aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2017-10-01 19:47:50 -0400
committerMark Brown <broonie@kernel.org>2017-10-04 06:50:19 -0400
commit429919890e22431bc350ecf47b31866bb27631b2 (patch)
treeff9a0be99b80ba7c5d8662b430580f248a73f2d0
parent81cb71240e202a8086bda0755d9d78bd3decd0aa (diff)
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: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Tested-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/sh/rcar/rsnd.h4
-rw-r--r--sound/soc/sh/rcar/ssi.c27
2 files changed, 16 insertions, 15 deletions
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index c5de71f2dc8c..beffbec42404 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -601,6 +601,10 @@ struct rsnd_priv {
601#define rsnd_is_gen1(priv) (((priv)->flags & RSND_GEN_MASK) == RSND_GEN1) 601#define rsnd_is_gen1(priv) (((priv)->flags & RSND_GEN_MASK) == RSND_GEN1)
602#define rsnd_is_gen2(priv) (((priv)->flags & RSND_GEN_MASK) == RSND_GEN2) 602#define rsnd_is_gen2(priv) (((priv)->flags & RSND_GEN_MASK) == RSND_GEN2)
603 603
604#define rsnd_flags_has(p, f) ((p)->flags & (f))
605#define rsnd_flags_set(p, f) ((p)->flags |= (f))
606#define rsnd_flags_del(p, f) ((p)->flags &= ~(f))
607
604/* 608/*
605 * rsnd_kctrl 609 * rsnd_kctrl
606 */ 610 */
diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
index fffc07e72627..61b4ce20ee2b 100644
--- a/sound/soc/sh/rcar/ssi.c
+++ b/sound/soc/sh/rcar/ssi.c
@@ -101,9 +101,6 @@ struct rsnd_ssi {
101#define rsnd_ssi_get(priv, id) ((struct rsnd_ssi *)(priv->ssi) + id) 101#define rsnd_ssi_get(priv, id) ((struct rsnd_ssi *)(priv->ssi) + id)
102#define rsnd_ssi_nr(priv) ((priv)->ssi_nr) 102#define rsnd_ssi_nr(priv) ((priv)->ssi_nr)
103#define rsnd_mod_to_ssi(_mod) container_of((_mod), struct rsnd_ssi, mod) 103#define rsnd_mod_to_ssi(_mod) container_of((_mod), struct rsnd_ssi, mod)
104#define rsnd_ssi_flags_has(p, f) ((p)->flags & f)
105#define rsnd_ssi_flags_set(p, f) ((p)->flags |= f)
106#define rsnd_ssi_flags_del(p, f) ((p)->flags = ((p)->flags & ~f))
107#define rsnd_ssi_is_parent(ssi, io) ((ssi) == rsnd_io_to_mod_ssip(io)) 104#define rsnd_ssi_is_parent(ssi, io) ((ssi) == rsnd_io_to_mod_ssip(io))
108#define rsnd_ssi_is_multi_slave(mod, io) \ 105#define rsnd_ssi_is_multi_slave(mod, io) \
109 (rsnd_ssi_multi_slaves(io) & (1 << rsnd_mod_id(mod))) 106 (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 struct rsnd_mod *mod = rsnd_io_to_mod_ssi(io); 113 struct rsnd_mod *mod = rsnd_io_to_mod_ssi(io);
117 struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); 114 struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
118 115
119 if (rsnd_ssi_flags_has(ssi, RSND_SSI_HDMI0)) 116 if (rsnd_flags_has(ssi, RSND_SSI_HDMI0))
120 return RSND_SSI_HDMI_PORT0; 117 return RSND_SSI_HDMI_PORT0;
121 118
122 if (rsnd_ssi_flags_has(ssi, RSND_SSI_HDMI1)) 119 if (rsnd_flags_has(ssi, RSND_SSI_HDMI1))
123 return RSND_SSI_HDMI_PORT1; 120 return RSND_SSI_HDMI_PORT1;
124 121
125 return 0; 122 return 0;
@@ -134,7 +131,7 @@ int rsnd_ssi_use_busif(struct rsnd_dai_stream *io)
134 if (!rsnd_ssi_is_dma_mode(mod)) 131 if (!rsnd_ssi_is_dma_mode(mod))
135 return 0; 132 return 0;
136 133
137 if (!(rsnd_ssi_flags_has(ssi, RSND_SSI_NO_BUSIF))) 134 if (!(rsnd_flags_has(ssi, RSND_SSI_NO_BUSIF)))
138 use_busif = 1; 135 use_busif = 1;
139 if (rsnd_io_to_mod_src(io)) 136 if (rsnd_io_to_mod_src(io))
140 use_busif = 1; 137 use_busif = 1;
@@ -793,13 +790,13 @@ static int rsnd_ssi_common_probe(struct rsnd_mod *mod,
793 * But it don't need to call request_irq() many times. 790 * But it don't need to call request_irq() many times.
794 * Let's control it by RSND_SSI_PROBED flag. 791 * Let's control it by RSND_SSI_PROBED flag.
795 */ 792 */
796 if (!rsnd_ssi_flags_has(ssi, RSND_SSI_PROBED)) { 793 if (!rsnd_flags_has(ssi, RSND_SSI_PROBED)) {
797 ret = request_irq(ssi->irq, 794 ret = request_irq(ssi->irq,
798 rsnd_ssi_interrupt, 795 rsnd_ssi_interrupt,
799 IRQF_SHARED, 796 IRQF_SHARED,
800 dev_name(dev), mod); 797 dev_name(dev), mod);
801 798
802 rsnd_ssi_flags_set(ssi, RSND_SSI_PROBED); 799 rsnd_flags_set(ssi, RSND_SSI_PROBED);
803 } 800 }
804 801
805 return ret; 802 return ret;
@@ -817,10 +814,10 @@ static int rsnd_ssi_common_remove(struct rsnd_mod *mod,
817 return 0; 814 return 0;
818 815
819 /* PIO will request IRQ again */ 816 /* PIO will request IRQ again */
820 if (rsnd_ssi_flags_has(ssi, RSND_SSI_PROBED)) { 817 if (rsnd_flags_has(ssi, RSND_SSI_PROBED)) {
821 free_irq(ssi->irq, mod); 818 free_irq(ssi->irq, mod);
822 819
823 rsnd_ssi_flags_del(ssi, RSND_SSI_PROBED); 820 rsnd_flags_del(ssi, RSND_SSI_PROBED);
824 } 821 }
825 822
826 return 0; 823 return 0;
@@ -1003,13 +1000,13 @@ static void __rsnd_ssi_parse_hdmi_connection(struct rsnd_priv *priv,
1003 ssi = rsnd_mod_to_ssi(mod); 1000 ssi = rsnd_mod_to_ssi(mod);
1004 1001
1005 if (strstr(remote_ep->full_name, "hdmi0")) { 1002 if (strstr(remote_ep->full_name, "hdmi0")) {
1006 rsnd_ssi_flags_set(ssi, RSND_SSI_HDMI0); 1003 rsnd_flags_set(ssi, RSND_SSI_HDMI0);
1007 dev_dbg(dev, "%s[%d] connected to HDMI0\n", 1004 dev_dbg(dev, "%s[%d] connected to HDMI0\n",
1008 rsnd_mod_name(mod), rsnd_mod_id(mod)); 1005 rsnd_mod_name(mod), rsnd_mod_id(mod));
1009 } 1006 }
1010 1007
1011 if (strstr(remote_ep->full_name, "hdmi1")) { 1008 if (strstr(remote_ep->full_name, "hdmi1")) {
1012 rsnd_ssi_flags_set(ssi, RSND_SSI_HDMI1); 1009 rsnd_flags_set(ssi, RSND_SSI_HDMI1);
1013 dev_dbg(dev, "%s[%d] connected to HDMI1\n", 1010 dev_dbg(dev, "%s[%d] connected to HDMI1\n",
1014 rsnd_mod_name(mod), rsnd_mod_id(mod)); 1011 rsnd_mod_name(mod), rsnd_mod_id(mod));
1015 } 1012 }
@@ -1042,7 +1039,7 @@ int __rsnd_ssi_is_pin_sharing(struct rsnd_mod *mod)
1042{ 1039{
1043 struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); 1040 struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
1044 1041
1045 return !!(rsnd_ssi_flags_has(ssi, RSND_SSI_CLK_PIN_SHARE)); 1042 return !!(rsnd_flags_has(ssi, RSND_SSI_CLK_PIN_SHARE));
1046} 1043}
1047 1044
1048static u32 *rsnd_ssi_get_status(struct rsnd_dai_stream *io, 1045static u32 *rsnd_ssi_get_status(struct rsnd_dai_stream *io,
@@ -1125,10 +1122,10 @@ int rsnd_ssi_probe(struct rsnd_priv *priv)
1125 } 1122 }
1126 1123
1127 if (of_get_property(np, "shared-pin", NULL)) 1124 if (of_get_property(np, "shared-pin", NULL))
1128 rsnd_ssi_flags_set(ssi, RSND_SSI_CLK_PIN_SHARE); 1125 rsnd_flags_set(ssi, RSND_SSI_CLK_PIN_SHARE);
1129 1126
1130 if (of_get_property(np, "no-busif", NULL)) 1127 if (of_get_property(np, "no-busif", NULL))
1131 rsnd_ssi_flags_set(ssi, RSND_SSI_NO_BUSIF); 1128 rsnd_flags_set(ssi, RSND_SSI_NO_BUSIF);
1132 1129
1133 ssi->irq = irq_of_parse_and_map(np, 0); 1130 ssi->irq = irq_of_parse_and_map(np, 0);
1134 if (!ssi->irq) { 1131 if (!ssi->irq) {