summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBhalchandra Gajare <gajare@codeaurora.org>2015-12-23 17:44:16 -0800
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-23 21:16:35 -0700
commitb5f150167a6424df04cc41d4d16a8a2418571562 (patch)
tree0532fff2547d81d6f0fc7041522a44334c4507c7
parentccac8bdb0049dd8d93e37a562c238ad2189febec (diff)
mfd: wcd9xxx: Make DMIC clock drive strength platform dependent
Digital microphone clock drive strength setting in the codec could be platform dependent based on the type of microphone, etc. Add support to make the DMIC clock drive strength configurable through device tree. CRs-fixed: 938006 Change-Id: I8b17d985052098b56d012081a77b6dfc94553eca Signed-off-by: Bhalchandra Gajare <gajare@codeaurora.org>
-rwxr-xr-xDocumentation/devicetree/bindings/sound/taiko_codec.txt6
-rw-r--r--drivers/mfd/wcd9xxx-core.c18
-rwxr-xr-xinclude/linux/mfd/wcd9xxx/pdata.h5
3 files changed, 27 insertions, 2 deletions
diff --git a/Documentation/devicetree/bindings/sound/taiko_codec.txt b/Documentation/devicetree/bindings/sound/taiko_codec.txt
index 1e1a9157c90e..0b38ba2b7b95 100755
--- a/Documentation/devicetree/bindings/sound/taiko_codec.txt
+++ b/Documentation/devicetree/bindings/sound/taiko_codec.txt
@@ -88,6 +88,12 @@ Optional properties:
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
+ choose default value for particular codec if this
+ value is not specified in device tree.
+
- qcom,cdc-on-demand-supplies: List of supplies which can be enabled
dynamically.
Supplies in this list are off by default.
diff --git a/drivers/mfd/wcd9xxx-core.c b/drivers/mfd/wcd9xxx-core.c
index 7a1fd306a7b0..c2ee8979e50a 100644
--- a/drivers/mfd/wcd9xxx-core.c
+++ b/drivers/mfd/wcd9xxx-core.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2015, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2016, 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
@@ -2584,6 +2584,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 dmic_clk_drive;
const char *static_prop_name = "qcom,cdc-static-supplies";
const char *ond_prop_name = "qcom,cdc-on-demand-supplies";
const char *cp_supplies_name = "qcom,cdc-cp-supplies";
@@ -2703,6 +2704,21 @@ static struct wcd9xxx_pdata *wcd9xxx_populate_dt_pdata(struct device *dev)
pdata->mclk_rate,
"mad_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",
+ &dmic_clk_drive);
+ if (ret)
+ dev_err(dev, "Looking up %s property in node %s failed, err = %d",
+ "qcom,cdc-dmic-clk-drv-strength",
+ dev->of_node->full_name, ret);
+ else if (dmic_clk_drive != 2 && dmic_clk_drive != 4 &&
+ dmic_clk_drive != 8 && dmic_clk_drive != 16)
+ dev_err(dev, "Invalid cdc-dmic-clk-drv-strength %d\n",
+ dmic_clk_drive);
+ else
+ pdata->dmic_clk_drv = dmic_clk_drive;
+
ret = of_property_read_string(dev->of_node,
"qcom,cdc-variant",
&cdc_name);
diff --git a/include/linux/mfd/wcd9xxx/pdata.h b/include/linux/mfd/wcd9xxx/pdata.h
index 9c3508f79245..7dc7d42013fb 100755
--- a/include/linux/mfd/wcd9xxx/pdata.h
+++ b/include/linux/mfd/wcd9xxx/pdata.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2015, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2016, 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
@@ -87,6 +87,8 @@
#define WCD9XXX_DMIC_SAMPLE_RATE_UNDEFINED 0
+#define WCD9XXX_DMIC_CLK_DRIVE_UNDEFINED 0
+
struct wcd9xxx_amic {
/*legacy mode, txfe_enable and txfe_buff take 7 input
* each bit represent the channel / TXFE number
@@ -184,6 +186,7 @@ struct wcd9xxx_pdata {
u32 mclk_rate;
u32 dmic_sample_rate;
u32 mad_dmic_sample_rate;
+ u32 dmic_clk_drv;
enum codec_variant cdc_variant;
u16 use_pinctrl;
};