Skip to contentSkip to conversation

ARM: MMP: add 88pm860x battery-charger support

PATCH Superseded Jett.Zhou 4 participants 4 messages Mar 27, 2012 – May 7, 2012

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Jett.Zhou

author
#0 lore raw

PATCH 3/3 ARM: MMP: add 88pm860x battery-charger support

Add 88pm860x chg_desc platform data for ttc platform.

---
 arch/arm/mach-mmp/ttc_dkb.c |   37 +++++++++++++++++++++++++++++++++++++
 1 files changed, 37 insertions(+), 0 deletions(-)
arch/arm/mach-mmp/ttc_dkb.c +37 -0
index 5ac5d58..4e18be7 100644
@@ -17,6 +17,9 @@
 #include <linux/interrupt.h>
 #include <linux/i2c/pca953x.h>
 #include <linux/gpio.h>
+#include <linux/mfd/88pm860x.h>
+#include <linux/regulator/consumer.h>
+#include <linux/power/charger-manager.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -134,8 +137,42 @@ static struct pca953x_platform_data max7312_data[] = {
 	},
 };
 
+static char *ttc_psy_chg_stat[] = {"usb", NULL};
+/*
+ * Temperature can be handled by battery monitor base on interrupt
+ * scheme, so dummy it to make sure charger-manager initialize ok.
+ */
+static int dummy_temp_out_of_range(int *mC)
+{
+	*mC = 2500;
+	return 0;
+}
+
+struct charger_desc chg_desc_data = {
+	.polling_mode		= CM_POLL_ALWAYS,
+	.polling_interval_ms	= 180000,
+	.battery_present	= CM_FUEL_GAUGE,
+	.psy_charger_stat	= &ttc_psy_chg_stat[0],
+	.psy_fuel_gauge		= "battery-monitor",
+	.temperature_out_of_range	= dummy_temp_out_of_range,
+};
+
+static struct pm860x_platform_data ttc_dkb_pm8607_info = {
+	.chg_desc	= &chg_desc_data,
+	.companion_addr	= 0x11,
+	.irq_mode	= 0,
+	.irq_base	= IRQ_BOARD_START,
+	.i2c_port	= GI2C_PORT,
+};
+
 static struct i2c_board_info ttc_dkb_i2c_info[] = {
 	{
+		.type		= "88PM860x",
+		.addr		= 0x34,
+		.platform_data	= &ttc_dkb_pm8607_info,
+		.irq		= IRQ_PXA910_PMIC_INT,
+	},
+	{
 		.type		= "max7312",
 		.addr		= 0x23,
 		.irq		= MMP_GPIO_TO_IRQ(80),
Signature · 1 line
1.7.0.4
#1 lore raw

PATCH 3/3 ARM: MMP: add 88pm860x battery-charger support

Quoted 4 lines · Jett.Zhou

Add 88pm860x chg_desc platform data for ttc platform.

---

May I have an ack from ARM/MMP folks to take this into battery tree with the rest of the series?

Thanks!

Quoted 62 lines
 arch/arm/mach-mmp/ttc_dkb.c |   37 +++++++++++++++++++++++++++++++++++++
 1 files changed, 37 insertions(+), 0 deletions(-)
arch/arm/mach-mmp/ttc_dkb.c +37 -0
index 5ac5d58..4e18be7 100644
@@ -17,6 +17,9 @@
 #include <linux/interrupt.h>
 #include <linux/i2c/pca953x.h>
 #include <linux/gpio.h>
+#include <linux/mfd/88pm860x.h>
+#include <linux/regulator/consumer.h>
+#include <linux/power/charger-manager.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -134,8 +137,42 @@ static struct pca953x_platform_data max7312_data[] = {
 	},
 };
 
