2 * SuperH Mobile LCDC Framebuffer
4 * Copyright (c) 2008 Magnus Damm
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
11 #include <linux/kernel.h>
12 #include <linux/init.h>
13 #include <linux/delay.h>
15 #include <linux/clk.h>
16 #include <linux/pm_runtime.h>
17 #include <linux/platform_device.h>
18 #include <linux/dma-mapping.h>
19 #include <linux/interrupt.h>
20 #include <linux/vmalloc.h>
21 #include <linux/ioctl.h>
22 #include <linux/slab.h>
23 #include <linux/console.h>
24 #include <linux/backlight.h>
25 #include <linux/gpio.h>
26 #include <video/sh_mobile_lcdc.h>
27 #include <video/sh_mobile_meram.h>
28 #include <linux/atomic.h>
30 #include "sh_mobile_lcdcfb.h"
32 #define SIDE_B_OFFSET 0x1000
33 #define MIRROR_OFFSET 0x2000
38 static unsigned long lcdc_offs_mainlcd[NR_CH_REGS] = {
58 static unsigned long lcdc_offs_sublcd[NR_CH_REGS] = {
76 static const struct fb_videomode default_720p = {
91 .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
94 struct sh_mobile_lcdc_priv {
100 unsigned long lddckr;
101 struct sh_mobile_lcdc_chan ch[2];
102 struct notifier_block notifier;
104 int forced_bpp; /* 2 channel LCDC must share bpp setting */
105 struct sh_mobile_meram_info *meram_dev;
108 static bool banked(int reg_nr)
128 static void lcdc_write_chan(struct sh_mobile_lcdc_chan *chan,
129 int reg_nr, unsigned long data)
131 iowrite32(data, chan->lcdc->base + chan->reg_offs[reg_nr]);
133 iowrite32(data, chan->lcdc->base + chan->reg_offs[reg_nr] +
137 static void lcdc_write_chan_mirror(struct sh_mobile_lcdc_chan *chan,
138 int reg_nr, unsigned long data)
140 iowrite32(data, chan->lcdc->base + chan->reg_offs[reg_nr] +
144 static unsigned long lcdc_read_chan(struct sh_mobile_lcdc_chan *chan,
147 return ioread32(chan->lcdc->base + chan->reg_offs[reg_nr]);
150 static void lcdc_write(struct sh_mobile_lcdc_priv *priv,
151 unsigned long reg_offs, unsigned long data)
153 iowrite32(data, priv->base + reg_offs);
156 static unsigned long lcdc_read(struct sh_mobile_lcdc_priv *priv,
157 unsigned long reg_offs)
159 return ioread32(priv->base + reg_offs);
162 static void lcdc_wait_bit(struct sh_mobile_lcdc_priv *priv,
163 unsigned long reg_offs,
164 unsigned long mask, unsigned long until)
166 while ((lcdc_read(priv, reg_offs) & mask) != until)
170 static int lcdc_chan_is_sublcd(struct sh_mobile_lcdc_chan *chan)
172 return chan->cfg.chan == LCDC_CHAN_SUBLCD;
175 static void lcdc_sys_write_index(void *handle, unsigned long data)
177 struct sh_mobile_lcdc_chan *ch = handle;
179 lcdc_write(ch->lcdc, _LDDWD0R, data | LDDWDxR_WDACT);
180 lcdc_wait_bit(ch->lcdc, _LDSR, LDSR_AS, 0);
181 lcdc_write(ch->lcdc, _LDDWAR, LDDWAR_WA |
182 (lcdc_chan_is_sublcd(ch) ? 2 : 0));
183 lcdc_wait_bit(ch->lcdc, _LDSR, LDSR_AS, 0);
186 static void lcdc_sys_write_data(void *handle, unsigned long data)
188 struct sh_mobile_lcdc_chan *ch = handle;
190 lcdc_write(ch->lcdc, _LDDWD0R, data | LDDWDxR_WDACT | LDDWDxR_RSW);
191 lcdc_wait_bit(ch->lcdc, _LDSR, LDSR_AS, 0);
192 lcdc_write(ch->lcdc, _LDDWAR, LDDWAR_WA |
193 (lcdc_chan_is_sublcd(ch) ? 2 : 0));
194 lcdc_wait_bit(ch->lcdc, _LDSR, LDSR_AS, 0);
197 static unsigned long lcdc_sys_read_data(void *handle)
199 struct sh_mobile_lcdc_chan *ch = handle;
201 lcdc_write(ch->lcdc, _LDDRDR, LDDRDR_RSR);
202 lcdc_wait_bit(ch->lcdc, _LDSR, LDSR_AS, 0);
203 lcdc_write(ch->lcdc, _LDDRAR, LDDRAR_RA |
204 (lcdc_chan_is_sublcd(ch) ? 2 : 0));
206 lcdc_wait_bit(ch->lcdc, _LDSR, LDSR_AS, 0);
208 return lcdc_read(ch->lcdc, _LDDRDR) & LDDRDR_DRD_MASK;
211 struct sh_mobile_lcdc_sys_bus_ops sh_mobile_lcdc_sys_bus_ops = {
212 lcdc_sys_write_index,
217 static void sh_mobile_lcdc_clk_on(struct sh_mobile_lcdc_priv *priv)
219 if (atomic_inc_and_test(&priv->hw_usecnt)) {
221 clk_enable(priv->dot_clk);
222 pm_runtime_get_sync(priv->dev);
223 if (priv->meram_dev && priv->meram_dev->pdev)
224 pm_runtime_get_sync(&priv->meram_dev->pdev->dev);
228 static void sh_mobile_lcdc_clk_off(struct sh_mobile_lcdc_priv *priv)
230 if (atomic_sub_return(1, &priv->hw_usecnt) == -1) {
231 if (priv->meram_dev && priv->meram_dev->pdev)
232 pm_runtime_put_sync(&priv->meram_dev->pdev->dev);
233 pm_runtime_put(priv->dev);
235 clk_disable(priv->dot_clk);
239 static int sh_mobile_lcdc_sginit(struct fb_info *info,
240 struct list_head *pagelist)
242 struct sh_mobile_lcdc_chan *ch = info->par;
243 unsigned int nr_pages_max = info->fix.smem_len >> PAGE_SHIFT;
247 sg_init_table(ch->sglist, nr_pages_max);
249 list_for_each_entry(page, pagelist, lru)
250 sg_set_page(&ch->sglist[nr_pages++], page, PAGE_SIZE, 0);
255 static void sh_mobile_lcdc_deferred_io(struct fb_info *info,
256 struct list_head *pagelist)
258 struct sh_mobile_lcdc_chan *ch = info->par;
259 struct sh_mobile_lcdc_board_cfg *bcfg = &ch->cfg.board_cfg;
261 /* enable clocks before accessing hardware */
262 sh_mobile_lcdc_clk_on(ch->lcdc);
265 * It's possible to get here without anything on the pagelist via
266 * sh_mobile_lcdc_deferred_io_touch() or via a userspace fsync()
267 * invocation. In the former case, the acceleration routines are
268 * stepped in to when using the framebuffer console causing the
269 * workqueue to be scheduled without any dirty pages on the list.
271 * Despite this, a panel update is still needed given that the
272 * acceleration routines have their own methods for writing in
273 * that still need to be updated.
275 * The fsync() and empty pagelist case could be optimized for,
276 * but we don't bother, as any application exhibiting such
277 * behaviour is fundamentally broken anyways.
279 if (!list_empty(pagelist)) {
280 unsigned int nr_pages = sh_mobile_lcdc_sginit(info, pagelist);
282 /* trigger panel update */
283 dma_map_sg(info->dev, ch->sglist, nr_pages, DMA_TO_DEVICE);
284 if (bcfg->start_transfer)
285 bcfg->start_transfer(bcfg->board_data, ch,
286 &sh_mobile_lcdc_sys_bus_ops);
287 lcdc_write_chan(ch, LDSM2R, LDSM2R_OSTRG);
288 dma_unmap_sg(info->dev, ch->sglist, nr_pages, DMA_TO_DEVICE);
290 if (bcfg->start_transfer)
291 bcfg->start_transfer(bcfg->board_data, ch,
292 &sh_mobile_lcdc_sys_bus_ops);
293 lcdc_write_chan(ch, LDSM2R, LDSM2R_OSTRG);
297 static void sh_mobile_lcdc_deferred_io_touch(struct fb_info *info)
299 struct fb_deferred_io *fbdefio = info->fbdefio;
302 schedule_delayed_work(&info->deferred_work, fbdefio->delay);
305 static irqreturn_t sh_mobile_lcdc_irq(int irq, void *data)
307 struct sh_mobile_lcdc_priv *priv = data;
308 struct sh_mobile_lcdc_chan *ch;
309 unsigned long ldintr;
313 /* Acknowledge interrupts and disable further VSYNC End IRQs. */
314 ldintr = lcdc_read(priv, _LDINTR);
315 lcdc_write(priv, _LDINTR, (ldintr ^ LDINTR_STATUS_MASK) & ~LDINTR_VEE);
317 /* figure out if this interrupt is for main or sub lcd */
318 is_sub = (lcdc_read(priv, _LDSR) & LDSR_MSS) ? 1 : 0;
320 /* wake up channel and disable clocks */
321 for (k = 0; k < ARRAY_SIZE(priv->ch); k++) {
328 if (ldintr & LDINTR_FS) {
329 if (is_sub == lcdc_chan_is_sublcd(ch)) {
331 wake_up(&ch->frame_end_wait);
333 sh_mobile_lcdc_clk_off(priv);
338 if (ldintr & LDINTR_VES)
339 complete(&ch->vsync_completion);
345 static void sh_mobile_lcdc_start_stop(struct sh_mobile_lcdc_priv *priv,
348 unsigned long tmp = lcdc_read(priv, _LDCNT2R);
351 /* start or stop the lcdc */
353 lcdc_write(priv, _LDCNT2R, tmp | LDCNT2R_DO);
355 lcdc_write(priv, _LDCNT2R, tmp & ~LDCNT2R_DO);
357 /* wait until power is applied/stopped on all channels */
358 for (k = 0; k < ARRAY_SIZE(priv->ch); k++)
359 if (lcdc_read(priv, _LDCNT2R) & priv->ch[k].enabled)
361 tmp = lcdc_read_chan(&priv->ch[k], LDPMR)
363 if (start && tmp == LDPMR_LPS)
365 if (!start && tmp == 0)
371 lcdc_write(priv, _LDDCKSTPR, 1); /* stop dotclock */
374 static void sh_mobile_lcdc_geometry(struct sh_mobile_lcdc_chan *ch)
376 struct fb_var_screeninfo *var = &ch->info->var, *display_var = &ch->display_var;
377 unsigned long h_total, hsync_pos, display_h_total;
380 tmp = ch->ldmt1r_value;
381 tmp |= (var->sync & FB_SYNC_VERT_HIGH_ACT) ? 0 : LDMT1R_VPOL;
382 tmp |= (var->sync & FB_SYNC_HOR_HIGH_ACT) ? 0 : LDMT1R_HPOL;
383 tmp |= (ch->cfg.flags & LCDC_FLAGS_DWPOL) ? LDMT1R_DWPOL : 0;
384 tmp |= (ch->cfg.flags & LCDC_FLAGS_DIPOL) ? LDMT1R_DIPOL : 0;
385 tmp |= (ch->cfg.flags & LCDC_FLAGS_DAPOL) ? LDMT1R_DAPOL : 0;
386 tmp |= (ch->cfg.flags & LCDC_FLAGS_HSCNT) ? LDMT1R_HSCNT : 0;
387 tmp |= (ch->cfg.flags & LCDC_FLAGS_DWCNT) ? LDMT1R_DWCNT : 0;
388 lcdc_write_chan(ch, LDMT1R, tmp);
391 lcdc_write_chan(ch, LDMT2R, ch->cfg.sys_bus_cfg.ldmt2r);
392 lcdc_write_chan(ch, LDMT3R, ch->cfg.sys_bus_cfg.ldmt3r);
394 /* horizontal configuration */
395 h_total = display_var->xres + display_var->hsync_len +
396 display_var->left_margin + display_var->right_margin;
397 tmp = h_total / 8; /* HTCN */
398 tmp |= (min(display_var->xres, var->xres) / 8) << 16; /* HDCN */
399 lcdc_write_chan(ch, LDHCNR, tmp);
401 hsync_pos = display_var->xres + display_var->right_margin;
402 tmp = hsync_pos / 8; /* HSYNP */
403 tmp |= (display_var->hsync_len / 8) << 16; /* HSYNW */
404 lcdc_write_chan(ch, LDHSYNR, tmp);
406 /* vertical configuration */
407 tmp = display_var->yres + display_var->vsync_len +
408 display_var->upper_margin + display_var->lower_margin; /* VTLN */
409 tmp |= min(display_var->yres, var->yres) << 16; /* VDLN */
410 lcdc_write_chan(ch, LDVLNR, tmp);
412 tmp = display_var->yres + display_var->lower_margin; /* VSYNP */
413 tmp |= display_var->vsync_len << 16; /* VSYNW */
414 lcdc_write_chan(ch, LDVSYNR, tmp);
416 /* Adjust horizontal synchronisation for HDMI */
417 display_h_total = display_var->xres + display_var->hsync_len +
418 display_var->left_margin + display_var->right_margin;
419 tmp = ((display_var->xres & 7) << 24) |
420 ((display_h_total & 7) << 16) |
421 ((display_var->hsync_len & 7) << 8) |
423 lcdc_write_chan(ch, LDHAJR, tmp);
427 * __sh_mobile_lcdc_start - Configure and tart the LCDC
430 * Configure all enabled channels and start the LCDC device. All external
431 * devices (clocks, MERAM, panels, ...) are not touched by this function.
433 static void __sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
435 struct sh_mobile_lcdc_chan *ch;
440 /* Enable LCDC channels. Read data from external memory, avoid using the
443 lcdc_write(priv, _LDCNT2R, priv->ch[0].enabled | priv->ch[1].enabled);
445 /* Stop the LCDC first and disable all interrupts. */
446 sh_mobile_lcdc_start_stop(priv, 0);
447 lcdc_write(priv, _LDINTR, 0);
449 /* Configure power supply, dot clocks and start them. */
451 for (k = 0; k < ARRAY_SIZE(priv->ch); k++) {
457 bpp = ch->info->var.bits_per_pixel;
460 lcdc_write_chan(ch, LDPMR, 0);
462 m = ch->cfg.clock_divider;
466 /* FIXME: sh7724 can only use 42, 48, 54 and 60 for the divider
469 lcdc_write_chan(ch, LDDCKPAT1R, 0);
470 lcdc_write_chan(ch, LDDCKPAT2R, (1 << (m/2)) - 1);
474 tmp |= m << (lcdc_chan_is_sublcd(ch) ? 8 : 0);
477 lcdc_write(priv, _LDDCKR, tmp);
478 lcdc_write(priv, _LDDCKSTPR, 0);
479 lcdc_wait_bit(priv, _LDDCKSTPR, ~0, 0);
481 /* Setup geometry, format, frame buffer memory and operation mode. */
482 for (k = 0; k < ARRAY_SIZE(priv->ch); k++) {
487 sh_mobile_lcdc_geometry(ch);
489 if (ch->info->var.nonstd) {
490 tmp = (ch->info->var.nonstd << 16);
491 switch (ch->info->var.bits_per_pixel) {
504 switch (ch->info->var.bits_per_pixel) {
506 tmp = LDDFR_PKF_RGB16;
509 tmp = LDDFR_PKF_RGB24;
513 tmp = LDDFR_PKF_ARGB32;
518 lcdc_write_chan(ch, LDDFR, tmp);
519 lcdc_write_chan(ch, LDMLSR, ch->pitch);
520 lcdc_write_chan(ch, LDSA1R, ch->base_addr_y);
521 if (ch->info->var.nonstd)
522 lcdc_write_chan(ch, LDSA2R, ch->base_addr_c);
524 /* When using deferred I/O mode, configure the LCDC for one-shot
525 * operation and enable the frame end interrupt. Otherwise use
526 * continuous read mode.
528 if (ch->ldmt1r_value & LDMT1R_IFM &&
529 ch->cfg.sys_bus_cfg.deferred_io_msec) {
530 lcdc_write_chan(ch, LDSM1R, LDSM1R_OS);
531 lcdc_write(priv, _LDINTR, LDINTR_FE);
533 lcdc_write_chan(ch, LDSM1R, 0);
537 /* Word and long word swap. */
538 if (priv->ch[0].info->var.nonstd)
539 tmp = LDDDSR_LS | LDDDSR_WS | LDDDSR_BS;
543 tmp = LDDDSR_LS | LDDDSR_WS;
546 tmp = LDDDSR_LS | LDDDSR_WS | LDDDSR_BS;
554 lcdc_write(priv, _LDDDSR, tmp);
556 /* Enable the display output. */
557 lcdc_write(priv, _LDCNT1R, LDCNT1R_DE);
558 sh_mobile_lcdc_start_stop(priv, 1);
562 static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv)
564 struct sh_mobile_meram_info *mdev = priv->meram_dev;
565 struct sh_mobile_lcdc_board_cfg *board_cfg;
566 struct sh_mobile_lcdc_chan *ch;
571 /* enable clocks before accessing the hardware */
572 for (k = 0; k < ARRAY_SIZE(priv->ch); k++) {
573 if (priv->ch[k].enabled)
574 sh_mobile_lcdc_clk_on(priv);
578 lcdc_write(priv, _LDCNT2R, lcdc_read(priv, _LDCNT2R) | LDCNT2R_BR);
579 lcdc_wait_bit(priv, _LDCNT2R, LDCNT2R_BR, 0);
581 for (k = 0; k < ARRAY_SIZE(priv->ch); k++) {
587 board_cfg = &ch->cfg.board_cfg;
588 if (board_cfg->setup_sys) {
589 ret = board_cfg->setup_sys(board_cfg->board_data, ch,
590 &sh_mobile_lcdc_sys_bus_ops);
596 /* Compute frame buffer base address and pitch for each channel. */
597 for (k = 0; k < ARRAY_SIZE(priv->ch); k++) {
598 struct sh_mobile_meram_cfg *cfg;
605 ch->base_addr_y = ch->info->fix.smem_start;
606 ch->base_addr_c = ch->base_addr_y
608 * ch->info->var.yres_virtual;
609 ch->pitch = ch->info->fix.line_length;
611 /* Enable MERAM if possible. */
612 cfg = ch->cfg.meram_cfg;
613 if (mdev == NULL || mdev->ops == NULL || cfg == NULL)
616 /* we need to de-init configured ICBs before we can
617 * re-initialize them.
619 if (ch->meram_enabled) {
620 mdev->ops->meram_unregister(mdev, cfg);
621 ch->meram_enabled = 0;
624 if (!ch->info->var.nonstd)
625 pixelformat = SH_MOBILE_MERAM_PF_RGB;
626 else if (ch->info->var.bits_per_pixel == 24)
627 pixelformat = SH_MOBILE_MERAM_PF_NV24;
629 pixelformat = SH_MOBILE_MERAM_PF_NV;
631 ret = mdev->ops->meram_register(mdev, cfg, ch->pitch,
632 ch->info->var.yres, pixelformat,
633 ch->base_addr_y, ch->base_addr_c,
634 &ch->base_addr_y, &ch->base_addr_c,
637 ch->meram_enabled = 1;
640 /* Start the LCDC. */
641 __sh_mobile_lcdc_start(priv);
643 /* Setup deferred I/O, tell the board code to enable the panels, and
646 for (k = 0; k < ARRAY_SIZE(priv->ch); k++) {
651 tmp = ch->cfg.sys_bus_cfg.deferred_io_msec;
652 if (ch->ldmt1r_value & LDMT1R_IFM && tmp) {
653 ch->defio.deferred_io = sh_mobile_lcdc_deferred_io;
654 ch->defio.delay = msecs_to_jiffies(tmp);
655 ch->info->fbdefio = &ch->defio;
656 fb_deferred_io_init(ch->info);
659 board_cfg = &ch->cfg.board_cfg;
660 if (board_cfg->display_on && try_module_get(board_cfg->owner)) {
661 board_cfg->display_on(board_cfg->board_data, ch->info);
662 module_put(board_cfg->owner);
666 ch->bl->props.power = FB_BLANK_UNBLANK;
667 backlight_update_status(ch->bl);
674 static void sh_mobile_lcdc_stop(struct sh_mobile_lcdc_priv *priv)
676 struct sh_mobile_lcdc_chan *ch;
677 struct sh_mobile_lcdc_board_cfg *board_cfg;
680 /* clean up deferred io and ask board code to disable panel */
681 for (k = 0; k < ARRAY_SIZE(priv->ch); k++) {
687 * flush frame, and wait for frame end interrupt
688 * clean up deferred io and enable clock
690 if (ch->info && ch->info->fbdefio) {
692 schedule_delayed_work(&ch->info->deferred_work, 0);
693 wait_event(ch->frame_end_wait, ch->frame_end);
694 fb_deferred_io_cleanup(ch->info);
695 ch->info->fbdefio = NULL;
696 sh_mobile_lcdc_clk_on(priv);
700 ch->bl->props.power = FB_BLANK_POWERDOWN;
701 backlight_update_status(ch->bl);
704 board_cfg = &ch->cfg.board_cfg;
705 if (board_cfg->display_off && try_module_get(board_cfg->owner)) {
706 board_cfg->display_off(board_cfg->board_data);
707 module_put(board_cfg->owner);
710 /* disable the meram */
711 if (ch->meram_enabled) {
712 struct sh_mobile_meram_cfg *cfg;
713 struct sh_mobile_meram_info *mdev;
714 cfg = ch->cfg.meram_cfg;
715 mdev = priv->meram_dev;
716 mdev->ops->meram_unregister(mdev, cfg);
717 ch->meram_enabled = 0;
724 sh_mobile_lcdc_start_stop(priv, 0);
729 for (k = 0; k < ARRAY_SIZE(priv->ch); k++)
730 if (priv->ch[k].enabled)
731 sh_mobile_lcdc_clk_off(priv);
734 static int sh_mobile_lcdc_check_interface(struct sh_mobile_lcdc_chan *ch)
736 int interface_type = ch->cfg.interface_type;
738 switch (interface_type) {
762 /* SUBLCD only supports SYS interface */
763 if (lcdc_chan_is_sublcd(ch)) {
764 if (!(interface_type & LDMT1R_IFM))
767 interface_type &= ~LDMT1R_IFM;
770 ch->ldmt1r_value = interface_type;
774 static int sh_mobile_lcdc_setup_clocks(struct platform_device *pdev,
776 struct sh_mobile_lcdc_priv *priv)
780 switch (clock_source) {
783 priv->lddckr = LDDCKR_ICKSEL_BUS;
785 case LCDC_CLK_PERIPHERAL:
786 str = "peripheral_clk";
787 priv->lddckr = LDDCKR_ICKSEL_MIPI;
789 case LCDC_CLK_EXTERNAL:
791 priv->lddckr = LDDCKR_ICKSEL_HDMI;
798 priv->dot_clk = clk_get(&pdev->dev, str);
799 if (IS_ERR(priv->dot_clk)) {
800 dev_err(&pdev->dev, "cannot get dot clock %s\n", str);
801 return PTR_ERR(priv->dot_clk);
805 /* Runtime PM support involves two step for this driver:
806 * 1) Enable Runtime PM
807 * 2) Force Runtime PM Resume since hardware is accessed from probe()
809 priv->dev = &pdev->dev;
810 pm_runtime_enable(priv->dev);
811 pm_runtime_resume(priv->dev);
815 static int sh_mobile_lcdc_setcolreg(u_int regno,
816 u_int red, u_int green, u_int blue,
817 u_int transp, struct fb_info *info)
819 u32 *palette = info->pseudo_palette;
821 if (regno >= PALETTE_NR)
824 /* only FB_VISUAL_TRUECOLOR supported */
826 red >>= 16 - info->var.red.length;
827 green >>= 16 - info->var.green.length;
828 blue >>= 16 - info->var.blue.length;
829 transp >>= 16 - info->var.transp.length;
831 palette[regno] = (red << info->var.red.offset) |
832 (green << info->var.green.offset) |
833 (blue << info->var.blue.offset) |
834 (transp << info->var.transp.offset);
839 static struct fb_fix_screeninfo sh_mobile_lcdc_fix = {
840 .id = "SH Mobile LCDC",
841 .type = FB_TYPE_PACKED_PIXELS,
842 .visual = FB_VISUAL_TRUECOLOR,
843 .accel = FB_ACCEL_NONE,
849 static void sh_mobile_lcdc_fillrect(struct fb_info *info,
850 const struct fb_fillrect *rect)
852 sys_fillrect(info, rect);
853 sh_mobile_lcdc_deferred_io_touch(info);
856 static void sh_mobile_lcdc_copyarea(struct fb_info *info,
857 const struct fb_copyarea *area)
859 sys_copyarea(info, area);
860 sh_mobile_lcdc_deferred_io_touch(info);
863 static void sh_mobile_lcdc_imageblit(struct fb_info *info,
864 const struct fb_image *image)
866 sys_imageblit(info, image);
867 sh_mobile_lcdc_deferred_io_touch(info);
870 static int sh_mobile_fb_pan_display(struct fb_var_screeninfo *var,
871 struct fb_info *info)
873 struct sh_mobile_lcdc_chan *ch = info->par;
874 struct sh_mobile_lcdc_priv *priv = ch->lcdc;
875 unsigned long ldrcntr;
876 unsigned long new_pan_offset;
877 unsigned long base_addr_y, base_addr_c;
878 unsigned long c_offset;
881 new_pan_offset = (var->yoffset * info->fix.line_length) +
882 (var->xoffset * (info->var.bits_per_pixel / 8));
884 new_pan_offset = (var->yoffset * info->fix.line_length) +
887 if (new_pan_offset == ch->pan_offset)
888 return 0; /* No change, do nothing */
890 ldrcntr = lcdc_read(priv, _LDRCNTR);
892 /* Set the source address for the next refresh */
893 base_addr_y = ch->dma_handle + new_pan_offset;
896 c_offset = (var->yoffset *
897 info->fix.line_length *
898 (info->var.bits_per_pixel - 8)) / 8;
899 base_addr_c = ch->dma_handle + var->xres * var->yres_virtual +
902 if (info->var.bits_per_pixel == 24)
903 base_addr_c += 2 * var->xoffset;
905 base_addr_c += var->xoffset;
908 if (ch->meram_enabled) {
909 struct sh_mobile_meram_cfg *cfg;
910 struct sh_mobile_meram_info *mdev;
913 cfg = ch->cfg.meram_cfg;
914 mdev = priv->meram_dev;
915 ret = mdev->ops->meram_update(mdev, cfg,
916 base_addr_y, base_addr_c,
917 &base_addr_y, &base_addr_c);
922 ch->base_addr_y = base_addr_y;
923 ch->base_addr_c = base_addr_c;
925 lcdc_write_chan_mirror(ch, LDSA1R, base_addr_y);
927 lcdc_write_chan_mirror(ch, LDSA2R, base_addr_c);
929 if (lcdc_chan_is_sublcd(ch))
930 lcdc_write(ch->lcdc, _LDRCNTR, ldrcntr ^ LDRCNTR_SRS);
932 lcdc_write(ch->lcdc, _LDRCNTR, ldrcntr ^ LDRCNTR_MRS);
934 ch->pan_offset = new_pan_offset;
936 sh_mobile_lcdc_deferred_io_touch(info);
941 static int sh_mobile_wait_for_vsync(struct fb_info *info)
943 struct sh_mobile_lcdc_chan *ch = info->par;
944 unsigned long ldintr;
947 /* Enable VSync End interrupt and be careful not to acknowledge any
950 ldintr = lcdc_read(ch->lcdc, _LDINTR);
951 ldintr |= LDINTR_VEE | LDINTR_STATUS_MASK;
952 lcdc_write(ch->lcdc, _LDINTR, ldintr);
954 ret = wait_for_completion_interruptible_timeout(&ch->vsync_completion,
955 msecs_to_jiffies(100));
962 static int sh_mobile_ioctl(struct fb_info *info, unsigned int cmd,
968 case FBIO_WAITFORVSYNC:
969 retval = sh_mobile_wait_for_vsync(info);
973 retval = -ENOIOCTLCMD;
979 static void sh_mobile_fb_reconfig(struct fb_info *info)
981 struct sh_mobile_lcdc_chan *ch = info->par;
982 struct fb_videomode mode1, mode2;
983 struct fb_event event;
984 int evnt = FB_EVENT_MODE_CHANGE_ALL;
986 if (ch->use_count > 1 || (ch->use_count == 1 && !info->fbcon_par))
987 /* More framebuffer users are active */
990 fb_var_to_videomode(&mode1, &ch->display_var);
991 fb_var_to_videomode(&mode2, &info->var);
993 if (fb_mode_is_equal(&mode1, &mode2))
996 /* Display has been re-plugged, framebuffer is free now, reconfigure */
997 if (fb_set_var(info, &ch->display_var) < 0)
998 /* Couldn't reconfigure, hopefully, can continue as before */
1001 if (info->var.nonstd)
1002 info->fix.line_length = mode1.xres;
1004 info->fix.line_length = mode1.xres * (ch->cfg.bpp / 8);
1007 * fb_set_var() calls the notifier change internally, only if
1008 * FBINFO_MISC_USEREVENT flag is set. Since we do not want to fake a
1009 * user event, we have to call the chain ourselves.
1012 event.data = &mode1;
1013 fb_notifier_call_chain(evnt, &event);
1017 * Locking: both .fb_release() and .fb_open() are called with info->lock held if
1018 * user == 1, or with console sem held, if user == 0.
1020 static int sh_mobile_release(struct fb_info *info, int user)
1022 struct sh_mobile_lcdc_chan *ch = info->par;
1024 mutex_lock(&ch->open_lock);
1025 dev_dbg(info->dev, "%s(): %d users\n", __func__, ch->use_count);
1029 /* Nothing to reconfigure, when called from fbcon */
1032 sh_mobile_fb_reconfig(info);
1036 mutex_unlock(&ch->open_lock);
1041 static int sh_mobile_open(struct fb_info *info, int user)
1043 struct sh_mobile_lcdc_chan *ch = info->par;
1045 mutex_lock(&ch->open_lock);
1048 dev_dbg(info->dev, "%s(): %d users\n", __func__, ch->use_count);
1049 mutex_unlock(&ch->open_lock);
1054 static int sh_mobile_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
1056 struct sh_mobile_lcdc_chan *ch = info->par;
1057 struct sh_mobile_lcdc_priv *p = ch->lcdc;
1059 if (var->xres > MAX_XRES || var->yres > MAX_YRES ||
1060 var->xres * var->yres * (ch->cfg.bpp / 8) * 2 > info->fix.smem_len) {
1061 dev_warn(info->dev, "Invalid info: %u-%u-%u-%u x %u-%u-%u-%u @ %lukHz!\n",
1062 var->left_margin, var->xres, var->right_margin, var->hsync_len,
1063 var->upper_margin, var->yres, var->lower_margin, var->vsync_len,
1064 PICOS2KHZ(var->pixclock));
1068 /* only accept the forced_bpp for dual channel configurations */
1069 if (p->forced_bpp && p->forced_bpp != var->bits_per_pixel)
1072 switch (var->bits_per_pixel) {
1073 case 16: /* PKF[4:0] = 00011 - RGB 565 */
1074 case 24: /* PKF[4:0] = 01011 - RGB 888 */
1075 case 32: /* PKF[4:0] = 00000 - RGBA 888 */
1085 * Screen blanking. Behavior is as follows:
1086 * FB_BLANK_UNBLANK: screen unblanked, clocks enabled
1087 * FB_BLANK_NORMAL: screen blanked, clocks enabled
1090 * FB_BLANK_POWEROFF: screen blanked, clocks disabled
1092 static int sh_mobile_lcdc_blank(int blank, struct fb_info *info)
1094 struct sh_mobile_lcdc_chan *ch = info->par;
1095 struct sh_mobile_lcdc_priv *p = ch->lcdc;
1097 /* blank the screen? */
1098 if (blank > FB_BLANK_UNBLANK && ch->blank_status == FB_BLANK_UNBLANK) {
1099 struct fb_fillrect rect = {
1100 .width = info->var.xres,
1101 .height = info->var.yres,
1103 sh_mobile_lcdc_fillrect(info, &rect);
1105 /* turn clocks on? */
1106 if (blank <= FB_BLANK_NORMAL && ch->blank_status > FB_BLANK_NORMAL) {
1107 sh_mobile_lcdc_clk_on(p);
1109 /* turn clocks off? */
1110 if (blank > FB_BLANK_NORMAL && ch->blank_status <= FB_BLANK_NORMAL) {
1111 /* make sure the screen is updated with the black fill before
1112 * switching the clocks off. one vsync is not enough since
1113 * blanking may occur in the middle of a refresh. deferred io
1114 * mode will reenable the clocks and update the screen in time,
1115 * so it does not need this. */
1116 if (!info->fbdefio) {
1117 sh_mobile_wait_for_vsync(info);
1118 sh_mobile_wait_for_vsync(info);
1120 sh_mobile_lcdc_clk_off(p);
1123 ch->blank_status = blank;
1127 static struct fb_ops sh_mobile_lcdc_ops = {
1128 .owner = THIS_MODULE,
1129 .fb_setcolreg = sh_mobile_lcdc_setcolreg,
1130 .fb_read = fb_sys_read,
1131 .fb_write = fb_sys_write,
1132 .fb_fillrect = sh_mobile_lcdc_fillrect,
1133 .fb_copyarea = sh_mobile_lcdc_copyarea,
1134 .fb_imageblit = sh_mobile_lcdc_imageblit,
1135 .fb_blank = sh_mobile_lcdc_blank,
1136 .fb_pan_display = sh_mobile_fb_pan_display,
1137 .fb_ioctl = sh_mobile_ioctl,
1138 .fb_open = sh_mobile_open,
1139 .fb_release = sh_mobile_release,
1140 .fb_check_var = sh_mobile_check_var,
1143 static int sh_mobile_lcdc_update_bl(struct backlight_device *bdev)
1145 struct sh_mobile_lcdc_chan *ch = bl_get_data(bdev);
1146 struct sh_mobile_lcdc_board_cfg *cfg = &ch->cfg.board_cfg;
1147 int brightness = bdev->props.brightness;
1149 if (bdev->props.power != FB_BLANK_UNBLANK ||
1150 bdev->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK))
1153 return cfg->set_brightness(cfg->board_data, brightness);
1156 static int sh_mobile_lcdc_get_brightness(struct backlight_device *bdev)
1158 struct sh_mobile_lcdc_chan *ch = bl_get_data(bdev);
1159 struct sh_mobile_lcdc_board_cfg *cfg = &ch->cfg.board_cfg;
1161 return cfg->get_brightness(cfg->board_data);
1164 static int sh_mobile_lcdc_check_fb(struct backlight_device *bdev,
1165 struct fb_info *info)
1167 return (info->bl_dev == bdev);
1170 static struct backlight_ops sh_mobile_lcdc_bl_ops = {
1171 .options = BL_CORE_SUSPENDRESUME,
1172 .update_status = sh_mobile_lcdc_update_bl,
1173 .get_brightness = sh_mobile_lcdc_get_brightness,
1174 .check_fb = sh_mobile_lcdc_check_fb,
1177 static struct backlight_device *sh_mobile_lcdc_bl_probe(struct device *parent,
1178 struct sh_mobile_lcdc_chan *ch)
1180 struct backlight_device *bl;
1182 bl = backlight_device_register(ch->cfg.bl_info.name, parent, ch,
1183 &sh_mobile_lcdc_bl_ops, NULL);
1185 dev_err(parent, "unable to register backlight device: %ld\n",
1190 bl->props.max_brightness = ch->cfg.bl_info.max_brightness;
1191 bl->props.brightness = bl->props.max_brightness;
1192 backlight_update_status(bl);
1197 static void sh_mobile_lcdc_bl_remove(struct backlight_device *bdev)
1199 backlight_device_unregister(bdev);
1202 static int sh_mobile_lcdc_set_bpp(struct fb_var_screeninfo *var, int bpp,
1210 var->bits_per_pixel = bpp;
1211 var->nonstd = nonstd;
1219 case 16: /* PKF[4:0] = 00011 - RGB 565 */
1220 var->red.offset = 11;
1221 var->red.length = 5;
1222 var->green.offset = 5;
1223 var->green.length = 6;
1224 var->blue.offset = 0;
1225 var->blue.length = 5;
1226 var->transp.offset = 0;
1227 var->transp.length = 0;
1230 case 24: /* PKF[4:0] = 01011 - RGB 888 */
1231 var->red.offset = 16;
1232 var->red.length = 8;
1233 var->green.offset = 8;
1234 var->green.length = 8;
1235 var->blue.offset = 0;
1236 var->blue.length = 8;
1237 var->transp.offset = 0;
1238 var->transp.length = 0;
1241 case 32: /* PKF[4:0] = 00000 - RGBA 888 */
1242 var->red.offset = 16;
1243 var->red.length = 8;
1244 var->green.offset = 8;
1245 var->green.length = 8;
1246 var->blue.offset = 0;
1247 var->blue.length = 8;
1248 var->transp.offset = 24;
1249 var->transp.length = 8;
1254 var->bits_per_pixel = bpp;
1255 var->red.msb_right = 0;
1256 var->green.msb_right = 0;
1257 var->blue.msb_right = 0;
1258 var->transp.msb_right = 0;
1262 static int sh_mobile_lcdc_suspend(struct device *dev)
1264 struct platform_device *pdev = to_platform_device(dev);
1266 sh_mobile_lcdc_stop(platform_get_drvdata(pdev));
1270 static int sh_mobile_lcdc_resume(struct device *dev)
1272 struct platform_device *pdev = to_platform_device(dev);
1274 return sh_mobile_lcdc_start(platform_get_drvdata(pdev));
1277 static int sh_mobile_lcdc_runtime_suspend(struct device *dev)
1279 struct platform_device *pdev = to_platform_device(dev);
1280 struct sh_mobile_lcdc_priv *priv = platform_get_drvdata(pdev);
1282 /* turn off LCDC hardware */
1283 lcdc_write(priv, _LDCNT1R, 0);
1288 static int sh_mobile_lcdc_runtime_resume(struct device *dev)
1290 struct platform_device *pdev = to_platform_device(dev);
1291 struct sh_mobile_lcdc_priv *priv = platform_get_drvdata(pdev);
1293 __sh_mobile_lcdc_start(priv);
1298 static const struct dev_pm_ops sh_mobile_lcdc_dev_pm_ops = {
1299 .suspend = sh_mobile_lcdc_suspend,
1300 .resume = sh_mobile_lcdc_resume,
1301 .runtime_suspend = sh_mobile_lcdc_runtime_suspend,
1302 .runtime_resume = sh_mobile_lcdc_runtime_resume,
1305 /* locking: called with info->lock held */
1306 static int sh_mobile_lcdc_notify(struct notifier_block *nb,
1307 unsigned long action, void *data)
1309 struct fb_event *event = data;
1310 struct fb_info *info = event->info;
1311 struct sh_mobile_lcdc_chan *ch = info->par;
1312 struct sh_mobile_lcdc_board_cfg *board_cfg = &ch->cfg.board_cfg;
1314 if (&ch->lcdc->notifier != nb)
1317 dev_dbg(info->dev, "%s(): action = %lu, data = %p\n",
1318 __func__, action, event->data);
1321 case FB_EVENT_SUSPEND:
1322 if (board_cfg->display_off && try_module_get(board_cfg->owner)) {
1323 board_cfg->display_off(board_cfg->board_data);
1324 module_put(board_cfg->owner);
1326 sh_mobile_lcdc_stop(ch->lcdc);
1328 case FB_EVENT_RESUME:
1329 mutex_lock(&ch->open_lock);
1330 sh_mobile_fb_reconfig(info);
1331 mutex_unlock(&ch->open_lock);
1333 /* HDMI must be enabled before LCDC configuration */
1334 if (board_cfg->display_on && try_module_get(board_cfg->owner)) {
1335 board_cfg->display_on(board_cfg->board_data, info);
1336 module_put(board_cfg->owner);
1339 sh_mobile_lcdc_start(ch->lcdc);
1345 static int sh_mobile_lcdc_remove(struct platform_device *pdev);
1347 static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
1349 struct fb_info *info;
1350 struct sh_mobile_lcdc_priv *priv;
1351 struct sh_mobile_lcdc_info *pdata = pdev->dev.platform_data;
1352 struct resource *res;
1358 dev_err(&pdev->dev, "no platform data defined\n");
1362 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1363 i = platform_get_irq(pdev, 0);
1364 if (!res || i < 0) {
1365 dev_err(&pdev->dev, "cannot get platform resources\n");
1369 priv = kzalloc(sizeof(*priv), GFP_KERNEL);
1371 dev_err(&pdev->dev, "cannot allocate device data\n");
1375 platform_set_drvdata(pdev, priv);
1377 error = request_irq(i, sh_mobile_lcdc_irq, IRQF_DISABLED,
1378 dev_name(&pdev->dev), priv);
1380 dev_err(&pdev->dev, "unable to request irq\n");
1385 atomic_set(&priv->hw_usecnt, -1);
1388 for (i = 0; i < ARRAY_SIZE(pdata->ch); i++) {
1389 struct sh_mobile_lcdc_chan *ch = priv->ch + j;
1392 memcpy(&ch->cfg, &pdata->ch[i], sizeof(pdata->ch[i]));
1394 error = sh_mobile_lcdc_check_interface(ch);
1396 dev_err(&pdev->dev, "unsupported interface type\n");
1399 init_waitqueue_head(&ch->frame_end_wait);
1400 init_completion(&ch->vsync_completion);
1403 /* probe the backlight is there is one defined */
1404 if (ch->cfg.bl_info.max_brightness)
1405 ch->bl = sh_mobile_lcdc_bl_probe(&pdev->dev, ch);
1407 switch (pdata->ch[i].chan) {
1408 case LCDC_CHAN_MAINLCD:
1409 ch->enabled = LDCNT2R_ME;
1410 ch->reg_offs = lcdc_offs_mainlcd;
1413 case LCDC_CHAN_SUBLCD:
1414 ch->enabled = LDCNT2R_SE;
1415 ch->reg_offs = lcdc_offs_sublcd;
1422 dev_err(&pdev->dev, "no channels defined\n");
1427 /* for dual channel LCDC (MAIN + SUB) force shared bpp setting */
1429 priv->forced_bpp = pdata->ch[0].bpp;
1431 priv->base = ioremap_nocache(res->start, resource_size(res));
1435 error = sh_mobile_lcdc_setup_clocks(pdev, pdata->clock_source, priv);
1437 dev_err(&pdev->dev, "unable to setup clocks\n");
1441 priv->meram_dev = pdata->meram_dev;
1443 for (i = 0; i < j; i++) {
1444 struct fb_var_screeninfo *var;
1445 const struct fb_videomode *lcd_cfg, *max_cfg = NULL;
1446 struct sh_mobile_lcdc_chan *ch = priv->ch + i;
1447 struct sh_mobile_lcdc_chan_cfg *cfg = &ch->cfg;
1448 const struct fb_videomode *mode = cfg->lcd_cfg;
1449 unsigned long max_size = 0;
1453 ch->info = framebuffer_alloc(0, &pdev->dev);
1455 dev_err(&pdev->dev, "unable to allocate fb_info\n");
1462 info->fbops = &sh_mobile_lcdc_ops;
1465 mutex_init(&ch->open_lock);
1467 for (k = 0, lcd_cfg = mode;
1468 k < cfg->num_cfg && lcd_cfg;
1470 unsigned long size = lcd_cfg->yres * lcd_cfg->xres;
1471 /* NV12 buffers must have even number of lines */
1472 if ((cfg->nonstd) && cfg->bpp == 12 &&
1473 (lcd_cfg->yres & 0x1)) {
1474 dev_err(&pdev->dev, "yres must be multiple of 2"
1475 " for YCbCr420 mode.\n");
1480 if (size > max_size) {
1487 max_size = MAX_XRES * MAX_YRES;
1489 dev_dbg(&pdev->dev, "Found largest videomode %ux%u\n",
1490 max_cfg->xres, max_cfg->yres);
1492 info->fix = sh_mobile_lcdc_fix;
1493 info->fix.smem_len = max_size * 2 * cfg->bpp / 8;
1495 /* Only pan in 2 line steps for NV12 */
1496 if (cfg->nonstd && cfg->bpp == 12)
1497 info->fix.ypanstep = 2;
1500 mode = &default_720p;
1503 num_cfg = cfg->num_cfg;
1506 fb_videomode_to_modelist(mode, num_cfg, &info->modelist);
1508 fb_videomode_to_var(var, mode);
1509 var->width = cfg->lcd_size_cfg.width;
1510 var->height = cfg->lcd_size_cfg.height;
1511 /* Default Y virtual resolution is 2x panel size */
1512 var->yres_virtual = var->yres * 2;
1513 var->activate = FB_ACTIVATE_NOW;
1515 error = sh_mobile_lcdc_set_bpp(var, cfg->bpp, cfg->nonstd);
1519 buf = dma_alloc_coherent(&pdev->dev, info->fix.smem_len,
1520 &ch->dma_handle, GFP_KERNEL);
1522 dev_err(&pdev->dev, "unable to allocate buffer\n");
1527 info->pseudo_palette = &ch->pseudo_palette;
1528 info->flags = FBINFO_FLAG_DEFAULT;
1530 error = fb_alloc_cmap(&info->cmap, PALETTE_NR, 0);
1532 dev_err(&pdev->dev, "unable to allocate cmap\n");
1533 dma_free_coherent(&pdev->dev, info->fix.smem_len,
1534 buf, ch->dma_handle);
1538 info->fix.smem_start = ch->dma_handle;
1540 info->fix.line_length = var->xres;
1542 info->fix.line_length = var->xres * (cfg->bpp / 8);
1544 info->screen_base = buf;
1545 info->device = &pdev->dev;
1546 ch->display_var = *var;
1552 error = sh_mobile_lcdc_start(priv);
1554 dev_err(&pdev->dev, "unable to start hardware\n");
1558 for (i = 0; i < j; i++) {
1559 struct sh_mobile_lcdc_chan *ch = priv->ch + i;
1563 if (info->fbdefio) {
1564 ch->sglist = vmalloc(sizeof(struct scatterlist) *
1565 info->fix.smem_len >> PAGE_SHIFT);
1567 dev_err(&pdev->dev, "cannot allocate sglist\n");
1572 info->bl_dev = ch->bl;
1574 error = register_framebuffer(info);
1579 "registered %s/%s as %dx%d %dbpp.\n",
1581 (ch->cfg.chan == LCDC_CHAN_MAINLCD) ?
1582 "mainlcd" : "sublcd",
1583 info->var.xres, info->var.yres,
1586 /* deferred io mode: disable clock to save power */
1587 if (info->fbdefio || info->state == FBINFO_STATE_SUSPENDED)
1588 sh_mobile_lcdc_clk_off(priv);
1591 /* Failure ignored */
1592 priv->notifier.notifier_call = sh_mobile_lcdc_notify;
1593 fb_register_client(&priv->notifier);
1597 sh_mobile_lcdc_remove(pdev);
1602 static int sh_mobile_lcdc_remove(struct platform_device *pdev)
1604 struct sh_mobile_lcdc_priv *priv = platform_get_drvdata(pdev);
1605 struct fb_info *info;
1608 fb_unregister_client(&priv->notifier);
1610 for (i = 0; i < ARRAY_SIZE(priv->ch); i++)
1611 if (priv->ch[i].info && priv->ch[i].info->dev)
1612 unregister_framebuffer(priv->ch[i].info);
1614 sh_mobile_lcdc_stop(priv);
1616 for (i = 0; i < ARRAY_SIZE(priv->ch); i++) {
1617 info = priv->ch[i].info;
1619 if (!info || !info->device)
1622 if (priv->ch[i].sglist)
1623 vfree(priv->ch[i].sglist);
1625 if (info->screen_base)
1626 dma_free_coherent(&pdev->dev, info->fix.smem_len,
1628 priv->ch[i].dma_handle);
1629 fb_dealloc_cmap(&info->cmap);
1630 framebuffer_release(info);
1633 for (i = 0; i < ARRAY_SIZE(priv->ch); i++) {
1635 sh_mobile_lcdc_bl_remove(priv->ch[i].bl);
1639 clk_put(priv->dot_clk);
1642 pm_runtime_disable(priv->dev);
1645 iounmap(priv->base);
1648 free_irq(priv->irq, priv);
1653 static struct platform_driver sh_mobile_lcdc_driver = {
1655 .name = "sh_mobile_lcdc_fb",
1656 .owner = THIS_MODULE,
1657 .pm = &sh_mobile_lcdc_dev_pm_ops,
1659 .probe = sh_mobile_lcdc_probe,
1660 .remove = sh_mobile_lcdc_remove,
1663 static int __init sh_mobile_lcdc_init(void)
1665 return platform_driver_register(&sh_mobile_lcdc_driver);
1668 static void __exit sh_mobile_lcdc_exit(void)
1670 platform_driver_unregister(&sh_mobile_lcdc_driver);
1673 module_init(sh_mobile_lcdc_init);
1674 module_exit(sh_mobile_lcdc_exit);
1676 MODULE_DESCRIPTION("SuperH Mobile LCDC Framebuffer driver");
1677 MODULE_AUTHOR("Magnus Damm <damm@opensource.se>");
1678 MODULE_LICENSE("GPL v2");