sound/soc/sof/ops.h

Source file repositories/reference/linux-study-clean/sound/soc/sof/ops.h

File Facts

System
Linux kernel
Corpus path
sound/soc/sof/ops.h
Extension
.h
Size
17135 bytes
Lines
660
Domain
Driver Families
Bucket
sound/soc
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

if (sdev->dsp_core_ref_count[core] > 0) {
			sdev->dsp_core_ref_count[core]++;
			return 0;
		}

		/* power up the core */
		ret = sof_ops(sdev)->core_get(sdev, core);
		if (ret < 0)
			return ret;

		/* increment ref_count */
		sdev->dsp_core_ref_count[core]++;

		/* and update enabled_cores_mask */
		sdev->enabled_cores_mask |= BIT(core);

		dev_dbg(sdev->dev, "Core %d powered up\n", core);
	}

	return 0;
}

static inline int snd_sof_dsp_core_put(struct snd_sof_dev *sdev, int core)
{
	if (core > sdev->num_cores - 1) {
		dev_err(sdev->dev, "invalid core id: %d for num_cores: %d\n", core,
			sdev->num_cores);
		return -EINVAL;
	}

	if (sof_ops(sdev)->core_put) {
		int ret;

		/* decrement ref_count and return if it is > 0 */
		if (--(sdev->dsp_core_ref_count[core]) > 0)
			return 0;

		/* power down the core */
		ret = sof_ops(sdev)->core_put(sdev, core);
		if (ret < 0)
			return ret;

		/* and update enabled_cores_mask */
		sdev->enabled_cores_mask &= ~BIT(core);

		dev_dbg(sdev->dev, "Core %d powered down\n", core);
	}

	return 0;
}

/* pre/post fw load */
static inline int snd_sof_dsp_pre_fw_run(struct snd_sof_dev *sdev)
{
	if (sof_ops(sdev)->pre_fw_run)
		return sof_ops(sdev)->pre_fw_run(sdev);

	return 0;
}

static inline int snd_sof_dsp_post_fw_run(struct snd_sof_dev *sdev)
{
	if (sof_ops(sdev)->post_fw_run)
		return sof_ops(sdev)->post_fw_run(sdev);

	return 0;
}

/* parse platform specific extended manifest */
static inline int snd_sof_dsp_parse_platform_ext_manifest(struct snd_sof_dev *sdev,
							  const struct sof_ext_man_elem_header *hdr)
{
	if (sof_ops(sdev)->parse_platform_ext_manifest)
		return sof_ops(sdev)->parse_platform_ext_manifest(sdev, hdr);

	return 0;
}

/* misc */

/**
 * snd_sof_dsp_get_bar_index - Maps a section type with a BAR index
 *
 * @sdev: sof device
 * @type: section type as described by snd_sof_fw_blk_type
 *
 * Returns the corresponding BAR index (a positive integer) or -EINVAL
 * in case there is no mapping
 */
static inline int snd_sof_dsp_get_bar_index(struct snd_sof_dev *sdev, u32 type)

Annotation

Implementation Notes