sound/soc/sdca/sdca_ump.c
Source file repositories/reference/linux-study-clean/sound/soc/sdca/sdca_ump.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/sdca/sdca_ump.c- Extension
.c- Size
- 8568 bytes
- Lines
- 263
- Domain
- Driver Families
- Bucket
- sound/soc
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/dev_printk.hlinux/device.hlinux/regmap.hsound/sdca.hsound/sdca_function.hsound/sdca_ump.hsound/soc-component.hlinux/soundwire/sdw_registers.h
Detected Declarations
function sdca_ump_get_owner_hostfunction sdca_ump_set_owner_devicefunction sdca_ump_get_owner_hostfunction sdca_ump_get_owner_hostfunction sdca_ump_cancel_timeoutfunction sdca_ump_schedule_timeout
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
// Copyright (C) 2025 Cirrus Logic, Inc. and
// Cirrus Logic International Semiconductor Ltd.
/*
* The MIPI SDCA specification is available for public downloads at
* https://www.mipi.org/mipi-sdca-v1-0-download
*/
#include <linux/dev_printk.h>
#include <linux/device.h>
#include <linux/regmap.h>
#include <sound/sdca.h>
#include <sound/sdca_function.h>
#include <sound/sdca_ump.h>
#include <sound/soc-component.h>
#include <linux/soundwire/sdw_registers.h>
/**
* sdca_ump_get_owner_host - check a UMP buffer is owned by the host
* @dev: Pointer to the struct device used for error messages.
* @function_regmap: Pointer to the regmap for the SDCA Function.
* @function: Pointer to the Function information.
* @entity: Pointer to the SDCA Entity.
* @control: Pointer to the SDCA Control for the UMP Owner.
*
* Return: Returns zero on success, and a negative error code on failure.
*/
int sdca_ump_get_owner_host(struct device *dev,
struct regmap *function_regmap,
struct sdca_function_data *function,
struct sdca_entity *entity,
struct sdca_control *control)
{
unsigned int reg, owner;
int ret;
reg = SDW_SDCA_CTL(function->desc->adr, entity->id, control->sel, 0);
ret = regmap_read(function_regmap, reg, &owner);
if (ret < 0) {
dev_err(dev, "%s: failed to read UMP owner: %d\n",
entity->label, ret);
return ret;
}
if (owner != SDCA_UMP_OWNER_HOST) {
dev_err(dev, "%s: host is not the UMP owner\n", entity->label);
return -EINVAL;
}
return 0;
}
EXPORT_SYMBOL_NS_GPL(sdca_ump_get_owner_host, "SND_SOC_SDCA");
/**
* sdca_ump_set_owner_device - set a UMP buffer's ownership back to the device
* @dev: Pointer to the struct device used for error messages.
* @function_regmap: Pointer to the regmap for the SDCA Function.
* @function: Pointer to the Function information.
* @entity: Pointer to the SDCA Entity.
* @control: Pointer to the SDCA Control for the UMP Owner.
*
* Return: Returns zero on success, and a negative error code on failure.
*/
int sdca_ump_set_owner_device(struct device *dev,
struct regmap *function_regmap,
struct sdca_function_data *function,
struct sdca_entity *entity,
struct sdca_control *control)
{
unsigned int reg;
int ret;
reg = SDW_SDCA_CTL(function->desc->adr, entity->id, control->sel, 0);
ret = regmap_write(function_regmap, reg, SDCA_UMP_OWNER_DEVICE);
if (ret < 0)
dev_err(dev, "%s: failed to write UMP owner: %d\n",
entity->label, ret);
return ret;
}
EXPORT_SYMBOL_NS_GPL(sdca_ump_set_owner_device, "SND_SOC_SDCA");
/**
* sdca_ump_read_message - read a UMP message from the device
* @dev: Pointer to the struct device used for error messages.
* @device_regmap: Pointer to the Device register map.
* @function_regmap: Pointer to the regmap for the SDCA Function.
* @function: Pointer to the Function information.
* @entity: Pointer to the SDCA Entity.
Annotation
- Immediate include surface: `linux/dev_printk.h`, `linux/device.h`, `linux/regmap.h`, `sound/sdca.h`, `sound/sdca_function.h`, `sound/sdca_ump.h`, `sound/soc-component.h`, `linux/soundwire/sdw_registers.h`.
- Detected declarations: `function sdca_ump_get_owner_host`, `function sdca_ump_set_owner_device`, `function sdca_ump_get_owner_host`, `function sdca_ump_get_owner_host`, `function sdca_ump_cancel_timeout`, `function sdca_ump_schedule_timeout`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: integration implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.