Lines Matching +full:frc +full:- +full:shared

1 // SPDX-License-Identifier: GPL-2.0-only
3 * intel_hdmi_audio.c - Intel HDMI audio driver
23 #include <linux/dma-mapping.h>
40 for ((pipe) = 0; (pipe) < (card_ctx)->num_pipes; (pipe)++)
42 for ((port) = 0; (port) < (card_ctx)->num_ports; (port)++)
57 "Single-port mode (for compatibility)");
68 [5] = FLC | FRC,
111 { .ca_index = 0x14, .speakers = { FRC, FLC, 0, 0, 0, 0, FR, FL } },
112 { .ca_index = 0x15, .speakers = { FRC, FLC, 0, 0, 0, LFE, FR, FL } },
113 { .ca_index = 0x16, .speakers = { FRC, FLC, 0, 0, FC, 0, FR, FL } },
114 { .ca_index = 0x17, .speakers = { FRC, FLC, 0, 0, FC, LFE, FR, FL } },
115 { .ca_index = 0x18, .speakers = { FRC, FLC, 0, RC, 0, 0, FR, FL } },
116 { .ca_index = 0x19, .speakers = { FRC, FLC, 0, RC, 0, LFE, FR, FL } },
117 { .ca_index = 0x1a, .speakers = { FRC, FLC, 0, RC, FC, 0, FR, FL } },
118 { .ca_index = 0x1b, .speakers = { FRC, FLC, 0, RC, FC, LFE, FR, FL } },
119 { .ca_index = 0x1c, .speakers = { FRC, FLC, RR, RL, 0, 0, FR, FL } },
120 { .ca_index = 0x1d, .speakers = { FRC, FLC, RR, RL, 0, LFE, FR, FL } },
121 { .ca_index = 0x1e, .speakers = { FRC, FLC, RR, RL, FC, 0, FR, FL } },
122 { .ca_index = 0x1f, .speakers = { FRC, FLC, RR, RL, FC, LFE, FR, FL } },
175 spin_lock_irqsave(&intelhaddata->had_spinlock, flags); in had_substream_get()
176 substream = intelhaddata->stream_info.substream; in had_substream_get()
178 intelhaddata->stream_info.substream_refcount++; in had_substream_get()
179 spin_unlock_irqrestore(&intelhaddata->had_spinlock, flags); in had_substream_get()
190 spin_lock_irqsave(&intelhaddata->had_spinlock, flags); in had_substream_put()
191 intelhaddata->stream_info.substream_refcount--; in had_substream_put()
192 spin_unlock_irqrestore(&intelhaddata->had_spinlock, flags); in had_substream_put()
212 return ioread32(card_ctx->mmio_start + had_config_offset(pipe) + reg); in had_read_register_raw()
218 iowrite32(val, card_ctx->mmio_start + had_config_offset(pipe) + reg); in had_write_register_raw()
223 if (!ctx->connected) in had_read_register()
226 *val = had_read_register_raw(ctx->card_ctx, ctx->pipe, reg); in had_read_register()
231 if (ctx->connected) in had_write_register()
232 had_write_register_raw(ctx->card_ctx, ctx->pipe, reg, val); in had_write_register()
242 * HDMI IP. As a result a read-modify of AUD_CONFIG register will always
245 * more channels. Read-modify of AUD_CONFIG (Eg. for enabling audio)
248 * appropriate value when doing read-modify of AUD_CONFIG register.
254 intelhaddata->aud_config.regx.aud_en = enable; in had_enable_audio()
256 intelhaddata->aud_config.regval); in had_enable_audio()
264 if (!ctx->connected) in had_ack_irqs()
290 ch_stat0.regx.lpcm_id = (intelhaddata->aes_bits & in had_prog_status_reg()
292 ch_stat0.regx.clk_acc = (intelhaddata->aes_bits & in had_prog_status_reg()
295 switch (substream->runtime->rate) { in had_prog_status_reg()
321 return -EINVAL; in had_prog_status_reg()
327 switch (substream->runtime->format) { in had_prog_status_reg()
338 return -EINVAL; in had_prog_status_reg()
365 channels = substream->runtime->channels; in had_init_audio_ctrl()
366 cfg_val.regx.num_ch = channels - 2; in had_init_audio_ctrl()
372 if (substream->runtime->format == SNDRV_PCM_FORMAT_S16_LE) in had_init_audio_ctrl()
375 if (substream->runtime->format == SNDRV_PCM_FORMAT_S32_LE) in had_init_audio_ctrl()
381 if (intelhaddata->dp_output) { in had_init_audio_ctrl()
387 intelhaddata->aud_config = cfg_val; in had_init_audio_ctrl()
401 p->channels = 0; in init_channel_allocations()
402 p->spk_mask = 0; in init_channel_allocations()
403 for (j = 0; j < ARRAY_SIZE(p->speakers); j++) in init_channel_allocations()
404 if (p->speakers[j]) { in init_channel_allocations()
405 p->channels++; in init_channel_allocations()
406 p->spk_mask |= p->speakers[j]; in init_channel_allocations()
414 * eld->spk_alloc => (eld_speaker_allocation_bits[]) => spk_mask
415 * spk_mask => (channel_allocations[]) => ai->CA
440 if (intelhaddata->eld[DRM_ELD_SPEAKER] & (1 << i)) in had_channel_allocation()
454 dev_dbg(intelhaddata->dev, "select CA 0x%x for %d\n", ca, channels); in had_channel_allocation()
464 for (; t->map; t++) { in spk_to_chmap()
465 if (t->spk_mask == spk) in spk_to_chmap()
466 return t->map; in spk_to_chmap()
479 kfree(intelhaddata->chmap->chmap); in had_build_channel_allocation_map()
480 intelhaddata->chmap->chmap = NULL; in had_build_channel_allocation_map()
486 dev_dbg(intelhaddata->dev, "eld speaker = %x\n", in had_build_channel_allocation_map()
487 intelhaddata->eld[DRM_ELD_SPEAKER]); in had_build_channel_allocation_map()
498 eld_high = intelhaddata->eld[DRM_ELD_SPEAKER] & eld_high_mask; in had_build_channel_allocation_map()
499 if ((eld_high & (eld_high-1)) && (eld_high > 0x1F)) { in had_build_channel_allocation_map()
500 /* eld_high & (eld_high-1): if more than 1 bit set */ in had_build_channel_allocation_map()
505 intelhaddata->eld[DRM_ELD_SPEAKER] &= in had_build_channel_allocation_map()
513 if (intelhaddata->eld[DRM_ELD_SPEAKER] & (1 << i)) in had_build_channel_allocation_map()
520 chmap->map[c] = spk_to_chmap( in had_build_channel_allocation_map()
522 (MAX_SPEAKERS - 1) - c]); in had_build_channel_allocation_map()
524 chmap->channels = channel_allocations[i].channels; in had_build_channel_allocation_map()
525 intelhaddata->chmap->chmap = chmap; in had_build_channel_allocation_map()
534 * ALSA API channel-map control callbacks
539 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in had_chmap_ctl_info()
540 uinfo->count = HAD_MAX_CHANNEL; in had_chmap_ctl_info()
541 uinfo->value.integer.min = 0; in had_chmap_ctl_info()
542 uinfo->value.integer.max = SNDRV_CHMAP_LAST; in had_chmap_ctl_info()
550 struct snd_intelhad *intelhaddata = info->private_data; in had_chmap_ctl_get()
554 memset(ucontrol->value.integer.value, 0, in had_chmap_ctl_get()
556 mutex_lock(&intelhaddata->mutex); in had_chmap_ctl_get()
557 if (!intelhaddata->chmap->chmap) { in had_chmap_ctl_get()
558 mutex_unlock(&intelhaddata->mutex); in had_chmap_ctl_get()
562 chmap = intelhaddata->chmap->chmap; in had_chmap_ctl_get()
563 for (i = 0; i < chmap->channels; i++) in had_chmap_ctl_get()
564 ucontrol->value.integer.value[i] = chmap->map[i]; in had_chmap_ctl_get()
565 mutex_unlock(&intelhaddata->mutex); in had_chmap_ctl_get()
577 &intelhaddata->chmap); in had_register_chmap_ctls()
581 intelhaddata->chmap->private_data = intelhaddata; in had_register_chmap_ctls()
582 intelhaddata->chmap->kctl->info = had_chmap_ctl_info; in had_register_chmap_ctls()
583 intelhaddata->chmap->kctl->get = had_chmap_ctl_get; in had_register_chmap_ctls()
584 intelhaddata->chmap->chmap = NULL; in had_register_chmap_ctls()
604 channels = substream->runtime->channels; in had_prog_dip()
609 if (intelhaddata->dp_output) { in had_prog_dip()
611 frame2.regval = (substream->runtime->channels - 1) | (ca << 24); in had_prog_dip()
614 frame2.regx.chnl_cnt = substream->runtime->channels - 1; in had_prog_dip()
625 frame2.regx.chksum = -(checksum); in had_prog_dip()
633 for (i = 0; i < HAD_MAX_DIP_WORDS-VALID_DIP_WORDS; i++) in had_prog_dip()
677 maud_val = -EINVAL; in had_calculate_maud_value()
711 maud_val = -EINVAL; in had_calculate_maud_value()
715 maud_val = -EINVAL; in had_calculate_maud_value()
737 if (intelhaddata->dp_output) { in had_prog_cts()
746 dev_dbg(intelhaddata->dev, "TMDS value=%d, N value=%d, CTS Value=%d\n", in had_prog_cts()
786 n_val = -EINVAL; in had_calculate_n_value()
807 if (intelhaddata->dp_output) { in had_prog_n()
836 * PCM | 0 | 1 | 2 | 3 | 4 | 5 | .... |n-1|
840 * PCM | 0 | 1 | 2 | 3 | 4 | 5 | .... |n-1|
844 * PCM | 0 | 1 | 2 | 3 | 4 | 5 | .... |n-1|
854 * pcm_head (=1) --v v-- pcm_filled (=5)
855 * PCM | 0 | 1 | 2 | 3 | 4 | 5 | .... |n-1|
857 * bd_head (=1) --^ ^-- next to fill (= bd_head)
875 int idx = intelhaddata->bd_head; in had_prog_bd()
876 int ofs = intelhaddata->pcmbuf_filled * intelhaddata->period_bytes; in had_prog_bd()
877 u32 addr = substream->runtime->dma_addr + ofs; in had_prog_bd()
880 if (!substream->runtime->no_period_wakeup) in had_prog_bd()
884 intelhaddata->period_bytes); in had_prog_bd()
887 intelhaddata->bd_head++; in had_prog_bd()
888 intelhaddata->bd_head %= intelhaddata->num_bds; in had_prog_bd()
889 intelhaddata->pcmbuf_filled++; in had_prog_bd()
890 intelhaddata->pcmbuf_filled %= substream->runtime->periods; in had_prog_bd()
905 struct snd_pcm_runtime *runtime = substream->runtime; in had_init_ringbuf()
908 num_periods = runtime->periods; in had_init_ringbuf()
909 intelhaddata->num_bds = min(num_periods, HAD_NUM_OF_RING_BUFS); in had_init_ringbuf()
911 intelhaddata->num_bds = max(intelhaddata->num_bds, 2U); in had_init_ringbuf()
912 intelhaddata->period_bytes = in had_init_ringbuf()
913 frames_to_bytes(runtime, runtime->period_size); in had_init_ringbuf()
914 WARN_ON(intelhaddata->period_bytes & 0x3f); in had_init_ringbuf()
916 intelhaddata->bd_head = 0; in had_init_ringbuf()
917 intelhaddata->pcmbuf_head = 0; in had_init_ringbuf()
918 intelhaddata->pcmbuf_filled = 0; in had_init_ringbuf()
921 if (i < intelhaddata->num_bds) in had_init_ringbuf()
927 intelhaddata->bd_head = 0; /* reset at head again before starting */ in had_init_ringbuf()
934 int num_periods = substream->runtime->periods; in had_advance_ringbuf()
940 intelhaddata->pcmbuf_head++; in had_advance_ringbuf()
941 intelhaddata->pcmbuf_head %= num_periods; in had_advance_ringbuf()
945 * returns the current PCM buffer byte position, or -EPIPE for underrun.
954 spin_lock_irqsave(&intelhaddata->had_spinlock, flags); in had_process_ringbuf()
958 AUD_BUF_LEN(intelhaddata->bd_head), in had_process_ringbuf()
960 if (len < 0 || len > intelhaddata->period_bytes) { in had_process_ringbuf()
961 dev_dbg(intelhaddata->dev, "Invalid buf length %d\n", in had_process_ringbuf()
963 len = -EPIPE; in had_process_ringbuf()
971 if (++processed >= intelhaddata->num_bds) { in had_process_ringbuf()
972 len = -EPIPE; /* all empty? - report underrun */ in had_process_ringbuf()
978 len = intelhaddata->period_bytes - len; in had_process_ringbuf()
979 len += intelhaddata->period_bytes * intelhaddata->pcmbuf_head; in had_process_ringbuf()
981 spin_unlock_irqrestore(&intelhaddata->had_spinlock, flags); in had_process_ringbuf()
992 return; /* no stream? - bail out */ in had_process_buffer_done()
994 if (!intelhaddata->connected) { in had_process_buffer_done()
996 goto out; /* disconnected? - bail out */ in had_process_buffer_done()
1027 dev_err(intelhaddata->dev, "Unable to clear UNDERRUN bits\n"); in wait_clear_underrun_bit()
1038 if (!intelhaddata->connected) in had_pcm_sync_stop()
1070 runtime = substream->runtime; in had_pcm_open()
1072 retval = pm_runtime_resume_and_get(intelhaddata->dev); in had_pcm_open()
1077 runtime->hw = had_pcm_hardware; in had_pcm_open()
1087 retval = snd_pcm_hw_constraint_step(substream->runtime, 0, in had_pcm_open()
1097 spin_lock_irq(&intelhaddata->had_spinlock); in had_pcm_open()
1098 intelhaddata->stream_info.substream = substream; in had_pcm_open()
1099 intelhaddata->stream_info.substream_refcount++; in had_pcm_open()
1100 spin_unlock_irq(&intelhaddata->had_spinlock); in had_pcm_open()
1104 pm_runtime_mark_last_busy(intelhaddata->dev); in had_pcm_open()
1105 pm_runtime_put_autosuspend(intelhaddata->dev); in had_pcm_open()
1119 spin_lock_irq(&intelhaddata->had_spinlock); in had_pcm_close()
1120 intelhaddata->stream_info.substream = NULL; in had_pcm_close()
1121 intelhaddata->stream_info.substream_refcount--; in had_pcm_close()
1122 while (intelhaddata->stream_info.substream_refcount > 0) { in had_pcm_close()
1123 spin_unlock_irq(&intelhaddata->had_spinlock); in had_pcm_close()
1125 spin_lock_irq(&intelhaddata->had_spinlock); in had_pcm_close()
1127 spin_unlock_irq(&intelhaddata->had_spinlock); in had_pcm_close()
1129 pm_runtime_mark_last_busy(intelhaddata->dev); in had_pcm_close()
1130 pm_runtime_put_autosuspend(intelhaddata->dev); in had_pcm_close()
1145 dev_dbg(intelhaddata->dev, "%s:allocated memory = %d\n", in had_pcm_hw_params()
1160 spin_lock(&intelhaddata->had_spinlock); in had_pcm_trigger()
1177 retval = -EINVAL; in had_pcm_trigger()
1179 spin_unlock(&intelhaddata->had_spinlock); in had_pcm_trigger()
1195 runtime = substream->runtime; in had_pcm_prepare()
1197 dev_dbg(intelhaddata->dev, "period_size=%d\n", in had_pcm_prepare()
1198 (int)frames_to_bytes(runtime, runtime->period_size)); in had_pcm_prepare()
1199 dev_dbg(intelhaddata->dev, "periods=%d\n", runtime->periods); in had_pcm_prepare()
1200 dev_dbg(intelhaddata->dev, "buffer_size=%d\n", in had_pcm_prepare()
1202 dev_dbg(intelhaddata->dev, "rate=%d\n", runtime->rate); in had_pcm_prepare()
1203 dev_dbg(intelhaddata->dev, "channels=%d\n", runtime->channels); in had_pcm_prepare()
1206 disp_samp_freq = intelhaddata->tmds_clock_speed; in had_pcm_prepare()
1208 retval = had_prog_n(substream->runtime->rate, &n_param, intelhaddata); in had_pcm_prepare()
1210 dev_err(intelhaddata->dev, in had_pcm_prepare()
1215 if (intelhaddata->dp_output) in had_pcm_prepare()
1216 link_rate = intelhaddata->link_rate; in had_pcm_prepare()
1218 had_prog_cts(substream->runtime->rate, disp_samp_freq, link_rate, in had_pcm_prepare()
1249 if (!intelhaddata->connected) in had_pcm_pointer()
1255 len = bytes_to_frames(substream->runtime, len); in had_pcm_pointer()
1257 len %= substream->runtime->buffer_size; in had_pcm_pointer()
1290 disp_samp_freq = intelhaddata->tmds_clock_speed; in had_process_mode_change()
1292 retval = had_prog_n(substream->runtime->rate, &n_param, intelhaddata); in had_process_mode_change()
1294 dev_err(intelhaddata->dev, in had_process_mode_change()
1299 if (intelhaddata->dp_output) in had_process_mode_change()
1300 link_rate = intelhaddata->link_rate; in had_process_mode_change()
1302 had_prog_cts(substream->runtime->rate, disp_samp_freq, link_rate, in had_process_mode_change()
1318 spin_lock_irq(&intelhaddata->had_spinlock); in had_process_hot_plug()
1319 if (intelhaddata->connected) { in had_process_hot_plug()
1320 dev_dbg(intelhaddata->dev, "Device already connected\n"); in had_process_hot_plug()
1321 spin_unlock_irq(&intelhaddata->had_spinlock); in had_process_hot_plug()
1328 intelhaddata->connected = true; in had_process_hot_plug()
1329 dev_dbg(intelhaddata->dev, in had_process_hot_plug()
1332 spin_unlock_irq(&intelhaddata->had_spinlock); in had_process_hot_plug()
1343 snd_jack_report(intelhaddata->jack, SND_JACK_AVOUT); in had_process_hot_plug()
1351 spin_lock_irq(&intelhaddata->had_spinlock); in had_process_hot_unplug()
1352 if (!intelhaddata->connected) { in had_process_hot_unplug()
1353 dev_dbg(intelhaddata->dev, "Device already disconnected\n"); in had_process_hot_unplug()
1354 spin_unlock_irq(&intelhaddata->had_spinlock); in had_process_hot_unplug()
1362 intelhaddata->connected = false; in had_process_hot_unplug()
1363 dev_dbg(intelhaddata->dev, in had_process_hot_unplug()
1366 spin_unlock_irq(&intelhaddata->had_spinlock); in had_process_hot_unplug()
1368 kfree(intelhaddata->chmap->chmap); in had_process_hot_unplug()
1369 intelhaddata->chmap->chmap = NULL; in had_process_hot_unplug()
1378 snd_jack_report(intelhaddata->jack, 0); in had_process_hot_unplug()
1388 uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; in had_iec958_info()
1389 uinfo->count = 1; in had_iec958_info()
1398 mutex_lock(&intelhaddata->mutex); in had_iec958_get()
1399 ucontrol->value.iec958.status[0] = (intelhaddata->aes_bits >> 0) & 0xff; in had_iec958_get()
1400 ucontrol->value.iec958.status[1] = (intelhaddata->aes_bits >> 8) & 0xff; in had_iec958_get()
1401 ucontrol->value.iec958.status[2] = in had_iec958_get()
1402 (intelhaddata->aes_bits >> 16) & 0xff; in had_iec958_get()
1403 ucontrol->value.iec958.status[3] = in had_iec958_get()
1404 (intelhaddata->aes_bits >> 24) & 0xff; in had_iec958_get()
1405 mutex_unlock(&intelhaddata->mutex); in had_iec958_get()
1412 ucontrol->value.iec958.status[0] = 0xff; in had_iec958_mask_get()
1413 ucontrol->value.iec958.status[1] = 0xff; in had_iec958_mask_get()
1414 ucontrol->value.iec958.status[2] = 0xff; in had_iec958_mask_get()
1415 ucontrol->value.iec958.status[3] = 0xff; in had_iec958_mask_get()
1426 val = (ucontrol->value.iec958.status[0] << 0) | in had_iec958_put()
1427 (ucontrol->value.iec958.status[1] << 8) | in had_iec958_put()
1428 (ucontrol->value.iec958.status[2] << 16) | in had_iec958_put()
1429 (ucontrol->value.iec958.status[3] << 24); in had_iec958_put()
1430 mutex_lock(&intelhaddata->mutex); in had_iec958_put()
1431 if (intelhaddata->aes_bits != val) { in had_iec958_put()
1432 intelhaddata->aes_bits = val; in had_iec958_put()
1435 mutex_unlock(&intelhaddata->mutex); in had_iec958_put()
1442 uinfo->type = SNDRV_CTL_ELEM_TYPE_BYTES; in had_ctl_eld_info()
1443 uinfo->count = HDMI_MAX_ELD_BYTES; in had_ctl_eld_info()
1452 mutex_lock(&intelhaddata->mutex); in had_ctl_eld_get()
1453 memcpy(ucontrol->value.bytes.data, intelhaddata->eld, in had_ctl_eld_get()
1455 mutex_unlock(&intelhaddata->mutex); in had_ctl_eld_get()
1464 .info = had_iec958_info, /* shared */
1505 struct snd_intelhad *ctx = &card_ctx->pcm_ctx[port]; in display_pipe_interrupt_handler()
1506 int pipe = ctx->pipe; in display_pipe_interrupt_handler()
1528 ctx = &card_ctx->pcm_ctx[single_port ? 0 : port]; in notify_audio_lpe()
1530 ctx->port = port; in notify_audio_lpe()
1532 schedule_work(&ctx->hdmi_audio_wq); in notify_audio_lpe()
1540 struct intel_hdmi_lpe_audio_pdata *pdata = ctx->dev->platform_data; in had_audio_wq()
1541 struct intel_hdmi_lpe_audio_port_pdata *ppdata = &pdata->port[ctx->port]; in had_audio_wq()
1544 ret = pm_runtime_resume_and_get(ctx->dev); in had_audio_wq()
1548 mutex_lock(&ctx->mutex); in had_audio_wq()
1549 if (ppdata->pipe < 0) { in had_audio_wq()
1550 dev_dbg(ctx->dev, "%s: Event: HAD_NOTIFY_HOT_UNPLUG : port = %d\n", in had_audio_wq()
1551 __func__, ctx->port); in had_audio_wq()
1553 memset(ctx->eld, 0, sizeof(ctx->eld)); /* clear the old ELD */ in had_audio_wq()
1555 ctx->dp_output = false; in had_audio_wq()
1556 ctx->tmds_clock_speed = 0; in had_audio_wq()
1557 ctx->link_rate = 0; in had_audio_wq()
1562 ctx->pipe = -1; in had_audio_wq()
1564 dev_dbg(ctx->dev, "%s: HAD_NOTIFY_ELD : port = %d, tmds = %d\n", in had_audio_wq()
1565 __func__, ctx->port, ppdata->ls_clock); in had_audio_wq()
1567 memcpy(ctx->eld, ppdata->eld, sizeof(ctx->eld)); in had_audio_wq()
1569 ctx->dp_output = ppdata->dp_output; in had_audio_wq()
1570 if (ctx->dp_output) { in had_audio_wq()
1571 ctx->tmds_clock_speed = 0; in had_audio_wq()
1572 ctx->link_rate = ppdata->ls_clock; in had_audio_wq()
1574 ctx->tmds_clock_speed = ppdata->ls_clock; in had_audio_wq()
1575 ctx->link_rate = 0; in had_audio_wq()
1584 ctx->pipe = ppdata->pipe; in had_audio_wq()
1590 mutex_unlock(&ctx->mutex); in had_audio_wq()
1591 pm_runtime_mark_last_busy(ctx->dev); in had_audio_wq()
1592 pm_runtime_put_autosuspend(ctx->dev); in had_audio_wq()
1605 "HDMI/DP,pcm=%d", pcm->device); in had_create_jack()
1607 err = snd_jack_new(ctx->card_ctx->card, hdmi_str, in had_create_jack()
1608 SND_JACK_AVOUT, &ctx->jack, in had_create_jack()
1612 ctx->jack->private_data = ctx; in had_create_jack()
1624 snd_power_change_state(card_ctx->card, SNDRV_CTL_POWER_D3hot); in hdmi_lpe_audio_suspend()
1635 snd_power_change_state(card_ctx->card, SNDRV_CTL_POWER_D0); in hdmi_lpe_audio_resume()
1643 struct snd_intelhad_card *card_ctx = card->private_data; in hdmi_lpe_audio_free()
1644 struct intel_hdmi_lpe_audio_pdata *pdata = card_ctx->dev->platform_data; in hdmi_lpe_audio_free()
1647 spin_lock_irq(&pdata->lpe_audio_slock); in hdmi_lpe_audio_free()
1648 pdata->notify_audio_lpe = NULL; in hdmi_lpe_audio_free()
1649 spin_unlock_irq(&pdata->lpe_audio_slock); in hdmi_lpe_audio_free()
1652 struct snd_intelhad *ctx = &card_ctx->pcm_ctx[port]; in hdmi_lpe_audio_free()
1654 cancel_work_sync(&ctx->hdmi_audio_wq); in hdmi_lpe_audio_free()
1659 * hdmi_lpe_audio_probe - start bridge with i915
1662 * hdmi-lpe-audio platform device.
1675 pdata = pdev->dev.platform_data; in __hdmi_lpe_audio_probe()
1677 dev_err(&pdev->dev, "%s: quit: pdata not allocated by i915!!\n", __func__); in __hdmi_lpe_audio_probe()
1678 return -EINVAL; in __hdmi_lpe_audio_probe()
1688 dev_err(&pdev->dev, "Could not get IO_MEM resources\n"); in __hdmi_lpe_audio_probe()
1689 return -ENXIO; in __hdmi_lpe_audio_probe()
1693 ret = snd_devm_card_new(&pdev->dev, hdmi_card_index, hdmi_card_id, in __hdmi_lpe_audio_probe()
1698 card_ctx = card->private_data; in __hdmi_lpe_audio_probe()
1699 card_ctx->dev = &pdev->dev; in __hdmi_lpe_audio_probe()
1700 card_ctx->card = card; in __hdmi_lpe_audio_probe()
1701 strcpy(card->driver, INTEL_HAD); in __hdmi_lpe_audio_probe()
1702 strcpy(card->shortname, "Intel HDMI/DP LPE Audio"); in __hdmi_lpe_audio_probe()
1703 strcpy(card->longname, "Intel HDMI/DP LPE Audio"); in __hdmi_lpe_audio_probe()
1705 card_ctx->irq = -1; in __hdmi_lpe_audio_probe()
1707 card->private_free = hdmi_lpe_audio_free; in __hdmi_lpe_audio_probe()
1711 card_ctx->num_pipes = pdata->num_pipes; in __hdmi_lpe_audio_probe()
1712 card_ctx->num_ports = single_port ? 1 : pdata->num_ports; in __hdmi_lpe_audio_probe()
1715 ctx = &card_ctx->pcm_ctx[port]; in __hdmi_lpe_audio_probe()
1716 ctx->card_ctx = card_ctx; in __hdmi_lpe_audio_probe()
1717 ctx->dev = card_ctx->dev; in __hdmi_lpe_audio_probe()
1718 ctx->port = single_port ? -1 : port; in __hdmi_lpe_audio_probe()
1719 ctx->pipe = -1; in __hdmi_lpe_audio_probe()
1721 spin_lock_init(&ctx->had_spinlock); in __hdmi_lpe_audio_probe()
1722 mutex_init(&ctx->mutex); in __hdmi_lpe_audio_probe()
1723 INIT_WORK(&ctx->hdmi_audio_wq, had_audio_wq); in __hdmi_lpe_audio_probe()
1726 dev_dbg(&pdev->dev, "%s: mmio_start = 0x%x, mmio_end = 0x%x\n", in __hdmi_lpe_audio_probe()
1727 __func__, (unsigned int)res_mmio->start, in __hdmi_lpe_audio_probe()
1728 (unsigned int)res_mmio->end); in __hdmi_lpe_audio_probe()
1730 card_ctx->mmio_start = in __hdmi_lpe_audio_probe()
1731 devm_ioremap(&pdev->dev, res_mmio->start, in __hdmi_lpe_audio_probe()
1733 if (!card_ctx->mmio_start) { in __hdmi_lpe_audio_probe()
1734 dev_err(&pdev->dev, "Could not get ioremap\n"); in __hdmi_lpe_audio_probe()
1735 return -EACCES; in __hdmi_lpe_audio_probe()
1739 ret = devm_request_irq(&pdev->dev, irq, display_pipe_interrupt_handler, in __hdmi_lpe_audio_probe()
1740 0, pdev->name, card_ctx); in __hdmi_lpe_audio_probe()
1742 dev_err(&pdev->dev, "request_irq failed\n"); in __hdmi_lpe_audio_probe()
1746 card_ctx->irq = irq; in __hdmi_lpe_audio_probe()
1749 ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); in __hdmi_lpe_audio_probe()
1755 card_ctx->num_pipes = pdata->num_pipes; in __hdmi_lpe_audio_probe()
1756 card_ctx->num_ports = single_port ? 1 : pdata->num_ports; in __hdmi_lpe_audio_probe()
1761 ctx = &card_ctx->pcm_ctx[port]; in __hdmi_lpe_audio_probe()
1768 pcm->private_data = ctx; in __hdmi_lpe_audio_probe()
1769 pcm->info_flags = 0; in __hdmi_lpe_audio_probe()
1770 strscpy(pcm->name, card->shortname, strlen(card->shortname)); in __hdmi_lpe_audio_probe()
1778 card->dev, HAD_DEFAULT_BUFFER, in __hdmi_lpe_audio_probe()
1787 return -ENOMEM; in __hdmi_lpe_audio_probe()
1789 kctl->id.device = pcm->device; in __hdmi_lpe_audio_probe()
1810 spin_lock_irq(&pdata->lpe_audio_slock); in __hdmi_lpe_audio_probe()
1811 pdata->notify_audio_lpe = notify_audio_lpe; in __hdmi_lpe_audio_probe()
1812 spin_unlock_irq(&pdata->lpe_audio_slock); in __hdmi_lpe_audio_probe()
1814 pm_runtime_set_autosuspend_delay(&pdev->dev, INTEL_HDMI_AUDIO_SUSPEND_DELAY_MS); in __hdmi_lpe_audio_probe()
1815 pm_runtime_use_autosuspend(&pdev->dev); in __hdmi_lpe_audio_probe()
1816 pm_runtime_enable(&pdev->dev); in __hdmi_lpe_audio_probe()
1817 pm_runtime_mark_last_busy(&pdev->dev); in __hdmi_lpe_audio_probe()
1818 pm_runtime_idle(&pdev->dev); in __hdmi_lpe_audio_probe()
1820 dev_dbg(&pdev->dev, "%s: handle pending notification\n", __func__); in __hdmi_lpe_audio_probe()
1822 struct snd_intelhad *ctx = &card_ctx->pcm_ctx[port]; in __hdmi_lpe_audio_probe()
1824 schedule_work(&ctx->hdmi_audio_wq); in __hdmi_lpe_audio_probe()
1832 return snd_card_free_on_error(&pdev->dev, __hdmi_lpe_audio_probe(pdev)); in hdmi_lpe_audio_probe()
1841 .name = "hdmi-lpe-audio",