On Mon, Jun 6, 2016 at 8:14 PM, Clemens Gruber clemens.gruber@pqgruber.com wrote:
From: Eric Nelson eric@nelint.com
Regulator support on SGTL5000 is broken because the VDDIO and VDDA and VDDD should be powered on before enabling MCLK as shown in Figure 4 of [1]. This requires moving control of the regulators from the codec block to the I2C block of the driver.
The bulk of this patch consists of swapping the codec device with the i2c client. The new field num_supplies in struct sgtl5000_priv is used instead of ARRAY_SIZE(supplies) to handle the special case when the internal LDO is used instead of external VDDD.
Note that ER1 in the SGTL5000 Errata document [2] suggests that all designs should use external VDDD.
Since the internal LDO can only be enabled after I2C is available, there's no benefit in treating it as a regulator, so this patch removes the regulator structure surrounding it.
Instead, a single block of code in sgtl5000_i2c_probe() performs the initialization sequence in section 2.2.1.1 of [3] and page 26 of [1].
References: [1] SGTL5000 data sheet http://cache.nxp.com/files/analog/doc/data_sheet/SGTL5000.pdf [2] SGTL5000 errata http://cache.nxp.com/files/analog/doc/errata/SGTL5000ER.pdf [3] SGTL5000 Initialization and programming app note http://cache.nxp.com/files/analog/doc/app_note/AN3663.pdf
Signed-off-by: Eric Nelson eric@nelint.com Signed-off-by: Clemens Gruber clemens.gruber@pqgruber.com
Tested-by: Fabio Estevam fabio.estevam@nxp.com