drivers/auxdisplay/img-ascii-lcd.c
Source file repositories/reference/linux-study-clean/drivers/auxdisplay/img-ascii-lcd.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/auxdisplay/img-ascii-lcd.c- Extension
.c- Size
- 6936 bytes
- Lines
- 300
- Domain
- Driver Families
- Bucket
- drivers/auxdisplay
- 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/io.hlinux/mfd/syscon.hlinux/module.hlinux/of.hlinux/platform_device.hlinux/property.hlinux/regmap.hlinux/slab.hline-display.h
Detected Declarations
struct img_ascii_lcd_ctxstruct img_ascii_lcd_configstruct img_ascii_lcd_ctxfunction boston_updatefunction malta_updatefunction sead3_wait_sm_idlefunction sead3_wait_lcd_idlefunction sead3_updatefunction img_ascii_lcd_probefunction img_ascii_lcd_remove
Annotated Snippet
struct img_ascii_lcd_config {
unsigned int num_chars;
bool external_regmap;
const struct linedisp_ops ops;
};
/**
* struct img_ascii_lcd_ctx - Private data structure
* @linedisp: line display structure
* @base: the base address of the LCD registers
* @regmap: the regmap through which LCD registers are accessed
* @offset: the offset within regmap to the start of the LCD registers
*/
struct img_ascii_lcd_ctx {
struct linedisp linedisp;
union {
void __iomem *base;
struct regmap *regmap;
};
u32 offset;
};
/*
* MIPS Boston development board
*/
static void boston_update(struct linedisp *linedisp)
{
struct img_ascii_lcd_ctx *ctx =
container_of(linedisp, struct img_ascii_lcd_ctx, linedisp);
ulong val;
#if BITS_PER_LONG == 64
val = *((u64 *)&linedisp->buf[0]);
__raw_writeq(val, ctx->base);
#elif BITS_PER_LONG == 32
val = *((u32 *)&linedisp->buf[0]);
__raw_writel(val, ctx->base);
val = *((u32 *)&linedisp->buf[4]);
__raw_writel(val, ctx->base + 4);
#else
# error Not 32 or 64 bit
#endif
}
static const struct img_ascii_lcd_config boston_config = {
.num_chars = 8,
.ops = {
.update = boston_update,
},
};
/*
* MIPS Malta development board
*/
static void malta_update(struct linedisp *linedisp)
{
struct img_ascii_lcd_ctx *ctx =
container_of(linedisp, struct img_ascii_lcd_ctx, linedisp);
unsigned int i;
int err = 0;
for (i = 0; i < linedisp->num_chars; i++) {
err = regmap_write(ctx->regmap,
ctx->offset + (i * 8), linedisp->buf[i]);
if (err)
break;
}
if (unlikely(err))
pr_err_ratelimited("Failed to update LCD display: %d\n", err);
}
static const struct img_ascii_lcd_config malta_config = {
.num_chars = 8,
.external_regmap = true,
.ops = {
.update = malta_update,
},
};
/*
* MIPS SEAD3 development board
*/
enum {
SEAD3_REG_LCD_CTRL = 0x00,
#define SEAD3_REG_LCD_CTRL_SETDRAM BIT(7)
SEAD3_REG_LCD_DATA = 0x08,
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/io.h`, `linux/mfd/syscon.h`, `linux/module.h`, `linux/of.h`, `linux/platform_device.h`, `linux/property.h`, `linux/regmap.h`.
- Detected declarations: `struct img_ascii_lcd_ctx`, `struct img_ascii_lcd_config`, `struct img_ascii_lcd_ctx`, `function boston_update`, `function malta_update`, `function sead3_wait_sm_idle`, `function sead3_wait_lcd_idle`, `function sead3_update`, `function img_ascii_lcd_probe`, `function img_ascii_lcd_remove`.
- Atlas domain: Driver Families / drivers/auxdisplay.
- 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.