* [PATCH 0/4] ASoC: codecs: adau1373: drop platform data
@ 2024-10-21 13:46 Nuno Sa
2024-10-21 13:46 ` [PATCH 1/4] ASoC: codecs: adau1373: add some kconfig text Nuno Sa
` (3 more replies)
0 siblings, 4 replies; 11+ messages in thread
From: Nuno Sa @ 2024-10-21 13:46 UTC (permalink / raw)
To: linux-sound, devicetree
Cc: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
Lars-Peter Clausen, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Main motivation for this was to just add support for a powerdown GPIO.
Then, I realized the driver was using platdata which is not being used by
any platform. Hence, move to support FW properties and add bindings
docs.
---
Nuno Sa (4):
ASoC: codecs: adau1373: add some kconfig text
ASoC: dt-bindings: document the adau1373 Codec
ASoC: codecs: adau1373: drop patform_data
ASoC: codecs: adau1373: add powerdown gpio
.../devicetree/bindings/sound/adi,adau1373.yaml | 102 +++++++++++
MAINTAINERS | 1 +
include/sound/adau1373.h | 33 ----
sound/soc/codecs/Kconfig | 2 +-
sound/soc/codecs/adau1373.c | 198 ++++++++++++++++-----
5 files changed, 253 insertions(+), 83 deletions(-)
---
base-commit: cab655772416379a925af9ea85769a9d3eecdba0
change-id: 20241018-adau1373-shutdown-dc3d485a7d86
--
Thanks!
- Nuno Sá
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 1/4] ASoC: codecs: adau1373: add some kconfig text
2024-10-21 13:46 [PATCH 0/4] ASoC: codecs: adau1373: drop platform data Nuno Sa
@ 2024-10-21 13:46 ` Nuno Sa
2024-10-21 13:46 ` [PATCH 2/4] ASoC: dt-bindings: document the adau1373 Codec Nuno Sa
` (2 subsequent siblings)
3 siblings, 0 replies; 11+ messages in thread
From: Nuno Sa @ 2024-10-21 13:46 UTC (permalink / raw)
To: linux-sound, devicetree
Cc: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
Lars-Peter Clausen, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Add some text to 'tristate' so that we can actually enable the driver
when using things like menuconfig.
Signed-off-by: Nuno Sa <nuno.sa@analog.com>
---
sound/soc/codecs/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index 6a6125e94d2dc094b10c6f2fb53dd447e831f23d..72643907cef737ab4504ebac78b2bf7b4a8ead68 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -464,7 +464,7 @@ config SND_SOC_ADAU1372_SPI
select REGMAP_SPI
config SND_SOC_ADAU1373
- tristate
+ tristate "Analog Devices ADAU1373 CODEC"
depends on I2C
select SND_SOC_ADAU_UTILS
--
2.47.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 2/4] ASoC: dt-bindings: document the adau1373 Codec
2024-10-21 13:46 [PATCH 0/4] ASoC: codecs: adau1373: drop platform data Nuno Sa
2024-10-21 13:46 ` [PATCH 1/4] ASoC: codecs: adau1373: add some kconfig text Nuno Sa
@ 2024-10-21 13:46 ` Nuno Sa
2024-10-22 6:06 ` Krzysztof Kozlowski
2024-10-21 13:46 ` [PATCH 3/4] ASoC: codecs: adau1373: drop patform_data Nuno Sa
2024-10-21 13:46 ` [PATCH 4/4] ASoC: codecs: adau1373: add powerdown gpio Nuno Sa
3 siblings, 1 reply; 11+ messages in thread
From: Nuno Sa @ 2024-10-21 13:46 UTC (permalink / raw)
To: linux-sound, devicetree
Cc: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
Lars-Peter Clausen, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Describe the adau1373 Low Power Codec with Speaker and
Headphone Amplifier.
While at it, properly add a MAINTAINERS entry for ADI sound bindings.
Signed-off-by: Nuno Sa <nuno.sa@analog.com>
---
.../devicetree/bindings/sound/adi,adau1373.yaml | 102 +++++++++++++++++++++
MAINTAINERS | 1 +
2 files changed, 103 insertions(+)
diff --git a/Documentation/devicetree/bindings/sound/adi,adau1373.yaml b/Documentation/devicetree/bindings/sound/adi,adau1373.yaml
new file mode 100644
index 0000000000000000000000000000000000000000..b2b5b2226ed7b354f2fb7871c17272b347921fa5
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/adi,adau1373.yaml
@@ -0,0 +1,102 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/adi,adau1373.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+
+title: Analog Devices ADAU1373 CODEC
+
+maintainers:
+ - Nuno Sá <nuno.sa@analog.com>
+
+description: |
+ Analog Devices ADAU1373 Low power codec with speaker and headphone amplifiers.
+ https://www.analog.com/media/en/technical-documentation/data-sheets/ADAU1373.pdf
+
+allOf:
+ - $ref: dai-common.yaml#
+
+properties:
+ compatible:
+ enum:
+ - adi,adau1373
+
+ reg:
+ maxItems: 1
+
+ "#sound-dai-cells":
+ const: 0
+
+ powerdown-gpios:
+ description: GPIO used for hardware power-down.
+ maxItems: 1
+
+ adi,micbias1-microvolt:
+ description:
+ This property sets the microphone bias voltage for the first microphone.
+ enum: [1800000, 2200000, 2600000, 2900000]
+ default: 2900000
+
+ adi,micbias2-microvolt:
+ description:
+ This property sets the microphone bias voltage for the second microphone.
+ enum: [1800000, 2200000, 2600000, 2900000]
+ default: 2900000
+
+ adi,input1-differential:
+ description: This property sets the first analog input as differential.
+ type: boolean
+
+ adi,input2-differential:
+ description: This property sets the second analog input as differential.
+ type: boolean
+
+ adi,input3-differential:
+ description: This property sets the third analog input as differential.
+ type: boolean
+
+ adi,input4-differential:
+ description: This property sets the fourth analog input as differential.
+ type: boolean
+
+ adi,lineout-differential:
+ description: This property sets the line output as differential.
+ type: boolean
+
+ adi,lineout-gnd-sense:
+ description: This property enables the line output ground sense control.
+ type: boolean
+
+ adi,drc-settings:
+ description:
+ This setting is used to control the dynamic range of the signal. The
+ device provides a maximum of three full band DRCs with 13 entries each.
+ $ref: /schemas/types.yaml#/definitions/uint8-array
+ oneOf:
+ - minItems: 13
+ - minItems: 26
+ - minItems: 39
+
+required:
+ - "#sound-dai-cells"
+ - compatible
+ - reg
+
+unevaluatedProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/gpio/gpio.h>
+
+ i2c {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ audio-codec@1a {
+ compatible = "adi,adau1373";
+ reg = <0x1a>;
+ #sound-dai-cells = <0>;
+ powerdown-gpios = <&gpio 100 GPIO_ACTIVE_LOW>;
+ };
+ };
+...
diff --git a/MAINTAINERS b/MAINTAINERS
index c1a2c296446c0724a0c6e70c845e5e5e1e693fd5..a3bf361f7b80774ae2228f2d71a3f477eb497ec5 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1521,6 +1521,7 @@ L: linux-sound@vger.kernel.org
S: Supported
W: http://wiki.analog.com/
W: https://ez.analog.com/linux-software-drivers
+F: Documentation/devicetree/bindings/sound/adi,*
F: sound/soc/codecs/ad1*
F: sound/soc/codecs/ad7*
F: sound/soc/codecs/adau*
--
2.47.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 3/4] ASoC: codecs: adau1373: drop patform_data
2024-10-21 13:46 [PATCH 0/4] ASoC: codecs: adau1373: drop platform data Nuno Sa
2024-10-21 13:46 ` [PATCH 1/4] ASoC: codecs: adau1373: add some kconfig text Nuno Sa
2024-10-21 13:46 ` [PATCH 2/4] ASoC: dt-bindings: document the adau1373 Codec Nuno Sa
@ 2024-10-21 13:46 ` Nuno Sa
2024-10-21 13:46 ` [PATCH 4/4] ASoC: codecs: adau1373: add powerdown gpio Nuno Sa
3 siblings, 0 replies; 11+ messages in thread
From: Nuno Sa @ 2024-10-21 13:46 UTC (permalink / raw)
To: linux-sound, devicetree
Cc: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
Lars-Peter Clausen, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
struct adau1373_platform_data" was not being used by any platform.
Hence, drop it and move to firmware based support. All the
configurations quirks present in the platform_data are now supported as
firmware properties.
Signed-off-by: Nuno Sa <nuno.sa@analog.com>
---
include/sound/adau1373.h | 33 --------
sound/soc/codecs/adau1373.c | 180 ++++++++++++++++++++++++++++++++------------
2 files changed, 132 insertions(+), 81 deletions(-)
diff --git a/include/sound/adau1373.h b/include/sound/adau1373.h
deleted file mode 100644
index 4c32ba1328eda75f405047ce0f920791f348b98c..0000000000000000000000000000000000000000
--- a/include/sound/adau1373.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/*
- * Analog Devices ADAU1373 Audio Codec drive
- *
- * Copyright 2011 Analog Devices Inc.
- * Author: Lars-Peter Clausen <lars@metafoo.de>
- */
-
-#ifndef __SOUND_ADAU1373_H__
-#define __SOUND_ADAU1373_H__
-
-enum adau1373_micbias_voltage {
- ADAU1373_MICBIAS_2_9V = 0,
- ADAU1373_MICBIAS_2_2V = 1,
- ADAU1373_MICBIAS_2_6V = 2,
- ADAU1373_MICBIAS_1_8V = 3,
-};
-
-#define ADAU1373_DRC_SIZE 13
-
-struct adau1373_platform_data {
- bool input_differential[4];
- bool lineout_differential;
- bool lineout_ground_sense;
-
- unsigned int num_drc;
- uint8_t drc_setting[3][ADAU1373_DRC_SIZE];
-
- enum adau1373_micbias_voltage micbias1;
- enum adau1373_micbias_voltage micbias2;
-};
-
-#endif
diff --git a/sound/soc/codecs/adau1373.c b/sound/soc/codecs/adau1373.c
index a910e252aa1265aa44fbd944f666a6f7ad16dc24..9568ff933e12ba939134a696c8d9c16a2ef04795 100644
--- a/sound/soc/codecs/adau1373.c
+++ b/sound/soc/codecs/adau1373.c
@@ -10,6 +10,7 @@
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/pm.h>
+#include <linux/property.h>
#include <linux/i2c.h>
#include <linux/slab.h>
@@ -18,7 +19,6 @@
#include <sound/pcm_params.h>
#include <sound/tlv.h>
#include <sound/soc.h>
-#include <sound/adau1373.h>
#include "adau1373.h"
#include "adau-utils.h"
@@ -30,9 +30,28 @@ struct adau1373_dai {
bool clock_provider;
};
+enum adau1373_micbias_voltage {
+ ADAU1373_MICBIAS_2_9V,
+ ADAU1373_MICBIAS_2_2V,
+ ADAU1373_MICBIAS_2_6V,
+ ADAU1373_MICBIAS_1_8V,
+};
+
+#define ADAU1373_DRC_SIZE 13
+
struct adau1373 {
struct regmap *regmap;
struct adau1373_dai dais[3];
+
+ bool input_differential[4];
+ bool lineout_differential;
+ bool lineout_ground_sense;
+
+ unsigned int num_drc;
+ u8 drc_setting[3][ADAU1373_DRC_SIZE];
+
+ enum adau1373_micbias_voltage micbias1;
+ enum adau1373_micbias_voltage micbias2;
};
#define ADAU1373_INPUT_MODE 0x00
@@ -1332,66 +1351,61 @@ static void adau1373_load_drc_settings(struct adau1373 *adau1373,
regmap_write(adau1373->regmap, ADAU1373_DRC(nr) + i, drc[i]);
}
-static bool adau1373_valid_micbias(enum adau1373_micbias_voltage micbias)
+static int adau1373_get_micbias(unsigned int val,
+ enum adau1373_micbias_voltage *micbias)
{
- switch (micbias) {
- case ADAU1373_MICBIAS_2_9V:
- case ADAU1373_MICBIAS_2_2V:
- case ADAU1373_MICBIAS_2_6V:
- case ADAU1373_MICBIAS_1_8V:
- return true;
+ switch (val) {
+ case 2900000:
+ *micbias = ADAU1373_MICBIAS_2_9V;
+ return 0;
+ case 2200000:
+ *micbias = ADAU1373_MICBIAS_2_2V;
+ return 0;
+ case 2600000:
+ *micbias = ADAU1373_MICBIAS_2_6V;
+ return 0;
+ case 1800000:
+ *micbias = ADAU1373_MICBIAS_1_8V;
+ return 0;
default:
- break;
+ return -EINVAL;
}
- return false;
}
static int adau1373_probe(struct snd_soc_component *component)
{
struct adau1373 *adau1373 = snd_soc_component_get_drvdata(component);
- struct adau1373_platform_data *pdata = component->dev->platform_data;
- bool lineout_differential = false;
unsigned int val;
int i;
- if (pdata) {
- if (pdata->num_drc > ARRAY_SIZE(pdata->drc_setting))
- return -EINVAL;
-
- if (!adau1373_valid_micbias(pdata->micbias1) ||
- !adau1373_valid_micbias(pdata->micbias2))
- return -EINVAL;
-
- for (i = 0; i < pdata->num_drc; ++i) {
- adau1373_load_drc_settings(adau1373, i,
- pdata->drc_setting[i]);
- }
-
- snd_soc_add_component_controls(component, adau1373_drc_controls,
- pdata->num_drc);
-
- val = 0;
- for (i = 0; i < 4; ++i) {
- if (pdata->input_differential[i])
- val |= BIT(i);
- }
- regmap_write(adau1373->regmap, ADAU1373_INPUT_MODE, val);
-
- val = 0;
- if (pdata->lineout_differential)
- val |= ADAU1373_OUTPUT_CTRL_LDIFF;
- if (pdata->lineout_ground_sense)
- val |= ADAU1373_OUTPUT_CTRL_LNFBEN;
- regmap_write(adau1373->regmap, ADAU1373_OUTPUT_CTRL, val);
-
- lineout_differential = pdata->lineout_differential;
-
- regmap_write(adau1373->regmap, ADAU1373_EP_CTRL,
- (pdata->micbias1 << ADAU1373_EP_CTRL_MICBIAS1_OFFSET) |
- (pdata->micbias2 << ADAU1373_EP_CTRL_MICBIAS2_OFFSET));
+ for (i = 0; i < adau1373->num_drc; ++i) {
+ adau1373_load_drc_settings(adau1373, i,
+ adau1373->drc_setting[i]);
}
- if (!lineout_differential) {
+ snd_soc_add_component_controls(component, adau1373_drc_controls,
+ adau1373->num_drc);
+
+ val = 0;
+ for (i = 0; i < ARRAY_SIZE(adau1373->input_differential); ++i) {
+ if (adau1373->input_differential[i])
+ val |= BIT(i);
+ }
+ regmap_write(adau1373->regmap, ADAU1373_INPUT_MODE, val);
+
+ val = 0;
+ if (adau1373->lineout_differential)
+ val |= ADAU1373_OUTPUT_CTRL_LDIFF;
+ if (adau1373->lineout_ground_sense)
+ val |= ADAU1373_OUTPUT_CTRL_LNFBEN;
+
+ regmap_write(adau1373->regmap, ADAU1373_OUTPUT_CTRL, val);
+
+ regmap_write(adau1373->regmap, ADAU1373_EP_CTRL,
+ (adau1373->micbias1 << ADAU1373_EP_CTRL_MICBIAS1_OFFSET) |
+ (adau1373->micbias2 << ADAU1373_EP_CTRL_MICBIAS2_OFFSET));
+
+ if (!adau1373->lineout_differential) {
snd_soc_add_component_controls(component, adau1373_lineout2_controls,
ARRAY_SIZE(adau1373_lineout2_controls));
}
@@ -1471,6 +1485,65 @@ static const struct snd_soc_component_driver adau1373_component_driver = {
.endianness = 1,
};
+static int adau1373_parse_fw(struct device *dev, struct adau1373 *adau1373)
+{
+ int ret, drc_count;
+ unsigned int val;
+
+ if (device_property_present(dev, "adi,input1-differential"))
+ adau1373->input_differential[0] = true;
+ if (device_property_present(dev, "adi,input2-differential"))
+ adau1373->input_differential[1] = true;
+ if (device_property_present(dev, "adi,input3-differential"))
+ adau1373->input_differential[2] = true;
+ if (device_property_present(dev, "adi,input4-differential"))
+ adau1373->input_differential[3] = true;
+
+ if (device_property_present(dev, "adi,lineout-differential"))
+ adau1373->lineout_differential = true;
+ if (device_property_present(dev, "adi,lineout-gnd-sense"))
+ adau1373->lineout_ground_sense = true;
+
+ ret = device_property_read_u32(dev, "adi,micbias1-microvolt", &val);
+ if (!ret) {
+ ret = adau1373_get_micbias(val, &adau1373->micbias1);
+ if (ret)
+ return dev_err_probe(dev, ret,
+ "Failed to get micbias1(%u)\n", val);
+ }
+
+ ret = device_property_read_u32(dev, "adi,micbias2-microvolt", &val);
+ if (!ret) {
+ ret = adau1373_get_micbias(val, &adau1373->micbias2);
+ if (ret)
+ return dev_err_probe(dev, ret,
+ "Failed to get micbias2(%u)\n", val);
+ }
+
+ drc_count = device_property_count_u8(dev, "adi,drc-settings");
+ if (drc_count < 0)
+ return 0;
+ if (drc_count % ADAU1373_DRC_SIZE != 0)
+ return dev_err_probe(dev, -EINVAL,
+ "DRC count(%u) not multiple of %u\n",
+ drc_count, ADAU1373_DRC_SIZE);
+
+ adau1373->num_drc = drc_count / ADAU1373_DRC_SIZE;
+ if (adau1373->num_drc > ARRAY_SIZE(adau1373->drc_setting))
+ return dev_err_probe(dev, -EINVAL,
+ "Too many DRC settings(%u)\n",
+ adau1373->num_drc);
+
+ ret = device_property_read_u8_array(dev, "adi,drc-settings",
+ (u8 *)&adau1373->drc_setting[0],
+ drc_count);
+ if (ret)
+ return dev_err_probe(dev, ret,
+ "Failed to read DRC settings\n");
+
+ return 0;
+}
+
static int adau1373_i2c_probe(struct i2c_client *client)
{
struct adau1373 *adau1373;
@@ -1489,6 +1562,10 @@ static int adau1373_i2c_probe(struct i2c_client *client)
dev_set_drvdata(&client->dev, adau1373);
+ ret = adau1373_parse_fw(&client->dev, adau1373);
+ if (ret)
+ return ret;
+
ret = devm_snd_soc_register_component(&client->dev,
&adau1373_component_driver,
adau1373_dai_driver, ARRAY_SIZE(adau1373_dai_driver));
@@ -1501,9 +1578,16 @@ static const struct i2c_device_id adau1373_i2c_id[] = {
};
MODULE_DEVICE_TABLE(i2c, adau1373_i2c_id);
+static const struct of_device_id adau1373_of_match[] = {
+ { .compatible = "adi,adau1373", },
+ { }
+};
+MODULE_DEVICE_TABLE(of, adau1373_of_match);
+
static struct i2c_driver adau1373_i2c_driver = {
.driver = {
.name = "adau1373",
+ .of_match_table = adau1373_of_match,
},
.probe = adau1373_i2c_probe,
.id_table = adau1373_i2c_id,
--
2.47.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 4/4] ASoC: codecs: adau1373: add powerdown gpio
2024-10-21 13:46 [PATCH 0/4] ASoC: codecs: adau1373: drop platform data Nuno Sa
` (2 preceding siblings ...)
2024-10-21 13:46 ` [PATCH 3/4] ASoC: codecs: adau1373: drop patform_data Nuno Sa
@ 2024-10-21 13:46 ` Nuno Sa
2024-10-21 15:30 ` Mark Brown
3 siblings, 1 reply; 11+ messages in thread
From: Nuno Sa @ 2024-10-21 13:46 UTC (permalink / raw)
To: linux-sound, devicetree
Cc: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
Lars-Peter Clausen, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
If the powerdown GPIO is specified, we use it for reset. Otherwise,
fallback to a software reset.
Signed-off-by: Nuno Sa <nuno.sa@analog.com>
---
sound/soc/codecs/adau1373.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/sound/soc/codecs/adau1373.c b/sound/soc/codecs/adau1373.c
index 9568ff933e12ba939134a696c8d9c16a2ef04795..d5566b4c444f3a8be07cc17fbdbb5fee1b6442e9 100644
--- a/sound/soc/codecs/adau1373.c
+++ b/sound/soc/codecs/adau1373.c
@@ -8,6 +8,7 @@
#include <linux/module.h>
#include <linux/init.h>
+#include <linux/gpio/consumer.h>
#include <linux/delay.h>
#include <linux/pm.h>
#include <linux/property.h>
@@ -1547,6 +1548,7 @@ static int adau1373_parse_fw(struct device *dev, struct adau1373 *adau1373)
static int adau1373_i2c_probe(struct i2c_client *client)
{
struct adau1373 *adau1373;
+ struct gpio_desc *gpiod;
int ret;
adau1373 = devm_kzalloc(&client->dev, sizeof(*adau1373), GFP_KERNEL);
@@ -1558,7 +1560,21 @@ static int adau1373_i2c_probe(struct i2c_client *client)
if (IS_ERR(adau1373->regmap))
return PTR_ERR(adau1373->regmap);
- regmap_write(adau1373->regmap, ADAU1373_SOFT_RESET, 0x00);
+ /*
+ * If the powerdown GPIO is specified, we use it for reset. Otherwise
+ * a software reset is done.
+ */
+ gpiod = devm_gpiod_get_optional(&client->dev, "powerdown",
+ GPIOD_OUT_HIGH);
+ if (IS_ERR(gpiod))
+ return PTR_ERR(gpiod);
+
+ if (gpiod) {
+ gpiod_set_value_cansleep(gpiod, 0);
+ fsleep(10);
+ } else {
+ regmap_write(adau1373->regmap, ADAU1373_SOFT_RESET, 0x00);
+ }
dev_set_drvdata(&client->dev, adau1373);
--
2.47.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 4/4] ASoC: codecs: adau1373: add powerdown gpio
2024-10-21 13:46 ` [PATCH 4/4] ASoC: codecs: adau1373: add powerdown gpio Nuno Sa
@ 2024-10-21 15:30 ` Mark Brown
2024-10-22 6:39 ` Nuno Sá
0 siblings, 1 reply; 11+ messages in thread
From: Mark Brown @ 2024-10-21 15:30 UTC (permalink / raw)
To: Nuno Sa
Cc: linux-sound, devicetree, Liam Girdwood, Jaroslav Kysela,
Takashi Iwai, Lars-Peter Clausen, Rob Herring,
Krzysztof Kozlowski, Conor Dooley
[-- Attachment #1: Type: text/plain, Size: 246 bytes --]
On Mon, Oct 21, 2024 at 03:46:48PM +0200, Nuno Sa wrote:
> If the powerdown GPIO is specified, we use it for reset. Otherwise,
> fallback to a software reset.
Ideally we'd also put the device into reset when we unload, but that's
not essential.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/4] ASoC: dt-bindings: document the adau1373 Codec
2024-10-21 13:46 ` [PATCH 2/4] ASoC: dt-bindings: document the adau1373 Codec Nuno Sa
@ 2024-10-22 6:06 ` Krzysztof Kozlowski
2024-10-22 6:42 ` Nuno Sá
0 siblings, 1 reply; 11+ messages in thread
From: Krzysztof Kozlowski @ 2024-10-22 6:06 UTC (permalink / raw)
To: Nuno Sa
Cc: linux-sound, devicetree, Liam Girdwood, Mark Brown,
Jaroslav Kysela, Takashi Iwai, Lars-Peter Clausen, Rob Herring,
Krzysztof Kozlowski, Conor Dooley
On Mon, Oct 21, 2024 at 03:46:46PM +0200, Nuno Sa wrote:
> Describe the adau1373 Low Power Codec with Speaker and
> Headphone Amplifier.
>
> While at it, properly add a MAINTAINERS entry for ADI sound bindings.
>
> Signed-off-by: Nuno Sa <nuno.sa@analog.com>
> ---
> .../devicetree/bindings/sound/adi,adau1373.yaml | 102 +++++++++++++++++++++
> MAINTAINERS | 1 +
> 2 files changed, 103 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/sound/adi,adau1373.yaml b/Documentation/devicetree/bindings/sound/adi,adau1373.yaml
> new file mode 100644
> index 0000000000000000000000000000000000000000..b2b5b2226ed7b354f2fb7871c17272b347921fa5
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/sound/adi,adau1373.yaml
> @@ -0,0 +1,102 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/sound/adi,adau1373.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +
Just one blank line
> +title: Analog Devices ADAU1373 CODEC
> +
> +maintainers:
> + - Nuno Sá <nuno.sa@analog.com>
> +
> +description: |
> + Analog Devices ADAU1373 Low power codec with speaker and headphone amplifiers.
> + https://www.analog.com/media/en/technical-documentation/data-sheets/ADAU1373.pdf
> +
> +allOf:
> + - $ref: dai-common.yaml#
> +
> +properties:
> + compatible:
> + enum:
> + - adi,adau1373
> +
> + reg:
> + maxItems: 1
> +
> + "#sound-dai-cells":
> + const: 0
> +
> + powerdown-gpios:
> + description: GPIO used for hardware power-down.
> + maxItems: 1
> +
> + adi,micbias1-microvolt:
> + description:
> + This property sets the microphone bias voltage for the first microphone.
> + enum: [1800000, 2200000, 2600000, 2900000]
> + default: 2900000
> +
> + adi,micbias2-microvolt:
> + description:
> + This property sets the microphone bias voltage for the second microphone.
> + enum: [1800000, 2200000, 2600000, 2900000]
> + default: 2900000
> +
> + adi,input1-differential:
> + description: This property sets the first analog input as differential.
> + type: boolean
> +
> + adi,input2-differential:
> + description: This property sets the second analog input as differential.
> + type: boolean
> +
> + adi,input3-differential:
> + description: This property sets the third analog input as differential.
> + type: boolean
> +
> + adi,input4-differential:
> + description: This property sets the fourth analog input as differential.
> + type: boolean
> +
> + adi,lineout-differential:
> + description: This property sets the line output as differential.
> + type: boolean
> +
> + adi,lineout-gnd-sense:
> + description: This property enables the line output ground sense control.
> + type: boolean
> +
> + adi,drc-settings:
> + description:
> + This setting is used to control the dynamic range of the signal. The
> + device provides a maximum of three full band DRCs with 13 entries each.
> + $ref: /schemas/types.yaml#/definitions/uint8-array
> + oneOf:
> + - minItems: 13
> + - minItems: 26
> + - minItems: 39
and maxItems?
> +
> +required:
> + - "#sound-dai-cells"
> + - compatible
> + - reg
> +
> +unevaluatedProperties: false
> +
> +examples:
> + - |
> + #include <dt-bindings/gpio/gpio.h>
> +
> + i2c {
> + #address-cells = <1>;
> + #size-cells = <0>;
> + audio-codec@1a {
> + compatible = "adi,adau1373";
Messed indentation.
> + reg = <0x1a>;
> + #sound-dai-cells = <0>;
> + powerdown-gpios = <&gpio 100 GPIO_ACTIVE_LOW>;
Extend the example, you have like 10 unused properties.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 4/4] ASoC: codecs: adau1373: add powerdown gpio
2024-10-21 15:30 ` Mark Brown
@ 2024-10-22 6:39 ` Nuno Sá
0 siblings, 0 replies; 11+ messages in thread
From: Nuno Sá @ 2024-10-22 6:39 UTC (permalink / raw)
To: Mark Brown, Nuno Sa
Cc: linux-sound, devicetree, Liam Girdwood, Jaroslav Kysela,
Takashi Iwai, Lars-Peter Clausen, Rob Herring,
Krzysztof Kozlowski, Conor Dooley
On Mon, 2024-10-21 at 16:30 +0100, Mark Brown wrote:
> On Mon, Oct 21, 2024 at 03:46:48PM +0200, Nuno Sa wrote:
> > If the powerdown GPIO is specified, we use it for reset. Otherwise,
> > fallback to a software reset.
>
> Ideally we'd also put the device into reset when we unload, but that's
> not essential.
Alright... I can do a v2 with that. Will just wait for some more feedback on the
rest.
- Nuno Sá
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/4] ASoC: dt-bindings: document the adau1373 Codec
2024-10-22 6:06 ` Krzysztof Kozlowski
@ 2024-10-22 6:42 ` Nuno Sá
2024-10-26 18:14 ` Krzysztof Kozlowski
0 siblings, 1 reply; 11+ messages in thread
From: Nuno Sá @ 2024-10-22 6:42 UTC (permalink / raw)
To: Krzysztof Kozlowski, Nuno Sa
Cc: linux-sound, devicetree, Liam Girdwood, Mark Brown,
Jaroslav Kysela, Takashi Iwai, Lars-Peter Clausen, Rob Herring,
Krzysztof Kozlowski, Conor Dooley
On Tue, 2024-10-22 at 08:06 +0200, Krzysztof Kozlowski wrote:
> On Mon, Oct 21, 2024 at 03:46:46PM +0200, Nuno Sa wrote:
> > Describe the adau1373 Low Power Codec with Speaker and
> > Headphone Amplifier.
> >
> > While at it, properly add a MAINTAINERS entry for ADI sound bindings.
> >
> > Signed-off-by: Nuno Sa <nuno.sa@analog.com>
> > ---
> > .../devicetree/bindings/sound/adi,adau1373.yaml | 102
> > +++++++++++++++++++++
> > MAINTAINERS | 1 +
> > 2 files changed, 103 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/sound/adi,adau1373.yaml
> > b/Documentation/devicetree/bindings/sound/adi,adau1373.yaml
> > new file mode 100644
> > index
> > 0000000000000000000000000000000000000000..b2b5b2226ed7b354f2fb7871c17272b347
> > 921fa5
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/sound/adi,adau1373.yaml
> > @@ -0,0 +1,102 @@
> > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/sound/adi,adau1373.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +
>
> Just one blank line
>
> > +title: Analog Devices ADAU1373 CODEC
> > +
> > +maintainers:
> > + - Nuno Sá <nuno.sa@analog.com>
> > +
> > +description: |
> > + Analog Devices ADAU1373 Low power codec with speaker and headphone
> > amplifiers.
> > +
> > https://www.analog.com/media/en/technical-documentation/data-sheets/ADAU1373.pdf
> > +
> > +allOf:
> > + - $ref: dai-common.yaml#
> > +
> > +properties:
> > + compatible:
> > + enum:
> > + - adi,adau1373
> > +
> > + reg:
> > + maxItems: 1
> > +
> > + "#sound-dai-cells":
> > + const: 0
> > +
> > + powerdown-gpios:
> > + description: GPIO used for hardware power-down.
> > + maxItems: 1
> > +
> > + adi,micbias1-microvolt:
> > + description:
> > + This property sets the microphone bias voltage for the first
> > microphone.
> > + enum: [1800000, 2200000, 2600000, 2900000]
> > + default: 2900000
> > +
> > + adi,micbias2-microvolt:
> > + description:
> > + This property sets the microphone bias voltage for the second
> > microphone.
> > + enum: [1800000, 2200000, 2600000, 2900000]
> > + default: 2900000
> > +
> > + adi,input1-differential:
> > + description: This property sets the first analog input as differential.
> > + type: boolean
> > +
> > + adi,input2-differential:
> > + description: This property sets the second analog input as
> > differential.
> > + type: boolean
> > +
> > + adi,input3-differential:
> > + description: This property sets the third analog input as differential.
> > + type: boolean
> > +
> > + adi,input4-differential:
> > + description: This property sets the fourth analog input as
> > differential.
> > + type: boolean
> > +
> > + adi,lineout-differential:
> > + description: This property sets the line output as differential.
> > + type: boolean
> > +
> > + adi,lineout-gnd-sense:
> > + description: This property enables the line output ground sense
> > control.
> > + type: boolean
> > +
> > + adi,drc-settings:
> > + description:
> > + This setting is used to control the dynamic range of the signal. The
> > + device provides a maximum of three full band DRCs with 13 entries
> > each.
> > + $ref: /schemas/types.yaml#/definitions/uint8-array
> > + oneOf:
> > + - minItems: 13
> > + - minItems: 26
> > + - minItems: 39
>
> and maxItems?
Hmm, I had the idea that if maxItems was omitted, then it's the same as
minItems? Because that's the intent... We can either have an array of 13, 26 or
39 entries.
>
> > +
> > +required:
> > + - "#sound-dai-cells"
> > + - compatible
> > + - reg
> > +
> > +unevaluatedProperties: false
> > +
> > +examples:
> > + - |
> > + #include <dt-bindings/gpio/gpio.h>
> > +
> > + i2c {
> > + #address-cells = <1>;
> > + #size-cells = <0>;
> > + audio-codec@1a {
> > + compatible = "adi,adau1373";
>
> Messed indentation.
WIll fix. Normally my IDE handles this pretty well...
>
> > + reg = <0x1a>;
> > + #sound-dai-cells = <0>;
> > + powerdown-gpios = <&gpio 100 GPIO_ACTIVE_LOW>;
>
> Extend the example, you have like 10 unused properties.
Will do
Thanks!
- Nuno Sá
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/4] ASoC: dt-bindings: document the adau1373 Codec
2024-10-22 6:42 ` Nuno Sá
@ 2024-10-26 18:14 ` Krzysztof Kozlowski
2024-10-28 14:10 ` Nuno Sá
0 siblings, 1 reply; 11+ messages in thread
From: Krzysztof Kozlowski @ 2024-10-26 18:14 UTC (permalink / raw)
To: Nuno Sá, Nuno Sa
Cc: linux-sound, devicetree, Liam Girdwood, Mark Brown,
Jaroslav Kysela, Takashi Iwai, Lars-Peter Clausen, Rob Herring,
Krzysztof Kozlowski, Conor Dooley
On 22/10/2024 08:42, Nuno Sá wrote:
>>> + $ref: /schemas/types.yaml#/definitions/uint8-array
>>> + oneOf:
>>> + - minItems: 13
>>> + - minItems: 26
>>> + - minItems: 39
>>
>> and maxItems?
>
> Hmm, I had the idea that if maxItems was omitted, then it's the same as
> minItems? Because that's the intent... We can either have an array of 13, 26 or
> 39 entries.
That's not the case and none of the files follow such logic. If you
manage to find one file, please correct or report it.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/4] ASoC: dt-bindings: document the adau1373 Codec
2024-10-26 18:14 ` Krzysztof Kozlowski
@ 2024-10-28 14:10 ` Nuno Sá
0 siblings, 0 replies; 11+ messages in thread
From: Nuno Sá @ 2024-10-28 14:10 UTC (permalink / raw)
To: Krzysztof Kozlowski, Nuno Sa
Cc: linux-sound, devicetree, Liam Girdwood, Mark Brown,
Jaroslav Kysela, Takashi Iwai, Lars-Peter Clausen, Rob Herring,
Krzysztof Kozlowski, Conor Dooley
On Sat, 2024-10-26 at 20:14 +0200, Krzysztof Kozlowski wrote:
> On 22/10/2024 08:42, Nuno Sá wrote:
> > > > + $ref: /schemas/types.yaml#/definitions/uint8-array
> > > > + oneOf:
> > > > + - minItems: 13
> > > > + - minItems: 26
> > > > + - minItems: 39
> > >
> > > and maxItems?
> >
> > Hmm, I had the idea that if maxItems was omitted, then it's the same as
> > minItems? Because that's the intent... We can either have an array of 13, 26 or
> > 39 entries.
>
> That's not the case and none of the files follow such logic. If you
> manage to find one file, please correct or report it.
>
Okay... will add maxItems
FWIW, playing with the DT example and validating the bindings works (and fails) as
expected when omitting maxItems.
- Nuno Sá
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2024-10-28 14:10 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-21 13:46 [PATCH 0/4] ASoC: codecs: adau1373: drop platform data Nuno Sa
2024-10-21 13:46 ` [PATCH 1/4] ASoC: codecs: adau1373: add some kconfig text Nuno Sa
2024-10-21 13:46 ` [PATCH 2/4] ASoC: dt-bindings: document the adau1373 Codec Nuno Sa
2024-10-22 6:06 ` Krzysztof Kozlowski
2024-10-22 6:42 ` Nuno Sá
2024-10-26 18:14 ` Krzysztof Kozlowski
2024-10-28 14:10 ` Nuno Sá
2024-10-21 13:46 ` [PATCH 3/4] ASoC: codecs: adau1373: drop patform_data Nuno Sa
2024-10-21 13:46 ` [PATCH 4/4] ASoC: codecs: adau1373: add powerdown gpio Nuno Sa
2024-10-21 15:30 ` Mark Brown
2024-10-22 6:39 ` Nuno Sá
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).