public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Match data improvements for tlv320aic32x4 driver
@ 2023-08-28 19:10 Biju Das
  2023-08-28 19:10 ` [PATCH v2 1/2] ASoC: codec: tlv320aic32x4: Add enum aic32x4_type to aic32x4_probe() Biju Das
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Biju Das @ 2023-08-28 19:10 UTC (permalink / raw)
  To: Shenghao Ding, Kevin Lu, Baojun Xu, Jaroslav Kysela, Takashi Iwai
  Cc: Biju Das, Liam Girdwood, Mark Brown, alsa-devel, linux-kernel,
	Andy Shevchenko

This patch series aims to add match data improvements for tlv320aic32x4
driver.

This patch series is only compile tested.

v1->v2:
 * Created patch#1 for adding enum aic32x4_type to aic32x4_probe() and
   drop using dev_set_drvdata() from tlv320aic32x4_{i2c,spi} drivers.
 * Return value of i2c_get_match_data() passed to type paramemter in
   aic32x4_probe().

Biju Das (2):
  ASoC: codec: tlv320aic32x4: Add enum aic32x4_type to aic32x4_probe()
  ASoC: tlv320aic32x4-i2c: Simplify probe()

 sound/soc/codecs/tlv320aic32x4-i2c.c | 19 +++----------------
 sound/soc/codecs/tlv320aic32x4-spi.c |  7 ++++---
 sound/soc/codecs/tlv320aic32x4.c     |  5 +++--
 sound/soc/codecs/tlv320aic32x4.h     |  3 ++-
 4 files changed, 12 insertions(+), 22 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2 1/2] ASoC: codec: tlv320aic32x4: Add enum aic32x4_type to aic32x4_probe()
  2023-08-28 19:10 [PATCH v2 0/2] Match data improvements for tlv320aic32x4 driver Biju Das
@ 2023-08-28 19:10 ` Biju Das
  2023-08-29 14:57   ` Andy Shevchenko
  2023-08-28 19:10 ` [PATCH v2 2/2] ASoC: tlv320aic32x4-i2c: Simplify probe() Biju Das
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Biju Das @ 2023-08-28 19:10 UTC (permalink / raw)
  To: Shenghao Ding, Kevin Lu, Baojun Xu, Jaroslav Kysela, Takashi Iwai
  Cc: Biju Das, Liam Girdwood, Mark Brown, alsa-devel, linux-kernel,
	Andy Shevchenko

Add enum aic32x4_type to aic32x4_probe() and drop using dev_set_drvdata()
from tlv320aic32x4_{i2c,spi} drivers.

Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
v2:
 * New patch.
---
 sound/soc/codecs/tlv320aic32x4-i2c.c | 7 ++++---
 sound/soc/codecs/tlv320aic32x4-spi.c | 7 ++++---
 sound/soc/codecs/tlv320aic32x4.c     | 5 +++--
 sound/soc/codecs/tlv320aic32x4.h     | 3 ++-
 4 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/sound/soc/codecs/tlv320aic32x4-i2c.c b/sound/soc/codecs/tlv320aic32x4-i2c.c
index 49b33a256cd7..713f3f63b5e3 100644
--- a/sound/soc/codecs/tlv320aic32x4-i2c.c
+++ b/sound/soc/codecs/tlv320aic32x4-i2c.c
@@ -23,6 +23,7 @@ static int aic32x4_i2c_probe(struct i2c_client *i2c)
 {
 	struct regmap *regmap;
 	struct regmap_config config;
+	enum aic32x4_type type;
 
 	config = aic32x4_regmap_config;
 	config.reg_bits = 8;
@@ -34,15 +35,15 @@ static int aic32x4_i2c_probe(struct i2c_client *i2c)
 		const struct of_device_id *oid;
 
 		oid = of_match_node(aic32x4_of_id, i2c->dev.of_node);
-		dev_set_drvdata(&i2c->dev, (void *)oid->data);
+		type = (uintptr_t)oid->data;
 	} else {
 		const struct i2c_device_id *id;
 
 		id = i2c_match_id(aic32x4_i2c_id, i2c);
-		dev_set_drvdata(&i2c->dev, (void *)id->driver_data);
+		type = id->driver_data;
 	}
 
-	return aic32x4_probe(&i2c->dev, regmap);
+	return aic32x4_probe(&i2c->dev, regmap, type);
 }
 
 static void aic32x4_i2c_remove(struct i2c_client *i2c)
