Enable HDA Codec support on Intel Platforms (Series1)
Subsystems (3)
v5 cover Enable HDA Codec support on Intel Platforms (Series1)
Enhanced HD Audio capabilities introduced in HD Audio controllers are added in backward compatible way i.e. it does not change the behavior of the controller with respect to HDA Bus and HDA devices.
Since there is no change in the hardware with respect to the HDA bus and HDA device it is more appropriate to represent the same in software as well.
In order to align software representation with hardware it makes more sense to have common data structures across device, bus and driver for both enhanced HDA controllers and legacy HDA controllers.
This patch series removes the hdac_ext_device structure, hdac_ext_bus and hdac_ext_driver data structures so that legacy and enhanced HDaudio capabilities can be handled in a backwards-compatible way without separate definitions.
Once this clean-up is complete, additional patches will allow for HDaudio codec support in an ASoC framework without the need to develop new codec drivers, thereby enabling the use of the Intel DSP on more platforms (currently limited to hdmi).
Changes in v5:
- No functionality changes in this series except rebase.
Changes in v4:
- No changes in this series except rebase as there were no comments.
Changes in v3:
- No changes in this series except rebase as there were no comments.
Changes in v2:
- First three patches from v1 are merged so not included in this series.
- No changes in this series except rebase as there were no comments.
Rakesh Ughreja (3):
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
include/sound/hdaudio.h | 21 ++ include/sound/hdaudio_ext.h | 119 +++------- sound/hda/ext/hdac_ext_bus.c | 76 +++--- sound/hda/ext/hdac_ext_controller.c | 55 +++-- sound/hda/ext/hdac_ext_stream.c | 104 ++++----- sound/soc/codecs/hdac_hdmi.c | 415 ++++++++++++++++----------------- 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 | 18 +- sound/soc/intel/skylake/skl-topology.h | 6 +- sound/soc/intel/skylake/skl.c | 178 +++++++------- sound/soc/intel/skylake/skl.h | 7 +- 13 files changed, 522 insertions(+), 647 deletions(-)
Signature · 1 line
2.7.4
RFC v5 1/3 ALSA: hdac: Remove usage of struct hdac_ext_device and use hdac_device instead
This patch removes the hdac_ext_device structure. The legacy and enhanced HDaudio capabilities can be handled in a backwards-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 | 395 +++++++++++++++++++++---------------------- 3 files changed, 204 insertions(+), 252 deletions(-)
include/sound/hdaudio_ext.h +4 -32
@@ -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
@@ -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 -205
1,127 lines not on this page · raw message
Signature · 1 line
2.7.4
RFC v5 2/3 ALSA: hdac: Remove usage of struct hdac_ext_bus and use hdac_bus instead
In reply to Rakesh UghrejaThis patch removes the hdac_ext_bus structure. The legacy and enhanced HDaudio capabilities can be handled in a backwards-compatible way without separate definitions.
Follow-up patches in this series handle the driver definition.
--- include/sound/hdaudio.h | 16 +++ 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 | 18 ++-- sound/soc/intel/skylake/skl-topology.h | 6 +- sound/soc/intel/skylake/skl.c | 178 +++++++++++++++------------------ sound/soc/intel/skylake/skl.h | 7 +- 13 files changed, 306 insertions(+), 371 deletions(-)
include/sound/hdaudio.h +16 -0
@@ -251,6 +251,12 @@ struct hdac_rb {* @mlcap: MultiLink capabilities pointer * @gtscap: gts capabilities pointer * @drsmcap: dma resume capabilities pointer +* +* Parameters required for enhanced capabilities +* @num_streams: streams supported +* @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;
@@ -318,6 +324,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
@@ -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
@@ -1788,14 +1788,13 @@ static int hdmi_codec_probe(struct snd_soc_codec *codec)* 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 )
@@ -1972,14 +1971,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 )
@@ -2032,7 +2030,7 @@ static int hdac_hdmi_dev_probe(struct hdac_device *hdev) ret =snd_soc_register_codec (&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; }
@@ -2083,7 +2081,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;
@@ -2108,13 +2105,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 ; }
@@ -2123,7 +2120,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;
@@ -2133,13 +2129,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
@@ -139,7 +139,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;
@@ -226,7 +226,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",
@@ -246,8 +246,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 +7 -11
@@ -2772,9 +2772,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)
@@ -2880,8 +2879,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) {
@@ -3365,9 +3363,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 )
@@ -3456,12 +3453,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_platform *platform,struct hdac_ext_bus *ebus) +int skl_tplg_init (struct snd_soc_platform *platform,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
@@ -449,9 +449,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,
@@ -461,7 +461,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_platform *platform, -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 +80 -98
493 lines not on this page · raw message
sound/soc/intel/skylake/skl.h +3 -4
@@ -63,7 +63,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 */
@@ -97,9 +97,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.7.4
RFC v5 3/3 ALSA: hdac: Remove usage of struct hdac_ext_driver, use hdac_driver instead
In reply to Rakesh UghrejaThis patch removes the hdac_ext_driver structure. The legacy and enhanced HDaudio capabilities can be handled in a backwards-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
@@ -186,6 +186,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
@@ -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
@@ -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
@@ -2176,14 +2176,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.7.4
Quoted 18 lines · Rakesh Ughreja
Enhanced HD Audio capabilities introduced in HD Audio controllers are added in backward compatible way i.e. it does not change the behavior of the controller with respect to HDA Bus and HDA devices.
Since there is no change in the hardware with respect to the HDA bus and HDA device it is more appropriate to represent the same in software as well.
In order to align software representation with hardware it makes more sense to have common data structures across device, bus and driver for both enhanced HDA controllers and legacy HDA controllers.
This patch series removes the
hdac_ext_devicestructure,hdac_ext_busandhdac_ext_driverdata structures so that legacy and enhanced HDaudio capabilities can be handled in a backwards-compatible way without separate definitions.
Quoted 7 lines
Once this clean-up is complete, additional patches will allow for HDaudio codec support in an ASoC framework without the need to develop new codec drivers, thereby enabling the use of the Intel DSP on more platforms (currently limited to hdmi).
Changes in v5:
- No functionality changes in this series except rebase.
Thanks for the new patchset.
It took some time until I figure out that topic/intel branch isn't new enough, so the patches can't be applied. The whole previous cleanups of hdac_hdmi were slipped into topic/dai-drv branch.
Mark, could you make topic/intel branch more usable, by merging topic/dai-drv branch? Otherwise it's pretty hard to apply these patches.
Unfortunately my Dell machine has no DSP, and it doesn't give the proper NHLT entry, thus the snd-soc-skl loading fails. (BTW, there was a kernel WARNING hit by that; will submit the fix patch later.)
So, only judging from the quick glance over the patches:
first off, the less change in ALSA legacy side than previous versions is nice. Where to call the probe and the remove of ext_ops is still a slight question (whether it has to be the very beginning or not), but it's a good start.
Maybe we can drop the introduction of bus type, too. Basically just checking the non-NULL bus->ext_ops should be enough to identify the ext-bus type.
thanks,
Takashi
Quoted 12 lines
-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Wednesday, January 3, 2018 9:07 PM
To: Ughreja, Rakesh A <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Koul, Vinod <[email protected]>; Patches Audio <[email protected]>
Subject: Re: [RFC v5 0/3] Enable HDA Codec support on Intel Platforms (Series1)
Quoted 4 lines
Unfortunately my Dell machine has no DSP, and it doesn't give the proper NHLT entry, thus the snd-soc-skl loading fails. (BTW, there was a kernel WARNING hit by that; will submit the fix patch later.)
Yes, you are right.
Based on specification of Dell Latitude 7270, it looks like it is SKL SoC and so may not have DSP enabled in the BIOS.
Quoted 6 lines
So, only judging from the quick glance over the patches:
first off, the less change in ALSA legacy side than previous versions is nice. Where to call the probe and the remove ofext_opsis still a slight question (whether it has to be the very beginning or not), but it's a good start.
Based on your suggestion during the previous reviews, I tried reusing the other functions like snd_hda_codec_set_name, snd_hdac_regmap_init, patch, snd_hda_codec_build_pcms, snd_hda_codec_build_controls etc.
Except the regmap_init function everything else requires snd_card which is created only at the machine driver load, so I was not able to reuse any other function. That's why I am calling all these functions in the snd_soc_codec probe time, and not during the hdac_dev probe.
I have tried calling the regmap_init in the hdac_dev probe and things seem to work fine, but I am not sure if it is right thing to do, since the card is not created.
Do you know if we can do regmap_init before the card is created ?
Quoted 4 lines
Maybe we can drop the introduction of bus type, too. Basically just checking the non-NULL
bus->ext_opsshould be enough to identify the ext-bus type.
Yes, sure. I will include this change in the next series.
Regards,
Rakesh