drivers/gpu/drm/panel/panel-sony-acx565akm.c

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/panel/panel-sony-acx565akm.c

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/panel/panel-sony-acx565akm.c
Extension
.c
Size
15926 bytes
Lines
683
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 acx565akm_panel {
	struct drm_panel panel;

	struct spi_device *spi;
	struct gpio_desc *reset_gpio;
	struct backlight_device *backlight;

	struct mutex mutex;

	const char *name;
	u8 display_id[3];
	int model;
	int revision;
	bool has_bc;
	bool has_cabc;

	bool enabled;
	unsigned int cabc_mode;
	/*
	 * Next value of jiffies when we can issue the next sleep in/out
	 * command.
	 */
	unsigned long hw_guard_end;
	unsigned long hw_guard_wait;		/* max guard time in jiffies */
};

#define to_acx565akm_device(p) container_of(p, struct acx565akm_panel, panel)

static void acx565akm_transfer(struct acx565akm_panel *lcd, int cmd,
			      const u8 *wbuf, int wlen, u8 *rbuf, int rlen)
{
	struct spi_message	m;
	struct spi_transfer	*x, xfer[5];
	int			ret;

	spi_message_init(&m);

	memset(xfer, 0, sizeof(xfer));
	x = &xfer[0];

	cmd &=  0xff;
	x->tx_buf = &cmd;
	x->bits_per_word = 9;
	x->len = 2;

	if (rlen > 1 && wlen == 0) {
		/*
		 * Between the command and the response data there is a
		 * dummy clock cycle. Add an extra bit after the command
		 * word to account for this.
		 */
		x->bits_per_word = 10;
		cmd <<= 1;
	}
	spi_message_add_tail(x, &m);

	if (wlen) {
		x++;
		x->tx_buf = wbuf;
		x->len = wlen;
		x->bits_per_word = 9;
		spi_message_add_tail(x, &m);
	}

	if (rlen) {
		x++;
		x->rx_buf	= rbuf;
		x->len		= rlen;
		spi_message_add_tail(x, &m);
	}

	ret = spi_sync(lcd->spi, &m);
	if (ret < 0)
		dev_dbg(&lcd->spi->dev, "spi_sync %d\n", ret);
}

static inline void acx565akm_cmd(struct acx565akm_panel *lcd, int cmd)
{
	acx565akm_transfer(lcd, cmd, NULL, 0, NULL, 0);
}

static inline void acx565akm_write(struct acx565akm_panel *lcd,
			       int reg, const u8 *buf, int len)
{
	acx565akm_transfer(lcd, reg, buf, len, NULL, 0);
}

static inline void acx565akm_read(struct acx565akm_panel *lcd,
			      int reg, u8 *buf, int len)
{

Annotation

Implementation Notes