ASoC: rsnd: remove RSND_REG_ from rsnd_reg
Subsystems (3)
PATCH 1/1 ASoC: rsnd: remove RSND_REG_ from rsnd_reg
From: Kuninori Morimoto <[email protected]>
Current rsnd is using RSND_REG_xxx for register naming, and using RSND_REG_##f style macro for read/write. The biggest reason why it uses this style is that
we can avoid non-existing register access.
But, its demerit is sequential register access code will be very ugly.
Current rsnd driver is well tested, so, let's remove RSND_REG_ from rsnd_reg, and cleanup sequential register access code.
--- sound/soc/sh/rcar/adg.c | 36 +----- sound/soc/sh/rcar/ctu.c | 69 +++------- sound/soc/sh/rcar/dvc.c | 10 +- sound/soc/sh/rcar/gen.c | 23 ++-- sound/soc/sh/rcar/rsnd.h | 329 +++++++++++++++++++++++------------------------ sound/soc/sh/rcar/ssiu.c | 59 ++------- 6 files changed, 212 insertions(+), 314 deletions(-)
sound/soc/sh/rcar/adg.c +3 -33
@@ -249,28 +249,8 @@ int rsnd_adg_set_src_timesel_gen2(struct rsnd_mod *src_mod, out = out << shift; mask =0x0f1f << shift; -switch (id /2 ) { -case 0 : -rsnd_mod_bset (adg_mod,SRCIN_TIMSEL0 , mask, in); -rsnd_mod_bset (adg_mod,SRCOUT_TIMSEL0 , mask, out); -break ; -case 1 : -rsnd_mod_bset (adg_mod,SRCIN_TIMSEL1 , mask, in); -rsnd_mod_bset (adg_mod,SRCOUT_TIMSEL1 , mask, out); -break ; -case 2 : -rsnd_mod_bset (adg_mod,SRCIN_TIMSEL2 , mask, in); -rsnd_mod_bset (adg_mod,SRCOUT_TIMSEL2 , mask, out); -break ; -case 3 : -rsnd_mod_bset (adg_mod,SRCIN_TIMSEL3 , mask, in); -rsnd_mod_bset (adg_mod,SRCOUT_TIMSEL3 , mask, out); -break ; -case 4 : -rsnd_mod_bset (adg_mod,SRCIN_TIMSEL4 , mask, in); -rsnd_mod_bset (adg_mod,SRCOUT_TIMSEL4 , mask, out); -break ; - } +rsnd_mod_bset (adg_mod,SRCIN_TIMSEL (id /2 ), mask, in); +rsnd_mod_bset (adg_mod,SRCOUT_TIMSEL (id /2 ), mask, out);if (en)rsnd_mod_bset (adg_mod,DIV_EN , en, en);
@@ -299,17 +279,7 @@ static void rsnd_adg_set_ssi_clk(struct rsnd_mod *ssi_mod, u32 val)if (id ==8 )return ; -switch (id /4 ) { -case 0 : -rsnd_mod_bset (adg_mod,AUDIO_CLK_SEL0 , mask, val); -break ; -case 1 : -rsnd_mod_bset (adg_mod,AUDIO_CLK_SEL1 , mask, val); -break ; -case 2 : -rsnd_mod_bset (adg_mod,AUDIO_CLK_SEL2 , mask, val); -break ; - } +rsnd_mod_bset (adg_mod,AUDIO_CLK_SEL (id /4 ), mask, val);dev_dbg (dev,"AUDIO_CLK_SEL is 0x%x\n" , val); }
sound/soc/sh/rcar/ctu.c +17 -52
117 lines not on this page · raw message
sound/soc/sh/rcar/dvc.c +2 -8
@@ -86,14 +86,8 @@ static void rsnd_dvc_volume_parameter(struct rsnd_dai_stream *io, val[i] =rsnd_kctrl_valm (dvc->volume, i);/* Enable Digital Volume */ -rsnd_mod_write (mod,DVC_VOL0R , val[0 ]); -rsnd_mod_write (mod,DVC_VOL1R , val[1 ]); -rsnd_mod_write (mod,DVC_VOL2R , val[2 ]); -rsnd_mod_write (mod,DVC_VOL3R , val[3 ]); -rsnd_mod_write (mod,DVC_VOL4R , val[4 ]); -rsnd_mod_write (mod,DVC_VOL5R , val[5 ]); -rsnd_mod_write (mod,DVC_VOL6R , val[6 ]); -rsnd_mod_write (mod,DVC_VOL7R , val[7 ]); +for (i =0 ; i <RSND_MAX_CHANNELS ; i++) +rsnd_mod_write (mod,DVC_VOLxR (i), val[i]); } static void rsnd_dvc_volume_init(struct rsnd_dai_stream *io,
sound/soc/sh/rcar/gen.c +12 -11
@@ -26,8 +26,8 @@ struct rsnd_gen {struct regmap *regmap[RSND_BASE_MAX ];/* RSND_REG_MAX base */ -struct regmap_field *regs[RSND_REG_MAX ]; -const char *reg_name[RSND_REG_MAX ]; +struct regmap_field *regs[REG_MAX ]; +const char *reg_name[REG_MAX ]; };#define rsnd_priv_to_gen (p) ((struct rsnd_gen *)(p)->gen)
@@ -49,11 +49,11 @@ struct rsnd_regmap_field_conf { }/* single address mapping */ #define RSND_GEN_S_REG (id, offset) \ - RSND_REG_SET(RSND_REG_##id, offset, 0, #id) + RSND_REG_SET(id, offset, 0, #id)/* multi address mapping */ #define RSND_GEN_M_REG (id, offset, _id_offset) \ - RSND_REG_SET(RSND_REG_##id, offset, _id_offset, #id) + RSND_REG_SET(id, offset, _id_offset, #id)/* * basic function
@@ -79,9 +79,9 @@ static int rsnd_mod_id_cmd(struct rsnd_mod *mod)return rsnd_mod_id (mod); } -u32 rsnd_read (struct rsnd_priv *priv, -struct rsnd_mod *mod,enum rsnd_reg reg) +u32 rsnd_mod_read (struct rsnd_mod *mod,enum rsnd_reg reg) { +struct rsnd_priv *priv =rsnd_mod_to_priv (mod);struct device *dev =rsnd_priv_to_dev (priv);struct rsnd_gen *gen =rsnd_priv_to_gen (priv);u32 val;
@@ -98,10 +98,10 @@ u32 rsnd_read(struct rsnd_priv *priv,return val; } -void rsnd_write (struct rsnd_priv *priv, -struct rsnd_mod *mod, -enum rsnd_reg reg,u32 data) +void rsnd_mod_write (struct rsnd_mod *mod, +enum rsnd_reg reg,u32 data) { +struct rsnd_priv *priv =rsnd_mod_to_priv (mod);struct device *dev =rsnd_priv_to_dev (priv);struct rsnd_gen *gen =rsnd_priv_to_gen (priv);
@@ -115,9 +115,10 @@ void rsnd_write(struct rsnd_priv *priv, rsnd_reg_name(gen, reg), reg, data); } -void rsnd_bset (struct rsnd_priv *priv,struct rsnd_mod *mod, -enum rsnd_reg reg,u32 mask,u32 data) +void rsnd_mod_bset (struct rsnd_mod *mod, +enum rsnd_reg reg,u32 mask,u32 data) { +struct rsnd_priv *priv =rsnd_mod_to_priv (mod);struct device *dev =rsnd_priv_to_dev (priv);struct rsnd_gen *gen =rsnd_priv_to_gen (priv);
sound/soc/sh/rcar/rsnd.h +164 -165
349 lines not on this page · raw message
sound/soc/sh/rcar/ssiu.c +14 -45
79 lines not on this page · raw message
Signature · 1 line
2.7.4
Mark Brown
maintainerApplied "ASoC: rsnd: remove RSND_REG_ from rsnd_reg" to the asoc tree
The patch
ASoC: rsnd: remove RSND_REG_ from rsnd_reg
has been applied to the asoc tree at
https://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
Quoted 1 line
From
b7169ddea2f2a90538f606688adf4948f2da82ceMon Sep 17 00:00:00 2001
From: Kuninori Morimoto <[email protected]>
Date: Wed, 12 Dec 2018 16:03:58 +0900
Subject: [PATCH] ASoC: rsnd: remove RSND_REG_ from rsnd_reg
Current rsnd is using RSND_REG_xxx for register naming, and using RSND_REG_##f style macro for read/write. The biggest reason why it uses this style is that
we can avoid non-existing register access.
But, its demerit is sequential register access code will be very ugly.
Current rsnd driver is well tested, so, let's remove RSND_REG_ from rsnd_reg, and cleanup sequential register access code.
--- sound/soc/sh/rcar/adg.c | 36 +---- sound/soc/sh/rcar/ctu.c | 69 ++------ sound/soc/sh/rcar/dvc.c | 10 +- sound/soc/sh/rcar/gen.c | 23 +-- sound/soc/sh/rcar/rsnd.h | 329 +++++++++++++++++++-------------------- sound/soc/sh/rcar/ssiu.c | 59 ++----- 6 files changed, 212 insertions(+), 314 deletions(-)
sound/soc/sh/rcar/adg.c +3 -33
@@ -249,28 +249,8 @@ int rsnd_adg_set_src_timesel_gen2(struct rsnd_mod *src_mod, out = out << shift; mask =0x0f1f << shift; -switch (id /2 ) { -case 0 : -rsnd_mod_bset (adg_mod,SRCIN_TIMSEL0 , mask, in); -rsnd_mod_bset (adg_mod,SRCOUT_TIMSEL0 , mask, out); -break ; -case 1 : -rsnd_mod_bset (adg_mod,SRCIN_TIMSEL1 , mask, in); -rsnd_mod_bset (adg_mod,SRCOUT_TIMSEL1 , mask, out); -break ; -case 2 : -rsnd_mod_bset (adg_mod,SRCIN_TIMSEL2 , mask, in); -rsnd_mod_bset (adg_mod,SRCOUT_TIMSEL2 , mask, out); -break ; -case 3 : -rsnd_mod_bset (adg_mod,SRCIN_TIMSEL3 , mask, in); -rsnd_mod_bset (adg_mod,SRCOUT_TIMSEL3 , mask, out); -break ; -case 4 : -rsnd_mod_bset (adg_mod,SRCIN_TIMSEL4 , mask, in); -rsnd_mod_bset (adg_mod,SRCOUT_TIMSEL4 , mask, out); -break ; - } +rsnd_mod_bset (adg_mod,SRCIN_TIMSEL (id /2 ), mask, in); +rsnd_mod_bset (adg_mod,SRCOUT_TIMSEL (id /2 ), mask, out);if (en)rsnd_mod_bset (adg_mod,DIV_EN , en, en);
@@ -299,17 +279,7 @@ static void rsnd_adg_set_ssi_clk(struct rsnd_mod *ssi_mod, u32 val)if (id ==8 )return ; -switch (id /4 ) { -case 0 : -rsnd_mod_bset (adg_mod,AUDIO_CLK_SEL0 , mask, val); -break ; -case 1 : -rsnd_mod_bset (adg_mod,AUDIO_CLK_SEL1 , mask, val); -break ; -case 2 : -rsnd_mod_bset (adg_mod,AUDIO_CLK_SEL2 , mask, val); -break ; - } +rsnd_mod_bset (adg_mod,AUDIO_CLK_SEL (id /4 ), mask, val);dev_dbg (dev,"AUDIO_CLK_SEL is 0x%x\n" , val); }
sound/soc/sh/rcar/ctu.c +17 -52
117 lines not on this page · raw message
sound/soc/sh/rcar/dvc.c +2 -8
@@ -89,14 +89,8 @@ static void rsnd_dvc_volume_parameter(struct rsnd_dai_stream *io, val[i] =rsnd_kctrl_valm (dvc->volume, i);/* Enable Digital Volume */ -rsnd_mod_write (mod,DVC_VOL0R , val[0 ]); -rsnd_mod_write (mod,DVC_VOL1R , val[1 ]); -rsnd_mod_write (mod,DVC_VOL2R , val[2 ]); -rsnd_mod_write (mod,DVC_VOL3R , val[3 ]); -rsnd_mod_write (mod,DVC_VOL4R , val[4 ]); -rsnd_mod_write (mod,DVC_VOL5R , val[5 ]); -rsnd_mod_write (mod,DVC_VOL6R , val[6 ]); -rsnd_mod_write (mod,DVC_VOL7R , val[7 ]); +for (i =0 ; i <RSND_MAX_CHANNELS ; i++) +rsnd_mod_write (mod,DVC_VOLxR (i), val[i]); } static void rsnd_dvc_volume_init(struct rsnd_dai_stream *io,
sound/soc/sh/rcar/gen.c +12 -11
@@ -26,8 +26,8 @@ struct rsnd_gen {struct regmap *regmap[RSND_BASE_MAX ];/* RSND_REG_MAX base */ -struct regmap_field *regs[RSND_REG_MAX ]; -const char *reg_name[RSND_REG_MAX ]; +struct regmap_field *regs[REG_MAX ]; +const char *reg_name[REG_MAX ]; };#define rsnd_priv_to_gen (p) ((struct rsnd_gen *)(p)->gen)
@@ -49,11 +49,11 @@ struct rsnd_regmap_field_conf { }/* single address mapping */ #define RSND_GEN_S_REG (id, offset) \ - RSND_REG_SET(RSND_REG_##id, offset, 0, #id) + RSND_REG_SET(id, offset, 0, #id)/* multi address mapping */ #define RSND_GEN_M_REG (id, offset, _id_offset) \ - RSND_REG_SET(RSND_REG_##id, offset, _id_offset, #id) + RSND_REG_SET(id, offset, _id_offset, #id)/* * basic function
@@ -79,9 +79,9 @@ static int rsnd_mod_id_cmd(struct rsnd_mod *mod)return rsnd_mod_id (mod); } -u32 rsnd_read (struct rsnd_priv *priv, -struct rsnd_mod *mod,enum rsnd_reg reg) +u32 rsnd_mod_read (struct rsnd_mod *mod,enum rsnd_reg reg) { +struct rsnd_priv *priv =rsnd_mod_to_priv (mod);struct device *dev =rsnd_priv_to_dev (priv);struct rsnd_gen *gen =rsnd_priv_to_gen (priv);u32 val;
@@ -98,10 +98,10 @@ u32 rsnd_read(struct rsnd_priv *priv,return val; } -void rsnd_write (struct rsnd_priv *priv, -struct rsnd_mod *mod, -enum rsnd_reg reg,u32 data) +void rsnd_mod_write (struct rsnd_mod *mod, +enum rsnd_reg reg,u32 data) { +struct rsnd_priv *priv =rsnd_mod_to_priv (mod);struct device *dev =rsnd_priv_to_dev (priv);struct rsnd_gen *gen =rsnd_priv_to_gen (priv);
@@ -115,9 +115,10 @@ void rsnd_write(struct rsnd_priv *priv, rsnd_reg_name(gen, reg), reg, data); } -void rsnd_bset (struct rsnd_priv *priv,struct rsnd_mod *mod, -enum rsnd_reg reg,u32 mask,u32 data) +void rsnd_mod_bset (struct rsnd_mod *mod, +enum rsnd_reg reg,u32 mask,u32 data) { +struct rsnd_priv *priv =rsnd_mod_to_priv (mod);struct device *dev =rsnd_priv_to_dev (priv);struct rsnd_gen *gen =rsnd_priv_to_gen (priv);
sound/soc/sh/rcar/rsnd.h +164 -165
349 lines not on this page · raw message
sound/soc/sh/rcar/ssiu.c +14 -45
79 lines not on this page · raw message
Signature · 1 line
2.19.0.rc2