summaryrefslogtreecommitdiffstats
path: root/include/video
diff options
context:
space:
mode:
authorPhilipp Zabel <p.zabel@pengutronix.de>2023-03-30 14:46:42 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2023-04-05 11:54:37 +0200
commit0a4231985048fbac2d1d2fd375b640df2cfb0540 (patch)
treed699a2264a0c4ce0f2cad0773283d33219af94bd /include/video
parent9190f984ec2cd0fee523a7be640672c8202bdf51 (diff)
downloadbarebox-0a4231985048fbac2d1d2fd375b640df2cfb0540.tar.gz
barebox-0a4231985048fbac2d1d2fd375b640df2cfb0540.tar.xz
video: add MIPI DBI framebuffer helpers
Port helper functions for the panel-mipi-dbi driver from the Linux kernel. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Link: https://lore.barebox.org/20230330124643.3562397-3-p.zabel@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/video')
-rw-r--r--include/video/mipi_dbi.h63
1 files changed, 63 insertions, 0 deletions
diff --git a/include/video/mipi_dbi.h b/include/video/mipi_dbi.h
index 5452600693..917f7ddd59 100644
--- a/include/video/mipi_dbi.h
+++ b/include/video/mipi_dbi.h
@@ -11,6 +11,7 @@
#include <linux/types.h>
#include <spi/spi.h>
#include <driver.h>
+#include <fb.h>
struct regulator;
struct fb_videomode;
@@ -55,6 +56,61 @@ struct mipi_dbi {
struct list_head list;
};
+/**
+ * struct mipi_dbi_dev - MIPI DBI device
+ */
+struct mipi_dbi_dev {
+ /**
+ * @dev: Device
+ */
+ struct device *dev;
+
+ /**
+ * @info: Framebuffer info
+ */
+ struct fb_info info;
+
+ /**
+ * @mode: Fixed display mode
+ */
+ struct fb_videomode mode;
+
+ /**
+ * @tx_buf: Buffer used for transfer (copy clip rect area)
+ */
+ u8 *tx_buf;
+
+ /**
+ * @backlight_node: backlight device node (optional)
+ */
+ struct device_node *backlight_node;
+
+ /**
+ * @backlight: backlight device (optional)
+ */
+ struct backlight_device *backlight;
+
+ /**
+ * @regulator: power regulator (Vdd) (optional)
+ */
+ struct regulator *regulator;
+
+ /**
+ * @io_regulator: I/O power regulator (Vddi) (optional)
+ */
+ struct regulator *io_regulator;
+
+ /**
+ * @dbi: MIPI DBI interface
+ */
+ struct mipi_dbi dbi;
+
+ /**
+ * @driver_private: Driver private data.
+ */
+ void *driver_private;
+};
+
static inline const char *mipi_dbi_name(struct mipi_dbi *dbi)
{
return dev_name(&dbi->spi->dev);
@@ -62,8 +118,15 @@ static inline const char *mipi_dbi_name(struct mipi_dbi *dbi)
int mipi_dbi_spi_init(struct spi_device *spi, struct mipi_dbi *dbi,
int dc);
+int mipi_dbi_dev_init(struct mipi_dbi_dev *dbidev,
+ struct fb_ops *ops, struct fb_videomode *mode);
+void mipi_dbi_fb_flush(struct fb_info *info);
+void mipi_dbi_enable_flush(struct mipi_dbi_dev *dbidev,
+ struct fb_info *info);
+void mipi_dbi_fb_disable(struct fb_info *info);
void mipi_dbi_hw_reset(struct mipi_dbi *dbi);
bool mipi_dbi_display_is_on(struct mipi_dbi *dbi);
+int mipi_dbi_poweron_conditional_reset(struct mipi_dbi_dev *dbidev);
u32 mipi_dbi_spi_cmd_max_speed(struct spi_device *spi, size_t len);
int mipi_dbi_spi_transfer(struct spi_device *spi, u32 speed_hz,