-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFC] [DO NOT MERGE] Integration of Soundwire and SOF #1130
[RFC] [DO NOT MERGE] Integration of Soundwire and SOF #1130
Conversation
For SoundWire/ALH, we have BE-specific inits to run, so don't return and give a chance to the hardware driver to run. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
The helper calls the SoundWire initializations and sets the resource structure defined as an interface with the platform driver. The resource deals with PCI base address, interrupts and the callback for the stream configuration. The interrupts are gated/ungated at the top-level with the ADSPIPC2.SNDW field Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
The Core0 needs to be powered before the SoundWire IP is initialized. The storage of the SoundWire information the snd_sof_dev structure will have to be revisited. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Once we get the ALH stream ID, we need to send an IPC to configure the firmware. Open: how do we get the DAI index from the dai? Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Implement all required back-end operations for SoundWire FIXMEs: 1. the use of indices to detect SoundWire is a bad design to be revisited 2. this patch was squashed for simplicity but may have to be better split to simplify reviews. 3.we will have to rework all the stream handling since we have 4 structures called 'blah_stream' Signed-off-by: Bard liao <yung-chuan.liao@linux.intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Somehow the core0 needs to be on to set-up the interrupts and power-up the SoundWire IP. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
@plbossart & all, how about my solution for sdw in SOF based on this PR? plbossart#3 we don't need to make such strange code.
And some functions, such as prepare, trigger, free, should be done in BE sdw dai link driver, just like hda dai link driver. In this PR, the sdw setting is recourse to FE stream, do it like the following code
And found it will affect HDMI, although we can add more code to check whether it is HDMI or not. |
Your solution was posted after this PR, so please give people time to review. I provided comments already.
I cannot figure out what you were trying to say here. Just boiler-plate answer is that I don't want any ties between SoundWire and front-ends, nor any warts related to HDMI. |
@plbossart I do like the direction in Rander's PR.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @plbossart for posting it. Some minor comments from my side.
int sdw_pcm_prepare(struct snd_sof_dev *sdev, | ||
struct snd_pcm_substream *substream) | ||
{ | ||
//struct snd_pcm_runtime *runtime = substream->runtime; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove it :)
} | ||
|
||
int hda_dsp_pcm_close(struct snd_sof_dev *sdev, | ||
struct snd_pcm_substream *substream) | ||
{ | ||
struct hdac_stream *hstream = substream->runtime->private_data; | ||
struct hdac_stream *hstream = NULL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move below hstream = runtime->private_data;
here?
ret = hda_dsp_stream_put(sdev, direction, hstream->stream_tag); | ||
|
||
if (ret) { | ||
dev_dbg(sdev->dev, "stream %s not opened!\n", substream->name); | ||
return -ENODEV; | ||
} | ||
|
||
goto free; | ||
|
||
be: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably check if it is soundwire here. e.g.
if (rtd->cpu_dai->id < SDW_DAI_ID_RANGE_START ||
rtd->cpu_dai->id > SDW_DAI_ID_RANGE_END)
return 0;
@@ -500,6 +512,35 @@ int hda_dsp_stream_hw_free(struct snd_sof_dev *sdev, | |||
spin_unlock_irq(&bus->reg_lock); | |||
|
|||
return 0; | |||
be: | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably check if it is soundwire here, too
if (rtd->dai_link->no_pcm) | ||
/* skip front-end specific inits for BE */ | ||
if (rtd->dai_link->no_pcm) { | ||
snd_sof_pcm_platform_prepare(sdev, substream); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return snd_sof_pcm_platform_prepare(sdev, substream);?
if (rtd->dai_link->no_pcm) | ||
/* skip front-end specific inits for BE */ | ||
if (rtd->dai_link->no_pcm) { | ||
snd_sof_pcm_platform_trigger(sdev, substream, cmd); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return snd_sof_pcm_platform_trigger(sdev, substream, cmd);?
return ret; | ||
} | ||
|
||
hda_sdw_int_enable(sdev, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this necessary? SdW interrupt should work in suspended, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no. If the IP is power gated then it can't generate interrupts.
This is different from the bus wake, which is something that we need to handle with the clock-stop mode, but that's for future work.
yes, I also want to do it.
because hw_params in codecs is invoke before dai hw_params, so if sdw data is set in dai hw_params,
|
closed and replaced by #1139 |
The integration of SoundWire support is quite hacky (the spell checker suggests wacky which isn't far from the truth). @RanderWang suggested that this isn't quite right as well so let's try and use GitHub to collect feedback.
We will need bandwidth from the usual suspects @ranj063 @kv2019i @lyakh @juimonen to help us make progress.
The goal is not to merge this in topic/sof-dev for now, this is to be applied on top of all the queued SoundWire patches (kept in an integration branch for reference).