HSI changes for the v4.1 series

* nokia-modem: support speech data
 * misc. fixes
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABCgAGBQJVK8etAAoJENju1/PIO/qaKTkQAJnBnC6ZjhBVb7jBOqTvwDmu
 MUGQ62BXd2j9264zQ4lqJszDMo6mERY4B1GBlekWOZkCQhe+Dp3+ZdW12dP4OdbG
 baTXmIFo/OW7KiP1AIsWQU03Of323ke2jPlqDcYE/Uc/IdF4PkthdzmpfIC+cs2F
 DxSHIAyZhdLH4XCkfxP3g7TQK1rv+acOaYVod2RHrsuCkllTFEAUNpDUvfvEWWgL
 07ZOslPNQ4mjFT4sDVbqYRKVHullvMICxxuaksHte/FLePy7dUZOojLWrLf4yWK3
 plPrWiwVcyNAlNlPbQlKLRgUdAKfZys71jGhA1f4ww0vXErCDBtHTtrim5RZdKsN
 B25B4dq/w+JruFgWh+ItHjtSxfFoGxamwvFcMTxtQke7t0tK2fSlPtkAKki7cAtf
 m7Dn9dUrKWm1eVr/tOT7/Yyp3L8cmnlxL8QLr//QRkfggKbmKEpbPtjV5Zr6ppzP
 gOXSrjYkIYO1NLEJnmq+Ulz0N+4ck+RUagis4Nv8tSEShf/YSRqJWlreWJRzth+G
 yO1nmYQcWNGY1tGvEAZT6l63GZfpEaddMkRB0pLdplTzHkEiacecEqRMYJAd6ano
 Wc2FCQVso9BXXgPezbuw7XgGJ/Y6rgC/IjFjhLIZKXWKXYr3cju4z/jj/rSLoCd9
 TiIjyVYAIxFRcO8/NoSZ
 =iral
 -----END PGP SIGNATURE-----

Merge tag 'hsi-for-4.1' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-hsi

Pull HSI changes from Sebastian Reichel:

 - nokia-modem: support speech data
 - misc fixes

* tag 'hsi-for-4.1' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-hsi:
  HSI: cmt_speech: fix error return code
  HSI: nokia-modem: Add cmt-speech support
  HSI: cmt_speech: Add cmt-speech driver
  HSI: nokia-modem: fix error return code
This commit is contained in:
Linus Torvalds 2015-04-13 15:36:31 -07:00
commit 392b46f31f
6 changed files with 1615 additions and 3 deletions

View File

@ -6,13 +6,23 @@ comment "HSI clients"
config NOKIA_MODEM
tristate "Nokia Modem"
depends on HSI && SSI_PROTOCOL
depends on HSI && SSI_PROTOCOL && CMT_SPEECH
help
Say Y here if you want to add support for the modem on Nokia
N900 (Nokia RX-51) hardware.
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

View File

@ -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

File diff suppressed because it is too large Load Diff

View File

