]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
Merge branch 'lcdc-next' of git://linuxtv.org/pinchartl/fbdev into for-linus
authorTomi Valkeinen <tomi.valkeinen@ti.com>
Tue, 27 Nov 2012 09:45:43 +0000 (11:45 +0200)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Tue, 27 Nov 2012 09:45:43 +0000 (11:45 +0200)
Merge SH Mobile LCDC patches from Laurent.

* 'lcdc-next' of git://linuxtv.org/pinchartl/fbdev:
  fbdev: sh_mobile_lcdc: Make sh_mobile_lcdc_sys_bus_ops static
  sh: kfr2r09: Use the backlight API for brightness control
  ARM: mach-shmobile: ag5evm: Use the backlight API for brightness control
  fbdev: sh_mobile_lcdc: Remove unused get_brightness pdata callback
  sh: ecovec24: Remove unused get_brightness LCDC callback
  sh: ap325rxa: Remove unused get_brightness LCDC callback
  ARM: mach-shmobile: mackerel: Removed unused get_brightness callback
  fbdev: sh_mobile_lcdc: Store the backlight brightness internally
  fbdev: sh_mipi_dsi: Remove the unused sh_mipi_dsi_info lcd_chan field
  ARM: mach-shmobile: Remove the unused sh_mipi_dsi_info lcd_chan field
  fbdev: sh_mipi_dsi: Remove last reference to LCDC platform data
  fbdev: sh_mipi_dsi: Use the LCDC entity default mode
  fbdev: sh_mipi_dsi: Use the sh_mipi_dsi_info channel field
  ARM: mach-shmobile: Initiliaze the new sh_mipi_dsi_info channel field
  fbdev: sh_mipi_dsi: Add channel field to platform data
  ARM: mach-shmobile: ag5evm: Add LCDC tx_dev field to platform data
  fbdev: sh_mobile_lcdc: Remove priv argument from channel and overlay init
  fbdev: sh_mobile_lcdc: Rename mode argument to modes
  fbdev: sh_mobile_lcdc: Get display dimensions from the channel structure
  fbdev: sh_mobile_lcdc: use dma_mmap_coherent

13 files changed:
arch/arm/mach-shmobile/board-ag5evm.c
arch/arm/mach-shmobile/board-ap4evb.c
arch/arm/mach-shmobile/board-mackerel.c
arch/sh/boards/mach-ap325rxa/setup.c
arch/sh/boards/mach-ecovec24/setup.c
arch/sh/boards/mach-kfr2r09/lcd_wqvga.c
arch/sh/boards/mach-kfr2r09/setup.c
arch/sh/include/mach-kfr2r09/mach/kfr2r09.h
drivers/video/sh_mipi_dsi.c
drivers/video/sh_mobile_lcdcfb.c
drivers/video/sh_mobile_lcdcfb.h
include/video/sh_mipi_dsi.h
include/video/sh_mobile_lcdc.h

index 25eb88a923e6097f66af5157d8bd998e9a2e53f1..032d10817e795663c017cc85edf9660f840217e8 100644 (file)
@@ -213,95 +213,6 @@ static struct platform_device irda_device = {
        .num_resources  = ARRAY_SIZE(irda_resources),
 };
 
