linux/drivers/gpu/drm/bridge/tc358775.c

// SPDX-License-Identifier: GPL-2.0
/*
 * TC358775 DSI to LVDS bridge driver
 *
 * Copyright (C) 2020 SMART Wireless Computing
 * Author: Vinay Simha BN <[email protected]>
 *
 */
/* #define DEBUG */
#include <linux/bitfield.h>
#include <linux/clk.h>
#include <linux/device.h>
#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
#include <linux/kernel.h>
#include <linux/media-bus-format.h>
#include <linux/module.h>
#include <linux/of_device.h>
#include <linux/regulator/consumer.h>
#include <linux/slab.h>

#include <asm/unaligned.h>

#include <drm/display/drm_dp_helper.h>
#include <drm/drm_atomic_helper.h>
#include <drm/drm_bridge.h>
#include <drm/drm_mipi_dsi.h>
#include <drm/drm_of.h>
#include <drm/drm_panel.h>
#include <drm/drm_probe_helper.h>

#define FLD_VAL(val, start, end)

/* Registers */

/* DSI D-PHY Layer Registers */
#define D0W_DPHYCONTTX
#define CLW_DPHYCONTRX
#define D0W_DPHYCONTRX
#define D1W_DPHYCONTRX
#define D2W_DPHYCONTRX
#define D3W_DPHYCONTRX
#define COM_DPHYCONTRX
#define CLW_CNTRL
#define D0W_CNTRL
#define D1W_CNTRL
#define D2W_CNTRL
#define D3W_CNTRL
#define DFTMODE_CNTRL

/* DSI PPI Layer Registers */
#define PPI_STARTPPI
#define PPI_START_FUNCTION

#define PPI_BUSYPPI
#define PPI_LINEINITCNT
#define PPI_LPTXTIMECNT
#define PPI_LANEENABLE
#define PPI_TX_RX_TA

/* Analog timer function enable */
#define PPI_CLS_ATMR
#define PPI_D0S_ATMR
#define PPI_D1S_ATMR
#define PPI_D2S_ATMR
#define PPI_D3S_ATMR

#define PPI_D0S_CLRSIPOCOUNT
#define PPI_D1S_CLRSIPOCOUNT
#define PPI_D2S_CLRSIPOCOUNT
#define PPI_D3S_CLRSIPOCOUNT

#define CLS_PRE
#define D0S_PRE
#define D1S_PRE
#define D2S_PRE
#define D3S_PRE
#define CLS_PREP
#define D0S_PREP
#define D1S_PREP
#define D2S_PREP
#define D3S_PREP
#define CLS_ZERO
#define D0S_ZERO
#define D1S_ZERO
#define D2S_ZERO
#define D3S_ZERO

#define PPI_CLRFLG
#define PPI_CLRSIPO
#define HSTIMEOUT
#define HSTIMEOUTENABLE
#define DSI_STARTDSI
#define DSI_RX_START

#define DSI_BUSYDSI
#define DSI_LANEENABLE
#define DSI_LANESTATUS0
#define DSI_LANESTATUS1

#define DSI_INTSTATUS
#define DSI_INTMASK
#define DSI_INTCLR
#define DSI_LPTXTO

#define DSIERRCNT
#define APLCTRL
#define RDPKTLN

#define VPCTRL
#define EVTMODE
#define HTIM1
#define HTIM2
#define VTIM1
#define VTIM2
#define VFUEN
#define VFUEN_EN

/* Mux Input Select for LVDS LINK Input */
#define LV_MX0003
#define LV_MX0407
#define LV_MX0811
#define LV_MX1215
#define LV_MX1619
#define LV_MX2023
#define LV_MX2427
#define LV_MX(b0, b1, b2, b3)

/* Input bit numbers used in mux registers */
enum {};

#define LVCFG
#define LVPHY0
#define LV_PHY0_RST(v)
#define LV_PHY0_IS(v)
#define LV_PHY0_ND(v)
#define LV_PHY0_PRBS_ON(v)

#define LVPHY1
#define SYSSTAT
#define SYSRST

#define SYS_RST_I2CS
#define SYS_RST_I2CM
#define SYS_RST_LCD
#define SYS_RST_BM
#define SYS_RST_DSIRX
#define SYS_RST_REG

/* GPIO Registers */
#define GPIOC
#define GPIOO
#define GPIOI

/* I2C Registers */
#define I2CTIMCTRL
#define I2CMADDR
#define WDATAQ
#define RDATAQ

/* Chip ID and Revision ID Register */
#define IDREG

#define LPX_PERIOD
#define TTA_GET
#define TTA_SURE
#define SINGLE_LINK
#define DUAL_LINK

#define TC358775XBG_ID

/* Debug Registers */
#define DEBUG00
#define DEBUG01

#define DSI_CLEN_BIT
#define DIVIDE_BY_3
#define DIVIDE_BY_6
#define LVCFG_LVEN_BIT

#define L0EN

#define TC358775_VPCTRL_VSDELAY__MASK
#define TC358775_VPCTRL_VSDELAY__SHIFT
static inline u32 TC358775_VPCTRL_VSDELAY(uint32_t val)
{}

#define TC358775_VPCTRL_OPXLFMT__MASK
#define TC358775_VPCTRL_OPXLFMT__SHIFT
static inline u32 TC358775_VPCTRL_OPXLFMT(uint32_t val)
{}

#define TC358775_VPCTRL_MSF__MASK
#define TC358775_VPCTRL_MSF__SHIFT
static inline u32 TC358775_VPCTRL_MSF(uint32_t val)
{}

#define TC358775_LVCFG_PCLKDIV__MASK
#define TC358775_LVCFG_PCLKDIV__SHIFT
static inline u32 TC358775_LVCFG_PCLKDIV(uint32_t val)
{}

#define TC358775_LVCFG_LVDLINK__MASK
#define TC358775_LVCFG_LVDLINK__SHIFT
static inline u32 TC358775_LVCFG_LVDLINK(uint32_t val)
{}

enum tc358775_ports {};

enum tc3587x5_type {};

struct tc_data {};

static inline struct tc_data *bridge_to_tc(struct drm_bridge *b)
{}

static void tc_bridge_pre_enable(struct drm_bridge *bridge)
{}

static void tc_bridge_post_disable(struct drm_bridge *bridge)
{}

static void d2l_read(struct i2c_client *i2c, u16 addr, u32 *val)
{}

static void d2l_write(struct i2c_client *i2c, u16 addr, u32 val)
{}

/* helper function to access bus_formats */
static struct drm_connector *get_connector(struct drm_encoder *encoder)
{}

static void tc_bridge_enable(struct drm_bridge *bridge)
{}

static enum drm_mode_status
tc_mode_valid(struct drm_bridge *bridge,
	      const struct drm_display_info *info,
	      const struct drm_display_mode *mode)
{}

static int tc358775_parse_dt(struct device_node *np, struct tc_data *tc)
{}

static int tc_bridge_attach(struct drm_bridge *bridge,
			    enum drm_bridge_attach_flags flags)
{}

static const struct drm_bridge_funcs tc_bridge_funcs =;

static int tc_attach_host(struct tc_data *tc)
{}

static int tc_probe(struct i2c_client *client)
{}

static void tc_remove(struct i2c_client *client)
{}

static const struct i2c_device_id tc358775_i2c_ids[] =;
MODULE_DEVICE_TABLE(i2c, tc358775_i2c_ids);

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

static struct i2c_driver tc358775_driver =;
module_i2c_driver();

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