ar71xx: fix an unused variable warning
[openwrt.git] / target / linux / omap24xx / patches-2.6.38 / 900-n810-battery-management.patch
index c860cff..beef0b6 100644 (file)
@@ -1,8 +1,6 @@
-Index: linux-2.6.38-rc6/drivers/cbus/Kconfig
-===================================================================
---- linux-2.6.38-rc6.orig/drivers/cbus/Kconfig 2011-02-27 00:58:11.730599141 +0100
-+++ linux-2.6.38-rc6/drivers/cbus/Kconfig      2011-02-27 01:05:20.242989951 +0100
-@@ -72,4 +72,12 @@
+--- a/drivers/cbus/Kconfig
++++ b/drivers/cbus/Kconfig
+@@ -72,4 +72,12 @@ config CBUS_RETU_HEADSET
          to Retu/Vilma. Detection state and events are exposed through
          sysfs.
  
          to Retu/Vilma. Detection state and events are exposed through
          sysfs.
  
@@ -15,22 +13,18 @@ Index: linux-2.6.38-rc6/drivers/cbus/Kconfig
 +        If unsure, say N.
 +
  endmenu
 +        If unsure, say N.
 +
  endmenu
-Index: linux-2.6.38-rc6/drivers/cbus/Makefile
-===================================================================
---- linux-2.6.38-rc6.orig/drivers/cbus/Makefile        2011-02-27 00:58:11.713598687 +0100
-+++ linux-2.6.38-rc6/drivers/cbus/Makefile     2011-02-27 01:05:20.243989978 +0100
-@@ -11,3 +11,6 @@
+--- a/drivers/cbus/Makefile
++++ b/drivers/cbus/Makefile
+@@ -11,3 +11,6 @@ obj-$(CONFIG_CBUS_RETU_POWERBUTTON) += r
  obj-$(CONFIG_CBUS_RETU_RTC)   += retu-rtc.o
  obj-$(CONFIG_CBUS_RETU_WDT)   += retu-wdt.o
  obj-$(CONFIG_CBUS_RETU_HEADSET)       += retu-headset.o
 +n810bm-y                      += n810bm_main.o
 +n810bm-y                      += lipocharge.o
 +obj-$(CONFIG_N810BM)          += n810bm.o
  obj-$(CONFIG_CBUS_RETU_RTC)   += retu-rtc.o
  obj-$(CONFIG_CBUS_RETU_WDT)   += retu-wdt.o
  obj-$(CONFIG_CBUS_RETU_HEADSET)       += retu-headset.o
 +n810bm-y                      += n810bm_main.o
 +n810bm-y                      += lipocharge.o
 +obj-$(CONFIG_N810BM)          += n810bm.o
-Index: linux-2.6.38-rc6/drivers/cbus/n810bm_main.c
-===================================================================
---- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6.38-rc6/drivers/cbus/n810bm_main.c        2011-02-27 01:05:20.245990032 +0100
-@@ -0,0 +1,1597 @@
+--- /dev/null
++++ b/drivers/cbus/n810bm_main.c
+@@ -0,0 +1,1586 @@
 +/*
 + *   Nokia n810 battery management
 + *
 +/*
 + *   Nokia n810 battery management
 + *
@@ -159,7 +153,8 @@ Index: linux-2.6.38-rc6/drivers/cbus/n810bm_main.c
 +};
 +
 +enum n810bm_notify_flags {
 +};
 +
 +enum n810bm_notify_flags {
-+      N810BM_NOTIFY_battery_charging,
++      N810BM_NOTIFY_charger_present,
++      N810BM_NOTIFY_charger_state,
 +      N810BM_NOTIFY_charger_pwm,
 +};
 +
 +      N810BM_NOTIFY_charger_pwm,
 +};
 +
@@ -187,7 +182,8 @@ Index: linux-2.6.38-rc6/drivers/cbus/n810bm_main.c
 +      struct mutex mutex;
 +};
 +
 +      struct mutex mutex;
 +};
 +
-+static void n810bm_notify_battery_charging(struct n810bm *bm);
++static void n810bm_notify_charger_present(struct n810bm *bm);
++static void n810bm_notify_charger_state(struct n810bm *bm);
 +static void n810bm_notify_charger_pwm(struct n810bm *bm);
 +
 +
 +static void n810bm_notify_charger_pwm(struct n810bm *bm);
 +
 +
@@ -919,8 +915,8 @@ Index: linux-2.6.38-rc6/drivers/cbus/n810bm_main.c
 +      n810bm_set_current_measure_timer(bm, 250);
 +
 +      dev_info(&bm->pdev->dev, "Charging battery");
 +      n810bm_set_current_measure_timer(bm, 250);
 +
 +      dev_info(&bm->pdev->dev, "Charging battery");
++      n810bm_notify_charger_state(bm);
 +      n810bm_notify_charger_pwm(bm);
 +      n810bm_notify_charger_pwm(bm);
-+      n810bm_notify_battery_charging(bm);
 +}
 +
 +static void n810bm_stop_charge(struct n810bm *bm)
 +}
 +
 +static void n810bm_stop_charge(struct n810bm *bm)
@@ -943,8 +939,8 @@ Index: linux-2.6.38-rc6/drivers/cbus/n810bm_main.c
 +                    0);
 +
 +      dev_info(&bm->pdev->dev, "Not charging battery");
 +                    0);
 +
 +      dev_info(&bm->pdev->dev, "Not charging battery");
++      n810bm_notify_charger_state(bm);
 +      n810bm_notify_charger_pwm(bm);
 +      n810bm_notify_charger_pwm(bm);
-+      n810bm_notify_battery_charging(bm);
 +}
 +
 +/* Periodic check */
 +}
 +
 +/* Periodic check */
