Commit 7e7fe06d authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: rsnd: move .get_status under rsnd_mod_ops

Each mod needs to have .get_status, but current driver is handling it
under rsnd_mod, instead of rsnd_mod_ops.
It is not any make sence. This patch moves it to rsnd_mod_ops, and
tidyup its parameter order to align to other callback functions.
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 0900d1e6
...@@ -613,7 +613,7 @@ int rsnd_adg_probe(struct rsnd_priv *priv) ...@@ -613,7 +613,7 @@ int rsnd_adg_probe(struct rsnd_priv *priv)
return -ENOMEM; return -ENOMEM;
ret = rsnd_mod_init(priv, &adg->mod, &adg_ops, ret = rsnd_mod_init(priv, &adg->mod, &adg_ops,
NULL, NULL, 0, 0); NULL, 0, 0);
if (ret) if (ret)
return ret; return ret;
......
...@@ -116,10 +116,11 @@ static int rsnd_cmd_stop(struct rsnd_mod *mod, ...@@ -116,10 +116,11 @@ static int rsnd_cmd_stop(struct rsnd_mod *mod,
} }
static struct rsnd_mod_ops rsnd_cmd_ops = { static struct rsnd_mod_ops rsnd_cmd_ops = {
.name = CMD_NAME, .name = CMD_NAME,
.init = rsnd_cmd_init, .init = rsnd_cmd_init,
.start = rsnd_cmd_start, .start = rsnd_cmd_start,
.stop = rsnd_cmd_stop, .stop = rsnd_cmd_stop,
.get_status = rsnd_mod_get_status,
}; };
static struct rsnd_mod *rsnd_cmd_mod_get(struct rsnd_priv *priv, int id) static struct rsnd_mod *rsnd_cmd_mod_get(struct rsnd_priv *priv, int id)
...@@ -162,7 +163,7 @@ int rsnd_cmd_probe(struct rsnd_priv *priv) ...@@ -162,7 +163,7 @@ int rsnd_cmd_probe(struct rsnd_priv *priv)
for_each_rsnd_cmd(cmd, priv, i) { for_each_rsnd_cmd(cmd, priv, i) {
ret = rsnd_mod_init(priv, rsnd_mod_get(cmd), ret = rsnd_mod_init(priv, rsnd_mod_get(cmd),
&rsnd_cmd_ops, NULL, &rsnd_cmd_ops, NULL,
rsnd_mod_get_status, RSND_MOD_CMD, i); RSND_MOD_CMD, i);
if (ret) if (ret)
return ret; return ret;
} }
......
...@@ -137,8 +137,8 @@ struct dma_chan *rsnd_mod_dma_req(struct rsnd_dai_stream *io, ...@@ -137,8 +137,8 @@ struct dma_chan *rsnd_mod_dma_req(struct rsnd_dai_stream *io,
return mod->ops->dma_req(io, mod); return mod->ops->dma_req(io, mod);
} }
u32 *rsnd_mod_get_status(struct rsnd_dai_stream *io, u32 *rsnd_mod_get_status(struct rsnd_mod *mod,
struct rsnd_mod *mod, struct rsnd_dai_stream *io,
enum rsnd_mod_type type) enum rsnd_mod_type type)
{ {
return &mod->status; return &mod->status;
...@@ -148,9 +148,6 @@ int rsnd_mod_init(struct rsnd_priv *priv, ...@@ -148,9 +148,6 @@ int rsnd_mod_init(struct rsnd_priv *priv,
struct rsnd_mod *mod, struct rsnd_mod *mod,
struct rsnd_mod_ops *ops, struct rsnd_mod_ops *ops,
struct clk *clk, struct clk *clk,
u32* (*get_status)(struct rsnd_dai_stream *io,
struct rsnd_mod *mod,
enum rsnd_mod_type type),
enum rsnd_mod_type type, enum rsnd_mod_type type,
int id) int id)
{ {
...@@ -164,7 +161,6 @@ int rsnd_mod_init(struct rsnd_priv *priv, ...@@ -164,7 +161,6 @@ int rsnd_mod_init(struct rsnd_priv *priv,
mod->type = type; mod->type = type;
mod->clk = clk; mod->clk = clk;
mod->priv = priv; mod->priv = priv;
mod->get_status = get_status;
return ret; return ret;
} }
...@@ -472,7 +468,7 @@ static int rsnd_status_update(u32 *status, ...@@ -472,7 +468,7 @@ static int rsnd_status_update(u32 *status,
enum rsnd_mod_type *types = rsnd_mod_sequence[is_play]; \ enum rsnd_mod_type *types = rsnd_mod_sequence[is_play]; \
for_each_rsnd_mod_arrays(i, mod, io, types, RSND_MOD_MAX) { \ for_each_rsnd_mod_arrays(i, mod, io, types, RSND_MOD_MAX) { \
int tmp = 0; \ int tmp = 0; \
u32 *status = mod->get_status(io, mod, types[i]); \ u32 *status = mod->ops->get_status(mod, io, types[i]); \
int func_call = rsnd_status_update(status, \ int func_call = rsnd_status_update(status, \
__rsnd_mod_shift_##fn, \ __rsnd_mod_shift_##fn, \
__rsnd_mod_add_##fn, \ __rsnd_mod_add_##fn, \
......
...@@ -341,6 +341,7 @@ static struct rsnd_mod_ops rsnd_ctu_ops = { ...@@ -341,6 +341,7 @@ static struct rsnd_mod_ops rsnd_ctu_ops = {
.quit = rsnd_ctu_quit, .quit = rsnd_ctu_quit,
.hw_params = rsnd_ctu_hw_params, .hw_params = rsnd_ctu_hw_params,
.pcm_new = rsnd_ctu_pcm_new, .pcm_new = rsnd_ctu_pcm_new,
.get_status = rsnd_mod_get_status,
}; };
struct rsnd_mod *rsnd_ctu_mod_get(struct rsnd_priv *priv, int id) struct rsnd_mod *rsnd_ctu_mod_get(struct rsnd_priv *priv, int id)
...@@ -404,7 +405,7 @@ int rsnd_ctu_probe(struct rsnd_priv *priv) ...@@ -404,7 +405,7 @@ int rsnd_ctu_probe(struct rsnd_priv *priv)
} }
ret = rsnd_mod_init(priv, rsnd_mod_get(ctu), &rsnd_ctu_ops, ret = rsnd_mod_init(priv, rsnd_mod_get(ctu), &rsnd_ctu_ops,
clk, rsnd_mod_get_status, RSND_MOD_CTU, i); clk, RSND_MOD_CTU, i);
if (ret) { if (ret) {
of_node_put(np); of_node_put(np);
goto rsnd_ctu_probe_done; goto rsnd_ctu_probe_done;
......
...@@ -289,12 +289,13 @@ static int rsnd_dmaen_pointer(struct rsnd_mod *mod, ...@@ -289,12 +289,13 @@ static int rsnd_dmaen_pointer(struct rsnd_mod *mod,
} }
static struct rsnd_mod_ops rsnd_dmaen_ops = { static struct rsnd_mod_ops rsnd_dmaen_ops = {
.name = "audmac", .name = "audmac",
.prepare = rsnd_dmaen_prepare, .prepare = rsnd_dmaen_prepare,
.cleanup = rsnd_dmaen_cleanup, .cleanup = rsnd_dmaen_cleanup,
.start = rsnd_dmaen_start, .start = rsnd_dmaen_start,
.stop = rsnd_dmaen_stop, .stop = rsnd_dmaen_stop,
.pointer= rsnd_dmaen_pointer, .pointer = rsnd_dmaen_pointer,
.get_status = rsnd_mod_get_status,
}; };
/* /*
...@@ -477,10 +478,11 @@ static int rsnd_dmapp_attach(struct rsnd_dai_stream *io, ...@@ -477,10 +478,11 @@ static int rsnd_dmapp_attach(struct rsnd_dai_stream *io,
} }
static struct rsnd_mod_ops rsnd_dmapp_ops = { static struct rsnd_mod_ops rsnd_dmapp_ops = {
.name = "audmac-pp", .name = "audmac-pp",
.start = rsnd_dmapp_start, .start = rsnd_dmapp_start,
.stop = rsnd_dmapp_stop, .stop = rsnd_dmapp_stop,
.quit = rsnd_dmapp_stop, .quit = rsnd_dmapp_stop,
.get_status = rsnd_mod_get_status,
}; };
/* /*
...@@ -756,7 +758,7 @@ static int rsnd_dma_alloc(struct rsnd_dai_stream *io, struct rsnd_mod *mod, ...@@ -756,7 +758,7 @@ static int rsnd_dma_alloc(struct rsnd_dai_stream *io, struct rsnd_mod *mod,
*dma_mod = rsnd_mod_get(dma); *dma_mod = rsnd_mod_get(dma);
ret = rsnd_mod_init(priv, *dma_mod, ops, NULL, ret = rsnd_mod_init(priv, *dma_mod, ops, NULL,
rsnd_mod_get_status, type, dma_id); type, dma_id);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -823,5 +825,5 @@ int rsnd_dma_probe(struct rsnd_priv *priv) ...@@ -823,5 +825,5 @@ int rsnd_dma_probe(struct rsnd_priv *priv)
priv->dma = dmac; priv->dma = dmac;
/* dummy mem mod for debug */ /* dummy mem mod for debug */
return rsnd_mod_init(NULL, &mem, &mem_ops, NULL, NULL, 0, 0); return rsnd_mod_init(NULL, &mem, &mem_ops, NULL, 0, 0);
} }
...@@ -306,6 +306,7 @@ static struct rsnd_mod_ops rsnd_dvc_ops = { ...@@ -306,6 +306,7 @@ static struct rsnd_mod_ops rsnd_dvc_ops = {
.init = rsnd_dvc_init, .init = rsnd_dvc_init,
.quit = rsnd_dvc_quit, .quit = rsnd_dvc_quit,
.pcm_new = rsnd_dvc_pcm_new, .pcm_new = rsnd_dvc_pcm_new,
.get_status = rsnd_mod_get_status,
}; };
struct rsnd_mod *rsnd_dvc_mod_get(struct rsnd_priv *priv, int id) struct rsnd_mod *rsnd_dvc_mod_get(struct rsnd_priv *priv, int id)
...@@ -365,7 +366,7 @@ int rsnd_dvc_probe(struct rsnd_priv *priv) ...@@ -365,7 +366,7 @@ int rsnd_dvc_probe(struct rsnd_priv *priv)
} }
ret = rsnd_mod_init(priv, rsnd_mod_get(dvc), &rsnd_dvc_ops, ret = rsnd_mod_init(priv, rsnd_mod_get(dvc), &rsnd_dvc_ops,
clk, rsnd_mod_get_status, RSND_MOD_DVC, i); clk, RSND_MOD_DVC, i);
if (ret) { if (ret) {
of_node_put(np); of_node_put(np);
goto rsnd_dvc_probe_done; goto rsnd_dvc_probe_done;
......
...@@ -256,6 +256,7 @@ static struct rsnd_mod_ops rsnd_mix_ops = { ...@@ -256,6 +256,7 @@ static struct rsnd_mod_ops rsnd_mix_ops = {
.init = rsnd_mix_init, .init = rsnd_mix_init,
.quit = rsnd_mix_quit, .quit = rsnd_mix_quit,
.pcm_new = rsnd_mix_pcm_new, .pcm_new = rsnd_mix_pcm_new,
.get_status = rsnd_mod_get_status,
}; };
struct rsnd_mod *rsnd_mix_mod_get(struct rsnd_priv *priv, int id) struct rsnd_mod *rsnd_mix_mod_get(struct rsnd_priv *priv, int id)
...@@ -315,7 +316,7 @@ int rsnd_mix_probe(struct rsnd_priv *priv) ...@@ -315,7 +316,7 @@ int rsnd_mix_probe(struct rsnd_priv *priv)
} }
ret = rsnd_mod_init(priv, rsnd_mod_get(mix), &rsnd_mix_ops, ret = rsnd_mod_init(priv, rsnd_mod_get(mix), &rsnd_mix_ops,
clk, rsnd_mod_get_status, RSND_MOD_MIX, i); clk, RSND_MOD_MIX, i);
if (ret) { if (ret) {
of_node_put(np); of_node_put(np);
goto rsnd_mix_probe_done; goto rsnd_mix_probe_done;
......
...@@ -301,6 +301,9 @@ struct rsnd_mod_ops { ...@@ -301,6 +301,9 @@ struct rsnd_mod_ops {
int (*cleanup)(struct rsnd_mod *mod, int (*cleanup)(struct rsnd_mod *mod,
struct rsnd_dai_stream *io, struct rsnd_dai_stream *io,
struct rsnd_priv *priv); struct rsnd_priv *priv);
u32 *(*get_status)(struct rsnd_mod *mod,
struct rsnd_dai_stream *io,
enum rsnd_mod_type type);
}; };
struct rsnd_dai_stream; struct rsnd_dai_stream;
...@@ -310,9 +313,6 @@ struct rsnd_mod { ...@@ -310,9 +313,6 @@ struct rsnd_mod {
struct rsnd_mod_ops *ops; struct rsnd_mod_ops *ops;
struct rsnd_priv *priv; struct rsnd_priv *priv;
struct clk *clk; struct clk *clk;
u32 *(*get_status)(struct rsnd_dai_stream *io,
struct rsnd_mod *mod,
enum rsnd_mod_type type);
u32 status; u32 status;
}; };
/* /*
...@@ -385,9 +385,6 @@ int rsnd_mod_init(struct rsnd_priv *priv, ...@@ -385,9 +385,6 @@ int rsnd_mod_init(struct rsnd_priv *priv,
struct rsnd_mod *mod, struct rsnd_mod *mod,
struct rsnd_mod_ops *ops, struct rsnd_mod_ops *ops,
struct clk *clk, struct clk *clk,
u32* (*get_status)(struct rsnd_dai_stream *io,
struct rsnd_mod *mod,
enum rsnd_mod_type type),
enum rsnd_mod_type type, enum rsnd_mod_type type,
int id); int id);
void rsnd_mod_quit(struct rsnd_mod *mod); void rsnd_mod_quit(struct rsnd_mod *mod);
...@@ -396,8 +393,8 @@ struct dma_chan *rsnd_mod_dma_req(struct rsnd_dai_stream *io, ...@@ -396,8 +393,8 @@ struct dma_chan *rsnd_mod_dma_req(struct rsnd_dai_stream *io,
void rsnd_mod_interrupt(struct rsnd_mod *mod, void rsnd_mod_interrupt(struct rsnd_mod *mod,
void (*callback)(struct rsnd_mod *mod, void (*callback)(struct rsnd_mod *mod,
struct rsnd_dai_stream *io)); struct rsnd_dai_stream *io));
u32 *rsnd_mod_get_status(struct rsnd_dai_stream *io, u32 *rsnd_mod_get_status(struct rsnd_mod *mod,
struct rsnd_mod *mod, struct rsnd_dai_stream *io,
enum rsnd_mod_type type); enum rsnd_mod_type type);
struct rsnd_mod *rsnd_mod_next(int *iterator, struct rsnd_mod *rsnd_mod_next(int *iterator,
struct rsnd_dai_stream *io, struct rsnd_dai_stream *io,
......
...@@ -527,16 +527,17 @@ static int rsnd_src_pcm_new(struct rsnd_mod *mod, ...@@ -527,16 +527,17 @@ static int rsnd_src_pcm_new(struct rsnd_mod *mod,
} }
static struct rsnd_mod_ops rsnd_src_ops = { static struct rsnd_mod_ops rsnd_src_ops = {
.name = SRC_NAME, .name = SRC_NAME,
.dma_req = rsnd_src_dma_req, .dma_req = rsnd_src_dma_req,
.probe = rsnd_src_probe_, .probe = rsnd_src_probe_,
.init = rsnd_src_init, .init = rsnd_src_init,
.quit = rsnd_src_quit, .quit = rsnd_src_quit,
.start = rsnd_src_start, .start = rsnd_src_start,
.stop = rsnd_src_stop, .stop = rsnd_src_stop,
.irq = rsnd_src_irq, .irq = rsnd_src_irq,
.hw_params = rsnd_src_hw_params, .hw_params = rsnd_src_hw_params,
.pcm_new = rsnd_src_pcm_new, .pcm_new = rsnd_src_pcm_new,
.get_status = rsnd_mod_get_status,
}; };
struct rsnd_mod *rsnd_src_mod_get(struct rsnd_priv *priv, int id) struct rsnd_mod *rsnd_src_mod_get(struct rsnd_priv *priv, int id)
...@@ -605,8 +606,7 @@ int rsnd_src_probe(struct rsnd_priv *priv) ...@@ -605,8 +606,7 @@ int rsnd_src_probe(struct rsnd_priv *priv)
} }
ret = rsnd_mod_init(priv, rsnd_mod_get(src), ret = rsnd_mod_init(priv, rsnd_mod_get(src),
&rsnd_src_ops, clk, rsnd_mod_get_status, &rsnd_src_ops, clk, RSND_MOD_SRC, i);
RSND_MOD_SRC, i);
if (ret) { if (ret) {
of_node_put(np); of_node_put(np);
goto rsnd_src_probe_done; goto rsnd_src_probe_done;
......
...@@ -681,6 +681,41 @@ static irqreturn_t rsnd_ssi_interrupt(int irq, void *data) ...@@ -681,6 +681,41 @@ static irqreturn_t rsnd_ssi_interrupt(int irq, void *data)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
static u32 *rsnd_ssi_get_status(struct rsnd_mod *mod,
struct rsnd_dai_stream *io,
enum rsnd_mod_type type)
{
/*
* SSIP (= SSI parent) needs to be special, otherwise,
* 2nd SSI might doesn't start. see also rsnd_mod_call()
*
* We can't include parent SSI status on SSI, because we don't know
* how many SSI requests parent SSI. Thus, it is localed on "io" now.
* ex) trouble case
* Playback: SSI0
* Capture : SSI1 (needs SSI0)
*
* 1) start Capture -> SSI0/SSI1 are started.
* 2) start Playback -> SSI0 doesn't work, because it is already
* marked as "started" on 1)
*
* OTOH, using each mod's status is good for MUX case.
* It doesn't need to start in 2nd start
* ex)
* IO-0: SRC0 -> CTU1 -+-> MUX -> DVC -> SSIU -> SSI0
* |
* IO-1: SRC1 -> CTU2 -+
*
* 1) start IO-0 -> start SSI0
* 2) start IO-1 -> SSI0 doesn't need to start, because it is
* already started on 1)
*/
if (type == RSND_MOD_SSIP)
return &io->parent_ssi_status;
return rsnd_mod_get_status(mod, io, type);
}
/* /*
* SSI PIO * SSI PIO
*/ */
...@@ -876,18 +911,19 @@ static int rsnd_ssi_prepare(struct rsnd_mod *mod, ...@@ -876,18 +911,19 @@ static int rsnd_ssi_prepare(struct rsnd_mod *mod,
} }
static struct rsnd_mod_ops rsnd_ssi_pio_ops = { static struct rsnd_mod_ops rsnd_ssi_pio_ops = {
.name = SSI_NAME, .name = SSI_NAME,
.probe = rsnd_ssi_common_probe, .probe = rsnd_ssi_common_probe,
.remove = rsnd_ssi_common_remove, .remove = rsnd_ssi_common_remove,
.init = rsnd_ssi_pio_init, .init = rsnd_ssi_pio_init,
.quit = rsnd_ssi_quit, .quit = rsnd_ssi_quit,
.start = rsnd_ssi_start, .start = rsnd_ssi_start,
.stop = rsnd_ssi_stop, .stop = rsnd_ssi_stop,
.irq = rsnd_ssi_irq, .irq = rsnd_ssi_irq,
.pointer = rsnd_ssi_pio_pointer, .pointer = rsnd_ssi_pio_pointer,
.pcm_new = rsnd_ssi_pcm_new, .pcm_new = rsnd_ssi_pcm_new,
.hw_params = rsnd_ssi_hw_params, .hw_params = rsnd_ssi_hw_params,
.prepare = rsnd_ssi_prepare, .prepare = rsnd_ssi_prepare,
.get_status = rsnd_ssi_get_status,
}; };
static int rsnd_ssi_dma_probe(struct rsnd_mod *mod, static int rsnd_ssi_dma_probe(struct rsnd_mod *mod,
...@@ -951,19 +987,20 @@ static struct dma_chan *rsnd_ssi_dma_req(struct rsnd_dai_stream *io, ...@@ -951,19 +987,20 @@ static struct dma_chan *rsnd_ssi_dma_req(struct rsnd_dai_stream *io,
} }
static struct rsnd_mod_ops rsnd_ssi_dma_ops = { static struct rsnd_mod_ops rsnd_ssi_dma_ops = {
.name = SSI_NAME, .name = SSI_NAME,
.dma_req = rsnd_ssi_dma_req, .dma_req = rsnd_ssi_dma_req,
.probe = rsnd_ssi_dma_probe, .probe = rsnd_ssi_dma_probe,
.remove = rsnd_ssi_common_remove, .remove = rsnd_ssi_common_remove,
.init = rsnd_ssi_init, .init = rsnd_ssi_init,
.quit = rsnd_ssi_quit, .quit = rsnd_ssi_quit,
.start = rsnd_ssi_start, .start = rsnd_ssi_start,
.stop = rsnd_ssi_stop, .stop = rsnd_ssi_stop,
.irq = rsnd_ssi_irq, .irq = rsnd_ssi_irq,
.pcm_new = rsnd_ssi_pcm_new, .pcm_new = rsnd_ssi_pcm_new,
.fallback = rsnd_ssi_fallback, .fallback = rsnd_ssi_fallback,
.hw_params = rsnd_ssi_hw_params, .hw_params = rsnd_ssi_hw_params,
.prepare = rsnd_ssi_prepare, .prepare = rsnd_ssi_prepare,
.get_status = rsnd_ssi_get_status,
}; };
int rsnd_ssi_is_dma_mode(struct rsnd_mod *mod) int rsnd_ssi_is_dma_mode(struct rsnd_mod *mod)
...@@ -1091,41 +1128,6 @@ int __rsnd_ssi_is_pin_sharing(struct rsnd_mod *mod) ...@@ -1091,41 +1128,6 @@ int __rsnd_ssi_is_pin_sharing(struct rsnd_mod *mod)
return !!(rsnd_flags_has(rsnd_mod_to_ssi(mod), RSND_SSI_CLK_PIN_SHARE)); return !!(rsnd_flags_has(rsnd_mod_to_ssi(mod), RSND_SSI_CLK_PIN_SHARE));
} }
static u32 *rsnd_ssi_get_status(struct rsnd_dai_stream *io,
struct rsnd_mod *mod,
enum rsnd_mod_type type)
{
/*
* SSIP (= SSI parent) needs to be special, otherwise,
* 2nd SSI might doesn't start. see also rsnd_mod_call()
*
* We can't include parent SSI status on SSI, because we don't know
* how many SSI requests parent SSI. Thus, it is localed on "io" now.
* ex) trouble case
* Playback: SSI0
* Capture : SSI1 (needs SSI0)
*
* 1) start Capture -> SSI0/SSI1 are started.
* 2) start Playback -> SSI0 doesn't work, because it is already
* marked as "started" on 1)
*
* OTOH, using each mod's status is good for MUX case.
* It doesn't need to start in 2nd start
* ex)
* IO-0: SRC0 -> CTU1 -+-> MUX -> DVC -> SSIU -> SSI0
* |
* IO-1: SRC1 -> CTU2 -+
*
* 1) start IO-0 -> start SSI0
* 2) start IO-1 -> SSI0 doesn't need to start, because it is
* already started on 1)
*/
if (type == RSND_MOD_SSIP)
return &io->parent_ssi_status;
return rsnd_mod_get_status(io, mod, type);
}
int rsnd_ssi_probe(struct rsnd_priv *priv) int rsnd_ssi_probe(struct rsnd_priv *priv)
{ {
struct device_node *node; struct device_node *node;
...@@ -1192,7 +1194,7 @@ int rsnd_ssi_probe(struct rsnd_priv *priv) ...@@ -1192,7 +1194,7 @@ int rsnd_ssi_probe(struct rsnd_priv *priv)
ops = &rsnd_ssi_dma_ops; ops = &rsnd_ssi_dma_ops;
ret = rsnd_mod_init(priv, rsnd_mod_get(ssi), ops, clk, ret = rsnd_mod_init(priv, rsnd_mod_get(ssi), ops, clk,
rsnd_ssi_get_status, RSND_MOD_SSI, i); RSND_MOD_SSI, i);
if (ret) { if (ret) {
of_node_put(np); of_node_put(np);
goto rsnd_ssi_probe_done; goto rsnd_ssi_probe_done;
......
...@@ -22,6 +22,16 @@ struct rsnd_ssiu { ...@@ -22,6 +22,16 @@ struct rsnd_ssiu {
((pos) = ((struct rsnd_ssiu *)(priv)->ssiu + i)); \ ((pos) = ((struct rsnd_ssiu *)(priv)->ssiu + i)); \
i++) i++)
static u32 *rsnd_ssiu_get_status(struct rsnd_mod *mod,
struct rsnd_dai_stream *io,
enum rsnd_mod_type type)
{
struct rsnd_ssiu *ssiu = rsnd_mod_to_ssiu(mod);
int busif = rsnd_ssi_get_busif(io);
return &ssiu->busif_status[busif];
}
static int rsnd_ssiu_init(struct rsnd_mod *mod, static int rsnd_ssiu_init(struct rsnd_mod *mod,
struct rsnd_dai_stream *io, struct rsnd_dai_stream *io,
struct rsnd_priv *priv) struct rsnd_priv *priv)
...@@ -115,8 +125,9 @@ static int rsnd_ssiu_init(struct rsnd_mod *mod, ...@@ -115,8 +125,9 @@ static int rsnd_ssiu_init(struct rsnd_mod *mod,
} }
static struct rsnd_mod_ops rsnd_ssiu_ops_gen1 = { static struct rsnd_mod_ops rsnd_ssiu_ops_gen1 = {
.name = SSIU_NAME, .name = SSIU_NAME,
.init = rsnd_ssiu_init, .init = rsnd_ssiu_init,
.get_status = rsnd_ssiu_get_status,
}; };
static int rsnd_ssiu_init_gen2(struct rsnd_mod *mod, static int rsnd_ssiu_init_gen2(struct rsnd_mod *mod,
...@@ -279,10 +290,11 @@ static int rsnd_ssiu_stop_gen2(struct rsnd_mod *mod, ...@@ -279,10 +290,11 @@ static int rsnd_ssiu_stop_gen2(struct rsnd_mod *mod,
} }
static struct rsnd_mod_ops rsnd_ssiu_ops_gen2 = { static struct rsnd_mod_ops rsnd_ssiu_ops_gen2 = {
.name = SSIU_NAME, .name = SSIU_NAME,
.init = rsnd_ssiu_init_gen2, .init = rsnd_ssiu_init_gen2,
.start = rsnd_ssiu_start_gen2, .start = rsnd_ssiu_start_gen2,
.stop = rsnd_ssiu_stop_gen2, .stop = rsnd_ssiu_stop_gen2,
.get_status = rsnd_ssiu_get_status,
}; };
static struct rsnd_mod *rsnd_ssiu_mod_get(struct rsnd_priv *priv, int id) static struct rsnd_mod *rsnd_ssiu_mod_get(struct rsnd_priv *priv, int id)
...@@ -304,16 +316,6 @@ int rsnd_ssiu_attach(struct rsnd_dai_stream *io, ...@@ -304,16 +316,6 @@ int rsnd_ssiu_attach(struct rsnd_dai_stream *io,
return rsnd_dai_connect(mod, io, mod->type); return rsnd_dai_connect(mod, io, mod->type);
} }
static u32 *rsnd_ssiu_get_status(struct rsnd_dai_stream *io,
struct rsnd_mod *mod,
enum rsnd_mod_type type)
{
struct rsnd_ssiu *ssiu = rsnd_mod_to_ssiu(mod);
int busif = rsnd_ssi_get_busif(io);
return &ssiu->busif_status[busif];
}
int rsnd_ssiu_probe(struct rsnd_priv *priv) int rsnd_ssiu_probe(struct rsnd_priv *priv)
{ {
struct device *dev = rsnd_priv_to_dev(priv); struct device *dev = rsnd_priv_to_dev(priv);
...@@ -337,8 +339,7 @@ int rsnd_ssiu_probe(struct rsnd_priv *priv) ...@@ -337,8 +339,7 @@ int rsnd_ssiu_probe(struct rsnd_priv *priv)
for_each_rsnd_ssiu(ssiu, priv, i) { for_each_rsnd_ssiu(ssiu, priv, i) {
ret = rsnd_mod_init(priv, rsnd_mod_get(ssiu), ret = rsnd_mod_init(priv, rsnd_mod_get(ssiu),
ops, NULL, rsnd_ssiu_get_status, ops, NULL, RSND_MOD_SSIU, i);
RSND_MOD_SSIU, i);
if (ret) if (ret)
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment