2 * File: drivers/video/omap/hwa742.c
4 * Epson HWA742 LCD controller driver
6 * Copyright (C) 2004-2005 Nokia Corporation
7 * Authors: Juha Yrjölä <juha.yrjola@nokia.com>
8 * Imre Deak <imre.deak@nokia.com>
9 * YUV support: Jussi Laako <jussi.laako@nokia.com>
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the
13 * Free Software Foundation; either version 2 of the License, or (at your
14 * option) any later version.
16 * This program is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
21 * You should have received a copy of the GNU General Public License along
22 * with this program; if not, write to the Free Software Foundation, Inc.,
23 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 #include <linux/config.h>
26 #include <linux/module.h>
29 #include <linux/delay.h>
30 #include <linux/clk.h>
32 #include <asm/arch/dma.h>
33 #include <asm/arch/omapfb.h>
35 /* #define OMAPFB_DBG 1 */
39 #define MODULE_NAME "omapfb-hwa742"
41 #define HWA742_REV_CODE_REG 0x0
42 #define HWA742_CONFIG_REG 0x2
43 #define HWA742_PLL_DIV_REG 0x4
44 #define HWA742_PLL_0_REG 0x6
45 #define HWA742_PLL_1_REG 0x8
46 #define HWA742_PLL_2_REG 0xa
47 #define HWA742_PLL_3_REG 0xc
48 #define HWA742_PLL_4_REG 0xe
49 #define HWA742_CLK_SRC_REG 0x12
50 #define HWA742_PANEL_TYPE_REG 0x14
51 #define HWA742_H_DISP_REG 0x16
52 #define HWA742_H_NDP_REG 0x18
53 #define HWA742_V_DISP_1_REG 0x1a
54 #define HWA742_V_DISP_2_REG 0x1c
55 #define HWA742_V_NDP_REG 0x1e
56 #define HWA742_HS_W_REG 0x20
57 #define HWA742_HP_S_REG 0x22
58 #define HWA742_VS_W_REG 0x24
59 #define HWA742_VP_S_REG 0x26
60 #define HWA742_PCLK_POL_REG 0x28
61 #define HWA742_INPUT_MODE_REG 0x2a
62 #define HWA742_TRANSL_MODE_REG1 0x2e
63 #define HWA742_DISP_MODE_REG 0x34
64 #define HWA742_WINDOW_TYPE 0x36
65 #define HWA742_WINDOW_X_START_0 0x38
66 #define HWA742_WINDOW_X_START_1 0x3a
67 #define HWA742_WINDOW_Y_START_0 0x3c
68 #define HWA742_WINDOW_Y_START_1 0x3e
69 #define HWA742_WINDOW_X_END_0 0x40
70 #define HWA742_WINDOW_X_END_1 0x42
71 #define HWA742_WINDOW_Y_END_0 0x44
72 #define HWA742_WINDOW_Y_END_1 0x46
73 #define HWA742_MEMORY_WRITE_LSB 0x48
74 #define HWA742_MEMORY_WRITE_MSB 0x49
75 #define HWA742_MEMORY_READ_0 0x4a
76 #define HWA742_MEMORY_READ_1 0x4c
77 #define HWA742_MEMORY_READ_2 0x4e
78 #define HWA742_POWER_SAVE 0x56
79 #define HWA742_NDP_CTRL 0x58
81 #define HWA742_AUTO_UPDATE_TIME (HZ / 20)
83 #define pr_err(fmt, args...) printk(KERN_ERR MODULE_NAME ": " fmt, ## args)
85 /* Reserve 4 request slots for requests in irq context */
86 #define REQ_POOL_SIZE 24
87 #define IRQ_REQ_POOL_SIZE 4
90 int x, y, width, height;
95 #define REQ_FROM_IRQ_POOL 0x01
97 #define REQ_COMPLETE 0
100 struct hwa742_request {
101 struct list_head entry;
104 int (*handler)(struct hwa742_request *req);
105 void (*complete)(void *data);
109 struct update_param update;
110 struct completion *sync;
114 struct hwa742_struct {
115 enum omapfb_update_mode update_mode;
116 enum omapfb_update_mode update_mode_before_suspend;
118 struct timer_list auto_update_timer;
119 int stop_auto_update;
120 struct omapfb_update_window auto_update_window;
122 struct hwa742_request req_pool[REQ_POOL_SIZE];
123 struct list_head pending_req_list;
124 struct list_head free_req_list;
125 struct semaphore req_sema;
129 struct extif_timings reg_timings, lut_timings;
135 u32 max_transmit_size;
136 u32 extif_clk_period;
138 struct omapfb_device *fbdev;
139 struct lcd_ctrl_extif *extif;
140 struct lcd_ctrl *int_ctrl;
143 static u8 hwa742_read_reg(u8 reg)
147 hwa742.extif->set_bits_per_cycle(8);
148 hwa742.extif->write_command(®, 1);
149 hwa742.extif->read_data(&data, 1);
154 static void hwa742_write_reg(u8 reg, u8 data)
156 hwa742.extif->set_bits_per_cycle(8);
157 hwa742.extif->write_command(®, 1);
158 hwa742.extif->write_data(&data, 1);
161 static void set_window_regs(int x_start, int y_start, int x_end, int y_end)
169 tmp[1] = x_start >> 8;
171 tmp[3] = y_start >> 8;
177 hwa742.extif->set_bits_per_cycle(8);
178 cmd = HWA742_WINDOW_X_START_0;
180 hwa742.extif->write_command(&cmd, 1);
182 hwa742.extif->write_data(tmp, 8);
185 static void set_format_regs(int conv, int transl, int flags)
187 if (flags & OMAPFB_FORMAT_FLAG_DOUBLE) {
188 hwa742.window_type = ((hwa742.window_type & 0xfc) | 0x01);
189 DBGPRINT(2, "hwa742: enabled pixel doubling\n");
191 hwa742.window_type = (hwa742.window_type & 0xfc);
192 DBGPRINT(2, "hwa742: disabled pixel doubling\n");
195 hwa742_write_reg(HWA742_INPUT_MODE_REG, conv);
196 hwa742_write_reg(HWA742_TRANSL_MODE_REG1, transl);
197 hwa742_write_reg(HWA742_WINDOW_TYPE, hwa742.window_type);
200 static inline struct hwa742_request *alloc_req(void)
203 struct hwa742_request *req;
207 down(&hwa742.req_sema);
209 req_flags = REQ_FROM_IRQ_POOL;
211 spin_lock_irqsave(&hwa742.req_lock, flags);
212 BUG_ON(list_empty(&hwa742.free_req_list));
213 req = list_entry(hwa742.free_req_list.next,
214 struct hwa742_request, entry);
215 list_del(&req->entry);
216 spin_unlock_irqrestore(&hwa742.req_lock, flags);
218 INIT_LIST_HEAD(&req->entry);
219 req->flags = req_flags;
224 static inline void free_req(struct hwa742_request *req)
228 spin_lock_irqsave(&hwa742.req_lock, flags);
230 list_del(&req->entry);
231 list_add(&req->entry, &hwa742.free_req_list);
232 if (!(req->flags & REQ_FROM_IRQ_POOL))
233 up(&hwa742.req_sema);
235 spin_unlock_irqrestore(&hwa742.req_lock, flags);
238 static void process_pending_requests(void)
244 spin_lock_irqsave(&hwa742.req_lock, flags);
246 while (!list_empty(&hwa742.pending_req_list)) {
247 struct hwa742_request *req;
248 void (*complete)(void *);
251 req = list_entry(hwa742.pending_req_list.next,
252 struct hwa742_request, entry);
253 spin_unlock_irqrestore(&hwa742.req_lock, flags);
255 if (req->handler(req) == REQ_PENDING)
258 complete = req->complete;
259 complete_data = req->complete_data;
263 complete(complete_data);
265 spin_lock_irqsave(&hwa742.req_lock, flags);
268 spin_unlock_irqrestore(&hwa742.req_lock, flags);
273 static void submit_req_list(struct list_head *head)
280 spin_lock_irqsave(&hwa742.req_lock, flags);
281 if (likely(!list_empty(&hwa742.pending_req_list)))
283 list_splice_init(head, hwa742.pending_req_list.prev);
284 spin_unlock_irqrestore(&hwa742.req_lock, flags);
287 process_pending_requests();
292 static void request_complete(void *data)
294 struct hwa742_request *req = (struct hwa742_request *)data;
295 void (*complete)(void *);
298 complete = req->complete;
299 complete_data = req->complete_data;
304 complete(complete_data);
306 process_pending_requests();
309 static int send_frame_handler(struct hwa742_request *req)
311 struct update_param *par = &req->par.update;
318 unsigned long offset;
319 int color_mode = par->color_mode;
320 int flags = par->flags;
323 DBGPRINT(2, "x %d y %d w %d h %d scr_width %d color_mode %d flags %d\n",
324 x, y, w, h, scr_width, color_mode, flags);
326 switch (color_mode) {
327 case OMAPFB_COLOR_YUV422:
332 case OMAPFB_COLOR_YUV420:
337 case OMAPFB_COLOR_RGB565:
346 if (hwa742.prev_flags != flags ||
347 hwa742.prev_color_mode != color_mode) {
348 set_format_regs(conv, transl, flags);
349 hwa742.prev_color_mode = color_mode;
350 hwa742.prev_flags = flags;
353 set_window_regs(x, y, x + w, y + h);
355 offset = (scr_width * y + x) * bpp / 8;
357 hwa742.int_ctrl->setup_plane(OMAPFB_PLANE_GFX,
358 OMAPFB_CHANNEL_OUT_LCD, offset, scr_width, 0, 0, w, h,
361 hwa742.extif->set_bits_per_cycle(16);
363 hwa742.int_ctrl->enable_plane(OMAPFB_PLANE_GFX, 1);
364 hwa742.extif->transfer_area(w, h, request_complete, req);
369 static void send_frame_complete(void *data)
371 hwa742.int_ctrl->enable_plane(OMAPFB_PLANE_GFX, 0);
374 #define ADD_PREQ(_x, _y, _w, _h) do { \
376 req->handler = send_frame_handler; \
377 req->complete = send_frame_complete; \
378 req->par.update.x = _x; \
379 req->par.update.y = _y; \
380 req->par.update.width = _w; \
381 req->par.update.height = _h; \
382 req->par.update.color_mode = color_mode;\
383 req->par.update.flags = flags; \
384 list_add_tail(&req->entry, req_head); \
387 static void create_req_list(struct omapfb_update_window *win,
388 struct list_head *req_head)
390 struct hwa742_request *req;
393 int width = win->width;
394 int height = win->height;
398 flags = win->format & OMAPFB_FORMAT_FLAG_DOUBLE;
399 color_mode = win->format & OMAPFB_FORMAT_MASK;
402 ADD_PREQ(x, y, 1, height);
407 unsigned int xspan = width & ~1;
408 unsigned int ystart = y;
409 unsigned int yspan = height;
411 if (xspan * height * 2 > hwa742.max_transmit_size) {
412 yspan = hwa742.max_transmit_size / (xspan * 2);
413 ADD_PREQ(x, ystart, xspan, yspan);
415 yspan = height - yspan;
418 ADD_PREQ(x, ystart, xspan, yspan);
423 ADD_PREQ(x, y, 1, height);
426 static void auto_update_complete(void *data)
430 if (!hwa742.stop_auto_update)
431 mod_timer(&hwa742.auto_update_timer,
432 jiffies + HWA742_AUTO_UPDATE_TIME);
437 static void hwa742_update_window_auto(unsigned long arg)
440 struct hwa742_request *last;
444 create_req_list(&hwa742.auto_update_window, &req_list);
445 last = list_entry(req_list.prev, struct hwa742_request, entry);
447 last->complete = auto_update_complete;
448 last->complete_data = NULL;
450 submit_req_list(&req_list);
455 int hwa742_update_window_async(struct omapfb_update_window *win,
456 void (*complete_callback)(void *arg),
457 void *complete_callback_data)
460 struct hwa742_request *last;
465 if (hwa742.update_mode != OMAPFB_MANUAL_UPDATE) {
466 DBGPRINT(1, "invalid update mode\n");
470 if (unlikely(win->format & ~(0x03 | OMAPFB_FORMAT_FLAG_DOUBLE))) {
471 DBGPRINT(1, "invalid window flag");
476 create_req_list(win, &req_list);
477 last = list_entry(req_list.prev, struct hwa742_request, entry);
479 last->complete = complete_callback;
480 last->complete_data = (void *)complete_callback_data;
482 submit_req_list(&req_list);
488 EXPORT_SYMBOL(hwa742_update_window_async);
490 static int hwa742_setup_plane(int plane, int channel_out,
491 unsigned long offset, int screen_width,
492 int pos_x, int pos_y, int width, int height,
495 if (plane != OMAPFB_PLANE_GFX ||
496 channel_out != OMAPFB_CHANNEL_OUT_LCD)
502 static int hwa742_enable_plane(int plane, int enable)
507 hwa742.int_ctrl->enable_plane(plane, enable);
512 static int sync_handler(struct hwa742_request *req)
514 complete(req->par.sync);
518 static void hwa742_sync(void)
521 struct hwa742_request *req;
522 struct completion comp;
528 req->handler = sync_handler;
529 req->complete = NULL;
530 init_completion(&comp);
531 req->par.sync = ∁
533 list_add(&req->entry, &req_list);
534 submit_req_list(&req_list);
536 wait_for_completion(&comp);
541 static void hwa742_bind_client(struct omapfb_notifier_block *nb)
543 DBGPRINT(1, "update_mode %d\n", hwa742.update_mode);
544 if (hwa742.update_mode == OMAPFB_MANUAL_UPDATE) {
545 omapfb_notify_clients(hwa742.fbdev, OMAPFB_EVENT_READY);
549 static int hwa742_set_update_mode(enum omapfb_update_mode mode)
555 if (mode != OMAPFB_MANUAL_UPDATE && mode != OMAPFB_AUTO_UPDATE &&
556 mode != OMAPFB_UPDATE_DISABLED) {
561 if (mode == hwa742.update_mode)
564 printk(KERN_INFO "hwa742: setting update mode to %s\n",
565 mode == OMAPFB_UPDATE_DISABLED ? "disabled" :
566 (mode == OMAPFB_AUTO_UPDATE ? "auto" : "manual"));
568 switch (hwa742.update_mode) {
569 case OMAPFB_MANUAL_UPDATE:
570 omapfb_notify_clients(hwa742.fbdev, OMAPFB_EVENT_DISABLED);
572 case OMAPFB_AUTO_UPDATE:
573 hwa742.stop_auto_update = 1;
574 del_timer_sync(&hwa742.auto_update_timer);
576 case OMAPFB_UPDATE_DISABLED:
580 hwa742.update_mode = mode;
582 hwa742.stop_auto_update = 0;
585 case OMAPFB_MANUAL_UPDATE:
586 omapfb_notify_clients(hwa742.fbdev, OMAPFB_EVENT_READY);
588 case OMAPFB_AUTO_UPDATE:
589 hwa742_update_window_auto(0);
591 case OMAPFB_UPDATE_DISABLED:
600 static enum omapfb_update_mode hwa742_get_update_mode(void)
602 return hwa742.update_mode;
605 static unsigned long round_to_extif_ticks(unsigned long ps, int div)
607 int bus_tick = hwa742.extif_clk_period * div;
608 return (ps + bus_tick - 1) / bus_tick * bus_tick;
611 static int calc_reg_timing(unsigned long sysclk, int div)
613 struct extif_timings *t;
614 unsigned long systim;
616 /* CSOnTime 0, WEOnTime 2 ns, REOnTime 2 ns,
617 * AccessTime 2 ns + 12.2 ns (regs),
618 * WEOffTime = WEOnTime + 1 ns,
619 * REOffTime = REOnTime + 16 ns (regs),
620 * CSOffTime = REOffTime + 1 ns
621 * ReadCycle = 2ns + 2*SYSCLK (regs),
622 * WriteCycle = 2*SYSCLK + 2 ns,
623 * CSPulseWidth = 10 ns */
624 systim = 1000000000 / (sysclk / 1000);
625 DBGPRINT(1, "HWA742 systim %lu ps extif_clk_period %u ps"
626 "extif_clk_div %d\n", systim, hwa742.extif_clk_period, div);
628 t = &hwa742.reg_timings;
629 memset(t, 0, sizeof(*t));
632 t->we_on_time = round_to_extif_ticks(t->cs_on_time + 2000, div);
633 t->re_on_time = round_to_extif_ticks(t->cs_on_time + 2000, div);
634 t->access_time = round_to_extif_ticks(t->re_on_time + 12200, div);
635 t->we_off_time = round_to_extif_ticks(t->we_on_time + 1000, div);
636 t->re_off_time = round_to_extif_ticks(t->re_on_time + 16000, div);
637 t->cs_off_time = round_to_extif_ticks(t->re_off_time + 1000, div);
638 t->we_cycle_time = round_to_extif_ticks(2 * systim + 2000, div);
639 if (t->we_cycle_time < t->we_off_time)
640 t->we_cycle_time = t->we_off_time;
641 t->re_cycle_time = round_to_extif_ticks(2 * systim + 2000, div);
642 if (t->re_cycle_time < t->re_off_time)
643 t->re_cycle_time = t->re_off_time;
644 t->cs_pulse_width = 0;
646 DBGPRINT(1, "[reg]cson %d csoff %d reon %d reoff %d\n",
647 t->cs_on_time, t->cs_off_time, t->re_on_time, t->re_off_time);
648 DBGPRINT(1, "[reg]weon %d weoff %d recyc %d wecyc %d\n",
649 t->we_on_time, t->we_off_time, t->re_cycle_time,
651 DBGPRINT(1, "[reg]rdaccess %d cspulse %d\n",
652 t->access_time, t->cs_pulse_width);
654 return hwa742.extif->convert_timings(t);
657 static int calc_lut_timing(unsigned long sysclk, int div)
659 struct extif_timings *t;
660 unsigned long systim;
662 /* CSOnTime 0, WEOnTime 2 ns, REOnTime 2 ns,
663 * AccessTime 2 ns + 4 * SYSCLK + 26 (lut),
664 * WEOffTime = WEOnTime + 1 ns,
665 * REOffTime = REOnTime + 4*SYSCLK + 26 ns (lut),
666 * CSOffTime = REOffTime + 1 ns
667 * ReadCycle = 2ns + 4*SYSCLK + 26 ns (lut),
668 * WriteCycle = 2*SYSCLK + 2 ns,
669 * CSPulseWidth = 10 ns
671 systim = 1000000000 / (sysclk / 1000);
672 DBGPRINT(1, "HWA742 systim %lu ps extif_clk_period %u ps"
673 "extif_clk_div %d\n", systim, hwa742.extif_clk_period, div);
675 t = &hwa742.lut_timings;
676 memset(t, 0, sizeof(*t));
681 t->we_on_time = round_to_extif_ticks(t->cs_on_time + 2000, div);
682 t->re_on_time = round_to_extif_ticks(t->cs_on_time + 2000, div);
683 t->access_time = round_to_extif_ticks(t->re_on_time + 4 * systim +
685 t->we_off_time = round_to_extif_ticks(t->we_on_time + 1000, div);
686 t->re_off_time = round_to_extif_ticks(t->re_on_time + 4 * systim +
688 t->cs_off_time = round_to_extif_ticks(t->re_off_time + 1000, div);
689 t->we_cycle_time = round_to_extif_ticks(2 * systim + 2000, div);
690 if (t->we_cycle_time < t->we_off_time)
691 t->we_cycle_time = t->we_off_time;
692 t->re_cycle_time = round_to_extif_ticks(2000 + 4 * systim + 26000, div);
693 if (t->re_cycle_time < t->re_off_time)
694 t->re_cycle_time = t->re_off_time;
695 t->cs_pulse_width = 0;
697 DBGPRINT(1, "[lut]cson %d csoff %d reon %d reoff %d\n",
698 t->cs_on_time, t->cs_off_time, t->re_on_time, t->re_off_time);
699 DBGPRINT(1, "[lut]weon %d weoff %d recyc %d wecyc %d\n",
700 t->we_on_time, t->we_off_time, t->re_cycle_time,
702 DBGPRINT(1, "[lut]rdaccess %d cspulse %d\n",
703 t->access_time, t->cs_pulse_width);
705 return hwa742.extif->convert_timings(t);
708 static int calc_extif_timings(unsigned long sysclk)
713 hwa742.extif->get_clk_info(&hwa742.extif_clk_period, &max_clk_div);
714 for (div = 1; div < max_clk_div; div++) {
715 if (calc_reg_timing(sysclk, div) == 0)
718 if (div == max_clk_div)
721 for (div = 1; div < max_clk_div; div++) {
722 if (calc_lut_timing(sysclk, div) == 0)
726 if (div < max_clk_div)
730 pr_err("can't setup timings\n");
734 static unsigned long hwa742_get_caps(void)
736 return OMAPFB_CAPS_MANUAL_UPDATE;
739 static void hwa742_suspend(void)
741 hwa742.update_mode_before_suspend = hwa742.update_mode;
742 hwa742_set_update_mode(OMAPFB_UPDATE_DISABLED);
743 /* Enable sleep mode */
744 hwa742_write_reg(HWA742_POWER_SAVE, 1 << 1);
745 clk_disable(hwa742.sys_ck);
748 static void hwa742_resume(void)
750 if (clk_enable(hwa742.sys_ck) != 0)
751 pr_err("failed to enable SYS clock\n");
752 /* Disable sleep mode */
753 hwa742_write_reg(HWA742_POWER_SAVE, 0);
755 /* Loop until PLL output is stabilized */
756 if (hwa742_read_reg(HWA742_PLL_DIV_REG) & (1 << 7))
758 set_current_state(TASK_UNINTERRUPTIBLE);
759 schedule_timeout(msecs_to_jiffies(5));
761 hwa742_set_update_mode(hwa742.update_mode_before_suspend);
764 struct lcd_ctrl hwa742_ctrl;
766 static int hwa742_init(struct omapfb_device *fbdev, int ext_mode, int req_vram_size)
770 unsigned long sysfreq;
775 hwa742.sys_ck = clk_get(0, "bclk");
776 if (IS_ERR(hwa742.sys_ck)) {
777 pr_err("can't get SYS clock\n");
778 return PTR_ERR(hwa742.sys_ck);
781 if ((r = clk_enable(hwa742.sys_ck)) != 0) {
782 pr_err("can't enable SYS clock\n");
783 clk_put(hwa742.sys_ck);
787 BUG_ON(!fbdev->ext_if || !fbdev->int_ctrl);
789 hwa742.fbdev = fbdev;
790 hwa742.extif = fbdev->ext_if;
791 hwa742.int_ctrl = fbdev->int_ctrl;
793 spin_lock_init(&hwa742.req_lock);
795 if ((r = hwa742.int_ctrl->init(fbdev, 1, req_vram_size)) < 0)
798 if ((r = hwa742.extif->init()) < 0)
801 hwa742_ctrl.get_vram_layout = hwa742.int_ctrl->get_vram_layout;
802 hwa742_ctrl.mmap = hwa742.int_ctrl->mmap;
804 sysfreq = clk_get_rate(hwa742.sys_ck);
805 if ((r = calc_extif_timings(sysfreq)) < 0)
807 hwa742.extif->set_timings(&hwa742.reg_timings);
809 div = (hwa742_read_reg(HWA742_PLL_DIV_REG) & 0x3f) + 1;
811 nd = (hwa742_read_reg(HWA742_PLL_4_REG) & 0x7f) + 1;
813 if ((r = calc_extif_timings(sysfreq / div * nd)) < 0)
815 hwa742.extif->set_timings(&hwa742.reg_timings);
817 rev = hwa742_read_reg(HWA742_REV_CODE_REG);
818 if ((rev & 0xfc) != 0x80) {
819 pr_err("invalid revision %02x\n", rev);
824 conf = hwa742_read_reg(HWA742_CONFIG_REG);
825 pr_info(MODULE_NAME ": Epson HWA742 LCD controller rev. %d "
826 "initialized (CNF pins %x)\n", rev & 0x03, conf & 0x07);
828 if (!(hwa742_read_reg(HWA742_PLL_DIV_REG) & 0x80)) {
829 pr_err("controller not initialized by the bootloader\n");
834 hwa742.max_transmit_size = hwa742.extif->max_transmit_size;
836 hwa742.update_mode = OMAPFB_UPDATE_DISABLED;
838 hwa742.auto_update_window.x = 0;
839 hwa742.auto_update_window.y = 0;
840 hwa742.auto_update_window.width = fbdev->panel->x_res;
841 hwa742.auto_update_window.height = fbdev->panel->y_res;
842 hwa742.auto_update_window.format = 0;
844 init_timer(&hwa742.auto_update_timer);
845 hwa742.auto_update_timer.function = hwa742_update_window_auto;
846 hwa742.auto_update_timer.data = 0;
848 hwa742.prev_color_mode = -1;
849 hwa742.prev_flags = 0;
851 hwa742.fbdev = fbdev;
853 INIT_LIST_HEAD(&hwa742.free_req_list);
854 INIT_LIST_HEAD(&hwa742.pending_req_list);
855 for (i = 0; i < ARRAY_SIZE(hwa742.req_pool); i++)
856 list_add(&hwa742.req_pool[i].entry, &hwa742.free_req_list);
857 BUG_ON(i <= IRQ_REQ_POOL_SIZE);
858 sema_init(&hwa742.req_sema, i - IRQ_REQ_POOL_SIZE);
862 hwa742.extif->cleanup();
864 hwa742.int_ctrl->cleanup();
866 clk_disable(hwa742.sys_ck);
867 clk_put(hwa742.sys_ck);
871 static void hwa742_cleanup(void)
873 hwa742_set_update_mode(OMAPFB_UPDATE_DISABLED);
874 hwa742.extif->cleanup();
875 hwa742.int_ctrl->cleanup();
876 clk_disable(hwa742.sys_ck);
877 clk_put(hwa742.sys_ck);
880 struct lcd_ctrl hwa742_ctrl = {
883 .cleanup = hwa742_cleanup,
884 .bind_client = hwa742_bind_client,
885 .get_caps = hwa742_get_caps,
886 .set_update_mode = hwa742_set_update_mode,
887 .get_update_mode = hwa742_get_update_mode,
888 .setup_plane = hwa742_setup_plane,
889 .enable_plane = hwa742_enable_plane,
890 .update_window = hwa742_update_window_async,
892 .suspend = hwa742_suspend,
893 .resume = hwa742_resume,