All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/8] ASoC: Intel: boards: use software node API
@ 2021-08-12 22:44 Pierre-Louis Bossart
  2021-08-12 22:44 ` [PATCH v2 1/8] ASoC: Intel: boards: harden codec property handling Pierre-Louis Bossart
                   ` (8 more replies)
  0 siblings, 9 replies; 13+ messages in thread
From: Pierre-Louis Bossart @ 2021-08-12 22:44 UTC (permalink / raw)
  To: alsa-devel
  Cc: Heikki Krogerus, tiwai, Pierre-Louis Bossart, Hans de Goede,
	broonie, Andy Shevchenko

This is an update on an earlier contribution from Heikki Krogerus

The function device_add_properties() is going to be removed.
Replacing it with software node API equivalents.

Thanks for Hans de Goede and Andy Shevchenko for their comments,
suggestions and Reviewed-by tags on GitHub. The review thread can be
found at https://github.com/thesofproject/linux/pull/3041)

v2 changes: feedback from Andy and Hans
Better error handling
Codec reference is kept until the .remove callback
Remove bus search to find device

v1 changes from Heikki's patches:
Avoid the use of devm_ routines for Baytrail machine drivers.

Heikki Krogerus (1):
  ASoC: Intel: boards: use software node API in Atom boards

Pierre-Louis Bossart (7):
  ASoC: Intel: boards: harden codec property handling
  ASoC: Intel: boards: handle errors with acpi_dev_get_first_match_dev()
  ASoC: Intel: boards: get codec device with ACPI instead of bus search
  ASoC: Intel: sof_sdw: pass card information to init/exit functions
  ASoC: Intel: sof_sdw_rt711*: keep codec device reference until remove
  ASoC: Intel: use software node API in SoundWire machines
  ASoC: Intel: remove device_properties for Atom boards

 sound/soc/intel/boards/bytcht_es8316.c      | 31 ++++++++--
 sound/soc/intel/boards/bytcr_rt5640.c       | 57 ++++++++++++++-----
 sound/soc/intel/boards/bytcr_rt5651.c       | 63 ++++++++++++++-------
 sound/soc/intel/boards/sof_sdw.c            | 20 ++++---
 sound/soc/intel/boards/sof_sdw_common.h     | 37 +++++++-----
 sound/soc/intel/boards/sof_sdw_max98373.c   |  3 +-
 sound/soc/intel/boards/sof_sdw_rt1308.c     |  3 +-
 sound/soc/intel/boards/sof_sdw_rt1316.c     |  3 +-
 sound/soc/intel/boards/sof_sdw_rt5682.c     |  3 +-
 sound/soc/intel/boards/sof_sdw_rt700.c      |  3 +-
 sound/soc/intel/boards/sof_sdw_rt711.c      | 51 +++++++++--------
 sound/soc/intel/boards/sof_sdw_rt711_sdca.c | 52 +++++++++--------
 sound/soc/intel/boards/sof_sdw_rt715.c      |  3 +-
 sound/soc/intel/boards/sof_sdw_rt715_sdca.c |  3 +-
 14 files changed, 221 insertions(+), 111 deletions(-)

-- 
2.25.1


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

* [PATCH v2 1/8] ASoC: Intel: boards: harden codec property handling
  2021-08-12 22:44 [PATCH v2 0/8] ASoC: Intel: boards: use software node API Pierre-Louis Bossart
@ 2021-08-12 22:44 ` Pierre-Louis Bossart
  2021-08-13 10:22   ` Andy Shevchenko
  2021-08-12 22:44 ` [PATCH v2 2/8] ASoC: Intel: boards: handle errors with acpi_dev_get_first_match_dev() Pierre-Louis Bossart
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 13+ messages in thread
From: Pierre-Louis Bossart @ 2021-08-12 22:44 UTC (permalink / raw)
  To: alsa-devel
  Cc: Heikki Krogerus, tiwai, Pierre-Louis Bossart, Hans de Goede,
	broonie, Andy Shevchenko

In current ACPI-based devices, the DSDT does not include any of the
properties required by the codec driver. This is not an ACPI
limitation proper since the _DSD method could be used, as done for
Camera and SoundWire in newer platforms. For legacy devices, there is
unfortunately no other option than using a work-around: we add
properties to the codec device from the machine driver.

To avoid any issues with the codec driver being unbound, we need to
keep a reference to the codec device until the card is removed.

Co-developed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/intel/boards/bytcht_es8316.c | 12 ++++++--
 sound/soc/intel/boards/bytcr_rt5640.c  | 41 ++++++++++++++++++--------
 sound/soc/intel/boards/bytcr_rt5651.c  | 37 +++++++++++++++--------
 3 files changed, 62 insertions(+), 28 deletions(-)

diff --git a/sound/soc/intel/boards/bytcht_es8316.c b/sound/soc/intel/boards/bytcht_es8316.c
index a0af91580184..fcf7c9c04069 100644
--- a/sound/soc/intel/boards/bytcht_es8316.c
+++ b/sound/soc/intel/boards/bytcht_es8316.c
@@ -37,6 +37,7 @@ struct byt_cht_es8316_private {
 	struct clk *mclk;
 	struct snd_soc_jack jack;
 	struct gpio_desc *speaker_en_gpio;
+	struct device *codec_dev;
 	bool speaker_en;
 };
 
@@ -555,7 +556,7 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev)
 		gpiod_get_index(codec_dev, "speaker-enable", 0,
 				/* see comment in byt_cht_es8316_resume */
 				GPIOD_OUT_LOW | GPIOD_FLAGS_BIT_NONEXCLUSIVE);
-	put_device(codec_dev);
+	priv->codec_dev = codec_dev;
 
 	if (IS_ERR(priv->speaker_en_gpio)) {
 		ret = PTR_ERR(priv->speaker_en_gpio);
@@ -567,7 +568,7 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev)
 			dev_err(dev, "get speaker GPIO failed: %d\n", ret);
 			fallthrough;
 		case -EPROBE_DEFER:
-			return ret;
+			goto err;
 		}
 	}
 
@@ -605,10 +606,14 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev)
 	if (ret) {
 		gpiod_put(priv->speaker_en_gpio);
 		dev_err(dev, "snd_soc_register_card failed: %d\n", ret);
-		return ret;
+		goto err;
 	}
 	platform_set_drvdata(pdev, &byt_cht_es8316_card);
 	return 0;
+
+err:
+	put_device(priv->codec_dev);
+	return ret;
 }
 
 static int snd_byt_cht_es8316_mc_remove(struct platform_device *pdev)
@@ -617,6 +622,7 @@ static int snd_byt_cht_es8316_mc_remove(struct platform_device *pdev)
 	struct byt_cht_es8316_private *priv = snd_soc_card_get_drvdata(card);
 
 	gpiod_put(priv->speaker_en_gpio);
+	put_device(priv->codec_dev);
 	return 0;
 }
 
diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards/bytcr_rt5640.c
index d51bd22073df..808bfb7fd81e 100644
--- a/sound/soc/intel/boards/bytcr_rt5640.c
+++ b/sound/soc/intel/boards/bytcr_rt5640.c
@@ -90,6 +90,7 @@ enum {
 struct byt_rt5640_private {
 	struct snd_soc_jack jack;
 	struct clk *mclk;
+	struct device *codec_dev;
 };
 static bool is_bytcr;
 
@@ -969,16 +970,12 @@ static const struct dmi_system_id byt_rt5640_quirk_table[] = {
  * Note this MUST be called before snd_soc_register_card(), so that the props
  * are in place before the codec component driver's probe function parses them.
  */
-static int byt_rt5640_add_codec_device_props(const char *i2c_dev_name)
+static int byt_rt5640_add_codec_device_props(struct device *i2c_dev,
+					     struct byt_rt5640_private *priv)
 {
 	struct property_entry props[MAX_NO_PROPS] = {};
-	struct device *i2c_dev;
 	int ret, cnt = 0;
 
-	i2c_dev = bus_find_device_by_name(&i2c_bus_type, NULL, i2c_dev_name);
-	if (!i2c_dev)
-		return -EPROBE_DEFER;
-
 	switch (BYT_RT5640_MAP(byt_rt5640_quirk)) {
 	case BYT_RT5640_DMIC1_MAP:
 		props[cnt++] = PROPERTY_ENTRY_U32("realtek,dmic1-data-pin",
@@ -1018,7 +1015,6 @@ static int byt_rt5640_add_codec_device_props(const char *i2c_dev_name)
 		props[cnt++] = PROPERTY_ENTRY_BOOL("realtek,jack-detect-not-inverted");
 
 	ret = device_add_properties(i2c_dev, props);
-	put_device(i2c_dev);
 
 	return ret;
 }
@@ -1367,6 +1363,7 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
 	struct snd_soc_acpi_mach *mach;
 	const char *platform_name;
 	struct acpi_device *adev;
+	struct device *codec_dev;
 	bool sof_parent;
 	int ret_val = 0;
 	int dai_index = 0;
@@ -1475,10 +1472,16 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
 		byt_rt5640_quirk = quirk_override;
 	}
 
+	codec_dev = bus_find_device_by_name(&i2c_bus_type, NULL, byt_rt5640_codec_name);
+	if (!codec_dev)
+		return -EPROBE_DEFER;
+
+	priv->codec_dev = codec_dev;
+
 	/* Must be called before register_card, also see declaration comment. */
-	ret_val = byt_rt5640_add_codec_device_props(byt_rt5640_codec_name);
+	ret_val = byt_rt5640_add_codec_device_props(codec_dev, priv);
 	if (ret_val)
-		return ret_val;
+		goto err;
 
 	log_quirks(&pdev->dev);
 
@@ -1509,7 +1512,7 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
 			 * for all other errors, including -EPROBE_DEFER
 			 */
 			if (ret_val != -ENOENT)
-				return ret_val;
+				goto err;
 			byt_rt5640_quirk &= ~BYT_RT5640_MCLK_EN;
 		}
 	}
@@ -1553,7 +1556,7 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
 	ret_val = snd_soc_fixup_dai_links_platform_name(&byt_rt5640_card,
 							platform_name);
 	if (ret_val)
-		return ret_val;
+		goto err;
 
 	sof_parent = snd_soc_acpi_sof_parent(&pdev->dev);
 
@@ -1575,10 +1578,23 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
 	if (ret_val) {
 		dev_err(&pdev->dev, "devm_snd_soc_register_card failed %d\n",
 			ret_val);
-		return ret_val;
+		goto err;
 	}
 	platform_set_drvdata(pdev, &byt_rt5640_card);
 	return ret_val;
+
+err:
+	put_device(priv->codec_dev);
+	return ret_val;
+}
+
+static int snd_byt_rt5640_mc_remove(struct platform_device *pdev)
+{
+	struct snd_soc_card *card = platform_get_drvdata(pdev);
+	struct byt_rt5640_private *priv = snd_soc_card_get_drvdata(card);
+
+	put_device(priv->codec_dev);
+	return 0;
 }
 
 static struct platform_driver snd_byt_rt5640_mc_driver = {
@@ -1586,6 +1602,7 @@ static struct platform_driver snd_byt_rt5640_mc_driver = {
 		.name = "bytcr_rt5640",
 	},
 	.probe = snd_byt_rt5640_mc_probe,
+	.remove = snd_byt_rt5640_mc_remove
 };
 
 module_platform_driver(snd_byt_rt5640_mc_driver);
diff --git a/sound/soc/intel/boards/bytcr_rt5651.c b/sound/soc/intel/boards/bytcr_rt5651.c
index e13c0c63a949..7033c07f8fd6 100644
--- a/sound/soc/intel/boards/bytcr_rt5651.c
+++ b/sound/soc/intel/boards/bytcr_rt5651.c
@@ -85,6 +85,7 @@ struct byt_rt5651_private {
 	struct gpio_desc *ext_amp_gpio;
 	struct gpio_desc *hp_detect;
 	struct snd_soc_jack jack;
+	struct device *codec_dev;
 };
 
 static const struct acpi_gpio_mapping *byt_rt5651_gpios;
@@ -993,12 +994,12 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
 		byt_rt5651_quirk = quirk_override;
 	}
 
+	priv->codec_dev = codec_dev;
+
 	/* Must be called before register_card, also see declaration comment. */
 	ret_val = byt_rt5651_add_codec_device_props(codec_dev);
-	if (ret_val) {
-		put_device(codec_dev);
-		return ret_val;
-	}
+	if (ret_val)
+		goto err;
 
 	/* Cherry Trail devices use an external amplifier enable gpio */
 	if (soc_intel_is_cht() && !byt_rt5651_gpios)
@@ -1022,8 +1023,7 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
 					ret_val);
 				fallthrough;
 			case -EPROBE_DEFER:
-				put_device(codec_dev);
-				return ret_val;
+				goto err;
 			}
 		}
 		priv->hp_detect = devm_fwnode_gpiod_get(&pdev->dev,
@@ -1042,14 +1042,11 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
 					ret_val);
 				fallthrough;
 			case -EPROBE_DEFER:
-				put_device(codec_dev);
-				return ret_val;
+				goto err;
 			}
 		}
 	}
 
-	put_device(codec_dev);
-
 	log_quirks(&pdev->dev);
 
 	if ((byt_rt5651_quirk & BYT_RT5651_SSP2_AIF2) ||
@@ -1073,7 +1070,7 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
 			 * for all other errors, including -EPROBE_DEFER
 			 */
 			if (ret_val != -ENOENT)
-				return ret_val;
+				goto err;
 			byt_rt5651_quirk &= ~BYT_RT5651_MCLK_EN;
 		}
 	}
@@ -1102,7 +1099,7 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
 	ret_val = snd_soc_fixup_dai_links_platform_name(&byt_rt5651_card,
 							platform_name);
 	if (ret_val)
-		return ret_val;
+		goto err;
 
 	sof_parent = snd_soc_acpi_sof_parent(&pdev->dev);
 
@@ -1124,10 +1121,23 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
 	if (ret_val) {
 		dev_err(&pdev->dev, "devm_snd_soc_register_card failed %d\n",
 			ret_val);
-		return ret_val;
+		goto err;
 	}
 	platform_set_drvdata(pdev, &byt_rt5651_card);
 	return ret_val;
+
+err:
+	put_device(priv->codec_dev);
+	return ret_val;
+}
+
+static int snd_byt_rt5651_mc_remove(struct platform_device *pdev)
+{
+	struct snd_soc_card *card = platform_get_drvdata(pdev);
+	struct byt_rt5651_private *priv = snd_soc_card_get_drvdata(card);
+
+	put_device(priv->codec_dev);
+	return 0;
 }
 
 static struct platform_driver snd_byt_rt5651_mc_driver = {
@@ -1135,6 +1145,7 @@ static struct platform_driver snd_byt_rt5651_mc_driver = {
 		.name = "bytcr_rt5651",
 	},
 	.probe = snd_byt_rt5651_mc_probe,
+	.remove = snd_byt_rt5651_mc_remove,
 };
 
 module_platform_driver(snd_byt_rt5651_mc_driver);
-- 
2.25.1


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

* [PATCH v2 2/8] ASoC: Intel: boards: handle errors with acpi_dev_get_first_match_dev()
  2021-08-12 22:44 [PATCH v2 0/8] ASoC: Intel: boards: use software node API Pierre-Louis Bossart
  2021-08-12 22:44 ` [PATCH v2 1/8] ASoC: Intel: boards: harden codec property handling Pierre-Louis Bossart
