]> Git Repo - linux.git/commitdiff
Merge tag 'for-v3.4-rc1' of git://git.infradead.org/battery-2.6
authorLinus Torvalds <[email protected]>
Fri, 30 Mar 2012 23:09:02 +0000 (16:09 -0700)
committerLinus Torvalds <[email protected]>
Fri, 30 Mar 2012 23:09:02 +0000 (16:09 -0700)
Pull battery updates from Anton Vorontsov:
 "Various small bugfixes and enhancements, plus two new drivers:
   - A quite complex ab8500 charger driver, submitted by Arun Murthy @
     ST-Ericsson;
   - Summit Microelectronics SMB347 Battery Charger, submitted by Bruce
     E Robertson and Alan Cox @ Intel.

  And that's all."

* tag 'for-v3.4-rc1' of git://git.infradead.org/battery-2.6: (36 commits)
  max17042_battery: Clean up interrupt handling
  Revert "max8998_charger: Include linux/module.h just once"
  ab8500_fg: Fix some build warnings on x86_64
  max17042_battery: Fix CHARGE_FULL representation.
  max8998_charger: Include linux/module.h just once
  power_supply: Convert i2c drivers to module_i2c_driver
  lp8727_charger: Add MODULE_DEVICE_TABLE
  charger-manager: Simplify charger_get_property(), get rid of a warning
  charger-manager: Clean up for better readability
  da9052-battery: Convert to use module_platform_driver
  da9052-battery: Fix a memory leak when unload the module
  da9052-battery: Add missing platform_set_drvdata
  ab8500: Turn unneeded global symbols into local ones
  ab8500_fg: Fix copy-paste error
  ab8500_fg: Get rid of 'struct battery_type'
  ab8500_fg: Get rid of 'struct v_to_cap'
  ab8500_btemp: Get rid of 'enum adc_therm'
  ab8500_charger: Convert to the new USB OTG calls
  ab8500-btemp: AB8500 battery temperature driver
  ab8500-fg: A8500 fuel gauge driver
  ...

1  2 
drivers/power/Kconfig
drivers/power/Makefile
drivers/power/isp1704_charger.c
include/linux/mfd/abx500.h

diff --combined drivers/power/Kconfig
index 459f66437fe93159bb696efad3cb3e093eea6dfa,11f928e4e5b51280739b399a8b99d14e897023f4..99dc29f2f2f2ba84b16430a51548817b094b9c3a
@@@ -76,20 -76,6 +76,20 @@@ config BATTERY_DS278
        help
          Say Y here to enable support for batteries with ds2780 chip.
  
 +config BATTERY_DS2781
 +      tristate "2781 battery driver"
 +      depends on HAS_IOMEM
 +      select W1
 +      select W1_SLAVE_DS2781
 +      help
 +        If you enable this you will have the DS2781 battery driver support.
 +
 +        The battery monitor chip is used in many batteries/devices
 +        as the one who is responsible for charging/discharging/monitoring
 +        Li+ batteries.
 +
 +        If you are unsure, say N.
 +
  config BATTERY_DS2782
        tristate "DS2782/DS2786 standalone gas-gauge"
        depends on I2C
@@@ -249,7 -235,7 +249,7 @@@ config CHARGER_TWL403
          Say Y here to enable support for TWL4030 Battery Charge Interface.
  
  config CHARGER_LP8727
-       tristate "National Semiconductor LP8727 charger driver"
+       tristate "TI/National Semiconductor LP8727 charger driver"
        depends on I2C
        help
          Say Y here to enable support for LP8727 Charger Driver.
@@@ -288,4 -274,23 +288,23 @@@ config CHARGER_MAX899
          Say Y to enable support for the battery charger control sysfs and
          platform data of MAX8998/LP3974 PMICs.
  
+ config CHARGER_SMB347
+       tristate "Summit Microelectronics SMB347 Battery Charger"
+       depends on I2C
+       help
+         Say Y to include support for Summit Microelectronics SMB347
+         Battery Charger.
+ config AB8500_BM
+       bool "AB8500 Battery Management Driver"
+       depends on AB8500_CORE && AB8500_GPADC
+       help
+         Say Y to include support for AB5500 battery management.
+ config AB8500_BATTERY_THERM_ON_BATCTRL
+       bool "Thermistor connected on BATCTRL ADC"
+       depends on AB8500_BM
+       help
+         Say Y to enable battery temperature measurements using
+         thermistor connected on BATCTRL ADC.
  endif # POWER_SUPPLY
