diff mbox

[v5,01/11] dt: power: bq24257-charger: Cover additional devices

Message ID 1442612399-341-2-git-send-email-dannenberg@ti.com
State Superseded, archived
Headers show

Commit Message

Andreas Dannenberg Sept. 18, 2015, 9:39 p.m. UTC
Extend the bq24257 charger's device tree documentation to cover the
bq24250 and bq24251 devices as well feature additions.

Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
---
 .../devicetree/bindings/power/bq24257.txt          | 55 ++++++++++++++++++++--
 1 file changed, 50 insertions(+), 5 deletions(-)

Comments

Sebastian Reichel Sept. 22, 2015, 4:24 p.m. UTC | #1
Hi,

On Fri, Sep 18, 2015 at 04:39:49PM -0500, Andreas Dannenberg wrote:
> Extend the bq24257 charger's device tree documentation to cover the
> bq24250 and bq24251 devices as well feature additions.

The binding looks fine to except for:

> +- stat-gpios: GPIO used for the devices STAT_IN pin. Alternatively the pin can
> +    also be defined through the standard interrupt definition properties (see
> +    optional properties section below). Only use one method.

Why do you expose two ways for this?

-- Sebastian
Andreas Dannenberg Sept. 22, 2015, 9:58 p.m. UTC | #2
On Tue, Sep 22, 2015 at 06:24:48PM +0200, Sebastian Reichel wrote:
> Hi,
> 
> On Fri, Sep 18, 2015 at 04:39:49PM -0500, Andreas Dannenberg wrote:
> > Extend the bq24257 charger's device tree documentation to cover the
> > bq24250 and bq24251 devices as well feature additions.
> 
> The binding looks fine to except for:
> 
> > +- stat-gpios: GPIO used for the devices STAT_IN pin. Alternatively the pin can
> > +    also be defined through the standard interrupt definition properties (see
> > +    optional properties section below). Only use one method.
> 
> Why do you expose two ways for this?

Hi Sebastian. The original driver exposed this - it just didn't
document it in the DT binding doc. I'm not sure why this was introduced
in the first place (Laurentiu?). I know we can't change the API but
since it was never documented maybe we can remove it?

Regards,

--
Andreas Dannenberg
Texas Instruments Inc


> 
> -- Sebastian


--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sebastian Reichel Sept. 23, 2015, 12:34 a.m. UTC | #3
Hi,

On Tue, Sep 22, 2015 at 04:58:24PM -0500, Andreas Dannenberg wrote:
> On Tue, Sep 22, 2015 at 06:24:48PM +0200, Sebastian Reichel wrote:
> > On Fri, Sep 18, 2015 at 04:39:49PM -0500, Andreas Dannenberg wrote:
> > > Extend the bq24257 charger's device tree documentation to cover the
> > > bq24250 and bq24251 devices as well feature additions.
> > 
> > The binding looks fine to except for:
> > 
> > > +- stat-gpios: GPIO used for the devices STAT_IN pin. Alternatively the pin can
> > > +    also be defined through the standard interrupt definition properties (see
> > > +    optional properties section below). Only use one method.
> > 
> > Why do you expose two ways for this?
> 
> Hi Sebastian. The original driver exposed this - it just didn't
> document it in the DT binding doc. I'm not sure why this was introduced
> in the first place (Laurentiu?). I know we can't change the API but
> since it was never documented maybe we can remove it?

It seems this is neither documented, nor used. So I guess it can be
removed. Let's wait for feedback from Laurentiu, though.

-- Sebastian
Laurentiu Palcu Sept. 23, 2015, 8:14 a.m. UTC | #4
Hi,

On Wed, Sep 23, 2015 at 02:34:15AM +0200, Sebastian Reichel wrote:
> Hi,
> 
> On Tue, Sep 22, 2015 at 04:58:24PM -0500, Andreas Dannenberg wrote:
> > On Tue, Sep 22, 2015 at 06:24:48PM +0200, Sebastian Reichel wrote:
> > > On Fri, Sep 18, 2015 at 04:39:49PM -0500, Andreas Dannenberg wrote:
> > > > Extend the bq24257 charger's device tree documentation to cover the
> > > > bq24250 and bq24251 devices as well feature additions.
> > > 
> > > The binding looks fine to except for:
> > > 
> > > > +- stat-gpios: GPIO used for the devices STAT_IN pin. Alternatively the pin can
> > > > +    also be defined through the standard interrupt definition properties (see
> > > > +    optional properties section below). Only use one method.
> > > 
> > > Why do you expose two ways for this?
> > 
> > Hi Sebastian. The original driver exposed this - it just didn't
> > document it in the DT binding doc. I'm not sure why this was introduced
> > in the first place (Laurentiu?). I know we can't change the API but
> > since it was never documented maybe we can remove it?
> 
> It seems this is neither documented, nor used. So I guess it can be
> removed. Let's wait for feedback from Laurentiu, though.
This was needed to have both ACPI and DT enumeration work. At the time I
wrote the driver, GpioInt resources in ACPI were not passed to the
driver in client->irq, as opposed to DT enumeration.

However, conveniently enough, the patch below landed in master by the
same time bq24257 driver went in. So, I believe it should be safe now to
remove the stat-gpio probing.

commit 845c877009cf014b971aab7f54613f9185a824b0
Author: Mika Westerberg <mika.westerberg@linux.intel.com>
Date:   Wed May 6 13:29:08 2015 +0300

    i2c / ACPI: Assign IRQ for devices that have GpioInt automatically

