drivers/video/backlight/aw99706.c
Source file repositories/reference/linux-study-clean/drivers/video/backlight/aw99706.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/video/backlight/aw99706.c- Extension
.c- Size
- 11888 bytes
- Lines
- 472
- 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/bitfield.hlinux/delay.hlinux/gpio/consumer.hlinux/i2c.hlinux/kernel.hlinux/module.hlinux/regmap.h
Detected Declarations
struct aw99706_dt_propstruct reg_init_datastruct aw99706_deviceenum reg_accessfunction aw99706_dt_property_lookupfunction aw99706_dt_property_iled_max_convertfunction aw99706_readable_regfunction aw99706_writeable_regfunction aw99706_i2c_readfunction aw99706_i2c_writefunction aw99706_i2c_update_bitsfunction aw99706_dt_parsefunction aw99706_hw_initfunction aw99706_bl_enablefunction aw99706_update_brightnessfunction aw99706_bl_update_statusfunction aw99706_chip_id_readfunction aw99706_probefunction aw99706_removefunction aw99706_suspendfunction aw99706_resume
Annotated Snippet
struct aw99706_dt_prop {
const char * const name;
int (*lookup)(const struct aw99706_dt_prop *prop, u32 dt_val, u8 *val);
const u32 * const lookup_tbl;
u8 tbl_size;
u8 reg;
u8 mask;
u32 def_val;
};
static int aw99706_dt_property_lookup(const struct aw99706_dt_prop *prop,
u32 dt_val, u8 *val)
{
int i;
if (!prop->lookup_tbl) {
*val = dt_val;
return 0;
}
for (i = 0; i < prop->tbl_size; i++)
if (prop->lookup_tbl[i] == dt_val)
break;
*val = i;
return i == prop->tbl_size ? -1 : 0;
}
#define MIN_ILED_MAX 5000
#define MAX_ILED_MAX 50000
#define STEP_ILED_MAX 500
static int
aw99706_dt_property_iled_max_convert(const struct aw99706_dt_prop *prop,
u32 dt_val, u8 *val)
{
if (dt_val > MAX_ILED_MAX || dt_val < MIN_ILED_MAX)
return -1;
*val = (dt_val - MIN_ILED_MAX) / STEP_ILED_MAX;
return (dt_val - MIN_ILED_MAX) % STEP_ILED_MAX;
}
static const struct aw99706_dt_prop aw99706_dt_props[] = {
{
"awinic,dim-mode", aw99706_dt_property_lookup,
NULL, 0,
AW99706_CFG0_REG, AW99706_DIM_MODE_MASK, 1,
},
{
"awinic,sw-freq", aw99706_dt_property_lookup,
aw99706_sw_freq_tbl, ARRAY_SIZE(aw99706_sw_freq_tbl),
AW99706_CFG1_REG, AW99706_SW_FREQ_MASK, 750000,
},
{
"awinic,sw-ilmt", aw99706_dt_property_lookup,
aw99706_sw_ilmt_tbl, ARRAY_SIZE(aw99706_sw_ilmt_tbl),
AW99706_CFG1_REG, AW99706_SW_ILMT_MASK, 3000000,
},
{
"awinic,iled-max", aw99706_dt_property_iled_max_convert,
NULL, 0,
AW99706_CFG2_REG, AW99706_ILED_MAX_MASK, 20000,
},
{
"awinic,uvlo-thres", aw99706_dt_property_lookup,
aw99706_ulvo_thres_tbl, ARRAY_SIZE(aw99706_ulvo_thres_tbl),
AW99706_CFG2_REG, AW99706_UVLOSEL_MASK, 2200000,
},
{
"awinic,ramp-ctl", aw99706_dt_property_lookup,
NULL, 0,
AW99706_CFG6_REG, AW99706_RAMP_CTL_MASK, 2,
}
};
struct reg_init_data {
u8 reg;
u8 mask;
u8 val;
};
struct aw99706_device {
struct i2c_client *client;
struct device *dev;
struct regmap *regmap;
struct backlight_device *bl_dev;
Annotation
- Immediate include surface: `linux/backlight.h`, `linux/bitfield.h`, `linux/delay.h`, `linux/gpio/consumer.h`, `linux/i2c.h`, `linux/kernel.h`, `linux/module.h`, `linux/regmap.h`.
- Detected declarations: `struct aw99706_dt_prop`, `struct reg_init_data`, `struct aw99706_device`, `enum reg_access`, `function aw99706_dt_property_lookup`, `function aw99706_dt_property_iled_max_convert`, `function aw99706_readable_reg`, `function aw99706_writeable_reg`, `function aw99706_i2c_read`, `function aw99706_i2c_write`.
- 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.