Introduce Embedded Controller driver for Acer A500
Subsystems (4)
v7 cover Introduce Embedded Controller driver for Acer A500
This series adds support for the Embedded Controller which is found on Acer Iconia Tab A500 (Android tablet device).
The Embedded Controller is ENE KB930 and it's running firmware customized for the A500. The firmware interface may be reused by some other sibling Acer tablets, although none of those tablets are supported in upstream yet.
Changelog:
v7: - Improved MFD Kconfig entry by adding explicit dependency on OF and
by rewording the help message, matching it to the other MFD drivers.
- Improved comments in the code by removing unnecessary comments, adding necessary and rewording some others.
- Added expressive defines for the command opcodes.
- Fixed alphabet order of the MFD driver includes.
- Removed unnecessary size checks which are already done by regmap core.
- Renamed 'rmap' variable to 'regmap'.
v6: - Fixed dtschema-checker warning about a wrong indentation, reported
by kernel bot for v5.
v5: - No changes. Re-sending again in order to check whether dtschema-bot
warning is resolved now, which didn't happen in v4 because bot used older 5.9 kernel code base instead of 5.10.
v4: - No code changes. Added r-b from Rob Herring and Sebastian Reichel.
Re-sending for 5.11.
- The v3 of LED driver was applied by Pavel Machek and already presents
in v5.10 kernel.v3: - Rebased on a recent linux-next. Fixed new merge conflict and dropped
"regmap: Use flexible sleep" patch because it's already applied.
v2: - Factored out KB930 device-tree binding into a separate file, like it
was suggested by Lubomir Rintel.
- Switched to use regmap API like it was suggested by Lubomir Rintel.
- Added patch "regmap: Use flexible sleep" which allows not to hog CPU while LED is switching state.
- Corrected MODULE_LICENSE to use "GPL" in all patches.
- Corrected MFD driver Kconfig entry like it was suggested by Lubomir Rintel, it now depends on I2C.
- Switched to use I2C probe_new() in the MFD driver.
- Renamed the global pm_off variable, like it was suggested by Lubomir Rintel and Lee Jones.
- Dropped serial number from the battery driver because I realized that it's not a battery serial, but a device serial.
- Battery driver now uses dev_err_probe(), like it was suggested by Sebastian Reichel.
- Dropped legacy LED_ON usage from the LED driver and renamed the LEDs, like it was suggested by Pavel Machek. I also checked whether LED-name customization via device-tree could be needed by other potentially compatible devices and it shouldn't be needed, anyways it won't be difficult to extend the code even if I'm wrong.
Dmitry Osipenko (4):
dt-bindings: mfd: Add ENE KB930 Embedded Controller binding
mfd: Add driver for Embedded Controller found on Acer Iconia Tab A500
power: supply: Add battery gauge driver for Acer Iconia Tab A500
ARM: tegra: acer-a500: Add Embedded Controller
.../devicetree/bindings/mfd/ene-kb930.yaml | 65 ++++ .../boot/dts/tegra20-acer-a500-picasso.dts | 17 + drivers/mfd/Kconfig | 11 + drivers/mfd/Makefile | 1 + drivers/mfd/acer-ec-a500.c | 202 ++++++++++++ drivers/power/supply/Kconfig | 6 + drivers/power/supply/Makefile | 1 + drivers/power/supply/acer_a500_battery.c | 297 ++++++++++++++++++ 8 files changed, 600 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/ene-kb930.yaml create mode 100644 drivers/mfd/acer-ec-a500.c create mode 100644 drivers/power/supply/acer_a500_battery.c
Signature · 1 line
2.29.2
PATCH v7 1/4 dt-bindings: mfd: Add ENE KB930 Embedded Controller binding
Add binding document for the ENE KB930 Embedded Controller.
--- .../devicetree/bindings/mfd/ene-kb930.yaml | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/ene-kb930.yaml
Documentation/devicetree/bindings/mfd/ene-kb930.yaml new file +65 -0
@@ -0,0 +1,65 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mfd/ene-kb930.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: ENE KB930 Embedded Controller bindings + +description: | + This binding describes the ENE KB930 Embedded Controller attached to an + I2C bus. + +maintainers: + - Dmitry Osipenko <[email protected]> + +properties: + compatible: + items: + - enum: + - acer,a500-iconia-ec # Acer A500 Iconia tablet device + - const: ene,kb930 + reg: + maxItems: 1 + + monitored-battery: true + power-supplies: true + system-power-controller: true + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + battery: battery-cell { + compatible = "simple-battery"; + charge-full-design-microamp-hours = <3260000>; + energy-full-design-microwatt-hours = <24000000>; + operating-range-celsius = <0 40>; + }; + + mains: ac-adapter { + compatible = "gpio-charger"; + charger-type = "mains"; + gpios = <&gpio 125 0>; + }; + + i2c { + #address-cells = <1>; + #size-cells = <0>; + + embedded-controller@58 { + compatible = "acer,a500-iconia-ec", "ene,kb930"; + reg = <0x58>; + + system-power-controller; + + monitored-battery = <&battery>; + power-supplies = <&mains>; + }; + }; + +...
Signature · 1 line
2.29.2
PATCH v7 2/4 mfd: Add driver for Embedded Controller found on Acer Iconia Tab A500
In reply to Dmitry OsipenkoAcer Iconia Tab A500 is an Android tablet device, it has ENE KB930 Embedded Controller which provides battery-gauge, LED, GPIO and some other functions. The EC uses firmware that is specifically customized for Acer A500. This patch adds MFD driver for the Embedded Controller which allows to power-off / reboot the A500 device, it also provides a common register read/write API that will be used by the sub-devices.
--- drivers/mfd/Kconfig | 11 ++ drivers/mfd/Makefile | 1 + drivers/mfd/acer-ec-a500.c | 202 +++++++++++++++++++++++++++++++++++++ 3 files changed, 214 insertions(+) create mode 100644 drivers/mfd/acer-ec-a500.c
drivers/mfd/Kconfig +11 -0
@@ -2107,6 +2107,17 @@ config MFD_KHADAS_MCU additional drivers must be enabled in order to use the functionality of the device. +config MFD_ACER_A500_EC + tristate "Support for Acer Iconia Tab A500 Embedded Controller" + depends on I2C + depends on (ARCH_TEGRA_2x_SOC && OF) || COMPILE_TEST + select MFD_CORE + select REGMAP + help + Support for Embedded Controller found on Acer Iconia Tab A500. + The controller itself is ENE KB930, it is running firmware + customized for the specific needs of the Acer A500 hardware. + menu "Multimedia Capabilities Port drivers" depends on ARCH_SA1100
drivers/mfd/Makefile +1 -0
@@ -264,6 +264,7 @@ obj-$(CONFIG_MFD_ROHM_BD71828) += rohm-bd71828.o obj-$(CONFIG_MFD_ROHM_BD718XX) += rohm-bd718x7.o obj-$(CONFIG_MFD_STMFX) += stmfx.o obj-$(CONFIG_MFD_KHADAS_MCU) += khadas-mcu.o +obj-$(CONFIG_MFD_ACER_A500_EC) += acer-ec-a500.o obj-$(CONFIG_SGI_MFD_IOC3) += ioc3.o obj-$(CONFIG_MFD_SIMPLE_MFD_I2C) += simple-mfd-i2c.o
drivers/mfd/acer-ec-a500.c new file +202 -0
202 lines not on this page · raw message
Signature · 1 line
2.29.2
PATCH v7 3/4 power: supply: Add battery gauge driver for Acer Iconia Tab A500
In reply to Dmitry OsipenkoThis patch adds battery gauge driver for Acer Iconia Tab A500 device. The battery gauge function is provided via the Embedded Controller, which is found on the Acer A500.
--- drivers/power/supply/Kconfig | 6 + drivers/power/supply/Makefile | 1 + drivers/power/supply/acer_a500_battery.c | 297 +++++++++++++++++++++++ 3 files changed, 304 insertions(+) create mode 100644 drivers/power/supply/acer_a500_battery.c
drivers/power/supply/Kconfig +6 -0
@@ -774,4 +774,10 @@ config RN5T618_POWER This driver can also be built as a module. If so, the module will be called rn5t618_power. +config BATTERY_ACER_A500 + tristate "Acer Iconia Tab A500 battery driver" + depends on MFD_ACER_A500_EC + help + Say Y to include support for Acer Iconia Tab A500 battery fuel gauge. + endif # POWER_SUPPLY
drivers/power/supply/Makefile +1 -0
@@ -98,3 +98,4 @@ obj-$(CONFIG_CHARGER_BD70528) += bd70528-charger.o obj-$(CONFIG_CHARGER_BD99954) += bd99954-charger.o obj-$(CONFIG_CHARGER_WILCO) += wilco-charger.o obj-$(CONFIG_RN5T618_POWER) += rn5t618_power.o +obj-$(CONFIG_BATTERY_ACER_A500) += acer_a500_battery.o
drivers/power/supply/acer_a500_battery.c new file +297 -0
297 lines not on this page · raw message
Signature · 1 line
2.29.2
PATCH v7 4/4 ARM: tegra: acer-a500: Add Embedded Controller
In reply to Dmitry OsipenkoThis patch adds device-tree node for the Embedded Controller which is found on the Picasso board. The Embedded Controller itself is ENE KB930, it provides functions like battery-gauge/LED/GPIO/etc and it uses firmware that is specifically customized for the Acer A500 device.
--- arch/arm/boot/dts/tegra20-acer-a500-picasso.dts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
arch/arm/boot/dts/tegra20-acer-a500-picasso.dts +17 -0
@@ -533,6 +533,16 @@ panel_ddc: i2c@1 { reg = <1>; #address-cells = <1>; #size-cells = <0>; + + embedded-controller@58 { + compatible = "acer,a500-iconia-ec", "ene,kb930"; + reg = <0x58>; + + system-power-controller; + + monitored-battery = <&bat1010>; + power-supplies = <&mains>; + }; }; };
@@ -820,6 +830,13 @@ backlight: backlight { default-brightness-level = <20>; }; + bat1010: battery-2s1p { + compatible = "simple-battery"; + charge-full-design-microamp-hours = <3260000>; + energy-full-design-microwatt-hours = <24000000>; + operating-range-celsius = <0 40>; + }; + /* PMIC has a built-in 32KHz oscillator which is used by PMC */ clk32k_in: clock@0 { compatible = "fixed-clock";
Signature · 1 line
2.29.2