unsigned int new_selector)
{
struct s2mps11_info *s2mps11 = rdev_get_drvdata(rdev);
+ int rdev_id = rdev_get_id(rdev);
unsigned int ramp_delay = 0;
int old_volt, new_volt;
- switch (rdev_get_id(rdev)) {
+ switch (rdev_id) {
case S2MPS11_BUCK2:
ramp_delay = s2mps11->ramp_delay2;
break;
struct s2mps11_info *s2mps11 = rdev_get_drvdata(rdev);
unsigned int ramp_val, ramp_shift, ramp_reg = S2MPS11_REG_RAMP_BUCK;
unsigned int ramp_enable = 1, enable_shift = 0;
+ int rdev_id = rdev_get_id(rdev);
int ret;
- switch (rdev_get_id(rdev)) {
+ switch (rdev_id) {
case S2MPS11_BUCK1:
if (ramp_delay > s2mps11->ramp_delay16)
s2mps11->ramp_delay16 = ramp_delay;
goto ramp_disable;
/* Ramp delay can be enabled/disabled only for buck[2346] */
- if ((rdev_get_id(rdev) >= S2MPS11_BUCK2 &&
- rdev_get_id(rdev) <= S2MPS11_BUCK4) ||
- rdev_get_id(rdev) == S2MPS11_BUCK6) {
+ if ((rdev_id >= S2MPS11_BUCK2 && rdev_id <= S2MPS11_BUCK4) ||
+ rdev_id == S2MPS11_BUCK6) {
ret = regmap_update_bits(rdev->regmap, S2MPS11_REG_RAMP,
1 << enable_shift, 1 << enable_shift);
if (ret) {
static int s2mps14_regulator_enable(struct regulator_dev *rdev)
{
struct s2mps11_info *s2mps11 = rdev_get_drvdata(rdev);
+ int rdev_id = rdev_get_id(rdev);
unsigned int val;
switch (s2mps11->dev_type) {
case S2MPS13X:
case S2MPS14X:
- if (test_bit(rdev_get_id(rdev), s2mps11->suspend_state))
+ if (test_bit(rdev_id, s2mps11->suspend_state))
val = S2MPS14_ENABLE_SUSPEND;
- else if (s2mps11->ext_control_gpiod[rdev_get_id(rdev)])
+ else if (s2mps11->ext_control_gpiod[rdev_id])
val = S2MPS14_ENABLE_EXT_CONTROL;
else
val = rdev->desc->enable_mask;
break;
case S2MPU02:
- if (test_bit(rdev_get_id(rdev), s2mps11->suspend_state))
+ if (test_bit(rdev_id, s2mps11->suspend_state))
val = S2MPU02_ENABLE_SUSPEND;
else
val = rdev->desc->enable_mask;
if (ret < 0)
return ret;
- set_bit(rdev_get_id(rdev), s2mps11->suspend_state);
+ set_bit(rdev_id, s2mps11->suspend_state);
/*
* Don't enable suspend mode if regulator is already disabled because
* this would effectively for a short time turn on the regulator after
static int s2mpu02_set_ramp_delay(struct regulator_dev *rdev, int ramp_delay)
{
unsigned int ramp_val, ramp_shift, ramp_reg;
+ int rdev_id = rdev_get_id(rdev);
- switch (rdev_get_id(rdev)) {
+ switch (rdev_id) {
case S2MPU02_BUCK1:
ramp_shift = S2MPU02_BUCK1_RAMP_SHIFT;
break;