diff options
| -rw-r--r-- | sound/soc/sh/rcar/gen.c | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/sound/soc/sh/rcar/gen.c b/sound/soc/sh/rcar/gen.c index babb203b43b7..331fc558d796 100644 --- a/sound/soc/sh/rcar/gen.c +++ b/sound/soc/sh/rcar/gen.c | |||
| @@ -11,6 +11,11 @@ | |||
| 11 | #include "rsnd.h" | 11 | #include "rsnd.h" |
| 12 | 12 | ||
| 13 | struct rsnd_gen_ops { | 13 | struct rsnd_gen_ops { |
| 14 | int (*probe)(struct platform_device *pdev, | ||
| 15 | struct rcar_snd_info *info, | ||
| 16 | struct rsnd_priv *priv); | ||
| 17 | void (*remove)(struct platform_device *pdev, | ||
| 18 | struct rsnd_priv *priv); | ||
| 14 | int (*path_init)(struct rsnd_priv *priv, | 19 | int (*path_init)(struct rsnd_priv *priv, |
| 15 | struct rsnd_dai *rdai, | 20 | struct rsnd_dai *rdai, |
| 16 | struct rsnd_dai_stream *io); | 21 | struct rsnd_dai_stream *io); |
| @@ -98,11 +103,6 @@ static int rsnd_gen1_path_exit(struct rsnd_priv *priv, | |||
| 98 | return ret; | 103 | return ret; |
| 99 | } | 104 | } |
| 100 | 105 | ||
| 101 | static struct rsnd_gen_ops rsnd_gen1_ops = { | ||
| 102 | .path_init = rsnd_gen1_path_init, | ||
| 103 | .path_exit = rsnd_gen1_path_exit, | ||
| 104 | }; | ||
| 105 | |||
| 106 | #define RSND_GEN1_REG_MAP(g, s, i, oi, oa) \ | 106 | #define RSND_GEN1_REG_MAP(g, s, i, oi, oa) \ |
| 107 | do { \ | 107 | do { \ |
| 108 | (g)->reg_map[RSND_REG_##i].index = RSND_GEN1_##s; \ | 108 | (g)->reg_map[RSND_REG_##i].index = RSND_GEN1_##s; \ |
| @@ -163,7 +163,6 @@ static int rsnd_gen1_probe(struct platform_device *pdev, | |||
| 163 | IS_ERR(gen->base[RSND_GEN1_SSI])) | 163 | IS_ERR(gen->base[RSND_GEN1_SSI])) |
| 164 | return -ENODEV; | 164 | return -ENODEV; |
| 165 | 165 | ||
| 166 | gen->ops = &rsnd_gen1_ops; | ||
| 167 | rsnd_gen1_reg_map_init(gen); | 166 | rsnd_gen1_reg_map_init(gen); |
| 168 | 167 | ||
| 169 | dev_dbg(dev, "Gen1 device probed\n"); | 168 | dev_dbg(dev, "Gen1 device probed\n"); |
| @@ -183,6 +182,13 @@ static void rsnd_gen1_remove(struct platform_device *pdev, | |||
| 183 | { | 182 | { |
| 184 | } | 183 | } |
| 185 | 184 | ||
| 185 | static struct rsnd_gen_ops rsnd_gen1_ops = { | ||
| 186 | .probe = rsnd_gen1_probe, | ||
| 187 | .remove = rsnd_gen1_remove, | ||
| 188 | .path_init = rsnd_gen1_path_init, | ||
| 189 | .path_exit = rsnd_gen1_path_exit, | ||
| 190 | }; | ||
| 191 | |||
| 186 | /* | 192 | /* |
| 187 | * Gen | 193 | * Gen |
| 188 | */ | 194 | */ |
| @@ -251,6 +257,14 @@ int rsnd_gen_probe(struct platform_device *pdev, | |||
| 251 | return -ENOMEM; | 257 | return -ENOMEM; |
| 252 | } | 258 | } |
| 253 | 259 | ||
| 260 | if (rsnd_is_gen1(priv)) | ||
| 261 | gen->ops = &rsnd_gen1_ops; | ||
| 262 | |||
| 263 | if (!gen->ops) { | ||
| 264 | dev_err(dev, "unknown generation R-Car sound device\n"); | ||
| 265 | return -ENODEV; | ||
| 266 | } | ||
| 267 | |||
| 254 | priv->gen = gen; | 268 | priv->gen = gen; |
| 255 | 269 | ||
| 256 | /* | 270 | /* |
| @@ -261,20 +275,13 @@ int rsnd_gen_probe(struct platform_device *pdev, | |||
| 261 | for (i = 0; i < RSND_REG_MAX; i++) | 275 | for (i = 0; i < RSND_REG_MAX; i++) |
| 262 | gen->reg_map[i].index = -1; | 276 | gen->reg_map[i].index = -1; |
| 263 | 277 | ||
| 264 | /* | 278 | return gen->ops->probe(pdev, info, priv); |
| 265 | * init each module | ||
| 266 | */ | ||
| 267 | if (rsnd_is_gen1(priv)) | ||
| 268 | return rsnd_gen1_probe(pdev, info, priv); | ||
| 269 | |||
| 270 | dev_err(dev, "unknown generation R-Car sound device\n"); | ||
| 271 | |||
| 272 | return -ENODEV; | ||
| 273 | } | 279 | } |
| 274 | 280 | ||
| 275 | void rsnd_gen_remove(struct platform_device *pdev, | 281 | void rsnd_gen_remove(struct platform_device *pdev, |
| 276 | struct rsnd_priv *priv) | 282 | struct rsnd_priv *priv) |
| 277 | { | 283 | { |
| 278 | if (rsnd_is_gen1(priv)) | 284 | struct rsnd_gen *gen = rsnd_priv_to_gen(priv); |
| 279 | rsnd_gen1_remove(pdev, priv); | 285 | |
| 286 | gen->ops->remove(pdev, priv); | ||
| 280 | } | 287 | } |
