diff options
| -rw-r--r-- | arch/arm/mach-omap1/board-nokia770.c | 17 |
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 | ||
| 204 | static struct clk *dspxor_ck; | 205 | static struct clk *dspxor_ck; |
| 205 | static DECLARE_MUTEX(audio_pwr_sem); | 206 | static 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); | |||
| 218 | static int audio_pwr_state = -1; | 219 | static 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 | */ |
| 223 | static void nokia770_audio_pwr_up(void) | 224 | static void nokia770_audio_pwr_up(void) |
| 224 | { | 225 | { |
| @@ -237,11 +238,11 @@ static void nokia770_audio_pwr_up(void) | |||
| 237 | 238 | ||
| 238 | static void codec_delayed_power_down(struct work_struct *work) | 239 | static 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 | ||
| 247 | static DECLARE_DELAYED_WORK(codec_power_down_work, codec_delayed_power_down); | 248 | static DECLARE_DELAYED_WORK(codec_power_down_work, codec_delayed_power_down); |
| @@ -258,19 +259,19 @@ static void nokia770_audio_pwr_down(void) | |||
| 258 | static int | 259 | static int |
| 259 | nokia770_audio_pwr_up_request(struct dsp_kfunc_device *kdev, int stage) | 260 | nokia770_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 | ||
| 270 | static int | 271 | static int |
| 271 | nokia770_audio_pwr_down_request(struct dsp_kfunc_device *kdev, int stage) | 272 | nokia770_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 | ||
