linux/drivers/phy/rockchip/phy-rockchip-samsung-hdptx.c

// SPDX-License-Identifier: GPL-2.0+
/*
 * Copyright (c) 2021-2022 Rockchip Electronics Co., Ltd.
 * Copyright (c) 2024 Collabora Ltd.
 *
 * Author: Algea Cao <[email protected]>
 * Author: Cristian Ciocaltea <[email protected]>
 */
#include <linux/bitfield.h>
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/mfd/syscon.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/phy/phy.h>
#include <linux/platform_device.h>
#include <linux/rational.h>
#include <linux/regmap.h>
#include <linux/reset.h>

#define GRF_HDPTX_CON0
#define HDPTX_I_PLL_EN
#define HDPTX_I_BIAS_EN
#define HDPTX_I_BGR_EN
#define GRF_HDPTX_STATUS
#define HDPTX_O_PLL_LOCK_DONE
#define HDPTX_O_PHY_CLK_RDY
#define HDPTX_O_PHY_RDY
#define HDPTX_O_SB_RDY

#define HDTPX_REG(_n, _min, _max)

#define CMN_REG(n)
#define SB_REG(n)
#define LNTOP_REG(n)
#define LANE_REG(n)

/* CMN_REG(0008) */
#define LCPLL_EN_MASK
#define LCPLL_LCVCO_MODE_EN_MASK
/* CMN_REG(001e) */
#define LCPLL_PI_EN_MASK
#define LCPLL_100M_CLK_EN_MASK
/* CMN_REG(0025) */
#define LCPLL_PMS_IQDIV_RSTN
/* CMN_REG(0028) */
#define LCPLL_SDC_FRAC_EN
#define LCPLL_SDC_FRAC_RSTN
/* CMN_REG(002d) */
#define LCPLL_SDC_N_MASK
/* CMN_REG(002e) */
#define LCPLL_SDC_NUMBERATOR_MASK
/* CMN_REG(002f) */
#define LCPLL_SDC_DENOMINATOR_MASK
#define LCPLL_SDC_NDIV_RSTN
/* CMN_REG(003d) */
#define ROPLL_LCVCO_EN
/* CMN_REG(004e) */
#define ROPLL_PI_EN
/* CMN_REG(005c) */
#define ROPLL_PMS_IQDIV_RSTN
/* CMN_REG(005e) */
#define ROPLL_SDM_EN_MASK
#define ROPLL_SDM_FRAC_EN_RBR
#define ROPLL_SDM_FRAC_EN_HBR
#define ROPLL_SDM_FRAC_EN_HBR2
#define ROPLL_SDM_FRAC_EN_HBR3
/* CMN_REG(0064) */
#define ROPLL_SDM_NUM_SIGN_RBR_MASK
/* CMN_REG(0069) */
#define ROPLL_SDC_N_RBR_MASK
/* CMN_REG(0074) */
#define ROPLL_SDC_NDIV_RSTN
#define ROPLL_SSC_EN
/* CMN_REG(0081) */
#define OVRD_PLL_CD_CLK_EN
#define PLL_CD_HSCLK_EAST_EN
/* CMN_REG(0086) */
#define PLL_PCG_POSTDIV_SEL_MASK
#define PLL_PCG_CLK_SEL_MASK
#define PLL_PCG_CLK_EN
/* CMN_REG(0087) */
#define PLL_FRL_MODE_EN
#define PLL_TX_HS_CLK_EN
/* CMN_REG(0089) */
#define LCPLL_ALONE_MODE
/* CMN_REG(0097) */
#define DIG_CLK_SEL
#define ROPLL_REF
#define LCPLL_REF
/* CMN_REG(0099) */
#define CMN_ROPLL_ALONE_MODE
#define ROPLL_ALONE_MODE
/* CMN_REG(009a) */
#define HS_SPEED_SEL
#define DIV_10_CLOCK
/* CMN_REG(009b) */
#define IS_SPEED_SEL
#define LINK_SYMBOL_CLOCK
#define LINK_SYMBOL_CLOCK1_2

