aboutsummaryrefslogtreecommitdiff
path: root/sound/soc/codecs/rt5651.h
diff options
context:
space:
mode:
authorGravatar Hans de Goede <hdegoede@redhat.com> 2018-03-04 15:35:53 +0100
committerGravatar Mark Brown <broonie@kernel.org> 2018-03-07 12:49:21 +0000
commite6eb0207597afa1cdd4914a17a727b101cc859ff (patch)
tree183dae6ce9083cbdc88b5015f5f0a78d7e4bf2ea /sound/soc/codecs/rt5651.h
parentASoC: rt5651: Allow specifying over-current threshold through a device-property (diff)
downloadlinux-e6eb0207597afa1cdd4914a17a727b101cc859ff.tar.gz
linux-e6eb0207597afa1cdd4914a17a727b101cc859ff.tar.bz2
linux-e6eb0207597afa1cdd4914a17a727b101cc859ff.zip
ASoC: rt5651: Allow specifying the OVCD scale-factor through a device-property
OVer-Current-Detection (OVCD) for the micbias current is used to detect if an inserted jack is a headset or headphones (mic shorted to ground). The threshold for at which current the OVCD triggers on the rt5651 is not only controlled by setting the absolute current limit, but also by setting a scale factor which applies to the limit. Testing has shown that we need to set both (depending on the board). This commit adds support for the sofar unused OVCD scale-factor register and adds support for specifying non-default values for it through the "realtek,over-current-scale-factor" device-property. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/codecs/rt5651.h')
-rw-r--r--sound/soc/codecs/rt5651.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/sound/soc/codecs/rt5651.h b/sound/soc/codecs/rt5651.h
index 9cd5c279d0d6..71738ab93fb9 100644
--- a/sound/soc/codecs/rt5651.h
+++ b/sound/soc/codecs/rt5651.h
@@ -138,6 +138,7 @@
/* Index of Codec Private Register definition */
#define RT5651_BIAS_CUR1 0x12
#define RT5651_BIAS_CUR3 0x14
+#define RT5651_BIAS_CUR4 0x15
#define RT5651_CLSD_INT_REG1 0x1c
#define RT5651_CHPUMP_INT_REG1 0x24
#define RT5651_MAMP_INT_REG2 0x37
@@ -1966,6 +1967,15 @@
#define RT5651_D_GATE_EN_SFT 0
/* Codec Private Register definition */
+
+/* MIC Over current threshold scale factor (0x15) */
+#define RT5651_MIC_OVCD_SF_MASK (0x3 << 8)
+#define RT5651_MIC_OVCD_SF_SFT 8
+#define RT5651_MIC_OVCD_SF_0P5 (0x0 << 8)
+#define RT5651_MIC_OVCD_SF_0P75 (0x1 << 8)
+#define RT5651_MIC_OVCD_SF_1P0 (0x2 << 8)
+#define RT5651_MIC_OVCD_SF_1P5 (0x3 << 8)
+
/* 3D Speaker Control (0x63) */
#define RT5651_3D_SPK_MASK (0x1 << 15)
#define RT5651_3D_SPK_SFT 15
@@ -2065,6 +2075,7 @@ struct rt5651_priv {
struct delayed_work jack_detect_work;
enum rt5651_jd_src jd_src;
unsigned int ovcd_th;
+ unsigned int ovcd_sf;
int irq;
int sysclk;