Merge remote-tracking branches 'asoc/topic/fsl', 'asoc/topic/hdmi', 'asoc/topic/hisi' and 'asoc/topic/max9867' into asoc-next
This commit is contained in:
Коммит
5e9516db5f
|
@ -18,9 +18,11 @@
|
|||
#ifndef __HDMI_CODEC_H__
|
||||
#define __HDMI_CODEC_H__
|
||||
|
||||
#include <linux/of_graph.h>
|
||||
#include <linux/hdmi.h>
|
||||
#include <drm/drm_edid.h>
|
||||
#include <sound/asoundef.h>
|
||||
#include <sound/soc.h>
|
||||
#include <uapi/sound/asound.h>
|
||||
|
||||
/*
|
||||
|
@ -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 */
|
||||
|
|
|
@ -25,17 +25,6 @@
|
|||
|
||||
#include <drm/drm_crtc.h> /* 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 {
|
||||
|
@ -293,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;
|
||||
|
@ -702,6 +690,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 +705,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,30 +718,16 @@ 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)
|
||||
static int hdmi_of_xlate_dai_id(struct snd_soc_component *component,
|
||||
struct device_node *endpoint)
|
||||
{
|
||||
int id;
|
||||
struct hdmi_codec_priv *hcp = snd_soc_component_get_drvdata(component);
|
||||
int ret = -ENOTSUPP; /* see snd_soc_get_dai_id() */
|
||||
|
||||
if (args->args_count)
|
||||
id = args->args[0];
|
||||
else
|
||||
id = 0;
|
||||
if (hcp->hcd.ops->get_dai_id)
|
||||
ret = hcp->hcd.ops->get_dai_id(component, endpoint);
|
||||
|
||||
if (id < ARRAY_SIZE(hdmi_dai_name)) {
|
||||
*dai_name = hdmi_dai_name[id];
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -EAGAIN;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static struct snd_soc_codec_driver hdmi_codec = {
|
||||
|
@ -762,7 +738,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_name = hdmi_of_xlate_dai_name,
|
||||
.of_xlate_dai_id = hdmi_of_xlate_dai_id,
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -771,8 +747,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 +768,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 deteced\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
hcp->hcd = *hcd;
|
||||
mutex_init(&hcp->current_stream_lock);
|
||||
|
||||
|
@ -835,14 +780,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 +801,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);
|
||||
|
|
|
@ -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[] = {
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ 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,
|
||||
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);
|
||||
|
@ -175,7 +175,8 @@ int hi6210_i2s_startup(struct snd_pcm_substream *substream,
|
|||
|
||||
return 0;
|
||||
}
|
||||
void hi6210_i2s_shutdown(struct snd_pcm_substream *substream,
|
||||
|
||||
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);
|
||||
|
@ -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,
|
||||
|
|
Загрузка…
Ссылка в новой задаче