drivers/video/fbdev/ssd1307fb.c
Source file repositories/reference/linux-study-clean/drivers/video/fbdev/ssd1307fb.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/video/fbdev/ssd1307fb.c- Extension
.c- Size
- 20099 bytes
- Lines
- 810
- 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/delay.hlinux/fb.hlinux/gpio/consumer.hlinux/i2c.hlinux/kernel.hlinux/module.hlinux/property.hlinux/pwm.hlinux/uaccess.hlinux/regulator/consumer.h
Detected Declarations
struct ssd1307fb_deviceinfostruct ssd1307fb_parstruct ssd1307fb_arrayfunction ssd1307fb_write_arrayfunction ssd1307fb_write_cmdfunction ssd1307fb_set_col_rangefunction ssd1307fb_set_page_rangefunction ssd1307fb_update_rectfunction ssd1307fb_update_displayfunction ssd1307fb_blankfunction ssd1307fb_defio_damage_rangefunction ssd1307fb_defio_damage_areafunction ssd1307fb_deferred_iofunction ssd1307fb_initfunction ssd1307fb_update_blfunction ssd1307fb_get_brightnessfunction ssd1307fb_probefunction ssd1307fb_remove
Annotated Snippet
struct ssd1307fb_deviceinfo {
u32 default_vcomh;
u32 default_dclk_div;
u32 default_dclk_frq;
bool need_pwm;
bool need_chargepump;
};
struct ssd1307fb_par {
unsigned area_color_enable : 1;
unsigned com_invdir : 1;
unsigned com_lrremap : 1;
unsigned com_seq : 1;
unsigned lookup_table_set : 1;
unsigned low_power : 1;
unsigned seg_remap : 1;
u32 com_offset;
u32 contrast;
u32 dclk_div;
u32 dclk_frq;
const struct ssd1307fb_deviceinfo *device_info;
struct i2c_client *client;
u32 height;
struct fb_info *info;
u8 lookup_table[4];
u32 page_offset;
u32 col_offset;
u32 prechargep1;
u32 prechargep2;
struct pwm_device *pwm;
struct gpio_desc *reset;
struct regulator *vbat_reg;
u32 vcomh;
u32 width;
/* Cached address ranges */
u8 col_start;
u8 col_end;
u8 page_start;
u8 page_end;
};
struct ssd1307fb_array {
u8 type;
u8 data[];
};
static const struct fb_fix_screeninfo ssd1307fb_fix = {
.id = "Solomon SSD1307",
.type = FB_TYPE_PACKED_PIXELS,
.visual = FB_VISUAL_MONO10,
.xpanstep = 0,
.ypanstep = 0,
.ywrapstep = 0,
.accel = FB_ACCEL_NONE,
};
static const struct fb_var_screeninfo ssd1307fb_var = {
.bits_per_pixel = 1,
.red = { .length = 1 },
.green = { .length = 1 },
.blue = { .length = 1 },
};
static struct ssd1307fb_array *ssd1307fb_alloc_array(u32 len, u8 type)
{
struct ssd1307fb_array *array;
array = kzalloc(sizeof(struct ssd1307fb_array) + len, GFP_KERNEL);
if (!array)
return NULL;
array->type = type;
return array;
}
static int ssd1307fb_write_array(struct i2c_client *client,
struct ssd1307fb_array *array, u32 len)
{
int ret;
len += sizeof(struct ssd1307fb_array);
ret = i2c_master_send(client, (u8 *)array, len);
if (ret != len) {
dev_err(&client->dev, "Couldn't send I2C command.\n");
return ret;
}
return 0;
Annotation
- Immediate include surface: `linux/backlight.h`, `linux/delay.h`, `linux/fb.h`, `linux/gpio/consumer.h`, `linux/i2c.h`, `linux/kernel.h`, `linux/module.h`, `linux/property.h`.
- Detected declarations: `struct ssd1307fb_deviceinfo`, `struct ssd1307fb_par`, `struct ssd1307fb_array`, `function ssd1307fb_write_array`, `function ssd1307fb_write_cmd`, `function ssd1307fb_set_col_range`, `function ssd1307fb_set_page_range`, `function ssd1307fb_update_rect`, `function ssd1307fb_update_display`, `function ssd1307fb_blank`.
- 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.