drivers/gpu/drm/panel/panel-novatek-nt35950.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/panel/panel-novatek-nt35950.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/panel/panel-novatek-nt35950.c- Extension
.c- Size
- 16409 bytes
- Lines
- 609
- 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/gpio/consumer.hlinux/module.hlinux/of.hlinux/of_graph.hlinux/regulator/consumer.hdrm/drm_connector.hdrm/drm_crtc.hdrm/drm_mipi_dsi.hdrm/drm_modes.hdrm/drm_panel.h
Detected Declarations
struct nt35950struct nt35950_panel_modestruct nt35950_panel_descfunction nt35950_resetfunction nt35950_set_cmd2_pagefunction nt35950_set_data_compressionfunction nt35950_set_scalerfunction nt35950_set_scale_modefunction changesfunction nt35950_set_dispoutfunction nt35950_get_current_modefunction nt35950_onfunction nt35950_offfunction nt35950_sharp_init_vregsfunction nt35950_preparefunction nt35950_unpreparefunction nt35950_get_modesfunction nt35950_probefunction nt35950_remove
Annotated Snippet
struct nt35950 {
struct drm_panel panel;
struct drm_connector *connector;
struct mipi_dsi_device *dsi[2];
struct regulator_bulk_data vregs[NT35950_VREG_MAX];
struct gpio_desc *reset_gpio;
const struct nt35950_panel_desc *desc;
int cur_mode;
u8 last_page;
};
struct nt35950_panel_mode {
const struct drm_display_mode mode;
bool enable_sram;
bool is_video_mode;
u8 scaler_on;
u8 scaler_mode;
u8 compression;
u8 spr_en;
u8 spr_mode;
};
struct nt35950_panel_desc {
const char *model_name;
const struct mipi_dsi_device_info dsi_info;
const struct nt35950_panel_mode *mode_data;
bool is_dual_dsi;
u8 num_lanes;
u8 num_modes;
};
static inline struct nt35950 *to_nt35950(struct drm_panel *panel)
{
return container_of(panel, struct nt35950, panel);
}
static void nt35950_reset(struct nt35950 *nt)
{
gpiod_set_value_cansleep(nt->reset_gpio, 1);
usleep_range(12000, 13000);
gpiod_set_value_cansleep(nt->reset_gpio, 0);
usleep_range(300, 400);
gpiod_set_value_cansleep(nt->reset_gpio, 1);
usleep_range(12000, 13000);
}
/*
* nt35950_set_cmd2_page - Select manufacturer control (CMD2) page
* @dsi_ctx: context for mipi_dsi functions
* @nt: Main driver structure
* @page: Page number (0-7)
*/
static void nt35950_set_cmd2_page(struct mipi_dsi_multi_context *dsi_ctx,
struct nt35950 *nt, u8 page)
{
const u8 mauc_cmd2_page[] = { MCS_CMD_MAUCCTR, 0x55, 0xaa, 0x52,
0x08, page };
mipi_dsi_dcs_write_buffer_multi(dsi_ctx, mauc_cmd2_page,
ARRAY_SIZE(mauc_cmd2_page));
if (!dsi_ctx->accum_err)
nt->last_page = page;
}
/*
* nt35950_set_data_compression - Set data compression mode
* @dsi_ctx: context for mipi_dsi functions
* @nt: Main driver structure
* @comp_mode: Compression mode
*/
static void nt35950_set_data_compression(struct mipi_dsi_multi_context *dsi_ctx,
struct nt35950 *nt, u8 comp_mode)
{
u8 cmd_data_compression[] = { MCS_PARAM_DATA_COMPRESSION, comp_mode };
u8 cmd_vesa_dsc_on[] = { MCS_PARAM_VESA_DSC_ON, !!comp_mode };
u8 cmd_vesa_dsc_setting[] = { MCS_PARAM_VESA_DSC_SETTING, 0x03 };
u8 last_page = nt->last_page;
/* Set CMD2 Page 0 if we're not there yet */
if (last_page != 0)
nt35950_set_cmd2_page(dsi_ctx, nt, 0);
mipi_dsi_dcs_write_buffer_multi(dsi_ctx, cmd_data_compression,
ARRAY_SIZE(cmd_data_compression));
mipi_dsi_dcs_write_buffer_multi(dsi_ctx, cmd_vesa_dsc_on,
ARRAY_SIZE(cmd_vesa_dsc_on));
Annotation
- Immediate include surface: `linux/delay.h`, `linux/gpio/consumer.h`, `linux/module.h`, `linux/of.h`, `linux/of_graph.h`, `linux/regulator/consumer.h`, `drm/drm_connector.h`, `drm/drm_crtc.h`.
- Detected declarations: `struct nt35950`, `struct nt35950_panel_mode`, `struct nt35950_panel_desc`, `function nt35950_reset`, `function nt35950_set_cmd2_page`, `function nt35950_set_data_compression`, `function nt35950_set_scaler`, `function nt35950_set_scale_mode`, `function changes`, `function nt35950_set_dispout`.
- 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.