Browse Source

ASoC: wcd9xxx: Add gpio control for micbias-supply for SXR1120

SXR1120 has additional gpio for micbias supply to be
enabled. Add control for this gpio and enable it.

Change-Id: Ica4ea9765db9bd48a1f8eb010d82d2687c8abbb9
Signed-off-by: Vatsal Bucha <[email protected]>
Vatsal Bucha 6 years ago
parent
commit
8148b998ed
3 changed files with 19 additions and 1 deletions
  1. 3 1
      asoc/codecs/pdata.h
  2. 3 0
      asoc/codecs/wcd9xxx-core.c
  3. 13 0
      asoc/codecs/wcd9xxx-utils.c

+ 3 - 1
asoc/codecs/pdata.h

@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2017, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2018, The Linux Foundation. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -180,7 +180,9 @@ struct wcd9xxx_pdata {
 	int num_irqs;
 	int reset_gpio;
 	bool has_buck_vsel_gpio;
+	bool has_micb_supply_en_gpio;
 	struct device_node *buck_vsel_ctl_np;
+	struct device_node *micb_en_ctl;
 	struct device_node *wcd_rst_np;
 	struct wcd9xxx_amic amic_settings;
 	struct slim_device slimbus_slave_device;

+ 3 - 0
asoc/codecs/wcd9xxx-core.c

@@ -1289,6 +1289,9 @@ static int wcd9xxx_slim_probe(struct slim_device *slim)
 	if (pdata->has_buck_vsel_gpio)
 		msm_cdc_pinctrl_select_active_state(pdata->buck_vsel_ctl_np);
 
+	if (pdata->has_micb_supply_en_gpio)
+		msm_cdc_pinctrl_select_active_state(pdata->micb_en_ctl);
+
 	device_id = slim_get_device_id(slim);
 	if (!device_id) {
 		dev_err(&slim->dev, "%s: Error, no device id\n", __func__);

+ 13 - 0
asoc/codecs/wcd9xxx-utils.c

@@ -365,6 +365,19 @@ struct wcd9xxx_pdata *wcd9xxx_populate_dt_data(struct device *dev)
 		}
 	}
 
+	pdata->has_micb_supply_en_gpio = of_property_read_bool(dev->of_node,
+					   "qcom,has-micbias-supply-en-gpio");
+	if (pdata->has_micb_supply_en_gpio) {
+		pdata->micb_en_ctl = of_parse_phandle(dev->of_node,
+				"qcom,micbias-supply-en-gpio-node", 0);
+		if (!pdata->micb_en_ctl) {
+			dev_err(dev, "%s No entry for %s property in node %s\n",
+				__func__, "qcom,micbias-supply-en-gpio-node",
+				dev->of_node->full_name);
+			goto err_parse_dt_prop;
+		}
+	}
+
 	if (!(wcd9xxx_read_of_property_u32(dev, "qcom,cdc-mclk-clk-rate",
 					   &prop_val)))
 		pdata->mclk_rate = prop_val;