@ -46,6 +46,7 @@ struct nokia_modem_device {
struct nokia_modem_gpio *gpios;
int gpio_amount;
struct hsi_client *ssi_protocol;
struct hsi_client *cmt_speech;
};
static void do_nokia_modem_rst_ind_tasklet(unsigned long data)
@ -149,6 +150,7 @@ static int nokia_modem_probe(struct device *dev)
struct hsi_port *port = hsi_get_port(cl);
int irq, pflags, err;
struct hsi_board_info ssip;
struct hsi_board_info cmtspeech;
np = dev->of_node;
if (!np) {
@ -200,6 +202,7 @@ static int nokia_modem_probe(struct device *dev)
modem->ssi_protocol = hsi_new_client(port, &ssip);
if (!modem->ssi_protocol) {
dev_err(dev, "Could not register ssi-protocol device\n");
err = -ENOMEM;
goto error2;
}
@ -213,12 +216,35 @@ static int nokia_modem_probe(struct device *dev)
goto error3;
}
/* TODO: register cmt-speech hsi client */
cmtspeech.name = "cmt-speech";
cmtspeech.tx_cfg = cl->tx_cfg;
cmtspeech.rx_cfg = cl->rx_cfg;
cmtspeech.platform_data = NULL;
cmtspeech.archdata = NULL;
modem->cmt_speech = hsi_new_client(port, &cmtspeech);
if (!modem->cmt_speech) {
dev_err(dev, "Could not register cmt-speech device\n");
err = -ENOMEM;
goto error3;
}
err = device_attach(&modem->cmt_speech->device);
if (err == 0) {
dev_err(dev, "Missing cmt-speech driver\n");
err = -EPROBE_DEFER;
goto error4;
} else if (err < 0) {
dev_err(dev, "Could not load cmt-speech driver (%d)\n", err);
goto error4;
}
dev_info(dev, "Registered Nokia HSI modem\n");
return 0;
error4:
hsi_remove_client(&modem->cmt_speech->device, NULL);
error3:
hsi_remove_client(&modem->ssi_protocol->device, NULL);
error2:
@ -237,6 +263,11 @@ static int nokia_modem_remove(struct device *dev)
if (!modem)
return 0;
if (modem->cmt_speech) {
hsi_remove_client(&modem->cmt_speech->device, NULL);
modem->cmt_speech = NULL;
}
if (modem->ssi_protocol) {
hsi_remove_client(&modem->ssi_protocol->device, NULL);
modem->ssi_protocol = NULL;

View File

@ -1,2 +1,2 @@
# UAPI Header export list
header-y += hsi_char.h
header-y += hsi_char.h cs-protocol.h

View File

@ -0,0 +1,113 @@
/*
* cmt-speech interface definitions
*
* Copyright (C) 2008,2009,2010 Nokia Corporation. All rights reserved.
*
* Contact: Kai Vehmanen <kai.vehmanen@nokia.com>
* Original author: Peter Ujfalusi <peter.ujfalusi@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
*/
#ifndef _CS_PROTOCOL_H
#define _CS_PROTOCOL_H
#include <linux/types.h>
#include <linux/ioctl.h>
/* chardev parameters */
#define CS_DEV_FILE_NAME "/dev/cmt_speech"
/* user-space API versioning */
#define CS_IF_VERSION 2
/* APE kernel <-> user space messages */
#define CS_CMD_SHIFT 28
#define CS_DOMAIN_SHIFT 24
#define CS_CMD_MASK 0xff000000
#define CS_PARAM_MASK 0xffffff
#define CS_CMD(id, dom) \
(((id) << CS_CMD_SHIFT) | ((dom) << CS_DOMAIN_SHIFT))
#define CS_ERROR CS_CMD(1, 0)
#define CS_RX_DATA_RECEIVED CS_CMD(2, 0)
#define CS_TX_DATA_READY CS_CMD(3, 0)
#define CS_TX_DATA_SENT CS_CMD(4, 0)
/* params to CS_ERROR indication */
#define CS_ERR_PEER_RESET 0
/* ioctl interface */
/* parameters to CS_CONFIG_BUFS ioctl */
#define CS_FEAT_TSTAMP_RX_CTRL (1 << 0)
#define CS_FEAT_ROLLING_RX_COUNTER (2 << 0)
/* parameters to CS_GET_STATE ioctl */
#define CS_STATE_CLOSED 0
#define CS_STATE_OPENED 1 /* resource allocated */
#define CS_STATE_CONFIGURED 2 /* data path active */
/* maximum number of TX/RX buffers */
#define CS_MAX_BUFFERS_SHIFT 4
#define CS_MAX_BUFFERS (1 << CS_MAX_BUFFERS_SHIFT)
/* Parameters for setting up the data buffers */
struct cs_buffer_config {
__u32 rx_bufs; /* number of RX buffer slots */
__u32 tx_bufs; /* number of TX buffer slots */
__u32 buf_size; /* bytes */
__u32 flags; /* see CS_FEAT_* */
__u32 reserved[4];
};
/*
* Struct describing the layout and contents of the driver mmap area.
* This information is meant as read-only information for the application.
*/
struct cs_mmap_config_block {
__u32 reserved1;
__u32 buf_size; /* 0=disabled, otherwise the transfer size */
__u32 rx_bufs; /* # of RX buffers */
__u32 tx_bufs; /* # of TX buffers */
__u32 reserved2;
/* array of offsets within the mmap area for each RX and TX buffer */
__u32 rx_offsets[CS_MAX_BUFFERS];
__u32 tx_offsets[CS_MAX_BUFFERS];
__u32 rx_ptr;
__u32 rx_ptr_boundary;
__u32 reserved3[2];
/*
* if enabled with CS_FEAT_TSTAMP_RX_CTRL, monotonic
* timestamp taken when the last control command was received
*/
struct timespec tstamp_rx_ctrl;
};
#define CS_IO_MAGIC 'C'
#define CS_IOW(num, dtype) _IOW(CS_IO_MAGIC, num, dtype)
#define CS_IOR(num, dtype) _IOR(CS_IO_MAGIC, num, dtype)
#define CS_IOWR(num, dtype) _IOWR(CS_IO_MAGIC, num, dtype)
#define CS_IO(num) _IO(CS_IO_MAGIC, num)
#define CS_GET_STATE CS_IOR(21, unsigned int)
#define CS_SET_WAKELINE CS_IOW(23, unsigned int)
#define CS_GET_IF_VERSION CS_IOR(30, unsigned int)
#define CS_CONFIG_BUFS CS_IOW(31, struct cs_buffer_config)
#endif /* _CS_PROTOCOL_H */