diff options
author | Mark Brown <broonie@kernel.org> | 2015-07-17 14:32:04 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-07-17 14:32:04 -0400 |
commit | 41a5fefeff21bb08438383c0a6b5a06045775969 (patch) | |
tree | 6517730821e2fe9727b8485e7e12474948c51c58 | |
parent | c418a84a8c8f98b1a0f30cd68d0cdf40d77aed01 (diff) | |
parent | 8019ff6cfc0440415fcfb6352c58c3951e6ab053 (diff) |
Merge tag 'regmap-seq-delay-api' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap into asoc-reg-default
regmap: Create a new struct reg_sequence for register sequences
In order to allow us to start adding extra annotations for sequences
without bloating register default tables duplicate the structure under
the new name reg_sequence and update the APIs to use that instead of
reg_default.
Conflicts:
sound/soc/codecs/da7210.c
sound/soc/codecs/rt5651.c
sound/soc/codecs/wm8993.c
27 files changed, 62 insertions, 51 deletions
diff --git a/drivers/base/regmap/internal.h b/drivers/base/regmap/internal.h index b2b2849fc6d3..873ddf91c9d3 100644 --- a/drivers/base/regmap/internal.h +++ b/drivers/base/regmap/internal.h | |||
@@ -136,7 +136,7 @@ struct regmap { | |||
136 | /* if set, the HW registers are known to match map->reg_defaults */ | 136 | /* if set, the HW registers are known to match map->reg_defaults */ |
137 | bool no_sync_defaults; | 137 | bool no_sync_defaults; |
138 | 138 | ||
139 | struct reg_default *patch; | 139 | struct reg_sequence *patch; |
140 | int patch_regs; | 140 | int patch_regs; |
141 | 141 | ||
142 | /* if set, converts bulk rw to single rw */ | 142 | /* if set, converts bulk rw to single rw */ |
diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c index 7111d04f2621..2cbb4502747d 100644 --- a/drivers/base/regmap/regmap.c +++ b/drivers/base/regmap/regmap.c | |||
@@ -1743,7 +1743,7 @@ EXPORT_SYMBOL_GPL(regmap_bulk_write); | |||
1743 | * relative. The page register has been written if that was neccessary. | 1743 | * relative. The page register has been written if that was neccessary. |
1744 | */ | 1744 | */ |
1745 | static int _regmap_raw_multi_reg_write(struct regmap *map, | 1745 | static int _regmap_raw_multi_reg_write(struct regmap *map, |
1746 | const struct reg_default *regs, | 1746 | const struct reg_sequence *regs, |
1747 | size_t num_regs) | 1747 | size_t num_regs) |
1748 | { | 1748 | { |
1749 | int ret; | 1749 | int ret; |
@@ -1800,12 +1800,12 @@ static unsigned int _regmap_register_page(struct regmap *map, | |||
1800 | } | 1800 | } |
1801 | 1801 | ||
1802 | static int _regmap_range_multi_paged_reg_write(struct regmap *map, | 1802 | static int _regmap_range_multi_paged_reg_write(struct regmap *map, |
1803 | struct reg_default *regs, | 1803 | struct reg_sequence *regs, |
1804 | size_t num_regs) | 1804 | size_t num_regs) |
1805 | { | 1805 | { |
1806 | int ret; | 1806 | int ret; |
1807 | int i, n; | 1807 | int i, n; |
1808 | struct reg_default *base; | 1808 | struct reg_sequence *base; |
1809 | unsigned int this_page = 0; | 1809 | unsigned int this_page = 0; |
1810 | /* | 1810 | /* |
1811 | * the set of registers are not neccessarily in order, but | 1811 | * the set of registers are not neccessarily in order, but |
@@ -1843,7 +1843,7 @@ static int _regmap_range_multi_paged_reg_write(struct regmap *map, | |||
1843 | } | 1843 | } |
1844 | 1844 | ||
1845 | static int _regmap_multi_reg_write(struct regmap *map, | 1845 | static int _regmap_multi_reg_write(struct regmap *map, |
1846 | const struct reg_default *regs, | 1846 | const struct reg_sequence *regs, |
1847 | size_t num_regs) | 1847 | size_t num_regs) |
1848 | { | 1848 | { |
1849 | int i; | 1849 | int i; |
@@ -1895,8 +1895,8 @@ static int _regmap_multi_reg_write(struct regmap *map, | |||
1895 | struct regmap_range_node *range; | 1895 | struct regmap_range_node *range; |
1896 | range = _regmap_range_lookup(map, reg); | 1896 | range = _regmap_range_lookup(map, reg); |
1897 | if (range) { | 1897 | if (range) { |
1898 | size_t len = sizeof(struct reg_default)*num_regs; | 1898 | size_t len = sizeof(struct reg_sequence)*num_regs; |
1899 | struct reg_default *base = kmemdup(regs, len, | 1899 | struct reg_sequence *base = kmemdup(regs, len, |
1900 | GFP_KERNEL); | 1900 | GFP_KERNEL); |
1901 | if (!base) | 1901 | if (!base) |
1902 | return -ENOMEM; | 1902 | return -ENOMEM; |
@@ -1929,7 +1929,7 @@ static int _regmap_multi_reg_write(struct regmap *map, | |||
1929 | * A value of zero will be returned on success, a negative errno will be | 1929 | * A value of zero will be returned on success, a negative errno will be |
1930 | * returned in error cases. | 1930 | * returned in error cases. |
1931 | */ | 1931 | */ |
1932 | int regmap_multi_reg_write(struct regmap *map, const struct reg_default *regs, | 1932 | int regmap_multi_reg_write(struct regmap *map, const struct reg_sequence *regs, |
1933 | int num_regs) | 1933 | int num_regs) |
1934 | { | 1934 | { |
1935 | int ret; | 1935 | int ret; |
@@ -1962,7 +1962,7 @@ EXPORT_SYMBOL_GPL(regmap_multi_reg_write); | |||
1962 | * be returned in error cases. | 1962 | * be returned in error cases. |
1963 | */ | 1963 | */ |
1964 | int regmap_multi_reg_write_bypassed(struct regmap *map, | 1964 | int regmap_multi_reg_write_bypassed(struct regmap *map, |
1965 | const struct reg_default *regs, | 1965 | const struct reg_sequence *regs, |
1966 | int num_regs) | 1966 | int num_regs) |
1967 | { | 1967 | { |
1968 | int ret; | 1968 | int ret; |
@@ -2552,10 +2552,10 @@ EXPORT_SYMBOL_GPL(regmap_async_complete); | |||
2552 | * The caller must ensure that this function cannot be called | 2552 | * The caller must ensure that this function cannot be called |
2553 | * concurrently with either itself or regcache_sync(). | 2553 | * concurrently with either itself or regcache_sync(). |
2554 | */ | 2554 | */ |
2555 | int regmap_register_patch(struct regmap *map, const struct reg_default *regs, | 2555 | int regmap_register_patch(struct regmap *map, const struct reg_sequence *regs, |
2556 | int num_regs) | 2556 | int num_regs) |
2557 | { | 2557 | { |
2558 | struct reg_default *p; | 2558 | struct reg_sequence *p; |
2559 | int ret; | 2559 | int ret; |
2560 | bool bypass; | 2560 | bool bypass; |
2561 | 2561 | ||
@@ -2564,7 +2564,7 @@ int regmap_register_patch(struct regmap *map, const struct reg_default *regs, | |||
2564 | return 0; | 2564 | return 0; |
2565 | 2565 | ||
2566 | p = krealloc(map->patch, | 2566 | p = krealloc(map->patch, |
2567 | sizeof(struct reg_default) * (map->patch_regs + num_regs), | 2567 | sizeof(struct reg_sequence) * (map->patch_regs + num_regs), |
2568 | GFP_KERNEL); | 2568 | GFP_KERNEL); |
2569 | if (p) { | 2569 | if (p) { |
2570 | memcpy(p + map->patch_regs, regs, num_regs * sizeof(*regs)); | 2570 | memcpy(p + map->patch_regs, regs, num_regs * sizeof(*regs)); |
diff --git a/drivers/gpu/drm/i2c/adv7511.c b/drivers/gpu/drm/i2c/adv7511.c index 2aaa3c88999e..00416f23b5cb 100644 --- a/drivers/gpu/drm/i2c/adv7511.c +++ b/drivers/gpu/drm/i2c/adv7511.c | |||
@@ -54,7 +54,7 @@ static struct adv7511 *encoder_to_adv7511(struct drm_encoder *encoder) | |||
54 | } | 54 | } |
55 | 55 | ||
56 | /* ADI recommended values for proper operation. */ | 56 | /* ADI recommended values for proper operation. */ |
57 | static const struct reg_default adv7511_fixed_registers[] = { | 57 | static const struct reg_sequence adv7511_fixed_registers[] = { |
58 | { 0x98, 0x03 }, | 58 | { 0x98, 0x03 }, |
59 | { 0x9a, 0xe0 }, | 59 | { 0x9a, 0xe0 }, |
60 | { 0x9c, 0x30 }, | 60 | { 0x9c, 0x30 }, |
diff --git a/drivers/input/misc/drv260x.c b/drivers/input/misc/drv260x.c index e5d60ecd29a4..f5c9cf2f4073 100644 --- a/drivers/input/misc/drv260x.c +++ b/drivers/input/misc/drv260x.c | |||
@@ -313,14 +313,14 @@ static void drv260x_close(struct input_dev *input) | |||
313 | gpiod_set_value(haptics->enable_gpio, 0); | 313 | gpiod_set_value(haptics->enable_gpio, 0); |
314 | } | 314 | } |
315 | 315 | ||
316 | static const struct reg_default drv260x_lra_cal_regs[] = { | 316 | static const struct reg_sequence drv260x_lra_cal_regs[] = { |
317 | { DRV260X_MODE, DRV260X_AUTO_CAL }, | 317 | { DRV260X_MODE, DRV260X_AUTO_CAL }, |
318 | { DRV260X_CTRL3, DRV260X_NG_THRESH_2 }, | 318 | { DRV260X_CTRL3, DRV260X_NG_THRESH_2 }, |
319 | { DRV260X_FEEDBACK_CTRL, DRV260X_FB_REG_LRA_MODE | | 319 | { DRV260X_FEEDBACK_CTRL, DRV260X_FB_REG_LRA_MODE | |
320 | DRV260X_BRAKE_FACTOR_4X | DRV260X_LOOP_GAIN_HIGH }, | 320 | DRV260X_BRAKE_FACTOR_4X | DRV260X_LOOP_GAIN_HIGH }, |
321 | }; | 321 | }; |
322 | 322 | ||
323 | static const struct reg_default drv260x_lra_init_regs[] = { | 323 | static const struct reg_sequence drv260x_lra_init_regs[] = { |
324 | { DRV260X_MODE, DRV260X_RT_PLAYBACK }, | 324 | { DRV260X_MODE, DRV260X_RT_PLAYBACK }, |
325 | { DRV260X_A_TO_V_CTRL, DRV260X_AUDIO_HAPTICS_PEAK_20MS | | 325 | { DRV260X_A_TO_V_CTRL, DRV260X_AUDIO_HAPTICS_PEAK_20MS | |
326 | DRV260X_AUDIO_HAPTICS_FILTER_125HZ }, | 326 | DRV260X_AUDIO_HAPTICS_FILTER_125HZ }, |
@@ -337,7 +337,7 @@ static const struct reg_default drv260x_lra_init_regs[] = { | |||
337 | { DRV260X_CTRL4, DRV260X_AUTOCAL_TIME_500MS }, | 337 | { DRV260X_CTRL4, DRV260X_AUTOCAL_TIME_500MS }, |
338 | }; | 338 | }; |
339 | 339 | ||
340 | static const struct reg_default drv260x_erm_cal_regs[] = { | 340 | static const struct reg_sequence drv260x_erm_cal_regs[] = { |
341 | { DRV260X_MODE, DRV260X_AUTO_CAL }, | 341 | { DRV260X_MODE, DRV260X_AUTO_CAL }, |
342 | { DRV260X_A_TO_V_MIN_INPUT, DRV260X_AUDIO_HAPTICS_MIN_IN_VOLT }, | 342 | { DRV260X_A_TO_V_MIN_INPUT, DRV260X_AUDIO_HAPTICS_MIN_IN_VOLT }, |
343 | { DRV260X_A_TO_V_MAX_INPUT, DRV260X_AUDIO_HAPTICS_MAX_IN_VOLT }, | 343 | { DRV260X_A_TO_V_MAX_INPUT, DRV260X_AUDIO_HAPTICS_MAX_IN_VOLT }, |
diff --git a/drivers/input/misc/drv2665.c b/drivers/input/misc/drv2665.c index 0afaa33de07d..924456e3ca75 100644 --- a/drivers/input/misc/drv2665.c +++ b/drivers/input/misc/drv2665.c | |||
@@ -132,7 +132,7 @@ static void drv2665_close(struct input_dev *input) | |||
132 | "Failed to enter standby mode: %d\n", error); | 132 | "Failed to enter standby mode: %d\n", error); |
133 | } | 133 | } |
134 | 134 | ||
135 | static const struct reg_default drv2665_init_regs[] = { | 135 | static const struct reg_sequence drv2665_init_regs[] = { |
136 | { DRV2665_CTRL_2, 0 | DRV2665_10_MS_IDLE_TOUT }, | 136 | { DRV2665_CTRL_2, 0 | DRV2665_10_MS_IDLE_TOUT }, |
137 | { DRV2665_CTRL_1, DRV2665_25_VPP_GAIN }, | 137 | { DRV2665_CTRL_1, DRV2665_25_VPP_GAIN }, |
138 | }; | 138 | }; |
diff --git a/drivers/input/misc/drv2667.c b/drivers/input/misc/drv2667.c index fc0fddf0896a..047136aa646f 100644 --- a/drivers/input/misc/drv2667.c +++ b/drivers/input/misc/drv2667.c | |||
@@ -262,14 +262,14 @@ static void drv2667_close(struct input_dev *input) | |||
262 | "Failed to enter standby mode: %d\n", error); | 262 | "Failed to enter standby mode: %d\n", error); |
263 | } | 263 | } |
264 | 264 | ||
265 | static const struct reg_default drv2667_init_regs[] = { | 265 | static const struct reg_sequence drv2667_init_regs[] = { |
266 | { DRV2667_CTRL_2, 0 }, | 266 | { DRV2667_CTRL_2, 0 }, |
267 | { DRV2667_CTRL_1, DRV2667_25_VPP_GAIN }, | 267 | { DRV2667_CTRL_1, DRV2667_25_VPP_GAIN }, |
268 | { DRV2667_WV_SEQ_0, 1 }, | 268 | { DRV2667_WV_SEQ_0, 1 }, |
269 | { DRV2667_WV_SEQ_1, 0 } | 269 | { DRV2667_WV_SEQ_1, 0 } |
270 | }; | 270 | }; |
271 | 271 | ||
272 | static const struct reg_default drv2667_page1_init[] = { | 272 | static const struct reg_sequence drv2667_page1_init[] = { |
273 | { DRV2667_RAM_HDR_SZ, 0x05 }, | 273 | { DRV2667_RAM_HDR_SZ, 0x05 }, |
274 | { DRV2667_RAM_START_HI, 0x80 }, | 274 | { DRV2667_RAM_START_HI, 0x80 }, |
275 | { DRV2667_RAM_START_LO, 0x06 }, | 275 | { DRV2667_RAM_START_LO, 0x06 }, |
diff --git a/drivers/mfd/arizona-core.c b/drivers/mfd/arizona-core.c index bebf58a06a6b..66d50be11960 100644 --- a/drivers/mfd/arizona-core.c +++ b/drivers/mfd/arizona-core.c | |||
@@ -392,7 +392,7 @@ err: | |||
392 | * Register patch to some of the CODECs internal write sequences | 392 | * Register patch to some of the CODECs internal write sequences |
393 | * to ensure a clean exit from the low power sleep state. | 393 | * to ensure a clean exit from the low power sleep state. |
394 | */ | 394 | */ |
395 | static const struct reg_default wm5110_sleep_patch[] = { | 395 | static const struct reg_sequence wm5110_sleep_patch[] = { |
396 | { 0x337A, 0xC100 }, | 396 | { 0x337A, 0xC100 }, |
397 | { 0x337B, 0x0041 }, | 397 | { 0x337B, 0x0041 }, |
398 | { 0x3300, 0xA210 }, | 398 | { 0x3300, 0xA210 }, |
diff --git a/drivers/mfd/twl6040.c b/drivers/mfd/twl6040.c index c5265c1262c5..583dc33432f3 100644 --- a/drivers/mfd/twl6040.c +++ b/drivers/mfd/twl6040.c | |||
@@ -86,7 +86,7 @@ static const struct reg_default twl6040_defaults[] = { | |||
86 | { 0x2E, 0x00 }, /* REG_STATUS (ro) */ | 86 | { 0x2E, 0x00 }, /* REG_STATUS (ro) */ |
87 | }; | 87 | }; |
88 | 88 | ||
89 | static struct reg_default twl6040_patch[] = { | 89 | static struct reg_sequence twl6040_patch[] = { |
90 | /* | 90 | /* |
91 | * Select I2C bus access to dual access registers | 91 | * Select I2C bus access to dual access registers |
92 | * Interrupt register is cleared on read | 92 | * Interrupt register is cleared on read |
diff --git a/drivers/mfd/wm5102-tables.c b/drivers/mfd/wm5102-tables.c index aeae6ec123b3..423fb3730dc7 100644 --- a/drivers/mfd/wm5102-tables.c +++ b/drivers/mfd/wm5102-tables.c | |||
@@ -21,7 +21,7 @@ | |||
21 | #define WM5102_NUM_AOD_ISR 2 | 21 | #define WM5102_NUM_AOD_ISR 2 |
22 | #define WM5102_NUM_ISR 5 | 22 | #define WM5102_NUM_ISR 5 |
23 | 23 | ||
24 | static const struct reg_default wm5102_reva_patch[] = { | 24 | static const struct reg_sequence wm5102_reva_patch[] = { |
25 | { 0x80, 0x0003 }, | 25 | { 0x80, 0x0003 }, |
26 | { 0x221, 0x0090 }, | 26 | { 0x221, 0x0090 }, |
27 | { 0x211, 0x0014 }, | 27 | { 0x211, 0x0014 }, |
@@ -57,7 +57,7 @@ static const struct reg_default wm5102_reva_patch[] = { | |||
57 | { 0x80, 0x0000 }, | 57 | { 0x80, 0x0000 }, |
58 | }; | 58 | }; |
59 | 59 | ||
60 | static const struct reg_default wm5102_revb_patch[] = { | 60 | static const struct reg_sequence wm5102_revb_patch[] = { |
61 | { 0x19, 0x0001 }, | 61 | { 0x19, 0x0001 }, |
62 | { 0x80, 0x0003 }, | 62 | { 0x80, 0x0003 }, |
63 | { 0x081, 0xE022 }, | 63 | { 0x081, 0xE022 }, |
@@ -80,7 +80,7 @@ static const struct reg_default wm5102_revb_patch[] = { | |||
80 | /* We use a function so we can use ARRAY_SIZE() */ | 80 | /* We use a function so we can use ARRAY_SIZE() */ |
81 | int wm5102_patch(struct arizona *arizona) | 81 | int wm5102_patch(struct arizona *arizona) |
82 | { | 82 | { |
83 | const struct reg_default *wm5102_patch; | 83 | const struct reg_sequence *wm5102_patch; |
84 | int patch_size; | 84 | int patch_size; |
85 | 85 | ||
86 | switch (arizona->rev) { | 86 | switch (arizona->rev) { |
diff --git a/drivers/mfd/wm5110-tables.c b/drivers/mfd/wm5110-tables.c index 12cad94b4035..26ce14f903fe 100644 --- a/drivers/mfd/wm5110-tables.c +++ b/drivers/mfd/wm5110-tables.c | |||
@@ -21,7 +21,7 @@ | |||
21 | #define WM5110_NUM_AOD_ISR 2 | 21 | #define WM5110_NUM_AOD_ISR 2 |
22 | #define WM5110_NUM_ISR 5 | 22 | #define WM5110_NUM_ISR 5 |
23 | 23 | ||
24 | static const struct reg_default wm5110_reva_patch[] = { | 24 | static const struct reg_sequence wm5110_reva_patch[] = { |
25 | { 0x80, 0x3 }, | 25 | { 0x80, 0x3 }, |
26 | { 0x44, 0x20 }, | 26 | { 0x44, 0x20 }, |
27 | { 0x45, 0x40 }, | 27 | { 0x45, 0x40 }, |
@@ -134,7 +134,7 @@ static const struct reg_default wm5110_reva_patch[] = { | |||
134 | { 0x209, 0x002A }, | 134 | { 0x209, 0x002A }, |
135 | }; | 135 | }; |
136 | 136 | ||
137 | static const struct reg_default wm5110_revb_patch[] = { | 137 | static const struct reg_sequence wm5110_revb_patch[] = { |
138 | { 0x80, 0x3 }, | 138 | { 0x80, 0x3 }, |
139 | { 0x36e, 0x0210 }, | 139 | { 0x36e, 0x0210 }, |
140 | { 0x370, 0x0210 }, | 140 | { 0x370, 0x0210 }, |
@@ -224,7 +224,7 @@ static const struct reg_default wm5110_revb_patch[] = { | |||
224 | { 0x80, 0x0 }, | 224 | { 0x80, 0x0 }, |
225 | }; | 225 | }; |
226 | 226 | ||
227 | static const struct reg_default wm5110_revd_patch[] = { | 227 | static const struct reg_sequence wm5110_revd_patch[] = { |
228 | { 0x80, 0x3 }, | 228 | { 0x80, 0x3 }, |
229 | { 0x80, 0x3 }, | 229 | { 0x80, 0x3 }, |
230 | { 0x393, 0x27 }, | 230 | { 0x393, 0x27 }, |
diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c index 53ae5af5d6e4..0f4169a3a5d4 100644 --- a/drivers/mfd/wm8994-core.c +++ b/drivers/mfd/wm8994-core.c | |||
@@ -243,21 +243,21 @@ static int wm8994_ldo_in_use(struct wm8994_pdata *pdata, int ldo) | |||
243 | } | 243 | } |
244 | #endif | 244 | #endif |
245 | 245 | ||
246 | static const struct reg_default wm8994_revc_patch[] = { | 246 | static const struct reg_sequence wm8994_revc_patch[] = { |
247 | { 0x102, 0x3 }, | 247 | { 0x102, 0x3 }, |
248 | { 0x56, 0x3 }, | 248 | { 0x56, 0x3 }, |
249 | { 0x817, 0x0 }, | 249 | { 0x817, 0x0 }, |
250 | { 0x102, 0x0 }, | 250 | { 0x102, 0x0 }, |
251 | }; | 251 | }; |
252 | 252 | ||
253 | static const struct reg_default wm8958_reva_patch[] = { | 253 | static const struct reg_sequence wm8958_reva_patch[] = { |
254 | { 0x102, 0x3 }, | 254 | { 0x102, 0x3 }, |
255 | { 0xcb, 0x81 }, | 255 | { 0xcb, 0x81 }, |
256 | { 0x817, 0x0 }, | 256 | { 0x817, 0x0 }, |
257 | { 0x102, 0x0 }, | 257 | { 0x102, 0x0 }, |
258 | }; | 258 | }; |
259 | 259 | ||
260 | static const struct reg_default wm1811_reva_patch[] = { | 260 | static const struct reg_sequence wm1811_reva_patch[] = { |
261 | { 0x102, 0x3 }, | 261 | { 0x102, 0x3 }, |
262 | { 0x56, 0xc07 }, | 262 | { 0x56, 0xc07 }, |
263 | { 0x5d, 0x7e }, | 263 | { 0x5d, 0x7e }, |
@@ -326,7 +326,7 @@ static int wm8994_device_init(struct wm8994 *wm8994, int irq) | |||
326 | { | 326 | { |
327 | struct wm8994_pdata *pdata; | 327 | struct wm8994_pdata *pdata; |
328 | struct regmap_config *regmap_config; | 328 | struct regmap_config *regmap_config; |
329 | const struct reg_default *regmap_patch = NULL; | 329 | const struct reg_sequence *regmap_patch = NULL; |
330 | const char *devname; | 330 | const char *devname; |
331 | int ret, i, patch_regs = 0; | 331 | int ret, i, patch_regs = 0; |
332 | int pulls = 0; | 332 | int pulls = 0; |
diff --git a/drivers/mfd/wm8997-tables.c b/drivers/mfd/wm8997-tables.c index c0c25d75aacc..cab2c68f1737 100644 --- a/drivers/mfd/wm8997-tables.c +++ b/drivers/mfd/wm8997-tables.c | |||
@@ -17,7 +17,7 @@ | |||
17 | 17 | ||
18 | #include "arizona.h" | 18 | #include "arizona.h" |
19 | 19 | ||
20 | static const struct reg_default wm8997_reva_patch[] = { | 20 | static const struct reg_sequence wm8997_reva_patch[] = { |
21 | { 0x80, 0x0003 }, | 21 | { 0x80, 0x0003 }, |
22 | { 0x214, 0x0008 }, | 22 | { 0x214, 0x0008 }, |
23 | { 0x458, 0x0000 }, | 23 | { 0x458, 0x0000 }, |
diff --git a/include/linux/regmap.h b/include/linux/regmap.h index 59c55ea0f0b5..c9ef2ec69142 100644 --- a/include/linux/regmap.h +++ b/include/linux/regmap.h | |||
@@ -50,6 +50,17 @@ struct reg_default { | |||
50 | unsigned int def; | 50 | unsigned int def; |
51 | }; | 51 | }; |
52 | 52 | ||
53 | /** | ||
54 | * Register/value pairs for sequences of writes | ||
55 | * | ||
56 | * @reg: Register address. | ||
57 | * @def: Register value. | ||
58 | */ | ||
59 | struct reg_sequence { | ||
60 | unsigned int reg; | ||
61 | unsigned int def; | ||
62 | }; | ||
63 | |||
53 | #ifdef CONFIG_REGMAP | 64 | #ifdef CONFIG_REGMAP |
54 | 65 | ||
55 | enum regmap_endian { | 66 | enum regmap_endian { |
@@ -410,10 +421,10 @@ int regmap_raw_write(struct regmap *map, unsigned int reg, | |||
410 | const void *val, size_t val_len); | 421 | const void *val, size_t val_len); |
411 | int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val, | 422 | int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val, |
412 | size_t val_count); | 423 | size_t val_count); |
413 | int regmap_multi_reg_write(struct regmap *map, const struct reg_default *regs, | 424 | int regmap_multi_reg_write(struct regmap *map, const struct reg_sequence *regs, |
414 | int num_regs); | 425 | int num_regs); |
415 | int regmap_multi_reg_write_bypassed(struct regmap *map, | 426 | int regmap_multi_reg_write_bypassed(struct regmap *map, |
416 | const struct reg_default *regs, | 427 | const struct reg_sequence *regs, |
417 | int num_regs); | 428 | int num_regs); |
418 | int regmap_raw_write_async(struct regmap *map, unsigned int reg, | 429 | int regmap_raw_write_async(struct regmap *map, unsigned int reg, |
419 | const void *val, size_t val_len); | 430 | const void *val, size_t val_len); |
@@ -450,7 +461,7 @@ void regcache_mark_dirty(struct regmap *map); | |||
450 | bool regmap_check_range_table(struct regmap *map, unsigned int reg, | 461 | bool regmap_check_range_table(struct regmap *map, unsigned int reg, |
451 | const struct regmap_access_table *table); | 462 | const struct regmap_access_table *table); |
452 | 463 | ||
453 | int regmap_register_patch(struct regmap *map, const struct reg_default *regs, | 464 | int regmap_register_patch(struct regmap *map, const struct reg_sequence *regs, |
454 | int num_regs); | 465 | int num_regs); |
455 | int regmap_parse_val(struct regmap *map, const void *buf, | 466 | int regmap_parse_val(struct regmap *map, const void *buf, |
456 | unsigned int *val); | 467 | unsigned int *val); |
diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c index 802e05eae3e9..5edd33fcd68c 100644 --- a/sound/soc/codecs/arizona.c +++ b/sound/soc/codecs/arizona.c | |||
@@ -1366,7 +1366,7 @@ static void arizona_wm5102_set_dac_comp(struct snd_soc_codec *codec, | |||
1366 | { | 1366 | { |
1367 | struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); | 1367 | struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); |
1368 | struct arizona *arizona = priv->arizona; | 1368 | struct arizona *arizona = priv->arizona; |
1369 | struct reg_default dac_comp[] = { | 1369 | struct reg_sequence dac_comp[] = { |
1370 | { 0x80, 0x3 }, | 1370 | { 0x80, 0x3 }, |
1371 | { ARIZONA_DAC_COMP_1, 0 }, | 1371 | { ARIZONA_DAC_COMP_1, 0 }, |
1372 | { ARIZONA_DAC_COMP_2, 0 }, | 1372 | { ARIZONA_DAC_COMP_2, 0 }, |
diff --git a/sound/soc/codecs/cs35l32.c b/sound/soc/codecs/cs35l32.c index 8f40025b7e7c..2813a1b0c949 100644 --- a/sound/soc/codecs/cs35l32.c +++ b/sound/soc/codecs/cs35l32.c | |||
@@ -276,7 +276,7 @@ static const struct snd_soc_codec_driver soc_codec_dev_cs35l32 = { | |||
276 | }; | 276 | }; |
277 | 277 | ||
278 | /* Current and threshold powerup sequence Pg37 in datasheet */ | 278 | /* Current and threshold powerup sequence Pg37 in datasheet */ |
279 | static const struct reg_default cs35l32_monitor_patch[] = { | 279 | static const struct reg_sequence cs35l32_monitor_patch[] = { |
280 | 280 | ||
281 | { 0x00, 0x99 }, | 281 | { 0x00, 0x99 }, |
282 | { 0x48, 0x17 }, | 282 | { 0x48, 0x17 }, |
diff --git a/sound/soc/codecs/cs42l52.c b/sound/soc/codecs/cs42l52.c index 4de52c9957ac..8b2d05933594 100644 --- a/sound/soc/codecs/cs42l52.c +++ b/sound/soc/codecs/cs42l52.c | |||
@@ -1118,7 +1118,7 @@ static const struct snd_soc_codec_driver soc_codec_dev_cs42l52 = { | |||
1118 | }; | 1118 | }; |
1119 | 1119 | ||
1120 | /* Current and threshold powerup sequence Pg37 */ | 1120 | /* Current and threshold powerup sequence Pg37 */ |
1121 | static const struct reg_default cs42l52_threshold_patch[] = { | 1121 | static const struct reg_sequence cs42l52_threshold_patch[] = { |
1122 | 1122 | ||
1123 | { 0x00, 0x99 }, | 1123 | { 0x00, 0x99 }, |
1124 | { 0x3E, 0xBA }, | 1124 | { 0x3E, 0xBA }, |
diff --git a/sound/soc/codecs/da7210.c b/sound/soc/codecs/da7210.c index a44ead615b67..d4c0a324a03e 100644 --- a/sound/soc/codecs/da7210.c +++ b/sound/soc/codecs/da7210.c | |||
@@ -1182,7 +1182,7 @@ static struct snd_soc_codec_driver soc_codec_dev_da7210 = { | |||
1182 | 1182 | ||
1183 | #if IS_ENABLED(CONFIG_I2C) | 1183 | #if IS_ENABLED(CONFIG_I2C) |
1184 | 1184 | ||
1185 | static const struct reg_default da7210_regmap_i2c_patch[] = { | 1185 | static const struct reg_sequence da7210_regmap_i2c_patch[] = { |
1186 | 1186 | ||
1187 | /* System controller master disable */ | 1187 | /* System controller master disable */ |
1188 | { DA7210_STARTUP1, 0x00 }, | 1188 | { DA7210_STARTUP1, 0x00 }, |
@@ -1269,7 +1269,7 @@ static struct i2c_driver da7210_i2c_driver = { | |||
1269 | 1269 | ||
1270 | #if defined(CONFIG_SPI_MASTER) | 1270 | #if defined(CONFIG_SPI_MASTER) |
1271 | 1271 | ||
1272 | static const struct reg_default da7210_regmap_spi_patch[] = { | 1272 | static const struct reg_sequence da7210_regmap_spi_patch[] = { |
1273 | /* Dummy read to give two pulses over nCS for SPI */ | 1273 | /* Dummy read to give two pulses over nCS for SPI */ |
1274 | { DA7210_AUX2, 0x00 }, | 1274 | { DA7210_AUX2, 0x00 }, |
1275 | { DA7210_AUX2, 0x00 }, | 1275 | { DA7210_AUX2, 0x00 }, |
diff --git a/sound/soc/codecs/rt5640.c b/sound/soc/codecs/rt5640.c index 9bc78e57513d..1ed1f8895e12 100644 --- a/sound/soc/codecs/rt5640.c +++ b/sound/soc/codecs/rt5640.c | |||
@@ -51,7 +51,7 @@ static const struct regmap_range_cfg rt5640_ranges[] = { | |||
51 | .window_len = 0x1, }, | 51 | .window_len = 0x1, }, |
52 | }; | 52 | }; |
53 | 53 | ||
54 | static const struct reg_default init_list[] = { | 54 | static const struct reg_sequence init_list[] = { |
55 | {RT5640_PR_BASE + 0x3d, 0x3600}, | 55 | {RT5640_PR_BASE + 0x3d, 0x3600}, |
56 | {RT5640_PR_BASE + 0x12, 0x0aa8}, | 56 | {RT5640_PR_BASE + 0x12, 0x0aa8}, |
57 | {RT5640_PR_BASE + 0x14, 0x0aaa}, | 57 | {RT5640_PR_BASE + 0x14, 0x0aaa}, |
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index 9ce311e088fc..c0f4be430e70 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c | |||
@@ -54,7 +54,7 @@ static const struct regmap_range_cfg rt5645_ranges[] = { | |||
54 | }, | 54 | }, |
55 | }; | 55 | }; |
56 | 56 | ||
57 | static const struct reg_default init_list[] = { | 57 | static const struct reg_sequence init_list[] = { |
58 | {RT5645_PR_BASE + 0x3d, 0x3600}, | 58 | {RT5645_PR_BASE + 0x3d, 0x3600}, |
59 | {RT5645_PR_BASE + 0x1c, 0xfd20}, | 59 | {RT5645_PR_BASE + 0x1c, 0xfd20}, |
60 | {RT5645_PR_BASE + 0x20, 0x611f}, | 60 | {RT5645_PR_BASE + 0x20, 0x611f}, |
@@ -63,7 +63,7 @@ static const struct reg_default init_list[] = { | |||
63 | }; | 63 | }; |
64 | #define RT5645_INIT_REG_LEN ARRAY_SIZE(init_list) | 64 | #define RT5645_INIT_REG_LEN ARRAY_SIZE(init_list) |
65 | 65 | ||
66 | static const struct reg_default rt5650_init_list[] = { | 66 | static const struct reg_sequence rt5650_init_list[] = { |
67 | {0xf6, 0x0100}, | 67 | {0xf6, 0x0100}, |
68 | }; | 68 | }; |
69 | 69 | ||
diff --git a/sound/soc/codecs/rt5651.c b/sound/soc/codecs/rt5651.c index 3ee0574794db..383c3f065d30 100644 --- a/sound/soc/codecs/rt5651.c +++ b/sound/soc/codecs/rt5651.c | |||
@@ -46,7 +46,7 @@ static const struct regmap_range_cfg rt5651_ranges[] = { | |||
46 | .window_len = 0x1, }, | 46 | .window_len = 0x1, }, |
47 | }; | 47 | }; |
48 | 48 | ||
49 | static const struct reg_default init_list[] = { | 49 | static const struct reg_sequence init_list[] = { |
50 | {RT5651_PR_BASE + 0x3d, 0x3e00}, | 50 | {RT5651_PR_BASE + 0x3d, 0x3e00}, |
51 | }; | 51 | }; |
52 | 52 | ||
diff --git a/sound/soc/codecs/rt5670.c b/sound/soc/codecs/rt5670.c index a9123d414178..462a91f7cf68 100644 --- a/sound/soc/codecs/rt5670.c +++ b/sound/soc/codecs/rt5670.c | |||
@@ -51,7 +51,7 @@ static const struct regmap_range_cfg rt5670_ranges[] = { | |||
51 | .window_len = 0x1, }, | 51 | .window_len = 0x1, }, |
52 | }; | 52 | }; |
53 | 53 | ||
54 | static const struct reg_default init_list[] = { | 54 | static const struct reg_sequence init_list[] = { |
55 | { RT5670_PR_BASE + 0x14, 0x9a8a }, | 55 | { RT5670_PR_BASE + 0x14, 0x9a8a }, |
56 | { RT5670_PR_BASE + 0x38, 0x3ba1 }, | 56 | { RT5670_PR_BASE + 0x38, 0x3ba1 }, |
57 | { RT5670_PR_BASE + 0x3d, 0x3640 }, | 57 | { RT5670_PR_BASE + 0x3d, 0x3640 }, |
diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c index 31d969ac1192..b89775251470 100644 --- a/sound/soc/codecs/rt5677.c +++ b/sound/soc/codecs/rt5677.c | |||
@@ -54,7 +54,7 @@ static const struct regmap_range_cfg rt5677_ranges[] = { | |||
54 | }, | 54 | }, |
55 | }; | 55 | }; |
56 | 56 | ||
57 | static const struct reg_default init_list[] = { | 57 | static const struct reg_sequence init_list[] = { |
58 | {RT5677_ASRC_12, 0x0018}, | 58 | {RT5677_ASRC_12, 0x0018}, |
59 | {RT5677_PR_BASE + 0x3d, 0x364d}, | 59 | {RT5677_PR_BASE + 0x3d, 0x364d}, |
60 | {RT5677_PR_BASE + 0x17, 0x4fc0}, | 60 | {RT5677_PR_BASE + 0x17, 0x4fc0}, |
diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c index a7cf19b53fb2..83ae1eb44d4f 100644 --- a/sound/soc/codecs/tlv320aic3x.c +++ b/sound/soc/codecs/tlv320aic3x.c | |||
@@ -1668,7 +1668,7 @@ static const struct i2c_device_id aic3x_i2c_id[] = { | |||
1668 | }; | 1668 | }; |
1669 | MODULE_DEVICE_TABLE(i2c, aic3x_i2c_id); | 1669 | MODULE_DEVICE_TABLE(i2c, aic3x_i2c_id); |
1670 | 1670 | ||
1671 | static const struct reg_default aic3007_class_d[] = { | 1671 | static const struct reg_sequence aic3007_class_d[] = { |
1672 | /* Class-D speaker driver init; datasheet p. 46 */ | 1672 | /* Class-D speaker driver init; datasheet p. 46 */ |
1673 | { AIC3X_PAGE_SELECT, 0x0D }, | 1673 | { AIC3X_PAGE_SELECT, 0x0D }, |
1674 | { 0xD, 0x0D }, | 1674 | { 0xD, 0x0D }, |
diff --git a/sound/soc/codecs/wm2200.c b/sound/soc/codecs/wm2200.c index 01aeb75dd774..b80097449180 100644 --- a/sound/soc/codecs/wm2200.c +++ b/sound/soc/codecs/wm2200.c | |||
@@ -897,7 +897,7 @@ static bool wm2200_readable_register(struct device *dev, unsigned int reg) | |||
897 | } | 897 | } |
898 | } | 898 | } |
899 | 899 | ||
900 | static const struct reg_default wm2200_reva_patch[] = { | 900 | static const struct reg_sequence wm2200_reva_patch[] = { |
901 | { 0x07, 0x0003 }, | 901 | { 0x07, 0x0003 }, |
902 | { 0x102, 0x0200 }, | 902 | { 0x102, 0x0200 }, |
903 | { 0x203, 0x0084 }, | 903 | { 0x203, 0x0084 }, |
diff --git a/sound/soc/codecs/wm5100.c b/sound/soc/codecs/wm5100.c index 4c10cd88c1af..26d79bbb7599 100644 --- a/sound/soc/codecs/wm5100.c +++ b/sound/soc/codecs/wm5100.c | |||
@@ -1247,7 +1247,7 @@ static const struct snd_soc_dapm_route wm5100_dapm_routes[] = { | |||
1247 | { "PWM2", NULL, "PWM2 Driver" }, | 1247 | { "PWM2", NULL, "PWM2 Driver" }, |
1248 | }; | 1248 | }; |
1249 | 1249 | ||
1250 | static const struct reg_default wm5100_reva_patches[] = { | 1250 | static const struct reg_sequence wm5100_reva_patches[] = { |
1251 | { WM5100_AUDIO_IF_1_10, 0 }, | 1251 | { WM5100_AUDIO_IF_1_10, 0 }, |
1252 | { WM5100_AUDIO_IF_1_11, 1 }, | 1252 | { WM5100_AUDIO_IF_1_11, 1 }, |
1253 | { WM5100_AUDIO_IF_1_12, 2 }, | 1253 | { WM5100_AUDIO_IF_1_12, 2 }, |
diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c index 8edc6d203404..dc770d488ec6 100644 --- a/sound/soc/codecs/wm8962.c +++ b/sound/soc/codecs/wm8962.c | |||
@@ -3495,7 +3495,7 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8962 = { | |||
3495 | }; | 3495 | }; |
3496 | 3496 | ||
3497 | /* Improve power consumption for IN4 DC measurement mode */ | 3497 | /* Improve power consumption for IN4 DC measurement mode */ |
3498 | static const struct reg_default wm8962_dc_measure[] = { | 3498 | static const struct reg_sequence wm8962_dc_measure[] = { |
3499 | { 0xfd, 0x1 }, | 3499 | { 0xfd, 0x1 }, |
3500 | { 0xcc, 0x40 }, | 3500 | { 0xcc, 0x40 }, |
3501 | { 0xfd, 0 }, | 3501 | { 0xfd, 0 }, |
diff --git a/sound/soc/codecs/wm8993.c b/sound/soc/codecs/wm8993.c index f2d5211a9a96..06ff4943e7cc 100644 --- a/sound/soc/codecs/wm8993.c +++ b/sound/soc/codecs/wm8993.c | |||
@@ -1595,7 +1595,7 @@ static int wm8993_resume(struct snd_soc_codec *codec) | |||
1595 | #endif | 1595 | #endif |
1596 | 1596 | ||
1597 | /* Tune DC servo configuration */ | 1597 | /* Tune DC servo configuration */ |
1598 | static const struct reg_default wm8993_regmap_patch[] = { | 1598 | static const struct reg_sequence wm8993_regmap_patch[] = { |
1599 | { 0x44, 3 }, | 1599 | { 0x44, 3 }, |
1600 | { 0x56, 3 }, | 1600 | { 0x56, 3 }, |
1601 | { 0x44, 0 }, | 1601 | { 0x44, 0 }, |