From b9b0d88d87e5565e8d12bcf22ec601e8b4658dc6 Mon Sep 17 00:00:00 2001 From: Doug Brown Date: Sun, 2 Oct 2022 20:24:12 -0700 Subject: [PATCH 1/3] ASoC: dt-bindings: add schema for WM8961 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 Acked-by: Charles Keepax Reviewed-by: Krzysztof Kozlowski Link: https://lore.kernel.org/r/20221003032414.248326-2-doug@schmorgal.com Signed-off-by: Mark Brown --- .../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..795d34e1e97a --- /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: + compatible: + const: wlf,wm8961 + + reg: + maxItems: 1 + + '#sound-dai-cells': + const: 0 + +required: + - compatible + - reg + - '#sound-dai-cells' + +additionalProperties: false + +examples: + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + + wm8961: codec@4a { + compatible = "wlf,wm8961"; + reg = <0x4a>; + #sound-dai-cells = <0>; + }; + }; From c96851ee8195c820b765c6a7effcec79c81eb9c6 Mon Sep 17 00:00:00 2001 From: Doug Brown Date: Sun, 2 Oct 2022 20:24:13 -0700 Subject: [PATCH 2/3] ASoC: wm8961: add support for devicetree Add support for devicetree to the WM8961 driver so it can be used with modern DT-based kernels. Signed-off-by: Doug Brown Acked-by: Charles Keepax Link: https://lore.kernel.org/r/20221003032414.248326-3-doug@schmorgal.com Signed-off-by: Mark Brown --- sound/soc/codecs/wm8961.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sound/soc/codecs/wm8961.c b/sound/soc/codecs/wm8961.c index 7dc6aaf65576..a4857024711d 100644 --- a/sound/soc/codecs/wm8961.c +++ b/sound/soc/codecs/wm8961.c @@ -971,9 +971,16 @@ 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[] __maybe_unused = { + { .compatible = "wlf,wm8961", }, + { } +}; +MODULE_DEVICE_TABLE(of, wm8961_of_match); + static struct i2c_driver wm8961_i2c_driver = { .driver = { .name = "wm8961", + .of_match_table = of_match_ptr(wm8961_of_match), }, .probe_new = wm8961_i2c_probe, .id_table = wm8961_i2c_id, From 74a6a948c8fc28c8937e24178739979b3cd2ce14 Mon Sep 17 00:00:00 2001 From: Doug Brown Date: Sun, 2 Oct 2022 20:24:14 -0700 Subject: [PATCH 3/3] ASoC: codecs: allow WM8961 to be selected by the user Allow the WM8961 driver to be enabled independently now that it is usable with devicetree. Signed-off-by: Doug Brown Acked-by: Charles Keepax Link: https://lore.kernel.org/r/20221003032414.248326-4-doug@schmorgal.com Signed-off-by: Mark Brown --- 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 7022e6286e6c..7a13e750751a 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig @@ -1930,7 +1930,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