Skip to contentSkip to conversation

power: sbs-battery: Rename bq20z75 to sbs-battery

PATCH In review Rhyland Klein 1 participant 3 messages Dec 5, 2011 Power supply

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 power: sbs-battery: Rename bq20z75 to sbs-battery

The register set used in the bq20z75 is really just the set defined by the SBS spec. With that in mind, this patch is intended to generalize the driver to in name support any SBS compliant gas gauge.

-Rename source files to sbs-battery.*
-Rename internals with "sbs"

Change-Id Ibdfae134c7af9dc1b730d01b36f010f9a1923968
---
 drivers/power/Kconfig             |    8 +-
 drivers/power/Makefile            |    2 +-
 drivers/power/bq20z75.c           |  792 -------------------------------------
 drivers/power/sbs-battery.c       |  775 ++++++++++++++++++++++++++++++++++++
 include/linux/power/bq20z75.h     |   42 --
 include/linux/power/sbs-battery.h |   42 ++
 6 files changed, 822 insertions(+), 839 deletions(-)
 delete mode 100644 drivers/power/bq20z75.c
 create mode 100644 drivers/power/sbs-battery.c
 delete mode 100644 include/linux/power/bq20z75.h
 create mode 100644 include/linux/power/sbs-battery.h
drivers/power/Kconfig +4 -4
index e57b50b..4da63de 100644
@@ -115,12 +115,12 @@ config BATTERY_WM97XX
 	help
 	  Say Y to enable support for battery measured by WM97xx aux port.
 
-config BATTERY_BQ20Z75
-        tristate "TI BQ20z75 gas gauge"
+config BATTERY_SBS
+        tristate "SBS Compliant gas gauge"
         depends on I2C
         help
-         Say Y to include support for TI BQ20z75 SBS-compliant
-         gas gauge and protection IC.
+         Say Y to include support for SBS battery driver for SBS-compliant
+         gas gauges.
 
 config BATTERY_BQ27x00
 	tristate "BQ27x00 battery driver"
drivers/power/Makefile +1 -1
index 009a90f..9a180e8 100644
@@ -22,7 +22,7 @@ obj-$(CONFIG_BATTERY_OLPC)	+= olpc_battery.o
 obj-$(CONFIG_BATTERY_TOSA)	+= tosa_battery.o
 obj-$(CONFIG_BATTERY_COLLIE)	+= collie_battery.o
 obj-$(CONFIG_BATTERY_WM97XX)	+= wm97xx_battery.o
-obj-$(CONFIG_BATTERY_BQ20Z75)	+= bq20z75.o
+obj-$(CONFIG_BATTERY_SBS)	+= sbs-battery.o
 obj-$(CONFIG_BATTERY_BQ27x00)	+= bq27x00_battery.o
 obj-$(CONFIG_BATTERY_DA9030)	+= da9030_battery.o
 obj-$(CONFIG_BATTERY_MAX17040)	+= max17040_battery.o
drivers/power/bq20z75.c deleted +0 -792

792 lines not on this page · raw message

drivers/power/sbs-battery.c new file +775 -0

775 lines not on this page · raw message

include/linux/power/bq20z75.h deleted +0 -42

42 lines not on this page · raw message

include/linux/power/sbs-battery.h new file +42 -0

42 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#1 lore raw

PATCH 2/2 Added parameter for selection power supply name from pdata

Change-Id Ib0a41ff9ac8c1fc97aa7a87320f8d95be7988d71
---
 drivers/power/sbs-battery.c       |    2 +-
 include/linux/power/sbs-battery.h |    2 ++
 2 files changed, 3 insertions(+), 1 deletions(-)
drivers/power/sbs-battery.c +1 -1
index 1e60a54..567b8c1 100644
@@ -615,7 +615,7 @@ static int __devinit sbs_probe(struct i2c_client *client,
 	chip->client = client;
 	chip->enable_detection = false;
 	chip->gpio_detect = false;
-	chip->power_supply.name = "battery";
+	chip->power_supply.name = (pdata->power_supply_name ? : "battery");
 	chip->power_supply.type = POWER_SUPPLY_TYPE_BATTERY;
 	chip->power_supply.properties = sbs_properties;
 	chip->power_supply.num_properties = ARRAY_SIZE(sbs_properties);
include/linux/power/sbs-battery.h +2 -0
index 2b0a9d9..fa9bc89 100644
@@ -31,12 +31,14 @@
  * @i2c_retry_count:		# of times to retry on i2c IO failure
  * @poll_retry_count:		# of times to retry looking for new status after
  *				external change notification
+ * @power_supply_name:		Optional name for power supply: default: battery
  */
 struct sbs_platform_data {
 	int battery_detect;
 	int battery_detect_present;
 	int i2c_retry_count;
 	int poll_retry_count;
+	const char *power_supply_name;
 };
 
 #endif
Signature · 1 line
1.7.0.4
#2 lore raw

Re: [PATCH 2/2] Added parameter for selection power supply name from pdata

Quoted 29 lines · Rhyland Klein
Change-Id Ib0a41ff9ac8c1fc97aa7a87320f8d95be7988d71
---
 drivers/power/sbs-battery.c       |    2 +-
 include/linux/power/sbs-battery.h |    2 ++
 2 files changed, 3 insertions(+), 1 deletions(-)
drivers/power/sbs-battery.c +1 -1
index 1e60a54..567b8c1 100644
@@ -615,7 +615,7 @@ static int __devinit sbs_probe(struct i2c_client *client,
 	chip->client = client;
 	chip->enable_detection = false;
 	chip->gpio_detect = false;
-	chip->power_supply.name = "battery";
+	chip->power_supply.name = (pdata->power_supply_name ? : "battery");
 	chip->power_supply.type = POWER_SUPPLY_TYPE_BATTERY;
 	chip->power_supply.properties = sbs_properties;
 	chip->power_supply.num_properties = ARRAY_SIZE(sbs_properties);
include/linux/power/sbs-battery.h +1 -0
index 2b0a9d9..fa9bc89 100644
@@ -31,12 +31,14 @@
  * @i2c_retry_count:		# of times to retry on i2c IO failure
  * @poll_retry_count:		# of times to retry looking for new status after
  *				external change notification
+ * @power_supply_name:		Optional name for power supply: default: battery

include/linux/power/sbs-battery.h line 44

Quoted 10 lines
include/linux/power/sbs-battery.h +1 -0
  */
 struct sbs_platform_data {
 	int battery_detect;
 	int battery_detect_present;
 	int i2c_retry_count;
 	int poll_retry_count;
+	const char *power_supply_name;
 };
 
 #endif

Oops, ignore these, proper patches coming soon.

-rhyland