linux/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c

// SPDX-License-Identifier: GPL-2.0+
/*
 * Copyright (c) 2016 Allwinnertech Co., Ltd.
 * Copyright (C) 2017-2018 Bootlin
 *
 * Maxime Ripard <[email protected]>
 */

#include <linux/clk.h>
#include <linux/component.h>
#include <linux/crc-ccitt.h>
#include <linux/module.h>
#include <linux/of_address.h>
#include <linux/phy/phy-mipi-dphy.h>
#include <linux/phy/phy.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
#include <linux/regulator/consumer.h>
#include <linux/reset.h>
#include <linux/slab.h>

#include <drm/drm_atomic_helper.h>
#include <drm/drm_mipi_dsi.h>
#include <drm/drm_panel.h>
#include <drm/drm_print.h>
#include <drm/drm_probe_helper.h>
#include <drm/drm_simple_kms_helper.h>

#include "sun4i_crtc.h"
#include "sun4i_tcon.h"
#include "sun6i_mipi_dsi.h"

#include <video/mipi_display.h>

#define SUN6I_DSI_CTL_REG
#define SUN6I_DSI_CTL_EN

#define SUN6I_DSI_BASIC_CTL_REG
#define SUN6I_DSI_BASIC_CTL_TRAIL_INV(n)
#define SUN6I_DSI_BASIC_CTL_TRAIL_FILL
#define SUN6I_DSI_BASIC_CTL_HBP_DIS
#define SUN6I_DSI_BASIC_CTL_HSA_HSE_DIS
#define SUN6I_DSI_BASIC_CTL_VIDEO_BURST

#define SUN6I_DSI_BASIC_CTL0_REG
#define SUN6I_DSI_BASIC_CTL0_HS_EOTP_EN
#define SUN6I_DSI_BASIC_CTL0_CRC_EN
#define SUN6I_DSI_BASIC_CTL0_ECC_EN
#define SUN6I_DSI_BASIC_CTL0_INST_ST

#define SUN6I_DSI_BASIC_CTL1_REG
#define SUN6I_DSI_BASIC_CTL1_VIDEO_ST_DELAY(n)
#define SUN6I_DSI_BASIC_CTL1_VIDEO_FILL
#define SUN6I_DSI_BASIC_CTL1_VIDEO_PRECISION
#define SUN6I_DSI_BASIC_CTL1_VIDEO_MODE

#define SUN6I_DSI_BASIC_SIZE0_REG
#define SUN6I_DSI_BASIC_SIZE0_VBP(n)
#define SUN6I_DSI_BASIC_SIZE0_VSA(n)

#define SUN6I_DSI_BASIC_SIZE1_REG
#define SUN6I_DSI_BASIC_SIZE1_VT(n)
#define SUN6I_DSI_BASIC_SIZE1_VACT(n)

#define SUN6I_DSI_INST_FUNC_REG(n)
#define SUN6I_DSI_INST_FUNC_INST_MODE(n)
#define SUN6I_DSI_INST_FUNC_ESCAPE_ENTRY(n)
#define SUN6I_DSI_INST_FUNC_TRANS_PACKET(n)
#define SUN6I_DSI_INST_FUNC_LANE_CEN
#define SUN6I_DSI_INST_FUNC_LANE_DEN(n)

#define SUN6I_DSI_INST_LOOP_SEL_REG

#define SUN6I_DSI_INST_LOOP_NUM_REG(n)
#define SUN6I_DSI_INST_LOOP_NUM_N1(n)
#define SUN6I_DSI_INST_LOOP_NUM_N0(n)

#define SUN6I_DSI_INST_JUMP_SEL_REG

#define SUN6I_DSI_INST_JUMP_CFG_REG(n)
#define SUN6I_DSI_INST_JUMP_CFG_TO(n)
#define SUN6I_DSI_INST_JUMP_CFG_POINT(n)
#define SUN6I_DSI_INST_JUMP_CFG_NUM(n)

#define SUN6I_DSI_TRANS_START_REG

#define SUN6I_DSI_TRANS_ZERO_REG

#define SUN6I_DSI_TCON_DRQ_REG
#define SUN6I_DSI_TCON_DRQ_ENABLE_MODE
#define SUN6I_DSI_TCON_DRQ_SET(n)

#define SUN6I_DSI_PIXEL_CTL0_REG
#define SUN6I_DSI_PIXEL_CTL0_PD_PLUG_DISABLE
#define SUN6I_DSI_PIXEL_CTL0_FORMAT(n)

#define SUN6I_DSI_PIXEL_CTL1_REG

#define SUN6I_DSI_PIXEL_PH_REG
#define SUN6I_DSI_PIXEL_PH_ECC(n)
#define SUN6I_DSI_PIXEL_PH_WC(n)
#define SUN6I_DSI_PIXEL_PH_VC(n)
#define SUN6I_DSI_PIXEL_PH_DT(n)

#define SUN6I_DSI_PIXEL_PF0_REG
#define SUN6I_DSI_PIXEL_PF0_CRC_FORCE(n)

#define SUN6I_DSI_PIXEL_PF1_REG
#define SUN6I_DSI_PIXEL_PF1_CRC_INIT_LINEN(n)
#define SUN6I_DSI_PIXEL_PF1_CRC_INIT_LINE0(n)

#define SUN6I_DSI_SYNC_HSS_REG

#define SUN6I_DSI_SYNC_HSE_REG

#define SUN6I_DSI_SYNC_VSS_REG

#define SUN6I_DSI_SYNC_VSE_REG

#define SUN6I_DSI_BLK_HSA0_REG

#define SUN6I_DSI_BLK_HSA1_REG
#define SUN6I_DSI_BLK_PF(n)
#define SUN6I_DSI_BLK_PD(n)

#define SUN6I_DSI_BLK_HBP0_REG

#define SUN6I_DSI_BLK_HBP1_REG

#define SUN6I_DSI_BLK_HFP0_REG

#define SUN6I_DSI_BLK_HFP1_REG

#define SUN6I_DSI_BLK_HBLK0_REG

#define SUN6I_DSI_BLK_HBLK1_REG

#define SUN6I_DSI_BLK_VBLK0_REG

#define SUN6I_DSI_BLK_VBLK1_REG

#define SUN6I_DSI_BURST_LINE_REG
#define SUN6I_DSI_BURST_LINE_SYNC_POINT(n)
#define SUN6I_DSI_BURST_LINE_NUM(n)

#define SUN6I_DSI_BURST_DRQ_REG
#define SUN6I_DSI_BURST_DRQ_EDGE1(n)
#define SUN6I_DSI_BURST_DRQ_EDGE0(n)

#define SUN6I_DSI_CMD_CTL_REG
#define SUN6I_DSI_CMD_CTL_RX_OVERFLOW
#define SUN6I_DSI_CMD_CTL_RX_FLAG
#define SUN6I_DSI_CMD_CTL_TX_FLAG

#define SUN6I_DSI_CMD_RX_REG(n)

#define SUN6I_DSI_DEBUG_DATA_REG

#define SUN6I_DSI_CMD_TX_REG(n)

#define SUN6I_DSI_SYNC_POINT

enum sun6i_dsi_start_inst {};

enum sun6i_dsi_inst_id {};

enum sun6i_dsi_inst_mode {};

enum sun6i_dsi_inst_escape {};

enum sun6i_dsi_inst_packet {};

static const u32 sun6i_dsi_ecc_array[] =;

static u32 sun6i_dsi_ecc_compute(unsigned int data)
{}

static u16 sun6i_dsi_crc_compute(u8 const *buffer, size_t len)
{}

static u16 sun6i_dsi_crc_repeat(u8 pd, u8 *buffer, size_t len)
{}

static u32 sun6i_dsi_build_sync_pkt(u8 dt, u8 vc, u8 d0, u8 d1)
{}

static u32 sun6i_dsi_build_blk0_pkt(u8 vc, u16 wc)
{}

static u32 sun6i_dsi_build_blk1_pkt(u16 pd, u8 *buffer, size_t len)
{}

static void sun6i_dsi_inst_abort(struct sun6i_dsi *dsi)
{}

static void sun6i_dsi_inst_commit(struct sun6i_dsi *dsi)
{}

static int sun6i_dsi_inst_wait_for_completion(struct sun6i_dsi *dsi)
{}

static void sun6i_dsi_inst_setup(struct sun6i_dsi *dsi,
				 enum sun6i_dsi_inst_id id,
				 enum sun6i_dsi_inst_mode mode,
				 bool clock, u8 data,
				 enum sun6i_dsi_inst_packet packet,
				 enum sun6i_dsi_inst_escape escape)
{}

static void sun6i_dsi_inst_init(struct sun6i_dsi *dsi,
				struct mipi_dsi_device *device)
{
	u8 lanes_mask = GENMASK(device->lanes - 1, 0);

	sun6i_dsi_inst_setup(dsi, DSI_INST_ID_LP11, DSI_INST_MODE_STOP,
			     true, lanes_mask, 0, 0);

	sun6i_dsi_inst_setup(dsi, DSI_INST_ID_TBA, DSI_INST_MODE_TBA,
			     false, 1, 0, 0);

	sun6i_dsi_inst_setup(dsi, DSI_INST_ID_HSC, DSI_INST_MODE_HS,
			     true, 0, DSI_INST_PACK_PIXEL, 0);

	sun6i_dsi_inst_setup(dsi, DSI_INST_ID_HSD, DSI_INST_MODE_HS,
			     false, lanes_mask, DSI_INST_PACK_PIXEL, 0);

