Commit 90023c6e authored by Mark Brown's avatar Mark Brown

ASoC: fsl: Fix sparse warning

Merge series from Shengjiu Wang <shengjiu.wang@nxp.com>:

Fix sparse warnings in various fsl drivers.
parents 65fb8e2e 409a8652
...@@ -537,6 +537,7 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) ...@@ -537,6 +537,7 @@ static int fsl_asoc_card_probe(struct platform_device *pdev)
struct device *codec_dev = NULL; struct device *codec_dev = NULL;
const char *codec_dai_name; const char *codec_dai_name;
const char *codec_dev_name; const char *codec_dev_name;
u32 asrc_fmt = 0;
u32 width; u32 width;
int ret; int ret;
...@@ -829,8 +830,8 @@ static int fsl_asoc_card_probe(struct platform_device *pdev) ...@@ -829,8 +830,8 @@ static int fsl_asoc_card_probe(struct platform_device *pdev)
goto asrc_fail; goto asrc_fail;
} }
ret = of_property_read_u32(asrc_np, "fsl,asrc-format", ret = of_property_read_u32(asrc_np, "fsl,asrc-format", &asrc_fmt);
&priv->asrc_format); priv->asrc_format = (__force snd_pcm_format_t)asrc_fmt;
if (ret) { if (ret) {
/* Fallback to old binding; translate to asrc_format */ /* Fallback to old binding; translate to asrc_format */
ret = of_property_read_u32(asrc_np, "fsl,asrc-width", ret = of_property_read_u32(asrc_np, "fsl,asrc-width",
......
...@@ -1066,6 +1066,7 @@ static int fsl_asrc_probe(struct platform_device *pdev) ...@@ -1066,6 +1066,7 @@ static int fsl_asrc_probe(struct platform_device *pdev)
struct resource *res; struct resource *res;
void __iomem *regs; void __iomem *regs;
int irq, ret, i; int irq, ret, i;
u32 asrc_fmt = 0;
u32 map_idx; u32 map_idx;
char tmp[16]; char tmp[16];
u32 width; u32 width;
...@@ -1174,7 +1175,8 @@ static int fsl_asrc_probe(struct platform_device *pdev) ...@@ -1174,7 +1175,8 @@ static int fsl_asrc_probe(struct platform_device *pdev)
return ret; return ret;
} }
ret = of_property_read_u32(np, "fsl,asrc-format", &asrc->asrc_format); ret = of_property_read_u32(np, "fsl,asrc-format", &asrc_fmt);
asrc->asrc_format = (__force snd_pcm_format_t)asrc_fmt;
if (ret) { if (ret) {
ret = of_property_read_u32(np, "fsl,asrc-width", &width); ret = of_property_read_u32(np, "fsl,asrc-width", &width);
if (ret) { if (ret) {
...@@ -1197,7 +1199,7 @@ static int fsl_asrc_probe(struct platform_device *pdev) ...@@ -1197,7 +1199,7 @@ static int fsl_asrc_probe(struct platform_device *pdev)
} }
} }
if (!(FSL_ASRC_FORMATS & (1ULL << asrc->asrc_format))) { if (!(FSL_ASRC_FORMATS & pcm_format_to_bits(asrc->asrc_format))) {
dev_warn(&pdev->dev, "unsupported width, use default S24_LE\n"); dev_warn(&pdev->dev, "unsupported width, use default S24_LE\n");
asrc->asrc_format = SNDRV_PCM_FORMAT_S24_LE; asrc->asrc_format = SNDRV_PCM_FORMAT_S24_LE;
} }
......
...@@ -476,7 +476,8 @@ static int fsl_easrc_prefilter_config(struct fsl_asrc *easrc, ...@@ -476,7 +476,8 @@ static int fsl_easrc_prefilter_config(struct fsl_asrc *easrc,
struct fsl_asrc_pair *ctx; struct fsl_asrc_pair *ctx;
struct device *dev; struct device *dev;
u32 inrate, outrate, offset = 0; u32 inrate, outrate, offset = 0;
u32 in_s_rate, out_s_rate, in_s_fmt, out_s_fmt; u32 in_s_rate, out_s_rate;
snd_pcm_format_t in_s_fmt, out_s_fmt;
int ret, i; int ret, i;
if (!easrc) if (!easrc)
...@@ -1874,6 +1875,7 @@ static int fsl_easrc_probe(struct platform_device *pdev) ...@@ -1874,6 +1875,7 @@ static int fsl_easrc_probe(struct platform_device *pdev)
struct resource *res; struct resource *res;
struct device_node *np; struct device_node *np;
void __iomem *regs; void __iomem *regs;
u32 asrc_fmt = 0;
int ret, irq; int ret, irq;
easrc = devm_kzalloc(dev, sizeof(*easrc), GFP_KERNEL); easrc = devm_kzalloc(dev, sizeof(*easrc), GFP_KERNEL);
...@@ -1934,13 +1936,14 @@ static int fsl_easrc_probe(struct platform_device *pdev) ...@@ -1934,13 +1936,14 @@ static int fsl_easrc_probe(struct platform_device *pdev)
return ret; return ret;
} }
ret = of_property_read_u32(np, "fsl,asrc-format", &easrc->asrc_format); ret = of_property_read_u32(np, "fsl,asrc-format", &asrc_fmt);
easrc->asrc_format = (__force snd_pcm_format_t)asrc_fmt;
if (ret) { if (ret) {
dev_err(dev, "failed to asrc format\n"); dev_err(dev, "failed to asrc format\n");
return ret; return ret;
} }
if (!(FSL_EASRC_FORMATS & (1ULL << easrc->asrc_format))) { if (!(FSL_EASRC_FORMATS & (pcm_format_to_bits(easrc->asrc_format)))) {
dev_warn(dev, "unsupported format, switching to S24_LE\n"); dev_warn(dev, "unsupported format, switching to S24_LE\n");
easrc->asrc_format = SNDRV_PCM_FORMAT_S24_LE; easrc->asrc_format = SNDRV_PCM_FORMAT_S24_LE;
} }
......
...@@ -569,7 +569,7 @@ struct fsl_easrc_io_params { ...@@ -569,7 +569,7 @@ struct fsl_easrc_io_params {
unsigned int access_len; unsigned int access_len;
unsigned int fifo_wtmk; unsigned int fifo_wtmk;
unsigned int sample_rate; unsigned int sample_rate;
unsigned int sample_format; snd_pcm_format_t sample_format;
unsigned int norm_rate; unsigned int norm_rate;
}; };
......
...@@ -61,7 +61,7 @@ static inline bool fsl_sai_dir_is_synced(struct fsl_sai *sai, int dir) ...@@ -61,7 +61,7 @@ static inline bool fsl_sai_dir_is_synced(struct fsl_sai *sai, int dir)
static struct pinctrl_state *fsl_sai_get_pins_state(struct fsl_sai *sai, u32 bclk) static struct pinctrl_state *fsl_sai_get_pins_state(struct fsl_sai *sai, u32 bclk)
{ {
struct pinctrl_state *state = 0; struct pinctrl_state *state = NULL;
if (sai->is_pdm_mode) { if (sai->is_pdm_mode) {
/* DSD512@44.1kHz, DSD512@48kHz */ /* DSD512@44.1kHz, DSD512@48kHz */
......
...@@ -118,7 +118,7 @@ struct imx_card_data { ...@@ -118,7 +118,7 @@ struct imx_card_data {
struct snd_soc_card card; struct snd_soc_card card;
int num_dapm_routes; int num_dapm_routes;
u32 asrc_rate; u32 asrc_rate;
u32 asrc_format; snd_pcm_format_t asrc_format;
}; };
static struct imx_akcodec_fs_mul ak4458_fs_mul[] = { static struct imx_akcodec_fs_mul ak4458_fs_mul[] = {
...@@ -474,7 +474,7 @@ static int be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, ...@@ -474,7 +474,7 @@ static int be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
mask = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT); mask = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
snd_mask_none(mask); snd_mask_none(mask);
snd_mask_set(mask, data->asrc_format); snd_mask_set(mask, (__force unsigned int)data->asrc_format);
return 0; return 0;
} }
...@@ -493,6 +493,7 @@ static int imx_card_parse_of(struct imx_card_data *data) ...@@ -493,6 +493,7 @@ static int imx_card_parse_of(struct imx_card_data *data)
struct dai_link_data *link_data; struct dai_link_data *link_data;
struct of_phandle_args args; struct of_phandle_args args;
int ret, num_links; int ret, num_links;
u32 asrc_fmt = 0;
u32 width; u32 width;
ret = snd_soc_of_parse_card_name(card, "model"); ret = snd_soc_of_parse_card_name(card, "model");
...@@ -639,7 +640,8 @@ static int imx_card_parse_of(struct imx_card_data *data) ...@@ -639,7 +640,8 @@ static int imx_card_parse_of(struct imx_card_data *data)
goto err; goto err;
} }
ret = of_property_read_u32(args.np, "fsl,asrc-format", &data->asrc_format); ret = of_property_read_u32(args.np, "fsl,asrc-format", &asrc_fmt);
data->asrc_format = (__force snd_pcm_format_t)asrc_fmt;
if (ret) { if (ret) {
/* Fallback to old binding; translate to asrc_format */ /* Fallback to old binding; translate to asrc_format */
ret = of_property_read_u32(args.np, "fsl,asrc-width", &width); ret = of_property_read_u32(args.np, "fsl,asrc-width", &width);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment