Skip to content

Commit

Permalink
ASoC: max98357a: Make 'sdmode-gpios' dts property optional
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Anatol Pomozov authored and Mark Brown committed Jul 13, 2015
1 parent d770e55 commit 5119222
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 5 additions & 1 deletion Documentation/devicetree/bindings/sound/max98357a.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
5 changes: 4 additions & 1 deletion sound/soc/codecs/max98357a.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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));
Expand Down

0 comments on commit 5119222

Please sign in to comment.