drivers/staging/fbtft/fb_pcd8544.c
Source file repositories/reference/linux-study-clean/drivers/staging/fbtft/fb_pcd8544.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/staging/fbtft/fb_pcd8544.c- Extension
.c- Size
- 3510 bytes
- Lines
- 168
- 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 init_displayfunction set_addr_winfunction write_vmemfunction set_gamma
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0+
/*
* FB driver for the PCD8544 LCD Controller
*
* The display is monochrome and the video memory is RGB565.
* Any pixel value except 0 turns the pixel on.
*
* Copyright (C) 2013 Noralf Tronnes
*/
#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_pcd8544"
#define WIDTH 84
#define HEIGHT 48
#define TXBUFLEN (84 * 6)
#define DEFAULT_GAMMA "40" /* gamma controls the contrast in this driver */
static unsigned int tc;
module_param(tc, uint, 0000);
MODULE_PARM_DESC(tc, "TC[1:0] Temperature coefficient: 0-3 (default: 0)");
static unsigned int bs = 4;
module_param(bs, uint, 0000);
MODULE_PARM_DESC(bs, "BS[2:0] Bias voltage level: 0-7 (default: 4)");
static int init_display(struct fbtft_par *par)
{
par->fbtftops.reset(par);
/* Function set
*
* 5:1 1
* 2:0 PD - Powerdown control: chip is active
* 1:0 V - Entry mode: horizontal addressing
* 0:1 H - Extended instruction set control: extended
*/
write_reg(par, 0x21);
/* H=1 Temperature control
*
* 2:1 1
* 1:x TC1 - Temperature Coefficient: 0x10
* 0:x TC0
*/
write_reg(par, 0x04 | (tc & 0x3));
/* H=1 Bias system
*
* 4:1 1
* 3:0 0
* 2:x BS2 - Bias System
* 1:x BS1
* 0:x BS0
*/
write_reg(par, 0x10 | (bs & 0x7));
/* Function set
*
* 5:1 1
* 2:0 PD - Powerdown control: chip is active
* 1:1 V - Entry mode: vertical addressing
* 0:0 H - Extended instruction set control: basic
*/
write_reg(par, 0x22);
/* H=0 Display control
*
* 3:1 1
* 2:1 D - DE: 10=normal mode
* 1:0 0
* 0:0 E
*/
write_reg(par, 0x08 | 4);
return 0;
}
static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye)
{
/* H=0 Set X address of RAM
*
* 7:1 1
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 init_display`, `function set_addr_win`, `function write_vmem`, `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.