drivers/video/backlight/l4f00242t03.c
Source file repositories/reference/linux-study-clean/drivers/video/backlight/l4f00242t03.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/video/backlight/l4f00242t03.c- Extension
.c- Size
- 6725 bytes
- Lines
- 253
- Domain
- Driver Families
- Bucket
- drivers/video
- 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/device.hlinux/kernel.hlinux/delay.hlinux/module.hlinux/gpio/consumer.hlinux/lcd.hlinux/slab.hlinux/regulator/consumer.hlinux/spi/spi.h
Detected Declarations
struct l4f00242t03_privfunction l4f00242t03_resetfunction l4f00242t03_lcd_initfunction l4f00242t03_lcd_powerdownfunction l4f00242t03_lcd_power_getfunction l4f00242t03_lcd_power_setfunction l4f00242t03_probefunction l4f00242t03_removefunction l4f00242t03_shutdown
Annotated Snippet
struct l4f00242t03_priv {
struct spi_device *spi;
struct lcd_device *ld;
int lcd_state;
struct regulator *io_reg;
struct regulator *core_reg;
struct gpio_desc *reset;
struct gpio_desc *enable;
};
static void l4f00242t03_reset(struct gpio_desc *gpiod)
{
pr_debug("l4f00242t03_reset.\n");
gpiod_set_value(gpiod, 1);
mdelay(100);
gpiod_set_value(gpiod, 0);
mdelay(10); /* tRES >= 100us */
gpiod_set_value(gpiod, 1);
mdelay(20);
}
#define param(x) ((x) | 0x100)
static void l4f00242t03_lcd_init(struct spi_device *spi)
{
struct l4f00242t03_priv *priv = spi_get_drvdata(spi);
const u16 cmd[] = { 0x36, param(0), 0x3A, param(0x60) };
int ret;
dev_dbg(&spi->dev, "initializing LCD\n");
ret = regulator_set_voltage(priv->io_reg, 1800000, 1800000);
if (ret) {
dev_err(&spi->dev, "failed to set the IO regulator voltage.\n");
return;
}
ret = regulator_enable(priv->io_reg);
if (ret) {
dev_err(&spi->dev, "failed to enable the IO regulator.\n");
return;
}
ret = regulator_set_voltage(priv->core_reg, 2800000, 2800000);
if (ret) {
dev_err(&spi->dev, "failed to set the core regulator voltage.\n");
regulator_disable(priv->io_reg);
return;
}
ret = regulator_enable(priv->core_reg);
if (ret) {
dev_err(&spi->dev, "failed to enable the core regulator.\n");
regulator_disable(priv->io_reg);
return;
}
l4f00242t03_reset(priv->reset);
gpiod_set_value(priv->enable, 1);
msleep(60);
spi_write(spi, (const u8 *)cmd, ARRAY_SIZE(cmd) * sizeof(u16));
}
static void l4f00242t03_lcd_powerdown(struct spi_device *spi)
{
struct l4f00242t03_priv *priv = spi_get_drvdata(spi);
dev_dbg(&spi->dev, "Powering down LCD\n");
gpiod_set_value(priv->enable, 0);
regulator_disable(priv->io_reg);
regulator_disable(priv->core_reg);
}
static int l4f00242t03_lcd_power_get(struct lcd_device *ld)
{
struct l4f00242t03_priv *priv = lcd_get_data(ld);
return priv->lcd_state;
}
static int l4f00242t03_lcd_power_set(struct lcd_device *ld, int power)
{
struct l4f00242t03_priv *priv = lcd_get_data(ld);
struct spi_device *spi = priv->spi;
const u16 slpout = 0x11;
const u16 dison = 0x29;
const u16 slpin = 0x10;
Annotation
- Immediate include surface: `linux/device.h`, `linux/kernel.h`, `linux/delay.h`, `linux/module.h`, `linux/gpio/consumer.h`, `linux/lcd.h`, `linux/slab.h`, `linux/regulator/consumer.h`.
- Detected declarations: `struct l4f00242t03_priv`, `function l4f00242t03_reset`, `function l4f00242t03_lcd_init`, `function l4f00242t03_lcd_powerdown`, `function l4f00242t03_lcd_power_get`, `function l4f00242t03_lcd_power_set`, `function l4f00242t03_probe`, `function l4f00242t03_remove`, `function l4f00242t03_shutdown`.
- Atlas domain: Driver Families / drivers/video.
- 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.