kernel:sched:core: rename the rest of printk_sched to printk_deferred

Signed-off-by: Dan Trifan <jimsth@gmail.com>
ASoC: wcd9320: Add NULL checks

An failed device start is bad enough, don't crash the device.
Non-negative errors look a bit funny, though.

Signed-off-by: Dan Trifan <jimsth@gmail.com>
slim_msm: Optimize slimbus data port's connection with BAM pipe

Slimbus data port on apps side can be connected in any diretion (as
source, or as destination). BAM pipe connected to that port should
only be disconnected/reconnected if this port direction changes.
This helps with reducing calls to connect/disconnect BAM pipes.
Allocate descriptors to avoid getting descriptor-space from the
common pool and free them only when the port is deallocated.

Change-Id: Ie31acdb9e4c4bba12f1cc70d0c9ad7bf471b3056
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
slimbus: Fix port allocation and deallocation for manager's ports

Since Manager's ports don't have any direction when allocated, make
sure the direction is not checked when connect-port is called on a
manager port. Ensure that controller's port resourced are freed-up
when dealloc_mgrports is called.

Change-Id: I588408276cbee020623666b08433b57475cf47cc
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
slim_msm: ngd: Return success for channel removal during ADSP SSR

Slimbus master component resides on ADSP when this driver is used.
Wehn ADSP restarts, slimbus component goes down and bus is not
operational until it comes back up. During restart, slimbus clients
are notified since their device goes down, and the clients remove
channels and/or disconnect ports. Since bus is not operational,
return success for channel removal/port disconnection calls so that
the channel, port state is consistent with HW (not active, removed)

Change-Id: Ia2707ed9f3fc3573b5746c8e42fa7f229e0dea4f
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
slim_ngd: Return success for resource removal requests if HW restarts

Channel and ports are removed when HW restarts. Return success to
client channel removal, port disconnection requests when slimbus HW
is restarting.

Change-Id: Ifc9a3bb80023c823a7776a16fe32e5b59b181350
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
Slim_ngd: Don't create the device node per SSR

Observe the device crash due to the device node
gets created per ADSP SSR when the logical address
query succeeds at the first attempt.
This patch makes sure that the device node creation
happened only once  by declaring another variable to
track the logical address retry.

CRs-Fixed: 640381
Change-Id: I3d947fcbc575af7cb431255772aa9cb64d2df6b6
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
slim_ngd: notify slaves in some MDM restart scenarios

If MDM restarts when it had active framer, bus may lose sync.
Send device-down notification if that happens, and corresponding
reset-device and device-up notifications to slaves so that they
can act to restore their devices' communication over slimbus

CRs-Fixed: 612775
Change-Id: I83f22b9bcf18912c7c9507ea099691ed71d86a9f
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Signed-off-by: Naveen Kaje <nkaje@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm-slim-ngd: Read configurable external modem identifier

When an external modem is used, read the config from dt and use the
value in subsystem restart callback registration.

CRs-Fixed: 612775
Change-Id: I5e40e98a60c304c82741914157191cfb2f0697d5
Signed-off-by: Naveen Kaje <nkaje@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
slim_msm: Handle external-modem shutdown differently than restart

External modem may shutdown in cases other than subsystem-restart.
In that case, the power-up notification may not happen.
Handle such a scenario and make sure runtime-pm vote is not held
for more time than required, and that slave-device up/down/reset
notifications happen as expected if slimbus was down.

CRs-Fixed: 645450
Change-Id: I5fef2393c835d06c5ce1dc4f9cb62d418620211b
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
slim_msm_ngd: Add IPC logging support

Add IPC logging support for improved debugging
per device, and in memory to avoid using kernel
dmesg logs.

Logs are captured in four levels.
1) error level ---> All fatal errors are logged
2) warn level  ---> error level logs +
Warning messages are logged
3) Info level  ---> Error level +
warn level + the required information
for debugging is logged
4) Debug level ----> error level + warn level +
info level logs + extra information
for debugging are logged

Procedure to change the debug level at runtime:
==============================================
cd sys/devices/ctrl_num(eg:1234).slim
echo <log_level> > debug_mask

