diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2015-01-14 17:45:17 -0500 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2015-03-20 08:30:20 -0400 |
commit | 8472b5708ebaabf4568fe53672db7567e94c4c65 (patch) | |
tree | 6f2f743e51f8890df185cbd75719fac0b1fea866 /drivers/gpu/drm/omapdrm/omap_crtc.c | |
parent | 297767b68146f2355dfb10cb57185bef7769dfd9 (diff) |
drm: omapdrm: Avoid function forward declaration in omap_crtc.c
Move the set_enabled function to avoid the forward declaration. While at
it prefix it with omap_crtc_ like most other functions in the file, and
fix the comment stating in which contexts the function is called.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'drivers/gpu/drm/omapdrm/omap_crtc.c')
-rw-r--r-- | drivers/gpu/drm/omapdrm/omap_crtc.c | 107 |
1 files changed, 53 insertions, 54 deletions
diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c index e04782489224..1ef3e0146c68 100644 --- a/drivers/gpu/drm/omapdrm/omap_crtc.c +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c | |||
@@ -120,7 +120,57 @@ static void omap_crtc_start_update(struct omap_overlay_manager *mgr) | |||
120 | { | 120 | { |
121 | } | 121 | } |
122 | 122 | ||
123 | static void set_enabled(struct drm_crtc *crtc, bool enable); | 123 | /* Called only from CRTC pre_apply and suspend/resume handlers. */ |
124 | static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable) | ||
125 | { | ||
126 | struct drm_device *dev = crtc->dev; | ||
127 | struct omap_crtc *omap_crtc = to_omap_crtc(crtc); | ||
128 | enum omap_channel channel = omap_crtc->channel; | ||
129 | struct omap_irq_wait *wait; | ||
130 | u32 framedone_irq, vsync_irq; | ||
131 | int ret; | ||
132 | |||
133 | if (dispc_mgr_is_enabled(channel) == enable) | ||
134 | return; | ||
135 | |||
136 | /* | ||
137 | * Digit output produces some sync lost interrupts during the first | ||
138 | * frame when enabling, so we need to ignore those. | ||
139 | */ | ||
140 | omap_irq_unregister(crtc->dev, &omap_crtc->error_irq); | ||
141 | |||
142 | framedone_irq = dispc_mgr_get_framedone_irq(channel); | ||
143 | vsync_irq = dispc_mgr_get_vsync_irq(channel); | ||
144 | |||
145 | if (enable) { | ||
146 | wait = omap_irq_wait_init(dev, vsync_irq, 1); | ||
147 | } else { | ||
148 | /* | ||
149 | * When we disable the digit output, we need to wait for | ||
150 | * FRAMEDONE to know that DISPC has finished with the output. | ||
151 | * | ||
152 | * OMAP2/3 does not have FRAMEDONE irq for digit output, and in | ||
153 | * that case we need to use vsync interrupt, and wait for both | ||
154 | * even and odd frames. | ||
155 | */ | ||
156 | |||
157 | if (framedone_irq) | ||
158 | wait = omap_irq_wait_init(dev, framedone_irq, 1); | ||
159 | else | ||
160 | wait = omap_irq_wait_init(dev, vsync_irq, 2); | ||
161 | } | ||
162 | |||
163 | dispc_mgr_enable(channel, enable); | ||
164 | |||
165 | ret = omap_irq_wait(dev, wait, msecs_to_jiffies(100)); | ||
166 | if (ret) { | ||
167 | dev_err(dev->dev, "%s: timeout waiting for %s\n", | ||
168 | omap_crtc->name, enable ? "enable" : "disable"); | ||
169 | } | ||
170 | |||
171 | omap_irq_register(crtc->dev, &omap_crtc->error_irq); | ||
172 | } | ||
173 | |||
124 | 174 | ||
125 | static int omap_crtc_enable(struct omap_overlay_manager *mgr) | 175 | static int omap_crtc_enable(struct omap_overlay_manager *mgr) |
126 | { | 176 | { |
@@ -129,7 +179,7 @@ static int omap_crtc_enable(struct omap_overlay_manager *mgr) | |||
129 | dispc_mgr_setup(omap_crtc->channel, &omap_crtc->info); | 179 | dispc_mgr_setup(omap_crtc->channel, &omap_crtc->info); |
130 | dispc_mgr_set_timings(omap_crtc->channel, | 180 | dispc_mgr_set_timings(omap_crtc->channel, |
131 | &omap_crtc->timings); | 181 | &omap_crtc->timings); |
132 | set_enabled(&omap_crtc->base, true); | 182 | omap_crtc_set_enabled(&omap_crtc->base, true); |
133 | 183 | ||
134 | return 0; | 184 | return 0; |
135 | } | 185 | } |
@@ -138,7 +188,7 @@ static void omap_crtc_disable(struct omap_overlay_manager *mgr) | |||
138 | { | 188 | { |
139 | struct omap_crtc *omap_crtc = omap_crtcs[mgr->id]; | 189 | struct omap_crtc *omap_crtc = omap_crtcs[mgr->id]; |
140 | 190 | ||
141 | set_enabled(&omap_crtc->base, false); | 191 | omap_crtc_set_enabled(&omap_crtc->base, false); |
142 | } | 192 | } |
143 | 193 | ||
144 | static void omap_crtc_set_timings(struct omap_overlay_manager *mgr, | 194 | static void omap_crtc_set_timings(struct omap_overlay_manager *mgr, |
@@ -537,57 +587,6 @@ int omap_crtc_apply(struct drm_crtc *crtc, | |||
537 | return 0; | 587 | return 0; |
538 | } | 588 | } |
539 | 589 | ||
540 | /* called only from apply */ | ||
541 | static void set_enabled(struct drm_crtc *crtc, bool enable) | ||
542 | { | ||
543 | struct drm_device *dev = crtc->dev; | ||
544 | struct omap_crtc *omap_crtc = to_omap_crtc(crtc); | ||
545 | enum omap_channel channel = omap_crtc->channel; | ||
546 | struct omap_irq_wait *wait; | ||
547 | u32 framedone_irq, vsync_irq; | ||
548 | int ret; | ||
549 | |||
550 | if (dispc_mgr_is_enabled(channel) == enable) | ||
551 | return; | ||
552 | |||
553 | /* | ||
554 | * Digit output produces some sync lost interrupts during the first | ||
555 | * frame when enabling, so we need to ignore those. | ||
556 | */ | ||
557 | omap_irq_unregister(crtc->dev, &omap_crtc->error_irq); | ||
558 | |||
559 | framedone_irq = dispc_mgr_get_framedone_irq(channel); | ||
560 | vsync_irq = dispc_mgr_get_vsync_irq(channel); | ||
561 | |||
562 | if (enable) { | ||
563 | wait = omap_irq_wait_init(dev, vsync_irq, 1); | ||
564 | } else { | ||
565 | /* | ||
566 | * When we disable the digit output, we need to wait for | ||
567 | * FRAMEDONE to know that DISPC has finished with the output. | ||
568 | * | ||
569 | * OMAP2/3 does not have FRAMEDONE irq for digit output, and in | ||
570 | * that case we need to use vsync interrupt, and wait for both | ||
571 | * even and odd frames. | ||
572 | */ | ||
573 | |||
574 | if (framedone_irq) | ||
575 | wait = omap_irq_wait_init(dev, framedone_irq, 1); | ||
576 | else | ||
577 | wait = omap_irq_wait_init(dev, vsync_irq, 2); | ||
578 | } | ||
579 | |||
580 | dispc_mgr_enable(channel, enable); | ||
581 | |||
582 | ret = omap_irq_wait(dev, wait, msecs_to_jiffies(100)); | ||
583 | if (ret) { | ||
584 | dev_err(dev->dev, "%s: timeout waiting for %s\n", | ||
585 | omap_crtc->name, enable ? "enable" : "disable"); | ||
586 | } | ||
587 | |||
588 | omap_irq_register(crtc->dev, &omap_crtc->error_irq); | ||
589 | } | ||
590 | |||
591 | static void omap_crtc_pre_apply(struct omap_drm_apply *apply) | 590 | static void omap_crtc_pre_apply(struct omap_drm_apply *apply) |
592 | { | 591 | { |
593 | struct omap_crtc *omap_crtc = | 592 | struct omap_crtc *omap_crtc = |