LEGO MINDSTORMS EV3 Battery
Subsystems (3)
David Lechner
reviewerv2 cover LEGO MINDSTORMS EV3 Battery
This series adds support for the LEGO MINDSTORMS EV3 battery.
v2 changes:
* use devm_power_supply_register()
David Lechner (3):
dt-bindings: power: supply: New bindings for LEGO MINDSTORMS EV3
battery
power: supply: New driver for LEGO MINDSTORMS EV3 battery
ARM: dts: da850: Add node for LEGO MINDSTORMS EV3 Battery
.../bindings/power/supply/lego_ev3_battery.txt | 21 ++ arch/arm/boot/dts/da850-lego-ev3.dts | 28 +++ drivers/power/supply/Kconfig | 6 + drivers/power/supply/Makefile | 1 + drivers/power/supply/lego_ev3_battery.c | 228 +++++++++++++++++++++ 5 files changed, 284 insertions(+) create mode 100644 Documentation/devicetree/bindings/power/supply/lego_ev3_battery.txt create mode 100644 drivers/power/supply/lego_ev3_battery.c
Signature · 1 line
2.7.4
David Lechner
reviewerPATCH v2 1/3 dt-bindings: power: supply: New bindings for LEGO MINDSTORMS EV3 battery
This add a new device tree binding for LEGO MINDSTORMS EV3 battery. The EV3 has some built-in capability for monitoring the attached battery.
--- .../bindings/power/supply/lego_ev3_battery.txt | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Documentation/devicetree/bindings/power/supply/lego_ev3_battery.txt
Documentation/devicetree/bindings/power/supply/lego_ev3_battery.txt new file +21 -0
@@ -0,0 +1,21 @@ +LEGO MINDSTORMS EV3 Battery +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +LEGO MINDSTORMS EV3 has some built-in capability for monitoring the battery. +It uses 6 AA batteries or a special Li-ion rechargeable battery pack that is +detected by a key switch in the battery compartment. + +Required properties: + - compatible: Must be "lego,ev3-battery" + - io-channels: phandles to analog inputs for reading voltage and current + - io-channel-names: Must be "voltage", "current" + - rechargeable-gpios: phandle to the rechargeable battery indication gpio + +Example: + + battery { + compatible = "lego,ev3-battery"; + io-channels = <&adc 4>, <&adc 3>; + io-channel-names = "voltage", "current"; + rechargeable-gpios = <&gpio 136 GPIO_ACTIVE_LOW>; + };
Signature · 1 line
2.7.4
David Lechner
reviewerPATCH v2 2/3 power: supply: New driver for LEGO MINDSTORMS EV3 battery
In reply to David LechnerThis adds a new driver for the LEGO MINDSTORMS EV3 battery. The EV3 is an embedded ARM device that can use 6 AA batteries or a special rechargeable Li-ion battery pack. The rechargeable battery pack presses a special key switch in the battery compartment to indicate that it is present.
The EV3 is only capable of monitoring battery voltage and current. The charging circuit is built into the rechargeable battery pack and there is no way to communicate with is, so we can't provide any information about charging status.
When not using the rechargeable battery pack, it is most common to use alkaline batteries to power the device, but it is also common for people to use rechargeable NiMH batteries. Since there is not a way to automatically differentiate between these, the technology property is made writable.
--- drivers/power/supply/Kconfig | 6 + drivers/power/supply/Makefile | 1 + drivers/power/supply/lego_ev3_battery.c | 228 ++++++++++++++++++++++++++++++++ 3 files changed, 235 insertions(+) create mode 100644 drivers/power/supply/lego_ev3_battery.c
drivers/power/supply/Kconfig +6 -0
@@ -117,6 +117,12 @@ config BATTERY_DS2782 Say Y here to enable support for the DS2782/DS2786 standalone battery gas-gauge. +config BATTERY_LEGO_EV3 + tristate "LEGO MINDSTORMS EV3 battery" + depends on OF && IIO && GPIOLIB + help + Say Y here to enable support for the LEGO MINDSTORMS EV3 battery. + config BATTERY_PMU tristate "Apple PMU battery" depends on PPC32 && ADB_PMU
drivers/power/supply/Makefile +1 -0
@@ -25,6 +25,7 @@ obj-$(CONFIG_BATTERY_DS2781) += ds2781_battery.o obj-$(CONFIG_BATTERY_DS2782) += ds2782_battery.o obj-$(CONFIG_BATTERY_GAUGE_LTC2941) += ltc2941-battery-gauge.o obj-$(CONFIG_BATTERY_GOLDFISH) += goldfish_battery.o +obj-$(CONFIG_BATTERY_LEGO_EV3) += lego_ev3_battery.o obj-$(CONFIG_BATTERY_PMU) += pmu_battery.o obj-$(CONFIG_BATTERY_OLPC) += olpc_battery.o obj-$(CONFIG_BATTERY_TOSA) += tosa_battery.o
drivers/power/supply/lego_ev3_battery.c new file +228 -0
228 lines not on this page · raw message
Signature · 1 line
2.7.4
David Lechner
reviewerPATCH v2 3/3 ARM: dts: da850: Add node for LEGO MINDSTORMS EV3 Battery
In reply to David LechnerThis adds a new node to the LEGO MINDSTORMS EV3 device tree for the battery.
--- arch/arm/boot/dts/da850-lego-ev3.dts | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
arch/arm/boot/dts/da850-lego-ev3.dts +28 -0
@@ -172,6 +172,18 @@ gpio = <&gpio 111 GPIO_ACTIVE_HIGH>; enable-active-high; }; + + /* + * The EV3 can use 6-AA batteries or a rechargeable Li-ion battery pack. + */ + battery { + pinctrl-names = "default"; + pintctrl-0 = <&battery_pins>; + compatible = "lego,ev3-battery"; + io-channels = <&adc 4>, <&adc 3>; + io-channel-names = "voltage", "current"; + rechargeable-gpios = <&gpio 136 GPIO_ACTIVE_LOW>; + }; }; &pmx_core {
@@ -235,6 +247,15 @@ 0x34 0x00000008 0x0000000f >; }; + + battery_pins: pinmux_battery_pins { + pinctrl-single,bits = < + /* GP0[6] */ + 0x04 0x00000080 0x000000f0 + /* GP8[8] */ + 0x4c 0x00000080 0x000000f0 + >; + }; }; &pinconf {
@@ -349,6 +370,13 @@ &gpio { status = "okay"; + + /* Don't pull down battery voltage adc io channel */ + batt_volt_en { + gpio-hog; + gpios = <6 GPIO_ACTIVE_HIGH>; + output-low; + }; }; &usb_phy {
Signature · 1 line
2.7.4
Sebastian Reichel
maintainerRe: [PATCH v2 1/3] dt-bindings: power: supply: New bindings for LEGO MINDSTORMS EV3 battery
In reply to David LechnerHi,
Quoted 5 lines · David Lechner
This add a new device tree binding for LEGO MINDSTORMS EV3 battery. The EV3 has some built-in capability for monitoring the attached battery.
Signed-off-by David Lechner <[email protected]>Acked-by Rob Herring <[email protected]>
Thanks, queued.
-- Sebastian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170412/c8d575ee/attachment-0001.sig>
Sebastian Reichel
maintainerRe: [PATCH v2 2/3] power: supply: New driver for LEGO MINDSTORMS EV3 battery
In reply to David LechnerHi,
Quoted 10 lines · David Lechner
This adds a new driver for the LEGO MINDSTORMS EV3 battery. The EV3 is an embedded ARM device that can use 6 AA batteries or a special rechargeable Li-ion battery pack. The rechargeable battery pack presses a special key switch in the battery compartment to indicate that it is present.
The EV3 is only capable of monitoring battery voltage and current. The charging circuit is built into the rechargeable battery pack and there is no way to communicate with is, so we can't provide any information about charging status.
Quoted 6 lines
When not using the rechargeable battery pack, it is most common to use alkaline batteries to power the device, but it is also common for people to use rechargeable NiMH batteries. Since there is not a way to automatically differentiate between these, the technology property is made writable.
Signed-off-by David Lechner <[email protected]>
Thanks, queued.
-- Sebastian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170412/db3d704e/attachment.sig>
Re: [PATCH v2 3/3] ARM: dts: da850: Add node for LEGO MINDSTORMS EV3 Battery
In reply to David LechnerHi David,
Quoted 3 lines · David Lechner
This adds a new node to the LEGO MINDSTORMS EV3 device tree for the battery.
Signed-off-by David Lechner <[email protected]>
I am done sending my pull requests for v4.12. So I added this to my queue for v4.13
Thanks,
Sekhar