[PATCH 0/2] ASoC: add devicetree support for WM8961 codec
This series adds devicetree support for the Wolfson WM8961 codec. The first patch adds a schema, and the second patch hooks it up in the code.
Doug Brown (2): ASoC: dt-bindings: add schema for WM8961 ASoC: wm8961: add support for devicetree
.../devicetree/bindings/sound/wlf,wm8961.yaml | 40 +++++++++++++++++++ sound/soc/codecs/Kconfig | 2 +- sound/soc/codecs/wm8961.c | 6 +++ 3 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/sound/wlf,wm8961.yaml
Create a simple DT schema for the existing Wolfson WM8961 driver so that DT support can be added to the driver.
Signed-off-by: Doug Brown doug@schmorgal.com --- .../devicetree/bindings/sound/wlf,wm8961.yaml | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/wlf,wm8961.yaml
diff --git a/Documentation/devicetree/bindings/sound/wlf,wm8961.yaml b/Documentation/devicetree/bindings/sound/wlf,wm8961.yaml new file mode 100644 index 000000000000..73166cf0fdcf --- /dev/null +++ b/Documentation/devicetree/bindings/sound/wlf,wm8961.yaml @@ -0,0 +1,40 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/sound/wlf,wm8961.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Wolfson WM8961 Ultra-Low Power Stereo CODEC + +maintainers: + - patches@opensource.cirrus.com + +properties: + '#sound-dai-cells': + const: 0 + + compatible: + const: wlf,wm8961 + + reg: + maxItems: 1 + +required: + - '#sound-dai-cells' + - compatible + - reg + +additionalProperties: false + +examples: + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + + wm8961: codec@4a { + #sound-dai-cells = <0>; + compatible = "wlf,wm8961"; + reg = <0x4a>; + }; + };
On 01/10/2022 22:00, Doug Brown wrote:
Create a simple DT schema for the existing Wolfson WM8961 driver so that DT support can be added to the driver.
Signed-off-by: Doug Brown doug@schmorgal.com
.../devicetree/bindings/sound/wlf,wm8961.yaml | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/wlf,wm8961.yaml
diff --git a/Documentation/devicetree/bindings/sound/wlf,wm8961.yaml b/Documentation/devicetree/bindings/sound/wlf,wm8961.yaml new file mode 100644 index 000000000000..73166cf0fdcf --- /dev/null +++ b/Documentation/devicetree/bindings/sound/wlf,wm8961.yaml @@ -0,0 +1,40 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/sound/wlf,wm8961.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml#
+title: Wolfson WM8961 Ultra-Low Power Stereo CODEC
+maintainers:
- patches@opensource.cirrus.com
+properties:
- '#sound-dai-cells':
- const: 0
- compatible:
- const: wlf,wm8961
Please put compatible first in list of properties (and follow same order in "required"). It's the most important piece, so we want it to be the first to see. It also follows the convention of DTS, where compatible is expected to be first.
- reg:
- maxItems: 1
+required:
- '#sound-dai-cells'
- compatible
- reg
+additionalProperties: false
+examples:
- |
- i2c {
#address-cells = <1>;
#size-cells = <0>;
wm8961: codec@4a {
#sound-dai-cells = <0>;
compatible = "wlf,wm8961";
Here compatible first, reg second, then the rest.
reg = <0x4a>;
};
- };
Best regards, Krzysztof
This adds support for devicetree to the WM8961 driver so it can be used with modern DT-based kernels.
Signed-off-by: Doug Brown doug@schmorgal.com --- sound/soc/codecs/Kconfig | 2 +- sound/soc/codecs/wm8961.c | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index e3b90c425faf..2b5787ee8d31 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig @@ -1929,7 +1929,7 @@ config SND_SOC_WM8960 depends on I2C
config SND_SOC_WM8961 - tristate + tristate "Wolfson Microelectronics WM8961 CODEC" depends on I2C
config SND_SOC_WM8962 diff --git a/sound/soc/codecs/wm8961.c b/sound/soc/codecs/wm8961.c index 7dc6aaf65576..539096184eda 100644 --- a/sound/soc/codecs/wm8961.c +++ b/sound/soc/codecs/wm8961.c @@ -971,6 +971,12 @@ static const struct i2c_device_id wm8961_i2c_id[] = { }; MODULE_DEVICE_TABLE(i2c, wm8961_i2c_id);
+static const struct of_device_id wm8961_of_match[] = { + { .compatible = "wlf,wm8961", }, + { } +}; +MODULE_DEVICE_TABLE(of, wm8961_of_match); + static struct i2c_driver wm8961_i2c_driver = { .driver = { .name = "wm8961",
On 01/10/2022 22:00, Doug Brown wrote:
This adds support for devicetree to the WM8961 driver so it can be used
Do not use "This commit/patch adds ...". https://elixir.bootlin.com/linux/v5.17.1/source/Documentation/process/submit...
Just "Add support for ..."
with modern DT-based kernels.
Signed-off-by: Doug Brown doug@schmorgal.com
sound/soc/codecs/Kconfig | 2 +- sound/soc/codecs/wm8961.c | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index e3b90c425faf..2b5787ee8d31 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig @@ -1929,7 +1929,7 @@ config SND_SOC_WM8960 depends on I2C
config SND_SOC_WM8961
- tristate
- tristate "Wolfson Microelectronics WM8961 CODEC"
This is independent change. Please split to separate commit.
depends on I2C
config SND_SOC_WM8962 diff --git a/sound/soc/codecs/wm8961.c b/sound/soc/codecs/wm8961.c index 7dc6aaf65576..539096184eda 100644 --- a/sound/soc/codecs/wm8961.c +++ b/sound/soc/codecs/wm8961.c @@ -971,6 +971,12 @@ static const struct i2c_device_id wm8961_i2c_id[] = { }; MODULE_DEVICE_TABLE(i2c, wm8961_i2c_id);
+static const struct of_device_id wm8961_of_match[] = {
- { .compatible = "wlf,wm8961", },
- { }
+}; +MODULE_DEVICE_TABLE(of, wm8961_of_match);
Compile-test with W=1 and without CONFIG_OF. Is there a warning here?
Best regards, Krzysztof
participants (2)
-
Doug Brown
-
Krzysztof Kozlowski