Skip to contentSkip to conversation

Enable HDA Codec support on Intel Platforms

PATCH Superseded Pierre-Louis Bossart 3 participants 23 messages Jun 2, 2018 – Jul 4, 2018

Subsystems (3)

v3 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

v3 cover Enable HDA Codec support on Intel Platforms

Many Intel platforms (SKL, KBL) etc. in the market supports enhanced audio capabilities which also includes DSP processing. The default HDaudio legacy driver does not allow for the use of the DSP, this patch set makes it possible while reusing existing code for HDAudio codecs and without significant changes to the legacy driver.

This v3 is not split into two batches as done for v1 and v2, but keeps the same logical progression. The first three patches are mostly data structure changes, the DSP support capability is added then with an ASoC HDA driver and the last patches are fixes required for Skylake+. The changes to the HDAudio legacy driver are minimal.

Tests were run successfully on multiple platforms (Dell XPS13, KBL NUC, APL NUC and LeafHill reference board).

Credits: all the initial code was written by Rakesh Ughreja, the rebase to broonie/for-next, cleanups and additional tests were done by Pierre Bossart.

Changes v3:
- port to component model
- additional tests on ApolloLake and KabyLake NUC devices
- cleanups (alignment, typos, etc)

Changes v2:
- Resolved review comments and rebased to latest kernel.
- added module load support for codec drivers.

Rakesh Ughreja (13):
ALSA: hdac: Remove usage of struct hdac_ext_device and use hdac_device
instead
ALSA: hdac: Remove usage of struct hdac_ext_bus and use hdac_bus
instead
ALSA: hdac: Remove usage of struct hdac_ext_driver, use hdac_driver
instead
ASoC: Intel: Boards: Machine driver for SKL+ w/ HDAudio codecs
ASoC: Intel: Skylake: Add entry in sst_acpi_mach for HDA codecs
ASoC: Intel: Skylake: add HDA BE DAIs
ASoC: Intel: Skylake: use hda_bus instead of hdac_bus
ALSA: hda: split snd_hda_codec_new function
ALSA: hdac: remove memory allocation from snd_hdac_ext_bus_device_init
ALSA: hdac: add extended ops in the hdac_bus
ASoC: hdac_hda: add asoc extension for legacy HDA codec drivers
ALSA: hdac: ext: add wait for codec to respond after link reset
ASoC: Intel: Skylake: fix widget handling

 include/sound/hdaudio.h                      |  29 ++
 include/sound/hdaudio_ext.h                  | 123 ++-----
 sound/hda/ext/hdac_ext_bus.c                 |  80 ++---
 sound/hda/ext/hdac_ext_controller.c          |  64 ++--
 sound/hda/ext/hdac_ext_stream.c              | 104 +++---
 sound/pci/hda/hda_bind.c                     |  12 +
 sound/pci/hda/hda_codec.c                    |  68 +++-
 sound/pci/hda/hda_codec.h                    |   2 +
 sound/soc/codecs/Kconfig                     |   5 +
 sound/soc/codecs/Makefile                    |   2 +
 sound/soc/codecs/hdac_hda.c                  | 469 +++++++++++++++++++++++++++
 sound/soc/codecs/hdac_hda.h                  |  24 ++
 sound/soc/codecs/hdac_hdmi.c                 | 416 +++++++++++-------------
 sound/soc/intel/boards/Kconfig               |   9 +
 sound/soc/intel/boards/Makefile              |   2 +
 sound/soc/intel/boards/skl_hda_dsp_common.c  | 133 ++++++++
 sound/soc/intel/boards/skl_hda_dsp_common.h  |  37 +++
 sound/soc/intel/boards/skl_hda_dsp_generic.c | 174 ++++++++++
 sound/soc/intel/skylake/skl-messages.c       |  50 ++-
 sound/soc/intel/skylake/skl-nhlt.c           |   8 +-
 sound/soc/intel/skylake/skl-pcm.c            | 182 +++++++----
 sound/soc/intel/skylake/skl-topology.c       |  23 +-
 sound/soc/intel/skylake/skl-topology.h       |   6 +-
 sound/soc/intel/skylake/skl.c                | 296 +++++++++++------
 sound/soc/intel/skylake/skl.h                |  13 +-
 25 files changed, 1640 insertions(+), 691 deletions(-)
 create mode 100644 sound/soc/codecs/hdac_hda.c
 create mode 100644 sound/soc/codecs/hdac_hda.h
 create mode 100644 sound/soc/intel/boards/skl_hda_dsp_common.c
 create mode 100644 sound/soc/intel/boards/skl_hda_dsp_common.h
 create mode 100644 sound/soc/intel/boards/skl_hda_dsp_generic.c
Signature · 1 line
2.14.1
#1 lore raw

PATCH v3 1/13 ALSA: hdac: Remove usage of struct hdac_ext_device and use hdac_device instead

From: Rakesh Ughreja <[email protected]>

This patch removes the hdac_ext_device structure. The legacy and enhanced HDaudio capabilities can be handled in a backward-compatible way without separate definitions.

Follow-up patches in this series handle the bus and driver definitions.

---
 include/sound/hdaudio_ext.h  |  36 +---
 sound/hda/ext/hdac_ext_bus.c |  25 ++-
 sound/soc/codecs/hdac_hdmi.c | 396 +++++++++++++++++++++----------------------
 3 files changed, 204 insertions(+), 253 deletions(-)
include/sound/hdaudio_ext.h +4 -32
index 9c14e21dda85..c1a5ad0e6e39 100644
@@ -181,48 +181,20 @@ struct hda_dai_map {
 	u32	maxbps;
 };
 
-#define HDA_MAX_NIDS 16
-
-/**
- * struct hdac_ext_device - HDAC Ext device
- *
- * @hdac: hdac core device
- * @nid_list - the dai map which matches the dai-name with the nid
- * @map_cur_idx - the idx in use in dai_map
- * @ops - the hda codec ops common to all codec drivers
- * @pvt_data - private data, for asoc contains asoc codec object
- */
-struct hdac_ext_device {
-	struct hdac_device hdev;
-	struct hdac_ext_bus *ebus;
-
-	/* soc-dai to nid map */
-	struct hda_dai_map nid_list[HDA_MAX_NIDS];
-	unsigned int map_cur_idx;
-
-	/* codec ops */
-	struct hdac_ext_codec_ops ops;
-
-	struct snd_card *card;
-	void *scodec;
-	void *private_data;
-};
-
 struct hdac_ext_dma_params {
 	u32 format;
 	u8 stream_tag;
 };
-#define to_ehdac_device(dev) (container_of((dev), \
-				 struct hdac_ext_device, hdev))
+
 /*
  * HD-audio codec base driver
  */
 struct hdac_ext_driver {
 	struct hdac_driver hdac;
 
-	int	(*probe)(struct hdac_ext_device *dev);
-	int	(*remove)(struct hdac_ext_device *dev);
-	void	(*shutdown)(struct hdac_ext_device *dev);
+	int	(*probe)(struct hdac_device *dev);
+	int	(*remove)(struct hdac_device *dev);
+	void	(*shutdown)(struct hdac_device *dev);
 };
 
 int snd_hda_ext_driver_register(struct hdac_ext_driver *drv);
sound/hda/ext/hdac_ext_bus.c +10 -15
index 0daf31383084..0e4823fdd411 100644
@@ -137,17 +137,16 @@ static void default_release(struct device *dev)
  */
 int snd_hdac_ext_bus_device_init(struct hdac_ext_bus *ebus, int addr)
 {
-	struct hdac_ext_device *edev;
 	struct hdac_device *hdev = NULL;
 	struct hdac_bus *bus = ebus_to_hbus(ebus);
 	char name[15];
 	int ret;
 
-	edev = kzalloc(sizeof(*edev), GFP_KERNEL);
-	if (!edev)
+	hdev = kzalloc(sizeof(*hdev), GFP_KERNEL);
+	if (!hdev)
 		return -ENOMEM;
-	hdev = &edev->hdev;
-	edev->ebus = ebus;
+
+	hdev->bus = bus;
 
 	snprintf(name, sizeof(name), "ehdaudio%dD%d", ebus->idx, addr);
 
@@ -176,10 +175,8 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_device_init);
  */
 void snd_hdac_ext_bus_device_exit(struct hdac_device *hdev)
 {
-	struct hdac_ext_device *edev = to_ehdac_device(hdev);
-
 	snd_hdac_device_exit(hdev);
-	kfree(edev);
+	kfree(hdev);
 }
 EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_device_exit);
 
@@ -212,27 +209,25 @@ static inline struct hdac_ext_driver *get_edrv(struct device *dev)
 	return edrv;
 }
 
-static inline struct hdac_ext_device *get_edev(struct device *dev)
+static inline struct hdac_device *get_hdev(struct device *dev)
 {
 	struct hdac_device *hdev = dev_to_hdac_dev(dev);
-	struct hdac_ext_device *edev = to_ehdac_device(hdev);
-
-	return edev;
+	return hdev;
 }
 
 static int hda_ext_drv_probe(struct device *dev)
 {
-	return (get_edrv(dev))->probe(get_edev(dev));
+	return (get_edrv(dev))->probe(get_hdev(dev));
 }
 
 static int hdac_ext_drv_remove(struct device *dev)
 {
-	return (get_edrv(dev))->remove(get_edev(dev));
+	return (get_edrv(dev))->remove(get_hdev(dev));
 }
 
 static void hdac_ext_drv_shutdown(struct device *dev)
 {
-	return (get_edrv(dev))->shutdown(get_edev(dev));
+	return (get_edrv(dev))->shutdown(get_hdev(dev));
 }
 
 /**
sound/soc/codecs/hdac_hdmi.c +190 -206

1,131 lines not on this page · raw message

Signature · 1 line
2.14.1
#2 lore raw

PATCH v3 2/13 ALSA: hdac: Remove usage of struct hdac_ext_bus and use hdac_bus instead

In reply to Pierre-Louis Bossart

From: Rakesh Ughreja <[email protected]>

This patch removes the hdac_ext_bus structure. The legacy and enhanced HDaudio capabilities can be handled in a backward-compatible way without separate definitions.

Follow-up patches in this series handle the driver definition.

---
 include/sound/hdaudio.h                |  15 +++
 include/sound/hdaudio_ext.h            |  74 +++++--------
 sound/hda/ext/hdac_ext_bus.c           |  27 +++--
 sound/hda/ext/hdac_ext_controller.c    |  55 +++++-----
 sound/hda/ext/hdac_ext_stream.c        | 104 ++++++++-----------
 sound/soc/codecs/hdac_hdmi.c           |  22 ++--
 sound/soc/intel/skylake/skl-messages.c |  50 ++++-----
 sound/soc/intel/skylake/skl-nhlt.c     |   8 +-
 sound/soc/intel/skylake/skl-pcm.c      | 112 ++++++++++----------
 sound/soc/intel/skylake/skl-topology.c |  20 ++--
 sound/soc/intel/skylake/skl-topology.h |   6 +-
 sound/soc/intel/skylake/skl.c          | 184 +++++++++++++++------------------
 sound/soc/intel/skylake/skl.h          |   7 +-
 13 files changed, 308 insertions(+), 376 deletions(-)
include/sound/hdaudio.h +15 -0
index 06536e01ed94..17ab1118cad5 100644
@@ -250,6 +250,11 @@ struct hdac_rb {
  * @mlcap: MultiLink capabilities pointer
  * @gtscap: gts capabilities pointer
  * @drsmcap: dma resume capabilities pointer
+ * @num_streams: streams supported
+ * @idx: HDA link index
+ * @hlink_list: link list of HDA links
+ * @lock: lock for link mgmt
+ * @cmd_dma_state: state of cmd DMAs: CORB and RIRB
  */
 struct hdac_bus {
 	struct device *dev;
@@ -317,6 +322,16 @@ struct hdac_bus {
 	/* i915 component interface */
 	struct i915_audio_component *audio_component;
 	int i915_power_refcount;
+
+	/* parameters required for enhanced capabilities */
+	int num_streams;
+	int idx;
+
+	struct list_head hlink_list;
+
+	struct mutex lock;
+	bool cmd_dma_state;
+
 };
 
 int snd_hdac_bus_init(struct hdac_bus *bus, struct device *dev,
include/sound/hdaudio_ext.h +24 -50

121 lines not on this page · raw message

sound/hda/ext/hdac_ext_bus.c +13 -14
index 0e4823fdd411..77547ede9ae8 100644
@@ -87,7 +87,7 @@ static const struct hdac_io_ops hdac_ext_default_io = {
  *
  * Returns 0 if successful, or a negative error code.
  */
-int snd_hdac_ext_bus_init(struct hdac_ext_bus *ebus, struct device *dev,
+int snd_hdac_ext_bus_init(struct hdac_bus *bus, struct device *dev,
 			const struct hdac_bus_ops *ops,
 			const struct hdac_io_ops *io_ops)
 {
@@ -98,15 +98,15 @@ int snd_hdac_ext_bus_init(struct hdac_ext_bus *ebus, struct device *dev,
 	if (io_ops == NULL)
 		io_ops = &hdac_ext_default_io;
 
-	ret = snd_hdac_bus_init(&ebus->bus, dev, ops, io_ops);
+	ret = snd_hdac_bus_init(bus, dev, ops, io_ops);
 	if (ret < 0)
 		return ret;
 
-	INIT_LIST_HEAD(&ebus->hlink_list);
-	ebus->idx = idx++;
+	INIT_LIST_HEAD(&bus->hlink_list);
+	bus->idx = idx++;
 
-	mutex_init(&ebus->lock);
-	ebus->cmd_dma_state = true;
+	mutex_init(&bus->lock);
+	bus->cmd_dma_state = true;
 
 	return 0;
 }
@@ -116,10 +116,10 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_init);
  * snd_hdac_ext_bus_exit - clean up a HD-audio extended bus
  * @ebus: the pointer to extended bus object
  */
-void snd_hdac_ext_bus_exit(struct hdac_ext_bus *ebus)
+void snd_hdac_ext_bus_exit(struct hdac_bus *bus)
 {
-	snd_hdac_bus_exit(&ebus->bus);
-	WARN_ON(!list_empty(&ebus->hlink_list));
+	snd_hdac_bus_exit(bus);
+	WARN_ON(!list_empty(&bus->hlink_list));
 }
 EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_exit);
 
@@ -135,10 +135,9 @@ static void default_release(struct device *dev)
  *
  * Returns zero for success or a negative error code.
  */
-int snd_hdac_ext_bus_device_init(struct hdac_ext_bus *ebus, int addr)
+int snd_hdac_ext_bus_device_init(struct hdac_bus *bus, int addr)
 {
 	struct hdac_device *hdev = NULL;
-	struct hdac_bus *bus = ebus_to_hbus(ebus);
 	char name[15];
 	int ret;
 
@@ -148,7 +147,7 @@ int snd_hdac_ext_bus_device_init(struct hdac_ext_bus *ebus, int addr)
 
 	hdev->bus = bus;
 
-	snprintf(name, sizeof(name), "ehdaudio%dD%d", ebus->idx, addr);
+	snprintf(name, sizeof(name), "ehdaudio%dD%d", bus->idx, addr);
 
 	ret  = snd_hdac_device_init(hdev, bus, name, addr);
 	if (ret < 0) {
@@ -185,14 +184,14 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_device_exit);
  *
  * @ebus: HD-audio extended bus
  */
-void snd_hdac_ext_bus_device_remove(struct hdac_ext_bus *ebus)
+void snd_hdac_ext_bus_device_remove(struct hdac_bus *bus)
 {
 	struct hdac_device *codec, *__codec;
 	/*
 	 * we need to remove all the codec devices objects created in the
 	 * snd_hdac_ext_bus_device_init
 	 */
-	list_for_each_entry_safe(codec, __codec, &ebus->bus.codec_list, list) {
+	list_for_each_entry_safe(codec, __codec, &bus->codec_list, list) {
 		snd_hdac_device_unregister(codec);
 		put_device(&codec->dev);
 	}
sound/hda/ext/hdac_ext_controller.c +26 -29

174 lines not on this page · raw message

sound/hda/ext/hdac_ext_stream.c +45 -59

338 lines not on this page · raw message

sound/soc/codecs/hdac_hdmi.c +9 -13
index f1e235817a65..c3ccc8d9c91d 100644
@@ -1799,14 +1799,13 @@ static int hdmi_codec_probe(struct snd_soc_component *component)
 	 * 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
 	 */
-	hlink = snd_hdac_ext_bus_get_link(hbus_to_ebus(hdev->bus),
-						dev_name(&hdev->dev));
+	hlink = snd_hdac_ext_bus_get_link(hdev->bus, dev_name(&hdev->dev));
 	if (!hlink) {
 		dev_err(&hdev->dev, "hdac link not found\n");
 		return -EIO;
 	}
 
-	snd_hdac_ext_bus_link_get(hbus_to_ebus(hdev->bus), hlink);
+	snd_hdac_ext_bus_link_get(hdev->bus, hlink);
 
 	ret = create_fill_widget_route_map(dapm);
 	if (ret < 0)
@@ -1984,14 +1983,13 @@ static int hdac_hdmi_dev_probe(struct hdac_device *hdev)
 	const struct hda_device_id *hdac_id = hdac_get_device_id(hdev, hdrv);
 
 	/* hold the ref while we probe */
-	hlink = snd_hdac_ext_bus_get_link(hbus_to_ebus(hdev->bus),
-						dev_name(&hdev->dev));
+	hlink = snd_hdac_ext_bus_get_link(hdev->bus, dev_name(&hdev->dev));
 	if (!hlink) {
 		dev_err(&hdev->dev, "hdac link not found\n");
 		return -EIO;
 	}
 
-	snd_hdac_ext_bus_link_get(hbus_to_ebus(hdev->bus), hlink);
+	snd_hdac_ext_bus_link_get(hdev->bus, hlink);
 
 	hdmi_priv = devm_kzalloc(&hdev->dev, sizeof(*hdmi_priv), GFP_KERNEL);
 	if (hdmi_priv == NULL)
@@ -2044,7 +2042,7 @@ static int hdac_hdmi_dev_probe(struct hdac_device *hdev)
 	ret = devm_snd_soc_register_component(&hdev->dev, &hdmi_hda_codec,
 					hdmi_dais, num_dais);
 
-	snd_hdac_ext_bus_link_put(hbus_to_ebus(hdev->bus), hlink);
+	snd_hdac_ext_bus_link_put(hdev->bus, hlink);
 
 	return ret;
 }
@@ -2093,7 +2091,6 @@ static int hdac_hdmi_runtime_suspend(struct device *dev)
 {
 	struct hdac_device *hdev = dev_to_hdac_dev(dev);
 	struct hdac_bus *bus = hdev->bus;
-	struct hdac_ext_bus *ebus = hbus_to_ebus(bus);
 	struct hdac_ext_link *hlink = NULL;
 	int err;
 
@@ -2118,13 +2115,13 @@ static int hdac_hdmi_runtime_suspend(struct device *dev)
 		return err;
 	}
 
-	hlink = snd_hdac_ext_bus_get_link(ebus, dev_name(dev));
+	hlink = snd_hdac_ext_bus_get_link(bus, dev_name(dev));
 	if (!hlink) {
 		dev_err(dev, "hdac link not found\n");
 		return -EIO;
 	}
 
-	snd_hdac_ext_bus_link_put(ebus, hlink);
+	snd_hdac_ext_bus_link_put(bus, hlink);
 
 	return 0;
 }
@@ -2133,7 +2130,6 @@ static int hdac_hdmi_runtime_resume(struct device *dev)
 {
 	struct hdac_device *hdev = dev_to_hdac_dev(dev);
 	struct hdac_bus *bus = hdev->bus;
-	struct hdac_ext_bus *ebus = hbus_to_ebus(bus);
 	struct hdac_ext_link *hlink = NULL;
 	int err;
 
@@ -2143,13 +2139,13 @@ static int hdac_hdmi_runtime_resume(struct device *dev)
 	if (!bus)
 		return 0;
 
-	hlink = snd_hdac_ext_bus_get_link(ebus, dev_name(dev));
+	hlink = snd_hdac_ext_bus_get_link(bus, dev_name(dev));
 	if (!hlink) {
 		dev_err(dev, "hdac link not found\n");
 		return -EIO;
 	}
 
-	snd_hdac_ext_bus_link_get(ebus, hlink);
+	snd_hdac_ext_bus_link_get(bus, hlink);
 
 	err = snd_hdac_display_power(bus, true);
 	if (err < 0) {
sound/soc/intel/skylake/skl-messages.c +22 -28

151 lines not on this page · raw message

sound/soc/intel/skylake/skl-nhlt.c +4 -4
index b9b140275be0..01a050cf8775 100644
@@ -141,7 +141,7 @@ struct nhlt_specific_cfg
 {
 	struct nhlt_fmt *fmt;
 	struct nhlt_endpoint *epnt;
-	struct hdac_bus *bus = ebus_to_hbus(&skl->ebus);
+	struct hdac_bus *bus = skl_to_bus(skl);
 	struct device *dev = bus->dev;
 	struct nhlt_specific_cfg *sp_config;
 	struct nhlt_acpi_table *nhlt = skl->nhlt;
@@ -228,7 +228,7 @@ static void skl_nhlt_trim_space(char *trim)
 int skl_nhlt_update_topology_bin(struct skl *skl)
 {
 	struct nhlt_acpi_table *nhlt = (struct nhlt_acpi_table *)skl->nhlt;
-	struct hdac_bus *bus = ebus_to_hbus(&skl->ebus);
+	struct hdac_bus *bus = skl_to_bus(skl);
 	struct device *dev = bus->dev;
 
 	dev_dbg(dev, "oem_id %.6s, oem_table_id %8s oem_revision %d\n",
@@ -248,8 +248,8 @@ static ssize_t skl_nhlt_platform_id_show(struct device *dev,
 			struct device_attribute *attr, char *buf)
 {
 	struct pci_dev *pci = to_pci_dev(dev);
-	struct hdac_ext_bus *ebus = pci_get_drvdata(pci);
-	struct skl *skl = ebus_to_skl(ebus);
+	struct hdac_bus *bus = pci_get_drvdata(pci);
+	struct skl *skl = bus_to_skl(bus);
 	struct nhlt_acpi_table *nhlt = (struct nhlt_acpi_table *)skl->nhlt;
 	char platform_id[32];
 
sound/soc/intel/skylake/skl-pcm.c +54 -58

368 lines not on this page · raw message

sound/soc/intel/skylake/skl-topology.c +8 -12
index 2c5129782959..5ed17218c57c 100644
@@ -934,7 +934,7 @@ static int skl_tplg_find_moduleid_from_uuid(struct skl *skl,
 	struct soc_bytes_ext *sb = (void *) k->private_value;
 	struct skl_algo_data *bc = (struct skl_algo_data *)sb->dobj.private;
 	struct skl_kpb_params *uuid_params, *params;
-	struct hdac_bus *bus = ebus_to_hbus(skl_to_ebus(skl));
+	struct hdac_bus *bus = skl_to_bus(skl);
 	int i, size, module_id;
 
 	if (bc->set_params == SKL_PARAM_BIND && bc->max) {
@@ -3025,9 +3025,8 @@ static int skl_tplg_widget_load(struct snd_soc_component *cmpnt,
 				struct snd_soc_tplg_dapm_widget *tplg_w)
 {
 	int ret;
-	struct hdac_ext_bus *ebus = snd_soc_component_get_drvdata(cmpnt);
-	struct skl *skl = ebus_to_skl(ebus);
-	struct hdac_bus *bus = ebus_to_hbus(ebus);
+	struct hdac_bus *bus = snd_soc_component_get_drvdata(cmpnt);
+	struct skl *skl = bus_to_skl(bus);
 	struct skl_module_cfg *mconfig;
 
 	if (!tplg_w->priv.size)
@@ -3133,8 +3132,7 @@ static int skl_tplg_control_load(struct snd_soc_component *cmpnt,
 	struct soc_bytes_ext *sb;
 	struct snd_soc_tplg_bytes_control *tplg_bc;
 	struct snd_soc_tplg_enum_control *tplg_ec;
-	struct hdac_ext_bus *ebus  = snd_soc_component_get_drvdata(cmpnt);
-	struct hdac_bus *bus = ebus_to_hbus(ebus);
+	struct hdac_bus *bus  = snd_soc_component_get_drvdata(cmpnt);
 	struct soc_enum *se;
 
 	switch (hdr->ops.info) {
@@ -3618,9 +3616,8 @@ static int skl_tplg_get_manifest_data(struct snd_soc_tplg_manifest *manifest,
 static int skl_manifest_load(struct snd_soc_component *cmpnt,
 				struct snd_soc_tplg_manifest *manifest)
 {
-	struct hdac_ext_bus *ebus = snd_soc_component_get_drvdata(cmpnt);
-	struct hdac_bus *bus = ebus_to_hbus(ebus);
-	struct skl *skl = ebus_to_skl(ebus);
+	struct hdac_bus *bus = snd_soc_component_get_drvdata(cmpnt);
+	struct skl *skl = bus_to_skl(bus);
 
 	/* proceed only if we have private data defined */
 	if (manifest->priv.size == 0)
@@ -3709,12 +3706,11 @@ static void skl_tplg_set_pipe_type(struct skl *skl, struct skl_pipe *pipe)
 /*
  * SKL topology init routine
  */
-int skl_tplg_init(struct snd_soc_component *component, struct hdac_ext_bus *ebus)
+int skl_tplg_init(struct snd_soc_component *component, struct hdac_bus *bus)
 {
 	int ret;
 	const struct firmware *fw;
-	struct hdac_bus *bus = ebus_to_hbus(ebus);
-	struct skl *skl = ebus_to_skl(ebus);
+	struct skl *skl = bus_to_skl(bus);
 	struct skl_pipeline *ppl;
 
 	ret = request_firmware(&fw, skl->tplg_name, bus->dev);
sound/soc/intel/skylake/skl-topology.h +3 -3
index 6d7e0569695f..daeb6d2bb7fc 100644
@@ -458,9 +458,9 @@ enum skl_channel {
 
 static inline struct skl *get_skl_ctx(struct device *dev)
 {
-	struct hdac_ext_bus *ebus = dev_get_drvdata(dev);
+	struct hdac_bus *bus = dev_get_drvdata(dev);
 
-	return ebus_to_skl(ebus);
+	return bus_to_skl(bus);
 }
 
 int skl_tplg_be_update_params(struct snd_soc_dai *dai,
@@ -470,7 +470,7 @@ int skl_dsp_set_dma_control(struct skl_sst *ctx, u32 *caps,
 void skl_tplg_set_be_dmic_config(struct snd_soc_dai *dai,
 	struct skl_pipe_params *params, int stream);
 int skl_tplg_init(struct snd_soc_component *component,
-				struct hdac_ext_bus *ebus);
+				struct hdac_bus *ebus);
 struct skl_module_cfg *skl_tplg_fe_get_cpr_module(
 		struct snd_soc_dai *dai, int stream);
 int skl_tplg_update_pipe_params(struct device *dev,
sound/soc/intel/skylake/skl.c +82 -102

517 lines not on this page · raw message

sound/soc/intel/skylake/skl.h +3 -4
index 0d5375cbcf6e..78aa8bdcb619 100644
@@ -71,7 +71,7 @@ struct skl_fw_config {
 };
 
 struct skl {
-	struct hdac_ext_bus ebus;
+	struct hdac_bus hbus;
 	struct pci_dev *pci;
 
 	unsigned int init_done:1; /* delayed init status */
@@ -105,9 +105,8 @@ struct skl {
 	struct snd_soc_acpi_mach *mach;
 };
 
-#define skl_to_ebus(s)	(&(s)->ebus)
-#define ebus_to_skl(sbus) \
-	container_of(sbus, struct skl, sbus)
+#define skl_to_bus(s)  (&(s)->hbus)
+#define bus_to_skl(bus) container_of(bus, struct skl, hbus)
 
 /* to pass dai dma data */
 struct skl_dma_params {
Signature · 1 line
2.14.1
#3 lore raw

PATCH v3 3/13 ALSA: hdac: Remove usage of struct hdac_ext_driver, use hdac_driver instead

In reply to Pierre-Louis Bossart

From: Rakesh Ughreja <[email protected]>

This patch removes the hdac_ext_driver structure. The legacy and enhanced HDaudio capabilities can be handled in a backward-compatible way without separate definitions.

---
 include/sound/hdaudio.h      |  5 +++++
 include/sound/hdaudio_ext.h  | 17 ++---------------
 sound/hda/ext/hdac_ext_bus.c | 30 ++++++++++++++----------------
 sound/soc/codecs/hdac_hdmi.c | 12 +++++-------
 4 files changed, 26 insertions(+), 38 deletions(-)
include/sound/hdaudio.h +5 -0
index 17ab1118cad5..62dd486e7d48 100644
@@ -188,6 +188,11 @@ struct hdac_driver {
 	const struct hda_device_id *id_table;
 	int (*match)(struct hdac_device *dev, struct hdac_driver *drv);
 	void (*unsol_event)(struct hdac_device *dev, unsigned int event);
+
+	/* fields used by ext bus APIs */
+	int (*probe)(struct hdac_device *dev);
+	int (*remove)(struct hdac_device *dev);
+	void (*shutdown)(struct hdac_device *dev);
 };
 
 #define drv_to_hdac_driver(_drv) container_of(_drv, struct hdac_driver, driver)
include/sound/hdaudio_ext.h +2 -15
index e5b0cd1ade19..3c302477750b 100644
@@ -160,20 +160,7 @@ struct hdac_ext_dma_params {
 	u8 stream_tag;
 };
 
-/*
- * HD-audio codec base driver
- */
-struct hdac_ext_driver {
-	struct hdac_driver hdac;
-
-	int	(*probe)(struct hdac_device *dev);
-	int	(*remove)(struct hdac_device *dev);
-	void	(*shutdown)(struct hdac_device *dev);
-};
-
-int snd_hda_ext_driver_register(struct hdac_ext_driver *drv);
-void snd_hda_ext_driver_unregister(struct hdac_ext_driver *drv);
-
-#define to_ehdac_driver(_drv) container_of(_drv, struct hdac_ext_driver, hdac)
+int snd_hda_ext_driver_register(struct hdac_driver *drv);
+void snd_hda_ext_driver_unregister(struct hdac_driver *drv);
 
 #endif /* __SOUND_HDAUDIO_EXT_H */
sound/hda/ext/hdac_ext_bus.c +14 -16
index 77547ede9ae8..52f07766fff3 100644
@@ -200,12 +200,10 @@ EXPORT_SYMBOL_GPL(snd_hdac_ext_bus_device_remove);
 #define dev_to_hdac(dev) (container_of((dev), \
 			struct hdac_device, dev))
 
-static inline struct hdac_ext_driver *get_edrv(struct device *dev)
+static inline struct hdac_driver *get_hdrv(struct device *dev)
 {
 	struct hdac_driver *hdrv = drv_to_hdac_driver(dev->driver);
-	struct hdac_ext_driver *edrv = to_ehdac_driver(hdrv);
-
-	return edrv;
+	return hdrv;
 }
 
 static inline struct hdac_device *get_hdev(struct device *dev)
@@ -216,17 +214,17 @@ static inline struct hdac_device *get_hdev(struct device *dev)
 
 static int hda_ext_drv_probe(struct device *dev)
 {
-	return (get_edrv(dev))->probe(get_hdev(dev));
+	return (get_hdrv(dev))->probe(get_hdev(dev));
 }
 
 static int hdac_ext_drv_remove(struct device *dev)
 {
-	return (get_edrv(dev))->remove(get_hdev(dev));
+	return (get_hdrv(dev))->remove(get_hdev(dev));
 }
 
 static void hdac_ext_drv_shutdown(struct device *dev)
 {
-	return (get_edrv(dev))->shutdown(get_hdev(dev));
+	return (get_hdrv(dev))->shutdown(get_hdev(dev));
 }
 
 /**
@@ -234,20 +232,20 @@ static void hdac_ext_drv_shutdown(struct device *dev)
  *
  * @drv: ext hda driver structure
  */
-int snd_hda_ext_driver_register(struct hdac_ext_driver *drv)
+int snd_hda_ext_driver_register(struct hdac_driver *drv)
 {
-	drv->hdac.type = HDA_DEV_ASOC;
-	drv->hdac.driver.bus = &snd_hda_bus_type;
+	drv->type = HDA_DEV_ASOC;
+	drv->driver.bus = &snd_hda_bus_type;
 	/* we use default match */
 
 	if (drv->probe)
-		drv->hdac.driver.probe = hda_ext_drv_probe;
+		drv->driver.probe = hda_ext_drv_probe;
 	if (drv->remove)
-		drv->hdac.driver.remove = hdac_ext_drv_remove;
+		drv->driver.remove = hdac_ext_drv_remove;
 	if (drv->shutdown)
-		drv->hdac.driver.shutdown = hdac_ext_drv_shutdown;
+		drv->driver.shutdown = hdac_ext_drv_shutdown;
 
-	return driver_register(&drv->hdac.driver);
+	return driver_register(&drv->driver);
 }
 EXPORT_SYMBOL_GPL(snd_hda_ext_driver_register);
 
@@ -256,8 +254,8 @@ EXPORT_SYMBOL_GPL(snd_hda_ext_driver_register);
  *
  * @drv: ext hda driver structure
  */
-void snd_hda_ext_driver_unregister(struct hdac_ext_driver *drv)
+void snd_hda_ext_driver_unregister(struct hdac_driver *drv)
 {
-	driver_unregister(&drv->hdac.driver);
+	driver_unregister(&drv->driver);
 }
 EXPORT_SYMBOL_GPL(snd_hda_ext_driver_unregister);
sound/soc/codecs/hdac_hdmi.c +5 -7
index c3ccc8d9c91d..3e3a2a9ef310 100644
@@ -2186,14 +2186,12 @@ static const struct hda_device_id hdmi_list[] = {
 
 MODULE_DEVICE_TABLE(hdaudio, hdmi_list);
 
-static struct hdac_ext_driver hdmi_driver = {
-	. hdac = {
-		.driver = {
-			.name   = "HDMI HDA Codec",
-			.pm = &hdac_hdmi_pm,
-		},
-		.id_table       = hdmi_list,
+static struct hdac_driver hdmi_driver = {
+	.driver = {
+		.name   = "HDMI HDA Codec",
+		.pm = &hdac_hdmi_pm,
 	},
+	.id_table       = hdmi_list,
 	.probe          = hdac_hdmi_dev_probe,
 	.remove         = hdac_hdmi_dev_remove,
 };
Signature · 1 line
2.14.1
#4 lore raw

PATCH v3 4/13 ASoC: Intel: Boards: Machine driver for SKL+ w/ HDAudio codecs

In reply to Pierre-Louis Bossart

From: Rakesh Ughreja <[email protected]>

Add machine driver for Intel platforms (SKL/KBL/BXT/APL) with HDA and iDisp codecs. This patch adds support for only iDisp (HDMI/DP) codec. In the following patches support for HDA codecs will be added.

This should work for other Intel platforms as well e.g. GLK,CNL however this series is not tested on all the platforms.

---
 sound/soc/intel/boards/Kconfig               |   8 ++
 sound/soc/intel/boards/Makefile              |   2 +
 sound/soc/intel/boards/skl_hda_dsp_common.c  | 109 +++++++++++++++++++++
 sound/soc/intel/boards/skl_hda_dsp_common.h  |  37 ++++++++
 sound/soc/intel/boards/skl_hda_dsp_generic.c | 136 +++++++++++++++++++++++++++
 sound/soc/intel/skylake/skl.h                |   2 +
 6 files changed, 294 insertions(+)
 create mode 100644 sound/soc/intel/boards/skl_hda_dsp_common.c
 create mode 100644 sound/soc/intel/boards/skl_hda_dsp_common.h
 create mode 100644 sound/soc/intel/boards/skl_hda_dsp_generic.c
sound/soc/intel/boards/Kconfig +8 -0
index 24797482a3d2..5c24b7927dbc 100644
@@ -279,6 +279,14 @@ config SND_SOC_INTEL_KBL_DA7219_MAX98357A_MACH
 	  This adds support for ASoC Onboard Codec I2S machine driver. This will
 	  create an alsa sound card for DA7219 + MAX98357A I2S audio codec.
 	  Say Y if you have such a device.
+
+config SND_SOC_INTEL_SKL_HDA_DSP_GENERIC_MACH
+	tristate "SKL/KBL/BXT/APL with HDA Codecs"
+	select SND_SOC_HDAC_HDMI
+	help
+	  This adds support for ASoC machine driver for Intel platforms
+	  SKL/KBL/BXT/APL with iDisp, HDA audio codecs.
+          Say Y or m if you have such a device. This is a recommended option.
 	  If unsure select "N".
 
 endif ## SND_SOC_INTEL_SKYLAKE
sound/soc/intel/boards/Makefile +2 -0
index 92b5507291af..17728fb45c39 100644
@@ -19,6 +19,7 @@ snd-soc-kbl_da7219_max98357a-objs := kbl_da7219_max98357a.o
 snd-soc-kbl_rt5663_max98927-objs := kbl_rt5663_max98927.o
 snd-soc-kbl_rt5663_rt5514_max98927-objs := kbl_rt5663_rt5514_max98927.o
 snd-soc-skl_rt286-objs := skl_rt286.o
+snd-soc-skl_hda_dsp-objs := skl_hda_dsp_generic.o skl_hda_dsp_common.o
 snd-skl_nau88l25_max98357a-objs := skl_nau88l25_max98357a.o
 snd-soc-skl_nau88l25_ssm4567-objs := skl_nau88l25_ssm4567.o
 
@@ -44,3 +45,4 @@ obj-$(CONFIG_SND_SOC_INTEL_KBL_RT5663_RT5514_MAX98927_MACH) += snd-soc-kbl_rt566
 obj-$(CONFIG_SND_SOC_INTEL_SKL_RT286_MACH) += snd-soc-skl_rt286.o
 obj-$(CONFIG_SND_SOC_INTEL_SKL_NAU88L25_MAX98357A_MACH) += snd-skl_nau88l25_max98357a.o
 obj-$(CONFIG_SND_SOC_INTEL_SKL_NAU88L25_SSM4567_MACH) += snd-soc-skl_nau88l25_ssm4567.o
+obj-$(CONFIG_SND_SOC_INTEL_SKL_HDA_DSP_GENERIC_MACH) += snd-soc-skl_hda_dsp.o
sound/soc/intel/boards/skl_hda_dsp_common.c new file +109 -0

109 lines not on this page · raw message

sound/soc/intel/boards/skl_hda_dsp_common.h new file +37 -0
new file mode 100644
index 000000000000..9d03dc0eed60
@@ -0,0 +1,37 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright(c) 2015-17 Intel Corporation.
+ */
+
+/*
+ * This file defines data structures used in Machine Driver for Intel
+ * platforms with HDA Codecs.
+ */
+
+#ifndef __SOUND_SOC_HDA_DSP_COMMON_H
+#define __SOUND_SOC_HDA_DSP_COMMON_H
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <sound/core.h>
+#include <sound/jack.h>
+
+#define HDA_DSP_MAX_BE_DAI_LINKS 3
+
+struct skl_hda_hdmi_pcm {
+	struct list_head head;
+	struct snd_soc_dai *codec_dai;
+	struct snd_soc_jack hdmi_jack;
+	int device;
+};
+
+struct skl_hda_private {
+	struct list_head hdmi_pcm_list;
+	int pcm_count;
+	const char *platform_name;
+};
+
+extern struct snd_soc_dai_link skl_hda_be_dai_links[HDA_DSP_MAX_BE_DAI_LINKS];
+int skl_hda_hdmi_jack_init(struct snd_soc_card *card);
+int skl_hda_hdmi_add_pcm(struct snd_soc_card *card, int device);
+
+#endif /* __SOUND_SOC_HDA_DSP_COMMON_H */
sound/soc/intel/boards/skl_hda_dsp_generic.c new file +136 -0

136 lines not on this page · raw message

sound/soc/intel/skylake/skl.h +2 -0
index 78aa8bdcb619..4105a9371b64 100644
@@ -117,6 +117,8 @@ struct skl_dma_params {
 struct skl_machine_pdata {
 	u32 dmic_num;
 	bool use_tplg_pcm; /* use dais and dai links from topology */
+	const char *platform;
+	u32 codec_mask;
 };
 
 struct skl_dsp_ops {
Signature · 1 line
2.14.1
#5 lore raw

PATCH v3 5/13 ASoC: Intel: Skylake: Add entry in sst_acpi_mach for HDA codecs

In reply to Pierre-Louis Bossart

From: Rakesh Ughreja <[email protected]>

When no I2S based codec entries are found in the BIOS, check if there are any HDA codecs detected on the bus. Based on the number of codecs found take appropriate action in machine driver. If there are two HDA codecs i.e. iDisp + HDA found on the bus, register DAIs and DAI links for both. If only one codec i.e. iDisp is found then load only iDisp machine driver.

---
 sound/soc/intel/skylake/skl.c | 61 ++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 55 insertions(+), 6 deletions(-)
sound/soc/intel/skylake/skl.c +55 -6
index 9c5a701d68ac..e5b2fc44f56a 100644
@@ -473,6 +473,23 @@ static struct skl_ssp_clk skl_ssp_clks[] = {
 						{.name = "ssp5_sclkfs"},
 };
 
+static struct snd_soc_acpi_mach *skl_find_hda_machine(struct skl *skl,
+					struct snd_soc_acpi_mach *machines)
+{
+	struct hdac_bus *bus = skl_to_bus(skl);
+	struct snd_soc_acpi_mach *mach;
+
+	/* check if we have any codecs detected on bus */
+	if (bus->codec_mask == 0)
+		return NULL;
+
+	for (mach = machines; mach->id[0]; mach++) {
+		if (!strcmp(mach->id, "HDA_GEN"))
+			return mach;
+	}
+	return NULL;
+}
+
 static int skl_find_machine(struct skl *skl, void *driver_data)
 {
 	struct hdac_bus *bus = skl_to_bus(skl);
@@ -480,9 +497,13 @@ static int skl_find_machine(struct skl *skl, void *driver_data)
 	struct skl_machine_pdata *pdata;
 
 	mach = snd_soc_acpi_find_machine(mach);
-	if (mach == NULL) {
-		dev_err(bus->dev, "No matching machine driver found\n");
-		return -ENODEV;
+	if (!mach) {
+		dev_dbg(bus->dev, "No matching I2S machine driver found\n");
+		mach = skl_find_hda_machine(skl, driver_data);
+		if (!mach) {
+			dev_err(bus->dev, "No matching machine driver found\n");
+			return -ENODEV;
+		}
 	}
 
 	skl->mach = mach;
@@ -497,8 +518,9 @@ static int skl_find_machine(struct skl *skl, void *driver_data)
 
 static int skl_machine_device_register(struct skl *skl)
 {
-	struct hdac_bus *bus = skl_to_bus(skl);
 	struct snd_soc_acpi_mach *mach = skl->mach;
+	struct hdac_bus *bus = skl_to_bus(skl);
+	struct skl_machine_pdata *pdata;
 	struct platform_device *pdev;
 	int ret;
 
@@ -515,8 +537,12 @@ static int skl_machine_device_register(struct skl *skl)
 		return -EIO;
 	}
 
-	if (mach->pdata)
+	if (mach->pdata) {
+		pdata = (struct skl_machine_pdata *)mach->pdata;
+		pdata->platform = dev_name(bus->dev);
+		pdata->codec_mask = bus->codec_mask;
 		dev_set_drvdata(&pdev->dev, mach->pdata);
+	}
 
 	skl->i2s_dev = pdev;
 
@@ -1062,6 +1088,14 @@ static struct snd_soc_acpi_mach sst_skl_devdata[] = {
 		.quirk_data = &skl_codecs,
 		.pdata = &skl_dmic_data
 	},
+	{
+		.id = "HDA_GEN",
+		.drv_name = "skl_hda_generic",
+		.fw_filename = "intel/dsp_fw_release.bin",
+		.machine_quirk = NULL,
+		.quirk_data = NULL,
+		.pdata = &cnl_pdata,
+	},
 	{}
 };
 
@@ -1078,6 +1112,14 @@ static struct snd_soc_acpi_mach sst_bxtp_devdata[] = {
 		.machine_quirk = snd_soc_acpi_codec_list,
 		.quirk_data = &bxt_codecs,
 	},
+	{
+		.id = "HDA_GEN",
+		.drv_name = "skl_hda_generic",
+		.fw_filename = "intel/dsp_fw_bxtn.bin",
+		.machine_quirk = NULL,
+		.quirk_data = NULL,
+		.pdata = &cnl_pdata,
+	},
 	{}
 };
 
@@ -1132,7 +1174,14 @@ static struct snd_soc_acpi_mach sst_kbl_devdata[] = {
 		.quirk_data = &kbl_7219_98357_codecs,
 		.pdata = &skl_dmic_data
 	},
-
+	{
+		.id = "HDA_GEN",
+		.drv_name = "skl_hda_generic",
+		.fw_filename = "intel/dsp_fw_kbl.bin",
+		.machine_quirk = NULL,
+		.quirk_data = NULL,
+		.pdata = &cnl_pdata,
+	},
 	{}
 };
 
Signature · 1 line
2.14.1
#6 lore raw

PATCH v3 6/13 ASoC: Intel: Skylake: add HDA BE DAIs

In reply to Pierre-Louis Bossart

From: Rakesh Ughreja <[email protected]>

Add support for HDA BE DAIs in SKL platform driver.

---
 sound/soc/intel/skylake/skl-pcm.c | 70 ++++++++++++++++++++++++++++++++-------
 1 file changed, 58 insertions(+), 12 deletions(-)
sound/soc/intel/skylake/skl-pcm.c +58 -12
index d7fc3b2d3e68..3284f16077a5 100644
@@ -32,6 +32,7 @@
 #define HDA_MONO 1
 #define HDA_STEREO 2
 #define HDA_QUAD 4
+#define HDA_MAX 8
 
 static const struct snd_pcm_hardware azx_pcm_hw = {
 	.info =			(SNDRV_PCM_INFO_MMAP |
@@ -569,7 +570,10 @@ static int skl_link_hw_params(struct snd_pcm_substream *substream,
 	stream_tag = hdac_stream(link_dev)->stream_tag;
 
 	/* set the stream tag in the codec dai dma params  */
-	snd_soc_dai_set_tdm_slot(codec_dai, stream_tag, 0, 0, 0);
+	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+		snd_soc_dai_set_tdm_slot(codec_dai, stream_tag, 0, 0, 0);
+	else
+		snd_soc_dai_set_tdm_slot(codec_dai, 0, stream_tag, 0, 0);
 
 	p_params.s_fmt = snd_pcm_format_width(params_format(params));
 	p_params.ch = params_channels(params);
@@ -995,21 +999,63 @@ static struct snd_soc_dai_driver skl_platform_dai[] = {
 	},
 },
 {
-	.name = "HD-Codec Pin",
+	.name = "Analog CPU DAI",
 	.ops = &skl_link_dai_ops,
 	.playback = {
-		.stream_name = "HD-Codec Tx",
-		.channels_min = HDA_STEREO,
-		.channels_max = HDA_STEREO,
-		.rates = SNDRV_PCM_RATE_48000,
-		.formats = SNDRV_PCM_FMTBIT_S16_LE,
+		.stream_name = "Analog CPU Playback",
+		.channels_min = HDA_MONO,
+		.channels_max = HDA_MAX,
+		.rates = SNDRV_PCM_RATE_8000_192000,
+		.formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE |
+			SNDRV_PCM_FMTBIT_S32_LE,
 	},
 	.capture = {
-		.stream_name = "HD-Codec Rx",
-		.channels_min = HDA_STEREO,
-		.channels_max = HDA_STEREO,
-		.rates = SNDRV_PCM_RATE_48000,
-		.formats = SNDRV_PCM_FMTBIT_S16_LE,
+		.stream_name = "Analog CPU Capture",
+		.channels_min = HDA_MONO,
+		.channels_max = HDA_MAX,
+		.rates = SNDRV_PCM_RATE_8000_192000,
+		.formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE |
+			SNDRV_PCM_FMTBIT_S32_LE,
+	},
+},
+{
+	.name = "Alt Analog CPU DAI",
+	.ops = &skl_link_dai_ops,
+	.playback = {
+		.stream_name = "Alt Analog CPU Playback",
+		.channels_min = HDA_MONO,
+		.channels_max = HDA_MAX,
+		.rates = SNDRV_PCM_RATE_8000_192000,
+		.formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE |
+			SNDRV_PCM_FMTBIT_S32_LE,
+	},
+	.capture = {
+		.stream_name = "Alt Analog CPU Capture",
+		.channels_min = HDA_MONO,
+		.channels_max = HDA_MAX,
+		.rates = SNDRV_PCM_RATE_8000_192000,
+		.formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE |
+			SNDRV_PCM_FMTBIT_S32_LE,
+	},
+},
+{
+	.name = "Digital CPU DAI",
+	.ops = &skl_link_dai_ops,
+	.playback = {
+		.stream_name = "Digital CPU Playback",
+		.channels_min = HDA_MONO,
+		.channels_max = HDA_MAX,
+		.rates = SNDRV_PCM_RATE_8000_192000,
+		.formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE |
+			SNDRV_PCM_FMTBIT_S32_LE,
+	},
+	.capture = {
+		.stream_name = "Digital CPU Capture",
+		.channels_min = HDA_MONO,
+		.channels_max = HDA_MAX,
+		.rates = SNDRV_PCM_RATE_8000_192000,
+		.formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE |
+			SNDRV_PCM_FMTBIT_S32_LE,
 	},
 },
 };
Signature · 1 line
2.14.1
#7 lore raw

PATCH v3 7/13 ASoC: Intel: Skylake: use hda_bus instead of hdac_bus

In reply to Pierre-Louis Bossart

From: Rakesh Ughreja <[email protected]>

Use hda_bus instead of hdac_bus in the SKL ASoC platform driver to enable reuse of legacy HDA codec drivers.

---
 sound/soc/intel/skylake/skl.c | 10 +++++++++-
 sound/soc/intel/skylake/skl.h | 10 +++++++---
 2 files changed, 16 insertions(+), 4 deletions(-)
sound/soc/intel/skylake/skl.c +9 -1
index e5b2fc44f56a..9dae39cda441 100644
@@ -35,6 +35,7 @@
 #include "skl.h"
 #include "skl-sst-dsp.h"
 #include "skl-sst-ipc.h"
+#include "../../../pci/hda/hda_codec.h"
 
 static struct skl_machine_pdata skl_dmic_data;
 
@@ -668,7 +669,7 @@ static int probe_codec(struct hdac_bus *bus, int addr)
 	mutex_unlock(&bus->cmd_mutex);
 	if (res == -1)
 		return -EIO;
-	dev_dbg(bus->dev, "codec #%d probed OK\n", addr);
+	dev_dbg(bus->dev, "codec #%d probed OK: %x\n", addr, res);
 
 	return snd_hdac_ext_bus_device_init(bus, addr);
 }
@@ -807,6 +808,7 @@ static int skl_create(struct pci_dev *pci,
 {
 	struct skl *skl;
 	struct hdac_bus *bus;
+	struct hda_bus *hbus;
 
 	int err;
 
@@ -822,6 +824,7 @@ static int skl_create(struct pci_dev *pci,
 		return -ENOMEM;
 	}
 
+	hbus = skl_to_hbus(skl);
 	bus = skl_to_bus(skl);
 	snd_hdac_ext_bus_init(bus, &pci->dev, &bus_core_ops, io_ops);
 	bus->use_posbuf = 1;
@@ -829,6 +832,11 @@ static int skl_create(struct pci_dev *pci,
 	INIT_WORK(&skl->probe_work, skl_probe_work);
 	bus->bdl_pos_adj = 0;
 
+	mutex_init(&hbus->prepare_mutex);
+	hbus->pci = pci;
+	hbus->mixer_assigned = -1;
+	hbus->modelname = "sklbus";
+
 	*rskl = skl;
 
 	return 0;
sound/soc/intel/skylake/skl.h +7 -3
index 4105a9371b64..803cce47ffb2 100644
@@ -26,6 +26,7 @@
 #include <sound/soc.h>
 #include "skl-nhlt.h"
 #include "skl-ssp-clk.h"
+#include "../../../pci/hda/hda_codec.h"
 
 #define SKL_SUSPEND_DELAY 2000
 
@@ -71,7 +72,7 @@ struct skl_fw_config {
 };
 
 struct skl {
-	struct hdac_bus hbus;
+	struct hda_bus hbus;
 	struct pci_dev *pci;
 
 	unsigned int init_done:1; /* delayed init status */
@@ -105,8 +106,11 @@ struct skl {
 	struct snd_soc_acpi_mach *mach;
 };
 
-#define skl_to_bus(s)  (&(s)->hbus)
-#define bus_to_skl(bus) container_of(bus, struct skl, hbus)
+#define skl_to_bus(s)  (&(s)->hbus.core)
+#define bus_to_skl(bus) container_of(bus, struct skl, hbus.core)
+
+#define skl_to_hbus(s) (&(s)->hbus)
+#define hbus_to_skl(hbus) container_of((hbus), struct skl, (hbus))
 
 /* to pass dai dma data */
 struct skl_dma_params {
Signature · 1 line
2.14.1
#8 lore raw

PATCH v3 8/13 ALSA: hda: split snd_hda_codec_new function

In reply to Pierre-Louis Bossart

From: Rakesh Ughreja <[email protected]>

Split snd_hda_codec_new into two separate functions. snd_hda_codec_device_init allocates memory and registers with bus. snd_hda_codec_device_new initialializes the fields and performs snd_device_new. This enables reuse of legacy HDA codec drivers as ASoC codec drivers.

In addition mark some functions with EXPORT_SYMBOL_GPL so that it can be called by ASoC wrapper around the legacy HDA driver (hdac_hda).

---
 sound/pci/hda/hda_codec.c | 68 +++++++++++++++++++++++++++++++++++------------
 sound/pci/hda/hda_codec.h |  2 ++
 2 files changed, 53 insertions(+), 17 deletions(-)
sound/pci/hda/hda_codec.c +51 -17
index 5bc3a7468e17..76f4f097e83e 100644
@@ -856,6 +856,39 @@ static void snd_hda_codec_dev_release(struct device *dev)
 	kfree(codec);
 }
 
+#define DEV_NAME_LEN 31
+
+static int snd_hda_codec_device_init(struct hda_bus *bus, struct snd_card *card,
+			unsigned int codec_addr, struct hda_codec **codecp)
+{
+	char name[DEV_NAME_LEN];
+	struct hda_codec *codec;
+	int err;
+
+	dev_dbg(card->dev, "%s: entry\n", __func__);
+
+	if (snd_BUG_ON(!bus))
+		return -EINVAL;
+	if (snd_BUG_ON(codec_addr > HDA_MAX_CODEC_ADDRESS))
+		return -EINVAL;
+
+	codec = kzalloc(sizeof(*codec), GFP_KERNEL);
+	if (!codec)
+		return -ENOMEM;
+
+	sprintf(name, "hdaudioC%dD%d", card->number, codec_addr);
+	err = snd_hdac_device_init(&codec->core, &bus->core, name, codec_addr);
+	if (err < 0) {
+		kfree(codec);
+		return err;
+	}
+
+	codec->core.type = HDA_DEV_LEGACY;
+	*codecp = codec;
+
+	return err;
+}
+
 /**
  * snd_hda_codec_new - create a HDA codec
  * @bus: the bus to assign
@@ -867,7 +900,19 @@ static void snd_hda_codec_dev_release(struct device *dev)
 int snd_hda_codec_new(struct hda_bus *bus, struct snd_card *card,
 		      unsigned int codec_addr, struct hda_codec **codecp)
 {
-	struct hda_codec *codec;
+	int ret;
+
+	ret = snd_hda_codec_device_init(bus, card, codec_addr, codecp);
+	if (ret < 0)
+		return ret;
+
+	return snd_hda_codec_device_new(bus, card, codec_addr, *codecp);
+}
+EXPORT_SYMBOL_GPL(snd_hda_codec_new);
+
+int snd_hda_codec_device_new(struct hda_bus *bus, struct snd_card *card,
+			unsigned int codec_addr, struct hda_codec *codec)
+{
 	char component[31];
 	hda_nid_t fg;
 	int err;
@@ -877,25 +922,14 @@ int snd_hda_codec_new(struct hda_bus *bus, struct snd_card *card,
 		.dev_free = snd_hda_codec_dev_free,
 	};
 
+	dev_dbg(card->dev, "%s: entry\n", __func__);
+
 	if (snd_BUG_ON(!bus))
 		return -EINVAL;
 	if (snd_BUG_ON(codec_addr > HDA_MAX_CODEC_ADDRESS))
 		return -EINVAL;
 
-	codec = kzalloc(sizeof(*codec), GFP_KERNEL);
-	if (!codec)
-		return -ENOMEM;
-
-	sprintf(component, "hdaudioC%dD%d", card->number, codec_addr);
-	err = snd_hdac_device_init(&codec->core, &bus->core, component,
-				   codec_addr);
-	if (err < 0) {
-		kfree(codec);
-		return err;
-	}
-
 	codec->core.dev.release = snd_hda_codec_dev_release;
-	codec->core.type = HDA_DEV_LEGACY;
 	codec->core.exec_verb = codec_exec_verb;
 
 	codec->bus = bus;
@@ -955,15 +989,13 @@ int snd_hda_codec_new(struct hda_bus *bus, struct snd_card *card,
 	if (err < 0)
 		goto error;
 
-	if (codecp)
-		*codecp = codec;
 	return 0;
 
  error:
 	put_device(hda_codec_dev(codec));
 	return err;
 }
-EXPORT_SYMBOL_GPL(snd_hda_codec_new);
+EXPORT_SYMBOL_GPL(snd_hda_codec_device_new);
 
 /**
  * snd_hda_codec_update_widgets - Refresh widget caps and pin defaults
@@ -2979,6 +3011,7 @@ int snd_hda_codec_build_controls(struct hda_codec *codec)
 	sync_power_up_states(codec);
 	return 0;
 }
+EXPORT_SYMBOL_GPL(snd_hda_codec_build_controls);
 
 /*
  * PCM stuff
@@ -3184,6 +3217,7 @@ int snd_hda_codec_parse_pcms(struct hda_codec *codec)
 
 	return 0;
 }
+EXPORT_SYMBOL_GPL(snd_hda_codec_parse_pcms);
 
 /* assign all PCMs of the given codec */
 int snd_hda_codec_build_pcms(struct hda_codec *codec)
sound/pci/hda/hda_codec.h +2 -0
index 681c360f29f9..8bbedf7f3f54 100644
@@ -307,6 +307,8 @@ struct hda_codec {
  */
 int snd_hda_codec_new(struct hda_bus *bus, struct snd_card *card,
 		      unsigned int codec_addr, struct hda_codec **codecp);
+int snd_hda_codec_device_new(struct hda_bus *bus, struct snd_card *card,
+		      unsigned int codec_addr, struct hda_codec *codec);
 int snd_hda_codec_configure(struct hda_codec *codec);
 int snd_hda_codec_update_widgets(struct hda_codec *codec);
 
Signature · 1 line
2.14.1
#9 lore raw

PATCH v3 9/13 ALSA: hdac: remove memory allocation from snd_hdac_ext_bus_device_init

In reply to Pierre-Louis Bossart

From: Rakesh Ughreja <[email protected]>

Remove memory allocation within snd_hdac_ext_bus_device_init, to make its behaviour identical to snd_hdac_bus_device_init. So that caller can allocate the parent data structure containing hdac_device. This API change helps in reusing the legacy HDA codec drivers with ASoC platform drivers.

---
 include/sound/hdaudio_ext.h   | 3 ++-
 sound/hda/ext/hdac_ext_bus.c  | 8 ++------
 sound/soc/intel/skylake/skl.c | 8 +++++++-
 3 files changed, 11 insertions(+), 8 deletions(-)
include/sound/hdaudio_ext.h +2 -1
index 3c302477750b..c188b801239f 100644
@@ -9,7 +9,8 @@ int snd_hdac_ext_bus_init(struct hdac_bus *bus, struct device *dev,
 		      const struct hdac_io_ops *io_ops);
 
 void snd_hdac_ext_bus_exit(struct hdac_bus *bus);
-int snd_hdac_ext_bus_device_init(struct hdac_bus *bus, int addr);
+int snd_hdac_ext_bus_device_init(struct hdac_bus *bus, int addr,
+						struct hdac_device *hdev);
 void snd_hdac_ext_bus_device_exit(struct hdac_device *hdev);
 void snd_hdac_ext_bus_device_remove(struct hdac_bus *bus);
 
sound/hda/ext/hdac_ext_bus.c +2 -6
index 52f07766fff3..1eb58244688e 100644
@@ -135,16 +135,12 @@ static void default_release(struct device *dev)
  *
  * Returns zero for success or a negative error code.
  */
-int snd_hdac_ext_bus_device_init(struct hdac_bus *bus, int addr)
+int snd_hdac_ext_bus_device_init(struct hdac_bus *bus, int addr,
+					struct hdac_device *hdev)
 {
-	struct hdac_device *hdev = NULL;
 	char name[15];
 	int ret;
 
-	hdev = kzalloc(sizeof(*hdev), GFP_KERNEL);
-	if (!hdev)
-		return -ENOMEM;
-
 	hdev->bus = bus;
 
 	snprintf(name, sizeof(name), "ehdaudio%dD%d", bus->idx, addr);
sound/soc/intel/skylake/skl.c +7 -1
index 9dae39cda441..b0f509c89ded 100644
@@ -662,6 +662,8 @@ static int probe_codec(struct hdac_bus *bus, int addr)
 	unsigned int cmd = (addr << 28) | (AC_NODE_ROOT << 20) |
 		(AC_VERB_PARAMETERS << 8) | AC_PAR_VENDOR_ID;
 	unsigned int res = -1;
+	struct skl *skl = bus_to_skl(bus);
+	struct hdac_device *hdev;
 
 	mutex_lock(&bus->cmd_mutex);
 	snd_hdac_bus_send_cmd(bus, cmd);
@@ -671,7 +673,11 @@ static int probe_codec(struct hdac_bus *bus, int addr)
 		return -EIO;
 	dev_dbg(bus->dev, "codec #%d probed OK: %x\n", addr, res);
 
-	return snd_hdac_ext_bus_device_init(bus, addr);
+	hdev = devm_kzalloc(&skl->pci->dev, sizeof(*hdev), GFP_KERNEL);
+	if (!hdev)
+		return -ENOMEM;
+
+	return snd_hdac_ext_bus_device_init(bus, addr, hdev);
 }
 
 /* Codec initialization */
Signature · 1 line
2.14.1
#10 lore raw

PATCH v3 10/13 ALSA: hdac: add extended ops in the hdac_bus

In reply to Pierre-Louis Bossart

From: Rakesh Ughreja <[email protected]>

Add extended ops in the hdac_bus to allow calling the ASoC HDAC library ops to reuse the legacy HDA codec drivers with ASoC framework. Extended ops are used by the legacy codec drivers to call into hdac_hda library, in the subsequent patches..

---
 include/sound/hdaudio.h       | 9 +++++++++
 include/sound/hdaudio_ext.h   | 3 ++-
 sound/hda/ext/hdac_ext_bus.c  | 4 +++-
 sound/soc/intel/skylake/skl.c | 2 +-
 4 files changed, 15 insertions(+), 3 deletions(-)
include/sound/hdaudio.h +9 -0
index 62dd486e7d48..78dd64f2672f 100644
@@ -213,6 +213,14 @@ struct hdac_bus_ops {
 	int (*link_power)(struct hdac_bus *bus, bool enable);
 };
 
+/*
+ * ops used for ASoC HDA codec drivers
+ */
+struct hdac_ext_bus_ops {
+	int (*hdev_attach)(struct hdac_device *hdev);
+	int (*hdev_detach)(struct hdac_device *hdev);
+};
+
 /*
  * Lowlevel I/O operators
  */
@@ -265,6 +273,7 @@ struct hdac_bus {
 	struct device *dev;
 	const struct hdac_bus_ops *ops;
 	const struct hdac_io_ops *io_ops;
+	const struct hdac_ext_bus_ops *ext_ops;
 
 	/* h/w resources */
 	unsigned long addr;
include/sound/hdaudio_ext.h +2 -1
index c188b801239f..f34aced69ca8 100644
@@ -6,7 +6,8 @@
 
 int snd_hdac_ext_bus_init(struct hdac_bus *bus, struct device *dev,
 		      const struct hdac_bus_ops *ops,
-		      const struct hdac_io_ops *io_ops);
+		      const struct hdac_io_ops *io_ops,
+		      const struct hdac_ext_bus_ops *ext_ops);
 
 void snd_hdac_ext_bus_exit(struct hdac_bus *bus);
 int snd_hdac_ext_bus_device_init(struct hdac_bus *bus, int addr,
sound/hda/ext/hdac_ext_bus.c +3 -1
index 1eb58244688e..9c37d9af3023 100644
@@ -89,7 +89,8 @@ static const struct hdac_io_ops hdac_ext_default_io = {
  */
 int snd_hdac_ext_bus_init(struct hdac_bus *bus, struct device *dev,
 			const struct hdac_bus_ops *ops,
-			const struct hdac_io_ops *io_ops)
+			const struct hdac_io_ops *io_ops,
+			const struct hdac_ext_bus_ops *ext_ops)
 {
 	int ret;
 	static int idx;
@@ -102,6 +103,7 @@ int snd_hdac_ext_bus_init(struct hdac_bus *bus, struct device *dev,
 	if (ret < 0)
 		return ret;
 
+	bus->ext_ops = ext_ops;
 	INIT_LIST_HEAD(&bus->hlink_list);
 	bus->idx = idx++;
 
sound/soc/intel/skylake/skl.c +1 -1
index b0f509c89ded..0285b2bdedc9 100644
@@ -832,7 +832,7 @@ static int skl_create(struct pci_dev *pci,
 
 	hbus = skl_to_hbus(skl);
 	bus = skl_to_bus(skl);
-	snd_hdac_ext_bus_init(bus, &pci->dev, &bus_core_ops, io_ops);
+	snd_hdac_ext_bus_init(bus, &pci->dev, &bus_core_ops, io_ops, NULL);
 	bus->use_posbuf = 1;
 	skl->pci = pci;
 	INIT_WORK(&skl->probe_work, skl_probe_work);
Signature · 1 line
2.14.1
#11 lore raw

PATCH v3 11/13 ASoC: hdac_hda: add asoc extension for legacy HDA codec drivers

In reply to Pierre-Louis Bossart

From: Rakesh Ughreja <[email protected]>

This patch adds a kernel module which is used by the legacy HDA codec drivers as library. This implements hdac_ext_bus_ops to enable the reuse of legacy HDA codec drivers with ASoC platform drivers.

---
 sound/pci/hda/hda_bind.c                     |  12 +
 sound/soc/codecs/Kconfig                     |   5 +
 sound/soc/codecs/Makefile                    |   2 +
 sound/soc/codecs/hdac_hda.c                  | 469 +++++++++++++++++++++++++++
 sound/soc/codecs/hdac_hda.h                  |  24 ++
 sound/soc/intel/boards/Kconfig               |   1 +
 sound/soc/intel/boards/skl_hda_dsp_common.c  |  24 ++
 sound/soc/intel/boards/skl_hda_dsp_common.h  |   2 +-
 sound/soc/intel/boards/skl_hda_dsp_generic.c |  38 +++
 sound/soc/intel/skylake/skl.c                |  47 ++-
 10 files changed, 619 insertions(+), 5 deletions(-)
 create mode 100644 sound/soc/codecs/hdac_hda.c
 create mode 100644 sound/soc/codecs/hdac_hda.h
sound/pci/hda/hda_bind.c +12 -0
index d361bb77ca00..b1440a6c515f 100644
@@ -81,6 +81,12 @@ static int hda_codec_driver_probe(struct device *dev)
 	hda_codec_patch_t patch;
 	int err;
 
+	if (codec->bus->core.ext_ops) {
+		if (WARN_ON(!codec->bus->core.ext_ops->hdev_attach))
+			return -EINVAL;
+		return codec->bus->core.ext_ops->hdev_attach(&codec->core);
+	}
+
 	if (WARN_ON(!codec->preset))
 		return -EINVAL;
 
@@ -134,6 +140,12 @@ static int hda_codec_driver_remove(struct device *dev)
 {
 	struct hda_codec *codec = dev_to_hda_codec(dev);
 
+	if (codec->bus->core.ext_ops) {
+		if (WARN_ON(!codec->bus->core.ext_ops->hdev_detach))
+			return -EINVAL;
+		return codec->bus->core.ext_ops->hdev_detach(&codec->core);
+	}
+
 	if (codec->patch_ops.free)
 		codec->patch_ops.free(codec);
 	snd_hda_codec_cleanup_for_unbind(codec);
sound/soc/codecs/Kconfig +5 -0
index 63cf62e9c9aa..b92cf96fa6d5 100644
@@ -82,6 +82,7 @@ config SND_SOC_ALL_CODECS
 	select SND_SOC_ES7134
 	select SND_SOC_GTM601
 	select SND_SOC_HDAC_HDMI
+	select SND_SOC_HDAC_HDA
 	select SND_SOC_ICS43432
 	select SND_SOC_INNO_RK3036
 	select SND_SOC_ISABELLE if I2C
@@ -614,6 +615,10 @@ config SND_SOC_HDAC_HDMI
 	select SND_PCM_ELD
 	select HDMI
 
+config SND_SOC_HDAC_HDA
+	tristate
+	select SND_HDA
+
 config SND_SOC_ICS43432
 	tristate
 
sound/soc/codecs/Makefile +2 -0
index e023fdf85221..22e91b7922d8 100644
@@ -77,6 +77,7 @@ snd-soc-es8328-i2c-objs := es8328-i2c.o
 snd-soc-es8328-spi-objs := es8328-spi.o
 snd-soc-gtm601-objs := gtm601.o
 snd-soc-hdac-hdmi-objs := hdac_hdmi.o
+snd-soc-hdac-hda-objs := hdac_hda.o
 snd-soc-ics43432-objs := ics43432.o
 snd-soc-inno-rk3036-objs := inno_rk3036.o
 snd-soc-isabelle-objs := isabelle.o
@@ -335,6 +336,7 @@ obj-$(CONFIG_SND_SOC_ES8328_I2C)+= snd-soc-es8328-i2c.o
 obj-$(CONFIG_SND_SOC_ES8328_SPI)+= snd-soc-es8328-spi.o
 obj-$(CONFIG_SND_SOC_GTM601)    += snd-soc-gtm601.o
 obj-$(CONFIG_SND_SOC_HDAC_HDMI) += snd-soc-hdac-hdmi.o
+obj-$(CONFIG_SND_SOC_HDAC_HDA) += snd-soc-hdac-hda.o
 obj-$(CONFIG_SND_SOC_ICS43432)	+= snd-soc-ics43432.o
 obj-$(CONFIG_SND_SOC_INNO_RK3036)	+= snd-soc-inno-rk3036.o
 obj-$(CONFIG_SND_SOC_ISABELLE)	+= snd-soc-isabelle.o
sound/soc/codecs/hdac_hda.c new file +469 -0

469 lines not on this page · raw message

sound/soc/codecs/hdac_hda.h new file +24 -0
new file mode 100644
index 000000000000..d0e440f546b9
@@ -0,0 +1,24 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright(c) 2015-17 Intel Corporation.
+ */
+
+#ifndef __HDAC_HDA_H__
+#define __HDAC_HDA_H__
+
+struct hdac_hda_pcm {
+	int stream_tag[2];
+};
+
+struct hdac_hda_priv {
+	struct hda_codec codec;
+	struct hdac_hda_pcm pcm[2];
+};
+
+#define hdac_to_hda_priv(_hdac) \
+			container_of(_hdac, struct hdac_hda_priv, codec.core)
+#define hdac_to_hda_codec(_hdac) container_of(_hdac, struct hda_codec, core)
+
+struct hdac_ext_bus_ops *snd_soc_hdac_hda_get_ops(void);
+
+#endif /* __HDAC_HDA_H__ */
sound/soc/intel/boards/Kconfig +1 -0
index 5c24b7927dbc..953cf4c5fd2f 100644
@@ -283,6 +283,7 @@ config SND_SOC_INTEL_KBL_DA7219_MAX98357A_MACH
 config SND_SOC_INTEL_SKL_HDA_DSP_GENERIC_MACH
 	tristate "SKL/KBL/BXT/APL with HDA Codecs"
 	select SND_SOC_HDAC_HDMI
+	select SND_SOC_HDAC_HDA
 	help
 	  This adds support for ASoC machine driver for Intel platforms
 	  SKL/KBL/BXT/APL with iDisp, HDA audio codecs.
sound/soc/intel/boards/skl_hda_dsp_common.c +24 -0
index 0c02c6cf4dee..4b453087fda6 100644
@@ -75,6 +75,30 @@ struct snd_soc_dai_link skl_hda_be_dai_links[HDA_DSP_MAX_BE_DAI_LINKS] = {
 		.dpcm_playback = 1,
 		.no_pcm = 1,
 	},
+	{
+		.name = "Analog Playback and Capture",
+		.id = 4,
+		.cpu_dai_name = "Analog CPU DAI",
+		.codec_name = "ehdaudio0D0",
+		.codec_dai_name = "Analog Codec DAI",
+		.platform_name = "0000:00:1f.3",
+		.dpcm_playback = 1,
+		.dpcm_capture = 1,
+		.init = NULL,
+		.no_pcm = 1,
+	},
+	{
+		.name = "Digital Playback and Capture",
+		.id = 5,
+		.cpu_dai_name = "Digital CPU DAI",
+		.codec_name = "ehdaudio0D0",
+		.codec_dai_name = "Digital Codec DAI",
+		.platform_name = "0000:00:1f.3",
+		.dpcm_playback = 1,
+		.dpcm_capture = 1,
+		.init = NULL,
+		.no_pcm = 1,
+	},
 };
 
 int skl_hda_hdmi_jack_init(struct snd_soc_card *card)
sound/soc/intel/boards/skl_hda_dsp_common.h +1 -1
index 9d03dc0eed60..dd25d8550ddb 100644
@@ -15,7 +15,7 @@
 #include <sound/core.h>
 #include <sound/jack.h>
 
-#define HDA_DSP_MAX_BE_DAI_LINKS 3
+#define HDA_DSP_MAX_BE_DAI_LINKS 5
 
 struct skl_hda_hdmi_pcm {
 	struct list_head head;
sound/soc/intel/boards/skl_hda_dsp_generic.c +38 -0
index 720b1249a17f..3fcaf127fe79 100644
@@ -16,6 +16,15 @@
 #include "../skylake/skl.h"
 #include "skl_hda_dsp_common.h"
 
+static const struct snd_soc_dapm_widget skl_hda_widgets[] = {
+	SND_SOC_DAPM_HP("Analog Out", NULL),
+	SND_SOC_DAPM_MIC("Analog In", NULL),
+	SND_SOC_DAPM_HP("Alt Analog Out", NULL),
+	SND_SOC_DAPM_MIC("Alt Analog In", NULL),
+	SND_SOC_DAPM_SPK("Digital Out", NULL),
+	SND_SOC_DAPM_MIC("Digital In", NULL),
+};
+
 static const struct snd_soc_dapm_route skl_hda_map[] = {
 
 	{ "hifi3", NULL, "iDisp3 Tx"},
@@ -24,6 +33,29 @@ static const struct snd_soc_dapm_route skl_hda_map[] = {
 	{ "iDisp2 Tx", NULL, "iDisp2_out"},
 	{ "hifi1", NULL, "iDisp1 Tx"},
 	{ "iDisp1 Tx", NULL, "iDisp1_out"},
+
+	{ "Analog Out", NULL, "Codec Output Pin1" },
+	{ "Digital Out", NULL, "Codec Output Pin2" },
+	{ "Alt Analog Out", NULL, "Codec Output Pin3" },
+
+	{ "Codec Input Pin1", NULL, "Analog In" },
+	{ "Codec Input Pin2", NULL, "Digital In" },
+	{ "Codec Input Pin3", NULL, "Alt Analog In" },
+
+	/* CODEC BE connections */
+	{ "Analog Codec Playback", NULL, "Analog CPU Playback" },
+	{ "Analog CPU Playback", NULL, "codec0_out" },
+	{ "Digital Codec Playback", NULL, "Digital CPU Playback" },
+	{ "Digital CPU Playback", NULL, "codec1_out" },
+	{ "Alt Analog Codec Playback", NULL, "Alt Analog CPU Playback" },
+	{ "Alt Analog CPU Playback", NULL, "codec2_out" },
+
+	{ "codec0_in", NULL, "Analog CPU Capture" },
+	{ "Analog CPU Capture", NULL, "Analog Codec Capture" },
+	{ "codec1_in", NULL, "Digital CPU Capture" },
+	{ "Digital CPU Capture", NULL, "Digital Codec Capture" },
+	{ "codec2_in", NULL, "Alt Analog CPU Capture" },
+	{ "Alt Analog CPU Capture", NULL, "Alt Analog Codec Capture" },
 };
 
 static int skl_hda_card_late_probe(struct snd_soc_card *card)
@@ -52,6 +84,7 @@ static struct snd_soc_card hda_soc_card = {
 	.name = "skl_hda_card",
 	.owner = THIS_MODULE,
 	.dai_link = skl_hda_be_dai_links,
+	.dapm_widgets = skl_hda_widgets,
 	.dapm_routes = skl_hda_map,
 	.add_dai_link = skl_hda_add_dai_link,
 	.fully_routed = true,
@@ -75,6 +108,11 @@ static int skl_hda_fill_card_info(struct skl_machine_pdata *pdata)
 	if (codec_count == 1 && pdata->codec_mask & IDISP_CODEC_MASK) {
 		num_links = IDISP_DAI_COUNT;
 		num_route = IDISP_ROUTE_COUNT;
+	} else if (codec_count == 2 && codec_mask & IDISP_CODEC_MASK) {
+		num_links = ARRAY_SIZE(skl_hda_be_dai_links);
+		num_route = ARRAY_SIZE(skl_hda_map),
+		card->dapm_widgets = skl_hda_widgets;
+		card->num_dapm_widgets = ARRAY_SIZE(skl_hda_widgets);
 	} else {
 		return -EINVAL;
 	}
sound/soc/intel/skylake/skl.c +43 -4

86 lines not on this page · raw message

Signature · 1 line
2.14.1
#12 lore raw

PATCH v3 12/13 ALSA: hdac: ext: add wait for codec to respond after link reset

In reply to Pierre-Louis Bossart

From: Rakesh Ughreja <[email protected]>

As per HDA spec section 4.3 - Codec Discovery, the software shall wait for atleast 521usec for codec to respond after link reset. With the multi-link capability each link is turned ON/OFF individually. Link controller drives reset signal when it is turned ON.

---
 sound/hda/ext/hdac_ext_controller.c | 9 +++++++++
 1 file changed, 9 insertions(+)
sound/hda/ext/hdac_ext_controller.c +9 -0
index 72774119dd11..5bc4a1d587d4 100644
@@ -271,6 +271,15 @@ int snd_hdac_ext_bus_link_get(struct hdac_bus *bus,
 		}
 
 		ret = snd_hdac_ext_bus_link_power_up(link);
+
+		/*
+		 *  wait for 521usec for codec to report status
+		 *  HDA spec section 4.3 - Codec Discovery
+		 */
+		udelay(521);
+		bus->codec_mask = snd_hdac_chip_readw(bus, STATESTS);
+		dev_dbg(bus->dev, "codec_mask = 0x%lx\n", bus->codec_mask);
+		snd_hdac_chip_writew(bus, STATESTS, bus->codec_mask);
 	}
 
 	mutex_unlock(&bus->lock);
Signature · 1 line
2.14.1
#13 lore raw

PATCH v3 13/13 ASoC: Intel: Skylake: fix widget handling

In reply to Pierre-Louis Bossart

From: Rakesh Ughreja <[email protected]>

include DAPM Mux and output widgets into the list.

---
 sound/soc/intel/skylake/skl-topology.c | 3 +++
 1 file changed, 3 insertions(+)
sound/soc/intel/skylake/skl-topology.c +3 -0
index 5ed17218c57c..5700080387ed 100644
@@ -108,6 +108,9 @@ static int is_skl_dsp_widget_type(struct snd_soc_dapm_widget *w,
 	case snd_soc_dapm_aif_out:
 	case snd_soc_dapm_dai_out:
 	case snd_soc_dapm_switch:
+	case snd_soc_dapm_output:
+	case snd_soc_dapm_mux:
+
 		return false;
 	default:
 		return true;
Signature · 1 line
2.14.1
#14 lore raw
In reply to Pierre-Louis Bossart
Quoted 38 lines · Pierre-Louis Bossart

Many Intel platforms (SKL, KBL) etc. in the market supports enhanced audio capabilities which also includes DSP processing. The default HDaudio legacy driver does not allow for the use of the DSP, this patch set makes it possible while reusing existing code for HDAudio codecs and without significant changes to the legacy driver.

This v3 is not split into two batches as done for v1 and v2, but keeps the same logical progression. The first three patches are mostly data structure changes, the DSP support capability is added then with an ASoC HDA driver and the last patches are fixes required for Skylake+. The changes to the HDAudio legacy driver are minimal.

Tests were run successfully on multiple platforms (Dell XPS13, KBL NUC, APL NUC and LeafHill reference board).

Credits: all the initial code was written by Rakesh Ughreja, the rebase to broonie/for-next, cleanups and additional tests were done by Pierre Bossart.

Changes v3:
- port to component model
- additional tests on ApolloLake and KabyLake NUC devices
- cleanups (alignment, typos, etc)

Changes v2:
- Resolved review comments and rebased to latest kernel.
- added module load support for codec drivers.

Rakesh Ughreja (13):
ALSA: hdac: Remove usage of struct hdac_ext_device and use hdac_device
instead
ALSA: hdac: Remove usage of struct hdac_ext_bus and use hdac_bus
instead
ALSA: hdac: Remove usage of struct hdac_ext_driver, use hdac_driver
instead
ASoC: Intel: Boards: Machine driver for SKL+ w/ HDAudio codecs
ASoC: Intel: Skylake: Add entry in sst_acpi_mach for HDA codecs

Quoted 8 lines

ASoC: Intel: Skylake: add HDA BE DAIs
ASoC: Intel: Skylake: use hda_bus instead of hdac_bus
ALSA: hda: split snd_hda_codec_new function
ALSA: hdac: remove memory allocation from snd_hdac_ext_bus_device_init
ALSA: hdac: add extended ops in the hdac_bus
ASoC: hdac_hda: add asoc extension for legacy HDA codec drivers
ALSA: hdac: ext: add wait for codec to respond after link reset
ASoC: Intel: Skylake: fix widget handling

Thanks for the patches. But, from obvious reasons, we can't take these for the next merge window. So it's really no good timing for such a big series...

In anyways, the patch series look like a mixture of lots of different things. Maybe it's better to split to multiple series, namely:

- Individual fixes

Patches 12 and 13 are irrelevant with the whole story, and they are merely fixes, can be applied individually.
(the patch13 might be depending on others, though; didn't take a
deeper look at it yet.)

- The removal of hdac_ext_* structs

These are basically no functional changes and local in hdac_ext. The preliminary work. The regression test is mandatory.

- Some code split / exports in snd_hda_codec_*(), adaption of hdac_bus extended ops

Another preliminary work and a setup for the new binding. They should be also no functional changes, and the existing setup should work as is. The regression test is mandatory.

- The new hdac_hdmi codec support and the new board codes

These are the new stuff, and applied after the preparations above.

... and these patches are touching both ASoC and HD-audio legacy, we'd need the coordinated patch application. That is, we'd need a topic branch that will be merged to both Mark and my trees. We can branch it off after 4.18-rc1 release, for example, as a clean start point.

thanks,

Takashi

#15 lore raw
Quoted 49 lines · Takashi Iwai
Quoted 38 lines · Pierre-Louis Bossart

Many Intel platforms (SKL, KBL) etc. in the market supports enhanced audio capabilities which also includes DSP processing. The default HDaudio legacy driver does not allow for the use of the DSP, this patch set makes it possible while reusing existing code for HDAudio codecs and without significant changes to the legacy driver.

This v3 is not split into two batches as done for v1 and v2, but keeps the same logical progression. The first three patches are mostly data structure changes, the DSP support capability is added then with an ASoC HDA driver and the last patches are fixes required for Skylake+. The changes to the HDAudio legacy driver are minimal.

Tests were run successfully on multiple platforms (Dell XPS13, KBL NUC, APL NUC and LeafHill reference board).

Credits: all the initial code was written by Rakesh Ughreja, the rebase to broonie/for-next, cleanups and additional tests were done by Pierre Bossart.

Changes v3:
- port to component model
- additional tests on ApolloLake and KabyLake NUC devices
- cleanups (alignment, typos, etc)

Changes v2:
- Resolved review comments and rebased to latest kernel.
- added module load support for codec drivers.

Rakesh Ughreja (13):
ALSA: hdac: Remove usage of struct hdac_ext_device and use hdac_device
instead
ALSA: hdac: Remove usage of struct hdac_ext_bus and use hdac_bus
instead
ALSA: hdac: Remove usage of struct hdac_ext_driver, use hdac_driver
instead
ASoC: Intel: Boards: Machine driver for SKL+ w/ HDAudio codecs
ASoC: Intel: Skylake: Add entry in sst_acpi_mach for HDA codecs

Quoted 8 lines

ASoC: Intel: Skylake: add HDA BE DAIs
ASoC: Intel: Skylake: use hda_bus instead of hdac_bus
ALSA: hda: split snd_hda_codec_new function
ALSA: hdac: remove memory allocation from snd_hdac_ext_bus_device_init
ALSA: hdac: add extended ops in the hdac_bus
ASoC: hdac_hda: add asoc extension for legacy HDA codec drivers
ALSA: hdac: ext: add wait for codec to respond after link reset
ASoC: Intel: Skylake: fix widget handling

Quoted 3 lines

Thanks for the patches. But, from obvious reasons, we can't take these for the next merge window. So it's really no good timing for such a big series...

I wasn't asking for a forced merge or trying to make your life complicated, it was more that I had a bit of time this week to provide an update and wanted to check how we deal with the multiple changes in different parts (Skylake, hda, hdac). It's fine if those patches land in 4.19 with additional time for reviews/testing.

Quoted 19 lines

In anyways, the patch series look like a mixture of lots of different things. Maybe it's better to split to multiple series, namely:

- Individual fixes

Patches 12 and 13 are irrelevant with the whole story, and they are merely fixes, can be applied individually.
(the patch13 might be depending on others, though; didn't take a
deeper look at it yet.)

- The removal of hdac_ext_* structs

These are basically no functional changes and local in hdac_ext. The preliminary work. The regression test is mandatory.

- Some code split / exports in snd_hda_codec_*(), adaption of hdac_bus extended ops

Quoted 7 lines

Another preliminary work and a setup for the new binding. They should be also no functional changes, and the existing setup should work as is. The regression test is mandatory.

- The new hdac_hdmi codec support and the new board codes

These are the new stuff, and applied after the preparations above.

I can split the code, but as you highlighted the series is pretty much organized as
- cleanups
- code split
- addition of new functionaliy
- fixes
...

Quoted 6 lines

... and these patches are touching both ASoC and HD-audio legacy, we'd need the coordinated patch application. That is, we'd need a topic branch that will be merged to both Mark and my trees. We can branch it off after 4.18-rc1 release, for example, as a clean start point.

... And I am not sure I understand the topic branch merged in both directions. If we want to perform a non-regression with the first parts (without ASoC additions) then we may need to create a partial topic branch, then add the rest later?

Quoted 10 lines

thanks,

Takashi
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

maintainer
#16 lore raw
Quoted 6 lines · Pierre-Louis Bossart
Quoted 3 lines · Takashi Iwai

- The new hdac_hdmi codec support and the new board codes

These are the new stuff, and applied after the preparations above.

Quoted 7 lines

I can split the code, but as you highlighted the series is pretty much organized as
- cleanups
- code split
- addition of new functionaliy
- fixes
...

It's generally better to put fixes first - that way there's less chance of them getting held up on earlier bits of the series and they can be more easily sent to Linus and stable if required. Like Takashi says if they're not dependent on the rest of the series sending them completely separately is often even better.

#17 lore raw
In reply to Pierre-Louis Bossart
Quoted 11 lines · Pierre-Louis Bossart
Quoted 4 lines · Takashi Iwai

... and these patches are touching both ASoC and HD-audio legacy, we'd need the coordinated patch application. That is, we'd need a topic branch that will be merged to both Mark and my trees. We can branch it off after 4.18-rc1 release, for example, as a clean start point.

... And I am not sure I understand the topic branch merged in both directions. If we want to perform a non-regression with the first parts (without ASoC additions) then we may need to create a partial topic branch, then add the rest later?

The topic branch is needed so that it can be merged in my tree and Mark's tree directly and cleanly. It has nothing to do with 'no regression' rule, but rather only about the git merge mechanism.

Usually a topic branch is created from a clean stub point, e.g. Linus 4.18-rc1 release. Then I'd merge your patches starting at this point, so that these can be merged via git-merge to both my tree and Mark's tree at the same time. At later point, I'll merge whole Mark's tree for 4.19 merge window. And the merge will work cleanly since these common changes have been already merged in my tree.

The split of patches are helpful to ease reviews in general. For this kind of big mixture changes, some staged merges are preferred. That is, at first merge individual fixes, and merge preliminary / cleanup patches that don't break any functionality. These can be merged and tested quickly, per nature.

Then it follows the rest, the main change; this will need more careful reviews and tests, and it'd be often requested to rewrite multiple times. When the preliminary patches have been already merged, you don't have to resend the whole series again, and this will make the mail thread a lot easer to read through.

thanks,

Takashi

#18 lore raw
Quoted 32 lines · Takashi Iwai
Quoted 11 lines · Pierre-Louis Bossart
Quoted 4 lines · Takashi Iwai

... and these patches are touching both ASoC and HD-audio legacy, we'd need the coordinated patch application. That is, we'd need a topic branch that will be merged to both Mark and my trees. We can branch it off after 4.18-rc1 release, for example, as a clean start point.

... And I am not sure I understand the topic branch merged in both directions. If we want to perform a non-regression with the first parts (without ASoC additions) then we may need to create a partial topic branch, then add the rest later?

The topic branch is needed so that it can be merged in my tree and Mark's tree directly and cleanly. It has nothing to do with 'no regression' rule, but rather only about the git merge mechanism.

Usually a topic branch is created from a clean stub point, e.g. Linus 4.18-rc1 release. Then I'd merge your patches starting at this point, so that these can be merged via git-merge to both my tree and Mark's tree at the same time. At later point, I'll merge whole Mark's tree for 4.19 merge window. And the merge will work cleanly since these common changes have been already merged in my tree.

The split of patches are helpful to ease reviews in general. For this kind of big mixture changes, some staged merges are preferred. That is, at first merge individual fixes, and merge preliminary / cleanup patches that don't break any functionality. These can be merged and tested quickly, per nature.

Quoted 5 lines

Then it follows the rest, the main change; this will need more careful reviews and tests, and it'd be often requested to rewrite multiple times. When the preliminary patches have been already merged, you don't have to resend the whole series again, and this will make the mail thread a lot easer to read through.

Now I've put a few patches from the series into topic/hda-core-intel branch of sound git tree: namely,

ALSA: hdac: ext: add wait for codec to respond after link reset
ALSA: hdac: Remove usage of struct hdac_ext_device and use hdac_device instead
ALSA: hdac: Remove usage of struct hdac_ext_bus and use hdac_bus instead
ALSA: hdac: Remove usage of struct hdac_ext_driver, use hdac_driver instead
ALSA: hda: split snd_hda_codec_new function
ALSA: hdac: remove memory allocation from snd_hdac_ext_bus_device_init
ALSA: hdac: add extended ops in the hdac_bus

corresponds to the patch 12 as a fix at first, followed by patches 1, 2, 3 as hdac_ext_* cleanup, and patches 8, 9, 10 for preparation of the further move. All these should be only cleanups / refactoring (and one fix), hence no visible functional changes.

The branch isn't merged to for-next yet. And it's cleanly based on v4.18-rc1 so that Mark can pull into his tree. As far as I've checked, the merge can be done smoothly to the current asoc tree, too.

So, guys, please check / review whether these are all OK for now.

The rest are rather ASoC-intensive part and needs more careful reviews.

thanks,

Takashi

#19 lore raw
Quoted 61 lines · Takashi Iwai
Quoted 32 lines · Takashi Iwai
Quoted 11 lines · Pierre-Louis Bossart
Quoted 4 lines · Takashi Iwai

... and these patches are touching both ASoC and HD-audio legacy, we'd need the coordinated patch application. That is, we'd need a topic branch that will be merged to both Mark and my trees. We can branch it off after 4.18-rc1 release, for example, as a clean start point.

... And I am not sure I understand the topic branch merged in both directions. If we want to perform a non-regression with the first parts (without ASoC additions) then we may need to create a partial topic branch, then add the rest later?

The topic branch is needed so that it can be merged in my tree and Mark's tree directly and cleanly. It has nothing to do with 'no regression' rule, but rather only about the git merge mechanism.

Usually a topic branch is created from a clean stub point, e.g. Linus 4.18-rc1 release. Then I'd merge your patches starting at this point, so that these can be merged via git-merge to both my tree and Mark's tree at the same time. At later point, I'll merge whole Mark's tree for 4.19 merge window. And the merge will work cleanly since these common changes have been already merged in my tree.

The split of patches are helpful to ease reviews in general. For this kind of big mixture changes, some staged merges are preferred. That is, at first merge individual fixes, and merge preliminary / cleanup patches that don't break any functionality. These can be merged and tested quickly, per nature.

Quoted 5 lines

Then it follows the rest, the main change; this will need more careful reviews and tests, and it'd be often requested to rewrite multiple times. When the preliminary patches have been already merged, you don't have to resend the whole series again, and this will make the mail thread a lot easer to read through.

Now I've put a few patches from the series into topic/hda-core-intel branch of sound git tree: namely,

ALSA: hdac: ext: add wait for codec to respond after link reset
ALSA: hdac: Remove usage of struct hdac_ext_device and use hdac_device instead
ALSA: hdac: Remove usage of struct hdac_ext_bus and use hdac_bus instead
ALSA: hdac: Remove usage of struct hdac_ext_driver, use hdac_driver instead
ALSA: hda: split snd_hda_codec_new function
ALSA: hdac: remove memory allocation from snd_hdac_ext_bus_device_init
ALSA: hdac: add extended ops in the hdac_bus

corresponds to the patch 12 as a fix at first, followed by patches 1, 2, 3 as hdac_ext_* cleanup, and patches 8, 9, 10 for preparation of the further move. All these should be only cleanups / refactoring (and one fix), hence no visible functional changes.

The branch isn't merged to for-next yet. And it's cleanly based on v4.18-rc1 so that Mark can pull into his tree. As far as I've checked, the merge can be done smoothly to the current asoc tree, too.

Quoted 4 lines

So, guys, please check / review whether these are all OK for now.

The rest are rather ASoC-intensive part and needs more careful reviews.

Great, thank you, I was about to resend a smaller series but you beat me to it. Will double-check the branch.

#20 lore raw
Quoted 22 lines
Quoted 22 lines

Now I've put a few patches from the series into topic/hda-core-intel branch of sound git tree: namely,

    ALSA: hdac: ext: add wait for codec to respond after link reset
    ALSA: hdac: Remove usage of struct hdac_ext_device and use hdac_device instead
    ALSA: hdac: Remove usage of struct hdac_ext_bus and use hdac_bus instead
    ALSA: hdac: Remove usage of struct hdac_ext_driver, use hdac_driver instead
    ALSA: hda: split snd_hda_codec_new function
    ALSA: hdac: remove memory allocation from snd_hdac_ext_bus_device_init
    ALSA: hdac: add extended ops in the hdac_bus

corresponds to the patch 12 as a fix at first, followed by patches 1, 2, 3 as hdac_ext_* cleanup, and patches 8, 9, 10 for preparation of the further move.  All these should be only cleanups / refactoring (and one fix), hence no visible functional changes.

The branch isn't merged to for-next yet.  And it's cleanly based on v4.18-rc1 so that Mark can pull into his tree.  As far as I've checked, the merge can be done smoothly to the current asoc tree, too.

Quoted 6 lines
Quoted 4 lines

So, guys, please check / review whether these are all OK for now.

The rest are rather ASoC-intensive part and needs more careful reviews.

Great, thank you, I was about to resend a smaller series but you beat me to it. Will double-check the branch.

Takashi, the 0-day reports that bisect is broken are correct, the first patch should be moved after the 3 'Remove usage' patches, i.e. the order should be

-   ALSA: hdac: ext: add wait for codec to respond after link reset
    ALSA: hdac: Remove usage of struct hdac_ext_device and use hdac_device instead
    ALSA: hdac: Remove usage of struct hdac_ext_bus and use hdac_bus instead
    ALSA: hdac: Remove usage of struct hdac_ext_driver, use hdac_driver instead
+   ALSA: hdac: ext: add wait for codec to respond after link reset
    ALSA: hda: split snd_hda_codec_new function
    ALSA: hdac: remove memory allocation from snd_hdac_ext_bus_device_init
    ALSA: hdac: add extended ops in the hdac_bus

I haven't done any audio tests with the legacy driver yet but at least this change fixes compilation issues.
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#21 lore raw
Quoted 50 lines · Pierre-Louis Bossart
Quoted 27 lines
Quoted 27 lines

Now I've put a few patches from the series into topic/hda-core-intel branch of sound git tree: namely,

    ALSA: hdac: ext: add wait for codec to respond after link reset
    ALSA: hdac: Remove usage of struct hdac_ext_device and use hdac_device instead
    ALSA: hdac: Remove usage of struct hdac_ext_bus and use hdac_bus instead
    ALSA: hdac: Remove usage of struct hdac_ext_driver, use hdac_driver instead
    ALSA: hda: split snd_hda_codec_new function
    ALSA: hdac: remove memory allocation from snd_hdac_ext_bus_device_init
    ALSA: hdac: add extended ops in the hdac_bus

corresponds to the patch 12 as a fix at first, followed by patches 1, 2, 3 as hdac_ext_* cleanup, and patches 8, 9, 10 for preparation of the further move.  All these should be only cleanups / refactoring (and one fix), hence no visible functional changes.

The branch isn't merged to for-next yet.  And it's cleanly based on v4.18-rc1 so that Mark can pull into his tree.  As far as I've checked, the merge can be done smoothly to the current asoc tree, too.

Quoted 7 lines
Quoted 4 lines

So, guys, please check / review whether these are all OK for now.

The rest are rather ASoC-intensive part and needs more careful reviews.

Great, thank you, I was about to resend a smaller series but you beat me to it. Will double-check the branch.

Takashi, the 0-day reports that bisect is broken are correct, the first patch should be moved after the 3 'Remove usage' patches, i.e. the order should be

-   ALSA: hdac: ext: add wait for codec to respond after link reset
    ALSA: hdac: Remove usage of struct hdac_ext_device and use hdac_device instead
    ALSA: hdac: Remove usage of struct hdac_ext_bus and use hdac_bus instead
    ALSA: hdac: Remove usage of struct hdac_ext_driver, use hdac_driver instead
+   ALSA: hdac: ext: add wait for codec to respond after link reset
    ALSA: hda: split snd_hda_codec_new function
    ALSA: hdac: remove memory allocation from snd_hdac_ext_bus_device_init
    ALSA: hdac: add extended ops in the hdac_bus

Quoted 2 lines

I haven't done any audio tests with the legacy driver yet but at least this change fixes compilation issues.

OK, fixed now. Thanks!

Takashi
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#22 lore raw
Quoted 53 lines · Takashi Iwai
Quoted 50 lines · Pierre-Louis Bossart
Quoted 27 lines
Quoted 27 lines

Now I've put a few patches from the series into topic/hda-core-intel branch of sound git tree: namely,

    ALSA: hdac: ext: add wait for codec to respond after link reset
    ALSA: hdac: Remove usage of struct hdac_ext_device and use hdac_device instead
    ALSA: hdac: Remove usage of struct hdac_ext_bus and use hdac_bus instead
    ALSA: hdac: Remove usage of struct hdac_ext_driver, use hdac_driver instead
    ALSA: hda: split snd_hda_codec_new function
    ALSA: hdac: remove memory allocation from snd_hdac_ext_bus_device_init
    ALSA: hdac: add extended ops in the hdac_bus

corresponds to the patch 12 as a fix at first, followed by patches 1, 2, 3 as hdac_ext_* cleanup, and patches 8, 9, 10 for preparation of the further move.  All these should be only cleanups / refactoring (and one fix), hence no visible functional changes.

The branch isn't merged to for-next yet.  And it's cleanly based on v4.18-rc1 so that Mark can pull into his tree.  As far as I've checked, the merge can be done smoothly to the current asoc tree, too.

Quoted 7 lines
Quoted 4 lines

So, guys, please check / review whether these are all OK for now.

The rest are rather ASoC-intensive part and needs more careful reviews.

Great, thank you, I was about to resend a smaller series but you beat me to it. Will double-check the branch.

Takashi, the 0-day reports that bisect is broken are correct, the first patch should be moved after the 3 'Remove usage' patches, i.e. the order should be

-   ALSA: hdac: ext: add wait for codec to respond after link reset
    ALSA: hdac: Remove usage of struct hdac_ext_device and use hdac_device instead
    ALSA: hdac: Remove usage of struct hdac_ext_bus and use hdac_bus instead
    ALSA: hdac: Remove usage of struct hdac_ext_driver, use hdac_driver instead
+   ALSA: hdac: ext: add wait for codec to respond after link reset
    ALSA: hda: split snd_hda_codec_new function
    ALSA: hdac: remove memory allocation from snd_hdac_ext_bus_device_init
    ALSA: hdac: add extended ops in the hdac_bus

Quoted 4 lines
Quoted 2 lines

I haven't done any audio tests with the legacy driver yet but at least this change fixes compilation issues.

OK, fixed now. Thanks!

FYI, I merged the topic/hda-core-intel branch into for-next branch now, to be included in linux-next for driving this further.

The rest changes are rather ASoC-specific, so I guess they can go through Mark's tree. Mark, just pull the branch above if needed. It should be clean enough to merge.

thanks,

Takashi
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel