]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
ASoC: cs42l42: make HSBIAS_SENSE_EN optional
authorVitaly Rodionov <vitalyr@opensource.cirrus.com>
Tue, 11 May 2021 14:52:20 +0000 (15:52 +0100)
committerMark Brown <broonie@kernel.org>
Wed, 12 May 2021 12:02:53 +0000 (13:02 +0100)
HSBIAS_SENSE_EN configures HSBIAS output current sense through
the external 2.21-k resistor. HSBIAS_SENSE is hardware feature to reduce
the potential pop noise during the headset plug out slowly. But on some
platforms ESD voltage will affect it causing test to fail, especially
with CTIA headset type. For different hardware setups, a designer might
want to tweak default behavior.

Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20210511145220.125760-1-vitalyr@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Documentation/devicetree/bindings/sound/cs42l42.txt
sound/soc/codecs/cs42l42.c
sound/soc/codecs/cs42l42.h

index 7dfaa2ab906fbd520680051097a8af3ebe53270e..5d416fdaf02343a0cb43533bf903742e685a5d3a 100644 (file)
@@ -81,6 +81,13 @@ Optional properties:
   < x1 x2 x3 x4 >
   Default = < 15 8 4 1>
 
+  - cirrus,hs-bias-sense-disable: This is boolean property. If present the
+  HSBIAS sense is disabled. Configures HSBIAS output current sense through
+  the external 2.21-k resistor. HSBIAS_SENSE is hardware feature to reduce
+  the potential pop noise during the headset plug out slowly. But on some
+  platforms ESD voltage will affect it causing test to fail, especially
+  with CTIA headset type. For different hardware setups, a designer might
+  want to tweak default behavior.
 
 Example:
 
index d7fb6b38fd7c3ff5cacc952c70e6b29b743383c9..5087c5b781f8c5ba9d4081cce84928335c8557cf 100644 (file)
@@ -1033,7 +1033,7 @@ static void cs42l42_process_hs_type_detect(struct cs42l42_private *cs42l42)
                        CS42L42_AUTO_HSBIAS_HIZ_MASK |
                        CS42L42_TIP_SENSE_EN_MASK |
                        CS42L42_HSBIAS_SENSE_TRIP_MASK,
-                       (1 << CS42L42_HSBIAS_SENSE_EN_SHIFT) |
+                       (cs42l42->hs_bias_sense_en << CS42L42_HSBIAS_SENSE_EN_SHIFT) |
                        (1 << CS42L42_AUTO_HSBIAS_HIZ_SHIFT) |
                        (0 << CS42L42_TIP_SENSE_EN_SHIFT) |
                        (3 << CS42L42_HSBIAS_SENSE_TRIP_SHIFT));
@@ -1808,6 +1808,11 @@ static int cs42l42_handle_device_data(struct device *dev,
                        (cs42l42->hs_bias_ramp_rate <<
                        CS42L42_HSBIAS_RAMP_SHIFT));
 
+       if (device_property_read_bool(dev, "cirrus,hs-bias-sense-disable"))
+               cs42l42->hs_bias_sense_en = 0;
+       else
+               cs42l42->hs_bias_sense_en = 1;
+
        return 0;
 }
 
index 2e0d3836bd7e45384aecdb701fd8e5c1b808bf31..24f7be228d5f9b73de39ef8f032f63f9fdd5c106 100644 (file)
@@ -787,6 +787,7 @@ struct  cs42l42_private {
        u8 bias_thresholds[CS42L42_NUM_BIASES];
        u8 hs_bias_ramp_rate;
        u8 hs_bias_ramp_time;
+       u8 hs_bias_sense_en;
        u8 stream_use;
 };