nwz{e360,e370}: switch to new button driver

Change-Id: Iad08653f6cdbcfd75d3130186f91ed0b49a04ac9
This commit is contained in:
Amaury Pouly 2014-02-22 20:34:39 +01:00
parent a2bfbe9ebc
commit 8660393c9f
3 changed files with 21 additions and 33 deletions

View file

@ -1229,7 +1229,6 @@ target/arm/imx233/creative-zenxfi3/powermgmt-zenxfi3.c
#endif
#if defined(SONY_NWZE360) || defined(SONY_NWZE370)
target/arm/imx233/button-lradc-imx233.c
#ifndef BOOTLOADER
target/arm/imx233/fmradio-imx233.c
#endif

View file

@ -25,40 +25,37 @@
#include "power-imx233.h"
#include "string.h"
#include "usb.h"
#include "button-lradc-imx233.h"
#include "button-imx233.h"
struct imx233_button_lradc_mapping_t imx233_button_lradc_mapping[] =
#define CHAN 0
#define I_VDDIO 0 /* index in the table */
struct imx233_button_map_t imx233_button_map[] =
{
[I_VDDIO] = IMX233_BUTTON_(VDDIO, VDDIO(3630), "vddio"), /* we need VDDIO for relative */
#ifdef SONY_NWZE360
{195, BUTTON_VOL_DOWN},
{810, BUTTON_VOL_UP},
IMX233_BUTTON(VOL_DOWN, LRADC_REL(CHAN, 180, I_VDDIO), "vol_down"),
IMX233_BUTTON(VOL_UP, LRADC_REL(CHAN, 830, I_VDDIO), "vol_up"),
#endif
{1095, BUTTON_BACK},
{1470, BUTTON_PLAY},
{1845, BUTTON_RIGHT},
{2185, BUTTON_LEFT},
{2525, BUTTON_UP},
{2870, BUTTON_DOWN},
{3400, 0},
{0, IMX233_BUTTON_LRADC_END},
IMX233_BUTTON(BACK, LRADC_REL(CHAN, 1135, I_VDDIO), "back"),
IMX233_BUTTON(PLAY, LRADC_REL(CHAN, 1536, I_VDDIO), "play"),
IMX233_BUTTON(RIGHT, LRADC_REL(CHAN, 1930, I_VDDIO), "right"),
IMX233_BUTTON(LEFT, LRADC_REL(CHAN, 2290, I_VDDIO), "left"),
IMX233_BUTTON(UP, LRADC_REL(CHAN, 2655, I_VDDIO), "up"),
IMX233_BUTTON(DOWN, LRADC_REL(CHAN, 3020, I_VDDIO), "down"),
IMX233_BUTTON(POWER, PSWITCH(3), "power"),
#ifdef HAS_BUTTON_HOLD
IMX233_BUTTON_(HOLD, GPIO(0, 9), "hold", INVERTED, PULLUP),
#endif
IMX233_BUTTON_(END, END(), "")
};
void button_init_device(void)
{
imx233_button_lradc_init();
imx233_button_init();
}
#ifdef HAS_BUTTON_HOLD
bool button_hold(void)
{
return imx233_button_lradc_hold();
}
#endif
int button_read_device(void)
{
int res = 0;
if(BF_RD(POWER_STS, PSWITCH) == 3)
res |= BUTTON_POWER;
return imx233_button_lradc_read(res);
return imx233_button_read(0);
}

View file

@ -29,17 +29,9 @@ int button_read_device(void);
bool button_debug_screen(void);
#ifdef SONY_NWZE360
// Sony NWZ-E360 has hold detect on B0P09, inverted using pullup
#define HAS_BUTTON_HOLD
#define IMX233_BUTTON_LRADC_HOLD_DET BLH_GPIO
#define BLH_GPIO_BANK 0
#define BLH_GPIO_PIN 9
#define BLH_GPIO_INVERTED
#define BLH_GPIO_PULLUP
#endif
#define IMX233_BUTTON_LRADC_CHANNEL 0
/* Main unit's buttons */
#define BUTTON_POWER 0x00000001
#define BUTTON_BACK 0x00000002