	sun6i_dsi_inst_setup(dsi, DSI_INST_ID_LPDT, DSI_INST_MODE_ESCAPE,
			     false, 1, DSI_INST_PACK_COMMAND,
			     DSI_INST_ESCA_LPDT);

	sun6i_dsi_inst_setup(dsi, DSI_INST_ID_HSCEXIT, DSI_INST_MODE_HSCEXIT,
			     true, 0, 0, 0);

	sun6i_dsi_inst_setup(dsi, DSI_INST_ID_NOP, DSI_INST_MODE_STOP,
			     false, lanes_mask, 0, 0);

	sun6i_dsi_inst_setup(dsi, DSI_INST_ID_DLY, DSI_INST_MODE_NOP,
			     true, lanes_mask, 0, 0);

	regmap_write(dsi->regs, SUN6I_DSI_INST_JUMP_CFG_REG(0),
		     SUN6I_DSI_INST_JUMP_CFG_POINT(DSI_INST_ID_NOP) |
		     SUN6I_DSI_INST_JUMP_CFG_TO(DSI_INST_ID_HSCEXIT) |
		     SUN6I_DSI_INST_JUMP_CFG_NUM(1));
};

static u16 sun6i_dsi_get_video_start_delay(struct sun6i_dsi *dsi,
					   struct drm_display_mode *mode)
{}

static u16 sun6i_dsi_get_line_num(struct sun6i_dsi *dsi,
				  struct drm_display_mode *mode)
{}

static u16 sun6i_dsi_get_drq_edge0(struct sun6i_dsi *dsi,
				   struct drm_display_mode *mode,
				   u16 line_num, u16 edge1)
{}

static u16 sun6i_dsi_get_drq_edge1(struct sun6i_dsi *dsi,
				   struct drm_display_mode *mode,
				   u16 line_num)
{}

static void sun6i_dsi_setup_burst(struct sun6i_dsi *dsi,
				  struct drm_display_mode *mode)
{}

static void sun6i_dsi_setup_inst_loop(struct sun6i_dsi *dsi,
				      struct drm_display_mode *mode)
{}

static void sun6i_dsi_setup_format(struct sun6i_dsi *dsi,
				   struct drm_display_mode *mode)
{}

static void sun6i_dsi_setup_timings(struct sun6i_dsi *dsi,
				    struct drm_display_mode *mode)
{}

static int sun6i_dsi_start(struct sun6i_dsi *dsi,
			   enum sun6i_dsi_start_inst func)
{}

static void sun6i_dsi_encoder_enable(struct drm_encoder *encoder)
{}

static void sun6i_dsi_encoder_disable(struct drm_encoder *encoder)
{}

static int sun6i_dsi_get_modes(struct drm_connector *connector)
{}

static const struct drm_connector_helper_funcs sun6i_dsi_connector_helper_funcs =;

static enum drm_connector_status
sun6i_dsi_connector_detect(struct drm_connector *connector, bool force)
{}

static const struct drm_connector_funcs sun6i_dsi_connector_funcs =;

static const struct drm_encoder_helper_funcs sun6i_dsi_enc_helper_funcs =;

static u32 sun6i_dsi_dcs_build_pkt_hdr(struct sun6i_dsi *dsi,
				       const struct mipi_dsi_msg *msg)
{}

static int sun6i_dsi_dcs_write_short(struct sun6i_dsi *dsi,
				     const struct mipi_dsi_msg *msg)
{}

static int sun6i_dsi_dcs_write_long(struct sun6i_dsi *dsi,
				    const struct mipi_dsi_msg *msg)
{}

static int sun6i_dsi_dcs_read(struct sun6i_dsi *dsi,
			      const struct mipi_dsi_msg *msg)
{}

static int sun6i_dsi_attach(struct mipi_dsi_host *host,
			    struct mipi_dsi_device *device)
{}

static int sun6i_dsi_detach(struct mipi_dsi_host *host,
			    struct mipi_dsi_device *device)
{}

static ssize_t sun6i_dsi_transfer(struct mipi_dsi_host *host,
				  const struct mipi_dsi_msg *msg)
{}

static const struct mipi_dsi_host_ops sun6i_dsi_host_ops =;

static const struct regmap_config sun6i_dsi_regmap_config =;

static int sun6i_dsi_bind(struct device *dev, struct device *master,
			 void *data)
{}

static void sun6i_dsi_unbind(struct device *dev, struct device *master,
			    void *data)
{}

static const struct component_ops sun6i_dsi_ops =;

static int sun6i_dsi_probe(struct platform_device *pdev)
{}

static void sun6i_dsi_remove(struct platform_device *pdev)
{}

static const struct sun6i_dsi_variant sun6i_a31_mipi_dsi_variant =;

static const struct sun6i_dsi_variant sun50i_a64_mipi_dsi_variant =;

static const struct sun6i_dsi_variant sun50i_a100_mipi_dsi_variant =;

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

static struct platform_driver sun6i_dsi_platform_driver =;
module_platform_driver();

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