drivers/gpu/drm/panel/panel-samsung-db7430.c

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/panel/panel-samsung-db7430.c

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/panel/panel-samsung-db7430.c
Extension
.c
Size
10043 bytes
Lines
349
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.

Dependency Surface

Detected Declarations

Annotated Snippet

struct db7430 {
	/** @dev: the container device */
	struct device *dev;
	/** @dbi: the DBI bus abstraction handle */
	struct mipi_dbi dbi;
	/** @panel: the DRM panel instance for this device */
	struct drm_panel panel;
	/** @reset: reset GPIO line */
	struct gpio_desc *reset;
	/** @regulators: VCCIO and VIO supply regulators */
	struct regulator_bulk_data regulators[2];
};

static const struct drm_display_mode db7430_480_800_mode = {
	/*
	 * 31 ns period min (htotal*vtotal*vrefresh)/1000
	 * gives a Vrefresh of ~71 Hz.
	 */
	.clock = 32258,
	.hdisplay = 480,
	.hsync_start = 480 + 10,
	.hsync_end = 480 + 10 + 4,
	.htotal = 480 + 10 + 4 + 40,
	.vdisplay = 800,
	.vsync_start = 800 + 6,
	.vsync_end = 800 + 6 + 1,
	.vtotal = 800 + 6 + 1 + 7,
	.width_mm = 53,
	.height_mm = 87,
	.flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
};

static inline struct db7430 *to_db7430(struct drm_panel *panel)
{
	return container_of(panel, struct db7430, panel);
}

static int db7430_power_on(struct db7430 *db)
{
	struct mipi_dbi *dbi = &db->dbi;
	int ret;

	/* Power up */
	ret = regulator_bulk_enable(ARRAY_SIZE(db->regulators),
				    db->regulators);
	if (ret) {
		dev_err(db->dev, "failed to enable regulators: %d\n", ret);
		return ret;
	}
	msleep(50);

	/* Assert reset >=1 ms */
	gpiod_set_value_cansleep(db->reset, 1);
	usleep_range(1000, 5000);
	/* De-assert reset */
	gpiod_set_value_cansleep(db->reset, 0);
	/* Wait >= 10 ms */
	msleep(10);
	dev_dbg(db->dev, "de-asserted RESET\n");

	/*
	 * This is set to 0x0a (RGB/BGR order + horizontal flip) in order
	 * to make the display behave normally. If this is not set the displays
	 * normal output behaviour is horizontally flipped and BGR ordered. Do
	 * it twice because the first message doesn't always "take".
	 */
	mipi_dbi_command(dbi, MIPI_DCS_SET_ADDRESS_MODE, 0x0a);
	mipi_dbi_command(dbi, MIPI_DCS_SET_ADDRESS_MODE, 0x0a);
	mipi_dbi_command(dbi, DB7430_ACCESS_PROT_OFF, 0x00);
	mipi_dbi_command(dbi, DB7430_PANEL_DRIVING, 0x28, 0x08);
	mipi_dbi_command(dbi, DB7430_SOURCE_CONTROL,
			 0x01, 0x30, 0x15, 0x05, 0x22);
	mipi_dbi_command(dbi, DB7430_GATE_INTERFACE,
			 0x10, 0x01, 0x00);
	mipi_dbi_command(dbi, DB7430_DISPLAY_H_TIMING,
			 0x06, 0x55, 0x03, 0x07, 0x0b,
			 0x33, 0x00, 0x01, 0x03);
	/*
	 * 0x00 in datasheet 0x01 in vendor code 0x00, it seems 0x01 means
	 * DE active high and 0x00 means DE active low.
	 */
	mipi_dbi_command(dbi, DB7430_RGB_SYNC_OPTION, 0x01);
	mipi_dbi_command(dbi, DB7430_GAMMA_SET_RED,
		/* R positive gamma */ 0x00,
		0x0A, 0x31, 0x3B, 0x4E, 0x58, 0x59, 0x5B, 0x58, 0x5E, 0x62,
		0x60, 0x61, 0x5E, 0x62, 0x55, 0x55, 0x7F, 0x08,
		/* R negative gamma */ 0x00,
		0x0A, 0x31, 0x3B, 0x4E, 0x58, 0x59, 0x5B, 0x58, 0x5E, 0x62,
		0x60, 0x61, 0x5E, 0x62, 0x55, 0x55, 0x7F, 0x08);
	mipi_dbi_command(dbi, DB7430_GAMMA_SET_GREEN,

Annotation

Implementation Notes