drivers/video/backlight/ili9320.c
Source file repositories/reference/linux-study-clean/drivers/video/backlight/ili9320.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/video/backlight/ili9320.c- Extension
.c- Size
- 6604 bytes
- Lines
- 299
- Domain
- Driver Families
- Bucket
- drivers/video
- 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.
- 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/delay.hlinux/err.hlinux/init.hlinux/lcd.hlinux/module.hlinux/slab.hlinux/spi/spi.hvideo/ili9320.hili9320.h
Detected Declarations
function ili9320_write_spifunction ili9320_writefunction ili9320_write_regsfunction ili9320_resetfunction ili9320_init_chipfunction ili9320_power_onfunction ili9320_power_offfunction ili9320_powerfunction ili9320_set_powerfunction ili9320_get_powerfunction ili9320_setup_spifunction ili9320_probe_spifunction ili9320_removefunction ili9320_suspendfunction ili9320_resumefunction ili9320_shutdownexport ili9320_writeexport ili9320_write_regsexport ili9320_probe_spiexport ili9320_removeexport ili9320_suspendexport ili9320_resumeexport ili9320_shutdown
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/* drivers/video/backlight/ili9320.c
*
* ILI9320 LCD controller driver core.
*
* Copyright 2007 Simtec Electronics
* http://armlinux.simtec.co.uk/
* Ben Dooks <ben@simtec.co.uk>
*/
#include <linux/delay.h>
#include <linux/err.h>
#include <linux/init.h>
#include <linux/lcd.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/spi/spi.h>
#include <video/ili9320.h>
#include "ili9320.h"
static inline int ili9320_write_spi(struct ili9320 *ili,
unsigned int reg,
unsigned int value)
{
struct ili9320_spi *spi = &ili->access.spi;
unsigned char *addr = spi->buffer_addr;
unsigned char *data = spi->buffer_data;
/* spi message consits of:
* first byte: ID and operation
*/
addr[0] = spi->id | ILI9320_SPI_INDEX | ILI9320_SPI_WRITE;
addr[1] = reg >> 8;
addr[2] = reg;
/* second message is the data to transfer */
data[0] = spi->id | ILI9320_SPI_DATA | ILI9320_SPI_WRITE;
data[1] = value >> 8;
data[2] = value;
return spi_sync(spi->dev, &spi->message);
}
int ili9320_write(struct ili9320 *ili, unsigned int reg, unsigned int value)
{
dev_dbg(ili->dev, "write: reg=%02x, val=%04x\n", reg, value);
return ili->write(ili, reg, value);
}
EXPORT_SYMBOL_GPL(ili9320_write);
int ili9320_write_regs(struct ili9320 *ili,
const struct ili9320_reg *values,
int nr_values)
{
int index;
int ret;
for (index = 0; index < nr_values; index++, values++) {
ret = ili9320_write(ili, values->address, values->value);
if (ret != 0)
return ret;
}
return 0;
}
EXPORT_SYMBOL_GPL(ili9320_write_regs);
static void ili9320_reset(struct ili9320 *lcd)
{
struct ili9320_platdata *cfg = lcd->platdata;
cfg->reset(1);
mdelay(50);
cfg->reset(0);
mdelay(50);
cfg->reset(1);
mdelay(100);
}
static inline int ili9320_init_chip(struct ili9320 *lcd)
{
int ret;
Annotation
- Immediate include surface: `linux/delay.h`, `linux/err.h`, `linux/init.h`, `linux/lcd.h`, `linux/module.h`, `linux/slab.h`, `linux/spi/spi.h`, `video/ili9320.h`.
- Detected declarations: `function ili9320_write_spi`, `function ili9320_write`, `function ili9320_write_regs`, `function ili9320_reset`, `function ili9320_init_chip`, `function ili9320_power_on`, `function ili9320_power_off`, `function ili9320_power`, `function ili9320_set_power`, `function ili9320_get_power`.
- Atlas domain: Driver Families / drivers/video.
- 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.