aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2016-01-11 08:54:39 -0500
committerMark Brown <broonie@kernel.org>2016-01-11 08:54:39 -0500
commitd5221ab6b289da82dcf73b475aaee6a3da5c4ca5 (patch)
tree4d5a9e0b928a19af5368ba6172b30a43a2b18545 /sound
parent5450487a0954f87607b14d52a71d44c147d2d0d5 (diff)
parent3ae08dc0fc805bc15c5629f9794599c1171dc571 (diff)
Merge remote-tracking branch 'asoc/topic/rt5651' into asoc-next
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/rt5651.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/sound/soc/codecs/rt5651.c b/sound/soc/codecs/rt5651.c
index 1d4031818966..7a6197042423 100644
--- a/sound/soc/codecs/rt5651.c
+++ b/sound/soc/codecs/rt5651.c
@@ -18,6 +18,7 @@
18#include <linux/regmap.h> 18#include <linux/regmap.h>
19#include <linux/platform_device.h> 19#include <linux/platform_device.h>
20#include <linux/spi/spi.h> 20#include <linux/spi/spi.h>
21#include <linux/acpi.h>
21#include <sound/core.h> 22#include <sound/core.h>
22#include <sound/pcm.h> 23#include <sound/pcm.h>
23#include <sound/pcm_params.h> 24#include <sound/pcm_params.h>
@@ -1735,12 +1736,38 @@ static const struct regmap_config rt5651_regmap = {
1735 .num_ranges = ARRAY_SIZE(rt5651_ranges), 1736 .num_ranges = ARRAY_SIZE(rt5651_ranges),
1736}; 1737};
1737 1738
1739#if defined(CONFIG_OF)
1740static const struct of_device_id rt5651_of_match[] = {
1741 { .compatible = "realtek,rt5651", },
1742 {},
1743};
1744MODULE_DEVICE_TABLE(of, rt5651_of_match);
1745#endif
1746
1747#ifdef CONFIG_ACPI
1748static const struct acpi_device_id rt5651_acpi_match[] = {
1749 { "10EC5651", 0 },
1750 { },
1751};
1752MODULE_DEVICE_TABLE(acpi, rt5651_acpi_match);
1753#endif
1754
1738static const struct i2c_device_id rt5651_i2c_id[] = { 1755static const struct i2c_device_id rt5651_i2c_id[] = {
1739 { "rt5651", 0 }, 1756 { "rt5651", 0 },
1740 { } 1757 { }
1741}; 1758};
1742MODULE_DEVICE_TABLE(i2c, rt5651_i2c_id); 1759MODULE_DEVICE_TABLE(i2c, rt5651_i2c_id);
1743 1760
1761static int rt5651_parse_dt(struct rt5651_priv *rt5651, struct device_node *np)
1762{
1763 rt5651->pdata.in2_diff = of_property_read_bool(np,
1764 "realtek,in2-differential");
1765 rt5651->pdata.dmic_en = of_property_read_bool(np,
1766 "realtek,dmic-en");
1767
1768 return 0;
1769}
1770
1744static int rt5651_i2c_probe(struct i2c_client *i2c, 1771static int rt5651_i2c_probe(struct i2c_client *i2c,
1745 const struct i2c_device_id *id) 1772 const struct i2c_device_id *id)
1746{ 1773{
@@ -1757,6 +1784,8 @@ static int rt5651_i2c_probe(struct i2c_client *i2c,
1757 1784
1758 if (pdata) 1785 if (pdata)
1759 rt5651->pdata = *pdata; 1786 rt5651->pdata = *pdata;
1787 else if (i2c->dev.of_node)
1788 rt5651_parse_dt(rt5651, i2c->dev.of_node);
1760 1789
1761 rt5651->regmap = devm_regmap_init_i2c(i2c, &rt5651_regmap); 1790 rt5651->regmap = devm_regmap_init_i2c(i2c, &rt5651_regmap);
1762 if (IS_ERR(rt5651->regmap)) { 1791 if (IS_ERR(rt5651->regmap)) {
@@ -1806,6 +1835,8 @@ static int rt5651_i2c_remove(struct i2c_client *i2c)
1806static struct i2c_driver rt5651_i2c_driver = { 1835static struct i2c_driver rt5651_i2c_driver = {
1807 .driver = { 1836 .driver = {
1808 .name = "rt5651", 1837 .name = "rt5651",
1838 .acpi_match_table = ACPI_PTR(rt5651_acpi_match),
1839 .of_match_table = of_match_ptr(rt5651_of_match),
1809 }, 1840 },
1810 .probe = rt5651_i2c_probe, 1841 .probe = rt5651_i2c_probe,
1811 .remove = rt5651_i2c_remove, 1842 .remove = rt5651_i2c_remove,