diff options
author | Sean Paul <seanpaul@chromium.org> | 2012-11-01 06:13:46 -0400 |
---|---|---|
committer | Jingoo Han <jg1.han@samsung.com> | 2012-11-28 20:33:28 -0500 |
commit | c30ffb904cff819dc2423b1c3edd4f2e48f7acb0 (patch) | |
tree | b6ce271161da677c855c2c8b7291c2d14c90fd4f /drivers/video/exynos | |
parent | 784fa9a10b684b452ff01531c1b5eafd7215564d (diff) |
video: exynos_dp: Enable hotplug interrupts
Enable hotplug interrupts and move the hotplug scheduling into the
interrupt handler. This allows us to introduce a screen at any time
while we're running.
[jg1.han@samsung.com: moved the bit masking of hotplug interrupts]
Signed-off-by: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Olof Johansson <olofj@chromium.org>
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Diffstat (limited to 'drivers/video/exynos')
-rw-r--r-- | drivers/video/exynos/exynos_dp_core.c | 38 | ||||
-rw-r--r-- | drivers/video/exynos/exynos_dp_core.h | 9 | ||||
-rw-r--r-- | drivers/video/exynos/exynos_dp_reg.c | 38 |
3 files changed, 71 insertions, 14 deletions
diff --git a/drivers/video/exynos/exynos_dp_core.c b/drivers/video/exynos/exynos_dp_core.c index 617ba9568f0c..ebd914dd7252 100644 --- a/drivers/video/exynos/exynos_dp_core.c +++ b/drivers/video/exynos/exynos_dp_core.c | |||
@@ -49,10 +49,6 @@ static int exynos_dp_detect_hpd(struct exynos_dp_device *dp) | |||
49 | { | 49 | { |
50 | int timeout_loop = 0; | 50 | int timeout_loop = 0; |
51 | 51 | ||
52 | exynos_dp_init_hpd(dp); | ||
53 | |||
54 | usleep_range(200, 210); | ||
55 | |||
56 | while (exynos_dp_get_plug_in_status(dp) != 0) { | 52 | while (exynos_dp_get_plug_in_status(dp) != 0) { |
57 | timeout_loop++; | 53 | timeout_loop++; |
58 | if (DP_TIMEOUT_LOOP_COUNT < timeout_loop) { | 54 | if (DP_TIMEOUT_LOOP_COUNT < timeout_loop) { |
@@ -834,7 +830,32 @@ static irqreturn_t exynos_dp_irq_handler(int irq, void *arg) | |||
834 | { | 830 | { |
835 | struct exynos_dp_device *dp = arg; | 831 | struct exynos_dp_device *dp = arg; |
836 | 832 | ||
837 | dev_err(dp->dev, "exynos_dp_irq_handler\n"); | 833 | enum dp_irq_type irq_type; |
834 | |||
835 | irq_type = exynos_dp_get_irq_type(dp); | ||
836 | switch (irq_type) { | ||
837 | case DP_IRQ_TYPE_HP_CABLE_IN: | ||
838 | dev_dbg(dp->dev, "Received irq - cable in\n"); | ||
839 | schedule_work(&dp->hotplug_work); | ||
840 | exynos_dp_clear_hotplug_interrupts(dp); | ||
841 | break; | ||
842 | case DP_IRQ_TYPE_HP_CABLE_OUT: | ||
843 | dev_dbg(dp->dev, "Received irq - cable out\n"); | ||
844 | exynos_dp_clear_hotplug_interrupts(dp); | ||
845 | break; | ||
846 | case DP_IRQ_TYPE_HP_CHANGE: | ||
847 | /* | ||
848 | * We get these change notifications once in a while, but there | ||
849 | * is nothing we can do with them. Just ignore it for now and | ||
850 | * only handle cable changes. | ||
851 | */ | ||
852 | dev_dbg(dp->dev, "Received irq - hotplug change; ignoring.\n"); | ||
853 | exynos_dp_clear_hotplug_interrupts(dp); | ||
854 | break; | ||
855 | default: | ||
856 | dev_err(dp->dev, "Received irq - unknown type!\n"); | ||
857 | break; | ||
858 | } | ||
838 | return IRQ_HANDLED; | 859 | return IRQ_HANDLED; |
839 | } | 860 | } |
840 | 861 | ||
@@ -847,7 +868,7 @@ static void exynos_dp_hotplug(struct work_struct *work) | |||
847 | 868 | ||
848 | ret = exynos_dp_detect_hpd(dp); | 869 | ret = exynos_dp_detect_hpd(dp); |
849 | if (ret) { | 870 | if (ret) { |
850 | dev_err(dp->dev, "unable to detect hpd\n"); | 871 | /* Cable has been disconnected, we're done */ |
851 | return; | 872 | return; |
852 | } | 873 | } |
853 | 874 | ||
@@ -1093,7 +1114,6 @@ static int __devinit exynos_dp_probe(struct platform_device *pdev) | |||
1093 | exynos_dp_init_dp(dp); | 1114 | exynos_dp_init_dp(dp); |
1094 | 1115 | ||
1095 | platform_set_drvdata(pdev, dp); | 1116 | platform_set_drvdata(pdev, dp); |
1096 | schedule_work(&dp->hotplug_work); | ||
1097 | 1117 | ||
1098 | return 0; | 1118 | return 0; |
1099 | } | 1119 | } |
@@ -1103,6 +1123,8 @@ static int __devexit exynos_dp_remove(struct platform_device *pdev) | |||
1103 | struct exynos_dp_platdata *pdata = pdev->dev.platform_data; | 1123 | struct exynos_dp_platdata *pdata = pdev->dev.platform_data; |
1104 | struct exynos_dp_device *dp = platform_get_drvdata(pdev); | 1124 | struct exynos_dp_device *dp = platform_get_drvdata(pdev); |
1105 | 1125 | ||
1126 | disable_irq(dp->irq); | ||
1127 | |||
1106 | if (work_pending(&dp->hotplug_work)) | 1128 | if (work_pending(&dp->hotplug_work)) |
1107 | flush_work(&dp->hotplug_work); | 1129 | flush_work(&dp->hotplug_work); |
1108 | 1130 | ||
@@ -1159,7 +1181,7 @@ static int exynos_dp_resume(struct device *dev) | |||
1159 | 1181 | ||
1160 | exynos_dp_init_dp(dp); | 1182 | exynos_dp_init_dp(dp); |
1161 | 1183 | ||
1162 | schedule_work(&dp->hotplug_work); | 1184 | enable_irq(dp->irq); |
1163 | 1185 | ||
1164 | return 0; | 1186 | return 0; |
1165 | } | 1187 | } |
diff --git a/drivers/video/exynos/exynos_dp_core.h b/drivers/video/exynos/exynos_dp_core.h index 5ef7135039fa..ef3bb545f9a9 100644 --- a/drivers/video/exynos/exynos_dp_core.h +++ b/drivers/video/exynos/exynos_dp_core.h | |||
@@ -13,6 +13,13 @@ | |||
13 | #ifndef _EXYNOS_DP_CORE_H | 13 | #ifndef _EXYNOS_DP_CORE_H |
14 | #define _EXYNOS_DP_CORE_H | 14 | #define _EXYNOS_DP_CORE_H |
15 | 15 | ||
16 | enum dp_irq_type { | ||
17 | DP_IRQ_TYPE_HP_CABLE_IN, | ||
18 | DP_IRQ_TYPE_HP_CABLE_OUT, | ||
19 | DP_IRQ_TYPE_HP_CHANGE, | ||
20 | DP_IRQ_TYPE_UNKNOWN, | ||
21 | }; | ||
22 | |||
16 | struct link_train { | 23 | struct link_train { |
17 | int eq_loop; | 24 | int eq_loop; |
18 | int cr_loop[4]; | 25 | int cr_loop[4]; |
@@ -53,6 +60,8 @@ void exynos_dp_set_analog_power_down(struct exynos_dp_device *dp, | |||
53 | bool enable); | 60 | bool enable); |
54 | void exynos_dp_init_analog_func(struct exynos_dp_device *dp); | 61 | void exynos_dp_init_analog_func(struct exynos_dp_device *dp); |
55 | void exynos_dp_init_hpd(struct exynos_dp_device *dp); | 62 | void exynos_dp_init_hpd(struct exynos_dp_device *dp); |
63 | enum dp_irq_type exynos_dp_get_irq_type(struct exynos_dp_device *dp); | ||
64 | void exynos_dp_clear_hotplug_interrupts(struct exynos_dp_device *dp); | ||
56 | void exynos_dp_reset_aux(struct exynos_dp_device *dp); | 65 | void exynos_dp_reset_aux(struct exynos_dp_device *dp); |
57 | void exynos_dp_init_aux(struct exynos_dp_device *dp); | 66 | void exynos_dp_init_aux(struct exynos_dp_device *dp); |
58 | int exynos_dp_get_plug_in_status(struct exynos_dp_device *dp); | 67 | int exynos_dp_get_plug_in_status(struct exynos_dp_device *dp); |
diff --git a/drivers/video/exynos/exynos_dp_reg.c b/drivers/video/exynos/exynos_dp_reg.c index fc19ef651565..9fb901bcdd59 100644 --- a/drivers/video/exynos/exynos_dp_reg.c +++ b/drivers/video/exynos/exynos_dp_reg.c | |||
@@ -19,11 +19,11 @@ | |||
19 | #include "exynos_dp_core.h" | 19 | #include "exynos_dp_core.h" |
20 | #include "exynos_dp_reg.h" | 20 | #include "exynos_dp_reg.h" |
21 | 21 | ||
22 | #define COMMON_INT_MASK_1 (0) | 22 | #define COMMON_INT_MASK_1 0 |
23 | #define COMMON_INT_MASK_2 (0) | 23 | #define COMMON_INT_MASK_2 0 |
24 | #define COMMON_INT_MASK_3 (0) | 24 | #define COMMON_INT_MASK_3 0 |
25 | #define COMMON_INT_MASK_4 (0) | 25 | #define COMMON_INT_MASK_4 (HOTPLUG_CHG | HPD_LOST | PLUG) |
26 | #define INT_STA_MASK (0) | 26 | #define INT_STA_MASK INT_HPD |
27 | 27 | ||
28 | void exynos_dp_enable_video_mute(struct exynos_dp_device *dp, bool enable) | 28 | void exynos_dp_enable_video_mute(struct exynos_dp_device *dp, bool enable) |
29 | { | 29 | { |
@@ -324,7 +324,7 @@ void exynos_dp_init_analog_func(struct exynos_dp_device *dp) | |||
324 | writel(reg, dp->reg_base + EXYNOS_DP_FUNC_EN_2); | 324 | writel(reg, dp->reg_base + EXYNOS_DP_FUNC_EN_2); |
325 | } | 325 | } |
326 | 326 | ||
327 | void exynos_dp_init_hpd(struct exynos_dp_device *dp) | 327 | void exynos_dp_clear_hotplug_interrupts(struct exynos_dp_device *dp) |
328 | { | 328 | { |
329 | u32 reg; | 329 | u32 reg; |
330 | 330 | ||
@@ -333,12 +333,38 @@ void exynos_dp_init_hpd(struct exynos_dp_device *dp) | |||
333 | 333 | ||
334 | reg = INT_HPD; | 334 | reg = INT_HPD; |
335 | writel(reg, dp->reg_base + EXYNOS_DP_INT_STA); | 335 | writel(reg, dp->reg_base + EXYNOS_DP_INT_STA); |
336 | } | ||
337 | |||
338 | void exynos_dp_init_hpd(struct exynos_dp_device *dp) | ||
339 | { | ||
340 | u32 reg; | ||
341 | |||
342 | exynos_dp_clear_hotplug_interrupts(dp); | ||
336 | 343 | ||
337 | reg = readl(dp->reg_base + EXYNOS_DP_SYS_CTL_3); | 344 | reg = readl(dp->reg_base + EXYNOS_DP_SYS_CTL_3); |
338 | reg &= ~(F_HPD | HPD_CTRL); | 345 | reg &= ~(F_HPD | HPD_CTRL); |
339 | writel(reg, dp->reg_base + EXYNOS_DP_SYS_CTL_3); | 346 | writel(reg, dp->reg_base + EXYNOS_DP_SYS_CTL_3); |
340 | } | 347 | } |
341 | 348 | ||
349 | enum dp_irq_type exynos_dp_get_irq_type(struct exynos_dp_device *dp) | ||
350 | { | ||
351 | u32 reg; | ||
352 | |||
353 | /* Parse hotplug interrupt status register */ | ||
354 | reg = readl(dp->reg_base + EXYNOS_DP_COMMON_INT_STA_4); | ||
355 | |||
356 | if (reg & PLUG) | ||
357 | return DP_IRQ_TYPE_HP_CABLE_IN; | ||
358 | |||
359 | if (reg & HPD_LOST) | ||
360 | return DP_IRQ_TYPE_HP_CABLE_OUT; | ||
361 | |||
362 | if (reg & HOTPLUG_CHG) | ||
363 | return DP_IRQ_TYPE_HP_CHANGE; | ||
364 | |||
365 | return DP_IRQ_TYPE_UNKNOWN; | ||
366 | } | ||
367 | |||
342 | void exynos_dp_reset_aux(struct exynos_dp_device *dp) | 368 | void exynos_dp_reset_aux(struct exynos_dp_device *dp) |
343 | { | 369 | { |
344 | u32 reg; | 370 | u32 reg; |