Skip to content

Commit

Permalink
ASoC: rsnd: module name is unified
Browse files Browse the repository at this point in the history
Renesas sound driver uses many modules (= SSI/SRC/DVC),
and each module had own name.
But, each module name can be used as several purpose,
like clock name, DMA name etc...
This patch uses common name for each module.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
  • Loading branch information
Kuninori Morimoto authored and Mark Brown committed May 26, 2014
1 parent 033e7ed commit 8aefda5
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 9 deletions.
20 changes: 18 additions & 2 deletions sound/soc/sh/rcar/dvc.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
#define RSND_DVC_NAME_SIZE 16
#define RSND_DVC_VOLUME_MAX 100
#define RSND_DVC_VOLUME_NUM 2

#define DVC_NAME "dvc"

struct rsnd_dvc {
struct rsnd_dvc_platform_info *info; /* rcar_snd.h */
struct rsnd_mod mod;
Expand Down Expand Up @@ -43,6 +46,17 @@ static void rsnd_dvc_volume_update(struct rsnd_mod *mod)
rsnd_mod_write(mod, DVC_VOL1R, vol[1]);
}

static int rsnd_dvc_probe_gen2(struct rsnd_mod *mod,
struct rsnd_dai *rdai)
{
struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
struct device *dev = rsnd_priv_to_dev(priv);

dev_dbg(dev, "%s (Gen2) is probed\n", rsnd_mod_name(mod));

return 0;
}

static int rsnd_dvc_init(struct rsnd_mod *dvc_mod,
struct rsnd_dai *rdai)
{
Expand Down Expand Up @@ -208,7 +222,8 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod,
}

static struct rsnd_mod_ops rsnd_dvc_ops = {
.name = "dvc (gen2)",
.name = DVC_NAME,
.probe = rsnd_dvc_probe_gen2,
.init = rsnd_dvc_init,
.quit = rsnd_dvc_quit,
.start = rsnd_dvc_start,
Expand Down Expand Up @@ -255,7 +270,8 @@ int rsnd_dvc_probe(struct platform_device *pdev,
priv->dvc = dvc;

for_each_rsnd_dvc(dvc, priv, i) {
snprintf(name, RSND_DVC_NAME_SIZE, "dvc.%d", i);
snprintf(name, RSND_DVC_NAME_SIZE, "%s.%d",
DVC_NAME, i);

clk = devm_clk_get(dev, name);
if (IS_ERR(clk))
Expand Down
23 changes: 20 additions & 3 deletions sound/soc/sh/rcar/src.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
*/
#include "rsnd.h"

#define SRC_NAME "src"

struct rsnd_src {
struct rsnd_src_platform_info *info; /* rcar_snd.h */
struct rsnd_mod mod;
Expand Down Expand Up @@ -389,6 +391,17 @@ static int rsnd_src_set_convert_rate_gen1(struct rsnd_mod *mod,
return 0;
}

static int rsnd_src_probe_gen1(struct rsnd_mod *mod,
struct rsnd_dai *rdai)
{
struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
struct device *dev = rsnd_priv_to_dev(priv);

dev_dbg(dev, "%s (Gen1) is probed\n", rsnd_mod_name(mod));

return 0;
}

static int rsnd_src_init_gen1(struct rsnd_mod *mod,
struct rsnd_dai *rdai)
{
Expand Down Expand Up @@ -434,7 +447,8 @@ static int rsnd_src_stop_gen1(struct rsnd_mod *mod,
}

static struct rsnd_mod_ops rsnd_src_gen1_ops = {
.name = "sru (gen1)",
.name = SRC_NAME,
.probe = rsnd_src_probe_gen1,
.init = rsnd_src_init_gen1,
.quit = rsnd_src_quit,
.start = rsnd_src_start_gen1,
Expand Down Expand Up @@ -498,6 +512,8 @@ static int rsnd_src_probe_gen2(struct rsnd_mod *mod,
if (ret < 0)
dev_err(dev, "SRC DMA failed\n");

dev_dbg(dev, "%s (Gen2) is probed\n", rsnd_mod_name(mod));

return ret;
}

Expand Down Expand Up @@ -558,7 +574,7 @@ static int rsnd_src_stop_gen2(struct rsnd_mod *mod,
}

static struct rsnd_mod_ops rsnd_src_gen2_ops = {
.name = "src (gen2)",
.name = SRC_NAME,
.probe = rsnd_src_probe_gen2,
.remove = rsnd_src_remove_gen2,
.init = rsnd_src_init_gen2,
Expand Down Expand Up @@ -652,7 +668,8 @@ int rsnd_src_probe(struct platform_device *pdev,
priv->src = src;

for_each_rsnd_src(src, priv, i) {
snprintf(name, RSND_SRC_NAME_SIZE, "src.%d", i);
snprintf(name, RSND_SRC_NAME_SIZE, "%s.%d",
SRC_NAME, i);

clk = devm_clk_get(dev, name);
if (IS_ERR(clk))
Expand Down
15 changes: 11 additions & 4 deletions sound/soc/sh/rcar/ssi.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@
*/
#define CONT (1 << 8) /* WS Continue Function */

#define SSI_NAME "ssi"

struct rsnd_ssi {
struct clk *clk;
struct rsnd_ssi_platform_info *info; /* rcar_snd.h */
Expand Down Expand Up @@ -373,6 +375,8 @@ static int rsnd_ssi_pio_probe(struct rsnd_mod *mod,
if (ret)
dev_err(dev, "SSI request interrupt failed\n");

dev_dbg(dev, "%s (PIO) is probed\n", rsnd_mod_name(mod));

return ret;
}

Expand Down Expand Up @@ -405,7 +409,7 @@ static int rsnd_ssi_pio_stop(struct rsnd_mod *mod,
}

static struct rsnd_mod_ops rsnd_ssi_pio_ops = {
.name = "ssi (pio)",
.name = SSI_NAME,
.probe = rsnd_ssi_pio_probe,
.init = rsnd_ssi_init,
.quit = rsnd_ssi_quit,
Expand All @@ -430,6 +434,8 @@ static int rsnd_ssi_dma_probe(struct rsnd_mod *mod,
if (ret < 0)
dev_err(dev, "SSI DMA failed\n");

dev_dbg(dev, "%s (DMA) is probed\n", rsnd_mod_name(mod));

return ret;
}

Expand Down Expand Up @@ -480,7 +486,7 @@ static int rsnd_ssi_dma_stop(struct rsnd_mod *mod,
}

static struct rsnd_mod_ops rsnd_ssi_dma_ops = {
.name = "ssi (dma)",
.name = SSI_NAME,
.probe = rsnd_ssi_dma_probe,
.remove = rsnd_ssi_dma_remove,
.init = rsnd_ssi_init,
Expand All @@ -493,7 +499,7 @@ static struct rsnd_mod_ops rsnd_ssi_dma_ops = {
* Non SSI
*/
static struct rsnd_mod_ops rsnd_ssi_non_ops = {
.name = "ssi (non)",
.name = SSI_NAME,
};

/*
Expand Down Expand Up @@ -620,7 +626,8 @@ int rsnd_ssi_probe(struct platform_device *pdev,
for_each_rsnd_ssi(ssi, priv, i) {
pinfo = &info->ssi_info[i];

snprintf(name, RSND_SSI_NAME_SIZE, "ssi.%d", i);
snprintf(name, RSND_SSI_NAME_SIZE, "%s.%d",
SSI_NAME, i);

clk = devm_clk_get(dev, name);
if (IS_ERR(clk))
Expand Down

0 comments on commit 8aefda5

Please sign in to comment.