diff --git a/sound/soc/codecs/tlv320aic32x4-spi.c b/sound/soc/codecs/tlv320aic32x4-spi.c
index 03cce8d6404f..81c05030dd3b 100644
--- a/sound/soc/codecs/tlv320aic32x4-spi.c
+++ b/sound/soc/codecs/tlv320aic32x4-spi.c
@@ -22,6 +22,7 @@ static int aic32x4_spi_probe(struct spi_device *spi)
 {
 	struct regmap *regmap;
 	struct regmap_config config;
+	enum aic32x4_type type;
 
 	config = aic32x4_regmap_config;
 	config.reg_bits = 7;
@@ -35,15 +36,15 @@ static int aic32x4_spi_probe(struct spi_device *spi)
 		const struct of_device_id *oid;
 
 		oid = of_match_node(aic32x4_of_id, spi->dev.of_node);
-		dev_set_drvdata(&spi->dev, (void *)oid->data);
+		type = (uintptr_t)oid->data;
 	} else {
 		const struct spi_device_id *id_entry;
 
 		id_entry = spi_get_device_id(spi);
-		dev_set_drvdata(&spi->dev, (void *)id_entry->driver_data);
+		type = id_entry->driver_data;
 	}
 
-	return aic32x4_probe(&spi->dev, regmap);
+	return aic32x4_probe(&spi->dev, regmap, type);
 }
 
 static void aic32x4_spi_remove(struct spi_device *spi)
diff --git a/sound/soc/codecs/tlv320aic32x4.c b/sound/soc/codecs/tlv320aic32x4.c
index 6829834a412f..5c0c81da06db 100644
--- a/sound/soc/codecs/tlv320aic32x4.c
+++ b/sound/soc/codecs/tlv320aic32x4.c
@@ -1333,7 +1333,8 @@ static int aic32x4_setup_regulators(struct device *dev,
 	return ret;
 }
 
-int aic32x4_probe(struct device *dev, struct regmap *regmap)
+int aic32x4_probe(struct device *dev, struct regmap *regmap,
+		  enum aic32x4_type type)
 {
 	struct aic32x4_priv *aic32x4;
 	struct aic32x4_pdata *pdata = dev->platform_data;
@@ -1349,7 +1350,7 @@ int aic32x4_probe(struct device *dev, struct regmap *regmap)
 		return -ENOMEM;
 
 	aic32x4->dev = dev;
-	aic32x4->type = (uintptr_t)dev_get_drvdata(dev);
+	aic32x4->type = type;
 
 	dev_set_drvdata(dev, aic32x4);
 
diff --git a/sound/soc/codecs/tlv320aic32x4.h b/sound/soc/codecs/tlv320aic32x4.h
index d6101ce73f80..f68a846ef61d 100644
--- a/sound/soc/codecs/tlv320aic32x4.h
+++ b/sound/soc/codecs/tlv320aic32x4.h
@@ -17,7 +17,8 @@ enum aic32x4_type {
 };
 
 extern const struct regmap_config aic32x4_regmap_config;
-int aic32x4_probe(struct device *dev, struct regmap *regmap);
+int aic32x4_probe(struct device *dev, struct regmap *regmap,
+		  enum aic32x4_type type);
 void aic32x4_remove(struct device *dev);
 int aic32x4_register_clocks(struct device *dev, const char *mclk_name);
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH v2 2/2] ASoC: tlv320aic32x4-i2c: Simplify probe()
  2023-08-28 19:10 [PATCH v2 0/2] Match data improvements for tlv320aic32x4 driver Biju Das
  2023-08-28 19:10 ` [PATCH v2 1/2] ASoC: codec: tlv320aic32x4: Add enum aic32x4_type to aic32x4_probe() Biju Das
@ 2023-08-28 19:10 ` Biju Das
  2023-08-29 14:59   ` Andy Shevchenko
  2023-08-29 14:58 ` [PATCH v2 0/2] Match data improvements for tlv320aic32x4 driver Andy Shevchenko
  2023-09-11 23:57 ` Mark Brown
  3 siblings, 1 reply; 8+ messages in thread
From: Biju Das @ 2023-08-28 19:10 UTC (permalink / raw)
  To: Shenghao Ding, Kevin Lu, Baojun Xu, Jaroslav Kysela, Takashi Iwai
  Cc: Biju Das, Liam Girdwood, Mark Brown, alsa-devel, linux-kernel,
	Andy Shevchenko

Simplify probe() by replacing of_match_node() and i2c_match_id() with
i2c_get_match_data().

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
v1->v2:
 * Return value of i2c_get_match_data() passed to type paramemter in
   aic32x4_probe().
---
 sound/soc/codecs/tlv320aic32x4-i2c.c | 16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)

diff --git a/sound/soc/codecs/tlv320aic32x4-i2c.c b/sound/soc/codecs/tlv320aic32x4-i2c.c
index 713f3f63b5e3..b27b5ae1e4b2 100644
--- a/sound/soc/codecs/tlv320aic32x4-i2c.c
+++ b/sound/soc/codecs/tlv320aic32x4-i2c.c
@@ -16,9 +16,6 @@
 
 #include "tlv320aic32x4.h"
 
-static const struct of_device_id aic32x4_of_id[];
-static const struct i2c_device_id aic32x4_i2c_id[];
-
 static int aic32x4_i2c_probe(struct i2c_client *i2c)
 {
 	struct regmap *regmap;
@@ -30,18 +27,7 @@ static int aic32x4_i2c_probe(struct i2c_client *i2c)
 	config.val_bits = 8;
 
 	regmap = devm_regmap_init_i2c(i2c, &config);
-
-	if (i2c->dev.of_node) {
-		const struct of_device_id *oid;
-
-		oid = of_match_node(aic32x4_of_id, i2c->dev.of_node);
-		type = (uintptr_t)oid->data;
-	} else {
-		const struct i2c_device_id *id;
-
-		id = i2c_match_id(aic32x4_i2c_id, i2c);
-		type = id->driver_data;
-	}
+	type = (uintptr_t)i2c_get_match_data(i2c);
 
 	return aic32x4_probe(&i2c->dev, regmap, type);
 }
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 1/2] ASoC: codec: tlv320aic32x4: Add enum aic32x4_type to aic32x4_probe()
  2023-08-28 19:10 ` [PATCH v2 1/2] ASoC: codec: tlv320aic32x4: Add enum aic32x4_type to aic32x4_probe() Biju Das
