Re: [PATCHv3 1/2] HSI: cmt_speech: Add cmt-speech driver

2015-03-29 Thread Aaro Koskinen
Hi,

On Sat, Mar 21, 2015 at 08:09:16PM +0100, Sebastian Reichel wrote:
 From: Kai Vehmanen kai.vehma...@nokia.com
 
 Introduces the cmt-speech driver, which implements
 a character device interface for transferring speech
 data frames over HSI/SSI.
 
 The driver is used to exchange voice/speech data between
 the Nokia N900/N950/N9's modem and its cpu.
 
 Signed-off-by: Kai Vehmanen kai.vehma...@nokia.com
 Signed-off-by: Carlos Chinea carlos.chi...@nokia.com
 Signed-off-by: Joni Lapilainen joni.lapilai...@gmail.com

Acked-by: Aaro Koskinen aaro.koski...@iki.fi

A.
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCHv3 1/2] HSI: cmt_speech: Add cmt-speech driver

2015-03-21 Thread Sebastian Reichel
From: Kai Vehmanen kai.vehma...@nokia.com

Introduces the cmt-speech driver, which implements
a character device interface for transferring speech
data frames over HSI/SSI.

The driver is used to exchange voice/speech data between
the Nokia N900/N950/N9's modem and its cpu.

Signed-off-by: Kai Vehmanen kai.vehma...@nokia.com
Signed-off-by: Carlos Chinea carlos.chi...@nokia.com
Signed-off-by: Joni Lapilainen joni.lapilai...@gmail.com

Since the original driver has been written for 2.6.28 some
build fixes and general cleanups have been added by me:

 * fix build for 4.0 kernel
 * replace GFP_ATOMIC with GFP_KERNEL in cs_alloc_cmds()
 * add sanity check for CS_SET_WAKELINE ioctl
 * cleanup driver initialisation
 * rename driver to cmt-speech to be consistent with
   ssi-protocol driver
 * move cs-protocol.h to include/uapi/linux/hsi, since
   it describes a userspace API
 * replace hardcoded channels numbers with values provided
   via the HSI framework (e.g. coming from DT)

Signed-off-by: Sebastian Reichel s...@kernel.org
---
 drivers/hsi/clients/Kconfig  |   10 +
 drivers/hsi/clients/Makefile |1 +
 drivers/hsi/clients/cmt_speech.c | 1456 ++
 include/uapi/linux/hsi/Kbuild|2 +-
 include/uapi/linux/hsi/cs-protocol.h |  113 +++
 5 files changed, 1581 insertions(+), 1 deletion(-)
 create mode 100644 drivers/hsi/clients/cmt_speech.c
 create mode 100644 include/uapi/linux/hsi/cs-protocol.h

diff --git a/drivers/hsi/clients/Kconfig b/drivers/hsi/clients/Kconfig
index bc60dec..86c8495 100644
--- a/drivers/hsi/clients/Kconfig
+++ b/drivers/hsi/clients/Kconfig
@@ -13,6 +13,16 @@ config NOKIA_MODEM
 
If unsure, say N.
 
+config CMT_SPEECH
+   tristate CMT speech
+   depends on HSI  SSI_PROTOCOL
+   help
+   If you say Y here, you will enable the CMT speech protocol used
+   by Nokia modems. If you say M the protocol will be available as
+   module named cmt_speech.
+
+   If unsure, say N.
+
 config SSI_PROTOCOL
tristate SSI protocol
depends on HSI  PHONET  OMAP_SSI
diff --git a/drivers/hsi/clients/Makefile b/drivers/hsi/clients/Makefile
index 4d5bc0e..2607232 100644
--- a/drivers/hsi/clients/Makefile
+++ b/drivers/hsi/clients/Makefile
@@ -4,4 +4,5 @@
 
 obj-$(CONFIG_NOKIA_MODEM)  += nokia-modem.o
 obj-$(CONFIG_SSI_PROTOCOL) += ssi_protocol.o
+obj-$(CONFIG_CMT_SPEECH)   += cmt_speech.o
 obj-$(CONFIG_HSI_CHAR) += hsi_char.o
diff --git a/drivers/hsi/clients/cmt_speech.c b/drivers/hsi/clients/cmt_speech.c
new file mode 100644
index 000..e9560ef
--- /dev/null
+++ b/drivers/hsi/clients/cmt_speech.c
@@ -0,0 +1,1456 @@
+/*
+ * cmt_speech.c - HSI CMT speech driver
+ *
+ * Copyright (C) 2008,2009,2010 Nokia Corporation. All rights reserved.
+ *
+ * Contact: Kai Vehmanen kai.vehma...@nokia.com
+ * Original author: Peter Ujfalusi peter.ujfal...@nokia.com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+#include linux/errno.h
+#include linux/module.h
+#include linux/types.h
+#include linux/init.h
+#include linux/device.h
+#include linux/miscdevice.h
+#include linux/mm.h
+#include linux/slab.h
+#include linux/fs.h
+#include linux/poll.h
+#include linux/sched.h
+#include linux/ioctl.h
+#include linux/uaccess.h
+#include linux/pm_qos.h
+#include linux/hsi/hsi.h
+#include linux/hsi/ssi_protocol.h
+#include linux/hsi/cs-protocol.h
+
+#define CS_MMAP_SIZE   PAGE_SIZE
+
+struct char_queue {
+   struct list_headlist;
+   u32 msg;
+};
+
+struct cs_char {
+   unsigned intopened;
+   struct hsi_client   *cl;
+   struct cs_hsi_iface *hi;
+   struct list_headchardev_queue;
+   struct list_headdataind_queue;
+   int dataind_pending;
+   /* mmap things */
+   unsigned long   mmap_base;
+   unsigned long   mmap_size;
+   spinlock_t  lock;
+   struct fasync_struct*async_queue;
+   wait_queue_head_t   wait;
+   /* hsi channel ids */
+   int channel_id_cmd;
+   int channel_id_data;
+};
+
+#define SSI_CHANNEL_STATE_READING  1
+#define SSI_CHANNEL_STATE_WRITING  (1  1)
+#define SSI_CHANNEL_STATE_POLL (1  2)
+#define SSI_CHANNEL_STATE_ERROR