Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 34 additions & 1 deletion sound/soc/intel/boards/sof_sdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
#include <linux/soundwire/sdw_intel.h>
#include <sound/core.h>
#include <sound/soc-acpi.h>

#include "sof_sdw_common.h"
#include "../../codecs/rt711.h"
#include "../../sof/intel/hda.h"

static unsigned long sof_sdw_quirk = RT711_JD1;
static int quirk_override = -1;
Expand Down Expand Up @@ -776,6 +778,17 @@ static const struct dmi_system_id sof_sdw_quirk_table[] = {
},
.driver_data = (void *)(SOC_SDW_PCH_DMIC),
},
{
.callback = sof_sdw_quirk_cb,
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Google"),
DMI_MATCH(DMI_PRODUCT_NAME, "Francka"),
},
.driver_data = (void *)(SOC_SDW_CODEC_SPKR |
SOC_SDW_PCH_DMIC |
SOF_BT_OFFLOAD_SSP(2) |
SOF_SSP_BT_OFFLOAD_PRESENT),
},
{
.callback = sof_sdw_quirk_cb,
.matches = {
Expand Down Expand Up @@ -1132,8 +1145,28 @@ static int create_bt_dailinks(struct snd_soc_card *card,
struct snd_soc_dai_link **dai_links, int *be_id)
{
struct device *dev = card->dev;
int port = (sof_sdw_quirk & SOF_BT_OFFLOAD_SSP_MASK) >>
struct snd_soc_acpi_mach *mach = dev_get_platdata(dev);
const struct sof_intel_dsp_desc *chip = get_chip_info(snd_soc_card_get_drvdata(card));
int port;

if (!mach || !chip)
return -EINVAL;

port = (sof_sdw_quirk & SOF_BT_OFFLOAD_SSP_MASK) >>
SOF_BT_OFFLOAD_SSP_SHIFT;

/* Use the bt_link_mask from module parameters if provided
* and if the SoC hardware IP version is ACE4 or newer.
* This allows platform data to override which SSP is used
* for Bluetooth offload.
*/
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

sof_sdw_quirk could also from module parameter. Not sure which one should have higher priority.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Even when the sof_sdw_quirk override is used alone or together with bt_link_mask, it is the bt_link_mask that ultimately determines which topology with the BT prefix is loaded.

if (mach->mach_params.bt_link_mask &&
chip->hw_ip_version >= SOF_INTEL_ACE_4_0) {
port = __ffs(mach->mach_params.bt_link_mask);
dev_info(dev, "BT: using bt_link_mask override, SSP%d selected (ACE4+)\n",
port);
}

char *name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d-BT", port);
char *cpu_dai_name = devm_kasprintf(dev, GFP_KERNEL, "SSP%d Pin", port);
if (!name || !cpu_dai_name)
Expand Down
6 changes: 3 additions & 3 deletions sound/soc/intel/boards/sof_sdw_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ enum {
#define SOC_SDW_NO_AGGREGATION BIT(14)

/* BT audio offload: reserve 3 bits for future */
#define SOF_BT_OFFLOAD_SSP_SHIFT 15
#define SOF_BT_OFFLOAD_SSP_MASK (GENMASK(17, 15))
#define SOF_BT_OFFLOAD_SSP_SHIFT 18
#define SOF_BT_OFFLOAD_SSP_MASK (GENMASK(20, 18))
#define SOF_BT_OFFLOAD_SSP(quirk) \
(((quirk) << SOF_BT_OFFLOAD_SSP_SHIFT) & SOF_BT_OFFLOAD_SSP_MASK)
#define SOF_SSP_BT_OFFLOAD_PRESENT BIT(18)
#define SOF_SSP_BT_OFFLOAD_PRESENT BIT(21)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Good catch. Not sure if it needs a fixup tag. Also, it will impact the devices that use module parameter to overwrite the quirk. @ujfalusi @kv2019i How should we handle it?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@kv2019i @ujfalusi , I added a PR to support bt_link_mask starting from ACE4+ based on @bardliao PR #5518, for your review.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think this is @bardliao ok as we have not upstreamed the BT offload quirk bits yet. All shipping devices (all chromebooks) have a hardcoded SSP port for BT, so I think this is ok change to make.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Ok update. So we have had the SOF_BT_OFFLOAD* defs in upstream for some time, and as all flags are exposed via the quirk module param, these have been available as module params as well.

So this is a bit iffy situation (created when common flags were moved to vendor neutral soc_sdw_utils.h).

There is a conflict, so we need to resolve this anyways. I think this PR is the right path. The BT_OFFLOAD bits have only been used in the DMI overrides and given this feature is not availble outside Chromebooks, there's no known usage of this by end-users (via module params). The SOC_SDW_CODEC_SPKR bit OTOH has seen a lot of use by actual users, so this we cannot change at this point.

So as a summary, I think the change in this PR is good. We do need to be very careful aligning soc_sdw_utils.h and this SOF specific file.


struct intel_mc_ctx {
struct sof_hdmi_private hdmi;
Expand Down
35 changes: 35 additions & 0 deletions sound/soc/intel/common/soc-acpi-intel-ptl-match.c
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,15 @@ static const struct snd_soc_acpi_adr_device rt1320_2_group2_adr[] = {
}
};

static const struct snd_soc_acpi_adr_device rt1320_2_group2_l_adr[] = {
{
.adr = 0x000230025D132001ull,
.num_endpoints = 1,
.endpoints = &spk_l_endpoint,
.name_prefix = "rt1320-1"
}
};

static const struct snd_soc_acpi_adr_device rt1320_3_group2_adr[] = {
{
.adr = 0x000330025D132001ull,
Expand Down Expand Up @@ -531,6 +540,25 @@ static const struct snd_soc_acpi_link_adr ptl_rt722_l3[] = {
{}
};

static const struct snd_soc_acpi_link_adr ptl_rt722_l0_rt1320_l23[] = {
{
.mask = BIT(0),
.num_adr = ARRAY_SIZE(rt722_0_single_adr),
.adr_d = rt722_0_single_adr,
},
{
.mask = BIT(2),
.num_adr = ARRAY_SIZE(rt1320_2_group2_l_adr),
.adr_d = rt1320_2_group2_l_adr,
},
{
.mask = BIT(3),
.num_adr = ARRAY_SIZE(rt1320_3_group2_adr),
.adr_d = rt1320_3_group2_adr,
},
{}
};

static const struct snd_soc_acpi_link_adr ptl_rvp[] = {
{
.mask = BIT(0),
Expand Down Expand Up @@ -669,6 +697,13 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_ptl_sdw_machines[] = {
.drv_name = "sof_sdw",
.sof_tplg_filename = "sof-ptl-cs42l43-l2-cs35l56x6-l13.tplg",
},
{
.link_mask = BIT(0) | BIT(2) | BIT(3),
.links = ptl_rt722_l0_rt1320_l23,
.drv_name = "sof_sdw",
.sof_tplg_filename = "sof-ptl-rt722-l0-rt1320-l23.tplg",
.get_function_tplg_files = sof_sdw_get_tplg_files,
},
{
.link_mask = BIT(1) | BIT(2),
.links = ptl_sdw_rt712_vb_l2_rt1320_l1,
Expand Down
Loading