extcon: madera: Write hpdet_init_range during probe
authorCharles Keepax <ckeepax@opensource.cirrus.com>
Fri, 2 Mar 2018 15:42:19 +0000 (15:42 +0000)
committerCosmin Tanislav <demonsingur@gmail.com>
Mon, 22 Apr 2024 17:22:28 +0000 (20:22 +0300)
Currently, hpdet_init_range is only written to the hardware in
madera_hpdet_stop and madera_hpdet_restart. Neither of these will be
called before the first headphone detect meaning that the first
headphone detect will start at the wrong range.

Change-Id: I174f20c8da3a11d3bd3a6cac124746e182858c2e
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
drivers/extcon/extcon-madera.c

index dfc1215e22d0995e9030299f28f65340563c5c56..8cf2918274b43b29255fcfa2356f7f4a22eb3f84 100644 (file)
@@ -3155,6 +3155,11 @@ static int madera_extcon_probe(struct platform_device *pdev)
                goto err_input;
        }
 
+       regmap_update_bits(madera->regmap, MADERA_HEADPHONE_DETECT_1,
+                          MADERA_HP_IMPEDANCE_RANGE_MASK,
+                          info->hpdet_init_range <<
+                          MADERA_HP_IMPEDANCE_RANGE_SHIFT);
+
        ret = madera_request_irq(madera, MADERA_IRQ_MICDET1,
                                 "MICDET", madera_micdet, info);
        if (ret) {