drivers/gpu/drm/panel/panel-tpo-td043mtea1.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/panel/panel-tpo-td043mtea1.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/panel/panel-tpo-td043mtea1.c- Extension
.c- Size
- 11734 bytes
- Lines
- 505
- Domain
- Driver Families
- Bucket
- drivers/gpu
- 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/delay.hlinux/module.hlinux/regulator/consumer.hlinux/spi/spi.hdrm/drm_connector.hdrm/drm_modes.hdrm/drm_panel.h
Detected Declarations
struct td043mtea1_panelfunction td043mtea1_writefunction td043mtea1_write_gammafunction td043mtea1_write_mirrorfunction td043mtea1_power_onfunction td043mtea1_power_offfunction vmirror_showfunction vmirror_storefunction mode_showfunction mode_storefunction gamma_showfunction gamma_storefunction td043mtea1_unpreparefunction td043mtea1_preparefunction td043mtea1_get_modesfunction td043mtea1_suspendfunction td043mtea1_resumefunction td043mtea1_probefunction td043mtea1_remove
Annotated Snippet
struct td043mtea1_panel {
struct drm_panel panel;
struct spi_device *spi;
struct regulator *vcc_reg;
struct gpio_desc *reset_gpio;
unsigned int mode;
u16 gamma[12];
bool vmirror;
bool powered_on;
bool spi_suspended;
bool power_on_resume;
};
#define to_td043mtea1_device(p) container_of(p, struct td043mtea1_panel, panel)
/* -----------------------------------------------------------------------------
* Hardware Access
*/
static int td043mtea1_write(struct td043mtea1_panel *lcd, u8 addr, u8 value)
{
struct spi_message msg;
struct spi_transfer xfer;
u16 data;
int ret;
spi_message_init(&msg);
memset(&xfer, 0, sizeof(xfer));
data = ((u16)addr << 10) | (1 << 8) | value;
xfer.tx_buf = &data;
xfer.bits_per_word = 16;
xfer.len = 2;
spi_message_add_tail(&xfer, &msg);
ret = spi_sync(lcd->spi, &msg);
if (ret < 0)
dev_warn(&lcd->spi->dev, "failed to write to LCD reg (%d)\n",
ret);
return ret;
}
static void td043mtea1_write_gamma(struct td043mtea1_panel *lcd)
{
const u16 *gamma = lcd->gamma;
unsigned int i;
u8 val;
/* gamma bits [9:8] */
for (val = i = 0; i < 4; i++)
val |= (gamma[i] & 0x300) >> ((i + 1) * 2);
td043mtea1_write(lcd, 0x11, val);
for (val = i = 0; i < 4; i++)
val |= (gamma[i + 4] & 0x300) >> ((i + 1) * 2);
td043mtea1_write(lcd, 0x12, val);
for (val = i = 0; i < 4; i++)
val |= (gamma[i + 8] & 0x300) >> ((i + 1) * 2);
td043mtea1_write(lcd, 0x13, val);
/* gamma bits [7:0] */
for (i = 0; i < 12; i++)
td043mtea1_write(lcd, 0x14 + i, gamma[i] & 0xff);
}
static int td043mtea1_write_mirror(struct td043mtea1_panel *lcd)
{
u8 reg4 = TPO_R04_NFLIP_H | TPO_R04_NFLIP_V |
TPO_R04_CP_CLK_FREQ_1H | TPO_R04_VGL_FREQ_1H;
if (lcd->vmirror)
reg4 &= ~TPO_R04_NFLIP_V;
return td043mtea1_write(lcd, 4, reg4);
}
static int td043mtea1_power_on(struct td043mtea1_panel *lcd)
{
int ret;
if (lcd->powered_on)
return 0;
ret = regulator_enable(lcd->vcc_reg);
if (ret < 0)
return ret;
Annotation
- Immediate include surface: `linux/delay.h`, `linux/module.h`, `linux/regulator/consumer.h`, `linux/spi/spi.h`, `drm/drm_connector.h`, `drm/drm_modes.h`, `drm/drm_panel.h`.
- Detected declarations: `struct td043mtea1_panel`, `function td043mtea1_write`, `function td043mtea1_write_gamma`, `function td043mtea1_write_mirror`, `function td043mtea1_power_on`, `function td043mtea1_power_off`, `function vmirror_show`, `function vmirror_store`, `function mode_show`, `function mode_store`.
- Atlas domain: Driver Families / drivers/gpu.
- 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.