Skip to content

Commit 5931a30

Browse files
bardliaoplbossart
authored andcommitted
ASoC: SOF: move ops to sof_dev_desc
snd_sof_dsp_ops and sof_arch_ops are hardware specific stuff, so move them from snd_sof_dev to sof_dev_desc. Signed-off-by: Bard liao <yung-chuan.liao@linux.intel.com>
1 parent 04fff95 commit 5931a30

File tree

21 files changed

+139
-158
lines changed

21 files changed

+139
-158
lines changed

include/sound/sof.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ struct sof_dev_desc {
7070
/* defaults for no codec mode */
7171
const char *nocodec_fw_filename;
7272
const char *nocodec_tplg_filename;
73+
74+
const struct snd_sof_dsp_ops *ops;
75+
const struct sof_arch_ops *arch_ops;
7376
};
7477

7578
int sof_nocodec_setup(struct device *dev,

sound/soc/sof/core.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,6 @@ static int sof_probe(struct platform_device *pdev)
245245
sdev->parent = plat_data->dev;
246246
if dev_is_pci(plat_data->dev)
247247
sdev->pci = to_pci_dev(plat_data->dev);
248-
sdev->ops = plat_data->machine->pdata;
249248

250249
sdev->pdata = plat_data;
251250
sdev->first_boot = true;
@@ -326,9 +325,9 @@ static int sof_probe(struct platform_device *pdev)
326325
sdev->first_boot = false;
327326

328327
/* now register audio DSP platform driver and dai */
329-
ret = snd_soc_register_component(&pdev->dev, &sdev->plat_drv,
330-
sdev->ops->drv,
331-
sdev->ops->num_drv);
328+
ret = snd_soc_register_component(&pdev->dev, &sdev->plat_drv,
329+
sof_ops(sdev)->drv,
330+
sof_ops(sdev)->num_drv);
332331
if (ret < 0) {
333332
dev_err(sdev->dev,
334333
"error: failed to register DSP DAI driver %d\n", ret);

sound/soc/sof/debug.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <linux/io.h>
1616
#include <linux/pm_runtime.h>
1717
#include "sof-priv.h"
18+
#include "ops.h"
1819

1920
static ssize_t sof_dfsentry_read(struct file *file, char __user *buffer,
2021
size_t count, loff_t *ppos)
@@ -139,7 +140,7 @@ EXPORT_SYMBOL(snd_sof_debugfs_buf_create_item);
139140

140141
int snd_sof_dbg_init(struct snd_sof_dev *sdev)
141142
{
142-
const struct snd_sof_dsp_ops *ops = sdev->ops;
143+
const struct snd_sof_dsp_ops *ops = sof_ops(sdev);
143144
const struct snd_sof_debugfs_map *map;
144145
int err = 0, i;
145146

sound/soc/sof/hw-spi.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,6 @@ EXPORT_SYMBOL(snd_sof_spi_ops);
320320
const struct sof_intel_dsp_desc spi_chip_info = {
321321
.cores_num = 2,
322322
.cores_mask = 0x3,
323-
.ops = &snd_sof_spi_ops,
324323
};
325324
EXPORT_SYMBOL(spi_chip_info);
326325

sound/soc/sof/intel/apl.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,5 @@ const struct sof_intel_dsp_desc apl_chip_info = {
107107
.ipc_ack = HDA_DSP_REG_HIPCIE,
108108
.ipc_ack_mask = HDA_DSP_REG_HIPCIE_DONE,
109109
.ipc_ctl = HDA_DSP_REG_HIPCCTL,
110-
.ops = &sof_apl_ops,
111110
};
112111
EXPORT_SYMBOL(apl_chip_info);

sound/soc/sof/intel/bdw.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -537,9 +537,6 @@ static int bdw_probe(struct snd_sof_dev *sdev)
537537
u32 base, size;
538538
int ret = 0;
539539

540-
/* set DSP arch ops */
541-
sdev->arch_ops = &sof_xtensa_arch_ops;
542-
543540
/* LPE base */
544541
mmio = platform_get_resource(pdev, IORESOURCE_MEM,
545542
desc->resindex_lpe_base);
@@ -700,7 +697,6 @@ EXPORT_SYMBOL(sof_bdw_ops);
700697
const struct sof_intel_dsp_desc bdw_chip_info = {
701698
.cores_num = 1,
702699
.cores_mask = 1,
703-
.ops = &sof_bdw_ops,
704700
};
705701
EXPORT_SYMBOL(bdw_chip_info);
706702

sound/soc/sof/intel/byt.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,6 @@ EXPORT_SYMBOL(sof_tng_ops);
639639
const struct sof_intel_dsp_desc tng_chip_info = {
640640
.cores_num = 1,
641641
.cores_mask = 1,
642-
.ops = &sof_tng_ops,
643642
};
644643
EXPORT_SYMBOL(tng_chip_info);
645644

@@ -657,9 +656,6 @@ static int byt_acpi_probe(struct snd_sof_dev *sdev)
657656
u32 base, size;
658657
int ret = 0;
659658

660-
/* set DSP arch ops */
661-
sdev->arch_ops = &sof_xtensa_arch_ops;
662-
663659
/* DSP DMA can only access low 31 bits of host memory */
664660
ret = dma_coerce_mask_and_coherent(sdev->dev, DMA_BIT_MASK(31));
665661
if (ret < 0) {
@@ -808,7 +804,6 @@ EXPORT_SYMBOL(sof_byt_ops);
808804
const struct sof_intel_dsp_desc byt_chip_info = {
809805
.cores_num = 1,
810806
.cores_mask = 1,
811-
.ops = &sof_byt_ops,
812807
};
813808
EXPORT_SYMBOL(byt_chip_info);
814809

@@ -867,7 +862,6 @@ EXPORT_SYMBOL(sof_cht_ops);
867862
const struct sof_intel_dsp_desc cht_chip_info = {
868863
.cores_num = 1,
869864
.cores_mask = 1,
870-
.ops = &sof_cht_ops,
871865
};
872866
EXPORT_SYMBOL(cht_chip_info);
873867

sound/soc/sof/intel/cnl.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,5 @@ const struct sof_intel_dsp_desc cnl_chip_info = {
259259
.ipc_ack = CNL_DSP_REG_HIPCIDA,
260260
.ipc_ack_mask = CNL_DSP_REG_HIPCIDA_DONE,
261261
.ipc_ctl = CNL_DSP_REG_HIPCCTL,
262-
.ops = &sof_cnl_ops,
263262
};
264263
EXPORT_SYMBOL(cnl_chip_info);

sound/soc/sof/intel/hda.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -332,9 +332,6 @@ int hda_dsp_probe(struct snd_sof_dev *sdev)
332332
}
333333
dev_info(sdev->dev, "DSP detected with PCI class/subclass/prog-if 0x%06x\n", pci->class);
334334

335-
/* set DSP arch ops */
336-
sdev->arch_ops = &sof_xtensa_arch_ops;
337-
338335
chip = get_chip_info(sdev->pdata);
339336
if (!chip) {
340337
dev_err(sdev->dev, "error: no such device supported, chip id:%x\n",
@@ -364,7 +361,7 @@ int hda_dsp_probe(struct snd_sof_dev *sdev)
364361
#if IS_ENABLED(CONFIG_SND_SOC_SOF_DEBUG_FORCE_IPC_POSITION)
365362
hdev->no_ipc_position = 0;
366363
#else
367-
hdev->no_ipc_position = sdev->ops->pcm_pointer ? 1 : 0;
364+
hdev->no_ipc_position = sof_ops(sdev)->pcm_pointer ? 1 : 0;
368365
#endif
369366

370367
/* set up HDA base */
@@ -442,7 +439,7 @@ int hda_dsp_probe(struct snd_sof_dev *sdev)
442439

443440
dev_dbg(sdev->dev, "using IPC IRQ %d\n", sdev->ipc_irq);
444441
ret = request_threaded_irq(sdev->ipc_irq, hda_dsp_ipc_irq_handler,
445-
chip->ops->irq_thread, IRQF_SHARED,
442+
sof_ops(sdev)->irq_thread, IRQF_SHARED,
446443
"AudioDSP", sdev);
447444
if (ret < 0) {
448445
dev_err(sdev->dev, "error: failed to register IPC IRQ %d\n",

sound/soc/sof/intel/hsw.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -537,9 +537,6 @@ static int hsw_probe(struct snd_sof_dev *sdev)
537537
u32 base, size;
538538
int ret = 0;
539539

540-
/* set DSP arch ops */
541-
sdev->arch_ops = &sof_xtensa_arch_ops;
542-
543540
/* LPE base */
544541
mmio = platform_get_resource(pdev, IORESOURCE_MEM,
545542
desc->resindex_lpe_base);
@@ -701,7 +698,6 @@ EXPORT_SYMBOL(sof_hsw_ops);
701698
const struct sof_intel_dsp_desc hsw_chip_info = {
702699
.cores_num = 1,
703700
.cores_mask = 1,
704-
.ops = &sof_hsw_ops,
705701
};
706702
EXPORT_SYMBOL(hsw_chip_info);
707703

0 commit comments

Comments
 (0)