Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 00e8fad3 authored by Sudheer Papothi's avatar Sudheer Papothi Committed by Gerrit - the friendly Code Review server
Browse files

drivers: mfd: wcd9xxx: Add support to configure dmic clock



DMIC clock on ECPP(Echo Cancellation Ping-Pong) path can be set to
lower clock rate to avoid power consumption. Change configures the
DMIC clock rate on ECPP path based on device tree settings.

CRs-fixed: 1022917
Change-Id: I03e1a7f5ef3cf1b1907c03a3d38965ce3a611bc4
Signed-off-by: default avatarSudheer Papothi <spapothi@codeaurora.org>
Signed-off-by: default avatarVidyakumar Athota <vathota@codeaurora.org>
parent ed5efd09
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -93,6 +93,14 @@ Optional properties:
			   involving DMIC will use the rate defined by
			   cdc-dmic-sample-rate.

 - qcom,cdc-ecpp-dmic-rate: Specifies the sample rate of digital mic in HZ to be
			   used by ECPP (Echo Cancellation Ping Pong) block
			   on the codec. The valid set of values are same
			   as that of cdc-dmic-sample-rate, but this rate will
			   only be used by ECPP and all other audio use cases
			   involving DMIC will use the rate defined by
			   cdc-dmic-sample-rate.

 - qcom,cdc-dmic-clk-drv-strength: Specifies the drive strength for digital microphone
				   clock in the codec. Accepted values are 2,4,8 and 16.
				   The clock drive strentgh is in uA. Codec driver will
+17 −0
Original line number Diff line number Diff line
@@ -2645,6 +2645,7 @@ static u32 wcd9xxx_validate_dmic_sample_rate(struct device *dev,
	case 2:
	case 3:
	case 4:
	case 8:
	case 16:
		/* Valid dmic DIV factors */
		dev_dbg(dev,
@@ -2680,6 +2681,7 @@ static struct wcd9xxx_pdata *wcd9xxx_populate_dt_pdata(struct device *dev)
	u32 mclk_rate = 0;
	u32 dmic_sample_rate = 0;
	u32 mad_dmic_sample_rate = 0;
	u32 ecpp_dmic_sample_rate = 0;
	u32 dmic_clk_drive;
	const char *static_prop_name = "qcom,cdc-static-supplies";
	const char *ond_prop_name = "qcom,cdc-on-demand-supplies";
@@ -2804,6 +2806,21 @@ static struct wcd9xxx_pdata *wcd9xxx_populate_dt_pdata(struct device *dev)
						  pdata->mclk_rate,
						  "mad_dmic_rate");

	ret = of_property_read_u32(dev->of_node,
				"qcom,cdc-ecpp-dmic-rate",
				&ecpp_dmic_sample_rate);
	if (ret) {
		dev_err(dev, "Looking up %s property in node %s failed, err = %d",
			"qcom,cdc-ecpp-dmic-rate",
			dev->of_node->full_name, ret);
		ecpp_dmic_sample_rate = WCD9XXX_DMIC_SAMPLE_RATE_UNDEFINED;
	}
	pdata->ecpp_dmic_sample_rate =
		wcd9xxx_validate_dmic_sample_rate(dev,
						  ecpp_dmic_sample_rate,
						  pdata->mclk_rate,
						  "ecpp_dmic_rate");

	pdata->dmic_clk_drv = WCD9XXX_DMIC_CLK_DRIVE_UNDEFINED;
	ret = of_property_read_u32(dev->of_node,
				   "qcom,cdc-dmic-clk-drv-strength",
+1 −0
Original line number Diff line number Diff line
@@ -187,6 +187,7 @@ struct wcd9xxx_pdata {
	u32 mclk_rate;
	u32 dmic_sample_rate;
	u32 mad_dmic_sample_rate;
	u32 ecpp_dmic_sample_rate;
	u32 dmic_clk_drv;
	enum codec_variant cdc_variant;
	u16 use_pinctrl;