Procedure to collect the logs at run time:
=========================================
adb shell cat sys/kernel/debug/ipc_logging/ctrl_num.slim/log_cont
|tee slimbus.txt

CRs-Fixed: 645838
Change-Id: If183533472ee61b2d8cf458d228dd4ae2124dd37
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
ngd_slim: Decouple clock pause from power down/up

NGD slimbus driver itself can never send out clock pause sequence
for slimbus protocol on the HW lines since it can only be sent by
a manager device (which is controlled by ADSP when NGD driver is
instantiated from apps side).
Previously, clock pause of slimbus framework was coupled with power
down/up. That is not correct, since manager device may or may not
decide to send clock-pause on the HW lines. (e.g. if apps is inactive,
but some client on ADSP is active, clock-pause sequence won't be sent
over the bus.
Decouple power-on/off from clock pause to avoid giving incorrect
impression to clients on apps side about clock-pause state. Mark
clock-pause as unsupported by setting wakup function pointer to NULL
instead since this controller on apps cannot send it on HW lines.

CRs-Fixed: 667165
Change-Id: I382bca153deb2fed1d0f0672adaebde1e122dc68
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
sensors: change the ssc sensor class driver name

Change the ssc sensor class driver name from "sensors" to "ssc".
The ssc daemon will use the file "/dev/sensors", so this change
will not affect anything.

Change-Id: I0fbca0e4eeda18e6bedf7402b632114be1f9c3f8
Signed-off-by: Jie Cheng <rockiec@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
ARM: msm: Clean up sensor ADSP driver; OCMEM is no longer used

OCMEM is no longer used, hence, removing OCMEM related code from the
ADSP driver.

Change-Id: I2657923d02c462380c8d57a47493d93f073a566a
Acked-by: Kevin Smith <smithk@qti.qualcomm.com>
Signed-off-by: Satya Durga Srinivasu Prabhala <satyap@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm: ocmem: Add support for driver probe deferral

If a driver which needs to be probed before the ocmem
driver returns a EPROBE_DEFER, then the successive probe
of the ocmem driver will fail. Add support for probe
deferral in the ocmem driver.

CRs-Fixed: 552918
Change-Id: I887e67488e574fea6cb08cdaa6b1a342ab286c3a
Signed-off-by: Neeti Desai <neetid@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm: smem: split out shared memory initialization functionality

For historical reasons, the low level shared memory initialization
functionality exists in a combined driver with the higher level
communication protocols.  Move the low level shared memory functionality
out into its own driver to improve clarity and ease maintenance.

Change-Id: I675db52961df80d6e8e62e771630e562bf1a670c
Signed-off-by: Jeffrey Hugo <jhugo@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm: smem: add mpu based security support

Add support for the Memory Protection Unit (MPU) based shared memory
security feature.  This feature fragments shared memory into multiple
partitions and restricts access for each partition to a limited set of
processors which is enforced by MPUs.

Change-Id: I0878e1df3aad5aab49b845918be095c71956029d
Signed-off-by: Jeffrey Hugo <jhugo@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm: smem: clarify SBL misconfiguration error messages

SMEM must be initialized by the secondary bootloader (SBL) before Linux
is booted and the SMEM driver is initialized.  If it is not initialized,
error messages are printed and SMEM is disabled.  Some of these error
messages can be misinterpreted to be a Linux configuration issue instead
of an SBL issue which delays resolving the misconfiguration.

Add additional code comments and change the error messages to make it
clear that the SBL has not initialized SMEM.

Change-Id: I1d80245337fbfb708a070d56c65c293aed9a2b6b
Signed-off-by: Eric Holmberg <eholmber@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm: smem: add smem_get_free_space()

The smem_get_free_space() API is a private helper function to optimize the
SMD client's table scanning usecase.

Change-Id: I00b12bf3b667001f973fd5126278536b47e052f4
Signed-off-by: Jeffrey Hugo <jhugo@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm: smd: add sanity check on platform resources

Add null sanity checks to fix corner cases.

Change-Id: Ic91ca37d74621ad414d23d8756881ee866250745
Signed-off-by: Brent Hronik <bhronik@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>