Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions sound/soc/sof/intel/hda.c
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,10 @@ static int hda_init_caps(struct snd_sof_dev *sdev)
struct hdac_ext_link *hlink = NULL;
int ret = 0;

// FIXME: we do this a lot !
/* The initialization process of HDA in SOF is:
* (1) init HDA to set up a context for i915 initialization
* then stop HDA bus.
*/
hda_dsp_ctrl_init_chip(sdev, true);

device_disable_async_suspend(bus->dev);
Expand All @@ -402,14 +405,24 @@ static int hda_init_caps(struct snd_sof_dev *sdev)

snd_hdac_bus_stop_chip(bus);

/* probe i915 and HDA codecs */
/* (2) probe i915 and HDA codecs, HDMI codecs */
if (IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI)) {
ret = hda_codec_i915_init(sdev);
if (ret < 0)
return ret;
}

// FIXME: we do this a lot !
/* only HDA analog codec is detected in step (1) and
* codec_mask would be set. At step(3) HDMI codec can't
* be detected because HDA framework only check codecs
* when codec_mask is zero. So now set codec_mask to zero
* to force HDA framework to check codecs again.
*/
bus->codec_mask = 0;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RanderWang just to confirm, we detect codecs at step 1 and HDMI at step 2 ? So to me I would replace the //FIXME comments in the code above and also add your commit message explanation as the comments stating what is detected where. This makes it obvious to any reader why the bus is reset twice etc.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RanderWang just to confirm, we detect codecs at step 1 and HDMI at step 2 ? So to me I would replace the //FIXME comments in the code above and also add your commit message explanation as the comments stating what is detected where. This makes it obvious to any reader why the bus is reset twice etc.

yes, two steps to detect all codecs. It is good to refine my comments and I will update it

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry @RanderWang , I mean you have a large comment with 3 steps, each comment step should be next to the line of code that does that step and not all in one place.


/* (3) init HDA again to make everything ready so that all
* the codecs can be detected.
*/
ret = hda_dsp_ctrl_init_chip(sdev, true);
if (ret < 0) {
dev_err(bus->dev, "Init chip failed with ret: %d\n", ret);
Expand Down