r3197 - branches/src/target/kernel/2.6.23.x/patches
shoragan at sita.openmoko.org
shoragan at sita.openmoko.org
Tue Oct 16 19:54:35 CEST 2007
Author: shoragan
Date: 2007-10-16 19:54:28 +0200 (Tue, 16 Oct 2007)
New Revision: 3197
Added:
branches/src/target/kernel/2.6.23.x/patches/gta02-leds.patch
Removed:
branches/src/target/kernel/2.6.23.x/patches/gta02-leds.patch
Modified:
branches/src/target/kernel/2.6.23.x/patches/gta02-core.patch
branches/src/target/kernel/2.6.23.x/patches/series
Log:
Follow change in 2.6.22:
(orig r3181): laforge | 2007-10-15 18:44:47 +0200
Add GTA02 LED driver as well as required platform devices/resources
Modified: branches/src/target/kernel/2.6.23.x/patches/gta02-core.patch
===================================================================
--- branches/src/target/kernel/2.6.23.x/patches/gta02-core.patch 2007-10-16 17:27:14 UTC (rev 3196)
+++ branches/src/target/kernel/2.6.23.x/patches/gta02-core.patch 2007-10-16 17:54:28 UTC (rev 3197)
@@ -2,7 +2,7 @@
===================================================================
--- /dev/null
+++ linux-2.6.22/arch/arm/mach-s3c2440/mach-gta02.c
-@@ -0,0 +1,614 @@
+@@ -0,0 +1,636 @@
+/*
+ * linux/arch/arm/mach-s3c2440/mach-gta02.c
+ *
@@ -440,16 +440,37 @@
+ .board_info = gta02_spi_board_info,
+};
+
-+static struct resource gta02_led_resources[] = {
++static struct resource gta01_led_resources[] = {
+ [0] = {
+ .start = GTA02_GPIO_VIBRATOR_ON,
+ .end = GTA02_GPIO_VIBRATOR_ON,
+ },
-+ /* FIXME */
+};
+
++static struct platform_device gta01_led_dev = {
++ .name = "gta01-led",
++ .num_resources = ARRAY_SIZE(gta01_led_resources),
++ .resource = gta01_led_resources,
++};
++
++static struct resource gta02_led_resources[] = {
++ {
++ .name = "gta02-power:color",
++ .start = GTA02_GPIO_PWR_LED,
++ .end = GTA02_GPIO_PWR_LED,
++ }, {
++ .name = "gta02-aux:foo",
++ .start = GTA02_GPIO_AUX_LED1,
++ .end = GTA02_GPIO_AUX_LED1,
++ }, {
++ .name = "gta02-aux:bar",
++ .start = GTA02_GPIO_AUX_LED2,
++ .end = GTA02_GPIO_AUX_LED2,
++ },
++};
++
+struct platform_device gta02_led_dev = {
-+ .name = "gta01-led",
++ .name = "gta02-led",
+ .num_resources = ARRAY_SIZE(gta02_led_resources),
+ .resource = gta02_led_resources,
+};
@@ -589,6 +610,7 @@
+
+ mangle_pmu_pdata_by_system_rev();
+ platform_device_register(>a02_pmu_dev);
++ platform_device_register(>a01_led_dev);
+ platform_device_register(>a02_led_dev);
+
+ mangle_glamo_res_by_system_rev();
@@ -621,7 +643,7 @@
===================================================================
--- /dev/null
+++ linux-2.6.22/include/asm-arm/arch-s3c2410/gta02.h
-@@ -0,0 +1,94 @@
+@@ -0,0 +1,97 @@
+#ifndef _GTA02_H
+#define _GTA02_H
+
@@ -636,6 +658,9 @@
+
+#define GTA02_GPIO_n3DL_GSM S3C2410_GPA13 /* v1 + v2 + v3 only */
+
++#define GTA02_GPIO_AUX_LED1 S3C2410_GPB0
++#define GTA02_GPIO_AUX_LED2 S3C2410_GPB1
++#define GTA02_GPIO_PWR_LED S3C2410_GPB2
+#define GTA02_GPIO_VIBRATOR_ON S3C2410_GPB3
+#define GTA02v1_GPIO_GPS_PWRON S3C2410_GPB4 /* v1 only */
+#define GTA02_GPIO_MODEM_RST S3C2410_GPB5
@@ -978,9 +1003,9 @@
+MODULE_DESCRIPTION("FIC Neo1973 GSM Power Management");
Index: linux-2.6.22/drivers/leds/leds-gta01.c
===================================================================
---- linux-2.6.22.orig/drivers/leds/leds-gta01.c
-+++ linux-2.6.22/drivers/leds/leds-gta01.c
-@@ -71,7 +71,7 @@
+--- linux-2.6.22.5-moko.orig/drivers/leds/leds-gta01.c
++++ linux-2.6.22.5-moko/drivers/leds/leds-gta01.c
+@@ -111,7 +110,7 @@
struct gta01_vib_priv *vp;
struct resource *r;
@@ -993,7 +1018,7 @@
===================================================================
--- linux-2.6.22.orig/sound/soc/s3c24xx/neo1973_wm8753.c
+++ linux-2.6.22/sound/soc/s3c24xx/neo1973_wm8753.c
-@@ -638,6 +638,12 @@
+@@ -670,6 +670,12 @@
{
int ret;
@@ -1006,7 +1031,7 @@
neo1973_snd_device = platform_device_alloc("soc-audio", -1);
if (!neo1973_snd_device)
return -ENOMEM;
-@@ -666,5 +672,5 @@
+@@ -698,5 +704,5 @@
/* Module information */
MODULE_AUTHOR("Graeme Gregory, graeme.gregory at wolfsonmicro.com, www.wolfsonmicro.com");
Deleted: branches/src/target/kernel/2.6.23.x/patches/gta02-leds.patch
===================================================================
--- branches/src/target/kernel/2.6.23.x/patches/gta02-leds.patch 2007-10-16 17:27:14 UTC (rev 3196)
+++ branches/src/target/kernel/2.6.23.x/patches/gta02-leds.patch 2007-10-16 17:54:28 UTC (rev 3197)
@@ -1,97 +0,0 @@
-Index: linux-2.6.22/arch/arm/mach-s3c2440/mach-gta02.c
-===================================================================
---- linux-2.6.22.orig/arch/arm/mach-s3c2440/mach-gta02.c
-+++ linux-2.6.22/arch/arm/mach-s3c2440/mach-gta02.c
-@@ -541,17 +541,57 @@
- #endif
- #endif
-
--static struct s3c24xx_led_platdata gta02_led_pdata = {
-- .name = "gta02-vib",
-- .gpio = GTA02_GPIO_VIBRATOR_ON,
-- .def_trigger = "",
-+static struct s3c24xx_led_platdata gta02_led_pdata[] = {
-+ [0] = {
-+ .name = "gta02-led-pwr1",
-+ .gpio = GTA02_GPIO_LED_PWR1_ON,
-+ .def_trigger = "",
-+ },
-+ [1] = {
-+ .name = "gta02-led-pwr2",
-+ .gpio = GTA02_GPIO_LED_PWR2_ON,
-+ .def_trigger = "",
-+ },
-+ [2] = {
-+ .name = "gta02-led-aux",
-+ .gpio = GTA02_GPIO_LED_AUX_ON,
-+ .def_trigger = "",
-+ },
-+ [3] = {
-+ .name = "gta02-vib",
-+ .gpio = GTA02_GPIO_VIBRATOR_ON,
-+ .def_trigger = "",
-+ },
- };
-
--static struct platform_device gta02_led_dev = {
-- .name = "s3c24xx_led",
-- .id = 1,
-- .dev = {
-- .platform_data = >a02_led_pdata,
-+static struct platform_device gta02_led_dev[] = {
-+ [0] = {
-+ .name = "s3c24xx_led",
-+ .id = 0,
-+ .dev = {
-+ .platform_data = >a02_led_pdata[0],
-+ },
-+ },
-+ [1] = {
-+ .name = "s3c24xx_led",
-+ .id = 1,
-+ .dev = {
-+ .platform_data = >a02_led_pdata[1],
-+ },
-+ },
-+ [2] = {
-+ .name = "s3c24xx_led",
-+ .id = 2,
-+ .dev = {
-+ .platform_data = >a02_led_pdata[2],
-+ },
-+ },
-+ [3] = {
-+ .name = "s3c24xx_led",
-+ .id = 3,
-+ .dev = {
-+ .platform_data = >a02_led_pdata[3],
-+ },
- },
- };
-
-@@ -681,7 +721,10 @@
-
- mangle_pmu_pdata_by_system_rev();
- platform_device_register(>a02_pmu_dev);
-- platform_device_register(>a02_led_dev);
-+ platform_device_register(>a02_led_dev[0]);
-+ platform_device_register(>a02_led_dev[1]);
-+ platform_device_register(>a02_led_dev[2]);
-+ platform_device_register(>a02_led_dev[3]);
-
- mangle_glamo_res_by_system_rev();
- platform_device_register(>a02_glamo_dev);
-Index: linux-2.6.22/include/asm-arm/arch-s3c2410/gta02.h
-===================================================================
---- linux-2.6.22.orig/include/asm-arm/arch-s3c2410/gta02.h
-+++ linux-2.6.22/include/asm-arm/arch-s3c2410/gta02.h
-@@ -12,6 +12,9 @@
- #define GTA02_GPIO_3D_RESET S3C2440_GPJ0
- #define GTA02_GPIO_nSD_DETECT S3C2410_GPF5
- #define GTA02_GPIO_USB_PULLUP S3C2410_GPB9
-+#define GTA02_GPIO_LED_PWR1_ON S3C2410_GPB0
-+#define GTA02_GPIO_LED_PWR2_ON S3C2410_GPB1
-+#define GTA02_GPIO_LED_AUX_ON S3C2410_GPB2
- #define GTA02_GPIO_VIBRATOR_ON S3C2410_GPB3
- #define GTA02_GPIO_HOLD_KEY S3C2410_GPF7
- #define GTA02_GPIO_AUX_KEY S3C2410_GPF6
Added: branches/src/target/kernel/2.6.23.x/patches/gta02-leds.patch
===================================================================
--- branches/src/target/kernel/2.6.23.x/patches/gta02-leds.patch 2007-10-16 17:27:14 UTC (rev 3196)
+++ branches/src/target/kernel/2.6.23.x/patches/gta02-leds.patch 2007-10-16 17:54:28 UTC (rev 3197)
@@ -0,0 +1,250 @@
+Index: linux-2.6.23/drivers/leds/Kconfig
+===================================================================
+--- linux-2.6.23.orig/drivers/leds/Kconfig
++++ linux-2.6.23/drivers/leds/Kconfig
+@@ -107,6 +107,12 @@
+ help
+ This option enables support for the Vibrator on the FIC Neo1973.
+
++config LEDS_GTA02
++ tristate "LED Support for the FIC Neo1973 (GTA02)"
++ depends on LEDS_CLASS && MACH_NEO1973_GTA02
++ help
++ This option enables support for the LEDs on the FIC Neo1973.
++
+ comment "LED Triggers"
+
+ config LEDS_TRIGGERS
+Index: linux-2.6.23/drivers/leds/Makefile
+===================================================================
+--- linux-2.6.23.orig/drivers/leds/Makefile
++++ linux-2.6.23/drivers/leds/Makefile
+@@ -18,6 +18,7 @@
+ obj-$(CONFIG_LEDS_COBALT) += leds-cobalt.o
+ obj-$(CONFIG_LEDS_GPIO) += leds-gpio.o
+ obj-$(CONFIG_LEDS_GTA01) += leds-gta01.o
++obj-$(CONFIG_LEDS_GTA02) += leds-gta02.o
+
+ # LED Triggers
+ obj-$(CONFIG_LEDS_TRIGGER_TIMER) += ledtrig-timer.o
+Index: linux-2.6.23/drivers/leds/leds-gta02.c
+===================================================================
+--- /dev/null
++++ linux-2.6.23/drivers/leds/leds-gta02.c
+@@ -0,0 +1,216 @@
++/*
++ * LED driver for the FIC GTA02 (Neo1973) GSM Phone
++ *
++ * (C) 2006-2007 by OpenMoko, Inc.
++ * Author: Harald Welte <laforge at openmoko.org>
++ * All rights reserved.
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2 as
++ * published by the Free Software Foundation.
++ *
++ */
++
++#include <linux/kernel.h>
++#include <linux/init.h>
++#include <linux/platform_device.h>
++#include <linux/leds.h>
++#include <asm/hardware.h>
++#include <asm/mach-types.h>
++#include <asm/arch/pwm.h>
++#include <asm/arch/gta02.h>
++#include <asm/plat-s3c/regs-timer.h>
++
++#define MAX_LEDS 3
++#define COUNTER 256
++
++struct gta02_led_priv
++{
++ struct mutex mutex;
++ struct led_classdev cdev;
++ struct s3c2410_pwm pwm;
++ unsigned int gpio;
++ unsigned int has_pwm;
++};
++
++struct gta02_led_bundle
++{
++ int num_leds;
++ struct gta02_led_priv led[MAX_LEDS];
++};
++
++static inline struct gta02_led_priv *to_priv(struct led_classdev *led_cdev)
++{
++ return container_of(led_cdev, struct gta02_led_priv, cdev);
++}
++
++static inline struct gta02_led_bundle *to_bundle(struct led_classdev *led_cdev)
++{
++ return dev_get_drvdata(led_cdev->class_dev->dev);
++}
++
++static void gta02led_set(struct led_classdev *led_cdev,
++ enum led_brightness value)
++{
++ struct gta02_led_priv *lp = to_priv(led_cdev);
++
++ /*
++ * value == 255 -> 99% duty cycle (full power)
++ * value == 128 -> 50% duty cycle (medium power)
++ * value == 0 -> 0% duty cycle (zero power)
++ */
++ mutex_lock(&lp->mutex);
++ if (lp->has_pwm) {
++ s3c2410_pwm_duty_cycle(value, &lp->pwm);
++ } else {
++ if (value)
++ s3c2410_gpio_setpin(lp->gpio, 1);
++ else
++ s3c2410_gpio_setpin(lp->gpio, 0);
++ }
++ mutex_unlock(&lp->mutex);
++}
++
++#ifdef CONFIG_PM
++static int gta02led_suspend(struct platform_device *pdev, pm_message_t state)
++{
++ struct gta02_led_bundle *bundle = platform_get_drvdata(pdev);
++ int i;
++
++ for (i = 0; i < bundle->num_leds; i++)
++ led_classdev_suspend(&bundle->led[i].cdev);
++
++ return 0;
++}
++
++static int gta02led_resume(struct platform_device *pdev)
++{
++ struct gta02_led_bundle *bundle = platform_get_drvdata(pdev);
++ int i;
++
++ for (i = 0; i < bundle->num_leds; i++)
++ led_classdev_resume(&bundle->led[i].cdev);
++
++ return 0;
++}
++#endif
++
++static int __init gta02led_probe(struct platform_device *pdev)
++{
++ int i, rc;
++ struct gta02_led_bundle *bundle;
++
++ if (!machine_is_neo1973_gta02())
++ return -EIO;
++
++ bundle = kzalloc(sizeof(struct gta02_led_bundle), GFP_KERNEL);
++ if (!bundle)
++ return -ENOMEM;
++ platform_set_drvdata(pdev, bundle);
++
++ for (i = 0; i < pdev->num_resources; i++) {
++ struct gta02_led_priv *lp;
++ struct resource *r;
++
++ if (i >= MAX_LEDS)
++ break;
++
++ r = platform_get_resource(pdev, 0, i);
++ if (!r || !r->start || !r->name)
++ continue;
++
++ lp = &bundle->led[i];
++
++ lp->gpio = r->start;
++ lp->cdev.name = r->name;
++ lp->cdev.brightness_set = gta02led_set;
++
++ switch (lp->gpio) {
++ case S3C2410_GPB0:
++ lp->has_pwm = 1;
++ lp->pwm.timerid = PWM0;
++ s3c2410_gpio_cfgpin(lp->gpio, S3C2410_GPB0_TOUT0);
++ break;
++ case S3C2410_GPB1:
++ lp->has_pwm = 1;
++ lp->pwm.timerid = PWM1;
++ s3c2410_gpio_cfgpin(lp->gpio, S3C2410_GPB1_TOUT1);
++ break;
++ case S3C2410_GPB2:
++ lp->has_pwm = 1;
++ lp->pwm.timerid = PWM2;
++ s3c2410_gpio_cfgpin(lp->gpio, S3C2410_GPB2_TOUT2);
++ break;
++ case S3C2410_GPB3:
++ lp->has_pwm = 1;
++ lp->pwm.timerid = PWM3;
++ s3c2410_gpio_cfgpin(lp->gpio, S3C2410_GPB3_TOUT3);
++ break;
++ default:
++ break;
++ }
++
++ if (lp->has_pwm) {
++ lp->pwm.prescaler = 0;
++ lp->pwm.divider = S3C2410_TCFG1_MUX3_DIV8;
++ lp->pwm.counter = COUNTER;
++ lp->pwm.comparer = COUNTER;
++ s3c2410_pwm_enable(&lp->pwm);
++ s3c2410_pwm_start(&lp->pwm);
++ }
++
++ mutex_init(&lp->mutex);
++ rc = led_classdev_register(&pdev->dev, &lp->cdev);
++ }
++
++ return 0;
++}
++
++static int gta02led_remove(struct platform_device *pdev)
++{
++ struct gta02_led_bundle *bundle = platform_get_drvdata(pdev);
++ int i;
++
++ for (i = 0; i < bundle->num_leds; i++) {
++ struct gta02_led_priv *lp = &bundle->led[i];
++ if (lp->has_pwm)
++ s3c2410_pwm_disable(&lp->pwm);
++
++ led_classdev_unregister(&lp->cdev);
++ mutex_destroy(&lp->mutex);
++ }
++
++ platform_set_drvdata(pdev, NULL);
++ kfree(bundle);
++
++ return 0;
++}
++
++static struct platform_driver gta02led_driver = {
++ .probe = gta02led_probe,
++ .remove = gta02led_remove,
++#ifdef CONFIG_PM
++ .suspend = gta02led_suspend,
++ .resume = gta02led_resume,
++#endif
++ .driver = {
++ .name = "gta02-led",
++ },
++};
++
++static int __init gta02led_init(void)
++{
++ return platform_driver_register(>a02led_driver);
++}
++
++static void __exit gta02led_exit(void)
++{
++ platform_driver_unregister(>a02led_driver);
++}
++
++module_init(gta02led_init);
++module_exit(gta02led_exit);
++
++MODULE_AUTHOR("Harald Welte <laforge at openmoko.org>");
++MODULE_DESCRIPTION("FIC GTA02 LED driver");
++MODULE_LICENSE("GPL");
Modified: branches/src/target/kernel/2.6.23.x/patches/series
===================================================================
--- branches/src/target/kernel/2.6.23.x/patches/series 2007-10-16 17:27:14 UTC (rev 3196)
+++ branches/src/target/kernel/2.6.23.x/patches/series 2007-10-16 17:54:28 UTC (rev 3197)
@@ -51,4 +51,4 @@
explicitly-link-notes-section.patch
fix-s3c2410fb-register-access.patch
lis302dl.patch
-#gta02-leds.patch
+gta02-leds.patch
More information about the commitlog
mailing list