aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2017-07-18 13:34:17 -0400
committerMark Brown <broonie@kernel.org>2017-07-19 07:23:44 -0400
commitddc9e69b9dc23d4c0d8ed829575327746ea77a04 (patch)
tree5a3f1a7f0137d416b6257483ae3f81f0e52d0b25
parent5771a8c08880cdca3bfb4a3fc6d309d6bba20877 (diff)
ASoC: rt5677: Hide platform data in the module sources
There is no user of legacy platform data. Remove separate header and hide its content inside module sources. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--include/sound/rt5677.h45
-rw-r--r--sound/soc/codecs/rt5677.c29
-rw-r--r--sound/soc/codecs/rt5677.h30
3 files changed, 46 insertions, 58 deletions
diff --git a/include/sound/rt5677.h b/include/sound/rt5677.h
deleted file mode 100644
index a6207043ac3c..000000000000
--- a/include/sound/rt5677.h
+++ /dev/null
@@ -1,45 +0,0 @@
1/*
2 * linux/sound/rt5677.h -- Platform data for RT5677
3 *
4 * Copyright 2013 Realtek Semiconductor Corp.
5 * Author: Oder Chiou <oder_chiou@realtek.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef __LINUX_SND_RT5677_H
13#define __LINUX_SND_RT5677_H
14
15enum rt5677_dmic2_clk {
16 RT5677_DMIC_CLK1 = 0,
17 RT5677_DMIC_CLK2 = 1,
18};
19
20
21struct rt5677_platform_data {
22 /* IN1/IN2/LOUT1/LOUT2/LOUT3 can optionally be differential */
23 bool in1_diff;
24 bool in2_diff;
25 bool lout1_diff;
26 bool lout2_diff;
27 bool lout3_diff;
28 /* DMIC2 clock source selection */
29 enum rt5677_dmic2_clk dmic2_clk_pin;
30
31 /* configures GPIO, 0 - floating, 1 - pulldown, 2 - pullup */
32 u8 gpio_config[6];
33
34 /* jd1 can select 0 ~ 3 as OFF, GPIO1, GPIO2 and GPIO3 respectively */
35 unsigned int jd1_gpio;
36 /* jd2 and jd3 can select 0 ~ 3 as
37 OFF, GPIO4, GPIO5 and GPIO6 respectively */
38 unsigned int jd2_gpio;
39 unsigned int jd3_gpio;
40
41 /* Set MICBIAS1 VDD 1v8 or 3v3 */
42 bool micbias1_vdd_3v3;
43};
44
45#endif
diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c
index 36e530a36c82..0f9642c2198a 100644
--- a/sound/soc/codecs/rt5677.c
+++ b/sound/soc/codecs/rt5677.c
@@ -21,6 +21,7 @@
21#include <linux/platform_device.h> 21#include <linux/platform_device.h>
22#include <linux/spi/spi.h> 22#include <linux/spi/spi.h>
23#include <linux/firmware.h> 23#include <linux/firmware.h>
24#include <linux/of_device.h>
24#include <linux/property.h> 25#include <linux/property.h>
25#include <sound/core.h> 26#include <sound/core.h>
26#include <sound/pcm.h> 27#include <sound/pcm.h>
@@ -5019,25 +5020,21 @@ static const struct regmap_config rt5677_regmap = {
5019}; 5020};
5020 5021
5021static const struct i2c_device_id rt5677_i2c_id[] = { 5022static const struct i2c_device_id rt5677_i2c_id[] = {
5022 { "rt5677", RT5677 },
5023 { "rt5676", RT5676 },
5024 { } 5023 { }
5025}; 5024};
5026MODULE_DEVICE_TABLE(i2c, rt5677_i2c_id); 5025MODULE_DEVICE_TABLE(i2c, rt5677_i2c_id);
5027 5026
5028static const struct of_device_id rt5677_of_match[] = { 5027static const struct of_device_id rt5677_of_match[] = {
5029 { .compatible = "realtek,rt5677", }, 5028 { .compatible = "realtek,rt5677", RT5677 },
5030 { } 5029 { }
5031}; 5030};
5032MODULE_DEVICE_TABLE(of, rt5677_of_match); 5031MODULE_DEVICE_TABLE(of, rt5677_of_match);
5033 5032
5034#ifdef CONFIG_ACPI
5035static const struct acpi_device_id rt5677_acpi_match[] = { 5033static const struct acpi_device_id rt5677_acpi_match[] = {
5036 { "RT5677CE", RT5677 }, 5034 { "RT5677CE", RT5677 },
5037 { } 5035 { }
5038}; 5036};
5039MODULE_DEVICE_TABLE(acpi, rt5677_acpi_match); 5037MODULE_DEVICE_TABLE(acpi, rt5677_acpi_match);
5040#endif
5041 5038
5042static void rt5677_read_acpi_properties(struct rt5677_priv *rt5677, 5039static void rt5677_read_acpi_properties(struct rt5677_priv *rt5677,
5043 struct device *dev) 5040 struct device *dev)
@@ -5147,7 +5144,6 @@ static void rt5677_free_irq(struct i2c_client *i2c)
5147static int rt5677_i2c_probe(struct i2c_client *i2c, 5144static int rt5677_i2c_probe(struct i2c_client *i2c,
5148 const struct i2c_device_id *id) 5145 const struct i2c_device_id *id)
5149{ 5146{
5150 struct rt5677_platform_data *pdata = dev_get_platdata(&i2c->dev);
5151 struct rt5677_priv *rt5677; 5147 struct rt5677_priv *rt5677;
5152 int ret; 5148 int ret;
5153 unsigned int val; 5149 unsigned int val;
@@ -5159,16 +5155,25 @@ static int rt5677_i2c_probe(struct i2c_client *i2c,
5159 5155
5160 i2c_set_clientdata(i2c, rt5677); 5156 i2c_set_clientdata(i2c, rt5677);
5161 5157
5162 rt5677->type = id->driver_data; 5158 if (i2c->dev.of_node) {
5159 const struct of_device_id *match_id;
5160
5161 match_id = of_match_device(rt5677_of_match, &i2c->dev);
5162 if (match_id)
5163 rt5677->type = (enum rt5677_type)match_id->data;
5163 5164
5164 if (pdata)
5165 rt5677->pdata = *pdata;
5166 else if (i2c->dev.of_node)
5167 rt5677_read_device_properties(rt5677, &i2c->dev); 5165 rt5677_read_device_properties(rt5677, &i2c->dev);
5168 else if (ACPI_HANDLE(&i2c->dev)) 5166 } else if (ACPI_HANDLE(&i2c->dev)) {
5167 const struct acpi_device_id *acpi_id;
5168
5169 acpi_id = acpi_match_device(rt5677_acpi_match, &i2c->dev);
5170 if (acpi_id)
5171 rt5677->type = (enum rt5677_type)acpi_id->driver_data;
5172
5169 rt5677_read_acpi_properties(rt5677, &i2c->dev); 5173 rt5677_read_acpi_properties(rt5677, &i2c->dev);
5170 else 5174 } else {
5171 return -EINVAL; 5175 return -EINVAL;
5176 }
5172 5177
5173 /* pow-ldo2 and reset are optional. The codec pins may be statically 5178 /* pow-ldo2 and reset are optional. The codec pins may be statically
5174 * connected on the board without gpios. If the gpio device property 5179 * connected on the board without gpios. If the gpio device property
diff --git a/sound/soc/codecs/rt5677.h b/sound/soc/codecs/rt5677.h
index d46855a42c40..97239973edc4 100644
--- a/sound/soc/codecs/rt5677.h
+++ b/sound/soc/codecs/rt5677.h
@@ -12,7 +12,6 @@
12#ifndef __RT5677_H__ 12#ifndef __RT5677_H__
13#define __RT5677_H__ 13#define __RT5677_H__
14 14
15#include <sound/rt5677.h>
16#include <linux/gpio/driver.h> 15#include <linux/gpio/driver.h>
17#include <linux/gpio/consumer.h> 16#include <linux/gpio/consumer.h>
18 17
@@ -1761,6 +1760,35 @@ enum {
1761 RT5677_I2S4_SOURCE = (0x1 << 18), 1760 RT5677_I2S4_SOURCE = (0x1 << 18),
1762}; 1761};
1763 1762
1763enum rt5677_dmic2_clk {
1764 RT5677_DMIC_CLK1 = 0,
1765 RT5677_DMIC_CLK2 = 1,
1766};
1767
1768struct rt5677_platform_data {
1769 /* IN1/IN2/LOUT1/LOUT2/LOUT3 can optionally be differential */
1770 bool in1_diff;
1771 bool in2_diff;
1772 bool lout1_diff;
1773 bool lout2_diff;
1774 bool lout3_diff;
1775 /* DMIC2 clock source selection */
1776 enum rt5677_dmic2_clk dmic2_clk_pin;
1777
1778 /* configures GPIO, 0 - floating, 1 - pulldown, 2 - pullup */
1779 u8 gpio_config[6];
1780
1781 /* jd1 can select 0 ~ 3 as OFF, GPIO1, GPIO2 and GPIO3 respectively */
1782 unsigned int jd1_gpio;
1783 /* jd2 and jd3 can select 0 ~ 3 as
1784 OFF, GPIO4, GPIO5 and GPIO6 respectively */
1785 unsigned int jd2_gpio;
1786 unsigned int jd3_gpio;
1787
1788 /* Set MICBIAS1 VDD 1v8 or 3v3 */
1789 bool micbias1_vdd_3v3;
1790};
1791
1764struct rt5677_priv { 1792struct rt5677_priv {
1765 struct snd_soc_codec *codec; 1793 struct snd_soc_codec *codec;
1766 struct rt5677_platform_data pdata; 1794 struct rt5677_platform_data pdata;