drivers/staging/fbtft/fb_hx8347d.c
Source file repositories/reference/linux-study-clean/drivers/staging/fbtft/fb_hx8347d.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/staging/fbtft/fb_hx8347d.c- Extension
.c- Size
- 4746 bytes
- Lines
- 184
- Domain
- Driver Families
- Bucket
- drivers/staging
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/kernel.hlinux/init.hlinux/delay.hfbtft.h
Detected Declarations
function Copyrightfunction set_addr_winfunction set_varfunction set_gamma
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0+
/*
* FB driver for the HX8347D LCD Controller
*
* Copyright (C) 2013 Christian Vogelgsang
*
* Based on driver code found here: https://github.com/watterott/r61505u-Adapter
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/delay.h>
#include "fbtft.h"
#define DRVNAME "fb_hx8347d"
#define WIDTH 320
#define HEIGHT 240
#define DEFAULT_GAMMA "0 0 0 0 0 0 0 0 0 0 0 0 0 0\n" \
"0 0 0 0 0 0 0 0 0 0 0 0 0 0"
static int init_display(struct fbtft_par *par)
{
par->fbtftops.reset(par);
/* driving ability */
write_reg(par, 0xEA, 0x00);
write_reg(par, 0xEB, 0x20);
write_reg(par, 0xEC, 0x0C);
write_reg(par, 0xED, 0xC4);
write_reg(par, 0xE8, 0x40);
write_reg(par, 0xE9, 0x38);
write_reg(par, 0xF1, 0x01);
write_reg(par, 0xF2, 0x10);
write_reg(par, 0x27, 0xA3);
/* power voltage */
write_reg(par, 0x1B, 0x1B);
write_reg(par, 0x1A, 0x01);
write_reg(par, 0x24, 0x2F);
write_reg(par, 0x25, 0x57);
/* VCOM offset */
write_reg(par, 0x23, 0x8D); /* for flicker adjust */
/* power on */
write_reg(par, 0x18, 0x36);
write_reg(par, 0x19, 0x01); /* start osc */
write_reg(par, 0x01, 0x00); /* wakeup */
write_reg(par, 0x1F, 0x88);
mdelay(5);
write_reg(par, 0x1F, 0x80);
mdelay(5);
write_reg(par, 0x1F, 0x90);
mdelay(5);
write_reg(par, 0x1F, 0xD0);
mdelay(5);
/* color selection */
write_reg(par, 0x17, 0x05); /* 65k */
/*panel characteristic */
write_reg(par, 0x36, 0x00);
/*display on */
write_reg(par, 0x28, 0x38);
mdelay(40);
write_reg(par, 0x28, 0x3C);
return 0;
}
static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye)
{
write_reg(par, 0x02, (xs >> 8) & 0xFF);
write_reg(par, 0x03, xs & 0xFF);
write_reg(par, 0x04, (xe >> 8) & 0xFF);
write_reg(par, 0x05, xe & 0xFF);
write_reg(par, 0x06, (ys >> 8) & 0xFF);
write_reg(par, 0x07, ys & 0xFF);
write_reg(par, 0x08, (ye >> 8) & 0xFF);
write_reg(par, 0x09, ye & 0xFF);
write_reg(par, 0x22);
}
#define MEM_Y BIT(7) /* MY row address order */
#define MEM_X BIT(6) /* MX column address order */
#define MEM_V BIT(5) /* MV row / column exchange */
#define MEM_L BIT(4) /* ML vertical refresh order */
Annotation
- Immediate include surface: `linux/module.h`, `linux/kernel.h`, `linux/init.h`, `linux/delay.h`, `fbtft.h`.
- Detected declarations: `function Copyright`, `function set_addr_win`, `function set_var`, `function set_gamma`.
- Atlas domain: Driver Families / drivers/staging.
- 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.