History

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.

Axel Lin committed 7 years ago

Commit e08abec1 parent 5b60ee53 files · +8 −23Browse files

Unified · Split

3 files
  1. drivers/mfd/wm8400-core.c +0 −6
  2. drivers/regulator/wm8400-regulator.c +8 −9
  3. include/linux/mfd/wm8400-private.h +0 −8
drivers/mfd/wm8400-core.c+0−6
@@ -35,12 +35,6 @@ static bool wm8400_volatile(struct device *dev, unsigned int reg) · 34 unmodified lines
35 }35 }
36}36}
37 37
38int wm8400_block_read(struct wm8400 *wm8400, u8 reg, int count, u16 *data)
39{
40 return regmap_bulk_read(wm8400->regmap, reg, data, count);
41}
42EXPORT_SYMBOL_GPL(wm8400_block_read);
43
44static int wm8400_register_codec(struct wm8400 *wm8400)38static int wm8400_register_codec(struct wm8400 *wm8400)
45{39{
46 const struct mfd_cell cell = {40 const struct mfd_cell cell = {
drivers/regulator/wm8400-regulator.c+8−9
@@ -36,13 +36,12 @@ static const struct regulator_ops wm8400_ldo_ops = { · 35 unmodified lines
36 36
37static unsigned int wm8400_dcdc_get_mode(struct regulator_dev *dev)37static unsigned int wm8400_dcdc_get_mode(struct regulator_dev *dev)
38{38{
39 struct wm8400 *wm8400 = rdev_get_drvdata(dev);39 struct regmap *rmap = rdev_get_regmap(dev);
40 int offset = (rdev_get_id(dev) - WM8400_DCDC1) * 2;40 int offset = (rdev_get_id(dev) - WM8400_DCDC1) * 2;
41 u16 data[2];41 u16 data[2];
42 int ret;42 int ret;
43 43
44 ret = wm8400_block_read(wm8400, WM8400_DCDC1_CONTROL_1 + offset, 2,44 ret = regmap_bulk_read(rmap, WM8400_DCDC1_CONTROL_1 + offset, data, 2);
45 data);
46 if (ret != 0)45 if (ret != 0)
47 return 0;46 return 0;
48 47
@@ -63,36 +62,36 @@ static unsigned int wm8400_dcdc_get_mode(struct regulator_dev *dev) · 14 unmodified lines
63 62
64static int wm8400_dcdc_set_mode(struct regulator_dev *dev, unsigned int mode)63static int wm8400_dcdc_set_mode(struct regulator_dev *dev, unsigned int mode)
65{64{
66 struct wm8400 *wm8400 = rdev_get_drvdata(dev);65 struct regmap *rmap = rdev_get_regmap(dev);
67 int offset = (rdev_get_id(dev) - WM8400_DCDC1) * 2;66 int offset = (rdev_get_id(dev) - WM8400_DCDC1) * 2;
68 int ret;67 int ret;
69 68
70 switch (mode) {69 switch (mode) {
71 case REGULATOR_MODE_FAST:70 case REGULATOR_MODE_FAST:
72 /* Datasheet: active with force PWM */71 /* Datasheet: active with force PWM */
73 ret = wm8400_set_bits(wm8400, WM8400_DCDC1_CONTROL_2 + offset,72 ret = regmap_update_bits(rmap, WM8400_DCDC1_CONTROL_2 + offset,
74 WM8400_DC1_FRC_PWM, WM8400_DC1_FRC_PWM);73 WM8400_DC1_FRC_PWM, WM8400_DC1_FRC_PWM);
75 if (ret != 0)74 if (ret != 0)
76 return ret;75 return ret;
77 76
78 return wm8400_set_bits(wm8400, WM8400_DCDC1_CONTROL_1 + offset,77 return regmap_update_bits(rmap, WM8400_DCDC1_CONTROL_1 + offset,
79 WM8400_DC1_ACTIVE | WM8400_DC1_SLEEP,78 WM8400_DC1_ACTIVE | WM8400_DC1_SLEEP,
80 WM8400_DC1_ACTIVE);79 WM8400_DC1_ACTIVE);
81 80
82 case REGULATOR_MODE_NORMAL:81 case REGULATOR_MODE_NORMAL:
83 /* Datasheet: active */82 /* Datasheet: active */
84 ret = wm8400_set_bits(wm8400, WM8400_DCDC1_CONTROL_2 + offset,83 ret = regmap_update_bits(rmap, WM8400_DCDC1_CONTROL_2 + offset,
85 WM8400_DC1_FRC_PWM, 0);84 WM8400_DC1_FRC_PWM, 0);
86 if (ret != 0)85 if (ret != 0)
87 return ret;86 return ret;
88 87
89 return wm8400_set_bits(wm8400, WM8400_DCDC1_CONTROL_1 + offset,88 return regmap_update_bits(rmap, WM8400_DCDC1_CONTROL_1 + offset,
90 WM8400_DC1_ACTIVE | WM8400_DC1_SLEEP,89 WM8400_DC1_ACTIVE | WM8400_DC1_SLEEP,
91 WM8400_DC1_ACTIVE);90 WM8400_DC1_ACTIVE);
92 91
93 case REGULATOR_MODE_IDLE:92 case REGULATOR_MODE_IDLE:
94 /* Datasheet: standby */93 /* Datasheet: standby */
95 return wm8400_set_bits(wm8400, WM8400_DCDC1_CONTROL_1 + offset,94 return regmap_update_bits(rmap, WM8400_DCDC1_CONTROL_1 + offset,
96 WM8400_DC1_ACTIVE | WM8400_DC1_SLEEP, 0);95 WM8400_DC1_ACTIVE | WM8400_DC1_SLEEP, 0);
97 default:96 default:
98 return -EINVAL;97 return -EINVAL;
include/linux/mfd/wm8400-private.h+0−8
@@ -923,12 +923,4 @@ struct wm8400 { · 922 unmodified lines
923#define WM8400_LINE_CMP_VTHD_SHIFT 0 /* LINE_CMP_VTHD - [3:0] */923#define WM8400_LINE_CMP_VTHD_SHIFT 0 /* LINE_CMP_VTHD - [3:0] */
924#define WM8400_LINE_CMP_VTHD_WIDTH 4 /* LINE_CMP_VTHD - [3:0] */924#define WM8400_LINE_CMP_VTHD_WIDTH 4 /* LINE_CMP_VTHD - [3:0] */
925 925
926int wm8400_block_read(struct wm8400 *wm8400, u8 reg, int count, u16 *data);
927
928static inline int wm8400_set_bits(struct wm8400 *wm8400, u8 reg,
929 u16 mask, u16 val)
930{
931 return regmap_update_bits(wm8400->regmap, reg, mask, val);
932}
933
934#endif926#endif

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t