drivers/staging/fbtft/fb_upd161704.c
Source file repositories/reference/linux-study-clean/drivers/staging/fbtft/fb_upd161704.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/staging/fbtft/fb_upd161704.c- Extension
.c- Size
- 5197 bytes
- Lines
- 185
- 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_var
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0+
/*
* FB driver for the uPD161704 LCD Controller
*
* Copyright (C) 2014 Seong-Woo Kim
*
* Based on fb_ili9325.c by Noralf Tronnes
* Based on ili9325.c by Jeroen Domburg
* Init code from UTFT library by Henning Karlsen
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/delay.h>
#include "fbtft.h"
#define DRVNAME "fb_upd161704"
#define WIDTH 240
#define HEIGHT 320
#define BPP 16
static int init_display(struct fbtft_par *par)
{
par->fbtftops.reset(par);
/* Initialization sequence from Lib_UTFT */
/* register reset */
write_reg(par, 0x0003, 0x0001); /* Soft reset */
/* oscillator start */
write_reg(par, 0x003A, 0x0001); /*Oscillator 0: stop, 1: operation */
udelay(100);
/* y-setting */
write_reg(par, 0x0024, 0x007B); /* amplitude setting */
udelay(10);
write_reg(par, 0x0025, 0x003B); /* amplitude setting */
write_reg(par, 0x0026, 0x0034); /* amplitude setting */
udelay(10);
write_reg(par, 0x0027, 0x0004); /* amplitude setting */
write_reg(par, 0x0052, 0x0025); /* circuit setting 1 */
udelay(10);
write_reg(par, 0x0053, 0x0033); /* circuit setting 2 */
write_reg(par, 0x0061, 0x001C); /* adjustment V10 positive polarity */
udelay(10);
write_reg(par, 0x0062, 0x002C); /* adjustment V9 negative polarity */
write_reg(par, 0x0063, 0x0022); /* adjustment V34 positive polarity */
udelay(10);
write_reg(par, 0x0064, 0x0027); /* adjustment V31 negative polarity */
udelay(10);
write_reg(par, 0x0065, 0x0014); /* adjustment V61 negative polarity */
udelay(10);
write_reg(par, 0x0066, 0x0010); /* adjustment V61 negative polarity */
/* Basical clock for 1 line (BASECOUNT[7:0]) number specified */
write_reg(par, 0x002E, 0x002D);
/* Power supply setting */
write_reg(par, 0x0019, 0x0000); /* DC/DC output setting */
udelay(200);
write_reg(par, 0x001A, 0x1000); /* DC/DC frequency setting */
write_reg(par, 0x001B, 0x0023); /* DC/DC rising setting */
write_reg(par, 0x001C, 0x0C01); /* Regulator voltage setting */
write_reg(par, 0x001D, 0x0000); /* Regulator current setting */
write_reg(par, 0x001E, 0x0009); /* VCOM output setting */
write_reg(par, 0x001F, 0x0035); /* VCOM amplitude setting */
write_reg(par, 0x0020, 0x0015); /* VCOMM cencter setting */
write_reg(par, 0x0018, 0x1E7B); /* DC/DC operation setting */
/* windows setting */
write_reg(par, 0x0008, 0x0000); /* Minimum X address */
write_reg(par, 0x0009, 0x00EF); /* Maximum X address */
write_reg(par, 0x000a, 0x0000); /* Minimum Y address */
write_reg(par, 0x000b, 0x013F); /* Maximum Y address */
/* LCD display area setting */
write_reg(par, 0x0029, 0x0000); /* [LCDSIZE] X MIN. size set */
write_reg(par, 0x002A, 0x0000); /* [LCDSIZE] Y MIN. size set */
write_reg(par, 0x002B, 0x00EF); /* [LCDSIZE] X MAX. size set */
write_reg(par, 0x002C, 0x013F); /* [LCDSIZE] Y MAX. size set */
/* Gate scan setting */
write_reg(par, 0x0032, 0x0002);
/* n line inversion line number */
write_reg(par, 0x0033, 0x0000);
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`.
- 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.