mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-09 21:22:39 -05:00
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
This commit is contained in:
parent
0e0c610df0
commit
0324bf59a8
4 changed files with 93 additions and 13 deletions
|
|
@ -30,7 +30,19 @@
|
|||
* - imx233_button_lradc_mapping: target-defined table of adc values and mapping
|
||||
* - IMX233_BUTTON_LRADC_CHANNEL: lradc channel to use
|
||||
* - IMX233_BUTTON_LRADC_HOLD_DET: define hold detection method (ignored if !HAS_BUTTON_HOLD)
|
||||
* - IMX233_BUTTON_LRADC_MODE: define the button lradc mode
|
||||
*
|
||||
* The LRADC code supports two modes of operations: VDDIO relative or absolute.
|
||||
* In the (default) absolute value mode, the LRADC channel is sampled and its value
|
||||
* is compared to the one in the imx233_button_lradc_mapping table. This is
|
||||
* appropriate when the resistor ladder is derived from a fixed voltage.
|
||||
* In the VDDIO relative mode, the values in imx233_button_lradc_mapping are
|
||||
* the values for a specific value of VDDIO which is given by
|
||||
* IMX233_BUTTON_LRADC_VDDIO. In this mode, the code will also sample VDDIO
|
||||
* and do the following comparison:
|
||||
* lradc_value <=? imx233_button_lradc_mapping[i] * vddio_ref / vddio_value
|
||||
* where vddio_ref is IMX233_BUTTON_LRADC_VDDIO.
|
||||
*
|
||||
* The available values of IMX233_BUTTON_LRADC_HOLD are:
|
||||
* - BLH_ADC: detect hold using adc
|
||||
* - BLH_EXT: target button driver implements imx233_button_lradc_hold() using
|
||||
|
|
@ -40,6 +52,10 @@
|
|||
* + BLH_GPIO_PIN: pin in bank
|
||||
* + BLH_GPIO_INVERTED: define if inverted, default is active high
|
||||
* + BLH_GPIO_PULLUP: define if pins needs pullup
|
||||
*
|
||||
* WARNING
|
||||
* There must always be entry in imx233_button_lradc_mapping whose value is the steady
|
||||
* value of the channel when no button is pressed, and which maps to no button (.btn = 0)
|
||||
*/
|
||||
|
||||
/* hold detect method */
|
||||
|
|
@ -74,5 +90,8 @@ int imx233_button_lradc_read(int others);
|
|||
bool imx233_button_lradc_hold(void);
|
||||
#endif
|
||||
int imx233_button_lradc_read_raw(void); // return raw adc value
|
||||
#ifdef IMX233_BUTTON_LRADC_VDDIO
|
||||
int imx233_button_lradc_read_vddio(void);
|
||||
#endif
|
||||
|
||||
#endif /* __button_lradc_imx233__ */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue