-
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
Support BT audio offload on HDA machines #5123
Conversation
@@ -150,6 +152,28 @@ static int skl_hda_fill_card_info(struct snd_soc_card *card, | |||
} | |||
} | |||
|
|||
if (!ctx->bt_offload_present) { | |||
/* remove last link since bt audio offload is not supported */ | |||
num_links--; |
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.
You define #define BT_DAI_COUNT 1
, INHO, it is better to use num_links -= BT_DAI_COUNT
in case BT_DAI_COUNT is changed one day.
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
d197f34
to
6960b82
Compare
include/sound/soc-acpi.h
Outdated
@@ -165,6 +167,12 @@ struct snd_soc_acpi_link_adr { | |||
*/ | |||
#define SND_SOC_ACPI_TPLG_INTEL_CODEC_NAME BIT(4) | |||
|
|||
/* | |||
* when set the BT offload name suffix '-bt' will be appended to topology file |
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 code appends -bt-ssp%d
tot he topology filename...
include/sound/soc-acpi.h
Outdated
* when set the BT offload name suffix '-bt' will be appended to topology file | ||
* name if the feature is implemented in ACPI NHLT table | ||
*/ | ||
#define SND_SOC_ACPI_TPLG_INTEL_BT_OFFLOAD BIT(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.
Do we have a documented rule on what order these appends should be done, I believe they must be always <bit(0)><bit(1)>...<bit(last)> ?
sound/soc/sof/intel/hda.c
Outdated
@@ -444,6 +444,10 @@ static int mclk_id_override = -1; | |||
module_param_named(mclk_id, mclk_id_override, int, 0444); | |||
MODULE_PARM_DESC(mclk_id, "SOF SSP mclk_id"); | |||
|
|||
static int bt_link_mask_override = 0x0; |
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.
No need to initialize to 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.
fixed
sound/soc/sof/intel/hda.c
Outdated
mach->mach_params.bt_link_mask = check_nhlt_ssp_mask(sdev, NHLT_DEVICE_BT); | ||
|
||
/* allow for module parameter override */ | ||
if (bt_link_mask_override != 0x00) { |
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.
if (!bt_link_mask_override) {
?
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/sof/intel/hda.c
Outdated
/* allow for module parameter override */ | ||
if (bt_link_mask_override != 0x00) { | ||
dev_dbg(sdev->dev, | ||
"overriding bt link mask detected in NHLT tables 0x%x by kernel param 0x%x\n", |
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.
New code should use %#x
for hexadecimal numbers.
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/sof/intel/hda.c
Outdated
if (ssp_mask) | ||
dev_info(sdev->dev, "NHLT_DEVICE_I2S detected, ssp_mask %#x\n", ssp_mask); | ||
dev_info(sdev->dev, "NHLT device %d detected, ssp_mask %#x\n", |
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 would be hard pressed to guess based on the number what device is detected..
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
@@ -132,6 +137,14 @@ struct snd_soc_dai_link skl_hda_be_dai_links[HDA_DSP_MAX_BE_DAI_LINKS] = { | |||
.no_pcm = 1, | |||
SND_SOC_DAILINK_REG(dmic16k, dmic_codec, platform), | |||
}, | |||
{ | |||
.name = "SSP%d-BT", |
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.
It is a novel way, but I would rather not set this string as initial name.
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
return -ENOMEM; | ||
|
||
bt_link->cpus->dai_name = devm_kasprintf(dev, GFP_KERNEL, | ||
bt_link->cpus->dai_name, |
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 dai_name comes from topology and in a form of a magic string also?
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 name is from here:
SND_SOC_DAILINK_DEF(bt_offload_pin,
DAILINK_COMP_ARRAY(COMP_CPU("SSP%d Pin")));
@@ -14,7 +14,8 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_hda_machines[] = { | |||
/* .id is not used in this file */ | |||
.drv_name = "skl_hda_dsp_generic", | |||
.sof_tplg_filename = "sof-hda-generic", /* the tplg suffix is added at run time */ | |||
.tplg_quirk_mask = SND_SOC_ACPI_TPLG_INTEL_DMIC_NUMBER, | |||
.tplg_quirk_mask = SND_SOC_ACPI_TPLG_INTEL_DMIC_NUMBER | | |||
SND_SOC_ACPI_TPLG_INTEL_BT_OFFLOAD, |
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.
and this is going to break a lot of system presumably since we don not have any -bt-ssp
topology out there..
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 removed all tplg name fixup code and let OSV to decide so we don't break all HDA PC...
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 removed all tplg name fixup code and let OSV to decide so we don't break all HDA PC...
The problem is that we don't know who the OSV is, and we don't know how to distribute the required topology. So while the changes look ok at a high-level, who's going to use all this?
I don't want to merge something that creates a headache for support teams. We don't have a plan that makes any sense at the moment.
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.
Sorry I should provide the background story instead of just shooting the patches.
Currently there is a Chrome reference design brox which enables HDA external codec. Since BT audio offload was enabled for I2S Chromebooks, we want this feature could be also supported for HDA Chromebooks as well.
For the kernel driver, we will backport these two patches to Chrome tree and update the module option since Chromebook does not support NHLT table. And for topology, we will backport the patch to cavs2.5 branch and request Google to release the topology.
146498b
to
5ed91b9
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.
Looks mostly good now @brentlu, that's an acceptable solution that allows for new functionality without breaking older setups. Thanks for taking this initiative.
.name = NULL, /* initialized in driver probe function */ | ||
.id = 8, | ||
.dpcm_playback = 1, | ||
.dpcm_capture = 1, |
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 forgot if those flags still exist or have been removed.
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.
not yet removed. still doing some cleanups
https://patchwork.kernel.org/project/alsa-devel/list/?series=874792
Add an new variable bt_link_mask to snd_soc_acpi_mach_params structure. SSP port mask of BT offload found in NHLT table will be sent to machine driver to setup BE dai link with correct SSP port number. This patch only detects and enables the BT dailink. The functionality will only be unlocked with a topology file that makes a reference to that BT dailink. For backwards-compatibility reasons, this topology will not be used by default. Chromebooks and Linux users willing to experiment shall use the tplg_name kernel parameter to force the use of an enhanced topology. Signed-off-by: Brent Lu <brent.lu@intel.com>
Add BT offload BE link to dai link array if the BT offload link mask is valid (only one bit set). Signed-off-by: Brent Lu <brent.lu@intel.com>
SOF platform driver walks through HNLT endpoints and looks for endpoint which device type is BT sideband (0). Once a BT sideband endpoint is found, the SSP port number will be used to compose link mask and passed to machine driver to create BE link for BT audio offload.