-static unsigned char lcd_backlight_seq[3][2] = {
-       { 0x04, 0x07 },
-       { 0x23, 0x80 },
-       { 0x03, 0x01 },
-};
-
-static void lcd_backlight_on(void)
-{
-       struct i2c_adapter *a;
-       struct i2c_msg msg;
-       int k;
-
-       a = i2c_get_adapter(1);
-       for (k = 0; a && k < 3; k++) {
-               msg.addr = 0x6d;
-               msg.buf = &lcd_backlight_seq[k][0];
-               msg.len = 2;
-               msg.flags = 0;
-               if (i2c_transfer(a, &msg, 1) != 1)
-                       break;
-       }
-}
-
-static void lcd_backlight_reset(void)
-{
-       gpio_set_value(GPIO_PORT235, 0);
-       mdelay(24);
-       gpio_set_value(GPIO_PORT235, 1);
-}
-
-/* LCDC0 */
-static const struct fb_videomode lcdc0_modes[] = {
-       {
-               .name           = "R63302(QHD)",
-               .xres           = 544,
-               .yres           = 961,
-               .left_margin    = 72,
-               .right_margin   = 600,
-               .hsync_len      = 16,
-               .upper_margin   = 8,
-               .lower_margin   = 8,
-               .vsync_len      = 2,
-               .sync           = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
-       },
-};
-
-static struct sh_mobile_lcdc_info lcdc0_info = {
-       .clock_source = LCDC_CLK_PERIPHERAL,
-       .ch[0] = {
-               .chan = LCDC_CHAN_MAINLCD,
-               .interface_type = RGB24,
-               .clock_divider = 1,
-               .flags = LCDC_FLAGS_DWPOL,
-               .fourcc = V4L2_PIX_FMT_RGB565,
-               .lcd_modes = lcdc0_modes,
-               .num_modes = ARRAY_SIZE(lcdc0_modes),
-               .panel_cfg = {
-                       .width = 44,
-                       .height = 79,
-                       .display_on = lcd_backlight_on,
-                       .display_off = lcd_backlight_reset,
-               },
-       }
-};
-
-static struct resource lcdc0_resources[] = {
-       [0] = {
-               .name   = "LCDC0",
-               .start  = 0xfe940000, /* P4-only space */
-               .end    = 0xfe943fff,
-               .flags  = IORESOURCE_MEM,
-       },
-       [1] = {
-               .start  = intcs_evt2irq(0x580),
-               .flags  = IORESOURCE_IRQ,
-       },
-};
-
-static struct platform_device lcdc0_device = {
-       .name           = "sh_mobile_lcdc_fb",
-       .num_resources  = ARRAY_SIZE(lcdc0_resources),
-       .resource       = lcdc0_resources,
-       .id             = 0,
-       .dev    = {
-               .platform_data  = &lcdc0_info,
-               .coherent_dma_mask = ~0,
-       },
-};
-
 /* MIPI-DSI */
 static struct resource mipidsi0_resources[] = {
        [0] = {
@@ -358,7 +269,7 @@ sh_mipi_set_dot_clock_pck_err:
 
 static struct sh_mipi_dsi_info mipidsi0_info = {
        .data_format    = MIPI_RGB888,
-       .lcd_chan       = &lcdc0_info.ch[0],
+       .channel        = LCDC_CHAN_MAINLCD,
        .lane           = 2,
        .vsynw_offset   = 20,
        .clksrc         = 1,
@@ -378,6 +289,109 @@ static struct platform_device mipidsi0_device = {
        },
 };
 
+static unsigned char lcd_backlight_seq[3][2] = {
+       { 0x04, 0x07 },
+       { 0x23, 0x80 },
+       { 0x03, 0x01 },
+};
+
+static int lcd_backlight_set_brightness(int brightness)
+{
+       struct i2c_adapter *adap;
+       struct i2c_msg msg;
+       unsigned int i;
+       int ret;
+
+       if (brightness == 0) {
+               /* Reset the chip */
+               gpio_set_value(GPIO_PORT235, 0);
+               mdelay(24);
+               gpio_set_value(GPIO_PORT235, 1);
+               return 0;
+       }
+
+       adap = i2c_get_adapter(1);
+       if (adap == NULL)
+               return -ENODEV;
+
+       for (i = 0; i < ARRAY_SIZE(lcd_backlight_seq); i++) {
+               msg.addr = 0x6d;
+               msg.buf = &lcd_backlight_seq[i][0];
+               msg.len = 2;
+               msg.flags = 0;
+
+               ret = i2c_transfer(adap, &msg, 1);
+               if (ret < 0)
+                       break;
+       }
+
+       i2c_put_adapter(adap);
+       return ret < 0 ? ret : 0;
+}
+
+/* LCDC0 */
+static const struct fb_videomode lcdc0_modes[] = {
+       {
+               .name           = "R63302(QHD)",
+               .xres           = 544,
+               .yres           = 961,
+               .left_margin    = 72,
+               .right_margin   = 600,
+               .hsync_len      = 16,
+               .upper_margin   = 8,
+               .lower_margin   = 8,
+               .vsync_len      = 2,
+               .sync           = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
+       },
+};
+
+static struct sh_mobile_lcdc_info lcdc0_info = {
+       .clock_source = LCDC_CLK_PERIPHERAL,
+       .ch[0] = {
+               .chan = LCDC_CHAN_MAINLCD,
+               .interface_type = RGB24,
+               .clock_divider = 1,
+               .flags = LCDC_FLAGS_DWPOL,
+               .fourcc = V4L2_PIX_FMT_RGB565,
+               .lcd_modes = lcdc0_modes,
+               .num_modes = ARRAY_SIZE(lcdc0_modes),
+               .panel_cfg = {
+                       .width = 44,
+                       .height = 79,
+               },
+               .bl_info = {
+                       .name = "sh_mobile_lcdc_bl",
+                       .max_brightness = 1,
+                       .set_brightness = lcd_backlight_set_brightness,
+               },
+               .tx_dev = &mipidsi0_device,
+       }
+};
+
+static struct resource lcdc0_resources[] = {
+       [0] = {
+               .name   = "LCDC0",
+               .start  = 0xfe940000, /* P4-only space */
+               .end    = 0xfe943fff,
+               .flags  = IORESOURCE_MEM,
+       },
+       [1] = {
+               .start  = intcs_evt2irq(0x580),
+               .flags  = IORESOURCE_IRQ,
+       },
+};
+
+static struct platform_device lcdc0_device = {
+       .name           = "sh_mobile_lcdc_fb",
+       .num_resources  = ARRAY_SIZE(lcdc0_resources),
+       .resource       = lcdc0_resources,
+       .id             = 0,
+       .dev    = {
+               .platform_data  = &lcdc0_info,
+               .coherent_dma_mask = ~0,
+       },
+};
+
 /* Fixed 2.8V regulators to be used by SDHI0 */
 static struct regulator_consumer_supply fixed2v8_power_consumers[] =
 {
@@ -531,8 +545,8 @@ static struct platform_device *ag5evm_devices[] __initdata = {
        &fsi_device,
        &mmc_device,
        &irda_device,
-       &lcdc0_device,
        &mipidsi0_device,
+       &lcdc0_device,
        &sdhi0_device,
        &sdhi1_device,
 };
@@ -621,7 +635,7 @@ static void __init ag5evm_init(void)
        /* LCD backlight controller */
        gpio_request(GPIO_PORT235, NULL); /* RESET */
        gpio_direction_output(GPIO_PORT235, 0);
-       lcd_backlight_reset();
+       lcd_backlight_set_brightness(0);
 
        /* enable SDHI0 on CN15 [SD I/F] */
        gpio_request(GPIO_FN_SDHIWP0, NULL);
index 790dc68c431250a8ae7021bf622102826471ba16..728ed4d026c7db74c4e0c4829239b6d3eb5eb327 100644 (file)
@@ -552,11 +552,9 @@ static struct resource mipidsi0_resources[] = {
        },
 };
 
-static struct sh_mobile_lcdc_info lcdc_info;
-
 static struct sh_mipi_dsi_info mipidsi0_info = {
        .data_format    = MIPI_RGB888,
-       .lcd_chan       = &lcdc_info.ch[0],
+       .channel        = LCDC_CHAN_MAINLCD,
        .lane           = 2,
        .vsynw_offset   = 17,
        .phyctrl        = 0x6 << 8,
index 0c27c810cf99d0906b655f298091ffab257644fc..bfd2dc83d99546e168a4ef2978c4b10b1b72144b 100644 (file)
@@ -370,11 +370,6 @@ static int mackerel_set_brightness(int brightness)
        return 0;
 }
 
-static int mackerel_get_brightness(void)
-{
-       return gpio_get_value(GPIO_PORT31);
-}
-
 static const struct sh_mobile_meram_cfg lcd_meram_cfg = {
        .icb[0] = {
                .meram_size     = 0x40,
@@ -403,7 +398,6 @@ static struct sh_mobile_lcdc_info lcdc_info = {
                        .name = "sh_mobile_lcdc_bl",
                        .max_brightness = 1,
                        .set_brightness = mackerel_set_brightness,
-                       .get_brightness = mackerel_get_brightness,
                },
                .meram_cfg = &lcd_meram_cfg,
        }
index 9e963c1d14474c0e819358145b1c0f832315d79a..5620e33c18a0bef4f2874eead2bd4d175e8d4821 100644 (file)
@@ -179,11 +179,6 @@ static int ap320_wvga_set_brightness(int brightness)
        return 0;
 }
 
-static int ap320_wvga_get_brightness(void)
-{
-       return gpio_get_value(GPIO_PTS3);
-}
-
 static void ap320_wvga_power_on(void)
 {
        msleep(100);
@@ -232,7 +227,6 @@ static struct sh_mobile_lcdc_info lcdc_info = {
                        .name = "sh_mobile_lcdc_bl",
                        .max_brightness = 1,
                        .set_brightness = ap320_wvga_set_brightness,
-                       .get_brightness = ap320_wvga_get_brightness,
                },
        }
 };
index 64559e8af14b3e7aa3dad26d0f2dc3e07e1edf2c..3fede4556c91eee6ae7e5aa7a449675710254150 100644 (file)
@@ -329,11 +329,6 @@ static int ecovec24_set_brightness(int brightness)
        return 0;
 }
 
-static int ecovec24_get_brightness(void)
-{
-       return gpio_get_value(GPIO_PTR1);
-}
-
 static struct sh_mobile_lcdc_info lcdc_info = {
        .ch[0] = {
                .interface_type = RGB18,
@@ -347,7 +342,6 @@ static struct sh_mobile_lcdc_info lcdc_info = {
                        .name = "sh_mobile_lcdc_bl",
                        .max_brightness = 1,
                        .set_brightness = ecovec24_set_brightness,
-                       .get_brightness = ecovec24_get_brightness,
                },
        }
 };
index c148b36ecb65c04dbfccdd95685b5dd6cc3bc846..c620503326295f0d7bc30b58b71e58b0c5f5175c 100644 (file)
@@ -283,7 +283,7 @@ void kfr2r09_lcd_start(void *sohandle, struct sh_mobile_lcdc_sys_bus_ops *so)
 #define MAIN_MLED4      0x40
 #define MAIN_MSW        0x80
 
-static int kfr2r09_lcd_backlight(int on)
+int kfr2r09_lcd_set_brightness(int brightness)
 {
        struct i2c_adapter *a;
        struct i2c_msg msg;
@@ -295,7 +295,7 @@ static int kfr2r09_lcd_backlight(int on)
                return -ENODEV;
 
        buf[0] = 0x00;
-       if (on)
+       if (brightness)
                buf[1] = CTRL_CPSW | CTRL_C10 | CTRL_CKSW;
        else
                buf[1] = 0;
@@ -309,7 +309,7 @@ static int kfr2r09_lcd_backlight(int on)
                return -ENODEV;
 
        buf[0] = 0x01;
-       if (on)
+       if (brightness)
                buf[1] = MAIN_MSW | MAIN_MLED4 | 0x0c;
        else
                buf[1] = 0;
@@ -324,13 +324,3 @@ static int kfr2r09_lcd_backlight(int on)
 
        return 0;
 }
