ssip_xmit should be called from process context,
since it calls hsi_async_write.
Signed-off-by: Sebastian Reichel <sre@kernel.org>
Tested-by: Pavel Machek <pavel@ucw.cz>
To avoid setting irq_safe runtime pm flag in omap-ssi, multiple calls
will be moved to process context. This also affects ssi-protocol, so
use the safer spin_lock_bh instead of a simple spin_lock.
Signed-off-by: Sebastian Reichel <sre@kernel.org>
Tested-by: Pavel Machek <pavel@ucw.cz>
This avoids calling ssi_waketest(), while a spinlock is
being hold, since ssi_waketest may sleep once irq_safe
runtime pm is disabled.
Signed-off-by: Sebastian Reichel <sre@kernel.org>
Tested-by: Pavel Machek <pavel@ucw.cz>
Release &hi->lock before calling `cs_hsi_control_read_error' to avoid deadlock.
The bug was found using EBA (https://github.com/models-team/eba), which reported
the following:
Double lock
first at drivers/hsi/clients/cmt_speech.c:443
second at drivers/hsi/clients/cmt_speech.c:447
In cs_hsi_read_on_control_complete defined at drivers/hsi/clients/cmt_speech.c:438:
(!) drivers/hsi/clients/cmt_speech.c:443: spin_lock(& hi->lock);
(?) drivers/hsi/clients/cmt_speech.c:445: msg->status == 4 -> true
(!) drivers/hsi/clients/cmt_speech.c:447: cs_hsi_control_read_error(hi, msg);
(!) drivers/hsi/clients/cmt_speech.c:407: __cs_hsi_error_pre(hi, msg, "control read",
& hi->control_state);
(!) drivers/hsi/clients/cmt_speech.c:382: spin_lock(& hi->lock);
Signed-off-by: Iago Abal <mail@iagoabal.eu>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
Replace explicit computation of vma page count by a call to
vma_pages()
Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
When using the ssi-protocol driver with the Nokia N950, the
following error is thrown during modem powered up sequence.
[13852.274993] port0: SSI error: 0x01
[13852.279205] ssi-protocol ssi-protocol: RX error detected
[13852.284820] ssi-protocol ssi-protocol: Main state: 1
[13852.290069] ssi-protocol ssi-protocol: Recv state: 0
[13852.295288] ssi-protocol ssi-protocol: Send state: 0
[13852.300537] ssi-protocol ssi-protocol: CMT Offline
[13852.305603] ssi-protocol ssi-protocol: Wake test 1
[13852.310638] ssi-protocol ssi-protocol: Data RX id: 0
[13852.315887] ssi-protocol ssi-protocol: Data TX id: 0
[13856.001464] ssi-protocol ssi-protocol: Watchdog trigerred
[13856.007293] ssi-protocol ssi-protocol: Main state: 1
[13856.012542] ssi-protocol ssi-protocol: Recv state: 0
[13856.017761] ssi-protocol ssi-protocol: Send state: 0
[13856.023010] ssi-protocol ssi-protocol: CMT Offline
[13856.028045] ssi-protocol ssi-protocol: Wake test 0
[13856.033111] ssi-protocol ssi-protocol: Data RX id: 0
[13856.038330] ssi-protocol ssi-protocol: Data TX id: 0
This patch fixes the issue by using the handshake setup from
the Nokia N950 kernel. The new handshake sequence also works
with the N900, so there is no need to differentiate between
both modems.
Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
The Nokia N950 and Nokia N9 also have a SSI connected
modem, which use the same protocols as the Nokia N900,
but with increased link speed (96000 kbps instead of
55000 kbps) and with less GPIOs.
Since it's unclear, if the N950 and the N9 use exactly
the same modem, each of them gets their own compatible
string.
Acked-by: Rob Herring <robh@kernel.org>
Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
With two exceptions (drm/qxl and drm/radeon) all vm_operations_struct
structs should be constant.
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Reviewed-by: Oleg Nesterov <oleg@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Since 39b2bbe3d7 (gpio: add flags argument to gpiod_get*() functions)
which appeared in v3.17-rc1, the gpiod_get* functions take an additional
parameter that allows to specify direction and initial value for output.
Use this to simplify the driver. Furthermore this is one caller less
that stops us making the flags argument to gpiod_get*() mandatory.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
Reduce message priority from dev_err to dev_dbg for missing cmt-speech
or ssi-protocol drivers, since they will be probed again and it may
result in spamming the boot log.
Reported-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
The user interface for timestamps in the new cmt_speech
driver is broken in multiple ways:
- The layout is incompatible between 32-bit and 64-bit user
space, because of the size differences in 'struct timespec'.
This means that the driver can not work when used with 32-bit
user space on a 64-bit kernel.
- As there are plans to change 32-bit user space to use
a 64-bit time_t type in the future, it will also be
incompatible with new 32-bit user space.
- It is using ktime_get_ts under it's deprecated alias
(do_posix_clock_monotonic_gettime).
To keep support for the user space tools written for this driver (which
have lived many years out-of-tree), the interface has been hardened to
unsigned 32-bit values.
Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
Return a negative error code on failure.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@@
identifier ret; expression e1,e2;
@@
(
if (\(ret < 0\|ret != 0\))
{ ... return ret; }
|
ret = 0
)
... when != ret = e1
when != &ret
*if(...)
{
... when != ret = e2
when forall
return ret;
}
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
Register cmt-speech driver in nokia-modem driver and forward
hsi channel information.
Acked-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Tested-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
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.vehmanen@nokia.com>
Signed-off-by: Carlos Chinea <carlos.chinea@nokia.com>
Signed-off-by: Joni Lapilainen <joni.lapilainen@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)
Acked-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Tested-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
Return a negative error code on failure.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@@
identifier ret; expression e1,e2;
@@
(
if (\(ret < 0\|ret != 0\))
{ ... return ret; }
|
ret = 0
)
... when != ret = e1
when != &ret
*if(...)
{
... when != ret = e2
when forall
return ret;
}
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
modem->device was never initialized. This resulted in logs such as:
[ 241.386322] (NULL device *): CMT rst line change detected
Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
Return value of irq_of_parse_and_map() is unsigned int, with 0
indicating failure, so testing for negative result never works.
Signed-off-by: Dmitry Torokhov <dtor@chromium.org>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
The module documents, that 1 is the default, but
it actually isn't. This updates the module to use
pm=1 as default.
Signed-off-by: Sebastian Reichel <sre@kernel.org>
Remove the use of the IRQF_DISABLED flag
from drivers/hsi/clients/nokia-modem.c
It's a NOOP since 2.6.35 and it will be removed soon.
Signed-off-by: Michael Opdenacker <michael.opdenacker@free-electrons.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
* misc. fixes in SSI related drivers
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQIcBAABCgAGBQJT4WkMAAoJENju1/PIO/qaJHEP/jJbNgyl9Yk9/zSWPFmaU7NA
XlK1ul3Hqdni/iKk9kxDU+fnUs7JP2PYtpvbGKQGMSFsnKU5B4pEM79qcESUiEIT
TXYj/dimllJuxXAlqp6U+XRlQAqs0VWBdYoyQtR6rY9NijPW3k6tMN3DKwmJ9L2p
tDSTJnSQKmpARp/W+gOvcA0Jk68cVasAQqjbiZGTOPigHsLsUTeU2tYZnNi0qZpw
yZ0rF7qFiqtrQZ4tADe7BQgggW/UJponL0Xvb7rsORUfKDot4qx6Vy3tChCqVz6u
eKx1cm93yC8RVCVeLb0Wbt1RL8Xk2T6Pvk/5YdYS2v4Q3TN32BG5er2HJs+GFvlR
PeTDYwSncoNzFBp8HGIJRsp3rr1xg1N0/4mpYdrxHhs2/4AIcv+RIDGgcydzS6aV
obXxNyAHzsJzJTYPqfISATqxMYcVIa7/opt50x0XEdQ7NTBpPp5Wb6cLNROZ7x6t
q7Ku7c5bAkLL7VzDrs1oLWxrNCRBGLFmzrnUykeHPcT7SYsRZV8l2w8SEaYGc0W9
0Uhb2rZeOiBoPa2+tad9HHxcXJKi1XBX8Yj9/IclqWCJJt63CtBaddMPEof6xZpE
rGIVA/ut3azbqTgJ0si4HkO+/k/5apAJJW+CojTjzj8TqKn6JiToDnDWyOTJTbMV
JcW379525VV9luU82ssO
=jKr0
-----END PGP SIGNATURE-----
Merge tag 'hsi-for-3.17' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-hsi
Pull HSI changes from Sebastian Reichel:
"Misc fixes in SSI related drivers"
* tag 'hsi-for-3.17' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-hsi:
HSI: omap_ssi: Fix return value check in ssi_debug_add_ctrl()
HSI: omap_ssi_port: Fix return value check in ssi_debug_add_port()
HSI: ssi_protocol: Fix sparse non static symbol warning
drivers/hsi/controllers/omap_ssi{,_port}.c: fix failure checks
Fixes the following sparse warning:
drivers/hsi/clients/ssi_protocol.c:904:6: warning:
symbol 'ssip_port_event' was not declared. Should it be static?
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
The SSI protocol implementation has an incorrect dependency on the OMAP_SSI
driver, which allows SSI to be built-in while the underlying OMAP_SSI
implementation is a loadable module, causing a link error.
This changes the dependency to the simpler 'depends on OMAP_SSI' that also
ensures that SSI-protocol can only be a module if OMAP_SSI is not built-in.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Sebastian Reichel <sre@kernel.org>
Cc: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
Cc: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
The Nokia N900's modem is connected via Synchronous Serial Interface (SSI),
which is a legacy version of MIPI's High-speed Synchronous Serial Interface
(HSI).
The handles the GPIOs for enabling and resetting the modem and instanciates
ssi-protocol for data exchange. It does not yet support exchanging voice data
with the modem.
Signed-off-by: Sebastian Reichel <sre@kernel.org>
Reviewed-by: Pavel Machek <pavel@ucw.cz>
Tested-By: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
This adds a driver for the SSI McSAAB protocol as used in
the Nokia N900.
Signed-off-by: Carlos Chinea <carlos.chinea@nokia.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
Tested-By: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
Make HSI channel ids platform data, which can be provided
by platform data.
Signed-off-by: Sebastian Reichel <sre@kernel.org>
Tested-By: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
Fix return code check of alloc_chrdev_region, which
returns 0 on success.
Signed-off-by: Sebastian Reichel <sre@kernel.org>
Reviewed-by: Pavel Machek <pavel@ucw.cz>
CONFIG_HOTPLUG is going away as an option. As a result, the __dev*
markings need to be removed.
This change removes the use of __devinit, __devexit_p, __devinitdata,
__devinitconst, and __devexit from these drivers.
Based on patches originally written by Bill Pemberton, but redone by me
in order to handle some of the coding style issues better, by hand.
Cc: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Remove max_data_size sysfs entry. Otherwise is possible
to have a buffer overrun if its value is increased after
the device is open.
Signed-off-by: Carlos Chinea <carlos.chinea@nokia.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>