Lines Matching +full:a +full:- +full:display
4 * Permission is hereby granted, free of charge, to any person obtaining a
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
24 * Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
34 * Atom platforms (e.g. valleyview and cherryTrail) integrates a DMA-based
39 * The interface is handled by a separate standalone driver maintained in the
41 * subsystems, a bridge is setup between the hdmi-lpe-audio and i915:
42 * 1. Create a platform device to share MMIO/IRQ resources
45 * the hdmi-lpe-audio driver probes the lpe audio device and creates a new
50 * uninstall the hdmi-lpe-audio driver before uninstalling i915 module,
51 * otherwise we might run into use-after-free issues after i915 removes the
52 * platform device: even though hdmi-lpe-audio driver is released, the modules
80 #define HAS_LPE_AUDIO(display) ((display)->audio.lpe.platdev) argument
83 lpe_audio_platdev_create(struct intel_display *display) in lpe_audio_platdev_create() argument
85 struct pci_dev *pdev = to_pci_dev(display->drm->dev); in lpe_audio_platdev_create()
93 return ERR_PTR(-ENOMEM); in lpe_audio_platdev_create()
98 return ERR_PTR(-ENOMEM); in lpe_audio_platdev_create()
101 rsc[0].start = display->audio.lpe.irq; in lpe_audio_platdev_create()
102 rsc[0].end = display->audio.lpe.irq; in lpe_audio_platdev_create()
104 rsc[0].name = "hdmi-lpe-audio-irq"; in lpe_audio_platdev_create()
109 I915_HDMI_LPE_AUDIO_BASE + I915_HDMI_LPE_AUDIO_SIZE - 1; in lpe_audio_platdev_create()
111 rsc[1].name = "hdmi-lpe-audio-mmio"; in lpe_audio_platdev_create()
113 pinfo.parent = display->drm->dev; in lpe_audio_platdev_create()
114 pinfo.name = "hdmi-lpe-audio"; in lpe_audio_platdev_create()
115 pinfo.id = -1; in lpe_audio_platdev_create()
122 pdata->num_pipes = INTEL_NUM_PIPES(display); in lpe_audio_platdev_create()
123 pdata->num_ports = display->platform.cherryview ? 3 : 2; /* B,C,D or B,C */ in lpe_audio_platdev_create()
124 pdata->port[0].pipe = -1; in lpe_audio_platdev_create()
125 pdata->port[1].pipe = -1; in lpe_audio_platdev_create()
126 pdata->port[2].pipe = -1; in lpe_audio_platdev_create()
127 spin_lock_init(&pdata->lpe_audio_slock); in lpe_audio_platdev_create()
134 drm_err(display->drm, in lpe_audio_platdev_create()
139 pm_runtime_no_callbacks(&platdev->dev); in lpe_audio_platdev_create()
144 static void lpe_audio_platdev_destroy(struct intel_display *display) in lpe_audio_platdev_destroy() argument
146 /* XXX Note that platform_device_register_full() allocates a dma_mask in lpe_audio_platdev_destroy()
150 * allocation here - it should be fixed in the platform_device rather in lpe_audio_platdev_destroy()
154 platform_device_unregister(display->audio.lpe.platdev); in lpe_audio_platdev_destroy()
171 static int lpe_audio_irq_init(struct intel_display *display) in lpe_audio_irq_init() argument
173 struct drm_i915_private *dev_priv = to_i915(display->drm); in lpe_audio_irq_init()
174 int irq = display->audio.lpe.irq; in lpe_audio_irq_init()
176 drm_WARN_ON(display->drm, !intel_irqs_enabled(dev_priv)); in lpe_audio_irq_init()
185 static bool lpe_audio_detect(struct intel_display *display) in lpe_audio_detect() argument
189 if (display->platform.valleyview || display->platform.cherryview) { in lpe_audio_detect()
199 drm_info(display->drm, in lpe_audio_detect()
207 static int lpe_audio_setup(struct intel_display *display) in lpe_audio_setup() argument
211 display->audio.lpe.irq = irq_alloc_desc(0); in lpe_audio_setup()
212 if (display->audio.lpe.irq < 0) { in lpe_audio_setup()
213 drm_err(display->drm, "Failed to allocate IRQ desc: %d\n", in lpe_audio_setup()
214 display->audio.lpe.irq); in lpe_audio_setup()
215 ret = display->audio.lpe.irq; in lpe_audio_setup()
219 drm_dbg(display->drm, "irq = %d\n", display->audio.lpe.irq); in lpe_audio_setup()
221 ret = lpe_audio_irq_init(display); in lpe_audio_setup()
224 drm_err(display->drm, in lpe_audio_setup()
230 display->audio.lpe.platdev = lpe_audio_platdev_create(display); in lpe_audio_setup()
232 if (IS_ERR(display->audio.lpe.platdev)) { in lpe_audio_setup()
233 ret = PTR_ERR(display->audio.lpe.platdev); in lpe_audio_setup()
234 drm_err(display->drm, in lpe_audio_setup()
243 intel_de_write(display, VLV_AUD_CHICKEN_BIT_REG, in lpe_audio_setup()
248 irq_free_desc(display->audio.lpe.irq); in lpe_audio_setup()
250 display->audio.lpe.irq = -1; in lpe_audio_setup()
251 display->audio.lpe.platdev = NULL; in lpe_audio_setup()
256 * intel_lpe_audio_irq_handler() - forwards the LPE audio irq
257 * @display: display device
262 void intel_lpe_audio_irq_handler(struct intel_display *display) in intel_lpe_audio_irq_handler() argument
266 if (!HAS_LPE_AUDIO(display)) in intel_lpe_audio_irq_handler()
269 ret = generic_handle_irq(display->audio.lpe.irq); in intel_lpe_audio_irq_handler()
271 drm_err_ratelimited(display->drm, in intel_lpe_audio_irq_handler()
276 * intel_lpe_audio_init() - detect and setup the bridge between HDMI LPE Audio
278 * @display: display device
280 * Return: 0 if successful. non-zero if detection or
283 int intel_lpe_audio_init(struct intel_display *display) in intel_lpe_audio_init() argument
285 int ret = -ENODEV; in intel_lpe_audio_init()
287 if (lpe_audio_detect(display)) { in intel_lpe_audio_init()
288 ret = lpe_audio_setup(display); in intel_lpe_audio_init()
290 drm_err(display->drm, in intel_lpe_audio_init()
297 * intel_lpe_audio_teardown() - destroy the bridge between HDMI LPE
299 * @display: display device
301 * release all the resources for LPE audio <-> i915 bridge.
303 void intel_lpe_audio_teardown(struct intel_display *display) in intel_lpe_audio_teardown() argument
305 if (!HAS_LPE_AUDIO(display)) in intel_lpe_audio_teardown()
308 lpe_audio_platdev_destroy(display); in intel_lpe_audio_teardown()
310 irq_free_desc(display->audio.lpe.irq); in intel_lpe_audio_teardown()
312 display->audio.lpe.irq = -1; in intel_lpe_audio_teardown()
313 display->audio.lpe.platdev = NULL; in intel_lpe_audio_teardown()
317 * intel_lpe_audio_notify() - notify lpe audio event
319 * @display: display device
324 * @dp_output: Driving a DP output?
328 void intel_lpe_audio_notify(struct intel_display *display, in intel_lpe_audio_notify() argument
337 if (!HAS_LPE_AUDIO(display)) in intel_lpe_audio_notify()
340 pdata = dev_get_platdata(&display->audio.lpe.platdev->dev); in intel_lpe_audio_notify()
341 ppdata = &pdata->port[port - PORT_B]; in intel_lpe_audio_notify()
343 spin_lock_irqsave(&pdata->lpe_audio_slock, irqflags); in intel_lpe_audio_notify()
345 audio_enable = intel_de_read(display, VLV_AUD_PORT_EN_DBG(port)); in intel_lpe_audio_notify()
348 memcpy(ppdata->eld, eld, HDMI_MAX_ELD_BYTES); in intel_lpe_audio_notify()
349 ppdata->pipe = cpu_transcoder; in intel_lpe_audio_notify()
350 ppdata->ls_clock = ls_clock; in intel_lpe_audio_notify()
351 ppdata->dp_output = dp_output; in intel_lpe_audio_notify()
354 intel_de_write(display, VLV_AUD_PORT_EN_DBG(port), in intel_lpe_audio_notify()
357 memset(ppdata->eld, 0, HDMI_MAX_ELD_BYTES); in intel_lpe_audio_notify()
358 ppdata->pipe = -1; in intel_lpe_audio_notify()
359 ppdata->ls_clock = 0; in intel_lpe_audio_notify()
360 ppdata->dp_output = false; in intel_lpe_audio_notify()
363 intel_de_write(display, VLV_AUD_PORT_EN_DBG(port), in intel_lpe_audio_notify()
367 if (pdata->notify_audio_lpe) in intel_lpe_audio_notify()
368 pdata->notify_audio_lpe(display->audio.lpe.platdev, port - PORT_B); in intel_lpe_audio_notify()
370 spin_unlock_irqrestore(&pdata->lpe_audio_slock, irqflags); in intel_lpe_audio_notify()