Add support for tps65090-charger
v3 cover Add support for tps65090-charger
This patchset adds support for the TPS65090-charger. This charger is registered as a subdevice of the TPS65090 PMIC.
This series includes a fix for the tps65090 header file where all the interrupts were shifted by 1.
v3:
- fixed up the tps65090-charger driver to fix build errors/warnings
v2:
- cleaned up tps65090 driver per comments (mostly var naming)
- flushed out commit description for driver
- reordered probe so irq is registered after power_supply and cleaned up 1st
Rhyland Klein (4):
mfd: tps65090: Fix enum in header file
mfd: tps65090: Add resources for charger
power_supply: tps65090-charger: Add binding doc
power: tps65090: Add support for tps65090-charger
.../devicetree/bindings/power_supply/tps65090.txt | 23 ++ drivers/mfd/tps65090.c | 10 + drivers/power/Kconfig | 7 + drivers/power/Makefile | 1 + drivers/power/tps65090-charger.c | 315 ++++++++++++++++++++ include/linux/mfd/tps65090.h | 6 + 6 files changed, 362 insertions(+) create mode 100644 Documentation/devicetree/bindings/power_supply/tps65090.txt create mode 100644 drivers/power/tps65090-charger.c
Signature · 1 line
1.7.9.5
PATCH v3 1/4 mfd: tps65090: Fix enum in header file
The enum is missing the definition for the first bit, which makes all the rest off by one. Add definition for the TPS65090_IRQ_INTERRUPT bit which at 0.
---
v3:
- no changes since v2
v2:
- no changes since v1
include/linux/mfd/tps65090.h | 1 + 1 file changed, 1 insertion(+)
include/linux/mfd/tps65090.h +1 -0
@@ -27,6 +27,7 @@/* TPS65090 IRQs */ enum { +TPS65090_IRQ_INTERRUPT ,TPS65090_IRQ_VAC_STATUS_CHANGE ,TPS65090_IRQ_VSYS_STATUS_CHANGE ,TPS65090_IRQ_BAT_STATUS_CHANGE ,
Signature · 1 line
1.7.9.5
PATCH v3 2/4 mfd: tps65090: Add resources for charger
In reply to Rhyland KleinAdd irq resources to pass to the charger mfd sub dev so the charger can listen for interrupts.
---
v3:
- no changes since v2
v2:
- no changes since v1
drivers/mfd/tps65090.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/mfd/tps65090.c +10 -0
@@ -56,12 +56,22 @@#define TPS65090_INT2_MASK_OVERLOAD_FET6 6#define TPS65090_INT2_MASK_OVERLOAD_FET7 7 +static struct resource charger_resources[] = { + { + .start =TPS65090_IRQ_VAC_STATUS_CHANGE , + .end =TPS65090_IRQ_VAC_STATUS_CHANGE , + .flags =IORESOURCE_IRQ , + } +}; +static struct mfd_cell tps65090s[] = { { .name ="tps65090-pmic" , }, { .name ="tps65090-charger" , + .num_resources =ARRAY_SIZE (charger_resources), + .resources = &charger_resources[0 ], }, };
Signature · 1 line
1.7.9.5
Re: [Patch v3 2/4] mfd: tps65090: Add resources for charger
Quoted 31 lines · Rhyland Klein
Add irq resources to pass to the charger mfd sub dev so the charger can listen for interrupts.
Signed-off-by Rhyland Klein <[email protected]>---
v3:
- no changes since v2
v2:
- no changes since v1drivers/mfd/tps65090.c | 10 ++++++++++ 1 file changed, 10 insertions(+)drivers/mfd/tps65090.c +8
-0@@ -56,12 +56,22 @@#define TPS65090_INT2_MASK_OVERLOAD_FET6 6#define TPS65090_INT2_MASK_OVERLOAD_FET7 7 +static struct resource charger_resources[] = { + { + .start =TPS65090_IRQ_VAC_STATUS_CHANGE , + .end =TPS65090_IRQ_VAC_STATUS_CHANGE , + .flags =IORESOURCE_IRQ , + } +}; +static struct mfd_cell tps65090s[] = {
drivers/mfd/tps65090.c line 77
Quoted 10 lines
drivers/mfd/tps65090.c +2
-0{ .name = "tps65090-pmic", }, { .name = "tps65090-charger", + .num_resources = ARRAY_SIZE(charger_resources), + .resources = &charger_resources[0], }, };
Samuel, Anton merged patches 3 & 4 of this series. Have you had a chance to review patches 1 & 2 ?
-rhyland
Signature · 1 line
nvpublic
PATCH v3 3/4 power_supply: tps65090-charger: Add binding doc
In reply to Rhyland KleinThis change adds the binding documentation for the tps65090-charger.
---
v3:
- no changes since v2
v2:
- no changes since v1
.../devicetree/bindings/power_supply/tps65090.txt | 23 ++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Documentation/devicetree/bindings/power_supply/tps65090.txt
Documentation/devicetree/bindings/power_supply/tps65090.txt new file +23 -0
@@ -0,0 +1,23 @@ +TPS65090 Frontend PMU with Switchmode Charger + +Required Properties: +-compatible: "ti,tps65090" +-reg: I2C slave address +-interrupts: the interrupt output to which this device connects + +Optional Properties: +-ti,enable-low-current-chrg: Enables charging when a low current is detected + while the default logic is to stop charging. + +Example: + + tps65090@48 { + compatible = "ti,tps65090"; + reg = <0x48>; + interrupts = <0 88 0x4>; + + ti,enable-low-current-chrg; + + regulators { + ... + };
Signature · 1 line
1.7.9.5
Re: [Patch v3 3/4] power_supply: tps65090-charger: Add binding doc
Quoted 6 lines · Rhyland Klein
This change adds the binding documentation for the tps65090-charger.
Documentation/devicetree/bindings/power_supply/tps65090.txt +2
-0+Example: +
Documentation/devicetree/bindings/power_supply/tps65090.txt line 23
Quoted 10 lines
Documentation/devicetree/bindings/power_supply/tps65090.txt +10
-0+ tps65090@48 { + compatible = "ti,tps65090"; + reg = <0x48>; + interrupts = <0 88 0x4>; + + ti,enable-low-current-chrg; + + regulators { + ... + };
I'm a little confused by this binding.
What goes in the regulators sub-node; is that specified by another binding file in bindings/regulator/tps65090.txt?
I would expect one of the following:
1) A single binding file that describes absolutely everything in the chip. In this case, the main TPS65909 node wouldn't have child nodes for the MFD components, although the regulators sub-node, which in turn contains children does still make sense.
2) A separate binding for each component block, and perhaps also some top-level binding that indicates which child bindings can "plug into" it. In this case, I'd expect each block to be represented as a sub-node in DT. The overall regulator component might then still have a regulators child DT node itself, to represent each regulator's configuration. In this scenario, each binding document describes the entirety of a single node.
I think what you've got here is a hybrid; a single top-level node, but different binding documents defining the various properties that are relevant to each component block in the device. That seems odd to me.
Re: [Patch v3 3/4] power_supply: tps65090-charger: Add binding doc
Quoted 35 lines · Stephen Warren
Quoted 4 lines · Rhyland Klein
This change adds the binding documentation for the tps65090-charger.
Documentation/devicetree/bindings/power_supply/tps65090.txt +2
-0+Example: +Documentation/devicetree/bindings/power_supply/tps65090.txt line 23
Quoted 10 lines
Documentation/devicetree/bindings/power_supply/tps65090.txt +10
-0+ tps65090@48 { + compatible = "ti,tps65090"; + reg = <0x48>; + interrupts = <0 88 0x4>; + + ti,enable-low-current-chrg; + + regulators { + ... + };I'm a little confused by this binding.
What goes in the regulators sub-node; is that specified by another binding file in
bindings/regulator/tps65090.txt?I would expect one of the following:
1) A single binding file that describes absolutely everything in the chip. In this case, the main TPS65909 node wouldn't have child nodes for the MFD components, although the regulators sub-node, which in turn contains children does still make sense.
2) A separate binding for each component block, and perhaps also some top-level binding that indicates which child bindings can "plug into" it. In this case, I'd expect each block to be represented as a sub-node in DT. The overall regulator component might then still have a regulators child DT node itself, to represent each regulator's configuration. In this scenario, each binding document describes the entirety of a single node.
Quoted 3 lines
I think what you've got here is a hybrid; a single top-level node, but different binding documents defining the various properties that are relevant to each component block in the device. That seems odd to me.
Yes we started this discussion before and were discussing the proper arrangement of documentation when dealing with devices like these. This is where the drivers/ directory naming in the binding docs might diverge a bit as it might make less sense to have a binding doc for each child component of an mfd.
I was thinking about moving this driver towards #1 above, and using a child node for the charger. I would then also move the regulators to a child node, and its structure would be very similar to the Palmas driver/dt representation. My only concern was that, from what I understood, separating out the child node implied that the child functionality could/might be used somewhere else. Say in this case, that the charger functionality might be duplicated in another pmic from ti. I don't know how much that is the case with the tps65090 and so I am unsure if child nodes are the correct way to go.
As for #2, This would also be fine with me, as logically we are talking about a single chip. I this the only concern here is where to place a single binding document in the bindings directory where it makes sense. Putting regulator documentation under charger or vice versa doesn't make sense. And then for some devices, they might also have an rtc, gpio controller, interrupt controller, etc.. If each of them had a driver and their own dt information, I don't know where a single core place for all that documentation would be right now.
Hence, I was hoping to continue this dicussion and see if we can decide on the most logical choice, whatever that may be.
-rhyland
Signature · 1 line
nvpublic
Re: [Patch v3 3/4] power_supply: tps65090-charger: Add binding doc
Quoted 38 lines · Rhyland Klein
Quoted 37 lines · Stephen Warren
Quoted 6 lines · Rhyland Klein
This change adds the binding documentation for the tps65090-charger. diff --git
a/Documentation/devicetree/bindings/power_supply/tps65090.txtb/Documentation/devicetree/bindings/power_supply/tps65090.txtDocumentation/devicetree/bindings/power_supply/tps65090.txt new file +2
-0+Example: +Documentation/devicetree/bindings/power_supply/tps65090.txt line 23
Quoted 10 lines
Documentation/devicetree/bindings/power_supply/tps65090.txt new file +10
-0+ tps65090@48 { + compatible = "ti,tps65090"; + reg = <0x48>; + interrupts = <0 88 0x4>; + + ti,enable-low-current-chrg; + + regulators { + ... + };I'm a little confused by this binding.
What goes in the regulators sub-node; is that specified by another binding file in
bindings/regulator/tps65090.txt?I would expect one of the following:
1) A single binding file that describes absolutely everything in the chip. In this case, the main TPS65909 node wouldn't have child nodes for the MFD components, although the regulators sub-node, which in turn contains children does still make sense.
2) A separate binding for each component block, and perhaps also some top-level binding that indicates which child bindings can "plug into" it. In this case, I'd expect each block to be represented as a sub-node in DT. The overall regulator component might then still have a regulators child DT node itself, to represent each regulator's configuration. In this scenario, each binding document describes the entirety of a single node.
Quoted 6 lines
Quoted 3 lines
I think what you've got here is a hybrid; a single top-level node, but different binding documents defining the various properties that are relevant to each component block in the device. That seems odd to me.
Yes we started this discussion before and were discussing the proper arrangement of
(your message was wrapped far over 80 columns, please restrict to something like 72-74 or so).
Quoted 5 lines
documentation when dealing with devices like these. This is where the
drivers/directory
naming in the binding docs might diverge a bit as it might make less sense to have
a binding doc for each child component of an mfd.
I think your discussion swaps #1 and #2 relative to my list above? It certainly makes more sense if I read it that way.
Quoted 11 lines
I was thinking about moving this driver towards #1 above, and using a child node for
the charger. I would then also move the regulators to a child node, and its structure would
be very similar to the Palmas driver/dt representation. My only concern was that, from
what I understood, separating out the child node implied that the child functionality
could/might be used somewhere else. Say in this case, that the charger functionality might
be duplicated in another pmic from ti.
Having separate nodes certainly makes it easy to /allow/ that. I don't think it /requires/ that TI release (or plan to release) another chip containing that IP block.
Quoted 2 lines
I don't know how much that is the case with the
tps65090 and so I am unsure if child nodes are the correct way to go.
Thinking more about this, separate child nodes for separate IP blocks do start to make some sense. They definitely do allow easy binding/driver/... re-use if future chips come out with the same sub-block. Similarly, they neatly isolate each sub-block's binding from the others, so (a) avoid any conflicts between what the different IP blocks want to put in their nodes, like a list of regulators vs. using sub-nodes for other purposes, such as an integrate I2C mux with I2C bus child nodes, etc, and (b) the bindings can be defined separately thus avoiding the "where do we put the binding file" issue.
It's certainly more work, but now I tend to think separate nodes are the way to go.
Quoted 17 lines
As for #2, This would also be fine with me, as logically we are talking about a single chip. I
this the only concern here is where to place a single binding document in the bindings
directory where it makes sense. Putting regulator documentation under charger or vice
versa doesn't make sense. And then for some devices, they might also have an rtc, gpio
controller, interrupt controller, etc.. If each of them had a driver and their own dt
information, I don't know where a single core place for all that documentation would be
right now.Hence, I was hoping to continue this dicussion and see if we can decide on the most logical
choice, whatever that may be.
Re: [Patch v3 3/4] power_supply: tps65090-charger: Add binding doc
Quoted 43 lines · Stephen Warren
Quoted 42 lines · Rhyland Klein
Quoted 40 lines · Stephen Warren
Quoted 6 lines · Rhyland Klein
This change adds the binding documentation for the tps65090-charger. diff --git
a/Documentation/devicetree/bindings/power_supply/tps65090.txtb/Documentation/devicetree/bindings/power_supply/tps65090.txtDocumentation/devicetree/bindings/power_supply/tps65090.txt new file +2
-0+Example: +Documentation/devicetree/bindings/power_supply/tps65090.txt line 23
Quoted 10 lines
Documentation/devicetree/bindings/power_supply/tps65090.txt new file +10
-0+ tps65090@48 { + compatible = "ti,tps65090"; + reg = <0x48>; + interrupts = <0 88 0x4>; + + ti,enable-low-current-chrg; + + regulators { + ... + };I'm a little confused by this binding.
What goes in the regulators sub-node; is that specified by another binding file in
bindings/regulator/tps65090.txt?I would expect one of the following:
1) A single binding file that describes absolutely everything in the chip. In this case, the main TPS65909 node wouldn't have child nodes for the MFD components, although the regulators sub-node, which in turn contains children does still make sense.
2) A separate binding for each component block, and perhaps also some top-level binding that indicates which child bindings can "plug into" it. In this case, I'd expect each block to be represented as a sub-node in DT. The overall regulator component might then still have a regulators child DT node itself, to represent each regulator's configuration. In this scenario, each binding document describes the entirety of a single node.
I think what you've got here is a hybrid; a single top-level node, but different binding documents defining the various properties that are relevant to each component block in the device. That seems odd to me.
Quoted 5 lines
Quoted 2 lines
Yes we started this discussion before and were discussing the proper arrangement of
(your message was wrapped far over 80 columns, please restrict to something like 72-74 or so).
Apparently line wrapping only works properly on thunderbird if you force it to plain text (which of course I think I had...) all better now.
Quoted 9 lines
Quoted 6 lines
documentation when dealing with devices like these. This is where the
drivers/directory
naming in the binding docs might diverge a bit as it might make less sense to have
a binding doc for each child component of an mfd.I think your discussion swaps #1 and #2 relative to my list above? It certainly makes more sense if I read it that way.
Yep you're right, I swapped them.
Quoted 30 lines
Quoted 12 lines
I was thinking about moving this driver towards #1 above, and using a child node for
the charger. I would then also move the regulators to a child node, and its structure would
be very similar to the Palmas driver/dt representation. My only concern was that, from
what I understood, separating out the child node implied that the child functionality
could/might be used somewhere else. Say in this case, that the charger functionality might
be duplicated in another pmic from ti.Having separate nodes certainly makes it easy to /allow/ that. I don't think it /requires/ that TI release (or plan to release) another chip containing that IP block.
Quoted 2 lines
I don't know how much that is the case with the
tps65090 and so I am unsure if child nodes are the correct way to go.Thinking more about this, separate child nodes for separate IP blocks do start to make some sense. They definitely do allow easy binding/driver/... re-use if future chips come out with the same sub-block. Similarly, they neatly isolate each sub-block's binding from the others, so (a) avoid any conflicts between what the different IP blocks want to put in their nodes, like a list of regulators vs. using sub-nodes for other purposes, such as an integrate I2C mux with I2C bus child nodes, etc, and (b) the bindings can be defined separately thus avoiding the "where do we put the binding file" issue.
Quoted 2 lines
It's certainly more work, but now I tend to think separate nodes are the way to go.
I agree, I think this is definitely a much cleaner way of doing it, then each component gets its own documentation file and is clean.
-rhyland
Signature · 1 line
nvpublic
PATCH v3 4/4 power: tps65090: Add support for tps65090-charger
In reply to Rhyland KleinThis patch adds support for the tps65090 charger driver. This driver is responsible for controlling the charger aspect of the tps65090 mfd. Currently, this mainly consists of turning on and off the charger, but some features of the charger can be supported through this driver including:
Enable Auto Recharge based on Battery voltage
Fast Charge Safety Timer
Maximum battery discharge current
Maximum battery adapter current
Enable External Charge
Disable charging termination based on low charger current (supported)
Once the driver is accepted, later patches can add support for the features above which are not yet supported.
Based on work by:
Syed Rafiuddin <[email protected]>
Laxman Dewangan <[email protected]>
---
v3:
- fixed build errors/warnings around devm_free_irq and unused irq label
v2:
- updated commit description with more info
- cleaned up misc comments (var names, spacing, etc)
- reordered probe around irq so it is cleaner
drivers/power/Kconfig | 7 + drivers/power/Makefile | 1 + drivers/power/tps65090-charger.c | 315 ++++++++++++++++++++++++++++++++++++++ include/linux/mfd/tps65090.h | 5 + 4 files changed, 328 insertions(+) create mode 100644 drivers/power/tps65090-charger.c
drivers/power/Kconfig +7 -0
@@ -340,6 +340,13 @@ config CHARGER_SMB347 Say Y to include support for Summit Microelectronics SMB347 Battery Charger. +config CHARGER_TPS65090 + tristate "TPS65090 battery charger driver" + depends on MFD_TPS65090 + help + Say Y here to enable support for battery charging with TPS65090 + PMIC chips. + config AB8500_BM bool "AB8500 Battery Management Driver" depends on AB8500_CORE && AB8500_GPADC
drivers/power/Makefile +1 -0
@@ -53,4 +53,5 @@ obj-$(CONFIG_CHARGER_MAX8998) += max8998_charger.o obj-$(CONFIG_CHARGER_BQ2415X) += bq2415x_charger.o obj-$(CONFIG_POWER_AVS) += avs/ obj-$(CONFIG_CHARGER_SMB347) += smb347-charger.o +obj-$(CONFIG_CHARGER_TPS65090) += tps65090-charger.o obj-$(CONFIG_POWER_RESET) += reset/
drivers/power/tps65090-charger.c new file +315 -0
315 lines not on this page · raw message
include/linux/mfd/tps65090.h +5 -0
@@ -87,6 +87,11 @@ struct tps65090_regulator_plat_data {struct tps65090_platform_data {int irq_base; + +char **supplied_to; +size_t num_supplicants; +int enable_low_current_chrg; +struct tps65090_regulator_plat_data *reg_pdata[TPS65090_REGULATOR_MAX ]; };
Signature · 1 line
1.7.9.5
Quoted 5 lines · Rhyland Klein
This patchset adds support for the TPS65090-charger. This charger is registered as a subdevice of the TPS65090 PMIC.
This series includes a fix for the tps65090 header file where all the interrupts were shifted by 1.
Thanks for the patches, Rhyland! 3/4 and 4/4 applied to the battery-2.6.git tree.
Anton
Quoted 7 lines · Anton Vorontsov
Quoted 5 lines · Rhyland Klein
This patchset adds support for the TPS65090-charger. This charger is registered as a subdevice of the TPS65090 PMIC.
This series includes a fix for the tps65090 header file where all the interrupts were shifted by 1.
Quoted 9 lines
Thanks for the patches, Rhyland! 3/4 and 4/4 applied to the battery-2.6.git tree.
Anton
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
I was planning on posting a slightly changed v4 sometime soon which took care of some concerns on the Documentation and added a compatibility entry for the charger. Do you want me to send that still and you can replace v3 with v4?
-rhyland
Signature · 1 line
nvpublic
Quoted 8 lines · Rhyland Klein
Quoted 7 lines · Anton Vorontsov
Quoted 5 lines · Rhyland Klein
This patchset adds support for the TPS65090-charger. This charger is registered as a subdevice of the TPS65090 PMIC.
This series includes a fix for the tps65090 header file where all the interrupts were shifted by 1.
Quoted 7 lines
Quoted 3 lines
Thanks for the patches, Rhyland! 3/4 and 4/4 applied to the battery-2.6.git tree.
I was planning on posting a slightly changed v4 sometime soon which took care of some concerns on the Documentation and added a compatibility entry for the charger. Do you want me to send that still and you can replace v3 with v4?
I would rather avoid replacing, i.e. I'd prefer if you send an update on top of the v3 (incremental patch). If the changes were inspired by someone, feel free to add a Suggested-by: tag. ;-)
Thanks!
Anton
Quoted 17 lines · Anton Vorontsov
Quoted 8 lines · Rhyland Klein
Quoted 7 lines · Anton Vorontsov
Quoted 5 lines · Rhyland Klein
This patchset adds support for the TPS65090-charger. This charger is registered as a subdevice of the TPS65090 PMIC.
This series includes a fix for the tps65090 header file where all the interrupts were shifted by 1.
Quoted 7 lines
Quoted 3 lines
Thanks for the patches, Rhyland! 3/4 and 4/4 applied to the battery-2.6.git tree.
I was planning on posting a slightly changed v4 sometime soon which took care of some concerns on the Documentation and added a compatibility entry for the charger. Do you want me to send that still and you can replace v3 with v4?
Quoted 8 lines
I would rather avoid replacing, i.e. I'd prefer if you send an update on top of the v3 (incremental patch). If the changes were inspired by someone, feel free to add a Suggested-by: tag. ;-)
Thanks!
Anton
Will Do! the changes won't be big I don't think. Thanks!
-rhyland
Signature · 1 line
nvpublic