Device Tree support is added for Qualcomm SLIMBUS controller and
documentation is provided for required and optional device node
properties.
Change-Id: Ic81e853431c413b06296470609ce55d0692e870b
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
If BAM registration fails or BAM pipe connection for slimbus-RX pipe
fails, driver falls back on using RX through CSRs and interrupts.
Change-Id: Icb621468a227cb826db43695fa74b30452fbf9c1
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Slimbus MSM controller driver calls clk_enable and clk_disable from
non-atomic contexts.
So the calls are just replaced by clk_prepare_enable and
clk_disable_unprepare respectively.
Change-Id: Ieaa5b62d58c153ac70c5d221888860231fedcf4e
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
When a subsystem hosting satellite restarts, it may not have cleaned
up its active channels. Remove all active channels when this is
detected. Other satellites, and channels already removed (if cleanup
was executed on the subsystem hosting satellite) are not affected.
Change-Id: I50ac40e450335a4fa5be957bacf997311410bee1
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Once client defines a group of channels, it should be only allowed to
be controlled as a group and not individually to avoid synchronization
issues between grouped channels.
Change-Id: Ib318497b2666eb5134a1cb220e5df6569c9fcc2e
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Rename the clocks per the new naming convention under which
similarly named clocks are distinguished between using their
associated device's name and ID.
Change-Id: If35cda86f35837d1c8c599147a6f4852390bbc96
Signed-off-by: Tianyi Gou <tgou@codeaurora.org>
Controller device name is initialzied in add_numbered_controller.
Make sure that's done before clk_get is called so that clk_get is
called with correct device name.
Change-Id: Ieace43accbb3cf8c37068dbc06067dfb76d67d36
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Since slimbus framework now supports clients to request a specific
channel number, channel number may be different than channel handle.
Channel numbers can range from 0-255 and channel handles returned by
slimbus framework may not be same as channel number. (e.g. if there
are 32 channel resources and the first channel number requested is
120, then it may get channel resource 24.)
This will enable 2 satellite clients (one as producer and one as
consumer) to connect to a specific channel.
Change-Id: I294c4d433daea15bc633dfea8a1e0648ccff3234
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Supporting multiple satellites per 1 controller enables communication
with more than 1 ADSP on target. There may be upto 2 ADSPs that MSM
controller driver needs to communicate with.
Change-Id: I9de96341ba0eee9da69bb48dc6d276374773633f
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Clients may vote for slimbus controller runtime using pm_runtime_get
and pm_runtime_put APIs. Make sure error is logged when client tries
to call pm_runtime_put more than/before pm_runtime_get and it's
not sent to the runtime PM framework to avoid reference count
going -ve.
Change-Id: I794d5df5e98477b3423c04537eb577383537b1c7
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Source and sink ports for a channel may be connected from different
clients.
Multiple sink ports and 1 source port can be connected to a channel.
Ports are freed/zeroed when channel is removed.
Change-Id: I165bb9db4fb43a9a884ea14ffed08f8d11b65c39
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
There is a possibility that 2 or more clients can use the same
channel, one as producer and the other(s) as sink.
The slim_query_ch API gives the ability for a client to specify
channel number it needs to use.
Reference counting is used to make sure channel is not deallocated
until the last caller deallocates it.
Another counter (def) is used to keep track of channel definition and
removal. Channel definition is sent to hardware when the producer
and/or consumer(s) connects ports to the channel. Channel is only
removed when all clients indicate they want to remove channel.
Change-Id: Ic5084680419e16ee238d2e62c02e5430170b387d
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Once framer starts clocking the bus, devices may start reporting.
Make sure framework registration and controller initialization
happens before the framer is initialized.
Change-Id: I7d5ee1776e2f6be8da157a5c2bd98459c1aea75e
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
It is suspected that runtime PM for slimbus controller may be
responsible for a slimbus register-access when slimbus core clock
is off.
Disable the runtime-PM for slimbus to avoid this scenario for now and
provide provision so that runtime-PM can be enabled from command line
if homescreen power needs to be reduced.
Change-Id: I6f9d8f00f5a5aefa56dfd8713172ed87c783e00d
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Runtime PM is used to turn clocks on and off when the controller is
not in use. There are 2 use-cases for the controller:
When the controller is used for messaging, pm_runtime_get is called
before sending the message. pm_runtime_put is called when message is
sent and/or response is received.
When the controller is used for data channels, pm_runtime_get is
called when data channel slot usage goes from 0 to non-zero.
pm_runtime_put can't be just called when data channel is scheduled
since data channel activity is going on until the data channel is
explicitly taken down. In that case, pm_runtime_put is called when
data channels are no longer using any slots on the bus.
pm_runtime_autosuspend is used to ensure that runtime_suspend doesn't
happen right after runtime enters idle state. This serves 2 purposes:
1. Resources aren't turned on/off too frequently.
2. There is a use case from audio where it does read/write to some
registers and the following data-channel setup happens from the LPASS
(satellite side). The timer ensures that there is no runtime_suspend
between these 2 activities.
Change-Id: I282e779380ae76058198e63c088aabfa3f1686fd
CRs-Fixed: 318901
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Using runtime-PM for slimbus MSM controller may cause some race
conditions (e.g. suspend callback is not guaranteed to be complete
when client calls pm_runtime_get_sync). Rely on system-wide suspend
resume callbacks till the race conditions are sorted out.
Change-Id: Ie41aa9fd64c437fc7e2f5699439ca78dedb74cde
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Avoid race condition where runtime-pm suspend (called from runtime-PM
timer) and client request (called through the slimbus framework)may
make unbalanced IRQ enable, or may not let client vote for runtime PM.
Since it's the controller (and not framework) which puts itself in
clock pause, controller should also get itself out of clock pause to
avoid this race condition.
Change-Id: I43656e1291bc8fee4fed3d3dfb53f3951cea48f5
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Report present messages are hardware initiated and those messages
may be missed if runtime PM disables clocks prematurely.
Make sure the messages are received before runtime PM is enabled.
Change-Id: I76f9332478d1825862c38071e62bc1d8e0d9aca4
CRs-Fixed: 315296
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Runtime PM is used to turn clocks on and off when the controller is
not in use. There are 2 use-cases for the controller:
When the controller is used for messaging, pm_runtime_get is called
before sending the message. pm_runtime_put is called when message is
sent and/or response is received.
When the controller is used for data channels, pm_runtime_get is
called when data channel slot usage goes from 0 to non-zero.
pm_runtime_put can't be just called when data channel is scheduled
since data channel activity is going on until the data channel is
explicitly taken down. In that case, pm_runtime_put is called when
data channels are no longer using any slots on the bus.
pm_runtime_autosuspend is used to ensure that runtime_suspend doesn't
happen right after runtime enters idle state. This serves 2 purposes:
1. Resources aren't turned on/off too frequently.
2. There is a use case from audio where it does read/write to some
registers and the following data-channel setup happens from the LPASS
(satellite side). The timer ensures that there is no runtime_suspend
between these 2 activities.
Change-Id: Ia9461fc08f5778057e9420af3307c46c53623e4a
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
If applicable, make sure that slimbus doesn't violate slew rate spec
by programming the slimbus slew rate register
CRs-Fixed: 307733
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Timed-out transaction is invalidated from the table of
active transactions so that it can be reused later.
This also ensures that stale transaction completion is not called on a
timed-out sync-read caller. This may happen if a synchronous read
fails due to timeout, and read-response is received after timeout.
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Clock pause message informs all devices on the bus that the active
manager having framer device pause the bus. This allows stopping the
clock to conserve power.
Clock is paused only if there are no active data channels on the bus
and no response is pending for any READ message.
Slimbus framework wakes up the controller using a wakeup function
pointer. Controller should then program the active framer to be out of
clock pause.
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
If new channels are scheduled, that may modify pre-existing channel's
segment interval, offset.
This patch modifies those fields of already active/suspended channels
if reconfiguration succeeds.
CRs-fixed: 300522
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
Slimbus can run in clock gears 1 through 10 per spec. Scheduling
algorithm tries to find the optimum clock gear depending on bandwidth
usage for messaging and active data channels.
However, not all controllers may have the ability to support all the
10 clock gears. This patch provides ability so that scheduling
algorithm will only run the bus in supported slimbus clock gear.
Controllers can specify supported minimum and maximum clock gear
during registration with the framework.
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>