Commit 42991989 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: rsnd: add generic rsnd_flags_xxx() macro

SSI is using rsnd_ssi_flags_xxx() macro to control flags.
But it is useful macro not only for SSI. This patch replace it
to more generic rsnd_flags_xxx().
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: default avatarHiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 81cb7124
...@@ -601,6 +601,10 @@ struct rsnd_priv { ...@@ -601,6 +601,10 @@ struct rsnd_priv {
#define rsnd_is_gen1(priv) (((priv)->flags & RSND_GEN_MASK) == RSND_GEN1) #define rsnd_is_gen1(priv) (((priv)->flags & RSND_GEN_MASK) == RSND_GEN1)
#define rsnd_is_gen2(priv) (((priv)->flags & RSND_GEN_MASK) == RSND_GEN2) #define rsnd_is_gen2(priv) (((priv)->flags & RSND_GEN_MASK) == RSND_GEN2)
#define rsnd_flags_has(p, f) ((p)->flags & (f))
#define rsnd_flags_set(p, f) ((p)->flags |= (f))
#define rsnd_flags_del(p, f) ((p)->flags &= ~(f))
/* /*
* rsnd_kctrl * rsnd_kctrl
*/ */
......
...@@ -101,9 +101,6 @@ struct rsnd_ssi { ...@@ -101,9 +101,6 @@ struct rsnd_ssi {
#define rsnd_ssi_get(priv, id) ((struct rsnd_ssi *)(priv->ssi) + id) #define rsnd_ssi_get(priv, id) ((struct rsnd_ssi *)(priv->ssi) + id)
#define rsnd_ssi_nr(priv) ((priv)->ssi_nr) #define rsnd_ssi_nr(priv) ((priv)->ssi_nr)
#define rsnd_mod_to_ssi(_mod) container_of((_mod), struct rsnd_ssi, mod) #define rsnd_mod_to_ssi(_mod) container_of((_mod), struct rsnd_ssi, mod)
#define rsnd_ssi_flags_has(p, f) ((p)->flags & f)
#define rsnd_ssi_flags_set(p, f) ((p)->flags |= f)
#define rsnd_ssi_flags_del(p, f) ((p)->flags = ((p)->flags & ~f))
#define rsnd_ssi_is_parent(ssi, io) ((ssi) == rsnd_io_to_mod_ssip(io)) #define rsnd_ssi_is_parent(ssi, io) ((ssi) == rsnd_io_to_mod_ssip(io))
#define rsnd_ssi_is_multi_slave(mod, io) \ #define rsnd_ssi_is_multi_slave(mod, io) \
(rsnd_ssi_multi_slaves(io) & (1 << rsnd_mod_id(mod))) (rsnd_ssi_multi_slaves(io) & (1 << rsnd_mod_id(mod)))
...@@ -116,10 +113,10 @@ int rsnd_ssi_hdmi_port(struct rsnd_dai_stream *io) ...@@ -116,10 +113,10 @@ int rsnd_ssi_hdmi_port(struct rsnd_dai_stream *io)
struct rsnd_mod *mod = rsnd_io_to_mod_ssi(io); struct rsnd_mod *mod = rsnd_io_to_mod_ssi(io);
struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
if (rsnd_ssi_flags_has(ssi, RSND_SSI_HDMI0)) if (rsnd_flags_has(ssi, RSND_SSI_HDMI0))
return RSND_SSI_HDMI_PORT0; return RSND_SSI_HDMI_PORT0;
if (rsnd_ssi_flags_has(ssi, RSND_SSI_HDMI1)) if (rsnd_flags_has(ssi, RSND_SSI_HDMI1))
return RSND_SSI_HDMI_PORT1; return RSND_SSI_HDMI_PORT1;
return 0; return 0;
...@@ -134,7 +131,7 @@ int rsnd_ssi_use_busif(struct rsnd_dai_stream *io) ...@@ -134,7 +131,7 @@ int rsnd_ssi_use_busif(struct rsnd_dai_stream *io)
if (!rsnd_ssi_is_dma_mode(mod)) if (!rsnd_ssi_is_dma_mode(mod))
return 0; return 0;
if (!(rsnd_ssi_flags_has(ssi, RSND_SSI_NO_BUSIF))) if (!(rsnd_flags_has(ssi, RSND_SSI_NO_BUSIF)))
use_busif = 1; use_busif = 1;
if (rsnd_io_to_mod_src(io)) if (rsnd_io_to_mod_src(io))
use_busif = 1; use_busif = 1;
...@@ -793,13 +790,13 @@ static int rsnd_ssi_common_probe(struct rsnd_mod *mod, ...@@ -793,13 +790,13 @@ static int rsnd_ssi_common_probe(struct rsnd_mod *mod,
* But it don't need to call request_irq() many times. * But it don't need to call request_irq() many times.
* Let's control it by RSND_SSI_PROBED flag. * Let's control it by RSND_SSI_PROBED flag.
*/ */
if (!rsnd_ssi_flags_has(ssi, RSND_SSI_PROBED)) { if (!rsnd_flags_has(ssi, RSND_SSI_PROBED)) {
ret = request_irq(ssi->irq, ret = request_irq(ssi->irq,
rsnd_ssi_interrupt, rsnd_ssi_interrupt,
IRQF_SHARED, IRQF_SHARED,
dev_name(dev), mod); dev_name(dev), mod);
rsnd_ssi_flags_set(ssi, RSND_SSI_PROBED); rsnd_flags_set(ssi, RSND_SSI_PROBED);
} }
return ret; return ret;
...@@ -817,10 +814,10 @@ static int rsnd_ssi_common_remove(struct rsnd_mod *mod, ...@@ -817,10 +814,10 @@ static int rsnd_ssi_common_remove(struct rsnd_mod *mod,
return 0; return 0;
/* PIO will request IRQ again */ /* PIO will request IRQ again */
if (rsnd_ssi_flags_has(ssi, RSND_SSI_PROBED)) { if (rsnd_flags_has(ssi, RSND_SSI_PROBED)) {
free_irq(ssi->irq, mod); free_irq(ssi->irq, mod);
rsnd_ssi_flags_del(ssi, RSND_SSI_PROBED); rsnd_flags_del(ssi, RSND_SSI_PROBED);
} }
return 0; return 0;
...@@ -1003,13 +1000,13 @@ static void __rsnd_ssi_parse_hdmi_connection(struct rsnd_priv *priv, ...@@ -1003,13 +1000,13 @@ static void __rsnd_ssi_parse_hdmi_connection(struct rsnd_priv *priv,
ssi = rsnd_mod_to_ssi(mod); ssi = rsnd_mod_to_ssi(mod);
if (strstr(remote_ep->full_name, "hdmi0")) { if (strstr(remote_ep->full_name, "hdmi0")) {
rsnd_ssi_flags_set(ssi, RSND_SSI_HDMI0); rsnd_flags_set(ssi, RSND_SSI_HDMI0);
dev_dbg(dev, "%s[%d] connected to HDMI0\n", dev_dbg(dev, "%s[%d] connected to HDMI0\n",
rsnd_mod_name(mod), rsnd_mod_id(mod)); rsnd_mod_name(mod), rsnd_mod_id(mod));
} }
if (strstr(remote_ep->full_name, "hdmi1")) { if (strstr(remote_ep->full_name, "hdmi1")) {
rsnd_ssi_flags_set(ssi, RSND_SSI_HDMI1); rsnd_flags_set(ssi, RSND_SSI_HDMI1);
dev_dbg(dev, "%s[%d] connected to HDMI1\n", dev_dbg(dev, "%s[%d] connected to HDMI1\n",
rsnd_mod_name(mod), rsnd_mod_id(mod)); rsnd_mod_name(mod), rsnd_mod_id(mod));
} }
...@@ -1042,7 +1039,7 @@ int __rsnd_ssi_is_pin_sharing(struct rsnd_mod *mod) ...@@ -1042,7 +1039,7 @@ int __rsnd_ssi_is_pin_sharing(struct rsnd_mod *mod)
{ {
struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
return !!(rsnd_ssi_flags_has(ssi, RSND_SSI_CLK_PIN_SHARE)); return !!(rsnd_flags_has(ssi, RSND_SSI_CLK_PIN_SHARE));
} }
static u32 *rsnd_ssi_get_status(struct rsnd_dai_stream *io, static u32 *rsnd_ssi_get_status(struct rsnd_dai_stream *io,
...@@ -1125,10 +1122,10 @@ int rsnd_ssi_probe(struct rsnd_priv *priv) ...@@ -1125,10 +1122,10 @@ int rsnd_ssi_probe(struct rsnd_priv *priv)
} }
if (of_get_property(np, "shared-pin", NULL)) if (of_get_property(np, "shared-pin", NULL))
rsnd_ssi_flags_set(ssi, RSND_SSI_CLK_PIN_SHARE); rsnd_flags_set(ssi, RSND_SSI_CLK_PIN_SHARE);
if (of_get_property(np, "no-busif", NULL)) if (of_get_property(np, "no-busif", NULL))
rsnd_ssi_flags_set(ssi, RSND_SSI_NO_BUSIF); rsnd_flags_set(ssi, RSND_SSI_NO_BUSIF);
ssi->irq = irq_of_parse_and_map(np, 0); ssi->irq = irq_of_parse_and_map(np, 0);
if (!ssi->irq) { if (!ssi->irq) {
......
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