@@ -985,6 +981,7 @@ Index: linux-2.6.38-rc6/drivers/cbus/n810bm_main.c
 +              /* Charger state changed */
 +              dev_info(&bm->pdev->dev, "The charger was %s",
 +                       bm->charger_present ? "plugged in" : "removed");
 +              /* Charger state changed */
 +              dev_info(&bm->pdev->dev, "The charger was %s",
 +                       bm->charger_present ? "plugged in" : "removed");
++              n810bm_notify_charger_present(bm);
 +      }
 +
 +      if ((bm->battery_present && !bm->charger_present) ||
 +      }
 +
 +      if ((bm->battery_present && !bm->charger_present) ||
@@ -1143,29 +1140,14 @@ Index: linux-2.6.38-rc6/drivers/cbus/n810bm_main.c
 +
 +DEFINE_ATTR_SHOW_INT(battery_present, battery_present);
 +DEFINE_ATTR_SHOW_INT(charger_present, charger_present);
 +
 +DEFINE_ATTR_SHOW_INT(battery_present, battery_present);
 +DEFINE_ATTR_SHOW_INT(charger_present, charger_present);
++static DEFINE_ATTR_NOTIFY(charger_present);
++DEFINE_ATTR_SHOW_INT(charger_state, charger.state);
++static DEFINE_ATTR_NOTIFY(charger_state);
 +DEFINE_ATTR_SHOW_INT(charger_pwm, active_current_pwm);
 +static DEFINE_ATTR_NOTIFY(charger_pwm);
 +DEFINE_ATTR_SHOW_STORE_INT(charger_enable, charger_enabled);
 +DEFINE_ATTR_SHOW_STORE_INT(charger_verbose, verbose_charge_log);
 +
 +DEFINE_ATTR_SHOW_INT(charger_pwm, active_current_pwm);
 +static DEFINE_ATTR_NOTIFY(charger_pwm);
 +DEFINE_ATTR_SHOW_STORE_INT(charger_enable, charger_enabled);
 +DEFINE_ATTR_SHOW_STORE_INT(charger_verbose, verbose_charge_log);
 +
-+static ssize_t n810bm_attr_battery_charging(struct device *dev,
-+                                          struct device_attribute *attr,
-+                                          char *buf)
-+{
-+      struct n810bm *bm = device_to_n810bm(dev);
-+      ssize_t count;
-+
-+      mutex_lock(&bm->mutex);
-+      count = snprintf(buf, PAGE_SIZE, "%d\n",
-+                       (int)lipocharge_is_charging(&bm->charger));
-+      mutex_unlock(&bm->mutex);
-+
-+      return count;
-+}
-+static DEVICE_ATTR(battery_charging, S_IRUGO,
-+                 n810bm_attr_battery_charging, NULL);
-+static DEFINE_ATTR_NOTIFY(battery_charging);
-+
 +static ssize_t n810bm_attr_battery_level_show(struct device *dev,
 +                                            struct device_attribute *attr,
 +                                            char *buf)
 +static ssize_t n810bm_attr_battery_level_show(struct device *dev,
 +                                            struct device_attribute *attr,
 +                                            char *buf)
@@ -1289,12 +1271,12 @@ Index: linux-2.6.38-rc6/drivers/cbus/n810bm_main.c
 +static const struct device_attribute *n810bm_attrs[] = {
 +      &dev_attr_battery_present,
 +      &dev_attr_battery_level,
 +static const struct device_attribute *n810bm_attrs[] = {
 +      &dev_attr_battery_present,
 +      &dev_attr_battery_level,
-+      &dev_attr_battery_charging,
 +      &dev_attr_battery_current,
 +      &dev_attr_battery_capacity,
 +      &dev_attr_battery_temp,
 +      &dev_attr_backup_battery_voltage,
 +      &dev_attr_charger_present,
 +      &dev_attr_battery_current,
 +      &dev_attr_battery_capacity,
 +      &dev_attr_battery_temp,
 +      &dev_attr_backup_battery_voltage,
 +      &dev_attr_charger_present,
++      &dev_attr_charger_state,
 +      &dev_attr_charger_verbose,
 +      &dev_attr_charger_voltage,
 +      &dev_attr_charger_enable,
 +      &dev_attr_charger_verbose,
 +      &dev_attr_charger_voltage,
 +      &dev_attr_charger_enable,
@@ -1317,7 +1299,8 @@ Index: linux-2.6.38-rc6/drivers/cbus/n810bm_main.c
 +              }                                                       \
 +      } while (0)
 +
 +              }                                                       \
 +      } while (0)
 +
-+      do_notify(battery_charging);
++      do_notify(charger_present);
++      do_notify(charger_state);
 +      do_notify(charger_pwm);
 +}
 +
 +      do_notify(charger_pwm);
 +}
 +
@@ -1628,10 +1611,8 @@ Index: linux-2.6.38-rc6/drivers/cbus/n810bm_main.c
 +MODULE_FIRMWARE(N810BM_PMM_BLOCK_FILENAME);
 +MODULE_LICENSE("GPL");
 +MODULE_AUTHOR("Michael Buesch");
 +MODULE_FIRMWARE(N810BM_PMM_BLOCK_FILENAME);
 +MODULE_LICENSE("GPL");
 +MODULE_AUTHOR("Michael Buesch");
-Index: linux-2.6.38-rc6/drivers/cbus/lipocharge.c
-===================================================================
---- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6.38-rc6/drivers/cbus/lipocharge.c 2011-02-27 01:05:20.246990058 +0100
+--- /dev/null
++++ b/drivers/cbus/lipocharge.c
 @@ -0,0 +1,183 @@
 +/*
 + *   Generic LIPO battery charger
 @@ -0,0 +1,183 @@
 +/*
 + *   Generic LIPO battery charger
@@ -1816,10 +1797,8 @@ Index: linux-2.6.38-rc6/drivers/cbus/lipocharge.c
 +
 +      return 0;
 +}
 +
 +      return 0;
 +}
-Index: linux-2.6.38-rc6/drivers/cbus/lipocharge.h
-===================================================================
---- /dev/null  1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6.38-rc6/drivers/cbus/lipocharge.h 2011-02-27 01:05:20.246990058 +0100
+--- /dev/null
++++ b/drivers/cbus/lipocharge.h
 @@ -0,0 +1,60 @@
 +#ifndef LIPOCHARGE_H_
 +#define LIPOCHARGE_H_
 @@ -0,0 +1,60 @@
 +#ifndef LIPOCHARGE_H_
 +#define LIPOCHARGE_H_
@@ -1832,7 +1811,7 @@ Index: linux-2.6.38-rc6/drivers/cbus/lipocharge.h
 +#define LIPORATE_p6C  LIPORATE(0,6)   /* 0.6C */
 +
 +enum lipocharge_state {
 +#define LIPORATE_p6C  LIPORATE(0,6)   /* 0.6C */
 +
 +enum lipocharge_state {
-+      LIPO_IDLE,              /* Not charging */
++      LIPO_IDLE = 0,          /* Not charging */
 +      LIPO_FIRST_STAGE,       /* Charging: constant current */
 +      LIPO_SECOND_STAGE,      /* Charging: constant voltage */
 +};
 +      LIPO_FIRST_STAGE,       /* Charging: constant current */
 +      LIPO_SECOND_STAGE,      /* Charging: constant voltage */
 +};
@@ -1881,10 +1860,8 @@ Index: linux-2.6.38-rc6/drivers/cbus/lipocharge.h
 +}
 +
 +#endif /* LIPOCHARGE_H_ */
 +}
 +
 +#endif /* LIPOCHARGE_H_ */
-Index: linux-2.6.38-rc6/drivers/cbus/cbus.c
-===================================================================
---- linux-2.6.38-rc6.orig/drivers/cbus/cbus.c  2011-02-27 00:58:11.781600500 +0100
-+++ linux-2.6.38-rc6/drivers/cbus/cbus.c       2011-02-27 01:05:20.247990084 +0100
+--- a/drivers/cbus/cbus.c
++++ b/drivers/cbus/cbus.c
 @@ -35,6 +35,7 @@
  #include <linux/platform_device.h>
  
 @@ -35,6 +35,7 @@
  #include <linux/platform_device.h>
  
