diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2014-12-08 20:39:29 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2014-12-08 20:39:29 -0500 |
commit | ba00410b8131b23edfb0e09f8b6dd26c8eb621fb (patch) | |
tree | c08504e4d2fa51ac91cef544f336d0169806c49f /sound | |
parent | 8ce74dd6057832618957fc2cbd38fa959c3a0a6c (diff) | |
parent | aa583096d9767892983332e7c1a984bd17e3cd39 (diff) |
Merge branch 'iov_iter' into for-next
Diffstat (limited to 'sound')
41 files changed, 438 insertions, 1600 deletions
diff --git a/sound/core/pcm_compat.c b/sound/core/pcm_compat.c index 102e8fd1d450..2d957ba63557 100644 --- a/sound/core/pcm_compat.c +++ b/sound/core/pcm_compat.c | |||
@@ -210,6 +210,8 @@ static int snd_pcm_status_user_compat(struct snd_pcm_substream *substream, | |||
210 | if (err < 0) | 210 | if (err < 0) |
211 | return err; | 211 | return err; |
212 | 212 | ||
213 | if (clear_user(src, sizeof(*src))) | ||
214 | return -EFAULT; | ||
213 | if (put_user(status.state, &src->state) || | 215 | if (put_user(status.state, &src->state) || |
214 | compat_put_timespec(&status.trigger_tstamp, &src->trigger_tstamp) || | 216 | compat_put_timespec(&status.trigger_tstamp, &src->trigger_tstamp) || |
215 | compat_put_timespec(&status.tstamp, &src->tstamp) || | 217 | compat_put_timespec(&status.tstamp, &src->tstamp) || |
diff --git a/sound/firewire/bebob/bebob_focusrite.c b/sound/firewire/bebob/bebob_focusrite.c index 45a0eed6d5b1..3b052ed0fbf5 100644 --- a/sound/firewire/bebob/bebob_focusrite.c +++ b/sound/firewire/bebob/bebob_focusrite.c | |||
@@ -27,12 +27,14 @@ | |||
27 | #define SAFFIRE_CLOCK_SOURCE_INTERNAL 0 | 27 | #define SAFFIRE_CLOCK_SOURCE_INTERNAL 0 |
28 | #define SAFFIRE_CLOCK_SOURCE_SPDIF 1 | 28 | #define SAFFIRE_CLOCK_SOURCE_SPDIF 1 |
29 | 29 | ||
30 | /* '1' is absent, why... */ | 30 | /* clock sources as returned from register of Saffire Pro 10 and 26 */ |
31 | #define SAFFIREPRO_CLOCK_SOURCE_INTERNAL 0 | 31 | #define SAFFIREPRO_CLOCK_SOURCE_INTERNAL 0 |
32 | #define SAFFIREPRO_CLOCK_SOURCE_SKIP 1 /* never used on hardware */ | ||
32 | #define SAFFIREPRO_CLOCK_SOURCE_SPDIF 2 | 33 | #define SAFFIREPRO_CLOCK_SOURCE_SPDIF 2 |
33 | #define SAFFIREPRO_CLOCK_SOURCE_ADAT1 3 | 34 | #define SAFFIREPRO_CLOCK_SOURCE_ADAT1 3 /* not used on s.pro. 10 */ |
34 | #define SAFFIREPRO_CLOCK_SOURCE_ADAT2 4 | 35 | #define SAFFIREPRO_CLOCK_SOURCE_ADAT2 4 /* not used on s.pro. 10 */ |
35 | #define SAFFIREPRO_CLOCK_SOURCE_WORDCLOCK 5 | 36 | #define SAFFIREPRO_CLOCK_SOURCE_WORDCLOCK 5 |
37 | #define SAFFIREPRO_CLOCK_SOURCE_COUNT 6 | ||
36 | 38 | ||
37 | /* S/PDIF, ADAT1, ADAT2 is enabled or not. three quadlets */ | 39 | /* S/PDIF, ADAT1, ADAT2 is enabled or not. three quadlets */ |
38 | #define SAFFIREPRO_ENABLE_DIG_IFACES 0x01a4 | 40 | #define SAFFIREPRO_ENABLE_DIG_IFACES 0x01a4 |
@@ -101,13 +103,34 @@ saffire_write_quad(struct snd_bebob *bebob, u64 offset, u32 value) | |||
101 | &data, sizeof(__be32), 0); | 103 | &data, sizeof(__be32), 0); |
102 | } | 104 | } |
103 | 105 | ||
106 | static char *const saffirepro_10_clk_src_labels[] = { | ||
107 | SND_BEBOB_CLOCK_INTERNAL, "S/PDIF", "Word Clock" | ||
108 | }; | ||
104 | static char *const saffirepro_26_clk_src_labels[] = { | 109 | static char *const saffirepro_26_clk_src_labels[] = { |
105 | SND_BEBOB_CLOCK_INTERNAL, "S/PDIF", "ADAT1", "ADAT2", "Word Clock" | 110 | SND_BEBOB_CLOCK_INTERNAL, "S/PDIF", "ADAT1", "ADAT2", "Word Clock" |
106 | }; | 111 | }; |
107 | 112 | /* Value maps between registers and labels for SaffirePro 10/26. */ | |
108 | static char *const saffirepro_10_clk_src_labels[] = { | 113 | static const signed char saffirepro_clk_maps[][SAFFIREPRO_CLOCK_SOURCE_COUNT] = { |
109 | SND_BEBOB_CLOCK_INTERNAL, "S/PDIF", "Word Clock" | 114 | /* SaffirePro 10 */ |
115 | [0] = { | ||
116 | [SAFFIREPRO_CLOCK_SOURCE_INTERNAL] = 0, | ||
117 | [SAFFIREPRO_CLOCK_SOURCE_SKIP] = -1, /* not supported */ | ||
118 | [SAFFIREPRO_CLOCK_SOURCE_SPDIF] = 1, | ||
119 | [SAFFIREPRO_CLOCK_SOURCE_ADAT1] = -1, /* not supported */ | ||
120 | [SAFFIREPRO_CLOCK_SOURCE_ADAT2] = -1, /* not supported */ | ||
121 | [SAFFIREPRO_CLOCK_SOURCE_WORDCLOCK] = 2, | ||
122 | }, | ||
123 | /* SaffirePro 26 */ | ||
124 | [1] = { | ||
125 | [SAFFIREPRO_CLOCK_SOURCE_INTERNAL] = 0, | ||
126 | [SAFFIREPRO_CLOCK_SOURCE_SKIP] = -1, /* not supported */ | ||
127 | [SAFFIREPRO_CLOCK_SOURCE_SPDIF] = 1, | ||
128 | [SAFFIREPRO_CLOCK_SOURCE_ADAT1] = 2, | ||
129 | [SAFFIREPRO_CLOCK_SOURCE_ADAT2] = 3, | ||
130 | [SAFFIREPRO_CLOCK_SOURCE_WORDCLOCK] = 4, | ||
131 | } | ||
110 | }; | 132 | }; |
133 | |||
111 | static int | 134 | static int |
112 | saffirepro_both_clk_freq_get(struct snd_bebob *bebob, unsigned int *rate) | 135 | saffirepro_both_clk_freq_get(struct snd_bebob *bebob, unsigned int *rate) |
113 | { | 136 | { |
@@ -138,24 +161,35 @@ saffirepro_both_clk_freq_set(struct snd_bebob *bebob, unsigned int rate) | |||
138 | 161 | ||
139 | return saffire_write_quad(bebob, SAFFIREPRO_RATE_NOREBOOT, id); | 162 | return saffire_write_quad(bebob, SAFFIREPRO_RATE_NOREBOOT, id); |
140 | } | 163 | } |
164 | |||
165 | /* | ||
166 | * query hardware for current clock source, return our internally | ||
167 | * used clock index in *id, depending on hardware. | ||
168 | */ | ||
141 | static int | 169 | static int |
142 | saffirepro_both_clk_src_get(struct snd_bebob *bebob, unsigned int *id) | 170 | saffirepro_both_clk_src_get(struct snd_bebob *bebob, unsigned int *id) |
143 | { | 171 | { |
144 | int err; | 172 | int err; |
145 | u32 value; | 173 | u32 value; /* clock source read from hw register */ |
174 | const signed char *map; | ||
146 | 175 | ||
147 | err = saffire_read_quad(bebob, SAFFIREPRO_OFFSET_CLOCK_SOURCE, &value); | 176 | err = saffire_read_quad(bebob, SAFFIREPRO_OFFSET_CLOCK_SOURCE, &value); |
148 | if (err < 0) | 177 | if (err < 0) |
149 | goto end; | 178 | goto end; |
150 | 179 | ||
151 | if (bebob->spec->clock->labels == saffirepro_10_clk_src_labels) { | 180 | /* depending on hardware, use a different mapping */ |
152 | if (value == SAFFIREPRO_CLOCK_SOURCE_WORDCLOCK) | 181 | if (bebob->spec->clock->labels == saffirepro_10_clk_src_labels) |
153 | *id = 2; | 182 | map = saffirepro_clk_maps[0]; |
154 | else if (value == SAFFIREPRO_CLOCK_SOURCE_SPDIF) | 183 | else |
155 | *id = 1; | 184 | map = saffirepro_clk_maps[1]; |
156 | } else if (value > 1) { | 185 | |
157 | *id = value - 1; | 186 | /* In a case that this driver cannot handle the value of register. */ |
187 | if (value >= SAFFIREPRO_CLOCK_SOURCE_COUNT || map[value] < 0) { | ||
188 | err = -EIO; | ||
189 | goto end; | ||
158 | } | 190 | } |
191 | |||
192 | *id = (unsigned int)map[value]; | ||
159 | end: | 193 | end: |
160 | return err; | 194 | return err; |
161 | } | 195 | } |
diff --git a/sound/firewire/bebob/bebob_stream.c b/sound/firewire/bebob/bebob_stream.c index ef4d0c9f6578..1aab0a32870c 100644 --- a/sound/firewire/bebob/bebob_stream.c +++ b/sound/firewire/bebob/bebob_stream.c | |||
@@ -129,12 +129,24 @@ snd_bebob_stream_check_internal_clock(struct snd_bebob *bebob, bool *internal) | |||
129 | /* 1.The device has its own operation to switch source of clock */ | 129 | /* 1.The device has its own operation to switch source of clock */ |
130 | if (clk_spec) { | 130 | if (clk_spec) { |
131 | err = clk_spec->get(bebob, &id); | 131 | err = clk_spec->get(bebob, &id); |
132 | if (err < 0) | 132 | if (err < 0) { |
133 | dev_err(&bebob->unit->device, | 133 | dev_err(&bebob->unit->device, |
134 | "fail to get clock source: %d\n", err); | 134 | "fail to get clock source: %d\n", err); |
135 | else if (strncmp(clk_spec->labels[id], SND_BEBOB_CLOCK_INTERNAL, | 135 | goto end; |
136 | strlen(SND_BEBOB_CLOCK_INTERNAL)) == 0) | 136 | } |
137 | |||
138 | if (id >= clk_spec->num) { | ||
139 | dev_err(&bebob->unit->device, | ||
140 | "clock source %d out of range 0..%d\n", | ||
141 | id, clk_spec->num - 1); | ||
142 | err = -EIO; | ||
143 | goto end; | ||
144 | } | ||
145 | |||
146 | if (strncmp(clk_spec->labels[id], SND_BEBOB_CLOCK_INTERNAL, | ||
147 | strlen(SND_BEBOB_CLOCK_INTERNAL)) == 0) | ||
137 | *internal = true; | 148 | *internal = true; |
149 | |||
138 | goto end; | 150 | goto end; |
139 | } | 151 | } |
140 | 152 | ||
diff --git a/sound/firewire/bebob/bebob_terratec.c b/sound/firewire/bebob/bebob_terratec.c index 0e4c0bfc463b..9940611f2e1b 100644 --- a/sound/firewire/bebob/bebob_terratec.c +++ b/sound/firewire/bebob/bebob_terratec.c | |||
@@ -24,7 +24,12 @@ phase88_rack_clk_src_get(struct snd_bebob *bebob, unsigned int *id) | |||
24 | if (err < 0) | 24 | if (err < 0) |
25 | goto end; | 25 | goto end; |
26 | 26 | ||
27 | *id = (enable_ext & 0x01) | ((enable_word & 0x01) << 1); | 27 | if (enable_ext == 0) |
28 | *id = 0; | ||
29 | else if (enable_word == 0) | ||
30 | *id = 1; | ||
31 | else | ||
32 | *id = 2; | ||
28 | end: | 33 | end: |
29 | return err; | 34 | return err; |
30 | } | 35 | } |
diff --git a/sound/pci/ad1889.c b/sound/pci/ad1889.c index 7bfdf9c51416..1610c38337af 100644 --- a/sound/pci/ad1889.c +++ b/sound/pci/ad1889.c | |||
@@ -681,7 +681,7 @@ snd_ad1889_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffe | |||
681 | 681 | ||
682 | /* WARQ is at offset 12 */ | 682 | /* WARQ is at offset 12 */ |
683 | tmp = (reg & AD_DS_WSMC_WARQ) ? | 683 | tmp = (reg & AD_DS_WSMC_WARQ) ? |
684 | (((reg & AD_DS_WSMC_WARQ >> 12) & 0x01) ? 12 : 18) : 4; | 684 | ((((reg & AD_DS_WSMC_WARQ) >> 12) & 0x01) ? 12 : 18) : 4; |
685 | tmp /= (reg & AD_DS_WSMC_WAST) ? 2 : 1; | 685 | tmp /= (reg & AD_DS_WSMC_WAST) ? 2 : 1; |
686 | 686 | ||
687 | snd_iprintf(buffer, "Wave FIFO: %d %s words\n\n", tmp, | 687 | snd_iprintf(buffer, "Wave FIFO: %d %s words\n\n", tmp, |
@@ -693,7 +693,7 @@ snd_ad1889_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffe | |||
693 | 693 | ||
694 | /* SYRQ is at offset 4 */ | 694 | /* SYRQ is at offset 4 */ |
695 | tmp = (reg & AD_DS_WSMC_SYRQ) ? | 695 | tmp = (reg & AD_DS_WSMC_SYRQ) ? |
696 | (((reg & AD_DS_WSMC_SYRQ >> 4) & 0x01) ? 12 : 18) : 4; | 696 | ((((reg & AD_DS_WSMC_SYRQ) >> 4) & 0x01) ? 12 : 18) : 4; |
697 | tmp /= (reg & AD_DS_WSMC_WAST) ? 2 : 1; | 697 | tmp /= (reg & AD_DS_WSMC_WAST) ? 2 : 1; |
698 | 698 | ||
699 | snd_iprintf(buffer, "Synthesis FIFO: %d %s words\n\n", tmp, | 699 | snd_iprintf(buffer, "Synthesis FIFO: %d %s words\n\n", tmp, |
@@ -709,7 +709,7 @@ snd_ad1889_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffe | |||
709 | 709 | ||
710 | /* ACRQ is at offset 4 */ | 710 | /* ACRQ is at offset 4 */ |
711 | tmp = (reg & AD_DS_RAMC_ACRQ) ? | 711 | tmp = (reg & AD_DS_RAMC_ACRQ) ? |
712 | (((reg & AD_DS_RAMC_ACRQ >> 4) & 0x01) ? 12 : 18) : 4; | 712 | ((((reg & AD_DS_RAMC_ACRQ) >> 4) & 0x01) ? 12 : 18) : 4; |
713 | tmp /= (reg & AD_DS_RAMC_ADST) ? 2 : 1; | 713 | tmp /= (reg & AD_DS_RAMC_ADST) ? 2 : 1; |
714 | 714 | ||
715 | snd_iprintf(buffer, "ADC FIFO: %d %s words\n\n", tmp, | 715 | snd_iprintf(buffer, "ADC FIFO: %d %s words\n\n", tmp, |
@@ -720,7 +720,7 @@ snd_ad1889_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffe | |||
720 | 720 | ||
721 | /* RERQ is at offset 12 */ | 721 | /* RERQ is at offset 12 */ |
722 | tmp = (reg & AD_DS_RAMC_RERQ) ? | 722 | tmp = (reg & AD_DS_RAMC_RERQ) ? |
723 | (((reg & AD_DS_RAMC_RERQ >> 12) & 0x01) ? 12 : 18) : 4; | 723 | ((((reg & AD_DS_RAMC_RERQ) >> 12) & 0x01) ? 12 : 18) : 4; |
724 | tmp /= (reg & AD_DS_RAMC_ADST) ? 2 : 1; | 724 | tmp /= (reg & AD_DS_RAMC_ADST) ? 2 : 1; |
725 | 725 | ||
726 | snd_iprintf(buffer, "Resampler FIFO: %d %s words\n\n", tmp, | 726 | snd_iprintf(buffer, "Resampler FIFO: %d %s words\n\n", tmp, |
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index cfcca4c30d4d..16660f312043 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -219,6 +219,7 @@ MODULE_SUPPORTED_DEVICE("{{Intel, ICH6}," | |||
219 | "{Intel, LPT_LP}," | 219 | "{Intel, LPT_LP}," |
220 | "{Intel, WPT_LP}," | 220 | "{Intel, WPT_LP}," |
221 | "{Intel, SPT}," | 221 | "{Intel, SPT}," |
222 | "{Intel, SPT_LP}," | ||
222 | "{Intel, HPT}," | 223 | "{Intel, HPT}," |
223 | "{Intel, PBG}," | 224 | "{Intel, PBG}," |
224 | "{Intel, SCH}," | 225 | "{Intel, SCH}," |
@@ -374,6 +375,8 @@ static void __mark_pages_wc(struct azx *chip, struct snd_dma_buffer *dmab, bool | |||
374 | #ifdef CONFIG_SND_DMA_SGBUF | 375 | #ifdef CONFIG_SND_DMA_SGBUF |
375 | if (dmab->dev.type == SNDRV_DMA_TYPE_DEV_SG) { | 376 | if (dmab->dev.type == SNDRV_DMA_TYPE_DEV_SG) { |
376 | struct snd_sg_buf *sgbuf = dmab->private_data; | 377 | struct snd_sg_buf *sgbuf = dmab->private_data; |
378 | if (chip->driver_type == AZX_DRIVER_CMEDIA) | ||
379 | return; /* deal with only CORB/RIRB buffers */ | ||
377 | if (on) | 380 | if (on) |
378 | set_pages_array_wc(sgbuf->page_table, sgbuf->pages); | 381 | set_pages_array_wc(sgbuf->page_table, sgbuf->pages); |
379 | else | 382 | else |
@@ -1769,7 +1772,7 @@ static void pcm_mmap_prepare(struct snd_pcm_substream *substream, | |||
1769 | #ifdef CONFIG_X86 | 1772 | #ifdef CONFIG_X86 |
1770 | struct azx_pcm *apcm = snd_pcm_substream_chip(substream); | 1773 | struct azx_pcm *apcm = snd_pcm_substream_chip(substream); |
1771 | struct azx *chip = apcm->chip; | 1774 | struct azx *chip = apcm->chip; |
1772 | if (!azx_snoop(chip)) | 1775 | if (!azx_snoop(chip) && chip->driver_type != AZX_DRIVER_CMEDIA) |
1773 | area->vm_page_prot = pgprot_writecombine(area->vm_page_prot); | 1776 | area->vm_page_prot = pgprot_writecombine(area->vm_page_prot); |
1774 | #endif | 1777 | #endif |
1775 | } | 1778 | } |
@@ -2002,6 +2005,9 @@ static const struct pci_device_id azx_ids[] = { | |||
2002 | /* Sunrise Point */ | 2005 | /* Sunrise Point */ |
2003 | { PCI_DEVICE(0x8086, 0xa170), | 2006 | { PCI_DEVICE(0x8086, 0xa170), |
2004 | .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, | 2007 | .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, |
2008 | /* Sunrise Point-LP */ | ||
2009 | { PCI_DEVICE(0x8086, 0x9d70), | ||
2010 | .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, | ||
2005 | /* Haswell */ | 2011 | /* Haswell */ |
2006 | { PCI_DEVICE(0x8086, 0x0a0c), | 2012 | { PCI_DEVICE(0x8086, 0x0a0c), |
2007 | .driver_data = AZX_DRIVER_HDMI | AZX_DCAPS_INTEL_HASWELL }, | 2013 | .driver_data = AZX_DRIVER_HDMI | AZX_DCAPS_INTEL_HASWELL }, |
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index 71e4bad06345..e9ebc7bd752c 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c | |||
@@ -43,6 +43,7 @@ struct conexant_spec { | |||
43 | unsigned int num_eapds; | 43 | unsigned int num_eapds; |
44 | hda_nid_t eapds[4]; | 44 | hda_nid_t eapds[4]; |
45 | bool dynamic_eapd; | 45 | bool dynamic_eapd; |
46 | hda_nid_t mute_led_eapd; | ||
46 | 47 | ||
47 | unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */ | 48 | unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */ |
48 | 49 | ||
@@ -163,6 +164,17 @@ static void cx_auto_vmaster_hook(void *private_data, int enabled) | |||
163 | cx_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, enabled); | 164 | cx_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, enabled); |
164 | } | 165 | } |
165 | 166 | ||
167 | /* turn on/off EAPD according to Master switch (inversely!) for mute LED */ | ||
168 | static void cx_auto_vmaster_hook_mute_led(void *private_data, int enabled) | ||
169 | { | ||
170 | struct hda_codec *codec = private_data; | ||
171 | struct conexant_spec *spec = codec->spec; | ||
172 | |||
173 | snd_hda_codec_write(codec, spec->mute_led_eapd, 0, | ||
174 | AC_VERB_SET_EAPD_BTLENABLE, | ||
175 | enabled ? 0x00 : 0x02); | ||
176 | } | ||
177 | |||
166 | static int cx_auto_build_controls(struct hda_codec *codec) | 178 | static int cx_auto_build_controls(struct hda_codec *codec) |
167 | { | 179 | { |
168 | int err; | 180 | int err; |
@@ -223,6 +235,7 @@ enum { | |||
223 | CXT_FIXUP_TOSHIBA_P105, | 235 | CXT_FIXUP_TOSHIBA_P105, |
224 | CXT_FIXUP_HP_530, | 236 | CXT_FIXUP_HP_530, |
225 | CXT_FIXUP_CAP_MIX_AMP_5047, | 237 | CXT_FIXUP_CAP_MIX_AMP_5047, |
238 | CXT_FIXUP_MUTE_LED_EAPD, | ||
226 | }; | 239 | }; |
227 | 240 | ||
228 | /* for hda_fixup_thinkpad_acpi() */ | 241 | /* for hda_fixup_thinkpad_acpi() */ |
@@ -557,6 +570,18 @@ static void cxt_fixup_olpc_xo(struct hda_codec *codec, | |||
557 | } | 570 | } |
558 | } | 571 | } |
559 | 572 | ||
573 | static void cxt_fixup_mute_led_eapd(struct hda_codec *codec, | ||
574 | const struct hda_fixup *fix, int action) | ||
575 | { | ||
576 | struct conexant_spec *spec = codec->spec; | ||
577 | |||
578 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { | ||
579 | spec->mute_led_eapd = 0x1b; | ||
580 | spec->dynamic_eapd = 1; | ||
581 | spec->gen.vmaster_mute.hook = cx_auto_vmaster_hook_mute_led; | ||
582 | } | ||
583 | } | ||
584 | |||
560 | /* | 585 | /* |
561 | * Fix max input level on mixer widget to 0dB | 586 | * Fix max input level on mixer widget to 0dB |
562 | * (originally it has 0x2b steps with 0dB offset 0x14) | 587 | * (originally it has 0x2b steps with 0dB offset 0x14) |
@@ -705,6 +730,10 @@ static const struct hda_fixup cxt_fixups[] = { | |||
705 | .type = HDA_FIXUP_FUNC, | 730 | .type = HDA_FIXUP_FUNC, |
706 | .v.func = cxt_fixup_cap_mix_amp_5047, | 731 | .v.func = cxt_fixup_cap_mix_amp_5047, |
707 | }, | 732 | }, |
733 | [CXT_FIXUP_MUTE_LED_EAPD] = { | ||
734 | .type = HDA_FIXUP_FUNC, | ||
735 | .v.func = cxt_fixup_mute_led_eapd, | ||
736 | }, | ||
708 | }; | 737 | }; |
709 | 738 | ||
710 | static const struct snd_pci_quirk cxt5045_fixups[] = { | 739 | static const struct snd_pci_quirk cxt5045_fixups[] = { |
@@ -762,6 +791,7 @@ static const struct snd_pci_quirk cxt5066_fixups[] = { | |||
762 | SND_PCI_QUIRK(0x17aa, 0x21cf, "Lenovo T520", CXT_PINCFG_LENOVO_TP410), | 791 | SND_PCI_QUIRK(0x17aa, 0x21cf, "Lenovo T520", CXT_PINCFG_LENOVO_TP410), |
763 | SND_PCI_QUIRK(0x17aa, 0x21da, "Lenovo X220", CXT_PINCFG_LENOVO_TP410), | 792 | SND_PCI_QUIRK(0x17aa, 0x21da, "Lenovo X220", CXT_PINCFG_LENOVO_TP410), |
764 | SND_PCI_QUIRK(0x17aa, 0x21db, "Lenovo X220-tablet", CXT_PINCFG_LENOVO_TP410), | 793 | SND_PCI_QUIRK(0x17aa, 0x21db, "Lenovo X220-tablet", CXT_PINCFG_LENOVO_TP410), |
794 | SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo IdeaPad Z560", CXT_FIXUP_MUTE_LED_EAPD), | ||
765 | SND_PCI_QUIRK(0x17aa, 0x3975, "Lenovo U300s", CXT_FIXUP_STEREO_DMIC), | 795 | SND_PCI_QUIRK(0x17aa, 0x3975, "Lenovo U300s", CXT_FIXUP_STEREO_DMIC), |
766 | SND_PCI_QUIRK(0x17aa, 0x3977, "Lenovo IdeaPad U310", CXT_FIXUP_STEREO_DMIC), | 796 | SND_PCI_QUIRK(0x17aa, 0x3977, "Lenovo IdeaPad U310", CXT_FIXUP_STEREO_DMIC), |
767 | SND_PCI_QUIRK(0x17aa, 0x397b, "Lenovo S205", CXT_FIXUP_STEREO_DMIC), | 797 | SND_PCI_QUIRK(0x17aa, 0x397b, "Lenovo S205", CXT_FIXUP_STEREO_DMIC), |
@@ -780,6 +810,7 @@ static const struct hda_model_fixup cxt5066_fixup_models[] = { | |||
780 | { .id = CXT_PINCFG_LEMOTE_A1004, .name = "lemote-a1004" }, | 810 | { .id = CXT_PINCFG_LEMOTE_A1004, .name = "lemote-a1004" }, |
781 | { .id = CXT_PINCFG_LEMOTE_A1205, .name = "lemote-a1205" }, | 811 | { .id = CXT_PINCFG_LEMOTE_A1205, .name = "lemote-a1205" }, |
782 | { .id = CXT_FIXUP_OLPC_XO, .name = "olpc-xo" }, | 812 | { .id = CXT_FIXUP_OLPC_XO, .name = "olpc-xo" }, |
813 | { .id = CXT_FIXUP_MUTE_LED_EAPD, .name = "mute-led-eapd" }, | ||
783 | {} | 814 | {} |
784 | }; | 815 | }; |
785 | 816 | ||
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 34b7bdb510c7..8fea1b86df25 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -288,21 +288,91 @@ static void alc880_unsol_event(struct hda_codec *codec, unsigned int res) | |||
288 | snd_hda_jack_unsol_event(codec, res >> 2); | 288 | snd_hda_jack_unsol_event(codec, res >> 2); |
289 | } | 289 | } |
290 | 290 | ||
291 | /* additional initialization for ALC888 variants */ | 291 | /* Change EAPD to verb control */ |
292 | static void alc888_coef_init(struct hda_codec *codec) | 292 | static void alc_fill_eapd_coef(struct hda_codec *codec) |
293 | { | 293 | { |
294 | if (alc_get_coef0(codec) == 0x20) | 294 | int coef; |
295 | /* alc888S-VC */ | 295 | |
296 | alc_write_coef_idx(codec, 7, 0x830); | 296 | coef = alc_get_coef0(codec); |
297 | else | 297 | |
298 | /* alc888-VB */ | 298 | switch (codec->vendor_id) { |
299 | alc_write_coef_idx(codec, 7, 0x3030); | 299 | case 0x10ec0262: |
300 | alc_update_coef_idx(codec, 0x7, 0, 1<<5); | ||
301 | break; | ||
302 | case 0x10ec0267: | ||
303 | case 0x10ec0268: | ||
304 | alc_update_coef_idx(codec, 0x7, 0, 1<<13); | ||
305 | break; | ||
306 | case 0x10ec0269: | ||
307 | if ((coef & 0x00f0) == 0x0010) | ||
308 | alc_update_coef_idx(codec, 0xd, 0, 1<<14); | ||
309 | if ((coef & 0x00f0) == 0x0020) | ||
310 | alc_update_coef_idx(codec, 0x4, 1<<15, 0); | ||
311 | if ((coef & 0x00f0) == 0x0030) | ||
312 | alc_update_coef_idx(codec, 0x10, 1<<9, 0); | ||
313 | break; | ||
314 | case 0x10ec0280: | ||
315 | case 0x10ec0284: | ||
316 | case 0x10ec0290: | ||
317 | case 0x10ec0292: | ||
318 | alc_update_coef_idx(codec, 0x4, 1<<15, 0); | ||
319 | break; | ||
320 | case 0x10ec0233: | ||
321 | case 0x10ec0255: | ||
322 | case 0x10ec0282: | ||
323 | case 0x10ec0283: | ||
324 | case 0x10ec0286: | ||
325 | case 0x10ec0288: | ||
326 | alc_update_coef_idx(codec, 0x10, 1<<9, 0); | ||
327 | break; | ||
328 | case 0x10ec0285: | ||
329 | case 0x10ec0293: | ||
330 | alc_update_coef_idx(codec, 0xa, 1<<13, 0); | ||
331 | break; | ||
332 | case 0x10ec0662: | ||
333 | if ((coef & 0x00f0) == 0x0030) | ||
334 | alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */ | ||
335 | break; | ||
336 | case 0x10ec0272: | ||
337 | case 0x10ec0273: | ||
338 | case 0x10ec0663: | ||
339 | case 0x10ec0665: | ||
340 | case 0x10ec0670: | ||
341 | case 0x10ec0671: | ||
342 | case 0x10ec0672: | ||
343 | alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */ | ||
344 | break; | ||
345 | case 0x10ec0668: | ||
346 | alc_update_coef_idx(codec, 0x7, 3<<13, 0); | ||
347 | break; | ||
348 | case 0x10ec0867: | ||
349 | alc_update_coef_idx(codec, 0x4, 1<<10, 0); | ||
350 | break; | ||
351 | case 0x10ec0888: | ||
352 | if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030) | ||
353 | alc_update_coef_idx(codec, 0x7, 1<<5, 0); | ||
354 | break; | ||
355 | case 0x10ec0892: | ||
356 | alc_update_coef_idx(codec, 0x7, 1<<5, 0); | ||
357 | break; | ||
358 | case 0x10ec0899: | ||
359 | case 0x10ec0900: | ||
360 | alc_update_coef_idx(codec, 0x7, 1<<1, 0); | ||
361 | break; | ||
362 | } | ||
300 | } | 363 | } |
301 | 364 | ||
302 | /* additional initialization for ALC889 variants */ | 365 | /* additional initialization for ALC888 variants */ |
303 | static void alc889_coef_init(struct hda_codec *codec) | 366 | static void alc888_coef_init(struct hda_codec *codec) |
304 | { | 367 | { |
305 | alc_update_coef_idx(codec, 7, 0, 0x2010); | 368 | switch (alc_get_coef0(codec) & 0x00f0) { |
369 | /* alc888-VA */ | ||
370 | case 0x00: | ||
371 | /* alc888-VB */ | ||
372 | case 0x10: | ||
373 | alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */ | ||
374 | break; | ||
375 | } | ||
306 | } | 376 | } |
307 | 377 | ||
308 | /* turn on/off EAPD control (only if available) */ | 378 | /* turn on/off EAPD control (only if available) */ |
@@ -343,6 +413,7 @@ static void alc_eapd_shutup(struct hda_codec *codec) | |||
343 | /* generic EAPD initialization */ | 413 | /* generic EAPD initialization */ |
344 | static void alc_auto_init_amp(struct hda_codec *codec, int type) | 414 | static void alc_auto_init_amp(struct hda_codec *codec, int type) |
345 | { | 415 | { |
416 | alc_fill_eapd_coef(codec); | ||
346 | alc_auto_setup_eapd(codec, true); | 417 | alc_auto_setup_eapd(codec, true); |
347 | switch (type) { | 418 | switch (type) { |
348 | case ALC_INIT_GPIO1: | 419 | case ALC_INIT_GPIO1: |
@@ -359,25 +430,15 @@ static void alc_auto_init_amp(struct hda_codec *codec, int type) | |||
359 | case 0x10ec0260: | 430 | case 0x10ec0260: |
360 | alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010); | 431 | alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010); |
361 | break; | 432 | break; |
362 | case 0x10ec0262: | ||
363 | case 0x10ec0880: | 433 | case 0x10ec0880: |
364 | case 0x10ec0882: | 434 | case 0x10ec0882: |
365 | case 0x10ec0883: | 435 | case 0x10ec0883: |
366 | case 0x10ec0885: | 436 | case 0x10ec0885: |
367 | case 0x10ec0887: | 437 | alc_update_coef_idx(codec, 7, 0, 0x2030); |
368 | /*case 0x10ec0889:*/ /* this causes an SPDIF problem */ | ||
369 | case 0x10ec0900: | ||
370 | alc889_coef_init(codec); | ||
371 | break; | 438 | break; |
372 | case 0x10ec0888: | 439 | case 0x10ec0888: |
373 | alc888_coef_init(codec); | 440 | alc888_coef_init(codec); |
374 | break; | 441 | break; |
375 | #if 0 /* XXX: This may cause the silent output on speaker on some machines */ | ||
376 | case 0x10ec0267: | ||
377 | case 0x10ec0268: | ||
378 | alc_update_coef_idx(codec, 7, 0, 0x3000); | ||
379 | break; | ||
380 | #endif /* XXX */ | ||
381 | } | 442 | } |
382 | break; | 443 | break; |
383 | } | 444 | } |
@@ -1710,7 +1771,7 @@ static void alc889_fixup_coef(struct hda_codec *codec, | |||
1710 | { | 1771 | { |
1711 | if (action != HDA_FIXUP_ACT_INIT) | 1772 | if (action != HDA_FIXUP_ACT_INIT) |
1712 | return; | 1773 | return; |
1713 | alc889_coef_init(codec); | 1774 | alc_update_coef_idx(codec, 7, 0, 0x2030); |
1714 | } | 1775 | } |
1715 | 1776 | ||
1716 | /* toggle speaker-output according to the hp-jack state */ | 1777 | /* toggle speaker-output according to the hp-jack state */ |
@@ -2675,7 +2736,7 @@ static void alc269_shutup(struct hda_codec *codec) | |||
2675 | 2736 | ||
2676 | static struct coef_fw alc282_coefs[] = { | 2737 | static struct coef_fw alc282_coefs[] = { |
2677 | WRITE_COEF(0x03, 0x0002), /* Power Down Control */ | 2738 | WRITE_COEF(0x03, 0x0002), /* Power Down Control */ |
2678 | WRITE_COEF(0x05, 0x0700), /* FIFO and filter clock */ | 2739 | UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */ |
2679 | WRITE_COEF(0x07, 0x0200), /* DMIC control */ | 2740 | WRITE_COEF(0x07, 0x0200), /* DMIC control */ |
2680 | UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */ | 2741 | UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */ |
2681 | UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */ | 2742 | UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */ |
@@ -2786,7 +2847,7 @@ static void alc282_shutup(struct hda_codec *codec) | |||
2786 | 2847 | ||
2787 | static struct coef_fw alc283_coefs[] = { | 2848 | static struct coef_fw alc283_coefs[] = { |
2788 | WRITE_COEF(0x03, 0x0002), /* Power Down Control */ | 2849 | WRITE_COEF(0x03, 0x0002), /* Power Down Control */ |
2789 | WRITE_COEF(0x05, 0x0700), /* FIFO and filter clock */ | 2850 | UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */ |
2790 | WRITE_COEF(0x07, 0x0200), /* DMIC control */ | 2851 | WRITE_COEF(0x07, 0x0200), /* DMIC control */ |
2791 | UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */ | 2852 | UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */ |
2792 | UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */ | 2853 | UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */ |
@@ -2817,6 +2878,7 @@ static struct coef_fw alc283_coefs[] = { | |||
2817 | UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */ | 2878 | UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */ |
2818 | UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */ | 2879 | UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */ |
2819 | WRITE_COEF(0x37, 0xfc06), /* Class D amp control */ | 2880 | WRITE_COEF(0x37, 0xfc06), /* Class D amp control */ |
2881 | UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */ | ||
2820 | {} | 2882 | {} |
2821 | }; | 2883 | }; |
2822 | 2884 | ||
@@ -3349,6 +3411,27 @@ static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec, | |||
3349 | } | 3411 | } |
3350 | } | 3412 | } |
3351 | 3413 | ||
3414 | static void alc280_fixup_hp_gpio4(struct hda_codec *codec, | ||
3415 | const struct hda_fixup *fix, int action) | ||
3416 | { | ||
3417 | /* Like hp_gpio_mic1_led, but also needs GPIO4 low to enable headphone amp */ | ||
3418 | struct alc_spec *spec = codec->spec; | ||
3419 | static const struct hda_verb gpio_init[] = { | ||
3420 | { 0x01, AC_VERB_SET_GPIO_MASK, 0x18 }, | ||
3421 | { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x18 }, | ||
3422 | {} | ||
3423 | }; | ||
3424 | |||
3425 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { | ||
3426 | spec->gen.vmaster_mute.hook = alc269_fixup_hp_gpio_mute_hook; | ||
3427 | spec->gen.cap_sync_hook = alc269_fixup_hp_cap_mic_mute_hook; | ||
3428 | spec->gpio_led = 0; | ||
3429 | spec->cap_mute_led_nid = 0x18; | ||
3430 | snd_hda_add_verbs(codec, gpio_init); | ||
3431 | codec->power_filter = led_power_filter; | ||
3432 | } | ||
3433 | } | ||
3434 | |||
3352 | static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec, | 3435 | static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec, |
3353 | const struct hda_fixup *fix, int action) | 3436 | const struct hda_fixup *fix, int action) |
3354 | { | 3437 | { |
@@ -4216,6 +4299,7 @@ enum { | |||
4216 | ALC283_FIXUP_BXBT2807_MIC, | 4299 | ALC283_FIXUP_BXBT2807_MIC, |
4217 | ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED, | 4300 | ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED, |
4218 | ALC282_FIXUP_ASPIRE_V5_PINS, | 4301 | ALC282_FIXUP_ASPIRE_V5_PINS, |
4302 | ALC280_FIXUP_HP_GPIO4, | ||
4219 | }; | 4303 | }; |
4220 | 4304 | ||
4221 | static const struct hda_fixup alc269_fixups[] = { | 4305 | static const struct hda_fixup alc269_fixups[] = { |
@@ -4436,6 +4520,8 @@ static const struct hda_fixup alc269_fixups[] = { | |||
4436 | [ALC269_FIXUP_HEADSET_MODE] = { | 4520 | [ALC269_FIXUP_HEADSET_MODE] = { |
4437 | .type = HDA_FIXUP_FUNC, | 4521 | .type = HDA_FIXUP_FUNC, |
4438 | .v.func = alc_fixup_headset_mode, | 4522 | .v.func = alc_fixup_headset_mode, |
4523 | .chained = true, | ||
4524 | .chain_id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED | ||
4439 | }, | 4525 | }, |
4440 | [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = { | 4526 | [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = { |
4441 | .type = HDA_FIXUP_FUNC, | 4527 | .type = HDA_FIXUP_FUNC, |
@@ -4625,6 +4711,8 @@ static const struct hda_fixup alc269_fixups[] = { | |||
4625 | [ALC255_FIXUP_HEADSET_MODE] = { | 4711 | [ALC255_FIXUP_HEADSET_MODE] = { |
4626 | .type = HDA_FIXUP_FUNC, | 4712 | .type = HDA_FIXUP_FUNC, |
4627 | .v.func = alc_fixup_headset_mode_alc255, | 4713 | .v.func = alc_fixup_headset_mode_alc255, |
4714 | .chained = true, | ||
4715 | .chain_id = ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED | ||
4628 | }, | 4716 | }, |
4629 | [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = { | 4717 | [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = { |
4630 | .type = HDA_FIXUP_FUNC, | 4718 | .type = HDA_FIXUP_FUNC, |
@@ -4660,8 +4748,6 @@ static const struct hda_fixup alc269_fixups[] = { | |||
4660 | [ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED] = { | 4748 | [ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED] = { |
4661 | .type = HDA_FIXUP_FUNC, | 4749 | .type = HDA_FIXUP_FUNC, |
4662 | .v.func = alc_fixup_dell_wmi, | 4750 | .v.func = alc_fixup_dell_wmi, |
4663 | .chained_before = true, | ||
4664 | .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE | ||
4665 | }, | 4751 | }, |
4666 | [ALC282_FIXUP_ASPIRE_V5_PINS] = { | 4752 | [ALC282_FIXUP_ASPIRE_V5_PINS] = { |
4667 | .type = HDA_FIXUP_PINS, | 4753 | .type = HDA_FIXUP_PINS, |
@@ -4679,7 +4765,10 @@ static const struct hda_fixup alc269_fixups[] = { | |||
4679 | { }, | 4765 | { }, |
4680 | }, | 4766 | }, |
4681 | }, | 4767 | }, |
4682 | 4768 | [ALC280_FIXUP_HP_GPIO4] = { | |
4769 | .type = HDA_FIXUP_FUNC, | ||
4770 | .v.func = alc280_fixup_hp_gpio4, | ||
4771 | }, | ||
4683 | }; | 4772 | }; |
4684 | 4773 | ||
4685 | static const struct snd_pci_quirk alc269_fixup_tbl[] = { | 4774 | static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
@@ -4696,10 +4785,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { | |||
4696 | SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), | 4785 | SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), |
4697 | SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), | 4786 | SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), |
4698 | SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), | 4787 | SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), |
4699 | SND_PCI_QUIRK(0x1028, 0x0610, "Dell", ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED), | ||
4700 | SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK), | 4788 | SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK), |
4701 | SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK), | 4789 | SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK), |
4702 | SND_PCI_QUIRK(0x1028, 0x061f, "Dell", ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED), | ||
4703 | SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK), | 4790 | SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK), |
4704 | SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), | 4791 | SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), |
4705 | SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), | 4792 | SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), |
@@ -4727,21 +4814,16 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { | |||
4727 | SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | 4814 | SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
4728 | SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), | 4815 | SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), |
4729 | SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), | 4816 | SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), |
4730 | SND_PCI_QUIRK(0x103c, 0x8004, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), | ||
4731 | /* ALC290 */ | 4817 | /* ALC290 */ |
4732 | SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), | 4818 | SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), |
4733 | SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), | 4819 | SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), |
4734 | SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), | 4820 | SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), |
4735 | SND_PCI_QUIRK(0x103c, 0x2246, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), | 4821 | SND_PCI_QUIRK(0x103c, 0x2246, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), |
4736 | SND_PCI_QUIRK(0x103c, 0x2247, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), | ||
4737 | SND_PCI_QUIRK(0x103c, 0x2248, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), | ||
4738 | SND_PCI_QUIRK(0x103c, 0x2249, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), | ||
4739 | SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), | 4822 | SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), |
4740 | SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), | 4823 | SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), |
4741 | SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), | 4824 | SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), |
4742 | SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), | 4825 | SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), |
4743 | SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), | 4826 | SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), |
4744 | SND_PCI_QUIRK(0x103c, 0x2258, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), | ||
4745 | SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), | 4827 | SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), |
4746 | SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), | 4828 | SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), |
4747 | SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | 4829 | SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
@@ -4750,7 +4832,6 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { | |||
4750 | SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | 4832 | SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
4751 | SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), | 4833 | SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), |
4752 | SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), | 4834 | SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), |
4753 | SND_PCI_QUIRK(0x103c, 0x2277, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), | ||
4754 | SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), | 4835 | SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED), |
4755 | SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | 4836 | SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
4756 | SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), | 4837 | SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
@@ -4803,7 +4884,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { | |||
4803 | SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK), | 4884 | SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK), |
4804 | SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK), | 4885 | SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK), |
4805 | SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK), | 4886 | SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK), |
4806 | SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), | 4887 | SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK), |
4807 | SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), | 4888 | SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
4808 | SND_PCI_QUIRK(0x17aa, 0x3978, "IdeaPad Y410P", ALC269_FIXUP_NO_SHUTUP), | 4889 | SND_PCI_QUIRK(0x17aa, 0x3978, "IdeaPad Y410P", ALC269_FIXUP_NO_SHUTUP), |
4809 | SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), | 4890 | SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), |
@@ -4983,6 +5064,19 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = { | |||
4983 | {0x17, 0x40000000}, | 5064 | {0x17, 0x40000000}, |
4984 | {0x1d, 0x40700001}, | 5065 | {0x1d, 0x40700001}, |
4985 | {0x21, 0x02211040}), | 5066 | {0x21, 0x02211040}), |
5067 | SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4, | ||
5068 | {0x12, 0x90a60130}, | ||
5069 | {0x13, 0x40000000}, | ||
5070 | {0x14, 0x90170110}, | ||
5071 | {0x15, 0x0421101f}, | ||
5072 | {0x16, 0x411111f0}, | ||
5073 | {0x17, 0x411111f0}, | ||
5074 | {0x18, 0x411111f0}, | ||
5075 | {0x19, 0x411111f0}, | ||
5076 | {0x1a, 0x04a11020}, | ||
5077 | {0x1b, 0x411111f0}, | ||
5078 | {0x1d, 0x40748605}, | ||
5079 | {0x1e, 0x411111f0}), | ||
4986 | SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED, | 5080 | SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED, |
4987 | {0x12, 0x90a60140}, | 5081 | {0x12, 0x90a60140}, |
4988 | {0x13, 0x40000000}, | 5082 | {0x13, 0x40000000}, |
@@ -5193,9 +5287,6 @@ static void alc269_fill_coef(struct hda_codec *codec) | |||
5193 | } | 5287 | } |
5194 | } | 5288 | } |
5195 | 5289 | ||
5196 | /* Class D */ | ||
5197 | alc_update_coef_idx(codec, 0xd, 0, 1<<14); | ||
5198 | |||
5199 | /* HP */ | 5290 | /* HP */ |
5200 | alc_update_coef_idx(codec, 0x4, 0, 1<<11); | 5291 | alc_update_coef_idx(codec, 0x4, 0, 1<<11); |
5201 | } | 5292 | } |
@@ -5650,6 +5741,35 @@ static void alc662_fixup_led_gpio1(struct hda_codec *codec, | |||
5650 | } | 5741 | } |
5651 | } | 5742 | } |
5652 | 5743 | ||
5744 | static struct coef_fw alc668_coefs[] = { | ||
5745 | WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0), | ||
5746 | WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80), | ||
5747 | WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b, 0x0), | ||
5748 | WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f), | ||
5749 | WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001), | ||
5750 | WRITE_COEF(0x13, 0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940), | ||
5751 | WRITE_COEF(0x19, 0x0), WRITE_COEF(0x1a, 0x0), WRITE_COEF(0x1b, 0x0), | ||
5752 | WRITE_COEF(0x1c, 0x0), WRITE_COEF(0x1d, 0x0), WRITE_COEF(0x1e, 0x7418), | ||
5753 | WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468), | ||
5754 | WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418), | ||
5755 | WRITE_COEF(0x27, 0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00), | ||
5756 | WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000), | ||
5757 | WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac, 0x0), | ||
5758 | WRITE_COEF(0xad, 0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480), | ||
5759 | WRITE_COEF(0xb0, 0x0), WRITE_COEF(0xb1, 0x0), WRITE_COEF(0xb2, 0x0), | ||
5760 | WRITE_COEF(0xb3, 0x0), WRITE_COEF(0xb4, 0x0), WRITE_COEF(0xb5, 0x1040), | ||
5761 | WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697), | ||
5762 | WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab), | ||
5763 | WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02), | ||
5764 | WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6), | ||
5765 | {} | ||
5766 | }; | ||
5767 | |||
5768 | static void alc668_restore_default_value(struct hda_codec *codec) | ||
5769 | { | ||
5770 | alc_process_coef_fw(codec, alc668_coefs); | ||
5771 | } | ||
5772 | |||
5653 | enum { | 5773 | enum { |
5654 | ALC662_FIXUP_ASPIRE, | 5774 | ALC662_FIXUP_ASPIRE, |
5655 | ALC662_FIXUP_LED_GPIO1, | 5775 | ALC662_FIXUP_LED_GPIO1, |
@@ -5922,6 +6042,7 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = { | |||
5922 | SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), | 6042 | SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), |
5923 | SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), | 6043 | SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), |
5924 | SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), | 6044 | SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), |
6045 | SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), | ||
5925 | SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800), | 6046 | SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800), |
5926 | SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_BASS_1A), | 6047 | SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_BASS_1A), |
5927 | SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP), | 6048 | SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP), |
@@ -6075,29 +6196,6 @@ static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = { | |||
6075 | {} | 6196 | {} |
6076 | }; | 6197 | }; |
6077 | 6198 | ||
6078 | static void alc662_fill_coef(struct hda_codec *codec) | ||
6079 | { | ||
6080 | int coef; | ||
6081 | |||
6082 | coef = alc_get_coef0(codec); | ||
6083 | |||
6084 | switch (codec->vendor_id) { | ||
6085 | case 0x10ec0662: | ||
6086 | if ((coef & 0x00f0) == 0x0030) | ||
6087 | alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */ | ||
6088 | break; | ||
6089 | case 0x10ec0272: | ||
6090 | case 0x10ec0273: | ||
6091 | case 0x10ec0663: | ||
6092 | case 0x10ec0665: | ||
6093 | case 0x10ec0670: | ||
6094 | case 0x10ec0671: | ||
6095 | case 0x10ec0672: | ||
6096 | alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */ | ||
6097 | break; | ||
6098 | } | ||
6099 | } | ||
6100 | |||
6101 | /* | 6199 | /* |
6102 | */ | 6200 | */ |
6103 | static int patch_alc662(struct hda_codec *codec) | 6201 | static int patch_alc662(struct hda_codec *codec) |
@@ -6116,8 +6214,11 @@ static int patch_alc662(struct hda_codec *codec) | |||
6116 | 6214 | ||
6117 | alc_fix_pll_init(codec, 0x20, 0x04, 15); | 6215 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
6118 | 6216 | ||
6119 | spec->init_hook = alc662_fill_coef; | 6217 | switch (codec->vendor_id) { |
6120 | alc662_fill_coef(codec); | 6218 | case 0x10ec0668: |
6219 | spec->init_hook = alc668_restore_default_value; | ||
6220 | break; | ||
6221 | } | ||
6121 | 6222 | ||
6122 | snd_hda_pick_fixup(codec, alc662_fixup_models, | 6223 | snd_hda_pick_fixup(codec, alc662_fixup_models, |
6123 | alc662_fixup_tbl, alc662_fixups); | 6224 | alc662_fixup_tbl, alc662_fixups); |
diff --git a/sound/soc/Kconfig b/sound/soc/Kconfig index 0e9623368ab0..7d5d6444a837 100644 --- a/sound/soc/Kconfig +++ b/sound/soc/Kconfig | |||
@@ -49,7 +49,6 @@ source "sound/soc/mxs/Kconfig" | |||
49 | source "sound/soc/pxa/Kconfig" | 49 | source "sound/soc/pxa/Kconfig" |
50 | source "sound/soc/rockchip/Kconfig" | 50 | source "sound/soc/rockchip/Kconfig" |
51 | source "sound/soc/samsung/Kconfig" | 51 | source "sound/soc/samsung/Kconfig" |
52 | source "sound/soc/s6000/Kconfig" | ||
53 | source "sound/soc/sh/Kconfig" | 52 | source "sound/soc/sh/Kconfig" |
54 | source "sound/soc/sirf/Kconfig" | 53 | source "sound/soc/sirf/Kconfig" |
55 | source "sound/soc/spear/Kconfig" | 54 | source "sound/soc/spear/Kconfig" |
diff --git a/sound/soc/Makefile b/sound/soc/Makefile index 534714a1ca44..d88edfced8c4 100644 --- a/sound/soc/Makefile +++ b/sound/soc/Makefile | |||
@@ -26,7 +26,6 @@ obj-$(CONFIG_SND_SOC) += kirkwood/ | |||
26 | obj-$(CONFIG_SND_SOC) += pxa/ | 26 | obj-$(CONFIG_SND_SOC) += pxa/ |
27 | obj-$(CONFIG_SND_SOC) += rockchip/ | 27 | obj-$(CONFIG_SND_SOC) += rockchip/ |
28 | obj-$(CONFIG_SND_SOC) += samsung/ | 28 | obj-$(CONFIG_SND_SOC) += samsung/ |
29 | obj-$(CONFIG_SND_SOC) += s6000/ | ||
30 | obj-$(CONFIG_SND_SOC) += sh/ | 29 | obj-$(CONFIG_SND_SOC) += sh/ |
31 | obj-$(CONFIG_SND_SOC) += sirf/ | 30 | obj-$(CONFIG_SND_SOC) += sirf/ |
32 | obj-$(CONFIG_SND_SOC) += spear/ | 31 | obj-$(CONFIG_SND_SOC) += spear/ |
diff --git a/sound/soc/codecs/adau1761.c b/sound/soc/codecs/adau1761.c index 5518ebd6947c..91f60282fd2f 100644 --- a/sound/soc/codecs/adau1761.c +++ b/sound/soc/codecs/adau1761.c | |||
@@ -405,6 +405,7 @@ static const struct snd_soc_dapm_widget adau1761_dapm_widgets[] = { | |||
405 | 2, 0, NULL, 0), | 405 | 2, 0, NULL, 0), |
406 | 406 | ||
407 | SND_SOC_DAPM_SUPPLY("Slew Clock", ADAU1761_CLK_ENABLE0, 6, 0, NULL, 0), | 407 | SND_SOC_DAPM_SUPPLY("Slew Clock", ADAU1761_CLK_ENABLE0, 6, 0, NULL, 0), |
408 | SND_SOC_DAPM_SUPPLY("ALC Clock", ADAU1761_CLK_ENABLE0, 5, 0, NULL, 0), | ||
408 | 409 | ||
409 | SND_SOC_DAPM_SUPPLY_S("Digital Clock 0", 1, ADAU1761_CLK_ENABLE1, | 410 | SND_SOC_DAPM_SUPPLY_S("Digital Clock 0", 1, ADAU1761_CLK_ENABLE1, |
410 | 0, 0, NULL, 0), | 411 | 0, 0, NULL, 0), |
@@ -436,6 +437,9 @@ static const struct snd_soc_dapm_route adau1761_dapm_routes[] = { | |||
436 | { "Right Playback Mixer", NULL, "Slew Clock" }, | 437 | { "Right Playback Mixer", NULL, "Slew Clock" }, |
437 | { "Left Playback Mixer", NULL, "Slew Clock" }, | 438 | { "Left Playback Mixer", NULL, "Slew Clock" }, |
438 | 439 | ||
440 | { "Left Input Mixer", NULL, "ALC Clock" }, | ||
441 | { "Right Input Mixer", NULL, "ALC Clock" }, | ||
442 | |||
439 | { "Digital Clock 0", NULL, "SYSCLK" }, | 443 | { "Digital Clock 0", NULL, "SYSCLK" }, |
440 | { "Digital Clock 1", NULL, "SYSCLK" }, | 444 | { "Digital Clock 1", NULL, "SYSCLK" }, |
441 | }; | 445 | }; |
diff --git a/sound/soc/codecs/cs42l51-i2c.c b/sound/soc/codecs/cs42l51-i2c.c index cee51ae177c1..c40428f25ba5 100644 --- a/sound/soc/codecs/cs42l51-i2c.c +++ b/sound/soc/codecs/cs42l51-i2c.c | |||
@@ -46,6 +46,7 @@ static struct i2c_driver cs42l51_i2c_driver = { | |||
46 | .driver = { | 46 | .driver = { |
47 | .name = "cs42l51", | 47 | .name = "cs42l51", |
48 | .owner = THIS_MODULE, | 48 | .owner = THIS_MODULE, |
49 | .of_match_table = cs42l51_of_match, | ||
49 | }, | 50 | }, |
50 | .probe = cs42l51_i2c_probe, | 51 | .probe = cs42l51_i2c_probe, |
51 | .remove = cs42l51_i2c_remove, | 52 | .remove = cs42l51_i2c_remove, |
diff --git a/sound/soc/codecs/cs42l51.c b/sound/soc/codecs/cs42l51.c index 09488d97de60..669c38fc3034 100644 --- a/sound/soc/codecs/cs42l51.c +++ b/sound/soc/codecs/cs42l51.c | |||
@@ -558,11 +558,13 @@ error: | |||
558 | } | 558 | } |
559 | EXPORT_SYMBOL_GPL(cs42l51_probe); | 559 | EXPORT_SYMBOL_GPL(cs42l51_probe); |
560 | 560 | ||
561 | static const struct of_device_id cs42l51_of_match[] = { | 561 | const struct of_device_id cs42l51_of_match[] = { |
562 | { .compatible = "cirrus,cs42l51", }, | 562 | { .compatible = "cirrus,cs42l51", }, |
563 | { } | 563 | { } |
564 | }; | 564 | }; |
565 | MODULE_DEVICE_TABLE(of, cs42l51_of_match); | 565 | MODULE_DEVICE_TABLE(of, cs42l51_of_match); |
566 | EXPORT_SYMBOL_GPL(cs42l51_of_match); | ||
567 | |||
566 | MODULE_AUTHOR("Arnaud Patard <arnaud.patard@rtp-net.org>"); | 568 | MODULE_AUTHOR("Arnaud Patard <arnaud.patard@rtp-net.org>"); |
567 | MODULE_DESCRIPTION("Cirrus Logic CS42L51 ALSA SoC Codec Driver"); | 569 | MODULE_DESCRIPTION("Cirrus Logic CS42L51 ALSA SoC Codec Driver"); |
568 | MODULE_LICENSE("GPL"); | 570 | MODULE_LICENSE("GPL"); |
diff --git a/sound/soc/codecs/cs42l51.h b/sound/soc/codecs/cs42l51.h index 8c55bf384bc6..0ca805492ac4 100644 --- a/sound/soc/codecs/cs42l51.h +++ b/sound/soc/codecs/cs42l51.h | |||
@@ -22,6 +22,7 @@ struct device; | |||
22 | 22 | ||
23 | extern const struct regmap_config cs42l51_regmap; | 23 | extern const struct regmap_config cs42l51_regmap; |
24 | int cs42l51_probe(struct device *dev, struct regmap *regmap); | 24 | int cs42l51_probe(struct device *dev, struct regmap *regmap); |
25 | extern const struct of_device_id cs42l51_of_match[]; | ||
25 | 26 | ||
26 | #define CS42L51_CHIP_ID 0x1B | 27 | #define CS42L51_CHIP_ID 0x1B |
27 | #define CS42L51_CHIP_REV_A 0x00 | 28 | #define CS42L51_CHIP_REV_A 0x00 |
diff --git a/sound/soc/codecs/es8328-i2c.c b/sound/soc/codecs/es8328-i2c.c index aae410d122ee..2d05b5d3a6ce 100644 --- a/sound/soc/codecs/es8328-i2c.c +++ b/sound/soc/codecs/es8328-i2c.c | |||
@@ -19,7 +19,7 @@ | |||
19 | #include "es8328.h" | 19 | #include "es8328.h" |
20 | 20 | ||
21 | static const struct i2c_device_id es8328_id[] = { | 21 | static const struct i2c_device_id es8328_id[] = { |
22 | { "everest,es8328", 0 }, | 22 | { "es8328", 0 }, |
23 | { } | 23 | { } |
24 | }; | 24 | }; |
25 | MODULE_DEVICE_TABLE(i2c, es8328_id); | 25 | MODULE_DEVICE_TABLE(i2c, es8328_id); |
diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c index d519294f57c7..1229554f1464 100644 --- a/sound/soc/codecs/max98090.c +++ b/sound/soc/codecs/max98090.c | |||
@@ -1941,13 +1941,13 @@ static int max98090_dai_set_sysclk(struct snd_soc_dai *dai, | |||
1941 | * 0x02 (when master clk is 20MHz to 40MHz).. | 1941 | * 0x02 (when master clk is 20MHz to 40MHz).. |
1942 | * 0x03 (when master clk is 40MHz to 60MHz).. | 1942 | * 0x03 (when master clk is 40MHz to 60MHz).. |
1943 | */ | 1943 | */ |
1944 | if ((freq >= 10000000) && (freq < 20000000)) { | 1944 | if ((freq >= 10000000) && (freq <= 20000000)) { |
1945 | snd_soc_write(codec, M98090_REG_SYSTEM_CLOCK, | 1945 | snd_soc_write(codec, M98090_REG_SYSTEM_CLOCK, |
1946 | M98090_PSCLK_DIV1); | 1946 | M98090_PSCLK_DIV1); |
1947 | } else if ((freq >= 20000000) && (freq < 40000000)) { | 1947 | } else if ((freq > 20000000) && (freq <= 40000000)) { |
1948 | snd_soc_write(codec, M98090_REG_SYSTEM_CLOCK, | 1948 | snd_soc_write(codec, M98090_REG_SYSTEM_CLOCK, |
1949 | M98090_PSCLK_DIV2); | 1949 | M98090_PSCLK_DIV2); |
1950 | } else if ((freq >= 40000000) && (freq < 60000000)) { | 1950 | } else if ((freq > 40000000) && (freq <= 60000000)) { |
1951 | snd_soc_write(codec, M98090_REG_SYSTEM_CLOCK, | 1951 | snd_soc_write(codec, M98090_REG_SYSTEM_CLOCK, |
1952 | M98090_PSCLK_DIV4); | 1952 | M98090_PSCLK_DIV4); |
1953 | } else { | 1953 | } else { |
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index 3fb83bf09768..d16331e0b64d 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c | |||
@@ -139,6 +139,7 @@ static const struct reg_default rt5645_reg[] = { | |||
139 | { 0x76, 0x000a }, | 139 | { 0x76, 0x000a }, |
140 | { 0x77, 0x0c00 }, | 140 | { 0x77, 0x0c00 }, |
141 | { 0x78, 0x0000 }, | 141 | { 0x78, 0x0000 }, |
142 | { 0x79, 0x0123 }, | ||
142 | { 0x80, 0x0000 }, | 143 | { 0x80, 0x0000 }, |
143 | { 0x81, 0x0000 }, | 144 | { 0x81, 0x0000 }, |
144 | { 0x82, 0x0000 }, | 145 | { 0x82, 0x0000 }, |
@@ -334,6 +335,7 @@ static bool rt5645_readable_register(struct device *dev, unsigned int reg) | |||
334 | case RT5645_DMIC_CTRL2: | 335 | case RT5645_DMIC_CTRL2: |
335 | case RT5645_TDM_CTRL_1: | 336 | case RT5645_TDM_CTRL_1: |
336 | case RT5645_TDM_CTRL_2: | 337 | case RT5645_TDM_CTRL_2: |
338 | case RT5645_TDM_CTRL_3: | ||
337 | case RT5645_GLB_CLK: | 339 | case RT5645_GLB_CLK: |
338 | case RT5645_PLL_CTRL1: | 340 | case RT5645_PLL_CTRL1: |
339 | case RT5645_PLL_CTRL2: | 341 | case RT5645_PLL_CTRL2: |
diff --git a/sound/soc/codecs/rt5670.c b/sound/soc/codecs/rt5670.c index ba9d9b4d4857..9bd8b4f63303 100644 --- a/sound/soc/codecs/rt5670.c +++ b/sound/soc/codecs/rt5670.c | |||
@@ -100,18 +100,18 @@ static const struct reg_default rt5670_reg[] = { | |||
100 | { 0x4c, 0x5380 }, | 100 | { 0x4c, 0x5380 }, |
101 | { 0x4f, 0x0073 }, | 101 | { 0x4f, 0x0073 }, |
102 | { 0x52, 0x00d3 }, | 102 | { 0x52, 0x00d3 }, |
103 | { 0x53, 0xf0f0 }, | 103 | { 0x53, 0xf000 }, |
104 | { 0x61, 0x0000 }, | 104 | { 0x61, 0x0000 }, |
105 | { 0x62, 0x0001 }, | 105 | { 0x62, 0x0001 }, |
106 | { 0x63, 0x00c3 }, | 106 | { 0x63, 0x00c3 }, |
107 | { 0x64, 0x0000 }, | 107 | { 0x64, 0x0000 }, |
108 | { 0x65, 0x0000 }, | 108 | { 0x65, 0x0001 }, |
109 | { 0x66, 0x0000 }, | 109 | { 0x66, 0x0000 }, |
110 | { 0x6f, 0x8000 }, | 110 | { 0x6f, 0x8000 }, |
111 | { 0x70, 0x8000 }, | 111 | { 0x70, 0x8000 }, |
112 | { 0x71, 0x8000 }, | 112 | { 0x71, 0x8000 }, |
113 | { 0x72, 0x8000 }, | 113 | { 0x72, 0x8000 }, |
114 | { 0x73, 0x1110 }, | 114 | { 0x73, 0x7770 }, |
115 | { 0x74, 0x0e00 }, | 115 | { 0x74, 0x0e00 }, |
116 | { 0x75, 0x1505 }, | 116 | { 0x75, 0x1505 }, |
117 | { 0x76, 0x0015 }, | 117 | { 0x76, 0x0015 }, |
@@ -125,21 +125,21 @@ static const struct reg_default rt5670_reg[] = { | |||
125 | { 0x83, 0x0000 }, | 125 | { 0x83, 0x0000 }, |
126 | { 0x84, 0x0000 }, | 126 | { 0x84, 0x0000 }, |
127 | { 0x85, 0x0000 }, | 127 | { 0x85, 0x0000 }, |
128 | { 0x86, 0x0008 }, | 128 | { 0x86, 0x0004 }, |
129 | { 0x87, 0x0000 }, | 129 | { 0x87, 0x0000 }, |
130 | { 0x88, 0x0000 }, | 130 | { 0x88, 0x0000 }, |
131 | { 0x89, 0x0000 }, | 131 | { 0x89, 0x0000 }, |
132 | { 0x8a, 0x0000 }, | 132 | { 0x8a, 0x0000 }, |
133 | { 0x8b, 0x0000 }, | 133 | { 0x8b, 0x0000 }, |
134 | { 0x8c, 0x0007 }, | 134 | { 0x8c, 0x0003 }, |
135 | { 0x8d, 0x0000 }, | 135 | { 0x8d, 0x0000 }, |
136 | { 0x8e, 0x0004 }, | 136 | { 0x8e, 0x0004 }, |
137 | { 0x8f, 0x1100 }, | 137 | { 0x8f, 0x1100 }, |
138 | { 0x90, 0x0646 }, | 138 | { 0x90, 0x0646 }, |
139 | { 0x91, 0x0c06 }, | 139 | { 0x91, 0x0c06 }, |
140 | { 0x93, 0x0000 }, | 140 | { 0x93, 0x0000 }, |
141 | { 0x94, 0x0000 }, | 141 | { 0x94, 0x1270 }, |
142 | { 0x95, 0x0000 }, | 142 | { 0x95, 0x1000 }, |
143 | { 0x97, 0x0000 }, | 143 | { 0x97, 0x0000 }, |
144 | { 0x98, 0x0000 }, | 144 | { 0x98, 0x0000 }, |
145 | { 0x99, 0x0000 }, | 145 | { 0x99, 0x0000 }, |
@@ -150,11 +150,11 @@ static const struct reg_default rt5670_reg[] = { | |||
150 | { 0x9e, 0x0400 }, | 150 | { 0x9e, 0x0400 }, |
151 | { 0xae, 0x7000 }, | 151 | { 0xae, 0x7000 }, |
152 | { 0xaf, 0x0000 }, | 152 | { 0xaf, 0x0000 }, |
153 | { 0xb0, 0x6000 }, | 153 | { 0xb0, 0x7000 }, |
154 | { 0xb1, 0x0000 }, | 154 | { 0xb1, 0x0000 }, |
155 | { 0xb2, 0x0000 }, | 155 | { 0xb2, 0x0000 }, |
156 | { 0xb3, 0x001f }, | 156 | { 0xb3, 0x001f }, |
157 | { 0xb4, 0x2206 }, | 157 | { 0xb4, 0x220c }, |
158 | { 0xb5, 0x1f00 }, | 158 | { 0xb5, 0x1f00 }, |
159 | { 0xb6, 0x0000 }, | 159 | { 0xb6, 0x0000 }, |
160 | { 0xb7, 0x0000 }, | 160 | { 0xb7, 0x0000 }, |
@@ -171,25 +171,25 @@ static const struct reg_default rt5670_reg[] = { | |||
171 | { 0xcf, 0x1813 }, | 171 | { 0xcf, 0x1813 }, |
172 | { 0xd0, 0x0690 }, | 172 | { 0xd0, 0x0690 }, |
173 | { 0xd1, 0x1c17 }, | 173 | { 0xd1, 0x1c17 }, |
174 | { 0xd3, 0xb320 }, | 174 | { 0xd3, 0xa220 }, |
175 | { 0xd4, 0x0000 }, | 175 | { 0xd4, 0x0000 }, |
176 | { 0xd6, 0x0400 }, | 176 | { 0xd6, 0x0400 }, |
177 | { 0xd9, 0x0809 }, | 177 | { 0xd9, 0x0809 }, |
178 | { 0xda, 0x0000 }, | 178 | { 0xda, 0x0000 }, |
179 | { 0xdb, 0x0001 }, | 179 | { 0xdb, 0x0001 }, |
180 | { 0xdc, 0x0049 }, | 180 | { 0xdc, 0x0049 }, |
181 | { 0xdd, 0x0009 }, | 181 | { 0xdd, 0x0024 }, |
182 | { 0xe6, 0x8000 }, | 182 | { 0xe6, 0x8000 }, |
183 | { 0xe7, 0x0000 }, | 183 | { 0xe7, 0x0000 }, |
184 | { 0xec, 0xb300 }, | 184 | { 0xec, 0xa200 }, |
185 | { 0xed, 0x0000 }, | 185 | { 0xed, 0x0000 }, |
186 | { 0xee, 0xb300 }, | 186 | { 0xee, 0xa200 }, |
187 | { 0xef, 0x0000 }, | 187 | { 0xef, 0x0000 }, |
188 | { 0xf8, 0x0000 }, | 188 | { 0xf8, 0x0000 }, |
189 | { 0xf9, 0x0000 }, | 189 | { 0xf9, 0x0000 }, |
190 | { 0xfa, 0x8010 }, | 190 | { 0xfa, 0x8010 }, |
191 | { 0xfb, 0x0033 }, | 191 | { 0xfb, 0x0033 }, |
192 | { 0xfc, 0x0080 }, | 192 | { 0xfc, 0x0100 }, |
193 | }; | 193 | }; |
194 | 194 | ||
195 | static bool rt5670_volatile_register(struct device *dev, unsigned int reg) | 195 | static bool rt5670_volatile_register(struct device *dev, unsigned int reg) |
@@ -1877,6 +1877,10 @@ static const struct snd_soc_dapm_route rt5670_dapm_routes[] = { | |||
1877 | { "DAC1 MIXR", "DAC1 Switch", "DAC1 R Mux" }, | 1877 | { "DAC1 MIXR", "DAC1 Switch", "DAC1 R Mux" }, |
1878 | { "DAC1 MIXR", NULL, "DAC Stereo1 Filter" }, | 1878 | { "DAC1 MIXR", NULL, "DAC Stereo1 Filter" }, |
1879 | 1879 | ||
1880 | { "DAC Stereo1 Filter", NULL, "PLL1", is_sys_clk_from_pll }, | ||
1881 | { "DAC Mono Left Filter", NULL, "PLL1", is_sys_clk_from_pll }, | ||
1882 | { "DAC Mono Right Filter", NULL, "PLL1", is_sys_clk_from_pll }, | ||
1883 | |||
1880 | { "DAC MIX", NULL, "DAC1 MIXL" }, | 1884 | { "DAC MIX", NULL, "DAC1 MIXL" }, |
1881 | { "DAC MIX", NULL, "DAC1 MIXR" }, | 1885 | { "DAC MIX", NULL, "DAC1 MIXR" }, |
1882 | 1886 | ||
@@ -1926,14 +1930,10 @@ static const struct snd_soc_dapm_route rt5670_dapm_routes[] = { | |||
1926 | 1930 | ||
1927 | { "DAC L1", NULL, "DAC L1 Power" }, | 1931 | { "DAC L1", NULL, "DAC L1 Power" }, |
1928 | { "DAC L1", NULL, "Stereo DAC MIXL" }, | 1932 | { "DAC L1", NULL, "Stereo DAC MIXL" }, |
1929 | { "DAC L1", NULL, "PLL1", is_sys_clk_from_pll }, | ||
1930 | { "DAC R1", NULL, "DAC R1 Power" }, | 1933 | { "DAC R1", NULL, "DAC R1 Power" }, |
1931 | { "DAC R1", NULL, "Stereo DAC MIXR" }, | 1934 | { "DAC R1", NULL, "Stereo DAC MIXR" }, |
1932 | { "DAC R1", NULL, "PLL1", is_sys_clk_from_pll }, | ||
1933 | { "DAC L2", NULL, "Mono DAC MIXL" }, | 1935 | { "DAC L2", NULL, "Mono DAC MIXL" }, |
1934 | { "DAC L2", NULL, "PLL1", is_sys_clk_from_pll }, | ||
1935 | { "DAC R2", NULL, "Mono DAC MIXR" }, | 1936 | { "DAC R2", NULL, "Mono DAC MIXR" }, |
1936 | { "DAC R2", NULL, "PLL1", is_sys_clk_from_pll }, | ||
1937 | 1937 | ||
1938 | { "OUT MIXL", "BST1 Switch", "BST1" }, | 1938 | { "OUT MIXL", "BST1 Switch", "BST1" }, |
1939 | { "OUT MIXL", "INL Switch", "INL VOL" }, | 1939 | { "OUT MIXL", "INL Switch", "INL VOL" }, |
diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c index 6bb77d76561b..dab9b15304af 100644 --- a/sound/soc/codecs/sgtl5000.c +++ b/sound/soc/codecs/sgtl5000.c | |||
@@ -1299,8 +1299,7 @@ static int sgtl5000_probe(struct snd_soc_codec *codec) | |||
1299 | 1299 | ||
1300 | /* enable small pop, introduce 400ms delay in turning off */ | 1300 | /* enable small pop, introduce 400ms delay in turning off */ |
1301 | snd_soc_update_bits(codec, SGTL5000_CHIP_REF_CTRL, | 1301 | snd_soc_update_bits(codec, SGTL5000_CHIP_REF_CTRL, |
1302 | SGTL5000_SMALL_POP, | 1302 | SGTL5000_SMALL_POP, 1); |
1303 | SGTL5000_SMALL_POP); | ||
1304 | 1303 | ||
1305 | /* disable short cut detector */ | 1304 | /* disable short cut detector */ |
1306 | snd_soc_write(codec, SGTL5000_CHIP_SHORT_CTRL, 0); | 1305 | snd_soc_write(codec, SGTL5000_CHIP_SHORT_CTRL, 0); |
diff --git a/sound/soc/codecs/sgtl5000.h b/sound/soc/codecs/sgtl5000.h index 2f8c88931f69..bd7a344bf8c5 100644 --- a/sound/soc/codecs/sgtl5000.h +++ b/sound/soc/codecs/sgtl5000.h | |||
@@ -275,7 +275,7 @@ | |||
275 | #define SGTL5000_BIAS_CTRL_MASK 0x000e | 275 | #define SGTL5000_BIAS_CTRL_MASK 0x000e |
276 | #define SGTL5000_BIAS_CTRL_SHIFT 1 | 276 | #define SGTL5000_BIAS_CTRL_SHIFT 1 |
277 | #define SGTL5000_BIAS_CTRL_WIDTH 3 | 277 | #define SGTL5000_BIAS_CTRL_WIDTH 3 |
278 | #define SGTL5000_SMALL_POP 0x0001 | 278 | #define SGTL5000_SMALL_POP 0 |
279 | 279 | ||
280 | /* | 280 | /* |
281 | * SGTL5000_CHIP_MIC_CTRL | 281 | * SGTL5000_CHIP_MIC_CTRL |
diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c index f412a9911a75..67124783558a 100644 --- a/sound/soc/codecs/wm_adsp.c +++ b/sound/soc/codecs/wm_adsp.c | |||
@@ -1355,6 +1355,7 @@ static int wm_adsp_load_coeff(struct wm_adsp *dsp) | |||
1355 | file, blocks, pos - firmware->size); | 1355 | file, blocks, pos - firmware->size); |
1356 | 1356 | ||
1357 | out_fw: | 1357 | out_fw: |
1358 | regmap_async_complete(regmap); | ||
1358 | release_firmware(firmware); | 1359 | release_firmware(firmware); |
1359 | wm_adsp_buf_free(&buf_list); | 1360 | wm_adsp_buf_free(&buf_list); |
1360 | out: | 1361 | out: |
diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fsl_asrc.c index 3b145313f93e..9deabdd2b1a2 100644 --- a/sound/soc/fsl/fsl_asrc.c +++ b/sound/soc/fsl/fsl_asrc.c | |||
@@ -684,12 +684,38 @@ static bool fsl_asrc_writeable_reg(struct device *dev, unsigned int reg) | |||
684 | } | 684 | } |
685 | } | 685 | } |
686 | 686 | ||
687 | static struct reg_default fsl_asrc_reg[] = { | ||
688 | { REG_ASRCTR, 0x0000 }, { REG_ASRIER, 0x0000 }, | ||
689 | { REG_ASRCNCR, 0x0000 }, { REG_ASRCFG, 0x0000 }, | ||
690 | { REG_ASRCSR, 0x0000 }, { REG_ASRCDR1, 0x0000 }, | ||
691 | { REG_ASRCDR2, 0x0000 }, { REG_ASRSTR, 0x0000 }, | ||
692 | { REG_ASRRA, 0x0000 }, { REG_ASRRB, 0x0000 }, | ||
693 | { REG_ASRRC, 0x0000 }, { REG_ASRPM1, 0x0000 }, | ||
694 | { REG_ASRPM2, 0x0000 }, { REG_ASRPM3, 0x0000 }, | ||
695 | { REG_ASRPM4, 0x0000 }, { REG_ASRPM5, 0x0000 }, | ||
696 | { REG_ASRTFR1, 0x0000 }, { REG_ASRCCR, 0x0000 }, | ||
697 | { REG_ASRDIA, 0x0000 }, { REG_ASRDOA, 0x0000 }, | ||
698 | { REG_ASRDIB, 0x0000 }, { REG_ASRDOB, 0x0000 }, | ||
699 | { REG_ASRDIC, 0x0000 }, { REG_ASRDOC, 0x0000 }, | ||
700 | { REG_ASRIDRHA, 0x0000 }, { REG_ASRIDRLA, 0x0000 }, | ||
701 | { REG_ASRIDRHB, 0x0000 }, { REG_ASRIDRLB, 0x0000 }, | ||
702 | { REG_ASRIDRHC, 0x0000 }, { REG_ASRIDRLC, 0x0000 }, | ||
703 | { REG_ASR76K, 0x0A47 }, { REG_ASR56K, 0x0DF3 }, | ||
704 | { REG_ASRMCRA, 0x0000 }, { REG_ASRFSTA, 0x0000 }, | ||
705 | { REG_ASRMCRB, 0x0000 }, { REG_ASRFSTB, 0x0000 }, | ||
706 | { REG_ASRMCRC, 0x0000 }, { REG_ASRFSTC, 0x0000 }, | ||
707 | { REG_ASRMCR1A, 0x0000 }, { REG_ASRMCR1B, 0x0000 }, | ||
708 | { REG_ASRMCR1C, 0x0000 }, | ||
709 | }; | ||
710 | |||
687 | static const struct regmap_config fsl_asrc_regmap_config = { | 711 | static const struct regmap_config fsl_asrc_regmap_config = { |
688 | .reg_bits = 32, | 712 | .reg_bits = 32, |
689 | .reg_stride = 4, | 713 | .reg_stride = 4, |
690 | .val_bits = 32, | 714 | .val_bits = 32, |
691 | 715 | ||
692 | .max_register = REG_ASRMCR1C, | 716 | .max_register = REG_ASRMCR1C, |
717 | .reg_defaults = fsl_asrc_reg, | ||
718 | .num_reg_defaults = ARRAY_SIZE(fsl_asrc_reg), | ||
693 | .readable_reg = fsl_asrc_readable_reg, | 719 | .readable_reg = fsl_asrc_readable_reg, |
694 | .volatile_reg = fsl_asrc_volatile_reg, | 720 | .volatile_reg = fsl_asrc_volatile_reg, |
695 | .writeable_reg = fsl_asrc_writeable_reg, | 721 | .writeable_reg = fsl_asrc_writeable_reg, |
@@ -792,7 +818,7 @@ static int fsl_asrc_probe(struct platform_device *pdev) | |||
792 | return -ENOMEM; | 818 | return -ENOMEM; |
793 | 819 | ||
794 | asrc_priv->pdev = pdev; | 820 | asrc_priv->pdev = pdev; |
795 | strcpy(asrc_priv->name, np->name); | 821 | strncpy(asrc_priv->name, np->name, sizeof(asrc_priv->name) - 1); |
796 | 822 | ||
797 | /* Get the addresses and IRQ */ | 823 | /* Get the addresses and IRQ */ |
798 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 824 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
diff --git a/sound/soc/fsl/fsl_esai.c b/sound/soc/fsl/fsl_esai.c index 8bcdfda09d7a..a645e296199e 100644 --- a/sound/soc/fsl/fsl_esai.c +++ b/sound/soc/fsl/fsl_esai.c | |||
@@ -734,7 +734,7 @@ static int fsl_esai_probe(struct platform_device *pdev) | |||
734 | return -ENOMEM; | 734 | return -ENOMEM; |
735 | 735 | ||
736 | esai_priv->pdev = pdev; | 736 | esai_priv->pdev = pdev; |
737 | strcpy(esai_priv->name, np->name); | 737 | strncpy(esai_priv->name, np->name, sizeof(esai_priv->name) - 1); |
738 | 738 | ||
739 | /* Get the addresses and IRQ */ | 739 | /* Get the addresses and IRQ */ |
740 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 740 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
diff --git a/sound/soc/intel/sst-haswell-pcm.c b/sound/soc/intel/sst-haswell-pcm.c index 33fc5c3abf55..4df867cbb92a 100644 --- a/sound/soc/intel/sst-haswell-pcm.c +++ b/sound/soc/intel/sst-haswell-pcm.c | |||
@@ -691,9 +691,7 @@ static int hsw_pcm_new(struct snd_soc_pcm_runtime *rtd) | |||
691 | } | 691 | } |
692 | 692 | ||
693 | #define HSW_FORMATS \ | 693 | #define HSW_FORMATS \ |
694 | (SNDRV_PCM_FMTBIT_S32_LE | SNDRV_PCM_FMTBIT_S24_LE | \ | 694 | (SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S16_LE) |
695 | SNDRV_PCM_FMTBIT_S20_3LE | SNDRV_PCM_FMTBIT_S16_LE |\ | ||
696 | SNDRV_PCM_FMTBIT_S8) | ||
697 | 695 | ||
698 | static struct snd_soc_dai_driver hsw_dais[] = { | 696 | static struct snd_soc_dai_driver hsw_dais[] = { |
699 | { | 697 | { |
diff --git a/sound/soc/rockchip/rockchip_i2s.c b/sound/soc/rockchip/rockchip_i2s.c index f373e37f8305..c74ba37f862c 100644 --- a/sound/soc/rockchip/rockchip_i2s.c +++ b/sound/soc/rockchip/rockchip_i2s.c | |||
@@ -154,8 +154,10 @@ static void rockchip_snd_rxctrl(struct rk_i2s_dev *i2s, int on) | |||
154 | while (val) { | 154 | while (val) { |
155 | regmap_read(i2s->regmap, I2S_CLR, &val); | 155 | regmap_read(i2s->regmap, I2S_CLR, &val); |
156 | retry--; | 156 | retry--; |
157 | if (!retry) | 157 | if (!retry) { |
158 | dev_warn(i2s->dev, "fail to clear\n"); | 158 | dev_warn(i2s->dev, "fail to clear\n"); |
159 | break; | ||
160 | } | ||
159 | } | 161 | } |
160 | } | 162 | } |
161 | } | 163 | } |
diff --git a/sound/soc/s6000/Kconfig b/sound/soc/s6000/Kconfig deleted file mode 100644 index f244a2566f20..000000000000 --- a/sound/soc/s6000/Kconfig +++ /dev/null | |||
@@ -1,26 +0,0 @@ | |||
1 | config SND_S6000_SOC | ||
2 | tristate "SoC Audio for the Stretch s6000 family" | ||
3 | depends on XTENSA_VARIANT_S6000 || COMPILE_TEST | ||
4 | depends on HAS_IOMEM | ||
5 | select SND_S6000_SOC_PCM if XTENSA_VARIANT_S6000 | ||
6 | help | ||
7 | Say Y or M if you want to add support for codecs attached to | ||
8 | s6000 family chips. You will also need to select the platform | ||
9 | to support below. | ||
10 | |||
11 | config SND_S6000_SOC_PCM | ||
12 | tristate | ||
13 | |||
14 | config SND_S6000_SOC_I2S | ||
15 | tristate | ||
16 | |||
17 | config SND_S6000_SOC_S6IPCAM | ||
18 | bool "SoC Audio support for Stretch 6105 IP Camera" | ||
19 | depends on SND_S6000_SOC=y | ||
20 | depends on I2C=y | ||
21 | depends on XTENSA_PLATFORM_S6105 || COMPILE_TEST | ||
22 | select SND_S6000_SOC_I2S | ||
23 | select SND_SOC_TLV320AIC3X | ||
24 | help | ||
25 | Say Y if you want to add support for SoC audio on the | ||
26 | Stretch s6105 IP Camera Reference Design. | ||
diff --git a/sound/soc/s6000/Makefile b/sound/soc/s6000/Makefile deleted file mode 100644 index 0f0ae2a012aa..000000000000 --- a/sound/soc/s6000/Makefile +++ /dev/null | |||
@@ -1,11 +0,0 @@ | |||
1 | # s6000 Platform Support | ||
2 | snd-soc-s6000-objs := s6000-pcm.o | ||
3 | snd-soc-s6000-i2s-objs := s6000-i2s.o | ||
4 | |||
5 | obj-$(CONFIG_SND_S6000_SOC_PCM) += snd-soc-s6000.o | ||
6 | obj-$(CONFIG_SND_S6000_SOC_I2S) += snd-soc-s6000-i2s.o | ||
7 | |||
8 | # s6105 Machine Support | ||
9 | snd-soc-s6ipcam-objs := s6105-ipcam.o | ||
10 | |||
11 | obj-$(CONFIG_SND_S6000_SOC_S6IPCAM) += snd-soc-s6ipcam.o | ||
diff --git a/sound/soc/s6000/s6000-i2s.c b/sound/soc/s6000/s6000-i2s.c deleted file mode 100644 index 1c8d01166e5b..000000000000 --- a/sound/soc/s6000/s6000-i2s.c +++ /dev/null | |||
@@ -1,617 +0,0 @@ | |||
1 | /* | ||
2 | * ALSA SoC I2S Audio Layer for the Stretch S6000 family | ||
3 | * | ||
4 | * Author: Daniel Gloeckner, <dg@emlix.com> | ||
5 | * Copyright: (C) 2009 emlix GmbH <info@emlix.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #include <linux/init.h> | ||
13 | #include <linux/module.h> | ||
14 | #include <linux/device.h> | ||
15 | #include <linux/delay.h> | ||
16 | #include <linux/clk.h> | ||
17 | #include <linux/interrupt.h> | ||
18 | #include <linux/io.h> | ||
19 | #include <linux/slab.h> | ||
20 | |||
21 | #include <sound/core.h> | ||
22 | #include <sound/pcm.h> | ||
23 | #include <sound/pcm_params.h> | ||
24 | #include <sound/initval.h> | ||
25 | #include <sound/soc.h> | ||
26 | |||
27 | #include "s6000-i2s.h" | ||
28 | #include "s6000-pcm.h" | ||
29 | |||
30 | struct s6000_i2s_dev { | ||
31 | dma_addr_t sifbase; | ||
32 | u8 __iomem *scbbase; | ||
33 | unsigned int wide; | ||
34 | unsigned int channel_in; | ||
35 | unsigned int channel_out; | ||
36 | unsigned int lines_in; | ||
37 | unsigned int lines_out; | ||
38 | struct s6000_pcm_dma_params dma_params; | ||
39 | }; | ||
40 | |||
41 | #define S6_I2S_INTERRUPT_STATUS 0x00 | ||
42 | #define S6_I2S_INT_OVERRUN 1 | ||
43 | #define S6_I2S_INT_UNDERRUN 2 | ||
44 | #define S6_I2S_INT_ALIGNMENT 4 | ||
45 | #define S6_I2S_INTERRUPT_ENABLE 0x04 | ||
46 | #define S6_I2S_INTERRUPT_RAW 0x08 | ||
47 | #define S6_I2S_INTERRUPT_CLEAR 0x0C | ||
48 | #define S6_I2S_INTERRUPT_SET 0x10 | ||
49 | #define S6_I2S_MODE 0x20 | ||
50 | #define S6_I2S_DUAL 0 | ||
51 | #define S6_I2S_WIDE 1 | ||
52 | #define S6_I2S_TX_DEFAULT 0x24 | ||
53 | #define S6_I2S_DATA_CFG(c) (0x40 + 0x10 * (c)) | ||
54 | #define S6_I2S_IN 0 | ||
55 | #define S6_I2S_OUT 1 | ||
56 | #define S6_I2S_UNUSED 2 | ||
57 | #define S6_I2S_INTERFACE_CFG(c) (0x44 + 0x10 * (c)) | ||
58 | #define S6_I2S_DIV_MASK 0x001fff | ||
59 | #define S6_I2S_16BIT 0x000000 | ||
60 | #define S6_I2S_20BIT 0x002000 | ||
61 | #define S6_I2S_24BIT 0x004000 | ||
62 | #define S6_I2S_32BIT 0x006000 | ||
63 | #define S6_I2S_BITS_MASK 0x006000 | ||
64 | #define S6_I2S_MEM_16BIT 0x000000 | ||
65 | #define S6_I2S_MEM_32BIT 0x008000 | ||
66 | #define S6_I2S_MEM_MASK 0x008000 | ||
67 | #define S6_I2S_CHANNELS_SHIFT 16 | ||
68 | #define S6_I2S_CHANNELS_MASK 0x030000 | ||
69 | #define S6_I2S_SCK_IN 0x000000 | ||
70 | #define S6_I2S_SCK_OUT 0x040000 | ||
71 | #define S6_I2S_SCK_DIR 0x040000 | ||
72 | #define S6_I2S_WS_IN 0x000000 | ||
73 | #define S6_I2S_WS_OUT 0x080000 | ||
74 | #define S6_I2S_WS_DIR 0x080000 | ||
75 | #define S6_I2S_LEFT_FIRST 0x000000 | ||
76 | #define S6_I2S_RIGHT_FIRST 0x100000 | ||
77 | #define S6_I2S_FIRST 0x100000 | ||
78 | #define S6_I2S_CUR_SCK 0x200000 | ||
79 | #define S6_I2S_CUR_WS 0x400000 | ||
80 | #define S6_I2S_ENABLE(c) (0x48 + 0x10 * (c)) | ||
81 | #define S6_I2S_DISABLE_IF 0x02 | ||
82 | #define S6_I2S_ENABLE_IF 0x03 | ||
83 | #define S6_I2S_IS_BUSY 0x04 | ||
84 | #define S6_I2S_DMA_ACTIVE 0x08 | ||
85 | #define S6_I2S_IS_ENABLED 0x10 | ||
86 | |||
87 | #define S6_I2S_NUM_LINES 4 | ||
88 | |||
89 | #define S6_I2S_SIF_PORT0 0x0000000 | ||
90 | #define S6_I2S_SIF_PORT1 0x0000080 /* docs say 0x0000010 */ | ||
91 | |||
92 | static inline void s6_i2s_write_reg(struct s6000_i2s_dev *dev, int reg, u32 val) | ||
93 | { | ||
94 | writel(val, dev->scbbase + reg); | ||
95 | } | ||
96 | |||
97 | static inline u32 s6_i2s_read_reg(struct s6000_i2s_dev *dev, int reg) | ||
98 | { | ||
99 | return readl(dev->scbbase + reg); | ||
100 | } | ||
101 | |||
102 | static inline void s6_i2s_mod_reg(struct s6000_i2s_dev *dev, int reg, | ||
103 | u32 mask, u32 val) | ||
104 | { | ||
105 | val ^= s6_i2s_read_reg(dev, reg) & ~mask; | ||
106 | s6_i2s_write_reg(dev, reg, val); | ||
107 | } | ||
108 | |||
109 | static void s6000_i2s_start_channel(struct s6000_i2s_dev *dev, int channel) | ||
110 | { | ||
111 | int i, j, cur, prev; | ||
112 | |||
113 | /* | ||
114 | * Wait for WCLK to toggle 5 times before enabling the channel | ||
115 | * s6000 Family Datasheet 3.6.4: | ||
116 | * "At least two cycles of WS must occur between commands | ||
117 | * to disable or enable the interface" | ||
118 | */ | ||
119 | j = 0; | ||
120 | prev = ~S6_I2S_CUR_WS; | ||
121 | for (i = 1000000; --i && j < 6; ) { | ||
122 | cur = s6_i2s_read_reg(dev, S6_I2S_INTERFACE_CFG(channel)) | ||
123 | & S6_I2S_CUR_WS; | ||
124 | if (prev != cur) { | ||
125 | prev = cur; | ||
126 | j++; | ||
127 | } | ||
128 | } | ||
129 | if (j < 6) | ||
130 | printk(KERN_WARNING "s6000-i2s: timeout waiting for WCLK\n"); | ||
131 | |||
132 | s6_i2s_write_reg(dev, S6_I2S_ENABLE(channel), S6_I2S_ENABLE_IF); | ||
133 | } | ||
134 | |||
135 | static void s6000_i2s_stop_channel(struct s6000_i2s_dev *dev, int channel) | ||
136 | { | ||
137 | s6_i2s_write_reg(dev, S6_I2S_ENABLE(channel), S6_I2S_DISABLE_IF); | ||
138 | } | ||
139 | |||
140 | static void s6000_i2s_start(struct snd_pcm_substream *substream) | ||
141 | { | ||
142 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
143 | struct s6000_i2s_dev *dev = snd_soc_dai_get_drvdata(rtd->cpu_dai); | ||
144 | int channel; | ||
145 | |||
146 | channel = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ? | ||
147 | dev->channel_out : dev->channel_in; | ||
148 | |||
149 | s6000_i2s_start_channel(dev, channel); | ||
150 | } | ||
151 | |||
152 | static void s6000_i2s_stop(struct snd_pcm_substream *substream) | ||
153 | { | ||
154 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
155 | struct s6000_i2s_dev *dev = snd_soc_dai_get_drvdata(rtd->cpu_dai); | ||
156 | int channel; | ||
157 | |||
158 | channel = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ? | ||
159 | dev->channel_out : dev->channel_in; | ||
160 | |||
161 | s6000_i2s_stop_channel(dev, channel); | ||
162 | } | ||
163 | |||
164 | static int s6000_i2s_trigger(struct snd_pcm_substream *substream, int cmd, | ||
165 | int after) | ||
166 | { | ||
167 | switch (cmd) { | ||
168 | case SNDRV_PCM_TRIGGER_START: | ||
169 | case SNDRV_PCM_TRIGGER_RESUME: | ||
170 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: | ||
171 | if ((substream->stream == SNDRV_PCM_STREAM_CAPTURE) ^ !after) | ||
172 | s6000_i2s_start(substream); | ||
173 | break; | ||
174 | case SNDRV_PCM_TRIGGER_STOP: | ||
175 | case SNDRV_PCM_TRIGGER_SUSPEND: | ||
176 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: | ||
177 | if (!after) | ||
178 | s6000_i2s_stop(substream); | ||
179 | } | ||
180 | return 0; | ||
181 | } | ||
182 | |||
183 | static unsigned int s6000_i2s_int_sources(struct s6000_i2s_dev *dev) | ||
184 | { | ||
185 | unsigned int pending; | ||
186 | pending = s6_i2s_read_reg(dev, S6_I2S_INTERRUPT_RAW); | ||
187 | pending &= S6_I2S_INT_ALIGNMENT | | ||
188 | S6_I2S_INT_UNDERRUN | | ||
189 | S6_I2S_INT_OVERRUN; | ||
190 | s6_i2s_write_reg(dev, S6_I2S_INTERRUPT_CLEAR, pending); | ||
191 | |||
192 | return pending; | ||
193 | } | ||
194 | |||
195 | static unsigned int s6000_i2s_check_xrun(struct snd_soc_dai *cpu_dai) | ||
196 | { | ||
197 | struct s6000_i2s_dev *dev = snd_soc_dai_get_drvdata(cpu_dai); | ||
198 | unsigned int errors; | ||
199 | unsigned int ret; | ||
200 | |||
201 | errors = s6000_i2s_int_sources(dev); | ||
202 | if (likely(!errors)) | ||
203 | return 0; | ||
204 | |||
205 | ret = 0; | ||
206 | if (errors & S6_I2S_INT_ALIGNMENT) | ||
207 | printk(KERN_ERR "s6000-i2s: WCLK misaligned\n"); | ||
208 | if (errors & S6_I2S_INT_UNDERRUN) | ||
209 | ret |= 1 << SNDRV_PCM_STREAM_PLAYBACK; | ||
210 | if (errors & S6_I2S_INT_OVERRUN) | ||
211 | ret |= 1 << SNDRV_PCM_STREAM_CAPTURE; | ||
212 | return ret; | ||
213 | } | ||
214 | |||
215 | static void s6000_i2s_wait_disabled(struct s6000_i2s_dev *dev) | ||
216 | { | ||
217 | int channel; | ||
218 | int n = 50; | ||
219 | for (channel = 0; channel < 2; channel++) { | ||
220 | while (--n >= 0) { | ||
221 | int v = s6_i2s_read_reg(dev, S6_I2S_ENABLE(channel)); | ||
222 | if ((v & S6_I2S_IS_ENABLED) | ||
223 | || !(v & (S6_I2S_DMA_ACTIVE | S6_I2S_IS_BUSY))) | ||
224 | break; | ||
225 | udelay(20); | ||
226 | } | ||
227 | } | ||
228 | if (n < 0) | ||
229 | printk(KERN_WARNING "s6000-i2s: timeout disabling interfaces"); | ||
230 | } | ||
231 | |||
232 | static int s6000_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai, | ||
233 | unsigned int fmt) | ||
234 | { | ||
235 | struct s6000_i2s_dev *dev = snd_soc_dai_get_drvdata(cpu_dai); | ||
236 | u32 w; | ||
237 | |||
238 | switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { | ||
239 | case SND_SOC_DAIFMT_CBM_CFM: | ||
240 | w = S6_I2S_SCK_IN | S6_I2S_WS_IN; | ||
241 | break; | ||
242 | case SND_SOC_DAIFMT_CBS_CFM: | ||
243 | w = S6_I2S_SCK_OUT | S6_I2S_WS_IN; | ||
244 | break; | ||
245 | case SND_SOC_DAIFMT_CBM_CFS: | ||
246 | w = S6_I2S_SCK_IN | S6_I2S_WS_OUT; | ||
247 | break; | ||
248 | case SND_SOC_DAIFMT_CBS_CFS: | ||
249 | w = S6_I2S_SCK_OUT | S6_I2S_WS_OUT; | ||
250 | break; | ||
251 | default: | ||
252 | return -EINVAL; | ||
253 | } | ||
254 | |||
255 | switch (fmt & SND_SOC_DAIFMT_INV_MASK) { | ||
256 | case SND_SOC_DAIFMT_NB_NF: | ||
257 | w |= S6_I2S_LEFT_FIRST; | ||
258 | break; | ||
259 | case SND_SOC_DAIFMT_NB_IF: | ||
260 | w |= S6_I2S_RIGHT_FIRST; | ||
261 | break; | ||
262 | default: | ||
263 | return -EINVAL; | ||
264 | } | ||
265 | |||
266 | s6_i2s_mod_reg(dev, S6_I2S_INTERFACE_CFG(0), | ||
267 | S6_I2S_FIRST | S6_I2S_WS_DIR | S6_I2S_SCK_DIR, w); | ||
268 | s6_i2s_mod_reg(dev, S6_I2S_INTERFACE_CFG(1), | ||
269 | S6_I2S_FIRST | S6_I2S_WS_DIR | S6_I2S_SCK_DIR, w); | ||
270 | |||
271 | return 0; | ||
272 | } | ||
273 | |||
274 | static int s6000_i2s_set_clkdiv(struct snd_soc_dai *dai, int div_id, int div) | ||
275 | { | ||
276 | struct s6000_i2s_dev *dev = snd_soc_dai_get_drvdata(dai); | ||
277 | |||
278 | if (!div || (div & 1) || div > (S6_I2S_DIV_MASK + 1) * 2) | ||
279 | return -EINVAL; | ||
280 | |||
281 | s6_i2s_mod_reg(dev, S6_I2S_INTERFACE_CFG(div_id), | ||
282 | S6_I2S_DIV_MASK, div / 2 - 1); | ||
283 | return 0; | ||
284 | } | ||
285 | |||
286 | static int s6000_i2s_hw_params(struct snd_pcm_substream *substream, | ||
287 | struct snd_pcm_hw_params *params, | ||
288 | struct snd_soc_dai *dai) | ||
289 | { | ||
290 | struct s6000_i2s_dev *dev = snd_soc_dai_get_drvdata(dai); | ||
291 | int interf; | ||
292 | u32 w = 0; | ||
293 | |||
294 | if (dev->wide) | ||
295 | interf = 0; | ||
296 | else { | ||
297 | w |= (((params_channels(params) - 2) / 2) | ||
298 | << S6_I2S_CHANNELS_SHIFT) & S6_I2S_CHANNELS_MASK; | ||
299 | interf = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | ||
300 | ? dev->channel_out : dev->channel_in; | ||
301 | } | ||
302 | |||
303 | switch (params_format(params)) { | ||
304 | case SNDRV_PCM_FORMAT_S16_LE: | ||
305 | w |= S6_I2S_16BIT | S6_I2S_MEM_16BIT; | ||
306 | break; | ||
307 | case SNDRV_PCM_FORMAT_S32_LE: | ||
308 | w |= S6_I2S_32BIT | S6_I2S_MEM_32BIT; | ||
309 | break; | ||
310 | default: | ||
311 | printk(KERN_WARNING "s6000-i2s: unsupported PCM format %x\n", | ||
312 | params_format(params)); | ||
313 | return -EINVAL; | ||
314 | } | ||
315 | |||
316 | if (s6_i2s_read_reg(dev, S6_I2S_INTERFACE_CFG(interf)) | ||
317 | & S6_I2S_IS_ENABLED) { | ||
318 | printk(KERN_ERR "s6000-i2s: interface already enabled\n"); | ||
319 | return -EBUSY; | ||
320 | } | ||
321 | |||
322 | s6_i2s_mod_reg(dev, S6_I2S_INTERFACE_CFG(interf), | ||
323 | S6_I2S_CHANNELS_MASK|S6_I2S_MEM_MASK|S6_I2S_BITS_MASK, | ||
324 | w); | ||
325 | |||
326 | return 0; | ||
327 | } | ||
328 | |||
329 | static int s6000_i2s_dai_probe(struct snd_soc_dai *dai) | ||
330 | { | ||
331 | struct s6000_i2s_dev *dev = snd_soc_dai_get_drvdata(dai); | ||
332 | struct s6000_snd_platform_data *pdata = dai->dev->platform_data; | ||
333 | |||
334 | if (!pdata) | ||
335 | return -EINVAL; | ||
336 | |||
337 | dai->capture_dma_data = &dev->dma_params; | ||
338 | dai->playback_dma_data = &dev->dma_params; | ||
339 | |||
340 | dev->wide = pdata->wide; | ||
341 | dev->channel_in = pdata->channel_in; | ||
342 | dev->channel_out = pdata->channel_out; | ||
343 | dev->lines_in = pdata->lines_in; | ||
344 | dev->lines_out = pdata->lines_out; | ||
345 | |||
346 | s6_i2s_write_reg(dev, S6_I2S_MODE, | ||
347 | dev->wide ? S6_I2S_WIDE : S6_I2S_DUAL); | ||
348 | |||
349 | if (dev->wide) { | ||
350 | int i; | ||
351 | |||
352 | if (dev->lines_in + dev->lines_out > S6_I2S_NUM_LINES) | ||
353 | return -EINVAL; | ||
354 | |||
355 | dev->channel_in = 0; | ||
356 | dev->channel_out = 1; | ||
357 | dai->driver->capture.channels_min = 2 * dev->lines_in; | ||
358 | dai->driver->capture.channels_max = dai->driver->capture.channels_min; | ||
359 | dai->driver->playback.channels_min = 2 * dev->lines_out; | ||
360 | dai->driver->playback.channels_max = dai->driver->playback.channels_min; | ||
361 | |||
362 | for (i = 0; i < dev->lines_out; i++) | ||
363 | s6_i2s_write_reg(dev, S6_I2S_DATA_CFG(i), S6_I2S_OUT); | ||
364 | |||
365 | for (; i < S6_I2S_NUM_LINES - dev->lines_in; i++) | ||
366 | s6_i2s_write_reg(dev, S6_I2S_DATA_CFG(i), | ||
367 | S6_I2S_UNUSED); | ||
368 | |||
369 | for (; i < S6_I2S_NUM_LINES; i++) | ||
370 | s6_i2s_write_reg(dev, S6_I2S_DATA_CFG(i), S6_I2S_IN); | ||
371 | } else { | ||
372 | unsigned int cfg[2] = {S6_I2S_UNUSED, S6_I2S_UNUSED}; | ||
373 | |||
374 | if (dev->lines_in > 1 || dev->lines_out > 1) | ||
375 | return -EINVAL; | ||
376 | |||
377 | dai->driver->capture.channels_min = 2 * dev->lines_in; | ||
378 | dai->driver->capture.channels_max = 8 * dev->lines_in; | ||
379 | dai->driver->playback.channels_min = 2 * dev->lines_out; | ||
380 | dai->driver->playback.channels_max = 8 * dev->lines_out; | ||
381 | |||
382 | if (dev->lines_in) | ||
383 | cfg[dev->channel_in] = S6_I2S_IN; | ||
384 | if (dev->lines_out) | ||
385 | cfg[dev->channel_out] = S6_I2S_OUT; | ||
386 | |||
387 | s6_i2s_write_reg(dev, S6_I2S_DATA_CFG(0), cfg[0]); | ||
388 | s6_i2s_write_reg(dev, S6_I2S_DATA_CFG(1), cfg[1]); | ||
389 | } | ||
390 | |||
391 | if (dev->lines_out) { | ||
392 | if (dev->lines_in) { | ||
393 | if (!dev->dma_params.dma_out) | ||
394 | return -ENODEV; | ||
395 | } else { | ||
396 | dev->dma_params.dma_out = dev->dma_params.dma_in; | ||
397 | dev->dma_params.dma_in = 0; | ||
398 | } | ||
399 | } | ||
400 | dev->dma_params.sif_in = dev->sifbase + (dev->channel_in ? | ||
401 | S6_I2S_SIF_PORT1 : S6_I2S_SIF_PORT0); | ||
402 | dev->dma_params.sif_out = dev->sifbase + (dev->channel_out ? | ||
403 | S6_I2S_SIF_PORT1 : S6_I2S_SIF_PORT0); | ||
404 | dev->dma_params.same_rate = pdata->same_rate | pdata->wide; | ||
405 | return 0; | ||
406 | } | ||
407 | |||
408 | #define S6000_I2S_RATES SNDRV_PCM_RATE_CONTINUOUS | ||
409 | #define S6000_I2S_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S32_LE) | ||
410 | |||
411 | static const struct snd_soc_dai_ops s6000_i2s_dai_ops = { | ||
412 | .set_fmt = s6000_i2s_set_dai_fmt, | ||
413 | .set_clkdiv = s6000_i2s_set_clkdiv, | ||
414 | .hw_params = s6000_i2s_hw_params, | ||
415 | }; | ||
416 | |||
417 | static struct snd_soc_dai_driver s6000_i2s_dai = { | ||
418 | .probe = s6000_i2s_dai_probe, | ||
419 | .playback = { | ||
420 | .channels_min = 2, | ||
421 | .channels_max = 8, | ||
422 | .formats = S6000_I2S_FORMATS, | ||
423 | .rates = S6000_I2S_RATES, | ||
424 | .rate_min = 0, | ||
425 | .rate_max = 1562500, | ||
426 | }, | ||
427 | .capture = { | ||
428 | .channels_min = 2, | ||
429 | .channels_max = 8, | ||
430 | .formats = S6000_I2S_FORMATS, | ||
431 | .rates = S6000_I2S_RATES, | ||
432 | .rate_min = 0, | ||
433 | .rate_max = 1562500, | ||
434 | }, | ||
435 | .ops = &s6000_i2s_dai_ops, | ||
436 | }; | ||
437 | |||
438 | static const struct snd_soc_component_driver s6000_i2s_component = { | ||
439 | .name = "s6000-i2s", | ||
440 | }; | ||
441 | |||
442 | static int s6000_i2s_probe(struct platform_device *pdev) | ||
443 | { | ||
444 | struct s6000_i2s_dev *dev; | ||
445 | struct resource *scbmem, *sifmem, *region, *dma1, *dma2; | ||
446 | u8 __iomem *mmio; | ||
447 | int ret; | ||
448 | |||
449 | scbmem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
450 | if (!scbmem) { | ||
451 | dev_err(&pdev->dev, "no mem resource?\n"); | ||
452 | ret = -ENODEV; | ||
453 | goto err_release_none; | ||
454 | } | ||
455 | |||
456 | region = request_mem_region(scbmem->start, resource_size(scbmem), | ||
457 | pdev->name); | ||
458 | if (!region) { | ||
459 | dev_err(&pdev->dev, "I2S SCB region already claimed\n"); | ||
460 | ret = -EBUSY; | ||
461 | goto err_release_none; | ||
462 | } | ||
463 | |||
464 | mmio = ioremap(scbmem->start, resource_size(scbmem)); | ||
465 | if (!mmio) { | ||
466 | dev_err(&pdev->dev, "can't ioremap SCB region\n"); | ||
467 | ret = -ENOMEM; | ||
468 | goto err_release_scb; | ||
469 | } | ||
470 | |||
471 | sifmem = platform_get_resource(pdev, IORESOURCE_MEM, 1); | ||
472 | if (!sifmem) { | ||
473 | dev_err(&pdev->dev, "no second mem resource?\n"); | ||
474 | ret = -ENODEV; | ||
475 | goto err_release_map; | ||
476 | } | ||
477 | |||
478 | region = request_mem_region(sifmem->start, resource_size(sifmem), | ||
479 | pdev->name); | ||
480 | if (!region) { | ||
481 | dev_err(&pdev->dev, "I2S SIF region already claimed\n"); | ||
482 | ret = -EBUSY; | ||
483 | goto err_release_map; | ||
484 | } | ||
485 | |||
486 | dma1 = platform_get_resource(pdev, IORESOURCE_DMA, 0); | ||
487 | if (!dma1) { | ||
488 | dev_err(&pdev->dev, "no dma resource?\n"); | ||
489 | ret = -ENODEV; | ||
490 | goto err_release_sif; | ||
491 | } | ||
492 | |||
493 | region = request_mem_region(dma1->start, resource_size(dma1), | ||
494 | pdev->name); | ||
495 | if (!region) { | ||
496 | dev_err(&pdev->dev, "I2S DMA region already claimed\n"); | ||
497 | ret = -EBUSY; | ||
498 | goto err_release_sif; | ||
499 | } | ||
500 | |||
501 | dma2 = platform_get_resource(pdev, IORESOURCE_DMA, 1); | ||
502 | if (dma2) { | ||
503 | region = request_mem_region(dma2->start, resource_size(dma2), | ||
504 | pdev->name); | ||
505 | if (!region) { | ||
506 | dev_err(&pdev->dev, | ||
507 | "I2S DMA region already claimed\n"); | ||
508 | ret = -EBUSY; | ||
509 | goto err_release_dma1; | ||
510 | } | ||
511 | } | ||
512 | |||
513 | dev = kzalloc(sizeof(struct s6000_i2s_dev), GFP_KERNEL); | ||
514 | if (!dev) { | ||
515 | ret = -ENOMEM; | ||
516 | goto err_release_dma2; | ||
517 | } | ||
518 | dev_set_drvdata(&pdev->dev, dev); | ||
519 | |||
520 | dev->sifbase = sifmem->start; | ||
521 | dev->scbbase = mmio; | ||
522 | |||
523 | s6_i2s_write_reg(dev, S6_I2S_INTERRUPT_ENABLE, 0); | ||
524 | s6_i2s_write_reg(dev, S6_I2S_INTERRUPT_CLEAR, | ||
525 | S6_I2S_INT_ALIGNMENT | | ||
526 | S6_I2S_INT_UNDERRUN | | ||
527 | S6_I2S_INT_OVERRUN); | ||
528 | |||
529 | s6000_i2s_stop_channel(dev, 0); | ||
530 | s6000_i2s_stop_channel(dev, 1); | ||
531 | s6000_i2s_wait_disabled(dev); | ||
532 | |||
533 | dev->dma_params.check_xrun = s6000_i2s_check_xrun; | ||
534 | dev->dma_params.trigger = s6000_i2s_trigger; | ||
535 | dev->dma_params.dma_in = dma1->start; | ||
536 | dev->dma_params.dma_out = dma2 ? dma2->start : 0; | ||
537 | dev->dma_params.irq = platform_get_irq(pdev, 0); | ||
538 | if (dev->dma_params.irq < 0) { | ||
539 | dev_err(&pdev->dev, "no irq resource?\n"); | ||
540 | ret = -ENODEV; | ||
541 | goto err_release_dev; | ||
542 | } | ||
543 | |||
544 | s6_i2s_write_reg(dev, S6_I2S_INTERRUPT_ENABLE, | ||
545 | S6_I2S_INT_ALIGNMENT | | ||
546 | S6_I2S_INT_UNDERRUN | | ||
547 | S6_I2S_INT_OVERRUN); | ||
548 | |||
549 | ret = snd_soc_register_component(&pdev->dev, &s6000_i2s_component, | ||
550 | &s6000_i2s_dai, 1); | ||
551 | if (ret) | ||
552 | goto err_release_dev; | ||
553 | |||
554 | return 0; | ||
555 | |||
556 | err_release_dev: | ||
557 | kfree(dev); | ||
558 | err_release_dma2: | ||
559 | if (dma2) | ||
560 | release_mem_region(dma2->start, resource_size(dma2)); | ||
561 | err_release_dma1: | ||
562 | release_mem_region(dma1->start, resource_size(dma1)); | ||
563 | err_release_sif: | ||
564 | release_mem_region(sifmem->start, resource_size(sifmem)); | ||
565 | err_release_map: | ||
566 | iounmap(mmio); | ||
567 | err_release_scb: | ||
568 | release_mem_region(scbmem->start, resource_size(scbmem)); | ||
569 | err_release_none: | ||
570 | return ret; | ||
571 | } | ||
572 | |||
573 | static int s6000_i2s_remove(struct platform_device *pdev) | ||
574 | { | ||
575 | struct s6000_i2s_dev *dev = dev_get_drvdata(&pdev->dev); | ||
576 | struct resource *region; | ||
577 | void __iomem *mmio = dev->scbbase; | ||
578 | |||
579 | snd_soc_unregister_component(&pdev->dev); | ||
580 | |||
581 | s6000_i2s_stop_channel(dev, 0); | ||
582 | s6000_i2s_stop_channel(dev, 1); | ||
583 | |||
584 | s6_i2s_write_reg(dev, S6_I2S_INTERRUPT_ENABLE, 0); | ||
585 | kfree(dev); | ||
586 | |||
587 | region = platform_get_resource(pdev, IORESOURCE_DMA, 0); | ||
588 | release_mem_region(region->start, resource_size(region)); | ||
589 | |||
590 | region = platform_get_resource(pdev, IORESOURCE_DMA, 1); | ||
591 | if (region) | ||
592 | release_mem_region(region->start, resource_size(region)); | ||
593 | |||
594 | region = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
595 | release_mem_region(region->start, resource_size(region)); | ||
596 | |||
597 | iounmap(mmio); | ||
598 | region = platform_get_resource(pdev, IORESOURCE_IO, 0); | ||
599 | release_mem_region(region->start, resource_size(region)); | ||
600 | |||
601 | return 0; | ||
602 | } | ||
603 | |||
604 | static struct platform_driver s6000_i2s_driver = { | ||
605 | .probe = s6000_i2s_probe, | ||
606 | .remove = s6000_i2s_remove, | ||
607 | .driver = { | ||
608 | .name = "s6000-i2s", | ||
609 | .owner = THIS_MODULE, | ||
610 | }, | ||
611 | }; | ||
612 | |||
613 | module_platform_driver(s6000_i2s_driver); | ||
614 | |||
615 | MODULE_AUTHOR("Daniel Gloeckner"); | ||
616 | MODULE_DESCRIPTION("Stretch s6000 family I2S SoC Interface"); | ||
617 | MODULE_LICENSE("GPL"); | ||
diff --git a/sound/soc/s6000/s6000-i2s.h b/sound/soc/s6000/s6000-i2s.h deleted file mode 100644 index 86aa1921c89e..000000000000 --- a/sound/soc/s6000/s6000-i2s.h +++ /dev/null | |||
@@ -1,23 +0,0 @@ | |||
1 | /* | ||
2 | * ALSA SoC I2S Audio Layer for the Stretch s6000 family | ||
3 | * | ||
4 | * Author: Daniel Gloeckner, <dg@emlix.com> | ||
5 | * Copyright: (C) 2009 emlix GmbH <info@emlix.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #ifndef _S6000_I2S_H | ||
13 | #define _S6000_I2S_H | ||
14 | |||
15 | struct s6000_snd_platform_data { | ||
16 | int lines_in; | ||
17 | int lines_out; | ||
18 | int channel_in; | ||
19 | int channel_out; | ||
20 | int wide; | ||
21 | int same_rate; | ||
22 | }; | ||
23 | #endif | ||
diff --git a/sound/soc/s6000/s6000-pcm.c b/sound/soc/s6000/s6000-pcm.c deleted file mode 100644 index fb8461e1b1f6..000000000000 --- a/sound/soc/s6000/s6000-pcm.c +++ /dev/null | |||
@@ -1,521 +0,0 @@ | |||
1 | /* | ||
2 | * ALSA PCM interface for the Stetch s6000 family | ||
3 | * | ||
4 | * Author: Daniel Gloeckner, <dg@emlix.com> | ||
5 | * Copyright: (C) 2009 emlix GmbH <info@emlix.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #include <linux/module.h> | ||
13 | #include <linux/init.h> | ||
14 | #include <linux/platform_device.h> | ||
15 | #include <linux/slab.h> | ||
16 | #include <linux/dma-mapping.h> | ||
17 | #include <linux/interrupt.h> | ||
18 | |||
19 | #include <sound/core.h> | ||
20 | #include <sound/pcm.h> | ||
21 | #include <sound/pcm_params.h> | ||
22 | #include <sound/soc.h> | ||
23 | |||
24 | #include <asm/dma.h> | ||
25 | #include <variant/dmac.h> | ||
26 | |||
27 | #include "s6000-pcm.h" | ||
28 | |||
29 | #define S6_PCM_PREALLOCATE_SIZE (96 * 1024) | ||
30 | #define S6_PCM_PREALLOCATE_MAX (2048 * 1024) | ||
31 | |||
32 | static struct snd_pcm_hardware s6000_pcm_hardware = { | ||
33 | .info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER | | ||
34 | SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID | | ||
35 | SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_JOINT_DUPLEX), | ||
36 | .buffer_bytes_max = 0x7ffffff0, | ||
37 | .period_bytes_min = 16, | ||
38 | .period_bytes_max = 0xfffff0, | ||
39 | .periods_min = 2, | ||
40 | .periods_max = 1024, /* no limit */ | ||
41 | .fifo_size = 0, | ||
42 | }; | ||
43 | |||
44 | struct s6000_runtime_data { | ||
45 | spinlock_t lock; | ||
46 | int period; /* current DMA period */ | ||
47 | }; | ||
48 | |||
49 | static void s6000_pcm_enqueue_dma(struct snd_pcm_substream *substream) | ||
50 | { | ||
51 | struct snd_pcm_runtime *runtime = substream->runtime; | ||
52 | struct s6000_runtime_data *prtd = runtime->private_data; | ||
53 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; | ||
54 | struct s6000_pcm_dma_params *par; | ||
55 | int channel; | ||
56 | unsigned int period_size; | ||
57 | unsigned int dma_offset; | ||
58 | dma_addr_t dma_pos; | ||
59 | dma_addr_t src, dst; | ||
60 | |||
61 | par = snd_soc_dai_get_dma_data(soc_runtime->cpu_dai, substream); | ||
62 | |||
63 | period_size = snd_pcm_lib_period_bytes(substream); | ||
64 | dma_offset = prtd->period * period_size; | ||
65 | dma_pos = runtime->dma_addr + dma_offset; | ||
66 | |||
67 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { | ||
68 | src = dma_pos; | ||
69 | dst = par->sif_out; | ||
70 | channel = par->dma_out; | ||
71 | } else { | ||
72 | src = par->sif_in; | ||
73 | dst = dma_pos; | ||
74 | channel = par->dma_in; | ||
75 | } | ||
76 | |||
77 | if (!s6dmac_channel_enabled(DMA_MASK_DMAC(channel), | ||
78 | DMA_INDEX_CHNL(channel))) | ||
79 | return; | ||
80 | |||
81 | if (s6dmac_fifo_full(DMA_MASK_DMAC(channel), DMA_INDEX_CHNL(channel))) { | ||
82 | printk(KERN_ERR "s6000-pcm: fifo full\n"); | ||
83 | return; | ||
84 | } | ||
85 | |||
86 | if (WARN_ON(period_size & 15)) | ||
87 | return; | ||
88 | s6dmac_put_fifo(DMA_MASK_DMAC(channel), DMA_INDEX_CHNL(channel), | ||
89 | src, dst, period_size); | ||
90 | |||
91 | prtd->period++; | ||
92 | if (unlikely(prtd->period >= runtime->periods)) | ||
93 | prtd->period = 0; | ||
94 | } | ||
95 | |||
96 | static irqreturn_t s6000_pcm_irq(int irq, void *data) | ||
97 | { | ||
98 | struct snd_pcm *pcm = data; | ||
99 | struct snd_soc_pcm_runtime *runtime = pcm->private_data; | ||
100 | struct s6000_runtime_data *prtd; | ||
101 | unsigned int has_xrun; | ||
102 | int i, ret = IRQ_NONE; | ||
103 | |||
104 | for (i = 0; i < 2; ++i) { | ||
105 | struct snd_pcm_substream *substream = pcm->streams[i].substream; | ||
106 | struct s6000_pcm_dma_params *params = | ||
107 | snd_soc_dai_get_dma_data(runtime->cpu_dai, substream); | ||
108 | u32 channel; | ||
109 | unsigned int pending; | ||
110 | |||
111 | if (substream == SNDRV_PCM_STREAM_PLAYBACK) | ||
112 | channel = params->dma_out; | ||
113 | else | ||
114 | channel = params->dma_in; | ||
115 | |||
116 | has_xrun = params->check_xrun(runtime->cpu_dai); | ||
117 | |||
118 | if (!channel) | ||
119 | continue; | ||
120 | |||
121 | if (unlikely(has_xrun & (1 << i)) && | ||
122 | substream->runtime && | ||
123 | snd_pcm_running(substream)) { | ||
124 | dev_dbg(pcm->dev, "xrun\n"); | ||
125 | snd_pcm_stream_lock(substream); | ||
126 | snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN); | ||
127 | snd_pcm_stream_unlock(substream); | ||
128 | ret = IRQ_HANDLED; | ||
129 | } | ||
130 | |||
131 | pending = s6dmac_int_sources(DMA_MASK_DMAC(channel), | ||
132 | DMA_INDEX_CHNL(channel)); | ||
133 | |||
134 | if (pending & 1) { | ||
135 | ret = IRQ_HANDLED; | ||
136 | if (likely(substream->runtime && | ||
137 | snd_pcm_running(substream))) { | ||
138 | snd_pcm_period_elapsed(substream); | ||
139 | dev_dbg(pcm->dev, "period elapsed %x %x\n", | ||
140 | s6dmac_cur_src(DMA_MASK_DMAC(channel), | ||
141 | DMA_INDEX_CHNL(channel)), | ||
142 | s6dmac_cur_dst(DMA_MASK_DMAC(channel), | ||
143 | DMA_INDEX_CHNL(channel))); | ||
144 | prtd = substream->runtime->private_data; | ||
145 | spin_lock(&prtd->lock); | ||
146 | s6000_pcm_enqueue_dma(substream); | ||
147 | spin_unlock(&prtd->lock); | ||
148 | } | ||
149 | } | ||
150 | |||
151 | if (unlikely(pending & ~7)) { | ||
152 | if (pending & (1 << 3)) | ||
153 | printk(KERN_WARNING | ||
154 | "s6000-pcm: DMA %x Underflow\n", | ||
155 | channel); | ||
156 | if (pending & (1 << 4)) | ||
157 | printk(KERN_WARNING | ||
158 | "s6000-pcm: DMA %x Overflow\n", | ||
159 | channel); | ||
160 | if (pending & 0x1e0) | ||
161 | printk(KERN_WARNING | ||
162 | "s6000-pcm: DMA %x Master Error " | ||
163 | "(mask %x)\n", | ||
164 | channel, pending >> 5); | ||
165 | |||
166 | } | ||
167 | } | ||
168 | |||
169 | return ret; | ||
170 | } | ||
171 | |||
172 | static int s6000_pcm_start(struct snd_pcm_substream *substream) | ||
173 | { | ||
174 | struct s6000_runtime_data *prtd = substream->runtime->private_data; | ||
175 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; | ||
176 | struct s6000_pcm_dma_params *par; | ||
177 | unsigned long flags; | ||
178 | int srcinc; | ||
179 | u32 dma; | ||
180 | |||
181 | par = snd_soc_dai_get_dma_data(soc_runtime->cpu_dai, substream); | ||
182 | |||
183 | spin_lock_irqsave(&prtd->lock, flags); | ||
184 | |||
185 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { | ||
186 | srcinc = 1; | ||
187 | dma = par->dma_out; | ||
188 | } else { | ||
189 | srcinc = 0; | ||
190 | dma = par->dma_in; | ||
191 | } | ||
192 | s6dmac_enable_chan(DMA_MASK_DMAC(dma), DMA_INDEX_CHNL(dma), | ||
193 | 1 /* priority 1 (0 is max) */, | ||
194 | 0 /* peripheral requests w/o xfer length mode */, | ||
195 | srcinc /* source address increment */, | ||
196 | srcinc^1 /* destination address increment */, | ||
197 | 0 /* chunksize 0 (skip impossible on this dma) */, | ||
198 | 0 /* source skip after chunk (impossible) */, | ||
199 | 0 /* destination skip after chunk (impossible) */, | ||
200 | 4 /* 16 byte burst size */, | ||
201 | -1 /* don't conserve bandwidth */, | ||
202 | 0 /* low watermark irq descriptor threshold */, | ||
203 | 0 /* disable hardware timestamps */, | ||
204 | 1 /* enable channel */); | ||
205 | |||
206 | s6000_pcm_enqueue_dma(substream); | ||
207 | s6000_pcm_enqueue_dma(substream); | ||
208 | |||
209 | spin_unlock_irqrestore(&prtd->lock, flags); | ||
210 | |||
211 | return 0; | ||
212 | } | ||
213 | |||
214 | static int s6000_pcm_stop(struct snd_pcm_substream *substream) | ||
215 | { | ||
216 | struct s6000_runtime_data *prtd = substream->runtime->private_data; | ||
217 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; | ||
218 | struct s6000_pcm_dma_params *par; | ||
219 | unsigned long flags; | ||
220 | u32 channel; | ||
221 | |||
222 | par = snd_soc_dai_get_dma_data(soc_runtime->cpu_dai, substream); | ||
223 | |||
224 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | ||
225 | channel = par->dma_out; | ||
226 | else | ||
227 | channel = par->dma_in; | ||
228 | |||
229 | s6dmac_set_terminal_count(DMA_MASK_DMAC(channel), | ||
230 | DMA_INDEX_CHNL(channel), 0); | ||
231 | |||
232 | spin_lock_irqsave(&prtd->lock, flags); | ||
233 | |||
234 | s6dmac_disable_chan(DMA_MASK_DMAC(channel), DMA_INDEX_CHNL(channel)); | ||
235 | |||
236 | spin_unlock_irqrestore(&prtd->lock, flags); | ||
237 | |||
238 | return 0; | ||
239 | } | ||
240 | |||
241 | static int s6000_pcm_trigger(struct snd_pcm_substream *substream, int cmd) | ||
242 | { | ||
243 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; | ||
244 | struct s6000_pcm_dma_params *par; | ||
245 | int ret; | ||
246 | |||
247 | par = snd_soc_dai_get_dma_data(soc_runtime->cpu_dai, substream); | ||
248 | |||
249 | ret = par->trigger(substream, cmd, 0); | ||
250 | if (ret < 0) | ||
251 | return ret; | ||
252 | |||
253 | switch (cmd) { | ||
254 | case SNDRV_PCM_TRIGGER_START: | ||
255 | case SNDRV_PCM_TRIGGER_RESUME: | ||
256 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: | ||
257 | ret = s6000_pcm_start(substream); | ||
258 | break; | ||
259 | case SNDRV_PCM_TRIGGER_STOP: | ||
260 | case SNDRV_PCM_TRIGGER_SUSPEND: | ||
261 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: | ||
262 | ret = s6000_pcm_stop(substream); | ||
263 | break; | ||
264 | default: | ||
265 | ret = -EINVAL; | ||
266 | } | ||
267 | if (ret < 0) | ||
268 | return ret; | ||
269 | |||
270 | return par->trigger(substream, cmd, 1); | ||
271 | } | ||
272 | |||
273 | static int s6000_pcm_prepare(struct snd_pcm_substream *substream) | ||
274 | { | ||
275 | struct s6000_runtime_data *prtd = substream->runtime->private_data; | ||
276 | |||
277 | prtd->period = 0; | ||
278 | |||
279 | return 0; | ||
280 | } | ||
281 | |||
282 | static snd_pcm_uframes_t s6000_pcm_pointer(struct snd_pcm_substream *substream) | ||
283 | { | ||
284 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; | ||
285 | struct s6000_pcm_dma_params *par; | ||
286 | struct snd_pcm_runtime *runtime = substream->runtime; | ||
287 | struct s6000_runtime_data *prtd = runtime->private_data; | ||
288 | unsigned long flags; | ||
289 | unsigned int offset; | ||
290 | dma_addr_t count; | ||
291 | |||
292 | par = snd_soc_dai_get_dma_data(soc_runtime->cpu_dai, substream); | ||
293 | |||
294 | spin_lock_irqsave(&prtd->lock, flags); | ||
295 | |||
296 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | ||
297 | count = s6dmac_cur_src(DMA_MASK_DMAC(par->dma_out), | ||
298 | DMA_INDEX_CHNL(par->dma_out)); | ||
299 | else | ||
300 | count = s6dmac_cur_dst(DMA_MASK_DMAC(par->dma_in), | ||
301 | DMA_INDEX_CHNL(par->dma_in)); | ||
302 | |||
303 | count -= runtime->dma_addr; | ||
304 | |||
305 | spin_unlock_irqrestore(&prtd->lock, flags); | ||
306 | |||
307 | offset = bytes_to_frames(runtime, count); | ||
308 | if (unlikely(offset >= runtime->buffer_size)) | ||
309 | offset = 0; | ||
310 | |||
311 | return offset; | ||
312 | } | ||
313 | |||
314 | static int s6000_pcm_open(struct snd_pcm_substream *substream) | ||
315 | { | ||
316 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; | ||
317 | struct s6000_pcm_dma_params *par; | ||
318 | struct snd_pcm_runtime *runtime = substream->runtime; | ||
319 | struct s6000_runtime_data *prtd; | ||
320 | int ret; | ||
321 | |||
322 | par = snd_soc_dai_get_dma_data(soc_runtime->cpu_dai, substream); | ||
323 | snd_soc_set_runtime_hwparams(substream, &s6000_pcm_hardware); | ||
324 | |||
325 | ret = snd_pcm_hw_constraint_step(runtime, 0, | ||
326 | SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 16); | ||
327 | if (ret < 0) | ||
328 | return ret; | ||
329 | ret = snd_pcm_hw_constraint_step(runtime, 0, | ||
330 | SNDRV_PCM_HW_PARAM_BUFFER_BYTES, 16); | ||
331 | if (ret < 0) | ||
332 | return ret; | ||
333 | ret = snd_pcm_hw_constraint_integer(runtime, | ||
334 | SNDRV_PCM_HW_PARAM_PERIODS); | ||
335 | if (ret < 0) | ||
336 | return ret; | ||
337 | |||
338 | if (par->same_rate) { | ||
339 | int rate; | ||
340 | spin_lock(&par->lock); /* needed? */ | ||
341 | rate = par->rate; | ||
342 | spin_unlock(&par->lock); | ||
343 | if (rate != -1) { | ||
344 | ret = snd_pcm_hw_constraint_minmax(runtime, | ||
345 | SNDRV_PCM_HW_PARAM_RATE, | ||
346 | rate, rate); | ||
347 | if (ret < 0) | ||
348 | return ret; | ||
349 | } | ||
350 | } | ||
351 | |||
352 | prtd = kzalloc(sizeof(struct s6000_runtime_data), GFP_KERNEL); | ||
353 | if (prtd == NULL) | ||
354 | return -ENOMEM; | ||
355 | |||
356 | spin_lock_init(&prtd->lock); | ||
357 | |||
358 | runtime->private_data = prtd; | ||
359 | |||
360 | return 0; | ||
361 | } | ||
362 | |||
363 | static int s6000_pcm_close(struct snd_pcm_substream *substream) | ||
364 | { | ||
365 | struct snd_pcm_runtime *runtime = substream->runtime; | ||
366 | struct s6000_runtime_data *prtd = runtime->private_data; | ||
367 | |||
368 | kfree(prtd); | ||
369 | |||
370 | return 0; | ||
371 | } | ||
372 | |||
373 | static int s6000_pcm_hw_params(struct snd_pcm_substream *substream, | ||
374 | struct snd_pcm_hw_params *hw_params) | ||
375 | { | ||
376 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; | ||
377 | struct s6000_pcm_dma_params *par; | ||
378 | int ret; | ||
379 | ret = snd_pcm_lib_malloc_pages(substream, | ||
380 | params_buffer_bytes(hw_params)); | ||
381 | if (ret < 0) { | ||
382 | printk(KERN_WARNING "s6000-pcm: allocation of memory failed\n"); | ||
383 | return ret; | ||
384 | } | ||
385 | |||
386 | par = snd_soc_dai_get_dma_data(soc_runtime->cpu_dai, substream); | ||
387 | |||
388 | if (par->same_rate) { | ||
389 | spin_lock(&par->lock); | ||
390 | if (par->rate == -1 || | ||
391 | !(par->in_use & ~(1 << substream->stream))) { | ||
392 | par->rate = params_rate(hw_params); | ||
393 | par->in_use |= 1 << substream->stream; | ||
394 | } else if (params_rate(hw_params) != par->rate) { | ||
395 | snd_pcm_lib_free_pages(substream); | ||
396 | par->in_use &= ~(1 << substream->stream); | ||
397 | ret = -EBUSY; | ||
398 | } | ||
399 | spin_unlock(&par->lock); | ||
400 | } | ||
401 | return ret; | ||
402 | } | ||
403 | |||
404 | static int s6000_pcm_hw_free(struct snd_pcm_substream *substream) | ||
405 | { | ||
406 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; | ||
407 | struct s6000_pcm_dma_params *par = | ||
408 | snd_soc_dai_get_dma_data(soc_runtime->cpu_dai, substream); | ||
409 | |||
410 | spin_lock(&par->lock); | ||
411 | par->in_use &= ~(1 << substream->stream); | ||
412 | if (!par->in_use) | ||
413 | par->rate = -1; | ||
414 | spin_unlock(&par->lock); | ||
415 | |||
416 | return snd_pcm_lib_free_pages(substream); | ||
417 | } | ||
418 | |||
419 | static struct snd_pcm_ops s6000_pcm_ops = { | ||
420 | .open = s6000_pcm_open, | ||
421 | .close = s6000_pcm_close, | ||
422 | .ioctl = snd_pcm_lib_ioctl, | ||
423 | .hw_params = s6000_pcm_hw_params, | ||
424 | .hw_free = s6000_pcm_hw_free, | ||
425 | .trigger = s6000_pcm_trigger, | ||
426 | .prepare = s6000_pcm_prepare, | ||
427 | .pointer = s6000_pcm_pointer, | ||
428 | }; | ||
429 | |||
430 | static void s6000_pcm_free(struct snd_pcm *pcm) | ||
431 | { | ||
432 | struct snd_soc_pcm_runtime *runtime = pcm->private_data; | ||
433 | struct s6000_pcm_dma_params *params = | ||
434 | snd_soc_dai_get_dma_data(runtime->cpu_dai, | ||
435 | pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream); | ||
436 | |||
437 | free_irq(params->irq, pcm); | ||
438 | snd_pcm_lib_preallocate_free_for_all(pcm); | ||
439 | } | ||
440 | |||
441 | static int s6000_pcm_new(struct snd_soc_pcm_runtime *runtime) | ||
442 | { | ||
443 | struct snd_card *card = runtime->card->snd_card; | ||
444 | struct snd_pcm *pcm = runtime->pcm; | ||
445 | struct s6000_pcm_dma_params *params; | ||
446 | int res; | ||
447 | |||
448 | params = snd_soc_dai_get_dma_data(runtime->cpu_dai, | ||
449 | pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream); | ||
450 | |||
451 | res = dma_coerce_mask_and_coherent(card->dev, DMA_BIT_MASK(32)); | ||
452 | if (res) | ||
453 | return res; | ||
454 | |||
455 | if (params->dma_in) { | ||
456 | s6dmac_disable_chan(DMA_MASK_DMAC(params->dma_in), | ||
457 | DMA_INDEX_CHNL(params->dma_in)); | ||
458 | s6dmac_int_sources(DMA_MASK_DMAC(params->dma_in), | ||
459 | DMA_INDEX_CHNL(params->dma_in)); | ||
460 | } | ||
461 | |||
462 | if (params->dma_out) { | ||
463 | s6dmac_disable_chan(DMA_MASK_DMAC(params->dma_out), | ||
464 | DMA_INDEX_CHNL(params->dma_out)); | ||
465 | s6dmac_int_sources(DMA_MASK_DMAC(params->dma_out), | ||
466 | DMA_INDEX_CHNL(params->dma_out)); | ||
467 | } | ||
468 | |||
469 | res = request_irq(params->irq, s6000_pcm_irq, IRQF_SHARED, | ||
470 | "s6000-audio", pcm); | ||
471 | if (res) { | ||
472 | printk(KERN_ERR "s6000-pcm couldn't get IRQ\n"); | ||
473 | return res; | ||
474 | } | ||
475 | |||
476 | res = snd_pcm_lib_preallocate_pages_for_all(pcm, | ||
477 | SNDRV_DMA_TYPE_DEV, | ||
478 | card->dev, | ||
479 | S6_PCM_PREALLOCATE_SIZE, | ||
480 | S6_PCM_PREALLOCATE_MAX); | ||
481 | if (res) | ||
482 | printk(KERN_WARNING "s6000-pcm: preallocation failed\n"); | ||
483 | |||
484 | spin_lock_init(¶ms->lock); | ||
485 | params->in_use = 0; | ||
486 | params->rate = -1; | ||
487 | return 0; | ||
488 | } | ||
489 | |||
490 | static struct snd_soc_platform_driver s6000_soc_platform = { | ||
491 | .ops = &s6000_pcm_ops, | ||
492 | .pcm_new = s6000_pcm_new, | ||
493 | .pcm_free = s6000_pcm_free, | ||
494 | }; | ||
495 | |||
496 | static int s6000_soc_platform_probe(struct platform_device *pdev) | ||
497 | { | ||
498 | return snd_soc_register_platform(&pdev->dev, &s6000_soc_platform); | ||
499 | } | ||
500 | |||
501 | static int s6000_soc_platform_remove(struct platform_device *pdev) | ||
502 | { | ||
503 | snd_soc_unregister_platform(&pdev->dev); | ||
504 | return 0; | ||
505 | } | ||
506 | |||
507 | static struct platform_driver s6000_pcm_driver = { | ||
508 | .driver = { | ||
509 | .name = "s6000-pcm-audio", | ||
510 | .owner = THIS_MODULE, | ||
511 | }, | ||
512 | |||
513 | .probe = s6000_soc_platform_probe, | ||
514 | .remove = s6000_soc_platform_remove, | ||
515 | }; | ||
516 | |||
517 | module_platform_driver(s6000_pcm_driver); | ||
518 | |||
519 | MODULE_AUTHOR("Daniel Gloeckner"); | ||
520 | MODULE_DESCRIPTION("Stretch s6000 family PCM DMA module"); | ||
521 | MODULE_LICENSE("GPL"); | ||
diff --git a/sound/soc/s6000/s6000-pcm.h b/sound/soc/s6000/s6000-pcm.h deleted file mode 100644 index 09d9b883e58b..000000000000 --- a/sound/soc/s6000/s6000-pcm.h +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
1 | /* | ||
2 | * ALSA PCM interface for the Stretch s6000 family | ||
3 | * | ||
4 | * Author: Daniel Gloeckner, <dg@emlix.com> | ||
5 | * Copyright: (C) 2009 emlix GmbH <info@emlix.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #ifndef _S6000_PCM_H | ||
13 | #define _S6000_PCM_H | ||
14 | |||
15 | struct snd_soc_dai; | ||
16 | struct snd_pcm_substream; | ||
17 | |||
18 | struct s6000_pcm_dma_params { | ||
19 | unsigned int (*check_xrun)(struct snd_soc_dai *cpu_dai); | ||
20 | int (*trigger)(struct snd_pcm_substream *substream, int cmd, int after); | ||
21 | dma_addr_t sif_in; | ||
22 | dma_addr_t sif_out; | ||
23 | u32 dma_in; | ||
24 | u32 dma_out; | ||
25 | int irq; | ||
26 | int same_rate; | ||
27 | |||
28 | spinlock_t lock; | ||
29 | int in_use; | ||
30 | int rate; | ||
31 | }; | ||
32 | |||
33 | #endif | ||
diff --git a/sound/soc/s6000/s6105-ipcam.c b/sound/soc/s6000/s6105-ipcam.c deleted file mode 100644 index 3510c01f8a6a..000000000000 --- a/sound/soc/s6000/s6105-ipcam.c +++ /dev/null | |||
@@ -1,221 +0,0 @@ | |||
1 | /* | ||
2 | * ASoC driver for Stretch s6105 IP camera platform | ||
3 | * | ||
4 | * Author: Daniel Gloeckner, <dg@emlix.com> | ||
5 | * Copyright: (C) 2009 emlix GmbH <info@emlix.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #include <linux/module.h> | ||
13 | #include <linux/moduleparam.h> | ||
14 | #include <linux/timer.h> | ||
15 | #include <linux/interrupt.h> | ||
16 | #include <linux/platform_device.h> | ||
17 | #include <linux/i2c.h> | ||
18 | #include <sound/core.h> | ||
19 | #include <sound/pcm.h> | ||
20 | #include <sound/soc.h> | ||
21 | |||
22 | #include "s6000-pcm.h" | ||
23 | #include "s6000-i2s.h" | ||
24 | |||
25 | #define S6105_CAM_CODEC_CLOCK 12288000 | ||
26 | |||
27 | static int s6105_hw_params(struct snd_pcm_substream *substream, | ||
28 | struct snd_pcm_hw_params *params) | ||
29 | { | ||
30 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
31 | struct snd_soc_dai *codec_dai = rtd->codec_dai; | ||
32 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; | ||
33 | int ret = 0; | ||
34 | |||
35 | /* set codec DAI configuration */ | ||
36 | ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S | | ||
37 | SND_SOC_DAIFMT_CBM_CFM); | ||
38 | if (ret < 0) | ||
39 | return ret; | ||
40 | |||
41 | /* set cpu DAI configuration */ | ||
42 | ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_CBM_CFM | | ||
43 | SND_SOC_DAIFMT_NB_NF); | ||
44 | if (ret < 0) | ||
45 | return ret; | ||
46 | |||
47 | /* set the codec system clock */ | ||
48 | ret = snd_soc_dai_set_sysclk(codec_dai, 0, S6105_CAM_CODEC_CLOCK, | ||
49 | SND_SOC_CLOCK_OUT); | ||
50 | if (ret < 0) | ||
51 | return ret; | ||
52 | |||
53 | return 0; | ||
54 | } | ||
55 | |||
56 | static struct snd_soc_ops s6105_ops = { | ||
57 | .hw_params = s6105_hw_params, | ||
58 | }; | ||
59 | |||
60 | /* s6105 machine dapm widgets */ | ||
61 | static const struct snd_soc_dapm_widget aic3x_dapm_widgets[] = { | ||
62 | SND_SOC_DAPM_LINE("Audio Out Differential", NULL), | ||
63 | SND_SOC_DAPM_LINE("Audio Out Stereo", NULL), | ||
64 | SND_SOC_DAPM_LINE("Audio In", NULL), | ||
65 | }; | ||
66 | |||
67 | /* s6105 machine audio_mapnections to the codec pins */ | ||
68 | static const struct snd_soc_dapm_route audio_map[] = { | ||
69 | /* Audio Out connected to HPLOUT, HPLCOM, HPROUT */ | ||
70 | {"Audio Out Differential", NULL, "HPLOUT"}, | ||
71 | {"Audio Out Differential", NULL, "HPLCOM"}, | ||
72 | {"Audio Out Stereo", NULL, "HPLOUT"}, | ||
73 | {"Audio Out Stereo", NULL, "HPROUT"}, | ||
74 | |||
75 | /* Audio In connected to LINE1L, LINE1R */ | ||
76 | {"LINE1L", NULL, "Audio In"}, | ||
77 | {"LINE1R", NULL, "Audio In"}, | ||
78 | }; | ||
79 | |||
80 | static int output_type_info(struct snd_kcontrol *kcontrol, | ||
81 | struct snd_ctl_elem_info *uinfo) | ||
82 | { | ||
83 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | ||
84 | uinfo->count = 1; | ||
85 | uinfo->value.enumerated.items = 2; | ||
86 | if (uinfo->value.enumerated.item) { | ||
87 | uinfo->value.enumerated.item = 1; | ||
88 | strcpy(uinfo->value.enumerated.name, "HPLOUT/HPROUT"); | ||
89 | } else { | ||
90 | strcpy(uinfo->value.enumerated.name, "HPLOUT/HPLCOM"); | ||
91 | } | ||
92 | return 0; | ||
93 | } | ||
94 | |||
95 | static int output_type_get(struct snd_kcontrol *kcontrol, | ||
96 | struct snd_ctl_elem_value *ucontrol) | ||
97 | { | ||
98 | ucontrol->value.enumerated.item[0] = kcontrol->private_value; | ||
99 | return 0; | ||
100 | } | ||
101 | |||
102 | static int output_type_put(struct snd_kcontrol *kcontrol, | ||
103 | struct snd_ctl_elem_value *ucontrol) | ||
104 | { | ||
105 | struct snd_soc_card *card = kcontrol->private_data; | ||
106 | struct snd_soc_dapm_context *dapm = &card->dapm; | ||
107 | unsigned int val = (ucontrol->value.enumerated.item[0] != 0); | ||
108 | char *differential = "Audio Out Differential"; | ||
109 | char *stereo = "Audio Out Stereo"; | ||
110 | |||
111 | if (kcontrol->private_value == val) | ||
112 | return 0; | ||
113 | kcontrol->private_value = val; | ||
114 | snd_soc_dapm_disable_pin(dapm, val ? differential : stereo); | ||
115 | snd_soc_dapm_sync(dapm); | ||
116 | snd_soc_dapm_enable_pin(dapm, val ? stereo : differential); | ||
117 | snd_soc_dapm_sync(dapm); | ||
118 | |||
119 | return 1; | ||
120 | } | ||
121 | |||
122 | static const struct snd_kcontrol_new audio_out_mux = { | ||
123 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
124 | .name = "Master Output Mux", | ||
125 | .index = 0, | ||
126 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, | ||
127 | .info = output_type_info, | ||
128 | .get = output_type_get, | ||
129 | .put = output_type_put, | ||
130 | .private_value = 1 /* default to stereo */ | ||
131 | }; | ||
132 | |||
133 | /* Logic for a aic3x as connected on the s6105 ip camera ref design */ | ||
134 | static int s6105_aic3x_init(struct snd_soc_pcm_runtime *rtd) | ||
135 | { | ||
136 | struct snd_soc_card *card = rtd->card; | ||
137 | |||
138 | /* must correspond to audio_out_mux.private_value initializer */ | ||
139 | snd_soc_dapm_disable_pin(&card->dapm, "Audio Out Differential"); | ||
140 | |||
141 | snd_ctl_add(card->snd_card, snd_ctl_new1(&audio_out_mux, card)); | ||
142 | |||
143 | return 0; | ||
144 | } | ||
145 | |||
146 | /* s6105 digital audio interface glue - connects codec <--> CPU */ | ||
147 | static struct snd_soc_dai_link s6105_dai = { | ||
148 | .name = "TLV320AIC31", | ||
149 | .stream_name = "AIC31", | ||
150 | .cpu_dai_name = "s6000-i2s", | ||
151 | .codec_dai_name = "tlv320aic3x-hifi", | ||
152 | .platform_name = "s6000-pcm-audio", | ||
153 | .codec_name = "tlv320aic3x-codec.0-001a", | ||
154 | .init = s6105_aic3x_init, | ||
155 | .ops = &s6105_ops, | ||
156 | }; | ||
157 | |||
158 | /* s6105 audio machine driver */ | ||
159 | static struct snd_soc_card snd_soc_card_s6105 = { | ||
160 | .name = "Stretch IP Camera", | ||
161 | .owner = THIS_MODULE, | ||
162 | .dai_link = &s6105_dai, | ||
163 | .num_links = 1, | ||
164 | |||
165 | .dapm_widgets = aic3x_dapm_widgets, | ||
166 | .num_dapm_widgets = ARRAY_SIZE(aic3x_dapm_widgets), | ||
167 | .dapm_routes = audio_map, | ||
168 | .num_dapm_routes = ARRAY_SIZE(audio_map), | ||
169 | .fully_routed = true, | ||
170 | }; | ||
171 | |||
172 | static struct s6000_snd_platform_data s6105_snd_data __initdata = { | ||
173 | .wide = 0, | ||
174 | .channel_in = 0, | ||
175 | .channel_out = 1, | ||
176 | .lines_in = 1, | ||
177 | .lines_out = 1, | ||
178 | .same_rate = 1, | ||
179 | }; | ||
180 | |||
181 | static struct platform_device *s6105_snd_device; | ||
182 | |||
183 | /* temporary i2c device creation until this can be moved into the machine | ||
184 | * support file. | ||
185 | */ | ||
186 | static struct i2c_board_info i2c_device[] = { | ||
187 | { I2C_BOARD_INFO("tlv320aic33", 0x18), } | ||
188 | }; | ||
189 | |||
190 | static int __init s6105_init(void) | ||
191 | { | ||
192 | int ret; | ||
193 | |||
194 | i2c_register_board_info(0, i2c_device, ARRAY_SIZE(i2c_device)); | ||
195 | |||
196 | s6105_snd_device = platform_device_alloc("soc-audio", -1); | ||
197 | if (!s6105_snd_device) | ||
198 | return -ENOMEM; | ||
199 | |||
200 | platform_set_drvdata(s6105_snd_device, &snd_soc_card_s6105); | ||
201 | platform_device_add_data(s6105_snd_device, &s6105_snd_data, | ||
202 | sizeof(s6105_snd_data)); | ||
203 | |||
204 | ret = platform_device_add(s6105_snd_device); | ||
205 | if (ret) | ||
206 | platform_device_put(s6105_snd_device); | ||
207 | |||
208 | return ret; | ||
209 | } | ||
210 | |||
211 | static void __exit s6105_exit(void) | ||
212 | { | ||
213 | platform_device_unregister(s6105_snd_device); | ||
214 | } | ||
215 | |||
216 | module_init(s6105_init); | ||
217 | module_exit(s6105_exit); | ||
218 | |||
219 | MODULE_AUTHOR("Daniel Gloeckner"); | ||
220 | MODULE_DESCRIPTION("Stretch s6105 IP camera ASoC driver"); | ||
221 | MODULE_LICENSE("GPL"); | ||
diff --git a/sound/soc/samsung/snow.c b/sound/soc/samsung/snow.c index 0acf5d0eed53..72118a77dd5b 100644 --- a/sound/soc/samsung/snow.c +++ b/sound/soc/samsung/snow.c | |||
@@ -110,6 +110,7 @@ static const struct of_device_id snow_of_match[] = { | |||
110 | { .compatible = "google,snow-audio-max98095", }, | 110 | { .compatible = "google,snow-audio-max98095", }, |
111 | {}, | 111 | {}, |
112 | }; | 112 | }; |
113 | MODULE_DEVICE_TABLE(of, snow_of_match); | ||
113 | 114 | ||
114 | static struct platform_driver snow_driver = { | 115 | static struct platform_driver snow_driver = { |
115 | .driver = { | 116 | .driver = { |
diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c index 66fddec9543d..88e5df474ccf 100644 --- a/sound/soc/sh/fsi.c +++ b/sound/soc/sh/fsi.c | |||
@@ -1711,8 +1711,7 @@ static const struct snd_soc_dai_ops fsi_dai_ops = { | |||
1711 | static struct snd_pcm_hardware fsi_pcm_hardware = { | 1711 | static struct snd_pcm_hardware fsi_pcm_hardware = { |
1712 | .info = SNDRV_PCM_INFO_INTERLEAVED | | 1712 | .info = SNDRV_PCM_INFO_INTERLEAVED | |
1713 | SNDRV_PCM_INFO_MMAP | | 1713 | SNDRV_PCM_INFO_MMAP | |
1714 | SNDRV_PCM_INFO_MMAP_VALID | | 1714 | SNDRV_PCM_INFO_MMAP_VALID, |
1715 | SNDRV_PCM_INFO_PAUSE, | ||
1716 | .buffer_bytes_max = 64 * 1024, | 1715 | .buffer_bytes_max = 64 * 1024, |
1717 | .period_bytes_min = 32, | 1716 | .period_bytes_min = 32, |
1718 | .period_bytes_max = 8192, | 1717 | .period_bytes_max = 8192, |
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c index 1922ec57d10a..70042197f9e2 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c | |||
@@ -886,8 +886,7 @@ static int rsnd_dai_probe(struct platform_device *pdev, | |||
886 | static struct snd_pcm_hardware rsnd_pcm_hardware = { | 886 | static struct snd_pcm_hardware rsnd_pcm_hardware = { |
887 | .info = SNDRV_PCM_INFO_INTERLEAVED | | 887 | .info = SNDRV_PCM_INFO_INTERLEAVED | |
888 | SNDRV_PCM_INFO_MMAP | | 888 | SNDRV_PCM_INFO_MMAP | |
889 | SNDRV_PCM_INFO_MMAP_VALID | | 889 | SNDRV_PCM_INFO_MMAP_VALID, |
890 | SNDRV_PCM_INFO_PAUSE, | ||
891 | .buffer_bytes_max = 64 * 1024, | 890 | .buffer_bytes_max = 64 * 1024, |
892 | .period_bytes_min = 32, | 891 | .period_bytes_min = 32, |
893 | .period_bytes_max = 8192, | 892 | .period_bytes_max = 8192, |
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 4c8f8a23a0e9..b60ff56ebc0f 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -884,7 +884,7 @@ static struct snd_soc_dai *snd_soc_find_dai( | |||
884 | list_for_each_entry(component, &component_list, list) { | 884 | list_for_each_entry(component, &component_list, list) { |
885 | if (dlc->of_node && component->dev->of_node != dlc->of_node) | 885 | if (dlc->of_node && component->dev->of_node != dlc->of_node) |
886 | continue; | 886 | continue; |
887 | if (dlc->name && strcmp(dev_name(component->dev), dlc->name)) | 887 | if (dlc->name && strcmp(component->name, dlc->name)) |
888 | continue; | 888 | continue; |
889 | list_for_each_entry(dai, &component->dai_list, list) { | 889 | list_for_each_entry(dai, &component->dai_list, list) { |
890 | if (dlc->dai_name && strcmp(dai->name, dlc->dai_name)) | 890 | if (dlc->dai_name && strcmp(dai->name, dlc->dai_name)) |
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 002311afdeaa..57277dd79e11 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c | |||
@@ -1522,13 +1522,36 @@ static void dpcm_set_fe_runtime(struct snd_pcm_substream *substream) | |||
1522 | dpcm_init_runtime_hw(runtime, &cpu_dai_drv->capture); | 1522 | dpcm_init_runtime_hw(runtime, &cpu_dai_drv->capture); |
1523 | } | 1523 | } |
1524 | 1524 | ||
1525 | static int dpcm_fe_dai_do_trigger(struct snd_pcm_substream *substream, int cmd); | ||
1526 | |||
1527 | /* Set FE's runtime_update state; the state is protected via PCM stream lock | ||
1528 | * for avoiding the race with trigger callback. | ||
1529 | * If the state is unset and a trigger is pending while the previous operation, | ||
1530 | * process the pending trigger action here. | ||
1531 | */ | ||
1532 | static void dpcm_set_fe_update_state(struct snd_soc_pcm_runtime *fe, | ||
1533 | int stream, enum snd_soc_dpcm_update state) | ||
1534 | { | ||
1535 | struct snd_pcm_substream *substream = | ||
1536 | snd_soc_dpcm_get_substream(fe, stream); | ||
1537 | |||
1538 | snd_pcm_stream_lock_irq(substream); | ||
1539 | if (state == SND_SOC_DPCM_UPDATE_NO && fe->dpcm[stream].trigger_pending) { | ||
1540 | dpcm_fe_dai_do_trigger(substream, | ||
1541 | fe->dpcm[stream].trigger_pending - 1); | ||
1542 | fe->dpcm[stream].trigger_pending = 0; | ||
1543 | } | ||
1544 | fe->dpcm[stream].runtime_update = state; | ||
1545 | snd_pcm_stream_unlock_irq(substream); | ||
1546 | } | ||
1547 | |||
1525 | static int dpcm_fe_dai_startup(struct snd_pcm_substream *fe_substream) | 1548 | static int dpcm_fe_dai_startup(struct snd_pcm_substream *fe_substream) |
1526 | { | 1549 | { |
1527 | struct snd_soc_pcm_runtime *fe = fe_substream->private_data; | 1550 | struct snd_soc_pcm_runtime *fe = fe_substream->private_data; |
1528 | struct snd_pcm_runtime *runtime = fe_substream->runtime; | 1551 | struct snd_pcm_runtime *runtime = fe_substream->runtime; |
1529 | int stream = fe_substream->stream, ret = 0; | 1552 | int stream = fe_substream->stream, ret = 0; |
1530 | 1553 | ||
1531 | fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE; | 1554 | dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); |
1532 | 1555 | ||
1533 | ret = dpcm_be_dai_startup(fe, fe_substream->stream); | 1556 | ret = dpcm_be_dai_startup(fe, fe_substream->stream); |
1534 | if (ret < 0) { | 1557 | if (ret < 0) { |
@@ -1550,13 +1573,13 @@ static int dpcm_fe_dai_startup(struct snd_pcm_substream *fe_substream) | |||
1550 | dpcm_set_fe_runtime(fe_substream); | 1573 | dpcm_set_fe_runtime(fe_substream); |
1551 | snd_pcm_limit_hw_rates(runtime); | 1574 | snd_pcm_limit_hw_rates(runtime); |
1552 | 1575 | ||
1553 | fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; | 1576 | dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); |
1554 | return 0; | 1577 | return 0; |
1555 | 1578 | ||
1556 | unwind: | 1579 | unwind: |
1557 | dpcm_be_dai_startup_unwind(fe, fe_substream->stream); | 1580 | dpcm_be_dai_startup_unwind(fe, fe_substream->stream); |
1558 | be_err: | 1581 | be_err: |
1559 | fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; | 1582 | dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); |
1560 | return ret; | 1583 | return ret; |
1561 | } | 1584 | } |
1562 | 1585 | ||
@@ -1603,7 +1626,7 @@ static int dpcm_fe_dai_shutdown(struct snd_pcm_substream *substream) | |||
1603 | struct snd_soc_pcm_runtime *fe = substream->private_data; | 1626 | struct snd_soc_pcm_runtime *fe = substream->private_data; |
1604 | int stream = substream->stream; | 1627 | int stream = substream->stream; |
1605 | 1628 | ||
1606 | fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE; | 1629 | dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); |
1607 | 1630 | ||
1608 | /* shutdown the BEs */ | 1631 | /* shutdown the BEs */ |
1609 | dpcm_be_dai_shutdown(fe, substream->stream); | 1632 | dpcm_be_dai_shutdown(fe, substream->stream); |
@@ -1617,7 +1640,7 @@ static int dpcm_fe_dai_shutdown(struct snd_pcm_substream *substream) | |||
1617 | dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_STOP); | 1640 | dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_STOP); |
1618 | 1641 | ||
1619 | fe->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; | 1642 | fe->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE; |
1620 | fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; | 1643 | dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); |
1621 | return 0; | 1644 | return 0; |
1622 | } | 1645 | } |
1623 | 1646 | ||
@@ -1665,7 +1688,7 @@ static int dpcm_fe_dai_hw_free(struct snd_pcm_substream *substream) | |||
1665 | int err, stream = substream->stream; | 1688 | int err, stream = substream->stream; |
1666 | 1689 | ||
1667 | mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME); | 1690 | mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME); |
1668 | fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE; | 1691 | dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); |
1669 | 1692 | ||
1670 | dev_dbg(fe->dev, "ASoC: hw_free FE %s\n", fe->dai_link->name); | 1693 | dev_dbg(fe->dev, "ASoC: hw_free FE %s\n", fe->dai_link->name); |
1671 | 1694 | ||
@@ -1680,7 +1703,7 @@ static int dpcm_fe_dai_hw_free(struct snd_pcm_substream *substream) | |||
1680 | err = dpcm_be_dai_hw_free(fe, stream); | 1703 | err = dpcm_be_dai_hw_free(fe, stream); |
1681 | 1704 | ||
1682 | fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE; | 1705 | fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_FREE; |
1683 | fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; | 1706 | dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); |
1684 | 1707 | ||
1685 | mutex_unlock(&fe->card->mutex); | 1708 | mutex_unlock(&fe->card->mutex); |
1686 | return 0; | 1709 | return 0; |
@@ -1773,7 +1796,7 @@ static int dpcm_fe_dai_hw_params(struct snd_pcm_substream *substream, | |||
1773 | int ret, stream = substream->stream; | 1796 | int ret, stream = substream->stream; |
1774 | 1797 | ||
1775 | mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME); | 1798 | mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME); |
1776 | fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE; | 1799 | dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); |
1777 | 1800 | ||
1778 | memcpy(&fe->dpcm[substream->stream].hw_params, params, | 1801 | memcpy(&fe->dpcm[substream->stream].hw_params, params, |
1779 | sizeof(struct snd_pcm_hw_params)); | 1802 | sizeof(struct snd_pcm_hw_params)); |
@@ -1796,7 +1819,7 @@ static int dpcm_fe_dai_hw_params(struct snd_pcm_substream *substream, | |||
1796 | fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_PARAMS; | 1819 | fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_PARAMS; |
1797 | 1820 | ||
1798 | out: | 1821 | out: |
1799 | fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; | 1822 | dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); |
1800 | mutex_unlock(&fe->card->mutex); | 1823 | mutex_unlock(&fe->card->mutex); |
1801 | return ret; | 1824 | return ret; |
1802 | } | 1825 | } |
@@ -1910,7 +1933,7 @@ int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream, | |||
1910 | } | 1933 | } |
1911 | EXPORT_SYMBOL_GPL(dpcm_be_dai_trigger); | 1934 | EXPORT_SYMBOL_GPL(dpcm_be_dai_trigger); |
1912 | 1935 | ||
1913 | static int dpcm_fe_dai_trigger(struct snd_pcm_substream *substream, int cmd) | 1936 | static int dpcm_fe_dai_do_trigger(struct snd_pcm_substream *substream, int cmd) |
1914 | { | 1937 | { |
1915 | struct snd_soc_pcm_runtime *fe = substream->private_data; | 1938 | struct snd_soc_pcm_runtime *fe = substream->private_data; |
1916 | int stream = substream->stream, ret; | 1939 | int stream = substream->stream, ret; |
@@ -1984,6 +2007,23 @@ out: | |||
1984 | return ret; | 2007 | return ret; |
1985 | } | 2008 | } |
1986 | 2009 | ||
2010 | static int dpcm_fe_dai_trigger(struct snd_pcm_substream *substream, int cmd) | ||
2011 | { | ||
2012 | struct snd_soc_pcm_runtime *fe = substream->private_data; | ||
2013 | int stream = substream->stream; | ||
2014 | |||
2015 | /* if FE's runtime_update is already set, we're in race; | ||
2016 | * process this trigger later at exit | ||
2017 | */ | ||
2018 | if (fe->dpcm[stream].runtime_update != SND_SOC_DPCM_UPDATE_NO) { | ||
2019 | fe->dpcm[stream].trigger_pending = cmd + 1; | ||
2020 | return 0; /* delayed, assuming it's successful */ | ||
2021 | } | ||
2022 | |||
2023 | /* we're alone, let's trigger */ | ||
2024 | return dpcm_fe_dai_do_trigger(substream, cmd); | ||
2025 | } | ||
2026 | |||
1987 | int dpcm_be_dai_prepare(struct snd_soc_pcm_runtime *fe, int stream) | 2027 | int dpcm_be_dai_prepare(struct snd_soc_pcm_runtime *fe, int stream) |
1988 | { | 2028 | { |
1989 | struct snd_soc_dpcm *dpcm; | 2029 | struct snd_soc_dpcm *dpcm; |
@@ -2027,7 +2067,7 @@ static int dpcm_fe_dai_prepare(struct snd_pcm_substream *substream) | |||
2027 | 2067 | ||
2028 | dev_dbg(fe->dev, "ASoC: prepare FE %s\n", fe->dai_link->name); | 2068 | dev_dbg(fe->dev, "ASoC: prepare FE %s\n", fe->dai_link->name); |
2029 | 2069 | ||
2030 | fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE; | 2070 | dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_FE); |
2031 | 2071 | ||
2032 | /* there is no point preparing this FE if there are no BEs */ | 2072 | /* there is no point preparing this FE if there are no BEs */ |
2033 | if (list_empty(&fe->dpcm[stream].be_clients)) { | 2073 | if (list_empty(&fe->dpcm[stream].be_clients)) { |
@@ -2054,7 +2094,7 @@ static int dpcm_fe_dai_prepare(struct snd_pcm_substream *substream) | |||
2054 | fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE; | 2094 | fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE; |
2055 | 2095 | ||
2056 | out: | 2096 | out: |
2057 | fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; | 2097 | dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); |
2058 | mutex_unlock(&fe->card->mutex); | 2098 | mutex_unlock(&fe->card->mutex); |
2059 | 2099 | ||
2060 | return ret; | 2100 | return ret; |
@@ -2201,11 +2241,11 @@ static int dpcm_run_new_update(struct snd_soc_pcm_runtime *fe, int stream) | |||
2201 | { | 2241 | { |
2202 | int ret; | 2242 | int ret; |
2203 | 2243 | ||
2204 | fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_BE; | 2244 | dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_BE); |
2205 | ret = dpcm_run_update_startup(fe, stream); | 2245 | ret = dpcm_run_update_startup(fe, stream); |
2206 | if (ret < 0) | 2246 | if (ret < 0) |
2207 | dev_err(fe->dev, "ASoC: failed to startup some BEs\n"); | 2247 | dev_err(fe->dev, "ASoC: failed to startup some BEs\n"); |
2208 | fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; | 2248 | dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); |
2209 | 2249 | ||
2210 | return ret; | 2250 | return ret; |
2211 | } | 2251 | } |
@@ -2214,11 +2254,11 @@ static int dpcm_run_old_update(struct snd_soc_pcm_runtime *fe, int stream) | |||
2214 | { | 2254 | { |
2215 | int ret; | 2255 | int ret; |
2216 | 2256 | ||
2217 | fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_BE; | 2257 | dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_BE); |
2218 | ret = dpcm_run_update_shutdown(fe, stream); | 2258 | ret = dpcm_run_update_shutdown(fe, stream); |
2219 | if (ret < 0) | 2259 | if (ret < 0) |
2220 | dev_err(fe->dev, "ASoC: failed to shutdown some BEs\n"); | 2260 | dev_err(fe->dev, "ASoC: failed to shutdown some BEs\n"); |
2221 | fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; | 2261 | dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO); |
2222 | 2262 | ||
2223 | return ret; | 2263 | return ret; |
2224 | } | 2264 | } |
diff --git a/sound/usb/card.c b/sound/usb/card.c index 7ecd0e8a5c51..f61ebb17cc64 100644 --- a/sound/usb/card.c +++ b/sound/usb/card.c | |||
@@ -591,18 +591,19 @@ static void snd_usb_audio_disconnect(struct usb_device *dev, | |||
591 | { | 591 | { |
592 | struct snd_card *card; | 592 | struct snd_card *card; |
593 | struct list_head *p; | 593 | struct list_head *p; |
594 | bool was_shutdown; | ||
594 | 595 | ||
595 | if (chip == (void *)-1L) | 596 | if (chip == (void *)-1L) |
596 | return; | 597 | return; |
597 | 598 | ||
598 | card = chip->card; | 599 | card = chip->card; |
599 | down_write(&chip->shutdown_rwsem); | 600 | down_write(&chip->shutdown_rwsem); |
601 | was_shutdown = chip->shutdown; | ||
600 | chip->shutdown = 1; | 602 | chip->shutdown = 1; |
601 | up_write(&chip->shutdown_rwsem); | 603 | up_write(&chip->shutdown_rwsem); |
602 | 604 | ||
603 | mutex_lock(®ister_mutex); | 605 | mutex_lock(®ister_mutex); |
604 | chip->num_interfaces--; | 606 | if (!was_shutdown) { |
605 | if (chip->num_interfaces <= 0) { | ||
606 | struct snd_usb_endpoint *ep; | 607 | struct snd_usb_endpoint *ep; |
607 | 608 | ||
608 | snd_card_disconnect(card); | 609 | snd_card_disconnect(card); |
@@ -622,6 +623,10 @@ static void snd_usb_audio_disconnect(struct usb_device *dev, | |||
622 | list_for_each(p, &chip->mixer_list) { | 623 | list_for_each(p, &chip->mixer_list) { |
623 | snd_usb_mixer_disconnect(p); | 624 | snd_usb_mixer_disconnect(p); |
624 | } | 625 | } |
626 | } | ||
627 | |||
628 | chip->num_interfaces--; | ||
629 | if (chip->num_interfaces <= 0) { | ||
625 | usb_chip[chip->index] = NULL; | 630 | usb_chip[chip->index] = NULL; |
626 | mutex_unlock(®ister_mutex); | 631 | mutex_unlock(®ister_mutex); |
627 | snd_card_free_when_closed(card); | 632 | snd_card_free_when_closed(card); |
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c index 2e4a9dbc51fa..6e354d326858 100644 --- a/sound/usb/mixer.c +++ b/sound/usb/mixer.c | |||
@@ -2033,10 +2033,11 @@ static int parse_audio_selector_unit(struct mixer_build *state, int unitid, | |||
2033 | cval->res = 1; | 2033 | cval->res = 1; |
2034 | cval->initialized = 1; | 2034 | cval->initialized = 1; |
2035 | 2035 | ||
2036 | if (desc->bDescriptorSubtype == UAC2_CLOCK_SELECTOR) | 2036 | if (state->mixer->protocol == UAC_VERSION_1) |
2037 | cval->control = UAC2_CX_CLOCK_SELECTOR; | ||
2038 | else | ||
2039 | cval->control = 0; | 2037 | cval->control = 0; |
2038 | else /* UAC_VERSION_2 */ | ||
2039 | cval->control = (desc->bDescriptorSubtype == UAC2_CLOCK_SELECTOR) ? | ||
2040 | UAC2_CX_CLOCK_SELECTOR : UAC2_SU_SELECTOR; | ||
2040 | 2041 | ||
2041 | namelist = kmalloc(sizeof(char *) * desc->bNrInPins, GFP_KERNEL); | 2042 | namelist = kmalloc(sizeof(char *) * desc->bNrInPins, GFP_KERNEL); |
2042 | if (!namelist) { | 2043 | if (!namelist) { |
diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c index f119a41ed9a9..7c83bab69dee 100644 --- a/sound/usb/mixer_quirks.c +++ b/sound/usb/mixer_quirks.c | |||
@@ -885,6 +885,11 @@ static int snd_ftu_eff_switch_put(struct snd_kcontrol *kctl, | |||
885 | return changed; | 885 | return changed; |
886 | } | 886 | } |
887 | 887 | ||
888 | static void kctl_private_value_free(struct snd_kcontrol *kctl) | ||
889 | { | ||
890 | kfree((void *)kctl->private_value); | ||
891 | } | ||
892 | |||
888 | static int snd_ftu_create_effect_switch(struct usb_mixer_interface *mixer, | 893 | static int snd_ftu_create_effect_switch(struct usb_mixer_interface *mixer, |
889 | int validx, int bUnitID) | 894 | int validx, int bUnitID) |
890 | { | 895 | { |
@@ -919,6 +924,7 @@ static int snd_ftu_create_effect_switch(struct usb_mixer_interface *mixer, | |||
919 | return -ENOMEM; | 924 | return -ENOMEM; |
920 | } | 925 | } |
921 | 926 | ||
927 | kctl->private_free = kctl_private_value_free; | ||
922 | err = snd_ctl_add(mixer->chip->card, kctl); | 928 | err = snd_ctl_add(mixer->chip->card, kctl); |
923 | if (err < 0) | 929 | if (err < 0) |
924 | return err; | 930 | return err; |
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c index d2aa45a8d895..a5941f80fc5b 100644 --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c | |||
@@ -1146,6 +1146,20 @@ void snd_usb_ctl_msg_quirk(struct usb_device *dev, unsigned int pipe, | |||
1146 | if ((le16_to_cpu(dev->descriptor.idVendor) == 0x23ba) && | 1146 | if ((le16_to_cpu(dev->descriptor.idVendor) == 0x23ba) && |
1147 | (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS) | 1147 | (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS) |
1148 | mdelay(20); | 1148 | mdelay(20); |
1149 | |||
1150 | /* Marantz/Denon devices with USB DAC functionality need a delay | ||
1151 | * after each class compliant request | ||
1152 | */ | ||
1153 | if ((le16_to_cpu(dev->descriptor.idVendor) == 0x154e) && | ||
1154 | (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS) { | ||
1155 | |||
1156 | switch (le16_to_cpu(dev->descriptor.idProduct)) { | ||
1157 | case 0x3005: /* Marantz HD-DAC1 */ | ||
1158 | case 0x3006: /* Marantz SA-14S1 */ | ||
1159 | mdelay(20); | ||
1160 | break; | ||
1161 | } | ||
1162 | } | ||
1149 | } | 1163 | } |
1150 | 1164 | ||
1151 | /* | 1165 | /* |