@ 2023-08-29 14:57   ` Andy Shevchenko
  0 siblings, 0 replies; 8+ messages in thread
From: Andy Shevchenko @ 2023-08-29 14:57 UTC (permalink / raw)
  To: Biju Das
  Cc: Shenghao Ding, Kevin Lu, Baojun Xu, Jaroslav Kysela, Takashi Iwai,
	Liam Girdwood, Mark Brown, alsa-devel, linux-kernel

On Mon, Aug 28, 2023 at 08:10:13PM +0100, Biju Das wrote:
> Add enum aic32x4_type to aic32x4_probe() and drop using dev_set_drvdata()
> from tlv320aic32x4_{i2c,spi} drivers.

Yep, something like this, which looks okay to me
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 0/2] Match data improvements for tlv320aic32x4 driver
  2023-08-28 19:10 [PATCH v2 0/2] Match data improvements for tlv320aic32x4 driver Biju Das
  2023-08-28 19:10 ` [PATCH v2 1/2] ASoC: codec: tlv320aic32x4: Add enum aic32x4_type to aic32x4_probe() Biju Das
  2023-08-28 19:10 ` [PATCH v2 2/2] ASoC: tlv320aic32x4-i2c: Simplify probe() Biju Das
@ 2023-08-29 14:58 ` Andy Shevchenko
  2023-09-11 23:57 ` Mark Brown
  3 siblings, 0 replies; 8+ messages in thread
From: Andy Shevchenko @ 2023-08-29 14:58 UTC (permalink / raw)
  To: Biju Das
  Cc: Shenghao Ding, Kevin Lu, Baojun Xu, Jaroslav Kysela, Takashi Iwai,
	Liam Girdwood, Mark Brown, alsa-devel, linux-kernel

On Mon, Aug 28, 2023 at 08:10:12PM +0100, Biju Das wrote:
> This patch series aims to add match data improvements for tlv320aic32x4
> driver.
> 
> This patch series is only compile tested.

Also convert SPI to the new similar API.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 2/2] ASoC: tlv320aic32x4-i2c: Simplify probe()
  2023-08-28 19:10 ` [PATCH v2 2/2] ASoC: tlv320aic32x4-i2c: Simplify probe() Biju Das
