Date:2010-11-09 17:29:19 (9 years 4 months ago)
Author:Xiangfu Liu
Commit:edfd9f467cc584aff4d2c1f055c66c6b3da16c53
Message:[linux] support increase/decrease in screen brightness

Signed-off-by: Xiangfu Liu <xiangfu@sharism.cc>
Files: target/linux/xburst/files-2.6.32/drivers/video/backlight/gpm940b0.c (5 diffs)
target/linux/xburst/qi_lb60/config-2.6.32 (2 diffs)

Change Details

target/linux/xburst/files-2.6.32/drivers/video/backlight/gpm940b0.c
8383    return 0;
8484}
8585
86/*
86int gpm940b0_bl_get_brightness(struct backlight_device *bl)
87{
88    return bl->props.brightness;
89}
90
8791int gpm940b0_bl_update_status(struct backlight_device *bl)
8892{
8993    struct gpm940b0 *gpm940b0 = bl_get_data(bl);
9094
91    gpm940b0->reg5 &= ~0x38;
92    gpm940b0->reg5 |= ((bl->props.brightness << 3) & 0x38);
93
94    gpm940b0_write_reg(gpm940b0->spi, 0x5, gpm940b0->reg5);
95    gpm940b0_write_reg(gpm940b0->spi, 0x3, (bl->props.brightness));
9596
9697    return 0;
97}*/
98}
9899
99100static ssize_t reg_write(struct device *dev, struct device_attribute *attr,
100101                        const char *buf, size_t count)
...... 
119120    .set_mode = gpm940b0_set_mode,
120121};
121122
122#if 0
123123static struct backlight_ops gpm940b0_bl_ops = {
124/* .get_brightness = gpm940b0_bl_get_brightness,*/
124    .get_brightness = gpm940b0_bl_get_brightness,
125125    .update_status = gpm940b0_bl_update_status,
126126};
127#endif
128127
129128static int __devinit gpm940b0_probe(struct spi_device *spi)
130129{
...... 
154153
155154    gpm940b0->lcd->props.max_contrast = 255;
156155
157#if 0
158156    gpm940b0->bl = backlight_device_register("gpm940b0-bl", &spi->dev, gpm940b0,
159157                         &gpm940b0_bl_ops);
160158
...... 
163161        dev_err(&spi->dev, "Failed to register backlight device: %d\n", ret);
164162        gpm940b0->bl = NULL;
165163    } else {
166        gpm940b0->bl->props.max_brightness = 8;
167        gpm940b0->bl->props.brightness = 0;
164        gpm940b0->bl->props.max_brightness = 255;
165        gpm940b0->bl->props.brightness = 64;
168166        gpm940b0->bl->props.power = FB_BLANK_UNBLANK;
169167    }
170#endif
168    backlight_update_status(gpm940b0->bl);
171169
172170    ret = device_create_file(&spi->dev, &dev_attr_reg);
173171    if (ret)
...... 
190188static int __devexit gpm940b0_remove(struct spi_device *spi)
191189{
192190    struct gpm940b0 *gpm940b0 = spi_get_drvdata(spi);
193#if 0
194191    if (gpm940b0->bl)
195192        backlight_device_unregister(gpm940b0->bl);
196#endif
197193
198194    lcd_device_unregister(gpm940b0->lcd);
199195
target/linux/xburst/qi_lb60/config-2.6.32
1CONFIG_BACKLIGHT_CLASS_DEVICE=y
12CONFIG_BACKLIGHT_LCD_SUPPORT=y
23CONFIG_BATTERY_JZ4740=y
34CONFIG_CMDLINE="root=/dev/ram0 rootfstype=ramfs console=ttyS0,57600 console=tty0 mem=32M"
...... 
1920CONFIG_SPI_BITBANG=y
2021CONFIG_SPI_GPIO=y
2122CONFIG_SPI_MASTER=y
22CONFIG_USB_ETH_RNDIS=n
23# CONFIG_USB_ETH_RNDIS is not set

Archive Download the corresponding diff file



interactive