@ 2021-08-12 22:44 ` Pierre-Louis Bossart
  2021-08-13 10:23   ` Andy Shevchenko
  2021-08-12 22:44 ` [PATCH v2 3/8] ASoC: Intel: boards: get codec device with ACPI instead of bus search Pierre-Louis Bossart
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 13+ messages in thread
From: Pierre-Louis Bossart @ 2021-08-12 22:44 UTC (permalink / raw)
  To: alsa-devel
  Cc: Heikki Krogerus, tiwai, Pierre-Louis Bossart, Hans de Goede,
	broonie, Andy Shevchenko

acpi_dev_get_first_match_dev() searches for an acpi_handle
instantiated by the ACPI table scanning done early during boot.

Two of three machine drivers using this search don't deal with errors
and the one which does (bytcr_rt5651) returns -ENODEV, which doesn't
make sense here: an alternate driver will not be probed.

Add consistent error handling and report -ENXIO

Suggested-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/intel/boards/bytcht_es8316.c | 3 +++
 sound/soc/intel/boards/bytcr_rt5640.c  | 3 +++
 sound/soc/intel/boards/bytcr_rt5651.c  | 2 +-
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/sound/soc/intel/boards/bytcht_es8316.c b/sound/soc/intel/boards/bytcht_es8316.c
index fcf7c9c04069..7c078a9f6deb 100644
--- a/sound/soc/intel/boards/bytcht_es8316.c
+++ b/sound/soc/intel/boards/bytcht_es8316.c
@@ -492,6 +492,9 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev)
 			 "i2c-%s", acpi_dev_name(adev));
 		put_device(&adev->dev);
 		byt_cht_es8316_dais[dai_index].codecs->name = codec_name;
+	} else {
+		dev_err(&pdev->dev, "Error cannot find '%s' dev\n", mach->id);
+		return -ENXIO;
 	}
 
 	/* override plaform name, if required */
diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards/bytcr_rt5640.c
index 808bfb7fd81e..60ed954d7277 100644
--- a/sound/soc/intel/boards/bytcr_rt5640.c
+++ b/sound/soc/intel/boards/bytcr_rt5640.c
@@ -1396,6 +1396,9 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
 			 "i2c-%s", acpi_dev_name(adev));
 		put_device(&adev->dev);
 		byt_rt5640_dais[dai_index].codecs->name = byt_rt5640_codec_name;
+	} else {
+		dev_err(&pdev->dev, "Error cannot find '%s' dev\n", mach->id);
+		return -ENXIO;
 	}
 
 	/*
diff --git a/sound/soc/intel/boards/bytcr_rt5651.c b/sound/soc/intel/boards/bytcr_rt5651.c
index 7033c07f8fd6..b4307d1d5527 100644
--- a/sound/soc/intel/boards/bytcr_rt5651.c
+++ b/sound/soc/intel/boards/bytcr_rt5651.c
@@ -921,7 +921,7 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
 		byt_rt5651_dais[dai_index].codecs->name = byt_rt5651_codec_name;
 	} else {
 		dev_err(&pdev->dev, "Error cannot find '%s' dev\n", mach->id);
-		return -ENODEV;
+		return -ENXIO;
 	}
 
 	codec_dev = bus_find_device_by_name(&i2c_bus_type, NULL,
-- 
2.25.1


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

* [PATCH v2 3/8] ASoC: Intel: boards: get codec device with ACPI instead of bus search
  2021-08-12 22:44 [PATCH v2 0/8] ASoC: Intel: boards: use software node API Pierre-Louis Bossart
  2021-08-12 22:44 ` [PATCH v2 1/8] ASoC: Intel: boards: harden codec property handling Pierre-Louis Bossart
  2021-08-12 22:44 ` [PATCH v2 2/8] ASoC: Intel: boards: handle errors with acpi_dev_get_first_match_dev() Pierre-Louis Bossart
@ 2021-08-12 22:44 ` Pierre-Louis Bossart
  2021-08-12 22:44 ` [PATCH v2 4/8] ASoC: Intel: sof_sdw: pass card information to init/exit functions Pierre-Louis Bossart
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Pierre-Louis Bossart @ 2021-08-12 22:44 UTC (permalink / raw)
  To: alsa-devel
  Cc: Heikki Krogerus, tiwai, Pierre-Louis Bossart, Hans de Goede,
	broonie, Andy Shevchenko

We have an existing 'adev' handle from which we can find the codec
device, no need for an I2C bus search.

Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/intel/boards/bytcht_es8316.c | 4 ++--
 sound/soc/intel/boards/bytcr_rt5640.c  | 5 ++---
 sound/soc/intel/boards/bytcr_rt5651.c  | 6 ++----
 3 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/sound/soc/intel/boards/bytcht_es8316.c b/sound/soc/intel/boards/bytcht_es8316.c
index 7c078a9f6deb..34bdae45da73 100644
--- a/sound/soc/intel/boards/bytcht_es8316.c
+++ b/sound/soc/intel/boards/bytcht_es8316.c
@@ -539,9 +539,10 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev)
 	}
 
 	/* get speaker enable GPIO */
-	codec_dev = bus_find_device_by_name(&i2c_bus_type, NULL, codec_name);
+	codec_dev = acpi_get_first_physical_node(adev);
 	if (!codec_dev)
 		return -EPROBE_DEFER;
+	priv->codec_dev = get_device(codec_dev);
 
 	if (quirk & BYT_CHT_ES8316_JD_INVERTED)
 		props[cnt++] = PROPERTY_ENTRY_BOOL("everest,jack-detect-inverted");
@@ -559,7 +560,6 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev)
 		gpiod_get_index(codec_dev, "speaker-enable", 0,
 				/* see comment in byt_cht_es8316_resume */
 				GPIOD_OUT_LOW | GPIOD_FLAGS_BIT_NONEXCLUSIVE);
-	priv->codec_dev = codec_dev;
 
 	if (IS_ERR(priv->speaker_en_gpio)) {
 		ret = PTR_ERR(priv->speaker_en_gpio);
diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards/bytcr_rt5640.c
index 60ed954d7277..fbe75c77e4ca 100644
--- a/sound/soc/intel/boards/bytcr_rt5640.c
+++ b/sound/soc/intel/boards/bytcr_rt5640.c
@@ -1475,11 +1475,10 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
 		byt_rt5640_quirk = quirk_override;
 	}
 
-	codec_dev = bus_find_device_by_name(&i2c_bus_type, NULL, byt_rt5640_codec_name);
+	codec_dev = acpi_get_first_physical_node(adev);
 	if (!codec_dev)
 		return -EPROBE_DEFER;
-
-	priv->codec_dev = codec_dev;
+	priv->codec_dev = get_device(codec_dev);
 
 	/* Must be called before register_card, also see declaration comment. */
 	ret_val = byt_rt5640_add_codec_device_props(codec_dev, priv);
diff --git a/sound/soc/intel/boards/bytcr_rt5651.c b/sound/soc/intel/boards/bytcr_rt5651.c
index b4307d1d5527..c70dd729cdbb 100644
--- a/sound/soc/intel/boards/bytcr_rt5651.c
+++ b/sound/soc/intel/boards/bytcr_rt5651.c
@@ -924,10 +924,10 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
 		return -ENXIO;
 	}
 
-	codec_dev = bus_find_device_by_name(&i2c_bus_type, NULL,
-					    byt_rt5651_codec_name);
+	codec_dev = acpi_get_first_physical_node(adev);
 	if (!codec_dev)
 		return -EPROBE_DEFER;
+	priv->codec_dev = get_device(codec_dev);
 
 	/*
 	 * swap SSP0 if bytcr is detected
@@ -994,8 +994,6 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
 		byt_rt5651_quirk = quirk_override;
 	}
 
-	priv->codec_dev = codec_dev;
-
 	/* Must be called before register_card, also see declaration comment. */
 	ret_val = byt_rt5651_add_codec_device_props(codec_dev);
 	if (ret_val)
-- 
2.25.1


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

* [PATCH v2 4/8] ASoC: Intel: sof_sdw: pass card information to init/exit functions
  2021-08-12 22:44 [PATCH v2 0/8] ASoC: Intel: boards: use software node API Pierre-Louis Bossart
                   ` (2 preceding siblings ...)
  2021-08-12 22:44 ` [PATCH v2 3/8] ASoC: Intel: boards: get codec device with ACPI instead of bus search Pierre-Louis Bossart
@ 2021-08-12 22:44 ` Pierre-Louis Bossart
  2021-08-12 22:44 ` [PATCH v2 5/8] ASoC: Intel: sof_sdw_rt711*: keep codec device reference until remove Pierre-Louis Bossart
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Pierre-Louis Bossart @ 2021-08-12 22:44 UTC (permalink / raw)
  To: alsa-devel
  Cc: Heikki Krogerus, tiwai, Pierre-Louis Bossart, Hans de Goede,
	broonie, Andy Shevchenko

If we want to handle a context in init/exit function, we have to pass
the card information. This will be necessary to better deal with
device properties in the follow-up commits.

No functional change other than prototype update.

Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/intel/boards/sof_sdw.c            | 20 ++++++-----
 sound/soc/intel/boards/sof_sdw_common.h     | 37 +++++++++++++--------
 sound/soc/intel/boards/sof_sdw_max98373.c   |  3 +-
 sound/soc/intel/boards/sof_sdw_rt1308.c     |  3 +-
 sound/soc/intel/boards/sof_sdw_rt1316.c     |  3 +-
 sound/soc/intel/boards/sof_sdw_rt5682.c     |  3 +-
 sound/soc/intel/boards/sof_sdw_rt700.c      |  3 +-
 sound/soc/intel/boards/sof_sdw_rt711.c      |  5 +--
 sound/soc/intel/boards/sof_sdw_rt711_sdca.c |  5 +--
 sound/soc/intel/boards/sof_sdw_rt715.c      |  3 +-
 sound/soc/intel/boards/sof_sdw_rt715_sdca.c |  3 +-
 11 files changed, 56 insertions(+), 32 deletions(-)

diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c
index 6c946d7ee0a6..6602eda89e8e 100644
--- a/sound/soc/intel/boards/sof_sdw.c
+++ b/sound/soc/intel/boards/sof_sdw.c
@@ -352,7 +352,8 @@ static const struct snd_soc_ops sdw_ops = {
 	.shutdown = sdw_shutdown,
 };
 
-static int sof_sdw_mic_codec_mockup_init(const struct snd_soc_acpi_link_adr *link,
+static int sof_sdw_mic_codec_mockup_init(struct snd_soc_card *card,
+					 const struct snd_soc_acpi_link_adr *link,
 					 struct snd_soc_dai_link *dai_links,
 					 struct sof_sdw_codec_info *info,
 					 bool playback)
@@ -697,7 +698,8 @@ static int create_codec_dai_name(struct device *dev,
 	return 0;
 }
 
-static int set_codec_init_func(const struct snd_soc_acpi_link_adr *link,
+static int set_codec_init_func(struct snd_soc_card *card,
+			       const struct snd_soc_acpi_link_adr *link,
 			       struct snd_soc_dai_link *dai_links,
 			       bool playback, int group_id)
 {
@@ -720,7 +722,8 @@ static int set_codec_init_func(const struct snd_soc_acpi_link_adr *link,
 			if (link->adr_d[i].endpoints->group_id != group_id)
 				continue;
 			if (codec_info_list[codec_index].init)
-				codec_info_list[codec_index].init(link,
+				codec_info_list[codec_index].init(card,
+						link,
 						dai_links,
 						&codec_info_list[codec_index],
 						playback);
@@ -805,7 +808,8 @@ static int get_slave_info(const struct snd_soc_acpi_link_adr *adr_link,
 	return 0;
 }
 
-static int create_sdw_dailink(struct device *dev, int *be_index,
+static int create_sdw_dailink(struct snd_soc_card *card,
+			      struct device *dev, int *be_index,
 			      struct snd_soc_dai_link *dai_links,
 			      int sdw_be_num, int sdw_cpu_dai_num,
 			      struct snd_soc_dai_link_component *cpus,
@@ -926,7 +930,7 @@ static int create_sdw_dailink(struct device *dev, int *be_index,
 			      codecs, codec_num,
 			      NULL, &sdw_ops);
 
-		ret = set_codec_init_func(link, dai_links + (*be_index)++,
+		ret = set_codec_init_func(card, link, dai_links + (*be_index)++,
 					  playback, group_id);
 		if (ret < 0) {
 			dev_err(dev, "failed to init codec %d", codec_index);
@@ -1107,7 +1111,7 @@ static int sof_card_dai_links_create(struct device *dev,
 		    group_generated[endpoint->group_id])
 			continue;
 
-		ret = create_sdw_dailink(dev, &be_id, links, sdw_be_num,
+		ret = create_sdw_dailink(card, dev, &be_id, links, sdw_be_num,
 					 sdw_cpu_dai_num, cpus, adr_link,
 					 &cpu_id, group_generated,
 					 codec_conf, codec_conf_count,
@@ -1170,7 +1174,7 @@ static int sof_card_dai_links_create(struct device *dev,
 			      ssp_components, 1,
 			      NULL, info->ops);
 
-		ret = info->init(NULL, links + link_id, info, 0);
+		ret = info->init(card, NULL, links + link_id, info, 0);
 		if (ret < 0)
 			return ret;
 
@@ -1393,7 +1397,7 @@ static int mc_remove(struct platform_device *pdev)
 		for_each_card_prelinks(card, j, link) {
 			if (!strcmp(link->codecs[0].dai_name,
 				    codec_info_list[i].dai_name)) {
-				ret = codec_info_list[i].exit(&pdev->dev, link);
+				ret = codec_info_list[i].exit(card, link);
 				if (ret)
 					dev_warn(&pdev->dev,
 						 "codec exit failed %d\n",
diff --git a/sound/soc/intel/boards/sof_sdw_common.h b/sound/soc/intel/boards/sof_sdw_common.h
index 472ccfbbd207..b35f5a9b96f5 100644
--- a/sound/soc/intel/boards/sof_sdw_common.h
+++ b/sound/soc/intel/boards/sof_sdw_common.h
@@ -62,12 +62,13 @@ struct sof_sdw_codec_info {
 	const char *dai_name;
 	const struct snd_soc_ops *ops;
 
-	int  (*init)(const struct snd_soc_acpi_link_adr *link,
+	int  (*init)(struct snd_soc_card *card,
+		     const struct snd_soc_acpi_link_adr *link,
 		     struct snd_soc_dai_link *dai_links,
 		     struct sof_sdw_codec_info *info,
 		     bool playback);
 
-	int (*exit)(struct device *dev, struct snd_soc_dai_link *dai_link);
+	int (*exit)(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link);
 	bool late_probe;
 	int (*codec_card_late_probe)(struct snd_soc_card *card);
 };
@@ -76,6 +77,7 @@ struct mc_private {
 	struct list_head hdmi_pcm_list;
 	bool idisp_codec;
 	struct snd_soc_jack sdw_headset;
+	struct device *headset_codec_dev; /* only one headset per card */
 };
 
 extern unsigned long sof_sdw_quirk;
@@ -95,21 +97,24 @@ int sof_sdw_hdmi_card_late_probe(struct snd_soc_card *card);
 int sof_sdw_dmic_init(struct snd_soc_pcm_runtime *rtd);
 
 /* RT711 support */
-int sof_sdw_rt711_init(const struct snd_soc_acpi_link_adr *link,
+int sof_sdw_rt711_init(struct snd_soc_card *card,
+		       const struct snd_soc_acpi_link_adr *link,
 		       struct snd_soc_dai_link *dai_links,
 		       struct sof_sdw_codec_info *info,
 		       bool playback);
-int sof_sdw_rt711_exit(struct device *dev, struct snd_soc_dai_link *dai_link);
+int sof_sdw_rt711_exit(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link);
 
 /* RT711-SDCA support */
-int sof_sdw_rt711_sdca_init(const struct snd_soc_acpi_link_adr *link,
+int sof_sdw_rt711_sdca_init(struct snd_soc_card *card,
+			    const struct snd_soc_acpi_link_adr *link,
 			    struct snd_soc_dai_link *dai_links,
 			    struct sof_sdw_codec_info *info,
 			    bool playback);
-int sof_sdw_rt711_sdca_exit(struct device *dev, struct snd_soc_dai_link *dai_link);
+int sof_sdw_rt711_sdca_exit(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link);
 
 /* RT700 support */
-int sof_sdw_rt700_init(const struct snd_soc_acpi_link_adr *link,
+int sof_sdw_rt700_init(struct snd_soc_card *card,
+		       const struct snd_soc_acpi_link_adr *link,
 		       struct snd_soc_dai_link *dai_links,
 		       struct sof_sdw_codec_info *info,
 		       bool playback);
@@ -117,31 +122,36 @@ int sof_sdw_rt700_init(const struct snd_soc_acpi_link_adr *link,
 /* RT1308 support */
 extern struct snd_soc_ops sof_sdw_rt1308_i2s_ops;
 
-int sof_sdw_rt1308_init(const struct snd_soc_acpi_link_adr *link,
+int sof_sdw_rt1308_init(struct snd_soc_card *card,
+			const struct snd_soc_acpi_link_adr *link,
 			struct snd_soc_dai_link *dai_links,
 			struct sof_sdw_codec_info *info,
 			bool playback);
 
 /* RT1316 support */
-int sof_sdw_rt1316_init(const struct snd_soc_acpi_link_adr *link,
+int sof_sdw_rt1316_init(struct snd_soc_card *card,
+			const struct snd_soc_acpi_link_adr *link,
 			struct snd_soc_dai_link *dai_links,
 			struct sof_sdw_codec_info *info,
 			bool playback);
 
 /* RT715 support */
-int sof_sdw_rt715_init(const struct snd_soc_acpi_link_adr *link,
+int sof_sdw_rt715_init(struct snd_soc_card *card,
+		       const struct snd_soc_acpi_link_adr *link,
 		       struct snd_soc_dai_link *dai_links,
 		       struct sof_sdw_codec_info *info,
 		       bool playback);
 
 /* RT715-SDCA support */
-int sof_sdw_rt715_sdca_init(const struct snd_soc_acpi_link_adr *link,
+int sof_sdw_rt715_sdca_init(struct snd_soc_card *card,
+			    const struct snd_soc_acpi_link_adr *link,
 			    struct snd_soc_dai_link *dai_links,
 			    struct sof_sdw_codec_info *info,
 			    bool playback);
 
 /* MAX98373 support */
-int sof_sdw_mx8373_init(const struct snd_soc_acpi_link_adr *link,
+int sof_sdw_mx8373_init(struct snd_soc_card *card,
+			const struct snd_soc_acpi_link_adr *link,
 			struct snd_soc_dai_link *dai_links,
 			struct sof_sdw_codec_info *info,
 			bool playback);
@@ -149,7 +159,8 @@ int sof_sdw_mx8373_init(const struct snd_soc_acpi_link_adr *link,
 int sof_sdw_mx8373_late_probe(struct snd_soc_card *card);
 
 /* RT5682 support */
-int sof_sdw_rt5682_init(const struct snd_soc_acpi_link_adr *link,
+int sof_sdw_rt5682_init(struct snd_soc_card *card,
+			const struct snd_soc_acpi_link_adr *link,
 			struct snd_soc_dai_link *dai_links,
 			struct sof_sdw_codec_info *info,
 			bool playback);
diff --git a/sound/soc/intel/boards/sof_sdw_max98373.c b/sound/soc/intel/boards/sof_sdw_max98373.c
index 25f9065b627c..77a3f32db11e 100644
--- a/sound/soc/intel/boards/sof_sdw_max98373.c
+++ b/sound/soc/intel/boards/sof_sdw_max98373.c
@@ -120,7 +120,8 @@ static const struct snd_soc_ops max_98373_sdw_ops = {
 	.shutdown = sdw_shutdown,
 };
 
-int sof_sdw_mx8373_init(const struct snd_soc_acpi_link_adr *link,
+int sof_sdw_mx8373_init(struct snd_soc_card *card,
+			const struct snd_soc_acpi_link_adr *link,
 			struct snd_soc_dai_link *dai_links,
 			struct sof_sdw_codec_info *info,
 			bool playback)
diff --git a/sound/soc/intel/boards/sof_sdw_rt1308.c b/sound/soc/intel/boards/sof_sdw_rt1308.c
index 0d476f6f6313..f078fb1aad02 100644
--- a/sound/soc/intel/boards/sof_sdw_rt1308.c
+++ b/sound/soc/intel/boards/sof_sdw_rt1308.c
@@ -127,7 +127,8 @@ struct snd_soc_ops sof_sdw_rt1308_i2s_ops = {
 	.hw_params = rt1308_i2s_hw_params,
 };
 
-int sof_sdw_rt1308_init(const struct snd_soc_acpi_link_adr *link,
+int sof_sdw_rt1308_init(struct snd_soc_card *card,
+			const struct snd_soc_acpi_link_adr *link,
 			struct snd_soc_dai_link *dai_links,
 			struct sof_sdw_codec_info *info,
 			bool playback)
diff --git a/sound/soc/intel/boards/sof_sdw_rt1316.c b/sound/soc/intel/boards/sof_sdw_rt1316.c
index d6e1ebf18d57..58194b380232 100644
--- a/sound/soc/intel/boards/sof_sdw_rt1316.c
+++ b/sound/soc/intel/boards/sof_sdw_rt1316.c
@@ -89,7 +89,8 @@ static int all_spk_init(struct snd_soc_pcm_runtime *rtd)
 	return second_spk_init(rtd);
 }
 
-int sof_sdw_rt1316_init(const struct snd_soc_acpi_link_adr *link,
+int sof_sdw_rt1316_init(struct snd_soc_card *card,
+			const struct snd_soc_acpi_link_adr *link,
 			struct snd_soc_dai_link *dai_links,
 			struct sof_sdw_codec_info *info,
 			bool playback)
diff --git a/sound/soc/intel/boards/sof_sdw_rt5682.c b/sound/soc/intel/boards/sof_sdw_rt5682.c
index 5fa1a59615b6..ea55479609a8 100644
--- a/sound/soc/intel/boards/sof_sdw_rt5682.c
+++ b/sound/soc/intel/boards/sof_sdw_rt5682.c
@@ -111,7 +111,8 @@ static int rt5682_rtd_init(struct snd_soc_pcm_runtime *rtd)
 	return ret;
 }
 
-int sof_sdw_rt5682_init(const struct snd_soc_acpi_link_adr *link,
+int sof_sdw_rt5682_init(struct snd_soc_card *card,
+			const struct snd_soc_acpi_link_adr *link,
 			struct snd_soc_dai_link *dai_links,
 			struct sof_sdw_codec_info *info,
 			bool playback)
diff --git a/sound/soc/intel/boards/sof_sdw_rt700.c b/sound/soc/intel/boards/sof_sdw_rt700.c
index 21e7e4a81779..bb9584c8f866 100644
--- a/sound/soc/intel/boards/sof_sdw_rt700.c
+++ b/sound/soc/intel/boards/sof_sdw_rt700.c
@@ -110,7 +110,8 @@ static int rt700_rtd_init(struct snd_soc_pcm_runtime *rtd)
 	return ret;
 }
 
-int sof_sdw_rt700_init(const struct snd_soc_acpi_link_adr *link,
+int sof_sdw_rt700_init(struct snd_soc_card *card,
+		       const struct snd_soc_acpi_link_adr *link,
 		       struct snd_soc_dai_link *dai_links,
 		       struct sof_sdw_codec_info *info,
 		       bool playback)
diff --git a/sound/soc/intel/boards/sof_sdw_rt711.c b/sound/soc/intel/boards/sof_sdw_rt711.c
index 04074c09dded..8a6a17fe676e 100644
--- a/sound/soc/intel/boards/sof_sdw_rt711.c
+++ b/sound/soc/intel/boards/sof_sdw_rt711.c
@@ -135,7 +135,7 @@ static int rt711_rtd_init(struct snd_soc_pcm_runtime *rtd)
 	return ret;
 }
 
-int sof_sdw_rt711_exit(struct device *dev, struct snd_soc_dai_link *dai_link)
+int sof_sdw_rt711_exit(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link)
 {
 	struct device *sdw_dev;
 
@@ -150,7 +150,8 @@ int sof_sdw_rt711_exit(struct device *dev, struct snd_soc_dai_link *dai_link)
 	return 0;
 }
 
-int sof_sdw_rt711_init(const struct snd_soc_acpi_link_adr *link,
+int sof_sdw_rt711_init(struct snd_soc_card *card,
+		       const struct snd_soc_acpi_link_adr *link,
 		       struct snd_soc_dai_link *dai_links,
 		       struct sof_sdw_codec_info *info,
 		       bool playback)
diff --git a/sound/soc/intel/boards/sof_sdw_rt711_sdca.c b/sound/soc/intel/boards/sof_sdw_rt711_sdca.c
index 19496f0f9110..1ae66f266c6c 100644
--- a/sound/soc/intel/boards/sof_sdw_rt711_sdca.c
+++ b/sound/soc/intel/boards/sof_sdw_rt711_sdca.c
@@ -135,7 +135,7 @@ static int rt711_sdca_rtd_init(struct snd_soc_pcm_runtime *rtd)
 	return ret;
 }
 
-int sof_sdw_rt711_sdca_exit(struct device *dev, struct snd_soc_dai_link *dai_link)
+int sof_sdw_rt711_sdca_exit(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link)
 {
 	struct device *sdw_dev;
 
@@ -150,7 +150,8 @@ int sof_sdw_rt711_sdca_exit(struct device *dev, struct snd_soc_dai_link *dai_lin
 	return 0;
 }
 
-int sof_sdw_rt711_sdca_init(const struct snd_soc_acpi_link_adr *link,
+int sof_sdw_rt711_sdca_init(struct snd_soc_card *card,
+			    const struct snd_soc_acpi_link_adr *link,
 			    struct snd_soc_dai_link *dai_links,
 			    struct sof_sdw_codec_info *info,
 			    bool playback)
diff --git a/sound/soc/intel/boards/sof_sdw_rt715.c b/sound/soc/intel/boards/sof_sdw_rt715.c
index 9b298f79e784..c8af3780cbc3 100644
--- a/sound/soc/intel/boards/sof_sdw_rt715.c
+++ b/sound/soc/intel/boards/sof_sdw_rt715.c
@@ -24,7 +24,8 @@ static int rt715_rtd_init(struct snd_soc_pcm_runtime *rtd)
 	return 0;
 }
 
-int sof_sdw_rt715_init(const struct snd_soc_acpi_link_adr *link,
+int sof_sdw_rt715_init(struct snd_soc_card *card,
+		       const struct snd_soc_acpi_link_adr *link,
 		       struct snd_soc_dai_link *dai_links,
 		       struct sof_sdw_codec_info *info,
 		       bool playback)
diff --git a/sound/soc/intel/boards/sof_sdw_rt715_sdca.c b/sound/soc/intel/boards/sof_sdw_rt715_sdca.c
index c056e56a139b..85d3d8c355cc 100644
--- a/sound/soc/intel/boards/sof_sdw_rt715_sdca.c
+++ b/sound/soc/intel/boards/sof_sdw_rt715_sdca.c
@@ -24,7 +24,8 @@ static int rt715_sdca_rtd_init(struct snd_soc_pcm_runtime *rtd)
 	return 0;
 }
 
-int sof_sdw_rt715_sdca_init(const struct snd_soc_acpi_link_adr *link,
+int sof_sdw_rt715_sdca_init(struct snd_soc_card *card,
+			    const struct snd_soc_acpi_link_adr *link,
 			    struct snd_soc_dai_link *dai_links,
 			    struct sof_sdw_codec_info *info,
 			    bool playback)
-- 
2.25.1


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

* [PATCH v2 5/8] ASoC: Intel: sof_sdw_rt711*: keep codec device reference until remove
  2021-08-12 22:44 [PATCH v2 0/8] ASoC: Intel: boards: use software node API Pierre-Louis Bossart
                   ` (3 preceding siblings ...)
  2021-08-12 22:44 ` [PATCH v2 4/8] ASoC: Intel: sof_sdw: pass card information to init/exit functions Pierre-Louis Bossart
@ 2021-08-12 22:44 ` Pierre-Louis Bossart
  2021-08-12 22:44 ` [PATCH v2 6/8] ASoC: Intel: use software node API in SoundWire machines Pierre-Louis Bossart
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Pierre-Louis Bossart @ 2021-08-12 22:44 UTC (permalink / raw)
  To: alsa-devel
  Cc: Heikki Krogerus, tiwai, Pierre-Louis Bossart, Hans de Goede,
	broonie, Andy Shevchenko

Follow the example of Intel Atom drivers and keep a reference to the
headset codec until the properties are removed.

There is no guarantee that the module for the codec driver is loaded
before the machine driver probe, the use of the deferred probe
mechanism is required.

Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/intel/boards/sof_sdw_rt711.c      | 44 +++++++++------------
 sound/soc/intel/boards/sof_sdw_rt711_sdca.c | 43 +++++++++-----------
 2 files changed, 38 insertions(+), 49 deletions(-)

diff --git a/sound/soc/intel/boards/sof_sdw_rt711.c b/sound/soc/intel/boards/sof_sdw_rt711.c
index 8a6a17fe676e..510301e09b09 100644
--- a/sound/soc/intel/boards/sof_sdw_rt711.c
+++ b/sound/soc/intel/boards/sof_sdw_rt711.c
@@ -21,25 +21,15 @@
  * Note this MUST be called before snd_soc_register_card(), so that the props
  * are in place before the codec component driver's probe function parses them.
  */
-static int rt711_add_codec_device_props(const char *sdw_dev_name)
+static int rt711_add_codec_device_props(struct device *sdw_dev)
 {
 	struct property_entry props[MAX_NO_PROPS] = {};
-	struct device *sdw_dev;
-	int ret;
-
-	sdw_dev = bus_find_device_by_name(&sdw_bus_type, NULL, sdw_dev_name);
-	if (!sdw_dev)
-		return -EPROBE_DEFER;
 
-	if (SOF_RT711_JDSRC(sof_sdw_quirk)) {
-		props[0] = PROPERTY_ENTRY_U32("realtek,jd-src",
-					      SOF_RT711_JDSRC(sof_sdw_quirk));
-	}
-
-	ret = device_add_properties(sdw_dev, props);
-	put_device(sdw_dev);
+	if (!SOF_RT711_JDSRC(sof_sdw_quirk))
+		return 0;
+	props[0] = PROPERTY_ENTRY_U32("realtek,jd-src", SOF_RT711_JDSRC(sof_sdw_quirk));
 
-	return ret;
+	return device_add_properties(sdw_dev, props);
 }
 
 static const struct snd_soc_dapm_widget rt711_widgets[] = {
@@ -137,15 +127,10 @@ static int rt711_rtd_init(struct snd_soc_pcm_runtime *rtd)
 
 int sof_sdw_rt711_exit(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link)
 {
-	struct device *sdw_dev;
-
-	sdw_dev = bus_find_device_by_name(&sdw_bus_type, NULL,
-					  dai_link->codecs[0].name);
-	if (!sdw_dev)
-		return -EINVAL;
+	struct mc_private *ctx = snd_soc_card_get_drvdata(card);
 
-	device_remove_properties(sdw_dev);
-	put_device(sdw_dev);
+	device_remove_properties(ctx->headset_codec_dev);
+	put_device(ctx->headset_codec_dev);
 
 	return 0;
 }
@@ -156,6 +141,8 @@ int sof_sdw_rt711_init(struct snd_soc_card *card,
 		       struct sof_sdw_codec_info *info,
 		       bool playback)
 {
+	struct mc_private *ctx = snd_soc_card_get_drvdata(card);
+	struct device *sdw_dev;
 	int ret;
 
 	/*
@@ -165,9 +152,16 @@ int sof_sdw_rt711_init(struct snd_soc_card *card,
 	if (!playback)
 		return 0;
 
-	ret = rt711_add_codec_device_props(dai_links->codecs[0].name);
-	if (ret < 0)
+	sdw_dev = bus_find_device_by_name(&sdw_bus_type, NULL, dai_links->codecs[0].name);
+	if (!sdw_dev)
+		return -EPROBE_DEFER;
+
+	ret = rt711_add_codec_device_props(sdw_dev);
+	if (ret < 0) {
+		put_device(sdw_dev);
 		return ret;
+	}
+	ctx->headset_codec_dev = sdw_dev;
 
 	dai_links->init = rt711_rtd_init;
 
diff --git a/sound/soc/intel/boards/sof_sdw_rt711_sdca.c b/sound/soc/intel/boards/sof_sdw_rt711_sdca.c
index 1ae66f266c6c..94af40e2beb0 100644
--- a/sound/soc/intel/boards/sof_sdw_rt711_sdca.c
+++ b/sound/soc/intel/boards/sof_sdw_rt711_sdca.c
@@ -21,25 +21,16 @@
  * Note this MUST be called before snd_soc_register_card(), so that the props
  * are in place before the codec component driver's probe function parses them.
  */
-static int rt711_sdca_add_codec_device_props(const char *sdw_dev_name)
+static int rt711_sdca_add_codec_device_props(struct device *sdw_dev)
 {
 	struct property_entry props[MAX_NO_PROPS] = {};
-	struct device *sdw_dev;
-	int ret;
-
-	sdw_dev = bus_find_device_by_name(&sdw_bus_type, NULL, sdw_dev_name);
-	if (!sdw_dev)
-		return -EPROBE_DEFER;
 
-	if (SOF_RT711_JDSRC(sof_sdw_quirk)) {
-		props[0] = PROPERTY_ENTRY_U32("realtek,jd-src",
-					      SOF_RT711_JDSRC(sof_sdw_quirk));
-	}
+	if (!SOF_RT711_JDSRC(sof_sdw_quirk))
+		return 0;
 
-	ret = device_add_properties(sdw_dev, props);
-	put_device(sdw_dev);
+	props[0] = PROPERTY_ENTRY_U32("realtek,jd-src", SOF_RT711_JDSRC(sof_sdw_quirk));
 
-	return ret;
+	return device_add_properties(sdw_dev, props);
 }
 
 static const struct snd_soc_dapm_widget rt711_sdca_widgets[] = {
@@ -137,15 +128,10 @@ static int rt711_sdca_rtd_init(struct snd_soc_pcm_runtime *rtd)
 
 int sof_sdw_rt711_sdca_exit(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link)
 {
-	struct device *sdw_dev;
-
-	sdw_dev = bus_find_device_by_name(&sdw_bus_type, NULL,
-					  dai_link->codecs[0].name);
-	if (!sdw_dev)
-		return -EINVAL;
+	struct mc_private *ctx = snd_soc_card_get_drvdata(card);
 
-	device_remove_properties(sdw_dev);
-	put_device(sdw_dev);
+	device_remove_properties(ctx->headset_codec_dev);
+	put_device(ctx->headset_codec_dev);
 
 	return 0;
 }
@@ -156,6 +142,8 @@ int sof_sdw_rt711_sdca_init(struct snd_soc_card *card,
 			    struct sof_sdw_codec_info *info,
 			    bool playback)
 {
+	struct mc_private *ctx = snd_soc_card_get_drvdata(card);
+	struct device *sdw_dev;
 	int ret;
 
 	/*
@@ -165,9 +153,16 @@ int sof_sdw_rt711_sdca_init(struct snd_soc_card *card,
 	if (!playback)
 		return 0;
 
-	ret = rt711_sdca_add_codec_device_props(dai_links->codecs[0].name);
-	if (ret < 0)
+	sdw_dev = bus_find_device_by_name(&sdw_bus_type, NULL, dai_links->codecs[0].name);
+	if (!sdw_dev)
+		return -EPROBE_DEFER;
+
+	ret = rt711_sdca_add_codec_device_props(sdw_dev);
+	if (ret < 0) {
+		put_device(sdw_dev);
 		return ret;
+	}
+	ctx->headset_codec_dev = sdw_dev;
 
 	dai_links->init = rt711_sdca_rtd_init;
 
-- 
2.25.1


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

* [PATCH v2 6/8] ASoC: Intel: use software node API in SoundWire machines
  2021-08-12 22:44 [PATCH v2 0/8] ASoC: Intel: boards: use software node API Pierre-Louis Bossart
                   ` (4 preceding siblings ...)
  2021-08-12 22:44 ` [PATCH v2 5/8] ASoC: Intel: sof_sdw_rt711*: keep codec device reference until remove Pierre-Louis Bossart
@ 2021-08-12 22:44 ` Pierre-Louis Bossart
  2021-08-12 22:44 ` [PATCH v2 7/8] ASoC: Intel: remove device_properties for Atom boards Pierre-Louis Bossart
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Pierre-Louis Bossart @ 2021-08-12 22:44 UTC (permalink / raw)
  To: alsa-devel
  Cc: Heikki Krogerus, tiwai, Pierre-Louis Bossart, Hans de Goede,
	broonie, Andy Shevchenko

The function device_add_properties() is going to be removed.
Replacing it with software node API equivalents.

Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Co-developed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/intel/boards/sof_sdw_rt711.c      | 14 ++++++++++++--
 sound/soc/intel/boards/sof_sdw_rt711_sdca.c | 14 ++++++++++++--
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/sound/soc/intel/boards/sof_sdw_rt711.c b/sound/soc/intel/boards/sof_sdw_rt711.c
index 510301e09b09..c38b70c9fac3 100644
--- a/sound/soc/intel/boards/sof_sdw_rt711.c
+++ b/sound/soc/intel/boards/sof_sdw_rt711.c
@@ -24,12 +24,22 @@
 static int rt711_add_codec_device_props(struct device *sdw_dev)
 {
 	struct property_entry props[MAX_NO_PROPS] = {};
+	struct fwnode_handle *fwnode;
+	int ret;
 
 	if (!SOF_RT711_JDSRC(sof_sdw_quirk))
 		return 0;
 	props[0] = PROPERTY_ENTRY_U32("realtek,jd-src", SOF_RT711_JDSRC(sof_sdw_quirk));
 
-	return device_add_properties(sdw_dev, props);
+	fwnode = fwnode_create_software_node(props, NULL);
+	if (IS_ERR(fwnode))
+		return PTR_ERR(fwnode);
+
+	ret = device_add_software_node(sdw_dev, to_software_node(fwnode));
+
+	fwnode_handle_put(fwnode);
+
+	return ret;
 }
 
 static const struct snd_soc_dapm_widget rt711_widgets[] = {
@@ -129,7 +139,7 @@ int sof_sdw_rt711_exit(struct snd_soc_card *card, struct snd_soc_dai_link *dai_l
 {
 	struct mc_private *ctx = snd_soc_card_get_drvdata(card);
 
-	device_remove_properties(ctx->headset_codec_dev);
+	device_remove_software_node(ctx->headset_codec_dev);
 	put_device(ctx->headset_codec_dev);
 
 	return 0;
diff --git a/sound/soc/intel/boards/sof_sdw_rt711_sdca.c b/sound/soc/intel/boards/sof_sdw_rt711_sdca.c
index 94af40e2beb0..4215ddc36419 100644
--- a/sound/soc/intel/boards/sof_sdw_rt711_sdca.c
+++ b/sound/soc/intel/boards/sof_sdw_rt711_sdca.c
@@ -24,13 +24,23 @@
 static int rt711_sdca_add_codec_device_props(struct device *sdw_dev)
 {
 	struct property_entry props[MAX_NO_PROPS] = {};
+	struct fwnode_handle *fwnode;
+	int ret;
 
 	if (!SOF_RT711_JDSRC(sof_sdw_quirk))
 		return 0;
 
 	props[0] = PROPERTY_ENTRY_U32("realtek,jd-src", SOF_RT711_JDSRC(sof_sdw_quirk));
 
-	return device_add_properties(sdw_dev, props);
+	fwnode = fwnode_create_software_node(props, NULL);
+	if (IS_ERR(fwnode))
+		return PTR_ERR(fwnode);
+
+	ret = device_add_software_node(sdw_dev, to_software_node(fwnode));
+
+	fwnode_handle_put(fwnode);
+
+	return ret;
 }
 
 static const struct snd_soc_dapm_widget rt711_sdca_widgets[] = {
@@ -130,7 +140,7 @@ int sof_sdw_rt711_sdca_exit(struct snd_soc_card *card, struct snd_soc_dai_link *
 {
 	struct mc_private *ctx = snd_soc_card_get_drvdata(card);
 
-	device_remove_properties(ctx->headset_codec_dev);
+	device_remove_software_node(ctx->headset_codec_dev);
 	put_device(ctx->headset_codec_dev);
 
 	return 0;
-- 
2.25.1


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

* [PATCH v2 7/8] ASoC: Intel: remove device_properties for Atom boards
  2021-08-12 22:44 [PATCH v2 0/8] ASoC: Intel: boards: use software node API Pierre-Louis Bossart
                   ` (5 preceding siblings ...)
  2021-08-12 22:44 ` [PATCH v2 6/8] ASoC: Intel: use software node API in SoundWire machines Pierre-Louis Bossart
@ 2021-08-12 22:44 ` Pierre-Louis Bossart
  2021-08-12 22:44 ` [PATCH v2 8/8] ASoC: Intel: boards: use software node API in " Pierre-Louis Bossart
  2021-08-13 10:30 ` [PATCH v2 0/8] ASoC: Intel: boards: use software node API Andy Shevchenko
  8 siblings, 0 replies; 13+ messages in thread
