diff options
author | Alexander Sverdlin <subaparts@yandex.ru> | 2011-02-02 19:11:45 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-02-08 06:26:14 -0500 |
commit | a98a0bc6c92eacd181417a9c0ccd2e8028066622 (patch) | |
tree | 188923b6709275cce94a4a2c70f1081e94e2f8a9 | |
parent | 338ee25393a5627e8ded5819147f98b919656ce9 (diff) |
ASoC: CS4271: Move Chip Select control out of the CODEC code.
Move Chip Select control out of the CODEC code for CS4271.
Signed-off-by: Alexander Sverdlin <subaparts@yandex.ru>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r-- | include/sound/cs4271.h | 1 | ||||
-rw-r--r-- | sound/soc/codecs/cs4271.c | 22 |
2 files changed, 3 insertions, 20 deletions
diff --git a/include/sound/cs4271.h b/include/sound/cs4271.h index 16f8d325d3dc..50a059e7d116 100644 --- a/include/sound/cs4271.h +++ b/include/sound/cs4271.h | |||
@@ -19,7 +19,6 @@ | |||
19 | 19 | ||
20 | struct cs4271_platform_data { | 20 | struct cs4271_platform_data { |
21 | int gpio_nreset; /* GPIO driving Reset pin, if any */ | 21 | int gpio_nreset; /* GPIO driving Reset pin, if any */ |
22 | int gpio_disable; /* GPIO that disable serial bus, if any */ | ||
23 | }; | 22 | }; |
24 | 23 | ||
25 | #endif /* __CS4271_H */ | 24 | #endif /* __CS4271_H */ |
diff --git a/sound/soc/codecs/cs4271.c b/sound/soc/codecs/cs4271.c index 9c5b7db0ce6a..1791796216c8 100644 --- a/sound/soc/codecs/cs4271.c +++ b/sound/soc/codecs/cs4271.c | |||
@@ -441,22 +441,11 @@ static int cs4271_probe(struct snd_soc_codec *codec) | |||
441 | struct cs4271_platform_data *cs4271plat = codec->dev->platform_data; | 441 | struct cs4271_platform_data *cs4271plat = codec->dev->platform_data; |
442 | int ret; | 442 | int ret; |
443 | int gpio_nreset = -EINVAL; | 443 | int gpio_nreset = -EINVAL; |
444 | int gpio_disable = -EINVAL; | ||
445 | 444 | ||
446 | codec->control_data = cs4271->control_data; | 445 | codec->control_data = cs4271->control_data; |
447 | 446 | ||
448 | if (cs4271plat) { | 447 | if (cs4271plat && gpio_is_valid(cs4271plat->gpio_nreset)) |
449 | if (gpio_is_valid(cs4271plat->gpio_nreset)) | 448 | gpio_nreset = cs4271plat->gpio_nreset; |
450 | gpio_nreset = cs4271plat->gpio_nreset; | ||
451 | if (gpio_is_valid(cs4271plat->gpio_disable)) | ||
452 | gpio_disable = cs4271plat->gpio_disable; | ||
453 | } | ||
454 | |||
455 | if (gpio_disable >= 0) | ||
456 | if (gpio_request(gpio_disable, "CS4271 Disable")) | ||
457 | gpio_disable = -EINVAL; | ||
458 | if (gpio_disable >= 0) | ||
459 | gpio_direction_output(gpio_disable, 0); | ||
460 | 449 | ||
461 | if (gpio_nreset >= 0) | 450 | if (gpio_nreset >= 0) |
462 | if (gpio_request(gpio_nreset, "CS4271 Reset")) | 451 | if (gpio_request(gpio_nreset, "CS4271 Reset")) |
@@ -471,7 +460,6 @@ static int cs4271_probe(struct snd_soc_codec *codec) | |||
471 | } | 460 | } |
472 | 461 | ||
473 | cs4271->gpio_nreset = gpio_nreset; | 462 | cs4271->gpio_nreset = gpio_nreset; |
474 | cs4271->gpio_disable = gpio_disable; | ||
475 | 463 | ||
476 | /* | 464 | /* |
477 | * In case of I2C, chip address specified in board data. | 465 | * In case of I2C, chip address specified in board data. |
@@ -509,10 +497,9 @@ static int cs4271_probe(struct snd_soc_codec *codec) | |||
509 | static int cs4271_remove(struct snd_soc_codec *codec) | 497 | static int cs4271_remove(struct snd_soc_codec *codec) |
510 | { | 498 | { |
511 | struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec); | 499 | struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec); |
512 | int gpio_nreset, gpio_disable; | 500 | int gpio_nreset; |
513 | 501 | ||
514 | gpio_nreset = cs4271->gpio_nreset; | 502 | gpio_nreset = cs4271->gpio_nreset; |
515 | gpio_disable = cs4271->gpio_disable; | ||
516 | 503 | ||
517 | if (gpio_is_valid(gpio_nreset)) { | 504 | if (gpio_is_valid(gpio_nreset)) { |
518 | /* Set codec to the reset state */ | 505 | /* Set codec to the reset state */ |
@@ -520,9 +507,6 @@ static int cs4271_remove(struct snd_soc_codec *codec) | |||
520 | gpio_free(gpio_nreset); | 507 | gpio_free(gpio_nreset); |
521 | } | 508 | } |
522 | 509 | ||
523 | if (gpio_is_valid(gpio_disable)) | ||
524 | gpio_free(gpio_disable); | ||
525 | |||
526 | return 0; | 510 | return 0; |
527 | }; | 511 | }; |
528 | 512 | ||