Skip to content

Conversation

@ryans-lee
Copy link

This commit is about adding "Maxim DSM(Dynamic Speaker Management) component".
This component is written based on "Smart amplifier test component".
SOF audio component get variable length frame per approximately 1ms.
Because DSM requires fixed frame size(16 bit, 240 samples per channel), this component do internal buffering
to get desired input format.
This component originally works with DSM function library, but I removed it from this commit because it is not open source based and it has potential license issue. So it is currently working as bypass component.
This component tested on Volteer board with MAX98373 amp over I2S.

Please help to review.
Thank you in advance.

@ryans-lee ryans-lee changed the title sof dsm audio component smart Jul 28, 2020
@ryans-lee ryans-lee changed the title smart smart amp: added Maxim DSM audio component Jul 28, 2020
Copy link
Member

@plbossart plbossart left a comment

Choose a reason for hiding this comment

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

License question below:

@cujomalainey
Copy link
Contributor

I think you need to rebase your commit, you have conflicts and appear to be merging more than you intend

@ryans-lee ryans-lee force-pushed the sof_dsm_audio_component branch from 6e0af57 to 5ee011a Compare July 29, 2020 22:21
@ryans-lee
Copy link
Author

I think you need to rebase your commit, you have conflicts and appear to be merging more than you intend

Thanks for the comment. I rebased my commit.

Copy link
Contributor

@cujomalainey cujomalainey left a comment

Choose a reason for hiding this comment

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

general review comments as I am by no means an expert in DSM algorithms :)

@ryans-lee ryans-lee force-pushed the sof_dsm_audio_component branch 2 times, most recently from 6f15b9c to 589439e Compare July 31, 2020 01:06
Copy link
Member

@lgirdwood lgirdwood left a comment

Choose a reason for hiding this comment

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

Mostly minor stuff. @mmaka1 are we good to use the new trace UUID API here too ?

@ryans-lee ryans-lee force-pushed the sof_dsm_audio_component branch from 589439e to e60e820 Compare August 8, 2020 15:49
@ryans-lee
Copy link
Author

@plbossart @cujomalainey @lgirdwood I appreciate for your review.
I have updated changes to follow up your requests. Please help to review.
Thank you for your time.

@ryans-lee ryans-lee force-pushed the sof_dsm_audio_component branch from e60e820 to 2de5785 Compare August 11, 2020 03:04
@ryans-lee ryans-lee force-pushed the sof_dsm_audio_component branch 2 times, most recently from 9bd9b90 to 47b9e16 Compare August 14, 2020 21:15
@ryans-lee
Copy link
Author

Added one more commit about 'memmove' implementation in lib/lib.c

Copy link
Member

@lgirdwood lgirdwood left a comment

Choose a reason for hiding this comment

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

@ryans-lee can you make the memmove into it's own PR and add the comment about POSIX
@singalsu any comments ? This looks good to me.
@RDharageswari are there any Smart AMP dependencies that ned to be merged prior to this ?

src/lib/lib.c Outdated
Copy link
Member

Choose a reason for hiding this comment

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

I'm assuming this allings with the POSIX version of memove ? If so, we should say so in the commit message.

Copy link
Author

Choose a reason for hiding this comment

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

@lgirdwood Let me create separate PR to add memmove function. Actually all memmove functions in this PR can be replaced by memcpy because it is copying higher address to lower address. memcpy cannot be used for the opposite case.
Let me switch memmove function to memcpy in this PR.

@ryans-lee ryans-lee force-pushed the sof_dsm_audio_component branch from 47b9e16 to 10235e9 Compare August 17, 2020 23:42
@ryans-lee
Copy link
Author

I removed 'memmove' from this PR and updated the code again. Please help to review and approve.

@lgirdwood
Copy link
Member

@cujomalainey any comments ?

Copy link
Contributor

Choose a reason for hiding this comment

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

no handling of the data here?

Copy link
Author

Choose a reason for hiding this comment

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

Parameter read/write function have not been implemented yet.
'SOF_CTRL_CMD_BINARY' covers general parameter update to the component and I'm not sure configuration by 'SOF_CTRL_CMD_ENUM' at this moment. Will add implementation if needed when I submit separate PR for the parameter read/write function. Thank you.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, would you mind removing the ENUM since you have no usage? it looks like a bug there as it stands.

Copy link
Author

Choose a reason for hiding this comment

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

OK. Shall fix it.

Copy link
Contributor

Choose a reason for hiding this comment

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

