summaryrefslogtreecommitdiff
path: root/sound/soc/codecs/cs42l51.c
AgeCommit message (Collapse)Author
2022-06-27ASoC: cs*: Remove now redundant non_legacy_dai_naming flagCharles Keepax
The ASoC core has now been changed to default to the non-legacy DAI naming, as such drivers using the new scheme no longer need to specify the non_legacy_dai_naming flag. Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20220623125250.2355471-50-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-06-03ASoC: cs42l51: Correct minimum value for SX volume controlCharles Keepax
The minimum value for the PGA Volume is given as 0x1A, however the values from there to 0x19 are all the same volume and this is not represented in the TLV structure. The number of volumes given is correct so this leads to all the volumes being shifted. Move the minimum value up to 0x19 to fix this. Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20220602162119.3393857-7-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-09ASoC: cs42l51: Remove redundant big endian formatsCharles Keepax
The CODEC already provides the endianness flag on its snd_soc_component_driver structure, specifying it is ambivalent to endian. The core will expand the formats to cover both endian types, as such remove the redundant specification of both endians. Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20220504170905.332415-6-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
2022-01-28ASoC: cs42l51: Improve error handling in cs42l51_remove()Uwe Kleine-König
When disabling a regulator fails while the device goes away, there is little we can do and the machine is probably in enough trouble that any action we'd want to take fails anyhow. The return value used to be passed on in cs42l51_i2c_remove() (i.e. the i2c device remove callback). But the i2c core ignores the error code (apart from emitting a generic warning) and removes the device anyhow. So return 0 unconditionally in cs42l51_i2c_remove(), and instead of returning the error code to the upper layer emit a more helpful warning message. After that nobody is interested any more in the actual error code, so let cs42l51_remove() return void. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20220110071832.306185-1-u.kleine-koenig@pengutronix.de Signed-off-by: Mark Brown <broonie@kernel.org>
2020-10-23ASoC: cs42l51: manage mclk shutdown delayOlivier Moysan
A delay must be introduced before the shutdown down of the mclk, as stated in CS42L51 datasheet. Otherwise the codec may produce some noise after the end of DAPM power down sequence. The delay between DAC and CLOCK_SUPPLY widgets is too short. Add a delay in mclk shutdown request to manage the shutdown delay explicitly. From experiments, at least 10ms delay is necessary. Set delay to 20ms as recommended in Documentation/timers/timers-howto.rst when using msleep(). Signed-off-by: Olivier Moysan <olivier.moysan@st.com> Link: https://lore.kernel.org/r/20201020150109.482-1-olivier.moysan@st.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-21ASoC: cs42l51: add additional ADC volume controlsGuillermo Rodríguez
Add volume controls for: - Analog programmable gain amplifier (PGA) (-3 .. +12 dB) - ADC attenuator (0 .. -96 dB) Signed-off-by: Guillermo Rodríguez <guille.rodriguez@gmail.com> Acked-by: David Rhodes <David.rhodes@cirrus.com> Link: https://lore.kernel.org/r/20200918134317.22574-1-guille.rodriguez@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-07-16ASoC: codecs: cs*: merge .digital_mute() into .mute_stream()Kuninori Morimoto
snd_soc_dai_digital_mute() is internally using both mute_stream() (1) or digital_mute() (2), but the difference between these 2 are only handling direction. We can merge digital_mute() into mute_stream int snd_soc_dai_digital_mute(xxx, int direction) { ... else if (dai->driver->ops->mute_stream) (1) return dai->driver->ops->mute_stream(xxx, direction); else if (direction == SNDRV_PCM_STREAM_PLAYBACK && dai->driver->ops->digital_mute) (2) return dai->driver->ops->digital_mute(xxx); ... } Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Reviewed-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Link: https://lore.kernel.org/r/87r1tlwiwe.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2020-06-22ASoC: codecs: cs*: rename to snd_soc_component_read()Kuninori Morimoto
We need to use snd_soc_component_read() instead of snd_soc_component_read32() This patch renames _read32() to _read() Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87a7134mc4.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
2019-12-09ASoC: cs42l51: add dac mux widget in codec routesOlivier Moysan
Add "DAC mux" DAPM widget in CS42l51 audio codec routes, to support DAC mux control and to remove error trace "DAC Mux has no paths" at widget creation. Note: ADC path of DAC mux is not routed in this patch. Signed-off-by: Olivier Moysan <olivier.moysan@st.com> Link: https://lore.kernel.org/r/20191203141627.29471-1-olivier.moysan@st.com Signed-off-by: Mark Brown <broonie@kernel.org>
2019-05-30treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 174Thomas Gleixner
Based on 1 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license version 2 as published by the free software foundation this program is distributed in the hope that it will be useful but without any warranty without even the implied warranty of merchantability or fitness for a particular purpose see the gnu general public license for more details extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 655 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Reviewed-by: Richard Fontana <rfontana@redhat.com> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190527070034.575739538@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-05ASoC: cs42l51: change mic bias DAPMOlivier Moysan
Use SND_SOC_DAPM_SUPPLY for mic bias DAPM instead of deprecated SND_SOC_DAPM_MICBIAS. Signed-off-by: Olivier Moysan <olivier.moysan@st.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-04-04ASoC: cs42l51: add adc volume controlOlivier Moysan
Add ADC boost volume control for CS42L51 codec. Signed-off-by: Olivier Moysan <olivier.moysan@st.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-04-04ASoC: cs42l51: add power managementOlivier Moysan
Add sleep PM callbacks to support system low power modes. Signed-off-by: Olivier Moysan <olivier.moysan@st.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-04-04ASoC: cs42l51: add support of master modeOlivier Moysan
Add support of master mode for cs42l51 cirrus audio codec. Signed-off-by: Olivier Moysan <olivier.moysan@st.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-04-04ASoC: cs42l51: add reset managementOlivier Moysan
Manage cs42l51 audio codec reset pin. Signed-off-by: Olivier Moysan <olivier.moysan@st.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-04-04ASoC: cs42l51: add regulator managementOlivier Moysan
Add cs42l51 audio codec power supply management through regulator framework. Signed-off-by: Olivier Moysan <olivier.moysan@st.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-04-01ASoC: cs42l51: add multi endpoint supportOlivier Moysan
Support multiple endpoints on cs42L51 codec port when used in of_graph context. This patch allows to share the codec port between two CPU DAIs. Example: STM32MP157C-DK2 board uses CS42L51 audio codec. This codec is connected to two serial audio interfaces, which are configured either as rx or tx. From AsoC point of view the topolgy is the following: // 2 CPU DAIs (SAI2A/B), 1 Codec (CS42L51) Playback: CPU-A-DAI(slave) -> (master)CODEC-DAI/port0 Record: CPU-B-DAI(slave) <- (master)CODEC-DAI/port0 In the DT two endpoints have to be associated to the codec port: cs42l51_port: port { cs42l51_tx_endpoint: endpoint@0 { remote-endpoint = <&sai2a_endpoint>; }; cs42l51_rx_endpoint: endpoint@1 { remote-endpoint = <&sai2b_endpoint>; }; }; However, when the audio graph card parses the codec nodes, it expects to find DAI interface indexes matching the endpoints indexes. The current patch forces the use of DAI id 0 for both endpoints, which allows to share the codec DAI between the two CPU DAIs for playback and capture streams respectively. Signed-off-by: Olivier Moysan <olivier.moysan@st.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-10-19ASoC: cs42l51: fix mclk supportOlivier Moysan
The MCLK clock is made optional for cs42l51 codec. However, ASoC DAPM clock supply widget, expects the clock to be defined unconditionally. Register MCLK DAPM conditionally in codec driver, depending on clock presence in DT. Fixes: 5e8d63a726f8 ("ASoC: cs42l51: add mclk support") Signed-off-by: Olivier Moysan <olivier.moysan@st.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-10-19ASoC: cs42l51: add mclk supportOlivier Moysan
Add MCLK dapm to allow configuration of cirrus CS42l51 codec as a master clock consumer. Signed-off-by: Olivier Moysan <olivier.moysan@st.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-02-12ASoC: cs42l51: replace codec to componentKuninori Morimoto
Now we can replace Codec to Component. Let's do it. Note: xxx_codec_xxx() -> xxx_component_xxx() .idle_bias_off = 0 -> .idle_bias_on = 1 .ignore_pmdown_time = 0 -> .use_pmdown_time = 1 - -> .endianness = 1 - -> .non_legacy_dai_naming = 1 Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-08-10ASoC: codecs: add const to snd_soc_codec_driver structuresBhumika Goyal
Declare snd_soc_codec_driver structures as const as they are only passed as an argument to the function snd_soc_register_codec. This argument is of type const, so declare the structures with this property as const. In file codecs/sn95031.c, snd_soc_codec_driver structure is also used in a copy operation along with getting passed to snd_soc_register_codec. So, it can be made const too. Done using Coccinelle: @match disable optional_qualifier@ identifier s; position p; @@ static struct snd_soc_codec_driver s@p={...}; @good1@ identifier match.s; position p; @@ snd_soc_register_codec(...,&s@p,...) @bad@ identifier match.s; position p!={match.p,good1.p}; @@ s@p @depends on !bad disable optional_qualifier@ identifier match.s; @@ static +const struct snd_soc_codec_driver s={...}; Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-08-08ASoC: codec duplicated callback function goes to component on cs42l51Kuninori Morimoto
codec driver and component driver has duplicated callback functions, and codec side functions are just copied to component side when register timing. This was quick-hack, but no longer needed. This patch moves these functions from codec driver to component driver. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-03-01ASoC: cs42l51: Fix enum ctl accesses in a wrong typeTakashi Iwai
"PCM channel mixer" ctl in cs42l51 codec driver is enum, while the current driver accesses wrongly via value.integer.value[]. They have to be via value.enumerated.item[] instead. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-12-08Merge remote-tracking branches 'asoc/topic/cs4265', 'asoc/topic/cs4271', ↵Mark Brown
'asoc/topic/cs42l51' and 'asoc/topic/cs42l73' into asoc-next
2014-11-21ASoC: cs42l51: Replace w->codec snd_soc_dapm_to_codec(w->dapm)Lars-Peter Clausen
The codec field of the snd_soc_widget struct is eventually going to be removed, use snd_soc_dapm_to_codec(w->dapm) instead. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Acked-by: Brian Austin <brian.austin@cirrus.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-12ASoC: cs42l51: re-hook of_match_table pointerThomas Petazzoni
In commit a1253ef6d3fa ("ASoC: cs42l51: split i2c from codec driver"), the I2C part of the CS42L51 was moved to a separate file, but the definition of the of_device_id array was left in the driver file itself, no longer connected to the platform_driver structure using the .of_match_table pointer. This commit exports the of_device_id array in cs42l51, and uses it as .of_match_able in cs42l51-i2c.c. This solution was suggested by Brian Austin. Fixes: a1253ef6d3fa ("ASoC: cs42l51: split i2c from codec driver") Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Acked-by: Brian Austin <brian.austin@cirrus.com> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: <stable@vger.kernel.org>
2014-05-22Merge remote-tracking branches 'asoc/topic/cs42l56', 'asoc/topic/cs42xx8' ↵Mark Brown
and 'asoc/topic/davinci' into asoc-next
2014-04-18ASoC: cs42l51: Fix mask for REVIDAxel Lin
The REVID mask was changed by commit a1253ef6d3fa "ASoC: cs42l51: split i2c from codec driver". Fix it. Signed-off-by: Axel Lin <axel.lin@ingics.com> Acked-by: Brian Austin <brian.austin@cirrus.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-16ASoC: cs42l51: split i2c from codec driverBrian Austin
This patch removes the i2c bus code from the codec driver and creates seperate i2c driver. Signed-off-by: Brian Austin <brian.austin@cirrus.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-14ASoC: Add snd_soc_kcontrol_codec() helper functionLars-Peter Clausen
For CODEC controls snd_kcontrol_chip() currently returns a pointer to the CODEC that registered the control. With the upcoming consolidation of platform and CODEC controls this will change. Prepare for this by introducing the snd_soc_kcontrol_codec() helper function that will hide the implementation details of how the CODEC for a control can be obtained. This will allow us to change this easily in the future. The patch also updates all CODEC drivers to use the new helper function. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-23Merge tag 'asoc-v3.15-2' into asoc-nextMark Brown
ASoC: Updates for v3.15 This is mostly a few additional fixes from Lars-Peter, a new driver and cleaning up a git failure with merging the Intel branch (combined with an xargs failure to pay attention to error codes). The history lists a bunch of additional commits for the branch but the content of those commits is actually present already but not recorded in history due to git failing. Unfortunately xargs is used in the merge script and it doesn't do a good job of noticing errors from the commands it invokes. # gpg: Signature made Thu 13 Mar 2014 14:25:44 GMT using RSA key ID 7EA229BD # gpg: Good signature from "Mark Brown <broonie@sirena.org.uk>" # gpg: aka "Mark Brown <broonie@debian.org>" # gpg: aka "Mark Brown <broonie@kernel.org>" # gpg: aka "Mark Brown <broonie@tardis.ed.ac.uk>" # gpg: aka "Mark Brown <broonie@linaro.org>" # gpg: aka "Mark Brown <Mark.Brown@linaro.org>"
2014-03-23Merge tag 'asoc-v3.15' into asoc-nextMark Brown
ASoC: Updates for v3.15 Quite a busy release for ASoC this time, more on janitorial work than exciting new features but welcome nontheless: - Lots of cleanups from Takashi for enumerations; the original API for these was error prone so he's refactored lots of code to use more modern APIs which avoid issues. - Elimination of the ASoC level wrappers for I2C and SPI moving us closer to converting to regmap completely and avoiding some randconfig hassle. - Provide both manually and transparently locked DAPM APIs rather than a mix of the two fixing some concurrency issues. - Start converting CODEC drivers to use separate bus interface drivers rather than having them all in one file helping avoid dependency issues. - DPCM support for Intel Haswell and Bay Trail platforms. - Lots of work on improvements for simple-card, DaVinci and the Renesas rcar drivers. - New drivers for Analog Devices ADAU1977, TI PCM512x and parts of the CSR SiRF SoC. # gpg: Signature made Wed 12 Mar 2014 23:05:45 GMT using RSA key ID 7EA229BD # gpg: Good signature from "Mark Brown <broonie@sirena.org.uk>" # gpg: aka "Mark Brown <broonie@debian.org>" # gpg: aka "Mark Brown <broonie@kernel.org>" # gpg: aka "Mark Brown <broonie@tardis.ed.ac.uk>" # gpg: aka "Mark Brown <broonie@linaro.org>" # gpg: aka "Mark Brown <Mark.Brown@linaro.org>"
2014-03-19ASoC: cs42l51: Fix SOC_DOUBLE_R_SX_TLV shift values for ADC, PCM, and Analog ↵Brian Austin
kcontrols The shift values for the ADC,PCM, and Analog kcontrols were wrong causing wrong values for the SOC_DOUBLE_R_SX_TLV macros Fixed the TLV for aout_tlv to show -102dB correctly Fixes: 1d99f2436d (ASoC: core: Rework SOC_DOUBLE_R_SX_TLV add SOC_SINGLE_SX_TLV) Reported-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Brian Austin <brian.austin@cirrus.com> Signed-off-by: Mark Brown <broonie@linaro.org> Cc: stable@vger.kernel.org
2014-03-13Merge remote-tracking branch 'asoc/topic/io' into asoc-nextMark Brown
2014-03-12Merge remote-tracking branches 'asoc/topic/tlv320aic23', ↵Mark Brown
'asoc/topic/tlv320aic26', 'asoc/topic/tlv320aic32x4', 'asoc/topic/tlv320aic3x', 'asoc/topic/tlv320dac33', 'asoc/topic/twl4030', 'asoc/topic/twl6040', 'asoc/topic/uda1380', 'asoc/topic/wl1273' and 'asoc/topic/wm2200' into asoc-next
2014-03-11ASoC: codec: Simplify ASoC probe code.Xiubo Li
For some CODEC drivers like who act as the MFDs children are ignored by this patch. Signed-off-by: Xiubo Li <Li.Xiubo@freescale.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-23ASoC: wm2200: Use SOC_ENUM_SINGLE_*_DECL()Takashi Iwai
Just replace with the helper macros. No functional change at all. Signed-off-by: Takashi Iwai <tiwai@suse.de> Acked-by: Liam Girdwood <liam.r.girdwood@linux.intel.com> Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-19ASoC: cs42l51: Remove unused variableSachin Kamat
‘cs42l51’ is not used. Remove it. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Acked-by: Brian Austin <brian.austin@cirrus.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-11ASoC: cs42l51: Convert to direct regmap API usageMark Brown
As part of phasing out the ASoC level register I/O code (which is now just a thin wrapper around regmap anyway) convert the cs42l51 driver to use the regmap API directly. We now no longer initialise the cache from hardware at startup, the regmap caches are smart enough to understand which registers are actually cached and read on demand. This should have no visible effect on the system. Signed-off-by: Mark Brown <broonie@linaro.org> Acked-by: Brian Austin <brian.austin@cirrus.com>
2014-02-11ASoC: cs42l51: Don't log if we fail to allocate memoryMark Brown
The VM subsystem already logs quite loudly if we run out of memory so don't bother here. Signed-off-by: Mark Brown <broonie@linaro.org> Acked-by: Brian Austin <brian.austin@cirrus.com>
2014-02-11ASoC: cs42l51: add Device Tree binding to cs42l51Thomas Petazzoni
This commit adds a trivial Device Tree binding to the I2C-based cs42l51 sound codec, so that it can be used from Device Tree based platforms. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-13ASoC: cs42l51: Use params_width() rather than memory formatMark Brown
Signed-off-by: Mark Brown <broonie@linaro.org>
2012-08-06ASoC: cs42l51: Use module_i2c_driverSachin Kamat
module_i2c_driver makes the code simpler by eliminating module_init and module_exit calls. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-04ASoC: codecs: Remove rtd->codec usage from CODEC driversMark Brown
In order to support CODEC<->CODEC links remove the assumption that there is only a single CODEC on a DAI link by removing the use of the CODEC pointer in the rtd from the CODEC drivers. They are already being passed their DAI whenever they are passed an rtd and can get the CODEC from there. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-03ASoC: core: Rework SOC_DOUBLE_R_SX_TLV add SOC_SINGLE_SX_TLVBrian Austin
Some codecs namely Cirrus Logic Codecs have a way of wrapping the dB scale around 0dB without 0dB being in the middle. Rework of SOC_DOUBLE_R_SX_TLV to be more consistent with other asoc tlv macros. Add single register macro : SOC_SINGLE_SX_TLV. Use snd_soc_info_volsw for .info Use snd_soc_get_volsw_sx, snd_soc_put_volsw_sx for single and double. kcontrols for CS42L51 and CS42L73 are adjusted to these new TLV Macros. The max value is determined by: (number of steps) +1 for 0dB +max from codec datasheet. Signed-off-by: Brian Austin <brian.austin@cirrus.com> Acked-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-02ASoC: Convert cs42l51 to devm_kzalloc()Axel Lin
Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-12-20ASoC: Convert cs42l51 to table based DAPM and control initAxel Lin
Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-27ASoC: Remove unneeded platform_device.h inclusions from CODECsMark Brown
They've not been needed for a long time if they were ever required. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-23Merge branch 'for-3.2' into for-3.3Mark Brown
2011-11-23ASoC: cs42l51: Fix off-by-one for reg_cache_sizeAxel Lin
Just checking the code in cs42l51_fill_cache(): The cache pointer points to codec->reg_cache + 1. I think it is because CS42L51_FIRSTREG is 0x01, so codec->reg_cache[0] is not used here. Then we read CS42L51_NUMREGS bytes to cache. So we need reg_cache_size to be CS42L51_NUMREGS + 1. Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>