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>
This commit is contained in:
Bhalchandra Gajare 2015-12-23 17:44:16 -08:00 committed by David Keitel
parent ccac8bdb00
commit b5f150167a
3 changed files with 27 additions and 2 deletions

View file

@ -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.

View file

@ -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);

View file

@ -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;
};