Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ea0ca3a8 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
* 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
parents 74e6392c 906649de
Loading
Loading
Loading
Loading
+25 −2
Original line number Diff line number Diff line
@@ -23,6 +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>
@@ -53,6 +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 +114,30 @@ static struct spi_board_info rx51_peripherals_spi_board_info[] __initdata = {
	},
};

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",
	.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
@@ -961,6 +984,6 @@ void __init rx51_peripherals_init(void)
	if (partition)
		omap2_hsmmc_init(mmc);

	platform_device_register(&rx51_charger_device);
	rx51_charger_init();
}
+9 −0
Original line number Diff line number Diff line
@@ -210,6 +210,15 @@ config CHARGER_ISP1704
	  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
+1 −0
Original line number Diff line number Diff line
@@ -33,5 +33,6 @@ 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_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
+6 −5
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@
 * Copyright (C) 2008 Rodolfo Giometti <giometti@linux.it>
 * Copyright (C) 2008 Eurotech S.p.A. <info@eurotech.it>
 * Copyright (C) 2010-2011 Lars-Peter Clausen <lars@metafoo.de>
 * Copyright (C) 2011 Pali Rohár <pali.rohar@gmail.com>
 *
 * Based on a previous work by Copyright (C) 2008 Texas Instruments, Inc.
 *
@@ -76,7 +77,7 @@ struct bq27x00_reg_cache {
	int time_to_empty_avg;
	int time_to_full;
	int charge_full;
	int charge_counter;
	int cycle_count;
	int capacity;
	int flags;

@@ -115,7 +116,7 @@ static enum power_supply_property bq27x00_battery_props[] = {
	POWER_SUPPLY_PROP_CHARGE_FULL,
	POWER_SUPPLY_PROP_CHARGE_NOW,
	POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN,
	POWER_SUPPLY_PROP_CHARGE_COUNTER,
	POWER_SUPPLY_PROP_CYCLE_COUNT,
	POWER_SUPPLY_PROP_ENERGY_NOW,
};

@@ -267,7 +268,7 @@ static void bq27x00_update(struct bq27x00_device_info *di)
		cache.time_to_empty_avg = bq27x00_battery_read_time(di, BQ27x00_REG_TTECP);
		cache.time_to_full = bq27x00_battery_read_time(di, BQ27x00_REG_TTF);
		cache.charge_full = bq27x00_battery_read_lmd(di);
		cache.charge_counter = bq27x00_battery_read_cyct(di);
		cache.cycle_count = bq27x00_battery_read_cyct(di);

		if (!is_bq27500)
			cache.current_now = bq27x00_read(di, BQ27x00_REG_AI, false);
@@ -496,8 +497,8 @@ static int bq27x00_battery_get_property(struct power_supply *psy,
	case POWER_SUPPLY_PROP_CHARGE_FULL_DESIGN:
		ret = bq27x00_simple_value(di->charge_design_full, val);
		break;
	case POWER_SUPPLY_PROP_CHARGE_COUNTER:
		ret = bq27x00_simple_value(di->cache.charge_counter, val);
	case POWER_SUPPLY_PROP_CYCLE_COUNT:
		ret = bq27x00_simple_value(di->cache.cycle_count, val);
		break;
	case POWER_SUPPLY_PROP_ENERGY_NOW:
		ret = bq27x00_battery_energy(di, val);
+5 −1
Original line number Diff line number Diff line
@@ -86,7 +86,11 @@ static int rated_capacities[] = {
	920,	/* NEC */
	1440,	/* Samsung */
	1440,	/* BYD */
#ifdef CONFIG_MACH_H4700
	1800,	/* HP iPAQ hx4700 3.7V 1800mAh (359113-001) */
#else
	1440,	/* Lishen */
#endif
	1440,	/* NEC */
	2880,	/* Samsung */
	2880,	/* BYD */
@@ -186,7 +190,7 @@ static int ds2760_battery_read_status(struct ds2760_device_info *di)

	scale[0] = di->full_active_uAh;
	for (i = 1; i < 5; i++)
		scale[i] = scale[i - 1] + di->raw[DS2760_ACTIVE_FULL + 2 + i];
		scale[i] = scale[i - 1] + di->raw[DS2760_ACTIVE_FULL + 1 + i];

	di->full_active_uAh = battery_interpolate(scale, di->temp_C / 10);
	di->full_active_uAh *= 1000; /* convert to µAh */
Loading