Date:2012-03-05 18:36:08 (8 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
9696    struct delayed_work refresh_work;
9797
9898    uint32_t pseudo_palette[16];
99#ifdef CONFIG_JZ_SLCD_ILI9338
100    unsigned int rgb[3];
101#endif
99102};
100103
101104struct jz_slcd_panel {
drivers/video/jz4740_slcd_panels.c
2424#include "jz4740_slcd.h"
2525
2626static char *default_slcd_panel;
27#ifdef CONFIG_JZ_SLCD_ILI9338
28static unsigned int default_slcd_rgb[3] = { 100, 100, 100, };
29#endif
2730
2831/* Send a command without data. */
2932static void send_panel_command(struct jzfb *jzfb, u32 cmd) {
...... 
323326
324327#ifdef CONFIG_JZ_SLCD_ILI9338
325328
329static 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
351module_param_array_named(rgb, default_slcd_rgb, uint, NULL, 0);
352MODULE_PARM_DESC(rgb, "comma-separated list of three values representing the percentage of red, green and blue");
353
326354#define ILI9338_GPIO_CS_N JZ_GPIO_PORTB(17) /* Chip select */
327355#define ILI9338_GPIO_RESET_N JZ_GPIO_PORTB(18) /* LCD reset */
328356
...... 
406434    send_panel_command(jzfb, 0x3A);
407435    send_panel_data(jzfb, 0x05);
408436
437    ili9338_set_color_table(jzfb);
438
409439    send_panel_command(jzfb, 0x29);
410440
411441    send_panel_command(jzfb, 0x2c);
...... 
435465        goto err_reset;
436466    gpio_direction_output(ILI9338_GPIO_RESET_N, 0);
437467
468    memcpy(jzfb->rgb, default_slcd_rgb, sizeof(default_slcd_rgb));
438469    mdelay(100);
439470    return 0;
440471

Archive Download the corresponding diff file



interactive