From: Pierre-Louis Bossart @ 2021-08-12 22:44 UTC (permalink / raw)
  To: alsa-devel
  Cc: Heikki Krogerus, tiwai, Pierre-Louis Bossart, Hans de Goede,
	broonie, Andy Shevchenko

Prepare the transition to the software node API by removing device
properties in the probe error handling and .remove callback.

Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/intel/boards/bytcht_es8316.c | 2 ++
 sound/soc/intel/boards/bytcr_rt5640.c  | 5 ++++-
 sound/soc/intel/boards/bytcr_rt5651.c  | 5 ++++-
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/sound/soc/intel/boards/bytcht_es8316.c b/sound/soc/intel/boards/bytcht_es8316.c
index 34bdae45da73..5e1d30094250 100644
--- a/sound/soc/intel/boards/bytcht_es8316.c
+++ b/sound/soc/intel/boards/bytcht_es8316.c
@@ -615,6 +615,7 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev)
 	return 0;
 
 err:
+	device_remove_properties(priv->codec_dev);
 	put_device(priv->codec_dev);
 	return ret;
 }
@@ -625,6 +626,7 @@ static int snd_byt_cht_es8316_mc_remove(struct platform_device *pdev)
 	struct byt_cht_es8316_private *priv = snd_soc_card_get_drvdata(card);
 
 	gpiod_put(priv->speaker_en_gpio);
