diff options
Diffstat (limited to 'firmware/target/arm/tms320dm320/sansa-connect')
-rw-r--r-- | firmware/target/arm/tms320dm320/sansa-connect/avr-sansaconnect.c | 32 | ||||
-rw-r--r-- | firmware/target/arm/tms320dm320/sansa-connect/power-sansaconnect.c | 6 |
2 files changed, 33 insertions, 5 deletions
diff --git a/firmware/target/arm/tms320dm320/sansa-connect/avr-sansaconnect.c b/firmware/target/arm/tms320dm320/sansa-connect/avr-sansaconnect.c index 036b7db127..dedd017cf7 100644 --- a/firmware/target/arm/tms320dm320/sansa-connect/avr-sansaconnect.c +++ b/firmware/target/arm/tms320dm320/sansa-connect/avr-sansaconnect.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include "button.h" | 29 | #include "button.h" |
30 | #include "backlight.h" | 30 | #include "backlight.h" |
31 | #include "powermgmt.h" | 31 | #include "powermgmt.h" |
32 | #include "aic3x.h" | ||
32 | 33 | ||
33 | //#define BUTTON_DEBUG | 34 | //#define BUTTON_DEBUG |
34 | 35 | ||
@@ -405,6 +406,26 @@ void GIO0(void) | |||
405 | /* interrupt will be enabled back after button read */ | 406 | /* interrupt will be enabled back after button read */ |
406 | queue_post(&btn_queue, BTN_INTERRUPT, 0); | 407 | queue_post(&btn_queue, BTN_INTERRUPT, 0); |
407 | } | 408 | } |
409 | |||
410 | void GIO2(void) __attribute__ ((section(".icode"))); | ||
411 | void GIO2(void) | ||
412 | { | ||
413 | /* Clear interrupt */ | ||
414 | IO_INTC_IRQ1 = (1 << 7); | ||
415 | /* Disable interrupt */ | ||
416 | IO_INTC_EINT1 &= ~INTR_EINT1_EXT2; | ||
417 | |||
418 | if (IO_GIO_BITSET0 & 0x04) | ||
419 | { | ||
420 | aic3x_switch_output(false); | ||
421 | } | ||
422 | else | ||
423 | { | ||
424 | aic3x_switch_output(true); | ||
425 | } | ||
426 | |||
427 | IO_INTC_EINT1 |= INTR_EINT1_EXT2; | ||
428 | } | ||
408 | #endif | 429 | #endif |
409 | 430 | ||
410 | void button_init_device(void) | 431 | void button_init_device(void) |
@@ -425,12 +446,13 @@ void button_init_device(void) | |||
425 | avr_hid_get_state(); | 446 | avr_hid_get_state(); |
426 | 447 | ||
427 | #ifndef BOOTLOADER | 448 | #ifndef BOOTLOADER |
428 | IO_GIO_IRQPORT |= 0x01; /* Enable GIO0 external interrupt */ | 449 | IO_GIO_IRQPORT |= 0x05; /* Enable GIO0/GIO2 external interrupt */ |
429 | IO_GIO_INV0 &= ~0x01; /* Clear INV for GIO0 (falling edge detection) */ | 450 | IO_GIO_INV0 &= ~0x05; /* Clear INV for GIO0/GIO2 */ |
430 | IO_GIO_IRQEDGE &= ~0x01; /* Set edge detection (falling) */ | 451 | /* falling edge detection on GIO0, any edge on GIO2 */ |
452 | IO_GIO_IRQEDGE = (IO_GIO_IRQEDGE & ~0x01) | 0x04; | ||
431 | 453 | ||
432 | /* Enable GIO0 interrupt */ | 454 | /* Enable GIO0 and GIO2 interrupts */ |
433 | IO_INTC_EINT1 |= INTR_EINT1_EXT0; | 455 | IO_INTC_EINT1 |= INTR_EINT1_EXT0 | INTR_EINT1_EXT2; |
434 | #endif | 456 | #endif |
435 | } | 457 | } |
436 | 458 | ||
diff --git a/firmware/target/arm/tms320dm320/sansa-connect/power-sansaconnect.c b/firmware/target/arm/tms320dm320/sansa-connect/power-sansaconnect.c index 07c80a07c3..f73df98641 100644 --- a/firmware/target/arm/tms320dm320/sansa-connect/power-sansaconnect.c +++ b/firmware/target/arm/tms320dm320/sansa-connect/power-sansaconnect.c | |||
@@ -49,6 +49,9 @@ static void tps65021_write_reg(unsigned reg, unsigned value) | |||
49 | 49 | ||
50 | void power_init(void) | 50 | void power_init(void) |
51 | { | 51 | { |
52 | /* Enable LDO */ | ||
53 | tps65021_write_reg(0x03, 0xFD); | ||
54 | |||
52 | /* PWM mode */ | 55 | /* PWM mode */ |
53 | tps65021_write_reg(0x04, 0xB2); | 56 | tps65021_write_reg(0x04, 0xB2); |
54 | 57 | ||
@@ -61,6 +64,9 @@ void power_init(void) | |||
61 | 64 | ||
62 | void power_off(void) | 65 | void power_off(void) |
63 | { | 66 | { |
67 | /* Disable GIO0 and GIO2 interrupts */ | ||
68 | IO_INTC_EINT1 &= ~(INTR_EINT1_EXT2 | INTR_EINT1_EXT0); | ||
69 | |||
64 | avr_hid_reset_codec(); | 70 | avr_hid_reset_codec(); |
65 | avr_hid_power_off(); | 71 | avr_hid_power_off(); |
66 | } | 72 | } |