+static char *ttc_psy_chg_stat[] = {"usb", NULL};
+/*
+ * Temperature can be handled by battery monitor base on interrupt
+ * scheme, so dummy it to make sure charger-manager initialize ok.
+ */
+static int dummy_temp_out_of_range(int *mC)
+{
+	*mC = 2500;
+	return 0;
+}
+
+struct charger_desc chg_desc_data = {
+	.polling_mode		= CM_POLL_ALWAYS,
+	.polling_interval_ms	= 180000,
+	.battery_present	= CM_FUEL_GAUGE,
+	.psy_charger_stat	= &ttc_psy_chg_stat[0],
+	.psy_fuel_gauge		= "battery-monitor",
+	.temperature_out_of_range	= dummy_temp_out_of_range,
+};
+
+static struct pm860x_platform_data ttc_dkb_pm8607_info = {
+	.chg_desc	= &chg_desc_data,
+	.companion_addr	= 0x11,
+	.irq_mode	= 0,
+	.irq_base	= IRQ_BOARD_START,
+	.i2c_port	= GI2C_PORT,
+};
+
 static struct i2c_board_info ttc_dkb_i2c_info[] = {
 	{
+		.type		= "88PM860x",
+		.addr		= 0x34,
+		.platform_data	= &ttc_dkb_pm8607_info,
+		.irq		= IRQ_PXA910_PMIC_INT,
+	},
+	{
 		.type		= "max7312",
 		.addr		= 0x23,
 		.irq		= MMP_GPIO_TO_IRQ(80),
Signature · 1 line
1.7.0.4
Signature · 2 lines
Anton Vorontsov
Email: cbouatmailru at gmail.com
#2 lore raw

PATCH 3/3 ARM: MMP: add 88pm860x battery-charger support

Quoted 44 lines · Anton Vorontsov
Quoted 4 lines · Jett.Zhou

Add 88pm860x chg_desc platform data for ttc platform.

---

May I have an ack from ARM/MMP folks to take this into battery tree with the rest of the series?

Thanks!

Quoted 33 lines

?arch/arm/mach-mmp/ttc_dkb.c | ? 37 +++++++++++++++++++++++++++++++++++++ ?1 files changed, 37 insertions(+), 0 deletions(-)

arch/arm/mach-mmp/ttc_dkb.c +0 -0
index 5ac5d58..4e18be7 100644
@@ -17,6 +17,9 @@

?#include <linux/interrupt.h>
?#include <linux/i2c/pca953x.h>
?#include <linux/gpio.h>

arch/arm/mach-mmp/ttc_dkb.c +3 -0
+#include <linux/mfd/88pm860x.h>
+#include <linux/regulator/consumer.h>
+#include <linux/power/charger-manager.h>

?#include <asm/mach-types.h>
?#include <asm/mach/arch.h>

arch/arm/mach-mmp/ttc_dkb.c +12 -0
@@ -134,8 +137,42 @@ static struct pca953x_platform_data max7312_data[] = {
 ? ? ? },
 ?};
 
+static char *ttc_psy_chg_stat[] = {"usb", NULL};
+/*
+ * Temperature can be handled by battery monitor base on interrupt
+ * scheme, so dummy it to make sure charger-manager initialize ok.
+ */
+static int dummy_temp_out_of_range(int *mC)
+{
+ ? ? *mC = 2500;
+ ? ? return 0;
+}
+
+struct charger_desc chg_desc_data = {
Quoted 8 lines

arch/arm/mach-mmp/ttc_dkb.c static struct pca953x_platform_data max7312_data[] = { · line 159

Quoted 8 lines
arch/arm/mach-mmp/ttc_dkb.c +8 -0
+ ? ? .polling_mode ? ? ? ? ? = CM_POLL_ALWAYS,
+ ? ? .polling_interval_ms ? ?= 180000,
+ ? ? .battery_present ? ? ? ?= CM_FUEL_GAUGE,
+ ? ? .psy_charger_stat ? ? ? = &ttc_psy_chg_stat[0],
+ ? ? .psy_fuel_gauge ? ? ? ? = "battery-monitor",
+ ? ? .temperature_out_of_range ? ? ? = dummy_temp_out_of_range,
+};
+m ARM/MMP folks to take this into battery tree

with the rest of the se

Quoted 10 lines
Quoted 10 lines
arch/arm/mach-mmp/ttc_dkb.c +8 -0
+static struct pm860x_platform_data ttc_dkb_pm8607_info = {
+ ? ? .chg_desc ? ? ? = &chg_desc_data,
+ ? ? .companion_addr = 0x11,
+ ? ? .irq_mode ? ? ? = 0,
+ ? ? .irq_base ? ? ? = IRQ_BOARD_START,
+ ? ? .i2c_port ? ? ? = GI2C_PORT,
+};
+
 ?static struct i2c_board_info ttc_dkb_i2c_info[] = {
 ? ? ? {
Quoted 8 lines
Quoted 8 lines
arch/arm/mach-mmp/ttc_dkb.c +6 -0
+ ? ? ? ? ? ? .type ? ? ? ? ? = "88PM860x",
+ ? ? ? ? ? ? .addr ? ? ? ? ? = 0x34,
+ ? ? ? ? ? ? .platform_data ?= &ttc_dkb_pm8607_info,
+ ? ? ? ? ? ? .irq ? ? ? ? ? ?= IRQ_PXA910_PMIC_INT,
+ ? ? },
+ ? ? {
 ? ? ? ? ? ? ? .type ? ? ? ? ? = "max7312",

? ? ? ? ? ? ? .addr ? ? ? ? ? = 0x23,m ARM/MMP folks to take this into battery tree

with the rest of the se

Quoted 3 lines
Quoted 3 lines

? ? ? ? ? ? ? .irq ? ? ? ? ? ?= MMP_GPIO_TO_IRQ(80), --
1.7.0.4m ARM/MMP folks to take this into battery tree

with the rest of the se

Quoted 4 lines

--
Anton Vorontsov
Email: cbouatmailru at gmail.com

#3 lore raw

PATCH 3/3 ARM: MMP: add 88pm860x battery-charger support

In reply to Jett.Zhou

2012/3/27 Jett.Zhou <[email protected]>

Quoted 65 lines

Add 88pm860x chg_desc platform data for ttc platform.

---
?arch/arm/mach-mmp/ttc_dkb.c | ? 37 +++++++++++++++++++++++++++++++++++++ ?1 files changed, 37 insertions(+), 0 deletions(-)

arch/arm/mach-mmp/ttc_dkb.c +0 -0
index 5ac5d58..4e18be7 100644
@@ -17,6 +17,9 @@

?#include <linux/interrupt.h>
?#include <linux/i2c/pca953x.h>
?#include <linux/gpio.h>

arch/arm/mach-mmp/ttc_dkb.c +3 -0
+#include <linux/mfd/88pm860x.h>
+#include <linux/regulator/consumer.h>
+#include <linux/power/charger-manager.h>

?#include <asm/mach-types.h>
?#include <asm/mach/arch.h>

arch/arm/mach-mmp/ttc_dkb.c +34 -0
@@ -134,8 +137,42 @@ static struct pca953x_platform_data max7312_data[] =
 {
 ? ? ? ?},
 ?};
 
+static char *ttc_psy_chg_stat[] = {"usb", NULL};
+/*
+ * Temperature can be handled by battery monitor base on interrupt
+ * scheme, so dummy it to make sure charger-manager initialize ok.
+ */
+static int dummy_temp_out_of_range(int *mC)
+{
+ ? ? ? *mC = 2500;
+ ? ? ? return 0;
+}
+
+struct charger_desc chg_desc_data = {
+ ? ? ? .polling_mode ? ? ? ? ? = CM_POLL_ALWAYS,
+ ? ? ? .polling_interval_ms ? ?= 180000,
+ ? ? ? .battery_present ? ? ? ?= CM_FUEL_GAUGE,
+ ? ? ? .psy_charger_stat ? ? ? = &ttc_psy_chg_stat[0],
+ ? ? ? .psy_fuel_gauge ? ? ? ? = "battery-monitor",
+ ? ? ? .temperature_out_of_range ? ? ? = dummy_temp_out_of_range,
+};
+
+static struct pm860x_platform_data ttc_dkb_pm8607_info = {
+ ? ? ? .chg_desc ? ? ? = &chg_desc_data,
+ ? ? ? .companion_addr = 0x11,
+ ? ? ? .irq_mode ? ? ? = 0,
+ ? ? ? .irq_base ? ? ? = IRQ_BOARD_START,
+ ? ? ? .i2c_port ? ? ? = GI2C_PORT,
+};
+
 ?static struct i2c_board_info ttc_dkb_i2c_info[] = {
 ? ? ? ?{
+ ? ? ? ? ? ? ? .type ? ? ? ? ? = "88PM860x",
+ ? ? ? ? ? ? ? .addr ? ? ? ? ? = 0x34,
+ ? ? ? ? ? ? ? .platform_data ?= &ttc_dkb_pm8607_info,
+ ? ? ? ? ? ? ? .irq ? ? ? ? ? ?= IRQ_PXA910_PMIC_INT,
+ ? ? ? },
+ ? ? ? {
 ? ? ? ? ? ? ? ?.type ? ? ? ? ? = "max7312",
 ? ? ? ? ? ? ? ?.addr ? ? ? ? ? = 0x23,
Quoted 4 lines

? ? ? ? ? ? ? ?.irq ? ? ? ? ? ?= MMP_GPIO_TO_IRQ(80), --
1.7.0.4

Quoted 5 lines

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel