target/linux/xburst/files-2.6.32/drivers/video/backlight/gpm940b0.c |
83 | 83 | return 0; |
84 | 84 | } |
85 | 85 | |
86 | | /* |
| 86 | int gpm940b0_bl_get_brightness(struct backlight_device *bl) |
| 87 | { |
| 88 | return bl->props.brightness; |
| 89 | } |
| 90 | |
87 | 91 | int gpm940b0_bl_update_status(struct backlight_device *bl) |
88 | 92 | { |
89 | 93 | struct gpm940b0 *gpm940b0 = bl_get_data(bl); |
90 | 94 | |
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)); |
95 | 96 | |
96 | 97 | return 0; |
97 | | }*/ |
| 98 | } |
98 | 99 | |
99 | 100 | static ssize_t reg_write(struct device *dev, struct device_attribute *attr, |
100 | 101 | const char *buf, size_t count) |
... | ... | |
119 | 120 | .set_mode = gpm940b0_set_mode, |
120 | 121 | }; |
121 | 122 | |
122 | | #if 0 |
123 | 123 | static struct backlight_ops gpm940b0_bl_ops = { |
124 | | /* .get_brightness = gpm940b0_bl_get_brightness,*/ |
| 124 | .get_brightness = gpm940b0_bl_get_brightness, |
125 | 125 | .update_status = gpm940b0_bl_update_status, |
126 | 126 | }; |
127 | | #endif |
128 | 127 | |
129 | 128 | static int __devinit gpm940b0_probe(struct spi_device *spi) |
130 | 129 | { |
... | ... | |
154 | 153 | |
155 | 154 | gpm940b0->lcd->props.max_contrast = 255; |
156 | 155 | |
157 | | #if 0 |
158 | 156 | gpm940b0->bl = backlight_device_register("gpm940b0-bl", &spi->dev, gpm940b0, |
159 | 157 | &gpm940b0_bl_ops); |
160 | 158 | |
... | ... | |
163 | 161 | dev_err(&spi->dev, "Failed to register backlight device: %d\n", ret); |
164 | 162 | gpm940b0->bl = NULL; |
165 | 163 | } 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; |
168 | 166 | gpm940b0->bl->props.power = FB_BLANK_UNBLANK; |
169 | 167 | } |
170 | | #endif |
| 168 | backlight_update_status(gpm940b0->bl); |
171 | 169 | |
172 | 170 | ret = device_create_file(&spi->dev, &dev_attr_reg); |
173 | 171 | if (ret) |
... | ... | |
190 | 188 | static int __devexit gpm940b0_remove(struct spi_device *spi) |
191 | 189 | { |
192 | 190 | struct gpm940b0 *gpm940b0 = spi_get_drvdata(spi); |
193 | | #if 0 |
194 | 191 | if (gpm940b0->bl) |
195 | 192 | backlight_device_unregister(gpm940b0->bl); |
196 | | #endif |
197 | 193 | |
198 | 194 | lcd_device_unregister(gpm940b0->lcd); |
199 | 195 | |