aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap1/board-nokia770.c
diff options
context:
space:
mode:
authorMatthias Kaehlcke <matthias@kaehlcke.net>2008-06-09 19:24:08 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-07-03 11:39:56 -0400
commitd41d219e8154885105d631661e5a86ba6461fb81 (patch)
treeed7bc6400ae2870143af9359ba6baa0b02e38711 /arch/arm/mach-omap1/board-nokia770.c
parent3c093f9f182eef6a8dc535f2c62b36a0320d0db1 (diff)
[ARM] OMAP1: N770: Convert audio_pwr_sem in a mutex
ARM: OMAP1: N770: The semaphore audio_pwr_sem is used as a mutex. Convert it to the mutex API [akpm@linux-foundation.org: include mutex.h] Signed-off-by: Matthias Kaehlcke <matthias@kaehlcke.net> Cc: Tony Lindgren <tony@atomide.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-omap1/board-nokia770.c')
-rw-r--r--arch/arm/mach-omap1/board-nokia770.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c
index bcb984f2300f..3f39e0e79c9f 100644
--- a/arch/arm/mach-omap1/board-nokia770.c
+++ b/arch/arm/mach-omap1/board-nokia770.c
@@ -10,6 +10,7 @@
10 10
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/mutex.h>
13#include <linux/platform_device.h> 14#include <linux/platform_device.h>
14#include <linux/input.h> 15#include <linux/input.h>
15#include <linux/clk.h> 16#include <linux/clk.h>
@@ -202,7 +203,7 @@ static struct omap_board_config_kernel nokia770_config[] __initdata = {
202#define AMPLIFIER_CTRL_GPIO 58 203#define AMPLIFIER_CTRL_GPIO 58
203 204
204static struct clk *dspxor_ck; 205static struct clk *dspxor_ck;
205static DECLARE_MUTEX(audio_pwr_sem); 206static DEFINE_MUTEX(audio_pwr_lock);
206/* 207/*
207 * audio_pwr_state 208 * audio_pwr_state
208 * +--+-------------------------+---------------------------------------+ 209 * +--+-------------------------+---------------------------------------+
@@ -218,7 +219,7 @@ static DECLARE_MUTEX(audio_pwr_sem);
218static int audio_pwr_state = -1; 219static int audio_pwr_state = -1;
219 220
220/* 221/*
221 * audio_pwr_up / down should be called under audio_pwr_sem 222 * audio_pwr_up / down should be called under audio_pwr_lock
222 */ 223 */
223static void nokia770_audio_pwr_up(void) 224static void nokia770_audio_pwr_up(void)
224{ 225{
@@ -237,11 +238,11 @@ static void nokia770_audio_pwr_up(void)
237 238
238static void codec_delayed_power_down(struct work_struct *work) 239static void codec_delayed_power_down(struct work_struct *work)
239{ 240{
240 down(&audio_pwr_sem); 241 mutex_lock(&audio_pwr_lock);
241 if (audio_pwr_state == -1) 242 if (audio_pwr_state == -1)
242 aic23_power_down(); 243 aic23_power_down();
243 clk_disable(dspxor_ck); 244 clk_disable(dspxor_ck);
244 up(&audio_pwr_sem); 245 mutex_unlock(&audio_pwr_lock);
245} 246}
246 247
247static DECLARE_DELAYED_WORK(codec_power_down_work, codec_delayed_power_down); 248static DECLARE_DELAYED_WORK(codec_power_down_work, codec_delayed_power_down);
@@ -258,19 +259,19 @@ static void nokia770_audio_pwr_down(void)
258static int 259static int
259nokia770_audio_pwr_up_request(struct dsp_kfunc_device *kdev, int stage) 260nokia770_audio_pwr_up_request(struct dsp_kfunc_device *kdev, int stage)
260{ 261{
261 down(&audio_pwr_sem); 262 mutex_lock(&audio_pwr_lock);
262 if (audio_pwr_state == -1) 263 if (audio_pwr_state == -1)
263 nokia770_audio_pwr_up(); 264 nokia770_audio_pwr_up();
264 /* force audio_pwr_state = 0, even if it was 1. */ 265 /* force audio_pwr_state = 0, even if it was 1. */
265 audio_pwr_state = 0; 266 audio_pwr_state = 0;
266 up(&audio_pwr_sem); 267 mutex_unlock(&audio_pwr_lock);
267 return 0; 268 return 0;
268} 269}
269 270
270static int 271static int
271nokia770_audio_pwr_down_request(struct dsp_kfunc_device *kdev, int stage) 272nokia770_audio_pwr_down_request(struct dsp_kfunc_device *kdev, int stage)
272{ 273{
273 down(&audio_pwr_sem); 274 mutex_lock(&audio_pwr_lock);
274 switch (stage) { 275 switch (stage) {
275 case 1: 276 case 1:
276 if (audio_pwr_state == 0) 277 if (audio_pwr_state == 0)
@@ -283,7 +284,7 @@ nokia770_audio_pwr_down_request(struct dsp_kfunc_device *kdev, int stage)
283 } 284 }
284 break; 285 break;
285 } 286 }
286 up(&audio_pwr_sem); 287 mutex_unlock(&audio_pwr_lock);
287 return 0; 288 return 0;
288} 289}
289 290