• Home
  • Raw
  • Download

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>
37 for ((pipe) = 0; (pipe) < (card_ctx)->num_pipes; (pipe)++)
39 for ((port) = 0; (port) < (card_ctx)->num_ports; (port)++)
54 "Single-port mode (for compatibility)");
65 [5] = FLC | FRC,
108 { .ca_index = 0x14, .speakers = { FRC, FLC, 0, 0, 0, 0, FR, FL } },
109 { .ca_index = 0x15, .speakers = { FRC, FLC, 0, 0, 0, LFE, FR, FL } },
110 { .ca_index = 0x16, .speakers = { FRC, FLC, 0, 0, FC, 0, FR, FL } },
111 { .ca_index = 0x17, .speakers = { FRC, FLC, 0, 0, FC, LFE, FR, FL } },
112 { .ca_index = 0x18, .speakers = { FRC, FLC, 0, RC, 0, 0, FR, FL } },
113 { .ca_index = 0x19, .speakers = { FRC, FLC, 0, RC, 0, LFE, FR, FL } },
114 { .ca_index = 0x1a, .speakers = { FRC, FLC, 0, RC, FC, 0, FR, FL } },
115 { .ca_index = 0x1b, .speakers = { FRC, FLC, 0, RC, FC, LFE, FR, FL } },
116 { .ca_index = 0x1c, .speakers = { FRC, FLC, RR, RL, 0, 0, FR, FL } },
117 { .ca_index = 0x1d, .speakers = { FRC, FLC, RR, RL, 0, LFE, FR, FL } },
118 { .ca_index = 0x1e, .speakers = { FRC, FLC, RR, RL, FC, 0, FR, FL } },
119 { .ca_index = 0x1f, .speakers = { FRC, FLC, RR, RL, FC, LFE, FR, FL } },
172 spin_lock_irqsave(&intelhaddata->had_spinlock, flags); in had_substream_get()
173 substream = intelhaddata->stream_info.substream; in had_substream_get()
175 intelhaddata->stream_info.substream_refcount++; in had_substream_get()
176 spin_unlock_irqrestore(&intelhaddata->had_spinlock, flags); in had_substream_get()
187 spin_lock_irqsave(&intelhaddata->had_spinlock, flags); in had_substream_put()
188 intelhaddata->stream_info.substream_refcount--; in had_substream_put()
189 spin_unlock_irqrestore(&intelhaddata->had_spinlock, flags); in had_substream_put()
209 return ioread32(card_ctx->mmio_start + had_config_offset(pipe) + reg); in had_read_register_raw()
215 iowrite32(val, card_ctx->mmio_start + had_config_offset(pipe) + reg); in had_write_register_raw()
220 if (!ctx->connected) in had_read_register()
223 *val = had_read_register_raw(ctx->card_ctx, ctx->pipe, reg); in had_read_register()
228 if (ctx->connected) in had_write_register()
229 had_write_register_raw(ctx->card_ctx, ctx->pipe, reg, val); in had_write_register()
239 * HDMI IP. As a result a read-modify of AUD_CONFIG regiter will always
242 * more channels. Read-modify of AUD_CONFIG (Eg. for enabling audio)
245 * appropriate value when doing read-modify of AUD_CONFIG register.
251 intelhaddata->aud_config.regx.aud_en = enable; in had_enable_audio()
253 intelhaddata->aud_config.regval); in had_enable_audio()
261 if (!ctx->connected) in had_ack_irqs()
287 ch_stat0.regx.lpcm_id = (intelhaddata->aes_bits & in had_prog_status_reg()
289 ch_stat0.regx.clk_acc = (intelhaddata->aes_bits & in had_prog_status_reg()
292 switch (substream->runtime->rate) { in had_prog_status_reg()
318 return -EINVAL; in had_prog_status_reg()
324 switch (substream->runtime->format) { in had_prog_status_reg()
335 return -EINVAL; in had_prog_status_reg()
362 channels = substream->runtime->channels; in had_init_audio_ctrl()
363 cfg_val.regx.num_ch = channels - 2; in had_init_audio_ctrl()
369 if (substream->runtime->format == SNDRV_PCM_FORMAT_S16_LE) in had_init_audio_ctrl()
372 if (substream->runtime->format == SNDRV_PCM_FORMAT_S32_LE) in had_init_audio_ctrl()
378 if (intelhaddata->dp_output) { in had_init_audio_ctrl()
384 intelhaddata->aud_config = cfg_val; in had_init_audio_ctrl()
398 p->channels = 0; in init_channel_allocations()
399 p->spk_mask = 0; in init_channel_allocations()
400 for (j = 0; j < ARRAY_SIZE(p->speakers); j++) in init_channel_allocations()
401 if (p->speakers[j]) { in init_channel_allocations()
402 p->channels++; in init_channel_allocations()
403 p->spk_mask |= p->speakers[j]; in init_channel_allocations()
411 * eld->spk_alloc => (eld_speaker_allocation_bits[]) => spk_mask
412 * spk_mask => (channel_allocations[]) => ai->CA
437 if (intelhaddata->eld[DRM_ELD_SPEAKER] & (1 << i)) in had_channel_allocation()
451 dev_dbg(intelhaddata->dev, "select CA 0x%x for %d\n", ca, channels); in had_channel_allocation()
461 for (; t->map; t++) { in spk_to_chmap()
462 if (t->spk_mask == spk) in spk_to_chmap()
463 return t->map; in spk_to_chmap()
476 kfree(intelhaddata->chmap->chmap); in had_build_channel_allocation_map()
477 intelhaddata->chmap->chmap = NULL; in had_build_channel_allocation_map()
483 dev_dbg(intelhaddata->dev, "eld speaker = %x\n", in had_build_channel_allocation_map()
484 intelhaddata->eld[DRM_ELD_SPEAKER]); in had_build_channel_allocation_map()
495 eld_high = intelhaddata->eld[DRM_ELD_SPEAKER] & eld_high_mask; in had_build_channel_allocation_map()
496 if ((eld_high & (eld_high-1)) && (eld_high > 0x1F)) { in had_build_channel_allocation_map()
497 /* eld_high & (eld_high-1): if more than 1 bit set */ in had_build_channel_allocation_map()
502 intelhaddata->eld[DRM_ELD_SPEAKER] &= in had_build_channel_allocation_map()
510 if (intelhaddata->eld[DRM_ELD_SPEAKER] & (1 << i)) in had_build_channel_allocation_map()
517 chmap->map[c] = spk_to_chmap( in had_build_channel_allocation_map()
519 (MAX_SPEAKERS - 1) - c]); in had_build_channel_allocation_map()
521 chmap->channels = channel_allocations[i].channels; in had_build_channel_allocation_map()
522 intelhaddata->chmap->chmap = chmap; in had_build_channel_allocation_map()
531 * ALSA API channel-map control callbacks
536 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in had_chmap_ctl_info()
537 uinfo->count = HAD_MAX_CHANNEL; in had_chmap_ctl_info()
538 uinfo->value.integer.min = 0; in had_chmap_ctl_info()
539 uinfo->value.integer.max = SNDRV_CHMAP_LAST; in had_chmap_ctl_info()
547 struct snd_intelhad *intelhaddata = info->private_data; in had_chmap_ctl_get()
551 memset(ucontrol->value.integer.value, 0, in had_chmap_ctl_get()
553 mutex_lock(&intelhaddata->mutex); in had_chmap_ctl_get()
554 if (!intelhaddata->chmap->chmap) { in had_chmap_ctl_get()
555 mutex_unlock(&intelhaddata->mutex); in had_chmap_ctl_get()
559 chmap = intelhaddata->chmap->chmap; in had_chmap_ctl_get()
560 for (i = 0; i < chmap->channels; i++) in had_chmap_ctl_get()
561 ucontrol->value.integer.value[i] = chmap->map[i]; in had_chmap_ctl_get()
562 mutex_unlock(&intelhaddata->mutex); in had_chmap_ctl_get()
574 &intelhaddata->chmap); in had_register_chmap_ctls()
578 intelhaddata->chmap->private_data = intelhaddata; in had_register_chmap_ctls()
579 intelhaddata->chmap->kctl->info = had_chmap_ctl_info; in had_register_chmap_ctls()
580 intelhaddata->chmap->kctl->get = had_chmap_ctl_get; in had_register_chmap_ctls()
581 intelhaddata->chmap->chmap = NULL; in had_register_chmap_ctls()
601 channels = substream->runtime->channels; in had_prog_dip()
606 if (intelhaddata->dp_output) { in had_prog_dip()
608 frame2.regval = (substream->runtime->channels - 1) | (ca << 24); in had_prog_dip()
611 frame2.regx.chnl_cnt = substream->runtime->channels - 1; in had_prog_dip()
622 frame2.regx.chksum = -(checksum); in had_prog_dip()
630 for (i = 0; i < HAD_MAX_DIP_WORDS-VALID_DIP_WORDS; i++) in had_prog_dip()
674 maud_val = -EINVAL; in had_calculate_maud_value()
708 maud_val = -EINVAL; in had_calculate_maud_value()
712 maud_val = -EINVAL; in had_calculate_maud_value()
734 if (intelhaddata->dp_output) { in had_prog_cts()
743 dev_dbg(intelhaddata->dev, "TMDS value=%d, N value=%d, CTS Value=%d\n", in had_prog_cts()
783 n_val = -EINVAL; in had_calculate_n_value()
804 if (intelhaddata->dp_output) { in had_prog_n()
833 * PCM | 0 | 1 | 2 | 3 | 4 | 5 | .... |n-1|
837 * PCM | 0 | 1 | 2 | 3 | 4 | 5 | .... |n-1|
841 * PCM | 0 | 1 | 2 | 3 | 4 | 5 | .... |n-1|
851 * pcm_head (=1) --v v-- pcm_filled (=5)
852 * PCM | 0 | 1 | 2 | 3 | 4 | 5 | .... |n-1|
854 * bd_head (=1) --^ ^-- next to fill (= bd_head)
872 int idx = intelhaddata->bd_head; in had_prog_bd()
873 int ofs = intelhaddata->pcmbuf_filled * intelhaddata->period_bytes; in had_prog_bd()
874 u32 addr = substream->runtime->dma_addr + ofs; in had_prog_bd()
877 if (!substream->runtime->no_period_wakeup) in had_prog_bd()
881 intelhaddata->period_bytes); in had_prog_bd()
884 intelhaddata->bd_head++; in had_prog_bd()
885 intelhaddata->bd_head %= intelhaddata->num_bds; in had_prog_bd()
886 intelhaddata->pcmbuf_filled++; in had_prog_bd()
887 intelhaddata->pcmbuf_filled %= substream->runtime->periods; in had_prog_bd()
902 struct snd_pcm_runtime *runtime = substream->runtime; in had_init_ringbuf()
905 num_periods = runtime->periods; in had_init_ringbuf()
906 intelhaddata->num_bds = min(num_periods, HAD_NUM_OF_RING_BUFS); in had_init_ringbuf()
908 intelhaddata->num_bds = max(intelhaddata->num_bds, 2U); in had_init_ringbuf()
909 intelhaddata->period_bytes = in had_init_ringbuf()
910 frames_to_bytes(runtime, runtime->period_size); in had_init_ringbuf()
911 WARN_ON(intelhaddata->period_bytes & 0x3f); in had_init_ringbuf()
913 intelhaddata->bd_head = 0; in had_init_ringbuf()
914 intelhaddata->pcmbuf_head = 0; in had_init_ringbuf()
915 intelhaddata->pcmbuf_filled = 0; in had_init_ringbuf()
918 if (i < intelhaddata->num_bds) in had_init_ringbuf()
924 intelhaddata->bd_head = 0; /* reset at head again before starting */ in had_init_ringbuf()
931 int num_periods = substream->runtime->periods; in had_advance_ringbuf()
937 intelhaddata->pcmbuf_head++; in had_advance_ringbuf()
938 intelhaddata->pcmbuf_head %= num_periods; in had_advance_ringbuf()
942 * returns the current PCM buffer byte position, or -EPIPE for underrun.
951 spin_lock_irqsave(&intelhaddata->had_spinlock, flags); in had_process_ringbuf()
955 AUD_BUF_LEN(intelhaddata->bd_head), in had_process_ringbuf()
957 if (len < 0 || len > intelhaddata->period_bytes) { in had_process_ringbuf()
958 dev_dbg(intelhaddata->dev, "Invalid buf length %d\n", in had_process_ringbuf()
960 len = -EPIPE; in had_process_ringbuf()
968 if (++processed >= intelhaddata->num_bds) { in had_process_ringbuf()
969 len = -EPIPE; /* all empty? - report underrun */ in had_process_ringbuf()
975 len = intelhaddata->period_bytes - len; in had_process_ringbuf()
976 len += intelhaddata->period_bytes * intelhaddata->pcmbuf_head; in had_process_ringbuf()
978 spin_unlock_irqrestore(&intelhaddata->had_spinlock, flags); in had_process_ringbuf()
989 return; /* no stream? - bail out */ in had_process_buffer_done()
991 if (!intelhaddata->connected) { in had_process_buffer_done()
993 goto out; /* disconnected? - bail out */ in had_process_buffer_done()
1024 dev_err(intelhaddata->dev, "Unable to clear UNDERRUN bits\n"); in wait_clear_underrun_bit()
1033 if (!intelhaddata->need_reset || !intelhaddata->connected) in had_do_reset()
1039 intelhaddata->need_reset = false; in had_do_reset()
1053 intelhaddata->need_reset = true; in had_process_buffer_underrun()
1066 runtime = substream->runtime; in had_pcm_open()
1068 pm_runtime_get_sync(intelhaddata->dev); in had_pcm_open()
1071 runtime->hw = had_pcm_hardware; in had_pcm_open()
1081 retval = snd_pcm_hw_constraint_step(substream->runtime, 0, in had_pcm_open()
1091 spin_lock_irq(&intelhaddata->had_spinlock); in had_pcm_open()
1092 intelhaddata->stream_info.substream = substream; in had_pcm_open()
1093 intelhaddata->stream_info.substream_refcount++; in had_pcm_open()
1094 spin_unlock_irq(&intelhaddata->had_spinlock); in had_pcm_open()
1098 pm_runtime_mark_last_busy(intelhaddata->dev); in had_pcm_open()
1099 pm_runtime_put_autosuspend(intelhaddata->dev); in had_pcm_open()
1113 spin_lock_irq(&intelhaddata->had_spinlock); in had_pcm_close()
1114 intelhaddata->stream_info.substream = NULL; in had_pcm_close()
1115 intelhaddata->stream_info.substream_refcount--; in had_pcm_close()
1116 while (intelhaddata->stream_info.substream_refcount > 0) { in had_pcm_close()
1117 spin_unlock_irq(&intelhaddata->had_spinlock); in had_pcm_close()
1119 spin_lock_irq(&intelhaddata->had_spinlock); in had_pcm_close()
1121 spin_unlock_irq(&intelhaddata->had_spinlock); in had_pcm_close()
1123 pm_runtime_mark_last_busy(intelhaddata->dev); in had_pcm_close()
1124 pm_runtime_put_autosuspend(intelhaddata->dev); in had_pcm_close()
1139 dev_dbg(intelhaddata->dev, "%s:allocated memory = %d\n", in had_pcm_hw_params()
1167 spin_lock(&intelhaddata->had_spinlock); in had_pcm_trigger()
1181 intelhaddata->need_reset = true; in had_pcm_trigger()
1185 retval = -EINVAL; in had_pcm_trigger()
1187 spin_unlock(&intelhaddata->had_spinlock); in had_pcm_trigger()
1203 runtime = substream->runtime; in had_pcm_prepare()
1205 dev_dbg(intelhaddata->dev, "period_size=%d\n", in had_pcm_prepare()
1206 (int)frames_to_bytes(runtime, runtime->period_size)); in had_pcm_prepare()
1207 dev_dbg(intelhaddata->dev, "periods=%d\n", runtime->periods); in had_pcm_prepare()
1208 dev_dbg(intelhaddata->dev, "buffer_size=%d\n", in had_pcm_prepare()
1210 dev_dbg(intelhaddata->dev, "rate=%d\n", runtime->rate); in had_pcm_prepare()
1211 dev_dbg(intelhaddata->dev, "channels=%d\n", runtime->channels); in had_pcm_prepare()
1216 disp_samp_freq = intelhaddata->tmds_clock_speed; in had_pcm_prepare()
1218 retval = had_prog_n(substream->runtime->rate, &n_param, intelhaddata); in had_pcm_prepare()
1220 dev_err(intelhaddata->dev, in had_pcm_prepare()
1225 if (intelhaddata->dp_output) in had_pcm_prepare()
1226 link_rate = intelhaddata->link_rate; in had_pcm_prepare()
1228 had_prog_cts(substream->runtime->rate, disp_samp_freq, link_rate, in had_pcm_prepare()
1259 if (!intelhaddata->connected) in had_pcm_pointer()
1265 len = bytes_to_frames(substream->runtime, len); in had_pcm_pointer()
1267 len %= substream->runtime->buffer_size; in had_pcm_pointer()
1277 vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); in had_pcm_mmap()
1278 return remap_pfn_range(vma, vma->vm_start, in had_pcm_mmap()
1279 substream->runtime->dma_addr >> PAGE_SHIFT, in had_pcm_mmap()
1280 vma->vm_end - vma->vm_start, vma->vm_page_prot); in had_pcm_mmap()
1313 disp_samp_freq = intelhaddata->tmds_clock_speed; in had_process_mode_change()
1315 retval = had_prog_n(substream->runtime->rate, &n_param, intelhaddata); in had_process_mode_change()
1317 dev_err(intelhaddata->dev, in had_process_mode_change()
1322 if (intelhaddata->dp_output) in had_process_mode_change()
1323 link_rate = intelhaddata->link_rate; in had_process_mode_change()
1325 had_prog_cts(substream->runtime->rate, disp_samp_freq, link_rate, in had_process_mode_change()
1341 spin_lock_irq(&intelhaddata->had_spinlock); in had_process_hot_plug()
1342 if (intelhaddata->connected) { in had_process_hot_plug()
1343 dev_dbg(intelhaddata->dev, "Device already connected\n"); in had_process_hot_plug()
1344 spin_unlock_irq(&intelhaddata->had_spinlock); in had_process_hot_plug()
1351 intelhaddata->connected = true; in had_process_hot_plug()
1352 dev_dbg(intelhaddata->dev, in had_process_hot_plug()
1355 spin_unlock_irq(&intelhaddata->had_spinlock); in had_process_hot_plug()
1366 snd_jack_report(intelhaddata->jack, SND_JACK_AVOUT); in had_process_hot_plug()
1374 spin_lock_irq(&intelhaddata->had_spinlock); in had_process_hot_unplug()
1375 if (!intelhaddata->connected) { in had_process_hot_unplug()
1376 dev_dbg(intelhaddata->dev, "Device already disconnected\n"); in had_process_hot_unplug()
1377 spin_unlock_irq(&intelhaddata->had_spinlock); in had_process_hot_unplug()
1385 intelhaddata->connected = false; in had_process_hot_unplug()
1386 dev_dbg(intelhaddata->dev, in had_process_hot_unplug()
1389 spin_unlock_irq(&intelhaddata->had_spinlock); in had_process_hot_unplug()
1391 kfree(intelhaddata->chmap->chmap); in had_process_hot_unplug()
1392 intelhaddata->chmap->chmap = NULL; in had_process_hot_unplug()
1401 snd_jack_report(intelhaddata->jack, 0); in had_process_hot_unplug()
1411 uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; in had_iec958_info()
1412 uinfo->count = 1; in had_iec958_info()
1421 mutex_lock(&intelhaddata->mutex); in had_iec958_get()
1422 ucontrol->value.iec958.status[0] = (intelhaddata->aes_bits >> 0) & 0xff; in had_iec958_get()
1423 ucontrol->value.iec958.status[1] = (intelhaddata->aes_bits >> 8) & 0xff; in had_iec958_get()
1424 ucontrol->value.iec958.status[2] = in had_iec958_get()
1425 (intelhaddata->aes_bits >> 16) & 0xff; in had_iec958_get()
1426 ucontrol->value.iec958.status[3] = in had_iec958_get()
1427 (intelhaddata->aes_bits >> 24) & 0xff; in had_iec958_get()
1428 mutex_unlock(&intelhaddata->mutex); in had_iec958_get()
1435 ucontrol->value.iec958.status[0] = 0xff; in had_iec958_mask_get()
1436 ucontrol->value.iec958.status[1] = 0xff; in had_iec958_mask_get()
1437 ucontrol->value.iec958.status[2] = 0xff; in had_iec958_mask_get()
1438 ucontrol->value.iec958.status[3] = 0xff; in had_iec958_mask_get()
1449 val = (ucontrol->value.iec958.status[0] << 0) | in had_iec958_put()
1450 (ucontrol->value.iec958.status[1] << 8) | in had_iec958_put()
1451 (ucontrol->value.iec958.status[2] << 16) | in had_iec958_put()
1452 (ucontrol->value.iec958.status[3] << 24); in had_iec958_put()
1453 mutex_lock(&intelhaddata->mutex); in had_iec958_put()
1454 if (intelhaddata->aes_bits != val) { in had_iec958_put()
1455 intelhaddata->aes_bits = val; in had_iec958_put()
1458 mutex_unlock(&intelhaddata->mutex); in had_iec958_put()
1465 uinfo->type = SNDRV_CTL_ELEM_TYPE_BYTES; in had_ctl_eld_info()
1466 uinfo->count = HDMI_MAX_ELD_BYTES; in had_ctl_eld_info()
1475 mutex_lock(&intelhaddata->mutex); in had_ctl_eld_get()
1476 memcpy(ucontrol->value.bytes.data, intelhaddata->eld, in had_ctl_eld_get()
1478 mutex_unlock(&intelhaddata->mutex); in had_ctl_eld_get()
1487 .info = had_iec958_info, /* shared */
1528 struct snd_intelhad *ctx = &card_ctx->pcm_ctx[port]; in display_pipe_interrupt_handler()
1529 int pipe = ctx->pipe; in display_pipe_interrupt_handler()
1551 ctx = &card_ctx->pcm_ctx[single_port ? 0 : port]; in notify_audio_lpe()
1553 ctx->port = port; in notify_audio_lpe()
1555 schedule_work(&ctx->hdmi_audio_wq); in notify_audio_lpe()
1563 struct intel_hdmi_lpe_audio_pdata *pdata = ctx->dev->platform_data; in had_audio_wq()
1564 struct intel_hdmi_lpe_audio_port_pdata *ppdata = &pdata->port[ctx->port]; in had_audio_wq()
1566 pm_runtime_get_sync(ctx->dev); in had_audio_wq()
1567 mutex_lock(&ctx->mutex); in had_audio_wq()
1568 if (ppdata->pipe < 0) { in had_audio_wq()
1569 dev_dbg(ctx->dev, "%s: Event: HAD_NOTIFY_HOT_UNPLUG : port = %d\n", in had_audio_wq()
1570 __func__, ctx->port); in had_audio_wq()
1572 memset(ctx->eld, 0, sizeof(ctx->eld)); /* clear the old ELD */ in had_audio_wq()
1574 ctx->dp_output = false; in had_audio_wq()
1575 ctx->tmds_clock_speed = 0; in had_audio_wq()
1576 ctx->link_rate = 0; in had_audio_wq()
1581 ctx->pipe = -1; in had_audio_wq()
1583 dev_dbg(ctx->dev, "%s: HAD_NOTIFY_ELD : port = %d, tmds = %d\n", in had_audio_wq()
1584 __func__, ctx->port, ppdata->ls_clock); in had_audio_wq()
1586 memcpy(ctx->eld, ppdata->eld, sizeof(ctx->eld)); in had_audio_wq()
1588 ctx->dp_output = ppdata->dp_output; in had_audio_wq()
1589 if (ctx->dp_output) { in had_audio_wq()
1590 ctx->tmds_clock_speed = 0; in had_audio_wq()
1591 ctx->link_rate = ppdata->ls_clock; in had_audio_wq()
1593 ctx->tmds_clock_speed = ppdata->ls_clock; in had_audio_wq()
1594 ctx->link_rate = 0; in had_audio_wq()
1603 ctx->pipe = ppdata->pipe; in had_audio_wq()
1609 mutex_unlock(&ctx->mutex); in had_audio_wq()
1610 pm_runtime_mark_last_busy(ctx->dev); in had_audio_wq()
1611 pm_runtime_put_autosuspend(ctx->dev); in had_audio_wq()
1624 "HDMI/DP,pcm=%d", pcm->device); in had_create_jack()
1626 err = snd_jack_new(ctx->card_ctx->card, hdmi_str, in had_create_jack()
1627 SND_JACK_AVOUT, &ctx->jack, in had_create_jack()
1631 ctx->jack->private_data = ctx; in had_create_jack()
1643 snd_power_change_state(card_ctx->card, SNDRV_CTL_POWER_D3hot); in hdmi_lpe_audio_suspend()
1654 snd_power_change_state(card_ctx->card, SNDRV_CTL_POWER_D0); in hdmi_lpe_audio_resume()
1662 struct snd_intelhad_card *card_ctx = card->private_data; in hdmi_lpe_audio_free()
1663 struct intel_hdmi_lpe_audio_pdata *pdata = card_ctx->dev->platform_data; in hdmi_lpe_audio_free()
1666 spin_lock_irq(&pdata->lpe_audio_slock); in hdmi_lpe_audio_free()
1667 pdata->notify_audio_lpe = NULL; in hdmi_lpe_audio_free()
1668 spin_unlock_irq(&pdata->lpe_audio_slock); in hdmi_lpe_audio_free()
1671 struct snd_intelhad *ctx = &card_ctx->pcm_ctx[port]; in hdmi_lpe_audio_free()
1673 cancel_work_sync(&ctx->hdmi_audio_wq); in hdmi_lpe_audio_free()
1676 if (card_ctx->mmio_start) in hdmi_lpe_audio_free()
1677 iounmap(card_ctx->mmio_start); in hdmi_lpe_audio_free()
1678 if (card_ctx->irq >= 0) in hdmi_lpe_audio_free()
1679 free_irq(card_ctx->irq, card_ctx); in hdmi_lpe_audio_free()
1683 * hdmi_lpe_audio_probe - start bridge with i915
1686 * hdmi-lpe-audio platform device.
1699 pdata = pdev->dev.platform_data; in hdmi_lpe_audio_probe()
1701 dev_err(&pdev->dev, "%s: quit: pdata not allocated by i915!!\n", __func__); in hdmi_lpe_audio_probe()
1702 return -EINVAL; in hdmi_lpe_audio_probe()
1712 dev_err(&pdev->dev, "Could not get IO_MEM resources\n"); in hdmi_lpe_audio_probe()
1713 return -ENXIO; in hdmi_lpe_audio_probe()
1717 ret = snd_card_new(&pdev->dev, hdmi_card_index, hdmi_card_id, in hdmi_lpe_audio_probe()
1722 card_ctx = card->private_data; in hdmi_lpe_audio_probe()
1723 card_ctx->dev = &pdev->dev; in hdmi_lpe_audio_probe()
1724 card_ctx->card = card; in hdmi_lpe_audio_probe()
1725 strcpy(card->driver, INTEL_HAD); in hdmi_lpe_audio_probe()
1726 strcpy(card->shortname, "Intel HDMI/DP LPE Audio"); in hdmi_lpe_audio_probe()
1727 strcpy(card->longname, "Intel HDMI/DP LPE Audio"); in hdmi_lpe_audio_probe()
1729 card_ctx->irq = -1; in hdmi_lpe_audio_probe()
1731 card->private_free = hdmi_lpe_audio_free; in hdmi_lpe_audio_probe()
1735 card_ctx->num_pipes = pdata->num_pipes; in hdmi_lpe_audio_probe()
1736 card_ctx->num_ports = single_port ? 1 : pdata->num_ports; in hdmi_lpe_audio_probe()
1739 ctx = &card_ctx->pcm_ctx[port]; in hdmi_lpe_audio_probe()
1740 ctx->card_ctx = card_ctx; in hdmi_lpe_audio_probe()
1741 ctx->dev = card_ctx->dev; in hdmi_lpe_audio_probe()
1742 ctx->port = single_port ? -1 : port; in hdmi_lpe_audio_probe()
1743 ctx->pipe = -1; in hdmi_lpe_audio_probe()
1745 spin_lock_init(&ctx->had_spinlock); in hdmi_lpe_audio_probe()
1746 mutex_init(&ctx->mutex); in hdmi_lpe_audio_probe()
1747 INIT_WORK(&ctx->hdmi_audio_wq, had_audio_wq); in hdmi_lpe_audio_probe()
1750 dev_dbg(&pdev->dev, "%s: mmio_start = 0x%x, mmio_end = 0x%x\n", in hdmi_lpe_audio_probe()
1751 __func__, (unsigned int)res_mmio->start, in hdmi_lpe_audio_probe()
1752 (unsigned int)res_mmio->end); in hdmi_lpe_audio_probe()
1754 card_ctx->mmio_start = ioremap(res_mmio->start, in hdmi_lpe_audio_probe()
1756 if (!card_ctx->mmio_start) { in hdmi_lpe_audio_probe()
1757 dev_err(&pdev->dev, "Could not get ioremap\n"); in hdmi_lpe_audio_probe()
1758 ret = -EACCES; in hdmi_lpe_audio_probe()
1764 pdev->name, card_ctx); in hdmi_lpe_audio_probe()
1766 dev_err(&pdev->dev, "request_irq failed\n"); in hdmi_lpe_audio_probe()
1770 card_ctx->irq = irq; in hdmi_lpe_audio_probe()
1773 dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)); in hdmi_lpe_audio_probe()
1774 dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); in hdmi_lpe_audio_probe()
1778 card_ctx->num_pipes = pdata->num_pipes; in hdmi_lpe_audio_probe()
1779 card_ctx->num_ports = single_port ? 1 : pdata->num_ports; in hdmi_lpe_audio_probe()
1784 ctx = &card_ctx->pcm_ctx[port]; in hdmi_lpe_audio_probe()
1791 pcm->private_data = ctx; in hdmi_lpe_audio_probe()
1792 pcm->info_flags = 0; in hdmi_lpe_audio_probe()
1793 strlcpy(pcm->name, card->shortname, strlen(card->shortname)); in hdmi_lpe_audio_probe()
1801 card->dev, HAD_DEFAULT_BUFFER, in hdmi_lpe_audio_probe()
1810 ret = -ENOMEM; in hdmi_lpe_audio_probe()
1814 kctl->id.device = pcm->device; in hdmi_lpe_audio_probe()
1835 spin_lock_irq(&pdata->lpe_audio_slock); in hdmi_lpe_audio_probe()
1836 pdata->notify_audio_lpe = notify_audio_lpe; in hdmi_lpe_audio_probe()
1837 spin_unlock_irq(&pdata->lpe_audio_slock); in hdmi_lpe_audio_probe()
1839 pm_runtime_use_autosuspend(&pdev->dev); in hdmi_lpe_audio_probe()
1840 pm_runtime_mark_last_busy(&pdev->dev); in hdmi_lpe_audio_probe()
1842 dev_dbg(&pdev->dev, "%s: handle pending notification\n", __func__); in hdmi_lpe_audio_probe()
1844 struct snd_intelhad *ctx = &card_ctx->pcm_ctx[port]; in hdmi_lpe_audio_probe()
1846 schedule_work(&ctx->hdmi_audio_wq); in hdmi_lpe_audio_probe()
1857 * hdmi_lpe_audio_remove - stop bridge with i915
1865 snd_card_free(card_ctx->card); in hdmi_lpe_audio_remove()
1875 .name = "hdmi-lpe-audio",