drivers/auxdisplay/ht16k33.c
Source file repositories/reference/linux-study-clean/drivers/auxdisplay/ht16k33.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/auxdisplay/ht16k33.c- Extension
.c- Size
- 19233 bytes
- Lines
- 785
- Domain
- Driver Families
- Bucket
- drivers/auxdisplay
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/kernel.hlinux/module.hlinux/interrupt.hlinux/i2c.hlinux/property.hlinux/fb.hlinux/backlight.hlinux/container_of.hlinux/input.hlinux/input/matrix_keypad.hlinux/leds.hlinux/workqueue.hlinux/mm.hlinux/map_to_7segment.hlinux/map_to_14segment.hlinux/unaligned.hline-display.h
Detected Declarations
struct ht16k33_keypadstruct ht16k33_fbdevstruct ht16k33_privenum display_typefunction ht16k33_display_onfunction ht16k33_display_offfunction ht16k33_brightness_setfunction ht16k33_brightness_set_blockingfunction ht16k33_blink_setfunction ht16k33_fb_queuefunction ht16k33_fb_updatefunction ht16k33_initializefunction ht16k33_bl_update_statusfunction ht16k33_blankfunction ht16k33_mmapfunction ht16k33_keypad_scanfunction for_each_set_bitfunction ht16k33_keypad_irq_threadfunction ht16k33_keypad_startfunction ht16k33_keypad_stopfunction ht16k33_seg7_updatefunction ht16k33_seg14_updatefunction ht16k33_linedisp_get_map_typefunction ht16k33_linedisp_updatefunction ht16k33_led_probefunction ht16k33_keypad_probefunction ht16k33_fbdev_probefunction ht16k33_seg_probefunction ht16k33_probefunction ht16k33_remove
Annotated Snippet
struct ht16k33_keypad {
struct i2c_client *client;
struct input_dev *dev;
uint32_t cols;
uint32_t rows;
uint32_t row_shift;
uint32_t debounce_ms;
uint16_t last_key_state[HT16K33_MATRIX_KEYPAD_MAX_COLS];
wait_queue_head_t wait;
bool stopped;
};
struct ht16k33_fbdev {
struct fb_info *info;
uint32_t refresh_rate;
uint8_t *buffer;
uint8_t *cache;
};
struct ht16k33_priv {
struct i2c_client *client;
struct delayed_work work;
struct led_classdev led;
struct ht16k33_keypad keypad;
union {
struct ht16k33_fbdev fbdev;
struct linedisp linedisp;
};
enum display_type type;
uint8_t blink;
};
#define ht16k33_work_to_priv(p) \
container_of(p, struct ht16k33_priv, work.work)
#define ht16k33_led_to_priv(p) \
container_of(p, struct ht16k33_priv, led)
#define ht16k33_linedisp_to_priv(p) \
container_of(p, struct ht16k33_priv, linedisp)
static const struct fb_fix_screeninfo ht16k33_fb_fix = {
.id = DRIVER_NAME,
.type = FB_TYPE_PACKED_PIXELS,
.visual = FB_VISUAL_MONO10,
.xpanstep = 0,
.ypanstep = 0,
.ywrapstep = 0,
.line_length = HT16K33_MATRIX_LED_MAX_ROWS,
.accel = FB_ACCEL_NONE,
};
static const struct fb_var_screeninfo ht16k33_fb_var = {
.xres = HT16K33_MATRIX_LED_MAX_ROWS,
.yres = HT16K33_MATRIX_LED_MAX_COLS,
.xres_virtual = HT16K33_MATRIX_LED_MAX_ROWS,
.yres_virtual = HT16K33_MATRIX_LED_MAX_COLS,
.bits_per_pixel = 1,
.red = { 0, 1, 0 },
.green = { 0, 1, 0 },
.blue = { 0, 1, 0 },
.left_margin = 0,
.right_margin = 0,
.upper_margin = 0,
.lower_margin = 0,
.vmode = FB_VMODE_NONINTERLACED,
};
static int ht16k33_display_on(struct ht16k33_priv *priv)
{
uint8_t data = REG_DISPLAY_SETUP | REG_DISPLAY_SETUP_ON | priv->blink;
return i2c_smbus_write_byte(priv->client, data);
}
static int ht16k33_display_off(struct ht16k33_priv *priv)
{
return i2c_smbus_write_byte(priv->client, REG_DISPLAY_SETUP);
}
static int ht16k33_brightness_set(struct ht16k33_priv *priv,
unsigned int brightness)
{
int err;
if (brightness == 0) {
priv->blink = REG_DISPLAY_SETUP_BLINK_OFF;
return ht16k33_display_off(priv);
}
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/interrupt.h`, `linux/i2c.h`, `linux/property.h`, `linux/fb.h`, `linux/backlight.h`, `linux/container_of.h`.
- Detected declarations: `struct ht16k33_keypad`, `struct ht16k33_fbdev`, `struct ht16k33_priv`, `enum display_type`, `function ht16k33_display_on`, `function ht16k33_display_off`, `function ht16k33_brightness_set`, `function ht16k33_brightness_set_blocking`, `function ht16k33_blink_set`, `function ht16k33_fb_queue`.
- Atlas domain: Driver Families / drivers/auxdisplay.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.