+	device_remove_properties(priv->codec_dev);
 	put_device(priv->codec_dev);
 	return 0;
 }
diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards/bytcr_rt5640.c
index fbe75c77e4ca..08cc907adf8a 100644
--- a/sound/soc/intel/boards/bytcr_rt5640.c
+++ b/sound/soc/intel/boards/bytcr_rt5640.c
@@ -1483,7 +1483,7 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
 	/* Must be called before register_card, also see declaration comment. */
 	ret_val = byt_rt5640_add_codec_device_props(codec_dev, priv);
 	if (ret_val)
-		goto err;
+		goto err_device;
 
 	log_quirks(&pdev->dev);
 
@@ -1586,6 +1586,8 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
 	return ret_val;
 
 err:
+	device_remove_properties(priv->codec_dev);
+err_device:
 	put_device(priv->codec_dev);
 	return ret_val;
 }
@@ -1595,6 +1597,7 @@ static int snd_byt_rt5640_mc_remove(struct platform_device *pdev)
 	struct snd_soc_card *card = platform_get_drvdata(pdev);
 	struct byt_rt5640_private *priv = snd_soc_card_get_drvdata(card);
 
+	device_remove_properties(priv->codec_dev);
 	put_device(priv->codec_dev);
 	return 0;
 }
diff --git a/sound/soc/intel/boards/bytcr_rt5651.c b/sound/soc/intel/boards/bytcr_rt5651.c
index c70dd729cdbb..cc1505e53b4f 100644
--- a/sound/soc/intel/boards/bytcr_rt5651.c
+++ b/sound/soc/intel/boards/bytcr_rt5651.c
@@ -997,7 +997,7 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
 	/* Must be called before register_card, also see declaration comment. */
 	ret_val = byt_rt5651_add_codec_device_props(codec_dev);
 	if (ret_val)
-		goto err;
+		goto err_device;
 
 	/* Cherry Trail devices use an external amplifier enable gpio */
 	if (soc_intel_is_cht() && !byt_rt5651_gpios)
@@ -1125,6 +1125,8 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
 	return ret_val;
 
 err:
+	device_remove_properties(priv->codec_dev);
+err_device:
 	put_device(priv->codec_dev);
 	return ret_val;
 }
@@ -1134,6 +1136,7 @@ static int snd_byt_rt5651_mc_remove(struct platform_device *pdev)
 	struct snd_soc_card *card = platform_get_drvdata(pdev);
 	struct byt_rt5651_private *priv = snd_soc_card_get_drvdata(card);
 
+	device_remove_properties(priv->codec_dev);
 	put_device(priv->codec_dev);
 	return 0;
 }
