slim_ngd: Add NULL pointer check apart from error check

Check against NULL pointer after allocating
the memory for msm_slim_ctrl structure pointer
dynamically to avoid unexpected crashes.

Earlier this pointer is checked only for error
codes. In this patch NULL pointer check is also
added.

CRs-Fixed: 562417
Change-Id: I5cd731144f88b89ee412d19f110b3df6426186f7
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
slim_ngd: Handle runtime-pm resume error gracefully

Runtime-pm resume for satellite driver may fail if ADSP is going
through subsystem-restart. Handle that error, and set runtime-pm's
status to suspended if resume fails. Resume typically fails due to
failure to wake slimbus from pause_clock. Make sure another wakeup
can be tried later when ADSP comes back up

Change-Id: Ie9b798f5506de89a37491dbc3798acaa24b98808
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
slimbus: Manage channel slots only if framework manages bandwidth

If slimbus controller overrides bandwidth management, channel slots
should not be managed since controller is expected to do that.
Slimbus controller will go into idle mode due to this change when
channel setup/teardown is done. Make sure controller can transition
states correctly in runtime-pm suspend, and system-suspend case.

Change-Id: Id41aed822e3c98af8c1fe7db3a3527a1206739be
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
slim_msm: Rectify physical address type

Make sure physical address type is of correct type.

Change-Id: I9ec7a846e0fc14efd3627d141bb2228c8e56b2cc
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm: qmi: Match service version and instance during lookup

The remote subsystems construct instance_id from the version and service-
registered instance information. The version field is used to identify the
compatibility between client and service. The instance field is used to
uniquely identify a service from multiple instances of the same service_id
and version.

Currently the kernel QMI client interface matches only the instance during
the service lookup. Update the kernel QMI client interface to construct
instance_id from the version and instance information during lookup.

Change-Id: I2a4124ca8179d175d47c9468e907568a74281901
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
Slimbus: Correct the conditional check during channel removal

Use actual channel number to check if the channel to be
removed is present in the define_chan list before removing
it, instead of using the internal channel number used by
the frame work.

CRs-Fixed: 555260
Change-Id: I4c9521f7d228ca43c155fedf2c9ba5b8f86e2d3a
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
slimbus: Fix logical address notification mechanism

Make sure device-up/down notifications don't involve race condition,
and sub-system restart in such cases is handled gracefully

Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>

Conflicts:
	drivers/slimbus/slimbus.c
slim-ngd: NULL pointer check for client buffer

There is the chance of passing NULL pointer by the client
during the Slimbus/Codec transactions. Hence add NULL
pointer check for client buffer aswell.

CRs-Fixed: 608324
Change-Id: I161e8f04401afebb64ed72d5f392a67feb6ec13a
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>