Lines Matching refs:dw

21 #include "dw-hdmi-audio.h"
23 #define DRIVER_NAME "dw-hdmi-ahb-audio"
153 static void dw_hdmi_reformat_iec958(struct snd_dw_hdmi *dw,
156 u32 *src = dw->buf_src + offset;
157 u32 *dst = dw->buf_dst + offset;
158 u32 *end = dw->buf_src + offset + bytes;
181 static void dw_hdmi_reformat_s24(struct snd_dw_hdmi *dw,
184 u32 *src = dw->buf_src + offset;
185 u32 *dst = dw->buf_dst + offset;
186 u32 *end = dw->buf_src + offset + bytes;
192 cs = dw->cs[dw->iec_offset++];
193 if (dw->iec_offset >= 192)
194 dw->iec_offset = 0;
196 i = dw->channels;
209 static void dw_hdmi_create_cs(struct snd_dw_hdmi *dw,
217 memset(dw->cs, 0, sizeof(dw->cs));
227 dw->cs[i * 8 + j][ch] = (c & 1) << 2;
230 dw->cs[0][0] |= BIT(4);
233 static void dw_hdmi_start_dma(struct snd_dw_hdmi *dw)
235 void __iomem *base = dw->data.base;
236 unsigned offset = dw->buf_offset;
237 unsigned period = dw->buf_period;
240 dw->reformat(dw, offset, period);
246 start = dw->buf_addr + offset;
257 if (offset >= dw->buf_size)
259 dw->buf_offset = offset;
262 static void dw_hdmi_stop_dma(struct snd_dw_hdmi *dw)
265 writeb_relaxed(~0, dw->data.base + HDMI_AHB_DMA_MASK);
266 writeb_relaxed(HDMI_AHB_DMA_STOP_STOP, dw->data.base + HDMI_AHB_DMA_STOP);
271 struct snd_dw_hdmi *dw = data;
275 stat = readb_relaxed(dw->data.base + HDMI_IH_AHBDMAAUD_STAT0);
279 writeb_relaxed(stat, dw->data.base + HDMI_IH_AHBDMAAUD_STAT0);
281 substream = dw->substream;
285 spin_lock(&dw->lock);
286 if (dw->substream)
287 dw_hdmi_start_dma(dw);
288 spin_unlock(&dw->lock);
321 struct snd_dw_hdmi *dw = substream->private_data;
322 void __iomem *base = dw->data.base;
328 eld = dw->data.get_eld(dw->data.hdmi);
363 ret = request_irq(dw->data.irq, snd_dw_hdmi_irq, IRQF_SHARED,
364 "dw-hdmi-audio", dw);
378 struct snd_dw_hdmi *dw = substream->private_data;
382 dw->data.base + HDMI_IH_MUTE_AHBDMAAUD_STAT0);
384 free_irq(dw->data.irq, dw);
405 struct snd_dw_hdmi *dw = substream->private_data;
409 switch (dw->revision) {
428 dw_hdmi_set_sample_rate(dw->data.hdmi, runtime->rate);
437 writeb_relaxed(threshold, dw->data.base + HDMI_AHB_DMA_THRSLD);
438 writeb_relaxed(conf0, dw->data.base + HDMI_AHB_DMA_CONF0);
439 writeb_relaxed(conf1, dw->data.base + HDMI_AHB_DMA_CONF1);
441 dw_hdmi_set_channel_count(dw->data.hdmi, runtime->channels);
442 dw_hdmi_set_channel_allocation(dw->data.hdmi, ca);
446 dw->reformat = dw_hdmi_reformat_iec958;
449 dw_hdmi_create_cs(dw, runtime);
450 dw->reformat = dw_hdmi_reformat_s24;
453 dw->iec_offset = 0;
454 dw->channels = runtime->channels;
455 dw->buf_src = runtime->dma_area;
456 dw->buf_dst = substream->dma_buffer.area;
457 dw->buf_addr = substream->dma_buffer.addr;
458 dw->buf_period = snd_pcm_lib_period_bytes(substream);
459 dw->buf_size = snd_pcm_lib_buffer_bytes(substream);
466 struct snd_dw_hdmi *dw = substream->private_data;
472 spin_lock_irqsave(&dw->lock, flags);
473 dw->buf_offset = 0;
474 dw->substream = substream;
475 dw_hdmi_start_dma(dw);
476 dw_hdmi_audio_enable(dw->data.hdmi);
477 spin_unlock_irqrestore(&dw->lock, flags);
482 spin_lock_irqsave(&dw->lock, flags);
483 dw->substream = NULL;
484 dw_hdmi_stop_dma(dw);
485 dw_hdmi_audio_disable(dw->data.hdmi);
486 spin_unlock_irqrestore(&dw->lock, flags);
500 struct snd_dw_hdmi *dw = substream->private_data;
506 return bytes_to_frames(runtime, dw->buf_offset);
525 struct snd_dw_hdmi *dw;
535 dev_err(dev, "dw-hdmi-audio: unknown revision 0x%02x\n",
551 dw = card->private_data;
552 dw->card = card;
553 dw->data = *data;
554 dw->revision = revision;
556 spin_lock_init(&dw->lock);
562 dw->pcm = pcm;
563 pcm->private_data = dw;
578 platform_set_drvdata(pdev, dw);
589 struct snd_dw_hdmi *dw = platform_get_drvdata(pdev);
591 snd_card_free(dw->card);
603 struct snd_dw_hdmi *dw = dev_get_drvdata(dev);
605 snd_power_change_state(dw->card, SNDRV_CTL_POWER_D3cold);
612 struct snd_dw_hdmi *dw = dev_get_drvdata(dev);
614 snd_power_change_state(dw->card, SNDRV_CTL_POWER_D0);