Commit da7b34f8 authored by Mark Brown's avatar Mark Brown

Merge remote-tracking branches 'asoc/topic/da7218', 'asoc/topic/dai-drv',...

Merge remote-tracking branches 'asoc/topic/da7218', 'asoc/topic/dai-drv', 'asoc/topic/davinci', 'asoc/topic/disconnect' and 'asoc/topic/ep93xx' into asoc-next
...@@ -193,7 +193,7 @@ struct hda_dai_map { ...@@ -193,7 +193,7 @@ struct hda_dai_map {
* @pvt_data - private data, for asoc contains asoc codec object * @pvt_data - private data, for asoc contains asoc codec object
*/ */
struct hdac_ext_device { struct hdac_ext_device {
struct hdac_device hdac; struct hdac_device hdev;
struct hdac_ext_bus *ebus; struct hdac_ext_bus *ebus;
/* soc-dai to nid map */ /* soc-dai to nid map */
...@@ -213,7 +213,7 @@ struct hdac_ext_dma_params { ...@@ -213,7 +213,7 @@ struct hdac_ext_dma_params {
u8 stream_tag; u8 stream_tag;
}; };
#define to_ehdac_device(dev) (container_of((dev), \ #define to_ehdac_device(dev) (container_of((dev), \
struct hdac_ext_device, hdac)) struct hdac_ext_device, hdev))
/* /*
* HD-audio codec base driver * HD-audio codec base driver
*/ */
......
...@@ -860,12 +860,10 @@ struct snd_soc_component { ...@@ -860,12 +860,10 @@ struct snd_soc_component {
struct list_head card_aux_list; /* for auxiliary bound components */ struct list_head card_aux_list; /* for auxiliary bound components */
struct list_head card_list; struct list_head card_list;
struct snd_soc_dai_driver *dai_drv;
int num_dai;
const struct snd_soc_component_driver *driver; const struct snd_soc_component_driver *driver;
struct list_head dai_list; struct list_head dai_list;
int num_dai;
int (*read)(struct snd_soc_component *, unsigned int, unsigned int *); int (*read)(struct snd_soc_component *, unsigned int, unsigned int *);
int (*write)(struct snd_soc_component *, unsigned int, unsigned int); int (*write)(struct snd_soc_component *, unsigned int, unsigned int);
......
...@@ -146,7 +146,7 @@ int snd_hdac_ext_bus_device_init(struct hdac_ext_bus *ebus, int addr) ...@@ -146,7 +146,7 @@ int snd_hdac_ext_bus_device_init(struct hdac_ext_bus *ebus, int addr)
edev = kzalloc(sizeof(*edev), GFP_KERNEL); edev = kzalloc(sizeof(*edev), GFP_KERNEL);
if (!edev) if (!edev)
return -ENOMEM; return -ENOMEM;
hdev = &edev->hdac; hdev = &edev->hdev;
edev->ebus = ebus; edev->ebus = ebus;
snprintf(name, sizeof(name), "ehdaudio%dD%d", ebus->idx, addr); snprintf(name, sizeof(name), "ehdaudio%dD%d", ebus->idx, addr);
......
...@@ -365,7 +365,7 @@ static int ep93xx_ac97_probe(struct platform_device *pdev) ...@@ -365,7 +365,7 @@ static int ep93xx_ac97_probe(struct platform_device *pdev)
{ {
struct ep93xx_ac97_info *info; struct ep93xx_ac97_info *info;
struct resource *res; struct resource *res;
unsigned int irq; int irq;
int ret; int ret;
info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
...@@ -378,8 +378,8 @@ static int ep93xx_ac97_probe(struct platform_device *pdev) ...@@ -378,8 +378,8 @@ static int ep93xx_ac97_probe(struct platform_device *pdev)
return PTR_ERR(info->regs); return PTR_ERR(info->regs);
irq = platform_get_irq(pdev, 0); irq = platform_get_irq(pdev, 0);
if (!irq) if (irq <= 0)
return -ENODEV; return irq < 0 ? irq : -ENODEV;
ret = devm_request_irq(&pdev->dev, irq, ep93xx_ac97_interrupt, ret = devm_request_irq(&pdev->dev, irq, ep93xx_ac97_interrupt,
IRQF_TRIGGER_HIGH, pdev->name, info); IRQF_TRIGGER_HIGH, pdev->name, info);
......
...@@ -2455,10 +2455,8 @@ static struct da7218_pdata *da7218_of_to_pdata(struct snd_soc_codec *codec) ...@@ -2455,10 +2455,8 @@ static struct da7218_pdata *da7218_of_to_pdata(struct snd_soc_codec *codec)
u32 of_val32; u32 of_val32;
pdata = devm_kzalloc(codec->dev, sizeof(*pdata), GFP_KERNEL); pdata = devm_kzalloc(codec->dev, sizeof(*pdata), GFP_KERNEL);
if (!pdata) { if (!pdata)
dev_warn(codec->dev, "Failed to allocate memory for pdata\n");
return NULL; return NULL;
}
if (of_property_read_u32(np, "dlg,micbias1-lvl-millivolt", &of_val32) >= 0) if (of_property_read_u32(np, "dlg,micbias1-lvl-millivolt", &of_val32) >= 0)
pdata->micbias1_lvl = da7218_of_micbias_lvl(codec, of_val32); pdata->micbias1_lvl = da7218_of_micbias_lvl(codec, of_val32);
...@@ -2527,8 +2525,6 @@ static struct da7218_pdata *da7218_of_to_pdata(struct snd_soc_codec *codec) ...@@ -2527,8 +2525,6 @@ static struct da7218_pdata *da7218_of_to_pdata(struct snd_soc_codec *codec)
hpldet_pdata = devm_kzalloc(codec->dev, sizeof(*hpldet_pdata), hpldet_pdata = devm_kzalloc(codec->dev, sizeof(*hpldet_pdata),
GFP_KERNEL); GFP_KERNEL);
if (!hpldet_pdata) { if (!hpldet_pdata) {
dev_warn(codec->dev,
"Failed to allocate memory for hpldet pdata\n");
of_node_put(hpldet_np); of_node_put(hpldet_np);
return pdata; return pdata;
} }
...@@ -3273,8 +3269,7 @@ static int da7218_i2c_probe(struct i2c_client *i2c, ...@@ -3273,8 +3269,7 @@ static int da7218_i2c_probe(struct i2c_client *i2c,
struct da7218_priv *da7218; struct da7218_priv *da7218;
int ret; int ret;
da7218 = devm_kzalloc(&i2c->dev, sizeof(struct da7218_priv), da7218 = devm_kzalloc(&i2c->dev, sizeof(*da7218), GFP_KERNEL);
GFP_KERNEL);
if (!da7218) if (!da7218)
return -ENOMEM; return -ENOMEM;
......
...@@ -136,8 +136,11 @@ struct hdac_hdmi_priv { ...@@ -136,8 +136,11 @@ struct hdac_hdmi_priv {
struct mutex pin_mutex; struct mutex pin_mutex;
struct hdac_chmap chmap; struct hdac_chmap chmap;
struct hdac_hdmi_drv_data *drv_data; struct hdac_hdmi_drv_data *drv_data;
struct snd_soc_dai_driver *dai_drv;
}; };
#define hdev_to_hdmi_priv(_hdev) ((to_ehdac_device(_hdev))->private_data)
static struct hdac_hdmi_pcm * static struct hdac_hdmi_pcm *
hdac_hdmi_get_pcm_from_cvt(struct hdac_hdmi_priv *hdmi, hdac_hdmi_get_pcm_from_cvt(struct hdac_hdmi_priv *hdmi,
struct hdac_hdmi_cvt *cvt) struct hdac_hdmi_cvt *cvt)
...@@ -169,7 +172,7 @@ static void hdac_hdmi_jack_report(struct hdac_hdmi_pcm *pcm, ...@@ -169,7 +172,7 @@ static void hdac_hdmi_jack_report(struct hdac_hdmi_pcm *pcm,
* ports. * ports.
*/ */
if (pcm->jack_event == 0) { if (pcm->jack_event == 0) {
dev_dbg(&edev->hdac.dev, dev_dbg(&edev->hdev.dev,
"jack report for pcm=%d\n", "jack report for pcm=%d\n",
pcm->pcm_id); pcm->pcm_id);
snd_soc_jack_report(pcm->jack, SND_JACK_AVOUT, snd_soc_jack_report(pcm->jack, SND_JACK_AVOUT,
...@@ -195,18 +198,18 @@ static void hdac_hdmi_jack_report(struct hdac_hdmi_pcm *pcm, ...@@ -195,18 +198,18 @@ static void hdac_hdmi_jack_report(struct hdac_hdmi_pcm *pcm,
/* /*
* Get the no devices that can be connected to a port on the Pin widget. * Get the no devices that can be connected to a port on the Pin widget.
*/ */
static int hdac_hdmi_get_port_len(struct hdac_ext_device *hdac, hda_nid_t nid) static int hdac_hdmi_get_port_len(struct hdac_ext_device *edev, hda_nid_t nid)
{ {
unsigned int caps; unsigned int caps;
unsigned int type, param; unsigned int type, param;
caps = get_wcaps(&hdac->hdac, nid); caps = get_wcaps(&edev->hdev, nid);
type = get_wcaps_type(caps); type = get_wcaps_type(caps);
if (!(caps & AC_WCAP_DIGITAL) || (type != AC_WID_PIN)) if (!(caps & AC_WCAP_DIGITAL) || (type != AC_WID_PIN))
return 0; return 0;
param = snd_hdac_read_parm_uncached(&hdac->hdac, nid, param = snd_hdac_read_parm_uncached(&edev->hdev, nid,
AC_PAR_DEVLIST_LEN); AC_PAR_DEVLIST_LEN);
if (param == -1) if (param == -1)
return param; return param;
...@@ -219,10 +222,10 @@ static int hdac_hdmi_get_port_len(struct hdac_ext_device *hdac, hda_nid_t nid) ...@@ -219,10 +222,10 @@ static int hdac_hdmi_get_port_len(struct hdac_ext_device *hdac, hda_nid_t nid)
* id selected on the pin. Return 0 means the first port entry * id selected on the pin. Return 0 means the first port entry
* is selected or MST is not supported. * is selected or MST is not supported.
*/ */
static int hdac_hdmi_port_select_get(struct hdac_ext_device *hdac, static int hdac_hdmi_port_select_get(struct hdac_ext_device *edev,
struct hdac_hdmi_port *port) struct hdac_hdmi_port *port)
{ {
return snd_hdac_codec_read(&hdac->hdac, port->pin->nid, return snd_hdac_codec_read(&edev->hdev, port->pin->nid,
0, AC_VERB_GET_DEVICE_SEL, 0); 0, AC_VERB_GET_DEVICE_SEL, 0);
} }
...@@ -230,7 +233,7 @@ static int hdac_hdmi_port_select_get(struct hdac_ext_device *hdac, ...@@ -230,7 +233,7 @@ static int hdac_hdmi_port_select_get(struct hdac_ext_device *hdac,
* Sets the selected port entry for the configuring Pin widget verb. * Sets the selected port entry for the configuring Pin widget verb.
* returns error if port set is not equal to port get otherwise success * returns error if port set is not equal to port get otherwise success
*/ */
static int hdac_hdmi_port_select_set(struct hdac_ext_device *hdac, static int hdac_hdmi_port_select_set(struct hdac_ext_device *edev,
struct hdac_hdmi_port *port) struct hdac_hdmi_port *port)
{ {
int num_ports; int num_ports;
...@@ -239,7 +242,7 @@ static int hdac_hdmi_port_select_set(struct hdac_ext_device *hdac, ...@@ -239,7 +242,7 @@ static int hdac_hdmi_port_select_set(struct hdac_ext_device *hdac,
return 0; return 0;
/* AC_PAR_DEVLIST_LEN is 0 based. */ /* AC_PAR_DEVLIST_LEN is 0 based. */
num_ports = hdac_hdmi_get_port_len(hdac, port->pin->nid); num_ports = hdac_hdmi_get_port_len(edev, port->pin->nid);
if (num_ports < 0) if (num_ports < 0)
return -EIO; return -EIO;
...@@ -250,13 +253,13 @@ static int hdac_hdmi_port_select_set(struct hdac_ext_device *hdac, ...@@ -250,13 +253,13 @@ static int hdac_hdmi_port_select_set(struct hdac_ext_device *hdac,
if (num_ports + 1 < port->id) if (num_ports + 1 < port->id)
return 0; return 0;
snd_hdac_codec_write(&hdac->hdac, port->pin->nid, 0, snd_hdac_codec_write(&edev->hdev, port->pin->nid, 0,
AC_VERB_SET_DEVICE_SEL, port->id); AC_VERB_SET_DEVICE_SEL, port->id);
if (port->id != hdac_hdmi_port_select_get(hdac, port)) if (port->id != hdac_hdmi_port_select_get(edev, port))
return -EIO; return -EIO;
dev_dbg(&hdac->hdac.dev, "Selected the port=%d\n", port->id); dev_dbg(&edev->hdev.dev, "Selected the port=%d\n", port->id);
return 0; return 0;
} }
...@@ -276,9 +279,9 @@ static struct hdac_hdmi_pcm *get_hdmi_pcm_from_id(struct hdac_hdmi_priv *hdmi, ...@@ -276,9 +279,9 @@ static struct hdac_hdmi_pcm *get_hdmi_pcm_from_id(struct hdac_hdmi_priv *hdmi,
static inline struct hdac_ext_device *to_hda_ext_device(struct device *dev) static inline struct hdac_ext_device *to_hda_ext_device(struct device *dev)
{ {
struct hdac_device *hdac = dev_to_hdac_dev(dev); struct hdac_device *hdev = dev_to_hdac_dev(dev);
return to_ehdac_device(hdac); return to_ehdac_device(hdev);
} }
static unsigned int sad_format(const u8 *sad) static unsigned int sad_format(const u8 *sad)
...@@ -321,14 +324,14 @@ static int hdac_hdmi_eld_limit_formats(struct snd_pcm_runtime *runtime, ...@@ -321,14 +324,14 @@ static int hdac_hdmi_eld_limit_formats(struct snd_pcm_runtime *runtime,
} }
static void static void
hdac_hdmi_set_dip_index(struct hdac_ext_device *hdac, hda_nid_t pin_nid, hdac_hdmi_set_dip_index(struct hdac_ext_device *edev, hda_nid_t pin_nid,
int packet_index, int byte_index) int packet_index, int byte_index)
{ {
int val; int val;
val = (packet_index << 5) | (byte_index & 0x1f); val = (packet_index << 5) | (byte_index & 0x1f);
snd_hdac_codec_write(&hdac->hdac, pin_nid, 0, snd_hdac_codec_write(&edev->hdev, pin_nid, 0,
AC_VERB_SET_HDMI_DIP_INDEX, val); AC_VERB_SET_HDMI_DIP_INDEX, val);
} }
...@@ -344,14 +347,14 @@ struct dp_audio_infoframe { ...@@ -344,14 +347,14 @@ struct dp_audio_infoframe {
u8 LFEPBL01_LSV36_DM_INH7; u8 LFEPBL01_LSV36_DM_INH7;
}; };
static int hdac_hdmi_setup_audio_infoframe(struct hdac_ext_device *hdac, static int hdac_hdmi_setup_audio_infoframe(struct hdac_ext_device *edev,
struct hdac_hdmi_pcm *pcm, struct hdac_hdmi_port *port) struct hdac_hdmi_pcm *pcm, struct hdac_hdmi_port *port)
{ {
uint8_t buffer[HDMI_INFOFRAME_HEADER_SIZE + HDMI_AUDIO_INFOFRAME_SIZE]; uint8_t buffer[HDMI_INFOFRAME_HEADER_SIZE + HDMI_AUDIO_INFOFRAME_SIZE];
struct hdmi_audio_infoframe frame; struct hdmi_audio_infoframe frame;
struct hdac_hdmi_pin *pin = port->pin; struct hdac_hdmi_pin *pin = port->pin;
struct dp_audio_infoframe dp_ai; struct dp_audio_infoframe dp_ai;
struct hdac_hdmi_priv *hdmi = hdac->private_data; struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdev);
struct hdac_hdmi_cvt *cvt = pcm->cvt; struct hdac_hdmi_cvt *cvt = pcm->cvt;
u8 *dip; u8 *dip;
int ret; int ret;
...@@ -360,11 +363,11 @@ static int hdac_hdmi_setup_audio_infoframe(struct hdac_ext_device *hdac, ...@@ -360,11 +363,11 @@ static int hdac_hdmi_setup_audio_infoframe(struct hdac_ext_device *hdac,
u8 conn_type; u8 conn_type;
int channels, ca; int channels, ca;
ca = snd_hdac_channel_allocation(&hdac->hdac, port->eld.info.spk_alloc, ca = snd_hdac_channel_allocation(&edev->hdev, port->eld.info.spk_alloc,
pcm->channels, pcm->chmap_set, true, pcm->chmap); pcm->channels, pcm->chmap_set, true, pcm->chmap);
channels = snd_hdac_get_active_channels(ca); channels = snd_hdac_get_active_channels(ca);
hdmi->chmap.ops.set_channel_count(&hdac->hdac, cvt->nid, channels); hdmi->chmap.ops.set_channel_count(&edev->hdev, cvt->nid, channels);
snd_hdac_setup_channel_mapping(&hdmi->chmap, pin->nid, false, ca, snd_hdac_setup_channel_mapping(&hdmi->chmap, pin->nid, false, ca,
pcm->channels, pcm->chmap, pcm->chmap_set); pcm->channels, pcm->chmap, pcm->chmap_set);
...@@ -397,32 +400,32 @@ static int hdac_hdmi_setup_audio_infoframe(struct hdac_ext_device *hdac, ...@@ -397,32 +400,32 @@ static int hdac_hdmi_setup_audio_infoframe(struct hdac_ext_device *hdac,
break; break;
default: default:
dev_err(&hdac->hdac.dev, "Invalid connection type: %d\n", dev_err(&edev->hdev.dev, "Invalid connection type: %d\n",
conn_type); conn_type);
return -EIO; return -EIO;
} }
/* stop infoframe transmission */ /* stop infoframe transmission */
hdac_hdmi_set_dip_index(hdac, pin->nid, 0x0, 0x0); hdac_hdmi_set_dip_index(edev, pin->nid, 0x0, 0x0);
snd_hdac_codec_write(&hdac->hdac, pin->nid, 0, snd_hdac_codec_write(&edev->hdev, pin->nid, 0,
AC_VERB_SET_HDMI_DIP_XMIT, AC_DIPXMIT_DISABLE); AC_VERB_SET_HDMI_DIP_XMIT, AC_DIPXMIT_DISABLE);
/* Fill infoframe. Index auto-incremented */ /* Fill infoframe. Index auto-incremented */
hdac_hdmi_set_dip_index(hdac, pin->nid, 0x0, 0x0); hdac_hdmi_set_dip_index(edev, pin->nid, 0x0, 0x0);
if (conn_type == DRM_ELD_CONN_TYPE_HDMI) { if (conn_type == DRM_ELD_CONN_TYPE_HDMI) {
for (i = 0; i < sizeof(buffer); i++) for (i = 0; i < sizeof(buffer); i++)
snd_hdac_codec_write(&hdac->hdac, pin->nid, 0, snd_hdac_codec_write(&edev->hdev, pin->nid, 0,
AC_VERB_SET_HDMI_DIP_DATA, buffer[i]); AC_VERB_SET_HDMI_DIP_DATA, buffer[i]);
} else { } else {
for (i = 0; i < sizeof(dp_ai); i++) for (i = 0; i < sizeof(dp_ai); i++)
snd_hdac_codec_write(&hdac->hdac, pin->nid, 0, snd_hdac_codec_write(&edev->hdev, pin->nid, 0,
AC_VERB_SET_HDMI_DIP_DATA, dip[i]); AC_VERB_SET_HDMI_DIP_DATA, dip[i]);
} }
/* Start infoframe */ /* Start infoframe */
hdac_hdmi_set_dip_index(hdac, pin->nid, 0x0, 0x0); hdac_hdmi_set_dip_index(edev, pin->nid, 0x0, 0x0);
snd_hdac_codec_write(&hdac->hdac, pin->nid, 0, snd_hdac_codec_write(&edev->hdev, pin->nid, 0,
AC_VERB_SET_HDMI_DIP_XMIT, AC_DIPXMIT_BEST); AC_VERB_SET_HDMI_DIP_XMIT, AC_DIPXMIT_BEST);
return 0; return 0;
...@@ -433,11 +436,11 @@ static int hdac_hdmi_set_tdm_slot(struct snd_soc_dai *dai, ...@@ -433,11 +436,11 @@ static int hdac_hdmi_set_tdm_slot(struct snd_soc_dai *dai,
int slots, int slot_width) int slots, int slot_width)
{ {
struct hdac_ext_device *edev = snd_soc_dai_get_drvdata(dai); struct hdac_ext_device *edev = snd_soc_dai_get_drvdata(dai);
struct hdac_hdmi_priv *hdmi = edev->private_data; struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdev);
struct hdac_hdmi_dai_port_map *dai_map; struct hdac_hdmi_dai_port_map *dai_map;
struct hdac_hdmi_pcm *pcm; struct hdac_hdmi_pcm *pcm;
dev_dbg(&edev->hdac.dev, "%s: strm_tag: %d\n", __func__, tx_mask); dev_dbg(&edev->hdev.dev, "%s: strm_tag: %d\n", __func__, tx_mask);
dai_map = &hdmi->dai_map[dai->id]; dai_map = &hdmi->dai_map[dai->id];
...@@ -452,8 +455,8 @@ static int hdac_hdmi_set_tdm_slot(struct snd_soc_dai *dai, ...@@ -452,8 +455,8 @@ static int hdac_hdmi_set_tdm_slot(struct snd_soc_dai *dai,
static int hdac_hdmi_set_hw_params(struct snd_pcm_substream *substream, static int hdac_hdmi_set_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *hparams, struct snd_soc_dai *dai) struct snd_pcm_hw_params *hparams, struct snd_soc_dai *dai)
{ {
struct hdac_ext_device *hdac = snd_soc_dai_get_drvdata(dai); struct hdac_ext_device *edev = snd_soc_dai_get_drvdata(dai);
struct hdac_hdmi_priv *hdmi = hdac->private_data; struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdev);
struct hdac_hdmi_dai_port_map *dai_map; struct hdac_hdmi_dai_port_map *dai_map;
struct hdac_hdmi_port *port; struct hdac_hdmi_port *port;
struct hdac_hdmi_pcm *pcm; struct hdac_hdmi_pcm *pcm;
...@@ -466,7 +469,7 @@ static int hdac_hdmi_set_hw_params(struct snd_pcm_substream *substream, ...@@ -466,7 +469,7 @@ static int hdac_hdmi_set_hw_params(struct snd_pcm_substream *substream,
return -ENODEV; return -ENODEV;
if ((!port->eld.monitor_present) || (!port->eld.eld_valid)) { if ((!port->eld.monitor_present) || (!port->eld.eld_valid)) {
dev_err(&hdac->hdac.dev, dev_err(&edev->hdev.dev,
"device is not configured for this pin:port%d:%d\n", "device is not configured for this pin:port%d:%d\n",
port->pin->nid, port->id); port->pin->nid, port->id);
return -ENODEV; return -ENODEV;
...@@ -486,28 +489,28 @@ static int hdac_hdmi_set_hw_params(struct snd_pcm_substream *substream, ...@@ -486,28 +489,28 @@ static int hdac_hdmi_set_hw_params(struct snd_pcm_substream *substream,
return 0; return 0;
} }
static int hdac_hdmi_query_port_connlist(struct hdac_ext_device *hdac, static int hdac_hdmi_query_port_connlist(struct hdac_ext_device *edev,
struct hdac_hdmi_pin *pin, struct hdac_hdmi_pin *pin,
struct hdac_hdmi_port *port) struct hdac_hdmi_port *port)
{ {
if (!(get_wcaps(&hdac->hdac, pin->nid) & AC_WCAP_CONN_LIST)) { if (!(get_wcaps(&edev->hdev, pin->nid) & AC_WCAP_CONN_LIST)) {
dev_warn(&hdac->hdac.dev, dev_warn(&edev->hdev.dev,
"HDMI: pin %d wcaps %#x does not support connection list\n", "HDMI: pin %d wcaps %#x does not support connection list\n",
pin->nid, get_wcaps(&hdac->hdac, pin->nid)); pin->nid, get_wcaps(&edev->hdev, pin->nid));
return -EINVAL; return -EINVAL;
} }
if (hdac_hdmi_port_select_set(hdac, port) < 0) if (hdac_hdmi_port_select_set(edev, port) < 0)
return -EIO; return -EIO;
port->num_mux_nids = snd_hdac_get_connections(&hdac->hdac, pin->nid, port->num_mux_nids = snd_hdac_get_connections(&edev->hdev, pin->nid,
port->mux_nids, HDA_MAX_CONNECTIONS); port->mux_nids, HDA_MAX_CONNECTIONS);
if (port->num_mux_nids == 0) if (port->num_mux_nids == 0)
dev_warn(&hdac->hdac.dev, dev_warn(&edev->hdev.dev,
"No connections found for pin:port %d:%d\n", "No connections found for pin:port %d:%d\n",
pin->nid, port->id); pin->nid, port->id);
dev_dbg(&hdac->hdac.dev, "num_mux_nids %d for pin:port %d:%d\n", dev_dbg(&edev->hdev.dev, "num_mux_nids %d for pin:port %d:%d\n",
port->num_mux_nids, pin->nid, port->id); port->num_mux_nids, pin->nid, port->id);
return port->num_mux_nids; return port->num_mux_nids;
...@@ -565,8 +568,8 @@ static struct hdac_hdmi_port *hdac_hdmi_get_port_from_cvt( ...@@ -565,8 +568,8 @@ static struct hdac_hdmi_port *hdac_hdmi_get_port_from_cvt(
static int hdac_hdmi_pcm_open(struct snd_pcm_substream *substream, static int hdac_hdmi_pcm_open(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai) struct snd_soc_dai *dai)
{ {
struct hdac_ext_device *hdac = snd_soc_dai_get_drvdata(dai); struct hdac_ext_device *edev = snd_soc_dai_get_drvdata(dai);
struct hdac_hdmi_priv *hdmi = hdac->private_data; struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdev);
struct hdac_hdmi_dai_port_map *dai_map; struct hdac_hdmi_dai_port_map *dai_map;
struct hdac_hdmi_cvt *cvt; struct hdac_hdmi_cvt *cvt;
struct hdac_hdmi_port *port; struct hdac_hdmi_port *port;
...@@ -575,7 +578,7 @@ static int hdac_hdmi_pcm_open(struct snd_pcm_substream *substream, ...@@ -575,7 +578,7 @@ static int hdac_hdmi_pcm_open(struct snd_pcm_substream *substream,
dai_map = &hdmi->dai_map[dai->id]; dai_map = &hdmi->dai_map[dai->id];
cvt = dai_map->cvt; cvt = dai_map->cvt;
port = hdac_hdmi_get_port_from_cvt(hdac, hdmi, cvt); port = hdac_hdmi_get_port_from_cvt(edev, hdmi, cvt);
/* /*
* To make PA and other userland happy. * To make PA and other userland happy.
...@@ -586,7 +589,7 @@ static int hdac_hdmi_pcm_open(struct snd_pcm_substream *substream, ...@@ -586,7 +589,7 @@ static int hdac_hdmi_pcm_open(struct snd_pcm_substream *substream,
if ((!port->eld.monitor_present) || if ((!port->eld.monitor_present) ||
(!port->eld.eld_valid)) { (!port->eld.eld_valid)) {
dev_warn(&hdac->hdac.dev, dev_warn(&edev->hdev.dev,
"Failed: present?:%d ELD valid?:%d pin:port: %d:%d\n", "Failed: present?:%d ELD valid?:%d pin:port: %d:%d\n",
port->eld.monitor_present, port->eld.eld_valid, port->eld.monitor_present, port->eld.eld_valid,
port->pin->nid, port->id); port->pin->nid, port->id);
...@@ -608,8 +611,8 @@ static int hdac_hdmi_pcm_open(struct snd_pcm_substream *substream, ...@@ -608,8 +611,8 @@ static int hdac_hdmi_pcm_open(struct snd_pcm_substream *substream,
static void hdac_hdmi_pcm_close(struct snd_pcm_substream *substream, static void hdac_hdmi_pcm_close(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai) struct snd_soc_dai *dai)
{ {
struct hdac_ext_device *hdac = snd_soc_dai_get_drvdata(dai); struct hdac_ext_device *edev = snd_soc_dai_get_drvdata(dai);
struct hdac_hdmi_priv *hdmi = hdac->private_data; struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdev);
struct hdac_hdmi_dai_port_map *dai_map; struct hdac_hdmi_dai_port_map *dai_map;
struct hdac_hdmi_pcm *pcm; struct hdac_hdmi_pcm *pcm;
...@@ -630,14 +633,13 @@ static void hdac_hdmi_pcm_close(struct snd_pcm_substream *substream, ...@@ -630,14 +633,13 @@ static void hdac_hdmi_pcm_close(struct snd_pcm_substream *substream,
} }
static int static int
hdac_hdmi_query_cvt_params(struct hdac_device *hdac, struct hdac_hdmi_cvt *cvt) hdac_hdmi_query_cvt_params(struct hdac_device *hdev, struct hdac_hdmi_cvt *cvt)
{ {
unsigned int chans; unsigned int chans;
struct hdac_ext_device *edev = to_ehdac_device(hdac); struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev);
struct hdac_hdmi_priv *hdmi = edev->private_data;
int err; int err;
chans = get_wcaps(hdac, cvt->nid); chans = get_wcaps(hdev, cvt->nid);
chans = get_wcaps_channels(chans); chans = get_wcaps_channels(chans);
cvt->params.channels_min = 2; cvt->params.channels_min = 2;
...@@ -646,12 +648,12 @@ hdac_hdmi_query_cvt_params(struct hdac_device *hdac, struct hdac_hdmi_cvt *cvt) ...@@ -646,12 +648,12 @@ hdac_hdmi_query_cvt_params(struct hdac_device *hdac, struct hdac_hdmi_cvt *cvt)
if (chans > hdmi->chmap.channels_max) if (chans > hdmi->chmap.channels_max)
hdmi->chmap.channels_max = chans; hdmi->chmap.channels_max = chans;
err = snd_hdac_query_supported_pcm(hdac, cvt->nid, err = snd_hdac_query_supported_pcm(hdev, cvt->nid,
&cvt->params.rates, &cvt->params.rates,
&cvt->params.formats, &cvt->params.formats,
&cvt->params.maxbps); &cvt->params.maxbps);
if (err < 0) if (err < 0)
dev_err(&hdac->dev, dev_err(&hdev->dev,
"Failed to query pcm params for nid %d: %d\n", "Failed to query pcm params for nid %d: %d\n",
cvt->nid, err); cvt->nid, err);
...@@ -696,7 +698,7 @@ static void hdac_hdmi_fill_route(struct snd_soc_dapm_route *route, ...@@ -696,7 +698,7 @@ static void hdac_hdmi_fill_route(struct snd_soc_dapm_route *route,
static struct hdac_hdmi_pcm *hdac_hdmi_get_pcm(struct hdac_ext_device *edev, static struct hdac_hdmi_pcm *hdac_hdmi_get_pcm(struct hdac_ext_device *edev,
struct hdac_hdmi_port *port) struct hdac_hdmi_port *port)
{ {
struct hdac_hdmi_priv *hdmi = edev->private_data; struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdev);
struct hdac_hdmi_pcm *pcm = NULL; struct hdac_hdmi_pcm *pcm = NULL;
struct hdac_hdmi_port *p; struct hdac_hdmi_port *p;
...@@ -716,9 +718,9 @@ static struct hdac_hdmi_pcm *hdac_hdmi_get_pcm(struct hdac_ext_device *edev, ...@@ -716,9 +718,9 @@ static struct hdac_hdmi_pcm *hdac_hdmi_get_pcm(struct hdac_ext_device *edev,
static void hdac_hdmi_set_power_state(struct hdac_ext_device *edev, static void hdac_hdmi_set_power_state(struct hdac_ext_device *edev,
hda_nid_t nid, unsigned int pwr_state) hda_nid_t nid, unsigned int pwr_state)
{ {
if (get_wcaps(&edev->hdac, nid) & AC_WCAP_POWER) { if (get_wcaps(&edev->hdev, nid) & AC_WCAP_POWER) {
if (!snd_hdac_check_power_state(&edev->hdac, nid, pwr_state)) if (!snd_hdac_check_power_state(&edev->hdev, nid, pwr_state))
snd_hdac_codec_write(&edev->hdac, nid, 0, snd_hdac_codec_write(&edev->hdev, nid, 0,
AC_VERB_SET_POWER_STATE, pwr_state); AC_VERB_SET_POWER_STATE, pwr_state);
} }
} }
...@@ -726,8 +728,8 @@ static void hdac_hdmi_set_power_state(struct hdac_ext_device *edev, ...@@ -726,8 +728,8 @@ static void hdac_hdmi_set_power_state(struct hdac_ext_device *edev,
static void hdac_hdmi_set_amp(struct hdac_ext_device *edev, static void hdac_hdmi_set_amp(struct hdac_ext_device *edev,
hda_nid_t nid, int val) hda_nid_t nid, int val)
{ {
if (get_wcaps(&edev->hdac, nid) & AC_WCAP_OUT_AMP) if (get_wcaps(&edev->hdev, nid) & AC_WCAP_OUT_AMP)
snd_hdac_codec_write(&edev->hdac, nid, 0, snd_hdac_codec_write(&edev->hdev, nid, 0,
AC_VERB_SET_AMP_GAIN_MUTE, val); AC_VERB_SET_AMP_GAIN_MUTE, val);
} }
...@@ -739,7 +741,7 @@ static int hdac_hdmi_pin_output_widget_event(struct snd_soc_dapm_widget *w, ...@@ -739,7 +741,7 @@ static int hdac_hdmi_pin_output_widget_event(struct snd_soc_dapm_widget *w,
struct hdac_ext_device *edev = to_hda_ext_device(w->dapm->dev); struct hdac_ext_device *edev = to_hda_ext_device(w->dapm->dev);
struct hdac_hdmi_pcm *pcm; struct hdac_hdmi_pcm *pcm;
dev_dbg(&edev->hdac.dev, "%s: widget: %s event: %x\n", dev_dbg(&edev->hdev.dev, "%s: widget: %s event: %x\n",
__func__, w->name, event); __func__, w->name, event);
pcm = hdac_hdmi_get_pcm(edev, port); pcm = hdac_hdmi_get_pcm(edev, port);
...@@ -755,7 +757,7 @@ static int hdac_hdmi_pin_output_widget_event(struct snd_soc_dapm_widget *w, ...@@ -755,7 +757,7 @@ static int hdac_hdmi_pin_output_widget_event(struct snd_soc_dapm_widget *w,
hdac_hdmi_set_power_state(edev, port->pin->nid, AC_PWRST_D0); hdac_hdmi_set_power_state(edev, port->pin->nid, AC_PWRST_D0);
/* Enable out path for this pin widget */ /* Enable out path for this pin widget */
snd_hdac_codec_write(&edev->hdac, port->pin->nid, 0, snd_hdac_codec_write(&edev->hdev, port->pin->nid, 0,
AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
hdac_hdmi_set_amp(edev, port->pin->nid, AMP_OUT_UNMUTE); hdac_hdmi_set_amp(edev, port->pin->nid, AMP_OUT_UNMUTE);
...@@ -766,7 +768,7 @@ static int hdac_hdmi_pin_output_widget_event(struct snd_soc_dapm_widget *w, ...@@ -766,7 +768,7 @@ static int hdac_hdmi_pin_output_widget_event(struct snd_soc_dapm_widget *w,
hdac_hdmi_set_amp(edev, port->pin->nid, AMP_OUT_MUTE); hdac_hdmi_set_amp(edev, port->pin->nid, AMP_OUT_MUTE);
/* Disable out path for this pin widget */ /* Disable out path for this pin widget */
snd_hdac_codec_write(&edev->hdac, port->pin->nid, 0, snd_hdac_codec_write(&edev->hdev, port->pin->nid, 0,
AC_VERB_SET_PIN_WIDGET_CONTROL, 0); AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
hdac_hdmi_set_power_state(edev, port->pin->nid, AC_PWRST_D3); hdac_hdmi_set_power_state(edev, port->pin->nid, AC_PWRST_D3);
...@@ -782,10 +784,10 @@ static int hdac_hdmi_cvt_output_widget_event(struct snd_soc_dapm_widget *w, ...@@ -782,10 +784,10 @@ static int hdac_hdmi_cvt_output_widget_event(struct snd_soc_dapm_widget *w,
{ {
struct hdac_hdmi_cvt *cvt = w->priv; struct hdac_hdmi_cvt *cvt = w->priv;
struct hdac_ext_device *edev = to_hda_ext_device(w->dapm->dev); struct hdac_ext_device *edev = to_hda_ext_device(w->dapm->dev);
struct hdac_hdmi_priv *hdmi = edev->private_data; struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdev);
struct hdac_hdmi_pcm *pcm; struct hdac_hdmi_pcm *pcm;
dev_dbg(&edev->hdac.dev, "%s: widget: %s event: %x\n", dev_dbg(&edev->hdev.dev, "%s: widget: %s event: %x\n",
__func__, w->name, event); __func__, w->name, event);
pcm = hdac_hdmi_get_pcm_from_cvt(hdmi, cvt); pcm = hdac_hdmi_get_pcm_from_cvt(hdmi, cvt);
...@@ -797,23 +799,23 @@ static int hdac_hdmi_cvt_output_widget_event(struct snd_soc_dapm_widget *w, ...@@ -797,23 +799,23 @@ static int hdac_hdmi_cvt_output_widget_event(struct snd_soc_dapm_widget *w,
hdac_hdmi_set_power_state(edev, cvt->nid, AC_PWRST_D0); hdac_hdmi_set_power_state(edev, cvt->nid, AC_PWRST_D0);
/* Enable transmission */ /* Enable transmission */
snd_hdac_codec_write(&edev->hdac, cvt->nid, 0, snd_hdac_codec_write(&edev->hdev, cvt->nid, 0,
AC_VERB_SET_DIGI_CONVERT_1, 1); AC_VERB_SET_DIGI_CONVERT_1, 1);
/* Category Code (CC) to zero */ /* Category Code (CC) to zero */
snd_hdac_codec_write(&edev->hdac, cvt->nid, 0, snd_hdac_codec_write(&edev->hdev, cvt->nid, 0,
AC_VERB_SET_DIGI_CONVERT_2, 0); AC_VERB_SET_DIGI_CONVERT_2, 0);
snd_hdac_codec_write(&edev->hdac, cvt->nid, 0, snd_hdac_codec_write(&edev->hdev, cvt->nid, 0,
AC_VERB_SET_CHANNEL_STREAMID, pcm->stream_tag); AC_VERB_SET_CHANNEL_STREAMID, pcm->stream_tag);
snd_hdac_codec_write(&edev->hdac, cvt->nid, 0, snd_hdac_codec_write(&edev->hdev, cvt->nid, 0,
AC_VERB_SET_STREAM_FORMAT, pcm->format); AC_VERB_SET_STREAM_FORMAT, pcm->format);
break; break;
case SND_SOC_DAPM_POST_PMD: case SND_SOC_DAPM_POST_PMD:
snd_hdac_codec_write(&edev->hdac, cvt->nid, 0, snd_hdac_codec_write(&edev->hdev, cvt->nid, 0,
AC_VERB_SET_CHANNEL_STREAMID, 0); AC_VERB_SET_CHANNEL_STREAMID, 0);
snd_hdac_codec_write(&edev->hdac, cvt->nid, 0, snd_hdac_codec_write(&edev->hdev, cvt->nid, 0,
AC_VERB_SET_STREAM_FORMAT, 0); AC_VERB_SET_STREAM_FORMAT, 0);
hdac_hdmi_set_power_state(edev, cvt->nid, AC_PWRST_D3); hdac_hdmi_set_power_state(edev, cvt->nid, AC_PWRST_D3);
...@@ -831,7 +833,7 @@ static int hdac_hdmi_pin_mux_widget_event(struct snd_soc_dapm_widget *w, ...@@ -831,7 +833,7 @@ static int hdac_hdmi_pin_mux_widget_event(struct snd_soc_dapm_widget *w,
struct hdac_ext_device *edev = to_hda_ext_device(w->dapm->dev); struct hdac_ext_device *edev = to_hda_ext_device(w->dapm->dev);
int mux_idx; int mux_idx;
dev_dbg(&edev->hdac.dev, "%s: widget: %s event: %x\n", dev_dbg(&edev->hdev.dev, "%s: widget: %s event: %x\n",
__func__, w->name, event); __func__, w->name, event);
if (!kc) if (!kc)
...@@ -844,7 +846,7 @@ static int hdac_hdmi_pin_mux_widget_event(struct snd_soc_dapm_widget *w, ...@@ -844,7 +846,7 @@ static int hdac_hdmi_pin_mux_widget_event(struct snd_soc_dapm_widget *w,
return -EIO; return -EIO;
if (mux_idx > 0) { if (mux_idx > 0) {
snd_hdac_codec_write(&edev->hdac, port->pin->nid, 0, snd_hdac_codec_write(&edev->hdev, port->pin->nid, 0,
AC_VERB_SET_CONNECT_SEL, (mux_idx - 1)); AC_VERB_SET_CONNECT_SEL, (mux_idx - 1));
} }
...@@ -864,7 +866,7 @@ static int hdac_hdmi_set_pin_port_mux(struct snd_kcontrol *kcontrol, ...@@ -864,7 +866,7 @@ static int hdac_hdmi_set_pin_port_mux(struct snd_kcontrol *kcontrol,
struct snd_soc_dapm_context *dapm = w->dapm; struct snd_soc_dapm_context *dapm = w->dapm;
struct hdac_hdmi_port *port = w->priv; struct hdac_hdmi_port *port = w->priv;
struct hdac_ext_device *edev = to_hda_ext_device(dapm->dev); struct hdac_ext_device *edev = to_hda_ext_device(dapm->dev);
struct hdac_hdmi_priv *hdmi = edev->private_data; struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdev);
struct hdac_hdmi_pcm *pcm = NULL; struct hdac_hdmi_pcm *pcm = NULL;
const char *cvt_name = e->texts[ucontrol->value.enumerated.item[0]]; const char *cvt_name = e->texts[ucontrol->value.enumerated.item[0]];
...@@ -922,7 +924,7 @@ static int hdac_hdmi_create_pin_port_muxs(struct hdac_ext_device *edev, ...@@ -922,7 +924,7 @@ static int hdac_hdmi_create_pin_port_muxs(struct hdac_ext_device *edev,
struct snd_soc_dapm_widget *widget, struct snd_soc_dapm_widget *widget,
const char *widget_name) const char *widget_name)
{ {
struct hdac_hdmi_priv *hdmi = edev->private_data; struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdev);
struct hdac_hdmi_pin *pin = port->pin; struct hdac_hdmi_pin *pin = port->pin;
struct snd_kcontrol_new *kc; struct snd_kcontrol_new *kc;
struct hdac_hdmi_cvt *cvt; struct hdac_hdmi_cvt *cvt;
...@@ -934,17 +936,17 @@ static int hdac_hdmi_create_pin_port_muxs(struct hdac_ext_device *edev, ...@@ -934,17 +936,17 @@ static int hdac_hdmi_create_pin_port_muxs(struct hdac_ext_device *edev,
int i = 0; int i = 0;
int num_items = hdmi->num_cvt + 1; int num_items = hdmi->num_cvt + 1;
kc = devm_kzalloc(&edev->hdac.dev, sizeof(*kc), GFP_KERNEL); kc = devm_kzalloc(&edev->hdev.dev, sizeof(*kc), GFP_KERNEL);
if (!kc) if (!kc)
return -ENOMEM; return -ENOMEM;
se = devm_kzalloc(&edev->hdac.dev, sizeof(*se), GFP_KERNEL); se = devm_kzalloc(&edev->hdev.dev, sizeof(*se), GFP_KERNEL);
if (!se) if (!se)
return -ENOMEM; return -ENOMEM;
snprintf(kc_name, NAME_SIZE, "Pin %d port %d Input", snprintf(kc_name, NAME_SIZE, "Pin %d port %d Input",
pin->nid, port->id); pin->nid, port->id);
kc->name = devm_kstrdup(&edev->hdac.dev, kc_name, GFP_KERNEL); kc->name = devm_kstrdup(&edev->hdev.dev, kc_name, GFP_KERNEL);
if (!kc->name) if (!kc->name)
return -ENOMEM; return -ENOMEM;
...@@ -962,24 +964,24 @@ static int hdac_hdmi_create_pin_port_muxs(struct hdac_ext_device *edev, ...@@ -962,24 +964,24 @@ static int hdac_hdmi_create_pin_port_muxs(struct hdac_ext_device *edev,
se->mask = roundup_pow_of_two(se->items) - 1; se->mask = roundup_pow_of_two(se->items) - 1;
sprintf(mux_items, "NONE"); sprintf(mux_items, "NONE");
items[i] = devm_kstrdup(&edev->hdac.dev, mux_items, GFP_KERNEL); items[i] = devm_kstrdup(&edev->hdev.dev, mux_items, GFP_KERNEL);
if (!items[i]) if (!items[i])
return -ENOMEM; return -ENOMEM;
list_for_each_entry(cvt, &hdmi->cvt_list, head) { list_for_each_entry(cvt, &hdmi->cvt_list, head) {
i++; i++;
sprintf(mux_items, "cvt %d", cvt->nid); sprintf(mux_items, "cvt %d", cvt->nid);
items[i] = devm_kstrdup(&edev->hdac.dev, mux_items, GFP_KERNEL); items[i] = devm_kstrdup(&edev->hdev.dev, mux_items, GFP_KERNEL);
if (!items[i]) if (!items[i])
return -ENOMEM; return -ENOMEM;
} }
se->texts = devm_kmemdup(&edev->hdac.dev, items, se->texts = devm_kmemdup(&edev->hdev.dev, items,
(num_items * sizeof(char *)), GFP_KERNEL); (num_items * sizeof(char *)), GFP_KERNEL);
if (!se->texts) if (!se->texts)
return -ENOMEM; return -ENOMEM;
return hdac_hdmi_fill_widget_info(&edev->hdac.dev, widget, return hdac_hdmi_fill_widget_info(&edev->hdev.dev, widget,
snd_soc_dapm_mux, port, widget_name, NULL, kc, 1, snd_soc_dapm_mux, port, widget_name, NULL, kc, 1,
hdac_hdmi_pin_mux_widget_event, hdac_hdmi_pin_mux_widget_event,
SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_REG); SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_REG);
...@@ -990,7 +992,7 @@ static void hdac_hdmi_add_pinmux_cvt_route(struct hdac_ext_device *edev, ...@@ -990,7 +992,7 @@ static void hdac_hdmi_add_pinmux_cvt_route(struct hdac_ext_device *edev,
struct snd_soc_dapm_widget *widgets, struct snd_soc_dapm_widget *widgets,
struct snd_soc_dapm_route *route, int rindex) struct snd_soc_dapm_route *route, int rindex)
{ {
struct hdac_hdmi_priv *hdmi = edev->private_data; struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdev);
const struct snd_kcontrol_new *kc; const struct snd_kcontrol_new *kc;
struct soc_enum *se; struct soc_enum *se;
int mux_index = hdmi->num_cvt + hdmi->num_ports; int mux_index = hdmi->num_cvt + hdmi->num_ports;
...@@ -1033,8 +1035,8 @@ static int create_fill_widget_route_map(struct snd_soc_dapm_context *dapm) ...@@ -1033,8 +1035,8 @@ static int create_fill_widget_route_map(struct snd_soc_dapm_context *dapm)
struct snd_soc_dapm_widget *widgets; struct snd_soc_dapm_widget *widgets;
struct snd_soc_dapm_route *route; struct snd_soc_dapm_route *route;
struct hdac_ext_device *edev = to_hda_ext_device(dapm->dev); struct hdac_ext_device *edev = to_hda_ext_device(dapm->dev);
struct hdac_hdmi_priv *hdmi = edev->private_data; struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdev);
struct snd_soc_dai_driver *dai_drv = dapm->component->dai_drv; struct snd_soc_dai_driver *dai_drv = hdmi->dai_drv;
char widget_name[NAME_SIZE]; char widget_name[NAME_SIZE];
struct hdac_hdmi_cvt *cvt; struct hdac_hdmi_cvt *cvt;
struct hdac_hdmi_pin *pin; struct hdac_hdmi_pin *pin;
...@@ -1134,7 +1136,7 @@ static int create_fill_widget_route_map(struct snd_soc_dapm_context *dapm) ...@@ -1134,7 +1136,7 @@ static int create_fill_widget_route_map(struct snd_soc_dapm_context *dapm)
static int hdac_hdmi_init_dai_map(struct hdac_ext_device *edev) static int hdac_hdmi_init_dai_map(struct hdac_ext_device *edev)
{ {
struct hdac_hdmi_priv *hdmi = edev->private_data; struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdev);
struct hdac_hdmi_dai_port_map *dai_map; struct hdac_hdmi_dai_port_map *dai_map;
struct hdac_hdmi_cvt *cvt; struct hdac_hdmi_cvt *cvt;
int dai_id = 0; int dai_id = 0;
...@@ -1150,7 +1152,7 @@ static int hdac_hdmi_init_dai_map(struct hdac_ext_device *edev) ...@@ -1150,7 +1152,7 @@ static int hdac_hdmi_init_dai_map(struct hdac_ext_device *edev)
dai_id++; dai_id++;
if (dai_id == HDA_MAX_CVTS) { if (dai_id == HDA_MAX_CVTS) {
dev_warn(&edev->hdac.dev, dev_warn(&edev->hdev.dev,
"Max dais supported: %d\n", dai_id); "Max dais supported: %d\n", dai_id);
break; break;
} }
...@@ -1161,7 +1163,7 @@ static int hdac_hdmi_init_dai_map(struct hdac_ext_device *edev) ...@@ -1161,7 +1163,7 @@ static int hdac_hdmi_init_dai_map(struct hdac_ext_device *edev)
static int hdac_hdmi_add_cvt(struct hdac_ext_device *edev, hda_nid_t nid) static int hdac_hdmi_add_cvt(struct hdac_ext_device *edev, hda_nid_t nid)
{ {
struct hdac_hdmi_priv *hdmi = edev->private_data; struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdev);
struct hdac_hdmi_cvt *cvt; struct hdac_hdmi_cvt *cvt;
char name[NAME_SIZE]; char name[NAME_SIZE];
...@@ -1176,7 +1178,7 @@ static int hdac_hdmi_add_cvt(struct hdac_ext_device *edev, hda_nid_t nid) ...@@ -1176,7 +1178,7 @@ static int hdac_hdmi_add_cvt(struct hdac_ext_device *edev, hda_nid_t nid)
list_add_tail(&cvt->head, &hdmi->cvt_list); list_add_tail(&cvt->head, &hdmi->cvt_list);
hdmi->num_cvt++; hdmi->num_cvt++;
return hdac_hdmi_query_cvt_params(&edev->hdac, cvt); return hdac_hdmi_query_cvt_params(&edev->hdev, cvt);
} }
static int hdac_hdmi_parse_eld(struct hdac_ext_device *edev, static int hdac_hdmi_parse_eld(struct hdac_ext_device *edev,
...@@ -1188,7 +1190,7 @@ static int hdac_hdmi_parse_eld(struct hdac_ext_device *edev, ...@@ -1188,7 +1190,7 @@ static int hdac_hdmi_parse_eld(struct hdac_ext_device *edev,
>> DRM_ELD_VER_SHIFT; >> DRM_ELD_VER_SHIFT;
if (ver != ELD_VER_CEA_861D && ver != ELD_VER_PARTIAL) { if (ver != ELD_VER_CEA_861D && ver != ELD_VER_PARTIAL) {
dev_err(&edev->hdac.dev, "HDMI: Unknown ELD version %d\n", ver); dev_err(&edev->hdev.dev, "HDMI: Unknown ELD version %d\n", ver);
return -EINVAL; return -EINVAL;
} }
...@@ -1196,7 +1198,7 @@ static int hdac_hdmi_parse_eld(struct hdac_ext_device *edev, ...@@ -1196,7 +1198,7 @@ static int hdac_hdmi_parse_eld(struct hdac_ext_device *edev,
DRM_ELD_MNL_MASK) >> DRM_ELD_MNL_SHIFT; DRM_ELD_MNL_MASK) >> DRM_ELD_MNL_SHIFT;
if (mnl > ELD_MAX_MNL) { if (mnl > ELD_MAX_MNL) {
dev_err(&edev->hdac.dev, "HDMI: MNL Invalid %d\n", mnl); dev_err(&edev->hdev.dev, "HDMI: MNL Invalid %d\n", mnl);
return -EINVAL; return -EINVAL;
} }
...@@ -1209,7 +1211,7 @@ static void hdac_hdmi_present_sense(struct hdac_hdmi_pin *pin, ...@@ -1209,7 +1211,7 @@ static void hdac_hdmi_present_sense(struct hdac_hdmi_pin *pin,
struct hdac_hdmi_port *port) struct hdac_hdmi_port *port)
{ {
struct hdac_ext_device *edev = pin->edev; struct hdac_ext_device *edev = pin->edev;
struct hdac_hdmi_priv *hdmi = edev->private_data; struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdev);
struct hdac_hdmi_pcm *pcm; struct hdac_hdmi_pcm *pcm;
int size = 0; int size = 0;
int port_id = -1; int port_id = -1;
...@@ -1227,7 +1229,7 @@ static void hdac_hdmi_present_sense(struct hdac_hdmi_pin *pin, ...@@ -1227,7 +1229,7 @@ static void hdac_hdmi_present_sense(struct hdac_hdmi_pin *pin,
if (pin->mst_capable) if (pin->mst_capable)
port_id = port->id; port_id = port->id;
size = snd_hdac_acomp_get_eld(&edev->hdac, pin->nid, port_id, size = snd_hdac_acomp_get_eld(&edev->hdev, pin->nid, port_id,
&port->eld.monitor_present, &port->eld.monitor_present,
port->eld.eld_buffer, port->eld.eld_buffer,
ELD_MAX_SIZE); ELD_MAX_SIZE);
...@@ -1250,7 +1252,7 @@ static void hdac_hdmi_present_sense(struct hdac_hdmi_pin *pin, ...@@ -1250,7 +1252,7 @@ static void hdac_hdmi_present_sense(struct hdac_hdmi_pin *pin,
if (!port->eld.monitor_present || !port->eld.eld_valid) { if (!port->eld.monitor_present || !port->eld.eld_valid) {
dev_err(&edev->hdac.dev, "%s: disconnect for pin:port %d:%d\n", dev_err(&edev->hdev.dev, "%s: disconnect for pin:port %d:%d\n",
__func__, pin->nid, port->id); __func__, pin->nid, port->id);
/* /*
...@@ -1304,7 +1306,7 @@ static int hdac_hdmi_add_ports(struct hdac_hdmi_priv *hdmi, ...@@ -1304,7 +1306,7 @@ static int hdac_hdmi_add_ports(struct hdac_hdmi_priv *hdmi,
static int hdac_hdmi_add_pin(struct hdac_ext_device *edev, hda_nid_t nid) static int hdac_hdmi_add_pin(struct hdac_ext_device *edev, hda_nid_t nid)
{ {
struct hdac_hdmi_priv *hdmi = edev->private_data; struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdev);
struct hdac_hdmi_pin *pin; struct hdac_hdmi_pin *pin;
int ret; int ret;
...@@ -1333,40 +1335,38 @@ static int hdac_hdmi_add_pin(struct hdac_ext_device *edev, hda_nid_t nid) ...@@ -1333,40 +1335,38 @@ static int hdac_hdmi_add_pin(struct hdac_ext_device *edev, hda_nid_t nid)
#define INTEL_EN_DP12 0x02 /* enable DP 1.2 features */ #define INTEL_EN_DP12 0x02 /* enable DP 1.2 features */
#define INTEL_EN_ALL_PIN_CVTS 0x01 /* enable 2nd & 3rd pins and convertors */ #define INTEL_EN_ALL_PIN_CVTS 0x01 /* enable 2nd & 3rd pins and convertors */
static void hdac_hdmi_skl_enable_all_pins(struct hdac_device *hdac) static void hdac_hdmi_skl_enable_all_pins(struct hdac_device *hdev)
{ {
unsigned int vendor_param; unsigned int vendor_param;
struct hdac_ext_device *edev = to_ehdac_device(hdac); struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev);
struct hdac_hdmi_priv *hdmi = edev->private_data;
unsigned int vendor_nid = hdmi->drv_data->vendor_nid; unsigned int vendor_nid = hdmi->drv_data->vendor_nid;
vendor_param = snd_hdac_codec_read(hdac, vendor_nid, 0, vendor_param = snd_hdac_codec_read(hdev, vendor_nid, 0,
INTEL_GET_VENDOR_VERB, 0); INTEL_GET_VENDOR_VERB, 0);
if (vendor_param == -1 || vendor_param & INTEL_EN_ALL_PIN_CVTS) if (vendor_param == -1 || vendor_param & INTEL_EN_ALL_PIN_CVTS)
return; return;
vendor_param |= INTEL_EN_ALL_PIN_CVTS; vendor_param |= INTEL_EN_ALL_PIN_CVTS;
vendor_param = snd_hdac_codec_read(hdac, vendor_nid, 0, vendor_param = snd_hdac_codec_read(hdev, vendor_nid, 0,
INTEL_SET_VENDOR_VERB, vendor_param); INTEL_SET_VENDOR_VERB, vendor_param);
if (vendor_param == -1) if (vendor_param == -1)
return; return;
} }
static void hdac_hdmi_skl_enable_dp12(struct hdac_device *hdac) static void hdac_hdmi_skl_enable_dp12(struct hdac_device *hdev)
{ {
unsigned int vendor_param; unsigned int vendor_param;
struct hdac_ext_device *edev = to_ehdac_device(hdac); struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev);
struct hdac_hdmi_priv *hdmi = edev->private_data;
unsigned int vendor_nid = hdmi->drv_data->vendor_nid; unsigned int vendor_nid = hdmi->drv_data->vendor_nid;
vendor_param = snd_hdac_codec_read(hdac, vendor_nid, 0, vendor_param = snd_hdac_codec_read(hdev, vendor_nid, 0,
INTEL_GET_VENDOR_VERB, 0); INTEL_GET_VENDOR_VERB, 0);
if (vendor_param == -1 || vendor_param & INTEL_EN_DP12) if (vendor_param == -1 || vendor_param & INTEL_EN_DP12)
return; return;
/* enable DP1.2 mode */ /* enable DP1.2 mode */
vendor_param |= INTEL_EN_DP12; vendor_param |= INTEL_EN_DP12;
vendor_param = snd_hdac_codec_read(hdac, vendor_nid, 0, vendor_param = snd_hdac_codec_read(hdev, vendor_nid, 0,
INTEL_SET_VENDOR_VERB, vendor_param); INTEL_SET_VENDOR_VERB, vendor_param);
if (vendor_param == -1) if (vendor_param == -1)
return; return;
...@@ -1384,7 +1384,7 @@ static const struct snd_soc_dai_ops hdmi_dai_ops = { ...@@ -1384,7 +1384,7 @@ static const struct snd_soc_dai_ops hdmi_dai_ops = {
* Each converter can support a stream independently. So a dai is created * Each converter can support a stream independently. So a dai is created
* based on the number of converter queried. * based on the number of converter queried.
*/ */
static int hdac_hdmi_create_dais(struct hdac_device *hdac, static int hdac_hdmi_create_dais(struct hdac_device *hdev,
struct snd_soc_dai_driver **dais, struct snd_soc_dai_driver **dais,
struct hdac_hdmi_priv *hdmi, int num_dais) struct hdac_hdmi_priv *hdmi, int num_dais)
{ {
...@@ -1397,20 +1397,20 @@ static int hdac_hdmi_create_dais(struct hdac_device *hdac, ...@@ -1397,20 +1397,20 @@ static int hdac_hdmi_create_dais(struct hdac_device *hdac,
u64 formats; u64 formats;
int ret; int ret;
hdmi_dais = devm_kzalloc(&hdac->dev, hdmi_dais = devm_kzalloc(&hdev->dev,
(sizeof(*hdmi_dais) * num_dais), (sizeof(*hdmi_dais) * num_dais),
GFP_KERNEL); GFP_KERNEL);
if (!hdmi_dais) if (!hdmi_dais)
return -ENOMEM; return -ENOMEM;
list_for_each_entry(cvt, &hdmi->cvt_list, head) { list_for_each_entry(cvt, &hdmi->cvt_list, head) {
ret = snd_hdac_query_supported_pcm(hdac, cvt->nid, ret = snd_hdac_query_supported_pcm(hdev, cvt->nid,
&rates, &formats, &bps); &rates, &formats, &bps);
if (ret) if (ret)
return ret; return ret;
sprintf(dai_name, "intel-hdmi-hifi%d", i+1); sprintf(dai_name, "intel-hdmi-hifi%d", i+1);
hdmi_dais[i].name = devm_kstrdup(&hdac->dev, hdmi_dais[i].name = devm_kstrdup(&hdev->dev,
dai_name, GFP_KERNEL); dai_name, GFP_KERNEL);
if (!hdmi_dais[i].name) if (!hdmi_dais[i].name)
...@@ -1418,7 +1418,7 @@ static int hdac_hdmi_create_dais(struct hdac_device *hdac, ...@@ -1418,7 +1418,7 @@ static int hdac_hdmi_create_dais(struct hdac_device *hdac,
snprintf(name, sizeof(name), "hifi%d", i+1); snprintf(name, sizeof(name), "hifi%d", i+1);
hdmi_dais[i].playback.stream_name = hdmi_dais[i].playback.stream_name =
devm_kstrdup(&hdac->dev, name, GFP_KERNEL); devm_kstrdup(&hdev->dev, name, GFP_KERNEL);
if (!hdmi_dais[i].playback.stream_name) if (!hdmi_dais[i].playback.stream_name)
return -ENOMEM; return -ENOMEM;
...@@ -1438,6 +1438,7 @@ static int hdac_hdmi_create_dais(struct hdac_device *hdac, ...@@ -1438,6 +1438,7 @@ static int hdac_hdmi_create_dais(struct hdac_device *hdac,
} }
*dais = hdmi_dais; *dais = hdmi_dais;
hdmi->dai_drv = hdmi_dais;
return 0; return 0;
} }
...@@ -1451,29 +1452,26 @@ static int hdac_hdmi_parse_and_map_nid(struct hdac_ext_device *edev, ...@@ -1451,29 +1452,26 @@ static int hdac_hdmi_parse_and_map_nid(struct hdac_ext_device *edev,
{ {
hda_nid_t nid; hda_nid_t nid;
int i, num_nodes; int i, num_nodes;
struct hdac_device *hdac = &edev->hdac;
struct hdac_hdmi_priv *hdmi = edev->private_data;
struct hdac_hdmi_cvt *temp_cvt, *cvt_next; struct hdac_hdmi_cvt *temp_cvt, *cvt_next;
struct hdac_hdmi_pin *temp_pin, *pin_next; struct hdac_hdmi_pin *temp_pin, *pin_next;
struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdev);
struct hdac_device *hdev = &edev->hdev;
int ret; int ret;
hdac_hdmi_skl_enable_all_pins(hdac); hdac_hdmi_skl_enable_all_pins(hdev);
hdac_hdmi_skl_enable_dp12(hdac); hdac_hdmi_skl_enable_dp12(hdev);
num_nodes = snd_hdac_get_sub_nodes(hdac, hdac->afg, &nid); num_nodes = snd_hdac_get_sub_nodes(hdev, hdev->afg, &nid);
if (!nid || num_nodes <= 0) { if (!nid || num_nodes <= 0) {
dev_warn(&hdac->dev, "HDMI: failed to get afg sub nodes\n"); dev_warn(&hdev->dev, "HDMI: failed to get afg sub nodes\n");
return -EINVAL; return -EINVAL;
} }
hdac->num_nodes = num_nodes; for (i = 0; i < num_nodes; i++, nid++) {
hdac->start_nid = nid;
for (i = 0; i < hdac->num_nodes; i++, nid++) {
unsigned int caps; unsigned int caps;
unsigned int type; unsigned int type;
caps = get_wcaps(hdac, nid); caps = get_wcaps(hdev, nid);
type = get_wcaps_type(caps); type = get_wcaps_type(caps);
if (!(caps & AC_WCAP_DIGITAL)) if (!(caps & AC_WCAP_DIGITAL))
...@@ -1495,16 +1493,14 @@ static int hdac_hdmi_parse_and_map_nid(struct hdac_ext_device *edev, ...@@ -1495,16 +1493,14 @@ static int hdac_hdmi_parse_and_map_nid(struct hdac_ext_device *edev,
} }
} }
hdac->end_nid = nid;
if (!hdmi->num_pin || !hdmi->num_cvt) { if (!hdmi->num_pin || !hdmi->num_cvt) {
ret = -EIO; ret = -EIO;
goto free_widgets; goto free_widgets;
} }
ret = hdac_hdmi_create_dais(hdac, dais, hdmi, hdmi->num_cvt); ret = hdac_hdmi_create_dais(hdev, dais, hdmi, hdmi->num_cvt);
if (ret) { if (ret) {
dev_err(&hdac->dev, "Failed to create dais with err: %d\n", dev_err(&hdev->dev, "Failed to create dais with err: %d\n",
ret); ret);
goto free_widgets; goto free_widgets;
} }
...@@ -1537,7 +1533,7 @@ static int hdac_hdmi_parse_and_map_nid(struct hdac_ext_device *edev, ...@@ -1537,7 +1533,7 @@ static int hdac_hdmi_parse_and_map_nid(struct hdac_ext_device *edev,
static void hdac_hdmi_eld_notify_cb(void *aptr, int port, int pipe) static void hdac_hdmi_eld_notify_cb(void *aptr, int port, int pipe)
{ {
struct hdac_ext_device *edev = aptr; struct hdac_ext_device *edev = aptr;
struct hdac_hdmi_priv *hdmi = edev->private_data; struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdev);
struct hdac_hdmi_pin *pin = NULL; struct hdac_hdmi_pin *pin = NULL;
struct hdac_hdmi_port *hport = NULL; struct hdac_hdmi_port *hport = NULL;
struct snd_soc_codec *codec = edev->scodec; struct snd_soc_codec *codec = edev->scodec;
...@@ -1546,7 +1542,7 @@ static void hdac_hdmi_eld_notify_cb(void *aptr, int port, int pipe) ...@@ -1546,7 +1542,7 @@ static void hdac_hdmi_eld_notify_cb(void *aptr, int port, int pipe)
/* Don't know how this mapping is derived */ /* Don't know how this mapping is derived */
hda_nid_t pin_nid = port + 0x04; hda_nid_t pin_nid = port + 0x04;
dev_dbg(&edev->hdac.dev, "%s: for pin:%d port=%d\n", __func__, dev_dbg(&edev->hdev.dev, "%s: for pin:%d port=%d\n", __func__,
pin_nid, pipe); pin_nid, pipe);
/* /*
...@@ -1559,7 +1555,7 @@ static void hdac_hdmi_eld_notify_cb(void *aptr, int port, int pipe) ...@@ -1559,7 +1555,7 @@ static void hdac_hdmi_eld_notify_cb(void *aptr, int port, int pipe)
SNDRV_CTL_POWER_D0) SNDRV_CTL_POWER_D0)
return; return;
if (atomic_read(&edev->hdac.in_pm)) if (atomic_read(&edev->hdev.in_pm))
return; return;
list_for_each_entry(pin, &hdmi->pin_list, head) { list_for_each_entry(pin, &hdmi->pin_list, head) {
...@@ -1614,7 +1610,7 @@ static int create_fill_jack_kcontrols(struct snd_soc_card *card, ...@@ -1614,7 +1610,7 @@ static int create_fill_jack_kcontrols(struct snd_soc_card *card,
char *name; char *name;
int i = 0, j; int i = 0, j;
struct snd_soc_codec *codec = edev->scodec; struct snd_soc_codec *codec = edev->scodec;
struct hdac_hdmi_priv *hdmi = edev->private_data; struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdev);
kc = devm_kcalloc(codec->dev, hdmi->num_ports, kc = devm_kcalloc(codec->dev, hdmi->num_ports,
sizeof(*kc), GFP_KERNEL); sizeof(*kc), GFP_KERNEL);
...@@ -1652,7 +1648,7 @@ int hdac_hdmi_jack_port_init(struct snd_soc_codec *codec, ...@@ -1652,7 +1648,7 @@ int hdac_hdmi_jack_port_init(struct snd_soc_codec *codec,
struct snd_soc_dapm_context *dapm) struct snd_soc_dapm_context *dapm)
{ {
struct hdac_ext_device *edev = snd_soc_codec_get_drvdata(codec); struct hdac_ext_device *edev = snd_soc_codec_get_drvdata(codec);
struct hdac_hdmi_priv *hdmi = edev->private_data; struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdev);
struct hdac_hdmi_pin *pin; struct hdac_hdmi_pin *pin;
struct snd_soc_dapm_widget *widgets; struct snd_soc_dapm_widget *widgets;
struct snd_soc_dapm_route *route; struct snd_soc_dapm_route *route;
...@@ -1728,7 +1724,7 @@ int hdac_hdmi_jack_init(struct snd_soc_dai *dai, int device, ...@@ -1728,7 +1724,7 @@ int hdac_hdmi_jack_init(struct snd_soc_dai *dai, int device,
{ {
struct snd_soc_codec *codec = dai->codec; struct snd_soc_codec *codec = dai->codec;
struct hdac_ext_device *edev = snd_soc_codec_get_drvdata(codec); struct hdac_ext_device *edev = snd_soc_codec_get_drvdata(codec);
struct hdac_hdmi_priv *hdmi = edev->private_data; struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdev);
struct hdac_hdmi_pcm *pcm; struct hdac_hdmi_pcm *pcm;
struct snd_pcm *snd_pcm; struct snd_pcm *snd_pcm;
int err; int err;
...@@ -1750,7 +1746,7 @@ int hdac_hdmi_jack_init(struct snd_soc_dai *dai, int device, ...@@ -1750,7 +1746,7 @@ int hdac_hdmi_jack_init(struct snd_soc_dai *dai, int device,
if (snd_pcm) { if (snd_pcm) {
err = snd_hdac_add_chmap_ctls(snd_pcm, device, &hdmi->chmap); err = snd_hdac_add_chmap_ctls(snd_pcm, device, &hdmi->chmap);
if (err < 0) { if (err < 0) {
dev_err(&edev->hdac.dev, dev_err(&edev->hdev.dev,
"chmap control add failed with err: %d for pcm: %d\n", "chmap control add failed with err: %d for pcm: %d\n",
err, device); err, device);
kfree(pcm); kfree(pcm);
...@@ -1791,7 +1787,7 @@ static void hdac_hdmi_present_sense_all_pins(struct hdac_ext_device *edev, ...@@ -1791,7 +1787,7 @@ static void hdac_hdmi_present_sense_all_pins(struct hdac_ext_device *edev,
static int hdmi_codec_probe(struct snd_soc_codec *codec) static int hdmi_codec_probe(struct snd_soc_codec *codec)
{ {
struct hdac_ext_device *edev = snd_soc_codec_get_drvdata(codec); struct hdac_ext_device *edev = snd_soc_codec_get_drvdata(codec);
struct hdac_hdmi_priv *hdmi = edev->private_data; struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdev);
struct snd_soc_dapm_context *dapm = struct snd_soc_dapm_context *dapm =
snd_soc_component_get_dapm(&codec->component); snd_soc_component_get_dapm(&codec->component);
struct hdac_ext_link *hlink = NULL; struct hdac_ext_link *hlink = NULL;
...@@ -1803,9 +1799,9 @@ static int hdmi_codec_probe(struct snd_soc_codec *codec) ...@@ -1803,9 +1799,9 @@ static int hdmi_codec_probe(struct snd_soc_codec *codec)
* hold the ref while we probe, also no need to drop the ref on * hold the ref while we probe, also no need to drop the ref on
* exit, we call pm_runtime_suspend() so that will do for us * exit, we call pm_runtime_suspend() so that will do for us
*/ */
hlink = snd_hdac_ext_bus_get_link(edev->ebus, dev_name(&edev->hdac.dev)); hlink = snd_hdac_ext_bus_get_link(edev->ebus, dev_name(&edev->hdev.dev));
if (!hlink) { if (!hlink) {
dev_err(&edev->hdac.dev, "hdac link not found\n"); dev_err(&edev->hdev.dev, "hdac link not found\n");
return -EIO; return -EIO;
} }
...@@ -1818,7 +1814,7 @@ static int hdmi_codec_probe(struct snd_soc_codec *codec) ...@@ -1818,7 +1814,7 @@ static int hdmi_codec_probe(struct snd_soc_codec *codec)
aops.audio_ptr = edev; aops.audio_ptr = edev;
ret = snd_hdac_i915_register_notifier(&aops); ret = snd_hdac_i915_register_notifier(&aops);
if (ret < 0) { if (ret < 0) {
dev_err(&edev->hdac.dev, "notifier register failed: err: %d\n", dev_err(&edev->hdev.dev, "notifier register failed: err: %d\n",
ret); ret);
return ret; return ret;
} }
...@@ -1831,9 +1827,9 @@ static int hdmi_codec_probe(struct snd_soc_codec *codec) ...@@ -1831,9 +1827,9 @@ static int hdmi_codec_probe(struct snd_soc_codec *codec)
* hdac_device core already sets the state to active and calls * hdac_device core already sets the state to active and calls
* get_noresume. So enable runtime and set the device to suspend. * get_noresume. So enable runtime and set the device to suspend.
*/ */
pm_runtime_enable(&edev->hdac.dev); pm_runtime_enable(&edev->hdev.dev);
pm_runtime_put(&edev->hdac.dev); pm_runtime_put(&edev->hdev.dev);
pm_runtime_suspend(&edev->hdac.dev); pm_runtime_suspend(&edev->hdev.dev);
return 0; return 0;
} }
...@@ -1842,7 +1838,7 @@ static int hdmi_codec_remove(struct snd_soc_codec *codec) ...@@ -1842,7 +1838,7 @@ static int hdmi_codec_remove(struct snd_soc_codec *codec)
{ {
struct hdac_ext_device *edev = snd_soc_codec_get_drvdata(codec); struct hdac_ext_device *edev = snd_soc_codec_get_drvdata(codec);
pm_runtime_disable(&edev->hdac.dev); pm_runtime_disable(&edev->hdev.dev);
return 0; return 0;
} }
...@@ -1850,9 +1846,9 @@ static int hdmi_codec_remove(struct snd_soc_codec *codec) ...@@ -1850,9 +1846,9 @@ static int hdmi_codec_remove(struct snd_soc_codec *codec)
static int hdmi_codec_prepare(struct device *dev) static int hdmi_codec_prepare(struct device *dev)
{ {
struct hdac_ext_device *edev = to_hda_ext_device(dev); struct hdac_ext_device *edev = to_hda_ext_device(dev);
struct hdac_device *hdac = &edev->hdac; struct hdac_device *hdev = &edev->hdev;
pm_runtime_get_sync(&edev->hdac.dev); pm_runtime_get_sync(&edev->hdev.dev);
/* /*
* Power down afg. * Power down afg.
...@@ -1861,7 +1857,7 @@ static int hdmi_codec_prepare(struct device *dev) ...@@ -1861,7 +1857,7 @@ static int hdmi_codec_prepare(struct device *dev)
* is received. So setting power state is ensured without using loop * is received. So setting power state is ensured without using loop
* to read the state. * to read the state.
*/ */
snd_hdac_codec_read(hdac, hdac->afg, 0, AC_VERB_SET_POWER_STATE, snd_hdac_codec_read(hdev, hdev->afg, 0, AC_VERB_SET_POWER_STATE,
AC_PWRST_D3); AC_PWRST_D3);
return 0; return 0;
...@@ -1870,15 +1866,15 @@ static int hdmi_codec_prepare(struct device *dev) ...@@ -1870,15 +1866,15 @@ static int hdmi_codec_prepare(struct device *dev)
static void hdmi_codec_complete(struct device *dev) static void hdmi_codec_complete(struct device *dev)
{ {
struct hdac_ext_device *edev = to_hda_ext_device(dev); struct hdac_ext_device *edev = to_hda_ext_device(dev);
struct hdac_hdmi_priv *hdmi = edev->private_data; struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdev);
struct hdac_device *hdac = &edev->hdac; struct hdac_device *hdev = &edev->hdev;
/* Power up afg */ /* Power up afg */
snd_hdac_codec_read(hdac, hdac->afg, 0, AC_VERB_SET_POWER_STATE, snd_hdac_codec_read(hdev, hdev->afg, 0, AC_VERB_SET_POWER_STATE,
AC_PWRST_D0); AC_PWRST_D0);
hdac_hdmi_skl_enable_all_pins(&edev->hdac); hdac_hdmi_skl_enable_all_pins(&edev->hdev);
hdac_hdmi_skl_enable_dp12(&edev->hdac); hdac_hdmi_skl_enable_dp12(&edev->hdev);
/* /*
* As the ELD notify callback request is not entertained while the * As the ELD notify callback request is not entertained while the
...@@ -1888,7 +1884,7 @@ static void hdmi_codec_complete(struct device *dev) ...@@ -1888,7 +1884,7 @@ static void hdmi_codec_complete(struct device *dev)
*/ */
hdac_hdmi_present_sense_all_pins(edev, hdmi, false); hdac_hdmi_present_sense_all_pins(edev, hdmi, false);
pm_runtime_put_sync(&edev->hdac.dev); pm_runtime_put_sync(&edev->hdev.dev);
} }
#else #else
#define hdmi_codec_prepare NULL #define hdmi_codec_prepare NULL
...@@ -1901,21 +1897,20 @@ static const struct snd_soc_codec_driver hdmi_hda_codec = { ...@@ -1901,21 +1897,20 @@ static const struct snd_soc_codec_driver hdmi_hda_codec = {
.idle_bias_off = true, .idle_bias_off = true,
}; };
static void hdac_hdmi_get_chmap(struct hdac_device *hdac, int pcm_idx, static void hdac_hdmi_get_chmap(struct hdac_device *hdev, int pcm_idx,
unsigned char *chmap) unsigned char *chmap)
{ {
struct hdac_ext_device *edev = to_ehdac_device(hdac); struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev);
struct hdac_hdmi_priv *hdmi = edev->private_data;
struct hdac_hdmi_pcm *pcm = get_hdmi_pcm_from_id(hdmi, pcm_idx); struct hdac_hdmi_pcm *pcm = get_hdmi_pcm_from_id(hdmi, pcm_idx);
memcpy(chmap, pcm->chmap, ARRAY_SIZE(pcm->chmap)); memcpy(chmap, pcm->chmap, ARRAY_SIZE(pcm->chmap));
} }
static void hdac_hdmi_set_chmap(struct hdac_device *hdac, int pcm_idx, static void hdac_hdmi_set_chmap(struct hdac_device *hdev, int pcm_idx,
unsigned char *chmap, int prepared) unsigned char *chmap, int prepared)
{ {
struct hdac_ext_device *edev = to_ehdac_device(hdac); struct hdac_ext_device *edev = to_ehdac_device(hdev);
struct hdac_hdmi_priv *hdmi = edev->private_data; struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev);
struct hdac_hdmi_pcm *pcm = get_hdmi_pcm_from_id(hdmi, pcm_idx); struct hdac_hdmi_pcm *pcm = get_hdmi_pcm_from_id(hdmi, pcm_idx);
struct hdac_hdmi_port *port; struct hdac_hdmi_port *port;
...@@ -1934,10 +1929,9 @@ static void hdac_hdmi_set_chmap(struct hdac_device *hdac, int pcm_idx, ...@@ -1934,10 +1929,9 @@ static void hdac_hdmi_set_chmap(struct hdac_device *hdac, int pcm_idx,
mutex_unlock(&pcm->lock); mutex_unlock(&pcm->lock);
} }
static bool is_hdac_hdmi_pcm_attached(struct hdac_device *hdac, int pcm_idx) static bool is_hdac_hdmi_pcm_attached(struct hdac_device *hdev, int pcm_idx)
{ {
struct hdac_ext_device *edev = to_ehdac_device(hdac); struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev);
struct hdac_hdmi_priv *hdmi = edev->private_data;
struct hdac_hdmi_pcm *pcm = get_hdmi_pcm_from_id(hdmi, pcm_idx); struct hdac_hdmi_pcm *pcm = get_hdmi_pcm_from_id(hdmi, pcm_idx);
if (!pcm) if (!pcm)
...@@ -1949,10 +1943,9 @@ static bool is_hdac_hdmi_pcm_attached(struct hdac_device *hdac, int pcm_idx) ...@@ -1949,10 +1943,9 @@ static bool is_hdac_hdmi_pcm_attached(struct hdac_device *hdac, int pcm_idx)
return true; return true;
} }
static int hdac_hdmi_get_spk_alloc(struct hdac_device *hdac, int pcm_idx) static int hdac_hdmi_get_spk_alloc(struct hdac_device *hdev, int pcm_idx)
{ {
struct hdac_ext_device *edev = to_ehdac_device(hdac); struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(hdev);
struct hdac_hdmi_priv *hdmi = edev->private_data;
struct hdac_hdmi_pcm *pcm = get_hdmi_pcm_from_id(hdmi, pcm_idx); struct hdac_hdmi_pcm *pcm = get_hdmi_pcm_from_id(hdmi, pcm_idx);
struct hdac_hdmi_port *port; struct hdac_hdmi_port *port;
...@@ -1983,30 +1976,30 @@ static struct hdac_hdmi_drv_data intel_drv_data = { ...@@ -1983,30 +1976,30 @@ static struct hdac_hdmi_drv_data intel_drv_data = {
static int hdac_hdmi_dev_probe(struct hdac_ext_device *edev) static int hdac_hdmi_dev_probe(struct hdac_ext_device *edev)
{ {
struct hdac_device *codec = &edev->hdac; struct hdac_device *hdev = &edev->hdev;
struct hdac_hdmi_priv *hdmi_priv; struct hdac_hdmi_priv *hdmi_priv;
struct snd_soc_dai_driver *hdmi_dais = NULL; struct snd_soc_dai_driver *hdmi_dais = NULL;
struct hdac_ext_link *hlink = NULL; struct hdac_ext_link *hlink = NULL;
int num_dais = 0; int num_dais = 0;
int ret = 0; int ret = 0;
struct hdac_driver *hdrv = drv_to_hdac_driver(codec->dev.driver); struct hdac_driver *hdrv = drv_to_hdac_driver(hdev->dev.driver);
const struct hda_device_id *hdac_id = hdac_get_device_id(codec, hdrv); const struct hda_device_id *hdac_id = hdac_get_device_id(hdev, hdrv);
/* hold the ref while we probe */ /* hold the ref while we probe */
hlink = snd_hdac_ext_bus_get_link(edev->ebus, dev_name(&edev->hdac.dev)); hlink = snd_hdac_ext_bus_get_link(edev->ebus, dev_name(&edev->hdev.dev));
if (!hlink) { if (!hlink) {
dev_err(&edev->hdac.dev, "hdac link not found\n"); dev_err(&edev->hdev.dev, "hdac link not found\n");
return -EIO; return -EIO;
} }
snd_hdac_ext_bus_link_get(edev->ebus, hlink); snd_hdac_ext_bus_link_get(edev->ebus, hlink);
hdmi_priv = devm_kzalloc(&codec->dev, sizeof(*hdmi_priv), GFP_KERNEL); hdmi_priv = devm_kzalloc(&hdev->dev, sizeof(*hdmi_priv), GFP_KERNEL);
if (hdmi_priv == NULL) if (hdmi_priv == NULL)
return -ENOMEM; return -ENOMEM;
edev->private_data = hdmi_priv; edev->private_data = hdmi_priv;
snd_hdac_register_chmap_ops(codec, &hdmi_priv->chmap); snd_hdac_register_chmap_ops(hdev, &hdmi_priv->chmap);
hdmi_priv->chmap.ops.get_chmap = hdac_hdmi_get_chmap; hdmi_priv->chmap.ops.get_chmap = hdac_hdmi_get_chmap;
hdmi_priv->chmap.ops.set_chmap = hdac_hdmi_set_chmap; hdmi_priv->chmap.ops.set_chmap = hdac_hdmi_set_chmap;
hdmi_priv->chmap.ops.is_pcm_attached = is_hdac_hdmi_pcm_attached; hdmi_priv->chmap.ops.is_pcm_attached = is_hdac_hdmi_pcm_attached;
...@@ -2021,7 +2014,7 @@ static int hdac_hdmi_dev_probe(struct hdac_ext_device *edev) ...@@ -2021,7 +2014,7 @@ static int hdac_hdmi_dev_probe(struct hdac_ext_device *edev)
else else
hdmi_priv->drv_data = &intel_drv_data; hdmi_priv->drv_data = &intel_drv_data;
dev_set_drvdata(&codec->dev, edev); dev_set_drvdata(&hdev->dev, edev);
INIT_LIST_HEAD(&hdmi_priv->pin_list); INIT_LIST_HEAD(&hdmi_priv->pin_list);
INIT_LIST_HEAD(&hdmi_priv->cvt_list); INIT_LIST_HEAD(&hdmi_priv->cvt_list);
...@@ -2032,9 +2025,9 @@ static int hdac_hdmi_dev_probe(struct hdac_ext_device *edev) ...@@ -2032,9 +2025,9 @@ static int hdac_hdmi_dev_probe(struct hdac_ext_device *edev)
* Turned off in the runtime_suspend during the first explicit * Turned off in the runtime_suspend during the first explicit
* pm_runtime_suspend call. * pm_runtime_suspend call.
*/ */
ret = snd_hdac_display_power(edev->hdac.bus, true); ret = snd_hdac_display_power(edev->hdev.bus, true);
if (ret < 0) { if (ret < 0) {
dev_err(&edev->hdac.dev, dev_err(&edev->hdev.dev,
"Cannot turn on display power on i915 err: %d\n", "Cannot turn on display power on i915 err: %d\n",
ret); ret);
return ret; return ret;
...@@ -2042,13 +2035,14 @@ static int hdac_hdmi_dev_probe(struct hdac_ext_device *edev) ...@@ -2042,13 +2035,14 @@ static int hdac_hdmi_dev_probe(struct hdac_ext_device *edev)
ret = hdac_hdmi_parse_and_map_nid(edev, &hdmi_dais, &num_dais); ret = hdac_hdmi_parse_and_map_nid(edev, &hdmi_dais, &num_dais);
if (ret < 0) { if (ret < 0) {
dev_err(&codec->dev, dev_err(&hdev->dev,
"Failed in parse and map nid with err: %d\n", ret); "Failed in parse and map nid with err: %d\n", ret);
return ret; return ret;
} }
snd_hdac_refresh_widgets(hdev, true);
/* ASoC specific initialization */ /* ASoC specific initialization */
ret = snd_soc_register_codec(&codec->dev, &hdmi_hda_codec, ret = snd_soc_register_codec(&hdev->dev, &hdmi_hda_codec,
hdmi_dais, num_dais); hdmi_dais, num_dais);
snd_hdac_ext_bus_link_put(edev->ebus, hlink); snd_hdac_ext_bus_link_put(edev->ebus, hlink);
...@@ -2058,14 +2052,14 @@ static int hdac_hdmi_dev_probe(struct hdac_ext_device *edev) ...@@ -2058,14 +2052,14 @@ static int hdac_hdmi_dev_probe(struct hdac_ext_device *edev)
static int hdac_hdmi_dev_remove(struct hdac_ext_device *edev) static int hdac_hdmi_dev_remove(struct hdac_ext_device *edev)
{ {
struct hdac_hdmi_priv *hdmi = edev->private_data; struct hdac_hdmi_priv *hdmi = hdev_to_hdmi_priv(&edev->hdev);
struct hdac_hdmi_pin *pin, *pin_next; struct hdac_hdmi_pin *pin, *pin_next;
struct hdac_hdmi_cvt *cvt, *cvt_next; struct hdac_hdmi_cvt *cvt, *cvt_next;
struct hdac_hdmi_pcm *pcm, *pcm_next; struct hdac_hdmi_pcm *pcm, *pcm_next;
struct hdac_hdmi_port *port, *port_next; struct hdac_hdmi_port *port, *port_next;
int i; int i;
snd_soc_unregister_codec(&edev->hdac.dev); snd_soc_unregister_codec(&edev->hdev.dev);
list_for_each_entry_safe(pcm, pcm_next, &hdmi->pcm_list, head) { list_for_each_entry_safe(pcm, pcm_next, &hdmi->pcm_list, head) {
pcm->cvt = NULL; pcm->cvt = NULL;
...@@ -2101,8 +2095,8 @@ static int hdac_hdmi_dev_remove(struct hdac_ext_device *edev) ...@@ -2101,8 +2095,8 @@ static int hdac_hdmi_dev_remove(struct hdac_ext_device *edev)
static int hdac_hdmi_runtime_suspend(struct device *dev) static int hdac_hdmi_runtime_suspend(struct device *dev)
{ {
struct hdac_ext_device *edev = to_hda_ext_device(dev); struct hdac_ext_device *edev = to_hda_ext_device(dev);
struct hdac_device *hdac = &edev->hdac; struct hdac_device *hdev = &edev->hdev;
struct hdac_bus *bus = hdac->bus; struct hdac_bus *bus = hdev->bus;
struct hdac_ext_bus *ebus = hbus_to_ebus(bus); struct hdac_ext_bus *ebus = hbus_to_ebus(bus);
struct hdac_ext_link *hlink = NULL; struct hdac_ext_link *hlink = NULL;
int err; int err;
...@@ -2120,7 +2114,7 @@ static int hdac_hdmi_runtime_suspend(struct device *dev) ...@@ -2120,7 +2114,7 @@ static int hdac_hdmi_runtime_suspend(struct device *dev)
* is received. So setting power state is ensured without using loop * is received. So setting power state is ensured without using loop
* to read the state. * to read the state.
*/ */
snd_hdac_codec_read(hdac, hdac->afg, 0, AC_VERB_SET_POWER_STATE, snd_hdac_codec_read(hdev, hdev->afg, 0, AC_VERB_SET_POWER_STATE,
AC_PWRST_D3); AC_PWRST_D3);
err = snd_hdac_display_power(bus, false); err = snd_hdac_display_power(bus, false);
if (err < 0) { if (err < 0) {
...@@ -2142,8 +2136,8 @@ static int hdac_hdmi_runtime_suspend(struct device *dev) ...@@ -2142,8 +2136,8 @@ static int hdac_hdmi_runtime_suspend(struct device *dev)
static int hdac_hdmi_runtime_resume(struct device *dev) static int hdac_hdmi_runtime_resume(struct device *dev)
{ {
struct hdac_ext_device *edev = to_hda_ext_device(dev); struct hdac_ext_device *edev = to_hda_ext_device(dev);
struct hdac_device *hdac = &edev->hdac; struct hdac_device *hdev = &edev->hdev;
struct hdac_bus *bus = hdac->bus; struct hdac_bus *bus = hdev->bus;
struct hdac_ext_bus *ebus = hbus_to_ebus(bus); struct hdac_ext_bus *ebus = hbus_to_ebus(bus);
struct hdac_ext_link *hlink = NULL; struct hdac_ext_link *hlink = NULL;
int err; int err;
...@@ -2168,11 +2162,11 @@ static int hdac_hdmi_runtime_resume(struct device *dev) ...@@ -2168,11 +2162,11 @@ static int hdac_hdmi_runtime_resume(struct device *dev)
return err; return err;
} }
hdac_hdmi_skl_enable_all_pins(&edev->hdac); hdac_hdmi_skl_enable_all_pins(&edev->hdev);
hdac_hdmi_skl_enable_dp12(&edev->hdac); hdac_hdmi_skl_enable_dp12(&edev->hdev);
/* Power up afg */ /* Power up afg */
snd_hdac_codec_read(hdac, hdac->afg, 0, AC_VERB_SET_POWER_STATE, snd_hdac_codec_read(hdev, hdev->afg, 0, AC_VERB_SET_POWER_STATE,
AC_PWRST_D0); AC_PWRST_D0);
return 0; return 0;
......
...@@ -1242,6 +1242,20 @@ static int davinci_mcasp_hw_rule_format(struct snd_pcm_hw_params *params, ...@@ -1242,6 +1242,20 @@ static int davinci_mcasp_hw_rule_format(struct snd_pcm_hw_params *params,
return snd_mask_refine(fmt, &nfmt); return snd_mask_refine(fmt, &nfmt);
} }
static int davinci_mcasp_hw_rule_min_periodsize(
struct snd_pcm_hw_params *params, struct snd_pcm_hw_rule *rule)
{
struct snd_interval *period_size = hw_param_interval(params,
SNDRV_PCM_HW_PARAM_PERIOD_SIZE);
struct snd_interval frames;
snd_interval_any(&frames);
frames.min = 64;
frames.integer = 1;
return snd_interval_refine(period_size, &frames);
}
static int davinci_mcasp_startup(struct snd_pcm_substream *substream, static int davinci_mcasp_startup(struct snd_pcm_substream *substream,
struct snd_soc_dai *cpu_dai) struct snd_soc_dai *cpu_dai)
{ {
...@@ -1333,6 +1347,11 @@ static int davinci_mcasp_startup(struct snd_pcm_substream *substream, ...@@ -1333,6 +1347,11 @@ static int davinci_mcasp_startup(struct snd_pcm_substream *substream,
return ret; return ret;
} }
snd_pcm_hw_rule_add(substream->runtime, 0,
SNDRV_PCM_HW_PARAM_PERIOD_SIZE,
davinci_mcasp_hw_rule_min_periodsize, NULL,
SNDRV_PCM_HW_PARAM_PERIOD_SIZE, -1);
return 0; return 0;
} }
......
...@@ -1401,6 +1401,7 @@ void snd_soc_disconnect_sync(struct device *dev) ...@@ -1401,6 +1401,7 @@ void snd_soc_disconnect_sync(struct device *dev)
snd_card_disconnect_sync(component->card->snd_card); snd_card_disconnect_sync(component->card->snd_card);
} }
EXPORT_SYMBOL_GPL(snd_soc_disconnect_sync);
/** /**
* snd_soc_add_dai_link - Add a DAI link dynamically * snd_soc_add_dai_link - Add a DAI link dynamically
...@@ -3161,7 +3162,7 @@ static struct snd_soc_dai *soc_add_dai(struct snd_soc_component *component, ...@@ -3161,7 +3162,7 @@ static struct snd_soc_dai *soc_add_dai(struct snd_soc_component *component,
if (!dai->driver->ops) if (!dai->driver->ops)
dai->driver->ops = &null_dai_ops; dai->driver->ops = &null_dai_ops;
list_add(&dai->list, &component->dai_list); list_add_tail(&dai->list, &component->dai_list);
component->num_dai++; component->num_dai++;
dev_dbg(dev, "ASoC: Registered DAI '%s'\n", dai->name); dev_dbg(dev, "ASoC: Registered DAI '%s'\n", dai->name);
...@@ -3188,8 +3189,6 @@ static int snd_soc_register_dais(struct snd_soc_component *component, ...@@ -3188,8 +3189,6 @@ static int snd_soc_register_dais(struct snd_soc_component *component,
dev_dbg(dev, "ASoC: dai register %s #%zu\n", dev_name(dev), count); dev_dbg(dev, "ASoC: dai register %s #%zu\n", dev_name(dev), count);
component->dai_drv = dai_drv;
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
dai = soc_add_dai(component, dai_drv + i, dai = soc_add_dai(component, dai_drv + i,
...@@ -4366,6 +4365,7 @@ int snd_soc_get_dai_name(struct of_phandle_args *args, ...@@ -4366,6 +4365,7 @@ int snd_soc_get_dai_name(struct of_phandle_args *args,
args, args,
dai_name); dai_name);
} else { } else {
struct snd_soc_dai *dai;
int id = -1; int id = -1;
switch (args->args_count) { switch (args->args_count) {
...@@ -4387,7 +4387,14 @@ int snd_soc_get_dai_name(struct of_phandle_args *args, ...@@ -4387,7 +4387,14 @@ int snd_soc_get_dai_name(struct of_phandle_args *args,
ret = 0; ret = 0;
*dai_name = pos->dai_drv[id].name; /* find target DAI */
list_for_each_entry(dai, &pos->dai_list, list) {
if (id == 0)
break;
id--;
}
*dai_name = dai->driver->name;
if (!*dai_name) if (!*dai_name)
*dai_name = pos->name; *dai_name = pos->name;
} }
......
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