Commit Graph

70 Commits

Author SHA1 Message Date
Nikesh Oswal 1702ac2fae ASoC: arizona: Fix bclk for sample rates that are multiple of 4kHz
commit e73694d871867cae8471d2350ce89acb38bc2b63 upstream.

For a sample rate of 12kHz the bclk was taken from the 44.1kHz table as
we test for a multiple of 8kHz. This patch fixes this issue by testing
for multiples of 4kHz instead.

Signed-off-by: Nikesh Oswal <Nikesh.Oswal@cirrus.com>
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-01-28 21:49:31 -08:00
Richard Fitzgerald d2099a5052 ASoC: arizona: Set FLL to free-run before disabling
commit 3e68ce1bc72e5d6615677ec5a8b0a9bcb6c7a490 upstream.

The FLL must be placed into free-run mode before disabling
to allow it to entirely shut down.

Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-04 10:55:48 -08:00
Mark Brown 1a2c7d568f ASoC: arizona: Add delay after powering up line level outputs
Ensure that the outputs are fully enabled before we begin passing audio
through them.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-26 18:49:04 +00:00
Mark Brown 49bc389ec2 ASoC/extcon: arizona: Fix interaction between HPDET and headphone outputs
This patch series covers both ASoC and extcon subsystems and fixes an
 interaction between the HPDET function and the headphone outputs - we
 really shouldn't run HPDET while the headphone is active.  The first
 patch is a refactoring to make the extcon side easier.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iQIcBAABAgAGBQJRUcMYAAoJELSic+t+oim9PkAP/RQWC98LrD3kQgVk22MIDdyk
 P7dr37AePy+nMHP/sp3XIVyeD6pwuRWrlf31jAgMsXSb/+8ymJ3oO3t6aPUa9V9+
 KsxxoSUW+/ZO+88aK4r/w/Y45XMqMXsoEwllIxZoEpHXhDIxYFyF8wloPBXLzzbw
 AALowigrNbeYuijr5R1oV+kUOcT8DpzbamoK0jSbpdBdoPEP3ypD/yJTdi/RSyu/
 ELRNZFy4jUw2B3HVOB1YxUeCPpPA63u1oTypFgD7XrQX5v4MDuWyCv5bbBd7KhBk
 vbK/PHti5CMvi5RbA2EHbkI+n/Lb1qfnxIggN5BaSOQ1tlqrHnMlHYoSE/Sjterh
 TDGyYDNrWU1Wve2NTDJEd8oECPwm+8ABBnRYgwtnth/4D/EFkT+6Pv8FuIlYg1ku
 Tj/jwS2q/q26WfssDOph/GfUXtaagMALY99yy/HXM9RPYztOnUyvJIXLzKUUdapT
 KluChggzbj5ytsSy3L808BkgDxYTwHxva4q+n0ST4hDIeqe95HyE8gZA8jrYOf7T
 oA4tsBL3i0YGkPoPkVhMY9qeV0AOwDVlZioGP9Qcs8EI/Z9Bri8NZ4iW8VWkNoTt
 QG7EyuJy90VI/XvGgpITXKXxWQStMZG4+df6pXcn1h47K6ujtDyK/PBBt3t0OPCp
 WihSDHwuFQPSDWYULbZQ
 =gc7f
 -----END PGP SIGNATURE-----

Merge tag 'arizona-extcon-asoc' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/misc into asoc-arizona

ASoC/extcon: arizona: Fix interaction between HPDET and headphone outputs

This patch series covers both ASoC and extcon subsystems and fixes an
interaction between the HPDET function and the headphone outputs - we
really shouldn't run HPDET while the headphone is active.  The first
patch is a refactoring to make the extcon side easier.
2013-03-26 17:16:14 +00:00
Mark Brown f607e31ce3 ASoC: arizona: Fix interaction between headphone outputs and identification
Running HPDET while the headphone outputs are enabled can disrupt the
operation of HPDET. In order to avoid this HPDET needs to disable the
headphone outputs and ASoC needs to not enable them while HPDET is
running.

