ASOC: Add ADAU7118 8 Channel PDM-to-I2S/TDM Converter driver
Subsystems (4)
Nuno Sá
maintainerPATCH 1/2 ASOC: Add ADAU7118 8 Channel PDM-to-I2S/TDM Converter driver
This patch adds support for the 8 channel PDM-to-I2S/TDM converter. The ADAU7118 converts four stereo pulse density modulation (PDM) bitstreams into one pulse code modulation (PCM) output stream. The source for the PDM data can be eight microphones or other PDM sources. The PCM audio data is output on a serial audio interface port in either inter-IC serial (I2S) or time domain multiplexed (TDM) format.
--- MAINTAINERS | 1 + sound/soc/codecs/Kconfig | 28 ++ sound/soc/codecs/Makefile | 6 + sound/soc/codecs/adau7118-hw.c | 43 +++ sound/soc/codecs/adau7118-i2c.c | 82 +++++ sound/soc/codecs/adau7118.c | 621 ++++++++++++++++++++++++++++++++ sound/soc/codecs/adau7118.h | 24 ++ 7 files changed, 805 insertions(+) create mode 100644 sound/soc/codecs/adau7118-hw.c create mode 100644 sound/soc/codecs/adau7118-i2c.c create mode 100644 sound/soc/codecs/adau7118.c create mode 100644 sound/soc/codecs/adau7118.h
MAINTAINERS +1 -0
@@ -985,6 +985,7 @@ F: drivers/media/i2c/adv7842* ANALOG DEVICES INC ASOC CODEC DRIVERS M: Lars-Peter Clausen <[email protected]> +M: Nuno Sá <[email protected]> L: [email protected] (moderated for non-subscribers) W: http://wiki.analog.com/ W: http://ez.analog.com/community/linux-device-drivers
sound/soc/codecs/Kconfig +28 -0
@@ -34,6 +34,8 @@ config SND_SOC_ALL_CODECS select SND_SOC_ADAU1977_I2C if I2C select SND_SOC_ADAU1701 if I2C select SND_SOC_ADAU7002 + select SND_SOC_ADAU7118_I2C if I2C + select SND_SOC_ADAU7118_HW select SND_SOC_ADS117X select SND_SOC_AK4104 if SPI_MASTER select SND_SOC_AK4118 if I2C
@@ -392,6 +394,32 @@ config SND_SOC_ADAU1977_I2C config SND_SOC_ADAU7002 tristate "Analog Devices ADAU7002 Stereo PDM-to-I2S/TDM Converter" +config SND_SOC_ADAU7118 + tristate + +config SND_SOC_ADAU7118_HW + tristate "Analog Devices ADAU7118 8 Channel PDM-to-I2S/TDM Converter - HW Mode" + select SND_SOC_ADAU7118 + help + Enable support for the Analog Devices ADAU7118 8 Channel PDM-to-I2S/TDM + Converter. In this mode, the device works in standalone mode which + means that there is no bus to comunicate with it. Stereo mode is not + supported in this mode. + + To compile this driver as a module, choose M here: the module + will be called snd-soc-adau7118-hw. + +config SND_SOC_ADAU7118_I2C + tristate "Analog Devices ADAU7118 8 Channel PDM-to-I2S/TDM Converter - I2C" + select SND_SOC_ADAU7118 + select REGMAP_I2C + help + Enable support for the Analog Devices ADAU7118 8 Channel PDM-to-I2S/TDM + Converter over I2C. This gives full support over the device. + + To compile this driver as a module, choose M here: the module + will be called snd-soc-adau7118-i2c. + config SND_SOC_ADAV80X tristate
sound/soc/codecs/Makefile +6 -0
@@ -22,6 +22,9 @@ snd-soc-adau1977-objs := adau1977.o snd-soc-adau1977-spi-objs := adau1977-spi.o snd-soc-adau1977-i2c-objs := adau1977-i2c.o snd-soc-adau7002-objs := adau7002.o +snd-soc-adau7118-objs := adau7118.o +snd-soc-adau7118-i2c-objs := adau7118-i2c.o +snd-soc-adau7118-hw-objs := adau7118-hw.o snd-soc-adav80x-objs := adav80x.o snd-soc-adav801-objs := adav801.o snd-soc-adav803-objs := adav803.o
@@ -301,6 +304,9 @@ obj-$(CONFIG_SND_SOC_ADAU1977) += snd-soc-adau1977.o obj-$(CONFIG_SND_SOC_ADAU1977_SPI) += snd-soc-adau1977-spi.o obj-$(CONFIG_SND_SOC_ADAU1977_I2C) += snd-soc-adau1977-i2c.o obj-$(CONFIG_SND_SOC_ADAU7002) += snd-soc-adau7002.o +obj-$(CONFIG_SND_SOC_ADAU7118) += snd-soc-adau7118.o +obj-$(CONFIG_SND_SOC_ADAU7118_I2C) += snd-soc-adau7118-i2c.o +obj-$(CONFIG_SND_SOC_ADAU7118_HW) += snd-soc-adau7118-hw.o obj-$(CONFIG_SND_SOC_ADAV80X) += snd-soc-adav80x.o obj-$(CONFIG_SND_SOC_ADAV801) += snd-soc-adav801.o obj-$(CONFIG_SND_SOC_ADAV803) += snd-soc-adav803.o
sound/soc/codecs/adau7118-hw.c new file +43 -0
43 lines not on this page · raw message
sound/soc/codecs/adau7118-i2c.c new file +82 -0
82 lines not on this page · raw message
sound/soc/codecs/adau7118.c new file +621 -0
621 lines not on this page · raw message
sound/soc/codecs/adau7118.h new file +24 -0
@@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_ADAU7118_H +#define _LINUX_ADAU7118_H + +struct regmap ; +struct device ; + +/* register map */ +#define ADAU7118_REG_VENDOR_ID 0x00 +#define ADAU7118_REG_DEVICE_ID1 0x01 +#define ADAU7118_REG_DEVICE_ID2 0x02 +#define ADAU7118_REG_REVISION_ID 0x03 +#define ADAU7118_REG_ENABLES 0x04 +#define ADAU7118_REG_DEC_RATIO_CLK_MAP 0x05 +#define ADAU7118_REG_HPF_CONTROL 0x06 +#define ADAU7118_REG_SPT_CTRL1 0x07 +#define ADAU7118_REG_SPT_CTRL2 0x08 +#define ADAU7118_REG_SPT_CX (num) (0x09 + (num)) +#define ADAU7118_REG_DRIVE_STRENGTH 0x11 +#define ADAU7118_REG_RESET 0x12 + +int adau7118_probe (struct device *dev,struct regmap *map,bool hw_mode); + +#endif
Signature · 6 lines
2.23.0 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Nuno Sá
maintainerPATCH 2/2 dt-bindings: asoc: Add ADAU7118 documentation
Document the ADAU7118 8 channel PDM to I2S/TDM converter devicetree bindings.
--- .../bindings/sound/adi,adau7118.yaml | 88 +++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 89 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/adi,adau7118.yaml
Documentation/devicetree/bindings/sound/adi,adau7118.yaml new file +88 -0
@@ -0,0 +1,88 @@ +# SPDX-License-Identifier: GPL-2.0 +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/sound/adi,adau7118.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + + +title: Analog Devices ADAU7118 8 Channel PDM to I2S/TDM Converter + +maintainers: + - Nuno Sá <[email protected]> + +description: | + Analog Devices ADAU7118 8 Channel PDM to I2S/TDM Converter over I2C or HW + standalone mode. + https://www.analog.com/media/en/technical-documentation/data-sheets/ADAU7118.pdf + +properties: + compatible: + enum: + - adi,adau7118 + + reg: + maxItems: 1 + + "#sound-dai-cells": + const: 0 + + IOVDD-supply: + description: Digital Input/Output Power Supply. + $ref: "/schemas/types.yaml#/definitions/phandle" + + DVDD-supply: + description: Internal Core Digital Power Supply. + $ref: "/schemas/types.yaml#/definitions/phandle" + + adi,decimation-ratio: + description: | + This property set's the decimation ratio of PDM to PCM audio data. + allOf: + - $ref: /schemas/types.yaml#/definitions/uint32 + - enum: [64, 32, 16] + default: 64 + + adi,pdm-clk-map: + description: | + The ADAU7118 has two PDM clocks for the four Inputs. Each input must be + assigned to one of these two clocks. This property set's the mapping + between the clocks and the inputs. + allOf: + - $ref: /schemas/types.yaml#/definitions/uint32-array + - minItems: 4 + maxItems: 4 + items: + maximum: 1 + default: [0, 0, 1, 1] + +required: + - "#sound-dai-cells" + - compatible + +dependencies: + IOVDD-supply: [ DVDD-supply ] + DVDD-supply: [ IOVDD-supply ] + +examples: + - | + i2c0 { + /* example with i2c support */ + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + adau7118_codec: adau7118-codec@14 { + compatible = "adi,adau7118"; + reg = <14>; + #sound-dai-cells = <0>; + status = "okay"; + adi,pdm-clk-map = <1 1 0 0>; + adi,decimation-ratio = <16>; + }; + }; + + /* example with hw standalone mode */ + adau7118_codec_hw: adau7118-codec-hw { + compatible = "adi,adau7118"; + #sound-dai-cells = <0>; + status = "okay"; + };
MAINTAINERS +1 -0
@@ -996,6 +996,7 @@ F: sound/soc/codecs/ad1* F: sound/soc/codecs/ad7* F: sound/soc/codecs/ssm* F: sound/soc/codecs/sigmadsp.* +F: Documentation/devicetree/bindings/sound/adi,adau* ANALOG DEVICES INC DMA DRIVERS M: Lars-Peter Clausen <[email protected]>
Signature · 6 lines
2.23.0 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Mark Brown
maintainerRe: [alsa-devel] [PATCH 2/2] dt-bindings: asoc: Add ADAU7118 documentation
Documentation/devicetree/bindings/sound/adi,adau7118.yaml line 60
Quoted 3 lines · Nuno Sá
Documentation/devicetree/bindings/sound/adi,adau7118.yaml new file +3
-0+required: + - "#sound-dai-cells" + - compatible
The regulators should be listed as required too.
Mark Brown
maintainerQuoted 3 lines · Nuno Sá
This patch adds support for the 8 channel PDM-to-I2S/TDM converter. The ADAU7118 converts four stereo pulse density modulation (PDM) bitstreams into one pulse code modulation (PCM) output stream. The source for the PDM
This is the third copy of this I've got in the past 24 hours - there's no versioning or anything so what's going on?
Sa, Nuno
maintainerQuoted 10 lines · Mark Brown
[External]
Quoted 6 lines · Nuno Sá
This patch adds support for the 8 channel PDM-to-I2S/TDM converter. The
ADAU7118 converts four stereo pulse density modulation (PDM) bitstreams
into one pulse code modulation (PCM) output stream. The source for the PDM
Quoted 2 lines
This is the third copy of this I've got in the past 24 hours - there's no versioning or anything so what's going on?
That was my bad. The first patch I completely forgot to add the devicetree mailing list and reviewers. Then, I had some issues in subscribing my working email with the alsa mailing list that got fixed this morning. Either way, it was my mess and I apologize for the noise. It's all the same v1 patch (I should probably have used RESEND).
Nuno Sá
_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Mark Brown
maintainersound/soc/codecs/adau7118-hw.c line 7
Quoted 10 lines · Nuno Sá
sound/soc/codecs/adau7118-hw.c new file +7
-0@@ -0,0 +1,43 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Analog Devices ADAU7118 8 channel PDM-to-I2S/TDM Converter Standalone Hw +* driver +* +* Copyright 2019 Analog Devices Inc. +*/
Please make the entire comment a C++ style one in the .c files so things look more intentional.
Quoted 6 lines
sound/soc/codecs/adau7118-hw.c new file +6
-0+switch (fmt &SND_SOC_DAIFMT_FORMAT_MASK ) { +case SND_SOC_DAIFMT_I2S : + ret =snd_soc_component_update_bits (dai->component, +ADAU7118_REG_SPT_CTRL1 , +ADAU7118_DATA_FMT_MASK , +ADAU7118_DATA_FMT (0 ));
sound/soc/codecs/adau7118-hw.c line 23
Quoted 10 lines
sound/soc/codecs/adau7118-hw.c new file +10
-0+break ; +case SND_SOC_DAIFMT_LEFT_J : + ret =snd_soc_component_update_bits (dai->component, +ADAU7118_REG_SPT_CTRL1 , +ADAU7118_DATA_FMT_MASK , +ADAU7118_DATA_FMT (1 )); +break ; +case SND_SOC_DAIFMT_RIGHT_J : + st->right_j = true; +break ;
Don't we need to set any register values here?
sound/soc/codecs/adau7118-hw.c line 26
Quoted 3 lines
sound/soc/codecs/adau7118-hw.c new file +3
-0+ +return ret <0 ? ret :0 ; +}
Please don't use the ternery operator like this, it just makes things harder to read - write normal if conditional statements.
sound/soc/codecs/adau7118-hw.c line 31
Quoted 5 lines
sound/soc/codecs/adau7118-hw.c new file +5
-0+case SND_SOC_BIAS_STANDBY : +if (snd_soc_component_get_bias_level (component) == +SND_SOC_BIAS_OFF ) { +if (!st->iovdd) +return 0 ;
This is broken, the device will always require power so it should always control the regulators.
sound/soc/codecs/adau7118-hw.c line 41
Quoted 10 lines
sound/soc/codecs/adau7118-hw.c new file +10
-0+static int adau7118_suspend (struct snd_soc_component *component) +{ +return snd_soc_component_force_bias_level (component,SND_SOC_BIAS_OFF ); +} + +static int adau7118_resume (struct snd_soc_component *component) +{ +return snd_soc_component_force_bias_level (component, +SND_SOC_BIAS_STANDBY ); +}
Let DAPM do this for you, there's no substantial delays on power on so you're probably best just setting idle_bias_off.
sound/soc/codecs/adau7118-hw.c
Quoted 6 lines
sound/soc/codecs/adau7118-hw.c new file +6
-0+static int adau7118_regulator_setup (struct adau7118_data *st) +{ +int ret =0 ; + + st->iovdd =devm_regulator_get_optional (st->dev,"IOVDD" ); +if (!IS_ERR (st->iovdd)) {
Unless the device can operate with supplies physically absent it should not be requesting regulators as optional, this breaks your error handling especially with probe deferral which is a fairly common case.
Sa, Nuno
maintainerHi Mark,
Thanks for the review. Some comments/doubts inline. This device was my first contact with ASOC/sound devs so, I apologize if some of the comments/doubts are completely wrong/trivial.
Quoted 34 lines · Mark Brown
Quoted 11 lines · Nuno Sá
sound/soc/codecs/adau7118-hw.c new file +3
-0@@ -0,0 +1,43 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Analog Devices ADAU7118 8 channel PDM-to-I2S/TDM Converter Standalone Hw
+ * driver
+ *
+ * Copyright 2019 Analog Devices Inc.
+ */Please make the entire comment a C++ style one in the .c files so things look more intentional.
Quoted 16 lines
sound/soc/codecs/adau7118-hw.c new file +4
-0+switch (fmt &SND_SOC_DAIFMT_FORMAT_MASK ) { +case SND_SOC_DAIFMT_I2S : + ret =snd_soc_component_update_bits (dai->component, + ADAU7118_REG_SPT_CTRL1,
sound/soc/codecs/adau7118-hw.c new file +1
-0+ADAU7118_DATA_FMT_M ASK,
sound/soc/codecs/adau7118-hw.c new file +1
-0+ ADAU7118_DATA_FMT(0));
sound/soc/codecs/adau7118-hw.c new file +4
-0+break ; +case SND_SOC_DAIFMT_LEFT_J : + ret =snd_soc_component_update_bits (dai->component, + ADAU7118_REG_SPT_CTRL1,
sound/soc/codecs/adau7118-hw.c new file +1
-0+ADAU7118_DATA_FMT_M ASK,
Quoted 8 lines
sound/soc/codecs/adau7118-hw.c
Quoted 6 lines
sound/soc/codecs/adau7118-hw.c new file +1
-0+ ADAU7118_DATA_FMT(1));
sound/soc/codecs/adau7118-hw.c new file +4
-0+break ; +case SND_SOC_DAIFMT_RIGHT_J : + st->right_j = true; +break ;Don't we need to set any register values here?
The register set is done in adau7118_hw_params(). For right justification the device can delay bclck by 8, 12 or 16. So, We need to know the data_width to check if we can apply the configuration.
Quoted 6 lines
sound/soc/codecs/adau7118-hw.c
Quoted 3 lines
sound/soc/codecs/adau7118-hw.c new file +3
-0+ +return ret <0 ? ret :0 ; +}Please don't use the ternery operator like this, it just makes things harder to read - write normal if conditional statements.
ack.
Quoted 9 lines
sound/soc/codecs/adau7118-hw.c
Quoted 6 lines
sound/soc/codecs/adau7118-hw.c new file +3
-0+case SND_SOC_BIAS_STANDBY : +if (snd_soc_component_get_bias_level (component) == + SND_SOC_BIAS_OFF) {
sound/soc/codecs/adau7118-hw.c new file +2
-0+if (!st->iovdd) +return 0 ;This is broken, the device will always require power so it should always control the regulators.
The reason why I made this optional was to let the user assume that, in some cases, the supply can be always present (and not controlled by the kernel) and, in those cases, he would not have to care about giving regulators nodes in devicetree. Furthermore, the driver would not have to care about enabling/disabling regulators. Is this not a valid scenario? Or is it that, for this kind of devices it does not really make sense (which I think it doesn't) to have them always powered, so we just assume a regulator is needed (and in the unlikely scenario we don't have one, the user just provides a fixed-regulator)?
Quoted 7 lines
Quoted 7 lines
sound/soc/codecs/adau7118-hw.c new file +3
-0+static int adau7118_suspend (struct snd_soc_component *component) +{ + return snd_soc_component_force_bias_level(component,
SND_SOC_BIAS_OFF);sound/soc/codecs/adau7118-hw.c new file +3
-0+} + +static int adau7118_resume (struct snd_soc_component *component)
Quoted 8 lines
Quoted 5 lines
sound/soc/codecs/adau7118-hw.c new file +3
-0+{ +return snd_soc_component_force_bias_level (component, +SND_SOC_BIAS_STANDBY );
+}Let DAPM do this for you, there's no substantial delays on power on so you're probably best just setting
idle_bias_off.
So, this means dropping resume/suspend and to not set idle_bias_on, right?
Quoted 11 lines
sound/soc/codecs/adau7118-hw.c
Quoted 6 lines
sound/soc/codecs/adau7118-hw.c new file +6
-0+static int adau7118_regulator_setup (struct adau7118_data *st) +{ +int ret =0 ; + + st->iovdd =devm_regulator_get_optional (st->dev,"IOVDD" ); +if (!IS_ERR (st->iovdd)) {Unless the device can operate with supplies physically absent it should not be requesting regulators as optional, this breaks your error handling especially with probe deferral which is a fairly common case.
Just for my understanding (most likely I'm missing something obvious), why would I have issues with the error handling in probe deferral?
Thanks!
Nuno Sá
_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Mark Brown
maintainerQuoted 11 lines · Nuno
Quoted 5 lines · Mark Brown
sound/soc/codecs/adau7118.c line 169
Quoted 3 lines
sound/soc/codecs/adau7118.c new file +3
-0+case SND_SOC_DAIFMT_RIGHT_J : + st->right_j = true; +break ;Don't we need to set any register values here?
The register set is done in
adau7118_hw_params(). For right justification the device can delay bclck by 8, 12 or 16. So, We need to know thedata_widthto check if we can apply the configuration.
OK.
Quoted 10 lines
Quoted 9 lines
Review
Quoted 6 lines
sound/soc/codecs/adau7118.c new file +3
-0+case SND_SOC_BIAS_STANDBY : +if (snd_soc_component_get_bias_level (component) == + SND_SOC_BIAS_OFF) {
(quoted diff) +2
-0+ if (!st->iovdd) + return 0;This is broken, the device will always require power so it should always control the regulators.
Quoted 4 lines
The reason why I made this optional was to let the user assume that, in some cases, the supply can be always present (and not controlled by the kernel) and, in those cases, he would not have to care about giving regulators nodes in devicetree. Furthermore, the driver would not have
Have you tried doing that? Notice how the regulator API subtitutes in a dummy regulator for you and the driver works fine without custom code.
Quoted 2 lines
to care about enabling/disabling regulators. Is this not a valid scenario? Or is it that, for this kind of devices it does not really
It's not a valid scenario in driver code - the driver shouldn't be randomly ignoring errors and hoping the errors were deliberate rather than indiciations of real problems.
Quoted 10 lines
Quoted 9 lines
Quoted 6 lines
sound/soc/codecs/adau7118.c new file +4
-0+static int adau7118_resume (struct snd_soc_component *component) +{ +return snd_soc_component_force_bias_level (component, +SND_SOC_BIAS_STANDBY );
+}Let DAPM do this for you, there's no substantial delays on power on so you're probably best just setting
idle_bias_off.
Quoted 2 lines
So, this means dropping resume/suspend and to not set
idle_bias_on, right?
Right. Like I say it looks like your power up path is fast enough for this.
Quoted 12 lines
Quoted 11 lines
sound/soc/codecs/adau7118.c line 490
Quoted 6 lines
sound/soc/codecs/adau7118.c new file +6
-0+static int adau7118_regulator_setup (struct adau7118_data *st) +{ +int ret =0 ; + + st->iovdd =devm_regulator_get_optional (st->dev,"IOVDD" ); +if (!IS_ERR (st->iovdd)) {Unless the device can operate with supplies physically absent it should not be requesting regulators as optional, this breaks your error handling especially with probe deferral which is a fairly common case.
Quoted 2 lines
Just for my understanding (most likely I'm missing something obvious), why would I have issues with the error handling in probe deferral?
Actually it does look like you handle this correctly further down, the normal pattern would have been to have the error handling inside the if here and not indent the rest of the success path so I misread it.
Sa, Nuno
maintainerQuoted 32 lines · Mark Brown
Quoted 9 lines · Nuno
Quoted 4 lines · Mark Brown
sound/soc/codecs/adau7118.c line 169
Quoted 3 lines
sound/soc/codecs/adau7118.c new file +3
-0+case SND_SOC_DAIFMT_RIGHT_J : + st->right_j = true; +break ;Don't we need to set any register values here?
The register set is done in
adau7118_hw_params(). For right justification the device can delay bclck by 8, 12 or 16. So, We need to
know thedata_widthto check if we can apply the configuration.OK.
Quoted 10 lines
Quoted 10 lines
Review
Quoted 8 lines
(quoted diff) +2
-0+ case SND_SOC_BIAS_STANDBY: + if (snd_soc_component_get_bias_level(component)==
(quoted diff) +1
-0+ SND_SOC
_BIAS_OF
F) {(quoted diff) +2
-0+ if (!st->iovdd) + return 0;This is broken, the device will always require power so it should always control the regulators.
Quoted 7 lines
The reason why I made this optional was to let the user assume that, in
some cases, the supply can be always present (and not controlled by the
kernel) and, in those cases, he would not have to care about giving regulators nodes in devicetree. Furthermore, the driver would not have
Quoted 4 lines
Have you tried doing that? Notice how the regulator API subtitutes in a
dummy regulator for you and the driver works fine without custom code.
Ok, got it. Looking at _regulator_get I can see that a dummy regulator is provided, when NORMAL_GET is used, even if one was not given. So I think I get now the usage of devm_regulator_get_optional. As you said, supply voltages are not optional, the optional _get_ should be used for things that are really optional like some parts that can use external vs internal vref.
Quoted 45 lines
Quoted 3 lines
to care about enabling/disabling regulators. Is this not a valid scenario? Or is it that, for this kind of devices it does not really
It's not a valid scenario in driver code - the driver shouldn't be randomly ignoring errors and hoping the errors were deliberate rather than indiciations of real problems.
Quoted 10 lines
Quoted 10 lines
Quoted 8 lines
+static int
adau7118_resume(struct snd_soc_component *component)sound/soc/codecs/adau7118.c new file +3
-0+{ +return snd_soc_component_force_bias_level (component, + SND_SOC_BIAS_STANDBY)
;
+}Let DAPM do this for you, there's no substantial delays on power on so you're probably best just setting
idle_bias_off.Quoted 2 lines
So, this means dropping resume/suspend and to not set
idle_bias_on, right?Right. Like I say it looks like your power up path is fast enough for
this.Quoted 11 lines
Quoted 11 lines
sound/soc/codecs/adau7118.c line 490
Quoted 7 lines
sound/soc/codecs/adau7118.c new file +5
-0+static int adau7118_regulator_setup (struct adau7118_data *st) +{ +int ret =0 ; + + st->iovdd = devm_regulator_get_optional(st->dev,"IOVDD");
sound/soc/codecs/adau7118.c new file +1
-0+if (!IS_ERR (st->iovdd)) {Unless the device can operate with supplies physically absent it should not be requesting regulators as optional, this breaks your error handling especially with probe deferral which is a fairly common case.
Quoted 3 lines
Just for my understanding (most likely I'm missing something obvious),
why would I have issues with the error handling in probe deferral?Actually it does look like you handle this correctly further down, the
normal pattern would have been to have the error handling inside the if
here and not indent the rest of the success path so I misread it.