Commit 9a265e04 authored by Matti Vaittinen's avatar Matti Vaittinen Committed by Sebastian Reichel

power: supply: bd99954: Use LINEAR_RANGE()

Do minor clean-up by using newly inroduced LINEAR_RANGE() initialization
macro.
Signed-off-by: default avatarMatti Vaittinen <mazziesaccount@gmail.com>
Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
parent 98c148cd
...@@ -768,27 +768,13 @@ static const struct power_supply_desc bd9995x_power_supply_desc = { ...@@ -768,27 +768,13 @@ static const struct power_supply_desc bd9995x_power_supply_desc = {
* Describe the setting in linear_range table. * Describe the setting in linear_range table.
*/ */
static const struct linear_range input_current_limit_ranges[] = { static const struct linear_range input_current_limit_ranges[] = {
{ LINEAR_RANGE(0, 0x0, 0x1ff, 32000),
.min = 0,
.step = 32000,
.min_sel = 0x0,
.max_sel = 0x1ff,
},
}; };
/* Possible trickle, pre-charging and termination current values */ /* Possible trickle, pre-charging and termination current values */
static const struct linear_range charging_current_ranges[] = { static const struct linear_range charging_current_ranges[] = {
{ LINEAR_RANGE(0, 0x0, 0x10, 64000),
.min = 0, LINEAR_RANGE(1024000, 0x11, 0x1f, 0),
.step = 64000,
.min_sel = 0x0,
.max_sel = 0x10,
}, {
.min = 1024000,
.step = 0,
.min_sel = 0x11,
.max_sel = 0x1f,
},
}; };
/* /*
...@@ -796,72 +782,28 @@ static const struct linear_range charging_current_ranges[] = { ...@@ -796,72 +782,28 @@ static const struct linear_range charging_current_ranges[] = {
* and battery over voltage protection have same possible values * and battery over voltage protection have same possible values
*/ */
static const struct linear_range charge_voltage_regulation_ranges[] = { static const struct linear_range charge_voltage_regulation_ranges[] = {
{ LINEAR_RANGE(2560000, 0, 0xA0, 0),
.min = 2560000, LINEAR_RANGE(2560000, 0xA0, 0x4B0, 16000),
.step = 0, LINEAR_RANGE(19200000, 0x4B0, 0x7FF, 0),
.min_sel = 0,
.max_sel = 0xA0,
}, {
.min = 2560000,
.step = 16000,
.min_sel = 0xA0,
.max_sel = 0x4B0,
}, {
.min = 19200000,
.step = 0,
.min_sel = 0x4B0,
.max_sel = 0x7FF,
},
}; };
/* Possible VSYS voltage regulation values */ /* Possible VSYS voltage regulation values */
static const struct linear_range vsys_voltage_regulation_ranges[] = { static const struct linear_range vsys_voltage_regulation_ranges[] = {
{ LINEAR_RANGE(2560000, 0, 0x28, 0),
.min = 2560000, LINEAR_RANGE(2560000, 0x28, 0x12C, 64000),
.step = 0, LINEAR_RANGE(19200000, 0x12C, 0x1FF, 0),
.min_sel = 0,
.max_sel = 0x28,
}, {
.min = 2560000,
.step = 64000,
.min_sel = 0x28,
.max_sel = 0x12C,
}, {
.min = 19200000,
.step = 0,
.min_sel = 0x12C,
.max_sel = 0x1FF,
},
}; };
/* Possible settings for switching from trickle to pre-charging limits */ /* Possible settings for switching from trickle to pre-charging limits */
static const struct linear_range trickle_to_pre_threshold_ranges[] = { static const struct linear_range trickle_to_pre_threshold_ranges[] = {
{ LINEAR_RANGE(2048000, 0, 0x20, 0),
.min = 2048000, LINEAR_RANGE(2048000, 0x20, 0x12C, 64000),
.step = 0, LINEAR_RANGE(19200000, 0x12C, 0x1FF, 0),
.min_sel = 0,
.max_sel = 0x20,
}, {
.min = 2048000,
.step = 64000,
.min_sel = 0x20,
.max_sel = 0x12C,
}, {
.min = 19200000,
.step = 0,
.min_sel = 0x12C,
.max_sel = 0x1FF
}
}; };
/* Possible current values for fast-charging constant current phase */ /* Possible current values for fast-charging constant current phase */
static const struct linear_range fast_charge_current_ranges[] = { static const struct linear_range fast_charge_current_ranges[] = {
{ LINEAR_RANGE(0, 0, 0xFF, 64000),
.min = 0,
.step = 64000,
.min_sel = 0,
.max_sel = 0xFF,
}
}; };
struct battery_init { struct battery_init {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment