Commit e08abeca authored by Axel Lin's avatar Axel Lin Committed by Mark Brown

regulator: wm8400: Get rid of wm8400_block_read/wm8400_set_bits functions

The only user of wm8400_block_read/wm8400_set_bits functions is the
wm8400 regulator driver. At the context of all the callers, we can
use regmap_bulk_read/regmap_update_bits directly.
Thus remove wm8400_block_read/wm8400_set_bits functions.
Signed-off-by: default avatarAxel Lin <axel.lin@ingics.com>
Acked-by: default avatarCharles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 5b60ee57
...@@ -35,12 +35,6 @@ static bool wm8400_volatile(struct device *dev, unsigned int reg) ...@@ -35,12 +35,6 @@ static bool wm8400_volatile(struct device *dev, unsigned int reg)
} }
} }
int wm8400_block_read(struct wm8400 *wm8400, u8 reg, int count, u16 *data)
{
return regmap_bulk_read(wm8400->regmap, reg, data, count);
}
EXPORT_SYMBOL_GPL(wm8400_block_read);
static int wm8400_register_codec(struct wm8400 *wm8400) static int wm8400_register_codec(struct wm8400 *wm8400)
{ {
const struct mfd_cell cell = { const struct mfd_cell cell = {
......
...@@ -36,13 +36,12 @@ static const struct regulator_ops wm8400_ldo_ops = { ...@@ -36,13 +36,12 @@ static const struct regulator_ops wm8400_ldo_ops = {
static unsigned int wm8400_dcdc_get_mode(struct regulator_dev *dev) static unsigned int wm8400_dcdc_get_mode(struct regulator_dev *dev)
{ {
struct wm8400 *wm8400 = rdev_get_drvdata(dev); struct regmap *rmap = rdev_get_regmap(dev);
int offset = (rdev_get_id(dev) - WM8400_DCDC1) * 2; int offset = (rdev_get_id(dev) - WM8400_DCDC1) * 2;
u16 data[2]; u16 data[2];
int ret; int ret;
ret = wm8400_block_read(wm8400, WM8400_DCDC1_CONTROL_1 + offset, 2, ret = regmap_bulk_read(rmap, WM8400_DCDC1_CONTROL_1 + offset, data, 2);
data);
if (ret != 0) if (ret != 0)
return 0; return 0;
...@@ -63,36 +62,36 @@ static unsigned int wm8400_dcdc_get_mode(struct regulator_dev *dev) ...@@ -63,36 +62,36 @@ static unsigned int wm8400_dcdc_get_mode(struct regulator_dev *dev)
static int wm8400_dcdc_set_mode(struct regulator_dev *dev, unsigned int mode) static int wm8400_dcdc_set_mode(struct regulator_dev *dev, unsigned int mode)
{ {
struct wm8400 *wm8400 = rdev_get_drvdata(dev); struct regmap *rmap = rdev_get_regmap(dev);
int offset = (rdev_get_id(dev) - WM8400_DCDC1) * 2; int offset = (rdev_get_id(dev) - WM8400_DCDC1) * 2;
int ret; int ret;
switch (mode) { switch (mode) {
case REGULATOR_MODE_FAST: case REGULATOR_MODE_FAST:
/* Datasheet: active with force PWM */ /* Datasheet: active with force PWM */
ret = wm8400_set_bits(wm8400, WM8400_DCDC1_CONTROL_2 + offset, ret = regmap_update_bits(rmap, WM8400_DCDC1_CONTROL_2 + offset,
WM8400_DC1_FRC_PWM, WM8400_DC1_FRC_PWM); WM8400_DC1_FRC_PWM, WM8400_DC1_FRC_PWM);
if (ret != 0) if (ret != 0)
return ret; return ret;
return wm8400_set_bits(wm8400, WM8400_DCDC1_CONTROL_1 + offset, return regmap_update_bits(rmap, WM8400_DCDC1_CONTROL_1 + offset,
WM8400_DC1_ACTIVE | WM8400_DC1_SLEEP, WM8400_DC1_ACTIVE | WM8400_DC1_SLEEP,
WM8400_DC1_ACTIVE); WM8400_DC1_ACTIVE);
case REGULATOR_MODE_NORMAL: case REGULATOR_MODE_NORMAL:
/* Datasheet: active */ /* Datasheet: active */
ret = wm8400_set_bits(wm8400, WM8400_DCDC1_CONTROL_2 + offset, ret = regmap_update_bits(rmap, WM8400_DCDC1_CONTROL_2 + offset,
WM8400_DC1_FRC_PWM, 0); WM8400_DC1_FRC_PWM, 0);
if (ret != 0) if (ret != 0)
return ret; return ret;
return wm8400_set_bits(wm8400, WM8400_DCDC1_CONTROL_1 + offset, return regmap_update_bits(rmap, WM8400_DCDC1_CONTROL_1 + offset,
WM8400_DC1_ACTIVE | WM8400_DC1_SLEEP, WM8400_DC1_ACTIVE | WM8400_DC1_SLEEP,
WM8400_DC1_ACTIVE); WM8400_DC1_ACTIVE);
case REGULATOR_MODE_IDLE: case REGULATOR_MODE_IDLE:
/* Datasheet: standby */ /* Datasheet: standby */
return wm8400_set_bits(wm8400, WM8400_DCDC1_CONTROL_1 + offset, return regmap_update_bits(rmap, WM8400_DCDC1_CONTROL_1 + offset,
WM8400_DC1_ACTIVE | WM8400_DC1_SLEEP, 0); WM8400_DC1_ACTIVE | WM8400_DC1_SLEEP, 0);
default: default:
return -EINVAL; return -EINVAL;
......
...@@ -923,12 +923,4 @@ struct wm8400 { ...@@ -923,12 +923,4 @@ struct wm8400 {
#define WM8400_LINE_CMP_VTHD_SHIFT 0 /* LINE_CMP_VTHD - [3:0] */ #define WM8400_LINE_CMP_VTHD_SHIFT 0 /* LINE_CMP_VTHD - [3:0] */
#define WM8400_LINE_CMP_VTHD_WIDTH 4 /* LINE_CMP_VTHD - [3:0] */ #define WM8400_LINE_CMP_VTHD_WIDTH 4 /* LINE_CMP_VTHD - [3:0] */
int wm8400_block_read(struct wm8400 *wm8400, u8 reg, int count, u16 *data);
static inline int wm8400_set_bits(struct wm8400 *wm8400, u8 reg,
u16 mask, u16 val)
{
return regmap_update_bits(wm8400->regmap, reg, mask, val);
}
#endif #endif
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