laurentiu
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Andreas Dannenberg Sept. 23, 2015, 2:13 p.m. UTC | #5
On Wed, Sep 23, 2015 at 11:14:56AM +0300, Laurentiu Palcu wrote:
> Hi,
> 
> On Wed, Sep 23, 2015 at 02:34:15AM +0200, Sebastian Reichel wrote:
> > Hi,
> > 
> > On Tue, Sep 22, 2015 at 04:58:24PM -0500, Andreas Dannenberg wrote:
> > > On Tue, Sep 22, 2015 at 06:24:48PM +0200, Sebastian Reichel wrote:
> > > > On Fri, Sep 18, 2015 at 04:39:49PM -0500, Andreas Dannenberg wrote:
> > > > > Extend the bq24257 charger's device tree documentation to cover the
> > > > > bq24250 and bq24251 devices as well feature additions.
> > > > 
> > > > The binding looks fine to except for:
> > > > 
> > > > > +- stat-gpios: GPIO used for the devices STAT_IN pin. Alternatively the pin can
> > > > > +    also be defined through the standard interrupt definition properties (see
> > > > > +    optional properties section below). Only use one method.
> > > > 
> > > > Why do you expose two ways for this?
> > > 
> > > Hi Sebastian. The original driver exposed this - it just didn't
> > > document it in the DT binding doc. I'm not sure why this was introduced
> > > in the first place (Laurentiu?). I know we can't change the API but
> > > since it was never documented maybe we can remove it?
> > 
> > It seems this is neither documented, nor used. So I guess it can be
> > removed. Let's wait for feedback from Laurentiu, though.
> This was needed to have both ACPI and DT enumeration work. At the time I
> wrote the driver, GpioInt resources in ACPI were not passed to the
> driver in client->irq, as opposed to DT enumeration.
> 
> However, conveniently enough, the patch below landed in master by the
> same time bq24257 driver went in. So, I believe it should be safe now to
> remove the stat-gpio probing.
> 
> commit 845c877009cf014b971aab7f54613f9185a824b0
> Author: Mika Westerberg <mika.westerberg@linux.intel.com>
> Date:   Wed May 6 13:29:08 2015 +0300
> 
>     i2c / ACPI: Assign IRQ for devices that have GpioInt automatically
> 

Thanks for the background! I'll be happy to simplify this as part of my
patch series.

--
Andreas Dannenberg
Texas Instruments Inc
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/Documentation/devicetree/bindings/power/bq24257.txt b/Documentation/devicetree/bindings/power/bq24257.txt
index 5c9d394..3815897 100644
--- a/Documentation/devicetree/bindings/power/bq24257.txt
+++ b/Documentation/devicetree/bindings/power/bq24257.txt
@@ -1,21 +1,66 @@ 
-Binding for TI bq24257 Li-Ion Charger
+Binding for TI bq24250/bq24251/bq24257 Li-Ion Charger
 
 Required properties:
 - compatible: Should contain one of the following:
+ * "ti,bq24250"
+ * "ti,bq24251"
  * "ti,bq24257"
-- reg:			   integer, i2c address of the device.
+- reg: integer, i2c address of the device.
+- stat-gpios: GPIO used for the devices STAT_IN pin. Alternatively the pin can
+    also be defined through the standard interrupt definition properties (see
+    optional properties section below). Only use one method.
 - ti,battery-regulation-voltage: integer, maximum charging voltage in uV.
-- ti,charge-current:	   integer, maximum charging current in uA.
-- ti,termination-current:  integer, charge will be terminated when current in
-			   constant-voltage phase drops below this value (in uA).
+- ti,charge-current: integer, maximum charging current in uA.
+- ti,termination-current: integer, charge will be terminated when current in
+    constant-voltage phase drops below this value (in uA).
+
+Optional properties:
+- pg-gpios: GPIO used for connecting the bq2425x device PG (Power Good) pin.
+    This pin is not available on all devices however it should be used if
+    possible as this is the recommended way to obtain the charger's input PG
+    state. If this pin is not specified a software-based approach for PG
+    detection is used.
+- ti,current-limit: The maximum current to be drawn from the charger's input
+    (in uA). If this property is not specified a USB D+/D- signal based charger
+    type detection is used (if available) and the input limit current is set
+    accordingly. If the D+/D- based detection is not available on a given device
+    a default of 500,000 is used (=500mA).
+- ti,ovp-voltage: Configures the over voltage protection voltage (in uV). If
+    not specified a default of 6,5000,000 (=6.5V) is used.
+- ti,in-dpm-voltage: Configures the threshold input voltage for the dynamic
+    power path management (in uV). If not specified a default of 4,360,000
+    (=4.36V) is used.
+- interrupt-parent: Should be the phandle for the interrupt controller. Use in
+    conjunction with "interrupts" and only in case "stat-gpios" is not used.
+- interrupts: Interrupt mapping for GPIO IRQ (configure for both edges). Use in
+    conjunction with "interrupt-parent" and only in case "stat-gpios" is not
+    used.
 
 Example:
 
 bq24257 {
 	compatible = "ti,bq24257";
 	reg = <0x6a>;
+	stat-gpios = <&gpio1 16 GPIO_ACTIVE_HIGH>;
+	pg-gpios = <&gpio1 28 GPIO_ACTIVE_HIGH>;
 
 	ti,battery-regulation-voltage = <4200000>;
 	ti,charge-current = <1000000>;
 	ti,termination-current = <50000>;
 };
+
+Example:
+
+bq24250 {
+	compatible = "ti,bq24250";
+	reg = <0x6a>;
+	interrupt-parent = <&gpio1>;
+	interrupts = <16 IRQ_TYPE_EDGE_BOTH>;
+
+	ti,battery-regulation-voltage = <4200000>;
+	ti,charge-current = <500000>;
+	ti,termination-current = <50000>;
+	ti,current-limit = <900000>;
+	ti,ovp-voltage = <9500000>;
+	ti,in-dpm-voltage = <4440000>;
+};