diff options
Diffstat (limited to 'arch/arm/mach-omap1/board-nokia770.c')
| -rw-r--r-- | arch/arm/mach-omap1/board-nokia770.c | 136 |
1 files changed, 1 insertions, 135 deletions
diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c index 8c28b10f3dae..51a4539aecf5 100644 --- a/arch/arm/mach-omap1/board-nokia770.c +++ b/arch/arm/mach-omap1/board-nokia770.c | |||
| @@ -32,7 +32,6 @@ | |||
| 32 | #include <plat/board.h> | 32 | #include <plat/board.h> |
| 33 | #include <plat/keypad.h> | 33 | #include <plat/keypad.h> |
| 34 | #include <plat/common.h> | 34 | #include <plat/common.h> |
| 35 | #include <plat/dsp_common.h> | ||
| 36 | #include <plat/hwa742.h> | 35 | #include <plat/hwa742.h> |
| 37 | #include <plat/lcd_mipid.h> | 36 | #include <plat/lcd_mipid.h> |
| 38 | #include <plat/mmc.h> | 37 | #include <plat/mmc.h> |
| @@ -242,138 +241,6 @@ static inline void nokia770_mmc_init(void) | |||
| 242 | } | 241 | } |
| 243 | #endif | 242 | #endif |
| 244 | 243 | ||
| 245 | #if defined(CONFIG_OMAP_DSP) | ||
| 246 | /* | ||
| 247 | * audio power control | ||
| 248 | */ | ||
| 249 | #define HEADPHONE_GPIO 14 | ||
| 250 | #define AMPLIFIER_CTRL_GPIO 58 | ||
| 251 | |||
| 252 | static struct clk *dspxor_ck; | ||
| 253 | static DEFINE_MUTEX(audio_pwr_lock); | ||
| 254 | /* | ||
| 255 | * audio_pwr_state | ||
| 256 | * +--+-------------------------+---------------------------------------+ | ||
| 257 | * |-1|down |power-up request -> 0 | | ||
| 258 | * +--+-------------------------+---------------------------------------+ | ||
| 259 | * | 0|up |power-down(1) request -> 1 | | ||
| 260 | * | | |power-down(2) request -> (ignore) | | ||
| 261 | * +--+-------------------------+---------------------------------------+ | ||
| 262 | * | 1|up, |power-up request -> 0 | | ||
| 263 | * | |received down(1) request |power-down(2) request -> -1 | | ||
| 264 | * +--+-------------------------+---------------------------------------+ | ||
| 265 | */ | ||
| 266 | static int audio_pwr_state = -1; | ||
| 267 | |||
| 268 | static inline void aic23_power_up(void) | ||
| 269 | { | ||
| 270 | } | ||
| 271 | static inline void aic23_power_down(void) | ||
| 272 | { | ||
| 273 | } | ||
| 274 | |||
| 275 | /* | ||
| 276 | * audio_pwr_up / down should be called under audio_pwr_lock | ||
| 277 | */ | ||
| 278 | static void nokia770_audio_pwr_up(void) | ||
| 279 | { | ||
| 280 | clk_enable(dspxor_ck); | ||
| 281 | |||
| 282 | /* Turn on codec */ | ||
| 283 | aic23_power_up(); | ||
| 284 | |||
| 285 | if (gpio_get_value(HEADPHONE_GPIO)) | ||
| 286 | /* HP not connected, turn on amplifier */ | ||
| 287 | gpio_set_value(AMPLIFIER_CTRL_GPIO, 1); | ||
| 288 | else | ||
| 289 | /* HP connected, do not turn on amplifier */ | ||
| 290 | printk("HP connected\n"); | ||
| 291 | } | ||
| 292 | |||
| 293 | static void codec_delayed_power_down(struct work_struct *work) | ||
| 294 | { | ||
| 295 | mutex_lock(&audio_pwr_lock); | ||
| 296 | if (audio_pwr_state == -1) | ||
| 297 | aic23_power_down(); | ||
| 298 | clk_disable(dspxor_ck); | ||
| 299 | mutex_unlock(&audio_pwr_lock); | ||
| 300 | } | ||
| 301 | |||
| 302 | static DECLARE_DELAYED_WORK(codec_power_down_work, codec_delayed_power_down); | ||
| 303 | |||
| 304 | static void nokia770_audio_pwr_down(void) | ||
| 305 | { | ||
| 306 | /* Turn off amplifier */ | ||
| 307 | gpio_set_value(AMPLIFIER_CTRL_GPIO, 0); | ||
| 308 | |||
| 309 | /* Turn off codec: schedule delayed work */ | ||
| 310 | schedule_delayed_work(&codec_power_down_work, HZ / 20); /* 50ms */ | ||
| 311 | } | ||
| 312 | |||
| 313 | static int | ||
| 314 | nokia770_audio_pwr_up_request(struct dsp_kfunc_device *kdev, int stage) | ||
| 315 | { | ||
| 316 | mutex_lock(&audio_pwr_lock); | ||
| 317 | if (audio_pwr_state == -1) | ||
| 318 | nokia770_audio_pwr_up(); | ||
| 319 | /* force audio_pwr_state = 0, even if it was 1. */ | ||
| 320 | audio_pwr_state = 0; | ||
| 321 | mutex_unlock(&audio_pwr_lock); | ||
| 322 | return 0; | ||
| 323 | } | ||
| 324 | |||
| 325 | static int | ||
| 326 | nokia770_audio_pwr_down_request(struct dsp_kfunc_device *kdev, int stage) | ||
| 327 | { | ||
| 328 | mutex_lock(&audio_pwr_lock); | ||
| 329 | switch (stage) { | ||
| 330 | case 1: | ||
| 331 | if (audio_pwr_state == 0) | ||
| 332 | audio_pwr_state = 1; | ||
| 333 | break; | ||
| 334 | case 2: | ||
| 335 | if (audio_pwr_state == 1) { | ||
| 336 | nokia770_audio_pwr_down(); | ||
| 337 | audio_pwr_state = -1; | ||
| 338 | } | ||
| 339 | break; | ||
| 340 | } | ||
| 341 | mutex_unlock(&audio_pwr_lock); | ||
| 342 | return 0; | ||
| 343 | } | ||
| 344 | |||
| 345 | static struct dsp_kfunc_device nokia770_audio_device = { | ||
| 346 | .name = "audio", | ||
| 347 | .type = DSP_KFUNC_DEV_TYPE_AUDIO, | ||
| 348 | .enable = nokia770_audio_pwr_up_request, | ||
| 349 | .disable = nokia770_audio_pwr_down_request, | ||
| 350 | }; | ||
| 351 | |||
| 352 | static __init int omap_dsp_init(void) | ||
| 353 | { | ||
| 354 | int ret; | ||
| 355 | |||
| 356 | dspxor_ck = clk_get(0, "dspxor_ck"); | ||
| 357 | if (IS_ERR(dspxor_ck)) { | ||
| 358 | printk(KERN_ERR "couldn't acquire dspxor_ck\n"); | ||
| 359 | return PTR_ERR(dspxor_ck); | ||
| 360 | } | ||
| 361 | |||
| 362 | ret = dsp_kfunc_device_register(&nokia770_audio_device); | ||
| 363 | if (ret) { | ||
| 364 | printk(KERN_ERR | ||
| 365 | "KFUNC device registration faild: %s\n", | ||
| 366 | nokia770_audio_device.name); | ||
| 367 | goto out; | ||
| 368 | } | ||
| 369 | return 0; | ||
| 370 | out: | ||
| 371 | return ret; | ||
| 372 | } | ||
| 373 | #else | ||
| 374 | #define omap_dsp_init() do {} while (0) | ||
| 375 | #endif /* CONFIG_OMAP_DSP */ | ||
| 376 | |||
| 377 | static void __init omap_nokia770_init(void) | 244 | static void __init omap_nokia770_init(void) |
| 378 | { | 245 | { |
| 379 | platform_add_devices(nokia770_devices, ARRAY_SIZE(nokia770_devices)); | 246 | platform_add_devices(nokia770_devices, ARRAY_SIZE(nokia770_devices)); |
| @@ -382,11 +249,10 @@ static void __init omap_nokia770_init(void) | |||
| 382 | omap_gpio_init(); | 249 | omap_gpio_init(); |
| 383 | omap_serial_init(); | 250 | omap_serial_init(); |
| 384 | omap_register_i2c_bus(1, 100, NULL, 0); | 251 | omap_register_i2c_bus(1, 100, NULL, 0); |
| 385 | omap_dsp_init(); | ||
| 386 | hwa742_dev_init(); | 252 | hwa742_dev_init(); |
| 387 | ads7846_dev_init(); | 253 | ads7846_dev_init(); |
| 388 | mipid_dev_init(); | 254 | mipid_dev_init(); |
| 389 | omap_usb_init(&nokia770_usb_config); | 255 | omap1_usb_init(&nokia770_usb_config); |
| 390 | nokia770_mmc_init(); | 256 | nokia770_mmc_init(); |
| 391 | } | 257 | } |
| 392 | 258 | ||
