ASoC: Use device_get_match_data()
Use preferred device_get_match_data() instead of of_match_device() to get the driver match data. With this, adjust the includes to explicitly include the correct headers. Signed-off-by: Rob Herring <robh@kernel.org> Link: https://lore.kernel.org/r/20231006-dt-asoc-header-cleanups-v3-5-13a4f0f7fee6@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
ec5236c2e6
commit
9958d85968
@ -11,7 +11,6 @@
|
|||||||
#include <linux/io.h>
|
#include <linux/io.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/of.h>
|
#include <linux/of.h>
|
||||||
#include <linux/of_device.h>
|
|
||||||
#include <sound/dmaengine_pcm.h>
|
#include <sound/dmaengine_pcm.h>
|
||||||
#include <sound/pcm.h>
|
#include <sound/pcm.h>
|
||||||
#include <sound/pcm_params.h>
|
#include <sound/pcm_params.h>
|
||||||
@ -820,7 +819,6 @@ static int kmb_plat_dai_probe(struct platform_device *pdev)
|
|||||||
{
|
{
|
||||||
struct device_node *np = pdev->dev.of_node;
|
struct device_node *np = pdev->dev.of_node;
|
||||||
struct snd_soc_dai_driver *kmb_i2s_dai;
|
struct snd_soc_dai_driver *kmb_i2s_dai;
|
||||||
const struct of_device_id *match;
|
|
||||||
struct device *dev = &pdev->dev;
|
struct device *dev = &pdev->dev;
|
||||||
struct kmb_i2s_info *kmb_i2s;
|
struct kmb_i2s_info *kmb_i2s;
|
||||||
struct resource *res;
|
struct resource *res;
|
||||||
@ -831,16 +829,7 @@ static int kmb_plat_dai_probe(struct platform_device *pdev)
|
|||||||
if (!kmb_i2s)
|
if (!kmb_i2s)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
kmb_i2s_dai = devm_kzalloc(dev, sizeof(*kmb_i2s_dai), GFP_KERNEL);
|
kmb_i2s_dai = (struct snd_soc_dai_driver *)device_get_match_data(&pdev->dev);
|
||||||
if (!kmb_i2s_dai)
|
|
||||||
return -ENOMEM;
|
|
||||||
|
|
||||||
match = of_match_device(kmb_plat_of_match, &pdev->dev);
|
|
||||||
if (!match) {
|
|
||||||
dev_err(&pdev->dev, "Error: No device match found\n");
|
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
kmb_i2s_dai = (struct snd_soc_dai_driver *) match->data;
|
|
||||||
|
|
||||||
/* Prepare the related clocks */
|
/* Prepare the related clocks */
|
||||||
kmb_i2s->clk_apb = devm_clk_get(dev, "apb_clk");
|
kmb_i2s->clk_apb = devm_clk_get(dev, "apb_clk");
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/of.h>
|
#include <linux/of.h>
|
||||||
#include <linux/of_device.h>
|
|
||||||
#include <linux/platform_device.h>
|
#include <linux/platform_device.h>
|
||||||
#include <sound/pcm.h>
|
#include <sound/pcm.h>
|
||||||
#include <sound/pcm_params.h>
|
#include <sound/pcm_params.h>
|
||||||
@ -1106,7 +1105,6 @@ int asoc_qcom_lpass_cpu_platform_probe(struct platform_device *pdev)
|
|||||||
struct resource *res;
|
struct resource *res;
|
||||||
const struct lpass_variant *variant;
|
const struct lpass_variant *variant;
|
||||||
struct device *dev = &pdev->dev;
|
struct device *dev = &pdev->dev;
|
||||||
const struct of_device_id *match;
|
|
||||||
int ret, i, dai_id;
|
int ret, i, dai_id;
|
||||||
|
|
||||||
dsp_of_node = of_parse_phandle(pdev->dev.of_node, "qcom,adsp", 0);
|
dsp_of_node = of_parse_phandle(pdev->dev.of_node, "qcom,adsp", 0);
|
||||||
@ -1121,17 +1119,14 @@ int asoc_qcom_lpass_cpu_platform_probe(struct platform_device *pdev)
|
|||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
platform_set_drvdata(pdev, drvdata);
|
platform_set_drvdata(pdev, drvdata);
|
||||||
|
|
||||||
match = of_match_device(dev->driver->of_match_table, dev);
|
variant = device_get_match_data(dev);
|
||||||
if (!match || !match->data)
|
if (!variant)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (of_device_is_compatible(dev->of_node, "qcom,lpass-cpu-apq8016")) {
|
if (of_device_is_compatible(dev->of_node, "qcom,lpass-cpu-apq8016"))
|
||||||
dev_warn(dev, "%s compatible is deprecated\n",
|
dev_warn(dev, "qcom,lpass-cpu-apq8016 compatible is deprecated\n");
|
||||||
match->compatible);
|
|
||||||
}
|
|
||||||
|
|
||||||
drvdata->variant = (struct lpass_variant *)match->data;
|
drvdata->variant = variant;
|
||||||
variant = drvdata->variant;
|
|
||||||
|
|
||||||
of_lpass_cpu_parse_dai_data(dev, drvdata);
|
of_lpass_cpu_parse_dai_data(dev, drvdata);
|
||||||
|
|
||||||
|
@ -10,8 +10,8 @@
|
|||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/mfd/syscon.h>
|
#include <linux/mfd/syscon.h>
|
||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
|
#include <linux/of.h>
|
||||||
#include <linux/of_gpio.h>
|
#include <linux/of_gpio.h>
|
||||||
#include <linux/of_device.h>
|
|
||||||
#include <linux/clk.h>
|
#include <linux/clk.h>
|
||||||
#include <linux/pinctrl/consumer.h>
|
#include <linux/pinctrl/consumer.h>
|
||||||
#include <linux/pm_runtime.h>
|
#include <linux/pm_runtime.h>
|
||||||
@ -736,7 +736,6 @@ static int rockchip_i2s_init_dai(struct rk_i2s_dev *i2s, struct resource *res,
|
|||||||
static int rockchip_i2s_probe(struct platform_device *pdev)
|
static int rockchip_i2s_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct device_node *node = pdev->dev.of_node;
|
struct device_node *node = pdev->dev.of_node;
|
||||||
const struct of_device_id *of_id;
|
|
||||||
struct rk_i2s_dev *i2s;
|
struct rk_i2s_dev *i2s;
|
||||||
struct snd_soc_dai_driver *dai;
|
struct snd_soc_dai_driver *dai;
|
||||||
struct resource *res;
|
struct resource *res;
|
||||||
@ -752,11 +751,10 @@ static int rockchip_i2s_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
i2s->grf = syscon_regmap_lookup_by_phandle(node, "rockchip,grf");
|
i2s->grf = syscon_regmap_lookup_by_phandle(node, "rockchip,grf");
|
||||||
if (!IS_ERR(i2s->grf)) {
|
if (!IS_ERR(i2s->grf)) {
|
||||||
of_id = of_match_device(rockchip_i2s_match, &pdev->dev);
|
i2s->pins = device_get_match_data(&pdev->dev);
|
||||||
if (!of_id || !of_id->data)
|
if (!i2s->pins)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
i2s->pins = of_id->data;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* try to prepare related clocks */
|
/* try to prepare related clocks */
|
||||||
|
@ -10,9 +10,7 @@
|
|||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
#include <linux/mfd/syscon.h>
|
#include <linux/mfd/syscon.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/of_address.h>
|
#include <linux/of.h>
|
||||||
#include <linux/of_device.h>
|
|
||||||
#include <linux/of_gpio.h>
|
|
||||||
#include <linux/pm_runtime.h>
|
#include <linux/pm_runtime.h>
|
||||||
#include <linux/regmap.h>
|
#include <linux/regmap.h>
|
||||||
#include <linux/reset.h>
|
#include <linux/reset.h>
|
||||||
@ -75,7 +73,7 @@ struct rk_i2s_tdm_dev {
|
|||||||
struct snd_dmaengine_dai_dma_data playback_dma_data;
|
struct snd_dmaengine_dai_dma_data playback_dma_data;
|
||||||
struct reset_control *tx_reset;
|
struct reset_control *tx_reset;
|
||||||
struct reset_control *rx_reset;
|
struct reset_control *rx_reset;
|
||||||
struct rk_i2s_soc_data *soc_data;
|
const struct rk_i2s_soc_data *soc_data;
|
||||||
bool is_master_mode;
|
bool is_master_mode;
|
||||||
bool io_multiplex;
|
bool io_multiplex;
|
||||||
bool mclk_calibrate;
|
bool mclk_calibrate;
|
||||||
@ -1277,21 +1275,21 @@ static const struct txrx_config rv1126_txrx_config[] = {
|
|||||||
{ 0xff800000, 0x10260, RV1126_I2S0_CLK_TXONLY, RV1126_I2S0_CLK_RXONLY },
|
{ 0xff800000, 0x10260, RV1126_I2S0_CLK_TXONLY, RV1126_I2S0_CLK_RXONLY },
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct rk_i2s_soc_data px30_i2s_soc_data = {
|
static const struct rk_i2s_soc_data px30_i2s_soc_data = {
|
||||||
.softrst_offset = 0x0300,
|
.softrst_offset = 0x0300,
|
||||||
.configs = px30_txrx_config,
|
.configs = px30_txrx_config,
|
||||||
.config_count = ARRAY_SIZE(px30_txrx_config),
|
.config_count = ARRAY_SIZE(px30_txrx_config),
|
||||||
.init = common_soc_init,
|
.init = common_soc_init,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct rk_i2s_soc_data rk1808_i2s_soc_data = {
|
static const struct rk_i2s_soc_data rk1808_i2s_soc_data = {
|
||||||
.softrst_offset = 0x0300,
|
.softrst_offset = 0x0300,
|
||||||
.configs = rk1808_txrx_config,
|
.configs = rk1808_txrx_config,
|
||||||
.config_count = ARRAY_SIZE(rk1808_txrx_config),
|
.config_count = ARRAY_SIZE(rk1808_txrx_config),
|
||||||
.init = common_soc_init,
|
.init = common_soc_init,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct rk_i2s_soc_data rk3308_i2s_soc_data = {
|
static const struct rk_i2s_soc_data rk3308_i2s_soc_data = {
|
||||||
.softrst_offset = 0x0400,
|
.softrst_offset = 0x0400,
|
||||||
.grf_reg_offset = 0x0308,
|
.grf_reg_offset = 0x0308,
|
||||||
.grf_shift = 5,
|
.grf_shift = 5,
|
||||||
@ -1300,14 +1298,14 @@ static struct rk_i2s_soc_data rk3308_i2s_soc_data = {
|
|||||||
.init = common_soc_init,
|
.init = common_soc_init,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct rk_i2s_soc_data rk3568_i2s_soc_data = {
|
static const struct rk_i2s_soc_data rk3568_i2s_soc_data = {
|
||||||
.softrst_offset = 0x0400,
|
.softrst_offset = 0x0400,
|
||||||
.configs = rk3568_txrx_config,
|
.configs = rk3568_txrx_config,
|
||||||
.config_count = ARRAY_SIZE(rk3568_txrx_config),
|
.config_count = ARRAY_SIZE(rk3568_txrx_config),
|
||||||
.init = common_soc_init,
|
.init = common_soc_init,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct rk_i2s_soc_data rv1126_i2s_soc_data = {
|
static const struct rk_i2s_soc_data rv1126_i2s_soc_data = {
|
||||||
.softrst_offset = 0x0300,
|
.softrst_offset = 0x0300,
|
||||||
.configs = rv1126_txrx_config,
|
.configs = rv1126_txrx_config,
|
||||||
.config_count = ARRAY_SIZE(rv1126_txrx_config),
|
.config_count = ARRAY_SIZE(rv1126_txrx_config),
|
||||||
@ -1544,7 +1542,6 @@ static int rockchip_i2s_tdm_rx_path_prepare(struct rk_i2s_tdm_dev *i2s_tdm,
|
|||||||
static int rockchip_i2s_tdm_probe(struct platform_device *pdev)
|
static int rockchip_i2s_tdm_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct device_node *node = pdev->dev.of_node;
|
struct device_node *node = pdev->dev.of_node;
|
||||||
const struct of_device_id *of_id;
|
|
||||||
struct rk_i2s_tdm_dev *i2s_tdm;
|
struct rk_i2s_tdm_dev *i2s_tdm;
|
||||||
struct resource *res;
|
struct resource *res;
|
||||||
void __iomem *regs;
|
void __iomem *regs;
|
||||||
@ -1556,13 +1553,8 @@ static int rockchip_i2s_tdm_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
i2s_tdm->dev = &pdev->dev;
|
i2s_tdm->dev = &pdev->dev;
|
||||||
|
|
||||||
of_id = of_match_device(rockchip_i2s_tdm_match, &pdev->dev);
|
|
||||||
if (!of_id)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
spin_lock_init(&i2s_tdm->lock);
|
spin_lock_init(&i2s_tdm->lock);
|
||||||
i2s_tdm->soc_data = (struct rk_i2s_soc_data *)of_id->data;
|
i2s_tdm->soc_data = device_get_match_data(&pdev->dev);
|
||||||
|
|
||||||
i2s_tdm->frame_width = 64;
|
i2s_tdm->frame_width = 64;
|
||||||
|
|
||||||
i2s_tdm->clk_trcm = TRCM_TXRX;
|
i2s_tdm->clk_trcm = TRCM_TXRX;
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/clk.h>
|
#include <linux/clk.h>
|
||||||
#include <linux/of.h>
|
#include <linux/of.h>
|
||||||
#include <linux/of_device.h>
|
|
||||||
#include <linux/pm_runtime.h>
|
#include <linux/pm_runtime.h>
|
||||||
#include <linux/rational.h>
|
#include <linux/rational.h>
|
||||||
#include <linux/regmap.h>
|
#include <linux/regmap.h>
|
||||||
@ -572,7 +571,6 @@ static int rockchip_pdm_path_parse(struct rk_pdm_dev *pdm, struct device_node *n
|
|||||||
static int rockchip_pdm_probe(struct platform_device *pdev)
|
static int rockchip_pdm_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct device_node *node = pdev->dev.of_node;
|
struct device_node *node = pdev->dev.of_node;
|
||||||
const struct of_device_id *match;
|
|
||||||
struct rk_pdm_dev *pdm;
|
struct rk_pdm_dev *pdm;
|
||||||
struct resource *res;
|
struct resource *res;
|
||||||
void __iomem *regs;
|
void __iomem *regs;
|
||||||
@ -582,10 +580,7 @@ static int rockchip_pdm_probe(struct platform_device *pdev)
|
|||||||
if (!pdm)
|
if (!pdm)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
match = of_match_device(rockchip_pdm_match, &pdev->dev);
|
pdm->version = (enum rk_pdm_version)device_get_match_data(&pdev->dev);
|
||||||
if (match)
|
|
||||||
pdm->version = (uintptr_t)match->data;
|
|
||||||
|
|
||||||
if (pdm->version == RK_PDM_RK3308) {
|
if (pdm->version == RK_PDM_RK3308) {
|
||||||
pdm->reset = devm_reset_control_get(&pdev->dev, "pdm-m");
|
pdm->reset = devm_reset_control_get(&pdev->dev, "pdm-m");
|
||||||
if (IS_ERR(pdm->reset))
|
if (IS_ERR(pdm->reset))
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
#include <sound/soc.h>
|
#include <sound/soc.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/of.h>
|
#include <linux/of.h>
|
||||||
#include <linux/of_device.h>
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Default CFG switch settings to use this driver:
|
* Default CFG switch settings to use this driver:
|
||||||
@ -32,15 +31,6 @@
|
|||||||
/* SMDK has a 16.934MHZ crystal attached to WM8994 */
|
/* SMDK has a 16.934MHZ crystal attached to WM8994 */
|
||||||
#define SMDK_WM8994_FREQ 16934000
|
#define SMDK_WM8994_FREQ 16934000
|
||||||
|
|
||||||
struct smdk_wm8994_data {
|
|
||||||
int mclk1_rate;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Default SMDKs */
|
|
||||||
static struct smdk_wm8994_data smdk_board_data = {
|
|
||||||
.mclk1_rate = SMDK_WM8994_FREQ,
|
|
||||||
};
|
|
||||||
|
|
||||||
static int smdk_hw_params(struct snd_pcm_substream *substream,
|
static int smdk_hw_params(struct snd_pcm_substream *substream,
|
||||||
struct snd_pcm_hw_params *params)
|
struct snd_pcm_hw_params *params)
|
||||||
{
|
{
|
||||||
@ -136,8 +126,8 @@ static struct snd_soc_card smdk = {
|
|||||||
.num_links = ARRAY_SIZE(smdk_dai),
|
.num_links = ARRAY_SIZE(smdk_dai),
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct of_device_id samsung_wm8994_of_match[] __maybe_unused = {
|
static const struct of_device_id samsung_wm8994_of_match[] = {
|
||||||
{ .compatible = "samsung,smdk-wm8994", .data = &smdk_board_data },
|
{ .compatible = "samsung,smdk-wm8994" },
|
||||||
{},
|
{},
|
||||||
};
|
};
|
||||||
MODULE_DEVICE_TABLE(of, samsung_wm8994_of_match);
|
MODULE_DEVICE_TABLE(of, samsung_wm8994_of_match);
|
||||||
@ -147,15 +137,9 @@ static int smdk_audio_probe(struct platform_device *pdev)
|
|||||||
int ret;
|
int ret;
|
||||||
struct device_node *np = pdev->dev.of_node;
|
struct device_node *np = pdev->dev.of_node;
|
||||||
struct snd_soc_card *card = &smdk;
|
struct snd_soc_card *card = &smdk;
|
||||||
struct smdk_wm8994_data *board;
|
|
||||||
const struct of_device_id *id;
|
|
||||||
|
|
||||||
card->dev = &pdev->dev;
|
card->dev = &pdev->dev;
|
||||||
|
|
||||||
board = devm_kzalloc(&pdev->dev, sizeof(*board), GFP_KERNEL);
|
|
||||||
if (!board)
|
|
||||||
return -ENOMEM;
|
|
||||||
|
|
||||||
if (np) {
|
if (np) {
|
||||||
smdk_dai[0].cpus->dai_name = NULL;
|
smdk_dai[0].cpus->dai_name = NULL;
|
||||||
smdk_dai[0].cpus->of_node = of_parse_phandle(np,
|
smdk_dai[0].cpus->of_node = of_parse_phandle(np,
|
||||||
@ -171,12 +155,6 @@ static int smdk_audio_probe(struct platform_device *pdev)
|
|||||||
smdk_dai[0].platforms->of_node = smdk_dai[0].cpus->of_node;
|
smdk_dai[0].platforms->of_node = smdk_dai[0].cpus->of_node;
|
||||||
}
|
}
|
||||||
|
|
||||||
id = of_match_device(samsung_wm8994_of_match, &pdev->dev);
|
|
||||||
if (id)
|
|
||||||
*board = *((struct smdk_wm8994_data *)id->data);
|
|
||||||
|
|
||||||
platform_set_drvdata(pdev, board);
|
|
||||||
|
|
||||||
ret = devm_snd_soc_register_card(&pdev->dev, card);
|
ret = devm_snd_soc_register_card(&pdev->dev, card);
|
||||||
|
|
||||||
if (ret)
|
if (ret)
|
||||||
@ -188,7 +166,7 @@ static int smdk_audio_probe(struct platform_device *pdev)
|
|||||||
static struct platform_driver smdk_audio_driver = {
|
static struct platform_driver smdk_audio_driver = {
|
||||||
.driver = {
|
.driver = {
|
||||||
.name = "smdk-audio-wm8994",
|
.name = "smdk-audio-wm8994",
|
||||||
.of_match_table = of_match_ptr(samsung_wm8994_of_match),
|
.of_match_table = samsung_wm8994_of_match,
|
||||||
.pm = &snd_soc_pm_ops,
|
.pm = &snd_soc_pm_ops,
|
||||||
},
|
},
|
||||||
.probe = smdk_audio_probe,
|
.probe = smdk_audio_probe,
|
||||||
|
@ -1024,7 +1024,6 @@ static int stm32_i2s_parse_dt(struct platform_device *pdev,
|
|||||||
struct stm32_i2s_data *i2s)
|
struct stm32_i2s_data *i2s)
|
||||||
{
|
{
|
||||||
struct device_node *np = pdev->dev.of_node;
|
struct device_node *np = pdev->dev.of_node;
|
||||||
const struct of_device_id *of_id;
|
|
||||||
struct reset_control *rst;
|
struct reset_control *rst;
|
||||||
struct resource *res;
|
struct resource *res;
|
||||||
int irq, ret;
|
int irq, ret;
|
||||||
@ -1032,10 +1031,8 @@ static int stm32_i2s_parse_dt(struct platform_device *pdev,
|
|||||||
if (!np)
|
if (!np)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
of_id = of_match_device(stm32_i2s_ids, &pdev->dev);
|
i2s->regmap_conf = device_get_match_data(&pdev->dev);
|
||||||
if (of_id)
|
if (!i2s->regmap_conf)
|
||||||
i2s->regmap_conf = (const struct regmap_config *)of_id->data;
|
|
||||||
else
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
i2s->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
|
i2s->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
|
||||||
|
@ -151,8 +151,8 @@ error:
|
|||||||
static int stm32_sai_probe(struct platform_device *pdev)
|
static int stm32_sai_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct stm32_sai_data *sai;
|
struct stm32_sai_data *sai;
|
||||||
|
const struct stm32_sai_conf *conf;
|
||||||
struct reset_control *rst;
|
struct reset_control *rst;
|
||||||
const struct of_device_id *of_id;
|
|
||||||
u32 val;
|
u32 val;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -164,9 +164,9 @@ static int stm32_sai_probe(struct platform_device *pdev)
|
|||||||
if (IS_ERR(sai->base))
|
if (IS_ERR(sai->base))
|
||||||
return PTR_ERR(sai->base);
|
return PTR_ERR(sai->base);
|
||||||
|
|
||||||
of_id = of_match_device(stm32_sai_ids, &pdev->dev);
|
conf = device_get_match_data(&pdev->dev);
|
||||||
if (of_id)
|
if (conf)
|
||||||
memcpy(&sai->conf, (const struct stm32_sai_conf *)of_id->data,
|
memcpy(&sai->conf, (const struct stm32_sai_conf *)conf,
|
||||||
sizeof(struct stm32_sai_conf));
|
sizeof(struct stm32_sai_conf));
|
||||||
else
|
else
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
@ -1506,7 +1506,6 @@ static int stm32_sai_sub_parse_of(struct platform_device *pdev,
|
|||||||
static int stm32_sai_sub_probe(struct platform_device *pdev)
|
static int stm32_sai_sub_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct stm32_sai_sub_data *sai;
|
struct stm32_sai_sub_data *sai;
|
||||||
const struct of_device_id *of_id;
|
|
||||||
const struct snd_dmaengine_pcm_config *conf = &stm32_sai_pcm_config;
|
const struct snd_dmaengine_pcm_config *conf = &stm32_sai_pcm_config;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -1514,10 +1513,7 @@ static int stm32_sai_sub_probe(struct platform_device *pdev)
|
|||||||
if (!sai)
|
if (!sai)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
of_id = of_match_device(stm32_sai_sub_ids, &pdev->dev);
|
sai->id = (uintptr_t)device_get_match_data(&pdev->dev);
|
||||||
if (!of_id)
|
|
||||||
return -EINVAL;
|
|
||||||
sai->id = (uintptr_t)of_id->data;
|
|
||||||
|
|
||||||
sai->pdev = pdev;
|
sai->pdev = pdev;
|
||||||
mutex_init(&sai->ctrl_lock);
|
mutex_init(&sai->ctrl_lock);
|
||||||
|
@ -908,17 +908,13 @@ static int stm32_spdifrx_parse_of(struct platform_device *pdev,
|
|||||||
struct stm32_spdifrx_data *spdifrx)
|
struct stm32_spdifrx_data *spdifrx)
|
||||||
{
|
{
|
||||||
struct device_node *np = pdev->dev.of_node;
|
struct device_node *np = pdev->dev.of_node;
|
||||||
const struct of_device_id *of_id;
|
|
||||||
struct resource *res;
|
struct resource *res;
|
||||||
|
|
||||||
if (!np)
|
if (!np)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
of_id = of_match_device(stm32_spdifrx_ids, &pdev->dev);
|
spdifrx->regmap_conf = device_get_match_data(&pdev->dev);
|
||||||
if (of_id)
|
if (!spdifrx->regmap_conf)
|
||||||
spdifrx->regmap_conf =
|
|
||||||
(const struct regmap_config *)of_id->data;
|
|
||||||
else
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
spdifrx->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
|
spdifrx->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
|
||||||
|
@ -7,9 +7,8 @@
|
|||||||
#include <linux/clk.h>
|
#include <linux/clk.h>
|
||||||
#include <linux/device.h>
|
#include <linux/device.h>
|
||||||
#include <linux/io.h>
|
#include <linux/io.h>
|
||||||
|
#include <linux/mod_devicetable.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/of.h>
|
|
||||||
#include <linux/of_device.h>
|
|
||||||
#include <linux/platform_device.h>
|
#include <linux/platform_device.h>
|
||||||
#include <linux/pm_runtime.h>
|
#include <linux/pm_runtime.h>
|
||||||
#include <linux/regmap.h>
|
#include <linux/regmap.h>
|
||||||
@ -536,18 +535,13 @@ static int tegra210_amx_platform_probe(struct platform_device *pdev)
|
|||||||
struct tegra210_amx *amx;
|
struct tegra210_amx *amx;
|
||||||
void __iomem *regs;
|
void __iomem *regs;
|
||||||
int err;
|
int err;
|
||||||
const struct of_device_id *match;
|
|
||||||
struct tegra210_amx_soc_data *soc_data;
|
struct tegra210_amx_soc_data *soc_data;
|
||||||
|
|
||||||
match = of_match_device(tegra210_amx_of_match, dev);
|
|
||||||
|
|
||||||
soc_data = (struct tegra210_amx_soc_data *)match->data;
|
|
||||||
|
|
||||||
amx = devm_kzalloc(dev, sizeof(*amx), GFP_KERNEL);
|
amx = devm_kzalloc(dev, sizeof(*amx), GFP_KERNEL);
|
||||||
if (!amx)
|
if (!amx)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
amx->soc_data = soc_data;
|
amx->soc_data = device_get_match_data(dev);
|
||||||
|
|
||||||
dev_set_drvdata(dev, amx);
|
dev_set_drvdata(dev, amx);
|
||||||
|
|
||||||
|
@ -175,20 +175,17 @@ static struct snd_soc_card evm_soc_card = {
|
|||||||
static int davinci_evm_probe(struct platform_device *pdev)
|
static int davinci_evm_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct device_node *np = pdev->dev.of_node;
|
struct device_node *np = pdev->dev.of_node;
|
||||||
const struct of_device_id *match;
|
|
||||||
struct snd_soc_dai_link *dai;
|
struct snd_soc_dai_link *dai;
|
||||||
struct snd_soc_card_drvdata_davinci *drvdata = NULL;
|
struct snd_soc_card_drvdata_davinci *drvdata = NULL;
|
||||||
struct clk *mclk;
|
struct clk *mclk;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
match = of_match_device(of_match_ptr(davinci_evm_dt_ids), &pdev->dev);
|
dai = (struct snd_soc_dai_link *) device_get_match_data(&pdev->dev);
|
||||||
if (!match) {
|
if (!dai) {
|
||||||
dev_err(&pdev->dev, "Error: No device match found\n");
|
dev_err(&pdev->dev, "Error: No device match found\n");
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
dai = (struct snd_soc_dai_link *) match->data;
|
|
||||||
|
|
||||||
evm_soc_card.dai_link = dai;
|
evm_soc_card.dai_link = dai;
|
||||||
|
|
||||||
dai->codecs->of_node = of_parse_phandle(np, "ti,audio-codec", 0);
|
dai->codecs->of_node = of_parse_phandle(np, "ti,audio-codec", 0);
|
||||||
|
@ -21,8 +21,6 @@
|
|||||||
#include <linux/clk.h>
|
#include <linux/clk.h>
|
||||||
#include <linux/pm_runtime.h>
|
#include <linux/pm_runtime.h>
|
||||||
#include <linux/of.h>
|
#include <linux/of.h>
|
||||||
#include <linux/of_platform.h>
|
|
||||||
#include <linux/of_device.h>
|
|
||||||
#include <linux/platform_data/davinci_asp.h>
|
#include <linux/platform_data/davinci_asp.h>
|
||||||
#include <linux/math64.h>
|
#include <linux/math64.h>
|
||||||
#include <linux/bitmap.h>
|
#include <linux/bitmap.h>
|
||||||
@ -1882,9 +1880,10 @@ static bool davinci_mcasp_have_gpiochip(struct davinci_mcasp *mcasp)
|
|||||||
static int davinci_mcasp_get_config(struct davinci_mcasp *mcasp,
|
static int davinci_mcasp_get_config(struct davinci_mcasp *mcasp,
|
||||||
struct platform_device *pdev)
|
struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
const struct of_device_id *match = of_match_device(mcasp_dt_ids, &pdev->dev);
|
|
||||||
struct device_node *np = pdev->dev.of_node;
|
struct device_node *np = pdev->dev.of_node;
|
||||||
struct davinci_mcasp_pdata *pdata = NULL;
|
struct davinci_mcasp_pdata *pdata = NULL;
|
||||||
|
const struct davinci_mcasp_pdata *match_pdata =
|
||||||
|
device_get_match_data(&pdev->dev);
|
||||||
const u32 *of_serial_dir32;
|
const u32 *of_serial_dir32;
|
||||||
u32 val;
|
u32 val;
|
||||||
int i;
|
int i;
|
||||||
@ -1893,8 +1892,8 @@ static int davinci_mcasp_get_config(struct davinci_mcasp *mcasp,
|
|||||||
pdata = pdev->dev.platform_data;
|
pdata = pdev->dev.platform_data;
|
||||||
pdata->dismod = DISMOD_LOW;
|
pdata->dismod = DISMOD_LOW;
|
||||||
goto out;
|
goto out;
|
||||||
} else if (match) {
|
} else if (match_pdata) {
|
||||||
pdata = devm_kmemdup(&pdev->dev, match->data, sizeof(*pdata),
|
pdata = devm_kmemdup(&pdev->dev, match_pdata, sizeof(*pdata),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
if (!pdata)
|
if (!pdata)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
#include <linux/device.h>
|
#include <linux/device.h>
|
||||||
#include <linux/pm_runtime.h>
|
#include <linux/pm_runtime.h>
|
||||||
#include <linux/of.h>
|
#include <linux/of.h>
|
||||||
#include <linux/of_device.h>
|
|
||||||
#include <sound/core.h>
|
#include <sound/core.h>
|
||||||
#include <sound/pcm.h>
|
#include <sound/pcm.h>
|
||||||
#include <sound/pcm_params.h>
|
#include <sound/pcm_params.h>
|
||||||
@ -1360,23 +1359,22 @@ MODULE_DEVICE_TABLE(of, omap_mcbsp_of_match);
|
|||||||
static int asoc_mcbsp_probe(struct platform_device *pdev)
|
static int asoc_mcbsp_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct omap_mcbsp_platform_data *pdata = dev_get_platdata(&pdev->dev);
|
struct omap_mcbsp_platform_data *pdata = dev_get_platdata(&pdev->dev);
|
||||||
|
const struct omap_mcbsp_platform_data *match_pdata =
|
||||||
|
device_get_match_data(&pdev->dev);
|
||||||
struct omap_mcbsp *mcbsp;
|
struct omap_mcbsp *mcbsp;
|
||||||
const struct of_device_id *match;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
match = of_match_device(omap_mcbsp_of_match, &pdev->dev);
|
if (match_pdata) {
|
||||||
if (match) {
|
|
||||||
struct device_node *node = pdev->dev.of_node;
|
struct device_node *node = pdev->dev.of_node;
|
||||||
struct omap_mcbsp_platform_data *pdata_quirk = pdata;
|
struct omap_mcbsp_platform_data *pdata_quirk = pdata;
|
||||||
int buffer_size;
|
int buffer_size;
|
||||||
|
|
||||||
pdata = devm_kzalloc(&pdev->dev,
|
pdata = devm_kmemdup(&pdev->dev, match_pdata,
|
||||||
sizeof(struct omap_mcbsp_platform_data),
|
sizeof(struct omap_mcbsp_platform_data),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
if (!pdata)
|
if (!pdata)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
memcpy(pdata, match->data, sizeof(*pdata));
|
|
||||||
if (!of_property_read_u32(node, "ti,buffer-size", &buffer_size))
|
if (!of_property_read_u32(node, "ti,buffer-size", &buffer_size))
|
||||||
pdata->buffer_size = buffer_size;
|
pdata->buffer_size = buffer_size;
|
||||||
if (pdata_quirk)
|
if (pdata_quirk)
|
||||||
|
Loading…
Reference in New Issue
Block a user