.../bindings/power/supply/st,stc3117.yaml | 74 +++ MAINTAINERS | 8 + drivers/power/supply/Kconfig | 7 + drivers/power/supply/Makefile | 1 + drivers/power/supply/stc3117_fuel_gauge.c | 613 ++++++++++++++++++ 5 files changed, 703 insertions(+) create mode 100644 Documentation/devicetree/bindings/power/supply/st,stc3117.yaml create mode 100644 drivers/power/supply/stc3117_fuel_gauge.c
Adds initial support for the STC3117 fuel gauge. Output of test_power_supply_properties.sh TAP version 13 1..33 # Testing device stc3117-battery ok 1 stc3117-battery.exists ok 2 stc3117-battery.uevent.NAME ok 3 stc3117-battery.sysfs.type ok 4 stc3117-battery.uevent.TYPE ok 5 stc3117-battery.sysfs.usb_type # SKIP ok 6 stc3117-battery.sysfs.online # SKIP # Reported: '1' () ok 7 stc3117-battery.sysfs.present # Reported: 'Discharging' ok 8 stc3117-battery.sysfs.status # Reported: '30' % () ok 9 stc3117-battery.sysfs.capacity ok 10 stc3117-battery.sysfs.capacity_level # SKIP ok 11 stc3117-battery.sysfs.model_name # SKIP ok 12 stc3117-battery.sysfs.manufacturer # SKIP ok 13 stc3117-battery.sysfs.serial_number # SKIP ok 14 stc3117-battery.sysfs.technology # SKIP ok 15 stc3117-battery.sysfs.cycle_count # SKIP ok 16 stc3117-battery.sysfs.scope # SKIP ok 17 stc3117-battery.sysfs.input_current_limit # SKIP ok 18 stc3117-battery.sysfs.input_voltage_limit # SKIP # Reported: '3577000' uV (3.577 V) ok 19 stc3117-battery.sysfs.voltage_now ok 20 stc3117-battery.sysfs.voltage_min # SKIP ok 21 stc3117-battery.sysfs.voltage_max # SKIP # Reported: '3200000' uV (3.2 V) ok 22 stc3117-battery.sysfs.voltage_min_design # Reported: '4200000' uV (4.2 V) ok 23 stc3117-battery.sysfs.voltage_max_design # Reported: '206000' uA (206 mA) ok 24 stc3117-battery.sysfs.current_now ok 25 stc3117-battery.sysfs.current_max # SKIP ok 26 stc3117-battery.sysfs.charge_now # SKIP ok 27 stc3117-battery.sysfs.charge_full # SKIP # Reported: '3000000' uAh (3 Ah) ok 28 stc3117-battery.sysfs.charge_full_design ok 29 stc3117-battery.sysfs.power_now # SKIP ok 30 stc3117-battery.sysfs.energy_now # SKIP ok 31 stc3117-battery.sysfs.energy_full # SKIP ok 32 stc3117-battery.sysfs.energy_full_design # SKIP ok 33 stc3117-battery.sysfs.energy_full_design # SKIP # Totals: pass:12 fail:0 xfail:0 xpass:0 skip:21 error:0 v12 -> v13 - Battery information and RAM data add into struct stc3117_data Link for v12: https://lore.kernel.org/linux-pm/20241219094915.19059-1-bhavin.sharma@siliconsignals.io/T/#t v11 -> v12 - Removed direct scaling (* 1000) in userspace property values. - Modified stc3117_convert to ensure proper unit conversions. - Returned -ENODATA directly without scaling. - Corrected Singed-of-by & Co-developed-by Link for v11: https://lore.kernel.org/linux-pm/20241216070457.8083-1-bhavin.sharma@siliconsignals.io/T/#t v10 -> v11 - No changes v9 -> v10 - Use error code instead of arbitrary values - Use Co-developed-by tag Link for V9: https://lore.kernel.org/linux-pm/20241213063813.32371-1-bhavin.sharma@siliconsignals.io/T/#t v8 -> v9 - Corrected the error message Link for V8: https://lore.kernel.org/linux-pm/20241210080954.5067-1-bhavin.sharma@siliconsignals.io/T/#t v7 -> v8 - Add output of test_power_supply_properties.sh script. - Change 0X to 0x in macros. - Fix typos and Specify units in property comments. - Remove stc3117_update_battery_status function. - Convert voltage and current from mV/mA to uV/uA. - Represent temperature in tenths of a degree Celsius (1/10 °C). - Export average current and open-circuit voltage (OCV). - Use devm_delayed_work_autocancel. Link for V7: https://lore.kernel.org/linux-pm/20241202094328.14395-1-bhavin.sharma@siliconsignals.io/T/#t v6 -> v7 - Removes extra spaces. - Fixes error handling. - Fixes the logic for checking battery status. - Fixes typos. - Removes unnecessary commas. Link for v6: https://lore.kernel.org/linux-pm/20241130094531.14885-2-bhavin.sharma@siliconsignals.io/T/#t v5 -> v6 - Use shunt-resistor-micro-ohms property instead of sense-resistor. - Remove the battery node from the binding examples. - Add interrupt bindings to the example. - Correct the Signed-off-by (SoB) order in the commit. Link for v5: https://lore.kernel.org/linux-pm/20241129114200.13351-1-bhavin.sharma@siliconsignals.io/T/#t v4 -> v5 - Fix variable names - Limit code line length to 80 columns - Add interrupt and monitor-battery properties to bindings - Correct error handling with return dev_err_probe() Link for v4: https://lore.kernel.org/linux-pm/21c08a45-34f1-443c-97d4-6baf9fa01b67@kernel.org/T/#t v3 -> v4 - Added support for current, soc, temp, and status properties. - Addressed comments and feedback provided by Krzysztof and Sebastian. Link for v3: https://lore.kernel.org/linux-pm/20240205051321.4079933-1-bhavin.sharma@siliconsignals.io/T/#t v2 -> v3 - Resolved DTC warnings and errors - Formatted the changelogs - Added monitored battery properties - Replaced 'additionalProperties' with 'unevaluatedProperties' - Replaced '&i2c6' with 'i2c' Link for v2: https://lore.kernel.org/linux-pm/202401080530.0hMWnrIg-lkp@intel.com/T/#t v1 -> v2 - String value is redundantly quoted with any quotes (quoted-strings) - Found character '\t' that cannot start any token Link for v1: https://lore.kernel.org/linux-pm/46bba29c-330d-417d-ad84-ceb5207fdb55@wanadoo.fr/T/#t Bhavin Sharma (1): power: supply: Add STC3117 fuel gauge unit driver Hardevsinh Palaniya (1): dt-bindings: power: supply: Add STC3117 Fuel Gauge .../bindings/power/supply/st,stc3117.yaml | 74 +++ MAINTAINERS | 8 + drivers/power/supply/Kconfig | 7 + drivers/power/supply/Makefile | 1 + drivers/power/supply/stc3117_fuel_gauge.c | 613 ++++++++++++++++++ 5 files changed, 703 insertions(+) create mode 100644 Documentation/devicetree/bindings/power/supply/st,stc3117.yaml create mode 100644 drivers/power/supply/stc3117_fuel_gauge.c -- 2.34.1
On Fri, 20 Dec 2024 14:19:53 +0530, Bhavin Sharma wrote: > Adds initial support for the STC3117 fuel gauge. > > Output of test_power_supply_properties.sh > > TAP version 13 > 1..33 > # Testing device stc3117-battery > ok 1 stc3117-battery.exists > ok 2 stc3117-battery.uevent.NAME > ok 3 stc3117-battery.sysfs.type > ok 4 stc3117-battery.uevent.TYPE > ok 5 stc3117-battery.sysfs.usb_type # SKIP > ok 6 stc3117-battery.sysfs.online # SKIP > # Reported: '1' () > ok 7 stc3117-battery.sysfs.present > # Reported: 'Discharging' > ok 8 stc3117-battery.sysfs.status > # Reported: '30' % () > ok 9 stc3117-battery.sysfs.capacity > ok 10 stc3117-battery.sysfs.capacity_level # SKIP > ok 11 stc3117-battery.sysfs.model_name # SKIP > ok 12 stc3117-battery.sysfs.manufacturer # SKIP > ok 13 stc3117-battery.sysfs.serial_number # SKIP > ok 14 stc3117-battery.sysfs.technology # SKIP > ok 15 stc3117-battery.sysfs.cycle_count # SKIP > ok 16 stc3117-battery.sysfs.scope # SKIP > ok 17 stc3117-battery.sysfs.input_current_limit # SKIP > ok 18 stc3117-battery.sysfs.input_voltage_limit # SKIP > # Reported: '3577000' uV (3.577 V) > ok 19 stc3117-battery.sysfs.voltage_now > ok 20 stc3117-battery.sysfs.voltage_min # SKIP > ok 21 stc3117-battery.sysfs.voltage_max # SKIP > # Reported: '3200000' uV (3.2 V) > ok 22 stc3117-battery.sysfs.voltage_min_design > # Reported: '4200000' uV (4.2 V) > ok 23 stc3117-battery.sysfs.voltage_max_design > # Reported: '206000' uA (206 mA) > ok 24 stc3117-battery.sysfs.current_now > ok 25 stc3117-battery.sysfs.current_max # SKIP > ok 26 stc3117-battery.sysfs.charge_now # SKIP > ok 27 stc3117-battery.sysfs.charge_full # SKIP > # Reported: '3000000' uAh (3 Ah) > ok 28 stc3117-battery.sysfs.charge_full_design > ok 29 stc3117-battery.sysfs.power_now # SKIP > ok 30 stc3117-battery.sysfs.energy_now # SKIP > ok 31 stc3117-battery.sysfs.energy_full # SKIP > ok 32 stc3117-battery.sysfs.energy_full_design # SKIP > ok 33 stc3117-battery.sysfs.energy_full_design # SKIP > # Totals: pass:12 fail:0 xfail:0 xpass:0 skip:21 error:0 > > [...] Applied, thanks! [1/2] dt-bindings: power: supply: Add STC3117 Fuel Gauge commit: 69a3761389cb9a3a05684e84a659c2799b62cbb3 [2/2] power: supply: Add STC3117 fuel gauge unit driver commit: 74e3f620852390a4e8359c6056d67af1e42b1b1c Best regards, -- Sebastian Reichel <sebastian.reichel@collabora.com>
© 2016 - 2025 Red Hat, Inc.