Skip to content

Conversation

@juimonen
Copy link

@juimonen juimonen commented Feb 8, 2023

Add conditional link clock settings for mtl ssp using auxiliary data in the blob generation.

Signed-off-by: Jaska Uimonen jaska.uimonen@intel.com

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.

@ranj063 @jsarha pls review

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.

seems a bit intrusive an repetitive @juimonen, can we not have a mtl default with the values added instead of changing all topologies.

Copy link
Member

Choose a reason for hiding this comment

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

can we not have some sort of enum that is self explanatory or a comment. This is very hard to review.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd not pollute the hw_config class with NHLT-specific stuff at all. The clock_source is a SSP-specific value that can be set in ssp.conf based on PLATFORM definition

Copy link
Collaborator

Choose a reason for hiding this comment

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

what i'd think you need is something like this:

diff --git a/tools/topology/topology2/include/dais/ssp.conf b/tools/topology/topology2/include/dais/ssp.conf
index 9c73e7562..99fc9024e 100644
--- a/tools/topology/topology2/include/dais/ssp.conf
+++ b/tools/topology/topology2/include/dais/ssp.conf
@@ -111,6 +111,25 @@ Class.Dai."SSP" {
        # platform clock frequency
        DefineAttribute.io_clk {}
 
+       DefineAttribute."clock_source" {
+               constraints {
+                       !valid_values [
+                               "XTAL"
+                               "CARDINAL"
+                               "PLL"
+                               "MCLK"
+                               "WOV_CRO"
+                       ]
+                       !tuple_values [
+                               0
+                               1
+                               2
+                               3
+                               4
+                       ]
+               }
+       }
+
        attributes {
                !constructor [
                        "name"
@@ -140,4 +159,10 @@ Class.Dai."SSP" {
        frame_pulse_width       0
        tdm_padding_per_slot    false
        version                 $SSP_BLOB_VERSION
+
+       IncludeByKey.PLATFORM {
+               "mtl"   {
+                       clock_source    PLL
+               }
+       }
 }

Copy link
Member

Choose a reason for hiding this comment

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

  •   IncludeByKey.PLATFORM {
    
  •           "mtl"   {
    
  •                   clock_source    PLL
    

I hope we are using the 24.576MHz cardinal clock that comes for free and not the PLL? That index 2 seems completely wrong...

Copy link
Collaborator

@ranj063 ranj063 Feb 9, 2023

Choose a reason for hiding this comment

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

@plbossart I could be wrong with the indices, I was just giving an example. @juimonen please correct me

Copy link
Author

Choose a reason for hiding this comment

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

all this is good and dandy, but it would require me to rewrite/move the alsa-utils auxdata parser

Copy link
Author

Choose a reason for hiding this comment

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

We can debate about the sw-philosophical issues for a long time... So ssp blob is created per hw_config, like in BT we have 3 different hw_configs, we create 3 different blobs into nhlt. Aux data is embedded by the spec after the blob. So if the aux data is moved into ssp level, it would mean that all blobs would need a copy of the same aux data. I understand that in the link clock case this could be fine, but link clock is not the only aux data item. So if someone can guarantee me that any aux data items will not be different in any hw_configs per ssp, the move to ssp level would be justified. Otherwise I see the hw_config quite logical place for it.

Copy link
Member

Choose a reason for hiding this comment

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

I will repeat my suggestion to ALWAYS provide the AUX information with the clock source, and have the firmware discard what it cannot understand.

The point is that if you select a bitclock that divided from 24.576 MHz then you have to select the clock_source 1. If you derive the bitclock from 19.2 then clock_source 0 it is.

There's no differences between platforms, the mapping between clock sources is always the same, and we only have to select between 0 and 1 for now.

In other words, rather than keep this optional make it a mandatory one-size-fits-all.

Copy link
Member

Choose a reason for hiding this comment

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

do we really want to add this everywhere, when this is clearly a SOC-specific configuration that should be default in all topologies?

This should be part of a platform definition, not in all topologies IMHO.

Copy link
Member

Choose a reason for hiding this comment

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

@juimonen can we take this from platform.conf i.e. using the same method as SSP_BLOB_VERSION above ? This could be an attribute in teh base class that would default to PLATFORM_CLOCK_blah_DEFAULT ?

Copy link
Author

Choose a reason for hiding this comment

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

I don't currently know a way to add this to all hw_configs in a certain platform in some other way than this

@juimonen
Copy link
Author

juimonen commented Feb 8, 2023

seems a bit intrusive an repetitive @juimonen, can we not have a mtl default with the values added instead of changing all topologies.

yes agreed. @ranj063 any idea how to add this only once based on platform?

@lgirdwood
Copy link
Member

seems a bit intrusive an repetitive @juimonen, can we not have a mtl default with the values added instead of changing all topologies.

yes agreed. @ranj063 any idea how to add this only once based on platform?

Dont we have a platform file that can be included like in topology1 ? if not, please add one.

@ranj063
Copy link
Collaborator

ranj063 commented Feb 13, 2023

Dont we have a platform file that can be included like in topology1 ? if not, please add one

@lgirdwood yes we do. There's mtl.conf that we can add this to

@kv2019i
Copy link
Collaborator

kv2019i commented Feb 17, 2023

@juimonen array-support merged in #7113 so rebase will be needed

Add conditional link clock settings for mtl ssp using auxiliary data in
the blob generation.

Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
@lgirdwood
Copy link
Member

@juimonen still RFC ?

@juimonen
Copy link
Author

@juimonen still RFC ?

I want to see the CI after rebase (zephyr update) and there's still topology "cleanup" issues to be discussed...

@juimonen juimonen changed the title [RFC] topology2: ssp: add link clock aux data for mtl topology2: ssp: add link clock aux data for mtl Mar 8, 2023
@juimonen
Copy link
Author

juimonen commented Mar 8, 2023

@ranj063 @plbossart we need to figure this out, related code is merged and used in alsa-utils and zephyr ssp driver. This is a working solution, but if you want this cleaner, I need some guidance how to proceed. I would really like to get this for 2.5...

@lgirdwood
Copy link
Member

lgirdwood commented Mar 13, 2023

@ranj063 @plbossart we need to figure this out, related code is merged and used in alsa-utils and zephyr ssp driver. This is a working solution, but if you want this cleaner, I need some guidance how to proceed. I would really like to get this for 2.5...

@juimonen Looks like we need the clock source enum and the mtl.conf

@kv2019i
Copy link
Collaborator

kv2019i commented Mar 30, 2023

@juimonen Can you check how this could be moved to mtl.conf and evaluate the effort? I understand the concern that this bit now is needed in every topology used with mtl, and would b ebetter to have this in one place.

@plbossart @lgirdwood Ok to merge this now if Jaska commits to making a follow-up change. We really do need this change, we are getting corruption in audio signal without and this could mask all kinds of other things.

@juimonen
Copy link
Author

probably people would like something like this: https://github.com/juimonen/sof/tree/aux_test

problem is that it just doesn't work with alsa-utils and I kind of don't know why.

Copy link
Collaborator

@ranj063 ranj063 left a comment

Choose a reason for hiding this comment

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

im OK to merge this to unblock certain tests. We can work on beautifying it later

@ranj063
Copy link
Collaborator

ranj063 commented Apr 4, 2023

@lgirdwood @kv2019i lets not merge this one just yet. I have alternative PRs for this

@sys-pt1s
Copy link

sys-pt1s commented Apr 6, 2023

Can one of the admins verify this patch?

@kv2019i
Copy link
Collaborator

kv2019i commented Apr 24, 2023

@juimonen @ranj063 Close this one as a different solution got merged...?

@juimonen juimonen closed this Apr 24, 2023
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.

6 participants