[alsa-devel] [PATCH 1/3] ASoC: max98357a: Make 'sdmode-gpios' dts property optional
The option is not needed if chip is always on or managed by some other part of system like platform card driver.
Signed-off-by: Anatol Pomozov anatol.pomozov@gmail.com --- Documentation/devicetree/bindings/sound/max98357a.txt | 6 +++++- sound/soc/codecs/max98357a.c | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/Documentation/devicetree/bindings/sound/max98357a.txt b/Documentation/devicetree/bindings/sound/max98357a.txt index a7a149a..28645a2 100644 --- a/Documentation/devicetree/bindings/sound/max98357a.txt +++ b/Documentation/devicetree/bindings/sound/max98357a.txt @@ -4,7 +4,11 @@ This node models the Maxim MAX98357A DAC.
Required properties: - compatible : "maxim,max98357a" -- sdmode-gpios : GPIO specifier for the GPIO -> DAC SDMODE pin + +Optional properties: +- sdmode-gpios : GPIO specifier for the chip's SD_MODE pin. + If this option is not specified then driver does not manage + the pin state (e.g. chip is always on).
Example:
diff --git a/sound/soc/codecs/max98357a.c b/sound/soc/codecs/max98357a.c index 3a2fda0..fa1b793 100644 --- a/sound/soc/codecs/max98357a.c +++ b/sound/soc/codecs/max98357a.c @@ -31,6 +31,9 @@ static int max98357a_daiops_trigger(struct snd_pcm_substream *substream, { struct gpio_desc *sdmode = snd_soc_dai_get_drvdata(dai);
+ if (!sdmode) + return 0; + switch (cmd) { case SNDRV_PCM_TRIGGER_START: case SNDRV_PCM_TRIGGER_RESUME: @@ -60,7 +63,7 @@ static int max98357a_codec_probe(struct snd_soc_codec *codec) { struct gpio_desc *sdmode;
- sdmode = devm_gpiod_get(codec->dev, "sdmode", GPIOD_OUT_LOW); + sdmode = devm_gpiod_get_optional(codec->dev, "sdmode", GPIOD_OUT_LOW); if (IS_ERR(sdmode)) { dev_err(codec->dev, "%s() unable to get sdmode GPIO: %ld\n", __func__, PTR_ERR(sdmode));
Spec does not say anything about DAC called SDMode. It makes more sense to use DAI input that created automatically by DAPM and route it to Speaker output.
Signed-off-by: Anatol Pomozov anatol.pomozov@gmail.com --- sound/soc/codecs/max98357a.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/sound/soc/codecs/max98357a.c b/sound/soc/codecs/max98357a.c index fa1b793..b9e1131 100644 --- a/sound/soc/codecs/max98357a.c +++ b/sound/soc/codecs/max98357a.c @@ -51,12 +51,11 @@ static int max98357a_daiops_trigger(struct snd_pcm_substream *substream, }
static const struct snd_soc_dapm_widget max98357a_dapm_widgets[] = { - SND_SOC_DAPM_DAC("SDMode", NULL, SND_SOC_NOPM, 0, 0), SND_SOC_DAPM_OUTPUT("Speaker"), };
static const struct snd_soc_dapm_route max98357a_dapm_routes[] = { - {"Speaker", NULL, "SDMode"}, + {"Speaker", NULL, "HiFi Playback"}, };
static int max98357a_codec_probe(struct snd_soc_codec *codec)
The patch
ASoC: max98357a: Use DAI input as a dapm widget
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
From 508e61953f7b2c5c828412e5b46fa99b8a3fbaa1 Mon Sep 17 00:00:00 2001
From: Anatol Pomozov anatol.pomozov@gmail.com Date: Sun, 12 Jul 2015 08:14:20 -0700 Subject: [PATCH] ASoC: max98357a: Use DAI input as a dapm widget
Spec does not say anything about DAC called SDMode. It makes more sense to use DAI input that created automatically by DAPM and route it to Speaker output.
Signed-off-by: Anatol Pomozov anatol.pomozov@gmail.com Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/codecs/max98357a.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/sound/soc/codecs/max98357a.c b/sound/soc/codecs/max98357a.c index fa1b79302bb3..b9e1131bab74 100644 --- a/sound/soc/codecs/max98357a.c +++ b/sound/soc/codecs/max98357a.c @@ -51,12 +51,11 @@ static int max98357a_daiops_trigger(struct snd_pcm_substream *substream, }
static const struct snd_soc_dapm_widget max98357a_dapm_widgets[] = { - SND_SOC_DAPM_DAC("SDMode", NULL, SND_SOC_NOPM, 0, 0), SND_SOC_DAPM_OUTPUT("Speaker"), };
static const struct snd_soc_dapm_route max98357a_dapm_routes[] = { - {"Speaker", NULL, "SDMode"}, + {"Speaker", NULL, "HiFi Playback"}, };
static int max98357a_codec_probe(struct snd_soc_codec *codec)
gpiolib/asoc system already prints enough info if there are any problems.
Signed-off-by: Anatol Pomozov anatol.pomozov@gmail.com --- sound/soc/codecs/max98357a.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-)
diff --git a/sound/soc/codecs/max98357a.c b/sound/soc/codecs/max98357a.c index b9e1131..e88119a 100644 --- a/sound/soc/codecs/max98357a.c +++ b/sound/soc/codecs/max98357a.c @@ -63,11 +63,9 @@ static int max98357a_codec_probe(struct snd_soc_codec *codec) struct gpio_desc *sdmode;
sdmode = devm_gpiod_get_optional(codec->dev, "sdmode", GPIOD_OUT_LOW); - if (IS_ERR(sdmode)) { - dev_err(codec->dev, "%s() unable to get sdmode GPIO: %ld\n", - __func__, PTR_ERR(sdmode)); + if (IS_ERR(sdmode)) return PTR_ERR(sdmode); - } + snd_soc_codec_set_drvdata(codec, sdmode);
return 0; @@ -106,15 +104,8 @@ static struct snd_soc_dai_driver max98357a_dai_driver = {
static int max98357a_platform_probe(struct platform_device *pdev) { - int ret; - - ret = snd_soc_register_codec(&pdev->dev, &max98357a_codec_driver, + return snd_soc_register_codec(&pdev->dev, &max98357a_codec_driver, &max98357a_dai_driver, 1); - if (ret) - dev_err(&pdev->dev, "%s() error registering codec driver: %d\n", - __func__, ret); - - return ret; }
static int max98357a_platform_remove(struct platform_device *pdev)
The patch
ASoC: max98357a: Do not print error message on asoc/gpio errors
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
From 4ab0c591c1482c90d14c1d11bf4b469c54a31ecc Mon Sep 17 00:00:00 2001
From: Anatol Pomozov anatol.pomozov@gmail.com Date: Sun, 12 Jul 2015 08:14:21 -0700 Subject: [PATCH] ASoC: max98357a: Do not print error message on asoc/gpio errors
gpiolib/asoc system already prints enough info if there are any problems.
Signed-off-by: Anatol Pomozov anatol.pomozov@gmail.com Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/codecs/max98357a.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-)
diff --git a/sound/soc/codecs/max98357a.c b/sound/soc/codecs/max98357a.c index b9e1131bab74..e88119a71b84 100644 --- a/sound/soc/codecs/max98357a.c +++ b/sound/soc/codecs/max98357a.c @@ -63,11 +63,9 @@ static int max98357a_codec_probe(struct snd_soc_codec *codec) struct gpio_desc *sdmode;
sdmode = devm_gpiod_get_optional(codec->dev, "sdmode", GPIOD_OUT_LOW); - if (IS_ERR(sdmode)) { - dev_err(codec->dev, "%s() unable to get sdmode GPIO: %ld\n", - __func__, PTR_ERR(sdmode)); + if (IS_ERR(sdmode)) return PTR_ERR(sdmode); - } + snd_soc_codec_set_drvdata(codec, sdmode);
return 0; @@ -106,15 +104,8 @@ static struct snd_soc_dai_driver max98357a_dai_driver = {
static int max98357a_platform_probe(struct platform_device *pdev) { - int ret; - - ret = snd_soc_register_codec(&pdev->dev, &max98357a_codec_driver, + return snd_soc_register_codec(&pdev->dev, &max98357a_codec_driver, &max98357a_dai_driver, 1); - if (ret) - dev_err(&pdev->dev, "%s() error registering codec driver: %d\n", - __func__, ret); - - return ret; }
static int max98357a_platform_remove(struct platform_device *pdev)
The patch
ASoC: max98357a: Make 'sdmode-gpios' dts property optional
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
From 5119222f2e3de2e51a3b3270036d53c55ce68236 Mon Sep 17 00:00:00 2001
From: Anatol Pomozov anatol.pomozov@gmail.com Date: Sun, 12 Jul 2015 08:14:19 -0700 Subject: [PATCH] ASoC: max98357a: Make 'sdmode-gpios' dts property optional
The option is not needed if chip is always on or managed by some other part of system like platform card driver.
Signed-off-by: Anatol Pomozov anatol.pomozov@gmail.com Signed-off-by: Mark Brown broonie@kernel.org --- Documentation/devicetree/bindings/sound/max98357a.txt | 6 +++++- sound/soc/codecs/max98357a.c | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/Documentation/devicetree/bindings/sound/max98357a.txt b/Documentation/devicetree/bindings/sound/max98357a.txt index a7a149a236e5..28645a2ff885 100644 --- a/Documentation/devicetree/bindings/sound/max98357a.txt +++ b/Documentation/devicetree/bindings/sound/max98357a.txt @@ -4,7 +4,11 @@ This node models the Maxim MAX98357A DAC.
Required properties: - compatible : "maxim,max98357a" -- sdmode-gpios : GPIO specifier for the GPIO -> DAC SDMODE pin + +Optional properties: +- sdmode-gpios : GPIO specifier for the chip's SD_MODE pin. + If this option is not specified then driver does not manage + the pin state (e.g. chip is always on).
Example:
diff --git a/sound/soc/codecs/max98357a.c b/sound/soc/codecs/max98357a.c index 3a2fda08a893..fa1b79302bb3 100644 --- a/sound/soc/codecs/max98357a.c +++ b/sound/soc/codecs/max98357a.c @@ -31,6 +31,9 @@ static int max98357a_daiops_trigger(struct snd_pcm_substream *substream, { struct gpio_desc *sdmode = snd_soc_dai_get_drvdata(dai);
+ if (!sdmode) + return 0; + switch (cmd) { case SNDRV_PCM_TRIGGER_START: case SNDRV_PCM_TRIGGER_RESUME: @@ -60,7 +63,7 @@ static int max98357a_codec_probe(struct snd_soc_codec *codec) { struct gpio_desc *sdmode;
- sdmode = devm_gpiod_get(codec->dev, "sdmode", GPIOD_OUT_LOW); + sdmode = devm_gpiod_get_optional(codec->dev, "sdmode", GPIOD_OUT_LOW); if (IS_ERR(sdmode)) { dev_err(codec->dev, "%s() unable to get sdmode GPIO: %ld\n", __func__, PTR_ERR(sdmode));
On Sun, Jul 12, 2015 at 08:14:19AM -0700, Anatol Pomozov wrote:
The option is not needed if chip is always on or managed by some other part of system like platform card driver.
Signed-off-by: Anatol Pomozov anatol.pomozov@gmail.com
For all three patches:
Confirmed audio functionality on Storm board (ipq806x).
Tested-by: Kenneth Westfield kwestfie@codeaurora.org
participants (3)
-
Anatol Pomozov
-
Kenneth Westfield
-
Mark Brown