diff --combined drivers/power/Makefile
index c590fa5334066b398213e2e1e0850a4eb27335cb,27d470d65685121b13285b10373fae79eaa86deb..b6b243416c0ee1947a47efd85b205341dc0f1463
@@@ -16,7 -16,6 +16,7 @@@ obj-$(CONFIG_TEST_POWER)      += test_power.
  
  obj-$(CONFIG_BATTERY_DS2760)  += ds2760_battery.o
  obj-$(CONFIG_BATTERY_DS2780)  += ds2780_battery.o
 +obj-$(CONFIG_BATTERY_DS2781)  += ds2781_battery.o
  obj-$(CONFIG_BATTERY_DS2782)  += ds2782_battery.o
  obj-$(CONFIG_BATTERY_PMU)     += pmu_battery.o
  obj-$(CONFIG_BATTERY_OLPC)    += olpc_battery.o
@@@ -34,6 -33,7 +34,7 @@@ obj-$(CONFIG_BATTERY_S3C_ADC) += s3c_ad
  obj-$(CONFIG_CHARGER_PCF50633)        += pcf50633-charger.o
  obj-$(CONFIG_BATTERY_JZ4740)  += jz4740-battery.o
  obj-$(CONFIG_BATTERY_INTEL_MID)       += intel_mid_battery.o
+ obj-$(CONFIG_AB8500_BM)               += ab8500_charger.o ab8500_btemp.o ab8500_fg.o abx500_chargalg.o
  obj-$(CONFIG_CHARGER_ISP1704) += isp1704_charger.o
  obj-$(CONFIG_CHARGER_MAX8903) += max8903_charger.o
  obj-$(CONFIG_CHARGER_TWL4030) += twl4030_charger.o
@@@ -42,3 -42,4 +43,4 @@@ obj-$(CONFIG_CHARGER_GPIO)    += gpio-char
  obj-$(CONFIG_CHARGER_MANAGER) += charger-manager.o
  obj-$(CONFIG_CHARGER_MAX8997) += max8997_charger.o
  obj-$(CONFIG_CHARGER_MAX8998) += max8998_charger.o
