drivers/clk/sunxi/clk-sun4i-display.c
Source file repositories/reference/linux-study-clean/drivers/clk/sunxi/clk-sun4i-display.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/clk/sunxi/clk-sun4i-display.c- Extension
.c- Size
- 5922 bytes
- Lines
- 257
- Domain
- Driver Families
- Bucket
- drivers/clk
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/clk-provider.hlinux/io.hlinux/kernel.hlinux/of_address.hlinux/reset-controller.hlinux/slab.hlinux/spinlock.h
Detected Declarations
struct sun4i_a10_display_clk_datastruct reset_datafunction sun4i_a10_display_assertfunction sun4i_a10_display_deassertfunction sun4i_a10_display_statusfunction sun4i_a10_display_reset_xlatefunction sun4i_a10_display_initfunction sun4i_a10_tcon_ch0_setupfunction sun4i_a10_display_setup
Annotated Snippet
struct sun4i_a10_display_clk_data {
bool has_div;
u8 num_rst;
u8 parents;
u8 offset_en;
u8 offset_div;
u8 offset_mux;
u8 offset_rst;
u8 width_div;
u8 width_mux;
u32 flags;
};
struct reset_data {
void __iomem *reg;
spinlock_t *lock;
struct reset_controller_dev rcdev;
u8 offset;
};
static DEFINE_SPINLOCK(sun4i_a10_display_lock);
static inline struct reset_data *rcdev_to_reset_data(struct reset_controller_dev *rcdev)
{
return container_of(rcdev, struct reset_data, rcdev);
};
static int sun4i_a10_display_assert(struct reset_controller_dev *rcdev,
unsigned long id)
{
struct reset_data *data = rcdev_to_reset_data(rcdev);
unsigned long flags;
u32 reg;
spin_lock_irqsave(data->lock, flags);
reg = readl(data->reg);
writel(reg & ~BIT(data->offset + id), data->reg);
spin_unlock_irqrestore(data->lock, flags);
return 0;
}
static int sun4i_a10_display_deassert(struct reset_controller_dev *rcdev,
unsigned long id)
{
struct reset_data *data = rcdev_to_reset_data(rcdev);
unsigned long flags;
u32 reg;
spin_lock_irqsave(data->lock, flags);
reg = readl(data->reg);
writel(reg | BIT(data->offset + id), data->reg);
spin_unlock_irqrestore(data->lock, flags);
return 0;
}
static int sun4i_a10_display_status(struct reset_controller_dev *rcdev,
unsigned long id)
{
struct reset_data *data = rcdev_to_reset_data(rcdev);
return !(readl(data->reg) & BIT(data->offset + id));
}
static const struct reset_control_ops sun4i_a10_display_reset_ops = {
.assert = sun4i_a10_display_assert,
.deassert = sun4i_a10_display_deassert,
.status = sun4i_a10_display_status,
};
static int sun4i_a10_display_reset_xlate(struct reset_controller_dev *rcdev,
const struct of_phandle_args *spec)
{
/* We only have a single reset signal */
return 0;
}
static void __init sun4i_a10_display_init(struct device_node *node,
const struct sun4i_a10_display_clk_data *data)
{
const char *parents[4];
const char *clk_name = node->name;
Annotation
- Immediate include surface: `linux/clk-provider.h`, `linux/io.h`, `linux/kernel.h`, `linux/of_address.h`, `linux/reset-controller.h`, `linux/slab.h`, `linux/spinlock.h`.
- Detected declarations: `struct sun4i_a10_display_clk_data`, `struct reset_data`, `function sun4i_a10_display_assert`, `function sun4i_a10_display_deassert`, `function sun4i_a10_display_status`, `function sun4i_a10_display_reset_xlate`, `function sun4i_a10_display_init`, `function sun4i_a10_tcon_ch0_setup`, `function sun4i_a10_display_setup`.
- Atlas domain: Driver Families / drivers/clk.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.