diff options
author | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2012-10-10 08:13:14 -0400 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2012-10-29 06:44:40 -0400 |
commit | 4e0397cfa78913f3da08c0aa8076b6b0a3b262a0 (patch) | |
tree | 55c14525add2092a84b2ee77fce2a8d563ad6293 /drivers/video | |
parent | 04bd8ac14e6c0d4f75be0950c14f9791ffdc76d7 (diff) |
OMAPDSS: DISPC: Add IRQ enable/status helpers
DISPC irqs need to be handled from the compat layer and also in the
future by the omapdrm. To make this possible, this patchs adds a set of
helper functions, so that the irqs can be managed without direct
register reads/writes.
The following functions are added, and all the current direct reg
reads/writes are changed to use these.
u32 dispc_read_irqstatus(void);
void dispc_clear_irqstatus(u32 mask);
u32 dispc_read_irqenable(void);
void dispc_write_irqenable(u32 mask);
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/omap2/dss/dispc.c | 44 | ||||
-rw-r--r-- | drivers/video/omap2/dss/dss.h | 4 |
2 files changed, 36 insertions, 12 deletions
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c index 3fd60ce3d71..d2948732843 100644 --- a/drivers/video/omap2/dss/dispc.c +++ b/drivers/video/omap2/dss/dispc.c | |||
@@ -497,7 +497,7 @@ static void dispc_restore_context(void) | |||
497 | if (dss_has_feature(FEAT_MGR_LCD3)) | 497 | if (dss_has_feature(FEAT_MGR_LCD3)) |
498 | RR(CONTROL3); | 498 | RR(CONTROL3); |
499 | /* clear spurious SYNC_LOST_DIGIT interrupts */ | 499 | /* clear spurious SYNC_LOST_DIGIT interrupts */ |
500 | dispc_write_reg(DISPC_IRQSTATUS, DISPC_IRQ_SYNC_LOST_DIGIT); | 500 | dispc_clear_irqstatus(DISPC_IRQ_SYNC_LOST_DIGIT); |
501 | 501 | ||
502 | /* | 502 | /* |
503 | * enable last so IRQs won't trigger before | 503 | * enable last so IRQs won't trigger before |
@@ -3627,11 +3627,35 @@ int dispc_mgr_get_clock_div(enum omap_channel channel, | |||
3627 | return 0; | 3627 | return 0; |
3628 | } | 3628 | } |
3629 | 3629 | ||
3630 | u32 dispc_read_irqstatus(void) | ||
3631 | { | ||
3632 | return dispc_read_reg(DISPC_IRQSTATUS); | ||
3633 | } | ||
3634 | |||
3635 | void dispc_clear_irqstatus(u32 mask) | ||
3636 | { | ||
3637 | dispc_write_reg(DISPC_IRQSTATUS, mask); | ||
3638 | } | ||
3639 | |||
3640 | u32 dispc_read_irqenable(void) | ||
3641 | { | ||
3642 | return dispc_read_reg(DISPC_IRQENABLE); | ||
3643 | } | ||
3644 | |||
3645 | void dispc_write_irqenable(u32 mask) | ||
3646 | { | ||
3647 | u32 old_mask = dispc_read_reg(DISPC_IRQENABLE); | ||
3648 | |||
3649 | /* clear the irqstatus for newly enabled irqs */ | ||
3650 | dispc_clear_irqstatus((mask ^ old_mask) & mask); | ||
3651 | |||
3652 | dispc_write_reg(DISPC_IRQENABLE, mask); | ||
3653 | } | ||
3654 | |||
3630 | /* dispc.irq_lock has to be locked by the caller */ | 3655 | /* dispc.irq_lock has to be locked by the caller */ |
3631 | static void _omap_dispc_set_irqs(void) | 3656 | static void _omap_dispc_set_irqs(void) |
3632 | { | 3657 | { |
3633 | u32 mask; | 3658 | u32 mask; |
3634 | u32 old_mask; | ||
3635 | int i; | 3659 | int i; |
3636 | struct omap_dispc_isr_data *isr_data; | 3660 | struct omap_dispc_isr_data *isr_data; |
3637 | 3661 | ||
@@ -3646,11 +3670,7 @@ static void _omap_dispc_set_irqs(void) | |||
3646 | mask |= isr_data->mask; | 3670 | mask |= isr_data->mask; |
3647 | } | 3671 | } |
3648 | 3672 | ||
3649 | old_mask = dispc_read_reg(DISPC_IRQENABLE); | 3673 | dispc_write_irqenable(mask); |
3650 | /* clear the irqstatus for newly enabled irqs */ | ||
3651 | dispc_write_reg(DISPC_IRQSTATUS, (mask ^ old_mask) & mask); | ||
3652 | |||
3653 | dispc_write_reg(DISPC_IRQENABLE, mask); | ||
3654 | } | 3674 | } |
3655 | 3675 | ||
3656 | int omap_dispc_register_isr(omap_dispc_isr_t isr, void *arg, u32 mask) | 3676 | int omap_dispc_register_isr(omap_dispc_isr_t isr, void *arg, u32 mask) |
@@ -3777,8 +3797,8 @@ static irqreturn_t omap_dispc_irq_handler(int irq, void *arg) | |||
3777 | 3797 | ||
3778 | spin_lock(&dispc.irq_lock); | 3798 | spin_lock(&dispc.irq_lock); |
3779 | 3799 | ||
3780 | irqstatus = dispc_read_reg(DISPC_IRQSTATUS); | 3800 | irqstatus = dispc_read_irqstatus(); |
3781 | irqenable = dispc_read_reg(DISPC_IRQENABLE); | 3801 | irqenable = dispc_read_irqenable(); |
3782 | 3802 | ||
3783 | /* IRQ is not for us */ | 3803 | /* IRQ is not for us */ |
3784 | if (!(irqstatus & irqenable)) { | 3804 | if (!(irqstatus & irqenable)) { |
@@ -3797,9 +3817,9 @@ static irqreturn_t omap_dispc_irq_handler(int irq, void *arg) | |||
3797 | 3817 | ||
3798 | /* Ack the interrupt. Do it here before clocks are possibly turned | 3818 | /* Ack the interrupt. Do it here before clocks are possibly turned |
3799 | * off */ | 3819 | * off */ |
3800 | dispc_write_reg(DISPC_IRQSTATUS, irqstatus); | 3820 | dispc_clear_irqstatus(irqstatus); |
3801 | /* flush posted write */ | 3821 | /* flush posted write */ |
3802 | dispc_read_reg(DISPC_IRQSTATUS); | 3822 | dispc_read_irqstatus(); |
3803 | 3823 | ||
3804 | /* make a copy and unlock, so that isrs can unregister | 3824 | /* make a copy and unlock, so that isrs can unregister |
3805 | * themselves */ | 3825 | * themselves */ |
@@ -4008,7 +4028,7 @@ static void _omap_dispc_initialize_irq(void) | |||
4008 | 4028 | ||
4009 | /* there's SYNC_LOST_DIGIT waiting after enabling the DSS, | 4029 | /* there's SYNC_LOST_DIGIT waiting after enabling the DSS, |
4010 | * so clear it */ | 4030 | * so clear it */ |
4011 | dispc_write_reg(DISPC_IRQSTATUS, dispc_read_reg(DISPC_IRQSTATUS)); | 4031 | dispc_clear_irqstatus(dispc_read_irqstatus()); |
4012 | 4032 | ||
4013 | _omap_dispc_set_irqs(); | 4033 | _omap_dispc_set_irqs(); |
4014 | 4034 | ||
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h index e3e5a63dace..d614fda9275 100644 --- a/drivers/video/omap2/dss/dss.h +++ b/drivers/video/omap2/dss/dss.h | |||
@@ -397,6 +397,10 @@ void dpi_uninit_platform_driver(void) __exit; | |||
397 | int dispc_init_platform_driver(void) __init; | 397 | int dispc_init_platform_driver(void) __init; |
398 | void dispc_uninit_platform_driver(void) __exit; | 398 | void dispc_uninit_platform_driver(void) __exit; |
399 | void dispc_dump_clocks(struct seq_file *s); | 399 | void dispc_dump_clocks(struct seq_file *s); |
400 | u32 dispc_read_irqstatus(void); | ||
401 | void dispc_clear_irqstatus(u32 mask); | ||
402 | u32 dispc_read_irqenable(void); | ||
403 | void dispc_write_irqenable(u32 mask); | ||
400 | 404 | ||
401 | int dispc_runtime_get(void); | 405 | int dispc_runtime_get(void); |
402 | void dispc_runtime_put(void); | 406 | void dispc_runtime_put(void); |