should we return error on streams that are not S32LE so we don't have silent memory failures?

Copy link
Author

Choose a reason for hiding this comment

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

I took this code from the smart amp reference code smart_amp_test.c and I don't quite well understand about the reason why it is s32_le hardcoded. I confirmed feedback data is coming in s32_le but frame_fmt was still s16_le.
I suppose this issue is still there because smart_amp_test.c is still same.
Let me remove the hardcoded value later once frmae_fmt variable get the correct value.
@bkokoszx Could you please add comment here? Thanks for your help.

Copy link
Collaborator

Choose a reason for hiding this comment

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

There were two reasons why S32_LE format is hardcoded here:

  1. At the beginning there was requirement only for that format on feedback stream.
  2. Our pipeline params propagation mechanism does not handle case with DSM topology (format parameter is not properly propagated to feedback buffer, so it was hardcoded at that moment (assuming that we only need s32_le)).

If we want to delete this hardcode, we should reopen @keyonjie PR with params negotiation #2788.

Copy link
Contributor

Choose a reason for hiding this comment

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

If the current platforms only support S32LE then i am fine with the hardcode but I recommend we open a tracking bug in case other formats such float wish to use this then we have a bug we can refer to

Copy link
Author

Choose a reason for hiding this comment

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

@bkokoszx Could you please help on this?

Copy link
Member

Choose a reason for hiding this comment

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

@ryans-lee can you put a check in here that returns error with some trace error output so this does not silenttly fail. You should keep the TODO info so that this can be addressed one the negotion is completed by @keyonjie .

Copy link
Author

Choose a reason for hiding this comment

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

@lgirdwood I've added a check and put 'com_err' message to notify the issue. I considered to return error in smart_amp_process, but it causes several errors and blocked testing for capture stream.

@ryans-lee ryans-lee force-pushed the sof_dsm_audio_component branch from 10235e9 to 0b56909 Compare August 24, 2020 20:56
@ryans-lee
Copy link
Author

Removed 'SOF_CTRL_CMD_ENUM' case.
@cujomalainey Please help to review. Thank you.

One additional modification - Removed topology change from this PR. Created separate PR3342 for the same thing.

@RDharageswari
Copy link

@lgirdwood : There are no dependencies for this patch

Copy link
Member

@lgirdwood lgirdwood left a comment

Choose a reason for hiding this comment

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

I think we just need the one chnage and we are good ?

Copy link
Member

Choose a reason for hiding this comment

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

@ryans-lee can you put a check in here that returns error with some trace error output so this does not silenttly fail. You should keep the TODO info so that this can be addressed one the negotion is completed by @keyonjie .

Maxim DSM(Dynamic Speaker Management) audio component is added.
This component takes stereo input + 4 channel IV feedback.

Signed-off-by: Ryan Lee <ryans.lee@maximintegrated.com>
@ryans-lee ryans-lee force-pushed the sof_dsm_audio_component branch from 0b56909 to 6df8437 Compare August 27, 2020 17:03
@lgirdwood
Copy link
Member

Jenkins CI is kernel ROM status errors for ICL and CML.
@cujomalainey good for you too ? we can make any incremetal fixes as feature continues integration.

@ryans-lee
Copy link
Author

@cujomalainey Would you please provide your comments?

*/
if (sad->feedback_buf->stream.frame_fmt != SOF_IPC_FRAME_S32_LE) {
sad->feedback_buf->stream.frame_fmt = SOF_IPC_FRAME_S32_LE;
comp_err(dev, "smart_amp_prepare(): S32_LE format is hardcoded as workaround");
Copy link
Contributor

Choose a reason for hiding this comment

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

no return error code?

Copy link
Author

Choose a reason for hiding this comment

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

@cujomalainey I considered to return error in smart_amp_process, but it causes several errors and blocks testing for capture stream. Hence I removed error return and added error message to move forward.

Copy link
Contributor

Choose a reason for hiding this comment

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

Got it, as long as userspace handles the change properly then Im ok with this.

@lgirdwood
Copy link
Member

Jenkins CI showing ROM status errors on CML and ICL around PM flows that are unrelated.

@lgirdwood lgirdwood merged commit 26875c7 into thesofproject:master Sep 1, 2020
@ryans-lee
Copy link
Author

I appreciate for all your time and effort for the review.

@cujomalainey
Copy link
Contributor

Thanks for the patience in the review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DSM Dynamic Speaker Management enhancement New feature or request Notable Enhancement is significant or notable for release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants