sound/soc/sof/ops.c
Source file repositories/reference/linux-study-clean/sound/soc/sof/ops.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/sof/ops.c- Extension
.c- Size
- 4490 bytes
- Lines
- 168
- 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/pci.hops.h
Detected Declarations
function snd_sof_pci_update_bits_unlockedfunction snd_sof_pci_update_bitsfunction snd_sof_dsp_update_bits_unlockedfunction snd_sof_dsp_update_bits64_unlockedfunction snd_sof_dsp_update_bitsfunction snd_sof_dsp_update_bits64function snd_sof_dsp_update_bits_forced_unlockedfunction snd_sof_dsp_update_bits_forcedfunction snd_sof_dsp_panicexport snd_sof_pci_update_bitsexport snd_sof_dsp_update_bits_unlockedexport snd_sof_dsp_update_bits64_unlockedexport snd_sof_dsp_update_bitsexport snd_sof_dsp_update_bits64export snd_sof_dsp_update_bits_forcedexport snd_sof_dsp_panic
Annotated Snippet
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
//
// This file is provided under a dual BSD/GPLv2 license. When using or
// redistributing this file, you may do so under either license.
//
// Copyright(c) 2018 Intel Corporation
//
// Author: Liam Girdwood <liam.r.girdwood@linux.intel.com>
//
#include <linux/pci.h>
#include "ops.h"
static
bool snd_sof_pci_update_bits_unlocked(struct snd_sof_dev *sdev, u32 offset,
u32 mask, u32 value)
{
struct pci_dev *pci = to_pci_dev(sdev->dev);
unsigned int old, new;
u32 ret = 0;
pci_read_config_dword(pci, offset, &ret);
old = ret;
dev_dbg(sdev->dev, "Debug PCIR: %8.8x at %8.8x\n", old & mask, offset);
new = (old & ~mask) | (value & mask);
if (old == new)
return false;
pci_write_config_dword(pci, offset, new);
dev_dbg(sdev->dev, "Debug PCIW: %8.8x at %8.8x\n", value,
offset);
return true;
}
bool snd_sof_pci_update_bits(struct snd_sof_dev *sdev, u32 offset,
u32 mask, u32 value)
{
guard(spinlock_irqsave)(&sdev->hw_lock);
return snd_sof_pci_update_bits_unlocked(sdev, offset, mask, value);
}
EXPORT_SYMBOL(snd_sof_pci_update_bits);
bool snd_sof_dsp_update_bits_unlocked(struct snd_sof_dev *sdev, u32 bar,
u32 offset, u32 mask, u32 value)
{
unsigned int old, new;
u32 ret;
ret = snd_sof_dsp_read(sdev, bar, offset);
old = ret;
new = (old & ~mask) | (value & mask);
if (old == new)
return false;
snd_sof_dsp_write(sdev, bar, offset, new);
return true;
}
EXPORT_SYMBOL(snd_sof_dsp_update_bits_unlocked);
bool snd_sof_dsp_update_bits64_unlocked(struct snd_sof_dev *sdev, u32 bar,
u32 offset, u64 mask, u64 value)
{
u64 old, new;
old = snd_sof_dsp_read64(sdev, bar, offset);
new = (old & ~mask) | (value & mask);
if (old == new)
return false;
snd_sof_dsp_write64(sdev, bar, offset, new);
return true;
}
EXPORT_SYMBOL(snd_sof_dsp_update_bits64_unlocked);
/* This is for registers bits with attribute RWC */
bool snd_sof_dsp_update_bits(struct snd_sof_dev *sdev, u32 bar, u32 offset,
u32 mask, u32 value)
{
guard(spinlock_irqsave)(&sdev->hw_lock);
return snd_sof_dsp_update_bits_unlocked(sdev, bar, offset, mask, value);
}
Annotation
- Immediate include surface: `linux/pci.h`, `ops.h`.
- Detected declarations: `function snd_sof_pci_update_bits_unlocked`, `function snd_sof_pci_update_bits`, `function snd_sof_dsp_update_bits_unlocked`, `function snd_sof_dsp_update_bits64_unlocked`, `function snd_sof_dsp_update_bits`, `function snd_sof_dsp_update_bits64`, `function snd_sof_dsp_update_bits_forced_unlocked`, `function snd_sof_dsp_update_bits_forced`, `function snd_sof_dsp_panic`, `export snd_sof_pci_update_bits`.
- 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.