-
Notifications
You must be signed in to change notification settings - Fork 133
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
Ssp common module - codec type detection #4536
Ssp common module - codec type detection #4536
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.
The idea of removing codec quirks is good, but I think you went too far in the refactoring of codec @brentlu
#include <sound/soc-acpi.h> | ||
#include "sof_cirrus_common.h" | ||
#include "sof_maxim_common.h" | ||
#include "sof_realtek_common.h" |
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.
do we really need to include all these vendor-specific headers? That sounds like a partitioning of code that's not quite right?
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.
The ACPI HID of amplifiers are defined in sof_vendor_common.h so those headers are included here.
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.
comment is still valid, I think you just need to include sof_vendor_common.h ?
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.
I mean the sof_cirrus_common.h, sof_maxim_common.h, and sof_realtek_common.h. Unless we define the HID definition in sof_ssp_common.h and leave those file untouched.
5407b35
to
6d7ddfc
Compare
Upload new patchset to support codec detection only |
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.
I only have minor comments below @brentlu but that PR is moving in the right direction. Removing these quirks is a good thing (tm), thanks for suggesting it.
@bardliao @RanderWang please review if you have spare cycles
#include <sound/soc-acpi.h> | ||
#include "sof_cirrus_common.h" | ||
#include "sof_maxim_common.h" | ||
#include "sof_realtek_common.h" |
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.
comment is still valid, I think you just need to include sof_vendor_common.h ?
6d7ddfc
to
627fd64
Compare
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 @brentlu. A question about removing SOF_RT5682_SSP_AMP(1). Is it intentional?
sound/soc/intel/boards/sof_rt5682.c
Outdated
/* no codec conf required */ | ||
break; | ||
case CODEC_MAX98360A: | ||
/* no codec conf required */ |
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.
nitpick: We can group all those codecs together as
case CODEC_MAX98357A:
case CODEC_MAX98360A:
case CODEC_RT1019P:
case CODEC_RT5650:
/* no codec conf required */
break;
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, agree with @bardliao let's have a common block here.
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.
done
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.
Almost good @brentlu, I added two comments below. One more round and we should be good to go.
sound/soc/intel/boards/sof_rt5682.c
Outdated
/* no codec conf required */ | ||
break; | ||
case CODEC_MAX98360A: | ||
/* no codec conf required */ |
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, agree with @bardliao let's have a common block here.
627fd64
to
0df1f57
Compare
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.
one more cosmetic comment from me, thanks @brentlu
0df1f57
to
45bdd38
Compare
#define RT5682S_ACPI_HID "RTL5682" | ||
|
||
enum sof_ssp_codec { | ||
CODEC_NONE = 0, |
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.
is the = 0 really important?
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.
According to the bible, "if no enumerators with = appear, then the values of the corresponding constants begin at 0 and increase by 1 as the declaration is read from left to right". So I think you are right, the = 0 here is more than a habit. Will remove it.
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, nice cleanup @brentlu
45bdd38
to
a052bb3
Compare
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.
good work! it can be better.
* Codec probe function | ||
*/ | ||
#define CODEC_MAP_ENTRY(n, h, t) \ | ||
{ \ |
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.
align the \
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.
fixed
sound/soc/intel/boards/sof_nau8825.c
Outdated
if (!dai_links) | ||
return -ENOMEM; | ||
|
||
sof_audio_card_nau8825.dai_link = dai_links; | ||
|
||
/* update codec_conf */ | ||
if (ctx->amp_type != CODEC_NONE) { |
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.
why not remove this if and use it like
switch (ctx->amp_type) {
...
case CODEC_NONE:
break;
default:
...
}
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.
fixed
sound/soc/intel/boards/sof_ssp_amp.c
Outdated
if (!dai_links) | ||
return -ENOMEM; | ||
|
||
sof_ssp_amp_card.dai_link = dai_links; | ||
|
||
/* update codec_conf */ | ||
if (sof_ssp_amp_quirk & SOF_CS35L41_SPEAKER_AMP_PRESENT) { | ||
cs35l41_set_codec_conf(&sof_ssp_amp_card); | ||
if (ctx->amp_type != CODEC_NONE) { |
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.
convert this if to case
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.
fixed
a052bb3
to
ef53db3
Compare
Create a new common module to host functions which could be shared among SSP machine drivers. Add functions to detect headphone codec and speaker amplifier via ACPI system at runtime in order to remove codec type quirks in machine drivers. Signed-off-by: Brent Lu <[email protected]>
Use ACPI HID definition in ssp-common header for device name macros. No functional change here. Signed-off-by: Brent Lu <[email protected]>
Use ssp-common module to detect codec and amplifier type in driver probe function and remove all quirks about codec and amplifier type. Due to codec detection feature, we could remove HP Dooly's DMI quirk safely. Signed-off-by: Brent Lu <[email protected]>
Use ssp-common module to detect codec and amplifier type in driver probe function and remove all quirks about codec and amplifier type. Signed-off-by: Brent Lu <[email protected]>
Use ssp-common module to detect codec and amplifier type in driver probe function and remove all quirks about codec and amplifier type. Signed-off-by: Brent Lu <[email protected]>
Use ssp-common module to detect codec and amplifier type in driver probe function and remove all quirks about codec and amplifier type. Signed-off-by: Brent Lu <[email protected]>
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
Could we merge this PR? Thanks. |
merging but we'll send this upstream after the merge window closes in two weeks. |
Create an new common module to host functionalities for all ssp machine drivers:
Machine drivers sof_rt5682, sof_cs42l42, and sof_ssp_amp are tested on ADL Chromebooks. Check headphone playback/capture, speaker playback, DMIC capture, and HDMI playback function.
Brya
[ 5.941973] sof_rt5682 adl_mx98360_rt5682: codec RT5682 found
[ 5.941986] sof_rt5682 adl_mx98360_rt5682: amp MAX98360A found
[ 5.941988] sof_rt5682 adl_mx98360_rt5682: create dai links, link_order 0x7654321
[ 5.941989] sof_rt5682 adl_mx98360_rt5682: link 0: codec RT5682, ssp 0
[ 5.941990] sof_rt5682 adl_mx98360_rt5682: link 1: dmic01
[ 5.941991] sof_rt5682 adl_mx98360_rt5682: link 2: dmic16k
[ 5.941991] sof_rt5682 adl_mx98360_rt5682: link 3: intel hdmi, hdmi id 1
[ 5.941992] sof_rt5682 adl_mx98360_rt5682: link 4: intel hdmi, hdmi id 2
[ 5.941993] sof_rt5682 adl_mx98360_rt5682: link 5: intel hdmi, hdmi id 3
[ 5.941994] sof_rt5682 adl_mx98360_rt5682: link 6: intel hdmi, hdmi id 4
[ 5.941995] sof_rt5682 adl_mx98360_rt5682: link 7: amp MAX98360A, ssp 1
[ 5.941996] sof_rt5682 adl_mx98360_rt5682: link 8: bt, ssp 2
Vell
[ 6.475233] sof_ssp_amp adl_cs35l41: amp CS35L41 found
[ 6.475240] sof_ssp_amp adl_cs35l41: create dai links, link_order 0x643257
[ 6.475243] sof_ssp_amp adl_cs35l41: link 0: amp CS35L41, ssp 1
[ 6.475265] sof_ssp_amp adl_cs35l41: link 1: dmic01
[ 6.475266] sof_ssp_amp adl_cs35l41: link 2: dmic16k
[ 6.475268] sof_ssp_amp adl_cs35l41: link 3: intel hdmi, hdmi id 1
[ 6.475270] sof_ssp_amp adl_cs35l41: link 4: intel hdmi, hdmi id 2
[ 6.475272] sof_ssp_amp adl_cs35l41: link 5: intel hdmi, hdmi id 3
[ 6.475274] sof_ssp_amp adl_cs35l41: link 6: intel hdmi, hdmi id 4
[ 6.475276] sof_ssp_amp adl_cs35l41: link 7: bt, ssp 2
Crota
[ 7.727384] sof_cs42l42 adl_mx98360a_cs4242: codec CS42L42 found
[ 7.727414] sof_cs42l42 adl_mx98360a_cs4242: amp MAX98360A found
[ 7.727416] sof_cs42l42 adl_mx98360a_cs4242: create dai links, link_order 0x7654321
[ 7.727418] sof_cs42l42 adl_mx98360a_cs4242: link 0: codec CS42L42, ssp 0
[ 7.727420] sof_cs42l42 adl_mx98360a_cs4242: link 1: dmic01
[ 7.727421] sof_cs42l42 adl_mx98360a_cs4242: link 2: dmic16k
[ 7.727422] sof_cs42l42 adl_mx98360a_cs4242: link 3: intel hdmi, hdmi id 1
[ 7.727424] sof_cs42l42 adl_mx98360a_cs4242: link 4: intel hdmi, hdmi id 2
[ 7.727426] sof_cs42l42 adl_mx98360a_cs4242: link 5: intel hdmi, hdmi id 3
[ 7.727428] sof_cs42l42 adl_mx98360a_cs4242: link 6: intel hdmi, hdmi id 4
[ 7.727430] sof_cs42l42 adl_mx98360a_cs4242: link 7: amp MAX98360A, ssp 1
[ 7.727434] sof_cs42l42 adl_mx98360a_cs4242: link 8: bt, ssp 2