diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2019-01-03 20:46:54 -0500 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2019-01-04 23:52:42 +0100 |
commit | d24edc605b9b52d3610efbb9cf691c437ea00746 (patch) | |
tree | bd8e6119e4611c6ff83bd316816e0b9534d84deb /firmware/target/mips/ingenic_jz47xx/xduoo_x3 | |
parent | 100f4338deea5239423a0b8974784939d520385c (diff) | |
download | rockbox-d24edc605b9b52d3610efbb9cf691c437ea00746.tar.gz rockbox-d24edc605b9b52d3610efbb9cf691c437ea00746.zip |
Add HAVE_LINEOUT_DETECTION and associated logic
This allows targets to automatically switch audio settings when the
line out is plugged/unplugged.
Only hooked up on the xDuoo X3, but there are other potential users.
Change-Id: Ic46a329bc955cca2e2ad0335ca16295eab24ad59
Diffstat (limited to 'firmware/target/mips/ingenic_jz47xx/xduoo_x3')
-rw-r--r-- | firmware/target/mips/ingenic_jz47xx/xduoo_x3/sadc-xduoo_x3.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/firmware/target/mips/ingenic_jz47xx/xduoo_x3/sadc-xduoo_x3.c b/firmware/target/mips/ingenic_jz47xx/xduoo_x3/sadc-xduoo_x3.c index be02167a5d..d227255b8a 100644 --- a/firmware/target/mips/ingenic_jz47xx/xduoo_x3/sadc-xduoo_x3.c +++ b/firmware/target/mips/ingenic_jz47xx/xduoo_x3/sadc-xduoo_x3.c | |||
@@ -53,6 +53,13 @@ bool headphones_inserted(void) | |||
53 | return (__gpio_get_pin(PIN_PH_DECT) != 0); | 53 | return (__gpio_get_pin(PIN_PH_DECT) != 0); |
54 | } | 54 | } |
55 | 55 | ||
56 | bool lineout_inserted(void) | ||
57 | { | ||
58 | /* We want to prevent LO being "enabled" if HP is attached | ||
59 | to avoid potential eardrum damage */ | ||
60 | return (__gpio_get_pin(PIN_LO_DECT) == 0) && !headphones_inserted(); | ||
61 | } | ||
62 | |||
56 | void button_init_device(void) | 63 | void button_init_device(void) |
57 | { | 64 | { |
58 | key_val = 0xfff; | 65 | key_val = 0xfff; |
@@ -72,11 +79,11 @@ void button_init_device(void) | |||
72 | __gpio_set_pin(PIN_CHARGE_CON); /* 0.7 A */ | 79 | __gpio_set_pin(PIN_CHARGE_CON); /* 0.7 A */ |
73 | __gpio_as_output(PIN_CHARGE_CON); | 80 | __gpio_as_output(PIN_CHARGE_CON); |
74 | 81 | ||
75 | __gpio_as_input(PIN_LO_DECT); | ||
76 | __gpio_as_input(PIN_PH_DECT); | 82 | __gpio_as_input(PIN_PH_DECT); |
83 | __gpio_disable_pull(PIN_PH_DECT); | ||
77 | 84 | ||
85 | __gpio_as_input(PIN_LO_DECT); | ||
78 | __gpio_disable_pull(PIN_LO_DECT); | 86 | __gpio_disable_pull(PIN_LO_DECT); |
79 | __gpio_disable_pull(PIN_PH_DECT); | ||
80 | } | 87 | } |
81 | 88 | ||
82 | bool button_hold(void) | 89 | bool button_hold(void) |