mfd: arizona: Add register bits to support the ANC block

Some Arizona devices have a hardware ANC block present. This patch adds
the registers necessary to configure this hardware block.

Change-Id: I970dba7ab14f643c8f88e37f9b9942e60536f03b
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
ASoC: florida: Add DAPM/routing hookup for the ANC block

The Florida device contains a hardware ANC block, this patch connects up
controls and routing for this.

Change-Id: I344e3ad76b34620a8834ce1846c17efe66d1072f
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
ASoC: arizona: Do not test ratio zero as it is not a valid setting

Change-Id: I654a8b5fa07980875138abad07ed1b264ac808a2
Reported-by: Ryo Tsutsui <ryo.tsutsui@wolfsonmicro.com>
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
ASoC: arizona: Correct checking of FLL ratio limitations

The check to ensure the Fref frequency is within the bounds for the
current ratio, was placed in the wrong loop. The initial configuration
will always be valid and the loop lowering the ratio will only reinforce
this validity. The check should be on the loop increasing the ratio.
This could on occasion cause an invalid ratio/Fref combination to be
selected.

Change-Id: Ia7103d06c84ddd54c5a405cc6426ddde4629e739
Reported-by: Ryo Tsutsui <ryo.tsutsui@wolfsonmicro.com>
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
ASoC: arizona: Correct relationship between VCO corner and Fref

When configuring the FLL we must ensure that the reference clock passed
to the FLL is under a certain limit. This limit was specified
incorrectly in the current code, this patch corrects this. Although the
error will only be encountered in some edge cases.

Change-Id: I8fe58e97b9e02dba62416429ce684e54dae56e29
Reported-by: Ryo Tsutsui <ryo.tsutsui@wolfsonmicro.com>
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
ASoC: arizona: Coding standards, remove unneeded brackets

Change-Id: Id4ecff25cf1ea0a1a8c02872fc452db5c346ad7a
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
ASoC: arizona: Correct return value of arizona_is_enabled_fll

arizona_is_enabled_fll currently returns a bool, but can throw an error.
The error will be basically ignored and we will treat the FLL as already
on. This patch changes the return to be an int and adds error code to
propagate the error up to the callback.

Change-Id: I8680122f602e593e1cfa5e0ad012ba40d514cd58
Reported-by: Anil Kumar <anil.kumar@wolfsonmicro.com>
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
ASoC: arizona: FLL freerun only required whilst disabling

The FLL freerun is only required whilst we disable the FLL not the
entire time the FLL is disabled. This patch moves the FLL freerun
disable from the enable sequence to the disable sequence.

Change-Id: Id283cd579b5c7ae81abefdf6ff555ebb5b506dd8
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
ASoC: arizona: Update handling for input change on an active FLL

Currently, the driver places no restrictions on changes that can be
applied to an active FLL. However, it is only possible to change the
input for an active FLL, to change the output the FLL should be stopped
and then recofigured. This patch disallows changes in output frequency
and adds some additional handling to ensure the output remains
consistent across an input transitiion.

Change-Id: Ifb6173ba13ebd2e82f373bb94af0d23422778660
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
ASoC: arizona: Move chip type check into arizona_wm5102_set_dac_comp

In preparation for more refactoring move the check for the chip type
into arizona_wm5102_set_dac_comp.

Change-Id: I76d448adde2ac66abbc5b7e2f681e3d77567489e
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
mfd: arizona: Add ASYNC_SAMPLE_RATE_2 registers

Some arizona devices have a second asynchronous sample rate, add the
registers necessary to support this.

Change-Id: I86ea8f3c7a604629a7d6bca5d32f978a03420dd9
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
ASoC: arizona: Add support for linking an AIF to specific rate domains

Until we have better sample rate support in the ASoC core we need to
be able to link an AIF to a specific sample rate domain so we can
support different sample rates on the sample clock domain. This patch
adds support for this.

Change-Id: I6870e8b91278a40b9447b710e7faef8716e2ed9b
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
mfd: arizona: Disable PM runtime at start of driver removal

We don't want to trigger any PM runtime operations whilst we are tearing
down the driver, as things the suspend and resume callbacks rely on
might already have been destroyed. So disable PM runtime for the device
as the first step arizona_dev_exit.

Change-Id: I9b6b9197125d56180ad2000b0e58ee5f32d791f4
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
mfd: arizona: Disable DCVDD before we destroy the MFD

As DCVDD is probably supplied by a child of the MFD device move its
disable to before we destroy the MFD children as the regulator likely
won't exist after that.

Change-Id: Ief021333ae0fbddd9258dfe0058a871d0c1c871d
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
mfd: arizona: Don't use devres for DCVDD

Currently the Arizona core uses a devm_regulator_get against its own
device node to obtain DCVDD. The Arizona core is an MFD device and DCVDD
is usually supplied by a child node (arizona-ldo1) of the core. As
devres destruction for the MFD device will run after all its children
have been destroyed, the regulator will be destroyed before devres
calls regulator_put. This causes a warning from both the destruction of
the child node, as the regulator is still open, and from the put of the
regulator as the regulator device has already been destroyed.

This patch handles the regulator get and put without devres to avoid
this issue.

Change-Id: I86b3abc2ce7d9388de49e240f44cc82904607d67
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
mfd: arizona: Use num_core_supplies in arizona_dev_exit

Currently we call regulator_bulk_disable with
ARRAY_SIZE(arizona->core_supplies), however this array may be larger
than the number of supplies actually used by the chip we are dealing
with. Use the provided num_core_supplies member instead, so that we only
disable supplies which actually exist.

Change-Id: I0f80240e746a6537468c4292c38af0ea72af8791
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
mfd: arizona: Lower ARIZONA_MAX_CORE_SUPPLIES to 2

There are no Arizona devices with 3 core supplies but we define a fix
array with space for 3 core supplies. Lower the ARIZONA_MAX_CORE_SUPPLIES
define to 2, to save a few bytes.

Change-Id: I9c435bef2276b4134d3b5615b130eea16a871aea
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
mfd: arizona: Add comment to explain non-devm regulator_get

To avoid someone attempting to change this regulator_get back into a
devm_regulator_get put a comment in explaining that devres can't be used
here as the regulator will be destroyed before devres calls
regulator_put.

Change-Id: I0e09f37f61b4061ab8ccc736b73ad9f885e90dbd
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
ASoC: arizona: Mute all analog channels whilst clearing DAC

Mute all analogue channels whilst we are clearing the DAC after a
channel enable. This is to prevent pop noises appearing on the other
channels as the DAC clear affects all channels.

Change-Id: I0cdbc828f12e52d63fbddb592fdeb42eddc93ee3
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
mfd: wm5102: Correct default for LDO Control 2 register

Update the default value to match the patch.

Change-Id: I641371803ab7cadf9bd2e71555bb80b2917b1b95
Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>