sound/soc/codecs/tas2781-comlib.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/tas2781-comlib.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/tas2781-comlib.c- Extension
.c- Size
- 4793 bytes
- Lines
- 222
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/crc8.hlinux/dev_printk.hlinux/firmware.hlinux/gpio/consumer.hlinux/init.hlinux/interrupt.hlinux/module.hlinux/of.hlinux/of_irq.hlinux/regmap.hlinux/slab.hsound/tas2781.h
Detected Declarations
function tasdevice_dev_readfunction tasdevice_dev_bulk_readfunction tasdevice_dev_writefunction tasdevice_dev_bulk_writefunction tasdev_dsp_prog_blk_removefunction tasdev_dsp_prog_removefunction tasdev_dsp_cfg_blk_removefunction tasdev_dsp_cfg_removefunction tasdevice_dsp_removefunction tasdevice_removeexport tasdevice_dev_readexport tasdevice_dev_bulk_readexport tasdevice_dev_writeexport tasdevice_dev_bulk_writeexport tasdevice_dsp_removeexport tasdevice_remove
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
//
// TAS2563/TAS2781 Common functions for HDA and ASoC Audio drivers
//
// Copyright 2023 - 2025 Texas Instruments, Inc.
//
// Author: Shenghao Ding <shenghao-ding@ti.com>
#include <linux/crc8.h>
#include <linux/dev_printk.h>
#include <linux/firmware.h>
#include <linux/gpio/consumer.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_irq.h>
#include <linux/regmap.h>
#include <linux/slab.h>
#include <sound/tas2781.h>
int tasdevice_dev_read(struct tasdevice_priv *tas_priv,
unsigned short chn, unsigned int reg, unsigned int *val)
{
int ret = 0;
if (chn < tas_priv->ndev) {
struct regmap *map = tas_priv->regmap;
ret = tas_priv->change_chn_book(tas_priv, chn,
TASDEVICE_BOOK_ID(reg));
if (ret < 0)
goto out;
ret = regmap_read(map, TASDEVICE_PGRG(reg), val);
if (ret < 0)
dev_err(tas_priv->dev, "%s, E=%d\n", __func__, ret);
} else {
ret = -EINVAL;
dev_err(tas_priv->dev, "%s, no such channel(%d)\n", __func__,
chn);
}
out:
return ret;
}
EXPORT_SYMBOL_GPL(tasdevice_dev_read);
int tasdevice_dev_bulk_read(struct tasdevice_priv *tas_priv,
unsigned short chn, unsigned int reg, unsigned char *data,
unsigned int len)
{
int ret = 0;
if (chn < tas_priv->ndev) {
struct regmap *map = tas_priv->regmap;
ret = tas_priv->change_chn_book(tas_priv, chn,
TASDEVICE_BOOK_ID(reg));
if (ret < 0)
goto out;
ret = regmap_bulk_read(map, TASDEVICE_PGRG(reg), data, len);
if (ret < 0)
dev_err(tas_priv->dev, "%s, E=%d\n", __func__, ret);
} else
dev_err(tas_priv->dev, "%s, no such channel(%d)\n", __func__,
chn);
out:
return ret;
}
EXPORT_SYMBOL_GPL(tasdevice_dev_bulk_read);
int tasdevice_dev_write(struct tasdevice_priv *tas_priv,
unsigned short chn, unsigned int reg, unsigned int value)
{
int ret = 0;
if (chn < tas_priv->ndev) {
struct regmap *map = tas_priv->regmap;
ret = tas_priv->change_chn_book(tas_priv, chn,
TASDEVICE_BOOK_ID(reg));
if (ret < 0)
goto out;
ret = regmap_write(map, TASDEVICE_PGRG(reg),
value);
if (ret < 0)
Annotation
- Immediate include surface: `linux/crc8.h`, `linux/dev_printk.h`, `linux/firmware.h`, `linux/gpio/consumer.h`, `linux/init.h`, `linux/interrupt.h`, `linux/module.h`, `linux/of.h`.
- Detected declarations: `function tasdevice_dev_read`, `function tasdevice_dev_bulk_read`, `function tasdevice_dev_write`, `function tasdevice_dev_bulk_write`, `function tasdev_dsp_prog_blk_remove`, `function tasdev_dsp_prog_remove`, `function tasdev_dsp_cfg_blk_remove`, `function tasdev_dsp_cfg_remove`, `function tasdevice_dsp_remove`, `function tasdevice_remove`.
- 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.