diff options
author | Amaury Pouly <amaury.pouly@gmail.com> | 2014-02-04 00:23:35 +0100 |
---|---|---|
committer | Amaury Pouly <amaury.pouly@gmail.com> | 2014-02-10 23:14:25 +0100 |
commit | 0324bf59a8810cadf35d67f71f5ee409834ec4ee (patch) | |
tree | a636cb9b3ab6cfd6c0d3c54eb5659294799291a2 /firmware/target/arm/imx233/button-lradc-imx233.h | |
parent | 0e0c610df0d3d4044d0b21ddc1752a5dacd7f86e (diff) | |
download | rockbox-0324bf59a8810cadf35d67f71f5ee409834ec4ee.tar.gz rockbox-0324bf59a8810cadf35d67f71f5ee409834ec4ee.zip |
imx233: make button-lradc drive able to handle VDDIO derived values
In most devices, the button ladder is not actually derived from VDDIO but
from a constant voltage source, making it very easy to read it. However on
some devices like ther ZEN X-Fi Style, the ladder is wired to VDDIO we
can be changed so it's crucial that the button driver correctly scales the
values wrt VDDIO.
Change-Id: Ifc11abe2838fa7d16d0d60ecd96964a8dc5ea6d7
Diffstat (limited to 'firmware/target/arm/imx233/button-lradc-imx233.h')
-rw-r--r-- | firmware/target/arm/imx233/button-lradc-imx233.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/firmware/target/arm/imx233/button-lradc-imx233.h b/firmware/target/arm/imx233/button-lradc-imx233.h index eac5517adf..d96823fcdc 100644 --- a/firmware/target/arm/imx233/button-lradc-imx233.h +++ b/firmware/target/arm/imx233/button-lradc-imx233.h | |||
@@ -30,7 +30,19 @@ | |||
30 | * - imx233_button_lradc_mapping: target-defined table of adc values and mapping | 30 | * - imx233_button_lradc_mapping: target-defined table of adc values and mapping |
31 | * - IMX233_BUTTON_LRADC_CHANNEL: lradc channel to use | 31 | * - IMX233_BUTTON_LRADC_CHANNEL: lradc channel to use |
32 | * - IMX233_BUTTON_LRADC_HOLD_DET: define hold detection method (ignored if !HAS_BUTTON_HOLD) | 32 | * - IMX233_BUTTON_LRADC_HOLD_DET: define hold detection method (ignored if !HAS_BUTTON_HOLD) |
33 | * - IMX233_BUTTON_LRADC_MODE: define the button lradc mode | ||
33 | * | 34 | * |
35 | * The LRADC code supports two modes of operations: VDDIO relative or absolute. | ||
36 | * In the (default) absolute value mode, the LRADC channel is sampled and its value | ||
37 | * is compared to the one in the imx233_button_lradc_mapping table. This is | ||
38 | * appropriate when the resistor ladder is derived from a fixed voltage. | ||
39 | * In the VDDIO relative mode, the values in imx233_button_lradc_mapping are | ||
40 | * the values for a specific value of VDDIO which is given by | ||
41 | * IMX233_BUTTON_LRADC_VDDIO. In this mode, the code will also sample VDDIO | ||
42 | * and do the following comparison: | ||
43 | * lradc_value <=? imx233_button_lradc_mapping[i] * vddio_ref / vddio_value | ||
44 | * where vddio_ref is IMX233_BUTTON_LRADC_VDDIO. | ||
45 | * | ||
34 | * The available values of IMX233_BUTTON_LRADC_HOLD are: | 46 | * The available values of IMX233_BUTTON_LRADC_HOLD are: |
35 | * - BLH_ADC: detect hold using adc | 47 | * - BLH_ADC: detect hold using adc |
36 | * - BLH_EXT: target button driver implements imx233_button_lradc_hold() using | 48 | * - BLH_EXT: target button driver implements imx233_button_lradc_hold() using |
@@ -40,6 +52,10 @@ | |||
40 | * + BLH_GPIO_PIN: pin in bank | 52 | * + BLH_GPIO_PIN: pin in bank |
41 | * + BLH_GPIO_INVERTED: define if inverted, default is active high | 53 | * + BLH_GPIO_INVERTED: define if inverted, default is active high |
42 | * + BLH_GPIO_PULLUP: define if pins needs pullup | 54 | * + BLH_GPIO_PULLUP: define if pins needs pullup |
55 | * | ||
56 | * WARNING | ||
57 | * There must always be entry in imx233_button_lradc_mapping whose value is the steady | ||
58 | * value of the channel when no button is pressed, and which maps to no button (.btn = 0) | ||
43 | */ | 59 | */ |
44 | 60 | ||
45 | /* hold detect method */ | 61 | /* hold detect method */ |
@@ -74,5 +90,8 @@ int imx233_button_lradc_read(int others); | |||
74 | bool imx233_button_lradc_hold(void); | 90 | bool imx233_button_lradc_hold(void); |
75 | #endif | 91 | #endif |
76 | int imx233_button_lradc_read_raw(void); // return raw adc value | 92 | int imx233_button_lradc_read_raw(void); // return raw adc value |
93 | #ifdef IMX233_BUTTON_LRADC_VDDIO | ||
94 | int imx233_button_lradc_read_vddio(void); | ||
95 | #endif | ||
77 | 96 | ||
78 | #endif /* __button_lradc_imx233__ */ | 97 | #endif /* __button_lradc_imx233__ */ |