-
Notifications
You must be signed in to change notification settings - Fork 844
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
base: main
Are you sure you want to change the base?
Conversation
Also, the things I mentioned as "nice to have" is up to you to add it or not :) |
Add support for ltc4162-f/s and ltc4015 - Add compatible entries for ltc4162-f/s and ltc4015 - Include datasheets for new devices Signed-off-by: Kim Seer Paller <[email protected]>
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 Add chip_info struct to hold the chip specific data. Modify functions for battery voltage/current, input voltage/current, charge voltage, die temp, and force telemetry to handle different battery chemistries. Signed-off-by: Kim Seer Paller <[email protected]>
v2
|
There was a problem hiding this 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...
@@ -840,6 +1153,12 @@ static int ltc4162l_probe(struct i2c_client *client, | |||
info->client = client; | |||
i2c_set_clientdata(client, info); | |||
|
|||
chip_info = device_get_match_data(dev); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when upstreaming use i2c_get_match_data()
@@ -820,12 +1131,14 @@ static void ltc4162l_clear_interrupts(struct ltc4162l_info *info) | |||
} | |||
|
|||
static int ltc4162l_probe(struct i2c_client *client, | |||
const struct i2c_device_id *id) | |||
const struct i2c_device_id *id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a stylistic change... You have more in this patch. Do them in a different patch (like a follow up one)
size_t count) | ||
struct device_attribute *attr, | ||
const char *buf, | ||
size_t count) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style...
return sprintf(buf, "%u\n", | ||
regval == LTC4162L_ARM_SHIP_MODE_MAGIC ? 1 : 0); | ||
return sysfs_emit(buf, "%u\n", | ||
regval == LTC4162L_ARM_SHIP_MODE_MAGIC ? 1 : 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also not related
|
||
return count; | ||
return ret ? ret : count; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
@@ -98,7 +138,7 @@ static u8 ltc4162l_get_cell_count(struct ltc4162l_info *info) | |||
return 0; | |||
|
|||
/* Lower 4 bits is the cell count, or 0 if the chip doesn't know yet */ | |||
val &= 0x0f; | |||
val = FIELD_GET(LTC4162L_CELL_COUNT_MASK, val); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is also not related with addition of the new devices...
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:
ltc4162:
charge voltage, die temp, and force telemetry to handle different
battery chemistries.
PR Type
PR Checklist