Merge pull request #1677 from brooksytech/dev
Finish up RK3399 jack sense
This commit is contained in:
commit
41c4eeb021
3 changed files with 22 additions and 15 deletions
|
@ -7,8 +7,8 @@ cat <<EOF >/storage/.config/profile.d/001-deviceconfig
|
||||||
DEVICE_FAKE_JACKSENSE=true
|
DEVICE_FAKE_JACKSENSE=true
|
||||||
DEVICE_VOLUMECTL=true
|
DEVICE_VOLUMECTL=true
|
||||||
DEVICE_AUDIO_MIXER="DAC"
|
DEVICE_AUDIO_MIXER="DAC"
|
||||||
DEVICE_PLAYBACK_PATH_SPK="0*"
|
DEVICE_PLAYBACK_PATH_SPK="1*"
|
||||||
DEVICE_PLAYBACK_PATH_HP="1*"
|
DEVICE_PLAYBACK_PATH_HP="0*"
|
||||||
DEVICE_BRIGHTNESS="128"
|
DEVICE_BRIGHTNESS="128"
|
||||||
DEVICE_JACK="8"
|
DEVICE_JACK="8"
|
||||||
DEVICE_HEADPHONE_DEV="/dev/input/by-path/platform-es8316-sound-event"
|
DEVICE_HEADPHONE_DEV="/dev/input/by-path/platform-es8316-sound-event"
|
||||||
|
|
|
@ -80,7 +80,7 @@ state.rockchipes8316c {
|
||||||
control.4 {
|
control.4 {
|
||||||
iface MIXER
|
iface MIXER
|
||||||
name 'Playback Polarity'
|
name 'Playback Polarity'
|
||||||
value 'R Invert'
|
value Normal
|
||||||
comment {
|
comment {
|
||||||
access 'read write'
|
access 'read write'
|
||||||
type ENUMERATED
|
type ENUMERATED
|
||||||
|
|
|
@ -1,35 +1,42 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
# Copyright (C) 2020-present Shanti Gilbert (https://github.com/shantigilbert)
|
# Copyright (C) 2023-present BrooksyTech (https://github.com/brooksytech)
|
||||||
# Copyright (C) 2021-present Fewtarius
|
|
||||||
|
|
||||||
# Source predefined functions and variables
|
# Source predefined functions and variables
|
||||||
. /etc/profile
|
. /etc/profile
|
||||||
|
|
||||||
# Switch to headphones if we have them already connected at boot
|
# Check headphone gpio at boot and set the correct output device
|
||||||
GPIO=$(cat /sys/class/gpio/gpio${DEVICE_JACK}/value)
|
HP_GPIO=$(cat /sys/class/gpio/gpio${DEVICE_JACK}/value)
|
||||||
[[ "$GPIO" == "0" ]] && set_setting "audio.device" "headphone" || set_setting "audio.device" "speakers"
|
case ${HP_GPIO} in
|
||||||
|
"1")
|
||||||
if [ -e "/storage/.config/system/configs/system.cfg" ]; then
|
amixer cset name='Speaker Switch' ${DEVICE_PLAYBACK_PATH_HP}
|
||||||
/usr/bin/system_utils setaudio $(get_setting "audio.device")
|
amixer set 'Headphone' '67%'
|
||||||
/usr/bin/system_utils vol $(get_setting "audio.volume")
|
set_setting "audio.device" "headphone"
|
||||||
fi
|
;;
|
||||||
|
*)
|
||||||
|
amixer cset name='Speaker Switch' ${DEVICE_PLAYBACK_PATH_SPK}
|
||||||
|
amixer set 'Headphone' '100%'
|
||||||
|
set_setting "audio.device" "speakers"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
# Headphone sensing
|
# Headphone sensing
|
||||||
DEVICE="${DEVICE_HEADPHONE_DEV}"
|
DEVICE="${DEVICE_HEADPHONE_DEV}"
|
||||||
|
|
||||||
HP_ON='*(SW_HEADPHONE_INSERT), value 0*'
|
HP_OFF='*(SW_HEADPHONE_INSERT), value 0*'
|
||||||
HP_OFF='*(SW_HEADPHONE_INSERT), value 1*'
|
HP_ON='*(SW_HEADPHONE_INSERT), value 1*'
|
||||||
|
|
||||||
evtest "${DEVICE}" | while read line; do
|
evtest "${DEVICE}" | while read line; do
|
||||||
case $line in
|
case $line in
|
||||||
(${HP_ON})
|
(${HP_ON})
|
||||||
amixer cset name='Speaker Switch' ${DEVICE_PLAYBACK_PATH_HP}
|
amixer cset name='Speaker Switch' ${DEVICE_PLAYBACK_PATH_HP}
|
||||||
|
amixer set 'Headphone' '67%'
|
||||||
set_setting "audio.device" "headphone"
|
set_setting "audio.device" "headphone"
|
||||||
;;
|
;;
|
||||||
(${HP_OFF})
|
(${HP_OFF})
|
||||||
amixer cset name='Speaker Switch' ${DEVICE_PLAYBACK_PATH_SPK}
|
amixer cset name='Speaker Switch' ${DEVICE_PLAYBACK_PATH_SPK}
|
||||||
|
amixer set 'Headphone' '100%'
|
||||||
set_setting "audio.device" "speakers"
|
set_setting "audio.device" "speakers"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
Loading…
Reference in a new issue