ASoC: rt5677: Hide platform data in the module sources
Subsystems (3)
PATCH 1/1 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.
--- include/sound/rt5677.h | 45 --------------------------------------------- sound/soc/codecs/rt5677.c | 27 +++++++++++++++++---------- sound/soc/codecs/rt5677.h | 30 +++++++++++++++++++++++++++++- 3 files changed, 46 insertions(+), 56 deletions(-) delete mode 100644 include/sound/rt5677.h
include/sound/rt5677.h deleted +0 -45
@@ -1,45 +0,0 @@ -/* -* linux/sound/rt5677.h -- Platform data for RT5677 -* -* Copyright 2013 Realtek Semiconductor Corp. -* Author: Oder Chiou <[email protected]> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 as -* published by the Free Software Foundation. -*/ - -#ifndef __LINUX_SND_RT5677_H -#define __LINUX_SND_RT5677_H - -enum rt5677_dmic2_clk { -RT5677_DMIC_CLK1 =0 , -RT5677_DMIC_CLK2 =1 , -}; - - -struct rt5677_platform_data { -/* IN1/IN2/LOUT1/LOUT2/LOUT3 can optionally be differential */ -bool in1_diff; -bool in2_diff; -bool lout1_diff; -bool lout2_diff; -bool lout3_diff; -/* DMIC2 clock source selection */ -enum rt5677_dmic2_clk dmic2_clk_pin; - -/* configures GPIO, 0 - floating, 1 - pulldown, 2 - pullup */ -u8 gpio_config[6 ]; - -/* jd1 can select 0 ~ 3 as OFF, GPIO1, GPIO2 and GPIO3 respectively */ -unsigned int jd1_gpio; -/* jd2 and jd3 can select 0 ~ 3 as -OFF, GPIO4, GPIO5 and GPIO6 respectively */ -unsigned int jd2_gpio; -unsigned int jd3_gpio; - -/* Set MICBIAS1 VDD 1v8 or 3v3 */ -bool micbias1_vdd_3v3; -}; - -#endif
sound/soc/codecs/rt5677.c +17 -10
@@ -21,6 +21,7 @@#include <linux/platform_device.h> #include <linux/spi/spi.h> #include <linux/firmware.h> +#include <linux/of_device.h> #include <linux/property.h> #include <sound/core.h> #include <sound/pcm.h>
@@ -5019,14 +5020,12 @@ static const struct regmap_config rt5677_regmap = { };static const struct i2c_device_id rt5677_i2c_id[] = { - {"rt5677" ,RT5677 }, - {"rt5676" ,RT5676 }, { } };MODULE_DEVICE_TABLE (i2c, rt5677_i2c_id);static const struct of_device_id rt5677_of_match[] = { - { .compatible ="realtek,rt5677" , }, + { .compatible ="realtek,rt5677" ,RT5677 }, { } };MODULE_DEVICE_TABLE (of, rt5677_of_match);
@@ -5147,7 +5146,6 @@ static void rt5677_free_irq(struct i2c_client *i2c)static int rt5677_i2c_probe (struct i2c_client *i2c,const struct i2c_device_id *id) { -struct rt5677_platform_data *pdata =dev_get_platdata (&i2c->dev);struct rt5677_priv *rt5677;int ret;unsigned int val;
@@ -5159,16 +5157,25 @@ static int rt5677_i2c_probe(struct i2c_client *i2c,i2c_set_clientdata (i2c, rt5677); - rt5677->type = id->driver_data; +if (i2c->dev.of_node) { +const struct of_device_id *match_id; + + match_id =of_match_device (rt5677_of_match, &i2c->dev); +if (match_id) + rt5677->type = (enum rt5677_type )match_id->data; -if (pdata) - rt5677->pdata = *pdata; -else if (i2c->dev.of_node)rt5677_read_device_properties (rt5677, &i2c->dev); -else if (ACPI_HANDLE (&i2c->dev)) + }else if (ACPI_HANDLE (&i2c->dev)) { +const struct acpi_device_id *acpi_id; + + acpi_id =acpi_match_device (rt5677_acpi_match, &i2c->dev); +if (acpi_id) + rt5677->type = (enum rt5677_type )acpi_id->driver_data; +rt5677_read_acpi_properties (rt5677, &i2c->dev); -else + }else {return -EINVAL ; + }/* pow-ldo2 and reset are optional. The codec pins may be statically * connected on the board without gpios. If the gpio device property
sound/soc/codecs/rt5677.h +29 -1
@@ -12,7 +12,6 @@#ifndef __RT5677_H__#define __RT5677_H__ -#include <sound/rt5677.h> #include <linux/gpio/driver.h> #include <linux/gpio/consumer.h>
@@ -1761,6 +1760,35 @@ enum { RT5677_I2S4_SOURCE = (0x1 << 18), }; +enum rt5677_dmic2_clk { +RT5677_DMIC_CLK1 =0 , +RT5677_DMIC_CLK2 =1 , +}; + +struct rt5677_platform_data { +/* IN1/IN2/LOUT1/LOUT2/LOUT3 can optionally be differential */ +bool in1_diff; +bool in2_diff; +bool lout1_diff; +bool lout2_diff; +bool lout3_diff; +/* DMIC2 clock source selection */ +enum rt5677_dmic2_clk dmic2_clk_pin; + +/* configures GPIO, 0 - floating, 1 - pulldown, 2 - pullup */ +u8 gpio_config[6 ]; + +/* jd1 can select 0 ~ 3 as OFF, GPIO1, GPIO2 and GPIO3 respectively */ +unsigned int jd1_gpio; +/* jd2 and jd3 can select 0 ~ 3 as +OFF, GPIO4, GPIO5 and GPIO6 respectively */ +unsigned int jd2_gpio; +unsigned int jd3_gpio; + +/* Set MICBIAS1 VDD 1v8 or 3v3 */ +bool micbias1_vdd_3v3; +}; +struct rt5677_priv {struct snd_soc_codec *codec;struct rt5677_platform_data pdata;
Signature · 1 line
2.11.0
kbuild test robot
build botreproduce: wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross…
Hi Andy,
[auto build test ERROR on asoc/for-next]
[cannot apply to v4.12-rc5 next-20170616]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Andy-Shevchenko/ASoC-rt5677-Hide-platform-data-in-the-module-sources/20170618-110640 base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next config: sh-allmodconfig (attached as .config) compiler: sh4-linux-gnu-gcc (Debian 6.3.0-18) 6.3.0 20170516
reproduce:
wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=sh
All errors (new ones prefixed by >>):
sound/soc//codecs/rt5677.c: In function 'rt5677_i2c_probe':
>> sound/soc//codecs/rt5677.c:5171:31: error: 'rt5677_acpi_match' undeclared (first use in this function)
acpi_id = acpi_match_device(rt5677_acpi_match, &i2c->dev);
^~~~~~~~~~~~~~~~~sound/soc//codecs/rt5677.c:5171:31: note: each undeclared identifier is reported only once for each function it appears in
vim +/rt5677_acpi_match +5171 sound/soc//codecs/rt5677.c
5165 rt5677->type = (enum rt5677_type)match_id->data;
5166
5167 rt5677_read_device_properties(rt5677, &i2c->dev);
5168 } else if (ACPI_HANDLE(&i2c->dev)) {
5169 const struct acpi_device_id *acpi_id;
5170
> 5171 acpi_id = acpi_match_device(rt5677_acpi_match, &i2c->dev);
5172 if (acpi_id)
5173 rt5677->type = (enum rt5677_type)acpi_id->driver_data;
5174
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation