Skip to content

Commit

Permalink
ASoC: CS4271: Move Chip Select control out of the CODEC code.
Browse files Browse the repository at this point in the history
Move Chip Select control out of the CODEC code for CS4271.

Signed-off-by: Alexander Sverdlin <[email protected]>
Reviewed-by: H Hartley Sweeten <[email protected]>
Acked-by: Liam Girdwood <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
  • Loading branch information
Alexander Sverdlin authored and broonie committed Feb 8, 2011
1 parent 338ee25 commit a98a0bc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 20 deletions.
1 change: 0 additions & 1 deletion include/sound/cs4271.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

struct cs4271_platform_data {
int gpio_nreset; /* GPIO driving Reset pin, if any */
int gpio_disable; /* GPIO that disable serial bus, if any */
};

#endif /* __CS4271_H */
22 changes: 3 additions & 19 deletions sound/soc/codecs/cs4271.c
Original file line number Diff line number Diff line change
Expand Up @@ -441,22 +441,11 @@ static int cs4271_probe(struct snd_soc_codec *codec)
struct cs4271_platform_data *cs4271plat = codec->dev->platform_data;
int ret;
int gpio_nreset = -EINVAL;
int gpio_disable = -EINVAL;

codec->control_data = cs4271->control_data;

if (cs4271plat) {
if (gpio_is_valid(cs4271plat->gpio_nreset))
gpio_nreset = cs4271plat->gpio_nreset;
if (gpio_is_valid(cs4271plat->gpio_disable))
gpio_disable = cs4271plat->gpio_disable;
}

if (gpio_disable >= 0)
if (gpio_request(gpio_disable, "CS4271 Disable"))
gpio_disable = -EINVAL;
if (gpio_disable >= 0)
gpio_direction_output(gpio_disable, 0);
if (cs4271plat && gpio_is_valid(cs4271plat->gpio_nreset))
gpio_nreset = cs4271plat->gpio_nreset;

if (gpio_nreset >= 0)
if (gpio_request(gpio_nreset, "CS4271 Reset"))
Expand All @@ -471,7 +460,6 @@ static int cs4271_probe(struct snd_soc_codec *codec)
}

cs4271->gpio_nreset = gpio_nreset;
cs4271->gpio_disable = gpio_disable;

/*
* In case of I2C, chip address specified in board data.
Expand Down Expand Up @@ -509,20 +497,16 @@ static int cs4271_probe(struct snd_soc_codec *codec)
static int cs4271_remove(struct snd_soc_codec *codec)
{
struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec);
int gpio_nreset, gpio_disable;
int gpio_nreset;

gpio_nreset = cs4271->gpio_nreset;
gpio_disable = cs4271->gpio_disable;

if (gpio_is_valid(gpio_nreset)) {
/* Set codec to the reset state */
gpio_set_value(gpio_nreset, 0);
gpio_free(gpio_nreset);
}

if (gpio_is_valid(gpio_disable))
gpio_free(gpio_disable);

return 0;
};

Expand Down

0 comments on commit a98a0bc

Please sign in to comment.