From: Ben Zhang <benzh@chromium.org>
To: alsa-devel@alsa-project.org
Cc: Mark Brown <broonie@kernel.org>,
Liam Girdwood <lgirdwood@gmail.com>,
Bard Liao <bardliao@realtek.com>,
Oder Chiou <oder_chiou@realtek.com>,
Anatol Pomozov <anatol@google.com>,
Dylan Reid <dgreid@chromium.org>,
flove@realtek.com, linux-kernel@vger.kernel.org,
Ben Zhang <benzh@chromium.org>
Subject: [PATCH 2/2] ASoC: rt5677: add a platform config option for PDM clock divider
Date: Fri, 14 Nov 2014 22:56:48 -0800 [thread overview]
Message-ID: <1416034608-24238-2-git-send-email-benzh@chromium.org> (raw)
In-Reply-To: <1416034608-24238-1-git-send-email-benzh@chromium.org>
The PDM output clock can use a divider of 1/2/3/4 based on the system clock
Signed-off-by: Ben Zhang <benzh@chromium.org>
---
Documentation/devicetree/bindings/sound/rt5677.txt | 5 +++++
include/sound/rt5677.h | 8 ++++++++
sound/soc/codecs/rt5677.c | 7 +++++++
3 files changed, 20 insertions(+)
diff --git a/Documentation/devicetree/bindings/sound/rt5677.txt b/Documentation/devicetree/bindings/sound/rt5677.txt
index 740ff77..141f3e1 100644
--- a/Documentation/devicetree/bindings/sound/rt5677.txt
+++ b/Documentation/devicetree/bindings/sound/rt5677.txt
@@ -27,6 +27,10 @@ Optional properties:
Boolean. Indicate MIC1/2 input and LOUT1/2/3 outputs are differential,
rather than single-ended.
+- realtek,pdm_clk_div
+ Select 0/1/2/3 as PDM clock divider 1/2/4/3 respectively.
+ PDM clock = system clock / PDM clock divider
+
- realtek,gpio-config
Array of six 8bit elements that configures GPIO.
0 - floating (reset value)
@@ -71,6 +75,7 @@ rt5677 {
realtek,pow-ldo2-gpio =
<&gpio TEGRA_GPIO(V, 3) GPIO_ACTIVE_HIGH>;
realtek,in1-differential = "true";
+ realtek,pdm_clk_div = <1> /* PDM clock = system clock / 2 */
realtek,gpio-config = /bits/ 8 <0 0 0 0 0 2>; /* pull up GPIO6 */
realtek,jd2-gpio = <3>; /* Enables Jack detection for GPIO6 */
};
diff --git a/include/sound/rt5677.h b/include/sound/rt5677.h
index d9eb7d8..368aa33 100644
--- a/include/sound/rt5677.h
+++ b/include/sound/rt5677.h
@@ -17,6 +17,12 @@ enum rt5677_dmic2_clk {
RT5677_DMIC_CLK2 = 1,
};
+enum rt5677_pdm_clk_div {
+ RT5677_PDM_CLK_DIV1 = 0,
+ RT5677_PDM_CLK_DIV2 = 1,
+ RT5677_PDM_CLK_DIV4 = 2,
+ RT5677_PDM_CLK_DIV3 = 3,
+};
struct rt5677_platform_data {
/* IN1/IN2/LOUT1/LOUT2/LOUT3 can optionally be differential */
@@ -27,6 +33,8 @@ struct rt5677_platform_data {
bool lout3_diff;
/* DMIC2 clock source selection */
enum rt5677_dmic2_clk dmic2_clk_pin;
+ /* System clock to PDM filter divider */
+ enum rt5677_pdm_clk_div pdm_clk_div;
/* configures GPIO, 0 - floating, 1 - pulldown, 2 - pullup */
u8 gpio_config[6];
diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c
index 384281d..383cb61 100644
--- a/sound/soc/codecs/rt5677.c
+++ b/sound/soc/codecs/rt5677.c
@@ -4502,6 +4502,8 @@ static int rt5677_parse_dt(struct rt5677_priv *rt5677, struct device_node *np)
"realtek,lout2-differential");
rt5677->pdata.lout3_diff = of_property_read_bool(np,
"realtek,lout3-differential");
+ of_property_read_u32(np, "realtek,pdm_clk_div",
+ &rt5677->pdata.pdm_clk_div);
rt5677->pow_ldo2 = of_get_named_gpio(np,
"realtek,pow-ldo2-gpio", 0);
@@ -4548,6 +4550,8 @@ static void rt5677_parse_acpi(struct rt5677_priv *rt5677, struct device *dev)
{
rt5677->pdata.dmic2_clk_pin = (enum rt5677_dmic2_clk)
rt5677_parse_acpi_entry(dev, "DCLK");
+ rt5677->pdata.pdm_clk_div = (enum rt5677_pdm_clk_div)
+ rt5677_parse_acpi_entry(dev, "PCLK");
rt5677->pdata.in1_diff = (bool)rt5677_parse_acpi_entry(dev, "IN1");
rt5677->pdata.in2_diff = (bool)rt5677_parse_acpi_entry(dev, "IN2");
rt5677->pdata.lout1_diff = (bool)rt5677_parse_acpi_entry(dev, "OUT1");
@@ -4730,6 +4734,9 @@ static int rt5677_i2c_probe(struct i2c_client *i2c,
RT5677_GPIO5_DIR_OUT);
}
+ regmap_update_bits(rt5677->regmap, RT5677_PDM_DATA_CTRL1,
+ RT5677_PDM_DIV_MASK, rt5677->pdata.pdm_clk_div);
+
rt5677_init_gpio(i2c);
rt5677_irq_init(i2c);
--
2.1.0.rc2.206.gedb03e5
next prev parent reply other threads:[~2014-11-15 6:56 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-15 6:56 [PATCH 1/2] ASoC: rt5677: Add ACPI device probing Ben Zhang
2014-11-15 6:56 ` Ben Zhang [this message]
2014-11-25 12:07 ` Mark Brown
2014-11-25 12:11 ` Grant Likely
2014-11-25 14:28 ` Liam Girdwood
2014-11-25 16:01 ` [alsa-devel] " Darren Hart
2014-11-25 18:37 ` Liam Girdwood
2014-11-25 16:00 ` Darren Hart
2014-11-25 17:21 ` Mark Brown
2014-11-25 18:33 ` Darren Hart
2014-11-25 18:43 ` Mark Brown
2014-11-25 19:07 ` Darren Hart
2014-11-25 19:36 ` Mark Brown
2014-11-25 20:32 ` Rafael J. Wysocki
2014-11-25 20:31 ` Rafael J. Wysocki
2014-11-25 20:27 ` Mark Brown
2014-11-25 21:40 ` Rafael J. Wysocki
2014-11-25 22:15 ` Mark Brown
2014-11-25 22:41 ` Ben Zhang
2014-11-25 22:45 ` Mark Brown
2014-12-04 10:48 ` Grant Likely
2014-12-04 16:46 ` Mark Brown
2014-12-04 21:53 ` Rafael J. Wysocki
2014-11-26 1:48 ` Darren Hart
2014-11-26 11:17 ` Mark Brown
2014-11-26 23:09 ` Rafael J. Wysocki
2014-11-28 16:00 ` Mark Brown
2014-11-28 23:51 ` Rafael J. Wysocki
2014-11-29 11:52 ` Mark Brown
2014-11-29 22:27 ` Rafael J. Wysocki
2014-12-01 17:51 ` Mark Brown
2014-12-01 22:16 ` Rafael J. Wysocki
2014-12-01 22:19 ` Mark Brown
2014-12-01 22:55 ` Rafael J. Wysocki
2014-12-04 11:12 ` Grant Likely
2014-12-04 11:51 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1416034608-24238-2-git-send-email-benzh@chromium.org \
--to=benzh@chromium.org \
--cc=alsa-devel@alsa-project.org \
--cc=anatol@google.com \
--cc=bardliao@realtek.com \
--cc=broonie@kernel.org \
--cc=dgreid@chromium.org \
--cc=flove@realtek.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=oder_chiou@realtek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).