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/wm9712', 'asoc/topic/wm9713' and 'asoc/topic/zte' into asoc-next

+97 -120
+1
sound/soc/codecs/Kconfig
··· 1083 1083 1084 1084 config SND_SOC_WM9712 1085 1085 tristate 1086 + select REGMAP_AC97 1086 1087 1087 1088 config SND_SOC_WM9713 1088 1089 tristate
+85 -90
sound/soc/codecs/wm9712.c
··· 15 15 #include <linux/module.h> 16 16 #include <linux/kernel.h> 17 17 #include <linux/device.h> 18 + #include <linux/regmap.h> 18 19 #include <sound/core.h> 19 20 #include <sound/pcm.h> 20 21 #include <sound/ac97_codec.h> 21 22 #include <sound/initval.h> 22 23 #include <sound/soc.h> 23 24 #include <sound/tlv.h> 24 - #include "wm9712.h" 25 25 26 26 #define WM9712_VENDOR_ID 0x574d4c12 27 27 #define WM9712_VENDOR_ID_MASK 0xffffffff ··· 32 32 struct mutex lock; 33 33 }; 34 34 35 - static unsigned int ac97_read(struct snd_soc_codec *codec, 36 - unsigned int reg); 37 - static int ac97_write(struct snd_soc_codec *codec, 38 - unsigned int reg, unsigned int val); 35 + static const struct reg_default wm9712_reg_defaults[] = { 36 + { 0x02, 0x8000 }, 37 + { 0x04, 0x8000 }, 38 + { 0x06, 0x8000 }, 39 + { 0x08, 0x0f0f }, 40 + { 0x0a, 0xaaa0 }, 41 + { 0x0c, 0xc008 }, 42 + { 0x0e, 0x6808 }, 43 + { 0x10, 0xe808 }, 44 + { 0x12, 0xaaa0 }, 45 + { 0x14, 0xad00 }, 46 + { 0x16, 0x8000 }, 47 + { 0x18, 0xe808 }, 48 + { 0x1a, 0x3000 }, 49 + { 0x1c, 0x8000 }, 50 + { 0x20, 0x0000 }, 51 + { 0x22, 0x0000 }, 52 + { 0x26, 0x000f }, 53 + { 0x28, 0x0605 }, 54 + { 0x2a, 0x0410 }, 55 + { 0x2c, 0xbb80 }, 56 + { 0x2e, 0xbb80 }, 57 + { 0x32, 0xbb80 }, 58 + { 0x34, 0x2000 }, 59 + { 0x4c, 0xf83e }, 60 + { 0x4e, 0xffff }, 61 + { 0x50, 0x0000 }, 62 + { 0x52, 0x0000 }, 63 + { 0x56, 0xf83e }, 64 + { 0x58, 0x0008 }, 65 + { 0x5c, 0x0000 }, 66 + { 0x60, 0xb032 }, 67 + { 0x62, 0x3e00 }, 68 + { 0x64, 0x0000 }, 69 + { 0x76, 0x0006 }, 70 + { 0x78, 0x0001 }, 71 + { 0x7a, 0x0000 }, 72 + }; 39 73 40 - /* 41 - * WM9712 register cache 42 - */ 43 - static const u16 wm9712_reg[] = { 44 - 0x6174, 0x8000, 0x8000, 0x8000, /* 6 */ 45 - 0x0f0f, 0xaaa0, 0xc008, 0x6808, /* e */ 46 - 0xe808, 0xaaa0, 0xad00, 0x8000, /* 16 */ 47 - 0xe808, 0x3000, 0x8000, 0x0000, /* 1e */ 48 - 0x0000, 0x0000, 0x0000, 0x000f, /* 26 */ 49 - 0x0405, 0x0410, 0xbb80, 0xbb80, /* 2e */ 50 - 0x0000, 0xbb80, 0x0000, 0x0000, /* 36 */ 51 - 0x0000, 0x2000, 0x0000, 0x0000, /* 3e */ 52 - 0x0000, 0x0000, 0x0000, 0x0000, /* 46 */ 53 - 0x0000, 0x0000, 0xf83e, 0xffff, /* 4e */ 54 - 0x0000, 0x0000, 0x0000, 0xf83e, /* 56 */ 55 - 0x0008, 0x0000, 0x0000, 0x0000, /* 5e */ 56 - 0xb032, 0x3e00, 0x0000, 0x0000, /* 66 */ 57 - 0x0000, 0x0000, 0x0000, 0x0000, /* 6e */ 58 - 0x0000, 0x0000, 0x0000, 0x0006, /* 76 */ 59 - 0x0001, 0x0000, 0x574d, 0x4c12, /* 7e */ 74 + static bool wm9712_volatile_reg(struct device *dev, unsigned int reg) 75 + { 76 + switch (reg) { 77 + case AC97_REC_GAIN: 78 + return true; 79 + default: 80 + return regmap_ac97_default_volatile(dev, reg); 81 + } 82 + } 83 + 84 + static const struct regmap_config wm9712_regmap_config = { 85 + .reg_bits = 16, 86 + .reg_stride = 2, 87 + .val_bits = 16, 88 + .max_register = 0x7e, 89 + .cache_type = REGCACHE_RBTREE, 90 + 91 + .volatile_reg = wm9712_volatile_reg, 92 + 93 + .reg_defaults = wm9712_reg_defaults, 94 + .num_reg_defaults = ARRAY_SIZE(wm9712_reg_defaults), 60 95 }; 61 96 62 97 #define HPL_MIXER 0x0 ··· 520 485 {"ROUT2", NULL, "Speaker PGA"}, 521 486 }; 522 487 523 - static unsigned int ac97_read(struct snd_soc_codec *codec, 524 - unsigned int reg) 525 - { 526 - struct wm9712_priv *wm9712 = snd_soc_codec_get_drvdata(codec); 527 - u16 *cache = codec->reg_cache; 528 - 529 - if (reg == AC97_RESET || reg == AC97_GPIO_STATUS || 530 - reg == AC97_VENDOR_ID1 || reg == AC97_VENDOR_ID2 || 531 - reg == AC97_REC_GAIN) 532 - return soc_ac97_ops->read(wm9712->ac97, reg); 533 - else { 534 - reg = reg >> 1; 535 - 536 - if (reg >= (ARRAY_SIZE(wm9712_reg))) 537 - return -EIO; 538 - 539 - return cache[reg]; 540 - } 541 - } 542 - 543 - static int ac97_write(struct snd_soc_codec *codec, unsigned int reg, 544 - unsigned int val) 545 - { 546 - struct wm9712_priv *wm9712 = snd_soc_codec_get_drvdata(codec); 547 - u16 *cache = codec->reg_cache; 548 - 549 - soc_ac97_ops->write(wm9712->ac97, reg, val); 550 - reg = reg >> 1; 551 - if (reg < (ARRAY_SIZE(wm9712_reg))) 552 - cache[reg] = val; 553 - 554 - return 0; 555 - } 556 - 557 488 static int ac97_prepare(struct snd_pcm_substream *substream, 558 489 struct snd_soc_dai *dai) 559 490 { 560 491 struct snd_soc_codec *codec = dai->codec; 561 492 int reg; 562 - u16 vra; 563 493 struct snd_pcm_runtime *runtime = substream->runtime; 564 494 565 - vra = ac97_read(codec, AC97_EXTENDED_STATUS); 566 - ac97_write(codec, AC97_EXTENDED_STATUS, vra | 0x1); 495 + snd_soc_update_bits(codec, AC97_EXTENDED_STATUS, 0x1, 0x1); 567 496 568 497 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) 569 498 reg = AC97_PCM_FRONT_DAC_RATE; 570 499 else 571 500 reg = AC97_PCM_LR_ADC_RATE; 572 501 573 - return ac97_write(codec, reg, runtime->rate); 502 + return snd_soc_write(codec, reg, runtime->rate); 574 503 } 575 504 576 505 static int ac97_aux_prepare(struct snd_pcm_substream *substream, 577 506 struct snd_soc_dai *dai) 578 507 { 579 508 struct snd_soc_codec *codec = dai->codec; 580 - u16 vra, xsle; 581 509 struct snd_pcm_runtime *runtime = substream->runtime; 582 510 583 - vra = ac97_read(codec, AC97_EXTENDED_STATUS); 584 - ac97_write(codec, AC97_EXTENDED_STATUS, vra | 0x1); 585 - xsle = ac97_read(codec, AC97_PCI_SID); 586 - ac97_write(codec, AC97_PCI_SID, xsle | 0x8000); 511 + snd_soc_update_bits(codec, AC97_EXTENDED_STATUS, 0x1, 0x1); 512 + snd_soc_update_bits(codec, AC97_PCI_SID, 0x8000, 0x8000); 587 513 588 514 if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK) 589 515 return -ENODEV; 590 516 591 - return ac97_write(codec, AC97_PCM_SURR_DAC_RATE, runtime->rate); 517 + return snd_soc_write(codec, AC97_PCM_SURR_DAC_RATE, runtime->rate); 592 518 } 593 519 594 520 #define WM9712_AC97_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 |\ ··· 601 605 case SND_SOC_BIAS_PREPARE: 602 606 break; 603 607 case SND_SOC_BIAS_STANDBY: 604 - ac97_write(codec, AC97_POWERDOWN, 0x0000); 608 + snd_soc_write(codec, AC97_POWERDOWN, 0x0000); 605 609 break; 606 610 case SND_SOC_BIAS_OFF: 607 611 /* disable everything including AC link */ 608 - ac97_write(codec, AC97_EXTENDED_MSTATUS, 0xffff); 609 - ac97_write(codec, AC97_POWERDOWN, 0xffff); 612 + snd_soc_write(codec, AC97_EXTENDED_MSTATUS, 0xffff); 613 + snd_soc_write(codec, AC97_POWERDOWN, 0xffff); 610 614 break; 611 615 } 612 616 return 0; ··· 615 619 static int wm9712_soc_resume(struct snd_soc_codec *codec) 616 620 { 617 621 struct wm9712_priv *wm9712 = snd_soc_codec_get_drvdata(codec); 618 - int i, ret; 619 - u16 *cache = codec->reg_cache; 622 + int ret; 620 623 621 624 ret = snd_ac97_reset(wm9712->ac97, true, WM9712_VENDOR_ID, 622 625 WM9712_VENDOR_ID_MASK); ··· 624 629 625 630 snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_STANDBY); 626 631 627 - if (ret == 0) { 628 - /* Sync reg_cache with the hardware after cold reset */ 629 - for (i = 2; i < ARRAY_SIZE(wm9712_reg) << 1; i += 2) { 630 - if (i == AC97_INT_PAGING || i == AC97_POWERDOWN || 631 - (i > 0x58 && i != 0x5c)) 632 - continue; 633 - soc_ac97_ops->write(wm9712->ac97, i, cache[i>>1]); 634 - } 635 - } 632 + if (ret == 0) 633 + regcache_sync(codec->component.regmap); 636 634 637 635 return ret; 638 636 } ··· 633 645 static int wm9712_soc_probe(struct snd_soc_codec *codec) 634 646 { 635 647 struct wm9712_priv *wm9712 = snd_soc_codec_get_drvdata(codec); 648 + struct regmap *regmap; 636 649 int ret; 637 650 638 651 wm9712->ac97 = snd_soc_new_ac97_codec(codec, WM9712_VENDOR_ID, ··· 644 655 return ret; 645 656 } 646 657 658 + regmap = regmap_init_ac97(wm9712->ac97, &wm9712_regmap_config); 659 + if (IS_ERR(regmap)) { 660 + ret = PTR_ERR(regmap); 661 + goto err_free_ac97_codec; 662 + } 663 + 664 + snd_soc_codec_init_regmap(codec, regmap); 665 + 647 666 /* set alc mux to none */ 648 - ac97_write(codec, AC97_VIDEO, ac97_read(codec, AC97_VIDEO) | 0x3000); 667 + snd_soc_update_bits(codec, AC97_VIDEO, 0x3000, 0x3000); 649 668 650 669 return 0; 670 + err_free_ac97_codec: 671 + snd_soc_free_ac97_codec(wm9712->ac97); 672 + return ret; 651 673 } 652 674 653 675 static int wm9712_soc_remove(struct snd_soc_codec *codec) 654 676 { 655 677 struct wm9712_priv *wm9712 = snd_soc_codec_get_drvdata(codec); 656 678 679 + snd_soc_codec_exit_regmap(codec); 657 680 snd_soc_free_ac97_codec(wm9712->ac97); 658 681 return 0; 659 682 } ··· 674 673 .probe = wm9712_soc_probe, 675 674 .remove = wm9712_soc_remove, 676 675 .resume = wm9712_soc_resume, 677 - .read = ac97_read, 678 - .write = ac97_write, 679 676 .set_bias_level = wm9712_set_bias_level, 680 677 .suspend_bias_off = true, 681 - .reg_cache_size = ARRAY_SIZE(wm9712_reg), 682 - .reg_word_size = sizeof(u16), 683 - .reg_cache_step = 2, 684 - .reg_cache_default = wm9712_reg, 685 678 686 679 .component_driver = { 687 680 .controls = wm9712_snd_ac97_controls,
-11
sound/soc/codecs/wm9712.h
··· 1 - /* 2 - * wm9712.h -- WM9712 Soc Audio driver 3 - */ 4 - 5 - #ifndef _WM9712_H 6 - #define _WM9712_H 7 - 8 - #define WM9712_DAI_AC97_HIFI 0 9 - #define WM9712_DAI_AC97_AUX 1 10 - 11 - #endif
-4
sound/soc/codecs/wm9713.h
··· 41 41 #define WM9713_PCMBCLK_DIV_8 (3 << 9) 42 42 #define WM9713_PCMBCLK_DIV_16 (4 << 9) 43 43 44 - #define WM9713_DAI_AC97_HIFI 0 45 - #define WM9713_DAI_AC97_AUX 1 46 - #define WM9713_DAI_PCM_VOICE 2 47 - 48 44 #endif
-1
sound/soc/pxa/e800_wm9712.c
··· 21 21 #include <mach/audio.h> 22 22 #include <mach/eseries-gpio.h> 23 23 24 - #include "../codecs/wm9712.h" 25 24 #include "pxa2xx-ac97.h" 26 25 27 26 static int e800_spk_amp_event(struct snd_soc_dapm_widget *w,
-1
sound/soc/pxa/em-x270.c
··· 30 30 #include <asm/mach-types.h> 31 31 #include <mach/audio.h> 32 32 33 - #include "../codecs/wm9712.h" 34 33 #include "pxa2xx-ac97.h" 35 34 36 35 static struct snd_soc_dai_link em_x270_dai[] = {
-1
sound/soc/pxa/palm27x.c
··· 27 27 #include <mach/audio.h> 28 28 #include <linux/platform_data/asoc-palm27x.h> 29 29 30 - #include "../codecs/wm9712.h" 31 30 #include "pxa2xx-ac97.h" 32 31 33 32 static struct snd_soc_jack hs_jack;
-1
sound/soc/pxa/tosa.c
··· 31 31 #include <mach/tosa.h> 32 32 #include <mach/audio.h> 33 33 34 - #include "../codecs/wm9712.h" 35 34 #include "pxa2xx-ac97.h" 36 35 37 36 #define TOSA_HP 0
+8 -8
sound/soc/zte/Kconfig
··· 1 - config ZX296702_SPDIF 2 - tristate "ZX296702 spdif" 3 - depends on SOC_ZX296702 || COMPILE_TEST 1 + config ZX_SPDIF 2 + tristate "ZTE ZX SPDIF Driver Support" 3 + depends on ARCH_ZX || COMPILE_TEST 4 4 depends on COMMON_CLK 5 5 select SND_SOC_GENERIC_DMAENGINE_PCM 6 6 help 7 7 Say Y or M if you want to add support for codecs attached to the 8 - zx296702 spdif interface 8 + ZTE ZX SPDIF interface 9 9 10 - config ZX296702_I2S 11 - tristate "ZX296702 i2s" 12 - depends on SOC_ZX296702 || COMPILE_TEST 10 + config ZX_I2S 11 + tristate "ZTE ZX I2S Driver Support" 12 + depends on ARCH_ZX || COMPILE_TEST 13 13 depends on COMMON_CLK 14 14 select SND_SOC_GENERIC_DMAENGINE_PCM 15 15 help 16 16 Say Y or M if you want to add support for codecs attached to the 17 - zx296702 i2s interface 17 + ZTE ZX I2S interface
+2 -2
sound/soc/zte/Makefile
··· 1 - obj-$(CONFIG_ZX296702_SPDIF) += zx296702-spdif.o 2 - obj-$(CONFIG_ZX296702_I2S) += zx296702-i2s.o 1 + obj-$(CONFIG_ZX_SPDIF) += zx-spdif.o 2 + obj-$(CONFIG_ZX_I2S) += zx-i2s.o
sound/soc/zte/zx296702-i2s.c sound/soc/zte/zx-i2s.c
+1 -1
sound/soc/zte/zx296702-spdif.c sound/soc/zte/zx-spdif.c
··· 71 71 #define ZX_VALID_RIGHT_TRACK (2 << 0) 72 72 #define ZX_VALID_TRACK_MASK (3 << 0) 73 73 74 - #define ZX_SPDIF_CLK_RAT (4 * 32) 74 + #define ZX_SPDIF_CLK_RAT (2 * 32) 75 75 76 76 struct zx_spdif_info { 77 77 struct snd_dmaengine_dai_dma_data dma_data;