/* SB_REG(0102) */
#define OVRD_SB_RXTERM_EN_MASK
#define SB_RXTERM_EN_MASK
#define ANA_SB_RXTERM_OFFSP_MASK
/* SB_REG(0103) */
#define ANA_SB_RXTERM_OFFSN_MASK
#define OVRD_SB_RX_RESCAL_DONE_MASK
#define SB_RX_RESCAL_DONE_MASK
/* SB_REG(0104) */
#define OVRD_SB_EN_MASK
#define SB_EN_MASK
/* SB_REG(0105) */
#define OVRD_SB_EARC_CMDC_EN_MASK
#define SB_EARC_CMDC_EN_MASK
#define ANA_SB_TX_HLVL_PROG_MASK
/* SB_REG(0106) */
#define ANA_SB_TX_LLVL_PROG_MASK
/* SB_REG(0109) */
#define ANA_SB_DMRX_AFC_DIV_RATIO_MASK
/* SB_REG(010f) */
#define OVRD_SB_VREG_EN_MASK
#define SB_VREG_EN_MASK
#define OVRD_SB_VREG_LPF_BYPASS_MASK
#define SB_VREG_LPF_BYPASS_MASK
#define ANA_SB_VREG_GAIN_CTRL_MASK
/* SB_REG(0110) */
#define ANA_SB_VREG_REF_SEL_MASK
/* SB_REG(0113) */
#define SB_RX_RCAL_OPT_CODE_MASK
#define SB_RX_RTERM_CTRL_MASK
/* SB_REG(0114) */
#define SB_TG_SB_EN_DELAY_TIME_MASK
#define SB_TG_RXTERM_EN_DELAY_TIME_MASK
/* SB_REG(0115) */
#define SB_READY_DELAY_TIME_MASK
#define SB_TG_OSC_EN_DELAY_TIME_MASK
/* SB_REG(0116) */
#define AFC_RSTN_DELAY_TIME_MASK
/* SB_REG(0117) */
#define FAST_PULSE_TIME_MASK
/* SB_REG(011b) */
#define SB_EARC_SIG_DET_BYPASS_MASK
#define SB_AFC_TOL_MASK
/* SB_REG(011f) */
#define SB_PWM_AFC_CTRL_MASK
#define SB_RCAL_RSTN_MASK
/* SB_REG(0120) */
#define SB_EARC_EN_MASK
#define SB_EARC_AFC_EN_MASK
/* SB_REG(0123) */
#define OVRD_SB_READY_MASK
#define SB_READY_MASK

/* LNTOP_REG(0200) */
#define PROTOCOL_SEL
#define HDMI_MODE
#define HDMI_TMDS_FRL_SEL
/* LNTOP_REG(0206) */
#define DATA_BUS_SEL
#define DATA_BUS_36_40
/* LNTOP_REG(0207) */
#define LANE_EN
#define ALL_LANE_EN

/* LANE_REG(0312) */
#define LN0_TX_SER_RATE_SEL_RBR
#define LN0_TX_SER_RATE_SEL_HBR
#define LN0_TX_SER_RATE_SEL_HBR2
#define LN0_TX_SER_RATE_SEL_HBR3
/* LANE_REG(0412) */
#define LN1_TX_SER_RATE_SEL_RBR
#define LN1_TX_SER_RATE_SEL_HBR
#define LN1_TX_SER_RATE_SEL_HBR2
#define LN1_TX_SER_RATE_SEL_HBR3
/* LANE_REG(0512) */
#define LN2_TX_SER_RATE_SEL_RBR
#define LN2_TX_SER_RATE_SEL_HBR
#define LN2_TX_SER_RATE_SEL_HBR2
#define LN2_TX_SER_RATE_SEL_HBR3
/* LANE_REG(0612) */
#define LN3_TX_SER_RATE_SEL_RBR
#define LN3_TX_SER_RATE_SEL_HBR
#define LN3_TX_SER_RATE_SEL_HBR2
#define LN3_TX_SER_RATE_SEL_HBR3

struct lcpll_config {};

struct ropll_config {};

enum rk_hdptx_reset {};

struct rk_hdptx_phy {};

static const struct ropll_config ropll_tmds_cfg[] =;

static const struct reg_sequence rk_hdtpx_common_cmn_init_seq[] =;

static const struct reg_sequence rk_hdtpx_tmds_cmn_init_seq[] =;

static const struct reg_sequence rk_hdtpx_common_sb_init_seq[] =;

static const struct reg_sequence rk_hdtpx_tmds_lntop_highbr_seq[] =;

static const struct reg_sequence rk_hdtpx_tmds_lntop_lowbr_seq[] =;

static const struct reg_sequence rk_hdtpx_common_lane_init_seq[] =;

static const struct reg_sequence rk_hdtpx_tmds_lane_init_seq[] =;

static bool rk_hdptx_phy_is_rw_reg(struct device *dev, unsigned int reg)
{}

static const struct regmap_config rk_hdptx_phy_regmap_config =;

#define rk_hdptx_multi_reg_write(hdptx, seq)

static void rk_hdptx_pre_power_up(struct rk_hdptx_phy *hdptx)
{}

static int rk_hdptx_post_enable_lane(struct rk_hdptx_phy *hdptx)
{}

static int rk_hdptx_post_enable_pll(struct rk_hdptx_phy *hdptx)
{}

static void rk_hdptx_phy_disable(struct rk_hdptx_phy *hdptx)
{}

static bool rk_hdptx_phy_clk_pll_calc(unsigned int data_rate,
				      struct ropll_config *cfg)
{}

static int rk_hdptx_ropll_tmds_cmn_config(struct rk_hdptx_phy *hdptx,
					  unsigned int rate)
{}

static int rk_hdptx_ropll_tmds_mode_config(struct rk_hdptx_phy *hdptx,
					   unsigned int rate)
{}

static int rk_hdptx_phy_power_on(struct phy *phy)
{}

static int rk_hdptx_phy_power_off(struct phy *phy)
{}

static const struct phy_ops rk_hdptx_phy_ops =;

static int rk_hdptx_phy_runtime_suspend(struct device *dev)
{}

static int rk_hdptx_phy_runtime_resume(struct device *dev)
{}

static int rk_hdptx_phy_probe(struct platform_device *pdev)
{}

static const struct dev_pm_ops rk_hdptx_phy_pm_ops =;

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

static struct platform_driver rk_hdptx_phy_driver =;
module_platform_driver();

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