Skip to content

Commit

Permalink
Merge branch 'lcdc-next' of git://linuxtv.org/pinchartl/fbdev into fo…
Browse files Browse the repository at this point in the history
…r-linus

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
  • Loading branch information
Tomi Valkeinen committed Nov 27, 2012
2 parents 9489e9d + d38d840 commit 38ab331
Show file tree
Hide file tree
Showing 13 changed files with 192 additions and 206 deletions.
198 changes: 106 additions & 92 deletions arch/arm/mach-shmobile/board-ag5evm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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] = {
Expand Down Expand Up @@ -358,7 +269,7 @@ static int sh_mipi_set_dot_clock(struct platform_device *pdev,

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,
Expand All @@ -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[] =
{
Expand Down Expand Up @@ -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,
};
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 1 addition & 3 deletions arch/arm/mach-shmobile/board-ap4evb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 0 additions & 6 deletions arch/arm/mach-shmobile/board-mackerel.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
}
Expand Down
6 changes: 0 additions & 6 deletions arch/sh/boards/mach-ap325rxa/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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,
},
}
};
Expand Down
6 changes: 0 additions & 6 deletions arch/sh/boards/mach-ecovec24/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
},
}
};
Expand Down
16 changes: 3 additions & 13 deletions arch/sh/boards/mach-kfr2r09/lcd_wqvga.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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);
}
7 changes: 5 additions & 2 deletions arch/sh/boards/mach-kfr2r09/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 2 additions & 4 deletions arch/sh/include/mach-kfr2r09/mach/kfr2r09.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
Loading

0 comments on commit 38ab331

Please sign in to comment.