drivers/video/backlight/arcxcnn_bl.c
Source file repositories/reference/linux-study-clean/drivers/video/backlight/arcxcnn_bl.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/video/backlight/arcxcnn_bl.c- Extension
.c- Size
- 10957 bytes
- Lines
- 404
- 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/err.hlinux/i2c.hlinux/module.hlinux/of.hlinux/slab.h
Detected Declarations
struct arcxcnn_platform_datastruct arcxcnnenum arcxcnn_chip_idfunction arcxcnn_update_fieldfunction arcxcnn_set_brightnessfunction arcxcnn_bl_update_statusfunction arcxcnn_backlight_registerfunction arcxcnn_parse_dtfunction arcxcnn_probefunction arcxcnn_remove
Annotated Snippet
struct arcxcnn_platform_data {
const char *name;
u16 initial_brightness;
u8 leden;
u8 led_config_0;
u8 led_config_1;
u8 dim_freq;
u8 comp_config;
u8 filter_config;
u8 trim_config;
};
#define ARCXCNN_CMD 0x00 /* Command Register */
#define ARCXCNN_CMD_STDBY 0x80 /* I2C Standby */
#define ARCXCNN_CMD_RESET 0x40 /* Reset */
#define ARCXCNN_CMD_BOOST 0x10 /* Boost */
#define ARCXCNN_CMD_OVP_MASK 0x0C /* --- Over Voltage Threshold */
#define ARCXCNN_CMD_OVP_XXV 0x0C /* <rsvrd> Over Voltage Threshold */
#define ARCXCNN_CMD_OVP_20V 0x08 /* 20v Over Voltage Threshold */
#define ARCXCNN_CMD_OVP_24V 0x04 /* 24v Over Voltage Threshold */
#define ARCXCNN_CMD_OVP_31V 0x00 /* 31.4v Over Voltage Threshold */
#define ARCXCNN_CMD_EXT_COMP 0x01 /* part (0) or full (1) ext. comp */
#define ARCXCNN_CONFIG 0x01 /* Configuration */
#define ARCXCNN_STATUS1 0x02 /* Status 1 */
#define ARCXCNN_STATUS2 0x03 /* Status 2 */
#define ARCXCNN_FADECTRL 0x04 /* Fading Control */
#define ARCXCNN_ILED_CONFIG 0x05 /* ILED Configuration */
#define ARCXCNN_ILED_DIM_PWM 0x00 /* config dim mode pwm */
#define ARCXCNN_ILED_DIM_INT 0x04 /* config dim mode internal */
#define ARCXCNN_LEDEN 0x06 /* LED Enable Register */
#define ARCXCNN_LEDEN_ISETEXT 0x80 /* Full-scale current set extern */
#define ARCXCNN_LEDEN_MASK 0x3F /* LED string enables mask */
#define ARCXCNN_LEDEN_BITS 0x06 /* Bits of LED string enables */
#define ARCXCNN_LEDEN_LED1 0x01
#define ARCXCNN_LEDEN_LED2 0x02
#define ARCXCNN_LEDEN_LED3 0x04
#define ARCXCNN_LEDEN_LED4 0x08
#define ARCXCNN_LEDEN_LED5 0x10
#define ARCXCNN_LEDEN_LED6 0x20
#define ARCXCNN_WLED_ISET_LSB 0x07 /* LED ISET LSB (in upper nibble) */
#define ARCXCNN_WLED_ISET_LSB_SHIFT 0x04 /* ISET LSB Left Shift */
#define ARCXCNN_WLED_ISET_MSB 0x08 /* LED ISET MSB (8 bits) */
#define ARCXCNN_DIMFREQ 0x09
#define ARCXCNN_COMP_CONFIG 0x0A
#define ARCXCNN_FILT_CONFIG 0x0B
#define ARCXCNN_IMAXTUNE 0x0C
#define ARCXCNN_ID_MSB 0x1E
#define ARCXCNN_ID_LSB 0x1F
#define MAX_BRIGHTNESS 4095
#define INIT_BRIGHT 60
struct arcxcnn {
struct i2c_client *client;
struct backlight_device *bl;
struct device *dev;
struct arcxcnn_platform_data *pdata;
};
static int arcxcnn_update_field(struct arcxcnn *lp, u8 reg, u8 mask, u8 data)
{
int ret;
u8 tmp;
ret = i2c_smbus_read_byte_data(lp->client, reg);
if (ret < 0) {
dev_err(lp->dev, "failed to read 0x%.2x\n", reg);
return ret;
}
tmp = (u8)ret;
tmp &= ~mask;
tmp |= data & mask;
return i2c_smbus_write_byte_data(lp->client, reg, tmp);
}
static int arcxcnn_set_brightness(struct arcxcnn *lp, u32 brightness)
{
int ret;
u8 val;
/* lower nibble of brightness goes in upper nibble of LSB register */
val = (brightness & 0xF) << ARCXCNN_WLED_ISET_LSB_SHIFT;
ret = i2c_smbus_write_byte_data(lp->client,
ARCXCNN_WLED_ISET_LSB, val);
if (ret < 0)
Annotation
- Immediate include surface: `linux/backlight.h`, `linux/err.h`, `linux/i2c.h`, `linux/module.h`, `linux/of.h`, `linux/slab.h`.
- Detected declarations: `struct arcxcnn_platform_data`, `struct arcxcnn`, `enum arcxcnn_chip_id`, `function arcxcnn_update_field`, `function arcxcnn_set_brightness`, `function arcxcnn_bl_update_status`, `function arcxcnn_backlight_register`, `function arcxcnn_parse_dt`, `function arcxcnn_probe`, `function arcxcnn_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.