aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/sh
diff options
context:
space:
mode:
authorKuninori Morimoto <morimoto.kuninori@renesas.com>2010-01-27 23:46:16 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2010-01-28 07:44:22 -0500
commit8fc176d5abb2d92c52df859faac7974b4a1585c1 (patch)
tree63f64a0a4c12f2b28cd144701b7da042e1c07a65 /sound/soc/sh
parent0d34e91596ef537c2893a031f0483014bb82adf3 (diff)
ASoC: fsi: Add spin lock operation for accessing shared area
fsi_master_xxx function should be protected by spin lock, because it are used from both FSI-A and FSI-B. Signed-off-by: Kuninori Morimoto <morimoto.kuninori@renesas.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/sh')
-rw-r--r--sound/soc/sh/fsi.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c
index 5f9f2693f4eb..ebf358808db1 100644
--- a/sound/soc/sh/fsi.c
+++ b/sound/soc/sh/fsi.c
@@ -110,6 +110,7 @@ struct fsi_master {
110 struct fsi_priv fsia; 110 struct fsi_priv fsia;
111 struct fsi_priv fsib; 111 struct fsi_priv fsib;
112 struct sh_fsi_platform_info *info; 112 struct sh_fsi_platform_info *info;
113 spinlock_t lock;
113}; 114};
114 115
115/************************************************************************ 116/************************************************************************
@@ -168,30 +169,51 @@ static int fsi_reg_mask_set(struct fsi_priv *fsi, u32 reg, u32 mask, u32 data)
168 169
169static int fsi_master_write(struct fsi_master *master, u32 reg, u32 data) 170static int fsi_master_write(struct fsi_master *master, u32 reg, u32 data)
170{ 171{
172 int ret;
173 unsigned long flags;
174
171 if ((reg < MREG_START) || 175 if ((reg < MREG_START) ||
172 (reg > MREG_END)) 176 (reg > MREG_END))
173 return -1; 177 return -1;
174 178
175 return __fsi_reg_write((u32)(master->base + reg), data); 179 spin_lock_irqsave(&master->lock, flags);
180 ret = __fsi_reg_write((u32)(master->base + reg), data);
181 spin_unlock_irqrestore(&master->lock, flags);
182
183 return ret;
176} 184}
177 185
178static u32 fsi_master_read(struct fsi_master *master, u32 reg) 186static u32 fsi_master_read(struct fsi_master *master, u32 reg)
179{ 187{
188 u32 ret;
189 unsigned long flags;
190
180 if ((reg < MREG_START) || 191 if ((reg < MREG_START) ||
181 (reg > MREG_END)) 192 (reg > MREG_END))
182 return 0; 193 return 0;
183 194
184 return __fsi_reg_read((u32)(master->base + reg)); 195 spin_lock_irqsave(&master->lock, flags);
196 ret = __fsi_reg_read((u32)(master->base + reg));
197 spin_unlock_irqrestore(&master->lock, flags);
198
199 return ret;
185} 200}
186 201
187static int fsi_master_mask_set(struct fsi_master *master, 202static int fsi_master_mask_set(struct fsi_master *master,
188 u32 reg, u32 mask, u32 data) 203 u32 reg, u32 mask, u32 data)
189{ 204{
205 int ret;
206 unsigned long flags;
207
190 if ((reg < MREG_START) || 208 if ((reg < MREG_START) ||
191 (reg > MREG_END)) 209 (reg > MREG_END))
192 return -1; 210 return -1;
193 211
194 return __fsi_reg_mask_set((u32)(master->base + reg), mask, data); 212 spin_lock_irqsave(&master->lock, flags);
213 ret = __fsi_reg_mask_set((u32)(master->base + reg), mask, data);
214 spin_unlock_irqrestore(&master->lock, flags);
215
216 return ret;
195} 217}
196 218
197/************************************************************************ 219/************************************************************************
@@ -929,6 +951,7 @@ static int fsi_probe(struct platform_device *pdev)
929 master->fsia.master = master; 951 master->fsia.master = master;
930 master->fsib.base = master->base + 0x40; 952 master->fsib.base = master->base + 0x40;
931 master->fsib.master = master; 953 master->fsib.master = master;
954 spin_lock_init(&master->lock);
932 955
933 pm_runtime_enable(&pdev->dev); 956 pm_runtime_enable(&pdev->dev);
934 pm_runtime_resume(&pdev->dev); 957 pm_runtime_resume(&pdev->dev);