Changeset 25833


Ignore:
Timestamp:
2011-03-02T17:22:52+01:00 (7 years ago)
Author:
mb
Message:

n810bm: Add charger_state attribute

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/target/linux/omap24xx/patches-2.6.38/900-n810-battery-management.patch

    r25798 r25833  
    11Index: linux-2.6.38-rc6/drivers/cbus/Kconfig 
    22=================================================================== 
    3 --- linux-2.6.38-rc6.orig/drivers/cbus/Kconfig  2011-02-28 15:20:39.590247119 +0100 
    4 +++ linux-2.6.38-rc6/drivers/cbus/Kconfig       2011-02-28 15:25:56.106012376 +0100 
     3--- linux-2.6.38-rc6.orig/drivers/cbus/Kconfig  2011-03-01 19:56:10.396378152 +0100 
     4+++ linux-2.6.38-rc6/drivers/cbus/Kconfig       2011-03-01 19:56:10.669365669 +0100 
    55@@ -72,4 +72,12 @@ config CBUS_RETU_HEADSET 
    66          to Retu/Vilma. Detection state and events are exposed through 
     
    1818Index: linux-2.6.38-rc6/drivers/cbus/Makefile 
    1919=================================================================== 
    20 --- linux-2.6.38-rc6.orig/drivers/cbus/Makefile 2011-02-28 15:20:39.574247501 +0100 
    21 +++ linux-2.6.38-rc6/drivers/cbus/Makefile      2011-02-28 15:25:56.106012376 +0100 
     20--- linux-2.6.38-rc6.orig/drivers/cbus/Makefile 2011-03-01 19:56:10.396378152 +0100 
     21+++ linux-2.6.38-rc6/drivers/cbus/Makefile      2011-03-01 19:56:10.669365669 +0100 
    2222@@ -11,3 +11,6 @@ obj-$(CONFIG_CBUS_RETU_POWERBUTTON) += r 
    2323 obj-$(CONFIG_CBUS_RETU_RTC)    += retu-rtc.o 
     
    3030=================================================================== 
    3131--- /dev/null   1970-01-01 00:00:00.000000000 +0000 
    32 +++ linux-2.6.38-rc6/drivers/cbus/n810bm_main.c 2011-02-28 15:25:56.109012160 +0100 
    33 @@ -0,0 +1,1597 @@ 
     32+++ linux-2.6.38-rc6/drivers/cbus/n810bm_main.c 2011-03-01 21:15:45.484648402 +0100 
     33@@ -0,0 +1,1586 @@ 
    3434+/* 
    3535+ *   Nokia n810 battery management 
     
    160160+ 
    161161+enum n810bm_notify_flags { 
    162 +       N810BM_NOTIFY_battery_charging, 
     162+       N810BM_NOTIFY_charger_present, 
     163+       N810BM_NOTIFY_charger_state, 
    163164+       N810BM_NOTIFY_charger_pwm, 
    164165+}; 
     
    188189+}; 
    189190+ 
    190 +static void n810bm_notify_battery_charging(struct n810bm *bm); 
     191+static void n810bm_notify_charger_present(struct n810bm *bm); 
     192+static void n810bm_notify_charger_state(struct n810bm *bm); 
    191193+static void n810bm_notify_charger_pwm(struct n810bm *bm); 
    192194+ 
     
    920922+ 
    921923+       dev_info(&bm->pdev->dev, "Charging battery"); 
     924+       n810bm_notify_charger_state(bm); 
    922925+       n810bm_notify_charger_pwm(bm); 
    923 +       n810bm_notify_battery_charging(bm); 
    924926+} 
    925927+ 
     
    944946+ 
    945947+       dev_info(&bm->pdev->dev, "Not charging battery"); 
     948+       n810bm_notify_charger_state(bm); 
    946949+       n810bm_notify_charger_pwm(bm); 
    947 +       n810bm_notify_battery_charging(bm); 
    948950+} 
    949951+ 
     
    986988+               dev_info(&bm->pdev->dev, "The charger was %s", 
    987989+                        bm->charger_present ? "plugged in" : "removed"); 
     990+               n810bm_notify_charger_present(bm); 
    988991+       } 
    989992+ 
     
    11441147+DEFINE_ATTR_SHOW_INT(battery_present, battery_present); 
    11451148+DEFINE_ATTR_SHOW_INT(charger_present, charger_present); 
     1149+static DEFINE_ATTR_NOTIFY(charger_present); 
     1150+DEFINE_ATTR_SHOW_INT(charger_state, charger.state); 
     1151+static DEFINE_ATTR_NOTIFY(charger_state); 
    11461152+DEFINE_ATTR_SHOW_INT(charger_pwm, active_current_pwm); 
    11471153+static DEFINE_ATTR_NOTIFY(charger_pwm); 
    11481154+DEFINE_ATTR_SHOW_STORE_INT(charger_enable, charger_enabled); 
    11491155+DEFINE_ATTR_SHOW_STORE_INT(charger_verbose, verbose_charge_log); 
    1150 + 
    1151 +static ssize_t n810bm_attr_battery_charging(struct device *dev, 
    1152 +                                           struct device_attribute *attr, 
    1153 +                                           char *buf) 
    1154 +{ 
    1155 +       struct n810bm *bm = device_to_n810bm(dev); 
    1156 +       ssize_t count; 
    1157 + 
    1158 +       mutex_lock(&bm->mutex); 
    1159 +       count = snprintf(buf, PAGE_SIZE, "%d\n", 
    1160 +                        (int)lipocharge_is_charging(&bm->charger)); 
    1161 +       mutex_unlock(&bm->mutex); 
    1162 + 
    1163 +       return count; 
    1164 +} 
    1165 +static DEVICE_ATTR(battery_charging, S_IRUGO, 
    1166 +                  n810bm_attr_battery_charging, NULL); 
    1167 +static DEFINE_ATTR_NOTIFY(battery_charging); 
    11681156+ 
    11691157+static ssize_t n810bm_attr_battery_level_show(struct device *dev, 
     
    12901278+       &dev_attr_battery_present, 
    12911279+       &dev_attr_battery_level, 
    1292 +       &dev_attr_battery_charging, 
    12931280+       &dev_attr_battery_current, 
    12941281+       &dev_attr_battery_capacity, 
     
    12961283+       &dev_attr_backup_battery_voltage, 
    12971284+       &dev_attr_charger_present, 
     1285+       &dev_attr_charger_state, 
    12981286+       &dev_attr_charger_verbose, 
    12991287+       &dev_attr_charger_voltage, 
     
    13181306+       } while (0) 
    13191307+ 
    1320 +       do_notify(battery_charging); 
     1308+       do_notify(charger_present); 
     1309+       do_notify(charger_state); 
    13211310+       do_notify(charger_pwm); 
    13221311+} 
     
    16321621=================================================================== 
    16331622--- /dev/null   1970-01-01 00:00:00.000000000 +0000 
    1634 +++ linux-2.6.38-rc6/drivers/cbus/lipocharge.c  2011-02-28 15:25:56.110012088 +0100 
     1623+++ linux-2.6.38-rc6/drivers/cbus/lipocharge.c  2011-03-01 19:56:10.672365533 +0100 
    16351624@@ -0,0 +1,183 @@ 
    16361625+/* 
     
    18201809=================================================================== 
    18211810--- /dev/null   1970-01-01 00:00:00.000000000 +0000 
    1822 +++ linux-2.6.38-rc6/drivers/cbus/lipocharge.h  2011-02-28 15:25:56.110012088 +0100 
     1811+++ linux-2.6.38-rc6/drivers/cbus/lipocharge.h  2011-03-01 21:07:15.483394264 +0100 
    18231812@@ -0,0 +1,60 @@ 
    18241813+#ifndef LIPOCHARGE_H_ 
     
    18331822+ 
    18341823+enum lipocharge_state { 
    1835 +       LIPO_IDLE,              /* Not charging */ 
     1824+       LIPO_IDLE = 0,          /* Not charging */ 
    18361825+       LIPO_FIRST_STAGE,       /* Charging: constant current */ 
    18371826+       LIPO_SECOND_STAGE,      /* Charging: constant voltage */ 
     
    18841873Index: linux-2.6.38-rc6/drivers/cbus/cbus.c 
    18851874=================================================================== 
    1886 --- linux-2.6.38-rc6.orig/drivers/cbus/cbus.c   2011-02-28 15:20:39.640245927 +0100 
    1887 +++ linux-2.6.38-rc6/drivers/cbus/cbus.c        2011-02-28 15:25:56.110012088 +0100 
     1875--- linux-2.6.38-rc6.orig/drivers/cbus/cbus.c   2011-03-01 19:56:10.396378152 +0100 
     1876+++ linux-2.6.38-rc6/drivers/cbus/cbus.c        2011-03-01 19:56:10.673365487 +0100 
    18881877@@ -35,6 +35,7 @@ 
    18891878 #include <linux/platform_device.h> 
     
    19101899Index: linux-2.6.38-rc6/drivers/cbus/cbus.h 
    19111900=================================================================== 
    1912 --- linux-2.6.38-rc6.orig/drivers/cbus/cbus.h   2011-02-28 15:20:39.623246332 +0100 
    1913 +++ linux-2.6.38-rc6/drivers/cbus/cbus.h        2011-02-28 15:25:56.111012017 +0100 
     1901--- linux-2.6.38-rc6.orig/drivers/cbus/cbus.h   2011-03-01 19:56:10.396378152 +0100 
     1902+++ linux-2.6.38-rc6/drivers/cbus/cbus.h        2011-03-01 19:56:10.673365487 +0100 
    19141903@@ -26,4 +26,6 @@ 
    19151904 extern int cbus_read_reg(unsigned dev, unsigned reg); 
     
    19211910Index: linux-2.6.38-rc6/drivers/cbus/retu.c 
    19221911=================================================================== 
    1923 --- linux-2.6.38-rc6.orig/drivers/cbus/retu.c   2011-02-28 15:22:24.030477769 +0100 
    1924 +++ linux-2.6.38-rc6/drivers/cbus/retu.c        2011-02-28 15:25:56.111012017 +0100 
     1912--- linux-2.6.38-rc6.orig/drivers/cbus/retu.c   2011-03-01 19:56:10.469374814 +0100 
     1913+++ linux-2.6.38-rc6/drivers/cbus/retu.c        2011-03-01 19:56:10.674365441 +0100 
    19251914@@ -425,6 +425,11 @@ static int retu_allocate_children(struct 
    19261915        if (!child) 
     
    19371926Index: linux-2.6.38-rc6/drivers/cbus/tahvo.c 
    19381927=================================================================== 
    1939 --- linux-2.6.38-rc6.orig/drivers/cbus/tahvo.c  2011-02-28 15:20:39.547248145 +0100 
    1940 +++ linux-2.6.38-rc6/drivers/cbus/tahvo.c       2011-02-28 15:25:56.112011946 +0100 
     1928--- linux-2.6.38-rc6.orig/drivers/cbus/tahvo.c  2011-03-01 19:56:10.401377922 +0100 
     1929+++ linux-2.6.38-rc6/drivers/cbus/tahvo.c       2011-03-01 19:56:10.674365441 +0100 
    19411930@@ -54,6 +54,7 @@ static int tahvo_is_betty; 
    19421931  
Note: See TracChangeset for help on using the changeset viewer.