diff options
Diffstat (limited to 'drivers/video/backlight')
| -rw-r--r-- | drivers/video/backlight/adx_bl.c | 182 | ||||
| -rw-r--r-- | drivers/video/backlight/progear_bl.c | 160 | ||||
| -rw-r--r-- | drivers/video/backlight/tegra_pwm_bl.c | 177 |
3 files changed, 519 insertions, 0 deletions
diff --git a/drivers/video/backlight/adx_bl.c b/drivers/video/backlight/adx_bl.c new file mode 100644 index 00000000000..c861c41af44 --- /dev/null +++ b/drivers/video/backlight/adx_bl.c | |||
| @@ -0,0 +1,182 @@ | |||
| 1 | /* | ||
| 2 | * linux/drivers/video/backlight/adx.c | ||
| 3 | * | ||
| 4 | * Copyright (C) 2009 Avionic Design GmbH | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License version 2 as | ||
| 8 | * published by the Free Software Foundation. | ||
| 9 | * | ||
| 10 | * Written by Thierry Reding <thierry.reding@avionic-design.de> | ||
| 11 | */ | ||
| 12 | |||
| 13 | #include <linux/backlight.h> | ||
| 14 | #include <linux/fb.h> | ||
| 15 | #include <linux/gfp.h> | ||
| 16 | #include <linux/io.h> | ||
| 17 | #include <linux/module.h> | ||
| 18 | #include <linux/platform_device.h> | ||
| 19 | |||
| 20 | /* register definitions */ | ||
| 21 | #define ADX_BACKLIGHT_CONTROL 0x00 | ||
| 22 | #define ADX_BACKLIGHT_CONTROL_ENABLE (1 << 0) | ||
| 23 | #define ADX_BACKLIGHT_BRIGHTNESS 0x08 | ||
| 24 | #define ADX_BACKLIGHT_STATUS 0x10 | ||
| 25 | #define ADX_BACKLIGHT_ERROR 0x18 | ||
| 26 | |||
| 27 | struct adxbl { | ||
| 28 | void __iomem *base; | ||
| 29 | }; | ||
| 30 | |||
| 31 | static int adx_backlight_update_status(struct backlight_device *bldev) | ||
| 32 | { | ||
| 33 | struct adxbl *bl = bl_get_data(bldev); | ||
| 34 | u32 value; | ||
| 35 | |||
| 36 | value = bldev->props.brightness; | ||
| 37 | writel(value, bl->base + ADX_BACKLIGHT_BRIGHTNESS); | ||
| 38 | |||
| 39 | value = readl(bl->base + ADX_BACKLIGHT_CONTROL); | ||
| 40 | |||
| 41 | if (bldev->props.state & BL_CORE_FBBLANK) | ||
| 42 | value &= ~ADX_BACKLIGHT_CONTROL_ENABLE; | ||
| 43 | else | ||
| 44 | value |= ADX_BACKLIGHT_CONTROL_ENABLE; | ||
| 45 | |||
| 46 | writel(value, bl->base + ADX_BACKLIGHT_CONTROL); | ||
| 47 | |||
| 48 | return 0; | ||
| 49 | } | ||
| 50 | |||
| 51 | static int adx_backlight_get_brightness(struct backlight_device *bldev) | ||
| 52 | { | ||
| 53 | struct adxbl *bl = bl_get_data(bldev); | ||
| 54 | u32 brightness; | ||
| 55 | |||
| 56 | brightness = readl(bl->base + ADX_BACKLIGHT_BRIGHTNESS); | ||
| 57 | return brightness & 0xff; | ||
| 58 | } | ||
| 59 | |||
| 60 | static int adx_backlight_check_fb(struct backlight_device *bldev, struct fb_info *fb) | ||
| 61 | { | ||
| 62 | return 1; | ||
| 63 | } | ||
| 64 | |||
| 65 | static const struct backlight_ops adx_backlight_ops = { | ||
| 66 | .options = 0, | ||
| 67 | .update_status = adx_backlight_update_status, | ||
| 68 | .get_brightness = adx_backlight_get_brightness, | ||
| 69 | .check_fb = adx_backlight_check_fb, | ||
| 70 | }; | ||
| 71 | |||
| 72 | static int __devinit adx_backlight_probe(struct platform_device *pdev) | ||
| 73 | { | ||
| 74 | struct backlight_properties props; | ||
| 75 | struct backlight_device *bldev; | ||
| 76 | struct resource *res; | ||
| 77 | struct adxbl *bl; | ||
| 78 | int ret = 0; | ||
| 79 | |||
| 80 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
| 81 | if (!res) { | ||
| 82 | ret = -ENXIO; | ||
| 83 | goto out; | ||
| 84 | } | ||
| 85 | |||
| 86 | res = devm_request_mem_region(&pdev->dev, res->start, | ||
| 87 | resource_size(res), res->name); | ||
| 88 | if (!res) { | ||
| 89 | ret = -ENXIO; | ||
| 90 | goto out; | ||
| 91 | } | ||
| 92 | |||
| 93 | bl = devm_kzalloc(&pdev->dev, sizeof(*bl), GFP_KERNEL); | ||
| 94 | if (!bl) { | ||
| 95 | ret = -ENOMEM; | ||
| 96 | goto out; | ||
| 97 | } | ||
| 98 | |||
| 99 | bl->base = devm_ioremap_nocache(&pdev->dev, res->start, | ||
| 100 | resource_size(res)); | ||
| 101 | if (!bl->base) { | ||
| 102 | ret = -ENXIO; | ||
| 103 | goto out; | ||
| 104 | } | ||
| 105 | |||
| 106 | memset(&props, 0, sizeof(struct backlight_properties)); | ||
| 107 | props.type = BACKLIGHT_RAW; | ||
| 108 | props.max_brightness = 0xff; | ||
| 109 | bldev = backlight_device_register(dev_name(&pdev->dev), &pdev->dev, | ||
| 110 | bl, &adx_backlight_ops, &props); | ||
| 111 | if (IS_ERR(bldev)) { | ||
| 112 | ret = PTR_ERR(bldev); | ||
| 113 | goto out; | ||
| 114 | } | ||
| 115 | |||
| 116 | bldev->props.brightness = 0xff; | ||
| 117 | bldev->props.power = FB_BLANK_UNBLANK; | ||
| 118 | |||
| 119 | platform_set_drvdata(pdev, bldev); | ||
| 120 | |||
| 121 | out: | ||
| 122 | return ret; | ||
| 123 | } | ||
| 124 | |||
| 125 | static int __devexit adx_backlight_remove(struct platform_device *pdev) | ||
| 126 | { | ||
| 127 | struct backlight_device *bldev; | ||
| 128 | int ret = 0; | ||
| 129 | |||
| 130 | bldev = platform_get_drvdata(pdev); | ||
| 131 | bldev->props.power = FB_BLANK_UNBLANK; | ||
| 132 | bldev->props.brightness = 0xff; | ||
| 133 | backlight_update_status(bldev); | ||
| 134 | backlight_device_unregister(bldev); | ||
| 135 | platform_set_drvdata(pdev, NULL); | ||
| 136 | |||
| 137 | return ret; | ||
| 138 | } | ||
| 139 | |||
| 140 | #ifdef CONFIG_PM | ||
| 141 | static int adx_backlight_suspend(struct platform_device *pdev, | ||
| 142 | pm_message_t state) | ||
| 143 | { | ||
| 144 | return 0; | ||
| 145 | } | ||
| 146 | |||
| 147 | static int adx_backlight_resume(struct platform_device *pdev) | ||
| 148 | { | ||
| 149 | return 0; | ||
| 150 | } | ||
| 151 | #else | ||
| 152 | #define adx_backlight_suspend NULL | ||
| 153 | #define adx_backlight_resume NULL | ||
| 154 | #endif | ||
| 155 | |||
| 156 | static struct platform_driver adx_backlight_driver = { | ||
| 157 | .probe = adx_backlight_probe, | ||
| 158 | .remove = __devexit_p(adx_backlight_remove), | ||
| 159 | .suspend = adx_backlight_suspend, | ||
| 160 | .resume = adx_backlight_resume, | ||
| 161 | .driver = { | ||
| 162 | .name = "adx-backlight", | ||
| 163 | .owner = THIS_MODULE, | ||
| 164 | }, | ||
| 165 | }; | ||
| 166 | |||
| 167 | static int __init adx_backlight_init(void) | ||
| 168 | { | ||
| 169 | return platform_driver_register(&adx_backlight_driver); | ||
| 170 | } | ||
| 171 | |||
| 172 | static void __exit adx_backlight_exit(void) | ||
| 173 | { | ||
| 174 | platform_driver_unregister(&adx_backlight_driver); | ||
| 175 | } | ||
| 176 | |||
| 177 | module_init(adx_backlight_init); | ||
| 178 | module_exit(adx_backlight_exit); | ||
| 179 | |||
| 180 | MODULE_AUTHOR("Thierry Reding <thierry.reding@avionic-design.de>"); | ||
| 181 | MODULE_DESCRIPTION("Avionic Design Xanthos Backlight Driver"); | ||
| 182 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/drivers/video/backlight/progear_bl.c b/drivers/video/backlight/progear_bl.c new file mode 100644 index 00000000000..6af183d6465 --- /dev/null +++ b/drivers/video/backlight/progear_bl.c | |||
| @@ -0,0 +1,160 @@ | |||
| 1 | /* | ||
| 2 | * Backlight Driver for Frontpath ProGear HX1050+ | ||
| 3 | * | ||
| 4 | * Copyright (c) 2006 Marcin Juszkiewicz | ||
| 5 | * | ||
| 6 | * Based on Progear LCD driver by M Schacht | ||
| 7 | * <mschacht at alumni dot washington dot edu> | ||
| 8 | * | ||
| 9 | * Based on Sharp's Corgi Backlight Driver | ||
| 10 | * Based on Backlight Driver for HP Jornada 680 | ||
| 11 | * | ||
| 12 | * This program is free software; you can redistribute it and/or modify | ||
| 13 | * it under the terms of the GNU General Public License version 2 as | ||
| 14 | * published by the Free Software Foundation. | ||
| 15 | * | ||
| 16 | */ | ||
| 17 | |||
| 18 | #include <linux/module.h> | ||
| 19 | #include <linux/kernel.h> | ||
| 20 | #include <linux/init.h> | ||
| 21 | #include <linux/platform_device.h> | ||
| 22 | #include <linux/mutex.h> | ||
| 23 | #include <linux/fb.h> | ||
| 24 | #include <linux/backlight.h> | ||
| 25 | #include <linux/pci.h> | ||
| 26 | |||
| 27 | #define PMU_LPCR 0xB0 | ||
| 28 | #define SB_MPS1 0x61 | ||
| 29 | #define HW_LEVEL_MAX 0x77 | ||
| 30 | #define HW_LEVEL_MIN 0x4f | ||
| 31 | |||
| 32 | static struct pci_dev *pmu_dev = NULL; | ||
| 33 | static struct pci_dev *sb_dev = NULL; | ||
| 34 | |||
| 35 | static int progearbl_set_intensity(struct backlight_device *bd) | ||
| 36 | { | ||
| 37 | int intensity = bd->props.brightness; | ||
| 38 | |||
| 39 | if (bd->props.power != FB_BLANK_UNBLANK) | ||
| 40 | intensity = 0; | ||
| 41 | if (bd->props.fb_blank != FB_BLANK_UNBLANK) | ||
| 42 | intensity = 0; | ||
| 43 | |||
| 44 | pci_write_config_byte(pmu_dev, PMU_LPCR, intensity + HW_LEVEL_MIN); | ||
| 45 | |||
| 46 | return 0; | ||
| 47 | } | ||
| 48 | |||
| 49 | static int progearbl_get_intensity(struct backlight_device *bd) | ||
| 50 | { | ||
| 51 | u8 intensity; | ||
| 52 | pci_read_config_byte(pmu_dev, PMU_LPCR, &intensity); | ||
| 53 | |||
| 54 | return intensity - HW_LEVEL_MIN; | ||
| 55 | } | ||
| 56 | |||
| 57 | static const struct backlight_ops progearbl_ops = { | ||
| 58 | .get_brightness = progearbl_get_intensity, | ||
| 59 | .update_status = progearbl_set_intensity, | ||
| 60 | }; | ||
| 61 | |||
| 62 | static int progearbl_probe(struct platform_device *pdev) | ||
| 63 | { | ||
| 64 | struct backlight_properties props; | ||
| 65 | u8 temp; | ||
| 66 | struct backlight_device *progear_backlight_device; | ||
| 67 | int ret; | ||
| 68 | |||
| 69 | pmu_dev = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101, NULL); | ||
| 70 | if (!pmu_dev) { | ||
| 71 | printk("ALI M7101 PMU not found.\n"); | ||
| 72 | return -ENODEV; | ||
| 73 | } | ||
| 74 | |||
| 75 | sb_dev = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, NULL); | ||
| 76 | if (!sb_dev) { | ||
| 77 | printk("ALI 1533 SB not found.\n"); | ||
| 78 | ret = -ENODEV; | ||
| 79 | goto put_pmu; | ||
| 80 | } | ||
| 81 | |||
| 82 | /* Set SB_MPS1 to enable brightness control. */ | ||
| 83 | pci_read_config_byte(sb_dev, SB_MPS1, &temp); | ||
| 84 | pci_write_config_byte(sb_dev, SB_MPS1, temp | 0x20); | ||
| 85 | |||
| 86 | memset(&props, 0, sizeof(struct backlight_properties)); | ||
| 87 | props.type = BACKLIGHT_RAW; | ||
| 88 | props.max_brightness = HW_LEVEL_MAX - HW_LEVEL_MIN; | ||
| 89 | progear_backlight_device = backlight_device_register("progear-bl", | ||
| 90 | &pdev->dev, NULL, | ||
| 91 | &progearbl_ops, | ||
| 92 | &props); | ||
| 93 | if (IS_ERR(progear_backlight_device)) { | ||
| 94 | ret = PTR_ERR(progear_backlight_device); | ||
| 95 | goto put_sb; | ||
| 96 | } | ||
| 97 | |||
| 98 | platform_set_drvdata(pdev, progear_backlight_device); | ||
| 99 | |||
| 100 | progear_backlight_device->props.power = FB_BLANK_UNBLANK; | ||
| 101 | progear_backlight_device->props.brightness = HW_LEVEL_MAX - HW_LEVEL_MIN; | ||
| 102 | progearbl_set_intensity(progear_backlight_device); | ||
| 103 | |||
| 104 | return 0; | ||
| 105 | put_sb: | ||
| 106 | pci_dev_put(sb_dev); | ||
| 107 | put_pmu: | ||
| 108 | pci_dev_put(pmu_dev); | ||
| 109 | return ret; | ||
| 110 | } | ||
| 111 | |||
| 112 | static int progearbl_remove(struct platform_device *pdev) | ||
| 113 | { | ||
| 114 | struct backlight_device *bd = platform_get_drvdata(pdev); | ||
| 115 | backlight_device_unregister(bd); | ||
| 116 | |||
| 117 | return 0; | ||
| 118 | } | ||
| 119 | |||
| 120 | static struct platform_driver progearbl_driver = { | ||
| 121 | .probe = progearbl_probe, | ||
| 122 | .remove = progearbl_remove, | ||
| 123 | .driver = { | ||
| 124 | .name = "progear-bl", | ||
| 125 | }, | ||
| 126 | }; | ||
| 127 | |||
| 128 | static struct platform_device *progearbl_device; | ||
| 129 | |||
| 130 | static int __init progearbl_init(void) | ||
| 131 | { | ||
| 132 | int ret = platform_driver_register(&progearbl_driver); | ||
| 133 | |||
| 134 | if (ret) | ||
| 135 | return ret; | ||
| 136 | progearbl_device = platform_device_register_simple("progear-bl", -1, | ||
| 137 | NULL, 0); | ||
| 138 | if (IS_ERR(progearbl_device)) { | ||
| 139 | platform_driver_unregister(&progearbl_driver); | ||
| 140 | return PTR_ERR(progearbl_device); | ||
| 141 | } | ||
| 142 | |||
| 143 | return 0; | ||
| 144 | } | ||
| 145 | |||
| 146 | static void __exit progearbl_exit(void) | ||
| 147 | { | ||
| 148 | pci_dev_put(pmu_dev); | ||
| 149 | pci_dev_put(sb_dev); | ||
| 150 | |||
| 151 | platform_device_unregister(progearbl_device); | ||
| 152 | platform_driver_unregister(&progearbl_driver); | ||
| 153 | } | ||
| 154 | |||
| 155 | module_init(progearbl_init); | ||
| 156 | module_exit(progearbl_exit); | ||
| 157 | |||
| 158 | MODULE_AUTHOR("Marcin Juszkiewicz <linux@hrw.one.pl>"); | ||
| 159 | MODULE_DESCRIPTION("ProGear Backlight Driver"); | ||
| 160 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/video/backlight/tegra_pwm_bl.c b/drivers/video/backlight/tegra_pwm_bl.c new file mode 100644 index 00000000000..4be691c54d3 --- /dev/null +++ b/drivers/video/backlight/tegra_pwm_bl.c | |||
| @@ -0,0 +1,177 @@ | |||
| 1 | /* | ||
| 2 | * linux/drivers/video/backlight/tegra_pwm_bl.c | ||
| 3 | * | ||
| 4 | * Tegra pwm backlight driver | ||
| 5 | * | ||
| 6 | * Copyright (C) 2011 NVIDIA Corporation | ||
| 7 | * Author: Renuka Apte <rapte@nvidia.com> | ||
| 8 | * | ||
| 9 | * This program is free software; you can redistribute it and/or modify | ||
| 10 | * it under the terms of the GNU General Public License version 2 as | ||
| 11 | * published by the Free Software Foundation. | ||
| 12 | */ | ||
| 13 | |||
| 14 | #include <linux/module.h> | ||
| 15 | #include <linux/kernel.h> | ||
| 16 | #include <linux/init.h> | ||
| 17 | #include <linux/platform_device.h> | ||
| 18 | #include <linux/fb.h> | ||
| 19 | #include <linux/backlight.h> | ||
| 20 | #include <linux/err.h> | ||
| 21 | #include <linux/slab.h> | ||
| 22 | #include <linux/tegra_pwm_bl.h> | ||
| 23 | #include <mach/dc.h> | ||
| 24 | |||
| 25 | struct tegra_pwm_bl_data { | ||
| 26 | struct device *dev; | ||
| 27 | int which_dc; | ||
| 28 | int (*notify)(struct device *, int brightness); | ||
| 29 | struct tegra_dc_pwm_params params; | ||
| 30 | int (*check_fb)(struct device *dev, struct fb_info *info); | ||
| 31 | }; | ||
| 32 | |||
| 33 | static int tegra_pwm_backlight_update_status(struct backlight_device *bl) | ||
| 34 | { | ||
| 35 | struct tegra_pwm_bl_data *tbl = dev_get_drvdata(&bl->dev); | ||
| 36 | int brightness = bl->props.brightness; | ||
| 37 | int max = bl->props.max_brightness; | ||
| 38 | struct tegra_dc *dc; | ||
| 39 | |||
| 40 | if (bl->props.power != FB_BLANK_UNBLANK) | ||
| 41 | brightness = 0; | ||
| 42 | |||
| 43 | if (bl->props.fb_blank != FB_BLANK_UNBLANK) | ||
| 44 | brightness = 0; | ||
| 45 | |||
| 46 | if (tbl->notify) | ||
| 47 | brightness = tbl->notify(tbl->dev, brightness); | ||
| 48 | |||
| 49 | if (brightness > max) | ||
| 50 | dev_err(&bl->dev, "Invalid brightness value: %d max: %d\n", | ||
| 51 | brightness, max); | ||
| 52 | |||
| 53 | #if defined(CONFIG_ARCH_TEGRA_2x_SOC) | ||
| 54 | /* map API brightness range from (0~255) to hw range (0~128) */ | ||
| 55 | tbl->params.duty_cycle = (brightness * 128) / 255; | ||
| 56 | #else | ||
| 57 | tbl->params.duty_cycle = brightness & 0xFF; | ||
| 58 | #endif | ||
| 59 | |||
| 60 | /* Call tegra display controller function to update backlight */ | ||
| 61 | dc = tegra_dc_get_dc(tbl->which_dc); | ||
| 62 | if (dc) | ||
| 63 | tegra_dc_config_pwm(dc, &tbl->params); | ||
| 64 | else | ||
| 65 | dev_err(&bl->dev, "tegra display controller not available\n"); | ||
| 66 | |||
| 67 | return 0; | ||
| 68 | } | ||
| 69 | |||
| 70 | static int tegra_pwm_backlight_get_brightness(struct backlight_device *bl) | ||
| 71 | { | ||
| 72 | return bl->props.brightness; | ||
| 73 | } | ||
| 74 | |||
| 75 | static int tegra_pwm_backlight_check_fb(struct backlight_device *bl, | ||
| 76 | struct fb_info *info) | ||
| 77 | { | ||
| 78 | struct tegra_pwm_bl_data *tbl = dev_get_drvdata(&bl->dev); | ||
| 79 | return !tbl->check_fb || tbl->check_fb(tbl->dev, info); | ||
| 80 | } | ||
| 81 | |||
| 82 | static const struct backlight_ops tegra_pwm_backlight_ops = { | ||
| 83 | .update_status = tegra_pwm_backlight_update_status, | ||
| 84 | .get_brightness = tegra_pwm_backlight_get_brightness, | ||
| 85 | .check_fb = tegra_pwm_backlight_check_fb, | ||
| 86 | }; | ||
| 87 | |||
| 88 | static int tegra_pwm_backlight_probe(struct platform_device *pdev) | ||
| 89 | { | ||
| 90 | struct backlight_properties props; | ||
| 91 | struct platform_tegra_pwm_backlight_data *data; | ||
| 92 | struct backlight_device *bl; | ||
| 93 | struct tegra_pwm_bl_data *tbl; | ||
| 94 | int ret; | ||
| 95 | |||
| 96 | data = pdev->dev.platform_data; | ||
| 97 | if (!data) { | ||
| 98 | dev_err(&pdev->dev, "failed to find platform data\n"); | ||
| 99 | return -EINVAL; | ||
| 100 | } | ||
| 101 | |||
| 102 | tbl = kzalloc(sizeof(*tbl), GFP_KERNEL); | ||
| 103 | if (!tbl) { | ||
| 104 | dev_err(&pdev->dev, "no memory for state\n"); | ||
| 105 | ret = -ENOMEM; | ||
| 106 | goto err_alloc; | ||
| 107 | } | ||
| 108 | |||
| 109 | tbl->dev = &pdev->dev; | ||
| 110 | tbl->which_dc = data->which_dc; | ||
| 111 | tbl->notify = data->notify; | ||
| 112 | tbl->check_fb = data->check_fb; | ||
| 113 | tbl->params.which_pwm = data->which_pwm; | ||
| 114 | tbl->params.gpio_conf_to_sfio = data->gpio_conf_to_sfio; | ||
| 115 | tbl->params.switch_to_sfio = data->switch_to_sfio; | ||
| 116 | tbl->params.period = data->period; | ||
| 117 | tbl->params.clk_div = data->clk_div; | ||
| 118 | tbl->params.clk_select = data->clk_select; | ||
| 119 | |||
| 120 | memset(&props, 0, sizeof(struct backlight_properties)); | ||
| 121 | props.type = BACKLIGHT_RAW; | ||
| 122 | props.max_brightness = data->max_brightness; | ||
| 123 | bl = backlight_device_register(dev_name(&pdev->dev), &pdev->dev, tbl, | ||
| 124 | &tegra_pwm_backlight_ops, &props); | ||
| 125 | if (IS_ERR(bl)) { | ||
| 126 | dev_err(&pdev->dev, "failed to register backlight\n"); | ||
| 127 | ret = PTR_ERR(bl); | ||
| 128 | goto err_bl; | ||
| 129 | } | ||
| 130 | |||
| 131 | bl->props.brightness = data->dft_brightness; | ||
| 132 | backlight_update_status(bl); | ||
| 133 | |||
| 134 | platform_set_drvdata(pdev, bl); | ||
| 135 | return 0; | ||
| 136 | |||
| 137 | err_bl: | ||
| 138 | kfree(tbl); | ||
| 139 | err_alloc: | ||
| 140 | return ret; | ||
| 141 | } | ||
| 142 | |||
| 143 | static int tegra_pwm_backlight_remove(struct platform_device *pdev) | ||
| 144 | { | ||
| 145 | struct backlight_device *bl = platform_get_drvdata(pdev); | ||
| 146 | struct tegra_pwm_bl_data *tbl = dev_get_drvdata(&bl->dev); | ||
| 147 | |||
| 148 | backlight_device_unregister(bl); | ||
| 149 | kfree(tbl); | ||
| 150 | return 0; | ||
| 151 | } | ||
| 152 | |||
| 153 | static struct platform_driver tegra_pwm_backlight_driver = { | ||
| 154 | .driver = { | ||
| 155 | .name = "tegra-pwm-bl", | ||
| 156 | .owner = THIS_MODULE, | ||
| 157 | }, | ||
| 158 | .probe = tegra_pwm_backlight_probe, | ||
| 159 | .remove = tegra_pwm_backlight_remove, | ||
| 160 | }; | ||
| 161 | |||
| 162 | static int __init tegra_pwm_backlight_init(void) | ||
| 163 | { | ||
| 164 | return platform_driver_register(&tegra_pwm_backlight_driver); | ||
| 165 | } | ||
| 166 | late_initcall(tegra_pwm_backlight_init); | ||
| 167 | |||
| 168 | static void __exit tegra_pwm_backlight_exit(void) | ||
| 169 | { | ||
| 170 | platform_driver_unregister(&tegra_pwm_backlight_driver); | ||
| 171 | } | ||
| 172 | module_exit(tegra_pwm_backlight_exit); | ||
| 173 | |||
| 174 | MODULE_DESCRIPTION("Tegra PWM Backlight Driver"); | ||
| 175 | MODULE_LICENSE("GPL"); | ||
| 176 | MODULE_ALIAS("platform:tegra-pwm-backlight"); | ||
| 177 | |||
