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

Merge remote-tracking branches 'asoc/topic/tlv320aic23', 'asoc/topic/tlv320aic26', 'asoc/topic/tlv320aic32x4', 'asoc/topic/tlv320aic3x', 'asoc/topic/tlv320dac33', 'asoc/topic/twl4030', 'asoc/topic/twl6040', 'asoc/topic/uda1380', 'asoc/topic/wl1273' and 'asoc/topic/wm2200' into asoc-next

+339 -153
+30
Documentation/devicetree/bindings/sound/tlv320aic32x4.txt
··· 1 + Texas Instruments - tlv320aic32x4 Codec module 2 + 3 + The tlv320aic32x4 serial control bus communicates through I2C protocols 4 + 5 + Required properties: 6 + - compatible: Should be "ti,tlv320aic32x4" 7 + - reg: I2C slave address 8 + - supply-*: Required supply regulators are: 9 + "iov" - digital IO power supply 10 + "ldoin" - LDO power supply 11 + "dv" - Digital core power supply 12 + "av" - Analog core power supply 13 + If you supply ldoin, dv and av are optional. Otherwise they are required 14 + See regulator/regulator.txt for more information about the detailed binding 15 + format. 16 + 17 + Optional properties: 18 + - reset-gpios: Reset-GPIO phandle with args as described in gpio/gpio.txt 19 + - clocks/clock-names: Clock named 'mclk' for the master clock of the codec. 20 + See clock/clock-bindings.txt for information about the detailed format. 21 + 22 + 23 + Example: 24 + 25 + codec: tlv320aic32x4@18 { 26 + compatible = "ti,tlv320aic32x4"; 27 + reg = <0x18>; 28 + clocks = <&clks 201>; 29 + clock-names = "mclk"; 30 + };
-1
Documentation/devicetree/bindings/sound/tlv320aic3x.txt
··· 6 6 7 7 - compatible - "string" - One of: 8 8 "ti,tlv320aic3x" - Generic TLV320AIC3x device 9 - "ti,tlv320aic32x4" - TLV320AIC32x4 10 9 "ti,tlv320aic33" - TLV320AIC33 11 10 "ti,tlv320aic3007" - TLV320AIC3007 12 11 "ti,tlv320aic3106" - TLV320AIC3106
+2 -2
sound/soc/codecs/Makefile
··· 79 79 snd-soc-tlv320aic23-i2c-objs := tlv320aic23-i2c.o 80 80 snd-soc-tlv320aic23-spi-objs := tlv320aic23-spi.o 81 81 snd-soc-tlv320aic26-objs := tlv320aic26.o 82 - snd-soc-tlv320aic3x-objs := tlv320aic3x.o 83 82 snd-soc-tlv320aic32x4-objs := tlv320aic32x4.o 83 + snd-soc-tlv320aic3x-objs := tlv320aic3x.o 84 84 snd-soc-tlv320dac33-objs := tlv320dac33.o 85 85 snd-soc-twl4030-objs := twl4030.o 86 86 snd-soc-twl6040-objs := twl6040.o ··· 223 223 obj-$(CONFIG_SND_SOC_TLV320AIC23_I2C) += snd-soc-tlv320aic23-i2c.o 224 224 obj-$(CONFIG_SND_SOC_TLV320AIC23_SPI) += snd-soc-tlv320aic23-spi.o 225 225 obj-$(CONFIG_SND_SOC_TLV320AIC26) += snd-soc-tlv320aic26.o 226 - obj-$(CONFIG_SND_SOC_TLV320AIC3X) += snd-soc-tlv320aic3x.o 227 226 obj-$(CONFIG_SND_SOC_TLV320AIC32X4) += snd-soc-tlv320aic32x4.o 227 + obj-$(CONFIG_SND_SOC_TLV320AIC3X) += snd-soc-tlv320aic3x.o 228 228 obj-$(CONFIG_SND_SOC_TLV320DAC33) += snd-soc-tlv320dac33.o 229 229 obj-$(CONFIG_SND_SOC_TWL4030) += snd-soc-twl4030.o 230 230 obj-$(CONFIG_SND_SOC_TWL6040) += snd-soc-twl6040.o
+7 -8
sound/soc/codecs/cs42l51.c
··· 117 117 "R L", 118 118 }; 119 119 120 - static const struct soc_enum cs42l51_chan_mix = 121 - SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(chan_mix), chan_mix); 120 + static SOC_ENUM_SINGLE_EXT_DECL(cs42l51_chan_mix, chan_mix); 122 121 123 122 static const struct snd_kcontrol_new cs42l51_snd_controls[] = { 124 123 SOC_DOUBLE_R_SX_TLV("PCM Playback Volume", ··· 173 174 174 175 static const char *cs42l51_dac_names[] = {"Direct PCM", 175 176 "DSP PCM", "ADC"}; 176 - static const struct soc_enum cs42l51_dac_mux_enum = 177 - SOC_ENUM_SINGLE(CS42L51_DAC_CTL, 6, 3, cs42l51_dac_names); 177 + static SOC_ENUM_SINGLE_DECL(cs42l51_dac_mux_enum, 178 + CS42L51_DAC_CTL, 6, cs42l51_dac_names); 178 179 static const struct snd_kcontrol_new cs42l51_dac_mux_controls = 179 180 SOC_DAPM_ENUM("Route", cs42l51_dac_mux_enum); 180 181 181 182 static const char *cs42l51_adcl_names[] = {"AIN1 Left", "AIN2 Left", 182 183 "MIC Left", "MIC+preamp Left"}; 183 - static const struct soc_enum cs42l51_adcl_mux_enum = 184 - SOC_ENUM_SINGLE(CS42L51_ADC_INPUT, 4, 4, cs42l51_adcl_names); 184 + static SOC_ENUM_SINGLE_DECL(cs42l51_adcl_mux_enum, 185 + CS42L51_ADC_INPUT, 4, cs42l51_adcl_names); 185 186 static const struct snd_kcontrol_new cs42l51_adcl_mux_controls = 186 187 SOC_DAPM_ENUM("Route", cs42l51_adcl_mux_enum); 187 188 188 189 static const char *cs42l51_adcr_names[] = {"AIN1 Right", "AIN2 Right", 189 190 "MIC Right", "MIC+preamp Right"}; 190 - static const struct soc_enum cs42l51_adcr_mux_enum = 191 - SOC_ENUM_SINGLE(CS42L51_ADC_INPUT, 6, 4, cs42l51_adcr_names); 191 + static SOC_ENUM_SINGLE_DECL(cs42l51_adcr_mux_enum, 192 + CS42L51_ADC_INPUT, 6, cs42l51_adcr_names); 192 193 static const struct snd_kcontrol_new cs42l51_adcr_mux_controls = 193 194 SOC_DAPM_ENUM("Route", cs42l51_adcr_mux_enum); 194 195
-1
sound/soc/codecs/tlv320aic23-spi.c
··· 25 25 26 26 dev_dbg(&spi->dev, "probing tlv320aic23 spi device\n"); 27 27 28 - spi->bits_per_word = 16; 29 28 spi->mode = SPI_MODE_0; 30 29 ret = spi_setup(spi); 31 30 if (ret < 0)
+2
sound/soc/codecs/tlv320aic23.c
··· 59 59 .num_reg_defaults = ARRAY_SIZE(tlv320aic23_reg), 60 60 .cache_type = REGCACHE_RBTREE, 61 61 }; 62 + EXPORT_SYMBOL(tlv320aic23_regmap); 62 63 63 64 static const char *rec_src_text[] = { "Line", "Mic" }; 64 65 static const char *deemph_text[] = {"None", "32Khz", "44.1Khz", "48Khz"}; ··· 635 634 return snd_soc_register_codec(dev, &soc_codec_dev_tlv320aic23, 636 635 &tlv320aic23_dai, 1); 637 636 } 637 + EXPORT_SYMBOL(tlv320aic23_probe); 638 638 639 639 MODULE_DESCRIPTION("ASoC TLV320AIC23 codec driver"); 640 640 MODULE_AUTHOR("Arun KS <arunks@mistralsolutions.com>");
+3 -2
sound/soc/codecs/tlv320aic26.c
··· 238 238 * ALSA controls 239 239 */ 240 240 static const char *aic26_capture_src_text[] = {"Mic", "Aux"}; 241 - static const struct soc_enum aic26_capture_src_enum = 242 - SOC_ENUM_SINGLE(AIC26_REG_AUDIO_CTRL1, 12, 2, aic26_capture_src_text); 241 + static SOC_ENUM_SINGLE_DECL(aic26_capture_src_enum, 242 + AIC26_REG_AUDIO_CTRL1, 12, 243 + aic26_capture_src_text); 243 244 244 245 static const struct snd_kcontrol_new aic26_snd_controls[] = { 245 246 /* Output */
+207 -31
sound/soc/codecs/tlv320aic32x4.c
··· 29 29 #include <linux/delay.h> 30 30 #include <linux/pm.h> 31 31 #include <linux/gpio.h> 32 + #include <linux/of_gpio.h> 32 33 #include <linux/i2c.h> 33 34 #include <linux/cdev.h> 34 35 #include <linux/slab.h> 36 + #include <linux/clk.h> 37 + #include <linux/regulator/consumer.h> 35 38 36 39 #include <sound/tlv320aic32x4.h> 37 40 #include <sound/core.h> ··· 69 66 u32 micpga_routing; 70 67 bool swapdacs; 71 68 int rstn_gpio; 69 + struct clk *mclk; 70 + 71 + struct regulator *supply_ldo; 72 + struct regulator *supply_iov; 73 + struct regulator *supply_dv; 74 + struct regulator *supply_av; 72 75 }; 73 76 74 - /* 0dB min, 1dB steps */ 75 - static DECLARE_TLV_DB_SCALE(tlv_step_1, 0, 100, 0); 76 77 /* 0dB min, 0.5dB steps */ 77 78 static DECLARE_TLV_DB_SCALE(tlv_step_0_5, 0, 50, 0); 79 + /* -63.5dB min, 0.5dB steps */ 80 + static DECLARE_TLV_DB_SCALE(tlv_pcm, -6350, 50, 0); 81 + /* -6dB min, 1dB steps */ 82 + static DECLARE_TLV_DB_SCALE(tlv_driver_gain, -600, 100, 0); 83 + /* -12dB min, 0.5dB steps */ 84 + static DECLARE_TLV_DB_SCALE(tlv_adc_vol, -1200, 50, 0); 78 85 79 86 static const struct snd_kcontrol_new aic32x4_snd_controls[] = { 80 - SOC_DOUBLE_R_TLV("PCM Playback Volume", AIC32X4_LDACVOL, 81 - AIC32X4_RDACVOL, 0, 0x30, 0, tlv_step_0_5), 82 - SOC_DOUBLE_R_TLV("HP Driver Gain Volume", AIC32X4_HPLGAIN, 83 - AIC32X4_HPRGAIN, 0, 0x1D, 0, tlv_step_1), 84 - SOC_DOUBLE_R_TLV("LO Driver Gain Volume", AIC32X4_LOLGAIN, 85 - AIC32X4_LORGAIN, 0, 0x1D, 0, tlv_step_1), 87 + SOC_DOUBLE_R_S_TLV("PCM Playback Volume", AIC32X4_LDACVOL, 88 + AIC32X4_RDACVOL, 0, -0x7f, 0x30, 7, 0, tlv_pcm), 89 + SOC_DOUBLE_R_S_TLV("HP Driver Gain Volume", AIC32X4_HPLGAIN, 90 + AIC32X4_HPRGAIN, 0, -0x6, 0x1d, 5, 0, 91 + tlv_driver_gain), 92 + SOC_DOUBLE_R_S_TLV("LO Driver Gain Volume", AIC32X4_LOLGAIN, 93 + AIC32X4_LORGAIN, 0, -0x6, 0x1d, 5, 0, 94 + tlv_driver_gain), 86 95 SOC_DOUBLE_R("HP DAC Playback Switch", AIC32X4_HPLGAIN, 87 96 AIC32X4_HPRGAIN, 6, 0x01, 1), 88 97 SOC_DOUBLE_R("LO DAC Playback Switch", AIC32X4_LOLGAIN, ··· 105 90 SOC_SINGLE("ADCFGA Left Mute Switch", AIC32X4_ADCFGA, 7, 1, 0), 106 91 SOC_SINGLE("ADCFGA Right Mute Switch", AIC32X4_ADCFGA, 3, 1, 0), 107 92 108 - SOC_DOUBLE_R_TLV("ADC Level Volume", AIC32X4_LADCVOL, 109 - AIC32X4_RADCVOL, 0, 0x28, 0, tlv_step_0_5), 93 + SOC_DOUBLE_R_S_TLV("ADC Level Volume", AIC32X4_LADCVOL, 94 + AIC32X4_RADCVOL, 0, -0x18, 0x28, 6, 0, tlv_adc_vol), 110 95 SOC_DOUBLE_R_TLV("PGA Level Volume", AIC32X4_LMICPGAVOL, 111 96 AIC32X4_RMICPGAVOL, 0, 0x5f, 0, tlv_step_0_5), 112 97 ··· 495 480 static int aic32x4_set_bias_level(struct snd_soc_codec *codec, 496 481 enum snd_soc_bias_level level) 497 482 { 483 + struct aic32x4_priv *aic32x4 = snd_soc_codec_get_drvdata(codec); 484 + int ret; 485 + 498 486 switch (level) { 499 487 case SND_SOC_BIAS_ON: 488 + /* Switch on master clock */ 489 + ret = clk_prepare_enable(aic32x4->mclk); 490 + if (ret) { 491 + dev_err(codec->dev, "Failed to enable master clock\n"); 492 + return ret; 493 + } 494 + 500 495 /* Switch on PLL */ 501 496 snd_soc_update_bits(codec, AIC32X4_PLLPR, 502 497 AIC32X4_PLLEN, AIC32X4_PLLEN); ··· 534 509 case SND_SOC_BIAS_PREPARE: 535 510 break; 536 511 case SND_SOC_BIAS_STANDBY: 537 - /* Switch off PLL */ 538 - snd_soc_update_bits(codec, AIC32X4_PLLPR, 539 - AIC32X4_PLLEN, 0); 540 - 541 - /* Switch off NDAC Divider */ 542 - snd_soc_update_bits(codec, AIC32X4_NDAC, 543 - AIC32X4_NDACEN, 0); 544 - 545 - /* Switch off MDAC Divider */ 546 - snd_soc_update_bits(codec, AIC32X4_MDAC, 547 - AIC32X4_MDACEN, 0); 548 - 549 - /* Switch off NADC Divider */ 550 - snd_soc_update_bits(codec, AIC32X4_NADC, 551 - AIC32X4_NADCEN, 0); 512 + /* Switch off BCLK_N Divider */ 513 + snd_soc_update_bits(codec, AIC32X4_BCLKN, 514 + AIC32X4_BCLKEN, 0); 552 515 553 516 /* Switch off MADC Divider */ 554 517 snd_soc_update_bits(codec, AIC32X4_MADC, 555 518 AIC32X4_MADCEN, 0); 556 519 557 - /* Switch off BCLK_N Divider */ 558 - snd_soc_update_bits(codec, AIC32X4_BCLKN, 559 - AIC32X4_BCLKEN, 0); 520 + /* Switch off NADC Divider */ 521 + snd_soc_update_bits(codec, AIC32X4_NADC, 522 + AIC32X4_NADCEN, 0); 523 + 524 + /* Switch off MDAC Divider */ 525 + snd_soc_update_bits(codec, AIC32X4_MDAC, 526 + AIC32X4_MDACEN, 0); 527 + 528 + /* Switch off NDAC Divider */ 529 + snd_soc_update_bits(codec, AIC32X4_NDAC, 530 + AIC32X4_NDACEN, 0); 531 + 532 + /* Switch off PLL */ 533 + snd_soc_update_bits(codec, AIC32X4_PLLPR, 534 + AIC32X4_PLLEN, 0); 535 + 536 + /* Switch off master clock */ 537 + clk_disable_unprepare(aic32x4->mclk); 560 538 break; 561 539 case SND_SOC_BIAS_OFF: 562 540 break; ··· 616 588 617 589 snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_REGMAP); 618 590 619 - if (aic32x4->rstn_gpio >= 0) { 591 + if (gpio_is_valid(aic32x4->rstn_gpio)) { 620 592 ndelay(10); 621 593 gpio_set_value(aic32x4->rstn_gpio, 1); 622 594 } ··· 691 663 .num_dapm_routes = ARRAY_SIZE(aic32x4_dapm_routes), 692 664 }; 693 665 666 + static int aic32x4_parse_dt(struct aic32x4_priv *aic32x4, 667 + struct device_node *np) 668 + { 669 + aic32x4->swapdacs = false; 670 + aic32x4->micpga_routing = 0; 671 + aic32x4->rstn_gpio = of_get_named_gpio(np, "reset-gpios", 0); 672 + 673 + return 0; 674 + } 675 + 676 + static void aic32x4_disable_regulators(struct aic32x4_priv *aic32x4) 677 + { 678 + regulator_disable(aic32x4->supply_iov); 679 + 680 + if (!IS_ERR(aic32x4->supply_ldo)) 681 + regulator_disable(aic32x4->supply_ldo); 682 + 683 + if (!IS_ERR(aic32x4->supply_dv)) 684 + regulator_disable(aic32x4->supply_dv); 685 + 686 + if (!IS_ERR(aic32x4->supply_av)) 687 + regulator_disable(aic32x4->supply_av); 688 + } 689 + 690 + static int aic32x4_setup_regulators(struct device *dev, 691 + struct aic32x4_priv *aic32x4) 692 + { 693 + int ret = 0; 694 + 695 + aic32x4->supply_ldo = devm_regulator_get_optional(dev, "ldoin"); 696 + aic32x4->supply_iov = devm_regulator_get(dev, "iov"); 697 + aic32x4->supply_dv = devm_regulator_get_optional(dev, "dv"); 698 + aic32x4->supply_av = devm_regulator_get_optional(dev, "av"); 699 + 700 + /* Check if the regulator requirements are fulfilled */ 701 + 702 + if (IS_ERR(aic32x4->supply_iov)) { 703 + dev_err(dev, "Missing supply 'iov'\n"); 704 + return PTR_ERR(aic32x4->supply_iov); 705 + } 706 + 707 + if (IS_ERR(aic32x4->supply_ldo)) { 708 + if (PTR_ERR(aic32x4->supply_ldo) == -EPROBE_DEFER) 709 + return -EPROBE_DEFER; 710 + 711 + if (IS_ERR(aic32x4->supply_dv)) { 712 + dev_err(dev, "Missing supply 'dv' or 'ldoin'\n"); 713 + return PTR_ERR(aic32x4->supply_dv); 714 + } 715 + if (IS_ERR(aic32x4->supply_av)) { 716 + dev_err(dev, "Missing supply 'av' or 'ldoin'\n"); 717 + return PTR_ERR(aic32x4->supply_av); 718 + } 719 + } else { 720 + if (IS_ERR(aic32x4->supply_dv) && 721 + PTR_ERR(aic32x4->supply_dv) == -EPROBE_DEFER) 722 + return -EPROBE_DEFER; 723 + if (IS_ERR(aic32x4->supply_av) && 724 + PTR_ERR(aic32x4->supply_av) == -EPROBE_DEFER) 725 + return -EPROBE_DEFER; 726 + } 727 + 728 + ret = regulator_enable(aic32x4->supply_iov); 729 + if (ret) { 730 + dev_err(dev, "Failed to enable regulator iov\n"); 731 + return ret; 732 + } 733 + 734 + if (!IS_ERR(aic32x4->supply_ldo)) { 735 + ret = regulator_enable(aic32x4->supply_ldo); 736 + if (ret) { 737 + dev_err(dev, "Failed to enable regulator ldo\n"); 738 + goto error_ldo; 739 + } 740 + } 741 + 742 + if (!IS_ERR(aic32x4->supply_dv)) { 743 + ret = regulator_enable(aic32x4->supply_dv); 744 + if (ret) { 745 + dev_err(dev, "Failed to enable regulator dv\n"); 746 + goto error_dv; 747 + } 748 + } 749 + 750 + if (!IS_ERR(aic32x4->supply_av)) { 751 + ret = regulator_enable(aic32x4->supply_av); 752 + if (ret) { 753 + dev_err(dev, "Failed to enable regulator av\n"); 754 + goto error_av; 755 + } 756 + } 757 + 758 + if (!IS_ERR(aic32x4->supply_ldo) && IS_ERR(aic32x4->supply_av)) 759 + aic32x4->power_cfg |= AIC32X4_PWR_AIC32X4_LDO_ENABLE; 760 + 761 + return 0; 762 + 763 + error_av: 764 + if (!IS_ERR(aic32x4->supply_dv)) 765 + regulator_disable(aic32x4->supply_dv); 766 + 767 + error_dv: 768 + if (!IS_ERR(aic32x4->supply_ldo)) 769 + regulator_disable(aic32x4->supply_ldo); 770 + 771 + error_ldo: 772 + regulator_disable(aic32x4->supply_iov); 773 + return ret; 774 + } 775 + 694 776 static int aic32x4_i2c_probe(struct i2c_client *i2c, 695 777 const struct i2c_device_id *id) 696 778 { 697 779 struct aic32x4_pdata *pdata = i2c->dev.platform_data; 698 780 struct aic32x4_priv *aic32x4; 781 + struct device_node *np = i2c->dev.of_node; 699 782 int ret; 700 783 701 784 aic32x4 = devm_kzalloc(&i2c->dev, sizeof(struct aic32x4_priv), ··· 825 686 aic32x4->swapdacs = pdata->swapdacs; 826 687 aic32x4->micpga_routing = pdata->micpga_routing; 827 688 aic32x4->rstn_gpio = pdata->rstn_gpio; 689 + } else if (np) { 690 + ret = aic32x4_parse_dt(aic32x4, np); 691 + if (ret) { 692 + dev_err(&i2c->dev, "Failed to parse DT node\n"); 693 + return ret; 694 + } 828 695 } else { 829 696 aic32x4->power_cfg = 0; 830 697 aic32x4->swapdacs = false; ··· 838 693 aic32x4->rstn_gpio = -1; 839 694 } 840 695 841 - if (aic32x4->rstn_gpio >= 0) { 696 + aic32x4->mclk = devm_clk_get(&i2c->dev, "mclk"); 697 + if (IS_ERR(aic32x4->mclk)) { 698 + dev_err(&i2c->dev, "Failed getting the mclk. The current implementation does not support the usage of this codec without mclk\n"); 699 + return PTR_ERR(aic32x4->mclk); 700 + } 701 + 702 + if (gpio_is_valid(aic32x4->rstn_gpio)) { 842 703 ret = devm_gpio_request_one(&i2c->dev, aic32x4->rstn_gpio, 843 704 GPIOF_OUT_INIT_LOW, "tlv320aic32x4 rstn"); 844 705 if (ret != 0) 845 706 return ret; 846 707 } 847 708 709 + ret = aic32x4_setup_regulators(&i2c->dev, aic32x4); 710 + if (ret) { 711 + dev_err(&i2c->dev, "Failed to setup regulators\n"); 712 + return ret; 713 + } 714 + 848 715 ret = snd_soc_register_codec(&i2c->dev, 849 716 &soc_codec_dev_aic32x4, &aic32x4_dai, 1); 850 - return ret; 717 + if (ret) { 718 + dev_err(&i2c->dev, "Failed to register codec\n"); 719 + aic32x4_disable_regulators(aic32x4); 720 + return ret; 721 + } 722 + 723 + i2c_set_clientdata(i2c, aic32x4); 724 + 725 + return 0; 851 726 } 852 727 853 728 static int aic32x4_i2c_remove(struct i2c_client *client) 854 729 { 730 + struct aic32x4_priv *aic32x4 = i2c_get_clientdata(client); 731 + 732 + aic32x4_disable_regulators(aic32x4); 733 + 855 734 snd_soc_unregister_codec(&client->dev); 856 735 return 0; 857 736 } ··· 886 717 }; 887 718 MODULE_DEVICE_TABLE(i2c, aic32x4_i2c_id); 888 719 720 + static const struct of_device_id aic32x4_of_id[] = { 721 + { .compatible = "ti,tlv320aic32x4", }, 722 + { /* senitel */ } 723 + }; 724 + MODULE_DEVICE_TABLE(of, aic32x4_of_id); 725 + 889 726 static struct i2c_driver aic32x4_i2c_driver = { 890 727 .driver = { 891 728 .name = "tlv320aic32x4", 892 729 .owner = THIS_MODULE, 730 + .of_match_table = aic32x4_of_id, 893 731 }, 894 732 .probe = aic32x4_i2c_probe, 895 733 .remove = aic32x4_i2c_remove,
+13 -19
sound/soc/codecs/tlv320dac33.c
··· 478 478 "Bypass", "Mode 1", "Mode 7" 479 479 }; 480 480 481 - static const struct soc_enum dac33_fifo_mode_enum = 482 - SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(dac33_fifo_mode_texts), 483 - dac33_fifo_mode_texts); 481 + static SOC_ENUM_SINGLE_EXT_DECL(dac33_fifo_mode_enum, dac33_fifo_mode_texts); 484 482 485 483 /* L/R Line Output Gain */ 486 484 static const char *lr_lineout_gain_texts[] = { ··· 486 488 "Line 0dB DAC 12dB", "Line 6dB DAC 18dB", 487 489 }; 488 490 489 - static const struct soc_enum l_lineout_gain_enum = 490 - SOC_ENUM_SINGLE(DAC33_LDAC_PWR_CTRL, 0, 491 - ARRAY_SIZE(lr_lineout_gain_texts), 492 - lr_lineout_gain_texts); 491 + static SOC_ENUM_SINGLE_DECL(l_lineout_gain_enum, 492 + DAC33_LDAC_PWR_CTRL, 0, 493 + lr_lineout_gain_texts); 493 494 494 - static const struct soc_enum r_lineout_gain_enum = 495 - SOC_ENUM_SINGLE(DAC33_RDAC_PWR_CTRL, 0, 496 - ARRAY_SIZE(lr_lineout_gain_texts), 497 - lr_lineout_gain_texts); 495 + static SOC_ENUM_SINGLE_DECL(r_lineout_gain_enum, 496 + DAC33_RDAC_PWR_CTRL, 0, 497 + lr_lineout_gain_texts); 498 498 499 499 /* 500 500 * DACL/R digital volume control: ··· 530 534 /* LOP L/R invert selection */ 531 535 static const char *dac33_lr_lom_texts[] = {"DAC", "LOP"}; 532 536 533 - static const struct soc_enum dac33_left_lom_enum = 534 - SOC_ENUM_SINGLE(DAC33_OUT_AMP_CTRL, 3, 535 - ARRAY_SIZE(dac33_lr_lom_texts), 536 - dac33_lr_lom_texts); 537 + static SOC_ENUM_SINGLE_DECL(dac33_left_lom_enum, 538 + DAC33_OUT_AMP_CTRL, 3, 539 + dac33_lr_lom_texts); 537 540 538 541 static const struct snd_kcontrol_new dac33_dapm_left_lom_control = 539 542 SOC_DAPM_ENUM("Route", dac33_left_lom_enum); 540 543 541 - static const struct soc_enum dac33_right_lom_enum = 542 - SOC_ENUM_SINGLE(DAC33_OUT_AMP_CTRL, 2, 543 - ARRAY_SIZE(dac33_lr_lom_texts), 544 - dac33_lr_lom_texts); 544 + static SOC_ENUM_SINGLE_DECL(dac33_right_lom_enum, 545 + DAC33_OUT_AMP_CTRL, 2, 546 + dac33_lr_lom_texts); 545 547 546 548 static const struct snd_kcontrol_new dac33_dapm_right_lom_control = 547 549 SOC_DAPM_ENUM("Route", dac33_right_lom_enum);
+36 -48
sound/soc/codecs/twl4030.c
··· 415 415 static const char *twl4030_handsfreel_texts[] = 416 416 {"Voice", "AudioL1", "AudioL2", "AudioR2"}; 417 417 418 - static const struct soc_enum twl4030_handsfreel_enum = 419 - SOC_ENUM_SINGLE(TWL4030_REG_HFL_CTL, 0, 420 - ARRAY_SIZE(twl4030_handsfreel_texts), 421 - twl4030_handsfreel_texts); 418 + static SOC_ENUM_SINGLE_DECL(twl4030_handsfreel_enum, 419 + TWL4030_REG_HFL_CTL, 0, 420 + twl4030_handsfreel_texts); 422 421 423 422 static const struct snd_kcontrol_new twl4030_dapm_handsfreel_control = 424 423 SOC_DAPM_ENUM("Route", twl4030_handsfreel_enum); ··· 430 431 static const char *twl4030_handsfreer_texts[] = 431 432 {"Voice", "AudioR1", "AudioR2", "AudioL2"}; 432 433 433 - static const struct soc_enum twl4030_handsfreer_enum = 434 - SOC_ENUM_SINGLE(TWL4030_REG_HFR_CTL, 0, 435 - ARRAY_SIZE(twl4030_handsfreer_texts), 436 - twl4030_handsfreer_texts); 434 + static SOC_ENUM_SINGLE_DECL(twl4030_handsfreer_enum, 435 + TWL4030_REG_HFR_CTL, 0, 436 + twl4030_handsfreer_texts); 437 437 438 438 static const struct snd_kcontrol_new twl4030_dapm_handsfreer_control = 439 439 SOC_DAPM_ENUM("Route", twl4030_handsfreer_enum); ··· 446 448 static const char *twl4030_vibra_texts[] = 447 449 {"AudioL1", "AudioR1", "AudioL2", "AudioR2"}; 448 450 449 - static const struct soc_enum twl4030_vibra_enum = 450 - SOC_ENUM_SINGLE(TWL4030_REG_VIBRA_CTL, 2, 451 - ARRAY_SIZE(twl4030_vibra_texts), 452 - twl4030_vibra_texts); 451 + static SOC_ENUM_SINGLE_DECL(twl4030_vibra_enum, 452 + TWL4030_REG_VIBRA_CTL, 2, 453 + twl4030_vibra_texts); 453 454 454 455 static const struct snd_kcontrol_new twl4030_dapm_vibra_control = 455 456 SOC_DAPM_ENUM("Route", twl4030_vibra_enum); ··· 457 460 static const char *twl4030_vibrapath_texts[] = 458 461 {"Local vibrator", "Audio"}; 459 462 460 - static const struct soc_enum twl4030_vibrapath_enum = 461 - SOC_ENUM_SINGLE(TWL4030_REG_VIBRA_CTL, 4, 462 - ARRAY_SIZE(twl4030_vibrapath_texts), 463 - twl4030_vibrapath_texts); 463 + static SOC_ENUM_SINGLE_DECL(twl4030_vibrapath_enum, 464 + TWL4030_REG_VIBRA_CTL, 4, 465 + twl4030_vibrapath_texts); 464 466 465 467 static const struct snd_kcontrol_new twl4030_dapm_vibrapath_control = 466 468 SOC_DAPM_ENUM("Route", twl4030_vibrapath_enum); ··· 486 490 static const char *twl4030_micpathtx1_texts[] = 487 491 {"Analog", "Digimic0"}; 488 492 489 - static const struct soc_enum twl4030_micpathtx1_enum = 490 - SOC_ENUM_SINGLE(TWL4030_REG_ADCMICSEL, 0, 491 - ARRAY_SIZE(twl4030_micpathtx1_texts), 492 - twl4030_micpathtx1_texts); 493 + static SOC_ENUM_SINGLE_DECL(twl4030_micpathtx1_enum, 494 + TWL4030_REG_ADCMICSEL, 0, 495 + twl4030_micpathtx1_texts); 493 496 494 497 static const struct snd_kcontrol_new twl4030_dapm_micpathtx1_control = 495 498 SOC_DAPM_ENUM("Route", twl4030_micpathtx1_enum); ··· 497 502 static const char *twl4030_micpathtx2_texts[] = 498 503 {"Analog", "Digimic1"}; 499 504 500 - static const struct soc_enum twl4030_micpathtx2_enum = 501 - SOC_ENUM_SINGLE(TWL4030_REG_ADCMICSEL, 2, 502 - ARRAY_SIZE(twl4030_micpathtx2_texts), 503 - twl4030_micpathtx2_texts); 505 + static SOC_ENUM_SINGLE_DECL(twl4030_micpathtx2_enum, 506 + TWL4030_REG_ADCMICSEL, 2, 507 + twl4030_micpathtx2_texts); 504 508 505 509 static const struct snd_kcontrol_new twl4030_dapm_micpathtx2_control = 506 510 SOC_DAPM_ENUM("Route", twl4030_micpathtx2_enum); ··· 949 955 "Option 2 (voice/audio)", "Option 1 (audio)" 950 956 }; 951 957 952 - static const struct soc_enum twl4030_op_modes_enum = 953 - SOC_ENUM_SINGLE(TWL4030_REG_CODEC_MODE, 0, 954 - ARRAY_SIZE(twl4030_op_modes_texts), 955 - twl4030_op_modes_texts); 958 + static SOC_ENUM_SINGLE_DECL(twl4030_op_modes_enum, 959 + TWL4030_REG_CODEC_MODE, 0, 960 + twl4030_op_modes_texts); 956 961 957 962 static int snd_soc_put_twl4030_opmode_enum_double(struct snd_kcontrol *kcontrol, 958 963 struct snd_ctl_elem_value *ucontrol) ··· 1022 1029 "Voice high priority", "HiFi high priority" 1023 1030 }; 1024 1031 1025 - static const struct soc_enum twl4030_avadc_clk_priority_enum = 1026 - SOC_ENUM_SINGLE(TWL4030_REG_AVADC_CTL, 2, 1027 - ARRAY_SIZE(twl4030_avadc_clk_priority_texts), 1028 - twl4030_avadc_clk_priority_texts); 1032 + static SOC_ENUM_SINGLE_DECL(twl4030_avadc_clk_priority_enum, 1033 + TWL4030_REG_AVADC_CTL, 2, 1034 + twl4030_avadc_clk_priority_texts); 1029 1035 1030 1036 static const char *twl4030_rampdelay_texts[] = { 1031 1037 "27/20/14 ms", "55/40/27 ms", "109/81/55 ms", "218/161/109 ms", ··· 1032 1040 "3495/2581/1748 ms" 1033 1041 }; 1034 1042 1035 - static const struct soc_enum twl4030_rampdelay_enum = 1036 - SOC_ENUM_SINGLE(TWL4030_REG_HS_POPN_SET, 2, 1037 - ARRAY_SIZE(twl4030_rampdelay_texts), 1038 - twl4030_rampdelay_texts); 1043 + static SOC_ENUM_SINGLE_DECL(twl4030_rampdelay_enum, 1044 + TWL4030_REG_HS_POPN_SET, 2, 1045 + twl4030_rampdelay_texts); 1039 1046 1040 1047 /* Vibra H-bridge direction mode */ 1041 1048 static const char *twl4030_vibradirmode_texts[] = { 1042 1049 "Vibra H-bridge direction", "Audio data MSB", 1043 1050 }; 1044 1051 1045 - static const struct soc_enum twl4030_vibradirmode_enum = 1046 - SOC_ENUM_SINGLE(TWL4030_REG_VIBRA_CTL, 5, 1047 - ARRAY_SIZE(twl4030_vibradirmode_texts), 1048 - twl4030_vibradirmode_texts); 1052 + static SOC_ENUM_SINGLE_DECL(twl4030_vibradirmode_enum, 1053 + TWL4030_REG_VIBRA_CTL, 5, 1054 + twl4030_vibradirmode_texts); 1049 1055 1050 1056 /* Vibra H-bridge direction */ 1051 1057 static const char *twl4030_vibradir_texts[] = { 1052 1058 "Positive polarity", "Negative polarity", 1053 1059 }; 1054 1060 1055 - static const struct soc_enum twl4030_vibradir_enum = 1056 - SOC_ENUM_SINGLE(TWL4030_REG_VIBRA_CTL, 1, 1057 - ARRAY_SIZE(twl4030_vibradir_texts), 1058 - twl4030_vibradir_texts); 1061 + static SOC_ENUM_SINGLE_DECL(twl4030_vibradir_enum, 1062 + TWL4030_REG_VIBRA_CTL, 1, 1063 + twl4030_vibradir_texts); 1059 1064 1060 1065 /* Digimic Left and right swapping */ 1061 1066 static const char *twl4030_digimicswap_texts[] = { 1062 1067 "Not swapped", "Swapped", 1063 1068 }; 1064 1069 1065 - static const struct soc_enum twl4030_digimicswap_enum = 1066 - SOC_ENUM_SINGLE(TWL4030_REG_MISC_SET_1, 0, 1067 - ARRAY_SIZE(twl4030_digimicswap_texts), 1068 - twl4030_digimicswap_texts); 1070 + static SOC_ENUM_SINGLE_DECL(twl4030_digimicswap_enum, 1071 + TWL4030_REG_MISC_SET_1, 0, 1072 + twl4030_digimicswap_texts); 1069 1073 1070 1074 static const struct snd_kcontrol_new twl4030_snd_controls[] = { 1071 1075 /* Codec operation mode control */
+9 -8
sound/soc/codecs/twl6040.c
··· 81 81 }; 82 82 83 83 /* set of rates for each pll: low-power and high-performance */ 84 - static unsigned int lp_rates[] = { 84 + static const unsigned int lp_rates[] = { 85 85 8000, 86 86 11250, 87 87 16000, ··· 93 93 96000, 94 94 }; 95 95 96 - static unsigned int hp_rates[] = { 96 + static const unsigned int hp_rates[] = { 97 97 8000, 98 98 16000, 99 99 32000, ··· 101 101 96000, 102 102 }; 103 103 104 - static struct snd_pcm_hw_constraint_list sysclk_constraints[] = { 104 + static const struct snd_pcm_hw_constraint_list sysclk_constraints[] = { 105 105 { .count = ARRAY_SIZE(lp_rates), .list = lp_rates, }, 106 106 { .count = ARRAY_SIZE(hp_rates), .list = hp_rates, }, 107 107 }; ··· 392 392 {"Headset Mic", "Sub Mic", "Aux/FM Right", "Off"}; 393 393 394 394 static const struct soc_enum twl6040_enum[] = { 395 - SOC_ENUM_SINGLE(TWL6040_REG_MICLCTL, 3, 4, twl6040_amicl_texts), 396 - SOC_ENUM_SINGLE(TWL6040_REG_MICRCTL, 3, 4, twl6040_amicr_texts), 395 + SOC_ENUM_SINGLE(TWL6040_REG_MICLCTL, 3, 396 + ARRAY_SIZE(twl6040_amicl_texts), twl6040_amicl_texts), 397 + SOC_ENUM_SINGLE(TWL6040_REG_MICRCTL, 3, 398 + ARRAY_SIZE(twl6040_amicr_texts), twl6040_amicr_texts), 397 399 }; 398 400 399 401 static const char *twl6040_hs_texts[] = { ··· 478 476 "Low-Power", "High-Performance", 479 477 }; 480 478 481 - static const struct soc_enum twl6040_power_mode_enum = 482 - SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(twl6040_power_mode_texts), 483 - twl6040_power_mode_texts); 479 + static SOC_ENUM_SINGLE_EXT_DECL(twl6040_power_mode_enum, 480 + twl6040_power_mode_texts); 484 481 485 482 static int twl6040_headset_power_get_enum(struct snd_kcontrol *kcontrol, 486 483 struct snd_ctl_elem_value *ucontrol)
+20 -18
sound/soc/codecs/uda1380.c
··· 237 237 }; 238 238 239 239 static const struct soc_enum uda1380_deemp_enum[] = { 240 - SOC_ENUM_SINGLE(UDA1380_DEEMP, 8, 5, uda1380_deemp), 241 - SOC_ENUM_SINGLE(UDA1380_DEEMP, 0, 5, uda1380_deemp), 240 + SOC_ENUM_SINGLE(UDA1380_DEEMP, 8, ARRAY_SIZE(uda1380_deemp), 241 + uda1380_deemp), 242 + SOC_ENUM_SINGLE(UDA1380_DEEMP, 0, ARRAY_SIZE(uda1380_deemp), 243 + uda1380_deemp), 242 244 }; 243 - static const struct soc_enum uda1380_input_sel_enum = 244 - SOC_ENUM_SINGLE(UDA1380_ADC, 2, 4, uda1380_input_sel); /* SEL_MIC, SEL_LNA */ 245 - static const struct soc_enum uda1380_output_sel_enum = 246 - SOC_ENUM_SINGLE(UDA1380_PM, 7, 2, uda1380_output_sel); /* R02_EN_AVC */ 247 - static const struct soc_enum uda1380_spf_enum = 248 - SOC_ENUM_SINGLE(UDA1380_MODE, 14, 4, uda1380_spf_mode); /* M */ 249 - static const struct soc_enum uda1380_capture_sel_enum = 250 - SOC_ENUM_SINGLE(UDA1380_IFACE, 6, 2, uda1380_capture_sel); /* SEL_SOURCE */ 251 - static const struct soc_enum uda1380_sel_ns_enum = 252 - SOC_ENUM_SINGLE(UDA1380_MIXER, 14, 2, uda1380_sel_ns); /* SEL_NS */ 253 - static const struct soc_enum uda1380_mix_enum = 254 - SOC_ENUM_SINGLE(UDA1380_MIXER, 12, 4, uda1380_mix_control); /* MIX, MIX_POS */ 255 - static const struct soc_enum uda1380_sdet_enum = 256 - SOC_ENUM_SINGLE(UDA1380_MIXER, 4, 4, uda1380_sdet_setting); /* SD_VALUE */ 257 - static const struct soc_enum uda1380_os_enum = 258 - SOC_ENUM_SINGLE(UDA1380_MIXER, 0, 3, uda1380_os_setting); /* OS */ 245 + static SOC_ENUM_SINGLE_DECL(uda1380_input_sel_enum, 246 + UDA1380_ADC, 2, uda1380_input_sel); /* SEL_MIC, SEL_LNA */ 247 + static SOC_ENUM_SINGLE_DECL(uda1380_output_sel_enum, 248 + UDA1380_PM, 7, uda1380_output_sel); /* R02_EN_AVC */ 249 + static SOC_ENUM_SINGLE_DECL(uda1380_spf_enum, 250 + UDA1380_MODE, 14, uda1380_spf_mode); /* M */ 251 + static SOC_ENUM_SINGLE_DECL(uda1380_capture_sel_enum, 252 + UDA1380_IFACE, 6, uda1380_capture_sel); /* SEL_SOURCE */ 253 + static SOC_ENUM_SINGLE_DECL(uda1380_sel_ns_enum, 254 + UDA1380_MIXER, 14, uda1380_sel_ns); /* SEL_NS */ 255 + static SOC_ENUM_SINGLE_DECL(uda1380_mix_enum, 256 + UDA1380_MIXER, 12, uda1380_mix_control); /* MIX, MIX_POS */ 257 + static SOC_ENUM_SINGLE_DECL(uda1380_sdet_enum, 258 + UDA1380_MIXER, 4, uda1380_sdet_setting); /* SD_VALUE */ 259 + static SOC_ENUM_SINGLE_DECL(uda1380_os_enum, 260 + UDA1380_MIXER, 0, uda1380_os_setting); /* OS */ 259 261 260 262 /* 261 263 * from -48 dB in 1.5 dB steps (mute instead of -49.5 dB)
+2 -5
sound/soc/codecs/wl1273.c
··· 209 209 return 1; 210 210 } 211 211 212 - static const struct soc_enum wl1273_enum = 213 - SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(wl1273_audio_route), wl1273_audio_route); 212 + static SOC_ENUM_SINGLE_EXT_DECL(wl1273_enum, wl1273_audio_route); 214 213 215 214 static int snd_wl1273_fm_audio_get(struct snd_kcontrol *kcontrol, 216 215 struct snd_ctl_elem_value *ucontrol) ··· 246 247 247 248 static const char * const wl1273_audio_strings[] = { "Digital", "Analog" }; 248 249 249 - static const struct soc_enum wl1273_audio_enum = 250 - SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(wl1273_audio_strings), 251 - wl1273_audio_strings); 250 + static SOC_ENUM_SINGLE_EXT_DECL(wl1273_audio_enum, wl1273_audio_strings); 252 251 253 252 static int snd_wl1273_fm_volume_get(struct snd_kcontrol *kcontrol, 254 253 struct snd_ctl_elem_value *ucontrol)
+8 -10
sound/soc/codecs/wm2200.c
··· 1113 1113 "None", "IN1", "IN2", "IN3", 1114 1114 }; 1115 1115 1116 - static const struct soc_enum wm2200_rxanc_input_sel = 1117 - SOC_ENUM_SINGLE(WM2200_RXANC_SRC, 1118 - WM2200_IN_RXANC_SEL_SHIFT, 1119 - ARRAY_SIZE(wm2200_rxanc_input_sel_texts), 1120 - wm2200_rxanc_input_sel_texts); 1116 + static SOC_ENUM_SINGLE_DECL(wm2200_rxanc_input_sel, 1117 + WM2200_RXANC_SRC, 1118 + WM2200_IN_RXANC_SEL_SHIFT, 1119 + wm2200_rxanc_input_sel_texts); 1121 1120 1122 1121 static const struct snd_kcontrol_new wm2200_snd_controls[] = { 1123 1122 SOC_SINGLE("IN1 High Performance Switch", WM2200_IN1L_CONTROL, ··· 1287 1288 "OUT1L", "OUT1R", "OUT2L", "OUT2R", 1288 1289 }; 1289 1290 1290 - static const struct soc_enum wm2200_aec_loopback = 1291 - SOC_ENUM_SINGLE(WM2200_DAC_AEC_CONTROL_1, 1292 - WM2200_AEC_LOOPBACK_SRC_SHIFT, 1293 - ARRAY_SIZE(wm2200_aec_loopback_texts), 1294 - wm2200_aec_loopback_texts); 1291 + static SOC_ENUM_SINGLE_DECL(wm2200_aec_loopback, 1292 + WM2200_DAC_AEC_CONTROL_1, 1293 + WM2200_AEC_LOOPBACK_SRC_SHIFT, 1294 + wm2200_aec_loopback_texts); 1295 1295 1296 1296 static const struct snd_kcontrol_new wm2200_aec_loopback_mux = 1297 1297 SOC_DAPM_ENUM("AEC Loopback", wm2200_aec_loopback);