Skip to contentSkip to conversation

ASoC: add rt298 codec driver

PATCH In review Bard Liao 2 participants 5 messages Jun 26, 2015 – Jul 13, 2015

Subsystems (3)
lore
Share & tools
lore

Bard Liao

author
#0 lore raw

PATCH 1/1 ASoC: add rt298 codec driver

It is the initial version of ALC298 codec driver.

---
 include/sound/rt298.h     |   20 +
 sound/soc/codecs/Kconfig  |    7 +
 sound/soc/codecs/Makefile |    2 +
 sound/soc/codecs/rt298.c  | 1274 +++++++++++++++++++++++++++++++++++++++++++++
 sound/soc/codecs/rt298.h  |  206 ++++++++
 5 files changed, 1509 insertions(+)
 create mode 100644 include/sound/rt298.h
 create mode 100644 sound/soc/codecs/rt298.c
 create mode 100644 sound/soc/codecs/rt298.h
include/sound/rt298.h new file +20 -0
new file mode 100644
index 0000000..7fffeaa
@@ -0,0 +1,20 @@
+/*
+ * linux/sound/rt286.h -- Platform data for RT286
+ *
+ * Copyright 2013 Realtek Microelectronics
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef __LINUX_SND_RT298_H
+#define __LINUX_SND_RT298_H
+
+struct rt298_platform_data {
+	bool cbj_en; /*combo jack enable*/
+	bool gpio2_en; /*GPIO2 enable*/
+	bool suspend_power_off; /* power is off during suspend */
+};
+
+#endif
sound/soc/codecs/Kconfig +7 -0
index efaafce..76125a2 100644
@@ -83,6 +83,7 @@ config SND_SOC_ALL_CODECS
 	select SND_SOC_PCM512x_I2C if I2C
 	select SND_SOC_PCM512x_SPI if SPI_MASTER
 	select SND_SOC_RT286 if I2C
+	select SND_SOC_RT298 if I2C
 	select SND_SOC_RT5631 if I2C
 	select SND_SOC_RT5640 if I2C
 	select SND_SOC_RT5645 if I2C
@@ -512,12 +513,18 @@ config SND_SOC_RL6231
 config SND_SOC_RL6347A
 	tristate
 	default y if SND_SOC_RT286=y
+	default y if SND_SOC_RT298=y
 	default m if SND_SOC_RT286=m
+	default m if SND_SOC_RT298=m
 
 config SND_SOC_RT286
 	tristate
 	depends on I2C
 
+config SND_SOC_RT298
+	tristate
+	depends on I2C
+
 config SND_SOC_RT5631
 	tristate "Realtek ALC5631/RT5631 CODEC"
 	depends on I2C
sound/soc/codecs/Makefile +2 -0
index cf160d9..3b58c45 100644
@@ -79,6 +79,7 @@ snd-soc-pcm512x-spi-objs := pcm512x-spi.o
 snd-soc-rl6231-objs := rl6231.o
 snd-soc-rl6347a-objs := rl6347a.o
 snd-soc-rt286-objs := rt286.o
+snd-soc-rt298-objs := rt298.o
 snd-soc-rt5631-objs := rt5631.o
 snd-soc-rt5640-objs := rt5640.o
 snd-soc-rt5645-objs := rt5645.o
@@ -266,6 +267,7 @@ obj-$(CONFIG_SND_SOC_PCM512x_SPI)	+= snd-soc-pcm512x-spi.o
 obj-$(CONFIG_SND_SOC_RL6231)	+= snd-soc-rl6231.o
 obj-$(CONFIG_SND_SOC_RL6347A)	+= snd-soc-rl6347a.o
 obj-$(CONFIG_SND_SOC_RT286)	+= snd-soc-rt286.o
+obj-$(CONFIG_SND_SOC_RT298)	+= snd-soc-rt298.o
 obj-$(CONFIG_SND_SOC_RT5631)	+= snd-soc-rt5631.o
 obj-$(CONFIG_SND_SOC_RT5640)	+= snd-soc-rt5640.o
 obj-$(CONFIG_SND_SOC_RT5645)	+= snd-soc-rt5645.o
sound/soc/codecs/rt298.c new file +1274 -0

1,274 lines not on this page · raw message

sound/soc/codecs/rt298.h new file +206 -0

206 lines not on this page · raw message

Signature · 1 line
1.8.1.1.439.g50a6b54
maintainer
#1 lore raw
Quoted 1 line · Bard Liao

