| Date: | 2010-05-31 20:32:56 (13 years 6 months ago) |
|---|---|
| Author: | Lars C. |
| Commit: | 79da1ff132187dbc7c2335df79e37fce7ce999af |
| Message: | Rename gpm940b0 lcd driver to ili8960 The ili8960 is the lcd controller used inside the gpm940b0. |
| Files: |
arch/mips/jz4740/board-qi_lb60.c (1 diff) drivers/video/backlight/Kconfig (2 diffs) drivers/video/backlight/Makefile (1 diff) drivers/video/backlight/gpm940b0.c (1 diff) drivers/video/backlight/ili8960.c (1 diff) |
Change Details
| arch/mips/jz4740/board-qi_lb60.c | ||
|---|---|---|
| 283 | 283 | |
| 284 | 284 | static struct spi_board_info qi_lb60_spi_board_info[] = { |
| 285 | 285 | { |
| 286 | .modalias = "gpm940b0", | |
| 286 | .modalias = "ili8960", | |
| 287 | 287 | .controller_data = (void *)JZ_GPIO_PORTC(21), |
| 288 | 288 | .chip_select = 0, |
| 289 | 289 | .bus_num = 1, |
| drivers/video/backlight/Kconfig | ||
|---|---|---|
| 57 | 57 | |
| 58 | 58 | The LTV350QV panel is present on all ATSTK1000 boards. |
| 59 | 59 | |
| 60 | config LCD_ILI8960 | |
| 61 | tristate "Ilitek ili8960 LCD driver" | |
| 62 | depends on LCD_CLASS_DEVICE && SPI | |
| 63 | default n | |
| 64 | help | |
| 65 | Driver for the Ilitek ili8960 LCD controller chip. | |
| 66 | ||
| 60 | 67 | config LCD_ILI9320 |
| 61 | 68 | tristate |
| 62 | 69 | depends on LCD_CLASS_DEVICE && BACKLIGHT_LCD_SUPPORT |
| ... | ... | |
| 107 | 114 | If you have an HP Jornada 700 series handheld (710/720/728) |
| 108 | 115 | say Y to enable LCD control driver. |
| 109 | 116 | |
| 110 | config LCD_GPM940B0 | |
| 111 | tristate "Giantplus GPM940B0 LCD and backlight driver" | |
| 112 | depends on LCD_CLASS_DEVICE && SPI | |
| 113 | default n | |
| 114 | help | |
| 115 | LCD and backlight driver for the Giantplus GPM940B0 LCD module. | |
| 116 | ||
| 117 | 117 | # |
| 118 | 118 | # Backlight |
| 119 | 119 | # |
| drivers/video/backlight/Makefile | ||
|---|---|---|
| 6 | 6 | obj-$(CONFIG_LCD_L4F00242T03) += l4f00242t03.o |
| 7 | 7 | obj-$(CONFIG_LCD_LMS283GF05) += lms283gf05.o |
| 8 | 8 | obj-$(CONFIG_LCD_LTV350QV) += ltv350qv.o |
| 9 | obj-$(CONFIG_LCD_ILI8960) += ili8960.o | |
| 9 | 10 | obj-$(CONFIG_LCD_ILI9320) += ili9320.o |
| 10 | 11 | obj-$(CONFIG_LCD_PLATFORM) += platform_lcd.o |
| 11 | 12 | obj-$(CONFIG_LCD_VGG2432A4) += vgg2432a4.o |
| 12 | 13 | obj-$(CONFIG_LCD_TDO24M) += tdo24m.o |
| 13 | 14 | obj-$(CONFIG_LCD_TOSA) += tosa_lcd.o |
| 14 | obj-$(CONFIG_LCD_GPM940B0) += gpm940b0.o | |
| 15 | 15 | |
| 16 | 16 | obj-$(CONFIG_BACKLIGHT_CLASS_DEVICE) += backlight.o |
| 17 | 17 | obj-$(CONFIG_BACKLIGHT_ATMEL_PWM) += atmel-pwm-bl.o |
| drivers/video/backlight/gpm940b0.c | ||
|---|---|---|
| 1 | /* | |
| 2 | * Copyright (C) 2009-2010, Lars-Peter Clausen <lars@metafoo.de> | |
| 3 | * Driver for Giantplus GPM940B0 LCD | |
| 4 | * | |
| 5 | * This program is free software; you can redistribute it and/or modify it | |
| 6 | * under the terms of the GNU General Public License as published by the | |
| 7 | * Free Software Foundation; either version 2 of the License, or (at your | |
| 8 | * option) any later version. | |
| 9 | * | |
| 10 | * You should have received a copy of the GNU General Public License along | |
| 11 | * with this program; if not, write to the Free Software Foundation, Inc., | |
| 12 | * 675 Mass Ave, Cambridge, MA 02139, USA. | |
| 13 | * | |
| 14 | */ | |
| 15 | ||
| 16 | #include <linux/module.h> | |
| 17 | #include <linux/spi/spi.h> | |
| 18 | #include <linux/lcd.h> | |
| 19 | #include <linux/backlight.h> | |
| 20 | #include <linux/delay.h> | |
| 21 | ||
| 22 | struct gpm940b0 { | |
| 23 | struct spi_device *spi; | |
| 24 | struct lcd_device *lcd; | |
| 25 | struct backlight_device *bl; | |
| 26 | unsigned enabled:1; | |
| 27 | }; | |
| 28 | ||
| 29 | static int gpm940b0_write_reg(struct spi_device *spi, uint8_t reg, | |
| 30 | uint8_t data) | |
| 31 | { | |
| 32 | uint8_t buf[2]; | |
| 33 | buf[0] = ((reg & 0x40) << 1) | (reg & 0x3f); | |
| 34 | buf[1] = data; | |
| 35 | ||
| 36 | return spi_write(spi, buf, sizeof(buf)); | |
| 37 | } | |
| 38 | ||
| 39 | static void gpm940b0_power_disable(struct spi_device *spi) | |
| 40 | { | |
| 41 | int ret = gpm940b0_write_reg(spi, 0x5, 0xc6) ; | |
| 42 | if (ret < 0) | |
| 43 | dev_err(&spi->dev, "Failed to disable power: %d\n", ret); | |
| 44 | } | |
| 45 | ||
| 46 | static void gpm940b0_power_enable(struct spi_device *spi) | |
| 47 | { | |
| 48 | gpm940b0_write_reg(spi, 0x5, 0xc7); | |
| 49 | } | |
| 50 | ||
| 51 | ||
| 52 | static int gpm940b0_set_power(struct lcd_device *lcd, int power) | |
| 53 | { | |
| 54 | struct gpm940b0 *gpm940b0 = lcd_get_data(lcd); | |
| 55 | ||
| 56 | switch (power) { | |
| 57 | case FB_BLANK_UNBLANK: | |
| 58 | mdelay(20); | |
| 59 | gpm940b0->enabled = 1; | |
| 60 | gpm940b0_power_enable(gpm940b0->spi); | |
| 61 | break; | |
| 62 | default: | |
| 63 | gpm940b0->enabled = 0; | |
| 64 | gpm940b0_power_disable(gpm940b0->spi); | |
| 65 | mdelay(20); | |
| 66 | break; | |
| 67 | } | |
| 68 | return 0; | |
| 69 | } | |
| 70 | ||
| 71 | static int gpm940b0_set_contrast(struct lcd_device *lcd, int contrast) | |
| 72 | { | |
| 73 | struct gpm940b0 *gpm940b0 = lcd_get_data(lcd); | |
| 74 | gpm940b0_write_reg(gpm940b0->spi, 0x0d, contrast); | |
| 75 | return 0; | |
| 76 | } | |
| 77 | ||
| 78 | static int gpm940b0_set_mode(struct lcd_device *lcd, struct fb_videomode *mode) | |
| 79 | { | |
| 80 | if (mode->xres != 320 && mode->yres != 240) | |
| 81 | return -EINVAL; | |
| 82 | ||
| 83 | return 0; | |
| 84 | } | |
| 85 | ||
| 86 | static ssize_t reg_write(struct device *dev, struct device_attribute *attr, | |
| 87 | const char *buf, size_t count) | |
| 88 | { | |
| 89 | char *buf2; | |
| 90 | uint32_t reg = simple_strtoul(buf, &buf2, 10); | |
| 91 | uint32_t val = simple_strtoul(buf2 + 1, NULL, 10); | |
| 92 | struct gpm940b0 *gpm940b0 = dev_get_drvdata(dev); | |
| 93 | ||
| 94 | if (reg < 0 || val < 0) | |
| 95 | return -EINVAL; | |
| 96 | ||
| 97 | gpm940b0_write_reg(gpm940b0->spi, reg, val); | |
| 98 | return count; | |
| 99 | } | |
| 100 | ||
| 101 | static DEVICE_ATTR(reg, 0644, NULL, reg_write); | |
| 102 | ||
| 103 | static ssize_t gpm940b0_show_brightness(struct device *dev, | |
| 104 | struct device_attribute *attr, char *buf) | |
| 105 | { | |
| 106 | int rc = -ENXIO; | |
| 107 | ||
| 108 | return rc; | |
| 109 | } | |
| 110 | ||
| 111 | static ssize_t gpm940b0_store_brightness(struct device *dev, | |
| 112 | struct device_attribute *attr, const char *buf, size_t count) | |
| 113 | { | |
| 114 | char *endp; | |
| 115 | struct lcd_device *ld = to_lcd_device(dev); | |
| 116 | struct gpm940b0 *gpm940b0 = lcd_get_data(ld); | |
| 117 | int brightness = simple_strtoul(buf, &endp, 0); | |
| 118 | ||
| 119 | if (brightness > 255 || brightness < 0) | |
| 120 | return -EINVAL; | |
| 121 | ||
| 122 | gpm940b0_write_reg(gpm940b0->spi, 0x3, brightness); | |
| 123 | ||
| 124 | return count; | |
| 125 | } | |
| 126 | ||
| 127 | ||
| 128 | static DEVICE_ATTR(brightness, 0644, gpm940b0_show_brightness, | |
| 129 | gpm940b0_store_brightness); | |
| 130 | ||
| 131 | static struct lcd_ops gpm940b0_lcd_ops = { | |
| 132 | .set_power = gpm940b0_set_power, | |
| 133 | .set_contrast = gpm940b0_set_contrast, | |
| 134 | .set_mode = gpm940b0_set_mode, | |
| 135 | }; | |
| 136 | ||
| 137 | static int __devinit gpm940b0_probe(struct spi_device *spi) | |
| 138 | { | |
| 139 | int ret; | |
| 140 | struct gpm940b0 *gpm940b0; | |
| 141 | ||
| 142 | gpm940b0 = kmalloc(sizeof(*gpm940b0), GFP_KERNEL); | |
| 143 | ||
| 144 | spi->bits_per_word = 8; | |
| 145 | spi->mode = SPI_MODE_3 | SPI_3WIRE; | |
| 146 | ||
| 147 | ret = spi_setup(spi); | |
| 148 | if (ret) { | |
| 149 | dev_err(&spi->dev, "Failed to setup spi\n"); | |
| 150 | goto err_free_gpm940b0; | |
| 151 | } | |
| 152 | ||
| 153 | gpm940b0->spi = spi; | |
| 154 | ||
| 155 | gpm940b0->lcd = lcd_device_register("gpm940b0-lcd", &spi->dev, gpm940b0, | |
| 156 | &gpm940b0_lcd_ops); | |
| 157 | ||
| 158 | if (IS_ERR(gpm940b0->lcd)) { | |
| 159 | ret = PTR_ERR(gpm940b0->lcd); | |
| 160 | dev_err(&spi->dev, "Failed to register lcd device: %d\n", ret); | |
| 161 | goto err_free_gpm940b0; | |
| 162 | } | |
| 163 | ||
| 164 | gpm940b0->lcd->props.max_contrast = 255; | |
| 165 | ||
| 166 | ret = device_create_file(&spi->dev, &dev_attr_reg); | |
| 167 | if (ret) | |
| 168 | goto err_unregister_lcd; | |
| 169 | ||
| 170 | ret = device_create_file(&gpm940b0->lcd->dev, &dev_attr_brightness); | |
| 171 | if (ret) | |
| 172 | goto err_unregister_lcd; | |
| 173 | ||
| 174 | gpm940b0->enabled = 1; | |
| 175 | dev_set_drvdata(&spi->dev, gpm940b0); | |
| 176 | ||
| 177 | gpm940b0_write_reg(spi, 0x13, 0x01); | |
| 178 | gpm940b0_write_reg(spi, 0x5, 0xc7); | |
| 179 | return 0; | |
| 180 | err_unregister_lcd: | |
| 181 | lcd_device_unregister(gpm940b0->lcd); | |
| 182 | err_free_gpm940b0: | |
| 183 | kfree(gpm940b0); | |
| 184 | return ret; | |
| 185 | } | |
| 186 | ||
| 187 | static int __devexit gpm940b0_remove(struct spi_device *spi) | |
| 188 | { | |
| 189 | struct gpm940b0 *gpm940b0 = spi_get_drvdata(spi); | |
| 190 | #if 0 | |
| 191 | if (gpm940b0->bl) | |
| 192 | backlight_device_unregister(gpm940b0->bl); | |
| 193 | #endif | |
| 194 | ||
| 195 | lcd_device_unregister(gpm940b0->lcd); | |
| 196 | ||
| 197 | spi_set_drvdata(spi, NULL); | |
| 198 | kfree(gpm940b0); | |
| 199 | return 0; | |
| 200 | } | |
| 201 | ||
| 202 | #ifdef CONFIG_PM | |
| 203 | ||
| 204 | static int gpm940b0_suspend(struct spi_device *spi, pm_message_t state) | |
| 205 | { | |
| 206 | struct gpm940b0 *gpm940b0 = spi_get_drvdata(spi); | |
| 207 | if (gpm940b0->enabled) { | |
| 208 | gpm940b0_power_disable(spi); | |
| 209 | mdelay(10); | |
| 210 | } | |
| 211 | return 0; | |
| 212 | } | |
| 213 | ||
| 214 | static int gpm940b0_resume(struct spi_device *spi) | |
| 215 | { | |
| 216 | struct gpm940b0 *gpm940b0 = spi_get_drvdata(spi); | |
| 217 | if (gpm940b0->enabled) | |
| 218 | gpm940b0_power_enable(spi); | |
| 219 | return 0; | |
| 220 | } | |
| 221 | ||
| 222 | #else | |
| 223 | #define gpm940b0_suspend NULL | |
| 224 | #define gpm940b0_resume NULL | |
| 225 | #endif | |
| 226 | ||
| 227 | static struct spi_driver gpm940b0_driver = { | |
| 228 | .driver = { | |
| 229 | .name = "gpm940b0", | |
| 230 | .owner = THIS_MODULE, | |
| 231 | }, | |
| 232 | .probe = gpm940b0_probe, | |
| 233 | .remove = __devexit_p(gpm940b0_remove), | |
| 234 | .suspend = gpm940b0_suspend, | |
| 235 | .resume = gpm940b0_resume, | |
| 236 | }; | |
| 237 | ||
| 238 | static int __init gpm940b0_init(void) | |
| 239 | { | |
| 240 | return spi_register_driver(&gpm940b0_driver); | |
| 241 | } | |
| 242 | module_init(gpm940b0_init); | |
| 243 | ||
| 244 | static void __exit gpm940b0_exit(void) | |
| 245 | { | |
| 246 | return spi_unregister_driver(&gpm940b0_driver); | |
| 247 | } | |
| 248 | module_exit(gpm940b0_exit) | |
| 249 | ||
| 250 | MODULE_AUTHOR("Lars-Peter Clausen"); | |
| 251 | MODULE_LICENSE("GPL v2"); | |
| 252 | MODULE_DESCRIPTION("LCD and backlight controll for Giantplus GPM940B0"); | |
| 253 | MODULE_ALIAS("spi:gpm940b0"); | |
| drivers/video/backlight/ili8960.c | ||
|---|---|---|
| 1 | /* | |
| 2 | * Copyright (C) 2009-2010, Lars-Peter Clausen <lars@metafoo.de> | |
| 3 | * Driver for Ilitek ili8960 LCD | |
| 4 | * | |
| 5 | * This program is free software; you can redistribute it and/or modify it | |
| 6 | * under the terms of the GNU General Public License as published by the | |
| 7 | * Free Software Foundation; either version 2 of the License, or (at your | |
| 8 | * option) any later version. | |
| 9 | * | |
| 10 | * You should have received a copy of the GNU General Public License along | |
| 11 | * with this program; if not, write to the Free Software Foundation, Inc., | |
| 12 | * 675 Mass Ave, Cambridge, MA 02139, USA. | |
| 13 | * | |
| 14 | */ | |
| 15 | ||
| 16 | #include <linux/module.h> | |
| 17 | #include <linux/spi/spi.h> | |
| 18 | #include <linux/lcd.h> | |
| 19 | #include <linux/backlight.h> | |
| 20 | #include <linux/delay.h> | |
| 21 | ||
| 22 | struct ili8960 { | |
| 23 | struct spi_device *spi; | |
| 24 | struct lcd_device *lcd; | |
| 25 | struct backlight_device *bl; | |
| 26 | unsigned enabled:1; | |
| 27 | }; | |
| 28 | ||
| 29 | static int ili8960_write_reg(struct spi_device *spi, uint8_t reg, | |
| 30 | uint8_t data) | |
| 31 | { | |
| 32 | uint8_t buf[2]; | |
| 33 | buf[0] = ((reg & 0x40) << 1) | (reg & 0x3f); | |
| 34 | buf[1] = data; | |
| 35 | ||
| 36 | return spi_write(spi, buf, sizeof(buf)); | |
| 37 | } | |
| 38 | ||
| 39 | static void ili8960_power_disable(struct spi_device *spi) | |
| 40 | { | |
| 41 | int ret = ili8960_write_reg(spi, 0x5, 0xc6) ; | |
| 42 | if (ret < 0) | |
| 43 | dev_err(&spi->dev, "Failed to disable power: %d\n", ret); | |
| 44 | } | |
| 45 | ||
| 46 | static void ili8960_power_enable(struct spi_device *spi) | |
| 47 | { | |
| 48 | ili8960_write_reg(spi, 0x5, 0xc7); | |
| 49 | } | |
| 50 | ||
| 51 | ||
| 52 | static int ili8960_set_power(struct lcd_device *lcd, int power) | |
| 53 | { | |
| 54 | struct ili8960 *ili8960 = lcd_get_data(lcd); | |
| 55 | ||
| 56 | switch (power) { | |
| 57 | case FB_BLANK_UNBLANK: | |
| 58 | mdelay(20); | |
| 59 | ili8960->enabled = 1; | |
| 60 | ili8960_power_enable(ili8960->spi); | |
| 61 | break; | |
| 62 | default: | |
| 63 | ili8960->enabled = 0; | |
| 64 | ili8960_power_disable(ili8960->spi); | |
| 65 | mdelay(20); | |
| 66 | break; | |
| 67 | } | |
| 68 | return 0; | |
| 69 | } | |
| 70 | ||
| 71 | static int ili8960_set_contrast(struct lcd_device *lcd, int contrast) | |
| 72 | { | |
| 73 | struct ili8960 *ili8960 = lcd_get_data(lcd); | |
| 74 | ili8960_write_reg(ili8960->spi, 0x0d, contrast); | |
| 75 | return 0; | |
| 76 | } | |
| 77 | ||
| 78 | static int ili8960_set_mode(struct lcd_device *lcd, struct fb_videomode *mode) | |
| 79 | { | |
| 80 | if (mode->xres != 320 && mode->yres != 240) | |
| 81 | return -EINVAL; | |
| 82 | ||
| 83 | return 0; | |
| 84 | } | |
| 85 | ||
| 86 | static ssize_t reg_write(struct device *dev, struct device_attribute *attr, | |
| 87 | const char *buf, size_t count) | |
| 88 | { | |
| 89 | char *buf2; | |
| 90 | uint32_t reg = simple_strtoul(buf, &buf2, 10); | |
| 91 | uint32_t val = simple_strtoul(buf2 + 1, NULL, 10); | |
| 92 | struct ili8960 *ili8960 = dev_get_drvdata(dev); | |
| 93 | ||
| 94 | if (reg < 0 || val < 0) | |
| 95 | return -EINVAL; | |
| 96 | ||
| 97 | ili8960_write_reg(ili8960->spi, reg, val); | |
| 98 | return count; | |
| 99 | } | |
| 100 | ||
| 101 | static DEVICE_ATTR(reg, 0644, NULL, reg_write); | |
| 102 | ||
| 103 | static ssize_t ili8960_show_brightness(struct device *dev, | |
| 104 | struct device_attribute *attr, char *buf) | |
| 105 | { | |
| 106 | int rc = -ENXIO; | |
| 107 | ||
| 108 | return rc; | |
| 109 | } | |
| 110 | ||
| 111 | static ssize_t ili8960_store_brightness(struct device *dev, | |
| 112 | struct device_attribute *attr, const char *buf, size_t count) | |
| 113 | { | |
| 114 | char *endp; | |
| 115 | struct lcd_device *ld = to_lcd_device(dev); | |
| 116 | struct ili8960 *ili8960 = lcd_get_data(ld); | |
| 117 | int brightness = simple_strtoul(buf, &endp, 0); | |
| 118 | ||
| 119 | if (brightness > 255 || brightness < 0) | |
| 120 | return -EINVAL; | |
| 121 | ||
| 122 | ili8960_write_reg(ili8960->spi, 0x3, brightness); | |
| 123 | ||
| 124 | return count; | |
| 125 | } | |
| 126 | ||
| 127 | ||
| 128 | static DEVICE_ATTR(brightness, 0644, ili8960_show_brightness, | |
| 129 | ili8960_store_brightness); | |
| 130 | ||
| 131 | static struct lcd_ops ili8960_lcd_ops = { | |
| 132 | .set_power = ili8960_set_power, | |
| 133 | .set_contrast = ili8960_set_contrast, | |
| 134 | .set_mode = ili8960_set_mode, | |
| 135 | }; | |
| 136 | ||
| 137 | static int __devinit ili8960_probe(struct spi_device *spi) | |
| 138 | { | |
| 139 | int ret; | |
| 140 | struct ili8960 *ili8960; | |
| 141 | ||
| 142 | ili8960 = kmalloc(sizeof(*ili8960), GFP_KERNEL); | |
| 143 | ||
| 144 | spi->bits_per_word = 8; | |
| 145 | spi->mode = SPI_MODE_3 | SPI_3WIRE; | |
| 146 | ||
| 147 | ret = spi_setup(spi); | |
| 148 | if (ret) { | |
| 149 | dev_err(&spi->dev, "Failed to setup spi\n"); | |
| 150 | goto err_free_ili8960; | |
| 151 | } | |
| 152 | ||
| 153 | ili8960->spi = spi; | |
| 154 | ||
| 155 | ili8960->lcd = lcd_device_register("ili8960-lcd", &spi->dev, ili8960, | |
| 156 | &ili8960_lcd_ops); | |
| 157 | ||
| 158 | if (IS_ERR(ili8960->lcd)) { | |
| 159 | ret = PTR_ERR(ili8960->lcd); | |
| 160 | dev_err(&spi->dev, "Failed to register lcd device: %d\n", ret); | |
| 161 | goto err_free_ili8960; | |
| 162 | } | |
| 163 | ||
| 164 | ili8960->lcd->props.max_contrast = 255; | |
| 165 | ||
| 166 | ret = device_create_file(&spi->dev, &dev_attr_reg); | |
| 167 | if (ret) | |
| 168 | goto err_unregister_lcd; | |
| 169 | ||
| 170 | ret = device_create_file(&ili8960->lcd->dev, &dev_attr_brightness); | |
| 171 | if (ret) | |
| 172 | goto err_unregister_lcd; | |
| 173 | ||
| 174 | ili8960->enabled = 1; | |
| 175 | dev_set_drvdata(&spi->dev, ili8960); | |
| 176 | ||
| 177 | ili8960_write_reg(spi, 0x13, 0x01); | |
| 178 | ili8960_write_reg(spi, 0x5, 0xc7); | |
| 179 | ||
| 180 | return 0; | |
| 181 | err_unregister_lcd: | |
| 182 | lcd_device_unregister(ili8960->lcd); | |
| 183 | err_free_ili8960: | |
| 184 | kfree(ili8960); | |
| 185 | return ret; | |
| 186 | } | |
| 187 | ||
| 188 | static int __devexit ili8960_remove(struct spi_device *spi) | |
| 189 | { | |
| 190 | struct ili8960 *ili8960 = spi_get_drvdata(spi); | |
| 191 | #if 0 | |
| 192 | if (ili8960->bl) | |
| 193 | backlight_device_unregister(ili8960->bl); | |
| 194 | #endif | |
| 195 | ||
| 196 | lcd_device_unregister(ili8960->lcd); | |
| 197 | ||
| 198 | spi_set_drvdata(spi, NULL); | |
| 199 | kfree(ili8960); | |
| 200 | return 0; | |
| 201 | } | |
| 202 | ||
| 203 | #ifdef CONFIG_PM | |
| 204 | ||
| 205 | static int ili8960_suspend(struct spi_device *spi, pm_message_t state) | |
| 206 | { | |
| 207 | struct ili8960 *ili8960 = spi_get_drvdata(spi); | |
| 208 | if (ili8960->enabled) { | |
| 209 | ili8960_power_disable(spi); | |
| 210 | mdelay(10); | |
| 211 | } | |
| 212 | return 0; | |
| 213 | } | |
| 214 | ||
| 215 | static int ili8960_resume(struct spi_device *spi) | |
| 216 | { | |
| 217 | struct ili8960 *ili8960 = spi_get_drvdata(spi); | |
| 218 | if (ili8960->enabled) | |
| 219 | ili8960_power_enable(spi); | |
| 220 | return 0; | |
| 221 | } | |
| 222 | ||
| 223 | #else | |
| 224 | #define ili8960_suspend NULL | |
| 225 | #define ili8960_resume NULL | |
| 226 | #endif | |
| 227 | ||
| 228 | static struct spi_driver ili8960_driver = { | |
| 229 | .driver = { | |
| 230 | .name = "ili8960", | |
| 231 | .owner = THIS_MODULE, | |
| 232 | }, | |
| 233 | .probe = ili8960_probe, | |
| 234 | .remove = __devexit_p(ili8960_remove), | |
| 235 | .suspend = ili8960_suspend, | |
| 236 | .resume = ili8960_resume, | |
| 237 | }; | |
| 238 | ||
| 239 | static int __init ili8960_init(void) | |
| 240 | { | |
| 241 | return spi_register_driver(&ili8960_driver); | |
| 242 | } | |
| 243 | module_init(ili8960_init); | |
| 244 | ||
| 245 | static void __exit ili8960_exit(void) | |
| 246 | { | |
| 247 | return spi_unregister_driver(&ili8960_driver); | |
| 248 | } | |
| 249 | module_exit(ili8960_exit) | |
| 250 | ||
| 251 | MODULE_AUTHOR("Lars-Peter Clausen"); | |
| 252 | MODULE_LICENSE("GPL v2"); | |
| 253 | MODULE_DESCRIPTION("LCD driver for Ilitek ili8960"); | |
| 254 | MODULE_ALIAS("spi:ili8960"); | |
Branches:
ben-wpan
ben-wpan-stefan
5396a9238205f20f811ea57898980d3ca82df0b6
jz-2.6.34
jz-2.6.34-rc5
jz-2.6.34-rc6
jz-2.6.34-rc7
jz-2.6.35
jz-2.6.36
jz-2.6.37
jz-2.6.38
jz-2.6.39
jz-3.0
jz-3.1
jz-3.11
jz-3.12
jz-3.13
jz-3.15
jz-3.16
jz-3.18-dt
jz-3.2
jz-3.3
jz-3.4
jz-3.5
jz-3.6
jz-3.6-rc2-pwm
jz-3.9
jz-3.9-clk
jz-3.9-rc8
jz47xx
jz47xx-2.6.38
master
Tags:
od-2011-09-04
od-2011-09-18
v2.6.34-rc5
v2.6.34-rc6
v2.6.34-rc7
v3.9
