Skip to content

Conversation

@abonislawski
Copy link
Member

@abonislawski abonislawski commented Jan 12, 2022

Merge peakvol component into already existing volume component.
The main differences:

  • curve duration format is in hundred of ns (ipc4) and ms (ip3);
  • volume format sent by driver: Q1.31 (ipc4) and Q8.16 (ipc3);
    In ipc4 case volume format is converted into Q1.23 inside firmware.

@abonislawski abonislawski force-pushed the volume_ipc4 branch 2 times, most recently from f9dd098 to cdd8b6d Compare January 12, 2022 11:38
@ranj063 ranj063 requested a review from singalsu January 12, 2022 17:05
Copy link
Collaborator

Choose a reason for hiding this comment

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

bit-pick: can we use kernel stype comments for struct fields like this:

/** struct ipc4_peak_volume_config
 * @channel_id: ID of channel. If set to ALL_CHANNELS_MASK then
 *		configuration is identical and will be set for all all channels
 * @target_volume: Target channel volume. Takes values from 0 to 0x7fffffff.
 * @curve_type : Fade curve type
 * @curve_duration: Curve duration in number of hundreds nanoseconds for format specified during
 *		    initialization.
 */
struct ipc4_peak_volume_config {
	uint32_t channel_id;
	uint32_t target_volume;
	uint32_t curve_type;
	uint32_t reserved;
	uint64_t curve_duration;
} __attribute__((packed, aligned(8)));

Copy link
Member Author

Choose a reason for hiding this comment

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

Looks like it is not used for other files in include/ipc4?

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.

A good feature to add, just minor stuff.

Copy link
Member

Choose a reason for hiding this comment

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

@singalsu @marcinszkudlinski can we pass the shift value as a non constant variable ? I'm guessing we cant as this would simplify. If not we could define this value as a macro and set it via the CONFIG.

Copy link
Member

@lgirdwood lgirdwood Jan 12, 2022

Choose a reason for hiding this comment

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

Sorry I missed the context in the above question.

out_sample = AE_ROUND32F48SSYM(AE_SRAI64(mult, 1));
#else /* CONFIG_IPC_MAJOR_4 */
			out_sample = AE_ROUND32F48SSYM(AE_SRAI64(mult, 8));

I assume the 1 and 8 above must be const.

Copy link
Collaborator

@singalsu singalsu Jan 13, 2022

Choose a reason for hiding this comment

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

The shift parameter is legacy from time when volume did format conversion. The function should be renamed to vol_s24() and hard code and optimize all shifts to minimum. Shifts by immediate instructions may be better for parallel execute than parametric shift instructions.

Copy link
Collaborator

@singalsu singalsu 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 this could be improved, some proposals added:

@abonislawski abonislawski force-pushed the volume_ipc4 branch 2 times, most recently from 0c8167d to 8980b5c Compare January 19, 2022 14:24
@lgirdwood
Copy link
Member

@abonislawski can you close any resolved comments. I think most are resolved now right ?

@abonislawski abonislawski force-pushed the volume_ipc4 branch 2 times, most recently from 42fd57b to f372c79 Compare January 24, 2022 13:19
Copy link
Collaborator

Choose a reason for hiding this comment

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

it somehow feels like all of the above should be simple macros instead of config options.

Copy link
Member Author

Choose a reason for hiding this comment

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

The best would be to add select in COMP_VOLUME kconfig
select A if IPC4
select B if IPC3
but it didnt work so I ended with a standard config, just hidden

@singalsu @ranj063 where do you want to put this?

Copy link
Collaborator

@ranj063 ranj063 Jan 24, 2022

Choose a reason for hiding this comment

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

@abonislawski how about hiding this as ops or fields in the volume specific data. struct vol_data? You can have fields such as q_notation that are set to Q1.23 and Q1.31 depending on the value and ops for doing IPC specific operations that will be set only where relevant

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure if this will be optimal solution to use AE_SRAI64 with shifts stored in variables.
@singalsu already mentioned to hard code and optimize all shifts to minimum.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@abonislawski not following what you mean by not optimal? You can still hardcode whatever you want based on the IPC version. Just wont be part of the config and also it will reduce al the #if/#else;s

Copy link
Member

Choose a reason for hiding this comment

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

@abonislawski fwiw, we had a recent bug with a similar Kconfig dependency. If the volume type is only used in 1 module then we could just do a

#if CONFIG_IPC3
#define COMP_VOLUME_Q8_16 
#endif

and so on. This keeps some simplicity in the Kconfig and the format localized to volume.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, moved to volume.h

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.

Cant add any other comments so it looks like you have pushed whilst I was reviewing.

Copy link
Member

Choose a reason for hiding this comment

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

@singalsu can you followup with a fix for the frag API usage here. Thanks !

@lgirdwood
Copy link
Member

CI unrelated on Jenkins.

@lgirdwood
Copy link
Member

@abonislawski I think we are good to go, can you rebase. Thanks !

Copy link
Collaborator

Choose a reason for hiding this comment

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

is this needed because the config can be used on different cores?

Copy link
Member

Choose a reason for hiding this comment

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

oh, I think this has been updated at the IPC layer (so that IPC layer does all the cache mgmt) instead of here so the cache inv is not needed here.

Copy link
Member Author

@abonislawski abonislawski Feb 4, 2022

Choose a reason for hiding this comment

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

yeap, it was updated for creating comp but this case is still affected.

Anyway removed dcache_() and ipc4 handler needs to be updated in another PR.
For now it doesnt matter because looks like volume_cmd() is never used for IPC4 because commit 6a297b4 added set large config but also removed cmd translation:
module set_large_config <-------> component cmd

All of this should be fixed in another PR

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.

Need to check cache handling is done by IPC layer.

@lgirdwood
Copy link
Member

@abonislawski fyi - here is the efficient copy() PR update that canbe copied here. #5300

@abonislawski abonislawski force-pushed the volume_ipc4 branch 2 times, most recently from 26bdf31 to 58bea8f Compare February 4, 2022 13:33
@abonislawski
Copy link
Member Author

@lgirdwood rebase ready
Big thanks to @singalsu for hifi3 support :)

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.

Only open on the Kconfig, otherwise good.

Merge peakvol component into already existing volume component.
The main differences:
- curve duration format is in hundred of ns (ipc4) and ms (ip3);
- volume format sent by driver: Q1.31 (ipc4) and Q8.16 (ipc3);
In ipc4 case volume format is converted into Q1.23 inside firmware.

Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
@lgirdwood lgirdwood merged commit cf04ada into thesofproject:main Feb 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants