Lines Matching +full:irq +full:- +full:device

24  *    Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
34 * Atom platforms (e.g. valleyview and cherryTrail) integrates a DMA-based
41 * subsystems, a bridge is setup between the hdmi-lpe-audio and i915:
42 * 1. Create a platform device to share MMIO/IRQ resources
43 * 2. Make the platform device child of i915 device for runtime PM.
44 * 3. Create IRQ chip to forward the LPE audio irqs.
45 * the hdmi-lpe-audio driver probes the lpe audio device and creates a new
49 * Due to the restriction in Linux platform device model, user need manually
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
65 #include <linux/device.h>
66 #include <linux/irq.h>
80 #define HAS_LPE_AUDIO(dev_priv) ((dev_priv)->display.audio.lpe.platdev != NULL)
85 struct pci_dev *pdev = to_pci_dev(dev_priv->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 = rsc[0].end = dev_priv->display.audio.lpe.irq; in lpe_audio_platdev_create()
103 rsc[0].name = "hdmi-lpe-audio-irq"; in lpe_audio_platdev_create()
108 I915_HDMI_LPE_AUDIO_BASE + I915_HDMI_LPE_AUDIO_SIZE - 1; in lpe_audio_platdev_create()
110 rsc[1].name = "hdmi-lpe-audio-mmio"; in lpe_audio_platdev_create()
112 pinfo.parent = dev_priv->drm.dev; in lpe_audio_platdev_create()
113 pinfo.name = "hdmi-lpe-audio"; in lpe_audio_platdev_create()
114 pinfo.id = -1; in lpe_audio_platdev_create()
121 pdata->num_pipes = INTEL_NUM_PIPES(dev_priv); in lpe_audio_platdev_create()
122 pdata->num_ports = IS_CHERRYVIEW(dev_priv) ? 3 : 2; /* B,C,D or B,C */ in lpe_audio_platdev_create()
123 pdata->port[0].pipe = -1; in lpe_audio_platdev_create()
124 pdata->port[1].pipe = -1; in lpe_audio_platdev_create()
125 pdata->port[2].pipe = -1; in lpe_audio_platdev_create()
126 spin_lock_init(&pdata->lpe_audio_slock); in lpe_audio_platdev_create()
133 drm_err(&dev_priv->drm, in lpe_audio_platdev_create()
134 "Failed to allocate LPE audio platform device\n"); in lpe_audio_platdev_create()
138 pm_runtime_no_callbacks(&platdev->dev); in lpe_audio_platdev_create()
149 * allocation here - it should be fixed in the platform_device rather in lpe_audio_platdev_destroy()
153 platform_device_unregister(dev_priv->display.audio.lpe.platdev); in lpe_audio_platdev_destroy()
172 int irq = dev_priv->display.audio.lpe.irq; in lpe_audio_irq_init() local
174 drm_WARN_ON(&dev_priv->drm, !intel_irqs_enabled(dev_priv)); in lpe_audio_irq_init()
175 irq_set_chip_and_handler_name(irq, in lpe_audio_irq_init()
180 return irq_set_chip_data(irq, dev_priv); in lpe_audio_irq_init()
197 drm_info(&dev_priv->drm, in lpe_audio_detect()
209 dev_priv->display.audio.lpe.irq = irq_alloc_desc(0); in lpe_audio_setup()
210 if (dev_priv->display.audio.lpe.irq < 0) { in lpe_audio_setup()
211 drm_err(&dev_priv->drm, "Failed to allocate IRQ desc: %d\n", in lpe_audio_setup()
212 dev_priv->display.audio.lpe.irq); in lpe_audio_setup()
213 ret = dev_priv->display.audio.lpe.irq; in lpe_audio_setup()
217 drm_dbg(&dev_priv->drm, "irq = %d\n", dev_priv->display.audio.lpe.irq); in lpe_audio_setup()
222 drm_err(&dev_priv->drm, in lpe_audio_setup()
228 dev_priv->display.audio.lpe.platdev = lpe_audio_platdev_create(dev_priv); in lpe_audio_setup()
230 if (IS_ERR(dev_priv->display.audio.lpe.platdev)) { in lpe_audio_setup()
231 ret = PTR_ERR(dev_priv->display.audio.lpe.platdev); in lpe_audio_setup()
232 drm_err(&dev_priv->drm, in lpe_audio_setup()
233 "Failed to create lpe audio platform device: %d\n", in lpe_audio_setup()
246 irq_free_desc(dev_priv->display.audio.lpe.irq); in lpe_audio_setup()
248 dev_priv->display.audio.lpe.irq = -1; in lpe_audio_setup()
249 dev_priv->display.audio.lpe.platdev = NULL; in lpe_audio_setup()
254 * intel_lpe_audio_irq_handler() - forwards the LPE audio irq
255 * @dev_priv: the i915 drm device private data
257 * the LPE Audio irq is forwarded to the irq handler registered by LPE audio
267 ret = generic_handle_irq(dev_priv->display.audio.lpe.irq); in intel_lpe_audio_irq_handler()
269 drm_err_ratelimited(&dev_priv->drm, in intel_lpe_audio_irq_handler()
270 "error handling LPE audio irq: %d\n", ret); in intel_lpe_audio_irq_handler()
274 * intel_lpe_audio_init() - detect and setup the bridge between HDMI LPE Audio
276 * @dev_priv: the i915 drm device private data
278 * Return: 0 if successful. non-zero if detection or
283 int ret = -ENODEV; in intel_lpe_audio_init()
288 drm_err(&dev_priv->drm, in intel_lpe_audio_init()
295 * intel_lpe_audio_teardown() - destroy the bridge between HDMI LPE
297 * @dev_priv: the i915 drm device private data
299 * release all the resources for LPE audio <-> i915 bridge.
308 irq_free_desc(dev_priv->display.audio.lpe.irq); in intel_lpe_audio_teardown()
310 dev_priv->display.audio.lpe.irq = -1; in intel_lpe_audio_teardown()
311 dev_priv->display.audio.lpe.platdev = NULL; in intel_lpe_audio_teardown()
315 * intel_lpe_audio_notify() - notify lpe audio event
317 * @dev_priv: the i915 drm device private data
338 pdata = dev_get_platdata(&dev_priv->display.audio.lpe.platdev->dev); in intel_lpe_audio_notify()
339 ppdata = &pdata->port[port - PORT_B]; in intel_lpe_audio_notify()
341 spin_lock_irqsave(&pdata->lpe_audio_slock, irqflags); in intel_lpe_audio_notify()
346 memcpy(ppdata->eld, eld, HDMI_MAX_ELD_BYTES); in intel_lpe_audio_notify()
347 ppdata->pipe = cpu_transcoder; in intel_lpe_audio_notify()
348 ppdata->ls_clock = ls_clock; in intel_lpe_audio_notify()
349 ppdata->dp_output = dp_output; in intel_lpe_audio_notify()
355 memset(ppdata->eld, 0, HDMI_MAX_ELD_BYTES); in intel_lpe_audio_notify()
356 ppdata->pipe = -1; in intel_lpe_audio_notify()
357 ppdata->ls_clock = 0; in intel_lpe_audio_notify()
358 ppdata->dp_output = false; in intel_lpe_audio_notify()
365 if (pdata->notify_audio_lpe) in intel_lpe_audio_notify()
366 pdata->notify_audio_lpe(dev_priv->display.audio.lpe.platdev, port - PORT_B); in intel_lpe_audio_notify()
368 spin_unlock_irqrestore(&pdata->lpe_audio_slock, irqflags); in intel_lpe_audio_notify()