Merge git://git.infradead.org/battery-2.6
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 27 May 2011 17:12:35 +0000 (10:12 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 27 May 2011 17:12:35 +0000 (10:12 -0700)
* git://git.infradead.org/battery-2.6:
  PXA: Use dev_pm_ops in z2_battery
  ds2760_battery: Fix rated capacity of the hx4700 1800mAh battery
  ds2760_battery: Fix indexing of the 4 active full EEPROM registers
  power: Make test_power driver more dynamic.
  bq27x00_battery: Name of cycle count property
  max8903_charger: Add GENERIC_HARDIRQS as a dependency (fixes S390 build)
  ARM: RX-51: Enable isp1704 power on/off
  isp1704_charger: Allow board specific powering routine
  gpio-charger: Add gpio_charger_resume
  power_supply: Add driver for MAX8903 charger

1  2 
arch/arm/mach-omap2/board-rx51-peripherals.c
drivers/power/Kconfig
drivers/power/Makefile

@@@ -23,6 -23,7 +23,7 @@@
  #include <linux/gpio.h>
  #include <linux/gpio_keys.h>
  #include <linux/mmc/host.h>
+ #include <linux/power/isp1704_charger.h>
  
  #include <plat/mcspi.h>
  #include <plat/board.h>
@@@ -43,7 -44,6 +44,7 @@@
  
  #include "mux.h"
  #include "hsmmc.h"
 +#include "common-board-devices.h"
  
  #define SYSTEM_REV_B_USES_VAUX3       0x1699
  #define SYSTEM_REV_S_USES_VAUX3 0x8
@@@ -53,6 -53,8 +54,8 @@@
  #define RX51_FMTX_RESET_GPIO          163
  #define RX51_FMTX_IRQ                 53
  
+ #define RX51_USB_TRANSCEIVER_RST_GPIO 67
  /* list all spi devices here */
  enum {
        RX51_SPI_WL1251,
@@@ -111,10 -113,30 +114,30 @@@ static struct spi_board_info rx51_perip
        },
  };
  
+ static void rx51_charger_set_power(bool on)
+ {
+       gpio_set_value(RX51_USB_TRANSCEIVER_RST_GPIO, on);
+ }
+ static struct isp1704_charger_data rx51_charger_data = {
+       .set_power      = rx51_charger_set_power,
+ };
  static struct platform_device rx51_charger_device = {
-       .name = "isp1704_charger",
+       .name   = "isp1704_charger",
+       .dev    = {
+               .platform_data = &rx51_charger_data,
+       },
  };
  
+ static void __init rx51_charger_init(void)
+ {
+       WARN_ON(gpio_request_one(RX51_USB_TRANSCEIVER_RST_GPIO,
+               GPIOF_OUT_INIT_LOW, "isp1704_reset"));
+       platform_device_register(&rx51_charger_device);
+ }
  #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
  
  #define RX51_GPIO_CAMERA_LENS_COVER   110
