Skip to content

Commit 38ab331

Browse files
committed
Merge branch 'lcdc-next' of git://linuxtv.org/pinchartl/fbdev into for-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
2 parents 9489e9d + d38d840 commit 38ab331

13 files changed

Lines changed: 192 additions & 206 deletions

File tree

‎arch/arm/mach-shmobile/board-ag5evm.c‎

Lines changed: 106 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -213,95 +213,6 @@ static struct platform_device irda_device = {
213213
.num_resources = ARRAY_SIZE(irda_resources),
214214
};
215215

216-
static unsigned char lcd_backlight_seq[3][2] = {
217-
{ 0x04, 0x07 },
218-
{ 0x23, 0x80 },
219-
{ 0x03, 0x01 },
220-
};
221-
222-
static void lcd_backlight_on(void)
223-
{
224-
struct i2c_adapter *a;
225-
struct i2c_msg msg;
226-
int k;
227-
228-
a = i2c_get_adapter(1);
229-
for (k = 0; a && k < 3; k++) {
230-
msg.addr = 0x6d;
231-
msg.buf = &lcd_backlight_seq[k][0];
232-
msg.len = 2;
233-
msg.flags = 0;
234-
if (i2c_transfer(a, &msg, 1) != 1)
235-
break;
236-
}
237-
}
238-
239-
static void lcd_backlight_reset(void)
240-
{
241-
gpio_set_value(GPIO_PORT235, 0);
242-
mdelay(24);
243-
gpio_set_value(GPIO_PORT235, 1);
244-
}
245-
246-
/* LCDC0 */
247-
static const struct fb_videomode lcdc0_modes[] = {
248-
{
249-
.name = "R63302(QHD)",
250-
.xres = 544,
251-
.yres = 961,
252-
.left_margin = 72,
253-
.right_margin = 600,
254-
.hsync_len = 16,
255-
.upper_margin = 8,
256-
.lower_margin = 8,
257-
.vsync_len = 2,
258-
.sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
259-
},
260-
};
261-
262-
static struct sh_mobile_lcdc_info lcdc0_info = {
263-
.clock_source = LCDC_CLK_PERIPHERAL,
264-
.ch[0] = {
265-
.chan = LCDC_CHAN_MAINLCD,
266-
.interface_type = RGB24,
267-
.clock_divider = 1,
268-
.flags = LCDC_FLAGS_DWPOL,
269-
.fourcc = V4L2_PIX_FMT_RGB565,
270-
.lcd_modes = lcdc0_modes,
271-
.num_modes = ARRAY_SIZE(lcdc0_modes),
272-
.panel_cfg = {
273-
.width = 44,
274-
.height = 79,
275-
.display_on = lcd_backlight_on,
276-
.display_off = lcd_backlight_reset,
277-
},
278-
}
279-
};
280-
281-
static struct resource lcdc0_resources[] = {
282-
[0] = {
283-
.name = "LCDC0",
284-
.start = 0xfe940000, /* P4-only space */
285-
.end = 0xfe943fff,
286-
.flags = IORESOURCE_MEM,
287-
},
288-
[1] = {
289-
.start = intcs_evt2irq(0x580),
290-
.flags = IORESOURCE_IRQ,
291-
},
292-
};
293-
294-
static struct platform_device lcdc0_device = {
295-
.name = "sh_mobile_lcdc_fb",
296-
.num_resources = ARRAY_SIZE(lcdc0_resources),
297-
.resource = lcdc0_resources,
298-
.id = 0,
299-
.dev = {
300-
.platform_data = &lcdc0_info,
301-
.coherent_dma_mask = ~0,
302-
},
303-
};
304-
305216
/* MIPI-DSI */
306217
static struct resource mipidsi0_resources[] = {
307218
[0] = {
@@ -358,7 +269,7 @@ static int sh_mipi_set_dot_clock(struct platform_device *pdev,
358269

359270
static struct sh_mipi_dsi_info mipidsi0_info = {
360271
.data_format = MIPI_RGB888,
361-
.lcd_chan = &lcdc0_info.ch[0],
272+
.channel = LCDC_CHAN_MAINLCD,
362273
.lane = 2,
363274
.vsynw_offset = 20,
364275
.clksrc = 1,
@@ -378,6 +289,109 @@ static struct platform_device mipidsi0_device = {
378289
},
379290
};
380291

292+
static unsigned char lcd_backlight_seq[3][2] = {
293+
{ 0x04, 0x07 },
294+
{ 0x23, 0x80 },
295+
{ 0x03, 0x01 },
296+
};
297+
298+
static int lcd_backlight_set_brightness(int brightness)
299+
{
300+
struct i2c_adapter *adap;
301+
struct i2c_msg msg;
302+
unsigned int i;
303+
int ret;
304+
305+
if (brightness == 0) {
306+
/* Reset the chip */
307+
gpio_set_value(GPIO_PORT235, 0);
308+
mdelay(24);
309+
gpio_set_value(GPIO_PORT235, 1);
310+
return 0;
311+
}
312+
313+
adap = i2c_get_adapter(1);
314+
if (adap == NULL)
315+
return -ENODEV;
316+
317+
for (i = 0; i < ARRAY_SIZE(lcd_backlight_seq); i++) {
318+
msg.addr = 0x6d;
319+
msg.buf = &lcd_backlight_seq[i][0];
320+
msg.len = 2;
321+
msg.flags = 0;
322+
323+
ret = i2c_transfer(adap, &msg, 1);
324+
if (ret < 0)
325+
break;
326+
}
327+
328+
i2c_put_adapter(adap);
329+
return ret < 0 ? ret : 0;
330+
}
331+
332+
/* LCDC0 */
333+
static const struct fb_videomode lcdc0_modes[] = {
334+
{
335+
.name = "R63302(QHD)",
336+
.xres = 544,
337+
.yres = 961,
338+
.left_margin = 72,
339+
.right_margin = 600,
340+
.hsync_len = 16,
341+
.upper_margin = 8,
342+
.lower_margin = 8,
343+
.vsync_len = 2,
344+
.sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
345+
},
346+
};
347+
348+
static struct sh_mobile_lcdc_info lcdc0_info = {
349+
.clock_source = LCDC_CLK_PERIPHERAL,
350+
.ch[0] = {
351+
.chan = LCDC_CHAN_MAINLCD,
352+
.interface_type = RGB24,
353+
.clock_divider = 1,
354+
.flags = LCDC_FLAGS_DWPOL,
355+
.fourcc = V4L2_PIX_FMT_RGB565,
356+
.lcd_modes = lcdc0_modes,
357+
.num_modes = ARRAY_SIZE(lcdc0_modes),
358+
.panel_cfg = {
359+
.width = 44,
360+
.height = 79,
361+
},
362+
.bl_info = {
363+
.name = "sh_mobile_lcdc_bl",
364+
.max_brightness = 1,
365+
.set_brightness = lcd_backlight_set_brightness,
366+
},
367+
.tx_dev = &mipidsi0_device,
368+
}
369+
};
370+
371+
static struct resource lcdc0_resources[] = {
372+
[0] = {
373+
.name = "LCDC0",
374+
.start = 0xfe940000, /* P4-only space */
375+
.end = 0xfe943fff,
376+
.flags = IORESOURCE_MEM,
377+
},
378+
[1] = {
379+
.start = intcs_evt2irq(0x580),
380+
.flags = IORESOURCE_IRQ,
381+
},
382+
};
383+
384+
static struct platform_device lcdc0_device = {
385+
.name = "sh_mobile_lcdc_fb",
386+
.num_resources = ARRAY_SIZE(lcdc0_resources),
387+
.resource = lcdc0_resources,
388+
.id = 0,
389+
.dev = {
390+
.platform_data = &lcdc0_info,
391+
.coherent_dma_mask = ~0,
392+
},
393+
};
394+
381395
/* Fixed 2.8V regulators to be used by SDHI0 */
382396
static struct regulator_consumer_supply fixed2v8_power_consumers[] =
383397
{
@@ -531,8 +545,8 @@ static struct platform_device *ag5evm_devices[] __initdata = {
531545
&fsi_device,
532546
&mmc_device,
533547
&irda_device,
534-
&lcdc0_device,
535548
&mipidsi0_device,
549+
&lcdc0_device,
536550
&sdhi0_device,
537551
&sdhi1_device,
538552
};
@@ -621,7 +635,7 @@ static void __init ag5evm_init(void)
621635
/* LCD backlight controller */
622636
gpio_request(GPIO_PORT235, NULL); /* RESET */
623637
gpio_direction_output(GPIO_PORT235, 0);
624-
lcd_backlight_reset();
638+
lcd_backlight_set_brightness(0);
625639

626640
/* enable SDHI0 on CN15 [SD I/F] */
627641
gpio_request(GPIO_FN_SDHIWP0, NULL);

‎arch/arm/mach-shmobile/board-ap4evb.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -552,11 +552,9 @@ static struct resource mipidsi0_resources[] = {
552552
},
553553
};
554554

555-
static struct sh_mobile_lcdc_info lcdc_info;
556-
557555
static struct sh_mipi_dsi_info mipidsi0_info = {
558556
.data_format = MIPI_RGB888,
559-
.lcd_chan = &lcdc_info.ch[0],
557+
.channel = LCDC_CHAN_MAINLCD,
560558
.lane = 2,
561559
.vsynw_offset = 17,
562560
.phyctrl = 0x6 << 8,

‎arch/arm/mach-shmobile/board-mackerel.c‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -370,11 +370,6 @@ static int mackerel_set_brightness(int brightness)
370370
return 0;
371371
}
372372

373-
static int mackerel_get_brightness(void)
374-
{
375-
return gpio_get_value(GPIO_PORT31);
376-
}
377-
378373
static const struct sh_mobile_meram_cfg lcd_meram_cfg = {
379374
.icb[0] = {
380375
.meram_size = 0x40,
@@ -403,7 +398,6 @@ static struct sh_mobile_lcdc_info lcdc_info = {
403398
.name = "sh_mobile_lcdc_bl",
404399
.max_brightness = 1,
405400
.set_brightness = mackerel_set_brightness,
406-
.get_brightness = mackerel_get_brightness,
407401
},
408402
.meram_cfg = &lcd_meram_cfg,
409403
}

‎arch/sh/boards/mach-ap325rxa/setup.c‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,6 @@ static int ap320_wvga_set_brightness(int brightness)
179179
return 0;
180180
}
181181

182-
static int ap320_wvga_get_brightness(void)
183-
{
184-
return gpio_get_value(GPIO_PTS3);
185-
}
186-
187182
static void ap320_wvga_power_on(void)
188183
{
189184
msleep(100);
@@ -232,7 +227,6 @@ static struct sh_mobile_lcdc_info lcdc_info = {
232227
.name = "sh_mobile_lcdc_bl",
233228
.max_brightness = 1,
234229
.set_brightness = ap320_wvga_set_brightness,
235-
.get_brightness = ap320_wvga_get_brightness,
236230
},
237231
}
238232
};

‎arch/sh/boards/mach-ecovec24/setup.c‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -329,11 +329,6 @@ static int ecovec24_set_brightness(int brightness)
329329
return 0;
330330
}
331331

332-
static int ecovec24_get_brightness(void)
333-
{
334-
return gpio_get_value(GPIO_PTR1);
335-
}
336-
337332
static struct sh_mobile_lcdc_info lcdc_info = {
338333
.ch[0] = {
339334
.interface_type = RGB18,
@@ -347,7 +342,6 @@ static struct sh_mobile_lcdc_info lcdc_info = {
347342
.name = "sh_mobile_lcdc_bl",
348343
.max_brightness = 1,
349344
.set_brightness = ecovec24_set_brightness,
350-
.get_brightness = ecovec24_get_brightness,
351345
},
352346
}
353347
};

‎arch/sh/boards/mach-kfr2r09/lcd_wqvga.c‎

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ void kfr2r09_lcd_start(void *sohandle, struct sh_mobile_lcdc_sys_bus_ops *so)
283283
#define MAIN_MLED4 0x40
284284
#define MAIN_MSW 0x80
285285

286-
static int kfr2r09_lcd_backlight(int on)
286+
int kfr2r09_lcd_set_brightness(int brightness)
287287
{
288288
struct i2c_adapter *a;
289289
struct i2c_msg msg;
@@ -295,7 +295,7 @@ static int kfr2r09_lcd_backlight(int on)
295295
return -ENODEV;
296296

297297
buf[0] = 0x00;
298-
if (on)
298+
if (brightness)
299299
buf[1] = CTRL_CPSW | CTRL_C10 | CTRL_CKSW;
300300
else
301301
buf[1] = 0;
@@ -309,7 +309,7 @@ static int kfr2r09_lcd_backlight(int on)
309309
return -ENODEV;
310310

311311
buf[0] = 0x01;
312-
if (on)
312+
if (brightness)
313313
buf[1] = MAIN_MSW | MAIN_MLED4 | 0x0c;
314314
else
315315
buf[1] = 0;
@@ -324,13 +324,3 @@ static int kfr2r09_lcd_backlight(int on)
324324

325325
return 0;
326326
}
327-
328-
void kfr2r09_lcd_on(void)
329-
{
330-
kfr2r09_lcd_backlight(1);
331-
}
332-
333-
void kfr2r09_lcd_off(void)
334-
{
335-
kfr2r09_lcd_backlight(0);
336-
}

‎arch/sh/boards/mach-kfr2r09/setup.c‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,11 @@ static struct sh_mobile_lcdc_info kfr2r09_sh_lcdc_info = {
158158
.height = 58,
159159
.setup_sys = kfr2r09_lcd_setup,
160160
.start_transfer = kfr2r09_lcd_start,
161-
.display_on = kfr2r09_lcd_on,
162-
.display_off = kfr2r09_lcd_off,
161+
},
162+
.bl_info = {
163+
.name = "sh_mobile_lcdc_bl",
164+
.max_brightness = 1,
165+
.set_brightness = kfr2r09_lcd_set_brightness,
163166
},
164167
.sys_bus_cfg = {
165168
.ldmt2r = 0x07010904,

‎arch/sh/include/mach-kfr2r09/mach/kfr2r09.h‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,13 @@
44
#include <video/sh_mobile_lcdc.h>
55

66
#if defined(CONFIG_FB_SH_MOBILE_LCDC) || defined(CONFIG_FB_SH_MOBILE_LCDC_MODULE)
7-
void kfr2r09_lcd_on(void);
8-
void kfr2r09_lcd_off(void);
7+
int kfr2r09_lcd_set_brightness(int brightness);
98
int kfr2r09_lcd_setup(void *sys_ops_handle,
109
struct sh_mobile_lcdc_sys_bus_ops *sys_ops);
1110
void kfr2r09_lcd_start(void *sys_ops_handle,
1211
struct sh_mobile_lcdc_sys_bus_ops *sys_ops);
1312
#else
14-
static void kfr2r09_lcd_on(void) {}
15-
static void kfr2r09_lcd_off(void) {}
13+
static int kfr2r09_lcd_set_brightness(int brightness) {}
1614
static int kfr2r09_lcd_setup(void *sys_ops_handle,
1715
struct sh_mobile_lcdc_sys_bus_ops *sys_ops)
1816
{

0 commit comments

Comments
 (0)