@ 2023-08-29 14:59   ` Andy Shevchenko
  2023-08-29 15:00     ` Biju Das
  0 siblings, 1 reply; 8+ messages in thread
From: Andy Shevchenko @ 2023-08-29 14:59 UTC (permalink / raw)
  To: Biju Das
  Cc: Shenghao Ding, Kevin Lu, Baojun Xu, Jaroslav Kysela, Takashi Iwai,
	Liam Girdwood, Mark Brown, alsa-devel, linux-kernel

On Mon, Aug 28, 2023 at 08:10:14PM +0100, Biju Das wrote:
> Simplify probe() by replacing of_match_node() and i2c_match_id() with
> i2c_get_match_data().

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
assuming that you finish this by converting SPI part as well.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH v2 2/2] ASoC: tlv320aic32x4-i2c: Simplify probe()
  2023-08-29 14:59   ` Andy Shevchenko
@ 2023-08-29 15:00     ` Biju Das
  0 siblings, 0 replies; 8+ messages in thread
From: Biju Das @ 2023-08-29 15:00 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Shenghao Ding, Kevin Lu, Baojun Xu, Jaroslav Kysela, Takashi Iwai,
	Liam Girdwood, Mark Brown, alsa-devel@alsa-project.org,
	linux-kernel@vger.kernel.org

Hi Andy Shevchenko,

> Subject: Re: [PATCH v2 2/2] ASoC: tlv320aic32x4-i2c: Simplify probe()
> 
> On Mon, Aug 28, 2023 at 08:10:14PM +0100, Biju Das wrote:
> > Simplify probe() by replacing of_match_node() and i2c_match_id() with
> > i2c_get_match_data().
> 
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> assuming that you finish this by converting SPI part as well.

Sure.

Cheers,
Biju

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2 0/2] Match data improvements for tlv320aic32x4 driver
  2023-08-28 19:10 [PATCH v2 0/2] Match data improvements for tlv320aic32x4 driver Biju Das
                   ` (2 preceding siblings ...)
  2023-08-29 14:58 ` [PATCH v2 0/2] Match data improvements for tlv320aic32x4 driver Andy Shevchenko
@ 2023-09-11 23:57 ` Mark Brown
  3 siblings, 0 replies; 8+ messages in thread
From: Mark Brown @ 2023-09-11 23:57 UTC (permalink / raw)
  To: Shenghao Ding, Kevin Lu, Baojun Xu, Jaroslav Kysela, Takashi Iwai,
	Biju Das
  Cc: Liam Girdwood, alsa-devel, linux-kernel, Andy Shevchenko

On Mon, 28 Aug 2023 20:10:12 +0100, Biju Das wrote:
> This patch series aims to add match data improvements for tlv320aic32x4
> driver.
> 
> This patch series is only compile tested.
> 
> v1->v2:
>  * Created patch#1 for adding enum aic32x4_type to aic32x4_probe() and
>    drop using dev_set_drvdata() from tlv320aic32x4_{i2c,spi} drivers.
>  * Return value of i2c_get_match_data() passed to type paramemter in
>    aic32x4_probe().
> 
> [...]

Applied to

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

Thanks!

[1/2] ASoC: codec: tlv320aic32x4: Add enum aic32x4_type to aic32x4_probe()
      commit: cac1636e214930b01b2f8ac9867771486554271a
[2/2] ASoC: tlv320aic32x4-i2c: Simplify probe()
      commit: d44f7bc9d181a2bec0dcff694d00b08c8f99284d

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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-09-12  2:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-28 19:10 [PATCH v2 0/2] Match data improvements for tlv320aic32x4 driver Biju Das
2023-08-28 19:10 ` [PATCH v2 1/2] ASoC: codec: tlv320aic32x4: Add enum aic32x4_type to aic32x4_probe() Biju Das
2023-08-29 14:57   ` Andy Shevchenko
2023-08-28 19:10 ` [PATCH v2 2/2] ASoC: tlv320aic32x4-i2c: Simplify probe() Biju Das
2023-08-29 14:59   ` Andy Shevchenko
2023-08-29 15:00     ` Biju Das
2023-08-29 14:58 ` [PATCH v2 0/2] Match data improvements for tlv320aic32x4 driver Andy Shevchenko
2023-09-11 23:57 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox