wm8737.c (65fdd9bffa1367b75de0c331a105ce36de618794) | wm8737.c (4f69bb31b8840713f82c6c476bae3f2356819ce2) |
---|---|
1/* 2 * wm8737.c -- WM8737 ALSA SoC Audio driver 3 * 4 * Copyright 2010 Wolfson Microelectronics plc 5 * 6 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com> 7 * 8 * This program is free software; you can redistribute it and/or modify --- 543 unchanged lines hidden (view full) --- 552#else 553#define wm8737_suspend NULL 554#define wm8737_resume NULL 555#endif 556 557static int wm8737_probe(struct snd_soc_codec *codec) 558{ 559 struct wm8737_priv *wm8737 = snd_soc_codec_get_drvdata(codec); | 1/* 2 * wm8737.c -- WM8737 ALSA SoC Audio driver 3 * 4 * Copyright 2010 Wolfson Microelectronics plc 5 * 6 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com> 7 * 8 * This program is free software; you can redistribute it and/or modify --- 543 unchanged lines hidden (view full) --- 552#else 553#define wm8737_suspend NULL 554#define wm8737_resume NULL 555#endif 556 557static int wm8737_probe(struct snd_soc_codec *codec) 558{ 559 struct wm8737_priv *wm8737 = snd_soc_codec_get_drvdata(codec); |
560 int ret, i; | 560 int ret; |
561 562 ret = snd_soc_codec_set_cache_io(codec, 7, 9, wm8737->control_type); 563 if (ret != 0) { 564 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret); 565 return ret; 566 } 567 | 561 562 ret = snd_soc_codec_set_cache_io(codec, 7, 9, wm8737->control_type); 563 if (ret != 0) { 564 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret); 565 return ret; 566 } 567 |
568 for (i = 0; i < ARRAY_SIZE(wm8737->supplies); i++) 569 wm8737->supplies[i].supply = wm8737_supply_names[i]; 570 571 ret = regulator_bulk_get(codec->dev, ARRAY_SIZE(wm8737->supplies), 572 wm8737->supplies); 573 if (ret != 0) { 574 dev_err(codec->dev, "Failed to request supplies: %d\n", ret); 575 return ret; 576 } 577 | |
578 ret = regulator_bulk_enable(ARRAY_SIZE(wm8737->supplies), 579 wm8737->supplies); 580 if (ret != 0) { 581 dev_err(codec->dev, "Failed to enable supplies: %d\n", ret); 582 goto err_get; 583 } 584 585 ret = wm8737_reset(codec); --- 16 unchanged lines hidden (view full) --- 602 ARRAY_SIZE(wm8737_snd_controls)); 603 wm8737_add_widgets(codec); 604 605 return 0; 606 607err_enable: 608 regulator_bulk_disable(ARRAY_SIZE(wm8737->supplies), wm8737->supplies); 609err_get: | 568 ret = regulator_bulk_enable(ARRAY_SIZE(wm8737->supplies), 569 wm8737->supplies); 570 if (ret != 0) { 571 dev_err(codec->dev, "Failed to enable supplies: %d\n", ret); 572 goto err_get; 573 } 574 575 ret = wm8737_reset(codec); --- 16 unchanged lines hidden (view full) --- 592 ARRAY_SIZE(wm8737_snd_controls)); 593 wm8737_add_widgets(codec); 594 595 return 0; 596 597err_enable: 598 regulator_bulk_disable(ARRAY_SIZE(wm8737->supplies), wm8737->supplies); 599err_get: |
610 regulator_bulk_free(ARRAY_SIZE(wm8737->supplies), wm8737->supplies); 611 | |
612 return ret; 613} 614 615static int wm8737_remove(struct snd_soc_codec *codec) 616{ | 600 return ret; 601} 602 603static int wm8737_remove(struct snd_soc_codec *codec) 604{ |
617 struct wm8737_priv *wm8737 = snd_soc_codec_get_drvdata(codec); 618 | |
619 wm8737_set_bias_level(codec, SND_SOC_BIAS_OFF); | 605 wm8737_set_bias_level(codec, SND_SOC_BIAS_OFF); |
620 regulator_bulk_free(ARRAY_SIZE(wm8737->supplies), wm8737->supplies); | |
621 return 0; 622} 623 624static struct snd_soc_codec_driver soc_codec_dev_wm8737 = { 625 .probe = wm8737_probe, 626 .remove = wm8737_remove, 627 .suspend = wm8737_suspend, 628 .resume = wm8737_resume, --- 11 unchanged lines hidden (view full) --- 640 641MODULE_DEVICE_TABLE(of, wm8737_of_match); 642 643#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) 644static __devinit int wm8737_i2c_probe(struct i2c_client *i2c, 645 const struct i2c_device_id *id) 646{ 647 struct wm8737_priv *wm8737; | 606 return 0; 607} 608 609static struct snd_soc_codec_driver soc_codec_dev_wm8737 = { 610 .probe = wm8737_probe, 611 .remove = wm8737_remove, 612 .suspend = wm8737_suspend, 613 .resume = wm8737_resume, --- 11 unchanged lines hidden (view full) --- 625 626MODULE_DEVICE_TABLE(of, wm8737_of_match); 627 628#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) 629static __devinit int wm8737_i2c_probe(struct i2c_client *i2c, 630 const struct i2c_device_id *id) 631{ 632 struct wm8737_priv *wm8737; |
648 int ret; | 633 int ret, i; |
649 650 wm8737 = devm_kzalloc(&i2c->dev, sizeof(struct wm8737_priv), 651 GFP_KERNEL); 652 if (wm8737 == NULL) 653 return -ENOMEM; 654 | 634 635 wm8737 = devm_kzalloc(&i2c->dev, sizeof(struct wm8737_priv), 636 GFP_KERNEL); 637 if (wm8737 == NULL) 638 return -ENOMEM; 639 |
640 for (i = 0; i < ARRAY_SIZE(wm8737->supplies); i++) 641 wm8737->supplies[i].supply = wm8737_supply_names[i]; 642 643 ret = devm_regulator_bulk_get(&i2c->dev, ARRAY_SIZE(wm8737->supplies), 644 wm8737->supplies); 645 if (ret != 0) { 646 dev_err(&i2c->dev, "Failed to request supplies: %d\n", ret); 647 return ret; 648 } 649 |
|
655 i2c_set_clientdata(i2c, wm8737); 656 wm8737->control_type = SND_SOC_I2C; 657 658 ret = snd_soc_register_codec(&i2c->dev, 659 &soc_codec_dev_wm8737, &wm8737_dai, 1); 660 661 return ret; 662 --- 23 unchanged lines hidden (view full) --- 686 .id_table = wm8737_i2c_id, 687}; 688#endif 689 690#if defined(CONFIG_SPI_MASTER) 691static int __devinit wm8737_spi_probe(struct spi_device *spi) 692{ 693 struct wm8737_priv *wm8737; | 650 i2c_set_clientdata(i2c, wm8737); 651 wm8737->control_type = SND_SOC_I2C; 652 653 ret = snd_soc_register_codec(&i2c->dev, 654 &soc_codec_dev_wm8737, &wm8737_dai, 1); 655 656 return ret; 657 --- 23 unchanged lines hidden (view full) --- 681 .id_table = wm8737_i2c_id, 682}; 683#endif 684 685#if defined(CONFIG_SPI_MASTER) 686static int __devinit wm8737_spi_probe(struct spi_device *spi) 687{ 688 struct wm8737_priv *wm8737; |
694 int ret; | 689 int ret, i; |
695 696 wm8737 = devm_kzalloc(&spi->dev, sizeof(struct wm8737_priv), 697 GFP_KERNEL); 698 if (wm8737 == NULL) 699 return -ENOMEM; 700 | 690 691 wm8737 = devm_kzalloc(&spi->dev, sizeof(struct wm8737_priv), 692 GFP_KERNEL); 693 if (wm8737 == NULL) 694 return -ENOMEM; 695 |
696 for (i = 0; i < ARRAY_SIZE(wm8737->supplies); i++) 697 wm8737->supplies[i].supply = wm8737_supply_names[i]; 698 699 ret = devm_regulator_bulk_get(&spi->dev, ARRAY_SIZE(wm8737->supplies), 700 wm8737->supplies); 701 if (ret != 0) { 702 dev_err(&spi->dev, "Failed to request supplies: %d\n", ret); 703 return ret; 704 } 705 |
|
701 wm8737->control_type = SND_SOC_SPI; 702 spi_set_drvdata(spi, wm8737); 703 704 ret = snd_soc_register_codec(&spi->dev, 705 &soc_codec_dev_wm8737, &wm8737_dai, 1); 706 707 return ret; 708} --- 54 unchanged lines hidden --- | 706 wm8737->control_type = SND_SOC_SPI; 707 spi_set_drvdata(spi, wm8737); 708 709 ret = snd_soc_register_codec(&spi->dev, 710 &soc_codec_dev_wm8737, &wm8737_dai, 1); 711 712 return ret; 713} --- 54 unchanged lines hidden --- |