aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/brcm2708/patches-4.4/0086-tpa6130a2-Add-headphone-switch-control.patch
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2016-01-17 10:42:23 +0000
committerFelix Fietkau <nbd@openwrt.org>2016-01-17 10:42:23 +0000
commit4224b52c3acc7203e7c2535d6806f30432dae5e3 (patch)
tree7a847d3e84dfc3608555587c3b9958474fc17d72 /target/linux/brcm2708/patches-4.4/0086-tpa6130a2-Add-headphone-switch-control.patch
parentcad399c87b7739c4b8eeb4119706860818f7d84f (diff)
downloadupstream-4224b52c3acc7203e7c2535d6806f30432dae5e3.tar.gz
upstream-4224b52c3acc7203e7c2535d6806f30432dae5e3.tar.bz2
upstream-4224b52c3acc7203e7c2535d6806f30432dae5e3.zip
brcm2708: add linux 4.4 support
- random-bcm2708 and spi-bcm2708 have been removed. - sound-soc-bcm2708-i2s has been upstreamed as sound-soc-bcm2835-i2s. Let's keep linux 4.1 for a while, since linux 4.4 appears to have some issues with multicast traffic on RPi ethernet: https://gist.github.com/Noltari/5b1cfdecce5ed4bc08fd Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> SVN-Revision: 48266
Diffstat (limited to 'target/linux/brcm2708/patches-4.4/0086-tpa6130a2-Add-headphone-switch-control.patch')
-rw-r--r--target/linux/brcm2708/patches-4.4/0086-tpa6130a2-Add-headphone-switch-control.patch91
1 files changed, 91 insertions, 0 deletions
diff --git a/target/linux/brcm2708/patches-4.4/0086-tpa6130a2-Add-headphone-switch-control.patch b/target/linux/brcm2708/patches-4.4/0086-tpa6130a2-Add-headphone-switch-control.patch
new file mode 100644
index 0000000000..5cf76f0ddb
--- /dev/null
+++ b/target/linux/brcm2708/patches-4.4/0086-tpa6130a2-Add-headphone-switch-control.patch
@@ -0,0 +1,91 @@
+From a7c37b3c36ccec8a089d576c55ad9ba1721cb0ef Mon Sep 17 00:00:00 2001
+From: Jan Grulich <jan@grulich.eu>
+Date: Mon, 24 Aug 2015 16:02:34 +0100
+Subject: [PATCH 086/127] tpa6130a2: Add headphone switch control
+
+Signed-off-by: Jan Grulich <jan@grulich.eu>
+---
+ sound/soc/codecs/tpa6130a2.c | 29 ++++++++++++++++++++++++++---
+ 1 file changed, 26 insertions(+), 3 deletions(-)
+
+--- a/sound/soc/codecs/tpa6130a2.c
++++ b/sound/soc/codecs/tpa6130a2.c
+@@ -4,6 +4,7 @@
+ * Copyright (C) Nokia Corporation
+ *
+ * Author: Peter Ujfalusi <peter.ujfalusi@ti.com>
++ * Modified: Jan Grulich <jan@grulich.eu>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+@@ -52,6 +53,8 @@ struct tpa6130a2_data {
+ enum tpa_model id;
+ };
+
++static void tpa6130a2_channel_enable(u8 channel, int enable);
++
+ static int tpa6130a2_i2c_read(int reg)
+ {
+ struct tpa6130a2_data *data;
+@@ -189,7 +192,7 @@ exit:
+ }
+
+ static int tpa6130a2_get_volsw(struct snd_kcontrol *kcontrol,
+- struct snd_ctl_elem_value *ucontrol)
++ struct snd_ctl_elem_value *ucontrol)
+ {
+ struct soc_mixer_control *mc =
+ (struct soc_mixer_control *)kcontrol->private_value;
+@@ -218,7 +221,7 @@ static int tpa6130a2_get_volsw(struct sn
+ }
+
+ static int tpa6130a2_put_volsw(struct snd_kcontrol *kcontrol,
+- struct snd_ctl_elem_value *ucontrol)
++ struct snd_ctl_elem_value *ucontrol)
+ {
+ struct soc_mixer_control *mc =
+ (struct soc_mixer_control *)kcontrol->private_value;
+@@ -255,8 +258,22 @@ static int tpa6130a2_put_volsw(struct sn
+ return 1;
+ }
+
++static int tpa6130a2_put_hp_sw(struct snd_kcontrol *kcontrol,
++ struct snd_ctl_elem_value *ucontrol)
++{
++ int enable = ucontrol->value.integer.value[0];
++ unsigned int state;
++
++ state = (tpa6130a2_read(TPA6130A2_REG_VOL_MUTE) & 0x80) == 0;
++ if (state == enable)
++ return 0; /* No change */
++
++ tpa6130a2_channel_enable(TPA6130A2_HP_EN_R | TPA6130A2_HP_EN_L, enable);
++ return 1; /* Changed */
++}
++
+ /*
+- * TPA6130 volume. From -59.5 to 4 dB with increasing step size when going
++ * TPA6130 volume. From -59.5 to +4.0 dB with increasing step size when going
+ * down in gain.
+ */
+ static const DECLARE_TLV_DB_RANGE(tpa6130_tlv,
+@@ -277,6 +294,9 @@ static const struct snd_kcontrol_new tpa
+ TPA6130A2_REG_VOL_MUTE, 0, 0x3f, 0,
+ tpa6130a2_get_volsw, tpa6130a2_put_volsw,
+ tpa6130_tlv),
++ SOC_SINGLE_EXT("TPA6130A2 Headphone Playback Switch",
++ TPA6130A2_REG_VOL_MUTE, 7, 1, 1,
++ tpa6130a2_get_volsw, tpa6130a2_put_hp_sw),
+ };
+
+ static const DECLARE_TLV_DB_RANGE(tpa6140_tlv,
+@@ -290,6 +310,9 @@ static const struct snd_kcontrol_new tpa
+ TPA6130A2_REG_VOL_MUTE, 1, 0x1f, 0,
+ tpa6130a2_get_volsw, tpa6130a2_put_volsw,
+ tpa6140_tlv),
++ SOC_SINGLE_EXT("TPA6140A2 Headphone Playback Switch",
++ TPA6130A2_REG_VOL_MUTE, 7, 1, 1,
++ tpa6130a2_get_volsw, tpa6130a2_put_hp_sw),
+ };
+
+ /*