Commit 04a32383 authored by Mark Brown's avatar Mark Brown

Merge series "ASoC: Intel: bytcht_es8316: few cleanups" from Andy Shevchenko...

Merge series "ASoC: Intel: bytcht_es8316: few cleanups" from Andy Shevchenko <andriy.shevchenko@linux.intel.com>:

The small set of cleanups against bytcht_es8316 board file.

In v4:
- fixed Pierre's email (Pierre)
- added Hans to the Cc list

In v3:
- actually added a Pierre's tag (Mark)

In v2:
- added tag (Pierre)
- added commit message to the patch 2 (Joe)

Andy Shevchenko (4):
  ASoC: Intel: bytcht_es8316: Get platform data via dev_get_platdata()
  ASoC: Intel: bytcht_es8316: Use temporary variable for struct device
  ASoC: Intel: bytcht_es8316: Switch to use gpiod_get_optional()
  ASoC: Intel: bytcht_es8316: Utilize dev_err_probe() to avoid log
    saturation

 sound/soc/intel/boards/bytcht_es8316.c | 37 +++++++++-----------------
 1 file changed, 12 insertions(+), 25 deletions(-)

--
2.33.0
parents febf5da8 bea03a32
...@@ -456,12 +456,12 @@ static const struct dmi_system_id byt_cht_es8316_quirk_table[] = { ...@@ -456,12 +456,12 @@ static const struct dmi_system_id byt_cht_es8316_quirk_table[] = {
static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev) static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev;
static const char * const mic_name[] = { "in1", "in2" }; static const char * const mic_name[] = { "in1", "in2" };
struct snd_soc_acpi_mach *mach = dev_get_platdata(dev);
struct property_entry props[MAX_NO_PROPS] = {}; struct property_entry props[MAX_NO_PROPS] = {};
struct byt_cht_es8316_private *priv; struct byt_cht_es8316_private *priv;
const struct dmi_system_id *dmi_id; const struct dmi_system_id *dmi_id;
struct device *dev = &pdev->dev;
struct snd_soc_acpi_mach *mach;
struct fwnode_handle *fwnode; struct fwnode_handle *fwnode;
const char *platform_name; const char *platform_name;
struct acpi_device *adev; struct acpi_device *adev;
...@@ -476,7 +476,6 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev) ...@@ -476,7 +476,6 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev)
if (!priv) if (!priv)
return -ENOMEM; return -ENOMEM;
mach = dev->platform_data;
/* fix index of codec dai */ /* fix index of codec dai */
for (i = 0; i < ARRAY_SIZE(byt_cht_es8316_dais); i++) { for (i = 0; i < ARRAY_SIZE(byt_cht_es8316_dais); i++) {
if (!strcmp(byt_cht_es8316_dais[i].codecs->name, if (!strcmp(byt_cht_es8316_dais[i].codecs->name,
...@@ -494,7 +493,7 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev) ...@@ -494,7 +493,7 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev)
put_device(&adev->dev); put_device(&adev->dev);
byt_cht_es8316_dais[dai_index].codecs->name = codec_name; byt_cht_es8316_dais[dai_index].codecs->name = codec_name;
} else { } else {
dev_err(&pdev->dev, "Error cannot find '%s' dev\n", mach->id); dev_err(dev, "Error cannot find '%s' dev\n", mach->id);
return -ENXIO; return -ENXIO;
} }
...@@ -533,11 +532,8 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev) ...@@ -533,11 +532,8 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev)
/* get the clock */ /* get the clock */
priv->mclk = devm_clk_get(dev, "pmc_plt_clk_3"); priv->mclk = devm_clk_get(dev, "pmc_plt_clk_3");
if (IS_ERR(priv->mclk)) { if (IS_ERR(priv->mclk))
ret = PTR_ERR(priv->mclk); return dev_err_probe(dev, PTR_ERR(priv->mclk), "clk_get pmc_plt_clk_3 failed\n");
dev_err(dev, "clk_get pmc_plt_clk_3 failed: %d\n", ret);
return ret;
}
/* get speaker enable GPIO */ /* get speaker enable GPIO */
codec_dev = acpi_get_first_physical_node(adev); codec_dev = acpi_get_first_physical_node(adev);
...@@ -567,23 +563,14 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev) ...@@ -567,23 +563,14 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev)
devm_acpi_dev_add_driver_gpios(codec_dev, byt_cht_es8316_gpios); devm_acpi_dev_add_driver_gpios(codec_dev, byt_cht_es8316_gpios);
priv->speaker_en_gpio = priv->speaker_en_gpio =
gpiod_get_index(codec_dev, "speaker-enable", 0, gpiod_get_optional(codec_dev, "speaker-enable",
/* see comment in byt_cht_es8316_resume */ /* see comment in byt_cht_es8316_resume() */
GPIOD_OUT_LOW | GPIOD_FLAGS_BIT_NONEXCLUSIVE); GPIOD_OUT_LOW | GPIOD_FLAGS_BIT_NONEXCLUSIVE);
if (IS_ERR(priv->speaker_en_gpio)) { if (IS_ERR(priv->speaker_en_gpio)) {
ret = PTR_ERR(priv->speaker_en_gpio); ret = dev_err_probe(dev, PTR_ERR(priv->speaker_en_gpio),
switch (ret) { "get speaker GPIO failed\n");
case -ENOENT:
priv->speaker_en_gpio = NULL;
break;
default:
dev_err(dev, "get speaker GPIO failed: %d\n", ret);
fallthrough;
case -EPROBE_DEFER:
goto err_put_codec; goto err_put_codec;
} }
}
snprintf(components_string, sizeof(components_string), snprintf(components_string, sizeof(components_string),
"cfg-spk:%s cfg-mic:%s", "cfg-spk:%s cfg-mic:%s",
...@@ -597,7 +584,7 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev) ...@@ -597,7 +584,7 @@ static int snd_byt_cht_es8316_mc_probe(struct platform_device *pdev)
byt_cht_es8316_card.long_name = long_name; byt_cht_es8316_card.long_name = long_name;
#endif #endif
sof_parent = snd_soc_acpi_sof_parent(&pdev->dev); sof_parent = snd_soc_acpi_sof_parent(dev);
/* set card and driver name */ /* set card and driver name */
if (sof_parent) { if (sof_parent) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment