Merge branch 'fbdev-for-linus' into fbdev-next
authorFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>
Tue, 22 Nov 2011 01:00:31 +0000 (01:00 +0000)
committerFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>
Tue, 22 Nov 2011 01:00:31 +0000 (01:00 +0000)
25 files changed:
arch/arm/mach-at91/board-cap9adk.c
arch/arm/mach-at91/board-neocore926.c
arch/arm/mach-at91/board-sam9261ek.c
arch/arm/mach-at91/board-sam9263ek.c
arch/arm/mach-at91/board-sam9m10g45ek.c
arch/arm/mach-at91/board-sam9rlek.c
arch/arm/mach-shmobile/board-ag5evm.c
arch/arm/mach-shmobile/board-ap4evb.c
arch/arm/mach-shmobile/clock-sh7372.c
arch/arm/mach-shmobile/clock-sh73a0.c
drivers/video/Kconfig
drivers/video/Makefile
drivers/video/atmel_lcdfb.c
drivers/video/cirrusfb.c
drivers/video/controlfb.c
drivers/video/display/Kconfig [deleted file]
drivers/video/display/Makefile [deleted file]
drivers/video/display/display-sysfs.c [deleted file]
drivers/video/s3c-fb.c
drivers/video/sbuslib.c
drivers/video/sh_mipi_dsi.c
drivers/video/sh_mobile_lcdcfb.c
include/linux/display.h [deleted file]
include/linux/zorro_ids.h
include/video/sh_mipi_dsi.h