Do the ASoC side of this by storing the enable state in the core driver
structure and only writing to the device if a flag indicating that the
accessory detection side is in a state where it can have the headphone
output stage enabled.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-26 15:45:25 +00:00
Wei Yongjun aed9913e6f ASoC: arizona: remove duplicated include from arizona.c
Remove duplicated include.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-26 14:04:58 +00:00
Mark Brown dc91428a61 ASoC: arizona: Basic support for ISRC rate selection
Since ASoC does not yet really have the framework features needed to
support propagating sample rates through the device well yet implement
basic support for the ISRCs equivalent to that we currently have for the
ASRCs. The user can opt for 8kHz or 16kHz as the rate for the DSP blocks
in addition to the main audio rate, these being the primary use cases.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-21 18:55:14 +01:00
Mark Brown f4a76e7cc6 ASoC: arizona: Suppress speaker enable if thermal shutdown is flagged
Ensure that the device state does not diverge from the state we have set
in the register map in order to make the behaviour clearer.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-21 18:55:13 +01:00
Mark Brown 899817e27a ASoC: arizona: Log thermal events
Help with debuggability.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-21 18:54:59 +01:00
Mark Brown 56447e1324 ASoC: arizona: Factor out speaker widgets from CODEC drivers
Some system designs have been identified which repurpose portions of the
speaker driver circuits for other functions which will require that they
not be managed using DAPM. Prepare for this by factoring out the creation
of the speaker widgets into the core driver, the widgets will be replaced
by dummy ones when the additional functions are enabled.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-21 18:54:18 +01:00
Mark Brown 76bf969e6f ASoC: arizona: Ensure we clock two channels for I2S mode
I2S requires stereo clocking even for mono data.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-13 19:03:17 +00:00
Mark Brown 3f341f741d ASoC: arizona: Provide defines for the clock rates
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-13 11:18:57 +00:00
Mark Brown 86cd684fcb ASoC: arizona: Suppress reference calculations when setting REFCLK to 0
Allow users to keep on specifying their output frequency when disabling
the reference clock.

Reported-by: Kyung Kwee Ryu <Kyung-Kwee.Ryu@wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-08 11:40:46 +08:00
Mark Brown eca2e8e24a ASoC: arizona: Ensure synchroniser is disabled when not needed
When live configuring a FLL configuration with no synchroniser disable the
synchroniser in case the previous configuration used one.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-08 11:40:28 +08:00
Mark Brown 8f113d7d26 ASoC: arizona: Optimise FLL loop gains
For optimal performance the FLL loop gain should be adjusted depending on
the frequency of the input clock for the loop.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-06 14:32:18 +08:00
Mark Brown 576411be20 ASoC: arizona: Increase FLL synchroniser bandwidth for high frequencies
If we are using a high freqency SYNCCLK then increasing the bandwidth of
the synchroniser improves performance.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-06 14:32:17 +08:00
Mark Brown ff680a1735 ASoC: arizona: If we only have a clock to synchronise with make it REFCLK
If there is only one clock active the FLL should use REFCLK rather than
SYNCCLK as the clock to synchronise with since REFCLK is always required.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-05 10:00:22 +08:00
Charles Keepax 1c5617fc23 ASoC: arizona: Don't enable FLL on REFCLK configuration
Enabling the FLL when REFCLK is being configured is not what the user
would expect and can cause issues if SYNCCLK has no specified frequency.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-04 11:01:01 +08:00
Mark Brown ddbce97cd1 ASoC: arizona: Only allow input volume updates when inputs are enabled
Since we are automatically managing the mutes we may as well also manage
the volume update bits, disabling volume updates while none of the inputs
are active. Since we are doing this we may as well allow the volumes to
ramp together so only enable volume updates once at the end of power up.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-04 11:01:01 +08:00
Charles Keepax f3f1163d19 ASoC: arizona: Add convience define for clearing SYNCCLK
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-04 11:01:01 +08:00
Charles Keepax ee929a9780 ASoC: arizona: Add support for directly setting the FLL REFCLK
This patch allows the REFCLK to be set directly allowing much greater
flexibility in how the FLLs are configured.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-04 11:01:00 +08:00
Charles Keepax de1e6eeddd ASoC: arizona: Improve suppression of noop FLL updates
Previously updates that only changes FLL source would be missed, this
patch corrects this. We also ensures that both REFCLK and SYNCCLK
frequency changes are considered, in preparation for future updates.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-04 11:01:00 +08:00
Charles Keepax 357228153b ASoC: arizona: Factor out FLL enable
In preparation for additional features on the FLL this patch factors out
the code for enabling an FLL into a seperate function.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-04 11:01:00 +08:00
Charles Keepax 7604054e13 ASoC: arizona: Factor out FLL disable
In preparation for additional features on the FLL this patch factors out
the code for disabling an FLL into a seperate function.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-04 11:01:00 +08:00
Charles Keepax d122d6c974 ASoC: arizona: Factor out check for enabled FLL
In preparation for additional features on the FLL this patch factors out
the code which checks if an FLL is currently enabled into a seperate
function.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-04 11:01:00 +08:00
Charles Keepax 9e359c645f ASoC: arizona: Tidy up SYNCCLK selection and cache values
This patch caches the current SYNCCLK settings in the arizona_fll struct
and uses these to simplify the code which determines which source should
be used for the REFCLK and SYNCCLK inputs.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-04 11:00:59 +08:00
Charles Keepax 19b34bdc6d ASoC: arizona: Move selection of FLL REFCLK into init
In preparation for additional features on the FLL this patch moves the
code selecting the REFCLK source based on the 32kHz clock into the FLL
initialisation function.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-04 11:00:59 +08:00
Mark Brown 43cd8bf1c8 ASoC: arizona: Automatically manage input mutes
For optimal performance the inputs should be kept muted until after power
up. Since there are few use cases for muting inputs during capture move
the mutes to automatic control.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-02-12 22:08:52 +00:00
Mark Brown 1f2e7a9001 Merge remote-tracking branch 'asoc/topic/arizona' into asoc-next 2013-02-11 11:06:25 +00:00
Mark Brown 9092a6ea16 ASoC: arizona: Fix debug logging level for FLLs and AIFs
Use _dbg for debug messages.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-02-07 11:41:19 +00:00
Ryo Tsutsui 01f58153ae ASoC: arizona: Fixed a bug in FLL fractional calculation
Previously arizona_calc_fll() was checking if the target frequency is
exactly divisible by reference frequency, but should have been product
of the ratio and the reference frequency.