-- 
2.25.1


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

* [PATCH v2 8/8] ASoC: Intel: boards: use software node API in Atom boards
  2021-08-12 22:44 [PATCH v2 0/8] ASoC: Intel: boards: use software node API Pierre-Louis Bossart
                   ` (6 preceding siblings ...)
  2021-08-12 22:44 ` [PATCH v2 7/8] ASoC: Intel: remove device_properties for Atom boards Pierre-Louis Bossart
@ 2021-08-12 22:44 ` Pierre-Louis Bossart
  2021-08-13 10:30 ` [PATCH v2 0/8] ASoC: Intel: boards: use software node API Andy Shevchenko
  8 siblings, 0 replies; 13+ messages in thread
From: Pierre-Louis Bossart @ 2021-08-12 22:44 UTC (permalink / raw)
  To: alsa-devel
  Cc: Heikki Krogerus, tiwai, Pierre-Louis Bossart, Hans de Goede,
	broonie, Andy Shevchenko

From: Heikki Krogerus <heikki.krogerus@linux.intel.com>

The function device_add_properties() is going to be removed.
Replacing it with software node API equivalents.

Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Co-developed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
---
 sound/soc/intel/boards/bytcht_es8316.c | 16 +++++++++++++---
 sound/soc/intel/boards/bytcr_rt5640.c  | 15 ++++++++++++---
 sound/soc/intel/boards/bytcr_rt5651.c  | 23 ++++++++++++++++++-----
 3 files changed, 43 insertions(+), 11 deletions(-)

diff --git a/sound/soc/intel/boards/bytcht_es8316.c b/sound/soc/intel/boards/bytcht_es8316.c
index 5e1d30094250..aa45dd6e6f3e 100644
--- a/sound/soc/intel/boards/bytcht_es8316.c
+++ b/sound/soc/intel/boards/bytcht_es8316.c
@@ -462,6 +462,7 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev)
 	const struct dmi_system_id *dmi_id;
 	struct device *dev = &pdev->dev;
 	struct snd_soc_acpi_mach *mach;
+	struct fwnode_handle *fwnode;
 	const char *platform_name;
 	struct acpi_device *adev;
 	struct device *codec_dev;
@@ -548,7 +549,16 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev)
 		props[cnt++] = PROPERTY_ENTRY_BOOL("everest,jack-detect-inverted");
 
 	if (cnt) {
-		ret = device_add_properties(codec_dev, props);
+		fwnode = fwnode_create_software_node(props, NULL);
+		if (IS_ERR(fwnode)) {
+			put_device(codec_dev);
+			return PTR_ERR(fwnode);
+		}
+
+		ret = device_add_software_node(codec_dev, to_software_node(fwnode));
+
+		fwnode_handle_put(fwnode);
+
 		if (ret) {
 			put_device(codec_dev);
 			return ret;
@@ -615,7 +625,7 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev)
 	return 0;
 
 err:
-	device_remove_properties(priv->codec_dev);
+	device_remove_software_node(priv->codec_dev);
 	put_device(priv->codec_dev);
 	return ret;
 }
@@ -626,7 +636,7 @@ static int snd_byt_cht_es8316_mc_remove(struct platform_device *pdev)
 	struct byt_cht_es8316_private *priv = snd_soc_card_get_drvdata(card);
 
 	gpiod_put(priv->speaker_en_gpio);
-	device_remove_properties(priv->codec_dev);
+	device_remove_software_node(priv->codec_dev);
 	put_device(priv->codec_dev);
 	return 0;
 }
diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards/bytcr_rt5640.c
index 08cc907adf8a..3eda3b1eb169 100644
--- a/sound/soc/intel/boards/bytcr_rt5640.c
+++ b/sound/soc/intel/boards/bytcr_rt5640.c
@@ -974,6 +974,7 @@ static int byt_rt5640_add_codec_device_props(struct device *i2c_dev,
 					     struct byt_rt5640_private *priv)
 {
 	struct property_entry props[MAX_NO_PROPS] = {};
+	struct fwnode_handle *fwnode;
 	int ret, cnt = 0;
 
 	switch (BYT_RT5640_MAP(byt_rt5640_quirk)) {
@@ -1014,7 +1015,15 @@ static int byt_rt5640_add_codec_device_props(struct device *i2c_dev,
 	if (byt_rt5640_quirk & BYT_RT5640_JD_NOT_INV)
 		props[cnt++] = PROPERTY_ENTRY_BOOL("realtek,jack-detect-not-inverted");
 
-	ret = device_add_properties(i2c_dev, props);
+	fwnode = fwnode_create_software_node(props, NULL);
+	if (IS_ERR(fwnode)) {
+		/* put_device() is handled in caller */
+		return PTR_ERR(fwnode);
+	}
+
+	ret = device_add_software_node(i2c_dev, to_software_node(fwnode));
+
+	fwnode_handle_put(fwnode);
 
 	return ret;
 }
@@ -1586,7 +1595,7 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
 	return ret_val;
 
 err:
-	device_remove_properties(priv->codec_dev);
+	device_remove_software_node(priv->codec_dev);
 err_device:
 	put_device(priv->codec_dev);
 	return ret_val;
@@ -1597,7 +1606,7 @@ static int snd_byt_rt5640_mc_remove(struct platform_device *pdev)
 	struct snd_soc_card *card = platform_get_drvdata(pdev);
 	struct byt_rt5640_private *priv = snd_soc_card_get_drvdata(card);
 
-	device_remove_properties(priv->codec_dev);
+	device_remove_software_node(priv->codec_dev);
 	put_device(priv->codec_dev);
 	return 0;
 }
diff --git a/sound/soc/intel/boards/bytcr_rt5651.c b/sound/soc/intel/boards/bytcr_rt5651.c
index cc1505e53b4f..e94c9124d4f4 100644
--- a/sound/soc/intel/boards/bytcr_rt5651.c
+++ b/sound/soc/intel/boards/bytcr_rt5651.c
@@ -528,10 +528,13 @@ static const struct dmi_system_id byt_rt5651_quirk_table[] = {
  * Note this MUST be called before snd_soc_register_card(), so that the props
  * are in place before the codec component driver's probe function parses them.
  */
-static int byt_rt5651_add_codec_device_props(struct device *i2c_dev)
+static int byt_rt5651_add_codec_device_props(struct device *i2c_dev,
+					     struct byt_rt5651_private *priv)
 {
 	struct property_entry props[MAX_NO_PROPS] = {};
+	struct fwnode_handle *fwnode;
 	int cnt = 0;
+	int ret;
 
 	props[cnt++] = PROPERTY_ENTRY_U32("realtek,jack-detect-source",
 				BYT_RT5651_JDSRC(byt_rt5651_quirk));
@@ -548,7 +551,17 @@ static int byt_rt5651_add_codec_device_props(struct device *i2c_dev)
 	if (byt_rt5651_quirk & BYT_RT5651_JD_NOT_INV)
 		props[cnt++] = PROPERTY_ENTRY_BOOL("realtek,jack-detect-not-inverted");
 
-	return device_add_properties(i2c_dev, props);
+	fwnode = fwnode_create_software_node(props, NULL);
+	if (IS_ERR(fwnode)) {
+		/* put_device(i2c_dev) is handled in caller */
+		return PTR_ERR(fwnode);
+	}
+
+	ret = device_add_software_node(i2c_dev, to_software_node(fwnode));
+
+	fwnode_handle_put(fwnode);
+
+	return ret;
 }
 
 static int byt_rt5651_init(struct snd_soc_pcm_runtime *runtime)
@@ -995,7 +1008,7 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
 	}
 
 	/* Must be called before register_card, also see declaration comment. */
-	ret_val = byt_rt5651_add_codec_device_props(codec_dev);
+	ret_val = byt_rt5651_add_codec_device_props(codec_dev, priv);
 	if (ret_val)
 		goto err_device;
 
@@ -1125,7 +1138,7 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
 	return ret_val;
 
 err:
-	device_remove_properties(priv->codec_dev);
+	device_remove_software_node(priv->codec_dev);
 err_device:
 	put_device(priv->codec_dev);
 	return ret_val;
@@ -1136,7 +1149,7 @@ static int snd_byt_rt5651_mc_remove(struct platform_device *pdev)
 	struct snd_soc_card *card = platform_get_drvdata(pdev);
 	struct byt_rt5651_private *priv = snd_soc_card_get_drvdata(card);
 
-	device_remove_properties(priv->codec_dev);
+	device_remove_software_node(priv->codec_dev);
 	put_device(priv->codec_dev);
 	return 0;
 }
-- 
2.25.1


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

* Re: [PATCH v2 1/8] ASoC: Intel: boards: harden codec property handling
  2021-08-12 22:44 ` [PATCH v2 1/8] ASoC: Intel: boards: harden codec property handling Pierre-Louis Bossart
@ 2021-08-13 10:22   ` Andy Shevchenko
  0 siblings, 0 replies; 13+ messages in thread
From: Andy Shevchenko @ 2021-08-13 10:22 UTC (permalink / raw)
  To: Pierre-Louis Bossart
  Cc: tiwai, Hans de Goede, alsa-devel, broonie, Heikki Krogerus

On Thu, Aug 12, 2021 at 05:44:36PM -0500, Pierre-Louis Bossart wrote:
> In current ACPI-based devices, the DSDT does not include any of the
> properties required by the codec driver. This is not an ACPI
> limitation proper since the _DSD method could be used, as done for
> Camera and SoundWire in newer platforms. For legacy devices, there is
> unfortunately no other option than using a work-around: we add
> properties to the codec device from the machine driver.
> 
> To avoid any issues with the codec driver being unbound, we need to
> keep a reference to the codec device until the card is removed.

A few nit-picks, otherwise looks good to me, thanks!
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

