From 6bbfb35560d440e21bdd73728d43a75b6b4de6fd Mon Sep 17 00:00:00 2001 From: Szymon Dziok Date: Sat, 26 Jul 2014 15:38:49 +0000 Subject: SA9200: Implement clicker. It's not integrated with key click option for now. Change-Id: Ib0769b02bfebe7c55eca7b7ea61df5d6dd83cdd3 --- firmware/target/arm/philips/sa9200/button-sa9200.c | 17 +++++++++++++++++ firmware/target/arm/pp/system-pp502x.c | 2 ++ 2 files changed, 19 insertions(+) (limited to 'firmware/target') diff --git a/firmware/target/arm/philips/sa9200/button-sa9200.c b/firmware/target/arm/philips/sa9200/button-sa9200.c index bef5be7522..c02d1088dc 100644 --- a/firmware/target/arm/philips/sa9200/button-sa9200.c +++ b/firmware/target/arm/philips/sa9200/button-sa9200.c @@ -29,6 +29,19 @@ static int int_btn = BUTTON_NONE; +/* + * Generate a click sound from the player (not in headphones yet) + * TODO: integrate this with the "key click" option + */ +static void button_click(void) +{ + GPIOF_ENABLE |= 0x08; + GPIOF_OUTPUT_VAL |= 0x08; + GPIOF_OUTPUT_EN |= 0x08; + udelay(1000); + GPIOF_OUTPUT_VAL &= ~0x08; +} + #ifndef BOOTLOADER static bool hold_button_old = false; @@ -135,6 +148,7 @@ bool button_hold(void) */ int button_read_device(void) { + static int btn_old = BUTTON_NONE; int btn = int_btn; bool hold = !(GPIOL_INPUT_VAL & 0x40); @@ -154,6 +168,9 @@ int button_read_device(void) if (!(GPIOF_INPUT_VAL & 0x10)) btn |= BUTTON_VOL_UP; if (!(GPIOF_INPUT_VAL & 0x04)) btn |= BUTTON_VOL_DOWN; + if ((btn != btn_old) && (btn != BUTTON_NONE)) button_click(); + btn_old = btn; + return btn; } diff --git a/firmware/target/arm/pp/system-pp502x.c b/firmware/target/arm/pp/system-pp502x.c index af2e6d7761..697b52cf51 100644 --- a/firmware/target/arm/pp/system-pp502x.c +++ b/firmware/target/arm/pp/system-pp502x.c @@ -489,6 +489,8 @@ void system_init(void) DEV_RS = 0x00000000; DEV_RS2 = 0x00000000; #elif defined(PHILIPS_SA9200) + DEV_INIT1 = 0x00000000; + DEV_INIT2 = 0x40004000; /* reset all allowed devices */ DEV_RS = 0x3ffffef8; DEV_RS2 = 0xffffffff; -- cgit v1.2.3