sound/aoa/soundbus/i2sbus/control.c
Source file repositories/reference/linux-study-clean/sound/aoa/soundbus/i2sbus/control.c
File Facts
- System
- Linux kernel
- Corpus path
sound/aoa/soundbus/i2sbus/control.c- Extension
.c- Size
- 4551 bytes
- Lines
- 193
- Domain
- Driver Families
- Bucket
- sound/aoa
- 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.
- 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.
- 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/kernel.hlinux/delay.hlinux/slab.hlinux/io.hasm/macio.hasm/pmac_feature.hasm/pmac_pfunc.hasm/keylargo.hi2sbus.h
Detected Declarations
function i2sbus_control_initfunction i2sbus_control_destroyfunction i2sbus_control_add_devfunction i2sbus_control_remove_devfunction i2sbus_control_enablefunction i2sbus_control_cellfunction i2sbus_control_clock
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/*
* i2sbus driver -- bus control routines
*
* Copyright 2006 Johannes Berg <johannes@sipsolutions.net>
*/
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/slab.h>
#include <linux/io.h>
#include <asm/macio.h>
#include <asm/pmac_feature.h>
#include <asm/pmac_pfunc.h>
#include <asm/keylargo.h>
#include "i2sbus.h"
int i2sbus_control_init(struct macio_dev* dev, struct i2sbus_control **c)
{
*c = kzalloc_obj(struct i2sbus_control);
if (!*c)
return -ENOMEM;
INIT_LIST_HEAD(&(*c)->list);
(*c)->macio = dev->bus->chip;
return 0;
}
void i2sbus_control_destroy(struct i2sbus_control *c)
{
kfree(c);
}
/* this is serialised externally */
int i2sbus_control_add_dev(struct i2sbus_control *c,
struct i2sbus_dev *i2sdev)
{
struct device_node *np;
np = i2sdev->sound.ofdev.dev.of_node;
i2sdev->enable = pmf_find_function(np, "enable");
i2sdev->cell_enable = pmf_find_function(np, "cell-enable");
i2sdev->clock_enable = pmf_find_function(np, "clock-enable");
i2sdev->cell_disable = pmf_find_function(np, "cell-disable");
i2sdev->clock_disable = pmf_find_function(np, "clock-disable");
/* if the bus number is not 0 or 1 we absolutely need to use
* the platform functions -- there's nothing in Darwin that
* would allow seeing a system behind what the FCRs are then,
* and I don't want to go parsing a bunch of platform functions
* by hand to try finding a system... */
if (i2sdev->bus_number != 0 && i2sdev->bus_number != 1 &&
(!i2sdev->enable ||
!i2sdev->cell_enable || !i2sdev->clock_enable ||
!i2sdev->cell_disable || !i2sdev->clock_disable)) {
pmf_put_function(i2sdev->enable);
pmf_put_function(i2sdev->cell_enable);
pmf_put_function(i2sdev->clock_enable);
pmf_put_function(i2sdev->cell_disable);
pmf_put_function(i2sdev->clock_disable);
return -ENODEV;
}
list_add(&i2sdev->item, &c->list);
return 0;
}
void i2sbus_control_remove_dev(struct i2sbus_control *c,
struct i2sbus_dev *i2sdev)
{
/* this is serialised externally */
list_del(&i2sdev->item);
if (list_empty(&c->list))
i2sbus_control_destroy(c);
}
int i2sbus_control_enable(struct i2sbus_control *c,
struct i2sbus_dev *i2sdev)
{
struct pmf_args args = { .count = 0 };
struct macio_chip *macio = c->macio;
if (i2sdev->enable)
return pmf_call_one(i2sdev->enable, &args);
if (macio == NULL || macio->base == NULL)
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/delay.h`, `linux/slab.h`, `linux/io.h`, `asm/macio.h`, `asm/pmac_feature.h`, `asm/pmac_pfunc.h`, `asm/keylargo.h`.
- Detected declarations: `function i2sbus_control_init`, `function i2sbus_control_destroy`, `function i2sbus_control_add_dev`, `function i2sbus_control_remove_dev`, `function i2sbus_control_enable`, `function i2sbus_control_cell`, `function i2sbus_control_clock`.
- Atlas domain: Driver Families / sound/aoa.
- Implementation status: source 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.