Also scale down the Lamba and Theta coefficients be under 16-bits in
order to match the registers.

Signed-off-by: Ryo Tsutsui <ryo.tsutsui@wolfsonmicro.com>
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@vger.kernel.org
2013-02-04 18:29:04 +00:00
Mark Brown c94aa30eda ASoC: arizona: Allow number of channels clocked to be restricted
Place a cap on the number of channels clocks are generated for. This is
intended for use with systems which have the WM5102 master an I2S bus with
multiple data lines.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-21 17:47:39 +09:00
Mark Brown f2c26d48d9 ASoC: arizona: Support clearing clocks
Some systems may wish to support switching between telephony and CD audio
clock rates but this is restricted by enforcement of constraints on the
current DAI clock. Support setting clocks to zero and don't enforce any
constraints in that case in order to facilitate this use case.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-21 17:38:54 +09:00
Mark Brown 4706ccbbe8 Merge remote-tracking branch 'asoc/fix/arizona' into asoc-arizona
Conflicts:
	sound/soc/codecs/arizona.c
2013-01-17 15:31:54 +09:00
Mark Brown b59e0f82aa ASoC: arizona: Use actual rather than desired BCLK when calculating LRCLK
Otherwise we'll get the wrong LRCLK if we need to pick a higher BCLK than
is required.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@vger.kernel.org
2013-01-17 14:36:07 +09:00
Mark Brown c98137bfcb ASoC: arizona: Don't request FLL lock IRQ
We only log the result and since the interrupt triggers on loss of lock
during shutdown this may lead to spurious interrupts during shutdown
delaying the process.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-16 19:28:59 +09:00
Mark Brown f48aa39221 Merge remote-tracking branch 'asoc/fix/arizona' into asoc-arizona 2013-01-13 21:34:01 +09:00
Charles Keepax e31c194672 ASoC: arizona: Disable free-running mode on FLL1
The free running mode can cause problems when attempting to bring up the
FLL running from a defined clock source. This patch disables
free-running mode.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-08 18:01:17 +00:00
Mark Brown b272efc860 ASoC: arizona: Factor out rate selection code
In preparation for more advanced sample rate managment move the existing
code out of the main hw_params() function.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-04 21:30:21 +00:00
Mark Brown 66b6eaf23a Merge branch 'fix/arizona' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-arizona 2013-01-04 21:30:16 +00:00
Mark Brown bc9ab6d31c ASoC: arizona: Allow runtime reconfiguration of the output mode
Some systems use external analogue switches to connect more analogue
devices to the CODEC than are supported by the device.  In some systems
this requires changing the switched output from single ended to
differential mode dynamically at runtime. Add a new function
arizona_set_output_mode() to support this.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-04 21:20:59 +00:00
Mark Brown 91660bd65c ASoC: wm5102: Implement routing and power management for ISRCs
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-04 20:55:55 +00:00
Mark Brown d71753e22b ASoC: arizona: Remove DSP B and left justified AIF modes
These are not supported.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@vger.kernel.org
2013-01-04 11:33:22 +00:00
Axel Lin 7110a287ff ASoC: arizona: Do proper shift for setting AIF rate
ARIZONA_AIF1_RATE_MASK is 0x7800 /* AIF1_RATE - [14:11] */
Thus we need left shift ARIZONA_AIF1_RATE_SHIFT when setting aif1 rate.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@vger.kernel.org
2012-12-24 15:41:44 +00:00
Mark Brown 01df259f59 ASoC: arizona: Implement tristate support
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-12-24 15:39:23 +00:00
Mark Brown 845571cce6 ASoC: arizona: Add noise gate hold time enumeration
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-12-24 15:39:07 +00:00
Mark Brown daa5ab9e0d Merge remote-tracking branch 'asoc/topic/arizona' into asoc-next 2012-12-10 00:22:00 +09:00
Mark Brown e853a00f5f ASoC: arizona: Add volume ramp controls
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-12-09 12:34:53 +09:00
Mark Brown c8d35a6a3e ASoC: arizona: Log the clock we're setting the DAI to use
Useful for diagnostics.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-12-07 12:53:12 +09:00
Mark Brown 0c778e8633 ASoC: arizona: Store the DAI clock ID when setting
So the code to suppress duplicate changes is effective.

Reported-by: Kyung Kwee Ryu <Kyung-Kwee.Ryu@wolfsonmicro.comyu@wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-12-07 12:53:09 +09:00