This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Backlight Support for OMAP3 using DSS

Other Parts Discussed in Thread: TPS65930

Hi,


I have written a backlight driver for omap3 processor which uses DSS. The backlight driver is using TPS65930's PWM to control the back light. I am not sure how to add this in my board specific file which will control the back light.

In my board specific file I have

static struct omap_dss_device HAWK_III_lcd_device = {
    .name            = "lcd",
    .type            = OMAP_DISPLAY_TYPE_DPI,
    .driver_name        = "URT_UMSH8272MD",

    .phy.dpi.data_lines    = 24,
    .max_backlight_level    = 100,
    .platform_enable    = HAWK_III_enable_lcd,
    .platform_disable    = HAWK_III_disable_lcd,
    .set_backlight = // HOW to add my backlight driver for it to control this.
};

Any help in this would be great. I am using 2.6.37 kernel.

Regards

Ali

  • Hi Ali,
    Please refer to the following sample BACKLIGHT driver on board file.

    You can refer and modify it as per your requirements.

    #define LCD_PANEL_RESET_GPIO_PROD 96
    #define LCD_PANEL_RESET_GPIO_PILOT 55
    #define LCD_PANEL_QVGA_GPIO 56

    static struct gpio zoom_lcd_gpios[] __initdata = {
    { -EINVAL, GPIOF_OUT_INIT_HIGH, "lcd reset" },
    { LCD_PANEL_QVGA_GPIO, GPIOF_OUT_INIT_HIGH, "lcd qvga" },
    };

    static void __init zoom_lcd_panel_init(void)
    {
    zoom_lcd_gpios[0].gpio = (omap_rev() > OMAP3430_REV_ES3_0) ?
    LCD_PANEL_RESET_GPIO_PROD :
    LCD_PANEL_RESET_GPIO_PILOT;

    if (gpio_request_array(zoom_lcd_gpios, ARRAY_SIZE(zoom_lcd_gpios)))
    pr_err("%s: Failed to get LCD GPIOs.\n", __func__);
    }

    static int zoom_panel_enable_lcd(struct omap_dss_device *dssdev)
    {
    return 0;
    }

    static void zoom_panel_disable_lcd(struct omap_dss_device *dssdev)
    {
    }

    /*
    * PWMA/B register offsets (TWL4030_MODULE_PWMA)
    */
    #define TWL_INTBR_PMBR1 0xD
    #define TWL_INTBR_GPBR1 0xC
    #define TWL_LED_PWMON 0x0
    #define TWL_LED_PWMOFF 0x1

    static int zoom_set_bl_intensity(struct omap_dss_device *dssdev, int level)
    {
    unsigned char c;
    u8 mux_pwm, enb_pwm;

    if (level > 100)
    return -1;

    twl_i2c_read_u8(TWL4030_MODULE_INTBR, &mux_pwm, TWL_INTBR_PMBR1);
    twl_i2c_read_u8(TWL4030_MODULE_INTBR, &enb_pwm, TWL_INTBR_GPBR1);

    if (level == 0) {
    /* disable pwm1 output and clock */
    enb_pwm = enb_pwm & 0xF5;
    /* change pwm1 pin to gpio pin */
    mux_pwm = mux_pwm & 0xCF;
    twl_i2c_write_u8(TWL4030_MODULE_INTBR,
    enb_pwm, TWL_INTBR_GPBR1);
    twl_i2c_write_u8(TWL4030_MODULE_INTBR,
    mux_pwm, TWL_INTBR_PMBR1);
    return 0;
    }

    if (!((enb_pwm & 0xA) && (mux_pwm & 0x30))) {
    /* change gpio pin to pwm1 pin */
    mux_pwm = mux_pwm | 0x30;
    /* enable pwm1 output and clock*/
    enb_pwm = enb_pwm | 0x0A;
    twl_i2c_write_u8(TWL4030_MODULE_INTBR,
    mux_pwm, TWL_INTBR_PMBR1);
    twl_i2c_write_u8(TWL4030_MODULE_INTBR,
    enb_pwm, TWL_INTBR_GPBR1);
    }

    c = ((50 * (100 - level)) / 100) + 1;
    twl_i2c_write_u8(TWL4030_MODULE_PWM1, 0x7F, TWL_LED_PWMOFF);
    twl_i2c_write_u8(TWL4030_MODULE_PWM1, c, TWL_LED_PWMON);

    return 0;
    }

    static struct omap_dss_device zoom_lcd_device = {
    .name = "lcd",
    .driver_name = "NEC_8048_panel",
    .type = OMAP_DISPLAY_TYPE_DPI,
    .phy.dpi.data_lines = 24,
    .platform_enable = zoom_panel_enable_lcd,
    .platform_disable = zoom_panel_disable_lcd,
    .max_backlight_level = 100,
    .set_backlight = zoom_set_bl_intensity,
    };