@@@ -558,8 -580,10 +581,8 @@@ static __init void rx51_init_si4713(voi
  static int rx51_twlgpio_setup(struct device *dev, unsigned gpio, unsigned n)
  {
        /* FIXME this gpio setup is just a placeholder for now */
 -      gpio_request(gpio + 6, "backlight_pwm");
 -      gpio_direction_output(gpio + 6, 0);
 -      gpio_request(gpio + 7, "speaker_en");
 -      gpio_direction_output(gpio + 7, 1);
 +      gpio_request_one(gpio + 6, GPIOF_OUT_INIT_LOW, "backlight_pwm");
 +      gpio_request_one(gpio + 7, GPIOF_OUT_INIT_HIGH, "speaker_en");
  
        return 0;
  }
@@@ -729,7 -753,7 +752,7 @@@ static struct twl4030_resconfig twl4030
        { .resource = RES_RESET, .devgroup = -1,
          .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
        },
 -      { .resource = RES_Main_Ref, .devgroup = -1,
 +      { .resource = RES_MAIN_REF, .devgroup = -1,
          .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
        },
        { 0, 0},
@@@ -776,6 -800,15 +799,6 @@@ static struct tpa6130a2_platform_data r
        .power_gpio             = 98,
  };
  
 -static struct i2c_board_info __initdata rx51_peripherals_i2c_board_info_1[] = {
 -      {
 -              I2C_BOARD_INFO("twl5030", 0x48),
 -              .flags = I2C_CLIENT_WAKE,
 -              .irq = INT_34XX_SYS_NIRQ,
 -              .platform_data = &rx51_twldata,
 -      },
 -};
 -
  /* Audio setup data */
  static struct aic3x_setup_data rx51_aic34_setup = {
        .gpio_func[0] = AIC3X_GPIO1_FUNC_DISABLED,
@@@ -823,7 -856,8 +846,7 @@@ static int __init rx51_i2c_init(void
                rx51_twldata.vaux3 = &rx51_vaux3_cam;
        }
        rx51_twldata.vmmc2 = &rx51_vmmc2;
 -      omap_register_i2c_bus(1, 2200, rx51_peripherals_i2c_board_info_1,
 -                            ARRAY_SIZE(rx51_peripherals_i2c_board_info_1));
 +      omap_pmic_init(1, 2200, "twl5030", INT_34XX_SYS_NIRQ, &rx51_twldata);
        omap_register_i2c_bus(2, 100, rx51_peripherals_i2c_board_info_2,
                              ARRAY_SIZE(rx51_peripherals_i2c_board_info_2));
        omap_register_i2c_bus(3, 400, NULL, 0);
@@@ -910,20 -944,26 +933,20 @@@ static void rx51_wl1251_set_power(bool 
        gpio_set_value(RX51_WL1251_POWER_GPIO, enable);
  }
  
 +static struct gpio rx51_wl1251_gpios[] __initdata = {
 +      { RX51_WL1251_POWER_GPIO, GPIOF_OUT_INIT_LOW,   "wl1251 power"  },
 +      { RX51_WL1251_IRQ_GPIO,   GPIOF_IN,             "wl1251 irq"    },
 +};
 +
  static void __init rx51_init_wl1251(void)
  {
        int irq, ret;
  
 -      ret = gpio_request(RX51_WL1251_POWER_GPIO, "wl1251 power");
 +      ret = gpio_request_array(rx51_wl1251_gpios,
 +                               ARRAY_SIZE(rx51_wl1251_gpios));
        if (ret < 0)
                goto error;
  
 -      ret = gpio_direction_output(RX51_WL1251_POWER_GPIO, 0);
 -      if (ret < 0)
 -              goto err_power;
 -
 -      ret = gpio_request(RX51_WL1251_IRQ_GPIO, "wl1251 irq");
 -      if (ret < 0)
 -              goto err_power;
 -
 -      ret = gpio_direction_input(RX51_WL1251_IRQ_GPIO);
 -      if (ret < 0)
 -              goto err_irq;
 -
        irq = gpio_to_irq(RX51_WL1251_IRQ_GPIO);
        if (irq < 0)
                goto err_irq;
  
  err_irq:
        gpio_free(RX51_WL1251_IRQ_GPIO);
 -
 -err_power:
        gpio_free(RX51_WL1251_POWER_GPIO);
 -
  error:
        printk(KERN_ERR "wl1251 board initialisation failed\n");
        wl1251_pdata.set_power = NULL;
@@@ -961,6 -1004,6 +984,6 @@@ void __init rx51_peripherals_init(void
        if (partition)
                omap2_hsmmc_init(mmc);
  
-       platform_device_register(&rx51_charger_device);
+       rx51_charger_init();
  }
  
diff --combined drivers/power/Kconfig
@@@ -68,13 -68,6 +68,13 @@@ config BATTERY_DS276
        help
          Say Y here to enable support for batteries with ds2760 chip.
  
 +config BATTERY_DS2780
 +      tristate "DS2780 battery driver"
 +      select W1
 +      select W1_SLAVE_DS2780
 +      help
 +        Say Y here to enable support for batteries with ds2780 chip.
 +
  config BATTERY_DS2782
        tristate "DS2782/DS2786 standalone gas-gauge"
        depends on I2C
@@@ -210,6 -203,15 +210,15 @@@ config CHARGER_ISP170
          Say Y to enable support for USB Charger Detection with
          ISP1707/ISP1704 USB transceivers.
  
+ config CHARGER_MAX8903
+       tristate "MAX8903 Battery DC-DC Charger for USB and Adapter Power"
+       depends on GENERIC_HARDIRQS
+       help
+         Say Y to enable support for the MAX8903 DC-DC charger and sysfs.
+         The driver supports controlling charger-enable and current-limit
+         pins based on the status of charger connections with interrupt
+         handlers.
  config CHARGER_TWL4030
        tristate "OMAP TWL4030 BCI charger driver"
        depends on TWL4030_CORE
diff --combined drivers/power/Makefile
@@@ -15,7 -15,6 +15,7 @@@ obj-$(CONFIG_WM8350_POWER)    += wm8350_po
  obj-$(CONFIG_TEST_POWER)      += test_power.o
  
  obj-$(CONFIG_BATTERY_DS2760)  += ds2760_battery.o
 +obj-$(CONFIG_BATTERY_DS2780)  += ds2780_battery.o
  obj-$(CONFIG_BATTERY_DS2782)  += ds2782_battery.o
  obj-$(CONFIG_BATTERY_PMU)     += pmu_battery.o
  obj-$(CONFIG_BATTERY_OLPC)    += olpc_battery.o
@@@ -33,5 -32,6 +33,6 @@@ obj-$(CONFIG_CHARGER_PCF50633)        += pcf50
  obj-$(CONFIG_BATTERY_JZ4740)  += jz4740-battery.o
  obj-$(CONFIG_BATTERY_INTEL_MID)       += intel_mid_battery.o
  obj-$(CONFIG_CHARGER_ISP1704) += isp1704_charger.o
+ obj-$(CONFIG_CHARGER_MAX8903) += max8903_charger.o
  obj-$(CONFIG_CHARGER_TWL4030) += twl4030_charger.o
  obj-$(CONFIG_CHARGER_GPIO)    += gpio-charger.o