diff options
| -rw-r--r-- | Documentation/devicetree/bindings/i2c/trivial-devices.txt | 1 | ||||
| -rw-r--r-- | Documentation/devicetree/bindings/misc/atmel-ssc.txt | 8 | ||||
| -rw-r--r-- | drivers/misc/atmel-ssc.c | 6 | ||||
| -rw-r--r-- | include/linux/atmel-ssc.h | 1 | ||||
| -rw-r--r-- | include/linux/mfd/arizona/registers.h | 6 | ||||
| -rw-r--r-- | sound/soc/atmel/atmel_ssc_dai.c | 13 | ||||
| -rw-r--r-- | sound/soc/atmel/sam9g20_wm8731.c | 20 | ||||
| -rw-r--r-- | sound/soc/cirrus/Kconfig | 2 | ||||
| -rw-r--r-- | sound/soc/codecs/arizona.c | 254 | ||||
| -rw-r--r-- | sound/soc/codecs/cs4271.c | 63 | ||||
| -rw-r--r-- | sound/soc/codecs/cs42l51.c | 71 | ||||
| -rw-r--r-- | sound/soc/codecs/cs42l52.c | 92 | ||||
| -rw-r--r-- | sound/soc/codecs/cs42l73.c | 55 | ||||
| -rw-r--r-- | sound/soc/codecs/da7210.c | 20 | ||||
| -rw-r--r-- | sound/soc/codecs/wm5102.c | 28 | ||||
| -rw-r--r-- | sound/soc/codecs/wm5110.c | 19 | ||||
| -rw-r--r-- | sound/soc/codecs/wm8997.c | 25 | ||||
| -rw-r--r-- | sound/soc/codecs/wm_adsp.c | 50 |
18 files changed, 427 insertions, 307 deletions
diff --git a/Documentation/devicetree/bindings/i2c/trivial-devices.txt b/Documentation/devicetree/bindings/i2c/trivial-devices.txt index 1a1ac2e560e9..f47e56bcf78d 100644 --- a/Documentation/devicetree/bindings/i2c/trivial-devices.txt +++ b/Documentation/devicetree/bindings/i2c/trivial-devices.txt | |||
| @@ -18,6 +18,7 @@ atmel,24c02 i2c serial eeprom (24cxx) | |||
| 18 | atmel,at97sc3204t i2c trusted platform module (TPM) | 18 | atmel,at97sc3204t i2c trusted platform module (TPM) |
| 19 | capella,cm32181 CM32181: Ambient Light Sensor | 19 | capella,cm32181 CM32181: Ambient Light Sensor |
| 20 | catalyst,24c32 i2c serial eeprom | 20 | catalyst,24c32 i2c serial eeprom |
| 21 | cirrus,cs42l51 Cirrus Logic CS42L51 audio codec | ||
| 21 | dallas,ds1307 64 x 8, Serial, I2C Real-Time Clock | 22 | dallas,ds1307 64 x 8, Serial, I2C Real-Time Clock |
| 22 | dallas,ds1338 I2C RTC with 56-Byte NV RAM | 23 | dallas,ds1338 I2C RTC with 56-Byte NV RAM |
| 23 | dallas,ds1339 I2C Serial Real-Time Clock | 24 | dallas,ds1339 I2C Serial Real-Time Clock |
diff --git a/Documentation/devicetree/bindings/misc/atmel-ssc.txt b/Documentation/devicetree/bindings/misc/atmel-ssc.txt index 60960b2755f4..efc98ea1f23d 100644 --- a/Documentation/devicetree/bindings/misc/atmel-ssc.txt +++ b/Documentation/devicetree/bindings/misc/atmel-ssc.txt | |||
| @@ -17,6 +17,14 @@ Required properties for devices compatible with "atmel,at91sam9g45-ssc": | |||
| 17 | See Documentation/devicetree/bindings/dma/atmel-dma.txt for details. | 17 | See Documentation/devicetree/bindings/dma/atmel-dma.txt for details. |
| 18 | - dma-names: Must be "tx", "rx". | 18 | - dma-names: Must be "tx", "rx". |
| 19 | 19 | ||
| 20 | Optional properties: | ||
| 21 | - atmel,clk-from-rk-pin: bool property. | ||
| 22 | - When SSC works in slave mode, according to the hardware design, the | ||
| 23 | clock can get from TK pin, and also can get from RK pin. So, add | ||
| 24 | this parameter to choose where the clock from. | ||
| 25 | - By default the clock is from TK pin, if the clock from RK pin, this | ||
| 26 | property is needed. | ||
| 27 | |||
| 20 | Examples: | 28 | Examples: |
| 21 | - PDC transfer: | 29 | - PDC transfer: |
| 22 | ssc0: ssc@fffbc000 { | 30 | ssc0: ssc@fffbc000 { |
diff --git a/drivers/misc/atmel-ssc.c b/drivers/misc/atmel-ssc.c index 5be808406edc..22de13727641 100644 --- a/drivers/misc/atmel-ssc.c +++ b/drivers/misc/atmel-ssc.c | |||
| @@ -150,6 +150,12 @@ static int ssc_probe(struct platform_device *pdev) | |||
| 150 | return -ENODEV; | 150 | return -ENODEV; |
| 151 | ssc->pdata = (struct atmel_ssc_platform_data *)plat_dat; | 151 | ssc->pdata = (struct atmel_ssc_platform_data *)plat_dat; |
| 152 | 152 | ||
| 153 | if (pdev->dev.of_node) { | ||
| 154 | struct device_node *np = pdev->dev.of_node; | ||
| 155 | ssc->clk_from_rk_pin = | ||
| 156 | of_property_read_bool(np, "atmel,clk-from-rk-pin"); | ||
| 157 | } | ||
| 158 | |||
| 153 | regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 159 | regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 154 | ssc->regs = devm_ioremap_resource(&pdev->dev, regs); | 160 | ssc->regs = devm_ioremap_resource(&pdev->dev, regs); |
| 155 | if (IS_ERR(ssc->regs)) | 161 | if (IS_ERR(ssc->regs)) |
diff --git a/include/linux/atmel-ssc.h b/include/linux/atmel-ssc.h index 66a0e5384edd..571a12ebb018 100644 --- a/include/linux/atmel-ssc.h +++ b/include/linux/atmel-ssc.h | |||
| @@ -18,6 +18,7 @@ struct ssc_device { | |||
| 18 | struct clk *clk; | 18 | struct clk *clk; |
| 19 | int user; | 19 | int user; |
| 20 | int irq; | 20 | int irq; |
| 21 | bool clk_from_rk_pin; | ||
| 21 | }; | 22 | }; |
| 22 | 23 | ||
| 23 | struct ssc_device * __must_check ssc_request(unsigned int ssc_num); | 24 | struct ssc_device * __must_check ssc_request(unsigned int ssc_num); |
diff --git a/include/linux/mfd/arizona/registers.h b/include/linux/mfd/arizona/registers.h index fdf3aa376eb2..3ddaa634b19d 100644 --- a/include/linux/mfd/arizona/registers.h +++ b/include/linux/mfd/arizona/registers.h | |||
| @@ -1702,9 +1702,9 @@ | |||
| 1702 | /* | 1702 | /* |
| 1703 | * R373 (0x175) - FLL1 Control 5 | 1703 | * R373 (0x175) - FLL1 Control 5 |
| 1704 | */ | 1704 | */ |
| 1705 | #define ARIZONA_FLL1_FRATIO_MASK 0x0700 /* FLL1_FRATIO - [10:8] */ | 1705 | #define ARIZONA_FLL1_FRATIO_MASK 0x0F00 /* FLL1_FRATIO - [11:8] */ |
| 1706 | #define ARIZONA_FLL1_FRATIO_SHIFT 8 /* FLL1_FRATIO - [10:8] */ | 1706 | #define ARIZONA_FLL1_FRATIO_SHIFT 8 /* FLL1_FRATIO - [11:8] */ |
| 1707 | #define ARIZONA_FLL1_FRATIO_WIDTH 3 /* FLL1_FRATIO - [10:8] */ | 1707 | #define ARIZONA_FLL1_FRATIO_WIDTH 4 /* FLL1_FRATIO - [11:8] */ |
| 1708 | #define ARIZONA_FLL1_OUTDIV_MASK 0x000E /* FLL1_OUTDIV - [3:1] */ | 1708 | #define ARIZONA_FLL1_OUTDIV_MASK 0x000E /* FLL1_OUTDIV - [3:1] */ |
| 1709 | #define ARIZONA_FLL1_OUTDIV_SHIFT 1 /* FLL1_OUTDIV - [3:1] */ | 1709 | #define ARIZONA_FLL1_OUTDIV_SHIFT 1 /* FLL1_OUTDIV - [3:1] */ |
| 1710 | #define ARIZONA_FLL1_OUTDIV_WIDTH 3 /* FLL1_OUTDIV - [3:1] */ | 1710 | #define ARIZONA_FLL1_OUTDIV_WIDTH 3 /* FLL1_OUTDIV - [3:1] */ |
diff --git a/sound/soc/atmel/atmel_ssc_dai.c b/sound/soc/atmel/atmel_ssc_dai.c index 1ead3c977a51..de433cfd044c 100644 --- a/sound/soc/atmel/atmel_ssc_dai.c +++ b/sound/soc/atmel/atmel_ssc_dai.c | |||
| @@ -341,6 +341,7 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream, | |||
| 341 | { | 341 | { |
| 342 | int id = dai->id; | 342 | int id = dai->id; |
| 343 | struct atmel_ssc_info *ssc_p = &ssc_info[id]; | 343 | struct atmel_ssc_info *ssc_p = &ssc_info[id]; |
| 344 | struct ssc_device *ssc = ssc_p->ssc; | ||
| 344 | struct atmel_pcm_dma_params *dma_params; | 345 | struct atmel_pcm_dma_params *dma_params; |
| 345 | int dir, channels, bits; | 346 | int dir, channels, bits; |
| 346 | u32 tfmr, rfmr, tcmr, rcmr; | 347 | u32 tfmr, rfmr, tcmr, rcmr; |
| @@ -466,7 +467,8 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream, | |||
| 466 | | SSC_BF(RCMR_START, start_event) | 467 | | SSC_BF(RCMR_START, start_event) |
| 467 | | SSC_BF(RCMR_CKI, SSC_CKI_RISING) | 468 | | SSC_BF(RCMR_CKI, SSC_CKI_RISING) |
| 468 | | SSC_BF(RCMR_CKO, SSC_CKO_NONE) | 469 | | SSC_BF(RCMR_CKO, SSC_CKO_NONE) |
| 469 | | SSC_BF(RCMR_CKS, SSC_CKS_CLOCK); | 470 | | SSC_BF(RCMR_CKS, ssc->clk_from_rk_pin ? |
| 471 | SSC_CKS_PIN : SSC_CKS_CLOCK); | ||
| 470 | 472 | ||
| 471 | rfmr = SSC_BF(RFMR_FSEDGE, SSC_FSEDGE_POSITIVE) | 473 | rfmr = SSC_BF(RFMR_FSEDGE, SSC_FSEDGE_POSITIVE) |
| 472 | | SSC_BF(RFMR_FSOS, SSC_FSOS_NONE) | 474 | | SSC_BF(RFMR_FSOS, SSC_FSOS_NONE) |
| @@ -481,7 +483,8 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream, | |||
| 481 | | SSC_BF(TCMR_START, start_event) | 483 | | SSC_BF(TCMR_START, start_event) |
| 482 | | SSC_BF(TCMR_CKI, SSC_CKI_FALLING) | 484 | | SSC_BF(TCMR_CKI, SSC_CKI_FALLING) |
| 483 | | SSC_BF(TCMR_CKO, SSC_CKO_NONE) | 485 | | SSC_BF(TCMR_CKO, SSC_CKO_NONE) |
| 484 | | SSC_BF(TCMR_CKS, SSC_CKS_PIN); | 486 | | SSC_BF(TCMR_CKS, ssc->clk_from_rk_pin ? |
| 487 | SSC_CKS_CLOCK : SSC_CKS_PIN); | ||
| 485 | 488 | ||
| 486 | tfmr = SSC_BF(TFMR_FSEDGE, SSC_FSEDGE_POSITIVE) | 489 | tfmr = SSC_BF(TFMR_FSEDGE, SSC_FSEDGE_POSITIVE) |
| 487 | | SSC_BF(TFMR_FSDEN, 0) | 490 | | SSC_BF(TFMR_FSDEN, 0) |
| @@ -550,7 +553,8 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream, | |||
| 550 | | SSC_BF(RCMR_START, SSC_START_RISING_RF) | 553 | | SSC_BF(RCMR_START, SSC_START_RISING_RF) |
| 551 | | SSC_BF(RCMR_CKI, SSC_CKI_RISING) | 554 | | SSC_BF(RCMR_CKI, SSC_CKI_RISING) |
| 552 | | SSC_BF(RCMR_CKO, SSC_CKO_NONE) | 555 | | SSC_BF(RCMR_CKO, SSC_CKO_NONE) |
| 553 | | SSC_BF(RCMR_CKS, SSC_CKS_PIN); | 556 | | SSC_BF(RCMR_CKS, ssc->clk_from_rk_pin ? |
| 557 | SSC_CKS_PIN : SSC_CKS_CLOCK); | ||
| 554 | 558 | ||
| 555 | rfmr = SSC_BF(RFMR_FSEDGE, SSC_FSEDGE_POSITIVE) | 559 | rfmr = SSC_BF(RFMR_FSEDGE, SSC_FSEDGE_POSITIVE) |
| 556 | | SSC_BF(RFMR_FSOS, SSC_FSOS_NONE) | 560 | | SSC_BF(RFMR_FSOS, SSC_FSOS_NONE) |
| @@ -565,7 +569,8 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream, | |||
| 565 | | SSC_BF(TCMR_START, SSC_START_RISING_RF) | 569 | | SSC_BF(TCMR_START, SSC_START_RISING_RF) |
| 566 | | SSC_BF(TCMR_CKI, SSC_CKI_FALLING) | 570 | | SSC_BF(TCMR_CKI, SSC_CKI_FALLING) |
| 567 | | SSC_BF(TCMR_CKO, SSC_CKO_NONE) | 571 | | SSC_BF(TCMR_CKO, SSC_CKO_NONE) |
| 568 | | SSC_BF(TCMR_CKS, SSC_CKS_PIN); | 572 | | SSC_BF(RCMR_CKS, ssc->clk_from_rk_pin ? |
| 573 | SSC_CKS_CLOCK : SSC_CKS_PIN); | ||
| 569 | 574 | ||
| 570 | tfmr = SSC_BF(TFMR_FSEDGE, SSC_FSEDGE_POSITIVE) | 575 | tfmr = SSC_BF(TFMR_FSEDGE, SSC_FSEDGE_POSITIVE) |
| 571 | | SSC_BF(TFMR_FSDEN, 0) | 576 | | SSC_BF(TFMR_FSDEN, 0) |
diff --git a/sound/soc/atmel/sam9g20_wm8731.c b/sound/soc/atmel/sam9g20_wm8731.c index f15bff1548f8..174bd546c08b 100644 --- a/sound/soc/atmel/sam9g20_wm8731.c +++ b/sound/soc/atmel/sam9g20_wm8731.c | |||
| @@ -155,25 +155,14 @@ static int at91sam9g20ek_wm8731_init(struct snd_soc_pcm_runtime *rtd) | |||
| 155 | return ret; | 155 | return ret; |
| 156 | } | 156 | } |
| 157 | 157 | ||
| 158 | /* Add specific widgets */ | ||
| 159 | snd_soc_dapm_new_controls(dapm, at91sam9g20ek_dapm_widgets, | ||
| 160 | ARRAY_SIZE(at91sam9g20ek_dapm_widgets)); | ||
| 161 | /* Set up specific audio path interconnects */ | ||
| 162 | snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon)); | ||
| 163 | |||
| 164 | /* not connected */ | 158 | /* not connected */ |
| 165 | snd_soc_dapm_nc_pin(dapm, "RLINEIN"); | 159 | snd_soc_dapm_nc_pin(dapm, "RLINEIN"); |
| 166 | snd_soc_dapm_nc_pin(dapm, "LLINEIN"); | 160 | snd_soc_dapm_nc_pin(dapm, "LLINEIN"); |
| 167 | 161 | ||
| 168 | #ifdef ENABLE_MIC_INPUT | 162 | #ifndef ENABLE_MIC_INPUT |
| 169 | snd_soc_dapm_enable_pin(dapm, "Int Mic"); | 163 | snd_soc_dapm_nc_pin(&rtd->card->dapm, "Int Mic"); |
| 170 | #else | ||
| 171 | snd_soc_dapm_nc_pin(dapm, "Int Mic"); | ||
| 172 | #endif | 164 | #endif |
| 173 | 165 | ||
| 174 | /* always connected */ | ||
| 175 | snd_soc_dapm_enable_pin(dapm, "Ext Spk"); | ||
| 176 | |||
| 177 | return 0; | 166 | return 0; |
| 178 | } | 167 | } |
| 179 | 168 | ||
| @@ -194,6 +183,11 @@ static struct snd_soc_card snd_soc_at91sam9g20ek = { | |||
| 194 | .dai_link = &at91sam9g20ek_dai, | 183 | .dai_link = &at91sam9g20ek_dai, |
| 195 | .num_links = 1, | 184 | .num_links = 1, |
| 196 | .set_bias_level = at91sam9g20ek_set_bias_level, | 185 | .set_bias_level = at91sam9g20ek_set_bias_level, |
| 186 | |||
| 187 | .dapm_widgets = at91sam9g20ek_dapm_widgets, | ||
| 188 | .num_dapm_widgets = ARRAY_SIZE(at91sam9g20ek_dapm_widgets), | ||
| 189 | .dapm_routes = intercon, | ||
| 190 | .num_dapm_routes = ARRAY_SIZE(intercon), | ||
| 197 | }; | 191 | }; |
| 198 | 192 | ||
| 199 | static int at91sam9g20ek_audio_probe(struct platform_device *pdev) | 193 | static int at91sam9g20ek_audio_probe(struct platform_device *pdev) |
diff --git a/sound/soc/cirrus/Kconfig b/sound/soc/cirrus/Kconfig index 06f938deda15..c872dacbab98 100644 --- a/sound/soc/cirrus/Kconfig +++ b/sound/soc/cirrus/Kconfig | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | config SND_EP93XX_SOC | 1 | config SND_EP93XX_SOC |
| 2 | tristate "SoC Audio support for the Cirrus Logic EP93xx series" | 2 | tristate "SoC Audio support for the Cirrus Logic EP93xx series" |
| 3 | depends on (ARCH_EP93XX || COMPILE_TEST) && SND_SOC | 3 | depends on ARCH_EP93XX || COMPILE_TEST |
| 4 | select SND_SOC_GENERIC_DMAENGINE_PCM | 4 | select SND_SOC_GENERIC_DMAENGINE_PCM |
| 5 | help | 5 | help |
| 6 | Say Y or M if you want to add support for codecs attached to | 6 | Say Y or M if you want to add support for codecs attached to |
diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c index a32b84ac03f6..29e198f57d4c 100644 --- a/sound/soc/codecs/arizona.c +++ b/sound/soc/codecs/arizona.c | |||
| @@ -53,6 +53,14 @@ | |||
| 53 | #define ARIZONA_AIF_RX_ENABLES 0x1A | 53 | #define ARIZONA_AIF_RX_ENABLES 0x1A |
| 54 | #define ARIZONA_AIF_FORCE_WRITE 0x1B | 54 | #define ARIZONA_AIF_FORCE_WRITE 0x1B |
| 55 | 55 | ||
| 56 | #define ARIZONA_FLL_VCO_CORNER 141900000 | ||
| 57 | #define ARIZONA_FLL_MAX_FREF 13500000 | ||
| 58 | #define ARIZONA_FLL_MIN_FVCO 90000000 | ||
| 59 | #define ARIZONA_FLL_MAX_FRATIO 16 | ||
| 60 | #define ARIZONA_FLL_MAX_REFDIV 8 | ||
| 61 | #define ARIZONA_FLL_MIN_OUTDIV 2 | ||
| 62 | #define ARIZONA_FLL_MAX_OUTDIV 7 | ||
| 63 | |||
| 56 | #define arizona_fll_err(_fll, fmt, ...) \ | 64 | #define arizona_fll_err(_fll, fmt, ...) \ |
| 57 | dev_err(_fll->arizona->dev, "FLL%d: " fmt, _fll->id, ##__VA_ARGS__) | 65 | dev_err(_fll->arizona->dev, "FLL%d: " fmt, _fll->id, ##__VA_ARGS__) |
| 58 | #define arizona_fll_warn(_fll, fmt, ...) \ | 66 | #define arizona_fll_warn(_fll, fmt, ...) \ |
| @@ -1386,74 +1394,147 @@ struct arizona_fll_cfg { | |||
| 1386 | int gain; | 1394 | int gain; |
| 1387 | }; | 1395 | }; |
| 1388 | 1396 | ||
| 1389 | static int arizona_calc_fll(struct arizona_fll *fll, | 1397 | static int arizona_validate_fll(struct arizona_fll *fll, |
| 1390 | struct arizona_fll_cfg *cfg, | 1398 | unsigned int Fref, |
| 1391 | unsigned int Fref, | 1399 | unsigned int Fout) |
| 1392 | unsigned int Fout) | ||
| 1393 | { | 1400 | { |
| 1394 | unsigned int target, div, gcd_fll; | 1401 | unsigned int Fvco_min; |
| 1395 | int i, ratio; | 1402 | |
| 1403 | if (Fref / ARIZONA_FLL_MAX_REFDIV > ARIZONA_FLL_MAX_FREF) { | ||
| 1404 | arizona_fll_err(fll, | ||
| 1405 | "Can't scale %dMHz in to <=13.5MHz\n", | ||
| 1406 | Fref); | ||
| 1407 | return -EINVAL; | ||
| 1408 | } | ||
| 1396 | 1409 | ||
| 1397 | arizona_fll_dbg(fll, "Fref=%u Fout=%u\n", Fref, Fout); | 1410 | Fvco_min = ARIZONA_FLL_MIN_FVCO * fll->vco_mult; |
| 1411 | if (Fout * ARIZONA_FLL_MAX_OUTDIV < Fvco_min) { | ||
| 1412 | arizona_fll_err(fll, "No FLL_OUTDIV for Fout=%uHz\n", | ||
| 1413 | Fout); | ||
| 1414 | return -EINVAL; | ||
| 1415 | } | ||
| 1416 | |||
| 1417 | return 0; | ||
| 1418 | } | ||
| 1419 | |||
| 1420 | static int arizona_find_fratio(unsigned int Fref, int *fratio) | ||
| 1421 | { | ||
| 1422 | int i; | ||
| 1423 | |||
| 1424 | /* Find an appropriate FLL_FRATIO */ | ||
| 1425 | for (i = 0; i < ARRAY_SIZE(fll_fratios); i++) { | ||
| 1426 | if (fll_fratios[i].min <= Fref && Fref <= fll_fratios[i].max) { | ||
| 1427 | if (fratio) | ||
| 1428 | *fratio = fll_fratios[i].fratio; | ||
| 1429 | return fll_fratios[i].ratio; | ||
| 1430 | } | ||
| 1431 | } | ||
| 1432 | |||
| 1433 | return -EINVAL; | ||
| 1434 | } | ||
| 1435 | |||
| 1436 | static int arizona_calc_fratio(struct arizona_fll *fll, | ||
| 1437 | struct arizona_fll_cfg *cfg, | ||
| 1438 | unsigned int target, | ||
| 1439 | unsigned int Fref, bool sync) | ||
| 1440 | { | ||
| 1441 | int init_ratio, ratio; | ||
| 1442 | int refdiv, div; | ||
| 1398 | 1443 | ||
| 1399 | /* Fref must be <=13.5MHz */ | 1444 | /* Fref must be <=13.5MHz, find initial refdiv */ |
| 1400 | div = 1; | 1445 | div = 1; |
| 1401 | cfg->refdiv = 0; | 1446 | cfg->refdiv = 0; |
| 1402 | while ((Fref / div) > 13500000) { | 1447 | while (Fref > ARIZONA_FLL_MAX_FREF) { |
| 1403 | div *= 2; | 1448 | div *= 2; |
| 1449 | Fref /= 2; | ||
| 1404 | cfg->refdiv++; | 1450 | cfg->refdiv++; |
| 1405 | 1451 | ||
| 1406 | if (div > 8) { | 1452 | if (div > ARIZONA_FLL_MAX_REFDIV) |
| 1407 | arizona_fll_err(fll, | ||
| 1408 | "Can't scale %dMHz in to <=13.5MHz\n", | ||
| 1409 | Fref); | ||
| 1410 | return -EINVAL; | 1453 | return -EINVAL; |
| 1454 | } | ||
| 1455 | |||
| 1456 | /* Find an appropriate FLL_FRATIO */ | ||
| 1457 | init_ratio = arizona_find_fratio(Fref, &cfg->fratio); | ||
| 1458 | if (init_ratio < 0) { | ||
| 1459 | arizona_fll_err(fll, "Unable to find FRATIO for Fref=%uHz\n", | ||
| 1460 | Fref); | ||
| 1461 | return init_ratio; | ||
| 1462 | } | ||
| 1463 | |||
| 1464 | switch (fll->arizona->type) { | ||
| 1465 | case WM5110: | ||
| 1466 | if (fll->arizona->rev < 3 || sync) | ||
| 1467 | return init_ratio; | ||
| 1468 | break; | ||
| 1469 | default: | ||
| 1470 | return init_ratio; | ||
| 1471 | } | ||
| 1472 | |||
| 1473 | cfg->fratio = init_ratio - 1; | ||
| 1474 | |||
| 1475 | /* Adjust FRATIO/refdiv to avoid integer mode if possible */ | ||
| 1476 | refdiv = cfg->refdiv; | ||
| 1477 | |||
| 1478 | while (div <= ARIZONA_FLL_MAX_REFDIV) { | ||
| 1479 | for (ratio = init_ratio; ratio <= ARIZONA_FLL_MAX_FRATIO; | ||
| 1480 | ratio++) { | ||
| 1481 | if (target % (ratio * Fref)) { | ||
| 1482 | cfg->refdiv = refdiv; | ||
| 1483 | cfg->fratio = ratio - 1; | ||
| 1484 | return ratio; | ||
| 1485 | } | ||
| 1411 | } | 1486 | } |
| 1487 | |||
| 1488 | for (ratio = init_ratio - 1; ratio >= 0; ratio--) { | ||
| 1489 | if (ARIZONA_FLL_VCO_CORNER / (fll->vco_mult * ratio) < | ||
| 1490 | Fref) | ||
| 1491 | break; | ||
| 1492 | |||
| 1493 | if (target % (ratio * Fref)) { | ||
| 1494 | cfg->refdiv = refdiv; | ||
| 1495 | cfg->fratio = ratio - 1; | ||
| 1496 | return ratio; | ||
| 1497 | } | ||
| 1498 | } | ||
| 1499 | |||
| 1500 | div *= 2; | ||
| 1501 | Fref /= 2; | ||
| 1502 | refdiv++; | ||
| 1503 | init_ratio = arizona_find_fratio(Fref, NULL); | ||
| 1412 | } | 1504 | } |
| 1413 | 1505 | ||
| 1414 | /* Apply the division for our remaining calculations */ | 1506 | arizona_fll_warn(fll, "Falling back to integer mode operation\n"); |
| 1415 | Fref /= div; | 1507 | return cfg->fratio + 1; |
| 1508 | } | ||
| 1509 | |||
| 1510 | static int arizona_calc_fll(struct arizona_fll *fll, | ||
| 1511 | struct arizona_fll_cfg *cfg, | ||
| 1512 | unsigned int Fref, bool sync) | ||
| 1513 | { | ||
| 1514 | unsigned int target, div, gcd_fll; | ||
| 1515 | int i, ratio; | ||
| 1516 | |||
| 1517 | arizona_fll_dbg(fll, "Fref=%u Fout=%u\n", Fref, fll->fout); | ||
| 1416 | 1518 | ||
| 1417 | /* Fvco should be over the targt; don't check the upper bound */ | 1519 | /* Fvco should be over the targt; don't check the upper bound */ |
| 1418 | div = 1; | 1520 | div = ARIZONA_FLL_MIN_OUTDIV; |
| 1419 | while (Fout * div < 90000000 * fll->vco_mult) { | 1521 | while (fll->fout * div < ARIZONA_FLL_MIN_FVCO * fll->vco_mult) { |
| 1420 | div++; | 1522 | div++; |
| 1421 | if (div > 7) { | 1523 | if (div > ARIZONA_FLL_MAX_OUTDIV) |
| 1422 | arizona_fll_err(fll, "No FLL_OUTDIV for Fout=%uHz\n", | ||
| 1423 | Fout); | ||
| 1424 | return -EINVAL; | 1524 | return -EINVAL; |
| 1425 | } | ||
| 1426 | } | 1525 | } |
| 1427 | target = Fout * div / fll->vco_mult; | 1526 | target = fll->fout * div / fll->vco_mult; |
| 1428 | cfg->outdiv = div; | 1527 | cfg->outdiv = div; |
| 1429 | 1528 | ||
| 1430 | arizona_fll_dbg(fll, "Fvco=%dHz\n", target); | 1529 | arizona_fll_dbg(fll, "Fvco=%dHz\n", target); |
| 1431 | 1530 | ||
| 1432 | /* Find an appropraite FLL_FRATIO and factor it out of the target */ | 1531 | /* Find an appropriate FLL_FRATIO and refdiv */ |
| 1433 | for (i = 0; i < ARRAY_SIZE(fll_fratios); i++) { | 1532 | ratio = arizona_calc_fratio(fll, cfg, target, Fref, sync); |
| 1434 | if (fll_fratios[i].min <= Fref && Fref <= fll_fratios[i].max) { | 1533 | if (ratio < 0) |
| 1435 | cfg->fratio = fll_fratios[i].fratio; | 1534 | return ratio; |
| 1436 | ratio = fll_fratios[i].ratio; | ||
| 1437 | break; | ||
| 1438 | } | ||
| 1439 | } | ||
| 1440 | if (i == ARRAY_SIZE(fll_fratios)) { | ||
| 1441 | arizona_fll_err(fll, "Unable to find FRATIO for Fref=%uHz\n", | ||
| 1442 | Fref); | ||
| 1443 | return -EINVAL; | ||
| 1444 | } | ||
| 1445 | 1535 | ||
| 1446 | for (i = 0; i < ARRAY_SIZE(fll_gains); i++) { | 1536 | /* Apply the division for our remaining calculations */ |
| 1447 | if (fll_gains[i].min <= Fref && Fref <= fll_gains[i].max) { | 1537 | Fref = Fref / (1 << cfg->refdiv); |
| 1448 | cfg->gain = fll_gains[i].gain; | ||
| 1449 | break; | ||
| 1450 | } | ||
| 1451 | } | ||
| 1452 | if (i == ARRAY_SIZE(fll_gains)) { | ||
| 1453 | arizona_fll_err(fll, "Unable to find gain for Fref=%uHz\n", | ||
| 1454 | Fref); | ||
| 1455 | return -EINVAL; | ||
| 1456 | } | ||
| 1457 | 1538 | ||
| 1458 | cfg->n = target / (ratio * Fref); | 1539 | cfg->n = target / (ratio * Fref); |
| 1459 | 1540 | ||
| @@ -1478,6 +1559,18 @@ static int arizona_calc_fll(struct arizona_fll *fll, | |||
| 1478 | cfg->lambda >>= 1; | 1559 | cfg->lambda >>= 1; |
| 1479 | } | 1560 | } |
| 1480 | 1561 | ||
| 1562 | for (i = 0; i < ARRAY_SIZE(fll_gains); i++) { | ||
| 1563 | if (fll_gains[i].min <= Fref && Fref <= fll_gains[i].max) { | ||
| 1564 | cfg->gain = fll_gains[i].gain; | ||
| 1565 | break; | ||
| 1566 | } | ||
| 1567 | } | ||
| 1568 | if (i == ARRAY_SIZE(fll_gains)) { | ||
| 1569 | arizona_fll_err(fll, "Unable to find gain for Fref=%uHz\n", | ||
| 1570 | Fref); | ||
| 1571 | return -EINVAL; | ||
| 1572 | } | ||
| 1573 | |||
| 1481 | arizona_fll_dbg(fll, "N=%x THETA=%x LAMBDA=%x\n", | 1574 | arizona_fll_dbg(fll, "N=%x THETA=%x LAMBDA=%x\n", |
| 1482 | cfg->n, cfg->theta, cfg->lambda); | 1575 | cfg->n, cfg->theta, cfg->lambda); |
| 1483 | arizona_fll_dbg(fll, "FRATIO=%x(%d) OUTDIV=%x REFCLK_DIV=%x\n", | 1576 | arizona_fll_dbg(fll, "FRATIO=%x(%d) OUTDIV=%x REFCLK_DIV=%x\n", |
| @@ -1505,14 +1598,18 @@ static void arizona_apply_fll(struct arizona *arizona, unsigned int base, | |||
| 1505 | cfg->refdiv << ARIZONA_FLL1_CLK_REF_DIV_SHIFT | | 1598 | cfg->refdiv << ARIZONA_FLL1_CLK_REF_DIV_SHIFT | |
| 1506 | source << ARIZONA_FLL1_CLK_REF_SRC_SHIFT); | 1599 | source << ARIZONA_FLL1_CLK_REF_SRC_SHIFT); |
| 1507 | 1600 | ||
| 1508 | if (sync) | 1601 | if (sync) { |
| 1509 | regmap_update_bits_async(arizona->regmap, base + 0x7, | 1602 | regmap_update_bits(arizona->regmap, base + 0x7, |
| 1510 | ARIZONA_FLL1_GAIN_MASK, | 1603 | ARIZONA_FLL1_GAIN_MASK, |
| 1511 | cfg->gain << ARIZONA_FLL1_GAIN_SHIFT); | 1604 | cfg->gain << ARIZONA_FLL1_GAIN_SHIFT); |
| 1512 | else | 1605 | } else { |
| 1513 | regmap_update_bits_async(arizona->regmap, base + 0x9, | 1606 | regmap_update_bits(arizona->regmap, base + 0x5, |
| 1514 | ARIZONA_FLL1_GAIN_MASK, | 1607 | ARIZONA_FLL1_OUTDIV_MASK, |
| 1515 | cfg->gain << ARIZONA_FLL1_GAIN_SHIFT); | 1608 | cfg->outdiv << ARIZONA_FLL1_OUTDIV_SHIFT); |
| 1609 | regmap_update_bits(arizona->regmap, base + 0x9, | ||
| 1610 | ARIZONA_FLL1_GAIN_MASK, | ||
| 1611 | cfg->gain << ARIZONA_FLL1_GAIN_SHIFT); | ||
| 1612 | } | ||
| 1516 | 1613 | ||
| 1517 | regmap_update_bits_async(arizona->regmap, base + 2, | 1614 | regmap_update_bits_async(arizona->regmap, base + 2, |
| 1518 | ARIZONA_FLL1_CTRL_UPD | ARIZONA_FLL1_N_MASK, | 1615 | ARIZONA_FLL1_CTRL_UPD | ARIZONA_FLL1_N_MASK, |
| @@ -1535,13 +1632,12 @@ static bool arizona_is_enabled_fll(struct arizona_fll *fll) | |||
| 1535 | return reg & ARIZONA_FLL1_ENA; | 1632 | return reg & ARIZONA_FLL1_ENA; |
| 1536 | } | 1633 | } |
| 1537 | 1634 | ||
| 1538 | static void arizona_enable_fll(struct arizona_fll *fll, | 1635 | static void arizona_enable_fll(struct arizona_fll *fll) |
| 1539 | struct arizona_fll_cfg *ref, | ||
| 1540 | struct arizona_fll_cfg *sync) | ||
| 1541 | { | 1636 | { |
| 1542 | struct arizona *arizona = fll->arizona; | 1637 | struct arizona *arizona = fll->arizona; |
| 1543 | int ret; | 1638 | int ret; |
| 1544 | bool use_sync = false; | 1639 | bool use_sync = false; |
| 1640 | struct arizona_fll_cfg cfg; | ||
| 1545 | 1641 | ||
| 1546 | /* | 1642 | /* |
| 1547 | * If we have both REFCLK and SYNCCLK then enable both, | 1643 | * If we have both REFCLK and SYNCCLK then enable both, |
| @@ -1549,23 +1645,21 @@ static void arizona_enable_fll(struct arizona_fll *fll, | |||
| 1549 | */ | 1645 | */ |
| 1550 | if (fll->ref_src >= 0 && fll->ref_freq && | 1646 | if (fll->ref_src >= 0 && fll->ref_freq && |
| 1551 | fll->ref_src != fll->sync_src) { | 1647 | fll->ref_src != fll->sync_src) { |
| 1552 | regmap_update_bits_async(arizona->regmap, fll->base + 5, | 1648 | arizona_calc_fll(fll, &cfg, fll->ref_freq, false); |
| 1553 | ARIZONA_FLL1_OUTDIV_MASK, | ||
| 1554 | ref->outdiv << ARIZONA_FLL1_OUTDIV_SHIFT); | ||
| 1555 | 1649 | ||
| 1556 | arizona_apply_fll(arizona, fll->base, ref, fll->ref_src, | 1650 | arizona_apply_fll(arizona, fll->base, &cfg, fll->ref_src, |
| 1557 | false); | 1651 | false); |
| 1558 | if (fll->sync_src >= 0) { | 1652 | if (fll->sync_src >= 0) { |
| 1559 | arizona_apply_fll(arizona, fll->base + 0x10, sync, | 1653 | arizona_calc_fll(fll, &cfg, fll->sync_freq, true); |
| 1654 | |||
| 1655 | arizona_apply_fll(arizona, fll->base + 0x10, &cfg, | ||
| 1560 | fll->sync_src, true); | 1656 | fll->sync_src, true); |
| 1561 | use_sync = true; | 1657 | use_sync = true; |
| 1562 | } | 1658 | } |
| 1563 | } else if (fll->sync_src >= 0) { | 1659 | } else if (fll->sync_src >= 0) { |
| 1564 | regmap_update_bits_async(arizona->regmap, fll->base + 5, | 1660 | arizona_calc_fll(fll, &cfg, fll->sync_freq, false); |
| 1565 | ARIZONA_FLL1_OUTDIV_MASK, | ||
| 1566 | sync->outdiv << ARIZONA_FLL1_OUTDIV_SHIFT); | ||
| 1567 | 1661 | ||
| 1568 | arizona_apply_fll(arizona, fll->base, sync, | 1662 | arizona_apply_fll(arizona, fll->base, &cfg, |
| 1569 | fll->sync_src, false); | 1663 | fll->sync_src, false); |
| 1570 | 1664 | ||
| 1571 | regmap_update_bits_async(arizona->regmap, fll->base + 0x11, | 1665 | regmap_update_bits_async(arizona->regmap, fll->base + 0x11, |
| @@ -1627,32 +1721,22 @@ static void arizona_disable_fll(struct arizona_fll *fll) | |||
| 1627 | int arizona_set_fll_refclk(struct arizona_fll *fll, int source, | 1721 | int arizona_set_fll_refclk(struct arizona_fll *fll, int source, |
| 1628 | unsigned int Fref, unsigned int Fout) | 1722 | unsigned int Fref, unsigned int Fout) |
| 1629 | { | 1723 | { |
| 1630 | struct arizona_fll_cfg ref, sync; | ||
| 1631 | int ret; | 1724 | int ret; |
| 1632 | 1725 | ||
| 1633 | if (fll->ref_src == source && fll->ref_freq == Fref) | 1726 | if (fll->ref_src == source && fll->ref_freq == Fref) |
| 1634 | return 0; | 1727 | return 0; |
| 1635 | 1728 | ||
| 1636 | if (fll->fout) { | 1729 | if (fll->fout && Fref > 0) { |
| 1637 | if (Fref > 0) { | 1730 | ret = arizona_validate_fll(fll, Fref, fll->fout); |
| 1638 | ret = arizona_calc_fll(fll, &ref, Fref, fll->fout); | 1731 | if (ret != 0) |
| 1639 | if (ret != 0) | 1732 | return ret; |
| 1640 | return ret; | ||
| 1641 | } | ||
| 1642 | |||
| 1643 | if (fll->sync_src >= 0) { | ||
| 1644 | ret = arizona_calc_fll(fll, &sync, fll->sync_freq, | ||
| 1645 | fll->fout); | ||
| 1646 | if (ret != 0) | ||
| 1647 | return ret; | ||
| 1648 | } | ||
| 1649 | } | 1733 | } |
| 1650 | 1734 | ||
| 1651 | fll->ref_src = source; | 1735 | fll->ref_src = source; |
| 1652 | fll->ref_freq = Fref; | 1736 | fll->ref_freq = Fref; |
| 1653 | 1737 | ||
| 1654 | if (fll->fout && Fref > 0) { | 1738 | if (fll->fout && Fref > 0) { |
| 1655 | arizona_enable_fll(fll, &ref, &sync); | 1739 | arizona_enable_fll(fll); |
| 1656 | } | 1740 | } |
| 1657 | 1741 | ||
| 1658 | return 0; | 1742 | return 0; |
| @@ -1662,7 +1746,6 @@ EXPORT_SYMBOL_GPL(arizona_set_fll_refclk); | |||
| 1662 | int arizona_set_fll(struct arizona_fll *fll, int source, | 1746 | int arizona_set_fll(struct arizona_fll *fll, int source, |
| 1663 | unsigned int Fref, unsigned int Fout) | 1747 | unsigned int Fref, unsigned int Fout) |
| 1664 | { | 1748 | { |
| 1665 | struct arizona_fll_cfg ref, sync; | ||
| 1666 | int ret; | 1749 | int ret; |
| 1667 | 1750 | ||
| 1668 | if (fll->sync_src == source && | 1751 | if (fll->sync_src == source && |
| @@ -1671,13 +1754,12 @@ int arizona_set_fll(struct arizona_fll *fll, int source, | |||
| 1671 | 1754 | ||
| 1672 | if (Fout) { | 1755 | if (Fout) { |
| 1673 | if (fll->ref_src >= 0) { | 1756 | if (fll->ref_src >= 0) { |
| 1674 | ret = arizona_calc_fll(fll, &ref, fll->ref_freq, | 1757 | ret = arizona_validate_fll(fll, fll->ref_freq, Fout); |
| 1675 | Fout); | ||
| 1676 | if (ret != 0) | 1758 | if (ret != 0) |
| 1677 | return ret; | 1759 | return ret; |
| 1678 | } | 1760 | } |
| 1679 | 1761 | ||
| 1680 | ret = arizona_calc_fll(fll, &sync, Fref, Fout); | 1762 | ret = arizona_validate_fll(fll, Fref, Fout); |
| 1681 | if (ret != 0) | 1763 | if (ret != 0) |
| 1682 | return ret; | 1764 | return ret; |
| 1683 | } | 1765 | } |
| @@ -1687,7 +1769,7 @@ int arizona_set_fll(struct arizona_fll *fll, int source, | |||
| 1687 | fll->fout = Fout; | 1769 | fll->fout = Fout; |
| 1688 | 1770 | ||
| 1689 | if (Fout) { | 1771 | if (Fout) { |
| 1690 | arizona_enable_fll(fll, &ref, &sync); | 1772 | arizona_enable_fll(fll); |
| 1691 | } else { | 1773 | } else { |
| 1692 | arizona_disable_fll(fll); | 1774 | arizona_disable_fll(fll); |
| 1693 | } | 1775 | } |
diff --git a/sound/soc/codecs/cs4271.c b/sound/soc/codecs/cs4271.c index ce05fd93dc74..aef4965750c7 100644 --- a/sound/soc/codecs/cs4271.c +++ b/sound/soc/codecs/cs4271.c | |||
| @@ -159,7 +159,6 @@ static bool cs4271_volatile_reg(struct device *dev, unsigned int reg) | |||
| 159 | } | 159 | } |
| 160 | 160 | ||
| 161 | struct cs4271_private { | 161 | struct cs4271_private { |
| 162 | /* SND_SOC_I2C or SND_SOC_SPI */ | ||
| 163 | unsigned int mclk; | 162 | unsigned int mclk; |
| 164 | bool master; | 163 | bool master; |
| 165 | bool deemph; | 164 | bool deemph; |
| @@ -540,14 +539,10 @@ static int cs4271_probe(struct snd_soc_codec *codec) | |||
| 540 | struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec); | 539 | struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec); |
| 541 | struct cs4271_platform_data *cs4271plat = codec->dev->platform_data; | 540 | struct cs4271_platform_data *cs4271plat = codec->dev->platform_data; |
| 542 | int ret; | 541 | int ret; |
| 543 | int gpio_nreset = -EINVAL; | ||
| 544 | bool amutec_eq_bmutec = false; | 542 | bool amutec_eq_bmutec = false; |
| 545 | 543 | ||
| 546 | #ifdef CONFIG_OF | 544 | #ifdef CONFIG_OF |
| 547 | if (of_match_device(cs4271_dt_ids, codec->dev)) { | 545 | if (of_match_device(cs4271_dt_ids, codec->dev)) { |
| 548 | gpio_nreset = of_get_named_gpio(codec->dev->of_node, | ||
| 549 | "reset-gpio", 0); | ||
| 550 | |||
| 551 | if (of_get_property(codec->dev->of_node, | 546 | if (of_get_property(codec->dev->of_node, |
| 552 | "cirrus,amutec-eq-bmutec", NULL)) | 547 | "cirrus,amutec-eq-bmutec", NULL)) |
| 553 | amutec_eq_bmutec = true; | 548 | amutec_eq_bmutec = true; |
| @@ -559,27 +554,19 @@ static int cs4271_probe(struct snd_soc_codec *codec) | |||
| 559 | #endif | 554 | #endif |
| 560 | 555 | ||
| 561 | if (cs4271plat) { | 556 | if (cs4271plat) { |
| 562 | if (gpio_is_valid(cs4271plat->gpio_nreset)) | ||
| 563 | gpio_nreset = cs4271plat->gpio_nreset; | ||
| 564 | |||
| 565 | amutec_eq_bmutec = cs4271plat->amutec_eq_bmutec; | 557 | amutec_eq_bmutec = cs4271plat->amutec_eq_bmutec; |
| 566 | cs4271->enable_soft_reset = cs4271plat->enable_soft_reset; | 558 | cs4271->enable_soft_reset = cs4271plat->enable_soft_reset; |
| 567 | } | 559 | } |
| 568 | 560 | ||
| 569 | if (gpio_nreset >= 0) | 561 | if (gpio_is_valid(cs4271->gpio_nreset)) { |
| 570 | if (devm_gpio_request(codec->dev, gpio_nreset, "CS4271 Reset")) | ||
| 571 | gpio_nreset = -EINVAL; | ||
| 572 | if (gpio_nreset >= 0) { | ||
| 573 | /* Reset codec */ | 562 | /* Reset codec */ |
| 574 | gpio_direction_output(gpio_nreset, 0); | 563 | gpio_direction_output(cs4271->gpio_nreset, 0); |
| 575 | udelay(1); | 564 | udelay(1); |
| 576 | gpio_set_value(gpio_nreset, 1); | 565 | gpio_set_value(cs4271->gpio_nreset, 1); |
| 577 | /* Give the codec time to wake up */ | 566 | /* Give the codec time to wake up */ |
| 578 | udelay(1); | 567 | udelay(1); |
| 579 | } | 568 | } |
| 580 | 569 | ||
| 581 | cs4271->gpio_nreset = gpio_nreset; | ||
| 582 | |||
| 583 | ret = regmap_update_bits(cs4271->regmap, CS4271_MODE2, | 570 | ret = regmap_update_bits(cs4271->regmap, CS4271_MODE2, |
| 584 | CS4271_MODE2_PDN | CS4271_MODE2_CPEN, | 571 | CS4271_MODE2_PDN | CS4271_MODE2_CPEN, |
| 585 | CS4271_MODE2_PDN | CS4271_MODE2_CPEN); | 572 | CS4271_MODE2_PDN | CS4271_MODE2_CPEN); |
| @@ -625,6 +612,36 @@ static struct snd_soc_codec_driver soc_codec_dev_cs4271 = { | |||
| 625 | .num_dapm_routes = ARRAY_SIZE(cs4271_dapm_routes), | 612 | .num_dapm_routes = ARRAY_SIZE(cs4271_dapm_routes), |
| 626 | }; | 613 | }; |
| 627 | 614 | ||
| 615 | static int cs4271_common_probe(struct device *dev, | ||
| 616 | struct cs4271_private **c) | ||
| 617 | { | ||
| 618 | struct cs4271_platform_data *cs4271plat = dev->platform_data; | ||
| 619 | struct cs4271_private *cs4271; | ||
| 620 | |||
| 621 | cs4271 = devm_kzalloc(dev, sizeof(*cs4271), GFP_KERNEL); | ||
| 622 | if (!cs4271) | ||
| 623 | return -ENOMEM; | ||
| 624 | |||
| 625 | if (of_match_device(cs4271_dt_ids, dev)) | ||
| 626 | cs4271->gpio_nreset = | ||
| 627 | of_get_named_gpio(dev->of_node, "reset-gpio", 0); | ||
| 628 | |||
| 629 | if (cs4271plat) | ||
| 630 | cs4271->gpio_nreset = cs4271plat->gpio_nreset; | ||
| 631 | |||
| 632 | if (gpio_is_valid(cs4271->gpio_nreset)) { | ||
| 633 | int ret; | ||
| 634 | |||
| 635 | ret = devm_gpio_request(dev, cs4271->gpio_nreset, | ||
| 636 | "CS4271 Reset"); | ||
| 637 | if (ret < 0) | ||
| 638 | return ret; | ||
| 639 | } | ||
| 640 | |||
| 641 | *c = cs4271; | ||
| 642 | return 0; | ||
| 643 | } | ||
| 644 | |||
| 628 | #if defined(CONFIG_SPI_MASTER) | 645 | #if defined(CONFIG_SPI_MASTER) |
| 629 | 646 | ||
| 630 | static const struct regmap_config cs4271_spi_regmap = { | 647 | static const struct regmap_config cs4271_spi_regmap = { |
| @@ -644,10 +661,11 @@ static const struct regmap_config cs4271_spi_regmap = { | |||
| 644 | static int cs4271_spi_probe(struct spi_device *spi) | 661 | static int cs4271_spi_probe(struct spi_device *spi) |
| 645 | { | 662 | { |
| 646 | struct cs4271_private *cs4271; | 663 | struct cs4271_private *cs4271; |
| 664 | int ret; | ||
| 647 | 665 | ||
| 648 | cs4271 = devm_kzalloc(&spi->dev, sizeof(*cs4271), GFP_KERNEL); | 666 | ret = cs4271_common_probe(&spi->dev, &cs4271); |
| 649 | if (!cs4271) | 667 | if (ret < 0) |
| 650 | return -ENOMEM; | 668 | return ret; |
| 651 | 669 | ||
| 652 | spi_set_drvdata(spi, cs4271); | 670 | spi_set_drvdata(spi, cs4271); |
| 653 | cs4271->regmap = devm_regmap_init_spi(spi, &cs4271_spi_regmap); | 671 | cs4271->regmap = devm_regmap_init_spi(spi, &cs4271_spi_regmap); |
| @@ -698,10 +716,11 @@ static int cs4271_i2c_probe(struct i2c_client *client, | |||
| 698 | const struct i2c_device_id *id) | 716 | const struct i2c_device_id *id) |
| 699 | { | 717 | { |
| 700 | struct cs4271_private *cs4271; | 718 | struct cs4271_private *cs4271; |
| 719 | int ret; | ||
| 701 | 720 | ||
| 702 | cs4271 = devm_kzalloc(&client->dev, sizeof(*cs4271), GFP_KERNEL); | 721 | ret = cs4271_common_probe(&client->dev, &cs4271); |
| 703 | if (!cs4271) | 722 | if (ret < 0) |
| 704 | return -ENOMEM; | 723 | return ret; |
| 705 | 724 | ||
| 706 | i2c_set_clientdata(client, cs4271); | 725 | i2c_set_clientdata(client, cs4271); |
| 707 | cs4271->regmap = devm_regmap_init_i2c(client, &cs4271_i2c_regmap); | 726 | cs4271->regmap = devm_regmap_init_i2c(client, &cs4271_i2c_regmap); |
diff --git a/sound/soc/codecs/cs42l51.c b/sound/soc/codecs/cs42l51.c index 6e9ea8379a91..3eab46020a30 100644 --- a/sound/soc/codecs/cs42l51.c +++ b/sound/soc/codecs/cs42l51.c | |||
| @@ -30,6 +30,7 @@ | |||
| 30 | #include <sound/pcm_params.h> | 30 | #include <sound/pcm_params.h> |
| 31 | #include <sound/pcm.h> | 31 | #include <sound/pcm.h> |
| 32 | #include <linux/i2c.h> | 32 | #include <linux/i2c.h> |
| 33 | #include <linux/regmap.h> | ||
| 33 | 34 | ||
| 34 | #include "cs42l51.h" | 35 | #include "cs42l51.h" |
| 35 | 36 | ||
| @@ -40,7 +41,6 @@ enum master_slave_mode { | |||
| 40 | }; | 41 | }; |
| 41 | 42 | ||
| 42 | struct cs42l51_private { | 43 | struct cs42l51_private { |
| 43 | enum snd_soc_control_type control_type; | ||
| 44 | unsigned int mclk; | 44 | unsigned int mclk; |
| 45 | unsigned int audio_mode; /* The mode (I2S or left-justified) */ | 45 | unsigned int audio_mode; /* The mode (I2S or left-justified) */ |
| 46 | enum master_slave_mode func; | 46 | enum master_slave_mode func; |
| @@ -52,24 +52,6 @@ struct cs42l51_private { | |||
| 52 | SNDRV_PCM_FMTBIT_S20_3LE | SNDRV_PCM_FMTBIT_S20_3BE | \ | 52 | SNDRV_PCM_FMTBIT_S20_3LE | SNDRV_PCM_FMTBIT_S20_3BE | \ |
| 53 | SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S24_BE) | 53 | SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S24_BE) |
| 54 | 54 | ||
| 55 | static int cs42l51_fill_cache(struct snd_soc_codec *codec) | ||
| 56 | { | ||
| 57 | u8 *cache = codec->reg_cache + 1; | ||
| 58 | struct i2c_client *i2c_client = to_i2c_client(codec->dev); | ||
| 59 | s32 length; | ||
| 60 | |||
| 61 | length = i2c_smbus_read_i2c_block_data(i2c_client, | ||
| 62 | CS42L51_FIRSTREG | 0x80, CS42L51_NUMREGS, cache); | ||
| 63 | if (length != CS42L51_NUMREGS) { | ||
| 64 | dev_err(&i2c_client->dev, | ||
| 65 | "I2C read failure, addr=0x%x (ret=%d vs %d)\n", | ||
| 66 | i2c_client->addr, length, CS42L51_NUMREGS); | ||
| 67 | return -EIO; | ||
| 68 | } | ||
| 69 | |||
| 70 | return 0; | ||
| 71 | } | ||
| 72 | |||
| 73 | static int cs42l51_get_chan_mix(struct snd_kcontrol *kcontrol, | 55 | static int cs42l51_get_chan_mix(struct snd_kcontrol *kcontrol, |
| 74 | struct snd_ctl_elem_value *ucontrol) | 56 | struct snd_ctl_elem_value *ucontrol) |
| 75 | { | 57 | { |
| @@ -505,16 +487,9 @@ static struct snd_soc_dai_driver cs42l51_dai = { | |||
| 505 | 487 | ||
| 506 | static int cs42l51_probe(struct snd_soc_codec *codec) | 488 | static int cs42l51_probe(struct snd_soc_codec *codec) |
| 507 | { | 489 | { |
| 508 | struct cs42l51_private *cs42l51 = snd_soc_codec_get_drvdata(codec); | ||
| 509 | int ret, reg; | 490 | int ret, reg; |
| 510 | 491 | ||
| 511 | ret = cs42l51_fill_cache(codec); | 492 | ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_REGMAP); |
| 512 | if (ret < 0) { | ||
| 513 | dev_err(codec->dev, "failed to fill register cache\n"); | ||
| 514 | return ret; | ||
| 515 | } | ||
| 516 | |||
| 517 | ret = snd_soc_codec_set_cache_io(codec, 8, 8, cs42l51->control_type); | ||
| 518 | if (ret < 0) { | 493 | if (ret < 0) { |
| 519 | dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret); | 494 | dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret); |
| 520 | return ret; | 495 | return ret; |
| @@ -538,8 +513,6 @@ static int cs42l51_probe(struct snd_soc_codec *codec) | |||
| 538 | 513 | ||
| 539 | static struct snd_soc_codec_driver soc_codec_device_cs42l51 = { | 514 | static struct snd_soc_codec_driver soc_codec_device_cs42l51 = { |
| 540 | .probe = cs42l51_probe, | 515 | .probe = cs42l51_probe, |
| 541 | .reg_cache_size = CS42L51_NUMREGS + 1, | ||
| 542 | .reg_word_size = sizeof(u8), | ||
| 543 | 516 | ||
| 544 | .controls = cs42l51_snd_controls, | 517 | .controls = cs42l51_snd_controls, |
| 545 | .num_controls = ARRAY_SIZE(cs42l51_snd_controls), | 518 | .num_controls = ARRAY_SIZE(cs42l51_snd_controls), |
| @@ -549,38 +522,53 @@ static struct snd_soc_codec_driver soc_codec_device_cs42l51 = { | |||
| 549 | .num_dapm_routes = ARRAY_SIZE(cs42l51_routes), | 522 | .num_dapm_routes = ARRAY_SIZE(cs42l51_routes), |
| 550 | }; | 523 | }; |
| 551 | 524 | ||
| 525 | static const struct regmap_config cs42l51_regmap = { | ||
| 526 | .reg_bits = 8, | ||
| 527 | .val_bits = 8, | ||
| 528 | |||
| 529 | .max_register = CS42L51_CHARGE_FREQ, | ||
| 530 | .cache_type = REGCACHE_RBTREE, | ||
| 531 | }; | ||
| 532 | |||
| 552 | static int cs42l51_i2c_probe(struct i2c_client *i2c_client, | 533 | static int cs42l51_i2c_probe(struct i2c_client *i2c_client, |
| 553 | const struct i2c_device_id *id) | 534 | const struct i2c_device_id *id) |
| 554 | { | 535 | { |
| 555 | struct cs42l51_private *cs42l51; | 536 | struct cs42l51_private *cs42l51; |
| 537 | struct regmap *regmap; | ||
| 538 | unsigned int val; | ||
| 556 | int ret; | 539 | int ret; |
| 557 | 540 | ||
| 541 | regmap = devm_regmap_init_i2c(i2c_client, &cs42l51_regmap); | ||
| 542 | if (IS_ERR(regmap)) { | ||
| 543 | ret = PTR_ERR(regmap); | ||
| 544 | dev_err(&i2c_client->dev, "Failed to create regmap: %d\n", | ||
| 545 | ret); | ||
| 546 | return ret; | ||
| 547 | } | ||
| 548 | |||
| 558 | /* Verify that we have a CS42L51 */ | 549 | /* Verify that we have a CS42L51 */ |
| 559 | ret = i2c_smbus_read_byte_data(i2c_client, CS42L51_CHIP_REV_ID); | 550 | ret = regmap_read(regmap, CS42L51_CHIP_REV_ID, &val); |
| 560 | if (ret < 0) { | 551 | if (ret < 0) { |
| 561 | dev_err(&i2c_client->dev, "failed to read I2C\n"); | 552 | dev_err(&i2c_client->dev, "failed to read I2C\n"); |
| 562 | goto error; | 553 | goto error; |
| 563 | } | 554 | } |
| 564 | 555 | ||
| 565 | if ((ret != CS42L51_MK_CHIP_REV(CS42L51_CHIP_ID, CS42L51_CHIP_REV_A)) && | 556 | if ((val != CS42L51_MK_CHIP_REV(CS42L51_CHIP_ID, CS42L51_CHIP_REV_A)) && |
| 566 | (ret != CS42L51_MK_CHIP_REV(CS42L51_CHIP_ID, CS42L51_CHIP_REV_B))) { | 557 | (val != CS42L51_MK_CHIP_REV(CS42L51_CHIP_ID, CS42L51_CHIP_REV_B))) { |
| 567 | dev_err(&i2c_client->dev, "Invalid chip id\n"); | 558 | dev_err(&i2c_client->dev, "Invalid chip id: %x\n", val); |
| 568 | ret = -ENODEV; | 559 | ret = -ENODEV; |
| 569 | goto error; | 560 | goto error; |
| 570 | } | 561 | } |
| 571 | 562 | ||
| 572 | dev_info(&i2c_client->dev, "found device cs42l51 rev %d\n", | 563 | dev_info(&i2c_client->dev, "found device cs42l51 rev %d\n", |
| 573 | ret & 7); | 564 | val & 7); |
| 574 | 565 | ||
| 575 | cs42l51 = devm_kzalloc(&i2c_client->dev, sizeof(struct cs42l51_private), | 566 | cs42l51 = devm_kzalloc(&i2c_client->dev, sizeof(struct cs42l51_private), |
| 576 | GFP_KERNEL); | 567 | GFP_KERNEL); |
| 577 | if (!cs42l51) { | 568 | if (!cs42l51) |
| 578 | dev_err(&i2c_client->dev, "could not allocate codec\n"); | ||
| 579 | return -ENOMEM; | 569 | return -ENOMEM; |
| 580 | } | ||
| 581 | 570 | ||
| 582 | i2c_set_clientdata(i2c_client, cs42l51); | 571 | i2c_set_clientdata(i2c_client, cs42l51); |
| 583 | cs42l51->control_type = SND_SOC_I2C; | ||
| 584 | 572 | ||
| 585 | ret = snd_soc_register_codec(&i2c_client->dev, | 573 | ret = snd_soc_register_codec(&i2c_client->dev, |
| 586 | &soc_codec_device_cs42l51, &cs42l51_dai, 1); | 574 | &soc_codec_device_cs42l51, &cs42l51_dai, 1); |
| @@ -600,10 +588,17 @@ static const struct i2c_device_id cs42l51_id[] = { | |||
| 600 | }; | 588 | }; |
| 601 | MODULE_DEVICE_TABLE(i2c, cs42l51_id); | 589 | MODULE_DEVICE_TABLE(i2c, cs42l51_id); |
| 602 | 590 | ||
| 591 | static const struct of_device_id cs42l51_of_match[] = { | ||
| 592 | { .compatible = "cirrus,cs42l51", }, | ||
| 593 | { } | ||
| 594 | }; | ||
| 595 | MODULE_DEVICE_TABLE(of, cs42l51_of_match); | ||
| 596 | |||
| 603 | static struct i2c_driver cs42l51_i2c_driver = { | 597 | static struct i2c_driver cs42l51_i2c_driver = { |
| 604 | .driver = { | 598 | .driver = { |
| 605 | .name = "cs42l51-codec", | 599 | .name = "cs42l51-codec", |
| 606 | .owner = THIS_MODULE, | 600 | .owner = THIS_MODULE, |
| 601 | .of_match_table = cs42l51_of_match, | ||
| 607 | }, | 602 | }, |
| 608 | .id_table = cs42l51_id, | 603 | .id_table = cs42l51_id, |
| 609 | .probe = cs42l51_i2c_probe, | 604 | .probe = cs42l51_i2c_probe, |
diff --git a/sound/soc/codecs/cs42l52.c b/sound/soc/codecs/cs42l52.c index 0bac6d5a4ac8..be455ea5f2fe 100644 --- a/sound/soc/codecs/cs42l52.c +++ b/sound/soc/codecs/cs42l52.c | |||
| @@ -210,13 +210,11 @@ static const char * const cs42l52_adca_text[] = { | |||
| 210 | static const char * const cs42l52_adcb_text[] = { | 210 | static const char * const cs42l52_adcb_text[] = { |
| 211 | "Input1B", "Input2B", "Input3B", "Input4B", "PGA Input Right"}; | 211 | "Input1B", "Input2B", "Input3B", "Input4B", "PGA Input Right"}; |
| 212 | 212 | ||
| 213 | static const struct soc_enum adca_enum = | 213 | static SOC_ENUM_SINGLE_DECL(adca_enum, |
| 214 | SOC_ENUM_SINGLE(CS42L52_ADC_PGA_A, 5, | 214 | CS42L52_ADC_PGA_A, 5, cs42l52_adca_text); |
| 215 | ARRAY_SIZE(cs42l52_adca_text), cs42l52_adca_text); | ||
| 216 | 215 | ||
| 217 | static const struct soc_enum adcb_enum = | 216 | static SOC_ENUM_SINGLE_DECL(adcb_enum, |
| 218 | SOC_ENUM_SINGLE(CS42L52_ADC_PGA_B, 5, | 217 | CS42L52_ADC_PGA_B, 5, cs42l52_adcb_text); |
| 219 | ARRAY_SIZE(cs42l52_adcb_text), cs42l52_adcb_text); | ||
| 220 | 218 | ||
| 221 | static const struct snd_kcontrol_new adca_mux = | 219 | static const struct snd_kcontrol_new adca_mux = |
| 222 | SOC_DAPM_ENUM("Left ADC Input Capture Mux", adca_enum); | 220 | SOC_DAPM_ENUM("Left ADC Input Capture Mux", adca_enum); |
| @@ -229,26 +227,22 @@ static const char * const mic_bias_level_text[] = { | |||
| 229 | "0.8 +VA", "0.83 +VA", "0.91 +VA" | 227 | "0.8 +VA", "0.83 +VA", "0.91 +VA" |
| 230 | }; | 228 | }; |
| 231 | 229 | ||
| 232 | static const struct soc_enum mic_bias_level_enum = | 230 | static SOC_ENUM_SINGLE_DECL(mic_bias_level_enum, |
| 233 | SOC_ENUM_SINGLE(CS42L52_IFACE_CTL2, 0, | 231 | CS42L52_IFACE_CTL2, 0, mic_bias_level_text); |
| 234 | ARRAY_SIZE(mic_bias_level_text), mic_bias_level_text); | ||
| 235 | 232 | ||
| 236 | static const char * const cs42l52_mic_text[] = { "MIC1", "MIC2" }; | 233 | static const char * const cs42l52_mic_text[] = { "MIC1", "MIC2" }; |
| 237 | 234 | ||
| 238 | static const struct soc_enum mica_enum = | 235 | static SOC_ENUM_SINGLE_DECL(mica_enum, |
| 239 | SOC_ENUM_SINGLE(CS42L52_MICA_CTL, 5, | 236 | CS42L52_MICA_CTL, 5, cs42l52_mic_text); |
| 240 | ARRAY_SIZE(cs42l52_mic_text), cs42l52_mic_text); | ||
| 241 | 237 | ||
| 242 | static const struct soc_enum micb_enum = | 238 | static SOC_ENUM_SINGLE_DECL(micb_enum, |
| 243 | SOC_ENUM_SINGLE(CS42L52_MICB_CTL, 5, | 239 | CS42L52_MICB_CTL, 5, cs42l52_mic_text); |
| 244 | ARRAY_SIZE(cs42l52_mic_text), cs42l52_mic_text); | ||
| 245 | 240 | ||
| 246 | static const char * const digital_output_mux_text[] = {"ADC", "DSP"}; | 241 | static const char * const digital_output_mux_text[] = {"ADC", "DSP"}; |
| 247 | 242 | ||
| 248 | static const struct soc_enum digital_output_mux_enum = | 243 | static SOC_ENUM_SINGLE_DECL(digital_output_mux_enum, |
| 249 | SOC_ENUM_SINGLE(CS42L52_ADC_MISC_CTL, 6, | 244 | CS42L52_ADC_MISC_CTL, 6, |
| 250 | ARRAY_SIZE(digital_output_mux_text), | 245 | digital_output_mux_text); |
| 251 | digital_output_mux_text); | ||
| 252 | 246 | ||
| 253 | static const struct snd_kcontrol_new digital_output_mux = | 247 | static const struct snd_kcontrol_new digital_output_mux = |
| 254 | SOC_DAPM_ENUM("Digital Output Mux", digital_output_mux_enum); | 248 | SOC_DAPM_ENUM("Digital Output Mux", digital_output_mux_enum); |
| @@ -258,18 +252,18 @@ static const char * const hp_gain_num_text[] = { | |||
| 258 | "0.7099", "0.8399", "1.000", "1.1430" | 252 | "0.7099", "0.8399", "1.000", "1.1430" |
| 259 | }; | 253 | }; |
| 260 | 254 | ||
| 261 | static const struct soc_enum hp_gain_enum = | 255 | static SOC_ENUM_SINGLE_DECL(hp_gain_enum, |
| 262 | SOC_ENUM_SINGLE(CS42L52_PB_CTL1, 5, | 256 | CS42L52_PB_CTL1, 5, |
| 263 | ARRAY_SIZE(hp_gain_num_text), hp_gain_num_text); | 257 | hp_gain_num_text); |
| 264 | 258 | ||
| 265 | static const char * const beep_pitch_text[] = { | 259 | static const char * const beep_pitch_text[] = { |
| 266 | "C4", "C5", "D5", "E5", "F5", "G5", "A5", "B5", | 260 | "C4", "C5", "D5", "E5", "F5", "G5", "A5", "B5", |
| 267 | "C6", "D6", "E6", "F6", "G6", "A6", "B6", "C7" | 261 | "C6", "D6", "E6", "F6", "G6", "A6", "B6", "C7" |
| 268 | }; | 262 | }; |
| 269 | 263 | ||
| 270 | static const struct soc_enum beep_pitch_enum = | 264 | static SOC_ENUM_SINGLE_DECL(beep_pitch_enum, |
| 271 | SOC_ENUM_SINGLE(CS42L52_BEEP_FREQ, 4, | 265 | CS42L52_BEEP_FREQ, 4, |
| 272 | ARRAY_SIZE(beep_pitch_text), beep_pitch_text); | 266 | beep_pitch_text); |
| 273 | 267 | ||
| 274 | static const char * const beep_ontime_text[] = { | 268 | static const char * const beep_ontime_text[] = { |
| 275 | "86 ms", "430 ms", "780 ms", "1.20 s", "1.50 s", | 269 | "86 ms", "430 ms", "780 ms", "1.20 s", "1.50 s", |
| @@ -277,66 +271,66 @@ static const char * const beep_ontime_text[] = { | |||
| 277 | "3.50 s", "3.80 s", "4.20 s", "4.50 s", "4.80 s", "5.20 s" | 271 | "3.50 s", "3.80 s", "4.20 s", "4.50 s", "4.80 s", "5.20 s" |
| 278 | }; | 272 | }; |
| 279 | 273 | ||
| 280 | static const struct soc_enum beep_ontime_enum = | 274 | static SOC_ENUM_SINGLE_DECL(beep_ontime_enum, |
| 281 | SOC_ENUM_SINGLE(CS42L52_BEEP_FREQ, 0, | 275 | CS42L52_BEEP_FREQ, 0, |
| 282 | ARRAY_SIZE(beep_ontime_text), beep_ontime_text); | 276 | beep_ontime_text); |
| 283 | 277 | ||
| 284 | static const char * const beep_offtime_text[] = { | 278 | static const char * const beep_offtime_text[] = { |
| 285 | "1.23 s", "2.58 s", "3.90 s", "5.20 s", | 279 | "1.23 s", "2.58 s", "3.90 s", "5.20 s", |
| 286 | "6.60 s", "8.05 s", "9.35 s", "10.80 s" | 280 | "6.60 s", "8.05 s", "9.35 s", "10.80 s" |
| 287 | }; | 281 | }; |
| 288 | 282 | ||
| 289 | static const struct soc_enum beep_offtime_enum = | 283 | static SOC_ENUM_SINGLE_DECL(beep_offtime_enum, |
| 290 | SOC_ENUM_SINGLE(CS42L52_BEEP_VOL, 5, | 284 | CS42L52_BEEP_VOL, 5, |
| 291 | ARRAY_SIZE(beep_offtime_text), beep_offtime_text); | 285 | beep_offtime_text); |
| 292 | 286 | ||
| 293 | static const char * const beep_config_text[] = { | 287 | static const char * const beep_config_text[] = { |
| 294 | "Off", "Single", "Multiple", "Continuous" | 288 | "Off", "Single", "Multiple", "Continuous" |
| 295 | }; | 289 | }; |
| 296 | 290 | ||
| 297 | static const struct soc_enum beep_config_enum = | 291 | static SOC_ENUM_SINGLE_DECL(beep_config_enum, |
| 298 | SOC_ENUM_SINGLE(CS42L52_BEEP_TONE_CTL, 6, | 292 | CS42L52_BEEP_TONE_CTL, 6, |
| 299 | ARRAY_SIZE(beep_config_text), beep_config_text); | 293 | beep_config_text); |
| 300 | 294 | ||
| 301 | static const char * const beep_bass_text[] = { | 295 | static const char * const beep_bass_text[] = { |
| 302 | "50 Hz", "100 Hz", "200 Hz", "250 Hz" | 296 | "50 Hz", "100 Hz", "200 Hz", "250 Hz" |
| 303 | }; | 297 | }; |
| 304 | 298 | ||
| 305 | static const struct soc_enum beep_bass_enum = | 299 | static SOC_ENUM_SINGLE_DECL(beep_bass_enum, |
| 306 | SOC_ENUM_SINGLE(CS42L52_BEEP_TONE_CTL, 1, | 300 | CS42L52_BEEP_TONE_CTL, 1, |
| 307 | ARRAY_SIZE(beep_bass_text), beep_bass_text); | 301 | beep_bass_text); |
| 308 | 302 | ||
| 309 | static const char * const beep_treble_text[] = { | 303 | static const char * const beep_treble_text[] = { |
| 310 | "5 kHz", "7 kHz", "10 kHz", " 15 kHz" | 304 | "5 kHz", "7 kHz", "10 kHz", " 15 kHz" |
| 311 | }; | 305 | }; |
| 312 | 306 | ||
| 313 | static const struct soc_enum beep_treble_enum = | 307 | static SOC_ENUM_SINGLE_DECL(beep_treble_enum, |
| 314 | SOC_ENUM_SINGLE(CS42L52_BEEP_TONE_CTL, 3, | 308 | CS42L52_BEEP_TONE_CTL, 3, |
| 315 | ARRAY_SIZE(beep_treble_text), beep_treble_text); | 309 | beep_treble_text); |
| 316 | 310 | ||
| 317 | static const char * const ng_threshold_text[] = { | 311 | static const char * const ng_threshold_text[] = { |
| 318 | "-34dB", "-37dB", "-40dB", "-43dB", | 312 | "-34dB", "-37dB", "-40dB", "-43dB", |
| 319 | "-46dB", "-52dB", "-58dB", "-64dB" | 313 | "-46dB", "-52dB", "-58dB", "-64dB" |
| 320 | }; | 314 | }; |
| 321 | 315 | ||
| 322 | static const struct soc_enum ng_threshold_enum = | 316 | static SOC_ENUM_SINGLE_DECL(ng_threshold_enum, |
| 323 | SOC_ENUM_SINGLE(CS42L52_NOISE_GATE_CTL, 2, | 317 | CS42L52_NOISE_GATE_CTL, 2, |
| 324 | ARRAY_SIZE(ng_threshold_text), ng_threshold_text); | 318 | ng_threshold_text); |
| 325 | 319 | ||
| 326 | static const char * const cs42l52_ng_delay_text[] = { | 320 | static const char * const cs42l52_ng_delay_text[] = { |
| 327 | "50ms", "100ms", "150ms", "200ms"}; | 321 | "50ms", "100ms", "150ms", "200ms"}; |
| 328 | 322 | ||
| 329 | static const struct soc_enum ng_delay_enum = | 323 | static SOC_ENUM_SINGLE_DECL(ng_delay_enum, |
| 330 | SOC_ENUM_SINGLE(CS42L52_NOISE_GATE_CTL, 0, | 324 | CS42L52_NOISE_GATE_CTL, 0, |
| 331 | ARRAY_SIZE(cs42l52_ng_delay_text), cs42l52_ng_delay_text); | 325 | cs42l52_ng_delay_text); |
| 332 | 326 | ||
| 333 | static const char * const cs42l52_ng_type_text[] = { | 327 | static const char * const cs42l52_ng_type_text[] = { |
| 334 | "Apply Specific", "Apply All" | 328 | "Apply Specific", "Apply All" |
| 335 | }; | 329 | }; |
| 336 | 330 | ||
| 337 | static const struct soc_enum ng_type_enum = | 331 | static SOC_ENUM_SINGLE_DECL(ng_type_enum, |
| 338 | SOC_ENUM_SINGLE(CS42L52_NOISE_GATE_CTL, 6, | 332 | CS42L52_NOISE_GATE_CTL, 6, |
| 339 | ARRAY_SIZE(cs42l52_ng_type_text), cs42l52_ng_type_text); | 333 | cs42l52_ng_type_text); |
| 340 | 334 | ||
| 341 | static const char * const left_swap_text[] = { | 335 | static const char * const left_swap_text[] = { |
| 342 | "Left", "LR 2", "Right"}; | 336 | "Left", "LR 2", "Right"}; |
diff --git a/sound/soc/codecs/cs42l73.c b/sound/soc/codecs/cs42l73.c index 549d5d6a3fef..06f429184821 100644 --- a/sound/soc/codecs/cs42l73.c +++ b/sound/soc/codecs/cs42l73.c | |||
| @@ -278,13 +278,13 @@ static const DECLARE_TLV_DB_SCALE(attn_tlv, -6300, 100, 1); | |||
| 278 | static const char * const cs42l73_pgaa_text[] = { "Line A", "Mic 1" }; | 278 | static const char * const cs42l73_pgaa_text[] = { "Line A", "Mic 1" }; |
| 279 | static const char * const cs42l73_pgab_text[] = { "Line B", "Mic 2" }; | 279 | static const char * const cs42l73_pgab_text[] = { "Line B", "Mic 2" }; |
| 280 | 280 | ||
| 281 | static const struct soc_enum pgaa_enum = | 281 | static SOC_ENUM_SINGLE_DECL(pgaa_enum, |
| 282 | SOC_ENUM_SINGLE(CS42L73_ADCIPC, 3, | 282 | CS42L73_ADCIPC, 3, |
| 283 | ARRAY_SIZE(cs42l73_pgaa_text), cs42l73_pgaa_text); | 283 | cs42l73_pgaa_text); |
| 284 | 284 | ||
| 285 | static const struct soc_enum pgab_enum = | 285 | static SOC_ENUM_SINGLE_DECL(pgab_enum, |
| 286 | SOC_ENUM_SINGLE(CS42L73_ADCIPC, 7, | 286 | CS42L73_ADCIPC, 7, |
| 287 | ARRAY_SIZE(cs42l73_pgab_text), cs42l73_pgab_text); | 287 | cs42l73_pgab_text); |
| 288 | 288 | ||
| 289 | static const struct snd_kcontrol_new pgaa_mux = | 289 | static const struct snd_kcontrol_new pgaa_mux = |
| 290 | SOC_DAPM_ENUM("Left Analog Input Capture Mux", pgaa_enum); | 290 | SOC_DAPM_ENUM("Left Analog Input Capture Mux", pgaa_enum); |
| @@ -309,9 +309,9 @@ static const struct snd_kcontrol_new input_right_mixer[] = { | |||
| 309 | static const char * const cs42l73_ng_delay_text[] = { | 309 | static const char * const cs42l73_ng_delay_text[] = { |
| 310 | "50ms", "100ms", "150ms", "200ms" }; | 310 | "50ms", "100ms", "150ms", "200ms" }; |
| 311 | 311 | ||
| 312 | static const struct soc_enum ng_delay_enum = | 312 | static SOC_ENUM_SINGLE_DECL(ng_delay_enum, |
| 313 | SOC_ENUM_SINGLE(CS42L73_NGCAB, 0, | 313 | CS42L73_NGCAB, 0, |
| 314 | ARRAY_SIZE(cs42l73_ng_delay_text), cs42l73_ng_delay_text); | 314 | cs42l73_ng_delay_text); |
| 315 | 315 | ||
| 316 | static const char * const cs42l73_mono_mix_texts[] = { | 316 | static const char * const cs42l73_mono_mix_texts[] = { |
| 317 | "Left", "Right", "Mono Mix"}; | 317 | "Left", "Right", "Mono Mix"}; |
| @@ -357,19 +357,19 @@ static const struct snd_kcontrol_new esl_xsp_mixer = | |||
| 357 | static const char * const cs42l73_ip_swap_text[] = { | 357 | static const char * const cs42l73_ip_swap_text[] = { |
| 358 | "Stereo", "Mono A", "Mono B", "Swap A-B"}; | 358 | "Stereo", "Mono A", "Mono B", "Swap A-B"}; |
| 359 | 359 | ||
| 360 | static const struct soc_enum ip_swap_enum = | 360 | static SOC_ENUM_SINGLE_DECL(ip_swap_enum, |
| 361 | SOC_ENUM_SINGLE(CS42L73_MIOPC, 6, | 361 | CS42L73_MIOPC, 6, |
| 362 | ARRAY_SIZE(cs42l73_ip_swap_text), cs42l73_ip_swap_text); | 362 | cs42l73_ip_swap_text); |
| 363 | 363 | ||
| 364 | static const char * const cs42l73_spo_mixer_text[] = {"Mono", "Stereo"}; | 364 | static const char * const cs42l73_spo_mixer_text[] = {"Mono", "Stereo"}; |
| 365 | 365 | ||
| 366 | static const struct soc_enum vsp_output_mux_enum = | 366 | static SOC_ENUM_SINGLE_DECL(vsp_output_mux_enum, |
| 367 | SOC_ENUM_SINGLE(CS42L73_MIXERCTL, 5, | 367 | CS42L73_MIXERCTL, 5, |
| 368 | ARRAY_SIZE(cs42l73_spo_mixer_text), cs42l73_spo_mixer_text); | 368 | cs42l73_spo_mixer_text); |
| 369 | 369 | ||
| 370 | static const struct soc_enum xsp_output_mux_enum = | 370 | static SOC_ENUM_SINGLE_DECL(xsp_output_mux_enum, |
| 371 | SOC_ENUM_SINGLE(CS42L73_MIXERCTL, 4, | 371 | CS42L73_MIXERCTL, 4, |
| 372 | ARRAY_SIZE(cs42l73_spo_mixer_text), cs42l73_spo_mixer_text); | 372 | cs42l73_spo_mixer_text); |
| 373 | 373 | ||
| 374 | static const struct snd_kcontrol_new vsp_output_mux = | 374 | static const struct snd_kcontrol_new vsp_output_mux = |
| 375 | SOC_DAPM_ENUM("Route", vsp_output_mux_enum); | 375 | SOC_DAPM_ENUM("Route", vsp_output_mux_enum); |
| @@ -1108,7 +1108,7 @@ static int cs42l73_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) | |||
| 1108 | return 0; | 1108 | return 0; |
| 1109 | } | 1109 | } |
| 1110 | 1110 | ||
| 1111 | static u32 cs42l73_asrc_rates[] = { | 1111 | static const unsigned int cs42l73_asrc_rates[] = { |
| 1112 | 8000, 11025, 12000, 16000, 22050, | 1112 | 8000, 11025, 12000, 16000, 22050, |
| 1113 | 24000, 32000, 44100, 48000 | 1113 | 24000, 32000, 44100, 48000 |
| 1114 | }; | 1114 | }; |
| @@ -1241,7 +1241,7 @@ static int cs42l73_set_tristate(struct snd_soc_dai *dai, int tristate) | |||
| 1241 | 0x7F, tristate << 7); | 1241 | 0x7F, tristate << 7); |
| 1242 | } | 1242 | } |
| 1243 | 1243 | ||
| 1244 | static struct snd_pcm_hw_constraint_list constraints_12_24 = { | 1244 | static const struct snd_pcm_hw_constraint_list constraints_12_24 = { |
| 1245 | .count = ARRAY_SIZE(cs42l73_asrc_rates), | 1245 | .count = ARRAY_SIZE(cs42l73_asrc_rates), |
| 1246 | .list = cs42l73_asrc_rates, | 1246 | .list = cs42l73_asrc_rates, |
| 1247 | }; | 1247 | }; |
| @@ -1255,9 +1255,6 @@ static int cs42l73_pcm_startup(struct snd_pcm_substream *substream, | |||
| 1255 | return 0; | 1255 | return 0; |
| 1256 | } | 1256 | } |
| 1257 | 1257 | ||
| 1258 | /* SNDRV_PCM_RATE_KNOT -> 12000, 24000 Hz, limit with constraint list */ | ||
| 1259 | #define CS42L73_RATES (SNDRV_PCM_RATE_8000_48000 | SNDRV_PCM_RATE_KNOT) | ||
| 1260 | |||
| 1261 | 1258 | ||
| 1262 | #define CS42L73_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ | 1259 | #define CS42L73_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ |
| 1263 | SNDRV_PCM_FMTBIT_S24_LE) | 1260 | SNDRV_PCM_FMTBIT_S24_LE) |
| @@ -1278,14 +1275,14 @@ static struct snd_soc_dai_driver cs42l73_dai[] = { | |||
| 1278 | .stream_name = "XSP Playback", | 1275 | .stream_name = "XSP Playback", |
| 1279 | .channels_min = 1, | 1276 | .channels_min = 1, |
| 1280 | .channels_max = 2, | 1277 | .channels_max = 2, |
| 1281 | .rates = CS42L73_RATES, | 1278 | .rates = SNDRV_PCM_RATE_KNOT, |
| 1282 | .formats = CS42L73_FORMATS, | 1279 | .formats = CS42L73_FORMATS, |
| 1283 | }, | 1280 | }, |
| 1284 | .capture = { | 1281 | .capture = { |
| 1285 | .stream_name = "XSP Capture", | 1282 | .stream_name = "XSP Capture", |
| 1286 | .channels_min = 1, | 1283 | .channels_min = 1, |
| 1287 | .channels_max = 2, | 1284 | .channels_max = 2, |
| 1288 | .rates = CS42L73_RATES, | 1285 | .rates = SNDRV_PCM_RATE_KNOT, |
| 1289 | .formats = CS42L73_FORMATS, | 1286 | .formats = CS42L73_FORMATS, |
| 1290 | }, | 1287 | }, |
| 1291 | .ops = &cs42l73_ops, | 1288 | .ops = &cs42l73_ops, |
| @@ -1298,14 +1295,14 @@ static struct snd_soc_dai_driver cs42l73_dai[] = { | |||
| 1298 | .stream_name = "ASP Playback", | 1295 | .stream_name = "ASP Playback", |
| 1299 | .channels_min = 2, | 1296 | .channels_min = 2, |
| 1300 | .channels_max = 2, | 1297 | .channels_max = 2, |
| 1301 | .rates = CS42L73_RATES, | 1298 | .rates = SNDRV_PCM_RATE_KNOT, |
| 1302 | .formats = CS42L73_FORMATS, | 1299 | .formats = CS42L73_FORMATS, |
| 1303 | }, | 1300 | }, |
| 1304 | .capture = { | 1301 | .capture = { |
| 1305 | .stream_name = "ASP Capture", | 1302 | .stream_name = "ASP Capture", |
| 1306 | .channels_min = 2, | 1303 | .channels_min = 2, |
| 1307 | .channels_max = 2, | 1304 | .channels_max = 2, |
| 1308 | .rates = CS42L73_RATES, | 1305 | .rates = SNDRV_PCM_RATE_KNOT, |
| 1309 | .formats = CS42L73_FORMATS, | 1306 | .formats = CS42L73_FORMATS, |
| 1310 | }, | 1307 | }, |
| 1311 | .ops = &cs42l73_ops, | 1308 | .ops = &cs42l73_ops, |
| @@ -1318,14 +1315,14 @@ static struct snd_soc_dai_driver cs42l73_dai[] = { | |||
| 1318 | .stream_name = "VSP Playback", | 1315 | .stream_name = "VSP Playback", |
| 1319 | .channels_min = 1, | 1316 | .channels_min = 1, |
| 1320 | .channels_max = 2, | 1317 | .channels_max = 2, |
| 1321 | .rates = CS42L73_RATES, | 1318 | .rates = SNDRV_PCM_RATE_KNOT, |
| 1322 | .formats = CS42L73_FORMATS, | 1319 | .formats = CS42L73_FORMATS, |
| 1323 | }, | 1320 | }, |
| 1324 | .capture = { | 1321 | .capture = { |
| 1325 | .stream_name = "VSP Capture", | 1322 | .stream_name = "VSP Capture", |
| 1326 | .channels_min = 1, | 1323 | .channels_min = 1, |
| 1327 | .channels_max = 2, | 1324 | .channels_max = 2, |
| 1328 | .rates = CS42L73_RATES, | 1325 | .rates = SNDRV_PCM_RATE_KNOT, |
| 1329 | .formats = CS42L73_FORMATS, | 1326 | .formats = CS42L73_FORMATS, |
| 1330 | }, | 1327 | }, |
| 1331 | .ops = &cs42l73_ops, | 1328 | .ops = &cs42l73_ops, |
diff --git a/sound/soc/codecs/da7210.c b/sound/soc/codecs/da7210.c index e62e294a8033..01e55fc72307 100644 --- a/sound/soc/codecs/da7210.c +++ b/sound/soc/codecs/da7210.c | |||
| @@ -307,29 +307,29 @@ static const char * const da7210_hpf_cutoff_txt[] = { | |||
| 307 | "Fs/8192*pi", "Fs/4096*pi", "Fs/2048*pi", "Fs/1024*pi" | 307 | "Fs/8192*pi", "Fs/4096*pi", "Fs/2048*pi", "Fs/1024*pi" |
| 308 | }; | 308 | }; |
| 309 | 309 | ||
| 310 | static const struct soc_enum da7210_dac_hpf_cutoff = | 310 | static SOC_ENUM_SINGLE_DECL(da7210_dac_hpf_cutoff, |
| 311 | SOC_ENUM_SINGLE(DA7210_DAC_HPF, 0, 4, da7210_hpf_cutoff_txt); | 311 | DA7210_DAC_HPF, 0, da7210_hpf_cutoff_txt); |
| 312 | 312 | ||
| 313 | static const struct soc_enum da7210_adc_hpf_cutoff = | 313 | static SOC_ENUM_SINGLE_DECL(da7210_adc_hpf_cutoff, |
| 314 | SOC_ENUM_SINGLE(DA7210_ADC_HPF, 0, 4, da7210_hpf_cutoff_txt); | 314 | DA7210_ADC_HPF, 0, da7210_hpf_cutoff_txt); |
| 315 | 315 | ||
| 316 | /* ADC and DAC voice (8kHz) high pass cutoff value */ | 316 | /* ADC and DAC voice (8kHz) high pass cutoff value */ |
| 317 | static const char * const da7210_vf_cutoff_txt[] = { | 317 | static const char * const da7210_vf_cutoff_txt[] = { |
| 318 | "2.5Hz", "25Hz", "50Hz", "100Hz", "150Hz", "200Hz", "300Hz", "400Hz" | 318 | "2.5Hz", "25Hz", "50Hz", "100Hz", "150Hz", "200Hz", "300Hz", "400Hz" |
| 319 | }; | 319 | }; |
| 320 | 320 | ||
| 321 | static const struct soc_enum da7210_dac_vf_cutoff = | 321 | static SOC_ENUM_SINGLE_DECL(da7210_dac_vf_cutoff, |
| 322 | SOC_ENUM_SINGLE(DA7210_DAC_HPF, 4, 8, da7210_vf_cutoff_txt); | 322 | DA7210_DAC_HPF, 4, da7210_vf_cutoff_txt); |
| 323 | 323 | ||
| 324 | static const struct soc_enum da7210_adc_vf_cutoff = | 324 | static SOC_ENUM_SINGLE_DECL(da7210_adc_vf_cutoff, |
| 325 | SOC_ENUM_SINGLE(DA7210_ADC_HPF, 4, 8, da7210_vf_cutoff_txt); | 325 | DA7210_ADC_HPF, 4, da7210_vf_cutoff_txt); |
| 326 | 326 | ||
| 327 | static const char *da7210_hp_mode_txt[] = { | 327 | static const char *da7210_hp_mode_txt[] = { |
| 328 | "Class H", "Class G" | 328 | "Class H", "Class G" |
| 329 | }; | 329 | }; |
| 330 | 330 | ||
| 331 | static const struct soc_enum da7210_hp_mode_sel = | 331 | static SOC_ENUM_SINGLE_DECL(da7210_hp_mode_sel, |
| 332 | SOC_ENUM_SINGLE(DA7210_HP_CFG, 0, 2, da7210_hp_mode_txt); | 332 | DA7210_HP_CFG, 0, da7210_hp_mode_txt); |
| 333 | 333 | ||
| 334 | /* ALC can be enabled only if noise suppression is disabled */ | 334 | /* ALC can be enabled only if noise suppression is disabled */ |
| 335 | static int da7210_put_alc_sw(struct snd_kcontrol *kcontrol, | 335 | static int da7210_put_alc_sw(struct snd_kcontrol *kcontrol, |
diff --git a/sound/soc/codecs/wm5102.c b/sound/soc/codecs/wm5102.c index ce9c8e14d4bd..34109050ceed 100644 --- a/sound/soc/codecs/wm5102.c +++ b/sound/soc/codecs/wm5102.c | |||
| @@ -582,7 +582,7 @@ static int wm5102_sysclk_ev(struct snd_soc_dapm_widget *w, | |||
| 582 | { | 582 | { |
| 583 | struct snd_soc_codec *codec = w->codec; | 583 | struct snd_soc_codec *codec = w->codec; |
| 584 | struct arizona *arizona = dev_get_drvdata(codec->dev->parent); | 584 | struct arizona *arizona = dev_get_drvdata(codec->dev->parent); |
| 585 | struct regmap *regmap = codec->control_data; | 585 | struct regmap *regmap = arizona->regmap; |
| 586 | const struct reg_default *patch = NULL; | 586 | const struct reg_default *patch = NULL; |
| 587 | int i, patch_size; | 587 | int i, patch_size; |
| 588 | 588 | ||
| @@ -622,13 +622,16 @@ static const unsigned int wm5102_osr_val[] = { | |||
| 622 | 622 | ||
| 623 | static const struct soc_enum wm5102_hpout_osr[] = { | 623 | static const struct soc_enum wm5102_hpout_osr[] = { |
| 624 | SOC_VALUE_ENUM_SINGLE(ARIZONA_OUTPUT_PATH_CONFIG_1L, | 624 | SOC_VALUE_ENUM_SINGLE(ARIZONA_OUTPUT_PATH_CONFIG_1L, |
| 625 | ARIZONA_OUT1_OSR_SHIFT, 0x7, 3, | 625 | ARIZONA_OUT1_OSR_SHIFT, 0x7, |
| 626 | ARRAY_SIZE(wm5102_osr_text), | ||
| 626 | wm5102_osr_text, wm5102_osr_val), | 627 | wm5102_osr_text, wm5102_osr_val), |
| 627 | SOC_VALUE_ENUM_SINGLE(ARIZONA_OUTPUT_PATH_CONFIG_2L, | 628 | SOC_VALUE_ENUM_SINGLE(ARIZONA_OUTPUT_PATH_CONFIG_2L, |
| 628 | ARIZONA_OUT2_OSR_SHIFT, 0x7, 3, | 629 | ARIZONA_OUT2_OSR_SHIFT, 0x7, |
| 630 | ARRAY_SIZE(wm5102_osr_text), | ||
| 629 | wm5102_osr_text, wm5102_osr_val), | 631 | wm5102_osr_text, wm5102_osr_val), |
| 630 | SOC_VALUE_ENUM_SINGLE(ARIZONA_OUTPUT_PATH_CONFIG_3L, | 632 | SOC_VALUE_ENUM_SINGLE(ARIZONA_OUTPUT_PATH_CONFIG_3L, |
| 631 | ARIZONA_OUT3_OSR_SHIFT, 0x7, 3, | 633 | ARIZONA_OUT3_OSR_SHIFT, 0x7, |
| 634 | ARRAY_SIZE(wm5102_osr_text), | ||
| 632 | wm5102_osr_text, wm5102_osr_val), | 635 | wm5102_osr_text, wm5102_osr_val), |
| 633 | }; | 636 | }; |
| 634 | 637 | ||
| @@ -685,15 +688,8 @@ ARIZONA_MIXER_CONTROLS("EQ2", ARIZONA_EQ2MIX_INPUT_1_SOURCE), | |||
| 685 | ARIZONA_MIXER_CONTROLS("EQ3", ARIZONA_EQ3MIX_INPUT_1_SOURCE), | 688 | ARIZONA_MIXER_CONTROLS("EQ3", ARIZONA_EQ3MIX_INPUT_1_SOURCE), |
| 686 | ARIZONA_MIXER_CONTROLS("EQ4", ARIZONA_EQ4MIX_INPUT_1_SOURCE), | 689 | ARIZONA_MIXER_CONTROLS("EQ4", ARIZONA_EQ4MIX_INPUT_1_SOURCE), |
| 687 | 690 | ||
| 688 | SND_SOC_BYTES_MASK("EQ1 Coefficients", ARIZONA_EQ1_1, 21, | 691 | SND_SOC_BYTES("EQ1 Coefficients", ARIZONA_EQ1_3, 19), |
| 689 | ARIZONA_EQ1_ENA_MASK), | 692 | SOC_SINGLE("EQ1 Mode Switch", ARIZONA_EQ1_2, ARIZONA_EQ1_B1_MODE, 1, 0), |
| 690 | SND_SOC_BYTES_MASK("EQ2 Coefficients", ARIZONA_EQ2_1, 21, | ||
| 691 | ARIZONA_EQ2_ENA_MASK), | ||
| 692 | SND_SOC_BYTES_MASK("EQ3 Coefficients", ARIZONA_EQ3_1, 21, | ||
| 693 | ARIZONA_EQ3_ENA_MASK), | ||
| 694 | SND_SOC_BYTES_MASK("EQ4 Coefficients", ARIZONA_EQ4_1, 21, | ||
| 695 | ARIZONA_EQ4_ENA_MASK), | ||
| 696 | |||
| 697 | SOC_SINGLE_TLV("EQ1 B1 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B1_GAIN_SHIFT, | 693 | SOC_SINGLE_TLV("EQ1 B1 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B1_GAIN_SHIFT, |
| 698 | 24, 0, eq_tlv), | 694 | 24, 0, eq_tlv), |
| 699 | SOC_SINGLE_TLV("EQ1 B2 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B2_GAIN_SHIFT, | 695 | SOC_SINGLE_TLV("EQ1 B2 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B2_GAIN_SHIFT, |
| @@ -705,6 +701,8 @@ SOC_SINGLE_TLV("EQ1 B4 Volume", ARIZONA_EQ1_2, ARIZONA_EQ1_B4_GAIN_SHIFT, | |||
| 705 | SOC_SINGLE_TLV("EQ1 B5 Volume", ARIZONA_EQ1_2, ARIZONA_EQ1_B5_GAIN_SHIFT, | 701 | SOC_SINGLE_TLV("EQ1 B5 Volume", ARIZONA_EQ1_2, ARIZONA_EQ1_B5_GAIN_SHIFT, |
| 706 | 24, 0, eq_tlv), | 702 | 24, 0, eq_tlv), |
| 707 | 703 | ||
| 704 | SND_SOC_BYTES("EQ2 Coefficients", ARIZONA_EQ2_3, 19), | ||
| 705 | SOC_SINGLE("EQ2 Mode Switch", ARIZONA_EQ2_2, ARIZONA_EQ2_B1_MODE, 1, 0), | ||
| 708 | SOC_SINGLE_TLV("EQ2 B1 Volume", ARIZONA_EQ2_1, ARIZONA_EQ2_B1_GAIN_SHIFT, | 706 | SOC_SINGLE_TLV("EQ2 B1 Volume", ARIZONA_EQ2_1, ARIZONA_EQ2_B1_GAIN_SHIFT, |
| 709 | 24, 0, eq_tlv), | 707 | 24, 0, eq_tlv), |
| 710 | SOC_SINGLE_TLV("EQ2 B2 Volume", ARIZONA_EQ2_1, ARIZONA_EQ2_B2_GAIN_SHIFT, | 708 | SOC_SINGLE_TLV("EQ2 B2 Volume", ARIZONA_EQ2_1, ARIZONA_EQ2_B2_GAIN_SHIFT, |
| @@ -716,6 +714,8 @@ SOC_SINGLE_TLV("EQ2 B4 Volume", ARIZONA_EQ2_2, ARIZONA_EQ2_B4_GAIN_SHIFT, | |||
| 716 | SOC_SINGLE_TLV("EQ2 B5 Volume", ARIZONA_EQ2_2, ARIZONA_EQ2_B5_GAIN_SHIFT, | 714 | SOC_SINGLE_TLV("EQ2 B5 Volume", ARIZONA_EQ2_2, ARIZONA_EQ2_B5_GAIN_SHIFT, |
| 717 | 24, 0, eq_tlv), | 715 | 24, 0, eq_tlv), |
| 718 | 716 | ||
| 717 | SND_SOC_BYTES("EQ3 Coefficients", ARIZONA_EQ3_3, 19), | ||
| 718 | SOC_SINGLE("EQ3 Mode Switch", ARIZONA_EQ3_2, ARIZONA_EQ3_B1_MODE, 1, 0), | ||
| 719 | SOC_SINGLE_TLV("EQ3 B1 Volume", ARIZONA_EQ3_1, ARIZONA_EQ3_B1_GAIN_SHIFT, | 719 | SOC_SINGLE_TLV("EQ3 B1 Volume", ARIZONA_EQ3_1, ARIZONA_EQ3_B1_GAIN_SHIFT, |
| 720 | 24, 0, eq_tlv), | 720 | 24, 0, eq_tlv), |
| 721 | SOC_SINGLE_TLV("EQ3 B2 Volume", ARIZONA_EQ3_1, ARIZONA_EQ3_B2_GAIN_SHIFT, | 721 | SOC_SINGLE_TLV("EQ3 B2 Volume", ARIZONA_EQ3_1, ARIZONA_EQ3_B2_GAIN_SHIFT, |
| @@ -727,6 +727,8 @@ SOC_SINGLE_TLV("EQ3 B4 Volume", ARIZONA_EQ3_2, ARIZONA_EQ3_B4_GAIN_SHIFT, | |||
| 727 | SOC_SINGLE_TLV("EQ3 B5 Volume", ARIZONA_EQ3_2, ARIZONA_EQ3_B5_GAIN_SHIFT, | 727 | SOC_SINGLE_TLV("EQ3 B5 Volume", ARIZONA_EQ3_2, ARIZONA_EQ3_B5_GAIN_SHIFT, |
| 728 | 24, 0, eq_tlv), | 728 | 24, 0, eq_tlv), |
| 729 | 729 | ||
| 730 | SND_SOC_BYTES("EQ4 Coefficients", ARIZONA_EQ4_3, 19), | ||
| 731 | SOC_SINGLE("EQ4 Mode Switch", ARIZONA_EQ4_2, ARIZONA_EQ4_B1_MODE, 1, 0), | ||
| 730 | SOC_SINGLE_TLV("EQ4 B1 Volume", ARIZONA_EQ4_1, ARIZONA_EQ4_B1_GAIN_SHIFT, | 732 | SOC_SINGLE_TLV("EQ4 B1 Volume", ARIZONA_EQ4_1, ARIZONA_EQ4_B1_GAIN_SHIFT, |
| 731 | 24, 0, eq_tlv), | 733 | 24, 0, eq_tlv), |
| 732 | SOC_SINGLE_TLV("EQ4 B2 Volume", ARIZONA_EQ4_1, ARIZONA_EQ4_B2_GAIN_SHIFT, | 734 | SOC_SINGLE_TLV("EQ4 B2 Volume", ARIZONA_EQ4_1, ARIZONA_EQ4_B2_GAIN_SHIFT, |
diff --git a/sound/soc/codecs/wm5110.c b/sound/soc/codecs/wm5110.c index 2c3c962d9a85..d7bf8848174a 100644 --- a/sound/soc/codecs/wm5110.c +++ b/sound/soc/codecs/wm5110.c | |||
| @@ -136,7 +136,7 @@ static int wm5110_sysclk_ev(struct snd_soc_dapm_widget *w, | |||
| 136 | { | 136 | { |
| 137 | struct snd_soc_codec *codec = w->codec; | 137 | struct snd_soc_codec *codec = w->codec; |
| 138 | struct arizona *arizona = dev_get_drvdata(codec->dev->parent); | 138 | struct arizona *arizona = dev_get_drvdata(codec->dev->parent); |
| 139 | struct regmap *regmap = codec->control_data; | 139 | struct regmap *regmap = arizona->regmap; |
| 140 | const struct reg_default *patch = NULL; | 140 | const struct reg_default *patch = NULL; |
| 141 | int i, patch_size; | 141 | int i, patch_size; |
| 142 | 142 | ||
| @@ -247,15 +247,8 @@ ARIZONA_MIXER_CONTROLS("EQ2", ARIZONA_EQ2MIX_INPUT_1_SOURCE), | |||
| 247 | ARIZONA_MIXER_CONTROLS("EQ3", ARIZONA_EQ3MIX_INPUT_1_SOURCE), | 247 | ARIZONA_MIXER_CONTROLS("EQ3", ARIZONA_EQ3MIX_INPUT_1_SOURCE), |
| 248 | ARIZONA_MIXER_CONTROLS("EQ4", ARIZONA_EQ4MIX_INPUT_1_SOURCE), | 248 | ARIZONA_MIXER_CONTROLS("EQ4", ARIZONA_EQ4MIX_INPUT_1_SOURCE), |
| 249 | 249 | ||
| 250 | SND_SOC_BYTES_MASK("EQ1 Coefficients", ARIZONA_EQ1_1, 21, | 250 | SND_SOC_BYTES("EQ1 Coefficients", ARIZONA_EQ1_3, 19), |
| 251 | ARIZONA_EQ1_ENA_MASK), | 251 | SOC_SINGLE("EQ1 Mode Switch", ARIZONA_EQ1_2, ARIZONA_EQ1_B1_MODE, 1, 0), |
| 252 | SND_SOC_BYTES_MASK("EQ2 Coefficients", ARIZONA_EQ2_1, 21, | ||
| 253 | ARIZONA_EQ2_ENA_MASK), | ||
| 254 | SND_SOC_BYTES_MASK("EQ3 Coefficients", ARIZONA_EQ3_1, 21, | ||
| 255 | ARIZONA_EQ3_ENA_MASK), | ||
| 256 | SND_SOC_BYTES_MASK("EQ4 Coefficients", ARIZONA_EQ4_1, 21, | ||
| 257 | ARIZONA_EQ4_ENA_MASK), | ||
| 258 | |||
| 259 | SOC_SINGLE_TLV("EQ1 B1 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B1_GAIN_SHIFT, | 252 | SOC_SINGLE_TLV("EQ1 B1 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B1_GAIN_SHIFT, |
| 260 | 24, 0, eq_tlv), | 253 | 24, 0, eq_tlv), |
| 261 | SOC_SINGLE_TLV("EQ1 B2 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B2_GAIN_SHIFT, | 254 | SOC_SINGLE_TLV("EQ1 B2 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B2_GAIN_SHIFT, |
| @@ -267,6 +260,8 @@ SOC_SINGLE_TLV("EQ1 B4 Volume", ARIZONA_EQ1_2, ARIZONA_EQ1_B4_GAIN_SHIFT, | |||
| 267 | SOC_SINGLE_TLV("EQ1 B5 Volume", ARIZONA_EQ1_2, ARIZONA_EQ1_B5_GAIN_SHIFT, | 260 | SOC_SINGLE_TLV("EQ1 B5 Volume", ARIZONA_EQ1_2, ARIZONA_EQ1_B5_GAIN_SHIFT, |
| 268 | 24, 0, eq_tlv), | 261 | 24, 0, eq_tlv), |
| 269 | 262 | ||
| 263 | SND_SOC_BYTES("EQ2 Coefficients", ARIZONA_EQ2_3, 19), | ||
| 264 | SOC_SINGLE("EQ2 Mode Switch", ARIZONA_EQ2_2, ARIZONA_EQ2_B1_MODE, 1, 0), | ||
| 270 | SOC_SINGLE_TLV("EQ2 B1 Volume", ARIZONA_EQ2_1, ARIZONA_EQ2_B1_GAIN_SHIFT, | 265 | SOC_SINGLE_TLV("EQ2 B1 Volume", ARIZONA_EQ2_1, ARIZONA_EQ2_B1_GAIN_SHIFT, |
| 271 | 24, 0, eq_tlv), | 266 | 24, 0, eq_tlv), |
| 272 | SOC_SINGLE_TLV("EQ2 B2 Volume", ARIZONA_EQ2_1, ARIZONA_EQ2_B2_GAIN_SHIFT, | 267 | SOC_SINGLE_TLV("EQ2 B2 Volume", ARIZONA_EQ2_1, ARIZONA_EQ2_B2_GAIN_SHIFT, |
| @@ -278,6 +273,8 @@ SOC_SINGLE_TLV("EQ2 B4 Volume", ARIZONA_EQ2_2, ARIZONA_EQ2_B4_GAIN_SHIFT, | |||
| 278 | SOC_SINGLE_TLV("EQ2 B5 Volume", ARIZONA_EQ2_2, ARIZONA_EQ2_B5_GAIN_SHIFT, | 273 | SOC_SINGLE_TLV("EQ2 B5 Volume", ARIZONA_EQ2_2, ARIZONA_EQ2_B5_GAIN_SHIFT, |
| 279 | 24, 0, eq_tlv), | 274 | 24, 0, eq_tlv), |
| 280 | 275 | ||
| 276 | SND_SOC_BYTES("EQ3 Coefficients", ARIZONA_EQ3_3, 19), | ||
| 277 | SOC_SINGLE("EQ3 Mode Switch", ARIZONA_EQ3_2, ARIZONA_EQ3_B1_MODE, 1, 0), | ||
| 281 | SOC_SINGLE_TLV("EQ3 B1 Volume", ARIZONA_EQ3_1, ARIZONA_EQ3_B1_GAIN_SHIFT, | 278 | SOC_SINGLE_TLV("EQ3 B1 Volume", ARIZONA_EQ3_1, ARIZONA_EQ3_B1_GAIN_SHIFT, |
| 282 | 24, 0, eq_tlv), | 279 | 24, 0, eq_tlv), |
| 283 | SOC_SINGLE_TLV("EQ3 B2 Volume", ARIZONA_EQ3_1, ARIZONA_EQ3_B2_GAIN_SHIFT, | 280 | SOC_SINGLE_TLV("EQ3 B2 Volume", ARIZONA_EQ3_1, ARIZONA_EQ3_B2_GAIN_SHIFT, |
| @@ -289,6 +286,8 @@ SOC_SINGLE_TLV("EQ3 B4 Volume", ARIZONA_EQ3_2, ARIZONA_EQ3_B4_GAIN_SHIFT, | |||
| 289 | SOC_SINGLE_TLV("EQ3 B5 Volume", ARIZONA_EQ3_2, ARIZONA_EQ3_B5_GAIN_SHIFT, | 286 | SOC_SINGLE_TLV("EQ3 B5 Volume", ARIZONA_EQ3_2, ARIZONA_EQ3_B5_GAIN_SHIFT, |
| 290 | 24, 0, eq_tlv), | 287 | 24, 0, eq_tlv), |
| 291 | 288 | ||
| 289 | SND_SOC_BYTES("EQ4 Coefficients", ARIZONA_EQ4_3, 19), | ||
| 290 | SOC_SINGLE("EQ4 Mode Switch", ARIZONA_EQ4_2, ARIZONA_EQ4_B1_MODE, 1, 0), | ||
| 292 | SOC_SINGLE_TLV("EQ4 B1 Volume", ARIZONA_EQ4_1, ARIZONA_EQ4_B1_GAIN_SHIFT, | 291 | SOC_SINGLE_TLV("EQ4 B1 Volume", ARIZONA_EQ4_1, ARIZONA_EQ4_B1_GAIN_SHIFT, |
| 293 | 24, 0, eq_tlv), | 292 | 24, 0, eq_tlv), |
| 294 | SOC_SINGLE_TLV("EQ4 B2 Volume", ARIZONA_EQ4_1, ARIZONA_EQ4_B2_GAIN_SHIFT, | 293 | SOC_SINGLE_TLV("EQ4 B2 Volume", ARIZONA_EQ4_1, ARIZONA_EQ4_B2_GAIN_SHIFT, |
diff --git a/sound/soc/codecs/wm8997.c b/sound/soc/codecs/wm8997.c index 555115ee2159..e10f44d7fdb7 100644 --- a/sound/soc/codecs/wm8997.c +++ b/sound/soc/codecs/wm8997.c | |||
| @@ -86,7 +86,7 @@ static int wm8997_sysclk_ev(struct snd_soc_dapm_widget *w, | |||
| 86 | { | 86 | { |
| 87 | struct snd_soc_codec *codec = w->codec; | 87 | struct snd_soc_codec *codec = w->codec; |
| 88 | struct arizona *arizona = dev_get_drvdata(codec->dev->parent); | 88 | struct arizona *arizona = dev_get_drvdata(codec->dev->parent); |
| 89 | struct regmap *regmap = codec->control_data; | 89 | struct regmap *regmap = arizona->regmap; |
| 90 | const struct reg_default *patch = NULL; | 90 | const struct reg_default *patch = NULL; |
| 91 | int i, patch_size; | 91 | int i, patch_size; |
| 92 | 92 | ||
| @@ -123,10 +123,12 @@ static const unsigned int wm8997_osr_val[] = { | |||
| 123 | 123 | ||
| 124 | static const struct soc_enum wm8997_hpout_osr[] = { | 124 | static const struct soc_enum wm8997_hpout_osr[] = { |
| 125 | SOC_VALUE_ENUM_SINGLE(ARIZONA_OUTPUT_PATH_CONFIG_1L, | 125 | SOC_VALUE_ENUM_SINGLE(ARIZONA_OUTPUT_PATH_CONFIG_1L, |
| 126 | ARIZONA_OUT1_OSR_SHIFT, 0x7, 3, | 126 | ARIZONA_OUT1_OSR_SHIFT, 0x7, |
| 127 | ARRAY_SIZE(wm8997_osr_text), | ||
| 127 | wm8997_osr_text, wm8997_osr_val), | 128 | wm8997_osr_text, wm8997_osr_val), |
| 128 | SOC_VALUE_ENUM_SINGLE(ARIZONA_OUTPUT_PATH_CONFIG_3L, | 129 | SOC_VALUE_ENUM_SINGLE(ARIZONA_OUTPUT_PATH_CONFIG_3L, |
| 129 | ARIZONA_OUT3_OSR_SHIFT, 0x7, 3, | 130 | ARIZONA_OUT3_OSR_SHIFT, 0x7, |
| 131 | ARRAY_SIZE(wm8997_osr_text), | ||
| 130 | wm8997_osr_text, wm8997_osr_val), | 132 | wm8997_osr_text, wm8997_osr_val), |
| 131 | }; | 133 | }; |
| 132 | 134 | ||
| @@ -170,15 +172,8 @@ ARIZONA_MIXER_CONTROLS("EQ2", ARIZONA_EQ2MIX_INPUT_1_SOURCE), | |||
| 170 | ARIZONA_MIXER_CONTROLS("EQ3", ARIZONA_EQ3MIX_INPUT_1_SOURCE), | 172 | ARIZONA_MIXER_CONTROLS("EQ3", ARIZONA_EQ3MIX_INPUT_1_SOURCE), |
| 171 | ARIZONA_MIXER_CONTROLS("EQ4", ARIZONA_EQ4MIX_INPUT_1_SOURCE), | 173 | ARIZONA_MIXER_CONTROLS("EQ4", ARIZONA_EQ4MIX_INPUT_1_SOURCE), |
| 172 | 174 | ||
| 173 | SND_SOC_BYTES_MASK("EQ1 Coefficients", ARIZONA_EQ1_1, 21, | 175 | SND_SOC_BYTES("EQ1 Coefficients", ARIZONA_EQ1_3, 19), |
| 174 | ARIZONA_EQ1_ENA_MASK), | 176 | SOC_SINGLE("EQ1 Mode Switch", ARIZONA_EQ1_2, ARIZONA_EQ1_B1_MODE, 1, 0), |
| 175 | SND_SOC_BYTES_MASK("EQ2 Coefficients", ARIZONA_EQ2_1, 21, | ||
| 176 | ARIZONA_EQ2_ENA_MASK), | ||
| 177 | SND_SOC_BYTES_MASK("EQ3 Coefficients", ARIZONA_EQ3_1, 21, | ||
| 178 | ARIZONA_EQ3_ENA_MASK), | ||
| 179 | SND_SOC_BYTES_MASK("EQ4 Coefficients", ARIZONA_EQ4_1, 21, | ||
| 180 | ARIZONA_EQ4_ENA_MASK), | ||
| 181 | |||
| 182 | SOC_SINGLE_TLV("EQ1 B1 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B1_GAIN_SHIFT, | 177 | SOC_SINGLE_TLV("EQ1 B1 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B1_GAIN_SHIFT, |
| 183 | 24, 0, eq_tlv), | 178 | 24, 0, eq_tlv), |
| 184 | SOC_SINGLE_TLV("EQ1 B2 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B2_GAIN_SHIFT, | 179 | SOC_SINGLE_TLV("EQ1 B2 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B2_GAIN_SHIFT, |
| @@ -190,6 +185,8 @@ SOC_SINGLE_TLV("EQ1 B4 Volume", ARIZONA_EQ1_2, ARIZONA_EQ1_B4_GAIN_SHIFT, | |||
| 190 | SOC_SINGLE_TLV("EQ1 B5 Volume", ARIZONA_EQ1_2, ARIZONA_EQ1_B5_GAIN_SHIFT, | 185 | SOC_SINGLE_TLV("EQ1 B5 Volume", ARIZONA_EQ1_2, ARIZONA_EQ1_B5_GAIN_SHIFT, |
| 191 | 24, 0, eq_tlv), | 186 | 24, 0, eq_tlv), |
| 192 | 187 | ||
| 188 | SND_SOC_BYTES("EQ2 Coefficients", ARIZONA_EQ2_3, 19), | ||
| 189 | SOC_SINGLE("EQ2 Mode Switch", ARIZONA_EQ2_2, ARIZONA_EQ2_B1_MODE, 1, 0), | ||
| 193 | SOC_SINGLE_TLV("EQ2 B1 Volume", ARIZONA_EQ2_1, ARIZONA_EQ2_B1_GAIN_SHIFT, | 190 | SOC_SINGLE_TLV("EQ2 B1 Volume", ARIZONA_EQ2_1, ARIZONA_EQ2_B1_GAIN_SHIFT, |
| 194 | 24, 0, eq_tlv), | 191 | 24, 0, eq_tlv), |
| 195 | SOC_SINGLE_TLV("EQ2 B2 Volume", ARIZONA_EQ2_1, ARIZONA_EQ2_B2_GAIN_SHIFT, | 192 | SOC_SINGLE_TLV("EQ2 B2 Volume", ARIZONA_EQ2_1, ARIZONA_EQ2_B2_GAIN_SHIFT, |
| @@ -201,6 +198,8 @@ SOC_SINGLE_TLV("EQ2 B4 Volume", ARIZONA_EQ2_2, ARIZONA_EQ2_B4_GAIN_SHIFT, | |||
| 201 | SOC_SINGLE_TLV("EQ2 B5 Volume", ARIZONA_EQ2_2, ARIZONA_EQ2_B5_GAIN_SHIFT, | 198 | SOC_SINGLE_TLV("EQ2 B5 Volume", ARIZONA_EQ2_2, ARIZONA_EQ2_B5_GAIN_SHIFT, |
| 202 | 24, 0, eq_tlv), | 199 | 24, 0, eq_tlv), |
| 203 | 200 | ||
| 201 | SND_SOC_BYTES("EQ3 Coefficients", ARIZONA_EQ3_3, 19), | ||
| 202 | SOC_SINGLE("EQ3 Mode Switch", ARIZONA_EQ3_2, ARIZONA_EQ3_B1_MODE, 1, 0), | ||
| 204 | SOC_SINGLE_TLV("EQ3 B1 Volume", ARIZONA_EQ3_1, ARIZONA_EQ3_B1_GAIN_SHIFT, | 203 | SOC_SINGLE_TLV("EQ3 B1 Volume", ARIZONA_EQ3_1, ARIZONA_EQ3_B1_GAIN_SHIFT, |
| 205 | 24, 0, eq_tlv), | 204 | 24, 0, eq_tlv), |
| 206 | SOC_SINGLE_TLV("EQ3 B2 Volume", ARIZONA_EQ3_1, ARIZONA_EQ3_B2_GAIN_SHIFT, | 205 | SOC_SINGLE_TLV("EQ3 B2 Volume", ARIZONA_EQ3_1, ARIZONA_EQ3_B2_GAIN_SHIFT, |
| @@ -212,6 +211,8 @@ SOC_SINGLE_TLV("EQ3 B4 Volume", ARIZONA_EQ3_2, ARIZONA_EQ3_B4_GAIN_SHIFT, | |||
| 212 | SOC_SINGLE_TLV("EQ3 B5 Volume", ARIZONA_EQ3_2, ARIZONA_EQ3_B5_GAIN_SHIFT, | 211 | SOC_SINGLE_TLV("EQ3 B5 Volume", ARIZONA_EQ3_2, ARIZONA_EQ3_B5_GAIN_SHIFT, |
| 213 | 24, 0, eq_tlv), | 212 | 24, 0, eq_tlv), |
| 214 | 213 | ||
| 214 | SND_SOC_BYTES("EQ4 Coefficients", ARIZONA_EQ4_3, 19), | ||
| 215 | SOC_SINGLE("EQ4 Mode Switch", ARIZONA_EQ4_2, ARIZONA_EQ4_B1_MODE, 1, 0), | ||
| 215 | SOC_SINGLE_TLV("EQ4 B1 Volume", ARIZONA_EQ4_1, ARIZONA_EQ4_B1_GAIN_SHIFT, | 216 | SOC_SINGLE_TLV("EQ4 B1 Volume", ARIZONA_EQ4_1, ARIZONA_EQ4_B1_GAIN_SHIFT, |
| 216 | 24, 0, eq_tlv), | 217 | 24, 0, eq_tlv), |
| 217 | SOC_SINGLE_TLV("EQ4 B2 Volume", ARIZONA_EQ4_1, ARIZONA_EQ4_B2_GAIN_SHIFT, | 218 | SOC_SINGLE_TLV("EQ4 B2 Volume", ARIZONA_EQ4_1, ARIZONA_EQ4_B2_GAIN_SHIFT, |
diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c index 444626fcab40..bb5f7b4e3ebb 100644 --- a/sound/soc/codecs/wm_adsp.c +++ b/sound/soc/codecs/wm_adsp.c | |||
| @@ -684,24 +684,38 @@ static int wm_adsp_load(struct wm_adsp *dsp) | |||
| 684 | } | 684 | } |
| 685 | 685 | ||
| 686 | if (reg) { | 686 | if (reg) { |
| 687 | buf = wm_adsp_buf_alloc(region->data, | 687 | size_t to_write = PAGE_SIZE; |
| 688 | le32_to_cpu(region->len), | 688 | size_t remain = le32_to_cpu(region->len); |
| 689 | &buf_list); | 689 | const u8 *data = region->data; |
| 690 | if (!buf) { | 690 | |
| 691 | adsp_err(dsp, "Out of memory\n"); | 691 | while (remain > 0) { |
| 692 | ret = -ENOMEM; | 692 | if (remain < PAGE_SIZE) |
| 693 | goto out_fw; | 693 | to_write = remain; |
| 694 | } | 694 | |
| 695 | buf = wm_adsp_buf_alloc(data, | ||
| 696 | to_write, | ||
| 697 | &buf_list); | ||
| 698 | if (!buf) { | ||
| 699 | adsp_err(dsp, "Out of memory\n"); | ||
| 700 | ret = -ENOMEM; | ||
| 701 | goto out_fw; | ||
| 702 | } | ||
| 695 | 703 | ||
| 696 | ret = regmap_raw_write_async(regmap, reg, buf->buf, | 704 | ret = regmap_raw_write_async(regmap, reg, |
| 697 | le32_to_cpu(region->len)); | 705 | buf->buf, |
| 698 | if (ret != 0) { | 706 | to_write); |
| 699 | adsp_err(dsp, | 707 | if (ret != 0) { |
| 700 | "%s.%d: Failed to write %d bytes at %d in %s: %d\n", | 708 | adsp_err(dsp, |
| 701 | file, regions, | 709 | "%s.%d: Failed to write %zd bytes at %d in %s: %d\n", |
| 702 | le32_to_cpu(region->len), offset, | 710 | file, regions, |
| 703 | region_name, ret); | 711 | to_write, offset, |
| 704 | goto out_fw; | 712 | region_name, ret); |
| 713 | goto out_fw; | ||
| 714 | } | ||
| 715 | |||
| 716 | data += to_write; | ||
| 717 | reg += to_write / 2; | ||
| 718 | remain -= to_write; | ||
| 705 | } | 719 | } |
| 706 | } | 720 | } |
| 707 | 721 | ||
| @@ -1679,6 +1693,8 @@ int wm_adsp2_event(struct snd_soc_dapm_widget *w, | |||
| 1679 | list_del(&alg_region->list); | 1693 | list_del(&alg_region->list); |
| 1680 | kfree(alg_region); | 1694 | kfree(alg_region); |
| 1681 | } | 1695 | } |
| 1696 | |||
| 1697 | adsp_dbg(dsp, "Shutdown complete\n"); | ||
| 1682 | break; | 1698 | break; |
| 1683 | 1699 | ||
| 1684 | default: | 1700 | default: |
