diff options
| -rw-r--r-- | drivers/gpu/drm/exynos/exynos_hdmi.c | 74 |
1 files changed, 14 insertions, 60 deletions
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index b490afa781dc..41ba9dc7f5c7 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c | |||
| @@ -98,8 +98,7 @@ struct hdmi_context { | |||
| 98 | 98 | ||
| 99 | void __iomem *regs; | 99 | void __iomem *regs; |
| 100 | void *parent_ctx; | 100 | void *parent_ctx; |
| 101 | int external_irq; | 101 | int irq; |
| 102 | int internal_irq; | ||
| 103 | 102 | ||
| 104 | struct i2c_client *ddc_port; | 103 | struct i2c_client *ddc_port; |
| 105 | struct i2c_client *hdmiphy_port; | 104 | struct i2c_client *hdmiphy_port; |
| @@ -1656,7 +1655,7 @@ static void hdmi_conf_init(struct hdmi_context *hdata) | |||
| 1656 | { | 1655 | { |
| 1657 | struct hdmi_infoframe infoframe; | 1656 | struct hdmi_infoframe infoframe; |
| 1658 | 1657 | ||
| 1659 | /* disable HPD interrupts */ | 1658 | /* disable HPD interrupts from HDMI IP block, use GPIO instead */ |
| 1660 | hdmi_reg_writemask(hdata, HDMI_INTC_CON, 0, HDMI_INTC_EN_GLOBAL | | 1659 | hdmi_reg_writemask(hdata, HDMI_INTC_CON, 0, HDMI_INTC_EN_GLOBAL | |
| 1661 | HDMI_INTC_EN_HPD_PLUG | HDMI_INTC_EN_HPD_UNPLUG); | 1660 | HDMI_INTC_EN_HPD_PLUG | HDMI_INTC_EN_HPD_UNPLUG); |
| 1662 | 1661 | ||
| @@ -2260,7 +2259,7 @@ static struct exynos_hdmi_ops hdmi_ops = { | |||
| 2260 | .dpms = hdmi_dpms, | 2259 | .dpms = hdmi_dpms, |
| 2261 | }; | 2260 | }; |
| 2262 | 2261 | ||
| 2263 | static irqreturn_t hdmi_external_irq_thread(int irq, void *arg) | 2262 | static irqreturn_t hdmi_irq_thread(int irq, void *arg) |
| 2264 | { | 2263 | { |
| 2265 | struct exynos_drm_hdmi_context *ctx = arg; | 2264 | struct exynos_drm_hdmi_context *ctx = arg; |
| 2266 | struct hdmi_context *hdata = ctx->ctx; | 2265 | struct hdmi_context *hdata = ctx->ctx; |
| @@ -2275,31 +2274,6 @@ static irqreturn_t hdmi_external_irq_thread(int irq, void *arg) | |||
| 2275 | return IRQ_HANDLED; | 2274 | return IRQ_HANDLED; |
| 2276 | } | 2275 | } |
| 2277 | 2276 | ||
| 2278 | static irqreturn_t hdmi_internal_irq_thread(int irq, void *arg) | ||
| 2279 | { | ||
| 2280 | struct exynos_drm_hdmi_context *ctx = arg; | ||
| 2281 | struct hdmi_context *hdata = ctx->ctx; | ||
| 2282 | u32 intc_flag; | ||
| 2283 | |||
| 2284 | intc_flag = hdmi_reg_read(hdata, HDMI_INTC_FLAG); | ||
| 2285 | /* clearing flags for HPD plug/unplug */ | ||
| 2286 | if (intc_flag & HDMI_INTC_FLAG_HPD_UNPLUG) { | ||
| 2287 | DRM_DEBUG_KMS("unplugged\n"); | ||
| 2288 | hdmi_reg_writemask(hdata, HDMI_INTC_FLAG, ~0, | ||
| 2289 | HDMI_INTC_FLAG_HPD_UNPLUG); | ||
| 2290 | } | ||
| 2291 | if (intc_flag & HDMI_INTC_FLAG_HPD_PLUG) { | ||
| 2292 | DRM_DEBUG_KMS("plugged\n"); | ||
| 2293 | hdmi_reg_writemask(hdata, HDMI_INTC_FLAG, ~0, | ||
| 2294 | HDMI_INTC_FLAG_HPD_PLUG); | ||
| 2295 | } | ||
| 2296 | |||
| 2297 | if (ctx->drm_dev) | ||
| 2298 | drm_helper_hpd_irq_event(ctx->drm_dev); | ||
| 2299 | |||
| 2300 | return IRQ_HANDLED; | ||
| 2301 | } | ||
| 2302 | |||
| 2303 | static int hdmi_resources_init(struct hdmi_context *hdata) | 2277 | static int hdmi_resources_init(struct hdmi_context *hdata) |
| 2304 | { | 2278 | { |
| 2305 | struct device *dev = hdata->dev; | 2279 | struct device *dev = hdata->dev; |
| @@ -2550,39 +2524,24 @@ static int hdmi_probe(struct platform_device *pdev) | |||
| 2550 | 2524 | ||
| 2551 | hdata->hdmiphy_port = hdmi_hdmiphy; | 2525 | hdata->hdmiphy_port = hdmi_hdmiphy; |
| 2552 | 2526 | ||
| 2553 | hdata->external_irq = gpio_to_irq(hdata->hpd_gpio); | 2527 | hdata->irq = gpio_to_irq(hdata->hpd_gpio); |
| 2554 | if (hdata->external_irq < 0) { | 2528 | if (hdata->irq < 0) { |
| 2555 | DRM_ERROR("failed to get GPIO external irq\n"); | 2529 | DRM_ERROR("failed to get GPIO irq\n"); |
| 2556 | ret = hdata->external_irq; | 2530 | ret = hdata->irq; |
| 2557 | goto err_hdmiphy; | ||
| 2558 | } | ||
| 2559 | |||
| 2560 | hdata->internal_irq = platform_get_irq(pdev, 0); | ||
| 2561 | if (hdata->internal_irq < 0) { | ||
| 2562 | DRM_ERROR("failed to get platform internal irq\n"); | ||
| 2563 | ret = hdata->internal_irq; | ||
| 2564 | goto err_hdmiphy; | 2531 | goto err_hdmiphy; |
| 2565 | } | 2532 | } |
| 2566 | 2533 | ||
| 2567 | hdata->hpd = gpio_get_value(hdata->hpd_gpio); | 2534 | hdata->hpd = gpio_get_value(hdata->hpd_gpio); |
| 2568 | 2535 | ||
| 2569 | ret = request_threaded_irq(hdata->external_irq, NULL, | 2536 | ret = request_threaded_irq(hdata->irq, NULL, |
| 2570 | hdmi_external_irq_thread, IRQF_TRIGGER_RISING | | 2537 | hdmi_irq_thread, IRQF_TRIGGER_RISING | |
| 2571 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, | 2538 | IRQF_TRIGGER_FALLING | IRQF_ONESHOT, |
| 2572 | "hdmi_external", drm_hdmi_ctx); | 2539 | "hdmi", drm_hdmi_ctx); |
| 2573 | if (ret) { | 2540 | if (ret) { |
| 2574 | DRM_ERROR("failed to register hdmi external interrupt\n"); | 2541 | DRM_ERROR("failed to register hdmi interrupt\n"); |
| 2575 | goto err_hdmiphy; | 2542 | goto err_hdmiphy; |
| 2576 | } | 2543 | } |
| 2577 | 2544 | ||
| 2578 | ret = request_threaded_irq(hdata->internal_irq, NULL, | ||
| 2579 | hdmi_internal_irq_thread, IRQF_ONESHOT, | ||
| 2580 | "hdmi_internal", drm_hdmi_ctx); | ||
| 2581 | if (ret) { | ||
| 2582 | DRM_ERROR("failed to register hdmi internal interrupt\n"); | ||
| 2583 | goto err_free_irq; | ||
| 2584 | } | ||
| 2585 | |||
| 2586 | /* Attach HDMI Driver to common hdmi. */ | 2545 | /* Attach HDMI Driver to common hdmi. */ |
| 2587 | exynos_hdmi_drv_attach(drm_hdmi_ctx); | 2546 | exynos_hdmi_drv_attach(drm_hdmi_ctx); |
| 2588 | 2547 | ||
| @@ -2593,8 +2552,6 @@ static int hdmi_probe(struct platform_device *pdev) | |||
| 2593 | 2552 | ||
| 2594 | return 0; | 2553 | return 0; |
| 2595 | 2554 | ||
| 2596 | err_free_irq: | ||
| 2597 | free_irq(hdata->external_irq, drm_hdmi_ctx); | ||
| 2598 | err_hdmiphy: | 2555 | err_hdmiphy: |
| 2599 | i2c_del_driver(&hdmiphy_driver); | 2556 | i2c_del_driver(&hdmiphy_driver); |
| 2600 | err_ddc: | 2557 | err_ddc: |
| @@ -2612,8 +2569,7 @@ static int hdmi_remove(struct platform_device *pdev) | |||
| 2612 | 2569 | ||
| 2613 | pm_runtime_disable(dev); | 2570 | pm_runtime_disable(dev); |
| 2614 | 2571 | ||
| 2615 | free_irq(hdata->internal_irq, hdata); | 2572 | free_irq(hdata->irq, hdata); |
| 2616 | free_irq(hdata->external_irq, hdata); | ||
| 2617 | 2573 | ||
| 2618 | 2574 | ||
| 2619 | /* hdmiphy i2c driver */ | 2575 | /* hdmiphy i2c driver */ |
| @@ -2632,8 +2588,7 @@ static int hdmi_suspend(struct device *dev) | |||
| 2632 | 2588 | ||
| 2633 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); | 2589 | DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); |
| 2634 | 2590 | ||
| 2635 | disable_irq(hdata->internal_irq); | 2591 | disable_irq(hdata->irq); |
| 2636 | disable_irq(hdata->external_irq); | ||
| 2637 | 2592 | ||
| 2638 | hdata->hpd = false; | 2593 | hdata->hpd = false; |
| 2639 | if (ctx->drm_dev) | 2594 | if (ctx->drm_dev) |
| @@ -2658,8 +2613,7 @@ static int hdmi_resume(struct device *dev) | |||
| 2658 | 2613 | ||
| 2659 | hdata->hpd = gpio_get_value(hdata->hpd_gpio); | 2614 | hdata->hpd = gpio_get_value(hdata->hpd_gpio); |
| 2660 | 2615 | ||
| 2661 | enable_irq(hdata->external_irq); | 2616 | enable_irq(hdata->irq); |
| 2662 | enable_irq(hdata->internal_irq); | ||
| 2663 | 2617 | ||
| 2664 | if (!pm_runtime_suspended(dev)) { | 2618 | if (!pm_runtime_suspended(dev)) { |
| 2665 | DRM_DEBUG_KMS("%s : Already resumed\n", __func__); | 2619 | DRM_DEBUG_KMS("%s : Already resumed\n", __func__); |
