-
Notifications
You must be signed in to change notification settings - Fork 128
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] SoundWire: add rt1308 feedback #2514
[RFC] SoundWire: add rt1308 feedback #2514
Conversation
sound/soc/codecs/rt1308-sdw.c
Outdated
capture: | ||
direction = SDW_DATA_DIR_TX; | ||
num_channels = 2; | ||
|
||
stream_config.frame_rate = params_rate(params); | ||
stream_config.ch_count = num_channels; | ||
stream_config.bps = snd_pcm_format_width(params_format(params)); | ||
stream_config.direction = direction; | ||
|
||
port_config_feedback[0].ch_mask = BIT(0); | ||
port_config_feedback[0].num = 2; /* DP2 */ | ||
port_config_feedback[1].ch_mask = BIT(1); | ||
port_config_feedback[1].num = 4; /* DP4 */ |
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.
@plbossart Thanks for this commit to explain how to config the multi data ports with one DAI link.
I think something I don't explain clearly in #2513
The feedback channels are two channels for each port.
Due to RT1308 is a stereo amplifier, it will protect the left and right speakers individually.
Left IV => using DP2 to feedback ch0 (I data) and ch1 (V data) for left speaker.
Right IV => using DP4 to feedback ch0 (I data) and ch1 (V data) for right speaker.
Therefore, the total channels are four channels like below.
num_channels = 4;
port_config_feedback[0].ch_mask = BIT(0) | BIT(1);
port_config_feedback[0].num = 2; /* DP2 */
port_config_feedback[1].ch_mask = BIT(2) | BIT(3);
port_config_feedback[1].num = 4; /* DP4 */
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.
@shumingfan waiting for your result. I also had such idea but I didn't get a answer from cadance's spec.
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.
@shumingfan I get the point for the case with a a single amp, we would get 4 channels. Your change makes sense. I have to see though how we would deal with 4 channels on the Intel side, I believe we would need 2 ports.
Also what happens in the case where there are two amplifiers in the system, and each of them controls a tweeter and woofer. How many feedback channels would we get from each amplifier?
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.
@plbossart It will have 4 feedback channels from each amplifier.
Hence, there are eight feedback channels when using two amplifiers in the system.
The amp protection needs to protect each speaker whether it belongs to the tweeter or woofer.
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.
@shumingfan waiting for your result. I also had such idea but I didn't get a answer from cadance's spec.
@RanderWang I tested the feedback function with the approach of this PR.
First, I tried to record the IV data from DP2 only. I can see the ch0 and ch1 have the captured data.
Then, I tried to record the IV data from DP2/4 both. There are captured data with ch0 and ch1 only.
The ch2 and ch3 are zero.
I checked the MIPI-defined registers of DP2 and DP4 which had been configured while the test.
The DP4_ChannelEN doesn't enable. I think there is a problem there.
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.
@shumingfan if the DP4 registers were configured, but only the DP4_ChannelEN is not set, this points to a missing loop in the bank switch where we only deal with a single port?
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.
@shumingfan if the DP4 registers were configured, but only the DP4_ChannelEN is not set, this points to a missing loop in the bank switch where we only deal with a single port?
@plbossart I found the root cause. The DP2/4_ChannelEn only supports channel1/2.
The driver needs to change the ch_mask to 0x3 for DP2/4 both.
Now, I could get the captured data of four channels.
num_channels = 4;
port_config_feedback[0].ch_mask = BIT(0) | BIT(1);
port_config_feedback[0].num = 2; /* DP2 */
port_config_feedback[1].ch_mask = BIT(0) | BIT(1);
port_config_feedback[1].num = 4; /* DP4 */
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 @shumingfan, updated the patch and added you as co-author. please check if this is ok now.
6c073fa
to
3a12553
Compare
The RT1308 can provide feedback for two speakers. Each speaker is handled by a port, and each port transmits two channels for I and V. The data is handled as a single 4ch stream and a single DAI. Co-developed-by: Shuming Fan <shumingf@realtek.com> Signed-off-by: Shuming Fan <shumingf@realtek.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
FIXME: for now there is no initialization on capture. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
3a12553
to
d41d1c1
Compare
@plbossart @bardliao @RanderWang Now I tried to connect two amplifiers to meet the environment of the customer's product.
Sorry, I am not familiar with the topology development. Does this graph make sense or be reasonable? |
@shumingfan please make it clear about your DAI in graph. only one BE DAI but two CPU DAIs & codec DAIs. Now as I know, we don't support capture aggregation. @bardliao do we support it ? |
@shumingfan you are absolutely right that we need a mux on capture to aggregate the two links. I don't think this exists today, we need to check with @slawblauciak. However I am not sure about the demux. The idea of inserting a demux was that we could pass an echo reference to the application for acoustic echo cancellation. It's my understanding that we use the demux only to split the stream in two. Now in your case, the aggregated feedback stream would be made of 8 channels. That seems a bit too much to pass to the application, so we may need to combine channels or select specific ones? Also note that if you want to develop this functionality, we will be limited by the SOF firmware signature issues. The simplest solution for development might be to use an UpExtreme board, which exposes 4 SoundWire links on its connector and allows for the community key to be used, and tie it to the 3-in-1 board. If you want to enable the RT1308 IV feedback on devices where the Intel production key is used, we need to solve collectively the signature issues. The Realtek library will probably not go into the Intel base firmware, so we are looking at a 2-key solution similar to Windows, and Realtek releasing the firmware to users. Adding @lgirdwood to make sure this is tracked. |
@plbossart Thanks for your explanation. But, it is bad news to our FW team that there is no mux on capture to aggregate the two links for now. We have the ICL RVP to do the test and algorithm development. |
There is no mux yet on capture, but I think this should be relatively simple to do. @bardliao could do this before breakfast :-)
yes, the need/usage is understood.
RVPs shipped outside of Intel usually use the production key, not the debug key. At any rate, it's not the SOF 'community key' either way. |
Oh, that is not easy to me in fact. |
this PR is a year old and nothing happened, closing. |
rough draft as an example of how to add IV feedback support
I have no idea how to add a capture dailink, might been @RanderWang's help here.
@shumingfan @bardliao comments welcome.