power: bq24617: Adding initial charger support
PATCH 1/1 power: bq24617: Adding initial charger support
From: Rhyland Klein <[email protected]>
Initial checkin adding basic support for the TI BQ24617 battery charger on the Nvidia Tegra architecture.
--- drivers/power/Kconfig | 7 + drivers/power/Makefile | 1 + drivers/power/tegra_bq24617.c | 259 +++++++++++++++++++++++++++++++++++++++++ include/linux/tegra_bq24617.h | 10 ++ 4 files changed, 277 insertions(+), 0 deletions(-) create mode 100644 drivers/power/tegra_bq24617.c create mode 100644 include/linux/tegra_bq24617.h
drivers/power/Kconfig +7 -0
@@ -185,4 +185,11 @@ config CHARGER_TWL4030 help Say Y here to enable support for TWL4030 Battery Charge Interface. +config CHARGER_BQ24617_TEGRA + tristate "BQ24617 Tegra battery charger" + depends on I2C && ARCH_TEGRA + help + Say Y to include support for the TI BQ24617 battery charger on + the Nvidia Tegra platform. + endif # POWER_SUPPLY
drivers/power/Makefile +1 -0
@@ -32,3 +32,4 @@ 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_TWL4030) += twl4030_charger.o +obj-$(CONFIG_CHARGER_BQ24617_TEGRA) += tegra_bq24617.o
drivers/power/tegra_bq24617.c new file +259 -0
259 lines not on this page · raw message
include/linux/tegra_bq24617.h new file +10 -0
@@ -0,0 +1,10 @@ +#ifndef _LINUX_BQ24617_H +#define _LINUX_BQ24617_H + +struct bq24617_platform_data { +int gpio_addr; +char **batteries; +int num_batteries; +}; + +#endif
Signature · 1 line
1.7.0.4
Quoted 4 lines · On Tue, Oct 19, 2010 at 07:17:11PM -0700, [email protected] wrote:
From: Rhyland Klein <[email protected]>
Initial checkin adding basic support for the TI BQ24617 battery charger on the Nvidia Tegra architecture.
Why is this driver dependant on the CPU? I can't see anything in the code that makes it so.
drivers/power/tegra_bq24617.c line 69
Quoted 6 lines
drivers/power/tegra_bq24617.c new file +6
-0+if (old_status !=-1 && + old_status != new_status) { +dev_dbg (&chip->pdev->dev, +"%s: %i -> %i\n" , __func__, old_status, + new_status); +kobject_uevent (&chip->power_supply.dev->kobj,KOBJ_CHANGE );
power_supply_changed().
drivers/power/tegra_bq24617.c line 81
Quoted 8 lines
drivers/power/tegra_bq24617.c new file +8
-0+static irqreturn_t bq24617_irq_switch (int irq,void *devid) +{ +struct bq24617_info *chip = devid; + +schedule_work (&chip->ac_work); + +return IRQ_HANDLED ; +}
You're looking for a threaded IRQ handler here - use request_threaded_irq() with no primary handler.
Quoted 8 lines
From: Mark Brown [mailto:[email protected]]
Sent: Tuesday, October 19, 2010 8:03 PM
To: Rhyland Klein
Cc: [email protected]; Andrew Chew; [email protected]; linux- [email protected]; [email protected]
Subject: Re: [PATCH 1/1] power: bq24617: Adding initial charger supportOn Tue, Oct 19, 2010 at 07:17:11PM -0700, [email protected] wrote:
Quoted 8 lines
Quoted 3 lines
From: Rhyland Klein <[email protected]>
Initial checkin adding basic support for the TI BQ24617 battery charger
on the
Quoted 1 line
Nvidia Tegra architecture.
Why is this driver dependant on the CPU? I can't see anything in the code that makes it so.
In hindsight this isn't the most accurate statement. The driver itself is not dependent on the CPU, it is dependent on the platform design, and in particular requires the PG line to be piped in through a GPIO. Would it make more sense to make the driver dependent on GPIO instead?
Quoted 9 lines
drivers/power/tegra_bq24617.c line 69
Quoted 7 lines
drivers/power/tegra_bq24617.c new file +6
-0+if (old_status !=-1 && + old_status != new_status) { +dev_dbg (&chip->pdev->dev, +"%s: %i -> %i\n" , __func__, old_status, + new_status); +kobject_uevent (&chip->power_supply.dev->kobj,KOBJ_CHANGE );
power_supply_changed().
Alright.
Quoted 12 lines
drivers/power/tegra_bq24617.c line 81
Quoted 9 lines
drivers/power/tegra_bq24617.c new file +8
-0+static irqreturn_t bq24617_irq_switch (int irq,void *devid) +{ +struct bq24617_info *chip = devid; + +schedule_work (&chip->ac_work); + +return IRQ_HANDLED ; +}You're looking for a threaded IRQ handler here - use
request_threaded_irq()with no primary handler.
Alright I will look into this.
Quoted 23 lines
-----Original Message-----
From: [email protected] [mailto:linux-kernel- [email protected]] On Behalf Of Rhyland Klein
Sent: Wednesday, October 20, 2010 10:52 AM
To: Mark Brown
Cc: [email protected]; Andrew Chew; [email protected]; linux- [email protected]; [email protected]
Subject: RE: [PATCH 1/1] power: bq24617: Adding initial charger supportQuoted 14 lines
From: Mark Brown [mailto:[email protected]]
Sent: Tuesday, October 19, 2010 8:03 PM
To: Rhyland Klein
Cc: [email protected]; Andrew Chew; [email protected]; linux- [email protected]; [email protected]
Subject: Re: [PATCH 1/1] power: bq24617: Adding initial charger supportQuoted 3 lines · On Tue, Oct 19, 2010 at 07:17:11PM -0700, [email protected] wrote:
From: Rhyland Klein <[email protected]>
Initial checkin adding basic support for the TI BQ24617 battery charger
on the
Quoted 1 line
Nvidia Tegra architecture.
Quoted 8 lines
Quoted 2 lines
Why is this driver dependant on the CPU? I can't see anything in the code that makes it so.
In hindsight this isn't the most accurate statement. The driver itself is not dependent on the CPU, it is dependent on the platform design, and in particular requires the PG line to be piped in through a GPIO. Would it make more sense to make the driver dependent on GPIO instead?
Sorry for the confusion on this, I am removing the TEGRA dependency as it isn't necessary.
Quoted 31 lines
Quoted 9 lines
drivers/power/tegra_bq24617.c line 69
Quoted 7 lines
drivers/power/tegra_bq24617.c new file +6
-0+if (old_status !=-1 && + old_status != new_status) { +dev_dbg (&chip->pdev->dev, +"%s: %i -> %i\n" , __func__, old_status, + new_status); +kobject_uevent (&chip->power_supply.dev->kobj,KOBJ_CHANGE );
power_supply_changed().Alright.
Quoted 12 lines
drivers/power/tegra_bq24617.c line 81
Quoted 9 lines
drivers/power/tegra_bq24617.c new file +8
-0+static irqreturn_t bq24617_irq_switch (int irq,void *devid) +{ +struct bq24617_info *chip = devid; + +schedule_work (&chip->ac_work); + +return IRQ_HANDLED ; +}You're looking for a threaded IRQ handler here - use
request_threaded_irq()with no primary handler.Alright I will look into this.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Quoted 55 lines
-----Original Message-----
From: Rhyland Klein
Sent: Wednesday, October 20, 2010 10:52 AM
To: 'Mark Brown'
Cc: [email protected]; Andrew Chew; [email protected]; linux- [email protected]; [email protected]
Subject: RE: [PATCH 1/1] power: bq24617: Adding initial charger supportQuoted 8 lines
From: Mark Brown [mailto:[email protected]]
Sent: Tuesday, October 19, 2010 8:03 PM
To: Rhyland Klein
Cc: [email protected]; Andrew Chew; [email protected]; linux- [email protected]; [email protected]
Subject: Re: [PATCH 1/1] power: bq24617: Adding initial charger supportOn Tue, Oct 19, 2010 at 07:17:11PM -0700, [email protected] wrote:
Quoted 8 lines
Quoted 3 lines
From: Rhyland Klein <[email protected]>
Initial checkin adding basic support for the TI BQ24617 battery charger
on the
Quoted 1 line
Nvidia Tegra architecture.
Why is this driver dependant on the CPU? I can't see anything in the code that makes it so.
In hindsight this isn't the most accurate statement. The driver itself is not dependent on the CPU, it is dependent on the platform design, and in particular requires the PG line to be piped in through a GPIO. Would it make more sense to make the driver dependent on GPIO instead?
Quoted 9 lines
drivers/power/tegra_bq24617.c line 69
Quoted 7 lines
drivers/power/tegra_bq24617.c new file +6
-0+if (old_status !=-1 && + old_status != new_status) { +dev_dbg (&chip->pdev->dev, +"%s: %i -> %i\n" , __func__, old_status, + new_status); +kobject_uevent (&chip->power_supply.dev->kobj,KOBJ_CHANGE );
power_supply_changed().Alright.
Quoted 12 lines
drivers/power/tegra_bq24617.c line 81
Quoted 9 lines
drivers/power/tegra_bq24617.c new file +8
-0+static irqreturn_t bq24617_irq_switch (int irq,void *devid) +{ +struct bq24617_info *chip = devid; + +schedule_work (&chip->ac_work); + +return IRQ_HANDLED ; +}You're looking for a threaded IRQ handler here - use
request_threaded_irq()with no primary handler.
Quoted 1 line
Alright I will look into this.
Fixing Anton's email address here, I had a typo in it.