Skip to contentSkip to conversation

ASoC: rt5670: 2 small cleanups

PATCH In review Hans de Goede 2 participants 5 messages Jul 3, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v2 cover ASoC: rt5670: 2 small cleanups

Hi All,

Here is in essence a resend of my 2 cleanup patches for the rt5670 ASoC codec code, rebased on top of broonie/sound/for-5.9 with broonie/sound/for-5.8 merged in.

Regards,

Hans

p.s.

I'll also send out the patch improving the comment in cht_bsw_rt5672.c cht_codec_fixup() which Pierre-Louis requested soon.

#1 lore raw

PATCH v2 1/2 ASoC: rt5670: Remove struct rt5670_platform_data

platform_data is an obsolete concept, instead device_properties, set through e.g. device-tree, should be used.

struct rt5670_platform_data is only used internally by the rt5670 codec driver, so lets remove it before someone starts relying on it.

---
 include/sound/rt5670.h    | 26 ------------------
 sound/soc/codecs/rt5670.c | 55 ++++++++++++++++++---------------------
 sound/soc/codecs/rt5670.h | 16 +++++++++---
 3 files changed, 38 insertions(+), 59 deletions(-)
 delete mode 100644 include/sound/rt5670.h
include/sound/rt5670.h deleted +0 -26
deleted file mode 100644
index 02e1d7778354..000000000000
@@ -1,26 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * linux/sound/rt5670.h -- Platform data for RT5670
- *
- * Copyright 2014 Realtek Microelectronics
- */
-
-#ifndef __LINUX_SND_RT5670_H
-#define __LINUX_SND_RT5670_H
-
-struct rt5670_platform_data {
-	int jd_mode;
-	bool in2_diff;
-	bool dev_gpio;
-	bool gpio1_is_ext_spk_en;
-
-	bool dmic_en;
-	unsigned int dmic1_data_pin;
-	/* 0 = GPIO6; 1 = IN2P; 3 = GPIO7*/
-	unsigned int dmic2_data_pin;
-	/* 0 = GPIO8; 1 = IN3N; */
-	unsigned int dmic3_data_pin;
-	/* 0 = GPIO9; 1 = GPIO10; 2 = GPIO5*/
-};
-
-#endif
sound/soc/codecs/rt5670.c +25 -30

183 lines not on this page · raw message

sound/soc/codecs/rt5670.h +13 -3
index de0203369b7c..657420805918 100644
@@ -9,8 +9,6 @@
 #ifndef __RT5670_H__
 #define __RT5670_H__
 
-#include <sound/rt5670.h>
-
 /* Info */
 #define RT5670_RESET				0x00
 #define RT5670_VENDOR_ID			0xfd