> Co-developed-by: Hans de Goede <hdegoede@redhat.com>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> ---
>  sound/soc/intel/boards/bytcht_es8316.c | 12 ++++++--
>  sound/soc/intel/boards/bytcr_rt5640.c  | 41 ++++++++++++++++++--------
>  sound/soc/intel/boards/bytcr_rt5651.c  | 37 +++++++++++++++--------
>  3 files changed, 62 insertions(+), 28 deletions(-)
> 
> diff --git a/sound/soc/intel/boards/bytcht_es8316.c b/sound/soc/intel/boards/bytcht_es8316.c
> index a0af91580184..fcf7c9c04069 100644
> --- a/sound/soc/intel/boards/bytcht_es8316.c
> +++ b/sound/soc/intel/boards/bytcht_es8316.c
> @@ -37,6 +37,7 @@ struct byt_cht_es8316_private {
>  	struct clk *mclk;
>  	struct snd_soc_jack jack;
>  	struct gpio_desc *speaker_en_gpio;
> +	struct device *codec_dev;
>  	bool speaker_en;
>  };
>  
> @@ -555,7 +556,7 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev)
>  		gpiod_get_index(codec_dev, "speaker-enable", 0,
>  				/* see comment in byt_cht_es8316_resume */
>  				GPIOD_OUT_LOW | GPIOD_FLAGS_BIT_NONEXCLUSIVE);
> -	put_device(codec_dev);
> +	priv->codec_dev = codec_dev;
>  
>  	if (IS_ERR(priv->speaker_en_gpio)) {
>  		ret = PTR_ERR(priv->speaker_en_gpio);
> @@ -567,7 +568,7 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev)
>  			dev_err(dev, "get speaker GPIO failed: %d\n", ret);
>  			fallthrough;
>  		case -EPROBE_DEFER:
> -			return ret;
> +			goto err;
>  		}
>  	}
>  
> @@ -605,10 +606,14 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev)
>  	if (ret) {
>  		gpiod_put(priv->speaker_en_gpio);
>  		dev_err(dev, "snd_soc_register_card failed: %d\n", ret);
> -		return ret;
> +		goto err;
>  	}
>  	platform_set_drvdata(pdev, &byt_cht_es8316_card);
>  	return 0;
> +
> +err:

I would give better name to this kind of label, e.g.

err_put_codec:

Ditto for the rest below.

> +	put_device(priv->codec_dev);
> +	return ret;
>  }
>  
>  static int snd_byt_cht_es8316_mc_remove(struct platform_device *pdev)
> @@ -617,6 +622,7 @@ static int snd_byt_cht_es8316_mc_remove(struct platform_device *pdev)
>  	struct byt_cht_es8316_private *priv = snd_soc_card_get_drvdata(card);
>  
>  	gpiod_put(priv->speaker_en_gpio);
> +	put_device(priv->codec_dev);
>  	return 0;
>  }
>  
> diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards/bytcr_rt5640.c
> index d51bd22073df..808bfb7fd81e 100644
> --- a/sound/soc/intel/boards/bytcr_rt5640.c
> +++ b/sound/soc/intel/boards/bytcr_rt5640.c
> @@ -90,6 +90,7 @@ enum {
>  struct byt_rt5640_private {
>  	struct snd_soc_jack jack;
>  	struct clk *mclk;
> +	struct device *codec_dev;
>  };
>  static bool is_bytcr;
>  
> @@ -969,16 +970,12 @@ static const struct dmi_system_id byt_rt5640_quirk_table[] = {
>   * Note this MUST be called before snd_soc_register_card(), so that the props
>   * are in place before the codec component driver's probe function parses them.
>   */
> -static int byt_rt5640_add_codec_device_props(const char *i2c_dev_name)
> +static int byt_rt5640_add_codec_device_props(struct device *i2c_dev,
> +					     struct byt_rt5640_private *priv)
>  {
>  	struct property_entry props[MAX_NO_PROPS] = {};
> -	struct device *i2c_dev;
>  	int ret, cnt = 0;
>  
> -	i2c_dev = bus_find_device_by_name(&i2c_bus_type, NULL, i2c_dev_name);
> -	if (!i2c_dev)
> -		return -EPROBE_DEFER;
> -
>  	switch (BYT_RT5640_MAP(byt_rt5640_quirk)) {
>  	case BYT_RT5640_DMIC1_MAP:
>  		props[cnt++] = PROPERTY_ENTRY_U32("realtek,dmic1-data-pin",
> @@ -1018,7 +1015,6 @@ static int byt_rt5640_add_codec_device_props(const char *i2c_dev_name)
>  		props[cnt++] = PROPERTY_ENTRY_BOOL("realtek,jack-detect-not-inverted");
>  
>  	ret = device_add_properties(i2c_dev, props);
> -	put_device(i2c_dev);
>  
>  	return ret;

Now can be

	return device_add_properties(i2c_dev, props);

>  }
> @@ -1367,6 +1363,7 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
>  	struct snd_soc_acpi_mach *mach;
>  	const char *platform_name;
>  	struct acpi_device *adev;
> +	struct device *codec_dev;
>  	bool sof_parent;
>  	int ret_val = 0;
>  	int dai_index = 0;
> @@ -1475,10 +1472,16 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
>  		byt_rt5640_quirk = quirk_override;
>  	}
>  
> +	codec_dev = bus_find_device_by_name(&i2c_bus_type, NULL, byt_rt5640_codec_name);
> +	if (!codec_dev)
> +		return -EPROBE_DEFER;
> +
> +	priv->codec_dev = codec_dev;
> +
>  	/* Must be called before register_card, also see declaration comment. */
> -	ret_val = byt_rt5640_add_codec_device_props(byt_rt5640_codec_name);
> +	ret_val = byt_rt5640_add_codec_device_props(codec_dev, priv);
>  	if (ret_val)
> -		return ret_val;
> +		goto err;
>  
>  	log_quirks(&pdev->dev);
>  
> @@ -1509,7 +1512,7 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
>  			 * for all other errors, including -EPROBE_DEFER
>  			 */
>  			if (ret_val != -ENOENT)
> -				return ret_val;
> +				goto err;
>  			byt_rt5640_quirk &= ~BYT_RT5640_MCLK_EN;
>  		}
>  	}
> @@ -1553,7 +1556,7 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
>  	ret_val = snd_soc_fixup_dai_links_platform_name(&byt_rt5640_card,
>  							platform_name);
>  	if (ret_val)
> -		return ret_val;
> +		goto err;
>  
>  	sof_parent = snd_soc_acpi_sof_parent(&pdev->dev);
>  
> @@ -1575,10 +1578,23 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
>  	if (ret_val) {
>  		dev_err(&pdev->dev, "devm_snd_soc_register_card failed %d\n",
>  			ret_val);
> -		return ret_val;
> +		goto err;
>  	}
>  	platform_set_drvdata(pdev, &byt_rt5640_card);
>  	return ret_val;
> +
> +err:
> +	put_device(priv->codec_dev);
> +	return ret_val;
> +}
> +
> +static int snd_byt_rt5640_mc_remove(struct platform_device *pdev)
> +{
> +	struct snd_soc_card *card = platform_get_drvdata(pdev);
> +	struct byt_rt5640_private *priv = snd_soc_card_get_drvdata(card);
> +
> +	put_device(priv->codec_dev);
> +	return 0;
>  }
>  
>  static struct platform_driver snd_byt_rt5640_mc_driver = {
> @@ -1586,6 +1602,7 @@ static struct platform_driver snd_byt_rt5640_mc_driver = {
>  		.name = "bytcr_rt5640",
>  	},
>  	.probe = snd_byt_rt5640_mc_probe,
> +	.remove = snd_byt_rt5640_mc_remove

+ Comma

>  };
>  
>  module_platform_driver(snd_byt_rt5640_mc_driver);
> diff --git a/sound/soc/intel/boards/bytcr_rt5651.c b/sound/soc/intel/boards/bytcr_rt5651.c
> index e13c0c63a949..7033c07f8fd6 100644
> --- a/sound/soc/intel/boards/bytcr_rt5651.c
> +++ b/sound/soc/intel/boards/bytcr_rt5651.c
> @@ -85,6 +85,7 @@ struct byt_rt5651_private {
>  	struct gpio_desc *ext_amp_gpio;
>  	struct gpio_desc *hp_detect;
>  	struct snd_soc_jack jack;
> +	struct device *codec_dev;
>  };
>  
>  static const struct acpi_gpio_mapping *byt_rt5651_gpios;
> @@ -993,12 +994,12 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
>  		byt_rt5651_quirk = quirk_override;
>  	}
>  
> +	priv->codec_dev = codec_dev;
> +
>  	/* Must be called before register_card, also see declaration comment. */
>  	ret_val = byt_rt5651_add_codec_device_props(codec_dev);
> -	if (ret_val) {
> -		put_device(codec_dev);
> -		return ret_val;
> -	}
> +	if (ret_val)
> +		goto err;
>  
>  	/* Cherry Trail devices use an external amplifier enable gpio */
>  	if (soc_intel_is_cht() && !byt_rt5651_gpios)
> @@ -1022,8 +1023,7 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
>  					ret_val);
>  				fallthrough;
>  			case -EPROBE_DEFER:
> -				put_device(codec_dev);
> -				return ret_val;
> +				goto err;
>  			}
>  		}
>  		priv->hp_detect = devm_fwnode_gpiod_get(&pdev->dev,
> @@ -1042,14 +1042,11 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
>  					ret_val);
>  				fallthrough;
>  			case -EPROBE_DEFER:
> -				put_device(codec_dev);
> -				return ret_val;
> +				goto err;
>  			}
>  		}
>  	}
>  
> -	put_device(codec_dev);
> -
>  	log_quirks(&pdev->dev);
>  
>  	if ((byt_rt5651_quirk & BYT_RT5651_SSP2_AIF2) ||
> @@ -1073,7 +1070,7 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
>  			 * for all other errors, including -EPROBE_DEFER
>  			 */
>  			if (ret_val != -ENOENT)
> -				return ret_val;
> +				goto err;
>  			byt_rt5651_quirk &= ~BYT_RT5651_MCLK_EN;
>  		}
>  	}
> @@ -1102,7 +1099,7 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
>  	ret_val = snd_soc_fixup_dai_links_platform_name(&byt_rt5651_card,
>  							platform_name);
>  	if (ret_val)
> -		return ret_val;
> +		goto err;
>  
>  	sof_parent = snd_soc_acpi_sof_parent(&pdev->dev);
>  
> @@ -1124,10 +1121,23 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
>  	if (ret_val) {
>  		dev_err(&pdev->dev, "devm_snd_soc_register_card failed %d\n",
>  			ret_val);
> -		return ret_val;
> +		goto err;
>  	}
>  	platform_set_drvdata(pdev, &byt_rt5651_card);
>  	return ret_val;
> +
> +err:
> +	put_device(priv->codec_dev);
> +	return ret_val;
> +}
> +
> +static int snd_byt_rt5651_mc_remove(struct platform_device *pdev)
> +{
> +	struct snd_soc_card *card = platform_get_drvdata(pdev);
> +	struct byt_rt5651_private *priv = snd_soc_card_get_drvdata(card);
> +
> +	put_device(priv->codec_dev);
> +	return 0;
>  }
>  
>  static struct platform_driver snd_byt_rt5651_mc_driver = {
> @@ -1135,6 +1145,7 @@ static struct platform_driver snd_byt_rt5651_mc_driver = {
>  		.name = "bytcr_rt5651",
>  	},
>  	.probe = snd_byt_rt5651_mc_probe,
> +	.remove = snd_byt_rt5651_mc_remove,
>  };
>  
>  module_platform_driver(snd_byt_rt5651_mc_driver);
> -- 
> 2.25.1
> 

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH v2 2/8] ASoC: Intel: boards: handle errors with acpi_dev_get_first_match_dev()
  2021-08-12 22:44 ` [PATCH v2 2/8] ASoC: Intel: boards: handle errors with acpi_dev_get_first_match_dev() Pierre-Louis Bossart
@ 2021-08-13 10:23   ` Andy Shevchenko
  0 siblings, 0 replies; 13+ messages in thread
From: Andy Shevchenko @ 2021-08-13 10:23 UTC (permalink / raw)
  To: Pierre-Louis Bossart
  Cc: tiwai, Hans de Goede, alsa-devel, broonie, Heikki Krogerus

