aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/cs4271.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/codecs/cs4271.c')
-rw-r--r--sound/soc/codecs/cs4271.c46
1 files changed, 28 insertions, 18 deletions
diff --git a/sound/soc/codecs/cs4271.c b/sound/soc/codecs/cs4271.c
index f994af34f552..ac8742a1f25a 100644
--- a/sound/soc/codecs/cs4271.c
+++ b/sound/soc/codecs/cs4271.c
@@ -474,18 +474,28 @@ static int cs4271_probe(struct snd_soc_codec *codec)
474 struct cs4271_platform_data *cs4271plat = codec->dev->platform_data; 474 struct cs4271_platform_data *cs4271plat = codec->dev->platform_data;
475 int ret; 475 int ret;
476 int gpio_nreset = -EINVAL; 476 int gpio_nreset = -EINVAL;
477 bool amutec_eq_bmutec = false;
477 478
478#ifdef CONFIG_OF 479#ifdef CONFIG_OF
479 if (of_match_device(cs4271_dt_ids, codec->dev)) 480 if (of_match_device(cs4271_dt_ids, codec->dev)) {
480 gpio_nreset = of_get_named_gpio(codec->dev->of_node, 481 gpio_nreset = of_get_named_gpio(codec->dev->of_node,
481 "reset-gpio", 0); 482 "reset-gpio", 0);
483
484 if (of_get_property(codec->dev->of_node,
485 "cirrus,amutec-eq-bmutec", NULL))
486 amutec_eq_bmutec = true;
487 }
482#endif 488#endif
483 489
484 if (cs4271plat && gpio_is_valid(cs4271plat->gpio_nreset)) 490 if (cs4271plat) {
485 gpio_nreset = cs4271plat->gpio_nreset; 491 if (gpio_is_valid(cs4271plat->gpio_nreset))
492 gpio_nreset = cs4271plat->gpio_nreset;
493
494 amutec_eq_bmutec = cs4271plat->amutec_eq_bmutec;
495 }
486 496
487 if (gpio_nreset >= 0) 497 if (gpio_nreset >= 0)
488 if (gpio_request(gpio_nreset, "CS4271 Reset")) 498 if (devm_gpio_request(codec->dev, gpio_nreset, "CS4271 Reset"))
489 gpio_nreset = -EINVAL; 499 gpio_nreset = -EINVAL;
490 if (gpio_nreset >= 0) { 500 if (gpio_nreset >= 0) {
491 /* Reset codec */ 501 /* Reset codec */
@@ -528,6 +538,11 @@ static int cs4271_probe(struct snd_soc_codec *codec)
528 /* Power-up sequence requires 85 uS */ 538 /* Power-up sequence requires 85 uS */
529 udelay(85); 539 udelay(85);
530 540
541 if (amutec_eq_bmutec)
542 snd_soc_update_bits(codec, CS4271_MODE2,
543 CS4271_MODE2_MUTECAEQUB,
544 CS4271_MODE2_MUTECAEQUB);
545
531 return snd_soc_add_codec_controls(codec, cs4271_snd_controls, 546 return snd_soc_add_codec_controls(codec, cs4271_snd_controls,
532 ARRAY_SIZE(cs4271_snd_controls)); 547 ARRAY_SIZE(cs4271_snd_controls));
533} 548}
@@ -535,15 +550,10 @@ static int cs4271_probe(struct snd_soc_codec *codec)
535static int cs4271_remove(struct snd_soc_codec *codec) 550static int cs4271_remove(struct snd_soc_codec *codec)
536{ 551{
537 struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec); 552 struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec);
538 int gpio_nreset;
539
540 gpio_nreset = cs4271->gpio_nreset;
541 553
542 if (gpio_is_valid(gpio_nreset)) { 554 if (gpio_is_valid(cs4271->gpio_nreset))
543 /* Set codec to the reset state */ 555 /* Set codec to the reset state */
544 gpio_set_value(gpio_nreset, 0); 556 gpio_set_value(cs4271->gpio_nreset, 0);
545 gpio_free(gpio_nreset);
546 }
547 557
548 return 0; 558 return 0;
549}; 559};
@@ -560,7 +570,7 @@ static struct snd_soc_codec_driver soc_codec_dev_cs4271 = {
560}; 570};
561 571
562#if defined(CONFIG_SPI_MASTER) 572#if defined(CONFIG_SPI_MASTER)
563static int __devinit cs4271_spi_probe(struct spi_device *spi) 573static int cs4271_spi_probe(struct spi_device *spi)
564{ 574{
565 struct cs4271_private *cs4271; 575 struct cs4271_private *cs4271;
566 576
@@ -575,7 +585,7 @@ static int __devinit cs4271_spi_probe(struct spi_device *spi)
575 &cs4271_dai, 1); 585 &cs4271_dai, 1);
576} 586}
577 587
578static int __devexit cs4271_spi_remove(struct spi_device *spi) 588static int cs4271_spi_remove(struct spi_device *spi)
579{ 589{
580 snd_soc_unregister_codec(&spi->dev); 590 snd_soc_unregister_codec(&spi->dev);
581 return 0; 591 return 0;
@@ -588,7 +598,7 @@ static struct spi_driver cs4271_spi_driver = {
588 .of_match_table = of_match_ptr(cs4271_dt_ids), 598 .of_match_table = of_match_ptr(cs4271_dt_ids),
589 }, 599 },
590 .probe = cs4271_spi_probe, 600 .probe = cs4271_spi_probe,
591 .remove = __devexit_p(cs4271_spi_remove), 601 .remove = cs4271_spi_remove,
592}; 602};
593#endif /* defined(CONFIG_SPI_MASTER) */ 603#endif /* defined(CONFIG_SPI_MASTER) */
594 604
@@ -599,8 +609,8 @@ static const struct i2c_device_id cs4271_i2c_id[] = {
599}; 609};
600MODULE_DEVICE_TABLE(i2c, cs4271_i2c_id); 610MODULE_DEVICE_TABLE(i2c, cs4271_i2c_id);
601 611
602static int __devinit cs4271_i2c_probe(struct i2c_client *client, 612static int cs4271_i2c_probe(struct i2c_client *client,
603 const struct i2c_device_id *id) 613 const struct i2c_device_id *id)
604{ 614{
605 struct cs4271_private *cs4271; 615 struct cs4271_private *cs4271;
606 616
@@ -615,7 +625,7 @@ static int __devinit cs4271_i2c_probe(struct i2c_client *client,
615 &cs4271_dai, 1); 625 &cs4271_dai, 1);
616} 626}
617 627
618static int __devexit cs4271_i2c_remove(struct i2c_client *client) 628static int cs4271_i2c_remove(struct i2c_client *client)
619{ 629{
620 snd_soc_unregister_codec(&client->dev); 630 snd_soc_unregister_codec(&client->dev);
621 return 0; 631 return 0;
@@ -629,7 +639,7 @@ static struct i2c_driver cs4271_i2c_driver = {
629 }, 639 },
630 .id_table = cs4271_i2c_id, 640 .id_table = cs4271_i2c_id,
631 .probe = cs4271_i2c_probe, 641 .probe = cs4271_i2c_probe,
632 .remove = __devexit_p(cs4271_i2c_remove), 642 .remove = cs4271_i2c_remove,
633}; 643};
634#endif /* defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) */ 644#endif /* defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) */
635 645