diff options
Diffstat (limited to 'sound')
55 files changed, 625 insertions, 383 deletions
diff --git a/sound/core/seq/seq_dummy.c b/sound/core/seq/seq_dummy.c index ec667f158f19..5d905d90d504 100644 --- a/sound/core/seq/seq_dummy.c +++ b/sound/core/seq/seq_dummy.c | |||
@@ -82,36 +82,6 @@ struct snd_seq_dummy_port { | |||
82 | static int my_client = -1; | 82 | static int my_client = -1; |
83 | 83 | ||
84 | /* | 84 | /* |
85 | * unuse callback - send ALL_SOUNDS_OFF and RESET_CONTROLLERS events | ||
86 | * to subscribers. | ||
87 | * Note: this callback is called only after all subscribers are removed. | ||
88 | */ | ||
89 | static int | ||
90 | dummy_unuse(void *private_data, struct snd_seq_port_subscribe *info) | ||
91 | { | ||
92 | struct snd_seq_dummy_port *p; | ||
93 | int i; | ||
94 | struct snd_seq_event ev; | ||
95 | |||
96 | p = private_data; | ||
97 | memset(&ev, 0, sizeof(ev)); | ||
98 | if (p->duplex) | ||
99 | ev.source.port = p->connect; | ||
100 | else | ||
101 | ev.source.port = p->port; | ||
102 | ev.dest.client = SNDRV_SEQ_ADDRESS_SUBSCRIBERS; | ||
103 | ev.type = SNDRV_SEQ_EVENT_CONTROLLER; | ||
104 | for (i = 0; i < 16; i++) { | ||
105 | ev.data.control.channel = i; | ||
106 | ev.data.control.param = MIDI_CTL_ALL_SOUNDS_OFF; | ||
107 | snd_seq_kernel_client_dispatch(p->client, &ev, 0, 0); | ||
108 | ev.data.control.param = MIDI_CTL_RESET_CONTROLLERS; | ||
109 | snd_seq_kernel_client_dispatch(p->client, &ev, 0, 0); | ||
110 | } | ||
111 | return 0; | ||
112 | } | ||
113 | |||
114 | /* | ||
115 | * event input callback - just redirect events to subscribers | 85 | * event input callback - just redirect events to subscribers |
116 | */ | 86 | */ |
117 | static int | 87 | static int |
@@ -175,7 +145,6 @@ create_port(int idx, int type) | |||
175 | | SNDRV_SEQ_PORT_TYPE_PORT; | 145 | | SNDRV_SEQ_PORT_TYPE_PORT; |
176 | memset(&pcb, 0, sizeof(pcb)); | 146 | memset(&pcb, 0, sizeof(pcb)); |
177 | pcb.owner = THIS_MODULE; | 147 | pcb.owner = THIS_MODULE; |
178 | pcb.unuse = dummy_unuse; | ||
179 | pcb.event_input = dummy_input; | 148 | pcb.event_input = dummy_input; |
180 | pcb.private_free = dummy_free; | 149 | pcb.private_free = dummy_free; |
181 | pcb.private_data = rec; | 150 | pcb.private_data = rec; |
diff --git a/sound/firewire/amdtp.c b/sound/firewire/amdtp.c index 3badc70124ab..0d580186ef1a 100644 --- a/sound/firewire/amdtp.c +++ b/sound/firewire/amdtp.c | |||
@@ -21,7 +21,19 @@ | |||
21 | #define CYCLES_PER_SECOND 8000 | 21 | #define CYCLES_PER_SECOND 8000 |
22 | #define TICKS_PER_SECOND (TICKS_PER_CYCLE * CYCLES_PER_SECOND) | 22 | #define TICKS_PER_SECOND (TICKS_PER_CYCLE * CYCLES_PER_SECOND) |
23 | 23 | ||
24 | #define TRANSFER_DELAY_TICKS 0x2e00 /* 479.17 µs */ | 24 | /* |
25 | * Nominally 3125 bytes/second, but the MIDI port's clock might be | ||
26 | * 1% too slow, and the bus clock 100 ppm too fast. | ||
27 | */ | ||
28 | #define MIDI_BYTES_PER_SECOND 3093 | ||
29 | |||
30 | /* | ||
31 | * Several devices look only at the first eight data blocks. | ||
32 | * In any case, this is more than enough for the MIDI data rate. | ||
33 | */ | ||
34 | #define MAX_MIDI_RX_BLOCKS 8 | ||
35 | |||
36 | #define TRANSFER_DELAY_TICKS 0x2e00 /* 479.17 µs */ | ||
25 | 37 | ||
26 | /* isochronous header parameters */ | 38 | /* isochronous header parameters */ |
27 | #define ISO_DATA_LENGTH_SHIFT 16 | 39 | #define ISO_DATA_LENGTH_SHIFT 16 |
@@ -78,8 +90,6 @@ int amdtp_stream_init(struct amdtp_stream *s, struct fw_unit *unit, | |||
78 | s->callbacked = false; | 90 | s->callbacked = false; |
79 | s->sync_slave = NULL; | 91 | s->sync_slave = NULL; |
80 | 92 | ||
81 | s->rx_blocks_for_midi = UINT_MAX; | ||
82 | |||
83 | return 0; | 93 | return 0; |
84 | } | 94 | } |
85 | EXPORT_SYMBOL(amdtp_stream_init); | 95 | EXPORT_SYMBOL(amdtp_stream_init); |
@@ -222,6 +232,14 @@ sfc_found: | |||
222 | for (i = 0; i < pcm_channels; i++) | 232 | for (i = 0; i < pcm_channels; i++) |
223 | s->pcm_positions[i] = i; | 233 | s->pcm_positions[i] = i; |
224 | s->midi_position = s->pcm_channels; | 234 | s->midi_position = s->pcm_channels; |
235 | |||
236 | /* | ||
237 | * We do not know the actual MIDI FIFO size of most devices. Just | ||
238 | * assume two bytes, i.e., one byte can be received over the bus while | ||
239 | * the previous one is transmitted over MIDI. | ||
240 | * (The value here is adjusted for midi_ratelimit_per_packet().) | ||
241 | */ | ||
242 | s->midi_fifo_limit = rate - MIDI_BYTES_PER_SECOND * s->syt_interval + 1; | ||
225 | } | 243 | } |
226 | EXPORT_SYMBOL(amdtp_stream_set_parameters); | 244 | EXPORT_SYMBOL(amdtp_stream_set_parameters); |
227 | 245 | ||
@@ -463,6 +481,36 @@ static void amdtp_fill_pcm_silence(struct amdtp_stream *s, | |||
463 | } | 481 | } |
464 | } | 482 | } |
465 | 483 | ||
484 | /* | ||
485 | * To avoid sending MIDI bytes at too high a rate, assume that the receiving | ||
486 | * device has a FIFO, and track how much it is filled. This values increases | ||
487 | * by one whenever we send one byte in a packet, but the FIFO empties at | ||
488 | * a constant rate independent of our packet rate. One packet has syt_interval | ||
489 | * samples, so the number of bytes that empty out of the FIFO, per packet(!), | ||
490 | * is MIDI_BYTES_PER_SECOND * syt_interval / sample_rate. To avoid storing | ||
491 | * fractional values, the values in midi_fifo_used[] are measured in bytes | ||
492 | * multiplied by the sample rate. | ||
493 | */ | ||
494 | static bool midi_ratelimit_per_packet(struct amdtp_stream *s, unsigned int port) | ||
495 | { | ||
496 | int used; | ||
497 | |||
498 | used = s->midi_fifo_used[port]; | ||
499 | if (used == 0) /* common shortcut */ | ||
500 | return true; | ||
501 | |||
502 | used -= MIDI_BYTES_PER_SECOND * s->syt_interval; | ||
503 | used = max(used, 0); | ||
504 | s->midi_fifo_used[port] = used; | ||
505 | |||
506 | return used < s->midi_fifo_limit; | ||
507 | } | ||
508 | |||
509 | static void midi_rate_use_one_byte(struct amdtp_stream *s, unsigned int port) | ||
510 | { | ||
511 | s->midi_fifo_used[port] += amdtp_rate_table[s->sfc]; | ||
512 | } | ||
513 | |||
466 | static void amdtp_fill_midi(struct amdtp_stream *s, | 514 | static void amdtp_fill_midi(struct amdtp_stream *s, |
467 | __be32 *buffer, unsigned int frames) | 515 | __be32 *buffer, unsigned int frames) |
468 | { | 516 | { |
@@ -470,16 +518,21 @@ static void amdtp_fill_midi(struct amdtp_stream *s, | |||
470 | u8 *b; | 518 | u8 *b; |
471 | 519 | ||
472 | for (f = 0; f < frames; f++) { | 520 | for (f = 0; f < frames; f++) { |
473 | buffer[s->midi_position] = 0; | ||
474 | b = (u8 *)&buffer[s->midi_position]; | 521 | b = (u8 *)&buffer[s->midi_position]; |
475 | 522 | ||
476 | port = (s->data_block_counter + f) % 8; | 523 | port = (s->data_block_counter + f) % 8; |
477 | if ((f >= s->rx_blocks_for_midi) || | 524 | if (f < MAX_MIDI_RX_BLOCKS && |
478 | (s->midi[port] == NULL) || | 525 | midi_ratelimit_per_packet(s, port) && |
479 | (snd_rawmidi_transmit(s->midi[port], b + 1, 1) <= 0)) | 526 | s->midi[port] != NULL && |
480 | b[0] = 0x80; | 527 | snd_rawmidi_transmit(s->midi[port], &b[1], 1) == 1) { |
481 | else | 528 | midi_rate_use_one_byte(s, port); |
482 | b[0] = 0x81; | 529 | b[0] = 0x81; |
530 | } else { | ||
531 | b[0] = 0x80; | ||
532 | b[1] = 0; | ||
533 | } | ||
534 | b[2] = 0; | ||
535 | b[3] = 0; | ||
483 | 536 | ||
484 | buffer += s->data_block_quadlets; | 537 | buffer += s->data_block_quadlets; |
485 | } | 538 | } |
diff --git a/sound/firewire/amdtp.h b/sound/firewire/amdtp.h index e6e8926275b0..8a03a91e728b 100644 --- a/sound/firewire/amdtp.h +++ b/sound/firewire/amdtp.h | |||
@@ -148,13 +148,12 @@ struct amdtp_stream { | |||
148 | bool double_pcm_frames; | 148 | bool double_pcm_frames; |
149 | 149 | ||
150 | struct snd_rawmidi_substream *midi[AMDTP_MAX_CHANNELS_FOR_MIDI * 8]; | 150 | struct snd_rawmidi_substream *midi[AMDTP_MAX_CHANNELS_FOR_MIDI * 8]; |
151 | int midi_fifo_limit; | ||
152 | int midi_fifo_used[AMDTP_MAX_CHANNELS_FOR_MIDI * 8]; | ||
151 | 153 | ||
152 | /* quirk: fixed interval of dbc between previos/current packets. */ | 154 | /* quirk: fixed interval of dbc between previos/current packets. */ |
153 | unsigned int tx_dbc_interval; | 155 | unsigned int tx_dbc_interval; |
154 | 156 | ||
155 | /* quirk: the first count of data blocks in an rx packet for MIDI */ | ||
156 | unsigned int rx_blocks_for_midi; | ||
157 | |||
158 | bool callbacked; | 157 | bool callbacked; |
159 | wait_queue_head_t callback_wait; | 158 | wait_queue_head_t callback_wait; |
160 | struct amdtp_stream *sync_slave; | 159 | struct amdtp_stream *sync_slave; |
diff --git a/sound/firewire/bebob/bebob_stream.c b/sound/firewire/bebob/bebob_stream.c index 1aab0a32870c..0ebcabfdc7ce 100644 --- a/sound/firewire/bebob/bebob_stream.c +++ b/sound/firewire/bebob/bebob_stream.c | |||
@@ -484,13 +484,6 @@ int snd_bebob_stream_init_duplex(struct snd_bebob *bebob) | |||
484 | amdtp_stream_destroy(&bebob->rx_stream); | 484 | amdtp_stream_destroy(&bebob->rx_stream); |
485 | destroy_both_connections(bebob); | 485 | destroy_both_connections(bebob); |
486 | } | 486 | } |
487 | /* | ||
488 | * The firmware for these devices ignore MIDI messages in more than | ||
489 | * first 8 data blocks of an received AMDTP packet. | ||
490 | */ | ||
491 | if (bebob->spec == &maudio_fw410_spec || | ||
492 | bebob->spec == &maudio_special_spec) | ||
493 | bebob->rx_stream.rx_blocks_for_midi = 8; | ||
494 | end: | 487 | end: |
495 | return err; | 488 | return err; |
496 | } | 489 | } |
diff --git a/sound/firewire/fireworks/fireworks_stream.c b/sound/firewire/fireworks/fireworks_stream.c index b985fc5ebdc6..4f440e163667 100644 --- a/sound/firewire/fireworks/fireworks_stream.c +++ b/sound/firewire/fireworks/fireworks_stream.c | |||
@@ -179,11 +179,6 @@ int snd_efw_stream_init_duplex(struct snd_efw *efw) | |||
179 | destroy_stream(efw, &efw->tx_stream); | 179 | destroy_stream(efw, &efw->tx_stream); |
180 | goto end; | 180 | goto end; |
181 | } | 181 | } |
182 | /* | ||
183 | * Fireworks ignores MIDI messages in more than first 8 data | ||
184 | * blocks of an received AMDTP packet. | ||
185 | */ | ||
186 | efw->rx_stream.rx_blocks_for_midi = 8; | ||
187 | 182 | ||
188 | /* set IEC61883 compliant mode (actually not fully compliant...) */ | 183 | /* set IEC61883 compliant mode (actually not fully compliant...) */ |
189 | err = snd_efw_command_set_tx_mode(efw, SND_EFW_TRANSPORT_MODE_IEC61883); | 184 | err = snd_efw_command_set_tx_mode(efw, SND_EFW_TRANSPORT_MODE_IEC61883); |
diff --git a/sound/firewire/fireworks/fireworks_transaction.c b/sound/firewire/fireworks/fireworks_transaction.c index 255dabc6fc33..2a85e4209f0b 100644 --- a/sound/firewire/fireworks/fireworks_transaction.c +++ b/sound/firewire/fireworks/fireworks_transaction.c | |||
@@ -124,7 +124,7 @@ copy_resp_to_buf(struct snd_efw *efw, void *data, size_t length, int *rcode) | |||
124 | spin_lock_irq(&efw->lock); | 124 | spin_lock_irq(&efw->lock); |
125 | 125 | ||
126 | t = (struct snd_efw_transaction *)data; | 126 | t = (struct snd_efw_transaction *)data; |
127 | length = min_t(size_t, t->length * sizeof(t->length), length); | 127 | length = min_t(size_t, be32_to_cpu(t->length) * sizeof(u32), length); |
128 | 128 | ||
129 | if (efw->push_ptr < efw->pull_ptr) | 129 | if (efw->push_ptr < efw->pull_ptr) |
130 | capacity = (unsigned int)(efw->pull_ptr - efw->push_ptr); | 130 | capacity = (unsigned int)(efw->pull_ptr - efw->push_ptr); |
diff --git a/sound/pci/hda/hda_controller.c b/sound/pci/hda/hda_controller.c index 8276a743e22e..0cfc9c8c4b4e 100644 --- a/sound/pci/hda/hda_controller.c +++ b/sound/pci/hda/hda_controller.c | |||
@@ -1922,10 +1922,18 @@ int azx_mixer_create(struct azx *chip) | |||
1922 | EXPORT_SYMBOL_GPL(azx_mixer_create); | 1922 | EXPORT_SYMBOL_GPL(azx_mixer_create); |
1923 | 1923 | ||
1924 | 1924 | ||
1925 | static bool is_input_stream(struct azx *chip, unsigned char index) | ||
1926 | { | ||
1927 | return (index >= chip->capture_index_offset && | ||
1928 | index < chip->capture_index_offset + chip->capture_streams); | ||
1929 | } | ||
1930 | |||
1925 | /* initialize SD streams */ | 1931 | /* initialize SD streams */ |
1926 | int azx_init_stream(struct azx *chip) | 1932 | int azx_init_stream(struct azx *chip) |
1927 | { | 1933 | { |
1928 | int i; | 1934 | int i; |
1935 | int in_stream_tag = 0; | ||
1936 | int out_stream_tag = 0; | ||
1929 | 1937 | ||
1930 | /* initialize each stream (aka device) | 1938 | /* initialize each stream (aka device) |
1931 | * assign the starting bdl address to each stream (device) | 1939 | * assign the starting bdl address to each stream (device) |
@@ -1938,9 +1946,21 @@ int azx_init_stream(struct azx *chip) | |||
1938 | azx_dev->sd_addr = chip->remap_addr + (0x20 * i + 0x80); | 1946 | azx_dev->sd_addr = chip->remap_addr + (0x20 * i + 0x80); |
1939 | /* int mask: SDI0=0x01, SDI1=0x02, ... SDO3=0x80 */ | 1947 | /* int mask: SDI0=0x01, SDI1=0x02, ... SDO3=0x80 */ |
1940 | azx_dev->sd_int_sta_mask = 1 << i; | 1948 | azx_dev->sd_int_sta_mask = 1 << i; |
1941 | /* stream tag: must be non-zero and unique */ | ||
1942 | azx_dev->index = i; | 1949 | azx_dev->index = i; |
1943 | azx_dev->stream_tag = i + 1; | 1950 | |
1951 | /* stream tag must be unique throughout | ||
1952 | * the stream direction group, | ||
1953 | * valid values 1...15 | ||
1954 | * use separate stream tag if the flag | ||
1955 | * AZX_DCAPS_SEPARATE_STREAM_TAG is used | ||
1956 | */ | ||
1957 | if (chip->driver_caps & AZX_DCAPS_SEPARATE_STREAM_TAG) | ||
1958 | azx_dev->stream_tag = | ||
1959 | is_input_stream(chip, i) ? | ||
1960 | ++in_stream_tag : | ||
1961 | ++out_stream_tag; | ||
1962 | else | ||
1963 | azx_dev->stream_tag = i + 1; | ||
1944 | } | 1964 | } |
1945 | 1965 | ||
1946 | return 0; | 1966 | return 0; |
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 2bf0b568e3de..d426a0bd6a5f 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -299,6 +299,9 @@ enum { | |||
299 | AZX_DCAPS_PM_RUNTIME | AZX_DCAPS_I915_POWERWELL |\ | 299 | AZX_DCAPS_PM_RUNTIME | AZX_DCAPS_I915_POWERWELL |\ |
300 | AZX_DCAPS_SNOOP_TYPE(SCH)) | 300 | AZX_DCAPS_SNOOP_TYPE(SCH)) |
301 | 301 | ||
302 | #define AZX_DCAPS_INTEL_SKYLAKE \ | ||
303 | (AZX_DCAPS_INTEL_PCH | AZX_DCAPS_SEPARATE_STREAM_TAG) | ||
304 | |||
302 | /* quirks for ATI SB / AMD Hudson */ | 305 | /* quirks for ATI SB / AMD Hudson */ |
303 | #define AZX_DCAPS_PRESET_ATI_SB \ | 306 | #define AZX_DCAPS_PRESET_ATI_SB \ |
304 | (AZX_DCAPS_NO_TCSEL | AZX_DCAPS_SYNC_WRITE | AZX_DCAPS_POSFIX_LPIB |\ | 307 | (AZX_DCAPS_NO_TCSEL | AZX_DCAPS_SYNC_WRITE | AZX_DCAPS_POSFIX_LPIB |\ |
@@ -2027,7 +2030,7 @@ static const struct pci_device_id azx_ids[] = { | |||
2027 | .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, | 2030 | .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, |
2028 | /* Sunrise Point-LP */ | 2031 | /* Sunrise Point-LP */ |
2029 | { PCI_DEVICE(0x8086, 0x9d70), | 2032 | { PCI_DEVICE(0x8086, 0x9d70), |
2030 | .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, | 2033 | .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_SKYLAKE }, |
2031 | /* Haswell */ | 2034 | /* Haswell */ |
2032 | { PCI_DEVICE(0x8086, 0x0a0c), | 2035 | { PCI_DEVICE(0x8086, 0x0a0c), |
2033 | .driver_data = AZX_DRIVER_HDMI | AZX_DCAPS_INTEL_HASWELL }, | 2036 | .driver_data = AZX_DRIVER_HDMI | AZX_DCAPS_INTEL_HASWELL }, |
diff --git a/sound/pci/hda/hda_priv.h b/sound/pci/hda/hda_priv.h index aa484fdf4338..166e3e84b963 100644 --- a/sound/pci/hda/hda_priv.h +++ b/sound/pci/hda/hda_priv.h | |||
@@ -171,6 +171,7 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 }; | |||
171 | #define AZX_DCAPS_I915_POWERWELL (1 << 27) /* HSW i915 powerwell support */ | 171 | #define AZX_DCAPS_I915_POWERWELL (1 << 27) /* HSW i915 powerwell support */ |
172 | #define AZX_DCAPS_CORBRP_SELF_CLEAR (1 << 28) /* CORBRP clears itself after reset */ | 172 | #define AZX_DCAPS_CORBRP_SELF_CLEAR (1 << 28) /* CORBRP clears itself after reset */ |
173 | #define AZX_DCAPS_NO_MSI64 (1 << 29) /* Stick to 32-bit MSIs */ | 173 | #define AZX_DCAPS_NO_MSI64 (1 << 29) /* Stick to 32-bit MSIs */ |
174 | #define AZX_DCAPS_SEPARATE_STREAM_TAG (1 << 30) /* capture and playback use separate stream tag */ | ||
174 | 175 | ||
175 | enum { | 176 | enum { |
176 | AZX_SNOOP_TYPE_NONE , | 177 | AZX_SNOOP_TYPE_NONE , |
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index 5f13d2d18079..b422e406a9cb 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c | |||
@@ -3353,6 +3353,7 @@ static const struct hda_codec_preset snd_hda_preset_hdmi[] = { | |||
3353 | { .id = 0x10de0067, .name = "MCP67 HDMI", .patch = patch_nvhdmi_2ch }, | 3353 | { .id = 0x10de0067, .name = "MCP67 HDMI", .patch = patch_nvhdmi_2ch }, |
3354 | { .id = 0x10de0070, .name = "GPU 70 HDMI/DP", .patch = patch_nvhdmi }, | 3354 | { .id = 0x10de0070, .name = "GPU 70 HDMI/DP", .patch = patch_nvhdmi }, |
3355 | { .id = 0x10de0071, .name = "GPU 71 HDMI/DP", .patch = patch_nvhdmi }, | 3355 | { .id = 0x10de0071, .name = "GPU 71 HDMI/DP", .patch = patch_nvhdmi }, |
3356 | { .id = 0x10de0072, .name = "GPU 72 HDMI/DP", .patch = patch_nvhdmi }, | ||
3356 | { .id = 0x10de8001, .name = "MCP73 HDMI", .patch = patch_nvhdmi_2ch }, | 3357 | { .id = 0x10de8001, .name = "MCP73 HDMI", .patch = patch_nvhdmi_2ch }, |
3357 | { .id = 0x11069f80, .name = "VX900 HDMI/DP", .patch = patch_via_hdmi }, | 3358 | { .id = 0x11069f80, .name = "VX900 HDMI/DP", .patch = patch_via_hdmi }, |
3358 | { .id = 0x11069f81, .name = "VX900 HDMI/DP", .patch = patch_via_hdmi }, | 3359 | { .id = 0x11069f81, .name = "VX900 HDMI/DP", .patch = patch_via_hdmi }, |
@@ -3413,6 +3414,7 @@ MODULE_ALIAS("snd-hda-codec-id:10de0060"); | |||
3413 | MODULE_ALIAS("snd-hda-codec-id:10de0067"); | 3414 | MODULE_ALIAS("snd-hda-codec-id:10de0067"); |
3414 | MODULE_ALIAS("snd-hda-codec-id:10de0070"); | 3415 | MODULE_ALIAS("snd-hda-codec-id:10de0070"); |
3415 | MODULE_ALIAS("snd-hda-codec-id:10de0071"); | 3416 | MODULE_ALIAS("snd-hda-codec-id:10de0071"); |
3417 | MODULE_ALIAS("snd-hda-codec-id:10de0072"); | ||
3416 | MODULE_ALIAS("snd-hda-codec-id:10de8001"); | 3418 | MODULE_ALIAS("snd-hda-codec-id:10de8001"); |
3417 | MODULE_ALIAS("snd-hda-codec-id:11069f80"); | 3419 | MODULE_ALIAS("snd-hda-codec-id:11069f80"); |
3418 | MODULE_ALIAS("snd-hda-codec-id:11069f81"); | 3420 | MODULE_ALIAS("snd-hda-codec-id:11069f81"); |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 4f6413e01c13..605d14003d25 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -568,9 +568,9 @@ static void stac_store_hints(struct hda_codec *codec) | |||
568 | spec->gpio_mask; | 568 | spec->gpio_mask; |
569 | } | 569 | } |
570 | if (get_int_hint(codec, "gpio_dir", &spec->gpio_dir)) | 570 | if (get_int_hint(codec, "gpio_dir", &spec->gpio_dir)) |
571 | spec->gpio_mask &= spec->gpio_mask; | ||
572 | if (get_int_hint(codec, "gpio_data", &spec->gpio_data)) | ||
573 | spec->gpio_dir &= spec->gpio_mask; | 571 | spec->gpio_dir &= spec->gpio_mask; |
572 | if (get_int_hint(codec, "gpio_data", &spec->gpio_data)) | ||
573 | spec->gpio_data &= spec->gpio_mask; | ||
574 | if (get_int_hint(codec, "eapd_mask", &spec->eapd_mask)) | 574 | if (get_int_hint(codec, "eapd_mask", &spec->eapd_mask)) |
575 | spec->eapd_mask &= spec->gpio_mask; | 575 | spec->eapd_mask &= spec->gpio_mask; |
576 | if (get_int_hint(codec, "gpio_mute", &spec->gpio_mute)) | 576 | if (get_int_hint(codec, "gpio_mute", &spec->gpio_mute)) |
diff --git a/sound/soc/adi/axi-i2s.c b/sound/soc/adi/axi-i2s.c index 7752860f7230..4c23381727a1 100644 --- a/sound/soc/adi/axi-i2s.c +++ b/sound/soc/adi/axi-i2s.c | |||
@@ -240,6 +240,8 @@ static int axi_i2s_probe(struct platform_device *pdev) | |||
240 | if (ret) | 240 | if (ret) |
241 | goto err_clk_disable; | 241 | goto err_clk_disable; |
242 | 242 | ||
243 | return 0; | ||
244 | |||
243 | err_clk_disable: | 245 | err_clk_disable: |
244 | clk_disable_unprepare(i2s->clk); | 246 | clk_disable_unprepare(i2s->clk); |
245 | return ret; | 247 | return ret; |
diff --git a/sound/soc/atmel/atmel_ssc_dai.c b/sound/soc/atmel/atmel_ssc_dai.c index 99ff35e2a25d..35e44e463cfe 100644 --- a/sound/soc/atmel/atmel_ssc_dai.c +++ b/sound/soc/atmel/atmel_ssc_dai.c | |||
@@ -348,7 +348,6 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream, | |||
348 | struct atmel_pcm_dma_params *dma_params; | 348 | struct atmel_pcm_dma_params *dma_params; |
349 | int dir, channels, bits; | 349 | int dir, channels, bits; |
350 | u32 tfmr, rfmr, tcmr, rcmr; | 350 | u32 tfmr, rfmr, tcmr, rcmr; |
351 | int start_event; | ||
352 | int ret; | 351 | int ret; |
353 | int fslen, fslen_ext; | 352 | int fslen, fslen_ext; |
354 | 353 | ||
@@ -457,19 +456,10 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream, | |||
457 | * The SSC transmit clock is obtained from the BCLK signal on | 456 | * The SSC transmit clock is obtained from the BCLK signal on |
458 | * on the TK line, and the SSC receive clock is | 457 | * on the TK line, and the SSC receive clock is |
459 | * generated from the transmit clock. | 458 | * generated from the transmit clock. |
460 | * | ||
461 | * For single channel data, one sample is transferred | ||
462 | * on the falling edge of the LRC clock. | ||
463 | * For two channel data, one sample is | ||
464 | * transferred on both edges of the LRC clock. | ||
465 | */ | 459 | */ |
466 | start_event = ((channels == 1) | ||
467 | ? SSC_START_FALLING_RF | ||
468 | : SSC_START_EDGE_RF); | ||
469 | |||
470 | rcmr = SSC_BF(RCMR_PERIOD, 0) | 460 | rcmr = SSC_BF(RCMR_PERIOD, 0) |
471 | | SSC_BF(RCMR_STTDLY, START_DELAY) | 461 | | SSC_BF(RCMR_STTDLY, START_DELAY) |
472 | | SSC_BF(RCMR_START, start_event) | 462 | | SSC_BF(RCMR_START, SSC_START_FALLING_RF) |
473 | | SSC_BF(RCMR_CKI, SSC_CKI_RISING) | 463 | | SSC_BF(RCMR_CKI, SSC_CKI_RISING) |
474 | | SSC_BF(RCMR_CKO, SSC_CKO_NONE) | 464 | | SSC_BF(RCMR_CKO, SSC_CKO_NONE) |
475 | | SSC_BF(RCMR_CKS, ssc->clk_from_rk_pin ? | 465 | | SSC_BF(RCMR_CKS, ssc->clk_from_rk_pin ? |
@@ -478,14 +468,14 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream, | |||
478 | rfmr = SSC_BF(RFMR_FSEDGE, SSC_FSEDGE_POSITIVE) | 468 | rfmr = SSC_BF(RFMR_FSEDGE, SSC_FSEDGE_POSITIVE) |
479 | | SSC_BF(RFMR_FSOS, SSC_FSOS_NONE) | 469 | | SSC_BF(RFMR_FSOS, SSC_FSOS_NONE) |
480 | | SSC_BF(RFMR_FSLEN, 0) | 470 | | SSC_BF(RFMR_FSLEN, 0) |
481 | | SSC_BF(RFMR_DATNB, 0) | 471 | | SSC_BF(RFMR_DATNB, (channels - 1)) |
482 | | SSC_BIT(RFMR_MSBF) | 472 | | SSC_BIT(RFMR_MSBF) |
483 | | SSC_BF(RFMR_LOOP, 0) | 473 | | SSC_BF(RFMR_LOOP, 0) |
484 | | SSC_BF(RFMR_DATLEN, (bits - 1)); | 474 | | SSC_BF(RFMR_DATLEN, (bits - 1)); |
485 | 475 | ||
486 | tcmr = SSC_BF(TCMR_PERIOD, 0) | 476 | tcmr = SSC_BF(TCMR_PERIOD, 0) |
487 | | SSC_BF(TCMR_STTDLY, START_DELAY) | 477 | | SSC_BF(TCMR_STTDLY, START_DELAY) |
488 | | SSC_BF(TCMR_START, start_event) | 478 | | SSC_BF(TCMR_START, SSC_START_FALLING_RF) |
489 | | SSC_BF(TCMR_CKI, SSC_CKI_FALLING) | 479 | | SSC_BF(TCMR_CKI, SSC_CKI_FALLING) |
490 | | SSC_BF(TCMR_CKO, SSC_CKO_NONE) | 480 | | SSC_BF(TCMR_CKO, SSC_CKO_NONE) |
491 | | SSC_BF(TCMR_CKS, ssc->clk_from_rk_pin ? | 481 | | SSC_BF(TCMR_CKS, ssc->clk_from_rk_pin ? |
@@ -495,7 +485,7 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream, | |||
495 | | SSC_BF(TFMR_FSDEN, 0) | 485 | | SSC_BF(TFMR_FSDEN, 0) |
496 | | SSC_BF(TFMR_FSOS, SSC_FSOS_NONE) | 486 | | SSC_BF(TFMR_FSOS, SSC_FSOS_NONE) |
497 | | SSC_BF(TFMR_FSLEN, 0) | 487 | | SSC_BF(TFMR_FSLEN, 0) |
498 | | SSC_BF(TFMR_DATNB, 0) | 488 | | SSC_BF(TFMR_DATNB, (channels - 1)) |
499 | | SSC_BIT(TFMR_MSBF) | 489 | | SSC_BIT(TFMR_MSBF) |
500 | | SSC_BF(TFMR_DATDEF, 0) | 490 | | SSC_BF(TFMR_DATDEF, 0) |
501 | | SSC_BF(TFMR_DATLEN, (bits - 1)); | 491 | | SSC_BF(TFMR_DATLEN, (bits - 1)); |
@@ -512,7 +502,7 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream, | |||
512 | rcmr = SSC_BF(RCMR_PERIOD, ssc_p->rcmr_period) | 502 | rcmr = SSC_BF(RCMR_PERIOD, ssc_p->rcmr_period) |
513 | | SSC_BF(RCMR_STTDLY, 1) | 503 | | SSC_BF(RCMR_STTDLY, 1) |
514 | | SSC_BF(RCMR_START, SSC_START_RISING_RF) | 504 | | SSC_BF(RCMR_START, SSC_START_RISING_RF) |
515 | | SSC_BF(RCMR_CKI, SSC_CKI_RISING) | 505 | | SSC_BF(RCMR_CKI, SSC_CKI_FALLING) |
516 | | SSC_BF(RCMR_CKO, SSC_CKO_NONE) | 506 | | SSC_BF(RCMR_CKO, SSC_CKO_NONE) |
517 | | SSC_BF(RCMR_CKS, SSC_CKS_DIV); | 507 | | SSC_BF(RCMR_CKS, SSC_CKS_DIV); |
518 | 508 | ||
@@ -527,7 +517,7 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream, | |||
527 | tcmr = SSC_BF(TCMR_PERIOD, ssc_p->tcmr_period) | 517 | tcmr = SSC_BF(TCMR_PERIOD, ssc_p->tcmr_period) |
528 | | SSC_BF(TCMR_STTDLY, 1) | 518 | | SSC_BF(TCMR_STTDLY, 1) |
529 | | SSC_BF(TCMR_START, SSC_START_RISING_RF) | 519 | | SSC_BF(TCMR_START, SSC_START_RISING_RF) |
530 | | SSC_BF(TCMR_CKI, SSC_CKI_RISING) | 520 | | SSC_BF(TCMR_CKI, SSC_CKI_FALLING) |
531 | | SSC_BF(TCMR_CKO, SSC_CKO_CONTINUOUS) | 521 | | SSC_BF(TCMR_CKO, SSC_CKO_CONTINUOUS) |
532 | | SSC_BF(TCMR_CKS, SSC_CKS_DIV); | 522 | | SSC_BF(TCMR_CKS, SSC_CKS_DIV); |
533 | 523 | ||
@@ -556,7 +546,7 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream, | |||
556 | rcmr = SSC_BF(RCMR_PERIOD, 0) | 546 | rcmr = SSC_BF(RCMR_PERIOD, 0) |
557 | | SSC_BF(RCMR_STTDLY, START_DELAY) | 547 | | SSC_BF(RCMR_STTDLY, START_DELAY) |
558 | | SSC_BF(RCMR_START, SSC_START_RISING_RF) | 548 | | SSC_BF(RCMR_START, SSC_START_RISING_RF) |
559 | | SSC_BF(RCMR_CKI, SSC_CKI_RISING) | 549 | | SSC_BF(RCMR_CKI, SSC_CKI_FALLING) |
560 | | SSC_BF(RCMR_CKO, SSC_CKO_NONE) | 550 | | SSC_BF(RCMR_CKO, SSC_CKO_NONE) |
561 | | SSC_BF(RCMR_CKS, ssc->clk_from_rk_pin ? | 551 | | SSC_BF(RCMR_CKS, ssc->clk_from_rk_pin ? |
562 | SSC_CKS_PIN : SSC_CKS_CLOCK); | 552 | SSC_CKS_PIN : SSC_CKS_CLOCK); |
diff --git a/sound/soc/codecs/pcm512x-i2c.c b/sound/soc/codecs/pcm512x-i2c.c index d0547fa275fc..dcdfac0ffeb1 100644 --- a/sound/soc/codecs/pcm512x-i2c.c +++ b/sound/soc/codecs/pcm512x-i2c.c | |||
@@ -46,6 +46,8 @@ static int pcm512x_i2c_remove(struct i2c_client *i2c) | |||
46 | static const struct i2c_device_id pcm512x_i2c_id[] = { | 46 | static const struct i2c_device_id pcm512x_i2c_id[] = { |
47 | { "pcm5121", }, | 47 | { "pcm5121", }, |
48 | { "pcm5122", }, | 48 | { "pcm5122", }, |
49 | { "pcm5141", }, | ||
50 | { "pcm5142", }, | ||
49 | { } | 51 | { } |
50 | }; | 52 | }; |
51 | MODULE_DEVICE_TABLE(i2c, pcm512x_i2c_id); | 53 | MODULE_DEVICE_TABLE(i2c, pcm512x_i2c_id); |
@@ -53,6 +55,8 @@ MODULE_DEVICE_TABLE(i2c, pcm512x_i2c_id); | |||
53 | static const struct of_device_id pcm512x_of_match[] = { | 55 | static const struct of_device_id pcm512x_of_match[] = { |
54 | { .compatible = "ti,pcm5121", }, | 56 | { .compatible = "ti,pcm5121", }, |
55 | { .compatible = "ti,pcm5122", }, | 57 | { .compatible = "ti,pcm5122", }, |
58 | { .compatible = "ti,pcm5141", }, | ||
59 | { .compatible = "ti,pcm5142", }, | ||
56 | { } | 60 | { } |
57 | }; | 61 | }; |
58 | MODULE_DEVICE_TABLE(of, pcm512x_of_match); | 62 | MODULE_DEVICE_TABLE(of, pcm512x_of_match); |
diff --git a/sound/soc/codecs/pcm512x-spi.c b/sound/soc/codecs/pcm512x-spi.c index f297058c0038..7b64a9cef704 100644 --- a/sound/soc/codecs/pcm512x-spi.c +++ b/sound/soc/codecs/pcm512x-spi.c | |||
@@ -43,6 +43,8 @@ static int pcm512x_spi_remove(struct spi_device *spi) | |||
43 | static const struct spi_device_id pcm512x_spi_id[] = { | 43 | static const struct spi_device_id pcm512x_spi_id[] = { |
44 | { "pcm5121", }, | 44 | { "pcm5121", }, |
45 | { "pcm5122", }, | 45 | { "pcm5122", }, |
46 | { "pcm5141", }, | ||
47 | { "pcm5142", }, | ||
46 | { }, | 48 | { }, |
47 | }; | 49 | }; |
48 | MODULE_DEVICE_TABLE(spi, pcm512x_spi_id); | 50 | MODULE_DEVICE_TABLE(spi, pcm512x_spi_id); |
@@ -50,6 +52,8 @@ MODULE_DEVICE_TABLE(spi, pcm512x_spi_id); | |||
50 | static const struct of_device_id pcm512x_of_match[] = { | 52 | static const struct of_device_id pcm512x_of_match[] = { |
51 | { .compatible = "ti,pcm5121", }, | 53 | { .compatible = "ti,pcm5121", }, |
52 | { .compatible = "ti,pcm5122", }, | 54 | { .compatible = "ti,pcm5122", }, |
55 | { .compatible = "ti,pcm5141", }, | ||
56 | { .compatible = "ti,pcm5142", }, | ||
53 | { } | 57 | { } |
54 | }; | 58 | }; |
55 | MODULE_DEVICE_TABLE(of, pcm512x_of_match); | 59 | MODULE_DEVICE_TABLE(of, pcm512x_of_match); |
diff --git a/sound/soc/codecs/pcm512x.c b/sound/soc/codecs/pcm512x.c index e5f2fb884bf3..30c673cdc12e 100644 --- a/sound/soc/codecs/pcm512x.c +++ b/sound/soc/codecs/pcm512x.c | |||
@@ -188,8 +188,8 @@ static const DECLARE_TLV_DB_SCALE(boost_tlv, 0, 80, 0); | |||
188 | static const char * const pcm512x_dsp_program_texts[] = { | 188 | static const char * const pcm512x_dsp_program_texts[] = { |
189 | "FIR interpolation with de-emphasis", | 189 | "FIR interpolation with de-emphasis", |
190 | "Low latency IIR with de-emphasis", | 190 | "Low latency IIR with de-emphasis", |
191 | "Fixed process flow", | ||
192 | "High attenuation with de-emphasis", | 191 | "High attenuation with de-emphasis", |
192 | "Fixed process flow", | ||
193 | "Ringing-less low latency FIR", | 193 | "Ringing-less low latency FIR", |
194 | }; | 194 | }; |
195 | 195 | ||
diff --git a/sound/soc/codecs/rt286.c b/sound/soc/codecs/rt286.c index 2cd4fe463102..f14d335b07b1 100644 --- a/sound/soc/codecs/rt286.c +++ b/sound/soc/codecs/rt286.c | |||
@@ -305,6 +305,8 @@ static int rt286_jack_detect(struct rt286_priv *rt286, bool *hp, bool *mic) | |||
305 | *hp = false; | 305 | *hp = false; |
306 | *mic = false; | 306 | *mic = false; |
307 | 307 | ||
308 | if (!rt286->codec) | ||
309 | return -EINVAL; | ||
308 | if (rt286->pdata.cbj_en) { | 310 | if (rt286->pdata.cbj_en) { |
309 | regmap_read(rt286->regmap, RT286_GET_HP_SENSE, &buf); | 311 | regmap_read(rt286->regmap, RT286_GET_HP_SENSE, &buf); |
310 | *hp = buf & 0x80000000; | 312 | *hp = buf & 0x80000000; |
@@ -417,6 +419,8 @@ static const DECLARE_TLV_DB_SCALE(mic_vol_tlv, 0, 1000, 0); | |||
417 | static const struct snd_kcontrol_new rt286_snd_controls[] = { | 419 | static const struct snd_kcontrol_new rt286_snd_controls[] = { |
418 | SOC_DOUBLE_R_TLV("DAC0 Playback Volume", RT286_DACL_GAIN, | 420 | SOC_DOUBLE_R_TLV("DAC0 Playback Volume", RT286_DACL_GAIN, |
419 | RT286_DACR_GAIN, 0, 0x7f, 0, out_vol_tlv), | 421 | RT286_DACR_GAIN, 0, 0x7f, 0, out_vol_tlv), |
422 | SOC_DOUBLE_R("ADC0 Capture Switch", RT286_ADCL_GAIN, | ||
423 | RT286_ADCR_GAIN, 7, 1, 1), | ||
420 | SOC_DOUBLE_R_TLV("ADC0 Capture Volume", RT286_ADCL_GAIN, | 424 | SOC_DOUBLE_R_TLV("ADC0 Capture Volume", RT286_ADCL_GAIN, |
421 | RT286_ADCR_GAIN, 0, 0x7f, 0, out_vol_tlv), | 425 | RT286_ADCR_GAIN, 0, 0x7f, 0, out_vol_tlv), |
422 | SOC_SINGLE_TLV("AMIC Volume", RT286_MIC_GAIN, | 426 | SOC_SINGLE_TLV("AMIC Volume", RT286_MIC_GAIN, |
@@ -538,32 +542,6 @@ static int rt286_set_dmic1_event(struct snd_soc_dapm_widget *w, | |||
538 | return 0; | 542 | return 0; |
539 | } | 543 | } |
540 | 544 | ||
541 | static int rt286_adc_event(struct snd_soc_dapm_widget *w, | ||
542 | struct snd_kcontrol *kcontrol, int event) | ||
543 | { | ||
544 | struct snd_soc_codec *codec = w->codec; | ||
545 | unsigned int nid; | ||
546 | |||
547 | nid = (w->reg >> 20) & 0xff; | ||
548 | |||
549 | switch (event) { | ||
550 | case SND_SOC_DAPM_POST_PMU: | ||
551 | snd_soc_update_bits(codec, | ||
552 | VERB_CMD(AC_VERB_SET_AMP_GAIN_MUTE, nid, 0), | ||
553 | 0x7080, 0x7000); | ||
554 | break; | ||
555 | case SND_SOC_DAPM_PRE_PMD: | ||
556 | snd_soc_update_bits(codec, | ||
557 | VERB_CMD(AC_VERB_SET_AMP_GAIN_MUTE, nid, 0), | ||
558 | 0x7080, 0x7080); | ||
559 | break; | ||
560 | default: | ||
561 | return 0; | ||
562 | } | ||
563 | |||
564 | return 0; | ||
565 | } | ||
566 | |||
567 | static int rt286_vref_event(struct snd_soc_dapm_widget *w, | 545 | static int rt286_vref_event(struct snd_soc_dapm_widget *w, |
568 | struct snd_kcontrol *kcontrol, int event) | 546 | struct snd_kcontrol *kcontrol, int event) |
569 | { | 547 | { |
@@ -667,12 +645,10 @@ static const struct snd_soc_dapm_widget rt286_dapm_widgets[] = { | |||
667 | SND_SOC_DAPM_ADC("ADC 1", NULL, SND_SOC_NOPM, 0, 0), | 645 | SND_SOC_DAPM_ADC("ADC 1", NULL, SND_SOC_NOPM, 0, 0), |
668 | 646 | ||
669 | /* ADC Mux */ | 647 | /* ADC Mux */ |
670 | SND_SOC_DAPM_MUX_E("ADC 0 Mux", RT286_SET_POWER(RT286_ADC_IN1), 0, 1, | 648 | SND_SOC_DAPM_MUX("ADC 0 Mux", RT286_SET_POWER(RT286_ADC_IN1), 0, 1, |
671 | &rt286_adc0_mux, rt286_adc_event, SND_SOC_DAPM_PRE_PMD | | 649 | &rt286_adc0_mux), |
672 | SND_SOC_DAPM_POST_PMU), | 650 | SND_SOC_DAPM_MUX("ADC 1 Mux", RT286_SET_POWER(RT286_ADC_IN2), 0, 1, |
673 | SND_SOC_DAPM_MUX_E("ADC 1 Mux", RT286_SET_POWER(RT286_ADC_IN2), 0, 1, | 651 | &rt286_adc1_mux), |
674 | &rt286_adc1_mux, rt286_adc_event, SND_SOC_DAPM_PRE_PMD | | ||
675 | SND_SOC_DAPM_POST_PMU), | ||
676 | 652 | ||
677 | /* Audio Interface */ | 653 | /* Audio Interface */ |
678 | SND_SOC_DAPM_AIF_IN("AIF1RX", "AIF1 Playback", 0, SND_SOC_NOPM, 0, 0), | 654 | SND_SOC_DAPM_AIF_IN("AIF1RX", "AIF1 Playback", 0, SND_SOC_NOPM, 0, 0), |
@@ -861,10 +837,8 @@ static int rt286_hw_params(struct snd_pcm_substream *substream, | |||
861 | RT286_I2S_CTRL1, 0x0018, d_len_code << 3); | 837 | RT286_I2S_CTRL1, 0x0018, d_len_code << 3); |
862 | dev_dbg(codec->dev, "format val = 0x%x\n", val); | 838 | dev_dbg(codec->dev, "format val = 0x%x\n", val); |
863 | 839 | ||
864 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | 840 | snd_soc_update_bits(codec, RT286_DAC_FORMAT, 0x407f, val); |
865 | snd_soc_update_bits(codec, RT286_DAC_FORMAT, 0x407f, val); | 841 | snd_soc_update_bits(codec, RT286_ADC_FORMAT, 0x407f, val); |
866 | else | ||
867 | snd_soc_update_bits(codec, RT286_ADC_FORMAT, 0x407f, val); | ||
868 | 842 | ||
869 | return 0; | 843 | return 0; |
870 | } | 844 | } |
diff --git a/sound/soc/codecs/rt5640.c b/sound/soc/codecs/rt5640.c index c3f2decd643c..1ff726c29249 100644 --- a/sound/soc/codecs/rt5640.c +++ b/sound/soc/codecs/rt5640.c | |||
@@ -2124,6 +2124,7 @@ MODULE_DEVICE_TABLE(of, rt5640_of_match); | |||
2124 | static struct acpi_device_id rt5640_acpi_match[] = { | 2124 | static struct acpi_device_id rt5640_acpi_match[] = { |
2125 | { "INT33CA", 0 }, | 2125 | { "INT33CA", 0 }, |
2126 | { "10EC5640", 0 }, | 2126 | { "10EC5640", 0 }, |
2127 | { "10EC5642", 0 }, | ||
2127 | { }, | 2128 | { }, |
2128 | }; | 2129 | }; |
2129 | MODULE_DEVICE_TABLE(acpi, rt5640_acpi_match); | 2130 | MODULE_DEVICE_TABLE(acpi, rt5640_acpi_match); |
diff --git a/sound/soc/codecs/rt5670.c b/sound/soc/codecs/rt5670.c index 8a0833de1665..0a027bc94399 100644 --- a/sound/soc/codecs/rt5670.c +++ b/sound/soc/codecs/rt5670.c | |||
@@ -14,10 +14,12 @@ | |||
14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
15 | #include <linux/delay.h> | 15 | #include <linux/delay.h> |
16 | #include <linux/pm.h> | 16 | #include <linux/pm.h> |
17 | #include <linux/pm_runtime.h> | ||
17 | #include <linux/i2c.h> | 18 | #include <linux/i2c.h> |
18 | #include <linux/platform_device.h> | 19 | #include <linux/platform_device.h> |
19 | #include <linux/acpi.h> | 20 | #include <linux/acpi.h> |
20 | #include <linux/spi/spi.h> | 21 | #include <linux/spi/spi.h> |
22 | #include <linux/dmi.h> | ||
21 | #include <sound/core.h> | 23 | #include <sound/core.h> |
22 | #include <sound/pcm.h> | 24 | #include <sound/pcm.h> |
23 | #include <sound/pcm_params.h> | 25 | #include <sound/pcm_params.h> |
@@ -2188,6 +2190,13 @@ static int rt5670_set_dai_sysclk(struct snd_soc_dai *dai, | |||
2188 | if (freq == rt5670->sysclk && clk_id == rt5670->sysclk_src) | 2190 | if (freq == rt5670->sysclk && clk_id == rt5670->sysclk_src) |
2189 | return 0; | 2191 | return 0; |
2190 | 2192 | ||
2193 | if (rt5670->pdata.jd_mode) { | ||
2194 | if (clk_id == RT5670_SCLK_S_PLL1) | ||
2195 | snd_soc_dapm_force_enable_pin(&codec->dapm, "PLL1"); | ||
2196 | else | ||
2197 | snd_soc_dapm_disable_pin(&codec->dapm, "PLL1"); | ||
2198 | snd_soc_dapm_sync(&codec->dapm); | ||
2199 | } | ||
2191 | switch (clk_id) { | 2200 | switch (clk_id) { |
2192 | case RT5670_SCLK_S_MCLK: | 2201 | case RT5670_SCLK_S_MCLK: |
2193 | reg_val |= RT5670_SCLK_SRC_MCLK; | 2202 | reg_val |= RT5670_SCLK_SRC_MCLK; |
@@ -2549,6 +2558,17 @@ static struct acpi_device_id rt5670_acpi_match[] = { | |||
2549 | MODULE_DEVICE_TABLE(acpi, rt5670_acpi_match); | 2558 | MODULE_DEVICE_TABLE(acpi, rt5670_acpi_match); |
2550 | #endif | 2559 | #endif |
2551 | 2560 | ||
2561 | static const struct dmi_system_id dmi_platform_intel_braswell[] = { | ||
2562 | { | ||
2563 | .ident = "Intel Braswell", | ||
2564 | .matches = { | ||
2565 | DMI_MATCH(DMI_SYS_VENDOR, "Intel Corporation"), | ||
2566 | DMI_MATCH(DMI_BOARD_NAME, "Braswell CRB"), | ||
2567 | }, | ||
2568 | }, | ||
2569 | {} | ||
2570 | }; | ||
2571 | |||
2552 | static int rt5670_i2c_probe(struct i2c_client *i2c, | 2572 | static int rt5670_i2c_probe(struct i2c_client *i2c, |
2553 | const struct i2c_device_id *id) | 2573 | const struct i2c_device_id *id) |
2554 | { | 2574 | { |
@@ -2568,6 +2588,12 @@ static int rt5670_i2c_probe(struct i2c_client *i2c, | |||
2568 | if (pdata) | 2588 | if (pdata) |
2569 | rt5670->pdata = *pdata; | 2589 | rt5670->pdata = *pdata; |
2570 | 2590 | ||
2591 | if (dmi_check_system(dmi_platform_intel_braswell)) { | ||
2592 | rt5670->pdata.dmic_en = true; | ||
2593 | rt5670->pdata.dmic1_data_pin = RT5670_DMIC_DATA_IN2P; | ||
2594 | rt5670->pdata.jd_mode = 1; | ||
2595 | } | ||
2596 | |||
2571 | rt5670->regmap = devm_regmap_init_i2c(i2c, &rt5670_regmap); | 2597 | rt5670->regmap = devm_regmap_init_i2c(i2c, &rt5670_regmap); |
2572 | if (IS_ERR(rt5670->regmap)) { | 2598 | if (IS_ERR(rt5670->regmap)) { |
2573 | ret = PTR_ERR(rt5670->regmap); | 2599 | ret = PTR_ERR(rt5670->regmap); |
@@ -2609,6 +2635,10 @@ static int rt5670_i2c_probe(struct i2c_client *i2c, | |||
2609 | } | 2635 | } |
2610 | 2636 | ||
2611 | if (rt5670->pdata.jd_mode) { | 2637 | if (rt5670->pdata.jd_mode) { |
2638 | regmap_update_bits(rt5670->regmap, RT5670_GLB_CLK, | ||
2639 | RT5670_SCLK_SRC_MASK, RT5670_SCLK_SRC_RCCLK); | ||
2640 | rt5670->sysclk = 0; | ||
2641 | rt5670->sysclk_src = RT5670_SCLK_S_RCCLK; | ||
2612 | regmap_update_bits(rt5670->regmap, RT5670_PWR_ANLG1, | 2642 | regmap_update_bits(rt5670->regmap, RT5670_PWR_ANLG1, |
2613 | RT5670_PWR_MB, RT5670_PWR_MB); | 2643 | RT5670_PWR_MB, RT5670_PWR_MB); |
2614 | regmap_update_bits(rt5670->regmap, RT5670_PWR_ANLG2, | 2644 | regmap_update_bits(rt5670->regmap, RT5670_PWR_ANLG2, |
@@ -2716,18 +2746,26 @@ static int rt5670_i2c_probe(struct i2c_client *i2c, | |||
2716 | 2746 | ||
2717 | } | 2747 | } |
2718 | 2748 | ||
2749 | pm_runtime_enable(&i2c->dev); | ||
2750 | pm_request_idle(&i2c->dev); | ||
2751 | |||
2719 | ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_rt5670, | 2752 | ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_rt5670, |
2720 | rt5670_dai, ARRAY_SIZE(rt5670_dai)); | 2753 | rt5670_dai, ARRAY_SIZE(rt5670_dai)); |
2721 | if (ret < 0) | 2754 | if (ret < 0) |
2722 | goto err; | 2755 | goto err; |
2723 | 2756 | ||
2757 | pm_runtime_put(&i2c->dev); | ||
2758 | |||
2724 | return 0; | 2759 | return 0; |
2725 | err: | 2760 | err: |
2761 | pm_runtime_disable(&i2c->dev); | ||
2762 | |||
2726 | return ret; | 2763 | return ret; |
2727 | } | 2764 | } |
2728 | 2765 | ||
2729 | static int rt5670_i2c_remove(struct i2c_client *i2c) | 2766 | static int rt5670_i2c_remove(struct i2c_client *i2c) |
2730 | { | 2767 | { |
2768 | pm_runtime_disable(&i2c->dev); | ||
2731 | snd_soc_unregister_codec(&i2c->dev); | 2769 | snd_soc_unregister_codec(&i2c->dev); |
2732 | 2770 | ||
2733 | return 0; | 2771 | return 0; |
diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c index 81fe1464d268..d27630accf03 100644 --- a/sound/soc/codecs/rt5677.c +++ b/sound/soc/codecs/rt5677.c | |||
@@ -784,8 +784,8 @@ static unsigned int bst_tlv[] = { | |||
784 | static int rt5677_dsp_vad_get(struct snd_kcontrol *kcontrol, | 784 | static int rt5677_dsp_vad_get(struct snd_kcontrol *kcontrol, |
785 | struct snd_ctl_elem_value *ucontrol) | 785 | struct snd_ctl_elem_value *ucontrol) |
786 | { | 786 | { |
787 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 787 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
788 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); | 788 | struct rt5677_priv *rt5677 = snd_soc_component_get_drvdata(component); |
789 | 789 | ||
790 | ucontrol->value.integer.value[0] = rt5677->dsp_vad_en; | 790 | ucontrol->value.integer.value[0] = rt5677->dsp_vad_en; |
791 | 791 | ||
@@ -795,8 +795,9 @@ static int rt5677_dsp_vad_get(struct snd_kcontrol *kcontrol, | |||
795 | static int rt5677_dsp_vad_put(struct snd_kcontrol *kcontrol, | 795 | static int rt5677_dsp_vad_put(struct snd_kcontrol *kcontrol, |
796 | struct snd_ctl_elem_value *ucontrol) | 796 | struct snd_ctl_elem_value *ucontrol) |
797 | { | 797 | { |
798 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 798 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
799 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); | 799 | struct rt5677_priv *rt5677 = snd_soc_component_get_drvdata(component); |
800 | struct snd_soc_codec *codec = snd_soc_component_to_codec(component); | ||
800 | 801 | ||
801 | rt5677->dsp_vad_en = !!ucontrol->value.integer.value[0]; | 802 | rt5677->dsp_vad_en = !!ucontrol->value.integer.value[0]; |
802 | 803 | ||
@@ -921,6 +922,97 @@ static int is_sys_clk_from_pll(struct snd_soc_dapm_widget *source, | |||
921 | return 0; | 922 | return 0; |
922 | } | 923 | } |
923 | 924 | ||
925 | static int is_using_asrc(struct snd_soc_dapm_widget *source, | ||
926 | struct snd_soc_dapm_widget *sink) | ||
927 | { | ||
928 | unsigned int reg, shift, val; | ||
929 | |||
930 | if (source->reg == RT5677_ASRC_1) { | ||
931 | switch (source->shift) { | ||
932 | case 12: | ||
933 | reg = RT5677_ASRC_4; | ||
934 | shift = 0; | ||
935 | break; | ||
936 | case 13: | ||
937 | reg = RT5677_ASRC_4; | ||
938 | shift = 4; | ||
939 | break; | ||
940 | case 14: | ||
941 | reg = RT5677_ASRC_4; | ||
942 | shift = 8; | ||
943 | break; | ||
944 | case 15: | ||
945 | reg = RT5677_ASRC_4; | ||
946 | shift = 12; | ||
947 | break; | ||
948 | default: | ||
949 | return 0; | ||
950 | } | ||
951 | } else { | ||
952 | switch (source->shift) { | ||
953 | case 0: | ||
954 | reg = RT5677_ASRC_6; | ||
955 | shift = 8; | ||
956 | break; | ||
957 | case 1: | ||
958 | reg = RT5677_ASRC_6; | ||
959 | shift = 12; | ||
960 | break; | ||
961 | case 2: | ||
962 | reg = RT5677_ASRC_5; | ||
963 | shift = 0; | ||
964 | break; | ||
965 | case 3: | ||
966 | reg = RT5677_ASRC_5; | ||
967 | shift = 4; | ||
968 | break; | ||
969 | case 4: | ||
970 | reg = RT5677_ASRC_5; | ||
971 | shift = 8; | ||
972 | break; | ||
973 | case 5: | ||
974 | reg = RT5677_ASRC_5; | ||
975 | shift = 12; | ||
976 | break; | ||
977 | case 12: | ||
978 | reg = RT5677_ASRC_3; | ||
979 | shift = 0; | ||
980 | break; | ||
981 | case 13: | ||
982 | reg = RT5677_ASRC_3; | ||
983 | shift = 4; | ||
984 | break; | ||
985 | case 14: | ||
986 | reg = RT5677_ASRC_3; | ||
987 | shift = 12; | ||
988 | break; | ||
989 | default: | ||
990 | return 0; | ||
991 | } | ||
992 | } | ||
993 | |||
994 | val = (snd_soc_read(source->codec, reg) >> shift) & 0xf; | ||
995 | switch (val) { | ||
996 | case 1 ... 6: | ||
997 | return 1; | ||
998 | default: | ||
999 | return 0; | ||
1000 | } | ||
1001 | |||
1002 | } | ||
1003 | |||
1004 | static int can_use_asrc(struct snd_soc_dapm_widget *source, | ||
1005 | struct snd_soc_dapm_widget *sink) | ||
1006 | { | ||
1007 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm); | ||
1008 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); | ||
1009 | |||
1010 | if (rt5677->sysclk > rt5677->lrck[RT5677_AIF1] * 384) | ||
1011 | return 1; | ||
1012 | |||
1013 | return 0; | ||
1014 | } | ||
1015 | |||
924 | /* Digital Mixer */ | 1016 | /* Digital Mixer */ |
925 | static const struct snd_kcontrol_new rt5677_sto1_adc_l_mix[] = { | 1017 | static const struct snd_kcontrol_new rt5677_sto1_adc_l_mix[] = { |
926 | SOC_DAPM_SINGLE("ADC1 Switch", RT5677_STO1_ADC_MIXER, | 1018 | SOC_DAPM_SINGLE("ADC1 Switch", RT5677_STO1_ADC_MIXER, |
@@ -2082,10 +2174,14 @@ static int rt5677_set_pll1_event(struct snd_soc_dapm_widget *w, | |||
2082 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); | 2174 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); |
2083 | 2175 | ||
2084 | switch (event) { | 2176 | switch (event) { |
2085 | case SND_SOC_DAPM_POST_PMU: | 2177 | case SND_SOC_DAPM_PRE_PMU: |
2086 | regmap_update_bits(rt5677->regmap, RT5677_PLL1_CTRL2, 0x2, 0x2); | 2178 | regmap_update_bits(rt5677->regmap, RT5677_PLL1_CTRL2, 0x2, 0x2); |
2179 | break; | ||
2180 | |||
2181 | case SND_SOC_DAPM_POST_PMU: | ||
2087 | regmap_update_bits(rt5677->regmap, RT5677_PLL1_CTRL2, 0x2, 0x0); | 2182 | regmap_update_bits(rt5677->regmap, RT5677_PLL1_CTRL2, 0x2, 0x0); |
2088 | break; | 2183 | break; |
2184 | |||
2089 | default: | 2185 | default: |
2090 | return 0; | 2186 | return 0; |
2091 | } | 2187 | } |
@@ -2100,10 +2196,14 @@ static int rt5677_set_pll2_event(struct snd_soc_dapm_widget *w, | |||
2100 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); | 2196 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); |
2101 | 2197 | ||
2102 | switch (event) { | 2198 | switch (event) { |
2103 | case SND_SOC_DAPM_POST_PMU: | 2199 | case SND_SOC_DAPM_PRE_PMU: |
2104 | regmap_update_bits(rt5677->regmap, RT5677_PLL2_CTRL2, 0x2, 0x2); | 2200 | regmap_update_bits(rt5677->regmap, RT5677_PLL2_CTRL2, 0x2, 0x2); |
2201 | break; | ||
2202 | |||
2203 | case SND_SOC_DAPM_POST_PMU: | ||
2105 | regmap_update_bits(rt5677->regmap, RT5677_PLL2_CTRL2, 0x2, 0x0); | 2204 | regmap_update_bits(rt5677->regmap, RT5677_PLL2_CTRL2, 0x2, 0x0); |
2106 | break; | 2205 | break; |
2206 | |||
2107 | default: | 2207 | default: |
2108 | return 0; | 2208 | return 0; |
2109 | } | 2209 | } |
@@ -2211,9 +2311,50 @@ static int rt5677_vref_event(struct snd_soc_dapm_widget *w, | |||
2211 | 2311 | ||
2212 | static const struct snd_soc_dapm_widget rt5677_dapm_widgets[] = { | 2312 | static const struct snd_soc_dapm_widget rt5677_dapm_widgets[] = { |
2213 | SND_SOC_DAPM_SUPPLY("PLL1", RT5677_PWR_ANLG2, RT5677_PWR_PLL1_BIT, | 2313 | SND_SOC_DAPM_SUPPLY("PLL1", RT5677_PWR_ANLG2, RT5677_PWR_PLL1_BIT, |
2214 | 0, rt5677_set_pll1_event, SND_SOC_DAPM_POST_PMU), | 2314 | 0, rt5677_set_pll1_event, SND_SOC_DAPM_PRE_PMU | |
2315 | SND_SOC_DAPM_POST_PMU), | ||
2215 | SND_SOC_DAPM_SUPPLY("PLL2", RT5677_PWR_ANLG2, RT5677_PWR_PLL2_BIT, | 2316 | SND_SOC_DAPM_SUPPLY("PLL2", RT5677_PWR_ANLG2, RT5677_PWR_PLL2_BIT, |
2216 | 0, rt5677_set_pll2_event, SND_SOC_DAPM_POST_PMU), | 2317 | 0, rt5677_set_pll2_event, SND_SOC_DAPM_PRE_PMU | |
2318 | SND_SOC_DAPM_POST_PMU), | ||
2319 | |||
2320 | /* ASRC */ | ||
2321 | SND_SOC_DAPM_SUPPLY_S("I2S1 ASRC", 1, RT5677_ASRC_1, 0, 0, NULL, 0), | ||
2322 | SND_SOC_DAPM_SUPPLY_S("I2S2 ASRC", 1, RT5677_ASRC_1, 1, 0, NULL, 0), | ||
2323 | SND_SOC_DAPM_SUPPLY_S("I2S3 ASRC", 1, RT5677_ASRC_1, 2, 0, NULL, 0), | ||
2324 | SND_SOC_DAPM_SUPPLY_S("I2S4 ASRC", 1, RT5677_ASRC_1, 3, 0, NULL, 0), | ||
2325 | SND_SOC_DAPM_SUPPLY_S("DAC STO ASRC", 1, RT5677_ASRC_2, 14, 0, NULL, 0), | ||
2326 | SND_SOC_DAPM_SUPPLY_S("DAC MONO2 L ASRC", 1, RT5677_ASRC_2, 13, 0, NULL, | ||
2327 | 0), | ||
2328 | SND_SOC_DAPM_SUPPLY_S("DAC MONO2 R ASRC", 1, RT5677_ASRC_2, 12, 0, NULL, | ||
2329 | 0), | ||
2330 | SND_SOC_DAPM_SUPPLY_S("DAC MONO3 L ASRC", 1, RT5677_ASRC_1, 15, 0, NULL, | ||
2331 | 0), | ||
2332 | SND_SOC_DAPM_SUPPLY_S("DAC MONO3 R ASRC", 1, RT5677_ASRC_1, 14, 0, NULL, | ||
2333 | 0), | ||
2334 | SND_SOC_DAPM_SUPPLY_S("DAC MONO4 L ASRC", 1, RT5677_ASRC_1, 13, 0, NULL, | ||
2335 | 0), | ||
2336 | SND_SOC_DAPM_SUPPLY_S("DAC MONO4 R ASRC", 1, RT5677_ASRC_1, 12, 0, NULL, | ||
2337 | 0), | ||
2338 | SND_SOC_DAPM_SUPPLY_S("DMIC STO1 ASRC", 1, RT5677_ASRC_2, 11, 0, NULL, | ||
2339 | 0), | ||
2340 | SND_SOC_DAPM_SUPPLY_S("DMIC STO2 ASRC", 1, RT5677_ASRC_2, 10, 0, NULL, | ||
2341 | 0), | ||
2342 | SND_SOC_DAPM_SUPPLY_S("DMIC STO3 ASRC", 1, RT5677_ASRC_2, 9, 0, NULL, | ||
2343 | 0), | ||
2344 | SND_SOC_DAPM_SUPPLY_S("DMIC STO4 ASRC", 1, RT5677_ASRC_2, 8, 0, NULL, | ||
2345 | 0), | ||
2346 | SND_SOC_DAPM_SUPPLY_S("DMIC MONO L ASRC", 1, RT5677_ASRC_2, 7, 0, NULL, | ||
2347 | 0), | ||
2348 | SND_SOC_DAPM_SUPPLY_S("DMIC MONO R ASRC", 1, RT5677_ASRC_2, 6, 0, NULL, | ||
2349 | 0), | ||
2350 | SND_SOC_DAPM_SUPPLY_S("ADC STO1 ASRC", 1, RT5677_ASRC_2, 5, 0, NULL, 0), | ||
2351 | SND_SOC_DAPM_SUPPLY_S("ADC STO2 ASRC", 1, RT5677_ASRC_2, 4, 0, NULL, 0), | ||
2352 | SND_SOC_DAPM_SUPPLY_S("ADC STO3 ASRC", 1, RT5677_ASRC_2, 3, 0, NULL, 0), | ||
2353 | SND_SOC_DAPM_SUPPLY_S("ADC STO4 ASRC", 1, RT5677_ASRC_2, 2, 0, NULL, 0), | ||
2354 | SND_SOC_DAPM_SUPPLY_S("ADC MONO L ASRC", 1, RT5677_ASRC_2, 1, 0, NULL, | ||
2355 | 0), | ||
2356 | SND_SOC_DAPM_SUPPLY_S("ADC MONO R ASRC", 1, RT5677_ASRC_2, 0, 0, NULL, | ||
2357 | 0), | ||
2217 | 2358 | ||
2218 | /* Input Side */ | 2359 | /* Input Side */ |
2219 | /* micbias */ | 2360 | /* micbias */ |
@@ -2645,10 +2786,18 @@ static const struct snd_soc_dapm_widget rt5677_dapm_widgets[] = { | |||
2645 | /* DAC Mixer */ | 2786 | /* DAC Mixer */ |
2646 | SND_SOC_DAPM_SUPPLY("dac stereo1 filter", RT5677_PWR_DIG2, | 2787 | SND_SOC_DAPM_SUPPLY("dac stereo1 filter", RT5677_PWR_DIG2, |
2647 | RT5677_PWR_DAC_S1F_BIT, 0, NULL, 0), | 2788 | RT5677_PWR_DAC_S1F_BIT, 0, NULL, 0), |
2648 | SND_SOC_DAPM_SUPPLY("dac mono left filter", RT5677_PWR_DIG2, | 2789 | SND_SOC_DAPM_SUPPLY("dac mono2 left filter", RT5677_PWR_DIG2, |
2649 | RT5677_PWR_DAC_M2F_L_BIT, 0, NULL, 0), | 2790 | RT5677_PWR_DAC_M2F_L_BIT, 0, NULL, 0), |
2650 | SND_SOC_DAPM_SUPPLY("dac mono right filter", RT5677_PWR_DIG2, | 2791 | SND_SOC_DAPM_SUPPLY("dac mono2 right filter", RT5677_PWR_DIG2, |
2651 | RT5677_PWR_DAC_M2F_R_BIT, 0, NULL, 0), | 2792 | RT5677_PWR_DAC_M2F_R_BIT, 0, NULL, 0), |
2793 | SND_SOC_DAPM_SUPPLY("dac mono3 left filter", RT5677_PWR_DIG2, | ||
2794 | RT5677_PWR_DAC_M3F_L_BIT, 0, NULL, 0), | ||
2795 | SND_SOC_DAPM_SUPPLY("dac mono3 right filter", RT5677_PWR_DIG2, | ||
2796 | RT5677_PWR_DAC_M3F_R_BIT, 0, NULL, 0), | ||
2797 | SND_SOC_DAPM_SUPPLY("dac mono4 left filter", RT5677_PWR_DIG2, | ||
2798 | RT5677_PWR_DAC_M4F_L_BIT, 0, NULL, 0), | ||
2799 | SND_SOC_DAPM_SUPPLY("dac mono4 right filter", RT5677_PWR_DIG2, | ||
2800 | RT5677_PWR_DAC_M4F_R_BIT, 0, NULL, 0), | ||
2652 | 2801 | ||
2653 | SND_SOC_DAPM_MIXER("Stereo DAC MIXL", SND_SOC_NOPM, 0, 0, | 2802 | SND_SOC_DAPM_MIXER("Stereo DAC MIXL", SND_SOC_NOPM, 0, 0, |
2654 | rt5677_sto1_dac_l_mix, ARRAY_SIZE(rt5677_sto1_dac_l_mix)), | 2803 | rt5677_sto1_dac_l_mix, ARRAY_SIZE(rt5677_sto1_dac_l_mix)), |
@@ -2721,6 +2870,31 @@ static const struct snd_soc_dapm_widget rt5677_dapm_widgets[] = { | |||
2721 | }; | 2870 | }; |
2722 | 2871 | ||
2723 | static const struct snd_soc_dapm_route rt5677_dapm_routes[] = { | 2872 | static const struct snd_soc_dapm_route rt5677_dapm_routes[] = { |
2873 | { "Stereo1 DMIC Mux", NULL, "DMIC STO1 ASRC", can_use_asrc }, | ||
2874 | { "Stereo2 DMIC Mux", NULL, "DMIC STO2 ASRC", can_use_asrc }, | ||
2875 | { "Stereo3 DMIC Mux", NULL, "DMIC STO3 ASRC", can_use_asrc }, | ||
2876 | { "Stereo4 DMIC Mux", NULL, "DMIC STO4 ASRC", can_use_asrc }, | ||
2877 | { "Mono DMIC L Mux", NULL, "DMIC MONO L ASRC", can_use_asrc }, | ||
2878 | { "Mono DMIC R Mux", NULL, "DMIC MONO R ASRC", can_use_asrc }, | ||
2879 | { "I2S1", NULL, "I2S1 ASRC", can_use_asrc}, | ||
2880 | { "I2S2", NULL, "I2S2 ASRC", can_use_asrc}, | ||
2881 | { "I2S3", NULL, "I2S3 ASRC", can_use_asrc}, | ||
2882 | { "I2S4", NULL, "I2S4 ASRC", can_use_asrc}, | ||
2883 | |||
2884 | { "dac stereo1 filter", NULL, "DAC STO ASRC", is_using_asrc }, | ||
2885 | { "dac mono2 left filter", NULL, "DAC MONO2 L ASRC", is_using_asrc }, | ||
2886 | { "dac mono2 right filter", NULL, "DAC MONO2 R ASRC", is_using_asrc }, | ||
2887 | { "dac mono3 left filter", NULL, "DAC MONO3 L ASRC", is_using_asrc }, | ||
2888 | { "dac mono3 right filter", NULL, "DAC MONO3 R ASRC", is_using_asrc }, | ||
2889 | { "dac mono4 left filter", NULL, "DAC MONO4 L ASRC", is_using_asrc }, | ||
2890 | { "dac mono4 right filter", NULL, "DAC MONO4 R ASRC", is_using_asrc }, | ||
2891 | { "adc stereo1 filter", NULL, "ADC STO1 ASRC", is_using_asrc }, | ||
2892 | { "adc stereo2 filter", NULL, "ADC STO2 ASRC", is_using_asrc }, | ||
2893 | { "adc stereo3 filter", NULL, "ADC STO3 ASRC", is_using_asrc }, | ||
2894 | { "adc stereo4 filter", NULL, "ADC STO4 ASRC", is_using_asrc }, | ||
2895 | { "adc mono left filter", NULL, "ADC MONO L ASRC", is_using_asrc }, | ||
2896 | { "adc mono right filter", NULL, "ADC MONO R ASRC", is_using_asrc }, | ||
2897 | |||
2724 | { "DMIC1", NULL, "DMIC L1" }, | 2898 | { "DMIC1", NULL, "DMIC L1" }, |
2725 | { "DMIC1", NULL, "DMIC R1" }, | 2899 | { "DMIC1", NULL, "DMIC R1" }, |
2726 | { "DMIC2", NULL, "DMIC L2" }, | 2900 | { "DMIC2", NULL, "DMIC L2" }, |
@@ -2851,8 +3025,6 @@ static const struct snd_soc_dapm_route rt5677_dapm_routes[] = { | |||
2851 | 3025 | ||
2852 | { "Stereo1 ADC MIXL", NULL, "Sto1 ADC MIXL" }, | 3026 | { "Stereo1 ADC MIXL", NULL, "Sto1 ADC MIXL" }, |
2853 | { "Stereo1 ADC MIXL", NULL, "adc stereo1 filter" }, | 3027 | { "Stereo1 ADC MIXL", NULL, "adc stereo1 filter" }, |
2854 | { "adc stereo1 filter", NULL, "PLL1", is_sys_clk_from_pll }, | ||
2855 | |||
2856 | { "Stereo1 ADC MIXR", NULL, "Sto1 ADC MIXR" }, | 3028 | { "Stereo1 ADC MIXR", NULL, "Sto1 ADC MIXR" }, |
2857 | { "Stereo1 ADC MIXR", NULL, "adc stereo1 filter" }, | 3029 | { "Stereo1 ADC MIXR", NULL, "adc stereo1 filter" }, |
2858 | { "adc stereo1 filter", NULL, "PLL1", is_sys_clk_from_pll }, | 3030 | { "adc stereo1 filter", NULL, "PLL1", is_sys_clk_from_pll }, |
@@ -2873,8 +3045,6 @@ static const struct snd_soc_dapm_route rt5677_dapm_routes[] = { | |||
2873 | 3045 | ||
2874 | { "Stereo2 ADC MIXL", NULL, "Stereo2 ADC LR Mux" }, | 3046 | { "Stereo2 ADC MIXL", NULL, "Stereo2 ADC LR Mux" }, |
2875 | { "Stereo2 ADC MIXL", NULL, "adc stereo2 filter" }, | 3047 | { "Stereo2 ADC MIXL", NULL, "adc stereo2 filter" }, |
2876 | { "adc stereo2 filter", NULL, "PLL1", is_sys_clk_from_pll }, | ||
2877 | |||
2878 | { "Stereo2 ADC MIXR", NULL, "Sto2 ADC MIXR" }, | 3048 | { "Stereo2 ADC MIXR", NULL, "Sto2 ADC MIXR" }, |
2879 | { "Stereo2 ADC MIXR", NULL, "adc stereo2 filter" }, | 3049 | { "Stereo2 ADC MIXR", NULL, "adc stereo2 filter" }, |
2880 | { "adc stereo2 filter", NULL, "PLL1", is_sys_clk_from_pll }, | 3050 | { "adc stereo2 filter", NULL, "PLL1", is_sys_clk_from_pll }, |
@@ -2889,8 +3059,6 @@ static const struct snd_soc_dapm_route rt5677_dapm_routes[] = { | |||
2889 | 3059 | ||
2890 | { "Stereo3 ADC MIXL", NULL, "Sto3 ADC MIXL" }, | 3060 | { "Stereo3 ADC MIXL", NULL, "Sto3 ADC MIXL" }, |
2891 | { "Stereo3 ADC MIXL", NULL, "adc stereo3 filter" }, | 3061 | { "Stereo3 ADC MIXL", NULL, "adc stereo3 filter" }, |
2892 | { "adc stereo3 filter", NULL, "PLL1", is_sys_clk_from_pll }, | ||
2893 | |||
2894 | { "Stereo3 ADC MIXR", NULL, "Sto3 ADC MIXR" }, | 3062 | { "Stereo3 ADC MIXR", NULL, "Sto3 ADC MIXR" }, |
2895 | { "Stereo3 ADC MIXR", NULL, "adc stereo3 filter" }, | 3063 | { "Stereo3 ADC MIXR", NULL, "adc stereo3 filter" }, |
2896 | { "adc stereo3 filter", NULL, "PLL1", is_sys_clk_from_pll }, | 3064 | { "adc stereo3 filter", NULL, "PLL1", is_sys_clk_from_pll }, |
@@ -2905,8 +3073,6 @@ static const struct snd_soc_dapm_route rt5677_dapm_routes[] = { | |||
2905 | 3073 | ||
2906 | { "Stereo4 ADC MIXL", NULL, "Sto4 ADC MIXL" }, | 3074 | { "Stereo4 ADC MIXL", NULL, "Sto4 ADC MIXL" }, |
2907 | { "Stereo4 ADC MIXL", NULL, "adc stereo4 filter" }, | 3075 | { "Stereo4 ADC MIXL", NULL, "adc stereo4 filter" }, |
2908 | { "adc stereo4 filter", NULL, "PLL1", is_sys_clk_from_pll }, | ||
2909 | |||
2910 | { "Stereo4 ADC MIXR", NULL, "Sto4 ADC MIXR" }, | 3076 | { "Stereo4 ADC MIXR", NULL, "Sto4 ADC MIXR" }, |
2911 | { "Stereo4 ADC MIXR", NULL, "adc stereo4 filter" }, | 3077 | { "Stereo4 ADC MIXR", NULL, "adc stereo4 filter" }, |
2912 | { "adc stereo4 filter", NULL, "PLL1", is_sys_clk_from_pll }, | 3078 | { "adc stereo4 filter", NULL, "PLL1", is_sys_clk_from_pll }, |
@@ -3455,10 +3621,8 @@ static const struct snd_soc_dapm_route rt5677_dapm_routes[] = { | |||
3455 | 3621 | ||
3456 | { "DAC1 MIXL", "Stereo ADC Switch", "ADDA1 Mux" }, | 3622 | { "DAC1 MIXL", "Stereo ADC Switch", "ADDA1 Mux" }, |
3457 | { "DAC1 MIXL", "DAC1 Switch", "DAC1 Mux" }, | 3623 | { "DAC1 MIXL", "DAC1 Switch", "DAC1 Mux" }, |
3458 | { "DAC1 MIXL", NULL, "dac stereo1 filter" }, | ||
3459 | { "DAC1 MIXR", "Stereo ADC Switch", "ADDA1 Mux" }, | 3624 | { "DAC1 MIXR", "Stereo ADC Switch", "ADDA1 Mux" }, |
3460 | { "DAC1 MIXR", "DAC1 Switch", "DAC1 Mux" }, | 3625 | { "DAC1 MIXR", "DAC1 Switch", "DAC1 Mux" }, |
3461 | { "DAC1 MIXR", NULL, "dac stereo1 filter" }, | ||
3462 | 3626 | ||
3463 | { "DAC1 FS", NULL, "DAC1 MIXL" }, | 3627 | { "DAC1 FS", NULL, "DAC1 MIXL" }, |
3464 | { "DAC1 FS", NULL, "DAC1 MIXR" }, | 3628 | { "DAC1 FS", NULL, "DAC1 MIXR" }, |
@@ -3525,35 +3689,46 @@ static const struct snd_soc_dapm_route rt5677_dapm_routes[] = { | |||
3525 | { "Stereo DAC MIXR", "DAC2 R Switch", "DAC2 R Mux" }, | 3689 | { "Stereo DAC MIXR", "DAC2 R Switch", "DAC2 R Mux" }, |
3526 | { "Stereo DAC MIXR", "DAC1 L Switch", "DAC1 MIXL" }, | 3690 | { "Stereo DAC MIXR", "DAC1 L Switch", "DAC1 MIXL" }, |
3527 | { "Stereo DAC MIXR", NULL, "dac stereo1 filter" }, | 3691 | { "Stereo DAC MIXR", NULL, "dac stereo1 filter" }, |
3692 | { "dac stereo1 filter", NULL, "PLL1", is_sys_clk_from_pll }, | ||
3528 | 3693 | ||
3529 | { "Mono DAC MIXL", "ST L Switch", "Sidetone Mux" }, | 3694 | { "Mono DAC MIXL", "ST L Switch", "Sidetone Mux" }, |
3530 | { "Mono DAC MIXL", "DAC1 L Switch", "DAC1 MIXL" }, | 3695 | { "Mono DAC MIXL", "DAC1 L Switch", "DAC1 MIXL" }, |
3531 | { "Mono DAC MIXL", "DAC2 L Switch", "DAC2 L Mux" }, | 3696 | { "Mono DAC MIXL", "DAC2 L Switch", "DAC2 L Mux" }, |
3532 | { "Mono DAC MIXL", "DAC2 R Switch", "DAC2 R Mux" }, | 3697 | { "Mono DAC MIXL", "DAC2 R Switch", "DAC2 R Mux" }, |
3533 | { "Mono DAC MIXL", NULL, "dac mono left filter" }, | 3698 | { "Mono DAC MIXL", NULL, "dac mono2 left filter" }, |
3699 | { "dac mono2 left filter", NULL, "PLL1", is_sys_clk_from_pll }, | ||
3534 | { "Mono DAC MIXR", "ST R Switch", "Sidetone Mux" }, | 3700 | { "Mono DAC MIXR", "ST R Switch", "Sidetone Mux" }, |
3535 | { "Mono DAC MIXR", "DAC1 R Switch", "DAC1 MIXR" }, | 3701 | { "Mono DAC MIXR", "DAC1 R Switch", "DAC1 MIXR" }, |
3536 | { "Mono DAC MIXR", "DAC2 R Switch", "DAC2 R Mux" }, | 3702 | { "Mono DAC MIXR", "DAC2 R Switch", "DAC2 R Mux" }, |
3537 | { "Mono DAC MIXR", "DAC2 L Switch", "DAC2 L Mux" }, | 3703 | { "Mono DAC MIXR", "DAC2 L Switch", "DAC2 L Mux" }, |
3538 | { "Mono DAC MIXR", NULL, "dac mono right filter" }, | 3704 | { "Mono DAC MIXR", NULL, "dac mono2 right filter" }, |
3705 | { "dac mono2 right filter", NULL, "PLL1", is_sys_clk_from_pll }, | ||
3539 | 3706 | ||
3540 | { "DD1 MIXL", "Sto DAC Mix L Switch", "Stereo DAC MIXL" }, | 3707 | { "DD1 MIXL", "Sto DAC Mix L Switch", "Stereo DAC MIXL" }, |
3541 | { "DD1 MIXL", "Mono DAC Mix L Switch", "Mono DAC MIXL" }, | 3708 | { "DD1 MIXL", "Mono DAC Mix L Switch", "Mono DAC MIXL" }, |
3542 | { "DD1 MIXL", "DAC3 L Switch", "DAC3 L Mux" }, | 3709 | { "DD1 MIXL", "DAC3 L Switch", "DAC3 L Mux" }, |
3543 | { "DD1 MIXL", "DAC3 R Switch", "DAC3 R Mux" }, | 3710 | { "DD1 MIXL", "DAC3 R Switch", "DAC3 R Mux" }, |
3711 | { "DD1 MIXL", NULL, "dac mono3 left filter" }, | ||
3712 | { "dac mono3 left filter", NULL, "PLL1", is_sys_clk_from_pll }, | ||
3544 | { "DD1 MIXR", "Sto DAC Mix R Switch", "Stereo DAC MIXR" }, | 3713 | { "DD1 MIXR", "Sto DAC Mix R Switch", "Stereo DAC MIXR" }, |
3545 | { "DD1 MIXR", "Mono DAC Mix R Switch", "Mono DAC MIXR" }, | 3714 | { "DD1 MIXR", "Mono DAC Mix R Switch", "Mono DAC MIXR" }, |
3546 | { "DD1 MIXR", "DAC3 L Switch", "DAC3 L Mux" }, | 3715 | { "DD1 MIXR", "DAC3 L Switch", "DAC3 L Mux" }, |
3547 | { "DD1 MIXR", "DAC3 R Switch", "DAC3 R Mux" }, | 3716 | { "DD1 MIXR", "DAC3 R Switch", "DAC3 R Mux" }, |
3717 | { "DD1 MIXR", NULL, "dac mono3 right filter" }, | ||
3718 | { "dac mono3 right filter", NULL, "PLL1", is_sys_clk_from_pll }, | ||
3548 | 3719 | ||
3549 | { "DD2 MIXL", "Sto DAC Mix L Switch", "Stereo DAC MIXL" }, | 3720 | { "DD2 MIXL", "Sto DAC Mix L Switch", "Stereo DAC MIXL" }, |
3550 | { "DD2 MIXL", "Mono DAC Mix L Switch", "Mono DAC MIXL" }, | 3721 | { "DD2 MIXL", "Mono DAC Mix L Switch", "Mono DAC MIXL" }, |
3551 | { "DD2 MIXL", "DAC4 L Switch", "DAC4 L Mux" }, | 3722 | { "DD2 MIXL", "DAC4 L Switch", "DAC4 L Mux" }, |
3552 | { "DD2 MIXL", "DAC4 R Switch", "DAC4 R Mux" }, | 3723 | { "DD2 MIXL", "DAC4 R Switch", "DAC4 R Mux" }, |
3724 | { "DD2 MIXL", NULL, "dac mono4 left filter" }, | ||
3725 | { "dac mono4 left filter", NULL, "PLL1", is_sys_clk_from_pll }, | ||
3553 | { "DD2 MIXR", "Sto DAC Mix R Switch", "Stereo DAC MIXR" }, | 3726 | { "DD2 MIXR", "Sto DAC Mix R Switch", "Stereo DAC MIXR" }, |
3554 | { "DD2 MIXR", "Mono DAC Mix R Switch", "Mono DAC MIXR" }, | 3727 | { "DD2 MIXR", "Mono DAC Mix R Switch", "Mono DAC MIXR" }, |
3555 | { "DD2 MIXR", "DAC4 L Switch", "DAC4 L Mux" }, | 3728 | { "DD2 MIXR", "DAC4 L Switch", "DAC4 L Mux" }, |
3556 | { "DD2 MIXR", "DAC4 R Switch", "DAC4 R Mux" }, | 3729 | { "DD2 MIXR", "DAC4 R Switch", "DAC4 R Mux" }, |
3730 | { "DD2 MIXR", NULL, "dac mono4 right filter" }, | ||
3731 | { "dac mono4 right filter", NULL, "PLL1", is_sys_clk_from_pll }, | ||
3557 | 3732 | ||
3558 | { "Stereo DAC MIX", NULL, "Stereo DAC MIXL" }, | 3733 | { "Stereo DAC MIX", NULL, "Stereo DAC MIXL" }, |
3559 | { "Stereo DAC MIX", NULL, "Stereo DAC MIXR" }, | 3734 | { "Stereo DAC MIX", NULL, "Stereo DAC MIXR" }, |
@@ -3575,11 +3750,8 @@ static const struct snd_soc_dapm_route rt5677_dapm_routes[] = { | |||
3575 | { "DAC3 SRC Mux", "DD MIX2L", "DD2 MIXL" }, | 3750 | { "DAC3 SRC Mux", "DD MIX2L", "DD2 MIXL" }, |
3576 | 3751 | ||
3577 | { "DAC 1", NULL, "DAC12 SRC Mux" }, | 3752 | { "DAC 1", NULL, "DAC12 SRC Mux" }, |
3578 | { "DAC 1", NULL, "PLL1", is_sys_clk_from_pll }, | ||
3579 | { "DAC 2", NULL, "DAC12 SRC Mux" }, | 3753 | { "DAC 2", NULL, "DAC12 SRC Mux" }, |
3580 | { "DAC 2", NULL, "PLL1", is_sys_clk_from_pll }, | ||
3581 | { "DAC 3", NULL, "DAC3 SRC Mux" }, | 3754 | { "DAC 3", NULL, "DAC3 SRC Mux" }, |
3582 | { "DAC 3", NULL, "PLL1", is_sys_clk_from_pll }, | ||
3583 | 3755 | ||
3584 | { "PDM1 L Mux", "STO1 DAC MIX", "Stereo DAC MIXL" }, | 3756 | { "PDM1 L Mux", "STO1 DAC MIX", "Stereo DAC MIXL" }, |
3585 | { "PDM1 L Mux", "MONO DAC MIX", "Mono DAC MIXL" }, | 3757 | { "PDM1 L Mux", "MONO DAC MIX", "Mono DAC MIXL" }, |
diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c index 29cf7ce610f4..aa98be32bb60 100644 --- a/sound/soc/codecs/sgtl5000.c +++ b/sound/soc/codecs/sgtl5000.c | |||
@@ -483,21 +483,21 @@ static int sgtl5000_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) | |||
483 | /* setting i2s data format */ | 483 | /* setting i2s data format */ |
484 | switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { | 484 | switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { |
485 | case SND_SOC_DAIFMT_DSP_A: | 485 | case SND_SOC_DAIFMT_DSP_A: |
486 | i2sctl |= SGTL5000_I2S_MODE_PCM; | 486 | i2sctl |= SGTL5000_I2S_MODE_PCM << SGTL5000_I2S_MODE_SHIFT; |
487 | break; | 487 | break; |
488 | case SND_SOC_DAIFMT_DSP_B: | 488 | case SND_SOC_DAIFMT_DSP_B: |
489 | i2sctl |= SGTL5000_I2S_MODE_PCM; | 489 | i2sctl |= SGTL5000_I2S_MODE_PCM << SGTL5000_I2S_MODE_SHIFT; |
490 | i2sctl |= SGTL5000_I2S_LRALIGN; | 490 | i2sctl |= SGTL5000_I2S_LRALIGN; |
491 | break; | 491 | break; |
492 | case SND_SOC_DAIFMT_I2S: | 492 | case SND_SOC_DAIFMT_I2S: |
493 | i2sctl |= SGTL5000_I2S_MODE_I2S_LJ; | 493 | i2sctl |= SGTL5000_I2S_MODE_I2S_LJ << SGTL5000_I2S_MODE_SHIFT; |
494 | break; | 494 | break; |
495 | case SND_SOC_DAIFMT_RIGHT_J: | 495 | case SND_SOC_DAIFMT_RIGHT_J: |
496 | i2sctl |= SGTL5000_I2S_MODE_RJ; | 496 | i2sctl |= SGTL5000_I2S_MODE_RJ << SGTL5000_I2S_MODE_SHIFT; |
497 | i2sctl |= SGTL5000_I2S_LRPOL; | 497 | i2sctl |= SGTL5000_I2S_LRPOL; |
498 | break; | 498 | break; |
499 | case SND_SOC_DAIFMT_LEFT_J: | 499 | case SND_SOC_DAIFMT_LEFT_J: |
500 | i2sctl |= SGTL5000_I2S_MODE_I2S_LJ; | 500 | i2sctl |= SGTL5000_I2S_MODE_I2S_LJ << SGTL5000_I2S_MODE_SHIFT; |
501 | i2sctl |= SGTL5000_I2S_LRALIGN; | 501 | i2sctl |= SGTL5000_I2S_LRALIGN; |
502 | break; | 502 | break; |
503 | default: | 503 | default: |
@@ -1462,6 +1462,9 @@ static int sgtl5000_i2c_probe(struct i2c_client *client, | |||
1462 | if (ret) | 1462 | if (ret) |
1463 | return ret; | 1463 | return ret; |
1464 | 1464 | ||
1465 | /* Need 8 clocks before I2C accesses */ | ||
1466 | udelay(1); | ||
1467 | |||
1465 | /* read chip information */ | 1468 | /* read chip information */ |
1466 | ret = regmap_read(sgtl5000->regmap, SGTL5000_CHIP_ID, ®); | 1469 | ret = regmap_read(sgtl5000->regmap, SGTL5000_CHIP_ID, ®); |
1467 | if (ret) | 1470 | if (ret) |
diff --git a/sound/soc/codecs/sta32x.h b/sound/soc/codecs/sta32x.h index d8e32a6262ee..d3191c983d71 100644 --- a/sound/soc/codecs/sta32x.h +++ b/sound/soc/codecs/sta32x.h | |||
@@ -131,7 +131,7 @@ | |||
131 | #define STA32X_CONFF_OCFG_MASK 0x03 | 131 | #define STA32X_CONFF_OCFG_MASK 0x03 |
132 | #define STA32X_CONFF_OCFG_SHIFT 0 | 132 | #define STA32X_CONFF_OCFG_SHIFT 0 |
133 | #define STA32X_CONFF_IDE 0x04 | 133 | #define STA32X_CONFF_IDE 0x04 |
134 | #define STA32X_CONFF_IDE_SHIFT 3 | 134 | #define STA32X_CONFF_IDE_SHIFT 2 |
135 | #define STA32X_CONFF_BCLE 0x08 | 135 | #define STA32X_CONFF_BCLE 0x08 |
136 | #define STA32X_CONFF_ECLE 0x20 | 136 | #define STA32X_CONFF_ECLE 0x20 |
137 | #define STA32X_CONFF_PWDN 0x40 | 137 | #define STA32X_CONFF_PWDN 0x40 |
diff --git a/sound/soc/codecs/ts3a227e.c b/sound/soc/codecs/ts3a227e.c index 1d1205702d23..9f2dced046de 100644 --- a/sound/soc/codecs/ts3a227e.c +++ b/sound/soc/codecs/ts3a227e.c | |||
@@ -254,6 +254,7 @@ static int ts3a227e_i2c_probe(struct i2c_client *i2c, | |||
254 | struct ts3a227e *ts3a227e; | 254 | struct ts3a227e *ts3a227e; |
255 | struct device *dev = &i2c->dev; | 255 | struct device *dev = &i2c->dev; |
256 | int ret; | 256 | int ret; |
257 | unsigned int acc_reg; | ||
257 | 258 | ||
258 | ts3a227e = devm_kzalloc(&i2c->dev, sizeof(*ts3a227e), GFP_KERNEL); | 259 | ts3a227e = devm_kzalloc(&i2c->dev, sizeof(*ts3a227e), GFP_KERNEL); |
259 | if (ts3a227e == NULL) | 260 | if (ts3a227e == NULL) |
@@ -283,6 +284,11 @@ static int ts3a227e_i2c_probe(struct i2c_client *i2c, | |||
283 | INTB_DISABLE | ADC_COMPLETE_INT_DISABLE, | 284 | INTB_DISABLE | ADC_COMPLETE_INT_DISABLE, |
284 | ADC_COMPLETE_INT_DISABLE); | 285 | ADC_COMPLETE_INT_DISABLE); |
285 | 286 | ||
287 | /* Read jack status because chip might not trigger interrupt at boot. */ | ||
288 | regmap_read(ts3a227e->regmap, TS3A227E_REG_ACCESSORY_STATUS, &acc_reg); | ||
289 | ts3a227e_new_jack_state(ts3a227e, acc_reg); | ||
290 | ts3a227e_jack_report(ts3a227e); | ||
291 | |||
286 | return 0; | 292 | return 0; |
287 | } | 293 | } |
288 | 294 | ||
diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c index b9211b42f6e9..b115ed815db9 100644 --- a/sound/soc/codecs/wm8731.c +++ b/sound/soc/codecs/wm8731.c | |||
@@ -717,6 +717,8 @@ static int wm8731_i2c_probe(struct i2c_client *i2c, | |||
717 | if (wm8731 == NULL) | 717 | if (wm8731 == NULL) |
718 | return -ENOMEM; | 718 | return -ENOMEM; |
719 | 719 | ||
720 | mutex_init(&wm8731->lock); | ||
721 | |||
720 | wm8731->regmap = devm_regmap_init_i2c(i2c, &wm8731_regmap); | 722 | wm8731->regmap = devm_regmap_init_i2c(i2c, &wm8731_regmap); |
721 | if (IS_ERR(wm8731->regmap)) { | 723 | if (IS_ERR(wm8731->regmap)) { |
722 | ret = PTR_ERR(wm8731->regmap); | 724 | ret = PTR_ERR(wm8731->regmap); |
diff --git a/sound/soc/codecs/wm8750.c b/sound/soc/codecs/wm8750.c index f6847fdd6ddd..eb0a1644ba11 100644 --- a/sound/soc/codecs/wm8750.c +++ b/sound/soc/codecs/wm8750.c | |||
@@ -323,7 +323,7 @@ static const struct snd_soc_dapm_widget wm8750_dapm_widgets[] = { | |||
323 | SND_SOC_DAPM_OUTPUT("ROUT2"), | 323 | SND_SOC_DAPM_OUTPUT("ROUT2"), |
324 | SND_SOC_DAPM_OUTPUT("MONO1"), | 324 | SND_SOC_DAPM_OUTPUT("MONO1"), |
325 | SND_SOC_DAPM_OUTPUT("OUT3"), | 325 | SND_SOC_DAPM_OUTPUT("OUT3"), |
326 | SND_SOC_DAPM_OUTPUT("VREF"), | 326 | SND_SOC_DAPM_VMID("VREF"), |
327 | 327 | ||
328 | SND_SOC_DAPM_INPUT("LINPUT1"), | 328 | SND_SOC_DAPM_INPUT("LINPUT1"), |
329 | SND_SOC_DAPM_INPUT("LINPUT2"), | 329 | SND_SOC_DAPM_INPUT("LINPUT2"), |
diff --git a/sound/soc/codecs/wm8904.c b/sound/soc/codecs/wm8904.c index 4d2d2b1380d5..75b87c5c0f04 100644 --- a/sound/soc/codecs/wm8904.c +++ b/sound/soc/codecs/wm8904.c | |||
@@ -1076,10 +1076,13 @@ static const struct snd_soc_dapm_route adc_intercon[] = { | |||
1076 | { "Right Capture PGA", NULL, "Right Capture Mux" }, | 1076 | { "Right Capture PGA", NULL, "Right Capture Mux" }, |
1077 | { "Right Capture PGA", NULL, "Right Capture Inverting Mux" }, | 1077 | { "Right Capture PGA", NULL, "Right Capture Inverting Mux" }, |
1078 | 1078 | ||
1079 | { "AIFOUTL", "Left", "ADCL" }, | 1079 | { "AIFOUTL Mux", "Left", "ADCL" }, |
1080 | { "AIFOUTL", "Right", "ADCR" }, | 1080 | { "AIFOUTL Mux", "Right", "ADCR" }, |
1081 | { "AIFOUTR", "Left", "ADCL" }, | 1081 | { "AIFOUTR Mux", "Left", "ADCL" }, |
1082 | { "AIFOUTR", "Right", "ADCR" }, | 1082 | { "AIFOUTR Mux", "Right", "ADCR" }, |
1083 | |||
1084 | { "AIFOUTL", NULL, "AIFOUTL Mux" }, | ||
1085 | { "AIFOUTR", NULL, "AIFOUTR Mux" }, | ||
1083 | 1086 | ||
1084 | { "ADCL", NULL, "CLK_DSP" }, | 1087 | { "ADCL", NULL, "CLK_DSP" }, |
1085 | { "ADCL", NULL, "Left Capture PGA" }, | 1088 | { "ADCL", NULL, "Left Capture PGA" }, |
@@ -1089,12 +1092,16 @@ static const struct snd_soc_dapm_route adc_intercon[] = { | |||
1089 | }; | 1092 | }; |
1090 | 1093 | ||
1091 | static const struct snd_soc_dapm_route dac_intercon[] = { | 1094 | static const struct snd_soc_dapm_route dac_intercon[] = { |
1092 | { "DACL", "Right", "AIFINR" }, | 1095 | { "DACL Mux", "Left", "AIFINL" }, |
1093 | { "DACL", "Left", "AIFINL" }, | 1096 | { "DACL Mux", "Right", "AIFINR" }, |
1097 | |||
1098 | { "DACR Mux", "Left", "AIFINL" }, | ||
1099 | { "DACR Mux", "Right", "AIFINR" }, | ||
1100 | |||
1101 | { "DACL", NULL, "DACL Mux" }, | ||
1094 | { "DACL", NULL, "CLK_DSP" }, | 1102 | { "DACL", NULL, "CLK_DSP" }, |
1095 | 1103 | ||
1096 | { "DACR", "Right", "AIFINR" }, | 1104 | { "DACR", NULL, "DACR Mux" }, |
1097 | { "DACR", "Left", "AIFINL" }, | ||
1098 | { "DACR", NULL, "CLK_DSP" }, | 1105 | { "DACR", NULL, "CLK_DSP" }, |
1099 | 1106 | ||
1100 | { "Charge pump", NULL, "SYSCLK" }, | 1107 | { "Charge pump", NULL, "SYSCLK" }, |
diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c index 031a1ae71d94..a96eb497a379 100644 --- a/sound/soc/codecs/wm8960.c +++ b/sound/soc/codecs/wm8960.c | |||
@@ -556,7 +556,7 @@ static struct { | |||
556 | { 22050, 2 }, | 556 | { 22050, 2 }, |
557 | { 24000, 2 }, | 557 | { 24000, 2 }, |
558 | { 16000, 3 }, | 558 | { 16000, 3 }, |
559 | { 11250, 4 }, | 559 | { 11025, 4 }, |
560 | { 12000, 4 }, | 560 | { 12000, 4 }, |
561 | { 8000, 5 }, | 561 | { 8000, 5 }, |
562 | }; | 562 | }; |
diff --git a/sound/soc/codecs/wm9705.c b/sound/soc/codecs/wm9705.c index 3eddb18fefd1..5cc457ef8894 100644 --- a/sound/soc/codecs/wm9705.c +++ b/sound/soc/codecs/wm9705.c | |||
@@ -344,23 +344,27 @@ static int wm9705_soc_probe(struct snd_soc_codec *codec) | |||
344 | struct snd_ac97 *ac97; | 344 | struct snd_ac97 *ac97; |
345 | int ret = 0; | 345 | int ret = 0; |
346 | 346 | ||
347 | ac97 = snd_soc_new_ac97_codec(codec); | 347 | ac97 = snd_soc_alloc_ac97_codec(codec); |
348 | if (IS_ERR(ac97)) { | 348 | if (IS_ERR(ac97)) { |
349 | ret = PTR_ERR(ac97); | 349 | ret = PTR_ERR(ac97); |
350 | dev_err(codec->dev, "Failed to register AC97 codec\n"); | 350 | dev_err(codec->dev, "Failed to register AC97 codec\n"); |
351 | return ret; | 351 | return ret; |
352 | } | 352 | } |
353 | 353 | ||
354 | snd_soc_codec_set_drvdata(codec, ac97); | ||
355 | |||
356 | ret = wm9705_reset(codec); | 354 | ret = wm9705_reset(codec); |
357 | if (ret) | 355 | if (ret) |
358 | goto reset_err; | 356 | goto err_put_device; |
357 | |||
358 | ret = device_add(&ac97->dev); | ||
359 | if (ret) | ||
360 | goto err_put_device; | ||
361 | |||
362 | snd_soc_codec_set_drvdata(codec, ac97); | ||
359 | 363 | ||
360 | return 0; | 364 | return 0; |
361 | 365 | ||
362 | reset_err: | 366 | err_put_device: |
363 | snd_soc_free_ac97_codec(ac97); | 367 | put_device(&ac97->dev); |
364 | return ret; | 368 | return ret; |
365 | } | 369 | } |
366 | 370 | ||
diff --git a/sound/soc/codecs/wm9712.c b/sound/soc/codecs/wm9712.c index e04643d2bb24..9517571e820d 100644 --- a/sound/soc/codecs/wm9712.c +++ b/sound/soc/codecs/wm9712.c | |||
@@ -666,7 +666,7 @@ static int wm9712_soc_probe(struct snd_soc_codec *codec) | |||
666 | struct wm9712_priv *wm9712 = snd_soc_codec_get_drvdata(codec); | 666 | struct wm9712_priv *wm9712 = snd_soc_codec_get_drvdata(codec); |
667 | int ret = 0; | 667 | int ret = 0; |
668 | 668 | ||
669 | wm9712->ac97 = snd_soc_new_ac97_codec(codec); | 669 | wm9712->ac97 = snd_soc_alloc_ac97_codec(codec); |
670 | if (IS_ERR(wm9712->ac97)) { | 670 | if (IS_ERR(wm9712->ac97)) { |
671 | ret = PTR_ERR(wm9712->ac97); | 671 | ret = PTR_ERR(wm9712->ac97); |
672 | dev_err(codec->dev, "Failed to register AC97 codec: %d\n", ret); | 672 | dev_err(codec->dev, "Failed to register AC97 codec: %d\n", ret); |
@@ -675,15 +675,19 @@ static int wm9712_soc_probe(struct snd_soc_codec *codec) | |||
675 | 675 | ||
676 | ret = wm9712_reset(codec, 0); | 676 | ret = wm9712_reset(codec, 0); |
677 | if (ret < 0) | 677 | if (ret < 0) |
678 | goto reset_err; | 678 | goto err_put_device; |
679 | |||
680 | ret = device_add(&wm9712->ac97->dev); | ||
681 | if (ret) | ||
682 | goto err_put_device; | ||
679 | 683 | ||
680 | /* set alc mux to none */ | 684 | /* set alc mux to none */ |
681 | ac97_write(codec, AC97_VIDEO, ac97_read(codec, AC97_VIDEO) | 0x3000); | 685 | ac97_write(codec, AC97_VIDEO, ac97_read(codec, AC97_VIDEO) | 0x3000); |
682 | 686 | ||
683 | return 0; | 687 | return 0; |
684 | 688 | ||
685 | reset_err: | 689 | err_put_device: |
686 | snd_soc_free_ac97_codec(wm9712->ac97); | 690 | put_device(&wm9712->ac97->dev); |
687 | return ret; | 691 | return ret; |
688 | } | 692 | } |
689 | 693 | ||
diff --git a/sound/soc/codecs/wm9713.c b/sound/soc/codecs/wm9713.c index 71b9d5b0734d..6ab1122a3872 100644 --- a/sound/soc/codecs/wm9713.c +++ b/sound/soc/codecs/wm9713.c | |||
@@ -1225,7 +1225,7 @@ static int wm9713_soc_probe(struct snd_soc_codec *codec) | |||
1225 | struct wm9713_priv *wm9713 = snd_soc_codec_get_drvdata(codec); | 1225 | struct wm9713_priv *wm9713 = snd_soc_codec_get_drvdata(codec); |
1226 | int ret = 0, reg; | 1226 | int ret = 0, reg; |
1227 | 1227 | ||
1228 | wm9713->ac97 = snd_soc_new_ac97_codec(codec); | 1228 | wm9713->ac97 = snd_soc_alloc_ac97_codec(codec); |
1229 | if (IS_ERR(wm9713->ac97)) | 1229 | if (IS_ERR(wm9713->ac97)) |
1230 | return PTR_ERR(wm9713->ac97); | 1230 | return PTR_ERR(wm9713->ac97); |
1231 | 1231 | ||
@@ -1234,7 +1234,11 @@ static int wm9713_soc_probe(struct snd_soc_codec *codec) | |||
1234 | wm9713_reset(codec, 0); | 1234 | wm9713_reset(codec, 0); |
1235 | ret = wm9713_reset(codec, 1); | 1235 | ret = wm9713_reset(codec, 1); |
1236 | if (ret < 0) | 1236 | if (ret < 0) |
1237 | goto reset_err; | 1237 | goto err_put_device; |
1238 | |||
1239 | ret = device_add(&wm9713->ac97->dev); | ||
1240 | if (ret) | ||
1241 | goto err_put_device; | ||
1238 | 1242 | ||
1239 | /* unmute the adc - move to kcontrol */ | 1243 | /* unmute the adc - move to kcontrol */ |
1240 | reg = ac97_read(codec, AC97_CD) & 0x7fff; | 1244 | reg = ac97_read(codec, AC97_CD) & 0x7fff; |
@@ -1242,8 +1246,8 @@ static int wm9713_soc_probe(struct snd_soc_codec *codec) | |||
1242 | 1246 | ||
1243 | return 0; | 1247 | return 0; |
1244 | 1248 | ||
1245 | reset_err: | 1249 | err_put_device: |
1246 | snd_soc_free_ac97_codec(wm9713->ac97); | 1250 | put_device(&wm9713->ac97->dev); |
1247 | return ret; | 1251 | return ret; |
1248 | } | 1252 | } |
1249 | 1253 | ||
diff --git a/sound/soc/dwc/designware_i2s.c b/sound/soc/dwc/designware_i2s.c index b93168d4f648..06d3a34ac90a 100644 --- a/sound/soc/dwc/designware_i2s.c +++ b/sound/soc/dwc/designware_i2s.c | |||
@@ -209,16 +209,9 @@ static int dw_i2s_hw_params(struct snd_pcm_substream *substream, | |||
209 | 209 | ||
210 | switch (config->chan_nr) { | 210 | switch (config->chan_nr) { |
211 | case EIGHT_CHANNEL_SUPPORT: | 211 | case EIGHT_CHANNEL_SUPPORT: |
212 | ch_reg = 3; | ||
213 | break; | ||
214 | case SIX_CHANNEL_SUPPORT: | 212 | case SIX_CHANNEL_SUPPORT: |
215 | ch_reg = 2; | ||
216 | break; | ||
217 | case FOUR_CHANNEL_SUPPORT: | 213 | case FOUR_CHANNEL_SUPPORT: |
218 | ch_reg = 1; | ||
219 | break; | ||
220 | case TWO_CHANNEL_SUPPORT: | 214 | case TWO_CHANNEL_SUPPORT: |
221 | ch_reg = 0; | ||
222 | break; | 215 | break; |
223 | default: | 216 | default: |
224 | dev_err(dev->dev, "channel not supported\n"); | 217 | dev_err(dev->dev, "channel not supported\n"); |
@@ -227,18 +220,22 @@ static int dw_i2s_hw_params(struct snd_pcm_substream *substream, | |||
227 | 220 | ||
228 | i2s_disable_channels(dev, substream->stream); | 221 | i2s_disable_channels(dev, substream->stream); |
229 | 222 | ||
230 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { | 223 | for (ch_reg = 0; ch_reg < (config->chan_nr / 2); ch_reg++) { |
231 | i2s_write_reg(dev->i2s_base, TCR(ch_reg), xfer_resolution); | 224 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
232 | i2s_write_reg(dev->i2s_base, TFCR(ch_reg), 0x02); | 225 | i2s_write_reg(dev->i2s_base, TCR(ch_reg), |
233 | irq = i2s_read_reg(dev->i2s_base, IMR(ch_reg)); | 226 | xfer_resolution); |
234 | i2s_write_reg(dev->i2s_base, IMR(ch_reg), irq & ~0x30); | 227 | i2s_write_reg(dev->i2s_base, TFCR(ch_reg), 0x02); |
235 | i2s_write_reg(dev->i2s_base, TER(ch_reg), 1); | 228 | irq = i2s_read_reg(dev->i2s_base, IMR(ch_reg)); |
236 | } else { | 229 | i2s_write_reg(dev->i2s_base, IMR(ch_reg), irq & ~0x30); |
237 | i2s_write_reg(dev->i2s_base, RCR(ch_reg), xfer_resolution); | 230 | i2s_write_reg(dev->i2s_base, TER(ch_reg), 1); |
238 | i2s_write_reg(dev->i2s_base, RFCR(ch_reg), 0x07); | 231 | } else { |
239 | irq = i2s_read_reg(dev->i2s_base, IMR(ch_reg)); | 232 | i2s_write_reg(dev->i2s_base, RCR(ch_reg), |
240 | i2s_write_reg(dev->i2s_base, IMR(ch_reg), irq & ~0x03); | 233 | xfer_resolution); |
241 | i2s_write_reg(dev->i2s_base, RER(ch_reg), 1); | 234 | i2s_write_reg(dev->i2s_base, RFCR(ch_reg), 0x07); |
235 | irq = i2s_read_reg(dev->i2s_base, IMR(ch_reg)); | ||
236 | i2s_write_reg(dev->i2s_base, IMR(ch_reg), irq & ~0x03); | ||
237 | i2s_write_reg(dev->i2s_base, RER(ch_reg), 1); | ||
238 | } | ||
242 | } | 239 | } |
243 | 240 | ||
244 | i2s_write_reg(dev->i2s_base, CCR, ccr); | 241 | i2s_write_reg(dev->i2s_base, CCR, ccr); |
@@ -263,6 +260,19 @@ static void dw_i2s_shutdown(struct snd_pcm_substream *substream, | |||
263 | snd_soc_dai_set_dma_data(dai, substream, NULL); | 260 | snd_soc_dai_set_dma_data(dai, substream, NULL); |
264 | } | 261 | } |
265 | 262 | ||
263 | static int dw_i2s_prepare(struct snd_pcm_substream *substream, | ||
264 | struct snd_soc_dai *dai) | ||
265 | { | ||
266 | struct dw_i2s_dev *dev = snd_soc_dai_get_drvdata(dai); | ||
267 | |||
268 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | ||
269 | i2s_write_reg(dev->i2s_base, TXFFR, 1); | ||
270 | else | ||
271 | i2s_write_reg(dev->i2s_base, RXFFR, 1); | ||
272 | |||
273 | return 0; | ||
274 | } | ||
275 | |||
266 | static int dw_i2s_trigger(struct snd_pcm_substream *substream, | 276 | static int dw_i2s_trigger(struct snd_pcm_substream *substream, |
267 | int cmd, struct snd_soc_dai *dai) | 277 | int cmd, struct snd_soc_dai *dai) |
268 | { | 278 | { |
@@ -294,6 +304,7 @@ static struct snd_soc_dai_ops dw_i2s_dai_ops = { | |||
294 | .startup = dw_i2s_startup, | 304 | .startup = dw_i2s_startup, |
295 | .shutdown = dw_i2s_shutdown, | 305 | .shutdown = dw_i2s_shutdown, |
296 | .hw_params = dw_i2s_hw_params, | 306 | .hw_params = dw_i2s_hw_params, |
307 | .prepare = dw_i2s_prepare, | ||
297 | .trigger = dw_i2s_trigger, | 308 | .trigger = dw_i2s_trigger, |
298 | }; | 309 | }; |
299 | 310 | ||
@@ -324,13 +335,47 @@ static int dw_i2s_resume(struct snd_soc_dai *dai) | |||
324 | #define dw_i2s_resume NULL | 335 | #define dw_i2s_resume NULL |
325 | #endif | 336 | #endif |
326 | 337 | ||
338 | static void dw_configure_dai_by_pd(struct dw_i2s_dev *dev, | ||
339 | struct snd_soc_dai_driver *dw_i2s_dai, | ||
340 | struct resource *res, | ||
341 | const struct i2s_platform_data *pdata) | ||
342 | { | ||
343 | /* Set DMA slaves info */ | ||
344 | |||
345 | dev->play_dma_data.data = pdata->play_dma_data; | ||
346 | dev->capture_dma_data.data = pdata->capture_dma_data; | ||
347 | dev->play_dma_data.addr = res->start + I2S_TXDMA; | ||
348 | dev->capture_dma_data.addr = res->start + I2S_RXDMA; | ||
349 | dev->play_dma_data.max_burst = 16; | ||
350 | dev->capture_dma_data.max_burst = 16; | ||
351 | dev->play_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES; | ||
352 | dev->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES; | ||
353 | dev->play_dma_data.filter = pdata->filter; | ||
354 | dev->capture_dma_data.filter = pdata->filter; | ||
355 | |||
356 | if (pdata->cap & DWC_I2S_PLAY) { | ||
357 | dev_dbg(dev->dev, " designware: play supported\n"); | ||
358 | dw_i2s_dai->playback.channels_min = MIN_CHANNEL_NUM; | ||
359 | dw_i2s_dai->playback.channels_max = pdata->channel; | ||
360 | dw_i2s_dai->playback.formats = pdata->snd_fmts; | ||
361 | dw_i2s_dai->playback.rates = pdata->snd_rates; | ||
362 | } | ||
363 | |||
364 | if (pdata->cap & DWC_I2S_RECORD) { | ||
365 | dev_dbg(dev->dev, "designware: record supported\n"); | ||
366 | dw_i2s_dai->capture.channels_min = MIN_CHANNEL_NUM; | ||
367 | dw_i2s_dai->capture.channels_max = pdata->channel; | ||
368 | dw_i2s_dai->capture.formats = pdata->snd_fmts; | ||
369 | dw_i2s_dai->capture.rates = pdata->snd_rates; | ||
370 | } | ||
371 | } | ||
372 | |||
327 | static int dw_i2s_probe(struct platform_device *pdev) | 373 | static int dw_i2s_probe(struct platform_device *pdev) |
328 | { | 374 | { |
329 | const struct i2s_platform_data *pdata = pdev->dev.platform_data; | 375 | const struct i2s_platform_data *pdata = pdev->dev.platform_data; |
330 | struct dw_i2s_dev *dev; | 376 | struct dw_i2s_dev *dev; |
331 | struct resource *res; | 377 | struct resource *res; |
332 | int ret; | 378 | int ret; |
333 | unsigned int cap; | ||
334 | struct snd_soc_dai_driver *dw_i2s_dai; | 379 | struct snd_soc_dai_driver *dw_i2s_dai; |
335 | 380 | ||
336 | if (!pdata) { | 381 | if (!pdata) { |
@@ -345,44 +390,23 @@ static int dw_i2s_probe(struct platform_device *pdev) | |||
345 | } | 390 | } |
346 | 391 | ||
347 | dw_i2s_dai = devm_kzalloc(&pdev->dev, sizeof(*dw_i2s_dai), GFP_KERNEL); | 392 | dw_i2s_dai = devm_kzalloc(&pdev->dev, sizeof(*dw_i2s_dai), GFP_KERNEL); |
348 | if (!dw_i2s_dai) { | 393 | if (!dw_i2s_dai) |
349 | dev_err(&pdev->dev, "mem allocation failed for dai driver\n"); | ||
350 | return -ENOMEM; | 394 | return -ENOMEM; |
351 | } | ||
352 | 395 | ||
353 | dw_i2s_dai->ops = &dw_i2s_dai_ops; | 396 | dw_i2s_dai->ops = &dw_i2s_dai_ops; |
354 | dw_i2s_dai->suspend = dw_i2s_suspend; | 397 | dw_i2s_dai->suspend = dw_i2s_suspend; |
355 | dw_i2s_dai->resume = dw_i2s_resume; | 398 | dw_i2s_dai->resume = dw_i2s_resume; |
356 | 399 | ||
357 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 400 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
358 | if (!res) { | ||
359 | dev_err(&pdev->dev, "no i2s resource defined\n"); | ||
360 | return -ENODEV; | ||
361 | } | ||
362 | |||
363 | dev->i2s_base = devm_ioremap_resource(&pdev->dev, res); | 401 | dev->i2s_base = devm_ioremap_resource(&pdev->dev, res); |
364 | if (IS_ERR(dev->i2s_base)) { | 402 | if (IS_ERR(dev->i2s_base)) |
365 | dev_err(&pdev->dev, "ioremap fail for i2s_region\n"); | ||
366 | return PTR_ERR(dev->i2s_base); | 403 | return PTR_ERR(dev->i2s_base); |
367 | } | ||
368 | |||
369 | cap = pdata->cap; | ||
370 | dev->capability = cap; | ||
371 | dev->i2s_clk_cfg = pdata->i2s_clk_cfg; | ||
372 | 404 | ||
373 | /* Set DMA slaves info */ | 405 | dev->dev = &pdev->dev; |
374 | 406 | dw_configure_dai_by_pd(dev, dw_i2s_dai, res, pdata); | |
375 | dev->play_dma_data.data = pdata->play_dma_data; | ||
376 | dev->capture_dma_data.data = pdata->capture_dma_data; | ||
377 | dev->play_dma_data.addr = res->start + I2S_TXDMA; | ||
378 | dev->capture_dma_data.addr = res->start + I2S_RXDMA; | ||
379 | dev->play_dma_data.max_burst = 16; | ||
380 | dev->capture_dma_data.max_burst = 16; | ||
381 | dev->play_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES; | ||
382 | dev->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES; | ||
383 | dev->play_dma_data.filter = pdata->filter; | ||
384 | dev->capture_dma_data.filter = pdata->filter; | ||
385 | 407 | ||
408 | dev->capability = pdata->cap; | ||
409 | dev->i2s_clk_cfg = pdata->i2s_clk_cfg; | ||
386 | dev->clk = clk_get(&pdev->dev, NULL); | 410 | dev->clk = clk_get(&pdev->dev, NULL); |
387 | if (IS_ERR(dev->clk)) | 411 | if (IS_ERR(dev->clk)) |
388 | return PTR_ERR(dev->clk); | 412 | return PTR_ERR(dev->clk); |
@@ -391,23 +415,6 @@ static int dw_i2s_probe(struct platform_device *pdev) | |||
391 | if (ret < 0) | 415 | if (ret < 0) |
392 | goto err_clk_put; | 416 | goto err_clk_put; |
393 | 417 | ||
394 | if (cap & DWC_I2S_PLAY) { | ||
395 | dev_dbg(&pdev->dev, " designware: play supported\n"); | ||
396 | dw_i2s_dai->playback.channels_min = MIN_CHANNEL_NUM; | ||
397 | dw_i2s_dai->playback.channels_max = pdata->channel; | ||
398 | dw_i2s_dai->playback.formats = pdata->snd_fmts; | ||
399 | dw_i2s_dai->playback.rates = pdata->snd_rates; | ||
400 | } | ||
401 | |||
402 | if (cap & DWC_I2S_RECORD) { | ||
403 | dev_dbg(&pdev->dev, "designware: record supported\n"); | ||
404 | dw_i2s_dai->capture.channels_min = MIN_CHANNEL_NUM; | ||
405 | dw_i2s_dai->capture.channels_max = pdata->channel; | ||
406 | dw_i2s_dai->capture.formats = pdata->snd_fmts; | ||
407 | dw_i2s_dai->capture.rates = pdata->snd_rates; | ||
408 | } | ||
409 | |||
410 | dev->dev = &pdev->dev; | ||
411 | dev_set_drvdata(&pdev->dev, dev); | 418 | dev_set_drvdata(&pdev->dev, dev); |
412 | ret = snd_soc_register_component(&pdev->dev, &dw_i2s_component, | 419 | ret = snd_soc_register_component(&pdev->dev, &dw_i2s_component, |
413 | dw_i2s_dai, 1); | 420 | dw_i2s_dai, 1); |
diff --git a/sound/soc/fsl/fsl_esai.h b/sound/soc/fsl/fsl_esai.h index 91a550f4a10d..5e793bbb6b02 100644 --- a/sound/soc/fsl/fsl_esai.h +++ b/sound/soc/fsl/fsl_esai.h | |||
@@ -302,7 +302,7 @@ | |||
302 | #define ESAI_xCCR_xFP_MASK (((1 << ESAI_xCCR_xFP_WIDTH) - 1) << ESAI_xCCR_xFP_SHIFT) | 302 | #define ESAI_xCCR_xFP_MASK (((1 << ESAI_xCCR_xFP_WIDTH) - 1) << ESAI_xCCR_xFP_SHIFT) |
303 | #define ESAI_xCCR_xFP(v) ((((v) - 1) << ESAI_xCCR_xFP_SHIFT) & ESAI_xCCR_xFP_MASK) | 303 | #define ESAI_xCCR_xFP(v) ((((v) - 1) << ESAI_xCCR_xFP_SHIFT) & ESAI_xCCR_xFP_MASK) |
304 | #define ESAI_xCCR_xDC_SHIFT 9 | 304 | #define ESAI_xCCR_xDC_SHIFT 9 |
305 | #define ESAI_xCCR_xDC_WIDTH 4 | 305 | #define ESAI_xCCR_xDC_WIDTH 5 |
306 | #define ESAI_xCCR_xDC_MASK (((1 << ESAI_xCCR_xDC_WIDTH) - 1) << ESAI_xCCR_xDC_SHIFT) | 306 | #define ESAI_xCCR_xDC_MASK (((1 << ESAI_xCCR_xDC_WIDTH) - 1) << ESAI_xCCR_xDC_SHIFT) |
307 | #define ESAI_xCCR_xDC(v) ((((v) - 1) << ESAI_xCCR_xDC_SHIFT) & ESAI_xCCR_xDC_MASK) | 307 | #define ESAI_xCCR_xDC(v) ((((v) - 1) << ESAI_xCCR_xDC_SHIFT) & ESAI_xCCR_xDC_MASK) |
308 | #define ESAI_xCCR_xPSR_SHIFT 8 | 308 | #define ESAI_xCCR_xPSR_SHIFT 8 |
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c index a65f17d57ffb..059496ed9ad7 100644 --- a/sound/soc/fsl/fsl_ssi.c +++ b/sound/soc/fsl/fsl_ssi.c | |||
@@ -1362,9 +1362,9 @@ static int fsl_ssi_probe(struct platform_device *pdev) | |||
1362 | } | 1362 | } |
1363 | 1363 | ||
1364 | ssi_private->irq = platform_get_irq(pdev, 0); | 1364 | ssi_private->irq = platform_get_irq(pdev, 0); |
1365 | if (!ssi_private->irq) { | 1365 | if (ssi_private->irq < 0) { |
1366 | dev_err(&pdev->dev, "no irq for node %s\n", np->full_name); | 1366 | dev_err(&pdev->dev, "no irq for node %s\n", np->full_name); |
1367 | return -ENXIO; | 1367 | return ssi_private->irq; |
1368 | } | 1368 | } |
1369 | 1369 | ||
1370 | /* Are the RX and the TX clocks locked? */ | 1370 | /* Are the RX and the TX clocks locked? */ |
diff --git a/sound/soc/fsl/imx-wm8962.c b/sound/soc/fsl/imx-wm8962.c index 4caacb05a623..cd146d4fa805 100644 --- a/sound/soc/fsl/imx-wm8962.c +++ b/sound/soc/fsl/imx-wm8962.c | |||
@@ -257,6 +257,7 @@ static int imx_wm8962_probe(struct platform_device *pdev) | |||
257 | if (ret) | 257 | if (ret) |
258 | goto clk_fail; | 258 | goto clk_fail; |
259 | data->card.num_links = 1; | 259 | data->card.num_links = 1; |
260 | data->card.owner = THIS_MODULE; | ||
260 | data->card.dai_link = &data->dai; | 261 | data->card.dai_link = &data->dai; |
261 | data->card.dapm_widgets = imx_wm8962_dapm_widgets; | 262 | data->card.dapm_widgets = imx_wm8962_dapm_widgets; |
262 | data->card.num_dapm_widgets = ARRAY_SIZE(imx_wm8962_dapm_widgets); | 263 | data->card.num_dapm_widgets = ARRAY_SIZE(imx_wm8962_dapm_widgets); |
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index fb9240fdc9b7..7fe3009b1c43 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c | |||
@@ -452,9 +452,8 @@ static int asoc_simple_card_parse_of(struct device_node *node, | |||
452 | } | 452 | } |
453 | 453 | ||
454 | /* Decrease the reference count of the device nodes */ | 454 | /* Decrease the reference count of the device nodes */ |
455 | static int asoc_simple_card_unref(struct platform_device *pdev) | 455 | static int asoc_simple_card_unref(struct snd_soc_card *card) |
456 | { | 456 | { |
457 | struct snd_soc_card *card = platform_get_drvdata(pdev); | ||
458 | struct snd_soc_dai_link *dai_link; | 457 | struct snd_soc_dai_link *dai_link; |
459 | int num_links; | 458 | int num_links; |
460 | 459 | ||
@@ -556,7 +555,7 @@ static int asoc_simple_card_probe(struct platform_device *pdev) | |||
556 | return ret; | 555 | return ret; |
557 | 556 | ||
558 | err: | 557 | err: |
559 | asoc_simple_card_unref(pdev); | 558 | asoc_simple_card_unref(&priv->snd_card); |
560 | return ret; | 559 | return ret; |
561 | } | 560 | } |
562 | 561 | ||
@@ -572,7 +571,7 @@ static int asoc_simple_card_remove(struct platform_device *pdev) | |||
572 | snd_soc_jack_free_gpios(&simple_card_mic_jack, 1, | 571 | snd_soc_jack_free_gpios(&simple_card_mic_jack, 1, |
573 | &simple_card_mic_jack_gpio); | 572 | &simple_card_mic_jack_gpio); |
574 | 573 | ||
575 | return asoc_simple_card_unref(pdev); | 574 | return asoc_simple_card_unref(card); |
576 | } | 575 | } |
577 | 576 | ||
578 | static const struct of_device_id asoc_simple_of_match[] = { | 577 | static const struct of_device_id asoc_simple_of_match[] = { |
diff --git a/sound/soc/intel/Kconfig b/sound/soc/intel/Kconfig index e989ecf046c9..c0813f546d1f 100644 --- a/sound/soc/intel/Kconfig +++ b/sound/soc/intel/Kconfig | |||
@@ -46,7 +46,7 @@ config SND_SOC_INTEL_BAYTRAIL | |||
46 | 46 | ||
47 | config SND_SOC_INTEL_HASWELL_MACH | 47 | config SND_SOC_INTEL_HASWELL_MACH |
48 | tristate "ASoC Audio DSP support for Intel Haswell Lynxpoint" | 48 | tristate "ASoC Audio DSP support for Intel Haswell Lynxpoint" |
49 | depends on SND_SOC_INTEL_SST && X86_INTEL_LPSS && I2C && \\ | 49 | depends on SND_SOC_INTEL_SST && X86_INTEL_LPSS && I2C && \ |
50 | I2C_DESIGNWARE_PLATFORM | 50 | I2C_DESIGNWARE_PLATFORM |
51 | select SND_SOC_INTEL_HASWELL | 51 | select SND_SOC_INTEL_HASWELL |
52 | select SND_SOC_RT5640 | 52 | select SND_SOC_RT5640 |
@@ -76,7 +76,7 @@ config SND_SOC_INTEL_BYT_MAX98090_MACH | |||
76 | 76 | ||
77 | config SND_SOC_INTEL_BROADWELL_MACH | 77 | config SND_SOC_INTEL_BROADWELL_MACH |
78 | tristate "ASoC Audio DSP support for Intel Broadwell Wildcatpoint" | 78 | tristate "ASoC Audio DSP support for Intel Broadwell Wildcatpoint" |
79 | depends on SND_SOC_INTEL_SST && X86_INTEL_LPSS && DW_DMAC && \\ | 79 | depends on SND_SOC_INTEL_SST && X86_INTEL_LPSS && DW_DMAC && \ |
80 | I2C_DESIGNWARE_PLATFORM | 80 | I2C_DESIGNWARE_PLATFORM |
81 | select SND_SOC_INTEL_HASWELL | 81 | select SND_SOC_INTEL_HASWELL |
82 | select SND_COMPRESS_OFFLOAD | 82 | select SND_COMPRESS_OFFLOAD |
@@ -89,7 +89,7 @@ config SND_SOC_INTEL_BROADWELL_MACH | |||
89 | 89 | ||
90 | config SND_SOC_INTEL_BYTCR_RT5640_MACH | 90 | config SND_SOC_INTEL_BYTCR_RT5640_MACH |
91 | tristate "ASoC Audio DSP Support for MID BYT Platform" | 91 | tristate "ASoC Audio DSP Support for MID BYT Platform" |
92 | depends on X86 | 92 | depends on X86 && I2C |
93 | select SND_SOC_RT5640 | 93 | select SND_SOC_RT5640 |
94 | select SND_SST_MFLD_PLATFORM | 94 | select SND_SST_MFLD_PLATFORM |
95 | select SND_SST_IPC_ACPI | 95 | select SND_SST_IPC_ACPI |
@@ -101,7 +101,7 @@ config SND_SOC_INTEL_BYTCR_RT5640_MACH | |||
101 | 101 | ||
102 | config SND_SOC_INTEL_CHT_BSW_RT5672_MACH | 102 | config SND_SOC_INTEL_CHT_BSW_RT5672_MACH |
103 | tristate "ASoC Audio driver for Intel Cherrytrail & Braswell with RT5672 codec" | 103 | tristate "ASoC Audio driver for Intel Cherrytrail & Braswell with RT5672 codec" |
104 | depends on X86_INTEL_LPSS | 104 | depends on X86_INTEL_LPSS && I2C |
105 | select SND_SOC_RT5670 | 105 | select SND_SOC_RT5670 |
106 | select SND_SST_MFLD_PLATFORM | 106 | select SND_SST_MFLD_PLATFORM |
107 | select SND_SST_IPC_ACPI | 107 | select SND_SST_IPC_ACPI |
diff --git a/sound/soc/intel/bytcr_dpcm_rt5640.c b/sound/soc/intel/bytcr_dpcm_rt5640.c index f5d0fc1ab10c..59308629043e 100644 --- a/sound/soc/intel/bytcr_dpcm_rt5640.c +++ b/sound/soc/intel/bytcr_dpcm_rt5640.c | |||
@@ -215,7 +215,6 @@ static int snd_byt_mc_probe(struct platform_device *pdev) | |||
215 | 215 | ||
216 | static struct platform_driver snd_byt_mc_driver = { | 216 | static struct platform_driver snd_byt_mc_driver = { |
217 | .driver = { | 217 | .driver = { |
218 | .owner = THIS_MODULE, | ||
219 | .name = "bytt100_rt5640", | 218 | .name = "bytt100_rt5640", |
220 | .pm = &snd_soc_pm_ops, | 219 | .pm = &snd_soc_pm_ops, |
221 | }, | 220 | }, |
@@ -227,4 +226,4 @@ module_platform_driver(snd_byt_mc_driver); | |||
227 | MODULE_DESCRIPTION("ASoC Intel(R) Baytrail CR Machine driver"); | 226 | MODULE_DESCRIPTION("ASoC Intel(R) Baytrail CR Machine driver"); |
228 | MODULE_AUTHOR("Subhransu S. Prusty <subhransu.s.prusty@intel.com>"); | 227 | MODULE_AUTHOR("Subhransu S. Prusty <subhransu.s.prusty@intel.com>"); |
229 | MODULE_LICENSE("GPL v2"); | 228 | MODULE_LICENSE("GPL v2"); |
230 | MODULE_ALIAS("platform:bytrt5640-audio"); | 229 | MODULE_ALIAS("platform:bytt100_rt5640"); |
diff --git a/sound/soc/intel/cht_bsw_rt5672.c b/sound/soc/intel/cht_bsw_rt5672.c index 9b8b561171b7..a406c6104897 100644 --- a/sound/soc/intel/cht_bsw_rt5672.c +++ b/sound/soc/intel/cht_bsw_rt5672.c | |||
@@ -270,7 +270,6 @@ static int snd_cht_mc_probe(struct platform_device *pdev) | |||
270 | 270 | ||
271 | static struct platform_driver snd_cht_mc_driver = { | 271 | static struct platform_driver snd_cht_mc_driver = { |
272 | .driver = { | 272 | .driver = { |
273 | .owner = THIS_MODULE, | ||
274 | .name = "cht-bsw-rt5672", | 273 | .name = "cht-bsw-rt5672", |
275 | .pm = &snd_soc_pm_ops, | 274 | .pm = &snd_soc_pm_ops, |
276 | }, | 275 | }, |
diff --git a/sound/soc/intel/sst-firmware.c b/sound/soc/intel/sst-firmware.c index 4a5bde9c686b..a2ae2c5f2e9f 100644 --- a/sound/soc/intel/sst-firmware.c +++ b/sound/soc/intel/sst-firmware.c | |||
@@ -497,6 +497,7 @@ struct sst_module *sst_module_new(struct sst_fw *sst_fw, | |||
497 | sst_module->sst_fw = sst_fw; | 497 | sst_module->sst_fw = sst_fw; |
498 | sst_module->scratch_size = template->scratch_size; | 498 | sst_module->scratch_size = template->scratch_size; |
499 | sst_module->persistent_size = template->persistent_size; | 499 | sst_module->persistent_size = template->persistent_size; |
500 | sst_module->entry = template->entry; | ||
500 | 501 | ||
501 | INIT_LIST_HEAD(&sst_module->block_list); | 502 | INIT_LIST_HEAD(&sst_module->block_list); |
502 | INIT_LIST_HEAD(&sst_module->runtime_list); | 503 | INIT_LIST_HEAD(&sst_module->runtime_list); |
@@ -706,6 +707,7 @@ static int block_alloc_fixed(struct sst_dsp *dsp, struct sst_block_allocator *ba | |||
706 | struct list_head *block_list) | 707 | struct list_head *block_list) |
707 | { | 708 | { |
708 | struct sst_mem_block *block, *tmp; | 709 | struct sst_mem_block *block, *tmp; |
710 | struct sst_block_allocator ba_tmp = *ba; | ||
709 | u32 end = ba->offset + ba->size, block_end; | 711 | u32 end = ba->offset + ba->size, block_end; |
710 | int err; | 712 | int err; |
711 | 713 | ||
@@ -730,9 +732,9 @@ static int block_alloc_fixed(struct sst_dsp *dsp, struct sst_block_allocator *ba | |||
730 | if (ba->offset >= block->offset && ba->offset < block_end) { | 732 | if (ba->offset >= block->offset && ba->offset < block_end) { |
731 | 733 | ||
732 | /* align ba to block boundary */ | 734 | /* align ba to block boundary */ |
733 | ba->size -= block_end - ba->offset; | 735 | ba_tmp.size -= block_end - ba->offset; |
734 | ba->offset = block_end; | 736 | ba_tmp.offset = block_end; |
735 | err = block_alloc_contiguous(dsp, ba, block_list); | 737 | err = block_alloc_contiguous(dsp, &ba_tmp, block_list); |
736 | if (err < 0) | 738 | if (err < 0) |
737 | return -ENOMEM; | 739 | return -ENOMEM; |
738 | 740 | ||
@@ -763,10 +765,14 @@ static int block_alloc_fixed(struct sst_dsp *dsp, struct sst_block_allocator *ba | |||
763 | /* does block span more than 1 section */ | 765 | /* does block span more than 1 section */ |
764 | if (ba->offset >= block->offset && ba->offset < block_end) { | 766 | if (ba->offset >= block->offset && ba->offset < block_end) { |
765 | 767 | ||
768 | /* add block */ | ||
769 | list_move(&block->list, &dsp->used_block_list); | ||
770 | list_add(&block->module_list, block_list); | ||
766 | /* align ba to block boundary */ | 771 | /* align ba to block boundary */ |
767 | ba->offset = block->offset; | 772 | ba_tmp.size -= block_end - ba->offset; |
773 | ba_tmp.offset = block_end; | ||
768 | 774 | ||
769 | err = block_alloc_contiguous(dsp, ba, block_list); | 775 | err = block_alloc_contiguous(dsp, &ba_tmp, block_list); |
770 | if (err < 0) | 776 | if (err < 0) |
771 | return -ENOMEM; | 777 | return -ENOMEM; |
772 | 778 | ||
diff --git a/sound/soc/intel/sst-haswell-ipc.c b/sound/soc/intel/sst-haswell-ipc.c index 3f8c48231364..8156cc1accb7 100644 --- a/sound/soc/intel/sst-haswell-ipc.c +++ b/sound/soc/intel/sst-haswell-ipc.c | |||
@@ -651,11 +651,11 @@ static void hsw_notification_work(struct work_struct *work) | |||
651 | } | 651 | } |
652 | 652 | ||
653 | /* tell DSP that notification has been handled */ | 653 | /* tell DSP that notification has been handled */ |
654 | sst_dsp_shim_update_bits_unlocked(hsw->dsp, SST_IPCD, | 654 | sst_dsp_shim_update_bits(hsw->dsp, SST_IPCD, |
655 | SST_IPCD_BUSY | SST_IPCD_DONE, SST_IPCD_DONE); | 655 | SST_IPCD_BUSY | SST_IPCD_DONE, SST_IPCD_DONE); |
656 | 656 | ||
657 | /* unmask busy interrupt */ | 657 | /* unmask busy interrupt */ |
658 | sst_dsp_shim_update_bits_unlocked(hsw->dsp, SST_IMRX, SST_IMRX_BUSY, 0); | 658 | sst_dsp_shim_update_bits(hsw->dsp, SST_IMRX, SST_IMRX_BUSY, 0); |
659 | } | 659 | } |
660 | 660 | ||
661 | static struct ipc_message *reply_find_msg(struct sst_hsw *hsw, u32 header) | 661 | static struct ipc_message *reply_find_msg(struct sst_hsw *hsw, u32 header) |
@@ -1228,6 +1228,11 @@ int sst_hsw_stream_free(struct sst_hsw *hsw, struct sst_hsw_stream *stream) | |||
1228 | struct sst_dsp *sst = hsw->dsp; | 1228 | struct sst_dsp *sst = hsw->dsp; |
1229 | unsigned long flags; | 1229 | unsigned long flags; |
1230 | 1230 | ||
1231 | if (!stream) { | ||
1232 | dev_warn(hsw->dev, "warning: stream is NULL, no stream to free, ignore it.\n"); | ||
1233 | return 0; | ||
1234 | } | ||
1235 | |||
1231 | /* dont free DSP streams that are not commited */ | 1236 | /* dont free DSP streams that are not commited */ |
1232 | if (!stream->commited) | 1237 | if (!stream->commited) |
1233 | goto out; | 1238 | goto out; |
@@ -1415,6 +1420,16 @@ int sst_hsw_stream_commit(struct sst_hsw *hsw, struct sst_hsw_stream *stream) | |||
1415 | u32 header; | 1420 | u32 header; |
1416 | int ret; | 1421 | int ret; |
1417 | 1422 | ||
1423 | if (!stream) { | ||
1424 | dev_warn(hsw->dev, "warning: stream is NULL, no stream to commit, ignore it.\n"); | ||
1425 | return 0; | ||
1426 | } | ||
1427 | |||
1428 | if (stream->commited) { | ||
1429 | dev_warn(hsw->dev, "warning: stream is already committed, ignore it.\n"); | ||
1430 | return 0; | ||
1431 | } | ||
1432 | |||
1418 | trace_ipc_request("stream alloc", stream->host_id); | 1433 | trace_ipc_request("stream alloc", stream->host_id); |
1419 | 1434 | ||
1420 | header = IPC_GLB_TYPE(IPC_GLB_ALLOCATE_STREAM); | 1435 | header = IPC_GLB_TYPE(IPC_GLB_ALLOCATE_STREAM); |
@@ -1519,6 +1534,11 @@ int sst_hsw_stream_pause(struct sst_hsw *hsw, struct sst_hsw_stream *stream, | |||
1519 | { | 1534 | { |
1520 | int ret; | 1535 | int ret; |
1521 | 1536 | ||
1537 | if (!stream) { | ||
1538 | dev_warn(hsw->dev, "warning: stream is NULL, no stream to pause, ignore it.\n"); | ||
1539 | return 0; | ||
1540 | } | ||
1541 | |||
1522 | trace_ipc_request("stream pause", stream->reply.stream_hw_id); | 1542 | trace_ipc_request("stream pause", stream->reply.stream_hw_id); |
1523 | 1543 | ||
1524 | ret = sst_hsw_stream_operations(hsw, IPC_STR_PAUSE, | 1544 | ret = sst_hsw_stream_operations(hsw, IPC_STR_PAUSE, |
@@ -1535,6 +1555,11 @@ int sst_hsw_stream_resume(struct sst_hsw *hsw, struct sst_hsw_stream *stream, | |||
1535 | { | 1555 | { |
1536 | int ret; | 1556 | int ret; |
1537 | 1557 | ||
1558 | if (!stream) { | ||
1559 | dev_warn(hsw->dev, "warning: stream is NULL, no stream to resume, ignore it.\n"); | ||
1560 | return 0; | ||
1561 | } | ||
1562 | |||
1538 | trace_ipc_request("stream resume", stream->reply.stream_hw_id); | 1563 | trace_ipc_request("stream resume", stream->reply.stream_hw_id); |
1539 | 1564 | ||
1540 | ret = sst_hsw_stream_operations(hsw, IPC_STR_RESUME, | 1565 | ret = sst_hsw_stream_operations(hsw, IPC_STR_RESUME, |
@@ -1550,6 +1575,11 @@ int sst_hsw_stream_reset(struct sst_hsw *hsw, struct sst_hsw_stream *stream) | |||
1550 | { | 1575 | { |
1551 | int ret, tries = 10; | 1576 | int ret, tries = 10; |
1552 | 1577 | ||
1578 | if (!stream) { | ||
1579 | dev_warn(hsw->dev, "warning: stream is NULL, no stream to reset, ignore it.\n"); | ||
1580 | return 0; | ||
1581 | } | ||
1582 | |||
1553 | /* dont reset streams that are not commited */ | 1583 | /* dont reset streams that are not commited */ |
1554 | if (!stream->commited) | 1584 | if (!stream->commited) |
1555 | return 0; | 1585 | return 0; |
diff --git a/sound/soc/intel/sst/sst.h b/sound/soc/intel/sst/sst.h index 7f4bbfcbc6f5..562bc483d6b7 100644 --- a/sound/soc/intel/sst/sst.h +++ b/sound/soc/intel/sst/sst.h | |||
@@ -58,6 +58,7 @@ enum sst_algo_ops { | |||
58 | #define SST_BLOCK_TIMEOUT 1000 | 58 | #define SST_BLOCK_TIMEOUT 1000 |
59 | 59 | ||
60 | #define FW_SIGNATURE_SIZE 4 | 60 | #define FW_SIGNATURE_SIZE 4 |
61 | #define FW_NAME_SIZE 32 | ||
61 | 62 | ||
62 | /* stream states */ | 63 | /* stream states */ |
63 | enum sst_stream_states { | 64 | enum sst_stream_states { |
@@ -426,7 +427,7 @@ struct intel_sst_drv { | |||
426 | * Holder for firmware name. Due to async call it needs to be | 427 | * Holder for firmware name. Due to async call it needs to be |
427 | * persistent till worker thread gets called | 428 | * persistent till worker thread gets called |
428 | */ | 429 | */ |
429 | char firmware_name[20]; | 430 | char firmware_name[FW_NAME_SIZE]; |
430 | }; | 431 | }; |
431 | 432 | ||
432 | /* misc definitions */ | 433 | /* misc definitions */ |
diff --git a/sound/soc/intel/sst/sst_acpi.c b/sound/soc/intel/sst/sst_acpi.c index 3abc29e8a928..e541d0e69ea2 100644 --- a/sound/soc/intel/sst/sst_acpi.c +++ b/sound/soc/intel/sst/sst_acpi.c | |||
@@ -47,7 +47,7 @@ struct sst_machines { | |||
47 | char board[32]; | 47 | char board[32]; |
48 | char machine[32]; | 48 | char machine[32]; |
49 | void (*machine_quirk)(void); | 49 | void (*machine_quirk)(void); |
50 | char firmware[32]; | 50 | char firmware[FW_NAME_SIZE]; |
51 | struct sst_platform_info *pdata; | 51 | struct sst_platform_info *pdata; |
52 | 52 | ||
53 | }; | 53 | }; |
@@ -245,7 +245,7 @@ static struct sst_machines *sst_acpi_find_machine( | |||
245 | return NULL; | 245 | return NULL; |
246 | } | 246 | } |
247 | 247 | ||
248 | int sst_acpi_probe(struct platform_device *pdev) | 248 | static int sst_acpi_probe(struct platform_device *pdev) |
249 | { | 249 | { |
250 | struct device *dev = &pdev->dev; | 250 | struct device *dev = &pdev->dev; |
251 | int ret = 0; | 251 | int ret = 0; |
@@ -332,7 +332,7 @@ do_sst_cleanup: | |||
332 | * This function is called by OS when a device is unloaded | 332 | * This function is called by OS when a device is unloaded |
333 | * This frees the interrupt etc | 333 | * This frees the interrupt etc |
334 | */ | 334 | */ |
335 | int sst_acpi_remove(struct platform_device *pdev) | 335 | static int sst_acpi_remove(struct platform_device *pdev) |
336 | { | 336 | { |
337 | struct intel_sst_drv *ctx; | 337 | struct intel_sst_drv *ctx; |
338 | 338 | ||
@@ -343,14 +343,14 @@ int sst_acpi_remove(struct platform_device *pdev) | |||
343 | } | 343 | } |
344 | 344 | ||
345 | static struct sst_machines sst_acpi_bytcr[] = { | 345 | static struct sst_machines sst_acpi_bytcr[] = { |
346 | {"10EC5640", "T100", "bytt100_rt5640", NULL, "fw_sst_0f28.bin", | 346 | {"10EC5640", "T100", "bytt100_rt5640", NULL, "intel/fw_sst_0f28.bin", |
347 | &byt_rvp_platform_data }, | 347 | &byt_rvp_platform_data }, |
348 | {}, | 348 | {}, |
349 | }; | 349 | }; |
350 | 350 | ||
351 | /* Cherryview-based platforms: CherryTrail and Braswell */ | 351 | /* Cherryview-based platforms: CherryTrail and Braswell */ |
352 | static struct sst_machines sst_acpi_chv[] = { | 352 | static struct sst_machines sst_acpi_chv[] = { |
353 | {"10EC5670", "cht-bsw", "cht-bsw-rt5672", NULL, "fw_sst_22a8.bin", | 353 | {"10EC5670", "cht-bsw", "cht-bsw-rt5672", NULL, "intel/fw_sst_22a8.bin", |
354 | &chv_platform_data }, | 354 | &chv_platform_data }, |
355 | {}, | 355 | {}, |
356 | }; | 356 | }; |
@@ -366,7 +366,6 @@ MODULE_DEVICE_TABLE(acpi, sst_acpi_ids); | |||
366 | static struct platform_driver sst_acpi_driver = { | 366 | static struct platform_driver sst_acpi_driver = { |
367 | .driver = { | 367 | .driver = { |
368 | .name = "intel_sst_acpi", | 368 | .name = "intel_sst_acpi", |
369 | .owner = THIS_MODULE, | ||
370 | .acpi_match_table = ACPI_PTR(sst_acpi_ids), | 369 | .acpi_match_table = ACPI_PTR(sst_acpi_ids), |
371 | .pm = &intel_sst_pm, | 370 | .pm = &intel_sst_pm, |
372 | }, | 371 | }, |
diff --git a/sound/soc/omap/omap-hdmi-audio.c b/sound/soc/omap/omap-hdmi-audio.c index 3f9ac7dbdc80..ccfb41c22e53 100644 --- a/sound/soc/omap/omap-hdmi-audio.c +++ b/sound/soc/omap/omap-hdmi-audio.c | |||
@@ -393,7 +393,6 @@ static int omap_hdmi_audio_remove(struct platform_device *pdev) | |||
393 | static struct platform_driver hdmi_audio_driver = { | 393 | static struct platform_driver hdmi_audio_driver = { |
394 | .driver = { | 394 | .driver = { |
395 | .name = DRV_NAME, | 395 | .name = DRV_NAME, |
396 | .owner = THIS_MODULE, | ||
397 | }, | 396 | }, |
398 | .probe = omap_hdmi_audio_probe, | 397 | .probe = omap_hdmi_audio_probe, |
399 | .remove = omap_hdmi_audio_remove, | 398 | .remove = omap_hdmi_audio_remove, |
diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c index 8b79cafab1e2..c7eb9dd67f60 100644 --- a/sound/soc/omap/omap-mcbsp.c +++ b/sound/soc/omap/omap-mcbsp.c | |||
@@ -434,7 +434,7 @@ static int omap_mcbsp_dai_set_dai_fmt(struct snd_soc_dai *cpu_dai, | |||
434 | case SND_SOC_DAIFMT_CBM_CFS: | 434 | case SND_SOC_DAIFMT_CBM_CFS: |
435 | /* McBSP slave. FS clock as output */ | 435 | /* McBSP slave. FS clock as output */ |
436 | regs->srgr2 |= FSGM; | 436 | regs->srgr2 |= FSGM; |
437 | regs->pcr0 |= FSXM; | 437 | regs->pcr0 |= FSXM | FSRM; |
438 | break; | 438 | break; |
439 | case SND_SOC_DAIFMT_CBM_CFM: | 439 | case SND_SOC_DAIFMT_CBM_CFM: |
440 | /* McBSP slave */ | 440 | /* McBSP slave */ |
diff --git a/sound/soc/pxa/spitz.c b/sound/soc/pxa/spitz.c index d7d5fb20ea6f..a6d680acd907 100644 --- a/sound/soc/pxa/spitz.c +++ b/sound/soc/pxa/spitz.c | |||
@@ -352,7 +352,6 @@ static int spitz_remove(struct platform_device *pdev) | |||
352 | static struct platform_driver spitz_driver = { | 352 | static struct platform_driver spitz_driver = { |
353 | .driver = { | 353 | .driver = { |
354 | .name = "spitz-audio", | 354 | .name = "spitz-audio", |
355 | .owner = THIS_MODULE, | ||
356 | .pm = &snd_soc_pm_ops, | 355 | .pm = &snd_soc_pm_ops, |
357 | }, | 356 | }, |
358 | .probe = spitz_probe, | 357 | .probe = spitz_probe, |
diff --git a/sound/soc/rockchip/rockchip_i2s.c b/sound/soc/rockchip/rockchip_i2s.c index 26ec5117b35c..acb5be53bfb4 100644 --- a/sound/soc/rockchip/rockchip_i2s.c +++ b/sound/soc/rockchip/rockchip_i2s.c | |||
@@ -247,6 +247,10 @@ static int rockchip_i2s_hw_params(struct snd_pcm_substream *substream, | |||
247 | 247 | ||
248 | regmap_update_bits(i2s->regmap, I2S_TXCR, I2S_TXCR_VDW_MASK, val); | 248 | regmap_update_bits(i2s->regmap, I2S_TXCR, I2S_TXCR_VDW_MASK, val); |
249 | regmap_update_bits(i2s->regmap, I2S_RXCR, I2S_RXCR_VDW_MASK, val); | 249 | regmap_update_bits(i2s->regmap, I2S_RXCR, I2S_RXCR_VDW_MASK, val); |
250 | regmap_update_bits(i2s->regmap, I2S_DMACR, I2S_DMACR_TDL_MASK, | ||
251 | I2S_DMACR_TDL(16)); | ||
252 | regmap_update_bits(i2s->regmap, I2S_DMACR, I2S_DMACR_RDL_MASK, | ||
253 | I2S_DMACR_RDL(16)); | ||
250 | 254 | ||
251 | return 0; | 255 | return 0; |
252 | } | 256 | } |
@@ -335,6 +339,7 @@ static struct snd_soc_dai_driver rockchip_i2s_dai = { | |||
335 | SNDRV_PCM_FMTBIT_S24_LE), | 339 | SNDRV_PCM_FMTBIT_S24_LE), |
336 | }, | 340 | }, |
337 | .ops = &rockchip_i2s_dai_ops, | 341 | .ops = &rockchip_i2s_dai_ops, |
342 | .symmetric_rates = 1, | ||
338 | }; | 343 | }; |
339 | 344 | ||
340 | static const struct snd_soc_component_driver rockchip_i2s_component = { | 345 | static const struct snd_soc_component_driver rockchip_i2s_component = { |
@@ -454,11 +459,11 @@ static int rockchip_i2s_probe(struct platform_device *pdev) | |||
454 | 459 | ||
455 | i2s->playback_dma_data.addr = res->start + I2S_TXDR; | 460 | i2s->playback_dma_data.addr = res->start + I2S_TXDR; |
456 | i2s->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; | 461 | i2s->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; |
457 | i2s->playback_dma_data.maxburst = 16; | 462 | i2s->playback_dma_data.maxburst = 4; |
458 | 463 | ||
459 | i2s->capture_dma_data.addr = res->start + I2S_RXDR; | 464 | i2s->capture_dma_data.addr = res->start + I2S_RXDR; |
460 | i2s->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; | 465 | i2s->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; |
461 | i2s->capture_dma_data.maxburst = 16; | 466 | i2s->capture_dma_data.maxburst = 4; |
462 | 467 | ||
463 | i2s->dev = &pdev->dev; | 468 | i2s->dev = &pdev->dev; |
464 | dev_set_drvdata(&pdev->dev, i2s); | 469 | dev_set_drvdata(&pdev->dev, i2s); |
diff --git a/sound/soc/rockchip/rockchip_i2s.h b/sound/soc/rockchip/rockchip_i2s.h index 89a5d8bc6ee7..93f456f518a9 100644 --- a/sound/soc/rockchip/rockchip_i2s.h +++ b/sound/soc/rockchip/rockchip_i2s.h | |||
@@ -127,7 +127,7 @@ | |||
127 | #define I2S_DMACR_TDE_DISABLE (0 << I2S_DMACR_TDE_SHIFT) | 127 | #define I2S_DMACR_TDE_DISABLE (0 << I2S_DMACR_TDE_SHIFT) |
128 | #define I2S_DMACR_TDE_ENABLE (1 << I2S_DMACR_TDE_SHIFT) | 128 | #define I2S_DMACR_TDE_ENABLE (1 << I2S_DMACR_TDE_SHIFT) |
129 | #define I2S_DMACR_TDL_SHIFT 0 | 129 | #define I2S_DMACR_TDL_SHIFT 0 |
130 | #define I2S_DMACR_TDL(x) ((x - 1) << I2S_DMACR_TDL_SHIFT) | 130 | #define I2S_DMACR_TDL(x) ((x) << I2S_DMACR_TDL_SHIFT) |
131 | #define I2S_DMACR_TDL_MASK (0x1f << I2S_DMACR_TDL_SHIFT) | 131 | #define I2S_DMACR_TDL_MASK (0x1f << I2S_DMACR_TDL_SHIFT) |
132 | 132 | ||
133 | /* | 133 | /* |
diff --git a/sound/soc/samsung/arndale_rt5631.c b/sound/soc/samsung/arndale_rt5631.c index 1e2b61ca8db2..8bf2e2c4bafb 100644 --- a/sound/soc/samsung/arndale_rt5631.c +++ b/sound/soc/samsung/arndale_rt5631.c | |||
@@ -135,7 +135,6 @@ MODULE_DEVICE_TABLE(of, samsung_arndale_rt5631_of_match); | |||
135 | static struct platform_driver arndale_audio_driver = { | 135 | static struct platform_driver arndale_audio_driver = { |
136 | .driver = { | 136 | .driver = { |
137 | .name = "arndale-audio", | 137 | .name = "arndale-audio", |
138 | .owner = THIS_MODULE, | ||
139 | .pm = &snd_soc_pm_ops, | 138 | .pm = &snd_soc_pm_ops, |
140 | .of_match_table = of_match_ptr(samsung_arndale_rt5631_of_match), | 139 | .of_match_table = of_match_ptr(samsung_arndale_rt5631_of_match), |
141 | }, | 140 | }, |
diff --git a/sound/soc/soc-ac97.c b/sound/soc/soc-ac97.c index 2e10e9a38376..08d7259bbaab 100644 --- a/sound/soc/soc-ac97.c +++ b/sound/soc/soc-ac97.c | |||
@@ -48,15 +48,18 @@ static void soc_ac97_device_release(struct device *dev) | |||
48 | } | 48 | } |
49 | 49 | ||
50 | /** | 50 | /** |
51 | * snd_soc_new_ac97_codec - initailise AC97 device | 51 | * snd_soc_alloc_ac97_codec() - Allocate new a AC'97 device |
52 | * @codec: audio codec | 52 | * @codec: The CODEC for which to create the AC'97 device |
53 | * | 53 | * |
54 | * Initialises AC97 codec resources for use by ad-hoc devices only. | 54 | * Allocated a new snd_ac97 device and intializes it, but does not yet register |
55 | * it. The caller is responsible to either call device_add(&ac97->dev) to | ||
56 | * register the device, or to call put_device(&ac97->dev) to free the device. | ||
57 | * | ||
58 | * Returns: A snd_ac97 device or a PTR_ERR in case of an error. | ||
55 | */ | 59 | */ |
56 | struct snd_ac97 *snd_soc_new_ac97_codec(struct snd_soc_codec *codec) | 60 | struct snd_ac97 *snd_soc_alloc_ac97_codec(struct snd_soc_codec *codec) |
57 | { | 61 | { |
58 | struct snd_ac97 *ac97; | 62 | struct snd_ac97 *ac97; |
59 | int ret; | ||
60 | 63 | ||
61 | ac97 = kzalloc(sizeof(struct snd_ac97), GFP_KERNEL); | 64 | ac97 = kzalloc(sizeof(struct snd_ac97), GFP_KERNEL); |
62 | if (ac97 == NULL) | 65 | if (ac97 == NULL) |
@@ -73,7 +76,28 @@ struct snd_ac97 *snd_soc_new_ac97_codec(struct snd_soc_codec *codec) | |||
73 | codec->component.card->snd_card->number, 0, | 76 | codec->component.card->snd_card->number, 0, |
74 | codec->component.name); | 77 | codec->component.name); |
75 | 78 | ||
76 | ret = device_register(&ac97->dev); | 79 | device_initialize(&ac97->dev); |
80 | |||
81 | return ac97; | ||
82 | } | ||
83 | EXPORT_SYMBOL(snd_soc_alloc_ac97_codec); | ||
84 | |||
85 | /** | ||
86 | * snd_soc_new_ac97_codec - initailise AC97 device | ||
87 | * @codec: audio codec | ||
88 | * | ||
89 | * Initialises AC97 codec resources for use by ad-hoc devices only. | ||
90 | */ | ||
91 | struct snd_ac97 *snd_soc_new_ac97_codec(struct snd_soc_codec *codec) | ||
92 | { | ||
93 | struct snd_ac97 *ac97; | ||
94 | int ret; | ||
95 | |||
96 | ac97 = snd_soc_alloc_ac97_codec(codec); | ||
97 | if (IS_ERR(ac97)) | ||
98 | return ac97; | ||
99 | |||
100 | ret = device_add(&ac97->dev); | ||
77 | if (ret) { | 101 | if (ret) { |
78 | put_device(&ac97->dev); | 102 | put_device(&ac97->dev); |
79 | return ERR_PTR(ret); | 103 | return ERR_PTR(ret); |
diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c index 590a82f01d0b..025c38fbe3c0 100644 --- a/sound/soc/soc-compress.c +++ b/sound/soc/soc-compress.c | |||
@@ -659,7 +659,8 @@ int soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num) | |||
659 | rtd->dai_link->stream_name); | 659 | rtd->dai_link->stream_name); |
660 | 660 | ||
661 | ret = snd_pcm_new_internal(rtd->card->snd_card, new_name, num, | 661 | ret = snd_pcm_new_internal(rtd->card->snd_card, new_name, num, |
662 | 1, 0, &be_pcm); | 662 | rtd->dai_link->dpcm_playback, |
663 | rtd->dai_link->dpcm_capture, &be_pcm); | ||
663 | if (ret < 0) { | 664 | if (ret < 0) { |
664 | dev_err(rtd->card->dev, "ASoC: can't create compressed for %s\n", | 665 | dev_err(rtd->card->dev, "ASoC: can't create compressed for %s\n", |
665 | rtd->dai_link->name); | 666 | rtd->dai_link->name); |
@@ -668,8 +669,10 @@ int soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num) | |||
668 | 669 | ||
669 | rtd->pcm = be_pcm; | 670 | rtd->pcm = be_pcm; |
670 | rtd->fe_compr = 1; | 671 | rtd->fe_compr = 1; |
671 | be_pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream->private_data = rtd; | 672 | if (rtd->dai_link->dpcm_playback) |
672 | be_pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream->private_data = rtd; | 673 | be_pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream->private_data = rtd; |
674 | else if (rtd->dai_link->dpcm_capture) | ||
675 | be_pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream->private_data = rtd; | ||
673 | memcpy(compr->ops, &soc_compr_dyn_ops, sizeof(soc_compr_dyn_ops)); | 676 | memcpy(compr->ops, &soc_compr_dyn_ops, sizeof(soc_compr_dyn_ops)); |
674 | } else | 677 | } else |
675 | memcpy(compr->ops, &soc_compr_ops, sizeof(soc_compr_ops)); | 678 | memcpy(compr->ops, &soc_compr_ops, sizeof(soc_compr_ops)); |
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 985052b3fbed..c024962ba500 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -1626,9 +1626,6 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card) | |||
1626 | } | 1626 | } |
1627 | } | 1627 | } |
1628 | 1628 | ||
1629 | if (card->fully_routed) | ||
1630 | snd_soc_dapm_auto_nc_pins(card); | ||
1631 | |||
1632 | snd_soc_dapm_new_widgets(card); | 1629 | snd_soc_dapm_new_widgets(card); |
1633 | 1630 | ||
1634 | ret = snd_card_register(card->snd_card); | 1631 | ret = snd_card_register(card->snd_card); |
@@ -3230,7 +3227,7 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card, | |||
3230 | const char *propname) | 3227 | const char *propname) |
3231 | { | 3228 | { |
3232 | struct device_node *np = card->dev->of_node; | 3229 | struct device_node *np = card->dev->of_node; |
3233 | int num_routes, old_routes; | 3230 | int num_routes; |
3234 | struct snd_soc_dapm_route *routes; | 3231 | struct snd_soc_dapm_route *routes; |
3235 | int i, ret; | 3232 | int i, ret; |
3236 | 3233 | ||
@@ -3248,9 +3245,7 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card, | |||
3248 | return -EINVAL; | 3245 | return -EINVAL; |
3249 | } | 3246 | } |
3250 | 3247 | ||
3251 | old_routes = card->num_dapm_routes; | 3248 | routes = devm_kzalloc(card->dev, num_routes * sizeof(*routes), |
3252 | routes = devm_kzalloc(card->dev, | ||
3253 | (old_routes + num_routes) * sizeof(*routes), | ||
3254 | GFP_KERNEL); | 3249 | GFP_KERNEL); |
3255 | if (!routes) { | 3250 | if (!routes) { |
3256 | dev_err(card->dev, | 3251 | dev_err(card->dev, |
@@ -3258,11 +3253,9 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card, | |||
3258 | return -EINVAL; | 3253 | return -EINVAL; |
3259 | } | 3254 | } |
3260 | 3255 | ||
3261 | memcpy(routes, card->dapm_routes, old_routes * sizeof(*routes)); | ||
3262 | |||
3263 | for (i = 0; i < num_routes; i++) { | 3256 | for (i = 0; i < num_routes; i++) { |
3264 | ret = of_property_read_string_index(np, propname, | 3257 | ret = of_property_read_string_index(np, propname, |
3265 | 2 * i, &routes[old_routes + i].sink); | 3258 | 2 * i, &routes[i].sink); |
3266 | if (ret) { | 3259 | if (ret) { |
3267 | dev_err(card->dev, | 3260 | dev_err(card->dev, |
3268 | "ASoC: Property '%s' index %d could not be read: %d\n", | 3261 | "ASoC: Property '%s' index %d could not be read: %d\n", |
@@ -3270,7 +3263,7 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card, | |||
3270 | return -EINVAL; | 3263 | return -EINVAL; |
3271 | } | 3264 | } |
3272 | ret = of_property_read_string_index(np, propname, | 3265 | ret = of_property_read_string_index(np, propname, |
3273 | (2 * i) + 1, &routes[old_routes + i].source); | 3266 | (2 * i) + 1, &routes[i].source); |
3274 | if (ret) { | 3267 | if (ret) { |
3275 | dev_err(card->dev, | 3268 | dev_err(card->dev, |
3276 | "ASoC: Property '%s' index %d could not be read: %d\n", | 3269 | "ASoC: Property '%s' index %d could not be read: %d\n", |
@@ -3279,7 +3272,7 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card, | |||
3279 | } | 3272 | } |
3280 | } | 3273 | } |
3281 | 3274 | ||
3282 | card->num_dapm_routes += num_routes; | 3275 | card->num_dapm_routes = num_routes; |
3283 | card->dapm_routes = routes; | 3276 | card->dapm_routes = routes; |
3284 | 3277 | ||
3285 | return 0; | 3278 | return 0; |
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index c5136bb1f982..ea496842ee83 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -2279,6 +2279,9 @@ static void dapm_update_widget_flags(struct snd_soc_dapm_widget *w) | |||
2279 | 2279 | ||
2280 | switch (w->id) { | 2280 | switch (w->id) { |
2281 | case snd_soc_dapm_input: | 2281 | case snd_soc_dapm_input: |
2282 | /* On a fully routed card a input is never a source */ | ||
2283 | if (w->dapm->card->fully_routed) | ||
2284 | break; | ||
2282 | w->is_source = 1; | 2285 | w->is_source = 1; |
2283 | list_for_each_entry(p, &w->sources, list_sink) { | 2286 | list_for_each_entry(p, &w->sources, list_sink) { |
2284 | if (p->source->id == snd_soc_dapm_micbias || | 2287 | if (p->source->id == snd_soc_dapm_micbias || |
@@ -2291,6 +2294,9 @@ static void dapm_update_widget_flags(struct snd_soc_dapm_widget *w) | |||
2291 | } | 2294 | } |
2292 | break; | 2295 | break; |
2293 | case snd_soc_dapm_output: | 2296 | case snd_soc_dapm_output: |
2297 | /* On a fully routed card a output is never a sink */ | ||
2298 | if (w->dapm->card->fully_routed) | ||
2299 | break; | ||
2294 | w->is_sink = 1; | 2300 | w->is_sink = 1; |
2295 | list_for_each_entry(p, &w->sinks, list_source) { | 2301 | list_for_each_entry(p, &w->sinks, list_source) { |
2296 | if (p->sink->id == snd_soc_dapm_spk || | 2302 | if (p->sink->id == snd_soc_dapm_spk || |
@@ -3085,16 +3091,24 @@ snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm, | |||
3085 | 3091 | ||
3086 | switch (w->id) { | 3092 | switch (w->id) { |
3087 | case snd_soc_dapm_mic: | 3093 | case snd_soc_dapm_mic: |
3088 | case snd_soc_dapm_input: | ||
3089 | w->is_source = 1; | 3094 | w->is_source = 1; |
3090 | w->power_check = dapm_generic_check_power; | 3095 | w->power_check = dapm_generic_check_power; |
3091 | break; | 3096 | break; |
3097 | case snd_soc_dapm_input: | ||
3098 | if (!dapm->card->fully_routed) | ||
3099 | w->is_source = 1; | ||
3100 | w->power_check = dapm_generic_check_power; | ||
3101 | break; | ||
3092 | case snd_soc_dapm_spk: | 3102 | case snd_soc_dapm_spk: |
3093 | case snd_soc_dapm_hp: | 3103 | case snd_soc_dapm_hp: |
3094 | case snd_soc_dapm_output: | ||
3095 | w->is_sink = 1; | 3104 | w->is_sink = 1; |
3096 | w->power_check = dapm_generic_check_power; | 3105 | w->power_check = dapm_generic_check_power; |
3097 | break; | 3106 | break; |
3107 | case snd_soc_dapm_output: | ||
3108 | if (!dapm->card->fully_routed) | ||
3109 | w->is_sink = 1; | ||
3110 | w->power_check = dapm_generic_check_power; | ||
3111 | break; | ||
3098 | case snd_soc_dapm_vmid: | 3112 | case snd_soc_dapm_vmid: |
3099 | case snd_soc_dapm_siggen: | 3113 | case snd_soc_dapm_siggen: |
3100 | w->is_source = 1; | 3114 | w->is_source = 1; |
@@ -3809,93 +3823,6 @@ int snd_soc_dapm_ignore_suspend(struct snd_soc_dapm_context *dapm, | |||
3809 | EXPORT_SYMBOL_GPL(snd_soc_dapm_ignore_suspend); | 3823 | EXPORT_SYMBOL_GPL(snd_soc_dapm_ignore_suspend); |
3810 | 3824 | ||
3811 | /** | 3825 | /** |
3812 | * dapm_is_external_path() - Checks if a path is a external path | ||
3813 | * @card: The card the path belongs to | ||
3814 | * @path: The path to check | ||
3815 | * | ||
3816 | * Returns true if the path is either between two different DAPM contexts or | ||
3817 | * between two external pins of the same DAPM context. Otherwise returns | ||
3818 | * false. | ||
3819 | */ | ||
3820 | static bool dapm_is_external_path(struct snd_soc_card *card, | ||
3821 | struct snd_soc_dapm_path *path) | ||
3822 | { | ||
3823 | dev_dbg(card->dev, | ||
3824 | "... Path %s(id:%d dapm:%p) - %s(id:%d dapm:%p)\n", | ||
3825 | path->source->name, path->source->id, path->source->dapm, | ||
3826 | path->sink->name, path->sink->id, path->sink->dapm); | ||
3827 | |||
3828 | /* Connection between two different DAPM contexts */ | ||
3829 | if (path->source->dapm != path->sink->dapm) | ||
3830 | return true; | ||
3831 | |||
3832 | /* Loopback connection from external pin to external pin */ | ||
3833 | if (path->sink->id == snd_soc_dapm_input) { | ||
3834 | switch (path->source->id) { | ||
3835 | case snd_soc_dapm_output: | ||
3836 | case snd_soc_dapm_micbias: | ||
3837 | return true; | ||
3838 | default: | ||
3839 | break; | ||
3840 | } | ||
3841 | } | ||
3842 | |||
3843 | return false; | ||
3844 | } | ||
3845 | |||
3846 | static bool snd_soc_dapm_widget_in_card_paths(struct snd_soc_card *card, | ||
3847 | struct snd_soc_dapm_widget *w) | ||
3848 | { | ||
3849 | struct snd_soc_dapm_path *p; | ||
3850 | |||
3851 | list_for_each_entry(p, &w->sources, list_sink) { | ||
3852 | if (dapm_is_external_path(card, p)) | ||
3853 | return true; | ||
3854 | } | ||
3855 | |||
3856 | list_for_each_entry(p, &w->sinks, list_source) { | ||
3857 | if (dapm_is_external_path(card, p)) | ||
3858 | return true; | ||
3859 | } | ||
3860 | |||
3861 | return false; | ||
3862 | } | ||
3863 | |||
3864 | /** | ||
3865 | * snd_soc_dapm_auto_nc_pins - call snd_soc_dapm_nc_pin for unused pins | ||
3866 | * @card: The card whose pins should be processed | ||
3867 | * | ||
3868 | * Automatically call snd_soc_dapm_nc_pin() for any external pins in the card | ||
3869 | * which are unused. Pins are used if they are connected externally to a | ||
3870 | * component, whether that be to some other device, or a loop-back connection to | ||
3871 | * the component itself. | ||
3872 | */ | ||
3873 | void snd_soc_dapm_auto_nc_pins(struct snd_soc_card *card) | ||
3874 | { | ||
3875 | struct snd_soc_dapm_widget *w; | ||
3876 | |||
3877 | dev_dbg(card->dev, "ASoC: Auto NC: DAPMs: card:%p\n", &card->dapm); | ||
3878 | |||
3879 | list_for_each_entry(w, &card->widgets, list) { | ||
3880 | switch (w->id) { | ||
3881 | case snd_soc_dapm_input: | ||
3882 | case snd_soc_dapm_output: | ||
3883 | case snd_soc_dapm_micbias: | ||
3884 | dev_dbg(card->dev, "ASoC: Auto NC: Checking widget %s\n", | ||
3885 | w->name); | ||
3886 | if (!snd_soc_dapm_widget_in_card_paths(card, w)) { | ||
3887 | dev_dbg(card->dev, | ||
3888 | "... Not in map; disabling\n"); | ||
3889 | snd_soc_dapm_nc_pin(w->dapm, w->name); | ||
3890 | } | ||
3891 | break; | ||
3892 | default: | ||
3893 | break; | ||
3894 | } | ||
3895 | } | ||
3896 | } | ||
3897 | |||
3898 | /** | ||
3899 | * snd_soc_dapm_free - free dapm resources | 3826 | * snd_soc_dapm_free - free dapm resources |
3900 | * @dapm: DAPM context | 3827 | * @dapm: DAPM context |
3901 | * | 3828 | * |
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index eb87d96e2cf0..0ae0e2a9eed7 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c | |||
@@ -746,7 +746,8 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream) | |||
746 | codec_dai); | 746 | codec_dai); |
747 | if (ret < 0) { | 747 | if (ret < 0) { |
748 | dev_err(codec_dai->dev, | 748 | dev_err(codec_dai->dev, |
749 | "ASoC: DAI prepare error: %d\n", ret); | 749 | "ASoC: codec DAI prepare error: %d\n", |
750 | ret); | ||
750 | goto out; | 751 | goto out; |
751 | } | 752 | } |
752 | } | 753 | } |
@@ -755,8 +756,8 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream) | |||
755 | if (cpu_dai->driver->ops && cpu_dai->driver->ops->prepare) { | 756 | if (cpu_dai->driver->ops && cpu_dai->driver->ops->prepare) { |
756 | ret = cpu_dai->driver->ops->prepare(substream, cpu_dai); | 757 | ret = cpu_dai->driver->ops->prepare(substream, cpu_dai); |
757 | if (ret < 0) { | 758 | if (ret < 0) { |
758 | dev_err(cpu_dai->dev, "ASoC: DAI prepare error: %d\n", | 759 | dev_err(cpu_dai->dev, |
759 | ret); | 760 | "ASoC: cpu DAI prepare error: %d\n", ret); |
760 | goto out; | 761 | goto out; |
761 | } | 762 | } |
762 | } | 763 | } |
diff --git a/sound/usb/caiaq/audio.c b/sound/usb/caiaq/audio.c index 272844746135..327f8642ca80 100644 --- a/sound/usb/caiaq/audio.c +++ b/sound/usb/caiaq/audio.c | |||
@@ -816,7 +816,7 @@ int snd_usb_caiaq_audio_init(struct snd_usb_caiaqdev *cdev) | |||
816 | return -EINVAL; | 816 | return -EINVAL; |
817 | } | 817 | } |
818 | 818 | ||
819 | if (cdev->n_streams < 2) { | 819 | if (cdev->n_streams < 1) { |
820 | dev_err(dev, "bogus number of streams: %d\n", cdev->n_streams); | 820 | dev_err(dev, "bogus number of streams: %d\n", cdev->n_streams); |
821 | return -EINVAL; | 821 | return -EINVAL; |
822 | } | 822 | } |
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c index 41650d5b93b7..3e2ef61c627b 100644 --- a/sound/usb/mixer.c +++ b/sound/usb/mixer.c | |||
@@ -913,6 +913,7 @@ static void volume_control_quirks(struct usb_mixer_elem_info *cval, | |||
913 | case USB_ID(0x046d, 0x0807): /* Logitech Webcam C500 */ | 913 | case USB_ID(0x046d, 0x0807): /* Logitech Webcam C500 */ |
914 | case USB_ID(0x046d, 0x0808): | 914 | case USB_ID(0x046d, 0x0808): |
915 | case USB_ID(0x046d, 0x0809): | 915 | case USB_ID(0x046d, 0x0809): |
916 | case USB_ID(0x046d, 0x0819): /* Logitech Webcam C210 */ | ||
916 | case USB_ID(0x046d, 0x081b): /* HD Webcam c310 */ | 917 | case USB_ID(0x046d, 0x081b): /* HD Webcam c310 */ |
917 | case USB_ID(0x046d, 0x081d): /* HD Webcam c510 */ | 918 | case USB_ID(0x046d, 0x081d): /* HD Webcam c510 */ |
918 | case USB_ID(0x046d, 0x0825): /* HD Webcam c270 */ | 919 | case USB_ID(0x046d, 0x0825): /* HD Webcam c270 */ |