The patch
ASoC: uda134x: Use regmap_update_bits() were appropriate
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks, Mark
From ef3355d22046f4b2c00b0fdf964d6c92fd3f050d Mon Sep 17 00:00:00 2001
From: Lars-Peter Clausen lars@metafoo.de Date: Mon, 13 Jul 2015 12:26:48 +0200 Subject: [PATCH] ASoC: uda134x: Use regmap_update_bits() were appropriate
Instead of doing the read-modify-update cycle by hand when updating a register use regmap_update_bits().
This also means we can now remove uda134x_read_reg_cache() and uda134x_write() since they are unused.
Signed-off-by: Lars-Peter Clausen lars@metafoo.de Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/codecs/uda134x.c | 57 ++++++++++++---------------------------------- 1 file changed, 14 insertions(+), 43 deletions(-)
diff --git a/sound/soc/codecs/uda134x.c b/sound/soc/codecs/uda134x.c index d25a9f3968d0..e19026380534 100644 --- a/sound/soc/codecs/uda134x.c +++ b/sound/soc/codecs/uda134x.c @@ -61,31 +61,6 @@ static const struct reg_default uda134x_reg_defaults[] = { };
/* - * The codec has no support for reading its registers except for peak level... - */ -static inline unsigned int uda134x_read_reg_cache(struct snd_soc_codec *codec, - unsigned int reg) -{ - struct uda134x_priv *uda134x = snd_soc_codec_get_drvdata(codec); - unsigned int val; - int ret; - - ret = regmap_read(uda134x->regmap, reg, &val); - if (ret) - return -1; - - return val; -} - -static void uda134x_write(struct snd_soc_codec *codec, unsigned int reg, - unsigned int val) -{ - struct uda134x_priv *uda134x = snd_soc_codec_get_drvdata(codec); - - regmap_write(uda134x->regmap, reg, val); -} - -/* * Write to the uda134x registers * */ @@ -137,27 +112,28 @@ static int uda134x_regmap_write(void *context, unsigned int reg,
static inline void uda134x_reset(struct snd_soc_codec *codec) { - u8 reset_reg = uda134x_read_reg_cache(codec, UDA134X_STATUS0); - uda134x_write(codec, UDA134X_STATUS0, reset_reg | (1<<6)); + struct uda134x_priv *uda134x = snd_soc_codec_get_drvdata(codec); + unsigned int mask = 1<<6; + + regmap_update_bits(uda134x->regmap, UDA134X_STATUS0, mask, mask); msleep(1); - uda134x_write(codec, UDA134X_STATUS0, reset_reg & ~(1<<6)); + regmap_update_bits(uda134x->regmap, UDA134X_STATUS0, mask, 0); }
static int uda134x_mute(struct snd_soc_dai *dai, int mute) { - struct snd_soc_codec *codec = dai->codec; - u8 mute_reg = uda134x_read_reg_cache(codec, UDA134X_DATA010); + struct uda134x_priv *uda134x = snd_soc_codec_get_drvdata(dai->codec); + unsigned int mask = 1<<2; + unsigned int val;
pr_debug("%s mute: %d\n", __func__, mute);
if (mute) - mute_reg |= (1<<2); + val = mask; else - mute_reg &= ~(1<<2); - - uda134x_write(codec, UDA134X_DATA010, mute_reg); + val = 0;
- return 0; + return regmap_update_bits(uda134x->regmap, UDA134X_DATA010, mask, val); }
static int uda134x_startup(struct snd_pcm_substream *substream, @@ -209,7 +185,7 @@ static int uda134x_hw_params(struct snd_pcm_substream *substream, { struct snd_soc_codec *codec = dai->codec; struct uda134x_priv *uda134x = snd_soc_codec_get_drvdata(codec); - u8 hw_params; + unsigned int hw_params = 0;
if (substream == uda134x->slave_substream) { pr_debug("%s ignoring hw_params for slave substream\n", @@ -217,10 +193,6 @@ static int uda134x_hw_params(struct snd_pcm_substream *substream, return 0; }
- hw_params = uda134x_read_reg_cache(codec, UDA134X_STATUS0); - hw_params &= STATUS0_SYSCLK_MASK; - hw_params &= STATUS0_DAIFMT_MASK; - pr_debug("%s sysclk: %d, rate:%d\n", __func__, uda134x->sysclk, params_rate(params));
@@ -271,9 +243,8 @@ static int uda134x_hw_params(struct snd_pcm_substream *substream, return -EINVAL; }
- uda134x_write(codec, UDA134X_STATUS0, hw_params); - - return 0; + return regmap_update_bits(uda134x->regmap, UDA134X_STATUS0, + STATUS0_SYSCLK_MASK | STATUS0_DAIFMT_MASK, hw_params); }
static int uda134x_set_dai_sysclk(struct snd_soc_dai *codec_dai,