Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Alexander Sverdlin and committed by
Mark Brown
a98a0bc6 338ee253

+3 -20
-1
include/sound/cs4271.h
··· 19 19 20 20 struct cs4271_platform_data { 21 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 24 #endif /* __CS4271_H */
+3 -19
sound/soc/codecs/cs4271.c
··· 441 441 struct cs4271_platform_data *cs4271plat = codec->dev->platform_data; 442 442 int ret; 443 443 int gpio_nreset = -EINVAL; 444 - int gpio_disable = -EINVAL; 445 444 446 445 codec->control_data = cs4271->control_data; 447 446 448 - if (cs4271plat) { 449 - if (gpio_is_valid(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); 447 + if (cs4271plat && gpio_is_valid(cs4271plat->gpio_nreset)) 448 + gpio_nreset = cs4271plat->gpio_nreset; 460 449 461 450 if (gpio_nreset >= 0) 462 451 if (gpio_request(gpio_nreset, "CS4271 Reset")) ··· 460 471 } 461 472 462 473 cs4271->gpio_nreset = gpio_nreset; 463 - cs4271->gpio_disable = gpio_disable; 464 474 465 475 /* 466 476 * In case of I2C, chip address specified in board data. ··· 497 509 static int cs4271_remove(struct snd_soc_codec *codec) 498 510 { 499 511 struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec); 500 - int gpio_nreset, gpio_disable; 512 + int gpio_nreset; 501 513 502 514 gpio_nreset = cs4271->gpio_nreset; 503 - gpio_disable = cs4271->gpio_disable; 504 515 505 516 if (gpio_is_valid(gpio_nreset)) { 506 517 /* Set codec to the reset state */ 507 518 gpio_set_value(gpio_nreset, 0); 508 519 gpio_free(gpio_nreset); 509 520 } 510 - 511 - if (gpio_is_valid(gpio_disable)) 512 - gpio_free(gpio_disable); 513 521 514 522 return 0; 515 523 };