Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for ltc4162-f/s and ltc4015 battery charger #2594

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

kseerp
Copy link
Contributor

@kseerp kseerp commented Sep 9, 2024

PR Description

Add support for:
LTC4162-F 35V/3.2A Multi-Cell LiFePO4 Step-Down Battery Charger
LTC4162-S 35V/3.2A Lead-Acid Step-Down Battery Charger
LTC4015 35V/3.2A Multichemistry Buck Battery Charger Controller

Bindings:

  • Add compatible entries for ltc4162-f/s and ltc4015
  • Include datasheets for new devices
  • Change vendor prefix from lltc to adi

ltc4162:

  • Modify functions for battery voltage/current, input voltage/current,
    charge voltage, die temp, and force telemetry to handle different
    battery chemistries.

PR Type

  • New feature (a change that adds new functionality)
  • Bug fix (a change that fixes an issue)
  • Breaking change (a change that affects other repos or cause CIs to fail)

PR Checklist

  • I have conducted a self-review of my own code changes
  • I have tested the changes on the relevant hardware
  • I have updated the documentation outside this repo accordingly (if there is the case)

@kseerp kseerp changed the title add support ltc4162-f/s and ltc4015 batter charger add support for ltc4162-f/s and ltc4015 battery charger Sep 9, 2024
drivers/power/supply/ltc4162-l-charger.c Outdated Show resolved Hide resolved
drivers/power/supply/ltc4162-l-charger.c Outdated Show resolved Hide resolved
drivers/power/supply/ltc4162-l-charger.c Outdated Show resolved Hide resolved
drivers/power/supply/ltc4162-l-charger.c Outdated Show resolved Hide resolved
drivers/power/supply/ltc4162-l-charger.c Outdated Show resolved Hide resolved
@nunojsa
Copy link
Collaborator

nunojsa commented Sep 20, 2024

Also, the things I mentioned as "nice to have" is up to you to add it or not :)

@kseerp kseerp force-pushed the dev/ltc4162 branch 2 times, most recently from 8ae99f4 to 9f8e3a4 Compare October 11, 2024 08:32
@kseerp
Copy link
Contributor Author

kseerp commented Oct 11, 2024

v2

  • Added chip_info struct to hold chip specific data.
  • Added functions specific to each chip to get/set vbat, vcharge, die_temp.
  • Duplicated the default descriptor to configure name based on chip_info.
  • Used FIELD_GET to extract the value from register.
  • Changed sprintf to sysfs_emit.

Copy link
Collaborator

@nunojsa nunojsa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks mostly good to me. Just make sure to split your changes a bit better so it makes it easier to review. At this point, I would say to send this upstream...

drivers/power/supply/ltc4162-l-charger.c Outdated Show resolved Hide resolved
drivers/power/supply/ltc4162-l-charger.c Outdated Show resolved Hide resolved
drivers/power/supply/ltc4162-l-charger.c Outdated Show resolved Hide resolved
drivers/power/supply/ltc4162-l-charger.c Outdated Show resolved Hide resolved
drivers/power/supply/ltc4162-l-charger.c Outdated Show resolved Hide resolved
drivers/power/supply/ltc4162-l-charger.c Outdated Show resolved Hide resolved
…c4015

Add LTC4162-F/S and LTC4015 to the supported devices of LTC4162-L.
They share a common set of registers. The only differences lie in the
resolution value of the scaling factor for battery voltage and battery
current measurement, input voltage, and input current for different
battery chemistries. The differences also include the calculation of
setting and getting the actual voltage applied to the charge voltage,
as well as getting the die temperature.

This add compatible entries for ltc4162-f/s and ltc4015 and include
datasheets for new devices.

Acked-by: Krzysztof Kozlowski <[email protected]>
Signed-off-by: Kim Seer Paller <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Sebastian Reichel <[email protected]>
…4015

LTC4162-L 35V/3.2A Multi-Cell Lithium-Ion Step-Down Battery Charger
LTC4162-F 35V/3.2A Multi-Cell LiFePO4 Step-Down Battery Charger
LTC4162-S 35V/3.2A Lead-Acid Step-Down Battery Charger
LTC4015 35V/3.2A Multichemistry Buck Battery Charger Controller

The LTC4162-L/F/S variants and LTC4015 share a common set of registers.
The difference lies in the resolution value of the scaling factor for
battery voltage and battery current measurement, input voltage, and
input current for different battery chemistries. The difference also
includes the calculation of setting and getting the actual voltage
setting applied to the charge voltage, as well as getting the die
temperature. Adding chip info structure to encapsulates these
differences by defining function pointers and parameters specific to
each device. This structure includes:
  - function pointers for getting and setting various parameters such as
    battery voltage, charge voltage, and die temperature
  - resolution parameters for battery current and input voltage
  - telemetry mask to specify which bits in the register are used for
    telemetry features

Signed-off-by: Kim Seer Paller <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Sebastian Reichel <[email protected]>
@kseerp kseerp reopened this Dec 15, 2024
@kseerp
Copy link
Contributor Author

kseerp commented Dec 16, 2024

Series applied upstream. Add ADI compliant version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants