From bcca1114383c2147e60e73825ec68403c90bea40 Mon Sep 17 00:00:00 2001 From: Szymon Dziok Date: Sat, 8 Nov 2014 21:12:24 +0100 Subject: HDD1630/HDD6330/SA9200: Integration of the clicker with the "Keyclick" menu. Change-Id: Ieb26f2252c1f2613cc9bd83c8349f49113f46d87 --- firmware/SOURCES | 2 + firmware/export/config/gogearhdd1630.h | 2 + firmware/export/config/gogearhdd6330.h | 2 + firmware/export/config/gogearsa9200.h | 2 + .../target/arm/philips/hdd1630/button-hdd1630.c | 20 +------ .../target/arm/philips/hdd6330/button-hdd6330.c | 18 ------ firmware/target/arm/philips/piezo.c | 67 ++++++++++++++++++++++ firmware/target/arm/philips/piezo.h | 23 ++++++++ firmware/target/arm/philips/sa9200/button-sa9200.c | 17 ------ 9 files changed, 99 insertions(+), 54 deletions(-) create mode 100644 firmware/target/arm/philips/piezo.c create mode 100644 firmware/target/arm/philips/piezo.h diff --git a/firmware/SOURCES b/firmware/SOURCES index 950e4f2bcf..cf8a59bd00 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES @@ -944,6 +944,7 @@ target/arm/sandisk/sansa-view/powermgmt-view.c #ifdef PHILIPS_SA9200 #ifndef BOOTLOADER drivers/synaptics-mep.c +target/arm/philips/piezo.c #endif /* BOOTLOADER */ target/arm/philips/sa9200/backlight-sa9200.c target/arm/philips/sa9200/button-sa9200.c @@ -956,6 +957,7 @@ target/arm/philips/sa9200/powermgmt-sa9200.c #if defined(PHILIPS_HDD1630) || defined(PHILIPS_HDD6330) #ifndef BOOTLOADER drivers/synaptics-mep.c +target/arm/philips/piezo.c #endif /* BOOTLOADER */ target/arm/philips/power-hdd.c target/arm/philips/fmradio_i2c-hdd.c diff --git a/firmware/export/config/gogearhdd1630.h b/firmware/export/config/gogearhdd1630.h index f36526172f..e1e0af0566 100644 --- a/firmware/export/config/gogearhdd1630.h +++ b/firmware/export/config/gogearhdd1630.h @@ -77,6 +77,8 @@ #define CONFIG_KEYPAD PHILIPS_HDD1630_PAD +#define HAVE_HARDWARE_CLICK + /* Define this to enable morse code input */ #define HAVE_MORSE_INPUT diff --git a/firmware/export/config/gogearhdd6330.h b/firmware/export/config/gogearhdd6330.h index 3e12b63177..fde8364ded 100644 --- a/firmware/export/config/gogearhdd6330.h +++ b/firmware/export/config/gogearhdd6330.h @@ -77,6 +77,8 @@ #define CONFIG_KEYPAD PHILIPS_HDD6330_PAD +#define HAVE_HARDWARE_CLICK + /* Define this to enable morse code input */ #define HAVE_MORSE_INPUT diff --git a/firmware/export/config/gogearsa9200.h b/firmware/export/config/gogearsa9200.h index c6dd67a5b7..90d5ad6938 100644 --- a/firmware/export/config/gogearsa9200.h +++ b/firmware/export/config/gogearsa9200.h @@ -60,6 +60,8 @@ #define CONFIG_KEYPAD PHILIPS_SA9200_PAD +#define HAVE_HARDWARE_CLICK + /* Define this to enable morse code input */ #define HAVE_MORSE_INPUT diff --git a/firmware/target/arm/philips/hdd1630/button-hdd1630.c b/firmware/target/arm/philips/hdd1630/button-hdd1630.c index df0f5afbed..faed6abb72 100644 --- a/firmware/target/arm/philips/hdd1630/button-hdd1630.c +++ b/firmware/target/arm/philips/hdd1630/button-hdd1630.c @@ -29,18 +29,6 @@ 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) -{ - GPO32_ENABLE |= 0x2000; - GPO32_VAL |= 0x2000; - udelay(1000); - GPO32_VAL &= ~0x2000; -} - #ifndef BOOTLOADER void button_init_device(void) { @@ -59,7 +47,7 @@ void button_int(void) int_btn = BUTTON_NONE; val = touchpad_read_device(data, 4); - + if (val == MEP_BUTTON_HEADER) { /* Buttons packet */ @@ -96,7 +84,6 @@ bool button_hold(void) */ int button_read_device(void) { - static int btn_old = BUTTON_NONE; int btn = int_btn; /* Hold */ @@ -111,11 +98,6 @@ int button_read_device(void) if (!(GPIOD_INPUT_VAL & 0x20)) btn |= BUTTON_PLAYLIST; if (!(GPIOD_INPUT_VAL & 0x40)) btn |= BUTTON_POWER; - if ((btn != btn_old) && (btn != BUTTON_NONE)) - button_click(); - - btn_old = btn; - return btn; } diff --git a/firmware/target/arm/philips/hdd6330/button-hdd6330.c b/firmware/target/arm/philips/hdd6330/button-hdd6330.c index 3f662cca4f..9e9bfd941a 100644 --- a/firmware/target/arm/philips/hdd6330/button-hdd6330.c +++ b/firmware/target/arm/philips/hdd6330/button-hdd6330.c @@ -37,18 +37,6 @@ static int scroll_repeat = BUTTON_NONE; #endif static int repeat = 0; -/* - * Generate a click sound from the player (not in headphones yet) - * TODO: integrate this with the "key click" option - */ -static void button_click(void) -{ - GPO32_ENABLE |= 0x2000; - GPO32_VAL |= 0x2000; - udelay(1000); - GPO32_VAL &= ~0x2000; -} - #ifndef BOOTLOADER void button_init_device(void) { @@ -142,7 +130,6 @@ bool button_hold(void) */ int button_read_device(void) { - static int btn_old = BUTTON_NONE; int btn = int_btn; /* Hold */ @@ -167,11 +154,6 @@ int button_read_device(void) btn = BUTTON_NONE; } - if ((btn != btn_old) && (btn != BUTTON_NONE)) - button_click(); - - btn_old = btn; - return btn; } diff --git a/firmware/target/arm/philips/piezo.c b/firmware/target/arm/philips/piezo.c new file mode 100644 index 0000000000..52c3fed2d0 --- /dev/null +++ b/firmware/target/arm/philips/piezo.c @@ -0,0 +1,67 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2014 Szymon Dziok + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#include "system.h" +#include "kernel.h" +#include "piezo.h" + +void piezo_hw_voltage_on(void) +{ +#ifndef SIMULATOR + +#if defined(PHILIPS_SA9200) + GPIOF_ENABLE |= 0x08; + GPIOF_OUTPUT_VAL |= 0x08; + GPIOF_OUTPUT_EN |= 0x08; +#else + GPO32_ENABLE |= 0x2000; + GPO32_VAL |= 0x2000; +#endif /* PHILIPS_SA9200 */ + +#endif +} + +void piezo_hw_voltage_off(void) +{ +#ifndef SIMULATOR + +#if defined(PHILIPS_SA9200) + GPIOF_OUTPUT_VAL &= ~0x08; +#else + GPO32_VAL &= ~0x2000; +#endif /* PHILIPS_SA9200 */ + +#endif +} + +void piezo_init(void) +{ +} + +void piezo_button_beep(bool beep, bool force) +{ + /* hw can only do a click */ + (void)beep; + (void)force; + piezo_hw_voltage_on(); + udelay(1000); + piezo_hw_voltage_off(); +} diff --git a/firmware/target/arm/philips/piezo.h b/firmware/target/arm/philips/piezo.h new file mode 100644 index 0000000000..730042c4f3 --- /dev/null +++ b/firmware/target/arm/philips/piezo.h @@ -0,0 +1,23 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2014 Szymon Dziok + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +void piezo_init(void); +void piezo_button_beep(bool beep, bool force); diff --git a/firmware/target/arm/philips/sa9200/button-sa9200.c b/firmware/target/arm/philips/sa9200/button-sa9200.c index c02d1088dc..bef5be7522 100644 --- a/firmware/target/arm/philips/sa9200/button-sa9200.c +++ b/firmware/target/arm/philips/sa9200/button-sa9200.c @@ -29,19 +29,6 @@ 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; @@ -148,7 +135,6 @@ 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); @@ -168,9 +154,6 @@ 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; } -- cgit v1.2.3