ASoC: rt9120: Add Richtek RT9120 supprot
Subsystems (4)
v3 cover ASoC: rt9120: Add Richtek RT9120 supprot
From: ChiYuan Huang <[email protected]>
This patch series Add the Richtek RT9120 support.
In v3:
- Add dvdd regulator binding to check the dvdd voltage domain.
- Refine sdo_select_text.
- Use switch case in 'internal_power_event' function.
- Remove the volume and mute initially write in component probe.
- Remove the mute API. It's no need by HW design.
In v2:
- Add missing #sound-dai-cells property.
ChiYuan Huang (2):
ASoC: dt-bindings: rt9120: Add initial bindings
ASoC: rt9120: Add rt9210 audio amplifier support
.../devicetree/bindings/sound/richtek,rt9120.yaml | 59 +++ sound/soc/codecs/Kconfig | 10 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/rt9120.c | 489 +++++++++++++++++++++ 4 files changed, 560 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/richtek,rt9120.yaml create mode 100644 sound/soc/codecs/rt9120.c
Signature · 1 line
2.7.4
PATCH v3 1/2 ASoC: dt-bindings: rt9120: Add initial bindings
From: ChiYuan Huang <[email protected]>
Add initial bindings for Richtek rt9120 audio amplifier.
--- .../devicetree/bindings/sound/richtek,rt9120.yaml | 59 ++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/richtek,rt9120.yaml
Documentation/devicetree/bindings/sound/richtek,rt9120.yaml new file +59 -0
@@ -0,0 +1,59 @@ +# SPDX-License-Identifier: GPL-2.0 +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/sound/richtek,rt9120.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Richtek RT9120 Class-D audio amplifier + +maintainers: + - ChiYuan Huang <[email protected]> + +description: | + The RT9120 is a high efficiency, I2S-input, stereo audio power amplifier + delivering 2*20W into 8 Ohm BTL speaker loads. It supports the wide input + voltage range from 4.5V to 26.4V to meet the need on most common + applications like as TV, monitors. home entertainment, electronic music + equipment. + +properties: + compatible: + enum: + - richtek,rt9120 + + reg: + description: I2C device address + maxItems: 1 + + pwdnn-gpios: + description: GPIO used for power down, low active + maxItems: 1 + + dvdd-supply: + description: | + Supply for the default on DVDD power, voltage domain must be 3P3V or 1P8V + + '#sound-dai-cells': + const: 0 + +required: + - compatible + - reg + - dvdd-supply + - '#sound-dai-cells' + +additionalProperties: false + +examples: + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + rt9120@1a { + compatible = "richtek,rt9120"; + reg = <0x1a>; + pwdnn-gpios = <&gpio26 2 0>; + dvdd-supply = <&vdd_io_reg>; + #sound-dai-cells = <0>; + }; + };
Signature · 1 line
2.7.4
PATCH v3 2/2 ASoC: rt9120: Add rt9210 audio amplifier support
In reply to cy_huangFrom: ChiYuan Huang <[email protected]>
Add Richtek rt9120 audio amplifier support.
--- sound/soc/codecs/Kconfig | 10 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/rt9120.c | 489 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 501 insertions(+) create mode 100644 sound/soc/codecs/rt9120.c
sound/soc/codecs/Kconfig +10 -0
@@ -187,6 +187,7 @@ config SND_SOC_ALL_CODECS imply SND_SOC_RT715_SDCA_SDW imply SND_SOC_RT1308_SDW imply SND_SOC_RT1316_SDW + imply SND_SOC_RT9120 imply SND_SOC_SDW_MOCKUP imply SND_SOC_SGTL5000 imply SND_SOC_SI476X
@@ -1288,6 +1289,15 @@ config SND_SOC_RT715_SDCA_SDW select REGMAP_SOUNDWIRE select REGMAP_SOUNDWIRE_MBQ +config SND_SOC_RT9120 + tristate "Richtek RT9120 Stereo Class-D Amplifier" + depends on I2C + select REGMAP_I2C + select GPIOLIB + help + Enable support for Richtek RT9120 20W, stereo, inductor-less, + high-efficiency Class-D audio amplifier. + config SND_SOC_SDW_MOCKUP tristate "SoundWire mockup codec" depends on EXPERT
sound/soc/codecs/Makefile +2 -0
@@ -203,6 +203,7 @@ snd-soc-rt711-objs := rt711.o rt711-sdw.o snd-soc-rt711-sdca-objs := rt711-sdca.o rt711-sdca-sdw.o snd-soc-rt715-objs := rt715.o rt715-sdw.o snd-soc-rt715-sdca-objs := rt715-sdca.o rt715-sdca-sdw.o +snd-soc-rt9120-objs := rt9120.o snd-soc-sdw-mockup-objs := sdw-mockup.o snd-soc-sgtl5000-objs := sgtl5000.o snd-soc-alc5623-objs := alc5623.o
@@ -531,6 +532,7 @@ obj-$(CONFIG_SND_SOC_RT711) += snd-soc-rt711.o obj-$(CONFIG_SND_SOC_RT711_SDCA_SDW) += snd-soc-rt711-sdca.o obj-$(CONFIG_SND_SOC_RT715) += snd-soc-rt715.o obj-$(CONFIG_SND_SOC_RT715_SDCA_SDW) += snd-soc-rt715-sdca.o +obj-$(CONFIG_SND_SOC_RT9120) += snd-soc-rt9120.o obj-$(CONFIG_SND_SOC_SDW_MOCKUP) += snd-soc-sdw-mockup.o obj-$(CONFIG_SND_SOC_SGTL5000) += snd-soc-sgtl5000.o obj-$(CONFIG_SND_SOC_SIGMADSP) += snd-soc-sigmadsp.o
sound/soc/codecs/rt9120.c new file +489 -0
489 lines not on this page · raw message
Signature · 1 line
2.7.4
Mark Brown
maintainerRe: [PATCH v3 2/2] ASoC: rt9120: Add rt9210 audio amplifier support
sound/soc/codecs/rt9120.c line 82
Quoted 3 lines · cy_huang
sound/soc/codecs/rt9120.c new file +3
-0+static const struct snd_kcontrol_new rt9120_snd_controls[] = { +SOC_SINGLE_TLV ("MS Volume" ,RT9120_REG_MSVOL ,0 ,2047 ,1 , digital_gain), +SOC_SINGLE ("SPK Gain" ,RT9120_REG_SPKGAIN ,0 ,7 ,0 ),
Volume controls should end in Volume even if they don't have TLV information so applications know how to render them. I'll fix this up as I apply.
Re: [PATCH v3 2/2] ASoC: rt9120: Add rt9210 audio amplifier support
Mark Brown <[email protected]> 於 2021年10月8日 週五 下午8:51寫道:
Quoted 10 lines · cy_huang
sound/soc/codecs/rt9120.c line 82
Quoted 4 lines
sound/soc/codecs/rt9120.c new file +3
-0+static const struct snd_kcontrol_new rt9120_snd_controls[] = { +SOC_SINGLE_TLV ("MS Volume" ,RT9120_REG_MSVOL ,0 ,2047 ,1 , digital_gain), +SOC_SINGLE ("SPK Gain" ,RT9120_REG_SPKGAIN ,0 ,7 ,0 ),Volume controls should end in Volume even if they don't have TLV information so applications know how to render them. I'll fix this up as I apply.
It's not linear mapping analog gain and cannot use the TLV as you said. Mappling table is listed like as below
0 -> 6dB
1 -> 8dB
2 -> 10dB
3 -> 12dB
4 -> 13dB
5 -> 14dB
6 -> 15dB
7 -> 16dB
Do I just need to change it to 'SPK Gain Volume' to present this control item? Or is there any table mapping for the nonlinear TLV information?
Re: [PATCH v3 2/2] ASoC: rt9120: Add rt9210 audio amplifier support
ChiYuan Huang <[email protected]> 於 2021年10月12日 週二 上午10:47寫道:
Quoted 24 lines
Mark Brown <[email protected]> 於 2021年10月8日 週五 下午8:51寫道:
Quoted 10 lines · cy_huang
sound/soc/codecs/rt9120.c line 82
Quoted 4 lines
sound/soc/codecs/rt9120.c new file +3
-0+static const struct snd_kcontrol_new rt9120_snd_controls[] = { +SOC_SINGLE_TLV ("MS Volume" ,RT9120_REG_MSVOL ,0 ,2047 ,1 , digital_gain), +SOC_SINGLE ("SPK Gain" ,RT9120_REG_SPKGAIN ,0 ,7 ,0 ),Volume controls should end in Volume even if they don't have TLV information so applications know how to render them. I'll fix this up as I apply.
It's not linear mapping analog gain and cannot use the TLV as you said. Mappling table is listed like as below
0 -> 6dB
1 -> 8dB
2 -> 10dB
3 -> 12dB
4 -> 13dB
5 -> 14dB
6 -> 15dB
7 -> 16dB
Quoted 2 lines
Do I just need to change it to 'SPK Gain Volume' to present this control item? Or is there any table mapping for the nonlinear TLV information?
Finally found there's 'DECLARE_TLV_DB_RANGE' that can meet the requirement. I will fix this by the tlv db range and naming it to 'SPK Gain Volume'. If there's any changes still needed, please feel free to let me know.