It is the initial version of ALC298 codec driver.

I'll apply this but a few things here which you should look at:

Quoted 4 lines
sound/soc/codecs/rt298.c new file +4 -0
+static int rt298_probe(struct snd_soc_codec *codec)
+{
+	struct rt298_priv *rt298 = snd_soc_codec_get_drvdata(codec);
+

sound/soc/codecs/rt298.c line 1001

Quoted 10 lines
sound/soc/codecs/rt298.c new file +10 -0
+	rt298->codec = codec;
+
+	if (rt298->i2c->irq) {
+		regmap_update_bits(rt298->regmap,
+					RT298_IRQ_CTRL, 0x2, 0x2);
+
+		INIT_DELAYED_WORK(&rt298->jack_detect_work,
+					rt298_jack_detect_work);
+		schedule_delayed_work(&rt298->jack_detect_work,
+					msecs_to_jiffies(1250));

That seems like an awfully long time to wait to do the first jack detection. What's this for?

sound/soc/codecs/rt298.c line 1147

Quoted 10 lines
sound/soc/codecs/rt298.c new file +10 -0
+static int rt298_i2c_probe(struct i2c_client *i2c,
+			   const struct i2c_device_id *id)
+{
+	struct rt298_platform_data *pdata = dev_get_platdata(&i2c->dev);
+	struct rt298_priv *rt298;
+	struct device *dev = &i2c->dev;
+	const struct acpi_device_id *acpiid;
+	int i, ret;
+
+	pr_info("%s\n", __func__);

This isn't adding anything, you should remove it.

author
#2 lore raw
Quoted 13 lines

-----Original Message-----
From: Mark Brown [mailto:[email protected]]
Sent: Thursday, July 09, 2015 7:09 PM
To: Bard Liao
Cc: [email protected]; [email protected]; [email protected]; Flove; Oder Chiou; John Lin; [email protected]
Subject: Re: [PATCH] ASoC: add rt298 codec driver

Quoted 1 line · Bard Liao

It is the initial version of ALC298 codec driver.

I'll apply this but a few things here which you should look at:

Quoted 16 lines

sound/soc/codecs/rt298.c line 1001

Quoted 13 lines
sound/soc/codecs/rt298.c new file +13 -0
+static int rt298_probe(struct snd_soc_codec *codec) {
+	struct rt298_priv *rt298 = snd_soc_codec_get_drvdata(codec);
+
+	rt298->codec = codec;
+
+	if (rt298->i2c->irq) {
+		regmap_update_bits(rt298->regmap,
+					RT298_IRQ_CTRL, 0x2, 0x2);
+
+		INIT_DELAYED_WORK(&rt298->jack_detect_work,
+					rt298_jack_detect_work);
+		schedule_delayed_work(&rt298->jack_detect_work,
+					msecs_to_jiffies(1250));

That seems like an awfully long time to wait to do the first jack detection. What's this for?

Originally, that is for waiting dapm initialization. Now we check rt298->codec at the beginning of rt298_jack_detect. I don't know if it is still necessary.

Quoted 12 lines

sound/soc/codecs/rt298.c line 1147

Quoted 10 lines
sound/soc/codecs/rt298.c new file +9 -0
+static int rt298_i2c_probe(struct i2c_client *i2c,
+			   const struct i2c_device_id *id) {
+	struct rt298_platform_data *pdata = dev_get_platdata(&i2c->dev);
+	struct rt298_priv *rt298;
+	struct device *dev = &i2c->dev;
+	const struct acpi_device_id *acpiid;
+	int i, ret;
+
+	pr_info("%s\n", __func__);

This isn't adding anything, you should remove it.

Do you mean remove "pr_info("%s\n", __func__);" ?

Quoted 2 lines

------Please consider the environment before printing this e-mail.

maintainer
#3 lore raw
Quoted 5 lines · Bard Liao
Quoted 3 lines

sound/soc/codecs/rt298.c line 1147

Quoted 1 line
sound/soc/codecs/rt298.c new file +1 -0
+	pr_info("%s\n", __func__);

This isn't adding anything, you should remove it.

Do you mean remove "pr_info("%s\n", __func__);" ?

Yes.

maintainer
#4 lore raw

Applied "ASoC: add rt298 codec driver" to the asoc tree

In reply to Bard Liao

The patch

ASoC: add rt298 codec driver

has been applied to the asoc tree at

git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

Quoted 1 line

From 6adcafae6ed20fe380addc8e7c628e529751ade3 Mon Sep 17 00:00:00 2001

From: Bard Liao <[email protected]>
Date: Fri, 26 Jun 2015 10:59:49 +0800
Subject: [PATCH] ASoC: add rt298 codec driver

It is the initial version of ALC298 codec driver.

---
 include/sound/rt298.h     |   20 +
 sound/soc/codecs/Kconfig  |    7 +
 sound/soc/codecs/Makefile |    2 +
 sound/soc/codecs/rt298.c  | 1274 +++++++++++++++++++++++++++++++++++++++++++++
 sound/soc/codecs/rt298.h  |  206 ++++++++
 5 files changed, 1509 insertions(+)
 create mode 100644 include/sound/rt298.h
 create mode 100644 sound/soc/codecs/rt298.c
 create mode 100644 sound/soc/codecs/rt298.h
include/sound/rt298.h new file +20 -0
new file mode 100644
index 000000000000..7fffeaa84f64
@@ -0,0 +1,20 @@
+/*
+ * linux/sound/rt286.h -- Platform data for RT286
+ *
+ * Copyright 2013 Realtek Microelectronics
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef __LINUX_SND_RT298_H
+#define __LINUX_SND_RT298_H
+
+struct rt298_platform_data {
+	bool cbj_en; /*combo jack enable*/
+	bool gpio2_en; /*GPIO2 enable*/
+	bool suspend_power_off; /* power is off during suspend */
+};
+
+#endif
sound/soc/codecs/Kconfig +7 -0
index efaafce8ba38..76125a281557 100644
@@ -83,6 +83,7 @@ config SND_SOC_ALL_CODECS
 	select SND_SOC_PCM512x_I2C if I2C
 	select SND_SOC_PCM512x_SPI if SPI_MASTER
 	select SND_SOC_RT286 if I2C
+	select SND_SOC_RT298 if I2C
 	select SND_SOC_RT5631 if I2C
 	select SND_SOC_RT5640 if I2C
 	select SND_SOC_RT5645 if I2C
@@ -512,12 +513,18 @@ config SND_SOC_RL6231
 config SND_SOC_RL6347A
 	tristate
 	default y if SND_SOC_RT286=y
+	default y if SND_SOC_RT298=y
 	default m if SND_SOC_RT286=m
+	default m if SND_SOC_RT298=m
 
 config SND_SOC_RT286
 	tristate
 	depends on I2C
 
+config SND_SOC_RT298
+	tristate
+	depends on I2C
+
 config SND_SOC_RT5631
 	tristate "Realtek ALC5631/RT5631 CODEC"
 	depends on I2C
sound/soc/codecs/Makefile +2 -0
index cf160d972cb3..3b58c4571859 100644
@@ -79,6 +79,7 @@ snd-soc-pcm512x-spi-objs := pcm512x-spi.o
 snd-soc-rl6231-objs := rl6231.o
 snd-soc-rl6347a-objs := rl6347a.o
 snd-soc-rt286-objs := rt286.o
+snd-soc-rt298-objs := rt298.o
 snd-soc-rt5631-objs := rt5631.o
 snd-soc-rt5640-objs := rt5640.o
 snd-soc-rt5645-objs := rt5645.o
@@ -266,6 +267,7 @@ obj-$(CONFIG_SND_SOC_PCM512x_SPI)	+= snd-soc-pcm512x-spi.o
 obj-$(CONFIG_SND_SOC_RL6231)	+= snd-soc-rl6231.o
 obj-$(CONFIG_SND_SOC_RL6347A)	+= snd-soc-rl6347a.o
 obj-$(CONFIG_SND_SOC_RT286)	+= snd-soc-rt286.o
+obj-$(CONFIG_SND_SOC_RT298)	+= snd-soc-rt298.o
 obj-$(CONFIG_SND_SOC_RT5631)	+= snd-soc-rt5631.o
 obj-$(CONFIG_SND_SOC_RT5640)	+= snd-soc-rt5640.o
 obj-$(CONFIG_SND_SOC_RT5645)	+= snd-soc-rt5645.o
sound/soc/codecs/rt298.c new file +1274 -0

1,274 lines not on this page · raw message

sound/soc/codecs/rt298.h new file +206 -0

206 lines not on this page · raw message

Signature · 1 line
2.1.4