#include <linux/clk.h>
#include <linux/clk-provider.h>
#include <linux/delay.h>
#include <linux/io.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/nvmem-consumer.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
#include <linux/phy/phy.h>
#include <linux/slab.h>
#define UPDATE(x, h, l) …
#define RK3228_PRE_PLL_REFCLK_SEL_PCLK …
#define RK3228_BYPASS_RXSENSE_EN …
#define RK3228_BYPASS_PWRON_EN …
#define RK3228_BYPASS_PLLPD_EN …
#define RK3228_BYPASS_PDATA_EN …
#define RK3228_PDATAEN_DISABLE …
#define RK3228_BYPASS_AUTO_TERM_RES_CAL …
#define RK3228_AUTO_TERM_RES_CAL_SPEED_14_8(x) …
#define RK3228_AUTO_TERM_RES_CAL_SPEED_7_0(x) …
#define RK3228_POST_PLL_CTRL_MANUAL …
#define RK3228_POST_PLL_POWER_DOWN …
#define RK3228_PRE_PLL_POWER_DOWN …
#define RK3228_RXSENSE_CLK_CH_ENABLE …
#define RK3228_RXSENSE_DATA_CH2_ENABLE …
#define RK3228_RXSENSE_DATA_CH1_ENABLE …
#define RK3228_RXSENSE_DATA_CH0_ENABLE …
#define RK3228_BANDGAP_ENABLE …
#define RK3228_TMDS_DRIVER_ENABLE …
#define RK3228_PRE_PLL_FB_DIV_8_MASK …
#define RK3228_PRE_PLL_FB_DIV_8(x) …
#define RK3228_PCLK_VCO_DIV_5_MASK …
#define RK3228_PCLK_VCO_DIV_5(x) …
#define RK3228_PRE_PLL_PRE_DIV_MASK …
#define RK3228_PRE_PLL_PRE_DIV(x) …
#define RK3228_PRE_PLL_FB_DIV_7_0(x) …
#define RK3228_PRE_PLL_PCLK_DIV_B_MASK …
#define RK3228_PRE_PLL_PCLK_DIV_B_SHIFT …
#define RK3228_PRE_PLL_PCLK_DIV_B(x) …
#define RK3228_PRE_PLL_PCLK_DIV_A_MASK …
#define RK3228_PRE_PLL_PCLK_DIV_A(x) …
#define RK3228_PRE_PLL_PCLK_DIV_C_MASK …
#define RK3228_PRE_PLL_PCLK_DIV_C(x) …
#define RK3228_PRE_PLL_PCLK_DIV_D_MASK …
#define RK3228_PRE_PLL_PCLK_DIV_D(x) …
#define RK3228_PRE_PLL_TMDSCLK_DIV_C_MASK …
#define RK3228_PRE_PLL_TMDSCLK_DIV_C(x) …
#define RK3228_PRE_PLL_TMDSCLK_DIV_A_MASK …
#define RK3228_PRE_PLL_TMDSCLK_DIV_A(x) …
#define RK3228_PRE_PLL_TMDSCLK_DIV_B_MASK …
#define RK3228_PRE_PLL_TMDSCLK_DIV_B(x) …
#define RK3228_PRE_PLL_LOCK_STATUS …
#define RK3228_POST_PLL_POST_DIV_ENABLE …
#define RK3228_POST_PLL_PRE_DIV_MASK …
#define RK3228_POST_PLL_PRE_DIV(x) …
#define RK3228_POST_PLL_FB_DIV_7_0(x) …
#define RK3228_POST_PLL_FB_DIV_8_MASK …
#define RK3228_POST_PLL_FB_DIV_8(x) …
#define RK3228_POST_PLL_POST_DIV_MASK …
#define RK3228_POST_PLL_POST_DIV(x) …
#define RK3228_POST_PLL_LOCK_STATUS …
#define RK3228_TMDS_CH_TA_ENABLE …
#define RK3228_TMDS_CLK_CH_TA(x) …
#define RK3228_TMDS_DATA_CH2_TA(x) …
#define RK3228_TMDS_DATA_CH1_TA(x) …
#define RK3228_TMDS_DATA_CH0_TA(x) …
#define RK3228_TMDS_DATA_CH2_PRE_EMPHASIS_MASK …
#define RK3228_TMDS_DATA_CH2_PRE_EMPHASIS(x) …
#define RK3228_TMDS_DATA_CH1_PRE_EMPHASIS_MASK …
#define RK3228_TMDS_DATA_CH1_PRE_EMPHASIS(x) …
#define RK3228_TMDS_DATA_CH0_PRE_EMPHASIS_MASK …
#define RK3228_TMDS_DATA_CH0_PRE_EMPHASIS(x) …
#define RK3228_TMDS_CLK_CH_OUTPUT_SWING(x) …
#define RK3228_TMDS_DATA_CH2_OUTPUT_SWING(x) …
#define RK3228_TMDS_DATA_CH1_OUTPUT_SWING(x) …
#define RK3228_TMDS_DATA_CH0_OUTPUT_SWING(x) …
#define RK3328_BYPASS_RXSENSE_EN …
#define RK3328_BYPASS_POWERON_EN …
#define RK3328_BYPASS_PLLPD_EN …
#define RK3328_INT_POL_HIGH …
#define RK3328_BYPASS_PDATA_EN …
#define RK3328_PDATA_EN …
#define RK3328_INT_TMDS_CLK(x) …
#define RK3328_INT_TMDS_D2(x) …
#define RK3328_INT_TMDS_D1(x) …
#define RK3328_INT_TMDS_D0(x) …
#define RK3328_INT_AGND_LOW_PULSE_LOCKED …
#define RK3328_INT_RXSENSE_LOW_PULSE_LOCKED …
#define RK3328_INT_VSS_AGND_ESD_DET …
#define RK3328_INT_AGND_VSS_ESD_DET …
#define RK3328_PCLK_VCO_DIV_5_MASK …
#define RK3328_PCLK_VCO_DIV_5(x) …
#define RK3328_PRE_PLL_POWER_DOWN …
#define RK3328_PRE_PLL_PRE_DIV_MASK …
#define RK3328_PRE_PLL_PRE_DIV(x) …
#define RK3328_SPREAD_SPECTRUM_MOD_DOWN …
#define RK3328_SPREAD_SPECTRUM_MOD_DISABLE …
#define RK3328_PRE_PLL_FRAC_DIV_DISABLE …
#define RK3328_PRE_PLL_FB_DIV_11_8_MASK …
#define RK3328_PRE_PLL_FB_DIV_11_8(x) …
#define RK3328_PRE_PLL_FB_DIV_7_0(x) …
#define RK3328_PRE_PLL_TMDSCLK_DIV_C_MASK …
#define RK3328_PRE_PLL_TMDSCLK_DIV_C(x) …
#define RK3328_PRE_PLL_TMDSCLK_DIV_B_MASK …
#define RK3328_PRE_PLL_TMDSCLK_DIV_B(x) …
#define RK3328_PRE_PLL_TMDSCLK_DIV_A_MASK …
#define RK3328_PRE_PLL_TMDSCLK_DIV_A(x) …
#define RK3328_PRE_PLL_PCLK_DIV_B_SHIFT …
#define RK3328_PRE_PLL_PCLK_DIV_B_MASK …
#define RK3328_PRE_PLL_PCLK_DIV_B(x) …
#define RK3328_PRE_PLL_PCLK_DIV_A_MASK …
#define RK3328_PRE_PLL_PCLK_DIV_A(x) …
#define RK3328_PRE_PLL_PCLK_DIV_C_SHIFT …
#define RK3328_PRE_PLL_PCLK_DIV_C_MASK …
#define RK3328_PRE_PLL_PCLK_DIV_C(x) …
#define RK3328_PRE_PLL_PCLK_DIV_D_MASK …
#define RK3328_PRE_PLL_PCLK_DIV_D(x) …
#define RK3328_PRE_PLL_LOCK_STATUS …
#define RK3328_POST_PLL_POST_DIV_ENABLE …
#define RK3328_POST_PLL_REFCLK_SEL_TMDS …
#define RK3328_POST_PLL_POWER_DOWN …
#define RK3328_POST_PLL_FB_DIV_8(x) …
#define RK3328_POST_PLL_PRE_DIV(x) …
#define RK3328_POST_PLL_FB_DIV_7_0(x) …
#define RK3328_POST_PLL_POST_DIV_MASK …
#define RK3328_POST_PLL_POST_DIV_2 …
#define RK3328_POST_PLL_POST_DIV_4 …
#define RK3328_POST_PLL_POST_DIV_8 …
#define RK3328_POST_PLL_LOCK_STATUS …
#define RK3328_BANDGAP_ENABLE …
#define RK3328_TMDS_CLK_DRIVER_EN …
#define RK3328_TMDS_D2_DRIVER_EN …
#define RK3328_TMDS_D1_DRIVER_EN …
#define RK3328_TMDS_D0_DRIVER_EN …
#define RK3328_TMDS_DRIVER_ENABLE …
#define RK3328_BYPASS_TERM_RESISTOR_CALIB …
#define RK3328_TERM_RESISTOR_CALIB_SPEED_14_8(x) …
#define RK3328_TERM_RESISTOR_CALIB_SPEED_7_0(x) …
#define RK3328_TERM_RESISTOR_50 …
#define RK3328_TERM_RESISTOR_62_5 …
#define RK3328_TERM_RESISTOR_75 …
#define RK3328_TERM_RESISTOR_100 …
#define RK3328_ESD_DETECT_MASK …
#define RK3328_ESD_DETECT_340MV …
#define RK3328_ESD_DETECT_280MV …
#define RK3328_ESD_DETECT_260MV …
#define RK3328_ESD_DETECT_240MV …
#define RK3328_TMDS_TERM_RESIST_MASK …
#define RK3328_TMDS_TERM_RESIST_75 …
#define RK3328_TMDS_TERM_RESIST_150 …
#define RK3328_TMDS_TERM_RESIST_300 …
#define RK3328_TMDS_TERM_RESIST_600 …
#define RK3328_TMDS_TERM_RESIST_1000 …
#define RK3328_TMDS_TERM_RESIST_2000 …
#define RK3328_PRE_PLL_FRAC_DIV_23_16(x) …
#define RK3328_PRE_PLL_FRAC_DIV_15_8(x) …
#define RK3328_PRE_PLL_FRAC_DIV_7_0(x) …
struct inno_hdmi_phy_drv_data;
struct inno_hdmi_phy { … };
struct pre_pll_config { … };
struct post_pll_config { … };
struct phy_config { … };
struct inno_hdmi_phy_ops { … };
struct inno_hdmi_phy_drv_data { … };
static const struct pre_pll_config pre_pll_cfg_table[] = …;
static const struct post_pll_config post_pll_cfg_table[] = …;
static const struct phy_config rk3228_phy_cfg[] = …;
static const struct phy_config rk3328_phy_cfg[] = …;
static inline struct inno_hdmi_phy *to_inno_hdmi_phy(struct clk_hw *hw)
{ … }
static inline void inno_write(struct inno_hdmi_phy *inno, u32 reg, u8 val)
{ … }
static inline u8 inno_read(struct inno_hdmi_phy *inno, u32 reg)
{ … }
static inline void inno_update_bits(struct inno_hdmi_phy *inno, u8 reg,
u8 mask, u8 val)
{ … }
#define inno_poll(inno, reg, val, cond, sleep_us, timeout_us) …
static unsigned long inno_hdmi_phy_get_tmdsclk(struct inno_hdmi_phy *inno,
unsigned long rate)
{ … }
static irqreturn_t inno_hdmi_phy_rk3328_hardirq(int irq, void *dev_id)
{ … }
static irqreturn_t inno_hdmi_phy_rk3328_irq(int irq, void *dev_id)
{ … }
static int inno_hdmi_phy_power_on(struct phy *phy)
{ … }
static int inno_hdmi_phy_power_off(struct phy *phy)
{ … }
static const struct phy_ops inno_hdmi_phy_ops = …;
static const
struct pre_pll_config *inno_hdmi_phy_get_pre_pll_cfg(struct inno_hdmi_phy *inno,
unsigned long rate)
{ … }
static int inno_hdmi_phy_rk3228_clk_is_prepared(struct clk_hw *hw)
{ … }
static int inno_hdmi_phy_rk3228_clk_prepare(struct clk_hw *hw)
{ … }
static void inno_hdmi_phy_rk3228_clk_unprepare(struct clk_hw *hw)
{ … }
static
unsigned long inno_hdmi_phy_rk3228_clk_recalc_rate(struct clk_hw *hw,
unsigned long parent_rate)
{ … }
static long inno_hdmi_phy_rk3228_clk_round_rate(struct clk_hw *hw,
unsigned long rate,
unsigned long *parent_rate)
{ … }
static int inno_hdmi_phy_rk3228_clk_set_rate(struct clk_hw *hw,
unsigned long rate,
unsigned long parent_rate)
{ … }
static const struct clk_ops inno_hdmi_phy_rk3228_clk_ops = …;
static int inno_hdmi_phy_rk3328_clk_is_prepared(struct clk_hw *hw)
{ … }
static int inno_hdmi_phy_rk3328_clk_prepare(struct clk_hw *hw)
{ … }
static void inno_hdmi_phy_rk3328_clk_unprepare(struct clk_hw *hw)
{ … }
static
unsigned long inno_hdmi_phy_rk3328_clk_recalc_rate(struct clk_hw *hw,
unsigned long parent_rate)
{ … }
static long inno_hdmi_phy_rk3328_clk_round_rate(struct clk_hw *hw,
unsigned long rate,
unsigned long *parent_rate)
{ … }
static int inno_hdmi_phy_rk3328_clk_set_rate(struct clk_hw *hw,
unsigned long rate,
unsigned long parent_rate)
{ … }
static const struct clk_ops inno_hdmi_phy_rk3328_clk_ops = …;
static int inno_hdmi_phy_clk_register(struct inno_hdmi_phy *inno)
{ … }
static int inno_hdmi_phy_rk3228_init(struct inno_hdmi_phy *inno)
{ … }
static int
inno_hdmi_phy_rk3228_power_on(struct inno_hdmi_phy *inno,
const struct post_pll_config *cfg,
const struct phy_config *phy_cfg)
{ … }
static void inno_hdmi_phy_rk3228_power_off(struct inno_hdmi_phy *inno)
{ … }
static const struct inno_hdmi_phy_ops rk3228_hdmi_phy_ops = …;
static int inno_hdmi_phy_rk3328_init(struct inno_hdmi_phy *inno)
{ … }
static int
inno_hdmi_phy_rk3328_power_on(struct inno_hdmi_phy *inno,
const struct post_pll_config *cfg,
const struct phy_config *phy_cfg)
{ … }
static void inno_hdmi_phy_rk3328_power_off(struct inno_hdmi_phy *inno)
{ … }
static const struct inno_hdmi_phy_ops rk3328_hdmi_phy_ops = …;
static const struct inno_hdmi_phy_drv_data rk3228_hdmi_phy_drv_data = …;
static const struct inno_hdmi_phy_drv_data rk3328_hdmi_phy_drv_data = …;
static const struct regmap_config inno_hdmi_phy_regmap_config = …;
static void inno_hdmi_phy_action(void *data)
{ … }
static int inno_hdmi_phy_probe(struct platform_device *pdev)
{ … }
static void inno_hdmi_phy_remove(struct platform_device *pdev)
{ … }
static const struct of_device_id inno_hdmi_phy_of_match[] = …;
MODULE_DEVICE_TABLE(of, inno_hdmi_phy_of_match);
static struct platform_driver inno_hdmi_phy_driver = …;
module_platform_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;