@@ -1988,11 +1986,23 @@ int rt5670_sel_asrc_clk_src(struct snd_soc_component *component,
 
 struct rt5670_priv {
 	struct snd_soc_component *component;
-	struct rt5670_platform_data pdata;
 	struct regmap *regmap;
 	struct snd_soc_jack *jack;
 	struct snd_soc_jack_gpio hp_gpio;
 
+	int jd_mode;
+	bool in2_diff;
+	bool dev_gpio;
+	bool gpio1_is_ext_spk_en;
+
+	bool dmic_en;
+	unsigned int dmic1_data_pin;
+	/* 0 = GPIO6; 1 = IN2P; 3 = GPIO7*/
+	unsigned int dmic2_data_pin;
+	/* 0 = GPIO8; 1 = IN3N; */
+	unsigned int dmic3_data_pin;
+	/* 0 = GPIO9; 1 = GPIO10; 2 = GPIO5*/
+
 	int sysclk;
 	int sysclk_src;
 	int lrck[RT5670_AIFS];
Signature · 1 line
2.26.2
#2 lore raw

PATCH v2 2/2 ASoC: rt5670: Rename dev_gpio to gpio1_is_irq

In reply to Hans de Goede

Rename the not really descriptive dev_gpio quirk / setting to gpio1_is_irq, which describes what it actually does.

---
 sound/soc/codecs/rt5670.c | 24 ++++++++++++------------
 sound/soc/codecs/rt5670.h |  2 +-
 2 files changed, 13 insertions(+), 13 deletions(-)
sound/soc/codecs/rt5670.c +12 -12
index 3ccaeb985176..a0c8f58d729b 100644
@@ -30,7 +30,7 @@
 #include "rt5670.h"
 #include "rt5670-dsp.h"
 
-#define RT5670_DEV_GPIO			BIT(0)
+#define RT5670_GPIO1_IS_IRQ			BIT(0)
 #define RT5670_IN2_DIFF			BIT(1)
 #define RT5670_DMIC_EN			BIT(2)
 #define RT5670_DMIC1_IN2P		BIT(3)
@@ -2833,7 +2833,7 @@ static const struct dmi_system_id dmi_platform_intel_quirks[] = {
 		},
 		.driver_data = (unsigned long *)(RT5670_DMIC_EN |
 						 RT5670_DMIC1_IN2P |
-						 RT5670_DEV_GPIO |
+						 RT5670_GPIO1_IS_IRQ |
 						 RT5670_JD_MODE1),
 	},
 	{
@@ -2845,7 +2845,7 @@ static const struct dmi_system_id dmi_platform_intel_quirks[] = {
 		},
 		.driver_data = (unsigned long *)(RT5670_DMIC_EN |
 						 RT5670_DMIC1_IN2P |
-						 RT5670_DEV_GPIO |
+						 RT5670_GPIO1_IS_IRQ |
 						 RT5670_JD_MODE1),
 	},
 	{
@@ -2857,7 +2857,7 @@ static const struct dmi_system_id dmi_platform_intel_quirks[] = {
 		},
 		.driver_data = (unsigned long *)(RT5670_DMIC_EN |
 						 RT5670_DMIC2_INR |
-						 RT5670_DEV_GPIO |
+						 RT5670_GPIO1_IS_IRQ |
 						 RT5670_JD_MODE1),
 	},
 	{
@@ -2869,7 +2869,7 @@ static const struct dmi_system_id dmi_platform_intel_quirks[] = {
 		},
 		.driver_data = (unsigned long *)(RT5670_DMIC_EN |
 						 RT5670_DMIC1_IN2P |
-						 RT5670_DEV_GPIO |
+						 RT5670_GPIO1_IS_IRQ |
 						 RT5670_JD_MODE1),
 	},
 	{
@@ -2881,7 +2881,7 @@ static const struct dmi_system_id dmi_platform_intel_quirks[] = {
 		},
 		.driver_data = (unsigned long *)(RT5670_DMIC_EN |
 						 RT5670_DMIC1_IN2P |
-						 RT5670_DEV_GPIO |
+						 RT5670_GPIO1_IS_IRQ |
 						 RT5670_JD_MODE1),
 	},
 	{
@@ -2905,7 +2905,7 @@ static const struct dmi_system_id dmi_platform_intel_quirks[] = {
 		},
 		.driver_data = (unsigned long *)(RT5670_DMIC_EN |
 						 RT5670_DMIC2_INR |
-						 RT5670_DEV_GPIO |
+						 RT5670_GPIO1_IS_IRQ |
 						 RT5670_JD_MODE3),
 	},
 	{
@@ -2917,7 +2917,7 @@ static const struct dmi_system_id dmi_platform_intel_quirks[] = {
 		},
 		.driver_data = (unsigned long *)(RT5670_DMIC_EN |
 						 RT5670_DMIC2_INR |
-						 RT5670_DEV_GPIO |
+						 RT5670_GPIO1_IS_IRQ |
 						 RT5670_JD_MODE3),
 	},
 	{}
@@ -2945,9 +2945,9 @@ static int rt5670_i2c_probe(struct i2c_client *i2c,
 		rt5670_quirk = quirk_override;
 	}
 
-	if (rt5670_quirk & RT5670_DEV_GPIO) {
-		rt5670->dev_gpio = true;
-		dev_info(&i2c->dev, "quirk dev_gpio\n");
+	if (rt5670_quirk & RT5670_GPIO1_IS_IRQ) {
+		rt5670->gpio1_is_irq = true;
+		dev_info(&i2c->dev, "quirk GPIO1 is IRQ\n");
 	}
 	if (rt5670_quirk & RT5670_GPIO1_IS_EXT_SPK_EN) {
 		rt5670->gpio1_is_ext_spk_en = true;
@@ -3040,7 +3040,7 @@ static int rt5670_i2c_probe(struct i2c_client *i2c,
 		regmap_update_bits(rt5670->regmap, RT5670_IN2,
 					RT5670_IN_DF2, RT5670_IN_DF2);
 
-	if (rt5670->dev_gpio) {
+	if (rt5670->gpio1_is_irq) {
 		/* for push button */
 		regmap_write(rt5670->regmap, RT5670_IL_CMD, 0x0000);
 		regmap_write(rt5670->regmap, RT5670_IL_CMD2, 0x0010);
sound/soc/codecs/rt5670.h +1 -1
index 657420805918..56b13fe6bd3c 100644
@@ -1992,7 +1992,7 @@ struct rt5670_priv {
 
 	int jd_mode;
 	bool in2_diff;
-	bool dev_gpio;
+	bool gpio1_is_irq;
 	bool gpio1_is_ext_spk_en;
 
 	bool dmic_en;
Signature · 1 line
2.26.2
author Reviewed-by Pierre-Louis Bossart on the v2 series
#3 lore raw
In reply to Hans de Goede

Hi,

Quoted 9 lines · Hans de Goede

Hi All,

Here is in essence a resend of my 2 cleanup patches for the rt5670 ASoC codec code, rebased on top of broonie/sound/for-5.9 with broonie/sound/for-5.8 merged in.

Regards,

Hans

I just realized I forgot to add the Reviewed-by from Pierre-Louis from v1, since these are unchanged (only rebased) that still stands, so this series is:

Regards,

Hans

maintainer
#4 lore raw
In reply to Hans de Goede
Quoted 9 lines · Hans de Goede

Here is in essence a resend of my 2 cleanup patches for the rt5670 ASoC codec code, rebased on top of broonie/sound/for-5.9 with broonie/sound/for-5.8 merged in.

Regards,

Hans

[...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/2] ASoC: rt5670: Remove struct rt5670_platform_data

      commit: c14f61a89c1335f95d9b37624ee157fb1fd424ee
[2/2] ASoC: rt5670: Rename dev_gpio to gpio1_is_irq
      commit: 883330c11fa6dca55e30f8612398b3e0abc51dc5

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