Add support for Smart Battery System Manager
Subsystems (3)
A message that is not in the archive (sent off-list or not yet received): 1bIiDr-0004G1-0P
v3 cover Add support for Smart Battery System Manager
This patch series adds support for Smart Battery System Manager. A SBSM is a device listening at I2C/SMBus address 0x0a and is capable of communicating up to four I2C smart battery devices. All smart battery devices are listening at address 0x0b, so the SBSM muliplexes between them. The driver makes use of the I2C-Mux framework to allow smart batteries to be bound via device tree, i.e. the sbs-battery driver.
Via sysfs interface the online state and charge type are presented. If the driver is bound as ltc1760 (a Dual Smart Battery System Manager) the charge type can also be changed from trickle to fast.
Changes:
V2:
* Fixed sample node names and compatible strings in binding documentaton.
* Removed optional property "sbsm,i2c-retry-count"
* Retry count hardcoded. Removed no longer needed OF readout function
* Rebased onto v4.7rc-5
V3:
* Changed enumeration sheme
* Rebased onto v4.7rc-7
Karl-Heinz Schneider (2):
Documentation: Add sbs-manager device tree node documentation
power: Adds support for Smart Battery System Manager
.../devicetree/bindings/power/sbs,sbs-manager.txt | 52 ++++ drivers/power/Kconfig | 13 + drivers/power/Makefile | 1 + drivers/power/sbs-manager.c | 325 +++++++++++++++++++++ 4 files changed, 391 insertions(+) create mode 100644 Documentation/devicetree/bindings/power/sbs,sbs-manager.txt create mode 100644 drivers/power/sbs-manager.c
--
1.9.1
PATCH v3 1/2 Documentation: Add sbs-manager device tree node documentation
This patch adds device tree documentation for the sbs-manager
--- .../devicetree/bindings/power/sbs,sbs-manager.txt | 52 ++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 Documentation/devicetree/bindings/power/sbs,sbs-manager.txt
Documentation/devicetree/bindings/power/sbs,sbs-manager.txt new file +52 -0
@@ -0,0 +1,52 @@ +Binding for sbs-manager + +Required properties: +- compatible: should be "lltc,ltc1760" or use "sbs,sbs-manager" as fallback. +- reg: integer, i2c address of the device. Should be <0xa>. + +From OS view the device is basically an i2c-mux used to communicate with up to +four smart battery devices at address 0xb. The driver actually implements this +behaviour. So standard i2c-mux nodes can be used to register up to four slave +batteries. Channels will be numerated starting from 1 to 4. + +Example: + +batman@0a { + compatible = "lltc,ltc1760"; + reg = <0x0a>; + #address-cells = <1>; + #size-cells = <0>; + + i2c@1 { + #address-cells = <1>; + #size-cells = <0>; + reg = <1>; + + battery@0b { + compatible = "ti,bq2060", "sbs,sbs-battery"; + reg = <0x0b>; + }; + }; + + i2c@2 { + #address-cells = <1>; + #size-cells = <0>; + reg = <2>; + + battery@0b { + compatible = "ti,bq2060", "sbs,sbs-battery"; + reg = <0x0b>; + }; + }; + + i2c@3 { + #address-cells = <1>; + #size-cells = <0>; + reg = <3>; + + battery@0b { + compatible = "ti,bq2060", "sbs,sbs-battery"; + reg = <0x0b>; + }; + }; +};
--
1.9.1
Re: [PATCH v3 1/2] Documentation: Add sbs-manager device tree node documentation
Quoted 8 lines · Karl-Heinz Schneider
This patch adds device tree documentation for the sbs-manager
Reviewed-by Phil Reid <[email protected]>Signed-off-by Karl-Heinz Schneider <[email protected]>--- .../devicetree/bindings/power/sbs,sbs-manager.txt | 52 ++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 Documentation/devicetree/bindings/power/sbs,sbs-manager.txt
Re: [PATCH v3 1/2] Documentation: Add sbs-manager device tree node documentation
Am Samstag, den 16.07.2016, 17:05 -0500 schrieb Rob Herring:
Quoted 11 lines · Karl-Heinz Schneider
Quoted 8 lines
This patch adds device tree documentation for the sbs-manager
Reviewed-by Phil Reid <[email protected]>Signed-off-by Karl-Heinz Schneider <[email protected]>--- .../devicetree/bindings/power/sbs,sbs-manager.txt | 52 ++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 Documentation/devicetree/bindings/power/sbs,sbs-manager.txtAcked-by Rob Herring <[email protected]>
Thanks!
Signature · 1 line
Karl-Heinz
Re: [PATCH v3 1/2] Documentation: Add sbs-manager device tree node documentation
In reply to Karl-Heinz SchneiderDocumentation/devicetree/bindings/power/sbs,sbs-manager.txt line 22
Quoted 9 lines
Documentation/devicetree/bindings/power/sbs,sbs-manager.txt new file +9
-0+batman@0a { + compatible = "lltc,ltc1760"; + reg = <0x0a>; + #address-cells = <1>; + #size-cells = <0>; + + i2c@1 { + #address-cells = <1>; + #size-cells = <0>;
Rob, aren't those two lines inherited from above?
Re: [PATCH v3 1/2] Documentation: Add sbs-manager device tree node documentation
Quoted 11 lines · Wolfram Sang
Documentation/devicetree/bindings/power/sbs,sbs-manager.txt line 22
Quoted 9 lines
Documentation/devicetree/bindings/power/sbs,sbs-manager.txt new file +9
-0+batman@0a { + compatible = "lltc,ltc1760"; + reg = <0x0a>; + #address-cells = <1>; + #size-cells = <0>; + + i2c@1 { + #address-cells = <1>; + #size-cells = <0>;Rob, aren't those two lines inherited from above?
I too think they are inherited, but am a bit undecided whether I want that fact to be explored or not, as they just happen to match. They do not express the same thing (it is for the i2c-mux number in the parent, and for the i2c device address in the children).
But the repetitions are indeed tedious when there are many muxed buses...
Cheers,
Peter
Re: [PATCH v3 1/2] Documentation: Add sbs-manager device tree node documentation
Quoted 13 lines · Peter Rosin
Quoted 11 lines · Wolfram Sang
Documentation/devicetree/bindings/power/sbs,sbs-manager.txt line 22
Quoted 9 lines
Documentation/devicetree/bindings/power/sbs,sbs-manager.txt new file +9
-0+batman@0a { + compatible = "lltc,ltc1760"; + reg = <0x0a>; + #address-cells = <1>; + #size-cells = <0>; + + i2c@1 { + #address-cells = <1>; + #size-cells = <0>;Rob, aren't those two lines inherited from above?
Quoted 4 lines
I too think they are inherited, but am a bit undecided whether I want that fact to be explored or not, as they just happen to match. They do not express the same thing (it is for the i2c-mux number in the parent, and for the i2c device address in the children).
Ah, I see. If they don't mean the same thing, then we should be rather safe than sorry, I guess.
Quoted 2 lines
But the repetitions are indeed tedious when there are many muxed buses...
Yes.
PATCH v3 2/2 power: Adds support for Smart Battery System Manager
In reply to Karl-Heinz SchneiderThis patch adds support for Smart Battery System Manager.
A SBSM is a device listening at I2C/SMBus address 0x0a and is capable of communicating up to four I2C smart battery devices. All smart battery devices are listening at address 0x0b, so the SBSM muliplexes between them. The driver makes use of the I2C-Mux framework to allow smart batteries to be bound via device tree, i.e. the sbs-battery driver.
Via sysfs interface the online state and charge type are presented. If the driver is bound as ltc1760 (an implementation of a Dual Smart Battery System Manager) the charge type can also be changed from trickle to fast.
--- drivers/power/Kconfig | 13 ++ drivers/power/Makefile | 1 + drivers/power/sbs-manager.c | 325 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 339 insertions(+) create mode 100644 drivers/power/sbs-manager.c
drivers/power/Kconfig +13 -0
@@ -157,6 +157,19 @@ config BATTERY_WM97XX help Say Y to enable support for battery measured by WM97xx aux port. +config MANAGER_SBS + tristate "Smart Battery System Manager" + depends on I2C && I2C_MUX + help + Say Y here to include support for Smart Battery System Manager + ICs. The driver reports online and charging status via sysfs. + It presents itself also as I2C mux which allows to bind + smart battery driver to its ports. + Supported is for example LTC1760. + + This driver can also be built as a module. If so, the module will be + called sbs-manager. + config BATTERY_SBS tristate "SBS Compliant gas gauge" depends on I2C
drivers/power/Makefile +1 -0
@@ -22,6 +22,7 @@ obj-$(CONFIG_BATTERY_DS2760) += ds2760_battery.o obj-$(CONFIG_BATTERY_DS2780) += ds2780_battery.o obj-$(CONFIG_BATTERY_DS2781) += ds2781_battery.o obj-$(CONFIG_BATTERY_DS2782) += ds2782_battery.o +obj-$(CONFIG_MANAGER_SBS) += sbs-manager.o obj-$(CONFIG_BATTERY_GAUGE_LTC2941) += ltc2941-battery-gauge.o obj-$(CONFIG_BATTERY_GOLDFISH) += goldfish_battery.o obj-$(CONFIG_BATTERY_PMU) += pmu_battery.o
drivers/power/sbs-manager.c new file +325 -0
325 lines not on this page · raw message
--
1.9.1
kbuild test robot
build bot[PATCH] power: fix platform_no_drv_owner.cocci warnings
drivers/power/sbs-manager.c:315:3-8: No need to set .owner here. The core will do it.
drivers/power/sbs-manager.c:315:3-8: No need to set .owner here. The core will do it.
Remove .owner field if calls are used which set it automatically
Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocci
---
sbs-manager.c | 1 - 1 file changed, 1 deletion(-)
drivers/power/sbs-manager.c +0 -1
@@ -312,7 +312,6 @@ MODULE_DEVICE_TABLE(i2c, sbsm_ids);static struct i2c_driver sbsm_driver = { .driver = { .name ="sbsm" , - .owner =THIS_MODULE , }, .probe = sbsm_probe, .remove = sbsm_remove,
kbuild test robot
build botRe: [PATCH v3 2/2] power: Adds support for Smart Battery System Manager
In reply to Karl-Heinz Schneidercoccinelle warnings: (new ones prefixed by >>)
Hi,
[auto build test WARNING on battery/master]
[also build test WARNING on v4.7-rc7 next-20160712]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Karl-Heinz-Schneider/Documentation-Add-sbs-manager-device-tree-node-documentation/20160713-025704 base: git://git.infradead.org/battery-2.6.git master
coccinelle warnings: (new ones prefixed by >>)
>> drivers/power/sbs-manager.c:315:3-8: No need to set .owner here. The core will do it.
Please review and possibly fold the followup patch.
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Re: [PATCH v3 2/2] power: Adds support for Smart Battery System Manager
In reply to Karl-Heinz Schneiderdrivers/power/sbs-manager.c line 243
Quoted 5 lines
drivers/power/sbs-manager.c new file +4
-0+ data->muxc =i2c_mux_alloc (adapter, dev,SBSM_MAX_BATS ,0 , +I2C_MUX_LOCKED , &sbsm_select,NULL ); +if (!data->muxc) { +dev_err (dev,"failed to alloc i2c mux\n" );
Don't print errors on ENOMEM.
Other than that, looks good to me, yet Peter has more insight to i2c-muxes these days.
Re: [PATCH v3 2/2] power: Adds support for Smart Battery System Manager
Hi Wolfram,
Am Dienstag, den 19.07.2016, 06:17 +0200 schrieb Wolfram Sang:
Quoted 6 lines
drivers/power/sbs-manager.c line 243
Quoted 4 lines
drivers/power/sbs-manager.c new file +4
-0+ data->muxc =i2c_mux_alloc (adapter, dev,SBSM_MAX_BATS ,0 , +I2C_MUX_LOCKED , &sbsm_select,NULL ); +if (!data->muxc) { +dev_err (dev,"failed to alloc i2c mux\n" );Don't print errors on ENOMEM.
Will be fixed on next revision.
Quoted 4 lines
Other than that, looks good to me, yet Peter has more insight to i2c-muxes these days.
Tanks for review.
Will wait another few days before sending a new revision, hence changes are rather small.
Signature · 1 line
Karl-Heinz
Re: [PATCH v3 2/2] power: Adds support for Smart Battery System Manager
Quoted 13 lines · Karl-Heinz Schneider
Hi Wolfram,
Am Dienstag, den 19.07.2016, 06:17 +0200 schrieb Wolfram Sang:
Quoted 6 lines
drivers/power/sbs-manager.c line 243
Quoted 4 lines
drivers/power/sbs-manager.c new file +4
-0+ data->muxc =i2c_mux_alloc (adapter, dev,SBSM_MAX_BATS ,0 , +I2C_MUX_LOCKED , &sbsm_select,NULL ); +if (!data->muxc) { +dev_err (dev,"failed to alloc i2c mux\n" );Don't print errors on ENOMEM.
Will be fixed on next revision.
Quoted 1 line
Quoted 7 lines
Quoted 3 lines
Other than that, looks good to me, yet Peter has more insight to i2c-muxes these days.
Tanks for review.
Will wait another few days before sending a new revision, hence changes are rather small.
Looks good to me from a muxing perspective, with very a minor nit that the devicetree bindings do not point to i2c-mux.txt for where "standard i2c-mux nodes" are described.
Cheers,
Peter
Re: [PATCH v3 2/2] power: Adds support for Smart Battery System Manager
Hi Peter, Hi Rob,
Am Montag, den 25.07.2016, 12:44 +0200 schrieb Peter Rosin:
Quoted 12 lines · Karl-Heinz Schneider
Quoted 7 lines
Quoted 3 lines
Other than that, looks good to me, yet Peter has more insight to i2c-muxes these days.
Tanks for review.
Will wait another few days before sending a new revision, hence changes are rather small.
Looks good to me from a muxing perspective, with very a minor nit that the devicetree bindings do not point to i2c-mux.txt for where "standard i2c-mux nodes" are described.
Right, will add it.
like this:
@@ -7,7 +7,8 @@ Required properties:
From OS view the device is basically an i2c-mux used to communicate with up to four smart battery devices at address 0xb. The driver actually implements this behaviour. So standard i2c-mux nodes can be used to register up to four slave
-batteries. Channels will be numerated starting from 1 to 4. +batteries. See Documentation/devicetree/bindings/i2c/i2c-mux.txt for more +information on i2c-mux nodes. Channels will be numerated starting from 1 to 4.
Example:
Rob, are you OK with that change?
Quoted 3 lines
Cheers,
Peter
tanks.
Signature · 1 line
Karl-Heinz
v4 cover Add support for Smart Battery System Manager
In reply to a message not in the archiveThis patch series adds support for Smart Battery System Manager. A SBSM is a device listening at I2C/SMBus address 0x0a and is capable of communicating up to four I2C smart battery devices. All smart battery devices are listening at address 0x0b, so the SBSM muliplexes between them. The driver makes use of the I2C-Mux framework to allow smart batteries to be bound via device tree, i.e. the sbs-battery driver.
Via sysfs interface the online state and charge type are presented. If the driver is bound as ltc1760 (a Dual Smart Battery System Manager) the charge type can also be changed from trickle to fast.
Changes:
V2:
* Fixed sample node names and compatible strings in binding documentaton.
* Removed optional property "sbsm,i2c-retry-count"
* Retry count hardcoded. Removed no longer needed OF readout function
* Rebased onto v4.7rc-5
V3:
* Changed enumeration sheme
* Rebased onto v4.7rc-7
V4:
* removed .owner field as advised by kbuild test robot
* removed print on ENOMEM
* added reference to i2c-mux documentation in binding doc
Karl-Heinz Schneider (2):
Documentation: Add sbs-manager device tree node documentation
power: Adds support for Smart Battery System Manager
.../devicetree/bindings/power/sbs,sbs-manager.txt | 53 ++++ drivers/power/Kconfig | 13 + drivers/power/Makefile | 1 + drivers/power/sbs-manager.c | 323 +++++++++++++++++++++ 4 files changed, 390 insertions(+) create mode 100644 Documentation/devicetree/bindings/power/sbs,sbs-manager.txt create mode 100644 drivers/power/sbs-manager.c
--
2.7.4
PATCH v4 1/2 Documentation: Add sbs-manager device tree node documentation
This patch adds device tree documentation for the sbs-manager
--- .../devicetree/bindings/power/sbs,sbs-manager.txt | 53 ++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 Documentation/devicetree/bindings/power/sbs,sbs-manager.txt
Documentation/devicetree/bindings/power/sbs,sbs-manager.txt new file +53 -0
@@ -0,0 +1,53 @@ +Binding for sbs-manager + +Required properties: +- compatible: should be "lltc,ltc1760" or use "sbs,sbs-manager" as fallback. +- reg: integer, i2c address of the device. Should be <0xa>. + +From OS view the device is basically an i2c-mux used to communicate with up to +four smart battery devices at address 0xb. The driver actually implements this +behaviour. So standard i2c-mux nodes can be used to register up to four slave +batteries. See Documentation/devicetree/bindings/i2c/i2c-mux.txt for more +information on i2c-mux nodes. Channels will be numerated starting from 1 to 4. + +Example: + +batman@0a { + compatible = "lltc,ltc1760"; + reg = <0x0a>; + #address-cells = <1>; + #size-cells = <0>; + + i2c@1 { + #address-cells = <1>; + #size-cells = <0>; + reg = <1>; + + battery@0b { + compatible = "ti,bq2060", "sbs,sbs-battery"; + reg = <0x0b>; + }; + }; + + i2c@2 { + #address-cells = <1>; + #size-cells = <0>; + reg = <2>; + + battery@0b { + compatible = "ti,bq2060", "sbs,sbs-battery"; + reg = <0x0b>; + }; + }; + + i2c@3 { + #address-cells = <1>; + #size-cells = <0>; + reg = <3>; + + battery@0b { + compatible = "ti,bq2060", "sbs,sbs-battery"; + reg = <0x0b>; + }; + }; +};
Signature · 1 line
2.7.4
Rob Herring
maintainerRe: [PATCH v4 1/2] Documentation: Add sbs-manager device tree node documentation
Quoted 15 lines · Karl-Heinz Schneider
This patch adds device tree documentation for the sbs-manager
Reviewed-by Phil Reid <[email protected]>Signed-off-by Karl-Heinz Schneider <[email protected]>--- .../devicetree/bindings/power/sbs,sbs-manager.txt | 53 ++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 Documentation/devicetree/bindings/power/sbs,sbs-manager.txtDocumentation/devicetree/bindings/power/sbs,sbs-manager.txt new file +0
-0
Documentation/devicetree/bindings/power/sbs,sbs-manager.txt line 5
Quoted 5 lines
Documentation/devicetree/bindings/power/sbs,sbs-manager.txt new file +5
-0@@ -0,0 +1,53 @@ +Binding for sbs-manager + +Required properties: +- compatible: should be "lltc,ltc1760" or use "sbs,sbs-manager" as fallback. +- reg: integer, i2c address of the device. Should be <0xa>.
What happened to adding Phil's interrupt support into this? You don't have to add the whole patch, just the binding part. The driver support can come later.
Documentation/devicetree/bindings/power/sbs,sbs-manager.txt line 15
Quoted 10 lines
Documentation/devicetree/bindings/power/sbs,sbs-manager.txt new file +10
-0+ +From OS view the device is basically an i2c-mux used to communicate with up to +four smart battery devices at address 0xb. The driver actually implements this +behaviour. So standard i2c-mux nodes can be used to register up to four slave +batteries. See Documentation/devicetree/bindings/i2c/i2c-mux.txt for more +information on i2c-mux nodes. Channels will be numerated starting from 1 to 4. + +Example: + +batman@0a {
drop leading 0.
Documentation/devicetree/bindings/power/sbs,sbs-manager.txt line 26
Quoted 11 lines
Documentation/devicetree/bindings/power/sbs,sbs-manager.txt new file +11
-0+ compatible = "lltc,ltc1760"; + reg = <0x0a>; + #address-cells = <1>; + #size-cells = <0>; + + i2c@1 { + #address-cells = <1>; + #size-cells = <0>; + reg = <1>; + + battery@0b {
and here...
Quoted 30 lines
Documentation/devicetree/bindings/power/sbs,sbs-manager.txt new file +27
-0+ compatible = "ti,bq2060", "sbs,sbs-battery"; + reg = <0x0b>; + }; + }; + + i2c@2 { + #address-cells = <1>; + #size-cells = <0>; + reg = <2>; + + battery@0b { + compatible = "ti,bq2060", "sbs,sbs-battery"; + reg = <0x0b>; + }; + }; + + i2c@3 { + #address-cells = <1>; + #size-cells = <0>; + reg = <3>; + + battery@0b { + compatible = "ti,bq2060", "sbs,sbs-battery"; + reg = <0x0b>; + }; + }; +};Signature · 1 line
2.7.4
Re: [PATCH v4 1/2] Documentation: Add sbs-manager device tree node documentation
Hi Rob,
Am Mittwoch, den 31.08.2016, 09:43 -0500 schrieb Rob Herring:
Quoted 24 lines · Karl-Heinz Schneider
Quoted 23 lines
This patch adds device tree documentation for the sbs-manager
Reviewed-by Phil Reid <[email protected]>Signed-off-by Karl-Heinz Schneider <[email protected]>---
.../devicetree/bindings/power/sbs,sbs-manager.txt | 53
++++++++++++++++++++++1 file changed, 53 insertions(+)create mode 100644
Documentation/devicetree/bindings/power/sbs,sbs-manager.txt(quoted diff) +0
-0manager.txt b/Documentation/devicetree/bindings/power/sbs,sbs- manager.txt
new file mode 100644
index 0000000..6b1a87ceDocumentation/devicetree/bindings/power/sbs,sbs-manager.txt new file +3
-0@@ -0,0 +1,53 @@ +Binding for sbs-manager + +Required properties:
Quoted 8 lines
Quoted 3 lines
Documentation/devicetree/bindings/power/sbs,sbs-manager.txt new file +1
-0+- compatible: should be "lltc,ltc1760" or use "sbs,sbs-manager" asfallback.
+- reg: integer, i2c address of the device. Should be <0xa>.What happened to adding Phil's interrupt support into this? You don't
have to add the whole patch, just the binding part. The driver support
can come later.
Phil revoked his patch. Right now it's not clear how the interrupt/gpio solution will look like and if they will need an device tree binding at all...
Quoted 18 lines
Quoted 13 lines
Documentation/devicetree/bindings/power/sbs,sbs-manager.txt new file +2
-0+ +From OS view the device is basically an i2c-mux used tocommunicate with up to
+four smart battery devices at address0xb. The driver actually implements this
+behaviour. So standard i2c-mux nodes can be used to register up to four slave
+batteries. SeeDocumentation/devicetree/bindings/i2c/i2c-mux.txtfor more
+information on i2c-mux nodes. Channels will be numerated starting from 1 to 4.Documentation/devicetree/bindings/power/sbs,sbs-manager.txt line 15
Quoted 4 lines
Documentation/devicetree/bindings/power/sbs,sbs-manager.txt new file +4
-0+ +Example: + +batman@0a {drop leading 0.
OK.
Quoted 3 lines
Quoted 3 lines
+ compatible = "lltc,ltc1760";
+ reg = <0x0a>;
Will remove leading 0 at this places too.
Quoted 10 lines
Documentation/devicetree/bindings/power/sbs,sbs-manager.txt line 26
Quoted 9 lines
+ #address-cells = <1>;
+ #size-cells = <0>;Documentation/devicetree/bindings/power/sbs,sbs-manager.txt new file +7
-0+ + i2c@1 { + #address-cells = <1>; + #size-cells = <0>; + reg = <1>; + + battery@0b {and here...
OK.
Quoted 20 lines
Quoted 20 lines
+ compatible = "ti,bq2060", "sbs,sbs-battery"; + reg = <
0x0b>;
+ };
+ };Documentation/devicetree/bindings/power/sbs,sbs-manager.txt new file +15
-0+ + i2c@2 { + #address-cells = <1>; + #size-cells = <0>; + reg = <2>; + + battery@0b { + compatible = "ti,bq2060", "sbs,sbs-battery"; + reg = <0x0b>; + }; + }; + + i2c@3 { + #address-cells = <1>; + #size-cells = <0>;
Quoted 8 lines
Documentation/devicetree/bindings/power/sbs,sbs-manager.txt line 40
Quoted 8 lines
+ reg = <3>;
Documentation/devicetree/bindings/power/sbs,sbs-manager.txt new file +7
-0+ + battery@0b { + compatible = "ti,bq2060", "sbs,sbs-battery"; + reg = <0x0b>; + }; + }; +};
Thanks for review Rob.
Signature · 1 line
Karl-Heinz
A message that is not in the archive (sent off-list or not yet received): 1472673151.5102.12.camel-X5L7DgJ4l23oE99TX8zNy7NAH6kLmebB@public.gmane.org
Re: [PATCH v4 1/2] Documentation: Add sbs-manager device tree node documentation
Quoted 36 lines · Karl-Heinz Schneider
Hi Rob,
Am Mittwoch, den 31.08.2016, 09:43 -0500 schrieb Rob Herring:
Quoted 24 lines · Karl-Heinz Schneider
Quoted 23 lines
This patch adds device tree documentation for the sbs-manager
Reviewed-by Phil Reid <preid-qgqNFa1JUf/[email protected]>Signed-off-by Karl-Heinz Schneider <[email protected]>--- .../devicetree/bindings/power/sbs,sbs-manager.txt | 53 ++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644
Documentation/devicetree/bindings/power/sbs,sbs-manager.txt(quoted diff) +0
-0manager.txt b/Documentation/devicetree/bindings/power/sbs,sbs- manager.txt
new file mode 100644
index 0000000..6b1a87ceDocumentation/devicetree/bindings/power/sbs,sbs-manager.txt new file +3
-0@@ -0,0 +1,53 @@ +Binding for sbs-manager + +Required properties:Quoted 8 lines
Quoted 3 lines
Documentation/devicetree/bindings/power/sbs,sbs-manager.txt new file +1
-0+- compatible: should be "lltc,ltc1760" or use "sbs,sbs-manager" asfallback.
+- reg: integer, i2c address of the device. Should be <0xa>.What happened to adding Phil's interrupt support into this? You don't
have to add the whole patch, just the binding part. The driver support
can come later.
Quoted 3 lines
Phil revoked his patch. Right now it's not clear how the interrupt/gpio solution will look like and if they will need an device tree binding at all...
I'm getting back to this now.
I think we can use the smbalert driver to handle the source interrupt. Which I think doesn't need anything in the dt binding. Driver just needs to implement the alert callback.
I haven't figured out if the smb_alert could be used for the sbs-battery driver interrupt or if this would make sense. However I think it would still need to be a gpio controller in either case so that it can report the presence of the batteries in a manner suitable for the sbs-battery driver to use.
I think the gpio controller approach is the simpler method.
It looks like the smbalert_driver driver needs some updates to work with device trees. I need a bit more time to investigate this option.
Quoted 73 lines
Quoted 19 lines
Quoted 14 lines
Documentation/devicetree/bindings/power/sbs,sbs-manager.txt new file +2
-0+ +From OS view the device is basically an i2c-mux used tocommunicate with up to
+four smart battery devices at address0xb. The driver actually implements this
+behaviour. So standard i2c-mux nodes can be used to register up to four slave
+batteries. SeeDocumentation/devicetree/bindings/i2c/i2c-mux.txtfor more
+information on i2c-mux nodes. Channels will be numerated starting from 1 to 4.Documentation/devicetree/bindings/power/sbs,sbs-manager.txt line 15
Quoted 4 lines
Documentation/devicetree/bindings/power/sbs,sbs-manager.txt new file +4
-0+ +Example: + +batman@0a {drop leading 0.
OK.
Quoted 3 lines
Documentation/devicetree/bindings/power/sbs,sbs-manager.txt line 17
Quoted 3 lines
Documentation/devicetree/bindings/power/sbs,sbs-manager.txt new file +2
-0+ compatible = "lltc,ltc1760"; + reg = <0x0a>;Will remove leading 0 at this places too.
Quoted 10 lines
Documentation/devicetree/bindings/power/sbs,sbs-manager.txt line 26
Quoted 9 lines
Documentation/devicetree/bindings/power/sbs,sbs-manager.txt new file +9
-0+ #address-cells = <1>; + #size-cells = <0>; + + i2c@1 { + #address-cells = <1>; + #size-cells = <0>; + reg = <1>; + + battery@0b {and here...
OK.
Quoted 20 lines
Quoted 20 lines
Documentation/devicetree/bindings/power/sbs,sbs-manager.txt new file +19
-0+ compatible = "ti,bq2060", "sbs,sbs-battery"; + reg = <0x0b>; + }; + }; + + i2c@2 { + #address-cells = <1>; + #size-cells = <0>; + reg = <2>; + + battery@0b { + compatible = "ti,bq2060", "sbs,sbs-battery"; + reg = <0x0b>; + }; + }; + + i2c@3 { + #address-cells = <1>; + #size-cells = <0>;Quoted 8 lines
Documentation/devicetree/bindings/power/sbs,sbs-manager.txt line 53
Quoted 8 lines
Documentation/devicetree/bindings/power/sbs,sbs-manager.txt new file +8
-0+ reg = <3>; + + battery@0b { + compatible = "ti,bq2060", "sbs,sbs-battery"; + reg = <0x0b>; + }; + }; +};Thanks for review Rob.
Signature · 15 lines
Regards Phil Reid ElectroMagnetic Imaging Technology Pty Ltd Development of Geophysical Instrumentation & Software www.electromag.com.au 3 The Avenue, Midland WA 6056, AUSTRALIA Ph: +61 8 9250 8100 Fax: +61 8 9250 7100 Email: preid-qgqNFa1JUf/[email protected] -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v4 1/2] Documentation: Add sbs-manager device tree node documentation
In reply to Rob HerringHi Rob,
Sorry for resending this mail, evolution mixed it up...
Quoted 12 lines · Rob Herring
Quoted 11 lines · Karl-Heinz Schneider
This patch adds device tree documentation for the sbs-manager
Reviewed-by Phil Reid <[email protected]>Signed-off-by Karl-Heinz Schneider <[email protected]>--- .../devicetree/bindings/power/sbs,sbs-manager.txt | 53 ++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644
Documentation/devicetree/bindings/power/sbs,sbs-manager.txt
Quoted 16 lines
Quoted 10 lines
Documentation/devicetree/bindings/power/sbs,sbs-manager.txt new file +4
-0@@ -0,0 +1,53 @@ +Binding for sbs-manager + +Required properties: +- compatible: should be "lltc,ltc1760" or use "sbs,sbs-manager" asQuoted 2 lines
fallback.
+- reg: integer, i2c address of the device. Should be <0xa>.What happened to adding Phil's interrupt support into this? You don't have to add the whole patch, just the binding part. The driver support can come later.
Phil revoked his patch. Right now it's not clear how the interrupt/gpio solution will look like and if they will need an device tree binding at all...
Quoted 10 lines
Quoted 10 lines
Documentation/devicetree/bindings/power/sbs,sbs-manager.txt new file +2
-0+ +From OS view the device is basically an i2c-mux used to communicatewith up to
+four smart battery devices at address0xb. The driver actually implements this
+behaviour. So standard i2c-mux nodes can be used to register up to four slave
+batteries. SeeDocumentation/devicetree/bindings/i2c/i2c-mux.txtfor more
Quoted 8 lines
Documentation/devicetree/bindings/power/sbs,sbs-manager.txt line 15
Quoted 6 lines
+information on i2c-mux nodes. Channels will be numerated starting from 1 to 4.
Documentation/devicetree/bindings/power/sbs,sbs-manager.txt new file +4
-0+ +Example: + +batman@0a {drop leading 0.
OK.
Quoted 2 lines
Documentation/devicetree/bindings/power/sbs,sbs-manager.txt line 17
Quoted 2 lines
Documentation/devicetree/bindings/power/sbs,sbs-manager.txt new file +2
-0+ compatible = "lltc,ltc1760"; + reg = <0x0a>;
Will remove leading 0 at this places too.
Quoted 11 lines
Documentation/devicetree/bindings/power/sbs,sbs-manager.txt line 26
Quoted 9 lines
Documentation/devicetree/bindings/power/sbs,sbs-manager.txt new file +9
-0+ #address-cells = <1>; + #size-cells = <0>; + + i2c@1 { + #address-cells = <1>; + #size-cells = <0>; + reg = <1>; + + battery@0b {and here...
OK.
Quoted 23 lines
Quoted 23 lines
Documentation/devicetree/bindings/power/sbs,sbs-manager.txt new file +22
-0+ compatible = "ti,bq2060", "sbs,sbs-battery"; + reg = <0x0b>; + }; + }; + + i2c@2 { + #address-cells = <1>; + #size-cells = <0>; + reg = <2>; + + battery@0b { + compatible = "ti,bq2060", "sbs,sbs-battery"; + reg = <0x0b>; + }; + }; + + i2c@3 { + #address-cells = <1>; + #size-cells = <0>; + reg = <3>; + + battery@0b {
Quoted 8 lines
Quoted 8 lines
Documentation/devicetree/bindings/power/sbs,sbs-manager.txt new file +5
-1+ compatible = "ti,bq2060", "sbs,sbs-battery"; + reg = <0x0b>; + }; + }; +}; --2.7.4
Thanks for review Rob.
Signature · 1 line
Karl-Heinz
Re: [PATCH v4 1/2] Documentation: Add sbs-manager device tree node documentation
Sorry for the resend, I noticed my reply also got horrible mangled.
Quoted 31 lines · Karl-Heinz Schneider
Hi Rob,
Sorry for resending this mail, evolution mixed it up...
Quoted 10 lines · Rob Herring
Quoted 9 lines · Karl-Heinz Schneider
This patch adds device tree documentation for the sbs-manager
Reviewed-by Phil Reid <[email protected]>Signed-off-by Karl-Heinz Schneider <[email protected]>--- .../devicetree/bindings/power/sbs,sbs-manager.txt | 53 ++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 Documentation/devicetree/bindings/power/sbs,sbs-manager.txtQuoted 15 lines
Documentation/devicetree/bindings/power/sbs,sbs-manager.txt line 5
Quoted 11 lines
Documentation/devicetree/bindings/power/sbs,sbs-manager.txt new file +5
-0@@ -0,0 +1,53 @@ +Binding for sbs-manager + +Required properties: +- compatible: should be "lltc,ltc1760" or use "sbs,sbs-manager" as fallback. +- reg: integer, i2c address of the device. Should be <0xa>.What happened to adding Phil's interrupt support into this? You don't have to add the whole patch, just the binding part. The driver support can come later.
Quoted 4 lines
Phil revoked his patch. Right now it's not clear how the interrupt/gpio solution will look like and if they will need an device tree binding at all...
I'm getting back to this now.
I think we can use the smbalert driver to handle the source interrupt. Which I think doesn't need anything in the dt binding. Driver just needs to implement the alert callback.
I haven't figured out if the smb_alert could be used for the sbs-battery driver interrupt or if this would make sense. However I think it would still need to be a gpio controller in either case so that it can report the presence of the batteries in a manner suitable for the sbs-battery driver to use.
I think the gpio controller approach is the simpler method.
It looks like the smbalert_driver driver needs some updates to work with device trees. I need a bit more time to investigate this option.
Signature · 2 lines
Regards Phil Reid
PATCH v4 2/2 power: Adds support for Smart Battery System Manager
In reply to Karl-Heinz SchneiderThis patch adds support for Smart Battery System Manager.
A SBSM is a device listening at I2C/SMBus address 0x0a and is capable of communicating up to four I2C smart battery devices. All smart battery devices are listening at address 0x0b, so the SBSM muliplexes between them. The driver makes use of the I2C-Mux framework to allow smart batteries to be bound via device tree, i.e. the sbs-battery driver.
Via sysfs interface the online state and charge type are presented. If the driver is bound as ltc1760 (an implementation of a Dual Smart Battery System Manager) the charge type can also be changed from trickle to fast.
--- drivers/power/Kconfig | 13 ++ drivers/power/Makefile | 1 + drivers/power/sbs-manager.c | 323 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 337 insertions(+) create mode 100644 drivers/power/sbs-manager.c
drivers/power/Kconfig +13 -0
@@ -157,6 +157,19 @@ config BATTERY_WM97XX help Say Y to enable support for battery measured by WM97xx aux port. +config MANAGER_SBS + tristate "Smart Battery System Manager" + depends on I2C && I2C_MUX + help + Say Y here to include support for Smart Battery System Manager + ICs. The driver reports online and charging status via sysfs. + It presents itself also as I2C mux which allows to bind + smart battery driver to its ports. + Supported is for example LTC1760. + + This driver can also be built as a module. If so, the module will be + called sbs-manager. + config BATTERY_SBS tristate "SBS Compliant gas gauge" depends on I2C
drivers/power/Makefile +1 -0
@@ -22,6 +22,7 @@ obj-$(CONFIG_BATTERY_DS2760) += ds2760_battery.o obj-$(CONFIG_BATTERY_DS2780) += ds2780_battery.o obj-$(CONFIG_BATTERY_DS2781) += ds2781_battery.o obj-$(CONFIG_BATTERY_DS2782) += ds2782_battery.o +obj-$(CONFIG_MANAGER_SBS) += sbs-manager.o obj-$(CONFIG_BATTERY_GAUGE_LTC2941) += ltc2941-battery-gauge.o obj-$(CONFIG_BATTERY_GOLDFISH) += goldfish_battery.o obj-$(CONFIG_BATTERY_PMU) += pmu_battery.o
drivers/power/sbs-manager.c new file +323 -0
323 lines not on this page · raw message
Signature · 1 line
2.7.4
Hi,
Quoted 10 lines · Karl-Heinz Schneider
This patch series adds support for Smart Battery System Manager. A SBSM is a device listening at I2C/SMBus address
0x0aand is capable of communicating up to four I2C smart battery devices. All smart battery devices are listening at address0x0b, so the SBSM muliplexes between them. The driver makes use of the I2C-Mux framework to allow smart batteries to be bound via device tree, i.e. the sbs-battery driver.Via sysfs interface the online state and charge type are presented. If the driver is bound as ltc1760 (a Dual Smart Battery System Manager) the charge type can also be changed from trickle to fast.
Driver looks fine to me. Waiting for Rob's ACK on the DT bindings.
-- Sebastian
Hi Sebastian,
Am Mittwoch, den 31.08.2016, 17:10 +0200 schrieb Sebastian Reichel:
Quoted 14 lines
Hi,
Quoted 11 lines · Karl-Heinz Schneider
This patch series adds support for Smart Battery System Manager. A SBSM is a device listening at I2C/SMBus address
0x0aand is capable of
communicating up to four I2C smart battery devices. All smart battery
devices are listening at address0x0b, so the SBSM muliplexes between
them. The driver makes use of the I2C-Mux framework to allow smart batteries to be bound via device tree, i.e. the sbs-battery driver.
Quoted 8 lines
Quoted 5 lines
Via sysfs interface the online state and charge type are presented. If
the driver is bound as ltc1760 (a Dual Smart Battery System Manager)
the charge type can also be changed from trickle to fast.Driver looks fine to me. Waiting for Rob's ACK on the DT bindings.
-- Sebastian
Thanks
Signature · 1 line
Karl-Heinz