Skip to contentSkip to conversation

ASoC: rt1308: Add RT1308 amplifier driver

PATCH Superseded [email protected] 2 participants 2 messages Jun 15, 2019 – Jun 17, 2019

Subsystems (4)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ASoC: rt1308: Add RT1308 amplifier driver

From: Derek Fang <[email protected]>

This is the initial amplifier driver for rt1308.

---
 Documentation/devicetree/bindings/sound/rt1308.txt |  17 +
 sound/soc/codecs/Kconfig                           |   6 +
 sound/soc/codecs/Makefile                          |   2 +
 sound/soc/codecs/rt1308.c                          | 913 +++++++++++++++++++++
 sound/soc/codecs/rt1308.h                          | 291 +++++++
 5 files changed, 1229 insertions(+)
 create mode 100755 Documentation/devicetree/bindings/sound/rt1308.txt
 create mode 100755 sound/soc/codecs/rt1308.c
 create mode 100755 sound/soc/codecs/rt1308.h
Documentation/devicetree/bindings/sound/rt1308.txt new file +17 -0
new file mode 100755
index 0000000..2d46084
@@ -0,0 +1,17 @@
+RT1308 audio Amplifier
+
+This device supports I2C only.
+
+Required properties:
+
+- compatible : "realtek,rt1308".
+
+- reg : The I2C address of the device.
+
+
+Example:
+
+rt1308: rt1308@10 {
+	compatible = "realtek,rt1308";
+	reg = <0x10>;
+};
sound/soc/codecs/Kconfig +6 -0
index 4dfd469..34979cf 100644
@@ -143,6 +143,7 @@ config SND_SOC_ALL_CODECS
 	select SND_SOC_RT298 if I2C
 	select SND_SOC_RT1011 if I2C
 	select SND_SOC_RT1305 if I2C
+	select SND_SOC_RT1308 if I2C
 	select SND_SOC_RT5514 if I2C
 	select SND_SOC_RT5616 if I2C
 	select SND_SOC_RT5631 if I2C
@@ -881,6 +882,7 @@ config SND_SOC_RL6231
 	default y if SND_SOC_RT5682=y
 	default y if SND_SOC_RT1011=y
 	default y if SND_SOC_RT1305=y
+	default y if SND_SOC_RT1308=y
 	default m if SND_SOC_RT5514=m
 	default m if SND_SOC_RT5616=m
 	default m if SND_SOC_RT5640=m
@@ -896,6 +898,7 @@ config SND_SOC_RL6231
 	default m if SND_SOC_RT5682=m
 	default m if SND_SOC_RT1011=m
 	default m if SND_SOC_RT1305=m
+	default m if SND_SOC_RT1308=m
 
 config SND_SOC_RL6347A
 	tristate
@@ -924,6 +927,9 @@ config SND_SOC_RT1011
 config SND_SOC_RT1305
 	tristate
 
+config SND_SOC_RT1308
+	tristate
+
 config SND_SOC_RT5514
 	tristate
 
sound/soc/codecs/Makefile +2 -0
index 112701f..e6eb3b9 100644
@@ -144,6 +144,7 @@ snd-soc-rl6231-objs := rl6231.o
 snd-soc-rl6347a-objs := rl6347a.o
 snd-soc-rt1011-objs := rt1011.o
 snd-soc-rt1305-objs := rt1305.o
+snd-soc-rt1308-objs := rt1308.o
 snd-soc-rt274-objs := rt274.o
 snd-soc-rt286-objs := rt286.o
 snd-soc-rt298-objs := rt298.o
@@ -420,6 +421,7 @@ obj-$(CONFIG_SND_SOC_RL6231)	+= snd-soc-rl6231.o
 obj-$(CONFIG_SND_SOC_RL6347A)	+= snd-soc-rl6347a.o
 obj-$(CONFIG_SND_SOC_RT1011)	+= snd-soc-rt1011.o
 obj-$(CONFIG_SND_SOC_RT1305)	+= snd-soc-rt1305.o
+obj-$(CONFIG_SND_SOC_RT1308)	+= snd-soc-rt1308.o
 obj-$(CONFIG_SND_SOC_RT274)	+= snd-soc-rt274.o
 obj-$(CONFIG_SND_SOC_RT286)	+= snd-soc-rt286.o
 obj-$(CONFIG_SND_SOC_RT298)	+= snd-soc-rt298.o
sound/soc/codecs/rt1308.c new file +913 -0

913 lines not on this page · raw message

sound/soc/codecs/rt1308.h new file +291 -0

291 lines not on this page · raw message

Signature · 1 line
2.7.4
maintainer
#1 lore raw

On Sat, Jun 15, 2019 at 05:04:47PM +0800, [email protected] wrote:

This looks mostly good, a couple of really small things which should be easy to fix:

sound/soc/codecs/rt1308.c line 883

Quoted 11 lines
sound/soc/codecs/rt1308.c new file +11 -0
+	return devm_snd_soc_register_component(&i2c->dev,
+			&soc_component_dev_rt1308,
+			rt1308_dai, ARRAY_SIZE(rt1308_dai));
+}
+
+static int rt1308_i2c_remove(struct i2c_client *i2c)
+{
+	snd_soc_unregister_component(&i2c->dev);
+
+	return 0;
+}

You used devm_snd_soc_register_component() so no need to explicitly unregister and this function can go.

sound/soc/codecs/rt1308.c line 899

Quoted 3 lines
sound/soc/codecs/rt1308.c new file +3 -0
+#if defined(CONFIG_OF)
+		.of_match_table = rt1308_of_match,
+#endif

of_match_ptr()

sound/soc/codecs/rt1308.c line 902

Quoted 3 lines
sound/soc/codecs/rt1308.c new file +3 -0
+#if defined(CONFIG_ACPI)
+		.acpi_match_table = ACPI_PTR(rt1308_acpi_match)
+#endif

No need for the ifdef, that's what ACPI_PTR() does.