index 5dffd3be62d25878b52cdbb46150a7d71ad965ac..911d9862e6fffe2c116af50c04caaa9dc250f7d6 100644 (file)
@@ -299,7 +299,7 @@ static struct fb_videomode at91_tft_vga_modes[] = {
                .xres           = 240,          .yres           = 320,
                .pixclock       = KHZ2PICOS(4965),
 
-               .left_margin    = 1,            .right_margin   = 33,
+               .left_margin    = 1,            .right_margin   = 34,
                .upper_margin   = 1,            .lower_margin   = 0,
                .hsync_len      = 5,            .vsync_len      = 1,
 
index ef816c17dc61ebd0a0b9fb0c04ab134912f5b4c7..190dc19ce467225d8a6c85b62afcc54b3c43fe0a 100644 (file)
@@ -230,7 +230,7 @@ static struct fb_videomode at91_tft_vga_modes[] = {
                .xres           = 240,          .yres           = 320,
                .pixclock       = KHZ2PICOS(5000),
 
-               .left_margin    = 1,            .right_margin   = 33,
+               .left_margin    = 1,            .right_margin   = 34,
                .upper_margin   = 1,            .lower_margin   = 0,
                .hsync_len      = 5,            .vsync_len      = 1,
 
index b005b738e8ff7bc6dc4af3c8e173421bd9b234c7..4f469ea469690979d4825228a8e606c91cf76947 100644 (file)
@@ -365,7 +365,7 @@ static struct fb_videomode at91_stn_modes[] = {
                .xres           = 320,          .yres           = 240,
                .pixclock       = KHZ2PICOS(1440),
 
-               .left_margin    = 1,            .right_margin   = 1,
+               .left_margin    = 1,            .right_margin   = 2,
                .upper_margin   = 0,            .lower_margin   = 0,
                .hsync_len      = 1,            .vsync_len      = 1,
 
@@ -426,7 +426,7 @@ static struct fb_videomode at91_tft_vga_modes[] = {
                .xres           = 240,          .yres           = 320,
                .pixclock       = KHZ2PICOS(4965),
 
-               .left_margin    = 1,            .right_margin   = 33,
+               .left_margin    = 1,            .right_margin   = 34,
                .upper_margin   = 1,            .lower_margin   = 0,
                .hsync_len      = 5,            .vsync_len      = 1,
 
index bccdcf23caa106e392dba97fa4df69f9775a5337..0e96ee9e4ad313dc8e0fab14a7e10501fd319ec2 100644 (file)
@@ -253,7 +253,7 @@ static struct fb_videomode at91_tft_vga_modes[] = {
                .xres           = 240,          .yres           = 320,
                .pixclock       = KHZ2PICOS(4965),
 
-               .left_margin    = 1,            .right_margin   = 33,
+               .left_margin    = 1,            .right_margin   = 34,
                .upper_margin   = 1,            .lower_margin   = 0,
                .hsync_len      = 5,            .vsync_len      = 1,
 
index 92de9127923a6dd0ecf6b61780129a1e3e9d6cf2..855c68b378d66cf26f32cad71349a6773a543dc9 100644 (file)
@@ -192,7 +192,7 @@ static struct fb_videomode at91_tft_vga_modes[] = {
                .xres           = 480,          .yres           = 272,
                .pixclock       = KHZ2PICOS(9000),
 
-               .left_margin    = 1,            .right_margin   = 1,
+               .left_margin    = 1,            .right_margin   = 2,
                .upper_margin   = 40,           .lower_margin   = 1,
                .hsync_len      = 45,           .vsync_len      = 1,
 
index b2b748239f365ab77627a6d96a7c442be91fd161..0e943a2d95029e2cd44a63e4bad91243a4239e56 100644 (file)
@@ -149,7 +149,7 @@ static struct fb_videomode at91_tft_vga_modes[] = {
                .xres           = 240,          .yres           = 320,
                .pixclock       = KHZ2PICOS(4965),
 
-               .left_margin    = 1,            .right_margin   = 33,
+               .left_margin    = 1,            .right_margin   = 34,
                .upper_margin   = 1,            .lower_margin   = 0,
                .hsync_len      = 5,            .vsync_len      = 1,
 
index b862e9f81e3e557935f13df5ec6fa29128b4d86c..7e3dd7326827541da238568c9f0d7d0c54d08ca9 100644 (file)
@@ -321,12 +321,46 @@ static struct resource mipidsi0_resources[] = {
        },
 };
 
+#define DSI0PHYCR      0xe615006c
+static int sh_mipi_set_dot_clock(struct platform_device *pdev,
+                                void __iomem *base,
+                                int enable)
+{
+       struct clk *pck;
+       int ret;
+
+       pck = clk_get(&pdev->dev, "dsip_clk");
+       if (IS_ERR(pck)) {
+               ret = PTR_ERR(pck);
+               goto sh_mipi_set_dot_clock_pck_err;
+       }
+
+       if (enable) {
+               clk_set_rate(pck, clk_round_rate(pck,  24000000));
+               __raw_writel(0x2a809010, DSI0PHYCR);
+               clk_enable(pck);
+       } else {
+               clk_disable(pck);
+       }
+
+       ret = 0;
+
+       clk_put(pck);
+
+sh_mipi_set_dot_clock_pck_err:
+       return ret;
+}
+
 static struct sh_mipi_dsi_info mipidsi0_info = {
        .data_format    = MIPI_RGB888,
        .lcd_chan       = &lcdc0_info.ch[0],
+       .lane           = 2,
        .vsynw_offset   = 20,
        .clksrc         = 1,
-       .flags          = SH_MIPI_DSI_HSABM,
+       .flags          = SH_MIPI_DSI_HSABM             |
+                         SH_MIPI_DSI_SYNC_PULSES_MODE  |
+                         SH_MIPI_DSI_HSbyteCLK,
+       .set_dot_clock  = sh_mipi_set_dot_clock,
 };
 
 static struct platform_device mipidsi0_device = {
@@ -474,8 +508,6 @@ static void __init ag5evm_map_io(void)
        shmobile_setup_console();
 }
 
-#define DSI0PHYCR      0xe615006c
-
 static void __init ag5evm_init(void)
 {
        sh73a0_pinmux_init();
@@ -556,9 +588,6 @@ static void __init ag5evm_init(void)
        gpio_direction_output(GPIO_PORT235, 0);
        lcd_backlight_reset();
 
-       /* MIPI-DSI clock setup */
-       __raw_writel(0x2a809010, DSI0PHYCR);
-
        /* enable SDHI0 on CN15 [SD I/F] */
        gpio_request(GPIO_FN_SDHICD0, NULL);
        gpio_request(GPIO_FN_SDHIWP0, NULL);
index 4c865ece9ac4e9dc14aa4612ce7a780e59fed690..904b608d1aa39b98c480e5a8f0fe94a253795b6d 100644 (file)
@@ -564,6 +564,30 @@ static struct platform_device keysc_device = {
 };
 
 /* MIPI-DSI */
+#define PHYCTRL                0x0070
+static int sh_mipi_set_dot_clock(struct platform_device *pdev,
+                                void __iomem *base,
+                                int enable)
+{
+       struct clk *pck = clk_get(&pdev->dev, "dsip_clk");
+       void __iomem *phy =  base + PHYCTRL;
+
+       if (IS_ERR(pck))
+               return PTR_ERR(pck);
+
+       if (enable) {
+               clk_set_rate(pck, clk_round_rate(pck, 24000000));
+               iowrite32(ioread32(phy) | (0xb << 8), phy);
+               clk_enable(pck);
+       } else {
+               clk_disable(pck);
+       }
+
+       clk_put(pck);
+
+       return 0;
+}
+
 static struct resource mipidsi0_resources[] = {
        [0] = {
                .start  = 0xffc60000,
@@ -580,7 +604,11 @@ static struct resource mipidsi0_resources[] = {
 static struct sh_mipi_dsi_info mipidsi0_info = {
        .data_format    = MIPI_RGB888,
        .lcd_chan       = &lcdc_info.ch[0],
+       .lane           = 2,
        .vsynw_offset   = 17,
+       .flags          = SH_MIPI_DSI_SYNC_PULSES_MODE |
+                         SH_MIPI_DSI_HSbyteCLK,
+       .set_dot_clock  = sh_mipi_set_dot_clock,
 };
 
 static struct platform_device mipidsi0_device = {
index 995a9c3aec8fbe60da9c78f3dba9835d20db9003..1ebab171e4f7cdf0702993065b9485e0eaef4bcd 100644 (file)
@@ -612,8 +612,8 @@ static struct clk_lookup lookups[] = {
        CLKDEV_CON_ID("hdmi_clk", &div6_reparent_clks[DIV6_HDMI]),
        CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSIT]),
        CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSIT]),
-       CLKDEV_ICK_ID("dsi0p_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSI0P]),
-       CLKDEV_ICK_ID("dsi1p_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSI1P]),
+       CLKDEV_ICK_ID("dsip_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSI0P]),
+       CLKDEV_ICK_ID("dsip_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSI1P]),
 
        /* MSTP32 clocks */
        CLKDEV_DEV_ID("i2c-sh_mobile.2", &mstp_clks[MSTP001]), /* IIC2 */
index 61a846bb30f2034ec3ae69253aea2d2d6d695aa8..3da30bac518eb4ae264517632e7abd2341a5d809 100644 (file)
@@ -319,8 +319,8 @@ static struct clk_lookup lookups[] = {
        CLKDEV_CON_ID("sdhi2_clk", &div6_clks[DIV6_SDHI2]),
        CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSIT]),
        CLKDEV_ICK_ID("dsit_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSIT]),
-       CLKDEV_ICK_ID("dsi0p_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSI0P]),
-       CLKDEV_ICK_ID("dsi1p_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSI1P]),
+       CLKDEV_ICK_ID("dsip_clk", "sh-mipi-dsi.0", &div6_clks[DIV6_DSI0P]),
+       CLKDEV_ICK_ID("dsip_clk", "sh-mipi-dsi.1", &div6_clks[DIV6_DSI1P]),
 
        /* MSTP32 clocks */
        CLKDEV_DEV_ID("i2c-sh_mobile.2", &mstp_clks[MSTP001]), /* I2C2 */
index d83e967e4e15b6380fa1dc94584aac871b6a4b1d..dcf0a828f66ebd684571143457a6bd4f04fe1a5c 100644 (file)
@@ -2413,7 +2413,6 @@ source "drivers/video/omap/Kconfig"
 source "drivers/video/omap2/Kconfig"
 
 source "drivers/video/backlight/Kconfig"
-source "drivers/video/display/Kconfig"
 
 if VT
        source "drivers/video/console/Kconfig"
index 9b9d8fff7732917d0b16e28f705d552850c738b2..142606814d982bf1ed44df0090e4dbc04b8ab021 100644 (file)
@@ -13,7 +13,7 @@ fb-objs                           := $(fb-y)
 
 obj-$(CONFIG_VT)                 += console/
 obj-$(CONFIG_LOGO)               += logo/
-obj-y                            += backlight/ display/
+obj-y                            += backlight/
 
 obj-$(CONFIG_FB_CFB_FILLRECT)  += cfbfillrect.o
 obj-$(CONFIG_FB_CFB_COPYAREA)  += cfbcopyarea.o
index 63409c122ae804ec9fea9dd684cfac1b516a32ef..ced4419e56e2f3ca6c3166e372625408b7ff165d 100644 (file)
@@ -100,8 +100,11 @@ static int atmel_bl_update_status(struct backlight_device *bl)
                brightness = 0;
 
        lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_VAL, brightness);
-       lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR,
+       if (contrast_ctr & ATMEL_LCDC_POL_POSITIVE)
+               lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR,
                        brightness ? contrast_ctr : 0);
+       else
+               lcdc_writel(sinfo, ATMEL_LCDC_CONTRAST_CTR, contrast_ctr);
 
        bl->props.fb_blank = bl->props.power = sinfo->bl_power = power;
 
@@ -397,7 +400,7 @@ static int atmel_lcdfb_check_var(struct fb_var_screeninfo *var,
        var->lower_margin = min_t(u32, var->lower_margin,
                        ATMEL_LCDC_VFP);
        var->right_margin = min_t(u32, var->right_margin,
-                       (ATMEL_LCDC_HFP >> ATMEL_LCDC_HFP_OFFSET) + 1);
+                       (ATMEL_LCDC_HFP >> ATMEL_LCDC_HFP_OFFSET) + 2);
        var->hsync_len = min_t(u32, var->hsync_len,
                        (ATMEL_LCDC_HPW >> ATMEL_LCDC_HPW_OFFSET) + 1);
        var->left_margin = min_t(u32, var->left_margin,
@@ -582,7 +585,7 @@ static int atmel_lcdfb_set_par(struct fb_info *info)
        lcdc_writel(sinfo, ATMEL_LCDC_TIM1, value);
 
        /* Horizontal timing */
-       value = (info->var.right_margin - 1) << ATMEL_LCDC_HFP_OFFSET;
+       value = (info->var.right_margin - 2) << ATMEL_LCDC_HFP_OFFSET;
        value |= (info->var.hsync_len - 1) << ATMEL_LCDC_HPW_OFFSET;
        value |= (info->var.left_margin - 1);
        dev_dbg(info->device, "  * LCDTIM2 = %08lx\n", value);
@@ -682,14 +685,30 @@ static int atmel_lcdfb_setcolreg(unsigned int regno, unsigned int red,
 
        case FB_VISUAL_PSEUDOCOLOR:
                if (regno < 256) {
-                       val  = ((red   >> 11) & 0x001f);
-                       val |= ((green >>  6) & 0x03e0);
-                       val |= ((blue  >>  1) & 0x7c00);
-
-                       /*
-                        * TODO: intensity bit. Maybe something like
-                        *   ~(red[10] ^ green[10] ^ blue[10]) & 1
-                        */
+                       if (cpu_is_at91sam9261() || cpu_is_at91sam9263()
+                           || cpu_is_at91sam9rl()) {
+                               /* old style I+BGR:555 */
+                               val  = ((red   >> 11) & 0x001f);
+                               val |= ((green >>  6) & 0x03e0);
+                               val |= ((blue  >>  1) & 0x7c00);
+
+                               /*
+                                * TODO: intensity bit. Maybe something like
+                                *   ~(red[10] ^ green[10] ^ blue[10]) & 1
+                                */
+                       } else {
+                               /* new style BGR:565 / RGB:565 */
+                               if (sinfo->lcd_wiring_mode ==
+                                   ATMEL_LCDC_WIRING_RGB) {
+                                       val  = ((blue >> 11) & 0x001f);
+                                       val |= ((red  >>  0) & 0xf800);
+                               } else {
+                                       val  = ((red  >> 11) & 0x001f);
+                                       val |= ((blue >>  0) & 0xf800);
+                               }
+
+                               val |= ((green >>  5) & 0x07e0);
+                       }
 
                        lcdc_writel(sinfo, ATMEL_LCDC_LUT(regno), val);
                        ret = 0;
index 6df7c54db0a3470b1150d1eb8f5089967628eb73..6ea505c6f0c89c3986f4184002f91b054c691d20 100644 (file)
@@ -280,52 +280,74 @@ MODULE_DEVICE_TABLE(pci, cirrusfb_pci_table);
 #endif /* CONFIG_PCI */
 
 #ifdef CONFIG_ZORRO
-static const struct zorro_device_id cirrusfb_zorro_table[] = {
+struct zorrocl {
+       enum cirrus_board type; /* Board type */
+       u32 regoffset;          /* Offset of registers in first Zorro device */
+       u32 ramsize;            /* Size of video RAM in first Zorro device */
+                               /* If zero, use autoprobe on RAM device */
+       u32 ramoffset;          /* Offset of video RAM in first Zorro device */
+       zorro_id ramid;         /* Zorro ID of RAM device */
+       zorro_id ramid2;        /* Zorro ID of optional second RAM device */
+};
+
+static const struct zorrocl zcl_sd64 __devinitconst = {
+       .type           = BT_SD64,
+       .ramid          = ZORRO_PROD_HELFRICH_SD64_RAM,
+};
+
+static const struct zorrocl zcl_piccolo __devinitconst = {
+       .type           = BT_PICCOLO,
+       .ramid          = ZORRO_PROD_HELFRICH_PICCOLO_RAM,
+};
+
+static const struct zorrocl zcl_picasso __devinitconst = {
+       .type           = BT_PICASSO,
+       .ramid          = ZORRO_PROD_VILLAGE_TRONIC_PICASSO_II_II_PLUS_RAM,
+};
+
+static const struct zorrocl zcl_spectrum __devinitconst = {
+       .type           = BT_SPECTRUM,
+       .ramid          = ZORRO_PROD_GVP_EGS_28_24_SPECTRUM_RAM,
+};
+
+static const struct zorrocl zcl_picasso4_z3 __devinitconst = {
+       .type           = BT_PICASSO4,
+       .regoffset      = 0x00600000,
+       .ramsize        = 4 * MB_,
+       .ramoffset      = 0x01000000,   /* 0x02000000 for 64 MiB boards */
+};
+
+static const struct zorrocl zcl_picasso4_z2 __devinitconst = {
+       .type           = BT_PICASSO4,
+       .regoffset      = 0x10000,
+       .ramid          = ZORRO_PROD_VILLAGE_TRONIC_PICASSO_IV_Z2_RAM1,
+       .ramid2         = ZORRO_PROD_VILLAGE_TRONIC_PICASSO_IV_Z2_RAM2,
+};
+
+
+static const struct zorro_device_id cirrusfb_zorro_table[] __devinitconst = {
        {
-               .id             = ZORRO_PROD_HELFRICH_SD64_RAM,
-               .driver_data    = BT_SD64,
+               .id             = ZORRO_PROD_HELFRICH_SD64_REG,
+               .driver_data    = (unsigned long)&zcl_sd64,
        }, {
-               .id             = ZORRO_PROD_HELFRICH_PICCOLO_RAM,
-               .driver_data    = BT_PICCOLO,
+               .id             = ZORRO_PROD_HELFRICH_PICCOLO_REG,
+               .driver_data    = (unsigned long)&zcl_piccolo,
        }, {
-               .id     = ZORRO_PROD_VILLAGE_TRONIC_PICASSO_II_II_PLUS_RAM,
-               .driver_data    = BT_PICASSO,
+               .id     = ZORRO_PROD_VILLAGE_TRONIC_PICASSO_II_II_PLUS_REG,
+               .driver_data    = (unsigned long)&zcl_picasso,
        }, {
-               .id             = ZORRO_PROD_GVP_EGS_28_24_SPECTRUM_RAM,
-               .driver_data    = BT_SPECTRUM,
+               .id             = ZORRO_PROD_GVP_EGS_28_24_SPECTRUM_REG,
+               .driver_data    = (unsigned long)&zcl_spectrum,
        }, {
                .id             = ZORRO_PROD_VILLAGE_TRONIC_PICASSO_IV_Z3,
-               .driver_data    = BT_PICASSO4,
+               .driver_data    = (unsigned long)&zcl_picasso4_z3,
+       }, {
+               .id             = ZORRO_PROD_VILLAGE_TRONIC_PICASSO_IV_Z2_REG,
+               .driver_data    = (unsigned long)&zcl_picasso4_z2,
        },
        { 0 }
 };
 MODULE_DEVICE_TABLE(zorro, cirrusfb_zorro_table);
-
-static const struct {
-       zorro_id id2;
-       unsigned long size;
-} cirrusfb_zorro_table2[] = {
-       [BT_SD64] = {
-               .id2    = ZORRO_PROD_HELFRICH_SD64_REG,
-               .size   = 0x400000
-       },
-       [BT_PICCOLO] = {
-               .id2    = ZORRO_PROD_HELFRICH_PICCOLO_REG,
-               .size   = 0x200000
-       },
-       [BT_PICASSO] = {
-               .id2    = ZORRO_PROD_VILLAGE_TRONIC_PICASSO_II_II_PLUS_REG,
-               .size   = 0x200000
-       },
-       [BT_SPECTRUM] = {
-               .id2    = ZORRO_PROD_GVP_EGS_28_24_SPECTRUM_REG,
-               .size   = 0x200000
-       },
-       [BT_PICASSO4] = {
-               .id2    = 0,
-               .size   = 0x400000
-       }
-};
 #endif /* CONFIG_ZORRO */
 
 #ifdef CIRRUSFB_DEBUG
@@ -1956,16 +1978,12 @@ static void cirrusfb_zorro_unmap(struct fb_info *info)
        struct cirrusfb_info *cinfo = info->par;
        struct zorro_dev *zdev = to_zorro_dev(info->device);
 
-       zorro_release_device(zdev);
-
-       if (cinfo->btype == BT_PICASSO4) {
-               cinfo->regbase -= 0x600000;
-               iounmap((void *)cinfo->regbase);
+       if (info->fix.smem_start > 16 * MB_)
                iounmap(info->screen_base);
-       } else {
-               if (zorro_resource_start(zdev) > 0x01000000)
-                       iounmap(info->screen_base);
-       }
+       if (info->fix.mmio_start > 16 * MB_)
+               iounmap(cinfo->regbase);
+
+       zorro_release_device(zdev);
 }
 #endif /* CONFIG_ZORRO */
 
@@ -2222,115 +2240,116 @@ static struct pci_driver cirrusfb_pci_driver = {
 static int __devinit cirrusfb_zorro_register(struct zorro_dev *z,
                                             const struct zorro_device_id *ent)
 {
-       struct cirrusfb_info *cinfo;
        struct fb_info *info;
+       int error;
+       const struct zorrocl *zcl;
        enum cirrus_board btype;
-       struct zorro_dev *z2 = NULL;
-       unsigned long board_addr, board_size, size;
-       int ret;
-
-       btype = ent->driver_data;
-       if (cirrusfb_zorro_table2[btype].id2)
-               z2 = zorro_find_device(cirrusfb_zorro_table2[btype].id2, NULL);
-       size = cirrusfb_zorro_table2[btype].size;
+       unsigned long regbase, ramsize, rambase;
+       struct cirrusfb_info *cinfo;
 
        info = framebuffer_alloc(sizeof(struct cirrusfb_info), &z->dev);
        if (!info) {
                printk(KERN_ERR "cirrusfb: could not allocate memory\n");
-               ret = -ENOMEM;
-               goto err_out;
+               return -ENOMEM;
+       }
+
+       zcl = (const struct zorrocl *)ent->driver_data;
+       btype = zcl->type;
+       regbase = zorro_resource_start(z) + zcl->regoffset;
+       ramsize = zcl->ramsize;
+       if (ramsize) {
+               rambase = zorro_resource_start(z) + zcl->ramoffset;
+               if (zorro_resource_len(z) == 64 * MB_) {
+                       /* Quirk for 64 MiB Picasso IV */
+                       rambase += zcl->ramoffset;
+               }
+       } else {
+               struct zorro_dev *ram = zorro_find_device(zcl->ramid, NULL);
+               if (!ram || !zorro_resource_len(ram)) {
+                       dev_err(info->device, "No video RAM found\n");
+                       error = -ENODEV;
+                       goto err_release_fb;
+               }
+               rambase = zorro_resource_start(ram);
+               ramsize = zorro_resource_len(ram);
+               if (zcl->ramid2 &&
+                   (ram = zorro_find_device(zcl->ramid2, NULL))) {
+                       if (zorro_resource_start(ram) != rambase + ramsize) {
+                               dev_warn(info->device,
+                                        "Skipping non-contiguous RAM at %pR\n",
+                                        &ram->resource);
+                       } else {
+                               ramsize += zorro_resource_len(ram);
+                       }
+               }
        }
 
-       dev_info(info->device, "%s board detected\n",
-                cirrusfb_board_info[btype].name);
-
-       cinfo = info->par;
-       cinfo->btype = btype;
-
-       assert(z);
-       assert(btype != BT_NONE);
-
-       board_addr = zorro_resource_start(z);
-       board_size = zorro_resource_len(z);
-       info->screen_size = size;
+       dev_info(info->device,
+                "%s board detected, REG at 0x%lx, %lu MiB RAM at 0x%lx\n",
+                cirrusfb_board_info[btype].name, regbase, ramsize / MB_,
+                rambase);
 
        if (!zorro_request_device(z, "cirrusfb")) {
-               dev_err(info->device, "cannot reserve region 0x%lx, abort\n",
-                       board_addr);
-               ret = -EBUSY;
+               dev_err(info->device, "Cannot reserve %pR\n", &z->resource);
+               error = -EBUSY;
                goto err_release_fb;
        }
 
-       ret = -EIO;
-
-       if (btype == BT_PICASSO4) {
-               dev_info(info->device, " REG at $%lx\n", board_addr + 0x600000);
-
-               /* To be precise, for the P4 this is not the */
-               /* begin of the board, but the begin of RAM. */
-               /* for P4, map in its address space in 2 chunks (### TEST! ) */
-               /* (note the ugly hardcoded 16M number) */
-               cinfo->regbase = ioremap(board_addr, 16777216);
-               if (!cinfo->regbase)
-                       goto err_release_region;
-
-               dev_dbg(info->device, "Virtual address for board set to: $%p\n",
-                       cinfo->regbase);
-               cinfo->regbase += 0x600000;
-               info->fix.mmio_start = board_addr + 0x600000;
-
-               info->fix.smem_start = board_addr + 16777216;
-               info->screen_base = ioremap(info->fix.smem_start, 16777216);
-               if (!info->screen_base)
-                       goto err_unmap_regbase;
-       } else {
-               dev_info(info->device, " REG at $%lx\n",
-                        (unsigned long) z2->resource.start);
-
-               info->fix.smem_start = board_addr;
-               if (board_addr > 0x01000000)
-                       info->screen_base = ioremap(board_addr, board_size);
-               else
-                       info->screen_base = (caddr_t) ZTWO_VADDR(board_addr);
-               if (!info->screen_base)
-                       goto err_release_region;
+       cinfo = info->par;
+       cinfo->btype = btype;
 
-               /* set address for REG area of board */
-               cinfo->regbase = (caddr_t) ZTWO_VADDR(z2->resource.start);
-               info->fix.mmio_start = z2->resource.start;
+       info->fix.mmio_start = regbase;
+       cinfo->regbase = regbase > 16 * MB_ ? ioremap(regbase, 64 * 1024)
+                                           : (caddr_t)ZTWO_VADDR(regbase);
+       if (!cinfo->regbase) {
+               dev_err(info->device, "Cannot map registers\n");
+               error = -EIO;
+               goto err_release_dev;
+       }
 
-               dev_dbg(info->device, "Virtual address for board set to: $%p\n",
-                       cinfo->regbase);
+       info->fix.smem_start = rambase;
+       info->screen_size = ramsize;
+       info->screen_base = rambase > 16 * MB_ ? ioremap(rambase, ramsize)
+                                              : (caddr_t)ZTWO_VADDR(rambase);
+       if (!info->screen_base) {
+               dev_err(info->device, "Cannot map video RAM\n");
+               error = -EIO;
+               goto err_unmap_reg;
        }
+
        cinfo->unmap = cirrusfb_zorro_unmap;
 
        dev_info(info->device,
-                "Cirrus Logic chipset on Zorro bus, RAM (%lu MB) at $%lx\n",
-                board_size / MB_, board_addr);
-
-       zorro_set_drvdata(z, info);
+                "Cirrus Logic chipset on Zorro bus, RAM (%lu MiB) at 0x%lx\n",
+                ramsize / MB_, rambase);
 
        /* MCLK select etc. */
        if (cirrusfb_board_info[btype].init_sr1f)
                vga_wseq(cinfo->regbase, CL_SEQR1F,
                         cirrusfb_board_info[btype].sr1f);
 
-       ret = cirrusfb_register(info);
-       if (!ret)
-               return 0;
+       error = cirrusfb_register(info);
+       if (error) {
+               dev_err(info->device, "Failed to register device, error %d\n",
+                       error);
+               goto err_unmap_ram;
+       }
 
-       if (btype == BT_PICASSO4 || board_addr > 0x01000000)
+       zorro_set_drvdata(z, info);
+       return 0;
+
+err_unmap_ram:
+       if (rambase > 16 * MB_)
                iounmap(info->screen_base);
 
-err_unmap_regbase:
-       if (btype == BT_PICASSO4)
-               iounmap(cinfo->regbase - 0x600000);
-err_release_region:
-       release_region(board_addr, board_size);
+err_unmap_reg:
+       if (regbase > 16 * MB_)
+               iounmap(cinfo->regbase);
+err_release_dev:
+       zorro_release_device(z);
 err_release_fb:
        framebuffer_release(info);
-err_out:
-       return ret;
+       return error;
 }
 
 void __devexit cirrusfb_zorro_unregister(struct zorro_dev *z)
@@ -2338,6 +2357,7 @@ void __devexit cirrusfb_zorro_unregister(struct zorro_dev *z)
        struct fb_info *info = zorro_get_drvdata(z);
 
        cirrusfb_cleanup(info);
+       zorro_set_drvdata(z, NULL);
 }
 
 static struct zorro_driver cirrusfb_zorro_driver = {
index 7b2c40abae15b21e5ba26f460d809c216fb8e30a..0c189b32a4c5429f632bb812a784b9a4f8868607 100644 (file)
@@ -420,7 +420,7 @@ static int __init init_control(struct fb_info_control *p)
 
        /* Try to pick a video mode out of NVRAM if we have one. */
 #ifdef CONFIG_NVRAM
-       if (default_cmode == CMODE_NVRAM){
+       if (default_cmode == CMODE_NVRAM) {
                cmode = nvram_read_byte(NV_CMODE);
                if(cmode < CMODE_8 || cmode > CMODE_32)
                        cmode = CMODE_8;
diff --git a/drivers/video/display/Kconfig b/drivers/video/display/Kconfig
deleted file mode 100644 (file)
index f99af93..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# Display drivers configuration
-#
-
-menu "Display device support"
-
-config DISPLAY_SUPPORT
-       tristate "Display panel/monitor support"
-       ---help---
-         This framework adds support for low-level control of a display.
-         This includes support for power.
-
-         Enable this to be able to choose the drivers for controlling the
-         physical display panel/monitor on some platforms. This not only
-         covers LCD displays for PDAs but also other types of displays
-         such as CRT, TVout etc.
-
-         To have support for your specific display panel you will have to
-         select the proper drivers which depend on this option.
-
-comment "Display hardware drivers"
-       depends on DISPLAY_SUPPORT
-
-endmenu
diff --git a/drivers/video/display/Makefile b/drivers/video/display/Makefile
deleted file mode 100644 (file)
index c0ea832..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-# Display drivers
-
-display-objs                           := display-sysfs.o
-
-obj-$(CONFIG_DISPLAY_SUPPORT)          += display.o
-
diff --git a/drivers/video/display/display-sysfs.c b/drivers/video/display/display-sysfs.c
deleted file mode 100644 (file)
index 0c647d7..0000000
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- *  display-sysfs.c - Display output driver sysfs interface
- *
- *  Copyright (C) 2007 James Simmons <jsimmons@infradead.org>
- *
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or (at
- *  your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful, but
- *  WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *  General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License along
- *  with this program; if not, write to the Free Software Foundation, Inc.,
- *  59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- *
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- */
-#include <linux/module.h>
-#include <linux/display.h>
-#include <linux/ctype.h>
-#include <linux/idr.h>
-#include <linux/err.h>
-#include <linux/kdev_t.h>
-#include <linux/slab.h>
-
-static ssize_t display_show_name(struct device *dev,
-                               struct device_attribute *attr, char *buf)
-{
-       struct display_device *dsp = dev_get_drvdata(dev);
-       return snprintf(buf, PAGE_SIZE, "%s\n", dsp->name);
-}
-
-static ssize_t display_show_type(struct device *dev,
-                               struct device_attribute *attr, char *buf)
-{
-       struct display_device *dsp = dev_get_drvdata(dev);
-       return snprintf(buf, PAGE_SIZE, "%s\n", dsp->type);
-}
-
-static ssize_t display_show_contrast(struct device *dev,
-                               struct device_attribute *attr, char *buf)
-{
-       struct display_device *dsp = dev_get_drvdata(dev);
-       ssize_t rc = -ENXIO;
-
-       mutex_lock(&dsp->lock);
-       if (likely(dsp->driver) && dsp->driver->get_contrast)
-               rc = sprintf(buf, "%d\n", dsp->driver->get_contrast(dsp));
-       mutex_unlock(&dsp->lock);
-       return rc;
-}
-
-static ssize_t display_store_contrast(struct device *dev,
-                                       struct device_attribute *attr,
-                                       const char *buf, size_t count)
-{
-       struct display_device *dsp = dev_get_drvdata(dev);
-       ssize_t ret = -EINVAL, size;
-       int contrast;
-       char *endp;
-
-       contrast = simple_strtoul(buf, &endp, 0);
-       size = endp - buf;
-
-       if (isspace(*endp))
-               size++;
-
-       if (size != count)
-               return ret;
-
-       mutex_lock(&dsp->lock);
-       if (likely(dsp->driver && dsp->driver->set_contrast)) {
-               pr_debug("display: set contrast to %d\n", contrast);
-               dsp->driver->set_contrast(dsp, contrast);
-               ret = count;
-       }
-       mutex_unlock(&dsp->lock);
-       return ret;
-}
-
-static ssize_t display_show_max_contrast(struct device *dev,
-                                       struct device_attribute *attr,
-                                       char *buf)
-{
-       struct display_device *dsp = dev_get_drvdata(dev);
-       ssize_t rc = -ENXIO;
-
-       mutex_lock(&dsp->lock);
-       if (likely(dsp->driver))
-               rc = sprintf(buf, "%d\n", dsp->driver->max_contrast);
-       mutex_unlock(&dsp->lock);
-       return rc;
-}
-
-static struct device_attribute display_attrs[] = {
-       __ATTR(name, S_IRUGO, display_show_name, NULL),
-       __ATTR(type, S_IRUGO, display_show_type, NULL),
-       __ATTR(contrast, S_IRUGO | S_IWUSR, display_show_contrast, display_store_contrast),
-       __ATTR(max_contrast, S_IRUGO, display_show_max_contrast, NULL),
-};
-
-static int display_suspend(struct device *dev, pm_message_t state)
-{
-       struct display_device *dsp = dev_get_drvdata(dev);
-
-       mutex_lock(&dsp->lock);
-       if (likely(dsp->driver->suspend))
-               dsp->driver->suspend(dsp, state);
-       mutex_unlock(&dsp->lock);
-       return 0;
-};
-
-static int display_resume(struct device *dev)
-{
-       struct display_device *dsp = dev_get_drvdata(dev);
-
-       mutex_lock(&dsp->lock);
-       if (likely(dsp->driver->resume))
-               dsp->driver->resume(dsp);
-       mutex_unlock(&dsp->lock);
-       return 0;
-};
-
-static struct mutex allocated_dsp_lock;
-static DEFINE_IDR(allocated_dsp);
-static struct class *display_class;
-
-struct display_device *display_device_register(struct display_driver *driver,
-                                               struct device *parent, void *devdata)
-{
-       struct display_device *new_dev = NULL;
-       int ret = -EINVAL;
-
-       if (unlikely(!driver))
-               return ERR_PTR(ret);
-
-       mutex_lock(&allocated_dsp_lock);
-       ret = idr_pre_get(&allocated_dsp, GFP_KERNEL);
-       mutex_unlock(&allocated_dsp_lock);
-       if (!ret)
-               return ERR_PTR(ret);
-
-       new_dev = kzalloc(sizeof(struct display_device), GFP_KERNEL);
-       if (likely(new_dev) && unlikely(driver->probe(new_dev, devdata))) {
-               // Reserve the index for this display
-               mutex_lock(&allocated_dsp_lock);
-               ret = idr_get_new(&allocated_dsp, new_dev, &new_dev->idx);
-               mutex_unlock(&allocated_dsp_lock);
-
-               if (!ret) {
-                       new_dev->dev = device_create(display_class, parent,
-                                                    MKDEV(0, 0), new_dev,
-                                                    "display%d", new_dev->idx);
-                       if (!IS_ERR(new_dev->dev)) {
-                               new_dev->parent = parent;
-                               new_dev->driver = driver;
-                               mutex_init(&new_dev->lock);
-                               return new_dev;
-                       }
-                       mutex_lock(&allocated_dsp_lock);
-                       idr_remove(&allocated_dsp, new_dev->idx);
-                       mutex_unlock(&allocated_dsp_lock);
-                       ret = -EINVAL;
-               }
-       }
-       kfree(new_dev);
-       return ERR_PTR(ret);
-}
-EXPORT_SYMBOL(display_device_register);
-
-void display_device_unregister(struct display_device *ddev)
-{
-       if (!ddev)
-               return;
-       // Free device
-       mutex_lock(&ddev->lock);
-       device_unregister(ddev->dev);
-       mutex_unlock(&ddev->lock);
-       // Mark device index as available
-       mutex_lock(&allocated_dsp_lock);
-       idr_remove(&allocated_dsp, ddev->idx);
-       mutex_unlock(&allocated_dsp_lock);
-       kfree(ddev);
-}
-EXPORT_SYMBOL(display_device_unregister);
-
-static int __init display_class_init(void)
-{
-       display_class = class_create(THIS_MODULE, "display");
-       if (IS_ERR(display_class)) {
-               printk(KERN_ERR "Failed to create display class\n");
-               display_class = NULL;
-               return -EINVAL;
-       }
-       display_class->dev_attrs = display_attrs;
-       display_class->suspend = display_suspend;
-       display_class->resume = display_resume;
-       mutex_init(&allocated_dsp_lock);
-       return 0;
-}
-
-static void __exit display_class_exit(void)
-{
-       class_destroy(display_class);
-}
-
-module_init(display_class_init);
-module_exit(display_class_exit);
-
-MODULE_DESCRIPTION("Display Hardware handling");
-MODULE_AUTHOR("James Simmons <jsimmons@infradead.org>");
-MODULE_LICENSE("GPL");
-
index 0753b1cfcb8bc9eb6df5fa234ac2441b9c48470b..12eaee0b29e6b153b0405a49c546c73a3133b80a 100644 (file)
@@ -621,7 +621,8 @@ static int s3c_fb_set_par(struct fb_info *info)
                } else if (var->transp.length == 1)
                        data |= WINCON1_BPPMODE_25BPP_A1888
                                | WINCON1_BLD_PIX;
-               else if (var->transp.length == 4)
+               else if ((var->transp.length == 4) ||
+                       (var->transp.length == 8))
                        data |= WINCON1_BPPMODE_28BPP_A4888
                                | WINCON1_BLD_PIX | WINCON1_ALPHA_SEL;
                else
index 37d764ad56b052a8249dc8d9062c7af07a09d167..3c1de981a18cf77a49fbe2b9239112e29ecfe547 100644 (file)
@@ -76,7 +76,7 @@ int sbusfb_mmap_helper(struct sbus_mmap_map *map,
                                map_offset = (physbase + map[i].poff) & POFF_MASK;
                                break;
                        }
-               if (!map_size){
+               if (!map_size) {
                        page += PAGE_SIZE;
                        continue;
                }
index 72ee96bc6b3e4ca20f68bef852b0c498c2408cc9..05151b82f40f9867bd36ea5579610a5e6ae82af4 100644 (file)
@@ -8,6 +8,7 @@
  * published by the Free Software Foundation.
  */
 
+#include <linux/bitmap.h>
 #include <linux/clk.h>
 #include <linux/delay.h>
 #include <linux/init.h>
@@ -41,6 +42,7 @@
 #define VMCTR1         0x0020
 #define VMCTR2         0x0024
 #define VMLEN1         0x0028
+#define VMLEN2         0x002c
 #define CMTSRTREQ      0x0070
 #define CMTSRTCTR      0x00d0
 
@@ -51,8 +53,7 @@ struct sh_mipi {
        void __iomem    *base;
        void __iomem    *linkbase;
        struct clk      *dsit_clk;
-       struct clk      *dsip_clk;
-       struct device   *dev;
+       struct platform_device *pdev;
 
        void    *next_board_data;
        void    (*next_display_on)(void *board_data, struct fb_info *info);
@@ -124,35 +125,15 @@ static void sh_mipi_shutdown(struct platform_device *pdev)
        sh_mipi_dsi_enable(mipi, false);
 }
 
-static void mipi_display_on(void *arg, struct fb_info *info)
-{
-       struct sh_mipi *mipi = arg;
-
-       pm_runtime_get_sync(mipi->dev);
-       sh_mipi_dsi_enable(mipi, true);
-
-       if (mipi->next_display_on)
-               mipi->next_display_on(mipi->next_board_data, info);
-}
-
-static void mipi_display_off(void *arg)
-{
-       struct sh_mipi *mipi = arg;
-
-       if (mipi->next_display_off)
-               mipi->next_display_off(mipi->next_board_data);
-
-       sh_mipi_dsi_enable(mipi, false);
-       pm_runtime_put(mipi->dev);
-}
-
 static int __init sh_mipi_setup(struct sh_mipi *mipi,
                                struct sh_mipi_dsi_info *pdata)
 {
        void __iomem *base = mipi->base;
        struct sh_mobile_lcdc_chan_cfg *ch = pdata->lcd_chan;
-       u32 pctype, datatype, pixfmt, linelength, vmctr2 = 0x00e00000;
+       u32 pctype, datatype, pixfmt, linelength, vmctr2;
+       u32 tmp, top, bottom, delay, div;
        bool yuv;
+       int bpp;
 
        /*
         * Select data format. MIPI DSI is not hot-pluggable, so, we just use
@@ -253,6 +234,9 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi,
            (!yuv && ch->interface_type != RGB24))
                return -EINVAL;
 
+       if (!pdata->lane)
+               return -EINVAL;
+
        /* reset DSI link */
        iowrite32(0x00000001, base + SYSCTRL);
        /* Hold reset for 100 cycles of the slowest of bus, HS byte and LP clock */
@@ -261,15 +245,6 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi,
 
        /* setup DSI link */
 
-       /*
-        * Default = ULPS enable |
-        *      Contention detection enabled |
-        *      EoT packet transmission enable |
-        *      CRC check enable |
-        *      ECC check enable
-        * additionally enable first two lanes
-        */
-       iowrite32(0x00003703, base + SYSCONF);
        /*
         * T_wakeup = 0x7000
         * T_hs-trail = 3
@@ -290,15 +265,24 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi,
        iowrite32(0x0fffffff, base + TATOVSET);
        /* Peripheral reset timeout, default 0xffffffff */
        iowrite32(0x0fffffff, base + PRTOVSET);
-       /* Enable timeout counters */
-       iowrite32(0x00000f00, base + DSICTRL);
        /* Interrupts not used, disable all */
        iowrite32(0, base + DSIINTE);
        /* DSI-Tx bias on */
        iowrite32(0x00000001, base + PHYCTRL);
        udelay(200);
-       /* Deassert resets, power on, set multiplier */
-       iowrite32(0x03070b01, base + PHYCTRL);
+       /* Deassert resets, power on */
+       iowrite32(0x03070001, base + PHYCTRL);
+
+       /*
+        * Default = ULPS enable |
+        *      Contention detection enabled |
+        *      EoT packet transmission enable |
+        *      CRC check enable |
+        *      ECC check enable
+        */
+       bitmap_fill((unsigned long *)&tmp, pdata->lane);
+       tmp |= 0x00003700;
+       iowrite32(tmp, base + SYSCONF);
 
        /* setup l-bridge */
 
@@ -316,18 +300,68 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi,
         * Non-burst mode with sync pulses: VSE and HSE are output,
         * HSA period allowed, no commands in LP
         */
+       vmctr2 = 0;
+       if (pdata->flags & SH_MIPI_DSI_VSEE)
+               vmctr2 |= 1 << 23;
+       if (pdata->flags & SH_MIPI_DSI_HSEE)
+               vmctr2 |= 1 << 22;
+       if (pdata->flags & SH_MIPI_DSI_HSAE)
+               vmctr2 |= 1 << 21;
+       if (pdata->flags & SH_MIPI_DSI_BL2E)
+               vmctr2 |= 1 << 17;
        if (pdata->flags & SH_MIPI_DSI_HSABM)
-               vmctr2 |= 0x20;
-       if (pdata->flags & SH_MIPI_DSI_HSPBM)
-               vmctr2 |= 0x10;
+               vmctr2 |= 1 << 5;
+       if (pdata->flags & SH_MIPI_DSI_HBPBM)
+               vmctr2 |= 1 << 4;
+       if (pdata->flags & SH_MIPI_DSI_HFPBM)
+               vmctr2 |= 1 << 3;
        iowrite32(vmctr2, mipi->linkbase + VMCTR2);
 
        /*
-        * 0x660 = 1632 bytes per line (RGB24, 544 pixels: see
-        * sh_mobile_lcdc_info.ch[0].lcd_cfg[0].xres), HSALEN = 1 - default
-        * (unused if VMCTR2[HSABM] = 0)
+        * VMLEN1 = RGBLEN | HSALEN
+        *
+        * see
+        *  Video mode - Blanking Packet setting
+        */
+       top = linelength << 16; /* RGBLEN */
+       bottom = 0x00000001;
+       if (pdata->flags & SH_MIPI_DSI_HSABM) /* HSALEN */
+               bottom = (pdata->lane * ch->lcd_cfg[0].hsync_len) - 10;
+       iowrite32(top | bottom , mipi->linkbase + VMLEN1);
+
+       /*
+        * VMLEN2 = HBPLEN | HFPLEN
+        *
+        * see
+        *  Video mode - Blanking Packet setting
         */
-       iowrite32(1 | (linelength << 16), mipi->linkbase + VMLEN1);
+       top     = 0x00010000;
+       bottom  = 0x00000001;
+       delay   = 0;
+
+       div = 1;        /* HSbyteCLK is calculation base
+                        * HS4divCLK = HSbyteCLK/2
+                        * HS6divCLK is not supported for now */
+       if (pdata->flags & SH_MIPI_DSI_HS4divCLK)
+               div = 2;
+
+       if (pdata->flags & SH_MIPI_DSI_HFPBM) { /* HBPLEN */
+               top = ch->lcd_cfg[0].hsync_len + ch->lcd_cfg[0].left_margin;
+               top = ((pdata->lane * top / div) - 10) << 16;
+       }
+       if (pdata->flags & SH_MIPI_DSI_HBPBM) { /* HFPLEN */
+               bottom = ch->lcd_cfg[0].right_margin;
+               bottom = (pdata->lane * bottom / div) - 12;
+       }
+
+       bpp = linelength / ch->lcd_cfg[0].xres; /* byte / pixel */
+       if ((pdata->lane / div) > bpp) {
+               tmp = ch->lcd_cfg[0].xres / bpp; /* output cycle */
+               tmp = ch->lcd_cfg[0].xres - tmp; /* (input - output) cycle */
+               delay = (pdata->lane * tmp);
+       }
+
+       iowrite32(top | (bottom + delay) , mipi->linkbase + VMLEN2);
 
        msleep(5);
 
@@ -352,9 +386,56 @@ static int __init sh_mipi_setup(struct sh_mipi *mipi,
                          pixfmt << 4);
        sh_mipi_dcs(ch->chan, MIPI_DCS_SET_DISPLAY_ON);
 
+       /* Enable timeout counters */
+       iowrite32(0x00000f00, base + DSICTRL);
+
        return 0;
 }
 
+static void mipi_display_on(void *arg, struct fb_info *info)
+{
+       struct sh_mipi *mipi = arg;
+       struct sh_mipi_dsi_info *pdata = mipi->pdev->dev.platform_data;
+       int ret;
+
+       pm_runtime_get_sync(&mipi->pdev->dev);
+
+       ret = pdata->set_dot_clock(mipi->pdev, mipi->base, 1);
+       if (ret < 0)
+               goto mipi_display_on_fail1;
+
+       ret = sh_mipi_setup(mipi, pdata);
+       if (ret < 0)
+               goto mipi_display_on_fail2;
+
+       sh_mipi_dsi_enable(mipi, true);
+
+       if (mipi->next_display_on)
+               mipi->next_display_on(mipi->next_board_data, info);
+
+       return;
+
+mipi_display_on_fail1:
+       pm_runtime_put_sync(&mipi->pdev->dev);
+mipi_display_on_fail2:
+       pdata->set_dot_clock(mipi->pdev, mipi->base, 0);
+}
+
+static void mipi_display_off(void *arg)
+{
+       struct sh_mipi *mipi = arg;
+       struct sh_mipi_dsi_info *pdata = mipi->pdev->dev.platform_data;
+
+       if (mipi->next_display_off)
+               mipi->next_display_off(mipi->next_board_data);
+
+       sh_mipi_dsi_enable(mipi, false);
+
+       pdata->set_dot_clock(mipi->pdev, mipi->base, 0);
+
+       pm_runtime_put_sync(&mipi->pdev->dev);
+}
+
 static int __init sh_mipi_probe(struct platform_device *pdev)
 {
        struct sh_mipi *mipi;
@@ -363,11 +444,13 @@ static int __init sh_mipi_probe(struct platform_device *pdev)
        struct resource *res2 = platform_get_resource(pdev, IORESOURCE_MEM, 1);
        unsigned long rate, f_current;
        int idx = pdev->id, ret;
-       char dsip_clk[] = "dsi.p_clk";
 
        if (!res || !res2 || idx >= ARRAY_SIZE(mipi_dsi) || !pdata)
                return -ENODEV;
 
+       if (!pdata->set_dot_clock)
+               return -EINVAL;
+
        mutex_lock(&array_lock);
        if (idx < 0)
                for (idx = 0; idx < ARRAY_SIZE(mipi_dsi) && mipi_dsi[idx]; idx++)
@@ -408,7 +491,7 @@ static int __init sh_mipi_probe(struct platform_device *pdev)
                goto emap2;
        }
 
-       mipi->dev = &pdev->dev;
+       mipi->pdev = pdev;
 
        mipi->dsit_clk = clk_get(&pdev->dev, "dsit_clk");
        if (IS_ERR(mipi->dsit_clk)) {
@@ -428,44 +511,15 @@ static int __init sh_mipi_probe(struct platform_device *pdev)
 
        dev_dbg(&pdev->dev, "DSI-T clk %lu -> %lu\n", f_current, rate);
 
-       sprintf(dsip_clk, "dsi%1.1dp_clk", idx);
-       mipi->dsip_clk = clk_get(&pdev->dev, dsip_clk);
-       if (IS_ERR(mipi->dsip_clk)) {
-               ret = PTR_ERR(mipi->dsip_clk);
-               goto eclkpget;
-       }
-
-       f_current = clk_get_rate(mipi->dsip_clk);
-       /* Between 10 and 50MHz */
-       rate = clk_round_rate(mipi->dsip_clk, 24000000);
-       if (rate > 0 && rate != f_current)
-               ret = clk_set_rate(mipi->dsip_clk, rate);
-       else
-               ret = rate;
-       if (ret < 0)
-               goto esetprate;
-
-       dev_dbg(&pdev->dev, "DSI-P clk %lu -> %lu\n", f_current, rate);
-
-       msleep(10);
-
        ret = clk_enable(mipi->dsit_clk);
        if (ret < 0)
                goto eclkton;
 
-       ret = clk_enable(mipi->dsip_clk);
-       if (ret < 0)
-               goto eclkpon;
-
        mipi_dsi[idx] = mipi;
 
        pm_runtime_enable(&pdev->dev);
        pm_runtime_resume(&pdev->dev);
 
-       ret = sh_mipi_setup(mipi, pdata);
-       if (ret < 0)
-               goto emipisetup;
-
        mutex_unlock(&array_lock);
        platform_set_drvdata(pdev, mipi);
 
@@ -482,16 +536,7 @@ static int __init sh_mipi_probe(struct platform_device *pdev)
 
        return 0;
 
-emipisetup:
-       mipi_dsi[idx] = NULL;
-       pm_runtime_disable(&pdev->dev);
-       clk_disable(mipi->dsip_clk);
-eclkpon:
-       clk_disable(mipi->dsit_clk);
 eclkton:
-esetprate:
-       clk_put(mipi->dsip_clk);
-eclkpget:
 esettrate:
        clk_put(mipi->dsit_clk);
 eclktget:
@@ -542,10 +587,9 @@ static int __exit sh_mipi_remove(struct platform_device *pdev)
        pdata->lcd_chan->board_cfg.board_data = NULL;
 
        pm_runtime_disable(&pdev->dev);
-       clk_disable(mipi->dsip_clk);
        clk_disable(mipi->dsit_clk);
        clk_put(mipi->dsit_clk);
-       clk_put(mipi->dsip_clk);
+
        iounmap(mipi->linkbase);
        if (res2)
                release_mem_region(res2->start, resource_size(res2));
index facffc2549766e3ebefd5b8a13e78721523946eb..1f49ab48d0b5666b30c6dd8efbfaec73ace0a59d 100644 (file)
@@ -420,7 +420,7 @@ static void sh_mobile_lcdc_geometry(struct sh_mobile_lcdc_chan *ch)
        tmp = ((display_var->xres & 7) << 24) |
                ((display_h_total & 7) << 16) |
                ((display_var->hsync_len & 7) << 8) |
-               hsync_pos;
+               (hsync_pos & 7);
        lcdc_write_chan(ch, LDHAJR, tmp);
 }
 
diff --git a/include/linux/display.h b/include/linux/display.h
deleted file mode 100644 (file)
index 3bf70d6..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- *  Copyright (C) 2006 James Simmons <jsimmons@infradead.org>
- *
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or (at
- *  your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful, but
- *  WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *  General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License along
- *  with this program; if not, write to the Free Software Foundation, Inc.,
- *  59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- *
- * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- */
-
-#ifndef _LINUX_DISPLAY_H
-#define _LINUX_DISPLAY_H
-
-#include <linux/device.h>
-
-struct display_device;
-
-/* This structure defines all the properties of a Display. */
-struct display_driver {
-       int  (*set_contrast)(struct display_device *, unsigned int);
-       int  (*get_contrast)(struct display_device *);
-       void (*suspend)(struct display_device *, pm_message_t state);
-       void (*resume)(struct display_device *);
-       int  (*probe)(struct display_device *, void *);
-       int  (*remove)(struct display_device *);
-       int  max_contrast;
-};
-
-struct display_device {
-       struct module *owner;                   /* Owner module */
-       struct display_driver *driver;
-       struct device *parent;                  /* This is the parent */
-       struct device *dev;                     /* This is this display device */
-       struct mutex lock;
-       void *priv_data;
-       char type[16];
-       char *name;
-       int idx;
-};
-
-extern struct display_device *display_device_register(struct display_driver *driver,
-                                       struct device *dev, void *devdata);
-extern void display_device_unregister(struct display_device *dev);
-
-extern int probe_edid(struct display_device *dev, void *devdata);
-
-#define to_display_device(obj) container_of(obj, struct display_device, class_dev)
-
-#endif
index 7e749088910d3ed2e926070eb9e7326c7753495b..74bc53bcfdcf6bf6d68ed6e799ca267790c9a66a 100644 (file)
 #define  ZORRO_PROD_VILLAGE_TRONIC_PICASSO_II_II_PLUS_RAM      ZORRO_ID(VILLAGE_TRONIC, 0x0B, 0)
 #define  ZORRO_PROD_VILLAGE_TRONIC_PICASSO_II_II_PLUS_REG      ZORRO_ID(VILLAGE_TRONIC, 0x0C, 0)
 #define  ZORRO_PROD_VILLAGE_TRONIC_PICASSO_II_II_PLUS_SEGMENTED_MODE   ZORRO_ID(VILLAGE_TRONIC, 0x0D, 0)
-#define  ZORRO_PROD_VILLAGE_TRONIC_PICASSO_IV_Z2_MEM1          ZORRO_ID(VILLAGE_TRONIC, 0x15, 0)
-#define  ZORRO_PROD_VILLAGE_TRONIC_PICASSO_IV_Z2_MEM2          ZORRO_ID(VILLAGE_TRONIC, 0x16, 0)
+#define  ZORRO_PROD_VILLAGE_TRONIC_PICASSO_IV_Z2_RAM1          ZORRO_ID(VILLAGE_TRONIC, 0x15, 0)
+#define  ZORRO_PROD_VILLAGE_TRONIC_PICASSO_IV_Z2_RAM2          ZORRO_ID(VILLAGE_TRONIC, 0x16, 0)
 #define  ZORRO_PROD_VILLAGE_TRONIC_PICASSO_IV_Z2_REG           ZORRO_ID(VILLAGE_TRONIC, 0x17, 0)
 #define  ZORRO_PROD_VILLAGE_TRONIC_PICASSO_IV_Z3               ZORRO_ID(VILLAGE_TRONIC, 0x18, 0)
 #define  ZORRO_PROD_VILLAGE_TRONIC_ARIADNE                     ZORRO_ID(VILLAGE_TRONIC, 0xC9, 0)
index 6cb95c977de9c2455e7c5007a6cf641d0524f3e2..434d56b4a1a58db0ab4b4c08993b1630e70d235b 100644 (file)
@@ -28,14 +28,33 @@ enum sh_mipi_dsi_data_fmt {
 struct sh_mobile_lcdc_chan_cfg;
 
 #define SH_MIPI_DSI_HSABM      (1 << 0)
-#define SH_MIPI_DSI_HSPBM      (1 << 1)
+#define SH_MIPI_DSI_HBPBM      (1 << 1)
+#define SH_MIPI_DSI_HFPBM      (1 << 2)
+#define SH_MIPI_DSI_BL2E       (1 << 3)
+#define SH_MIPI_DSI_VSEE       (1 << 4)
+#define SH_MIPI_DSI_HSEE       (1 << 5)
+#define SH_MIPI_DSI_HSAE       (1 << 6)
+
+#define SH_MIPI_DSI_HSbyteCLK  (1 << 24)
+#define SH_MIPI_DSI_HS6divCLK  (1 << 25)
+#define SH_MIPI_DSI_HS4divCLK  (1 << 26)
+
+#define SH_MIPI_DSI_SYNC_PULSES_MODE   (SH_MIPI_DSI_VSEE | \
+                                        SH_MIPI_DSI_HSEE | \
+                                        SH_MIPI_DSI_HSAE)
+#define SH_MIPI_DSI_SYNC_EVENTS_MODE   (0)
+#define SH_MIPI_DSI_SYNC_BURST_MODE    (SH_MIPI_DSI_BL2E)
 
 struct sh_mipi_dsi_info {
        enum sh_mipi_dsi_data_fmt       data_format;
        struct sh_mobile_lcdc_chan_cfg  *lcd_chan;
+       int                             lane;
        unsigned long                   flags;
        u32                             clksrc;
        unsigned int                    vsynw_offset;
+       int     (*set_dot_clock)(struct platform_device *pdev,
+                                void __iomem *base,
+                                int enable);
 };
 
 #endif