drivers/staging/fbtft/fb_uc1701.c
Source file repositories/reference/linux-study-clean/drivers/staging/fbtft/fb_uc1701.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/staging/fbtft/fb_uc1701.c- Extension
.c- Size
- 4184 bytes
- Lines
- 171
- 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/gpio/consumer.hlinux/spi/spi.hlinux/delay.hfbtft.h
Detected Declarations
function Copyrightfunction set_addr_winfunction write_vmem
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0+
/*
* FB driver for the UC1701 LCD Controller
*
* The display is monochrome and the video memory is RGB565.
* Any pixel value except 0 turns the pixel on.
*
* Copyright (C) 2014 Juergen Holzmann
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/gpio/consumer.h>
#include <linux/spi/spi.h>
#include <linux/delay.h>
#include "fbtft.h"
#define DRVNAME "fb_uc1701"
#define WIDTH 102
#define HEIGHT 64
#define PAGES (HEIGHT / 8)
/* 1: Display on/off */
#define LCD_DISPLAY_ENABLE 0xAE
/* 2: display start line set */
#define LCD_START_LINE 0x40
/* 3: Page address set (lower 4 bits select one of the pages) */
#define LCD_PAGE_ADDRESS 0xB0
/* 4: column address */
#define LCD_COL_ADDRESS 0x10
/* 8: select orientation */
#define LCD_BOTTOMVIEW 0xA0
/* 9: inverted display */
#define LCD_DISPLAY_INVERT 0xA6
/* 10: show memory content or switch all pixels on */
#define LCD_ALL_PIXEL 0xA4
/* 11: lcd bias set */
#define LCD_BIAS 0xA2
/* 14: Reset Controller */
#define LCD_RESET_CMD 0xE2
/* 15: output mode select (turns display upside-down) */
#define LCD_SCAN_DIR 0xC0
/* 16: power control set */
#define LCD_POWER_CONTROL 0x28
/* 17: voltage regulator resistor ratio set */
#define LCD_VOLTAGE 0x20
/* 18: Volume mode set */
#define LCD_VOLUME_MODE 0x81
/* 22: NOP command */
#define LCD_NO_OP 0xE3
/* 25: advanced program control */
#define LCD_ADV_PROG_CTRL 0xFA
/* 25: advanced program control2 */
#define LCD_ADV_PROG_CTRL2 0x10
#define LCD_TEMPCOMP_HIGH 0x80
/* column offset for normal orientation */
#define SHIFT_ADDR_NORMAL 0
/* column offset for bottom view orientation */
#define SHIFT_ADDR_TOPVIEW 30
static int init_display(struct fbtft_par *par)
{
par->fbtftops.reset(par);
/* softreset of LCD */
write_reg(par, LCD_RESET_CMD);
mdelay(10);
/* set startpoint */
write_reg(par, LCD_START_LINE);
/* select orientation BOTTOMVIEW */
write_reg(par, LCD_BOTTOMVIEW | 1);
/* output mode select (turns display upside-down) */
write_reg(par, LCD_SCAN_DIR | 0x00);
/* Normal Pixel mode */
write_reg(par, LCD_ALL_PIXEL | 0);
/* positive display */
write_reg(par, LCD_DISPLAY_INVERT | 0);
/* bias 1/9 */
write_reg(par, LCD_BIAS | 0);
/* power control mode: all features on */
write_reg(par, LCD_POWER_CONTROL | 0x07);
Annotation
- Immediate include surface: `linux/module.h`, `linux/kernel.h`, `linux/init.h`, `linux/gpio/consumer.h`, `linux/spi/spi.h`, `linux/delay.h`, `fbtft.h`.
- Detected declarations: `function Copyright`, `function set_addr_win`, `function write_vmem`.
- 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.