From 2a54e845f6e5069666e1749bd952abdc0413910d Mon Sep 17 00:00:00 2001 From: Takashi Sakamoto Date: Tue, 2 May 2017 22:33:02 +0900 Subject: ASoC: hisilicon: localize functions without external linkage A driver for hi6210 sound interface on hi6220 boards includes some functions which has no external linkage. These functions should have static qualifier. This commit adds the qualifier to localize the functions. This issue is detected by sparse: hi6210-i2s.c:100:5: warning: symbol 'hi6210_i2s_startup' was not declared. Should it be static? hi6210-i2s.c:178:6: warning: symbol 'hi6210_i2s_shutdown' was not declared. Should it be static? hi6210-i2s.c:527:27: warning: symbol 'hi6210_i2s_dai_init' was not declared. Should it be static? Signed-off-by: Takashi Sakamoto Signed-off-by: Mark Brown --- sound/soc/hisilicon/hi6210-i2s.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'sound') diff --git a/sound/soc/hisilicon/hi6210-i2s.c b/sound/soc/hisilicon/hi6210-i2s.c index 45163e5202f5..b193d3beb253 100644 --- a/sound/soc/hisilicon/hi6210-i2s.c +++ b/sound/soc/hisilicon/hi6210-i2s.c @@ -97,8 +97,8 @@ static inline u32 hi6210_read_reg(struct hi6210_i2s *i2s, int reg) return readl(i2s->base + reg); } -int hi6210_i2s_startup(struct snd_pcm_substream *substream, - struct snd_soc_dai *cpu_dai) +static int hi6210_i2s_startup(struct snd_pcm_substream *substream, + struct snd_soc_dai *cpu_dai) { struct hi6210_i2s *i2s = dev_get_drvdata(cpu_dai->dev); int ret, n; @@ -175,8 +175,9 @@ int hi6210_i2s_startup(struct snd_pcm_substream *substream, return 0; } -void hi6210_i2s_shutdown(struct snd_pcm_substream *substream, - struct snd_soc_dai *cpu_dai) + +static void hi6210_i2s_shutdown(struct snd_pcm_substream *substream, + struct snd_soc_dai *cpu_dai) { struct hi6210_i2s *i2s = dev_get_drvdata(cpu_dai->dev); int n; @@ -524,7 +525,7 @@ static struct snd_soc_dai_ops hi6210_i2s_dai_ops = { .shutdown = hi6210_i2s_shutdown, }; -struct snd_soc_dai_driver hi6210_i2s_dai_init = { +static const struct snd_soc_dai_driver hi6210_i2s_dai_init = { .probe = hi6210_i2s_dai_probe, .playback = { .channels_min = 2, -- cgit v1.2.3-59-g8ed1b From 0c343a35bfecdf26c7041781815f3b639a45d93a Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Sun, 14 May 2017 17:53:21 +0100 Subject: ASoC: hdmi-codec: fix spelling mistake: "deteced" -> "detected" Trivial fix to spelling mistake in dev_err message Signed-off-by: Colin Ian King Acked-by: Kuninori Morimoto Signed-off-by: Mark Brown --- sound/soc/codecs/hdmi-codec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c index 8c5ae1fc23a9..a3f15149afcf 100644 --- a/sound/soc/codecs/hdmi-codec.c +++ b/sound/soc/codecs/hdmi-codec.c @@ -819,7 +819,7 @@ static int hdmi_codec_probe(struct platform_device *pdev) mutex_unlock(&hdmi_mutex); if (hd->cnt >= ARRAY_SIZE(hdmi_dai_name)) { - dev_err(dev, "too many hdmi codec are deteced\n"); + dev_err(dev, "too many hdmi codec are detected\n"); return -EINVAL; } -- cgit v1.2.3-59-g8ed1b From 24069b589b02cc1292761b0f72623dd50ad1e19c Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Thu, 18 May 2017 01:40:02 +0000 Subject: ASoC: hdmi-codec: remove multi detection support DesignWare HDMI driver (= dw-hdmi) is supporting HDMI sound, and its probe function was calling sound binding function multiple times as same HDMI device different port. Because of this behavior, commit 9731f82d601 ("ASoC: hdmi-codec: enable multi probe for ...") was added for multi detection case. But, this DesignWare HDMI detection/bind code was exchanged/adjusted by commit 69497eb9234 ("drm: bridge: dw-hdmi: Implement DRM bridge..."). Now, all DesignWare HDMI sound ports are detected as 1 bindng function. Because of this, hdmi-codec multi detection support is no longer needed. Thus, this patch removes commit 9731f82d601 ("ASoC: hdmi-codec: enable multi probe for ..."), and its related commit 340327a62c4 ("ASoC: hdmi-codec: Fix hdmi_of_xlate_dai_name...") commit 8480ac56795 ("ASoC: hdmi-codec: remove HDMI device unregister") commit 0c343a35bfe ("ASoC: hdmi-codec: fix spelling mistake: ...) Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- sound/soc/codecs/hdmi-codec.c | 88 ++----------------------------------------- 1 file changed, 3 insertions(+), 85 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c index a3f15149afcf..8659b76b066a 100644 --- a/sound/soc/codecs/hdmi-codec.c +++ b/sound/soc/codecs/hdmi-codec.c @@ -25,17 +25,6 @@ #include /* This is only to get MAX_ELD_BYTES */ -struct hdmi_device { - struct device *dev; - struct list_head list; - int cnt; -}; -#define pos_to_hdmi_device(pos) container_of((pos), struct hdmi_device, list) -LIST_HEAD(hdmi_device_list); -static DEFINE_MUTEX(hdmi_mutex); - -#define DAI_NAME_SIZE 16 - #define HDMI_CODEC_CHMAP_IDX_UNKNOWN -1 struct hdmi_codec_channel_map_table { @@ -702,6 +691,7 @@ static int hdmi_codec_pcm_new(struct snd_soc_pcm_runtime *rtd, } static struct snd_soc_dai_driver hdmi_i2s_dai = { + .name = "i2s-hifi", .id = DAI_ID_I2S, .playback = { .stream_name = "Playback", @@ -716,6 +706,7 @@ static struct snd_soc_dai_driver hdmi_i2s_dai = { }; static const struct snd_soc_dai_driver hdmi_spdif_dai = { + .name = "spdif-hifi", .id = DAI_ID_SPDIF, .playback = { .stream_name = "Playback", @@ -728,32 +719,6 @@ static const struct snd_soc_dai_driver hdmi_spdif_dai = { .pcm_new = hdmi_codec_pcm_new, }; -static char hdmi_dai_name[][DAI_NAME_SIZE] = { - "hdmi-hifi.0", - "hdmi-hifi.1", - "hdmi-hifi.2", - "hdmi-hifi.3", -}; - -static int hdmi_of_xlate_dai_name(struct snd_soc_component *component, - struct of_phandle_args *args, - const char **dai_name) -{ - int id; - - if (args->args_count) - id = args->args[0]; - else - id = 0; - - if (id < ARRAY_SIZE(hdmi_dai_name)) { - *dai_name = hdmi_dai_name[id]; - return 0; - } - - return -EAGAIN; -} - static struct snd_soc_codec_driver hdmi_codec = { .component_driver = { .controls = hdmi_controls, @@ -762,7 +727,6 @@ static struct snd_soc_codec_driver hdmi_codec = { .num_dapm_widgets = ARRAY_SIZE(hdmi_widgets), .dapm_routes = hdmi_routes, .num_dapm_routes = ARRAY_SIZE(hdmi_routes), - .of_xlate_dai_name = hdmi_of_xlate_dai_name, }, }; @@ -771,8 +735,6 @@ static int hdmi_codec_probe(struct platform_device *pdev) struct hdmi_codec_pdata *hcd = pdev->dev.platform_data; struct device *dev = &pdev->dev; struct hdmi_codec_priv *hcp; - struct hdmi_device *hd; - struct list_head *pos; int dai_count, i = 0; int ret; @@ -794,35 +756,6 @@ static int hdmi_codec_probe(struct platform_device *pdev) if (!hcp) return -ENOMEM; - hd = NULL; - mutex_lock(&hdmi_mutex); - list_for_each(pos, &hdmi_device_list) { - struct hdmi_device *tmp = pos_to_hdmi_device(pos); - - if (tmp->dev == dev->parent) { - hd = tmp; - break; - } - } - - if (!hd) { - hd = devm_kzalloc(dev, sizeof(*hd), GFP_KERNEL); - if (!hd) { - mutex_unlock(&hdmi_mutex); - return -ENOMEM; - } - - hd->dev = dev->parent; - - list_add_tail(&hd->list, &hdmi_device_list); - } - mutex_unlock(&hdmi_mutex); - - if (hd->cnt >= ARRAY_SIZE(hdmi_dai_name)) { - dev_err(dev, "too many hdmi codec are detected\n"); - return -EINVAL; - } - hcp->hcd = *hcd; mutex_init(&hcp->current_stream_lock); @@ -835,14 +768,11 @@ static int hdmi_codec_probe(struct platform_device *pdev) hcp->daidrv[i] = hdmi_i2s_dai; hcp->daidrv[i].playback.channels_max = hcd->max_i2s_channels; - hcp->daidrv[i].name = hdmi_dai_name[hd->cnt++]; i++; } - if (hcd->spdif) { + if (hcd->spdif) hcp->daidrv[i] = hdmi_spdif_dai; - hcp->daidrv[i].name = hdmi_dai_name[hd->cnt++]; - } ret = snd_soc_register_codec(dev, &hdmi_codec, hcp->daidrv, dai_count); @@ -859,20 +789,8 @@ static int hdmi_codec_probe(struct platform_device *pdev) static int hdmi_codec_remove(struct platform_device *pdev) { struct device *dev = &pdev->dev; - struct list_head *pos; struct hdmi_codec_priv *hcp; - mutex_lock(&hdmi_mutex); - list_for_each(pos, &hdmi_device_list) { - struct hdmi_device *tmp = pos_to_hdmi_device(pos); - - if (tmp->dev == dev->parent) { - list_del(pos); - break; - } - } - mutex_unlock(&hdmi_mutex); - hcp = dev_get_drvdata(dev); kfree(hcp->chmap_info); snd_soc_unregister_codec(dev); -- cgit v1.2.3-59-g8ed1b From 96203fb4237bf70f0fd0fa307ca2975077db3ceb Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Thu, 18 May 2017 01:40:20 +0000 Subject: ASoC: hdmi-codec: add .get_dai_id support ALSA SoC needs to know connected DAI ID for probing. It is not a big problem if device/driver was only for sound, but getting DAI ID will be difficult if device includes both Video/Sound, like HDMI. To solve this issue, this patch adds new .get_dai_id callback on hdmi_codec_ops Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- include/sound/hdmi-codec.h | 9 +++++++++ sound/soc/codecs/hdmi-codec.c | 13 +++++++++++++ 2 files changed, 22 insertions(+) (limited to 'sound') diff --git a/include/sound/hdmi-codec.h b/include/sound/hdmi-codec.h index 915c4357945c..9483c55f871b 100644 --- a/include/sound/hdmi-codec.h +++ b/include/sound/hdmi-codec.h @@ -18,9 +18,11 @@ #ifndef __HDMI_CODEC_H__ #define __HDMI_CODEC_H__ +#include #include #include #include +#include #include /* @@ -87,6 +89,13 @@ struct hdmi_codec_ops { */ int (*get_eld)(struct device *dev, void *data, uint8_t *buf, size_t len); + + /* + * Getting DAI ID + * Optional + */ + int (*get_dai_id)(struct snd_soc_component *comment, + struct device_node *endpoint); }; /* HDMI codec initalization data */ diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c index 8659b76b066a..6d05161b625d 100644 --- a/sound/soc/codecs/hdmi-codec.c +++ b/sound/soc/codecs/hdmi-codec.c @@ -719,6 +719,18 @@ static const struct snd_soc_dai_driver hdmi_spdif_dai = { .pcm_new = hdmi_codec_pcm_new, }; +static int hdmi_of_xlate_dai_id(struct snd_soc_component *component, + struct device_node *endpoint) +{ + struct hdmi_codec_priv *hcp = snd_soc_component_get_drvdata(component); + int ret = -ENOTSUPP; /* see snd_soc_get_dai_id() */ + + if (hcp->hcd.ops->get_dai_id) + ret = hcp->hcd.ops->get_dai_id(component, endpoint); + + return ret; +} + static struct snd_soc_codec_driver hdmi_codec = { .component_driver = { .controls = hdmi_controls, @@ -727,6 +739,7 @@ static struct snd_soc_codec_driver hdmi_codec = { .num_dapm_widgets = ARRAY_SIZE(hdmi_widgets), .dapm_routes = hdmi_routes, .num_dapm_routes = ARRAY_SIZE(hdmi_routes), + .of_xlate_dai_id = hdmi_of_xlate_dai_id, }, }; -- cgit v1.2.3-59-g8ed1b From ca3b5ad30c0b32f8d12ddb307b698ff56d56c2aa Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Tue, 6 Jun 2017 23:16:01 +0000 Subject: ASoC: hdmi-codec: remove unused ratec struct snd_pcm_hw_constraint_list ratec is not used. Let's remove it Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- sound/soc/codecs/hdmi-codec.c | 1 - 1 file changed, 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c index 6d05161b625d..22ed0dc88f0a 100644 --- a/sound/soc/codecs/hdmi-codec.c +++ b/sound/soc/codecs/hdmi-codec.c @@ -282,7 +282,6 @@ struct hdmi_codec_priv { struct hdmi_codec_daifmt daifmt[2]; struct mutex current_stream_lock; struct snd_pcm_substream *current_stream; - struct snd_pcm_hw_constraint_list ratec; uint8_t eld[MAX_ELD_BYTES]; struct snd_pcm_chmap *chmap_info; unsigned int chmap_idx; -- cgit v1.2.3-59-g8ed1b From 372f69a01be178b896ebb8ef7021e0b165084b25 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Wed, 21 Jun 2017 04:37:18 +0000 Subject: ASoC: fsl: mpc5200_dma: remove unused psc_dma MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit linux/sound/soc/fsl/mpc5200_dma.c:305:18: warning: unused variable \ psc_dma’ [-Wunused-variable] Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- sound/soc/fsl/mpc5200_dma.c | 1 - 1 file changed, 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/fsl/mpc5200_dma.c b/sound/soc/fsl/mpc5200_dma.c index 0b82e209b6e3..1f7e70bfbd55 100644 --- a/sound/soc/fsl/mpc5200_dma.c +++ b/sound/soc/fsl/mpc5200_dma.c @@ -302,7 +302,6 @@ static int psc_dma_new(struct snd_soc_pcm_runtime *rtd) struct snd_card *card = rtd->card->snd_card; struct snd_soc_dai *dai = rtd->cpu_dai; struct snd_pcm *pcm = rtd->pcm; - struct psc_dma *psc_dma = snd_soc_dai_get_drvdata(rtd->cpu_dai); size_t size = psc_dma_hardware.buffer_bytes_max; int rc; -- cgit v1.2.3-59-g8ed1b From 1943b0661184a5d17f31624dc8ac2c02a086c998 Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Thu, 22 Jun 2017 10:32:31 +0100 Subject: ASoC: max9867: make array ni_div static const The array ni_div does not need to be in global scope and is not modified, so make it static const. Cleans up sparse warning: "symbol 'ni_div' was not declared. Should it be static?" Signed-off-by: Colin Ian King Acked-By: Vinod Koul Signed-off-by: Mark Brown --- sound/soc/codecs/max9867.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/codecs/max9867.c b/sound/soc/codecs/max9867.c index 0247edc9c84e..2a40a69a7513 100644 --- a/sound/soc/codecs/max9867.c +++ b/sound/soc/codecs/max9867.c @@ -132,7 +132,7 @@ enum rates { pcm_rate_48, max_pcm_rate, }; -struct ni_div_rates { +static const struct ni_div_rates { u32 mclk; u16 ni[max_pcm_rate]; } ni_div[] = { -- cgit v1.2.3-59-g8ed1b