Changeset 11252


Ignore:
Timestamp:
2008-05-24T09:14:13+02:00 (8 years ago)
Author:
juhosg
Message:

[ixp4xx] move the latch-led driver into a separated patch

Location:
trunk/target/linux/ixp4xx/patches-2.6.25
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/target/linux/ixp4xx/patches-2.6.25/301-avila_led.patch

    r11250 r11252  
    1 diff -ruN clean/linux-2.6.25.4/arch/arm/mach-ixp4xx/avila-setup.c linux-2.6.25.4/arch/arm/mach-ixp4xx/avila-setup.c 
    2 --- clean/linux-2.6.25.4/arch/arm/mach-ixp4xx/avila-setup.c     2008-05-20 09:18:21.000000000 -0700 
    3 +++ linux-2.6.25.4/arch/arm/mach-ixp4xx/avila-setup.c   2008-05-20 09:31:55.000000000 -0700 
     1Index: linux-2.6.25.4/arch/arm/mach-ixp4xx/avila-setup.c 
     2=================================================================== 
     3--- linux-2.6.25.4.orig/arch/arm/mach-ixp4xx/avila-setup.c 
     4+++ linux-2.6.25.4/arch/arm/mach-ixp4xx/avila-setup.c 
    45@@ -26,6 +26,7 @@ 
    56 # include <linux/eeprom.h> 
     
    1011  
    1112 #include <asm/types.h> 
    12 @@ -172,6 +173,72 @@ 
     13@@ -172,6 +173,72 @@ static struct platform_device avila_npec 
    1314        .dev.platform_data      = &avila_npec_data, 
    1415 }; 
     
    8384        &avila_i2c_gpio, 
    8485        &avila_flash, 
    85 @@ -182,6 +249,8 @@ 
     86@@ -182,6 +249,8 @@ static void __init avila_gw23xx_setup(vo 
    8687 { 
    8788        platform_device_register(&avila_npeb_device); 
     
    9293  
    9394 #ifdef CONFIG_SENSORS_EEPROM 
    94 @@ -189,6 +258,8 @@ 
     95@@ -189,6 +258,8 @@ static void __init avila_gw2342_setup(vo 
    9596 { 
    9697        platform_device_register(&avila_npeb_device); 
     
    101102  
    102103 static void __init avila_gw2345_setup(void) 
    103 @@ -199,22 +270,30 @@ 
     104@@ -199,22 +270,30 @@ static void __init avila_gw2345_setup(vo 
    104105  
    105106        avila_npec_data.phy = 5; /* port 5 of the KS8995 switch */ 
     
    132133  
    133134 static void __init avila_gw2355_setup(void) 
    134 @@ -225,11 +304,29 @@ 
     135@@ -225,11 +304,29 @@ static void __init avila_gw2355_setup(vo 
    135136  
    136137        avila_npec_data.phy = 16; 
     
    162163  
    163164 static struct avila_board_info avila_boards[] __initdata = { 
    164 diff -ruN clean/linux-2.6.25.4/drivers/leds/Kconfig linux-2.6.25.4/drivers/leds/Kconfig 
    165 --- clean/linux-2.6.25.4/drivers/leds/Kconfig   2008-05-15 08:00:12.000000000 -0700 
    166 +++ linux-2.6.25.4/drivers/leds/Kconfig 2008-05-20 09:25:15.000000000 -0700 
    167 @@ -113,6 +113,12 @@ 
    168           outputs. To be useful the particular board must have LEDs 
    169           and they must be connected to the GPIO lines. 
    170   
    171 +config LEDS_LATCH 
    172 +       tristate "LED Support for Memory Latched LEDs" 
    173 +       depends on LEDS_CLASS 
    174 +       help 
    175 +               -- To Do -- 
    176 + 
    177  config LEDS_CM_X270 
    178         tristate "LED Support for the CM-X270 LEDs" 
    179         depends on LEDS_CLASS && MACH_ARMCORE 
    180 diff -ruN clean/linux-2.6.25.4/drivers/leds/leds-latch.c linux-2.6.25.4/drivers/leds/leds-latch.c 
    181 --- clean/linux-2.6.25.4/drivers/leds/leds-latch.c      1969-12-31 16:00:00.000000000 -0800 
    182 +++ linux-2.6.25.4/drivers/leds/leds-latch.c    2008-04-30 14:03:21.000000000 -0700 
    183 @@ -0,0 +1,141 @@ 
    184 +/* 
    185 + * LEDs driver for Memory Latched Devices 
    186 + * 
    187 + * Copyright (C) 2008 Gateworks Corp. 
    188 + * Chris Lang <clang@gateworks.com> 
    189 + * 
    190 + * This program is free software; you can redistribute it and/or modify 
    191 + * it under the terms of the GNU General Public License version 2 as 
    192 + * published by the Free Software Foundation. 
    193 + * 
    194 + */ 
    195 +#include <linux/kernel.h> 
    196 +#include <linux/init.h> 
    197 +#include <linux/platform_device.h> 
    198 +#include <linux/leds.h> 
    199 +#include <linux/workqueue.h> 
    200 +#include <asm/io.h> 
    201 +#include <linux/spinlock.h> 
    202 + 
    203 +static unsigned int mem_keep = 0xFF; 
    204 +static spinlock_t mem_lock; 
    205 +static unsigned char *iobase; 
    206 + 
    207 +struct latch_led_data { 
    208 +       struct led_classdev cdev; 
    209 +       struct work_struct work; 
    210 +       u8 new_level; 
    211 +       u8 bit; 
    212 +}; 
    213 + 
    214 +static void latch_led_set(struct led_classdev *led_cdev, 
    215 +       enum led_brightness value) 
    216 +{ 
    217 +       struct latch_led_data *led_dat = 
    218 +               container_of(led_cdev, struct latch_led_data, cdev); 
    219 + 
    220 +       spin_lock(mem_lock); 
    221 + 
    222 +       if (value == LED_OFF) 
    223 +               mem_keep |= (0x1 << led_dat->bit); 
    224 +       else 
    225 +               mem_keep &= ~(0x1 << led_dat->bit); 
    226 + 
    227 +       writeb(mem_keep, iobase); 
    228 + 
    229 +       spin_unlock(mem_lock); 
    230 +} 
    231 + 
    232 +static int latch_led_probe(struct platform_device *pdev) 
    233 +{ 
    234 +       struct latch_led_platform_data *pdata = pdev->dev.platform_data; 
    235 +       struct latch_led *cur_led; 
    236 +       struct latch_led_data *leds_data, *led_dat; 
    237 +       int i, ret = 0; 
    238 + 
    239 +       if (!pdata) 
    240 +               return -EBUSY; 
    241 + 
    242 +       leds_data = kzalloc(sizeof(struct latch_led_data) * pdata->num_leds, 
    243 +                               GFP_KERNEL); 
    244 +       if (!leds_data) 
    245 +               return -ENOMEM; 
    246 + 
    247 +       iobase = ioremap_nocache(pdata->mem, 0x1000); 
    248 +       writeb(0xFF, iobase); 
    249 + 
    250 +       for (i = 0; i < pdata->num_leds; i++) { 
    251 +               cur_led = &pdata->leds[i]; 
    252 +               led_dat = &leds_data[i]; 
    253 + 
    254 +               led_dat->cdev.name = cur_led->name; 
    255 +               led_dat->cdev.default_trigger = cur_led->default_trigger; 
    256 +               led_dat->cdev.brightness_set = latch_led_set; 
    257 +               led_dat->cdev.brightness = LED_OFF; 
    258 +               led_dat->bit = cur_led->bit; 
    259 + 
    260 +               ret = led_classdev_register(&pdev->dev, &led_dat->cdev); 
    261 +               if (ret < 0) { 
    262 +                       goto err; 
    263 +               } 
    264 +       } 
    265 + 
    266 +       platform_set_drvdata(pdev, leds_data); 
    267 + 
    268 +       return 0; 
    269 + 
    270 +err: 
    271 +       if (i > 0) { 
    272 +               for (i = i - 1; i >= 0; i--) { 
    273 +                       led_classdev_unregister(&leds_data[i].cdev); 
    274 +               } 
    275 +       } 
    276 + 
    277 +       kfree(leds_data); 
    278 + 
    279 +       return ret; 
    280 +} 
    281 + 
    282 +static int __devexit latch_led_remove(struct platform_device *pdev) 
    283 +{ 
    284 +       int i; 
    285 +       struct latch_led_platform_data *pdata = pdev->dev.platform_data; 
    286 +       struct latch_led_data *leds_data; 
    287 + 
    288 +       leds_data = platform_get_drvdata(pdev); 
    289 + 
    290 +       for (i = 0; i < pdata->num_leds; i++) { 
    291 +               led_classdev_unregister(&leds_data[i].cdev); 
    292 +               cancel_work_sync(&leds_data[i].work); 
    293 +       } 
    294 + 
    295 +       kfree(leds_data); 
    296 + 
    297 +       return 0; 
    298 +} 
    299 + 
    300 +static struct platform_driver latch_led_driver = { 
    301 +       .probe          = latch_led_probe, 
    302 +       .remove         = __devexit_p(latch_led_remove), 
    303 +       .driver         = { 
    304 +               .name   = "leds-latch", 
    305 +               .owner  = THIS_MODULE, 
    306 +       }, 
    307 +}; 
    308 + 
    309 +static int __init latch_led_init(void) 
    310 +{ 
    311 +       return platform_driver_register(&latch_led_driver); 
    312 +} 
    313 + 
    314 +static void __exit latch_led_exit(void) 
    315 +{ 
    316 +       platform_driver_unregister(&latch_led_driver); 
    317 +} 
    318 + 
    319 +module_init(latch_led_init); 
    320 +module_exit(latch_led_exit); 
    321 + 
    322 +MODULE_AUTHOR("Chris Lang <clang@gateworks.com>"); 
    323 +MODULE_DESCRIPTION("Latch LED driver"); 
    324 +MODULE_LICENSE("GPL"); 
    325 diff -ruN clean/linux-2.6.25.4/drivers/leds/Makefile linux-2.6.25.4/drivers/leds/Makefile 
    326 --- clean/linux-2.6.25.4/drivers/leds/Makefile  2008-05-15 08:00:12.000000000 -0700 
    327 +++ linux-2.6.25.4/drivers/leds/Makefile        2008-05-20 09:26:14.000000000 -0700 
    328 @@ -18,6 +18,7 @@ 
    329  obj-$(CONFIG_LEDS_COBALT_QUBE)         += leds-cobalt-qube.o 
    330  obj-$(CONFIG_LEDS_COBALT_RAQ)          += leds-cobalt-raq.o 
    331  obj-$(CONFIG_LEDS_GPIO)                        += leds-gpio.o 
    332 +obj-$(CONFIG_LEDS_LATCH)     += leds-latch.o 
    333  obj-$(CONFIG_LEDS_CM_X270)              += leds-cm-x270.o 
    334  obj-$(CONFIG_LEDS_CLEVO_MAIL)          += leds-clevo-mail.o 
    335  obj-$(CONFIG_LEDS_HP6XX)               += leds-hp6xx.o 
    336 diff -ruN clean/linux-2.6.25.4/include/asm-arm/arch-ixp4xx/avila.h linux-2.6.25.4/include/asm-arm/arch-ixp4xx/avila.h 
    337 --- clean/linux-2.6.25.4/include/asm-arm/arch-ixp4xx/avila.h    2008-05-15 08:00:12.000000000 -0700 
    338 +++ linux-2.6.25.4/include/asm-arm/arch-ixp4xx/avila.h  2008-05-20 09:22:28.000000000 -0700 
     165Index: linux-2.6.25.4/include/asm-arm/arch-ixp4xx/avila.h 
     166=================================================================== 
     167--- linux-2.6.25.4.orig/include/asm-arm/arch-ixp4xx/avila.h 
     168+++ linux-2.6.25.4/include/asm-arm/arch-ixp4xx/avila.h 
    339169@@ -36,4 +36,6 @@ 
    340170 #define AVILA_PCI_INTC_PIN     9 
     
    345175+#define AVILA_GW23XX_LED_USER_GPIO     3 
    346176+#define AVILA_GW23X7_LED_USER_GPIO     4 
    347 diff -ruN clean/linux-2.6.25.4/include/linux/leds.h linux-2.6.25.4/include/linux/leds.h 
    348 --- clean/linux-2.6.25.4/include/linux/leds.h   2008-05-15 08:00:12.000000000 -0700 
    349 +++ linux-2.6.25.4/include/linux/leds.h 2008-05-20 09:32:35.000000000 -0700 
    350 @@ -136,5 +136,18 @@ 
    351         struct gpio_led *leds; 
    352  }; 
    353   
    354 +/* For the leds-latch driver */ 
    355 +struct latch_led { 
    356 +       const char *name; 
    357 +       char *default_trigger; 
    358 +       unsigned  bit; 
    359 +}; 
    360 + 
    361 +struct latch_led_platform_data { 
    362 +       int     num_leds; 
    363 +       u32     mem; 
    364 +       struct latch_led *leds; 
    365 +}; 
    366 + 
    367   
    368  #endif         /* __LINUX_LEDS_H_INCLUDED */ 
Note: See TracChangeset for help on using the changeset viewer.