+ obj-$(CONFIG_CHARGER_SMB347)  += smb347-charger.o
index 1289a5f790a12143a837c1ddcefd6a713610bcd6,cce6211b80530287d8e28d48e9a59550fc844630..39eb50f35f09fd777445a53202fb30823d9f9438
@@@ -56,7 -56,7 +56,7 @@@ static u16 isp170x_id[] = 
  struct isp1704_charger {
        struct device           *dev;
        struct power_supply     psy;
 -      struct otg_transceiver  *otg;
 +      struct usb_phy          *phy;
        struct notifier_block   nb;
        struct work_struct      work;
  
        unsigned                max_power;
  };
  
 +static inline int isp1704_read(struct isp1704_charger *isp, u32 reg)
 +{
 +      return usb_phy_io_read(isp->phy, reg);
 +}
 +
 +static inline int isp1704_write(struct isp1704_charger *isp, u32 val, u32 reg)
 +{
 +      return usb_phy_io_write(isp->phy, val, reg);
 +}
 +
  /*
   * Disable/enable the power from the isp1704 if a function for it
   * has been provided with platform data.
@@@ -107,31 -97,31 +107,31 @@@ static inline int isp1704_charger_type(
        u8 otg_ctrl;
        int type = POWER_SUPPLY_TYPE_USB_DCP;
  
 -      func_ctrl = otg_io_read(isp->otg, ULPI_FUNC_CTRL);
 -      otg_ctrl = otg_io_read(isp->otg, ULPI_OTG_CTRL);
 +      func_ctrl = isp1704_read(isp, ULPI_FUNC_CTRL);
 +      otg_ctrl = isp1704_read(isp, ULPI_OTG_CTRL);
  
        /* disable pulldowns */
        reg = ULPI_OTG_CTRL_DM_PULLDOWN | ULPI_OTG_CTRL_DP_PULLDOWN;
 -      otg_io_write(isp->otg, ULPI_CLR(ULPI_OTG_CTRL), reg);
 +      isp1704_write(isp, ULPI_CLR(ULPI_OTG_CTRL), reg);
  
        /* full speed */
 -      otg_io_write(isp->otg, ULPI_CLR(ULPI_FUNC_CTRL),
 +      isp1704_write(isp, ULPI_CLR(ULPI_FUNC_CTRL),
                        ULPI_FUNC_CTRL_XCVRSEL_MASK);
 -      otg_io_write(isp->otg, ULPI_SET(ULPI_FUNC_CTRL),
 +      isp1704_write(isp, ULPI_SET(ULPI_FUNC_CTRL),
                        ULPI_FUNC_CTRL_FULL_SPEED);
  
        /* Enable strong pull-up on DP (1.5K) and reset */
        reg = ULPI_FUNC_CTRL_TERMSELECT | ULPI_FUNC_CTRL_RESET;
 -      otg_io_write(isp->otg, ULPI_SET(ULPI_FUNC_CTRL), reg);
 +      isp1704_write(isp, ULPI_SET(ULPI_FUNC_CTRL), reg);
        usleep_range(1000, 2000);
  
 -      reg = otg_io_read(isp->otg, ULPI_DEBUG);
 +      reg = isp1704_read(isp, ULPI_DEBUG);
        if ((reg & 3) != 3)
                type = POWER_SUPPLY_TYPE_USB_CDP;
  
        /* recover original state */
 -      otg_io_write(isp->otg, ULPI_FUNC_CTRL, func_ctrl);
 -      otg_io_write(isp->otg, ULPI_OTG_CTRL, otg_ctrl);
 +      isp1704_write(isp, ULPI_FUNC_CTRL, func_ctrl);
 +      isp1704_write(isp, ULPI_OTG_CTRL, otg_ctrl);
  
        return type;
  }
@@@ -146,28 -136,28 +146,28 @@@ static inline int isp1704_charger_verif
        u8      r;
  
        /* Reset the transceiver */
 -      r = otg_io_read(isp->otg, ULPI_FUNC_CTRL);
 +      r = isp1704_read(isp, ULPI_FUNC_CTRL);
        r |= ULPI_FUNC_CTRL_RESET;
 -      otg_io_write(isp->otg, ULPI_FUNC_CTRL, r);
 +      isp1704_write(isp, ULPI_FUNC_CTRL, r);
        usleep_range(1000, 2000);
  
        /* Set normal mode */
        r &= ~(ULPI_FUNC_CTRL_RESET | ULPI_FUNC_CTRL_OPMODE_MASK);
 -      otg_io_write(isp->otg, ULPI_FUNC_CTRL, r);
 +      isp1704_write(isp, ULPI_FUNC_CTRL, r);
  
        /* Clear the DP and DM pull-down bits */
        r = ULPI_OTG_CTRL_DP_PULLDOWN | ULPI_OTG_CTRL_DM_PULLDOWN;
 -      otg_io_write(isp->otg, ULPI_CLR(ULPI_OTG_CTRL), r);
 +      isp1704_write(isp, ULPI_CLR(ULPI_OTG_CTRL), r);
  
        /* Enable strong pull-up on DP (1.5K) and reset */
        r = ULPI_FUNC_CTRL_TERMSELECT | ULPI_FUNC_CTRL_RESET;
 -      otg_io_write(isp->otg, ULPI_SET(ULPI_FUNC_CTRL), r);
 +      isp1704_write(isp, ULPI_SET(ULPI_FUNC_CTRL), r);
        usleep_range(1000, 2000);
  
        /* Read the line state */
 -      if (!otg_io_read(isp->otg, ULPI_DEBUG)) {
 +      if (!isp1704_read(isp, ULPI_DEBUG)) {
                /* Disable strong pull-up on DP (1.5K) */
 -              otg_io_write(isp->otg, ULPI_CLR(ULPI_FUNC_CTRL),
 +              isp1704_write(isp, ULPI_CLR(ULPI_FUNC_CTRL),
                                ULPI_FUNC_CTRL_TERMSELECT);
                return 1;
        }
        /* Is it a charger or PS/2 connection */
  
        /* Enable weak pull-up resistor on DP */
 -      otg_io_write(isp->otg, ULPI_SET(ISP1704_PWR_CTRL),
 +      isp1704_write(isp, ULPI_SET(ISP1704_PWR_CTRL),
                        ISP1704_PWR_CTRL_DP_WKPU_EN);
  
        /* Disable strong pull-up on DP (1.5K) */
 -      otg_io_write(isp->otg, ULPI_CLR(ULPI_FUNC_CTRL),
 +      isp1704_write(isp, ULPI_CLR(ULPI_FUNC_CTRL),
                        ULPI_FUNC_CTRL_TERMSELECT);
  
        /* Enable weak pull-down resistor on DM */
 -      otg_io_write(isp->otg, ULPI_SET(ULPI_OTG_CTRL),
 +      isp1704_write(isp, ULPI_SET(ULPI_OTG_CTRL),
                        ULPI_OTG_CTRL_DM_PULLDOWN);
  
        /* It's a charger if the line states are clear */
 -      if (!(otg_io_read(isp->otg, ULPI_DEBUG)))
 +      if (!(isp1704_read(isp, ULPI_DEBUG)))
                ret = 1;
  
        /* Disable weak pull-up resistor on DP */
 -      otg_io_write(isp->otg, ULPI_CLR(ISP1704_PWR_CTRL),
 +      isp1704_write(isp, ULPI_CLR(ISP1704_PWR_CTRL),
                        ISP1704_PWR_CTRL_DP_WKPU_EN);
  
        return ret;
@@@ -203,14 -193,14 +203,14 @@@ static inline int isp1704_charger_detec
        u8              pwr_ctrl;
        int             ret = 0;
  
 -      pwr_ctrl = otg_io_read(isp->otg, ISP1704_PWR_CTRL);
 +      pwr_ctrl = isp1704_read(isp, ISP1704_PWR_CTRL);
  
        /* set SW control bit in PWR_CTRL register */
 -      otg_io_write(isp->otg, ISP1704_PWR_CTRL,
 +      isp1704_write(isp, ISP1704_PWR_CTRL,
                        ISP1704_PWR_CTRL_SWCTRL);
  
        /* enable manual charger detection */
 -      otg_io_write(isp->otg, ULPI_SET(ISP1704_PWR_CTRL),
 +      isp1704_write(isp, ULPI_SET(ISP1704_PWR_CTRL),
                        ISP1704_PWR_CTRL_SWCTRL
                        | ISP1704_PWR_CTRL_DPVSRC_EN);
        usleep_range(1000, 2000);
        timeout = jiffies + msecs_to_jiffies(300);
        do {
                /* Check if there is a charger */
 -              if (otg_io_read(isp->otg, ISP1704_PWR_CTRL)
 +              if (isp1704_read(isp, ISP1704_PWR_CTRL)
                                & ISP1704_PWR_CTRL_VDAT_DET) {
                        ret = isp1704_charger_verify(isp);
                        break;
        } while (!time_after(jiffies, timeout) && isp->online);
  
        /* recover original state */
 -      otg_io_write(isp->otg, ISP1704_PWR_CTRL, pwr_ctrl);
 +      isp1704_write(isp, ISP1704_PWR_CTRL, pwr_ctrl);
  
        return ret;
  }
@@@ -274,8 -264,8 +274,8 @@@ static void isp1704_charger_work(struc
                case POWER_SUPPLY_TYPE_USB:
                default:
                        /* enable data pullups */
 -                      if (isp->otg->gadget)
 -                              usb_gadget_connect(isp->otg->gadget);
 +                      if (isp->phy->otg->gadget)
 +                              usb_gadget_connect(isp->phy->otg->gadget);
                }
                break;
        case USB_EVENT_NONE:
                 * chargers. The pullups may be enabled elsewhere, so this can
                 * not be the final solution.
                 */
 -              if (isp->otg->gadget)
 -                      usb_gadget_disconnect(isp->otg->gadget);
 +              if (isp->phy->otg->gadget)
 +                      usb_gadget_disconnect(isp->phy->otg->gadget);
  
                isp1704_charger_set_power(isp, 0);
                break;
@@@ -374,11 -364,11 +374,11 @@@ static inline int isp1704_test_ulpi(str
        int ret = -ENODEV;
  
        /* Test ULPI interface */
 -      ret = otg_io_write(isp->otg, ULPI_SCRATCH, 0xaa);
 +      ret = isp1704_write(isp, ULPI_SCRATCH, 0xaa);
        if (ret < 0)
                return ret;
  
 -      ret = otg_io_read(isp->otg, ULPI_SCRATCH);
 +      ret = isp1704_read(isp, ULPI_SCRATCH);
        if (ret < 0)
                return ret;
  
                return -ENODEV;
  
        /* Verify the product and vendor id matches */
 -      vendor = otg_io_read(isp->otg, ULPI_VENDOR_ID_LOW);
 -      vendor |= otg_io_read(isp->otg, ULPI_VENDOR_ID_HIGH) << 8;
 +      vendor = isp1704_read(isp, ULPI_VENDOR_ID_LOW);
 +      vendor |= isp1704_read(isp, ULPI_VENDOR_ID_HIGH) << 8;
        if (vendor != NXP_VENDOR_ID)
                return -ENODEV;
  
 -      product = otg_io_read(isp->otg, ULPI_PRODUCT_ID_LOW);
 -      product |= otg_io_read(isp->otg, ULPI_PRODUCT_ID_HIGH) << 8;
 +      product = isp1704_read(isp, ULPI_PRODUCT_ID_LOW);
 +      product |= isp1704_read(isp, ULPI_PRODUCT_ID_HIGH) << 8;
  
        for (i = 0; i < ARRAY_SIZE(isp170x_id); i++) {
                if (product == isp170x_id[i]) {
@@@ -415,8 -405,8 +415,8 @@@ static int __devinit isp1704_charger_pr
        if (!isp)
                return -ENOMEM;
  
 -      isp->otg = otg_get_transceiver();
 -      if (!isp->otg)
 +      isp->phy = usb_get_transceiver();
 +      if (!isp->phy)
                goto fail0;
  
        isp->dev = &pdev->dev;
                goto fail1;
  
        /*
 -       * REVISIT: using work in order to allow the otg notifications to be
 +       * REVISIT: using work in order to allow the usb notifications to be
         * made atomically in the future.
         */
        INIT_WORK(&isp->work, isp1704_charger_work);
  
        isp->nb.notifier_call = isp1704_notifier_call;
  
 -      ret = otg_register_notifier(isp->otg, &isp->nb);
 +      ret = usb_register_notifier(isp->phy, &isp->nb);
        if (ret)
                goto fail2;
  
         * enumerated. The charger driver should be always loaded before any
         * gadget is loaded.
         */
 -      if (isp->otg->gadget)
 -              usb_gadget_disconnect(isp->otg->gadget);
 +      if (isp->phy->otg->gadget)
 +              usb_gadget_disconnect(isp->phy->otg->gadget);
  
        /* Detect charger if VBUS is valid (the cable was already plugged). */
 -      ret = otg_io_read(isp->otg, ULPI_USB_INT_STS);
 +      ret = isp1704_read(isp, ULPI_USB_INT_STS);
        isp1704_charger_set_power(isp, 0);
 -      if ((ret & ULPI_INT_VBUS_VALID) && !isp->otg->default_a) {
 +      if ((ret & ULPI_INT_VBUS_VALID) && !isp->phy->otg->default_a) {
                isp->event = USB_EVENT_VBUS;
                schedule_work(&isp->work);
        }
  fail2:
        power_supply_unregister(&isp->psy);
  fail1:
 -      otg_put_transceiver(isp->otg);
 +      usb_put_transceiver(isp->phy);
  fail0:
        kfree(isp);
  
        dev_err(&pdev->dev, "failed to register isp1704 with error %d\n", ret);
  
+       isp1704_charger_set_power(isp, 0);
        return ret;
  }
  
@@@ -487,9 -478,9 +488,9 @@@ static int __devexit isp1704_charger_re
  {
        struct isp1704_charger *isp = platform_get_drvdata(pdev);
  
 -      otg_unregister_notifier(isp->otg, &isp->nb);
 +      usb_unregister_notifier(isp->phy, &isp->nb);
        power_supply_unregister(&isp->psy);
 -      otg_put_transceiver(isp->otg);
 +      usb_put_transceiver(isp->phy);
        isp1704_charger_set_power(isp, 0);
        kfree(isp);
  
index 5fa697477b71fa6d6fe14fecf3f679bb22851b9a,8344196b0004da66bf988e7811a14e778f83666e..ee96cd51d8b23b54683950a50831cb5cda65d2ac
   * Author: Rickard Andersson <[email protected]>
   */
  
 -#include <linux/device.h>
  #include <linux/regulator/machine.h>
  
 +struct device;
 +
  #ifndef MFD_ABX500_H
  #define MFD_ABX500_H
  
  #define AB5500_1_1    0x21
  #define AB5500_2_0    0x24
  
 -/* AB8500 CIDs*/
 -#define AB8500_CUT1P0 0x10
 -#define AB8500_CUT1P1 0x11
 -#define AB8500_CUT2P0 0x20
 -#define AB8500_CUT3P0 0x30
 -#define AB8500_CUT3P3 0x33
 -
  /*
   * AB3100, EVENTA1, A2 and A3 event register flags
   * these are catenated into a single 32-bit flag in the code
@@@ -146,6 -152,279 +146,279 @@@ struct abx500_init_settings 
        u8 setting;
  };
  
+ /* Battery driver related data */
+ /*
+  * ADC for the battery thermistor.
+  * When using the ABx500_ADC_THERM_BATCTRL the battery ID resistor is combined
+  * with a NTC resistor to both identify the battery and to measure its
+  * temperature. Different phone manufactures uses different techniques to both
+  * identify the battery and to read its temperature.
+  */
+ enum abx500_adc_therm {
+       ABx500_ADC_THERM_BATCTRL,
+       ABx500_ADC_THERM_BATTEMP,
+ };
+ /**
+  * struct abx500_res_to_temp - defines one point in a temp to res curve. To
+  * be used in battery packs that combines the identification resistor with a
+  * NTC resistor.
+  * @temp:                     battery pack temperature in Celcius
+  * @resist:                   NTC resistor net total resistance
+  */
+ struct abx500_res_to_temp {
+       int temp;
+       int resist;
+ };
+ /**
+  * struct abx500_v_to_cap - Table for translating voltage to capacity
+  * @voltage:          Voltage in mV
+  * @capacity:         Capacity in percent
+  */
+ struct abx500_v_to_cap {
+       int voltage;
+       int capacity;
+ };
+ /* Forward declaration */
+ struct abx500_fg;
+ /**
+  * struct abx500_fg_parameters - Fuel gauge algorithm parameters, in seconds
+  * if not specified
+  * @recovery_sleep_timer:     Time between measurements while recovering
+  * @recovery_total_time:      Total recovery time
+  * @init_timer:                       Measurement interval during startup
+  * @init_discard_time:                Time we discard voltage measurement at startup
+  * @init_total_time:          Total init time during startup
+  * @high_curr_time:           Time current has to be high to go to recovery
+  * @accu_charging:            FG accumulation time while charging
+  * @accu_high_curr:           FG accumulation time in high current mode
+  * @high_curr_threshold:      High current threshold, in mA
+  * @lowbat_threshold:         Low battery threshold, in mV
+  * @overbat_threshold:                Over battery threshold, in mV
+  * @battok_falling_th_sel0    Threshold in mV for battOk signal sel0
+  *                            Resolution in 50 mV step.
+  * @battok_raising_th_sel1    Threshold in mV for battOk signal sel1
+  *                            Resolution in 50 mV step.
+  * @user_cap_limit            Capacity reported from user must be within this
+  *                            limit to be considered as sane, in percentage
+  *                            points.
+  * @maint_thres                       This is the threshold where we stop reporting
+  *                            battery full while in maintenance, in per cent
+  */
+ struct abx500_fg_parameters {
+       int recovery_sleep_timer;
+       int recovery_total_time;
+       int init_timer;
+       int init_discard_time;
+       int init_total_time;
+       int high_curr_time;
+       int accu_charging;
+       int accu_high_curr;
+       int high_curr_threshold;
+       int lowbat_threshold;
+       int overbat_threshold;
+       int battok_falling_th_sel0;
+       int battok_raising_th_sel1;
+       int user_cap_limit;
+       int maint_thres;
+ };
+ /**
+  * struct abx500_charger_maximization - struct used by the board config.
+  * @use_maxi:         Enable maximization for this battery type
+  * @maxi_chg_curr:    Maximum charger current allowed
+  * @maxi_wait_cycles: cycles to wait before setting charger current
+  * @charger_curr_step delta between two charger current settings (mA)
+  */
+ struct abx500_maxim_parameters {
+       bool ena_maxi;
+       int chg_curr;
+       int wait_cycles;
+       int charger_curr_step;
+ };
+ /**
+  * struct abx500_battery_type - different batteries supported
+  * @name:                     battery technology
+  * @resis_high:                       battery upper resistance limit
+  * @resis_low:                        battery lower resistance limit
+  * @charge_full_design:               Maximum battery capacity in mAh
+  * @nominal_voltage:          Nominal voltage of the battery in mV
+  * @termination_vol:          max voltage upto which battery can be charged
+  * @termination_curr          battery charging termination current in mA
+  * @recharge_vol              battery voltage limit that will trigger a new
+  *                            full charging cycle in the case where maintenan-
+  *                            -ce charging has been disabled
+  * @normal_cur_lvl:           charger current in normal state in mA
+  * @normal_vol_lvl:           charger voltage in normal state in mV
+  * @maint_a_cur_lvl:          charger current in maintenance A state in mA
+  * @maint_a_vol_lvl:          charger voltage in maintenance A state in mV
+  * @maint_a_chg_timer_h:      charge time in maintenance A state
+  * @maint_b_cur_lvl:          charger current in maintenance B state in mA
+  * @maint_b_vol_lvl:          charger voltage in maintenance B state in mV
+  * @maint_b_chg_timer_h:      charge time in maintenance B state
+  * @low_high_cur_lvl:         charger current in temp low/high state in mA
+  * @low_high_vol_lvl:         charger voltage in temp low/high state in mV'
+  * @battery_resistance:               battery inner resistance in mOhm.
+  * @n_r_t_tbl_elements:               number of elements in r_to_t_tbl
+  * @r_to_t_tbl:                       table containing resistance to temp points
+  * @n_v_cap_tbl_elements:     number of elements in v_to_cap_tbl
+  * @v_to_cap_tbl:             Voltage to capacity (in %) table
+  * @n_batres_tbl_elements     number of elements in the batres_tbl
+  * @batres_tbl                        battery internal resistance vs temperature table
+  */
+ struct abx500_battery_type {
+       int name;
+       int resis_high;
+       int resis_low;
+       int charge_full_design;
+       int nominal_voltage;
+       int termination_vol;
+       int termination_curr;
+       int recharge_vol;
+       int normal_cur_lvl;
+       int normal_vol_lvl;
+       int maint_a_cur_lvl;
+       int maint_a_vol_lvl;
+       int maint_a_chg_timer_h;
+       int maint_b_cur_lvl;
+       int maint_b_vol_lvl;
+       int maint_b_chg_timer_h;
+       int low_high_cur_lvl;
+       int low_high_vol_lvl;
+       int battery_resistance;
+       int n_temp_tbl_elements;
+       struct abx500_res_to_temp *r_to_t_tbl;
+       int n_v_cap_tbl_elements;
+       struct abx500_v_to_cap *v_to_cap_tbl;
+       int n_batres_tbl_elements;
+       struct batres_vs_temp *batres_tbl;
+ };
+ /**
+  * struct abx500_bm_capacity_levels - abx500 capacity level data
+  * @critical:         critical capacity level in percent
+  * @low:              low capacity level in percent
+  * @normal:           normal capacity level in percent
+  * @high:             high capacity level in percent
+  * @full:             full capacity level in percent
+  */
+ struct abx500_bm_capacity_levels {
+       int critical;
+       int low;
+       int normal;
+       int high;
+       int full;
+ };
+ /**
+  * struct abx500_bm_charger_parameters - Charger specific parameters
+  * @usb_volt_max:     maximum allowed USB charger voltage in mV
+  * @usb_curr_max:     maximum allowed USB charger current in mA
+  * @ac_volt_max:      maximum allowed AC charger voltage in mV
+  * @ac_curr_max:      maximum allowed AC charger current in mA
+  */
+ struct abx500_bm_charger_parameters {
+       int usb_volt_max;
+       int usb_curr_max;
+       int ac_volt_max;
+       int ac_curr_max;
+ };
+ /**
+  * struct abx500_bm_data - abx500 battery management data
+  * @temp_under                under this temp, charging is stopped
+  * @temp_low          between this temp and temp_under charging is reduced
+  * @temp_high         between this temp and temp_over charging is reduced
+  * @temp_over         over this temp, charging is stopped
+  * @temp_now          present battery temperature
+  * @temp_interval_chg temperature measurement interval in s when charging
+  * @temp_interval_nochg       temperature measurement interval in s when not charging
+  * @main_safety_tmr_h safety timer for main charger
+  * @usb_safety_tmr_h  safety timer for usb charger
+  * @bkup_bat_v                voltage which we charge the backup battery with
+  * @bkup_bat_i                current which we charge the backup battery with
+  * @no_maintenance    indicates that maintenance charging is disabled
+  * @abx500_adc_therm  placement of thermistor, batctrl or battemp adc
+  * @chg_unknown_bat   flag to enable charging of unknown batteries
+  * @enable_overshoot  flag to enable VBAT overshoot control
+  * @auto_trig         flag to enable auto adc trigger
+  * @fg_res            resistance of FG resistor in 0.1mOhm
+  * @n_btypes          number of elements in array bat_type
+  * @batt_id           index of the identified battery in array bat_type
+  * @interval_charging charge alg cycle period time when charging (sec)
+  * @interval_not_charging charge alg cycle period time when not charging (sec)
+  * @temp_hysteresis   temperature hysteresis
+  * @gnd_lift_resistance       Battery ground to phone ground resistance (mOhm)
+  * @maxi:             maximization parameters
+  * @cap_levels                capacity in percent for the different capacity levels
+  * @bat_type          table of supported battery types
+  * @chg_params                charger parameters
+  * @fg_params         fuel gauge parameters
+  */
+ struct abx500_bm_data {
+       int temp_under;
+       int temp_low;
+       int temp_high;
+       int temp_over;
+       int temp_now;
+       int temp_interval_chg;
+       int temp_interval_nochg;
+       int main_safety_tmr_h;
+       int usb_safety_tmr_h;
+       int bkup_bat_v;
+       int bkup_bat_i;
+       bool no_maintenance;
+       bool chg_unknown_bat;
+       bool enable_overshoot;
+       bool auto_trig;
+       enum abx500_adc_therm adc_therm;
+       int fg_res;
+       int n_btypes;
+       int batt_id;
+       int interval_charging;
+       int interval_not_charging;
+       int temp_hysteresis;
+       int gnd_lift_resistance;
+       const struct abx500_maxim_parameters *maxi;
+       const struct abx500_bm_capacity_levels *cap_levels;
+       const struct abx500_battery_type *bat_type;
+       const struct abx500_bm_charger_parameters *chg_params;
+       const struct abx500_fg_parameters *fg_params;
+ };
+ struct abx500_chargalg_platform_data {
+       char **supplied_to;
+       size_t num_supplicants;
+ };
+ struct abx500_charger_platform_data {
+       char **supplied_to;
+       size_t num_supplicants;
+       bool autopower_cfg;
+ };
+ struct abx500_btemp_platform_data {
+       char **supplied_to;
+       size_t num_supplicants;
+ };
+ struct abx500_fg_platform_data {
+       char **supplied_to;
+       size_t num_supplicants;
+ };
+ struct abx500_bm_plat_data {
+       struct abx500_bm_data *battery;
+       struct abx500_charger_platform_data *charger;
+       struct abx500_btemp_platform_data *btemp;
+       struct abx500_fg_platform_data *fg;
+       struct abx500_chargalg_platform_data *chargalg;
+ };
  int abx500_set_register_interruptible(struct device *dev, u8 bank, u8 reg,
        u8 value);
  int abx500_get_register_interruptible(struct device *dev, u8 bank, u8 reg,
This page took 0.112243 seconds and 4 git commands to generate.