drivers/video/backlight/max25014.c
Source file repositories/reference/linux-study-clean/drivers/video/backlight/max25014.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/video/backlight/max25014.c- Extension
.c- Size
- 10421 bytes
- Lines
- 378
- 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/backlight.hlinux/gpio/consumer.hlinux/i2c.hlinux/regmap.hlinux/slab.h
Detected Declarations
struct max25014function max25014_initial_power_statefunction max25014_check_errorsfunction max25014_configurefunction max25014_update_statusfunction max25014_parse_dtfunction max25014_probefunction max25014_remove
Annotated Snippet
struct max25014 {
struct i2c_client *client;
struct backlight_device *bl;
struct regmap *regmap;
struct gpio_desc *enable;
uint32_t iset;
uint8_t strings_mask;
};
static const struct regmap_config max25014_regmap_config = {
.reg_bits = 8,
.val_bits = 8,
.max_register = MAX25014_DIAG,
};
static int max25014_initial_power_state(struct max25014 *maxim)
{
uint32_t val;
int ret;
ret = regmap_read(maxim->regmap, MAX25014_ISET, &val);
if (ret)
return ret;
return val & MAX25014_ISET_ENA ? BACKLIGHT_POWER_ON : BACKLIGHT_POWER_OFF;
}
static int max25014_check_errors(struct max25014 *maxim)
{
uint32_t val;
uint8_t i;
int ret;
ret = regmap_read(maxim->regmap, MAX25014_OPEN, &val);
if (ret)
return ret;
if (val) {
dev_err(&maxim->client->dev, "Open led strings detected on:\n");
for (i = 0; i < 4; i++) {
if (val & 1 << i)
dev_err(&maxim->client->dev, "string %d\n", i + 1);
}
return -EIO;
}
ret = regmap_read(maxim->regmap, MAX25014_SHORTGND, &val);
if (ret)
return ret;
if (val) {
dev_err(&maxim->client->dev, "Short to ground detected on:\n");
for (i = 0; i < 4; i++) {
if (val & 1 << i)
dev_err(&maxim->client->dev, "string %d\n", i + 1);
}
return -EIO;
}
ret = regmap_read(maxim->regmap, MAX25014_SHORTED_LED, &val);
if (ret)
return ret;
if (val) {
dev_err(&maxim->client->dev, "Shorted led detected on:\n");
for (i = 0; i < 4; i++) {
if (val & 1 << i)
dev_err(&maxim->client->dev, "string %d\n", i + 1);
}
return -EIO;
}
ret = regmap_read(maxim->regmap, MAX25014_DIAG, &val);
if (ret)
return ret;
/*
* The HW_RST bit always starts at 1 after power up.
* It is reset on first read, does not indicate an error.
*/
if (val && val != MAX25014_DIAG_HW_RST) {
if (val & MAX25014_DIAG_OT)
dev_err(&maxim->client->dev,
"Overtemperature shutdown\n");
if (val & MAX25014_DIAG_OTW)
dev_err(&maxim->client->dev,
"Chip is getting too hot (>125C)\n");
if (val & MAX25014_DIAG_BSTOV)
dev_err(&maxim->client->dev,
"Boost converter overvoltage\n");
if (val & MAX25014_DIAG_BSTUV)
dev_err(&maxim->client->dev,
"Boost converter undervoltage\n");
if (val & MAX25014_DIAG_IREFOOR)
Annotation
- Immediate include surface: `linux/backlight.h`, `linux/gpio/consumer.h`, `linux/i2c.h`, `linux/regmap.h`, `linux/slab.h`.
- Detected declarations: `struct max25014`, `function max25014_initial_power_state`, `function max25014_check_errors`, `function max25014_configure`, `function max25014_update_status`, `function max25014_parse_dt`, `function max25014_probe`, `function max25014_remove`.
- 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.