linux/drivers/gpu/drm/panel/panel-ilitek-ili9341.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Ilitek ILI9341 TFT LCD drm_panel driver.
 *
 * This panel can be configured to support:
 * - 16-bit parallel RGB interface
 * - 18-bit parallel RGB interface
 * - 4-line serial spi interface
 *
 * Copyright (C) 2021 Dillon Min <[email protected]>
 *
 * For dbi+dpi part:
 * Derived from drivers/drm/gpu/panel/panel-ilitek-ili9322.c
 * the reuse of DBI abstraction part referred from Linus's patch
 * "drm/panel: s6e63m0: Switch to DBI abstraction for SPI"
 *
 * For only-dbi part, copy from David's code (drm/tiny/ili9341.c)
 * Copyright 2018 David Lechner <[email protected]>
 */

#include <linux/backlight.h>
#include <linux/bitops.h>
#include <linux/delay.h>
#include <linux/gpio/consumer.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/property.h>
#include <linux/regulator/consumer.h>
#include <linux/spi/spi.h>

#include <video/mipi_display.h>

#include <drm/drm_atomic_helper.h>
#include <drm/drm_drv.h>
#include <drm/drm_fbdev_dma.h>
#include <drm/drm_gem_atomic_helper.h>
#include <drm/drm_gem_dma_helper.h>
#include <drm/drm_gem_framebuffer_helper.h>
#include <drm/drm_mipi_dbi.h>
#include <drm/drm_modes.h>
#include <drm/drm_panel.h>
#include <drm/drm_print.h>

#define ILI9341_RGB_INTERFACE
#define ILI9341_FRC
#define ILI9341_DFC
#define ILI9341_POWER1
#define ILI9341_POWER2
#define ILI9341_VCOM1
#define ILI9341_VCOM2
#define ILI9341_POWERA
#define ILI9341_POWERB
#define ILI9341_PGAMMA
#define ILI9341_NGAMMA
#define ILI9341_DTCA
#define ILI9341_DTCB
#define ILI9341_POWER_SEQ
#define ILI9341_3GAMMA_EN
#define ILI9341_INTERFACE
#define ILI9341_PRC
#define ILI9341_ETMOD

#define ILI9341_MADCTL_BGR
#define ILI9341_MADCTL_MV
#define ILI9341_MADCTL_MX
#define ILI9341_MADCTL_MY

#define ILI9341_POWER_B_LEN
#define ILI9341_POWER_SEQ_LEN
#define ILI9341_DTCA_LEN
#define ILI9341_DTCB_LEN
#define ILI9341_POWER_A_LEN
#define ILI9341_DFC_1_LEN
#define ILI9341_FRC_LEN
#define ILI9341_VCOM_1_LEN
#define ILI9341_DFC_2_LEN
#define ILI9341_COLUMN_ADDR_LEN
#define ILI9341_PAGE_ADDR_LEN
#define ILI9341_INTERFACE_LEN
#define ILI9341_PGAMMA_LEN
#define ILI9341_NGAMMA_LEN
#define ILI9341_CA_LEN

#define ILI9341_PIXEL_DPI_16_BITS
#define ILI9341_PIXEL_DPI_18_BITS
#define ILI9341_GAMMA_CURVE_1
#define ILI9341_IF_WE_MODE
#define ILI9341_IF_BIG_ENDIAN
#define ILI9341_IF_DM_RGB
#define ILI9341_IF_DM_INTERNAL
#define ILI9341_IF_DM_VSYNC
#define ILI9341_IF_RM_RGB
#define ILI9341_IF_RIM_RGB

#define ILI9341_COLUMN_ADDR
#define ILI9341_PAGE_ADDR

#define ILI9341_RGB_EPL
#define ILI9341_RGB_DPL
#define ILI9341_RGB_HSPL
#define ILI9341_RGB_VSPL
#define ILI9341_RGB_DE_MODE
#define ILI9341_RGB_DISP_PATH_MEM

#define ILI9341_DBI_VCOMH_4P6V
#define ILI9341_DBI_PWR_2_DEFAULT
#define ILI9341_DBI_PRC_NORMAL
#define ILI9341_DBI_VCOM_1_VMH_4P25V
#define ILI9341_DBI_VCOM_1_VML_1P5V
#define ILI9341_DBI_VCOM_2_DEC_58
#define ILI9341_DBI_FRC_DIVA
#define ILI9341_DBI_FRC_RTNA
#define ILI9341_DBI_EMS_GAS
#define ILI9341_DBI_EMS_DTS
#define ILI9341_DBI_EMS_GON

/* struct ili9341_config - the system specific ILI9341 configuration */
struct ili9341_config {};

struct ili9341 {};

/*
 * The Stm32f429-disco board has a panel ili9341 connected to ltdc controller
 */
static const struct ili9341_config ili9341_stm32f429_disco_data =;

static inline struct ili9341 *panel_to_ili9341(struct drm_panel *panel)
{}

static void ili9341_dpi_init(struct ili9341 *ili)
{}

static int ili9341_dpi_power_on(struct ili9341 *ili)
{}

static int ili9341_dpi_power_off(struct ili9341 *ili)
{}

static int ili9341_dpi_disable(struct drm_panel *panel)
{}

static int ili9341_dpi_unprepare(struct drm_panel *panel)
{}

static int ili9341_dpi_prepare(struct drm_panel *panel)
{}

static int ili9341_dpi_enable(struct drm_panel *panel)
{}

static int ili9341_dpi_get_modes(struct drm_panel *panel,
				 struct drm_connector *connector)
{}

static const struct drm_panel_funcs ili9341_dpi_funcs =;

static void ili9341_dbi_enable(struct drm_simple_display_pipe *pipe,
			       struct drm_crtc_state *crtc_state,
			       struct drm_plane_state *plane_state)
{}

static const struct drm_simple_display_pipe_funcs ili9341_dbi_funcs =;

static const struct drm_display_mode ili9341_dbi_mode =;

DEFINE_DRM_GEM_DMA_FOPS(ili9341_dbi_fops);

static struct drm_driver ili9341_dbi_driver =;

static int ili9341_dbi_probe(struct spi_device *spi, struct gpio_desc *dc,
			     struct gpio_desc *reset)
{}

static int ili9341_dpi_probe(struct spi_device *spi, struct gpio_desc *dc,
			     struct gpio_desc *reset)
{}

static int ili9341_probe(struct spi_device *spi)
{}

static void ili9341_remove(struct spi_device *spi)
{}

static void ili9341_shutdown(struct spi_device *spi)
{}

static const struct of_device_id ili9341_of_match[] =;
MODULE_DEVICE_TABLE(of, ili9341_of_match);

static const struct spi_device_id ili9341_id[] =;
MODULE_DEVICE_TABLE(spi, ili9341_id);

static struct spi_driver ili9341_driver =;
module_spi_driver();

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();