ASoC: dt-bindings: rt9120: Add initial bindings
Subsystems (4)
PATCH 1/2 ASoC: dt-bindings: rt9120: Add initial bindings
From: ChiYuan Huang <[email protected]>
Add initial bindings for rt9120 audio amplifier.
--- .../devicetree/bindings/sound/richtek,rt9120.yaml | 53 ++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/richtek,rt9120.yaml
Documentation/devicetree/bindings/sound/richtek,rt9120.yaml new file +53 -0
@@ -0,0 +1,53 @@ +# 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 + + richtek,use-dvdd-1p8v: + description: Indicate DVDD 1P8V is used, default for 3P3V or 5V design + type: boolean + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + rt9120@1a { + compatible = "richtek,rt9120"; + reg = <0x1a>; + pwdnn-gpios = <&gpio26 2 0>; + richtek,use-dvdd-1p8v; + }; + };
Signature · 1 line
2.7.4
PATCH 2/2 ASoC: rt9120: Add rt9210 audio amplifier support
From: ChiYuan Huang <[email protected]>
Add rt9120 audio amplifier support.
--- sound/soc/codecs/Kconfig | 10 + sound/soc/codecs/Makefile | 2 + sound/soc/codecs/rt9120.c | 491 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 503 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 +491 -0
491 lines not on this page · raw message
Signature · 1 line
2.7.4
Mark Brown
maintainerRe: [PATCH 2/2] ASoC: rt9120: Add rt9210 audio amplifier support
sound/soc/codecs/rt9120.c line 72
Quoted 3 lines · cy_huang
sound/soc/codecs/rt9120.c new file +3
-0+static const char *const sdo_select_text[] = { +"NONE" ,"INTF" ,"FINAL" ,"RMS Detect" +};
Why not None and Final?
sound/soc/codecs/rt9120.c line 95
Quoted 6 lines
sound/soc/codecs/rt9120.c new file +6
-0+if (event ==SND_SOC_DAPM_PRE_PMU ) +snd_soc_component_write (comp,RT9120_REG_ERRRPT ,0 ); +else if (event ==SND_SOC_DAPM_POST_PMU ) +msleep (RT9120_AMPON_WAITMS ); +else if (event ==SND_SOC_DAPM_POST_PMD ) +msleep (RT9120_AMPOFF_WAITMS );
This should be a switch statement, it'd be clearer.
sound/soc/codecs/rt9120.c line 143
Quoted 5 lines
sound/soc/codecs/rt9120.c new file +5
-0+/* Default config volume to 0dB */ +snd_soc_component_write (comp,RT9120_REG_MSVOL ,0x180 ); +/* Mute by default */ +snd_soc_component_update_bits (comp,RT9120_REG_VOLRAMP , +RT9120_MUTE_MASK ,RT9120_MUTE_MASK );
As ever you should leave the defaults at whatever the hardware defaults to, the defaults for one machine may not be suitable for another so we shouldn't be trying to do that in software.
A message that is not in the archive (sent off-list or not yet received): CADiBU38X6nY1D7NpgW8+61AX6rUU7jngnPagryDKxUAKdtGjAg@mail.gmail.com
Re: [PATCH 2/2] ASoC: rt9120: Add rt9210 audio amplifier support
ChiYuan Huang <[email protected]> 於 2021年10月5日 週二 下午8:36寫道:
Quoted 29 lines
Mark Brown <[email protected]> 於 2021年10月5日 週二 下午7:54寫道:
Quoted 9 lines · cy_huang
sound/soc/codecs/rt9120.c line 72
Quoted 4 lines
sound/soc/codecs/rt9120.c new file +3
-0+static const char *const sdo_select_text[] = { +"NONE" ,"INTF" ,"FINAL" ,"RMS Detect" +};Why not None and Final?
Just follow the datasheet to write the text.
Whatever, Ack in next.Quoted 9 lines
sound/soc/codecs/rt9120.c line 95
Quoted 6 lines
sound/soc/codecs/rt9120.c new file +6
-0+if (event ==SND_SOC_DAPM_PRE_PMU ) +snd_soc_component_write (comp,RT9120_REG_ERRRPT ,0 ); +else if (event ==SND_SOC_DAPM_POST_PMU ) +msleep (RT9120_AMPON_WAITMS ); +else if (event ==SND_SOC_DAPM_POST_PMD ) +msleep (RT9120_AMPOFF_WAITMS );This should be a switch statement, it'd be clearer.
Ack in next.
Quoted 6 lines
Quoted 5 lines
sound/soc/codecs/rt9120.c new file +5
-0+/* Default config volume to 0dB */ +snd_soc_component_write (comp,RT9120_REG_MSVOL ,0x180 ); +/* Mute by default */ +snd_soc_component_update_bits (comp,RT9120_REG_VOLRAMP , +RT9120_MUTE_MASK ,RT9120_MUTE_MASK );
Quoted 8 lines
Quoted 3 lines
As ever you should leave the defaults at whatever the hardware defaults to, the defaults for one machine may not be suitable for another so we shouldn't be trying to do that in software.
The default volume will be kept in value
0x7ff(mute).
I just want to follow the ASoC flow to control mute/unmute mask by AMP on/off. If to default set volume to 0dB and mute is improper, user have to use mixer control to configure the volume.
Does mute function also need to be removed also?
Sorry, loop all again.
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH 2/2] ASoC: rt9120: Add rt9210 audio amplifier support
Hi, Mark:
Mark Brown <[email protected]> 於 2021年10月5日 週二 下午8:44寫道:
Quoted 21 lines · ChiYuan Huang
Quoted 13 lines
Mark Brown <[email protected]> 於 2021年10月5日 週二 下午7:54寫道:
Quoted 11 lines · cy_huang
sound/soc/codecs/rt9120.c line 143
Quoted 6 lines
sound/soc/codecs/rt9120.c new file +5
-0+/* Default config volume to 0dB */ +snd_soc_component_write (comp,RT9120_REG_MSVOL ,0x180 ); +/* Mute by default */ +snd_soc_component_update_bits (comp,RT9120_REG_VOLRAMP , +RT9120_MUTE_MASK ,RT9120_MUTE_MASK );As ever you should leave the defaults at whatever the hardware defaults to, the defaults for one machine may not be suitable for another so we shouldn't be trying to do that in software.
Quoted 5 lines
The default volume will be kept in value
0x7ff(mute).
I just want to follow the ASoC flow to control mute/unmute mask by AMP on/off. If to default set volume to 0dB and mute is improper, user have to use mixer control to configure the volume.
Does mute function also need to be removed also?
Quoted 7 lines
It's totally fine and indeed quite common for devices to be muted by default - usually systems will have UCM profiles that unmute things by the time users actually interact with them.
Please don't take things off-list unless there is a really strong reason to do so. Sending things to the list ensures that everyone gets a chance to read and comment on things.
After asking the HW member, there's already builtin HW volume ramp function. Mute API is still no need. There's already no pop issue without mute function.
So the next change, I'll remove the default volume and mute config, and also mute API.
Thx.
Mark Brown
maintainerDocumentation/devicetree/bindings/sound/richtek,rt9120.yaml line 34
Quoted 3 lines · cy_huang
Documentation/devicetree/bindings/sound/richtek,rt9120.yaml new file +3
-0+ richtek,use-dvdd-1p8v: + description: Indicate DVDD 1P8V is used, default for 3P3V or 5V design + type: boolean
I would expect this to be done through the regulator bindings, they would allow the driver to query the supply voltage.
A message that is not in the archive (sent off-list or not yet received): CADiBU39dvKS_a5FDgw9yMVFe8Uycn6bfjGwBWq+7MN_DdxkL1g@mail.gmail.com
A message that is not in the archive (sent off-list or not yet received): [email protected]
Mark Brown <[email protected]> 於 2021年10月5日 週二 下午8:29寫道:
Quoted 18 lines · ChiYuan Huang
Quoted 7 lines
Mark Brown <[email protected]> 於 2021年10月5日 週二 下午7:49寫道:
Quoted 5 lines · cy_huang
Quoted 4 lines
Documentation/devicetree/bindings/sound/richtek,rt9120.yaml new file +3
-0+ richtek,use-dvdd-1p8v: + description: Indicate DVDD 1P8V is used, default for 3P3V or 5V design + type: booleanQuoted 8 lines
Quoted 2 lines
I would expect this to be done through the regulator bindings, they would allow the driver to query the supply voltage.
It's more like as the I/O pad voltage.
Must be the same as I2C and I2S signal high level.
It depends on the application SOC design.
From my understanding, not all application SOC I/O voltage uses regulator interface.
Quoted 8 lines
It doesn't really matter what the SoC is doing here, you can always add regulator support to your device - you'd be requesting the supplies to your device, if the SoC doesn't request the supplies that go to it that doesn't really make a difference to what your driver does.
Please don't take things off-list unless there is a really strong reason to do so. Sending things to the list ensures that everyone gets a chance to read and comment on things.
Sorry, my fault.
I just noticed the mail not reply all. Loop all again.
Hi, Mark:
ChiYuan Huang <[email protected]> 於 2021年10月5日 週二 下午8:39寫道:
Quoted 29 lines
Mark Brown <[email protected]> 於 2021年10月5日 週二 下午8:29寫道:
Quoted 26 lines · ChiYuan Huang
Quoted 7 lines
Mark Brown <[email protected]> 於 2021年10月5日 週二 下午7:49寫道:
Quoted 5 lines · cy_huang
Quoted 4 lines
Documentation/devicetree/bindings/sound/richtek,rt9120.yaml new file +3
-0+ richtek,use-dvdd-1p8v: + description: Indicate DVDD 1P8V is used, default for 3P3V or 5V design + type: booleanQuoted 8 lines
Quoted 2 lines
I would expect this to be done through the regulator bindings, they would allow the driver to query the supply voltage.
It's more like as the I/O pad voltage.
Must be the same as I2C and I2S signal high level.
It depends on the application SOC design.
From my understanding, not all application SOC I/O voltage uses regulator interface.It doesn't really matter what the SoC is doing here, you can always add regulator support to your device - you'd be requesting the supplies to your device, if the SoC doesn't request the supplies that go to it that doesn't really make a difference to what your driver does.
Please don't take things off-list unless there is a really strong reason to do so. Sending things to the list ensures that everyone gets a chance to read and comment on things.
After contacting our HW RD, to support DVDD 1.8V not just SW config, also HW connections.
To get only DVDD supply voltage is not enough to meet the HW design. The property seems indeed and need to be used by user's HW connection.
Can this property to be kept?
Quoted 2 lines
Sorry, my fault.
I just noticed the mail not reply all. Loop all again.
Hi,
ChiYuan Huang <[email protected]> 於 2021年10月6日 週三 下午4:47寫道:
Quoted 32 lines
Hi, Mark:
ChiYuan Huang <[email protected]> 於 2021年10月5日 週二 下午8:39寫道:Quoted 29 lines
Mark Brown <[email protected]> 於 2021年10月5日 週二 下午8:29寫道:
Quoted 26 lines · ChiYuan Huang
Quoted 7 lines
Mark Brown <[email protected]> 於 2021年10月5日 週二 下午7:49寫道:
Quoted 5 lines · cy_huang
Quoted 4 lines
Documentation/devicetree/bindings/sound/richtek,rt9120.yaml new file +3
-0+ richtek,use-dvdd-1p8v: + description: Indicate DVDD 1P8V is used, default for 3P3V or 5V design + type: booleanQuoted 8 lines
Quoted 2 lines
I would expect this to be done through the regulator bindings, they would allow the driver to query the supply voltage.
It's more like as the I/O pad voltage.
Must be the same as I2C and I2S signal high level.
It depends on the application SOC design.
From my understanding, not all application SOC I/O voltage uses regulator interface.It doesn't really matter what the SoC is doing here, you can always add regulator support to your device - you'd be requesting the supplies to your device, if the SoC doesn't request the supplies that go to it that doesn't really make a difference to what your driver does.
Please don't take things off-list unless there is a really strong reason to do so. Sending things to the list ensures that everyone gets a chance to read and comment on things.
Quoted 6 lines
After contacting our HW RD, to support DVDD 1.8V not just SW config, also HW connections.
To get only DVDD supply voltage is not enough to meet the HW design. The property seems indeed and need to be used by user's HW connection.Can this property to be kept?
After thinking, This property name may be improper.
I think this change depends on HW external circuit for lowv application. Currently, I'm modifying the V3 change, this property name also affect the property parsing code change.
May I directly change the name to 'richtek,dvdd-lowv-application' and submit the patch v3?
Any comment is appreciated.
Quoted 2 lines
Quoted 2 lines
Sorry, my fault.
I just noticed the mail not reply all. Loop all again.
Mark Brown
maintainerQuoted 16 lines · ChiYuan Huang
ChiYuan Huang <[email protected]> 於 2021年10月6日 週三 下午4:47寫道:
Quoted 14 lines
ChiYuan Huang <[email protected]> 於 2021年10月5日 週二 下午8:39寫道:
Quoted 8 lines
Mark Brown <[email protected]> 於 2021年10月5日 週二 下午8:29寫道:
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
I would expect this to be done through the regulator bindings, they would allow the driver to query the supply voltage.
Please don't take things off-list unless there is a really strong reason to do so. Sending things to the list ensures that everyone gets a chance to read and comment on things.
After contacting our HW RD, to support DVDD 1.8V not just SW config, also HW connections.
To get only DVDD supply voltage is not enough to meet the HW design. The property seems indeed and need to be used by user's HW connection.
Quoted 8 lines
Quoted 1 line
Can this property to be kept?
After thinking, This property name may be improper.
I think this change depends on HW external circuit for lowv application. Currently, I'm modifying the V3 change, this property name also affect the property parsing code change.
May I directly change the name to 'richtek,dvdd-lowv-application' and submit the patch v3?
I still don't understand why you wouldn't describe this through the regulator bindings, those exist to describe the physical supplies ont he board and their constraints.
Mark Brown <[email protected]> 於 2021年10月7日 週四 下午9:45寫道:
Quoted 27 lines · ChiYuan Huang
Quoted 16 lines
ChiYuan Huang <[email protected]> 於 2021年10月6日 週三 下午4:47寫道:
Quoted 14 lines
ChiYuan Huang <[email protected]> 於 2021年10月5日 週二 下午8:39寫道:
Quoted 8 lines
Mark Brown <[email protected]> 於 2021年10月5日 週二 下午8:29寫道:
Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
I would expect this to be done through the regulator bindings, they would allow the driver to query the supply voltage.
Please don't take things off-list unless there is a really strong reason to do so. Sending things to the list ensures that everyone gets a chance to read and comment on things.
After contacting our HW RD, to support DVDD 1.8V not just SW config, also HW connections.
To get only DVDD supply voltage is not enough to meet the HW design. The property seems indeed and need to be used by user's HW connection.Quoted 8 lines
Quoted 1 line
Can this property to be kept?
After thinking, This property name may be improper.
I think this change depends on HW external circuit for lowv application. Currently, I'm modifying the V3 change, this property name also affect the property parsing code change.
May I directly change the name to 'richtek,dvdd-lowv-application' and submit the patch v3?
Quoted 3 lines
I still don't understand why you wouldn't describe this through the regulator bindings, those exist to describe the physical supplies ont he board and their constraints.
Not to oppose your comment, from the initial idea, I'm just thinking 'how' to make the user easy to use.
But if this way is more flexible, I'll change it to check the regulator voltage.
This will be put in patch v3.
Thanks.