Date:2011-04-29 12:42:43 (11 years 5 months ago)
Author:Maarten ter Huurne
Commit:722b6ea99574216c2ab73de59d0497b6c5073fc9
Message:MIPS: JZ4740: SLCD: panels: Add ILI9338 support.

Thanks to ChinaChip for providing the code and thanks to Ignacio for sending a patch to me.
Files: arch/mips/configs/a320_defconfig (2 diffs)
drivers/video/Kconfig (1 diff)
drivers/video/jz4740_slcd_panels.c (3 diffs)

Change Details

arch/mips/configs/a320_defconfig
11#
22# Automatically generated make config: don't edit
33# Linux/mips 2.6.38 Kernel Configuration
4# Thu Mar 24 11:58:12 2011
4# Fri Apr 29 12:40:10 2011
55#
66CONFIG_MIPS=y
77
...... 
859859CONFIG_FB_JZ4740_SLCD=y
860860# CONFIG_JZ_SLCD_ILI9325 is not set
861861CONFIG_JZ_SLCD_ILI9331=y
862# CONFIG_JZ_SLCD_ILI9338 is not set
862863# CONFIG_JZ_SLCD_LGDP4551 is not set
863864# CONFIG_JZ_SLCD_SPFD5420A is not set
864865CONFIG_BACKLIGHT_LCD_SUPPORT=y
drivers/video/Kconfig
23832383    bool "ILI9331 Smart LCD panel"
23842384    depends on FB_JZ4740_SLCD
23852385
2386config JZ_SLCD_ILI9338
2387    bool "ILI9338 Smart LCD panel"
2388    depends on FB_JZ4740_SLCD
2389
23862390config JZ_SLCD_LGDP4551
23872391    bool "LG LGDP4551 Smart LCD panel"
23882392    depends on FB_JZ4740_SLCD
drivers/video/jz4740_slcd_panels.c
55 * Copyright (C) 2005-2007, Ingenic Semiconductor Inc.
66 * Copyright (C) 2009, Ignacio Garcia Perez <iggarpe@gmail.com>
77 * Copyright (C) 2010, Maarten ter Huurne <maarten@treewalker.org>
8 * Copyright (C) 2011, ChinaChip
89 *
910 * This program is free software; you can redistribute it and/or modify
1011 * it under the terms of the GNU General Public License version 2 as
...... 
318319
319320#endif
320321
322#ifdef CONFIG_JZ_SLCD_ILI9338
323
324#define ILI9338_GPIO_CS_N JZ_GPIO_PORTB(17) /* Chip select */
325#define ILI9338_GPIO_RESET_N JZ_GPIO_PORTB(18) /* LCD reset */
326
327static int ili9338_init(struct jzfb *jzfb)
328{
329    struct device *dev = &jzfb->pdev->dev;
330    int ret;
331
332    ret = gpio_request(ILI9338_GPIO_CS_N, dev_name(dev));
333    if (ret)
334        goto err_cs;
335    gpio_direction_output(ILI9338_GPIO_CS_N, 1);
336
337    ret = gpio_request(ILI9338_GPIO_RESET_N, dev_name(dev));
338    if (ret)
339        goto err_reset;
340    gpio_direction_output(ILI9338_GPIO_RESET_N, 0);
341
342    mdelay(100);
343    return 0;
344
345err_reset:
346    gpio_free(ILI9338_GPIO_CS_N);
347err_cs:
348    dev_err(dev, "Could not reserve GPIO pins for ILI9338 panel driver\n");
349    return ret;
350}
351
352static void ili9338_exit(struct jzfb *jzfb)
353{
354    gpio_free(ILI9338_GPIO_CS_N);
355    gpio_free(ILI9338_GPIO_RESET_N);
356}
357
358static void ili9338_enable(struct jzfb *jzfb)
359{
360    /* RESET pulse */
361    gpio_set_value(ILI9338_GPIO_RESET_N, 0);
362    mdelay(10);
363    gpio_set_value(ILI9338_GPIO_RESET_N, 1);
364    mdelay(50);
365
366    /* Enable chip select */
367    gpio_set_value(ILI9338_GPIO_CS_N, 0);
368
369    /* Black magic */
370    send_panel_command(jzfb, 0x11);
371    mdelay(100);
372
373    send_panel_command(jzfb, 0xCB);
374    send_panel_data(jzfb, 0x01);
375
376    send_panel_command(jzfb, 0xC0);
377    send_panel_data(jzfb, 0x26);
378    send_panel_data(jzfb, 0x01);
379    send_panel_command(jzfb, 0xC1);
380    send_panel_data(jzfb, 0x10);
381    send_panel_command(jzfb, 0xC5);
382    send_panel_data(jzfb, 0x10);
383    send_panel_data(jzfb, 0x52);
384
385    send_panel_command(jzfb, 0x26);
386    send_panel_data(jzfb, 0x01);
387    send_panel_command(jzfb, 0xE0);
388    send_panel_data(jzfb, 0x10);
389    send_panel_data(jzfb, 0x10);
390    send_panel_data(jzfb, 0x10);
391    send_panel_data(jzfb, 0x08);
392    send_panel_data(jzfb, 0x0E);
393    send_panel_data(jzfb, 0x06);
394    send_panel_data(jzfb, 0x42);
395    send_panel_data(jzfb, 0x28);
396    send_panel_data(jzfb, 0x36);
397    send_panel_data(jzfb, 0x03);
398    send_panel_data(jzfb, 0x0E);
399    send_panel_data(jzfb, 0x04);
400    send_panel_data(jzfb, 0x13);
401    send_panel_data(jzfb, 0x0E);
402    send_panel_data(jzfb, 0x0C);
403    send_panel_command(jzfb, 0XE1);
404    send_panel_data(jzfb, 0x0C);
405    send_panel_data(jzfb, 0x23);
406    send_panel_data(jzfb, 0x26);
407    send_panel_data(jzfb, 0x04);
408    send_panel_data(jzfb, 0x0C);
409    send_panel_data(jzfb, 0x04);
410    send_panel_data(jzfb, 0x39);
411    send_panel_data(jzfb, 0x24);
412    send_panel_data(jzfb, 0x4B);
413    send_panel_data(jzfb, 0x03);
414    send_panel_data(jzfb, 0x0B);
415    send_panel_data(jzfb, 0x0B);
416    send_panel_data(jzfb, 0x33);
417    send_panel_data(jzfb, 0x37);
418    send_panel_data(jzfb, 0x0F);
419
420    send_panel_command(jzfb, 0x2a);
421    send_panel_data(jzfb, 0x00);
422    send_panel_data(jzfb, 0x00);
423    send_panel_data(jzfb, 0x01);
424    send_panel_data(jzfb, 0x3f);
425
426    send_panel_command(jzfb, 0x2b);
427    send_panel_data(jzfb, 0x00);
428    send_panel_data(jzfb, 0x00);
429    send_panel_data(jzfb, 0x00);
430    send_panel_data(jzfb, 0xef);
431
432    send_panel_command(jzfb, 0x36);
433    send_panel_data(jzfb, 0xe8);
434
435    send_panel_command(jzfb, 0x3A);
436    send_panel_data(jzfb, 0x05);
437
438    send_panel_command(jzfb, 0x29);
439
440    send_panel_command(jzfb, 0x2c);
441}
442
443/* TODO(IGP): make sure LCD power consumption is low in these conditions */
444static void ili9338_disable(struct jzfb *jzfb)
445{
446    /* Keep chip select disabled */
447    gpio_set_value(ILI9338_GPIO_CS_N, 1);
448    /* Keep RESET active */
449    gpio_set_value(ILI9338_GPIO_RESET_N, 0);
450}
451
452#endif
453
321454#ifdef CONFIG_JZ_SLCD_LGDP4551
322455
323456#define LGDP4551_GPIO_CS_N JZ_GPIO_PORTC(18) /* Chip select */
...... 
695828        ili9331_enable, ili9331_disable,
696829    },
697830#endif
831#ifdef CONFIG_JZ_SLCD_ILI9338
832    {
833        ili9338_init, ili9338_exit,
834        ili9338_enable, ili9338_disable,
835    },
836#endif
698837#ifdef CONFIG_JZ_SLCD_LGDP4551
699838    {
700839        lgdp4551_init, lgdp4551_exit,

Archive Download the corresponding diff file



interactive