On Thu, Aug 12, 2021 at 05:44:37PM -0500, Pierre-Louis Bossart wrote:
> acpi_dev_get_first_match_dev() searches for an acpi_handle
> instantiated by the ACPI table scanning done early during boot.
> 
> Two of three machine drivers using this search don't deal with errors
> and the one which does (bytcr_rt5651) returns -ENODEV, which doesn't
> make sense here: an alternate driver will not be probed.
> 
> Add consistent error handling and report -ENXIO

Missed period.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

> Suggested-by: Hans de Goede <hdegoede@redhat.com>
> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> ---
>  sound/soc/intel/boards/bytcht_es8316.c | 3 +++
>  sound/soc/intel/boards/bytcr_rt5640.c  | 3 +++
>  sound/soc/intel/boards/bytcr_rt5651.c  | 2 +-
>  3 files changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/sound/soc/intel/boards/bytcht_es8316.c b/sound/soc/intel/boards/bytcht_es8316.c
> index fcf7c9c04069..7c078a9f6deb 100644
> --- a/sound/soc/intel/boards/bytcht_es8316.c
> +++ b/sound/soc/intel/boards/bytcht_es8316.c
> @@ -492,6 +492,9 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev)
>  			 "i2c-%s", acpi_dev_name(adev));
>  		put_device(&adev->dev);
>  		byt_cht_es8316_dais[dai_index].codecs->name = codec_name;
> +	} else {
> +		dev_err(&pdev->dev, "Error cannot find '%s' dev\n", mach->id);
> +		return -ENXIO;
>  	}
>  
>  	/* override plaform name, if required */
> diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards/bytcr_rt5640.c
> index 808bfb7fd81e..60ed954d7277 100644
> --- a/sound/soc/intel/boards/bytcr_rt5640.c
> +++ b/sound/soc/intel/boards/bytcr_rt5640.c
> @@ -1396,6 +1396,9 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
>  			 "i2c-%s", acpi_dev_name(adev));
>  		put_device(&adev->dev);
>  		byt_rt5640_dais[dai_index].codecs->name = byt_rt5640_codec_name;
> +	} else {
> +		dev_err(&pdev->dev, "Error cannot find '%s' dev\n", mach->id);
> +		return -ENXIO;
>  	}
>  
>  	/*
> diff --git a/sound/soc/intel/boards/bytcr_rt5651.c b/sound/soc/intel/boards/bytcr_rt5651.c
> index 7033c07f8fd6..b4307d1d5527 100644
> --- a/sound/soc/intel/boards/bytcr_rt5651.c
> +++ b/sound/soc/intel/boards/bytcr_rt5651.c
> @@ -921,7 +921,7 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
>  		byt_rt5651_dais[dai_index].codecs->name = byt_rt5651_codec_name;
>  	} else {
>  		dev_err(&pdev->dev, "Error cannot find '%s' dev\n", mach->id);
> -		return -ENODEV;
> +		return -ENXIO;
>  	}
>  
>  	codec_dev = bus_find_device_by_name(&i2c_bus_type, NULL,
> -- 
> 2.25.1
> 

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH v2 0/8] ASoC: Intel: boards: use software node API
  2021-08-12 22:44 [PATCH v2 0/8] ASoC: Intel: boards: use software node API Pierre-Louis Bossart
                   ` (7 preceding siblings ...)
  2021-08-12 22:44 ` [PATCH v2 8/8] ASoC: Intel: boards: use software node API in " Pierre-Louis Bossart
@ 2021-08-13 10:30 ` Andy Shevchenko
  2021-08-13 13:33   ` Pierre-Louis Bossart
  8 siblings, 1 reply; 13+ messages in thread
From: Andy Shevchenko @ 2021-08-13 10:30 UTC (permalink / raw)
  To: Pierre-Louis Bossart
  Cc: tiwai, Hans de Goede, alsa-devel, broonie, Heikki Krogerus

On Thu, Aug 12, 2021 at 05:44:35PM -0500, Pierre-Louis Bossart wrote:
> This is an update on an earlier contribution from Heikki Krogerus
> 
> The function device_add_properties() is going to be removed.
> Replacing it with software node API equivalents.
> 
> Thanks for Hans de Goede and Andy Shevchenko for their comments,
> suggestions and Reviewed-by tags on GitHub. The review thread can be
> found at https://github.com/thesofproject/linux/pull/3041)

For all non-commented
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

> v2 changes: feedback from Andy and Hans
> Better error handling
> Codec reference is kept until the .remove callback
> Remove bus search to find device
> 
> v1 changes from Heikki's patches:
> Avoid the use of devm_ routines for Baytrail machine drivers.
> 
> Heikki Krogerus (1):
>   ASoC: Intel: boards: use software node API in Atom boards
> 
> Pierre-Louis Bossart (7):
>   ASoC: Intel: boards: harden codec property handling
>   ASoC: Intel: boards: handle errors with acpi_dev_get_first_match_dev()
>   ASoC: Intel: boards: get codec device with ACPI instead of bus search
>   ASoC: Intel: sof_sdw: pass card information to init/exit functions
>   ASoC: Intel: sof_sdw_rt711*: keep codec device reference until remove
>   ASoC: Intel: use software node API in SoundWire machines
>   ASoC: Intel: remove device_properties for Atom boards
> 
>  sound/soc/intel/boards/bytcht_es8316.c      | 31 ++++++++--
>  sound/soc/intel/boards/bytcr_rt5640.c       | 57 ++++++++++++++-----
>  sound/soc/intel/boards/bytcr_rt5651.c       | 63 ++++++++++++++-------
>  sound/soc/intel/boards/sof_sdw.c            | 20 ++++---
>  sound/soc/intel/boards/sof_sdw_common.h     | 37 +++++++-----
>  sound/soc/intel/boards/sof_sdw_max98373.c   |  3 +-
>  sound/soc/intel/boards/sof_sdw_rt1308.c     |  3 +-
>  sound/soc/intel/boards/sof_sdw_rt1316.c     |  3 +-
>  sound/soc/intel/boards/sof_sdw_rt5682.c     |  3 +-
>  sound/soc/intel/boards/sof_sdw_rt700.c      |  3 +-
>  sound/soc/intel/boards/sof_sdw_rt711.c      | 51 +++++++++--------
>  sound/soc/intel/boards/sof_sdw_rt711_sdca.c | 52 +++++++++--------
>  sound/soc/intel/boards/sof_sdw_rt715.c      |  3 +-
>  sound/soc/intel/boards/sof_sdw_rt715_sdca.c |  3 +-
>  14 files changed, 221 insertions(+), 111 deletions(-)
> 
> -- 
> 2.25.1
> 

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH v2 0/8] ASoC: Intel: boards: use software node API
  2021-08-13 10:30 ` [PATCH v2 0/8] ASoC: Intel: boards: use software node API Andy Shevchenko
@ 2021-08-13 13:33   ` Pierre-Louis Bossart
  0 siblings, 0 replies; 13+ messages in thread
From: Pierre-Louis Bossart @ 2021-08-13 13:33 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: tiwai, Hans de Goede, alsa-devel, broonie, Heikki Krogerus



On 8/13/21 5:30 AM, Andy Shevchenko wrote:
> On Thu, Aug 12, 2021 at 05:44:35PM -0500, Pierre-Louis Bossart wrote:
>> This is an update on an earlier contribution from Heikki Krogerus
>>
>> The function device_add_properties() is going to be removed.
>> Replacing it with software node API equivalents.
>>
>> Thanks for Hans de Goede and Andy Shevchenko for their comments,
>> suggestions and Reviewed-by tags on GitHub. The review thread can be
>> found at https://github.com/thesofproject/linux/pull/3041)
> 
> For all non-commented
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Thanks Andy for the review, I'll resend a v3 later today with your
suggested changes and your Reviewed-by tag added.
>> v2 changes: feedback from Andy and Hans
>> Better error handling
>> Codec reference is kept until the .remove callback
>> Remove bus search to find device
>>
>> v1 changes from Heikki's patches:
>> Avoid the use of devm_ routines for Baytrail machine drivers.
>>
>> Heikki Krogerus (1):
>>   ASoC: Intel: boards: use software node API in Atom boards
>>
>> Pierre-Louis Bossart (7):
>>   ASoC: Intel: boards: harden codec property handling
>>   ASoC: Intel: boards: handle errors with acpi_dev_get_first_match_dev()
>>   ASoC: Intel: boards: get codec device with ACPI instead of bus search
>>   ASoC: Intel: sof_sdw: pass card information to init/exit functions
>>   ASoC: Intel: sof_sdw_rt711*: keep codec device reference until remove
>>   ASoC: Intel: use software node API in SoundWire machines
>>   ASoC: Intel: remove device_properties for Atom boards
>>
>>  sound/soc/intel/boards/bytcht_es8316.c      | 31 ++++++++--
>>  sound/soc/intel/boards/bytcr_rt5640.c       | 57 ++++++++++++++-----
>>  sound/soc/intel/boards/bytcr_rt5651.c       | 63 ++++++++++++++-------
>>  sound/soc/intel/boards/sof_sdw.c            | 20 ++++---
>>  sound/soc/intel/boards/sof_sdw_common.h     | 37 +++++++-----
>>  sound/soc/intel/boards/sof_sdw_max98373.c   |  3 +-
>>  sound/soc/intel/boards/sof_sdw_rt1308.c     |  3 +-
>>  sound/soc/intel/boards/sof_sdw_rt1316.c     |  3 +-
>>  sound/soc/intel/boards/sof_sdw_rt5682.c     |  3 +-
>>  sound/soc/intel/boards/sof_sdw_rt700.c      |  3 +-
>>  sound/soc/intel/boards/sof_sdw_rt711.c      | 51 +++++++++--------
>>  sound/soc/intel/boards/sof_sdw_rt711_sdca.c | 52 +++++++++--------
>>  sound/soc/intel/boards/sof_sdw_rt715.c      |  3 +-
>>  sound/soc/intel/boards/sof_sdw_rt715_sdca.c |  3 +-
>>  14 files changed, 221 insertions(+), 111 deletions(-)
>>
>> -- 
>> 2.25.1
>>
> 

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

end of thread, other threads:[~2021-08-13 13:35 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-12 22:44 [PATCH v2 0/8] ASoC: Intel: boards: use software node API Pierre-Louis Bossart
2021-08-12 22:44 ` [PATCH v2 1/8] ASoC: Intel: boards: harden codec property handling Pierre-Louis Bossart
2021-08-13 10:22   ` Andy Shevchenko
2021-08-12 22:44 ` [PATCH v2 2/8] ASoC: Intel: boards: handle errors with acpi_dev_get_first_match_dev() Pierre-Louis Bossart
2021-08-13 10:23   ` Andy Shevchenko
2021-08-12 22:44 ` [PATCH v2 3/8] ASoC: Intel: boards: get codec device with ACPI instead of bus search Pierre-Louis Bossart
2021-08-12 22:44 ` [PATCH v2 4/8] ASoC: Intel: sof_sdw: pass card information to init/exit functions Pierre-Louis Bossart
2021-08-12 22:44 ` [PATCH v2 5/8] ASoC: Intel: sof_sdw_rt711*: keep codec device reference until remove Pierre-Louis Bossart
2021-08-12 22:44 ` [PATCH v2 6/8] ASoC: Intel: use software node API in SoundWire machines Pierre-Louis Bossart
2021-08-12 22:44 ` [PATCH v2 7/8] ASoC: Intel: remove device_properties for Atom boards Pierre-Louis Bossart
2021-08-12 22:44 ` [PATCH v2 8/8] ASoC: Intel: boards: use software node API in " Pierre-Louis Bossart
2021-08-13 10:30 ` [PATCH v2 0/8] ASoC: Intel: boards: use software node API Andy Shevchenko
2021-08-13 13:33   ` Pierre-Louis Bossart

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.