[alsa-devel] [PATCH 0/2] ASoC: omap-twl4030: remove legacy code
This patch series removes the omap-twl4030 platform data since all users are now device tree based.
These patches are based on Tony's omap-for-v4.10/legacy branch [0] and also on [1].
[0] https://git.kernel.org/cgit/linux/kernel/git/tmlind/linux-omap.git/log/?h=om... [1] https://patchwork.kernel.org/patch/9424067/
Nicolae Rosia (2): ASoC: omap-twl4030: rework probing for device tree only mfd: twl4030-audio: make module DT only
drivers/mfd/twl4030-audio.c | 46 ++-------- include/linux/i2c/twl.h | 23 ----- include/linux/platform_data/omap-twl4030.h | 58 ------------- sound/soc/codecs/twl4030.c | 8 ++ sound/soc/omap/omap-twl4030.c | 133 ++++++++++------------------- 5 files changed, 61 insertions(+), 207 deletions(-) delete mode 100644 include/linux/platform_data/omap-twl4030.h
This code is no longer used since all users are using device tree
Signed-off-by: Nicolae Rosia Nicolae_Rosia@mentor.com --- include/linux/platform_data/omap-twl4030.h | 58 ------------- sound/soc/omap/omap-twl4030.c | 133 ++++++++++------------------- 2 files changed, 46 insertions(+), 145 deletions(-) delete mode 100644 include/linux/platform_data/omap-twl4030.h
diff --git a/include/linux/platform_data/omap-twl4030.h b/include/linux/platform_data/omap-twl4030.h deleted file mode 100644 index ee60ef7..0000000 --- a/include/linux/platform_data/omap-twl4030.h +++ /dev/null @@ -1,58 +0,0 @@ -/** - * omap-twl4030.h - ASoC machine driver for TI SoC based boards with twl4030 - * codec, header. - * - * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com - * All rights reserved. - * - * Author: Peter Ujfalusi peter.ujfalusi@ti.com - * - * 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. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - */ - -#ifndef _OMAP_TWL4030_H_ -#define _OMAP_TWL4030_H_ - -/* To select if only one channel is connected in a stereo port */ -#define OMAP_TWL4030_LEFT (1 << 0) -#define OMAP_TWL4030_RIGHT (1 << 1) - -struct omap_tw4030_pdata { - const char *card_name; - /* Voice port is connected to McBSP3 */ - bool voice_connected; - - /* The driver will parse the connection flags if this flag is set */ - bool custom_routing; - /* Flags to indicate connected audio ports. */ - u8 has_hs; - u8 has_hf; - u8 has_predriv; - u8 has_carkit; - bool has_ear; - - bool has_mainmic; - bool has_submic; - bool has_hsmic; - bool has_carkitmic; - bool has_digimic0; - bool has_digimic1; - u8 has_linein; - - /* Jack detect GPIO or <= 0 if it is not implemented */ - int jack_detect; -}; - -#endif /* _OMAP_TWL4030_H_ */ diff --git a/sound/soc/omap/omap-twl4030.c b/sound/soc/omap/omap-twl4030.c index 7431314..3988744 100644 --- a/sound/soc/omap/omap-twl4030.c +++ b/sound/soc/omap/omap-twl4030.c @@ -31,7 +31,6 @@ */
#include <linux/platform_device.h> -#include <linux/platform_data/omap-twl4030.h> #include <linux/module.h> #include <linux/of.h> #include <linux/gpio.h> @@ -160,10 +159,8 @@ static inline void twl4030_disconnect_pin(struct snd_soc_dapm_context *dapm, static int omap_twl4030_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_card *card = rtd->card; - struct snd_soc_dapm_context *dapm = &card->dapm; - struct omap_tw4030_pdata *pdata = dev_get_platdata(card->dev); struct omap_twl4030 *priv = snd_soc_card_get_drvdata(card); - int ret = 0; + int ret;
/* Headset jack detection only if it is supported */ if (priv->jack_detect > 0) { @@ -183,29 +180,7 @@ static int omap_twl4030_init(struct snd_soc_pcm_runtime *rtd) return ret; }
- /* - * NULL pdata means we booted with DT. In this case the routing is - * provided and the card is fully routed, no need to mark pins. - */ - if (!pdata || !pdata->custom_routing) - return ret; - - /* Disable not connected paths if not used */ - twl4030_disconnect_pin(dapm, pdata->has_ear, "Earpiece Spk"); - twl4030_disconnect_pin(dapm, pdata->has_hf, "Handsfree Spk"); - twl4030_disconnect_pin(dapm, pdata->has_hs, "Headset Stereophone"); - twl4030_disconnect_pin(dapm, pdata->has_predriv, "Ext Spk"); - twl4030_disconnect_pin(dapm, pdata->has_carkit, "Carkit Spk"); - - twl4030_disconnect_pin(dapm, pdata->has_mainmic, "Main Mic"); - twl4030_disconnect_pin(dapm, pdata->has_submic, "Sub Mic"); - twl4030_disconnect_pin(dapm, pdata->has_hsmic, "Headset Mic"); - twl4030_disconnect_pin(dapm, pdata->has_carkitmic, "Carkit Mic"); - twl4030_disconnect_pin(dapm, pdata->has_digimic0, "Digital0 Mic"); - twl4030_disconnect_pin(dapm, pdata->has_digimic1, "Digital1 Mic"); - twl4030_disconnect_pin(dapm, pdata->has_linein, "Line In"); - - return ret; + return 0; }
static int omap_twl4030_card_remove(struct snd_soc_card *card) @@ -259,11 +234,12 @@ static struct snd_soc_card omap_twl4030_card = {
static int omap_twl4030_probe(struct platform_device *pdev) { - struct omap_tw4030_pdata *pdata = dev_get_platdata(&pdev->dev); struct device_node *node = pdev->dev.of_node; struct snd_soc_card *card = &omap_twl4030_card; struct omap_twl4030 *priv; - int ret = 0; + struct device_node *dai_node; + struct property *prop; + int ret;
card->dev = &pdev->dev;
@@ -271,67 +247,50 @@ static int omap_twl4030_probe(struct platform_device *pdev) if (priv == NULL) return -ENOMEM;
- if (node) { - struct device_node *dai_node; - struct property *prop; - - if (snd_soc_of_parse_card_name(card, "ti,model")) { - dev_err(&pdev->dev, "Card name is not provided\n"); - return -ENODEV; - } - - dai_node = of_parse_phandle(node, "ti,mcbsp", 0); - if (!dai_node) { - dev_err(&pdev->dev, "McBSP node is not provided\n"); - return -EINVAL; - } - omap_twl4030_dai_links[0].cpu_dai_name = NULL; - omap_twl4030_dai_links[0].cpu_of_node = dai_node; - - omap_twl4030_dai_links[0].platform_name = NULL; - omap_twl4030_dai_links[0].platform_of_node = dai_node; - - dai_node = of_parse_phandle(node, "ti,mcbsp-voice", 0); - if (!dai_node) { - card->num_links = 1; - } else { - omap_twl4030_dai_links[1].cpu_dai_name = NULL; - omap_twl4030_dai_links[1].cpu_of_node = dai_node; - - omap_twl4030_dai_links[1].platform_name = NULL; - omap_twl4030_dai_links[1].platform_of_node = dai_node; - } - - priv->jack_detect = of_get_named_gpio(node, - "ti,jack-det-gpio", 0); - - /* Optional: audio routing can be provided */ - prop = of_find_property(node, "ti,audio-routing", NULL); - if (prop) { - ret = snd_soc_of_parse_audio_routing(card, - "ti,audio-routing"); - if (ret) - return ret; - - card->fully_routed = 1; - } - } else if (pdata) { - if (pdata->card_name) { - card->name = pdata->card_name; - } else { - dev_err(&pdev->dev, "Card name is not provided\n"); - return -ENODEV; - } - - if (!pdata->voice_connected) - card->num_links = 1; - - priv->jack_detect = pdata->jack_detect; - } else { - dev_err(&pdev->dev, "Missing pdata\n"); + if (!node) { + dev_err(&pdev->dev, "no DT info\n"); + return -EINVAL; + } + + if (snd_soc_of_parse_card_name(card, "ti,model")) { + dev_err(&pdev->dev, "Card name is not provided\n"); return -ENODEV; }
+ dai_node = of_parse_phandle(node, "ti,mcbsp", 0); + if (!dai_node) { + dev_err(&pdev->dev, "McBSP node is not provided\n"); + return -EINVAL; + } + omap_twl4030_dai_links[0].cpu_dai_name = NULL; + omap_twl4030_dai_links[0].cpu_of_node = dai_node; + + omap_twl4030_dai_links[0].platform_name = NULL; + omap_twl4030_dai_links[0].platform_of_node = dai_node; + + dai_node = of_parse_phandle(node, "ti,mcbsp-voice", 0); + if (!dai_node) { + card->num_links = 1; + } else { + omap_twl4030_dai_links[1].cpu_dai_name = NULL; + omap_twl4030_dai_links[1].cpu_of_node = dai_node; + + omap_twl4030_dai_links[1].platform_name = NULL; + omap_twl4030_dai_links[1].platform_of_node = dai_node; + } + + priv->jack_detect = of_get_named_gpio(node, "ti,jack-det-gpio", 0); + + /* Optional: audio routing can be provided */ + prop = of_find_property(node, "ti,audio-routing", NULL); + if (prop) { + ret = snd_soc_of_parse_audio_routing(card, "ti,audio-routing"); + if (ret) + return ret; + + card->fully_routed = 1; + } + snd_soc_card_set_drvdata(card, priv); ret = devm_snd_soc_register_card(&pdev->dev, card); if (ret) {
On Tue, Nov 15, 2016 at 10:01:19AM +0200, Nicolae Rosia wrote:
This code is no longer used since all users are using device tree
Acked-by: Mark Brown broonie@kernel.org
Remove dead code since all users are DT enabled and the code remains untested. Move struct twl4030_codec_data to codec/twl4030.c since it is only used there.
Signed-off-by: Nicolae Rosia Nicolae_Rosia@mentor.com --- drivers/mfd/twl4030-audio.c | 46 +++++++-------------------------------------- include/linux/i2c/twl.h | 23 ----------------------- sound/soc/codecs/twl4030.c | 8 ++++++++ 3 files changed, 15 insertions(+), 62 deletions(-)
diff --git a/drivers/mfd/twl4030-audio.c b/drivers/mfd/twl4030-audio.c index 0a16064..5bda789 100644 --- a/drivers/mfd/twl4030-audio.c +++ b/drivers/mfd/twl4030-audio.c @@ -158,43 +158,17 @@ unsigned int twl4030_audio_get_mclk(void) } EXPORT_SYMBOL_GPL(twl4030_audio_get_mclk);
-static bool twl4030_audio_has_codec(struct twl4030_audio_data *pdata, - struct device_node *node) -{ - if (pdata && pdata->codec) - return true; - - if (of_find_node_by_name(node, "codec")) - return true; - - return false; -} - -static bool twl4030_audio_has_vibra(struct twl4030_audio_data *pdata, - struct device_node *node) -{ - int vibra; - - if (pdata && pdata->vibra) - return true; - - if (!of_property_read_u32(node, "ti,enable-vibra", &vibra) && vibra) - return true; - - return false; -} - static int twl4030_audio_probe(struct platform_device *pdev) { struct twl4030_audio *audio; - struct twl4030_audio_data *pdata = dev_get_platdata(&pdev->dev); struct device_node *node = pdev->dev.of_node; struct mfd_cell *cell = NULL; + u32 enable_vibra = 0; int ret, childs = 0; u8 val;
- if (!pdata && !node) { - dev_err(&pdev->dev, "Platform data is missing\n"); + if (!node) { + dev_err(&pdev->dev, "no DT info\n"); return -EINVAL; }
@@ -231,22 +205,16 @@ static int twl4030_audio_probe(struct platform_device *pdev) audio->resource[TWL4030_AUDIO_RES_APLL].reg = TWL4030_REG_APLL_CTL; audio->resource[TWL4030_AUDIO_RES_APLL].mask = TWL4030_APLL_EN;
- if (twl4030_audio_has_codec(pdata, node)) { + if (of_find_node_by_name(node, "codec")) { cell = &audio->cells[childs]; cell->name = "twl4030-codec"; - if (pdata) { - cell->platform_data = pdata->codec; - cell->pdata_size = sizeof(*pdata->codec); - } childs++; } - if (twl4030_audio_has_vibra(pdata, node)) { + + of_property_read_u32(node, "ti,enable-vibra", &enable_vibra); + if (enable_vibra == 1) { cell = &audio->cells[childs]; cell->name = "twl4030-vibra"; - if (pdata) { - cell->platform_data = pdata->vibra; - cell->pdata_size = sizeof(*pdata->vibra); - } childs++; }
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h index 9ad7828..983791a 100644 --- a/include/linux/i2c/twl.h +++ b/include/linux/i2c/twl.h @@ -681,29 +681,6 @@ struct twl4030_power_data { extern int twl4030_remove_script(u8 flags); extern void twl4030_power_off(void);
-struct twl4030_codec_data { - unsigned int digimic_delay; /* in ms */ - unsigned int ramp_delay_value; - unsigned int offset_cncl_path; - unsigned int hs_extmute:1; - int hs_extmute_gpio; -}; - -struct twl4030_vibra_data { - unsigned int coexist; -}; - -struct twl4030_audio_data { - unsigned int audio_mclk; - struct twl4030_codec_data *codec; - struct twl4030_vibra_data *vibra; - - /* twl6040 */ - int audpwron_gpio; /* audio power-on gpio */ - int naudint_irq; /* audio interrupt */ - unsigned int irq_base; -}; - struct twl4030_platform_data { struct twl4030_clock_init_data *clock; struct twl4030_bci_platform_data *bci; diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c index a2104d6..5cba27b 100644 --- a/sound/soc/codecs/twl4030.c +++ b/sound/soc/codecs/twl4030.c @@ -48,6 +48,14 @@
#define TWL4030_CACHEREGNUM (TWL4030_REG_MISC_SET_2 + 1)
+struct twl4030_codec_data { + unsigned int digimic_delay; /* in ms */ + unsigned int ramp_delay_value; + unsigned int offset_cncl_path; + unsigned int hs_extmute:1; + int hs_extmute_gpio; +}; + /* codec private data */ struct twl4030_priv { unsigned int codec_powered;
Hi Nicolae,
[auto build test ERROR on asoc/for-next] [also build test ERROR on v4.9-rc5 next-20161115] [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/Nicolae-Rosia/ASoC-omap-twl4030-rew... base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next config: i386-randconfig-s1-201646 (attached as .config) compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 reproduce: # save the attached .config to linux build tree make ARCH=i386
All errors (new ones prefixed by >>):
drivers/mfd/twl-core.c: In function 'add_children':
drivers/mfd/twl-core.c:858:26: error: dereferencing pointer to incomplete type 'struct twl4030_audio_data'
pdata->audio, sizeof(*pdata->audio), ^~~~~~~~~~~~~
vim +858 drivers/mfd/twl-core.c
80e45b1e drivers/mfd/twl4030-core.c Timo Kokkonen 2009-03-27 852 return PTR_ERR(child); 80e45b1e drivers/mfd/twl4030-core.c Timo Kokkonen 2009-03-27 853 } 80e45b1e drivers/mfd/twl4030-core.c Timo Kokkonen 2009-03-27 854 f78959cf drivers/mfd/twl-core.c Thierry Reding 2012-09-18 855 if (IS_ENABLED(CONFIG_MFD_TWL4030_AUDIO) && pdata->audio && f78959cf drivers/mfd/twl-core.c Thierry Reding 2012-09-18 856 twl_class_is_4030()) { 3c330279 drivers/mfd/twl-core.c Peter Ujfalusi 2013-01-16 857 child = add_child(TWL4030_MODULE_AUDIO_VOICE, "twl4030-audio", 4ae6df5e drivers/mfd/twl-core.c Peter Ujfalusi 2011-05-31 @858 pdata->audio, sizeof(*pdata->audio), d62abe56 drivers/mfd/twl-core.c Misael Lopez Cruz 2010-02-23 859 false, 0, 0); d62abe56 drivers/mfd/twl-core.c Misael Lopez Cruz 2010-02-23 860 if (IS_ERR(child)) d62abe56 drivers/mfd/twl-core.c Misael Lopez Cruz 2010-02-23 861 return PTR_ERR(child);
:::::: The code at line 858 was first introduced by commit :::::: 4ae6df5e1018796ce260be59b2c603bd0f9faa94 MFD: twl4030-audio: Rename platform data
:::::: TO: Peter Ujfalusi peter.ujfalusi@ti.com :::::: CC: Peter Ujfalusi peter.ujfalusi@ti.com
--- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
Hi Nicolae,
[auto build test ERROR on asoc/for-next] [also build test ERROR on v4.9-rc5 next-20161115] [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/Nicolae-Rosia/ASoC-omap-twl4030-rew... base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next config: i386-randconfig-i0-201646 (attached as .config) compiler: gcc-4.8 (Debian 4.8.4-1) 4.8.4 reproduce: # save the attached .config to linux build tree make ARCH=i386
All error/warnings (new ones prefixed by >>):
drivers/input/misc/twl4030-vibra.c:181:17: warning: 'struct twl4030_vibra_data' declared inside parameter list [enabled by default]
struct device_node *node) ^
drivers/input/misc/twl4030-vibra.c:181:17: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]
drivers/input/misc/twl4030-vibra.c: In function 'twl4030_vibra_check_coexist':
drivers/input/misc/twl4030-vibra.c:183:20: error: dereferencing pointer to incomplete type
if (pdata && pdata->coexist) ^ drivers/input/misc/twl4030-vibra.c: In function 'twl4030_vibra_probe':
drivers/input/misc/twl4030-vibra.c:212:2: warning: passing argument 1 of 'twl4030_vibra_check_coexist' from incompatible pointer type [enabled by default]
info->coexist = twl4030_vibra_check_coexist(pdata, twl4030_core_node); ^ drivers/input/misc/twl4030-vibra.c:180:13: note: expected 'struct twl4030_vibra_data *' but argument is of type 'struct twl4030_vibra_data *' static bool twl4030_vibra_check_coexist(struct twl4030_vibra_data *pdata, ^
vim +181 drivers/input/misc/twl4030-vibra.c
3dd1b3949 Jari Vanhala 2010-03-09 175 } 3dd1b3949 Jari Vanhala 2010-03-09 176 3dd1b3949 Jari Vanhala 2010-03-09 177 static SIMPLE_DEV_PM_OPS(twl4030_vibra_pm_ops, 3dd1b3949 Jari Vanhala 2010-03-09 178 twl4030_vibra_suspend, twl4030_vibra_resume); 3dd1b3949 Jari Vanhala 2010-03-09 179 64b9e4d80 Peter Ujfalusi 2012-09-10 180 static bool twl4030_vibra_check_coexist(struct twl4030_vibra_data *pdata, 64b9e4d80 Peter Ujfalusi 2012-09-10 @181 struct device_node *node) 64b9e4d80 Peter Ujfalusi 2012-09-10 182 { 64b9e4d80 Peter Ujfalusi 2012-09-10 @183 if (pdata && pdata->coexist) 64b9e4d80 Peter Ujfalusi 2012-09-10 184 return true; 64b9e4d80 Peter Ujfalusi 2012-09-10 185 e661d0a04 Marek Belisko 2015-07-29 186 node = of_find_node_by_name(node, "codec"); e661d0a04 Marek Belisko 2015-07-29 187 if (node) { a9e1d3c04 Libo Chen 2014-01-03 188 of_node_put(node); 64b9e4d80 Peter Ujfalusi 2012-09-10 189 return true; a9e1d3c04 Libo Chen 2014-01-03 190 } 64b9e4d80 Peter Ujfalusi 2012-09-10 191 64b9e4d80 Peter Ujfalusi 2012-09-10 192 return false; 64b9e4d80 Peter Ujfalusi 2012-09-10 193 } 64b9e4d80 Peter Ujfalusi 2012-09-10 194 5298cc4cc Bill Pemberton 2012-11-23 195 static int twl4030_vibra_probe(struct platform_device *pdev) 3dd1b3949 Jari Vanhala 2010-03-09 196 { c838cb3d4 Jingoo Han 2013-12-05 197 struct twl4030_vibra_data *pdata = dev_get_platdata(&pdev->dev); 64b9e4d80 Peter Ujfalusi 2012-09-10 198 struct device_node *twl4030_core_node = pdev->dev.parent->of_node; 3dd1b3949 Jari Vanhala 2010-03-09 199 struct vibra_info *info; 3dd1b3949 Jari Vanhala 2010-03-09 200 int ret; 3dd1b3949 Jari Vanhala 2010-03-09 201 64b9e4d80 Peter Ujfalusi 2012-09-10 202 if (!pdata && !twl4030_core_node) { 3dd1b3949 Jari Vanhala 2010-03-09 203 dev_dbg(&pdev->dev, "platform_data not available\n"); 3dd1b3949 Jari Vanhala 2010-03-09 204 return -EINVAL; 3dd1b3949 Jari Vanhala 2010-03-09 205 } 3dd1b3949 Jari Vanhala 2010-03-09 206 c3ead16e7 Peter Ujfalusi 2013-01-11 207 info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); 3dd1b3949 Jari Vanhala 2010-03-09 208 if (!info) 3dd1b3949 Jari Vanhala 2010-03-09 209 return -ENOMEM; 3dd1b3949 Jari Vanhala 2010-03-09 210 3dd1b3949 Jari Vanhala 2010-03-09 211 info->dev = &pdev->dev; 64b9e4d80 Peter Ujfalusi 2012-09-10 @212 info->coexist = twl4030_vibra_check_coexist(pdata, twl4030_core_node); 3dd1b3949 Jari Vanhala 2010-03-09 213 INIT_WORK(&info->play_work, vibra_play_work); 3dd1b3949 Jari Vanhala 2010-03-09 214 c3ead16e7 Peter Ujfalusi 2013-01-11 215 info->input_dev = devm_input_allocate_device(&pdev->dev);
:::::: The code at line 181 was first introduced by commit :::::: 64b9e4d803b154a78a2e76bd466bb32ad6f383de input: twl4030-vibra: Support for DT booted kernel
:::::: TO: Peter Ujfalusi peter.ujfalusi@ti.com :::::: CC: Samuel Ortiz sameo@linux.intel.com
--- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
Hi,
On Tue, Nov 15, 2016 at 12:00 PM, kbuild test robot lkp@intel.com wrote:
Hi Nicolae,
[auto build test ERROR on asoc/for-next] [also build test ERROR on v4.9-rc5 next-20161115] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
Thanks, I forgot to convert twl4030-vibra, will send v2.
Best regards, Nicolae Rosia
participants (4)
-
kbuild test robot
-
Mark Brown
-
Nicolae Rosia
-
Nicolae Rosia