-
Notifications
You must be signed in to change notification settings - Fork 322
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
driver: imx: Add PDM MICFIL driver #8184
Conversation
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.
@dbaluta I guess this also needs to land in Zephyr at some point ?
Yes. Sometimes in Q1 2024. |
@iuliana-prodan good for you ? |
@LaurentiuM1234 good for you ? |
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.
Looks good!
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.
LGTM for most part
9d59c06
to
efa2cb7
Compare
@iuliana-prodan @kv2019i addressed all your comments. @lyakh @lgirdwood it looks like there are some problems with Intel build with zephyr. Care to have a look?
|
These are known about on the Zephyr side. IIUC, we are waiting on a Zephyr side fix. Not a blocker. |
|
||
switch (qsel) { | ||
case MICFIL_QSEL_HIGH_QUALITY: | ||
pdm_clk = rate * 8 * osr / 2; /* kfactor = 0.5 */ |
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.
this is identical to the case below (8 / 2 = 4).
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.
Yes, this has the same final value! But, I prefer to keep it that way to keep this in line with the documentation.
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.
Oh... This is very... strange. It's your area so it's up to you to decide, but... This looks very confusing to me. You have multiple switch
-case
entries for different quality values, you seem to have different formulae, ant comments specify different "kfactor" values, but the result is the same. At the very least I'd put a comment there, preferably I'd unify all the case
s and provide just one formula, and just explain in the comment how that matches the documentation
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.
Yes, this comes from this table:
and this formula
I will add more comments to better explain the code.
What we want is to compute the CLK_DIV value so that we proper setup the MICFIL registers.
since
CLKDIV = MICFIL_CLK_ROOT / ( 2 * K * PDM_CLK_RATE)
and since
K
and PDM_CLK_RATE
have different values for different clk rates we end up with equal values sometimes, but as I said I prefer to write the complete formulas for documentation purposes.
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.
yeah, an explanation would be good, because even with that table I don't understand: e.g. with high quality the formula in the table seems to be
pdm_clk = rate * 8 * osr;
whereas you use
pdm_clk = rate * 8 * osr / 2;
CONFIG_SDMA_SCRIPT_CODE is always defined (even if not selected it defaults to empty string) so this is not a good way of including sdma script code header file. Make use of HAVE_SDMA_FIRMWARE boolean config in order to select the sdma script code header. Signed-off-by: Daniel Baluta <[email protected]>
The Pulse Density Modulated Microphone Interface (MICFIL) is a popular way to deliver audio from microphones to the processor in several applications, such as mobile telephones. However, current digital-audio systems use multibit audio signal (also known as multibit PCM) to represent the signal. This block implements the required digital interface to provide a 24-bits audio signal from a PDM microphone bitstream in a configurable output sampling rate. This patch adds initial support for PDM MICFIL IP found on i.MX8MP board. Signed-off-by: Daniel Baluta <[email protected]>
@lyakh all your comments should be addressed now |
What about #8184 (comment) - you're sure the calculations in the code are correct? I cannot see how they match the table that you provided |
The computation should be correct. Note that as specified in the comments the function |
I still would redo that switch-case statement: either it's wrong and should be fixed, or it's correct then I wouldn't use 3 different looking formulae producing the same result. But I cannot check correctness since I'm not working with this hardware and style is eventually subjective.
Feel free @dbaluta to merge |
It seems kernel side changes not merged yet. We are going to upstream few patches on SOF side adding new DAI configuration for AMD platforms. Could you please push kernel side changes? |
@vijendarmukunda you are right, we are now in the middle of an internal release. Is it OK for you to delay this until next week? |
@dbaluta : Sounds Okay. We will wait. |
@vijendarmukunda sent PR for review: thesofproject/linux#4670 |
The Pulse Density Modulated Microphone Interface (MICFIL) is a popular way to deliver audio from microphones to the processor in several applications, such as mobile telephones. However, current digital-audio systems use multibit audio signal (also known as multibit PCM) to represent the signal. This block implements the required digital interface to provide a 24-bits audio signal from a PDM microphone bitstream in a configurable output sampling rate.
This patch adds initial support for PDM MICFIL IP found on i.MX8MP board.
Follow PRs will add: