Date: | 2012-03-05 18:36:08 (11 years 6 months ago) |
---|---|
Author: | Paul Cercueil |
Commit: | 1ee6312fc545f0464b7191b674b74c46bab7bcb7 |
Message: | MIPS: JZ4740: add 'rgb' parameter for ILI9338. This parameter can be used to modify the internal color lookup table of the ILI9338, and alter the hue of the screen. |
Files: |
drivers/video/jz4740_slcd.h (1 diff) drivers/video/jz4740_slcd_panels.c (4 diffs) |
Change Details
drivers/video/jz4740_slcd.h | ||
---|---|---|
96 | 96 | struct delayed_work refresh_work; |
97 | 97 | |
98 | 98 | uint32_t pseudo_palette[16]; |
99 | #ifdef CONFIG_JZ_SLCD_ILI9338 | |
100 | unsigned int rgb[3]; | |
101 | #endif | |
99 | 102 | }; |
100 | 103 | |
101 | 104 | struct jz_slcd_panel { |
drivers/video/jz4740_slcd_panels.c | ||
---|---|---|
24 | 24 | #include "jz4740_slcd.h" |
25 | 25 | |
26 | 26 | static char *default_slcd_panel; |
27 | #ifdef CONFIG_JZ_SLCD_ILI9338 | |
28 | static unsigned int default_slcd_rgb[3] = { 100, 100, 100, }; | |
29 | #endif | |
27 | 30 | |
28 | 31 | /* Send a command without data. */ |
29 | 32 | static void send_panel_command(struct jzfb *jzfb, u32 cmd) { |
... | ... | |
323 | 326 | |
324 | 327 | #ifdef CONFIG_JZ_SLCD_ILI9338 |
325 | 328 | |
329 | static void ili9338_set_color_table(struct jzfb *jzfb) | |
330 | { | |
331 | unsigned int c; | |
332 | struct device *dev = &jzfb->pdev->dev; | |
333 | ||
334 | /* Set up a custom color lookup table. | |
335 | * This helps to fix the 'blueish' display on some devices. */ | |
336 | send_panel_command(jzfb, 0x2d); | |
337 | ||
338 | for (c = 0; c < 3; c++) { | |
339 | unsigned int i, n, v, s; | |
340 | n = c == 1 ? 64 /* 6 bits G */ : 32 /* 5 bits R/B */; | |
341 | s = jzfb->rgb[c] * (((63 << 24) - 1) / (100 * (n - 1))); | |
342 | v = 0; | |
343 | for (i = 0; i < n; i++, v += s) | |
344 | send_panel_data(jzfb, (v >> 24) + ((v >> 23) & 1)); | |
345 | } | |
346 | ||
347 | dev_info(dev, "ILI9338 color table initialized with R=%u G=%u B=%u\n", | |
348 | jzfb->rgb[0], jzfb->rgb[1], jzfb->rgb[2]); | |
349 | } | |
350 | ||
351 | module_param_array_named(rgb, default_slcd_rgb, uint, NULL, 0); | |
352 | MODULE_PARM_DESC(rgb, "comma-separated list of three values representing the percentage of red, green and blue"); | |
353 | ||
326 | 354 | #define ILI9338_GPIO_CS_N JZ_GPIO_PORTB(17) /* Chip select */ |
327 | 355 | #define ILI9338_GPIO_RESET_N JZ_GPIO_PORTB(18) /* LCD reset */ |
328 | 356 | |
... | ... | |
406 | 434 | send_panel_command(jzfb, 0x3A); |
407 | 435 | send_panel_data(jzfb, 0x05); |
408 | 436 | |
437 | ili9338_set_color_table(jzfb); | |
438 | ||
409 | 439 | send_panel_command(jzfb, 0x29); |
410 | 440 | |
411 | 441 | send_panel_command(jzfb, 0x2c); |
... | ... | |
435 | 465 | goto err_reset; |
436 | 466 | gpio_direction_output(ILI9338_GPIO_RESET_N, 0); |
437 | 467 | |
468 | memcpy(jzfb->rgb, default_slcd_rgb, sizeof(default_slcd_rgb)); | |
438 | 469 | mdelay(100); |
439 | 470 | return 0; |
440 | 471 |
Branches:
ben-wpan
ben-wpan-stefan
5396a9238205f20f811ea57898980d3ca82df0b6
jz-2.6.34
jz-2.6.34-rc5
jz-2.6.34-rc6
jz-2.6.34-rc7
jz-2.6.35
jz-2.6.36
jz-2.6.37
jz-2.6.38
jz-2.6.39
jz-3.0
jz-3.1
jz-3.11
jz-3.12
jz-3.13
jz-3.15
jz-3.16
jz-3.18-dt
jz-3.2
jz-3.3
jz-3.4
jz-3.5
jz-3.6
jz-3.6-rc2-pwm
jz-3.9
jz-3.9-clk
jz-3.9-rc8
jz47xx
jz47xx-2.6.38
master
Tags:
od-2011-09-04
od-2011-09-18
v2.6.34-rc5
v2.6.34-rc6
v2.6.34-rc7
v3.9