Commit Graph

32 Commits

Author SHA1 Message Date
Sagar Dharia
f8f603b5ca slim_msm: Add Device Tree support for Qualcomm SLIMBUS controller
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>
2012-03-30 11:11:21 -06:00
Sagar Dharia
31ac581ba1 slim_msm: Provision to support RX using interrupts if BAM fails
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>
2012-03-09 21:37:12 -07:00
Sagar Dharia
9acf7f4ee5 slim_msm: Use new clock APIs
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>
2012-03-08 09:59:22 -07:00
Sagar Dharia
69bf55767a slim_msm: Remove active channels of a satellite when it restarts
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>
2012-02-22 17:45:13 -07:00
Sagar Dharia
2e7026aae0 slimbus: Don't allow a grouped channel to be controlled individually
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>
2012-02-22 17:44:04 -07:00
Tianyi Gou
44a81b0adf msm: audio_slimbus: Register device with clock driver and rename clocks
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>
2012-02-14 09:58:15 -07:00
Sagar Dharia
b1c0acfb9e slim_msm: Initialize controller before clk_get is called.
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>
2012-02-09 08:05:05 -07:00
Sagar Dharia
0ffdca155e slim: msm: Enable satellite clients to request for specific channel
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>
2012-02-08 11:56:18 -08:00
Sagar Dharia
790cfd0872 slim: msm: Support multiple satellites per MSM controller
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>
2012-02-08 11:56:17 -08:00
Sagar Dharia
38fd18753e slim_msm: Make sure runtime PM reference count doesn't go -ve
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>
2012-02-06 18:36:38 -07:00
Sagar Dharia
29f35f08b9 slimbus: Provide separate APIs to connect source and sink ports
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>
2012-01-27 14:57:41 -07:00
Sagar Dharia
4ec2ff4a32 slimbus: Support more than 1 clients to use a channel
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>
2012-01-26 11:24:09 -07:00
Sagar Dharia
45e7791f4f slim: msm: Handle case where CONFIG_RUNTIME_PM may not be defined
Slimbus MSM controller voting will return -ENODEV if runtime
PM is not defined.

Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2012-01-10 10:02:55 -07:00
Sagar Dharia
d3ef30a363 slim: msm: Enable Runtime-PM for slimbus with error handling
Enable Runtime-PM and make sure error handling is done to avoid
unbalanced runtime-PM get/put votes.

Change-Id: Idcb8c2b0715719469b0e4dce68a4d6c9c261eff3
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2012-01-06 19:44:22 -07:00
Linux Build Service Account
04551f2530 Merge "slim: msm: Register MSM controller with framework before framer" into msm-3.0 2011-12-16 10:23:26 -08:00
Sagar Dharia
72007925ef slim: msm: Register MSM controller with framework before framer
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>
2011-12-13 21:14:26 -07:00
Jordan Crouse
9bb8aca892 slimbus: Fix a possible unitialized variable
Change-Id: Ic0dedbad60c44a3880082709b8aa94441f7033d1
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
2011-12-12 15:16:22 -07:00
Sagar Dharia
fb5826ad31 slim: msm: Disable runtime PM to avoid suspected slimbus lockup
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>
2011-11-30 15:35:07 -07:00
Sagar Dharia
45ee38a45b slim:msm: Add runtime PM to MSM slimbus controller
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>
2011-11-14 23:16:37 -07:00
Sagar Dharia
c6b33c3e45 slim: msm: Revert runtime-PM for Slimbus MSM controller
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>
2011-11-01 19:24:01 -06:00
Sagar Dharia
e676b64d88 slim: msm: Avoid race condition between runtime-pm timer & client
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>
2011-10-29 05:49:29 -06:00
Sagar Dharia
188ac3b34d slim: msm: Enable runtime PM after all devices report present
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>
2011-10-28 13:48:40 -06:00
Sagar Dharia
6b559e07ea slim:msm: Add runtime PM to MSM slimbus controller
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>
2011-10-20 14:42:24 -06:00
Sagar Dharia
cc969450f3 msm8960: slim: Program slimbus slew rate register
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>
2011-10-05 10:28:05 -07:00
Sagar Dharia
4d364c299d slim: Initialize return-value in port-allocation API
-EINVAL is returned if number of ports requested is 0

Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2011-10-05 10:27:54 -07:00
Sagar Dharia
e77961f2f2 slim: msm: Fix Klocwork reported issues in slim-msm controller driver
Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2011-10-04 17:13:51 -07:00
Sagar Dharia
cd0a2522c9 slimbus: Gracefully handle timeout for a synchronous read
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>
2011-10-03 16:20:59 -07:00
Sagar Dharia
144e5e03b5 msm_slim: Pause clock before disabling the reference clock.
Pause clock is used to conserve power and to make sure that reference
clock can be disabled.

Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
2011-10-03 16:20:59 -07:00
Sagar Dharia
33f34449d2 slimbus: Add clock pause support.
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>
2011-10-03 16:20:58 -07:00
Sagar Dharia
a0f6b6758a slimbus: Already active channels need to be modified in scheduling
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>
2011-10-03 16:14:58 -07:00
Sagar Dharia
98a7ecb14c slimbus: Support ability to specify maximum and minimum clock gears
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>
2011-10-03 10:27:10 -07:00
Bryan Huntsman
3f2bc4d6eb Initial Contribution
msm-2.6.38: tag AU_LINUX_ANDROID_GINGERBREAD.02.03.04.00.142

Signed-off-by: Bryan Huntsman <bryanh@codeaurora.org>
2011-10-03 09:57:10 -07:00