Date:2011-03-22 23:03:29 (11 years 6 months ago)
Author:Maarten ter Huurne
Commit:66672e1b71b692a465fd3015cc8239f2fec968f6
Message:MIPS: JZ4740: A320: Force backlight off when ILI is off.

When TV-out is active, the controller for the internal screen (ILI9325/9331) is off.
This patch ensures that the backlight is turned off for as long as the ILI chip stays off,
even if the user changes the brightness value via sysfs in the mean time.

Thanks to Paul Cercueil <paul@crapouillou.net> for the idea of reading the ILI RESET_N pin
to determine whether TV-out is active.
Files: arch/mips/jz4740/board-a320.c (1 diff)
drivers/video/jz4740_slcd_fb.c (2 diffs)

Change Details

arch/mips/jz4740/board-a320.c
182182    .register_select_active_low = 1,
183183};
184184
185static int a320_backlight_notify(struct device *dev, int brightness)
186{
187    if (!gpio_get_value(JZ_GPIO_PORTB(18))) {
188        /* RESET_N pin of the ILI chip is pulled down,
189           so force backlight off. */
190        return 0;
191    }
192
193    return brightness;
194}
195
185196static struct platform_pwm_backlight_data a320_backlight_pdata = {
186197    .pwm_id = 7,
187198    .max_brightness = 255,
188199    .dft_brightness = 100,
189200    .pwm_period_ns = 5000000,
201    .notify = a320_backlight_notify,
190202};
191203
192204static struct platform_device a320_backlight_device = {
drivers/video/jz4740_slcd_fb.c
562562
563563static void jzfb_tv_out(struct jzfb *jzfb, unsigned int mode)
564564{
565    int blank = jzfb->is_enabled ? FB_BLANK_UNBLANK : FB_BLANK_POWERDOWN;
566    struct fb_event event = {
567        .info = jzfb->fb,
568        .data = &blank,
569    };
570
565571    printk("A320 TV out: %d\n", mode);
566572
567573    if (mode != FB_A320TV_OFF) {
...... 
618624        jzfb->panel->enable(jzfb);
619625        schedule_delayed_work(&jzfb->refresh_work, 0);
620626    }
627
628    /* reaffirm the current blanking state, to trigger a backlight update */
629    fb_notifier_call_chain(FB_EVENT_BLANK, &event);
621630}
622631
623632static int jzfb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg)

Archive Download the corresponding diff file



interactive