@@ -1893,7 +1870,7 @@ Index: linux-2.6.38-rc6/drivers/cbus/cbus.c
  
  #include "cbus.h"
  
  
  #include "cbus.h"
  
-@@ -323,6 +324,13 @@
+@@ -323,6 +324,13 @@ static void __exit cbus_bus_exit(void)
  }
  module_exit(cbus_bus_exit);
  
  }
  module_exit(cbus_bus_exit);
  
@@ -1907,10 +1884,8 @@ Index: linux-2.6.38-rc6/drivers/cbus/cbus.c
  MODULE_DESCRIPTION("CBUS serial protocol");
  MODULE_LICENSE("GPL");
  MODULE_AUTHOR("Juha Yrjölä");
  MODULE_DESCRIPTION("CBUS serial protocol");
  MODULE_LICENSE("GPL");
  MODULE_AUTHOR("Juha Yrjölä");
-Index: linux-2.6.38-rc6/drivers/cbus/cbus.h
-===================================================================
---- linux-2.6.38-rc6.orig/drivers/cbus/cbus.h  2011-02-27 00:58:11.764600047 +0100
-+++ linux-2.6.38-rc6/drivers/cbus/cbus.h       2011-02-27 01:05:20.247990084 +0100
+--- a/drivers/cbus/cbus.h
++++ b/drivers/cbus/cbus.h
 @@ -26,4 +26,6 @@
  extern int cbus_read_reg(unsigned dev, unsigned reg);
  extern int cbus_write_reg(unsigned dev, unsigned reg, unsigned val);
 @@ -26,4 +26,6 @@
  extern int cbus_read_reg(unsigned dev, unsigned reg);
  extern int cbus_write_reg(unsigned dev, unsigned reg, unsigned val);
@@ -1918,11 +1893,9 @@ Index: linux-2.6.38-rc6/drivers/cbus/cbus.h
 +NORET_TYPE void cbus_emergency(void) ATTRIB_NORET;
 +
  #endif /* __DRIVERS_CBUS_CBUS_H */
 +NORET_TYPE void cbus_emergency(void) ATTRIB_NORET;
 +
  #endif /* __DRIVERS_CBUS_CBUS_H */
-Index: linux-2.6.38-rc6/drivers/cbus/retu.c
-===================================================================
---- linux-2.6.38-rc6.orig/drivers/cbus/retu.c  2011-02-27 00:58:11.748599621 +0100
-+++ linux-2.6.38-rc6/drivers/cbus/retu.c       2011-02-27 01:05:20.247990084 +0100
-@@ -423,6 +423,11 @@
+--- a/drivers/cbus/retu.c
++++ b/drivers/cbus/retu.c
+@@ -425,6 +425,11 @@ static int retu_allocate_children(struct
        if (!child)
                return -ENOMEM;
  
        if (!child)
                return -ENOMEM;
  
@@ -1934,11 +1907,9 @@ Index: linux-2.6.38-rc6/drivers/cbus/retu.c
        return 0;
  }
  
        return 0;
  }
  
-Index: linux-2.6.38-rc6/drivers/cbus/tahvo.c
-===================================================================
---- linux-2.6.38-rc6.orig/drivers/cbus/tahvo.c 2011-02-27 00:58:11.686597968 +0100
-+++ linux-2.6.38-rc6/drivers/cbus/tahvo.c      2011-02-27 12:17:27.516124940 +0100
-@@ -54,6 +54,7 @@
+--- a/drivers/cbus/tahvo.c
++++ b/drivers/cbus/tahvo.c
+@@ -54,6 +54,7 @@ static int tahvo_is_betty;
  
  static struct tasklet_struct tahvo_tasklet;
  spinlock_t tahvo_lock = SPIN_LOCK_UNLOCKED;
  
  static struct tasklet_struct tahvo_tasklet;
  spinlock_t tahvo_lock = SPIN_LOCK_UNLOCKED;
@@ -1946,7 +1917,7 @@ Index: linux-2.6.38-rc6/drivers/cbus/tahvo.c
  
  struct tahvo_irq_handler_desc {
        int (*func)(unsigned long);
  
  struct tahvo_irq_handler_desc {
        int (*func)(unsigned long);
-@@ -115,6 +116,7 @@
+@@ -115,6 +116,7 @@ void tahvo_set_clear_reg_bits(unsigned r
        tahvo_write_reg(reg, w);
        spin_unlock_irqrestore(&tahvo_lock, flags);
  }
        tahvo_write_reg(reg, w);
        spin_unlock_irqrestore(&tahvo_lock, flags);
  }
This page took 0.027829 seconds and 4 git commands to generate.