-
-void kfr2r09_lcd_on(void)
-{
-       kfr2r09_lcd_backlight(1);
-}
-
-void kfr2r09_lcd_off(void)
-{
-       kfr2r09_lcd_backlight(0);
-}
index f2a4304fbe2321996fb875b75d2bd570feda8ae6..ab502f12ef57ad1025b504645608447a2e115840 100644 (file)
@@ -158,8 +158,11 @@ static struct sh_mobile_lcdc_info kfr2r09_sh_lcdc_info = {
                        .height = 58,
                        .setup_sys = kfr2r09_lcd_setup,
                        .start_transfer = kfr2r09_lcd_start,
-                       .display_on = kfr2r09_lcd_on,
-                       .display_off = kfr2r09_lcd_off,
+               },
+               .bl_info = {
+                       .name = "sh_mobile_lcdc_bl",
+                       .max_brightness = 1,
+                       .set_brightness = kfr2r09_lcd_set_brightness,
                },
                .sys_bus_cfg = {
                        .ldmt2r = 0x07010904,
index ba3d93d333f8e292a20d53246ab4d90b5a96b6f9..c20c9e5f5eabe9279c1738d85354ba1a636a6207 100644 (file)
@@ -4,15 +4,13 @@
 #include <video/sh_mobile_lcdc.h>
 
 #if defined(CONFIG_FB_SH_MOBILE_LCDC) || defined(CONFIG_FB_SH_MOBILE_LCDC_MODULE)
-void kfr2r09_lcd_on(void);
-void kfr2r09_lcd_off(void);
+int kfr2r09_lcd_set_brightness(int brightness);
 int kfr2r09_lcd_setup(void *sys_ops_handle,
                      struct sh_mobile_lcdc_sys_bus_ops *sys_ops);
 void kfr2r09_lcd_start(void *sys_ops_handle,
                       struct sh_mobile_lcdc_sys_bus_ops *sys_ops);
 #else
-static void kfr2r09_lcd_on(void) {}
-static void kfr2r09_lcd_off(void) {}
+static int kfr2r09_lcd_set_brightness(int brightness) {}
 static int kfr2r09_lcd_setup(void *sys_ops_handle,
                                struct sh_mobile_lcdc_sys_bus_ops *sys_ops)
 {
index 3951fdae5f6847694f97627638f6d64857554247..f4962292792c6fd305af02d70709c5b43e203027 100644 (file)
@@ -127,13 +127,12 @@ static void sh_mipi_shutdown(struct platform_device *pdev)
        sh_mipi_dsi_enable(mipi, false);
 }
 
-static int sh_mipi_setup(struct sh_mipi *mipi, struct sh_mipi_dsi_info *pdata)
+static int sh_mipi_setup(struct sh_mipi *mipi, const struct fb_videomode *mode)
 {
        void __iomem *base = mipi->base;
-       struct sh_mobile_lcdc_chan_cfg *ch = pdata->lcd_chan;
+       struct sh_mipi_dsi_info *pdata = mipi->pdev->dev.platform_data;
        u32 pctype, datatype, pixfmt, linelength, vmctr2;
        u32 tmp, top, bottom, delay, div;
-       bool yuv;
        int bpp;
 
        /*
@@ -146,95 +145,79 @@ static int sh_mipi_setup(struct sh_mipi *mipi, struct sh_mipi_dsi_info *pdata)
                pctype = 0;
                datatype = MIPI_DSI_PACKED_PIXEL_STREAM_24;
                pixfmt = MIPI_DCS_PIXEL_FMT_24BIT;
-               linelength = ch->lcd_modes[0].xres * 3;
-               yuv = false;
+               linelength = mode->xres * 3;
                break;
        case MIPI_RGB565:
                pctype = 1;
                datatype = MIPI_DSI_PACKED_PIXEL_STREAM_16;
                pixfmt = MIPI_DCS_PIXEL_FMT_16BIT;
-               linelength = ch->lcd_modes[0].xres * 2;
-               yuv = false;
+               linelength = mode->xres * 2;
                break;
        case MIPI_RGB666_LP:
                pctype = 2;
                datatype = MIPI_DSI_PIXEL_STREAM_3BYTE_18;
                pixfmt = MIPI_DCS_PIXEL_FMT_24BIT;
-               linelength = ch->lcd_modes[0].xres * 3;
-               yuv = false;
+               linelength = mode->xres * 3;
                break;
        case MIPI_RGB666:
                pctype = 3;
                datatype = MIPI_DSI_PACKED_PIXEL_STREAM_18;
                pixfmt = MIPI_DCS_PIXEL_FMT_18BIT;
-               linelength = (ch->lcd_modes[0].xres * 18 + 7) / 8;
-               yuv = false;
+               linelength = (mode->xres * 18 + 7) / 8;
                break;
        case MIPI_BGR888:
                pctype = 8;
                datatype = MIPI_DSI_PACKED_PIXEL_STREAM_24;
                pixfmt = MIPI_DCS_PIXEL_FMT_24BIT;
-               linelength = ch->lcd_modes[0].xres * 3;
-               yuv = false;
+               linelength = mode->xres * 3;
                break;
        case MIPI_BGR565:
                pctype = 9;
                datatype = MIPI_DSI_PACKED_PIXEL_STREAM_16;
                pixfmt = MIPI_DCS_PIXEL_FMT_16BIT;
-               linelength = ch->lcd_modes[0].xres * 2;
-               yuv = false;
+               linelength = mode->xres * 2;
                break;
        case MIPI_BGR666_LP:
                pctype = 0xa;
                datatype = MIPI_DSI_PIXEL_STREAM_3BYTE_18;
                pixfmt = MIPI_DCS_PIXEL_FMT_24BIT;
-               linelength = ch->lcd_modes[0].xres * 3;
-               yuv = false;
+               linelength = mode->xres * 3;
                break;
        case MIPI_BGR666:
                pctype = 0xb;
                datatype = MIPI_DSI_PACKED_PIXEL_STREAM_18;
                pixfmt = MIPI_DCS_PIXEL_FMT_18BIT;
-               linelength = (ch->lcd_modes[0].xres * 18 + 7) / 8;
-               yuv = false;
+               linelength = (mode->xres * 18 + 7) / 8;
                break;
        case MIPI_YUYV:
                pctype = 4;
                datatype = MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR16;
                pixfmt = MIPI_DCS_PIXEL_FMT_16BIT;
-               linelength = ch->lcd_modes[0].xres * 2;
-               yuv = true;
+               linelength = mode->xres * 2;
                break;
        case MIPI_UYVY:
                pctype = 5;
                datatype = MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR16;
                pixfmt = MIPI_DCS_PIXEL_FMT_16BIT;
-               linelength = ch->lcd_modes[0].xres * 2;
-               yuv = true;
+               linelength = mode->xres * 2;
                break;
        case MIPI_YUV420_L:
                pctype = 6;
                datatype = MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR12;
                pixfmt = MIPI_DCS_PIXEL_FMT_12BIT;
-               linelength = (ch->lcd_modes[0].xres * 12 + 7) / 8;
-               yuv = true;
+               linelength = (mode->xres * 12 + 7) / 8;
                break;
        case MIPI_YUV420:
                pctype = 7;
                datatype = MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR12;
                pixfmt = MIPI_DCS_PIXEL_FMT_12BIT;
                /* Length of U/V line */
-               linelength = (ch->lcd_modes[0].xres + 1) / 2;
-               yuv = true;
+               linelength = (mode->xres + 1) / 2;
                break;
        default:
                return -EINVAL;
        }
 
-       if ((yuv && ch->interface_type != YUV422) ||
-           (!yuv && ch->interface_type != RGB24))
-               return -EINVAL;
-
        if (!pdata->lane)
                return -EINVAL;
 
@@ -293,7 +276,7 @@ static int sh_mipi_setup(struct sh_mipi *mipi, struct sh_mipi_dsi_info *pdata)
         */
        iowrite32(0x00000006, mipi->linkbase + DTCTR);
        /* VSYNC width = 2 (<< 17) */
-       iowrite32((ch->lcd_modes[0].vsync_len << pdata->vsynw_offset) |
+       iowrite32((mode->vsync_len << pdata->vsynw_offset) |
                  (pdata->clksrc << 16) | (pctype << 12) | datatype,
                  mipi->linkbase + VMCTR1);
 
@@ -327,7 +310,7 @@ static int sh_mipi_setup(struct sh_mipi *mipi, struct sh_mipi_dsi_info *pdata)
        top = linelength << 16; /* RGBLEN */
        bottom = 0x00000001;
        if (pdata->flags & SH_MIPI_DSI_HSABM) /* HSALEN */
-               bottom = (pdata->lane * ch->lcd_modes[0].hsync_len) - 10;
+               bottom = (pdata->lane * mode->hsync_len) - 10;
        iowrite32(top | bottom , mipi->linkbase + VMLEN1);
 
        /*
@@ -347,18 +330,18 @@ static int sh_mipi_setup(struct sh_mipi *mipi, struct sh_mipi_dsi_info *pdata)
                div = 2;
 
        if (pdata->flags & SH_MIPI_DSI_HFPBM) { /* HBPLEN */
-               top = ch->lcd_modes[0].hsync_len + ch->lcd_modes[0].left_margin;
+               top = mode->hsync_len + mode->left_margin;
                top = ((pdata->lane * top / div) - 10) << 16;
        }
        if (pdata->flags & SH_MIPI_DSI_HBPBM) { /* HFPLEN */
-               bottom = ch->lcd_modes[0].right_margin;
+               bottom = mode->right_margin;
                bottom = (pdata->lane * bottom / div) - 12;
        }
 
-       bpp = linelength / ch->lcd_modes[0].xres; /* byte / pixel */
+       bpp = linelength / mode->xres; /* byte / pixel */
        if ((pdata->lane / div) > bpp) {
-               tmp = ch->lcd_modes[0].xres / bpp; /* output cycle */
-               tmp = ch->lcd_modes[0].xres - tmp; /* (input - output) cycle */
+               tmp = mode->xres / bpp; /* output cycle */
+               tmp = mode->xres - tmp; /* (input - output) cycle */
                delay = (pdata->lane * tmp);
        }
 
@@ -369,7 +352,7 @@ static int sh_mipi_setup(struct sh_mipi *mipi, struct sh_mipi_dsi_info *pdata)
        /* setup LCD panel */
 
        /* cf. drivers/video/omap/lcd_mipid.c */
-       sh_mipi_dcs(ch->chan, MIPI_DCS_EXIT_SLEEP_MODE);
+       sh_mipi_dcs(pdata->channel, MIPI_DCS_EXIT_SLEEP_MODE);
        msleep(120);
        /*
         * [7] - Page Address Mode
@@ -381,11 +364,11 @@ static int sh_mipi_setup(struct sh_mipi *mipi, struct sh_mipi_dsi_info *pdata)
         * [1] - Flip Horizontal
         * [0] - Flip Vertical
         */
-       sh_mipi_dcs_param(ch->chan, MIPI_DCS_SET_ADDRESS_MODE, 0x00);
+       sh_mipi_dcs_param(pdata->channel, MIPI_DCS_SET_ADDRESS_MODE, 0x00);
        /* cf. set_data_lines() */
-       sh_mipi_dcs_param(ch->chan, MIPI_DCS_SET_PIXEL_FORMAT,
+       sh_mipi_dcs_param(pdata->channel, MIPI_DCS_SET_PIXEL_FORMAT,
                          pixfmt << 4);
-       sh_mipi_dcs(ch->chan, MIPI_DCS_SET_DISPLAY_ON);
+       sh_mipi_dcs(pdata->channel, MIPI_DCS_SET_DISPLAY_ON);
 
        /* Enable timeout counters */
        iowrite32(0x00000f00, base + DSICTRL);
@@ -405,7 +388,7 @@ static int mipi_display_on(struct sh_mobile_lcdc_entity *entity)
        if (ret < 0)
                goto mipi_display_on_fail1;
 
-       ret = sh_mipi_setup(mipi, pdata);
+       ret = sh_mipi_setup(mipi, &entity->def_mode);
        if (ret < 0)
                goto mipi_display_on_fail2;
 
index 699487c287b2b201a0d2d263aeadbcfa250a0f92..e78fe4bc15249c21612020b858273b0c8884f3da 100644 (file)
@@ -438,7 +438,7 @@ static unsigned long lcdc_sys_read_data(void *handle)
        return lcdc_read(ch->lcdc, _LDDRDR) & LDDRDR_DRD_MASK;
 }
 
-struct sh_mobile_lcdc_sys_bus_ops sh_mobile_lcdc_sys_bus_ops = {
+static struct sh_mobile_lcdc_sys_bus_ops sh_mobile_lcdc_sys_bus_ops = {
        lcdc_sys_write_index,
        lcdc_sys_write_data,
        lcdc_sys_read_data,
@@ -586,8 +586,8 @@ static int sh_mobile_lcdc_display_notify(struct sh_mobile_lcdc_chan *ch,
                                 * Just turn on, if we run a resume here, the
                                 * logo disappears.
                                 */
-                               info->var.width = monspec->max_x * 10;
-                               info->var.height = monspec->max_y * 10;
+                               info->var.width = ch->display.width;
+                               info->var.height = ch->display.height;
                                sh_mobile_lcdc_display_on(ch);
                        } else {
                                /* New monitor or have to wake up */
@@ -1614,6 +1614,15 @@ static int sh_mobile_lcdc_overlay_blank(int blank, struct fb_info *info)
        return 1;
 }
 
+static int
+sh_mobile_lcdc_overlay_mmap(struct fb_info *info, struct vm_area_struct *vma)
+{
+       struct sh_mobile_lcdc_overlay *ovl = info->par;
+
+       return dma_mmap_coherent(ovl->channel->lcdc->dev, vma, ovl->fb_mem,
+                                ovl->dma_handle, ovl->fb_size);
+}
+
 static struct fb_ops sh_mobile_lcdc_overlay_ops = {
        .owner          = THIS_MODULE,
        .fb_read        = fb_sys_read,
@@ -1626,6 +1635,7 @@ static struct fb_ops sh_mobile_lcdc_overlay_ops = {
        .fb_ioctl       = sh_mobile_lcdc_overlay_ioctl,
        .fb_check_var   = sh_mobile_lcdc_overlay_check_var,
        .fb_set_par     = sh_mobile_lcdc_overlay_set_par,
+       .fb_mmap        = sh_mobile_lcdc_overlay_mmap,
 };
 
 static void
@@ -2093,6 +2103,15 @@ static int sh_mobile_lcdc_blank(int blank, struct fb_info *info)
        return 0;
 }
 
+static int
+sh_mobile_lcdc_mmap(struct fb_info *info, struct vm_area_struct *vma)
+{
+       struct sh_mobile_lcdc_chan *ch = info->par;
+
+       return dma_mmap_coherent(ch->lcdc->dev, vma, ch->fb_mem,
+                                ch->dma_handle, ch->fb_size);
+}
+
 static struct fb_ops sh_mobile_lcdc_ops = {
        .owner          = THIS_MODULE,
        .fb_setcolreg   = sh_mobile_lcdc_setcolreg,
@@ -2108,6 +2127,7 @@ static struct fb_ops sh_mobile_lcdc_ops = {
        .fb_release     = sh_mobile_lcdc_release,
        .fb_check_var   = sh_mobile_lcdc_check_var,
        .fb_set_par     = sh_mobile_lcdc_set_par,
+       .fb_mmap        = sh_mobile_lcdc_mmap,
 };
 
 static void
@@ -2167,7 +2187,7 @@ sh_mobile_lcdc_channel_fb_cleanup(struct sh_mobile_lcdc_chan *ch)
 
 static int __devinit
 sh_mobile_lcdc_channel_fb_init(struct sh_mobile_lcdc_chan *ch,
-                              const struct fb_videomode *mode,
+                              const struct fb_videomode *modes,
                               unsigned int num_modes)
 {
        struct sh_mobile_lcdc_priv *priv = ch->lcdc;
@@ -2193,7 +2213,7 @@ sh_mobile_lcdc_channel_fb_init(struct sh_mobile_lcdc_chan *ch,
        info->pseudo_palette = &ch->pseudo_palette;
        info->par = ch;
 
-       fb_videomode_to_modelist(mode, num_modes, &info->modelist);
+       fb_videomode_to_modelist(modes, num_modes, &info->modelist);
 
        ret = fb_alloc_cmap(&info->cmap, PALETTE_NR, 0);
        if (ret < 0) {
@@ -2227,9 +2247,9 @@ sh_mobile_lcdc_channel_fb_init(struct sh_mobile_lcdc_chan *ch,
         * default.
         */
        var = &info->var;
-       fb_videomode_to_var(var, mode);
-       var->width = ch->cfg->panel_cfg.width;
-       var->height = ch->cfg->panel_cfg.height;
+       fb_videomode_to_var(var, modes);
+       var->width = ch->display.width;
+       var->height = ch->display.height;
        var->xres_virtual = ch->xres_virtual;
        var->yres_virtual = ch->yres_virtual;
        var->activate = FB_ACTIVATE_NOW;
@@ -2262,6 +2282,7 @@ static int sh_mobile_lcdc_update_bl(struct backlight_device *bdev)
            bdev->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK))
                brightness = 0;
 
+       ch->bl_brightness = brightness;
        return ch->cfg->bl_info.set_brightness(brightness);
 }
 
@@ -2269,7 +2290,7 @@ static int sh_mobile_lcdc_get_brightness(struct backlight_device *bdev)
 {
        struct sh_mobile_lcdc_chan *ch = bl_get_data(bdev);
 
-       return ch->cfg->bl_info.get_brightness();
+       return ch->bl_brightness;
 }
 
 static int sh_mobile_lcdc_check_fb(struct backlight_device *bdev,
@@ -2516,10 +2537,10 @@ static int __devinit sh_mobile_lcdc_check_interface(struct sh_mobile_lcdc_chan *
 }
 
 static int __devinit
-sh_mobile_lcdc_overlay_init(struct sh_mobile_lcdc_priv *priv,
-                         struct sh_mobile_lcdc_overlay *ovl)
+sh_mobile_lcdc_overlay_init(struct sh_mobile_lcdc_overlay *ovl)
 {
        const struct sh_mobile_lcdc_format_info *format;
+       struct device *dev = ovl->channel->lcdc->dev;
        int ret;
 
        if (ovl->cfg->fourcc == 0)
@@ -2528,7 +2549,7 @@ sh_mobile_lcdc_overlay_init(struct sh_mobile_lcdc_priv *priv,
        /* Validate the format. */
        format = sh_mobile_format_info(ovl->cfg->fourcc);
        if (format == NULL) {
-               dev_err(priv->dev, "Invalid FOURCC %08x\n", ovl->cfg->fourcc);
+               dev_err(dev, "Invalid FOURCC %08x\n", ovl->cfg->fourcc);
                return -EINVAL;
        }
 
@@ -2556,10 +2577,10 @@ sh_mobile_lcdc_overlay_init(struct sh_mobile_lcdc_priv *priv,
        /* Allocate frame buffer memory. */
        ovl->fb_size = ovl->cfg->max_xres * ovl->cfg->max_yres
                       * format->bpp / 8 * 2;
-       ovl->fb_mem = dma_alloc_coherent(priv->dev, ovl->fb_size,
-                                          &ovl->dma_handle, GFP_KERNEL);
+       ovl->fb_mem = dma_alloc_coherent(dev, ovl->fb_size, &ovl->dma_handle,
+                                        GFP_KERNEL);
        if (!ovl->fb_mem) {
-               dev_err(priv->dev, "unable to allocate buffer\n");
+               dev_err(dev, "unable to allocate buffer\n");
                return -ENOMEM;
        }
 
@@ -2571,11 +2592,11 @@ sh_mobile_lcdc_overlay_init(struct sh_mobile_lcdc_priv *priv,
 }
 
 static int __devinit
-sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_priv *priv,
-                           struct sh_mobile_lcdc_chan *ch)
+sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_chan *ch)
 {
        const struct sh_mobile_lcdc_format_info *format;
        const struct sh_mobile_lcdc_chan_cfg *cfg = ch->cfg;
+       struct device *dev = ch->lcdc->dev;
        const struct fb_videomode *max_mode;
        const struct fb_videomode *mode;
        unsigned int num_modes;
@@ -2588,7 +2609,7 @@ sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_priv *priv,
        /* Validate the format. */
        format = sh_mobile_format_info(cfg->fourcc);
        if (format == NULL) {
-               dev_err(priv->dev, "Invalid FOURCC %08x.\n", cfg->fourcc);
+               dev_err(dev, "Invalid FOURCC %08x.\n", cfg->fourcc);
                return -EINVAL;
        }
 
@@ -2604,7 +2625,7 @@ sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_priv *priv,
                /* NV12/NV21 buffers must have even number of lines */
                if ((cfg->fourcc == V4L2_PIX_FMT_NV12 ||
                     cfg->fourcc == V4L2_PIX_FMT_NV21) && (mode->yres & 0x1)) {
-                       dev_err(priv->dev, "yres must be multiple of 2 for "
+                       dev_err(dev, "yres must be multiple of 2 for "
                                "YCbCr420 mode.\n");
                        return -EINVAL;
                }
@@ -2618,7 +2639,7 @@ sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_priv *priv,
        if (!max_size)
                max_size = MAX_XRES * MAX_YRES;
        else
-               dev_dbg(priv->dev, "Found largest videomode %ux%u\n",
+               dev_dbg(dev, "Found largest videomode %ux%u\n",
                        max_mode->xres, max_mode->yres);
 
        if (cfg->lcd_modes == NULL) {
@@ -2652,10 +2673,10 @@ sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_priv *priv,
 
        /* Allocate frame buffer memory. */
        ch->fb_size = max_size * format->bpp / 8 * 2;
-       ch->fb_mem = dma_alloc_coherent(priv->dev, ch->fb_size, &ch->dma_handle,
+       ch->fb_mem = dma_alloc_coherent(dev, ch->fb_size, &ch->dma_handle,
                                        GFP_KERNEL);
        if (ch->fb_mem == NULL) {
-               dev_err(priv->dev, "unable to allocate buffer\n");
+               dev_err(dev, "unable to allocate buffer\n");
                return -ENOMEM;
        }
 
@@ -2663,8 +2684,7 @@ sh_mobile_lcdc_channel_init(struct sh_mobile_lcdc_priv *priv,
        if (cfg->tx_dev) {
                if (!cfg->tx_dev->dev.driver ||
                    !try_module_get(cfg->tx_dev->dev.driver->owner)) {
-                       dev_warn(priv->dev,
-                                "unable to get transmitter device\n");
+                       dev_warn(dev, "unable to get transmitter device\n");
                        return -EINVAL;
                }
                ch->tx_dev = platform_get_drvdata(cfg->tx_dev);
@@ -2772,9 +2792,9 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
        pm_runtime_enable(&pdev->dev);
 
        for (i = 0; i < num_channels; i++) {
-               struct sh_mobile_lcdc_chan *ch = priv->ch + i;
+               struct sh_mobile_lcdc_chan *ch = &priv->ch[i];
 
-               error = sh_mobile_lcdc_channel_init(priv, ch);
+               error = sh_mobile_lcdc_channel_init(ch);
                if (error)
                        goto err1;
        }
@@ -2785,7 +2805,7 @@ static int __devinit sh_mobile_lcdc_probe(struct platform_device *pdev)
                ovl->cfg = &pdata->overlays[i];
                ovl->channel = &priv->ch[0];
 
-               error = sh_mobile_lcdc_overlay_init(priv, ovl);
+               error = sh_mobile_lcdc_overlay_init(ovl);
                if (error)
                        goto err1;
        }
index 0f92f6544b94907a7a51b503101c07a705421aed..f839adef1d90a58128a922b78bf28a21bd6d047b 100644 (file)
@@ -94,6 +94,7 @@ struct sh_mobile_lcdc_chan {
 
        /* Backlight */
        struct backlight_device *bl;
+       unsigned int bl_brightness;
 
        /* FB */
        struct fb_info *info;
index 06c67fbc4eee471f8871fd3892f87be5712c2e00..a01f197e6ac1560d1200b0f8d4e1b843b1891fd2 100644 (file)
@@ -25,8 +25,6 @@ enum sh_mipi_dsi_data_fmt {
        MIPI_YUV420,
 };
 
-struct sh_mobile_lcdc_chan_cfg;
-
 #define SH_MIPI_DSI_HSABM      (1 << 0)
 #define SH_MIPI_DSI_HBPBM      (1 << 1)
 #define SH_MIPI_DSI_HFPBM      (1 << 2)
@@ -47,7 +45,7 @@ struct sh_mobile_lcdc_chan_cfg;
 
 struct sh_mipi_dsi_info {
        enum sh_mipi_dsi_data_fmt       data_format;
-       struct sh_mobile_lcdc_chan_cfg  *lcd_chan;
+       int                             channel;
        int                             lane;
        unsigned long                   flags;
        u32                             clksrc;
index ff43ffc1aab29a111a9f7893ac08b93864d1be0f..2605fa8adb9c00c74c951ee1e307fd85914dc247 100644 (file)
@@ -163,7 +163,6 @@ struct sh_mobile_lcdc_bl_info {
        const char *name;
        int max_brightness;
        int (*set_brightness)(int brightness);
-       int (*get_brightness)(void);
 };
 
 struct sh_mobile_lcdc_overlay_cfg {