Changeset 28766


Ignore:
Timestamp:
2011-11-05T17:01:53+01:00 (6 years ago)
Author:
mb
Message:

omap24xx: Fix n810bm compilation

File:
1 edited

Legend:

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

    r28683 r28766  
    11Index: linux-3.1/drivers/cbus/Kconfig 
    22=================================================================== 
    3 --- linux-3.1.orig/drivers/cbus/Kconfig 2011-10-30 19:14:57.000000000 +0100 
    4 +++ linux-3.1/drivers/cbus/Kconfig      2011-10-30 19:32:58.263510754 +0100 
     3--- linux-3.1.orig/drivers/cbus/Kconfig 2011-11-05 15:02:39.041041166 +0100 
     4+++ linux-3.1/drivers/cbus/Kconfig      2011-11-05 15:02:39.177041045 +0100 
    55@@ -83,4 +83,12 @@ config CBUS_RETU_HEADSET 
    66  
     
    1818Index: linux-3.1/drivers/cbus/Makefile 
    1919=================================================================== 
    20 --- linux-3.1.orig/drivers/cbus/Makefile        2011-10-30 19:14:57.000000000 +0100 
    21 +++ linux-3.1/drivers/cbus/Makefile     2011-10-30 19:32:58.263510754 +0100 
     20--- linux-3.1.orig/drivers/cbus/Makefile        2011-11-05 15:02:39.041041166 +0100 
     21+++ linux-3.1/drivers/cbus/Makefile     2011-11-05 15:02:39.177041045 +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-3.1/drivers/cbus/n810bm_main.c        2011-10-30 19:32:58.263510754 +0100 
    33 @@ -0,0 +1,1586 @@ 
     32+++ linux-3.1/drivers/cbus/n810bm_main.c        2011-11-05 16:42:53.033998545 +0100 
     33@@ -0,0 +1,1572 @@ 
    3434+/* 
    3535+ *   Nokia n810 battery management 
     
    6464+#include <linux/workqueue.h> 
    6565+#include <linux/delay.h> 
     66+#include <linux/interrupt.h> 
    6667+ 
    6768+#include "cbus.h" 
     
    166167+ 
    167168+struct n810bm { 
     169+       int tahvo_irq; 
     170+       bool tahvo_irq_enabled; 
     171+ 
    168172+       bool battery_present;                   /* A battery is inserted */ 
    169173+       bool charger_present;                   /* The charger is connected */ 
     
    182186+       unsigned long notify_flags; 
    183187+       struct work_struct notify_work; 
    184 +       struct work_struct currmeas_irq_work; 
    185188+       struct delayed_work periodic_check_work; 
    186189+ 
     
    222225+static u16 tahvo_read(struct n810bm *bm, unsigned int reg) 
    223226+{ 
    224 +       return tahvo_read_reg(reg); 
     227+       return tahvo_read_reg(&n810bm_tahvo_device->dev, reg); 
    225228+} 
    226229+ 
    227230+static void tahvo_maskset(struct n810bm *bm, unsigned int reg, u16 mask, u16 set) 
    228231+{ 
    229 +       tahvo_set_clear_reg_bits(reg, set, mask); 
     232+       tahvo_set_clear_reg_bits(&n810bm_tahvo_device->dev, reg, set, mask); 
    230233+} 
    231234+ 
    232235+static inline void tahvo_write(struct n810bm *bm, unsigned int reg, u16 value) 
    233236+{ 
    234 +       unsigned long flags; 
    235 + 
    236 +       spin_lock_irqsave(&tahvo_lock, flags); 
    237 +       tahvo_write_reg(reg, value); 
    238 +       spin_unlock_irqrestore(&tahvo_lock, flags); 
     237+       tahvo_write_reg(&n810bm_tahvo_device->dev, reg, value); 
    239238+} 
    240239+ 
    241240+static inline void tahvo_set(struct n810bm *bm, unsigned int reg, u16 mask) 
    242241+{ 
    243 +       tahvo_set_clear_reg_bits(reg, mask, mask); 
     242+       tahvo_set_clear_reg_bits(&n810bm_tahvo_device->dev, reg, mask, mask); 
    244243+} 
    245244+ 
    246245+static inline void tahvo_clear(struct n810bm *bm, unsigned int reg, u16 mask) 
    247246+{ 
    248 +       tahvo_set_clear_reg_bits(reg, 0, mask); 
     247+       tahvo_set_clear_reg_bits(&n810bm_tahvo_device->dev, reg, 0, mask); 
    249248+} 
    250249+ 
     
    678677+                   TAHVO_REG_CHGCTL_CURTIMRST); 
    679678+ 
    680 +       if (millisec_interval) 
    681 +               tahvo_enable_irq(TAHVO_INT_BATCURR); 
    682 +       else 
    683 +               tahvo_disable_irq(TAHVO_INT_BATCURR); 
     679+       if (millisec_interval) { 
     680+               if (!bm->tahvo_irq_enabled) { 
     681+                       bm->tahvo_irq_enabled = 1; 
     682+                       enable_irq(bm->tahvo_irq); 
     683+               } 
     684+       } else { 
     685+               if (bm->tahvo_irq_enabled) { 
     686+                       bm->tahvo_irq_enabled = 0; 
     687+                       disable_irq_nosync(bm->tahvo_irq); 
     688+               } 
     689+       } 
    684690+ 
    685691+       //TODO also do a software timer for safety. 
     
    10371043+*/ 
    10381044+ 
    1039 +static void n810bm_tahvo_current_measure_work(struct work_struct *work) 
    1040 +{ 
    1041 +       struct n810bm *bm = container_of(work, struct n810bm, currmeas_irq_work); 
     1045+static irqreturn_t n810bm_tahvo_current_measure_irq_handler(int irq, void *data) 
     1046+{ 
     1047+       struct n810bm *bm = data; 
    10421048+       int res, ma, mv, temp; 
    10431049+ 
     
    10821088+out_unlock: 
    10831089+       mutex_unlock(&bm->mutex); 
    1084 +} 
    1085 + 
    1086 +static void n810bm_tahvo_current_measure_irq_handler(unsigned long data) 
    1087 +{ 
    1088 +       struct n810bm *bm = (struct n810bm *)data; 
    1089 + 
    1090 +       tahvo_ack_irq(TAHVO_INT_BATCURR); 
    1091 +       schedule_work(&bm->currmeas_irq_work); 
     1090+ 
     1091+       return IRQ_HANDLED; 
    10921092+} 
    10931093+ 
     
    13671367+       cancel_delayed_work_sync(&bm->periodic_check_work); 
    13681368+       cancel_work_sync(&bm->notify_work); 
    1369 +       cancel_work_sync(&bm->currmeas_irq_work); 
    13701369+       flush_scheduled_work(); 
    13711370+} 
     
    13981397+               goto err_unwind_attrs; 
    13991398+*/ 
    1400 +       err = tahvo_request_irq(TAHVO_INT_BATCURR, 
    1401 +                               n810bm_tahvo_current_measure_irq_handler, 
    1402 +                               (unsigned long)bm, "n810bm"); 
     1399+       bm->tahvo_irq = platform_get_irq(n810bm_tahvo_device, 0); 
     1400+       err = request_threaded_irq(bm->tahvo_irq, NULL, 
     1401+                                  n810bm_tahvo_current_measure_irq_handler, 
     1402+                                  IRQF_ONESHOT, "tahvo-n810bm", bm); 
    14031403+       if (err) 
    14041404+               goto err_free_retu_irq; 
    1405 +       tahvo_disable_irq(TAHVO_INT_BATCURR); 
     1405+       disable_irq_nosync(bm->tahvo_irq); 
     1406+       bm->tahvo_irq_enabled = 0; 
    14061407+ 
    14071408+       schedule_delayed_work(&bm->periodic_check_work, 
     
    14341435+ 
    14351436+       lipocharge_exit(&bm->charger); 
    1436 +       tahvo_free_irq(TAHVO_INT_BATCURR); 
     1437+       free_irq(bm->tahvo_irq, bm); 
    14371438+//XXX  retu_free_irq(RETU_INT_ADCS); 
    14381439+       for (i = 0; i < ARRAY_SIZE(n810bm_attrs); i++) 
     
    14991500+       INIT_DELAYED_WORK(&bm->periodic_check_work, n810bm_periodic_check_work); 
    15001501+       INIT_WORK(&bm->notify_work, n810bm_notify_work); 
    1501 +       INIT_WORK(&bm->currmeas_irq_work, n810bm_tahvo_current_measure_work); 
    15021502+ 
    15031503+       dev_info(&bm->pdev->dev, "Requesting CAL BME PMM block firmware file " 
     
    15761576+}; 
    15771577+ 
    1578 +/* FIXME: for now alloc the device here... */ 
    1579 +static struct platform_device n810bm_tahvo_dev = { 
    1580 +       .name   = "tahvo-n810bm", 
    1581 +       .id     = -1, 
    1582 +}; 
    1583 + 
    15841578+static int __init n810bm_modinit(void) 
    15851579+{ 
    15861580+       int err; 
    1587 + 
    1588 +       //FIXME 
    1589 +       err = platform_device_register(&n810bm_tahvo_dev); 
    1590 +       if (err) 
    1591 +               return err; 
    15921581+ 
    15931582+       err = platform_driver_probe(&n810bm_retu_driver, n810bm_retu_probe); 
     
    16061595+static void __exit n810bm_modexit(void) 
    16071596+{ 
    1608 +       //FIXME 
    1609 +       platform_device_unregister(&n810bm_tahvo_dev); 
    1610 + 
    16111597+       platform_driver_unregister(&n810bm_tahvo_driver); 
    16121598+       platform_driver_unregister(&n810bm_retu_driver); 
     
    16211607=================================================================== 
    16221608--- /dev/null   1970-01-01 00:00:00.000000000 +0000 
    1623 +++ linux-3.1/drivers/cbus/lipocharge.c 2011-10-30 19:32:58.263510754 +0100 
     1609+++ linux-3.1/drivers/cbus/lipocharge.c 2011-11-05 15:02:39.177041045 +0100 
    16241610@@ -0,0 +1,183 @@ 
    16251611+/* 
     
    18091795=================================================================== 
    18101796--- /dev/null   1970-01-01 00:00:00.000000000 +0000 
    1811 +++ linux-3.1/drivers/cbus/lipocharge.h 2011-10-30 19:32:58.263510754 +0100 
     1797+++ linux-3.1/drivers/cbus/lipocharge.h 2011-11-05 15:02:39.177041045 +0100 
    18121798@@ -0,0 +1,60 @@ 
    18131799+#ifndef LIPOCHARGE_H_ 
     
    18731859Index: linux-3.1/drivers/cbus/cbus.c 
    18741860=================================================================== 
    1875 --- linux-3.1.orig/drivers/cbus/cbus.c  2011-10-30 19:31:35.000000000 +0100 
    1876 +++ linux-3.1/drivers/cbus/cbus.c       2011-10-30 19:33:12.107254808 +0100 
     1861--- linux-3.1.orig/drivers/cbus/cbus.c  2011-11-05 15:02:39.041041166 +0100 
     1862+++ linux-3.1/drivers/cbus/cbus.c       2011-11-05 15:02:39.177041045 +0100 
    18771863@@ -34,6 +34,7 @@ 
    18781864 #include <linux/gpio.h> 
     
    18991885Index: linux-3.1/drivers/cbus/cbus.h 
    19001886=================================================================== 
    1901 --- linux-3.1.orig/drivers/cbus/cbus.h  2011-10-30 19:14:57.000000000 +0100 
    1902 +++ linux-3.1/drivers/cbus/cbus.h       2011-10-30 19:32:58.263510754 +0100 
     1887--- linux-3.1.orig/drivers/cbus/cbus.h  2011-11-05 15:02:39.041041166 +0100 
     1888+++ linux-3.1/drivers/cbus/cbus.h       2011-11-05 15:02:39.177041045 +0100 
    19031889@@ -27,4 +27,6 @@ extern int cbus_read_reg(struct device * 
    19041890 extern int cbus_write_reg(struct device *, unsigned dev, unsigned reg, 
     
    19101896Index: linux-3.1/drivers/cbus/retu.c 
    19111897=================================================================== 
    1912 --- linux-3.1.orig/drivers/cbus/retu.c  2011-10-30 19:31:35.000000000 +0100 
    1913 +++ linux-3.1/drivers/cbus/retu.c       2011-10-30 19:32:58.263510754 +0100 
     1898--- linux-3.1.orig/drivers/cbus/retu.c  2011-11-05 15:02:39.041041166 +0100 
     1899+++ linux-3.1/drivers/cbus/retu.c       2011-11-05 15:02:39.177041045 +0100 
    19141900@@ -417,6 +417,11 @@ static int retu_allocate_children(struct 
    19151901        if (!child) 
     
    19261912Index: linux-3.1/drivers/cbus/tahvo.c 
    19271913=================================================================== 
    1928 --- linux-3.1.orig/drivers/cbus/tahvo.c 2011-10-30 19:31:35.000000000 +0100 
    1929 +++ linux-3.1/drivers/cbus/tahvo.c      2011-10-30 19:32:58.263510754 +0100 
     1914--- linux-3.1.orig/drivers/cbus/tahvo.c 2011-11-05 15:02:39.041041166 +0100 
     1915+++ linux-3.1/drivers/cbus/tahvo.c      2011-11-05 16:23:10.694222186 +0100 
    19301916@@ -129,6 +129,7 @@ void tahvo_set_clear_reg_bits(struct dev 
    19311917        __tahvo_write_reg(tahvo, reg, w); 
     
    19361922 static irqreturn_t tahvo_irq_handler(int irq, void *_tahvo) 
    19371923 { 
     1924@@ -305,6 +306,11 @@ static int tahvo_allocate_children(struc 
     1925        if (!child) 
     1926                return -ENOMEM; 
     1927  
     1928+       child = tahvo_allocate_child("tahvo-n810bm", parent, 
     1929+                                    irq_base + TAHVO_INT_BATCURR); 
     1930+       if (!child) 
     1931+               return -ENOMEM; 
     1932+ 
     1933        return 0; 
     1934 } 
     1935  
Note: See TracChangeset for help on using the changeset viewer.