Skip to content

Commit

Permalink
ASoC: SOF: mediatek: Add machine driver dsp ops for mt8195 platform
Browse files Browse the repository at this point in the history
Add dsp ops callback to select and register machine driver.

Signed-off-by: YC Hung <[email protected]>
  • Loading branch information
yaochunhung committed Aug 30, 2021
1 parent bc93b31 commit 5442374
Showing 1 changed file with 31 additions and 13 deletions.
44 changes: 31 additions & 13 deletions sound/soc/sof/mediatek/mt8195/mt8195.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,17 @@

static struct adsp_chip_info *adsp_info;

static struct snd_soc_acpi_mach sof_mt8195_mach = {
.id = "819501",
.drv_name = "mt8195_mt6359_rt1019_rt5682",
.sof_tplg_filename = "sof-mt8195-mt6359-rt1019-rt5682.tplg",
};

static void *get_adsp_chip_data(void)
{
return (void *)adsp_info;
}

void __iomem *get_adsp_reg_base(void)
{
struct adsp_chip_info *adsp;

adsp = get_adsp_chip_data();
if (!adsp)
return NULL;

return adsp->va_cfgreg;
}
EXPORT_SYMBOL(get_adsp_reg_base);

void __iomem *get_mbox_reg_base(u32 id)
{
struct adsp_chip_info *adsp;
Expand Down Expand Up @@ -345,6 +339,26 @@ static int mt8195_dsp_remove(struct snd_sof_dev *sdev)
return 0;
}

static void mt8195_machine_select(struct snd_sof_dev *sdev)
{
struct snd_sof_pdata *sof_pdata = sdev->pdata;
struct snd_soc_acpi_mach *mach;

mach = &sof_mt8195_mach;
if (!mach) {
dev_warn(sdev->dev, "warning: No matching ASoC machine driver found\n");
return;
}

sof_pdata->tplg_filename = mach->sof_tplg_filename;
sof_pdata->machine = mach;

/* get machine node and save it to mach->pdata */
mach->pdata = of_get_child_by_name(sdev->dev->of_node, "sound");
if (!mach->pdata)
dev_warn(sdev->dev, "warning: get child machine node \"sound\" failed\n");
}

/* mt8195 ops */
struct snd_sof_dsp_ops sof_mt8195_ops = {
/* probe and remove */
Expand All @@ -355,12 +369,16 @@ struct snd_sof_dsp_ops sof_mt8195_ops = {
.block_read = sof_block_read,
.block_write = sof_block_write,

/* Module IO */
/* Register IO */
.write = sof_io_write,
.read = sof_io_read,
.write64 = sof_io_write64,
.read64 = sof_io_read64,

/* machine driver */
.machine_select = mt8195_machine_select,
.machine_register = sof_machine_register,

/* Firmware ops */
.dsp_arch_ops = &sof_xtensa_arch_ops,
};
Expand Down

0 comments on commit 5442374

Please sign in to comment.