drm: bridge/dw_hdmi: separate VLEVCTRL settting into platform driver
authorYakir Yang <ykk@rock-chips.com>
Wed, 1 Apr 2015 03:56:10 +0000 (23:56 -0400)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Wed, 1 Apr 2015 09:54:13 +0000 (10:54 +0100)
Because of iMX6 & Rockchip have differnet mpll config parameter,
the VLEVCTRL parameter would be different. In this case we should
separate VLEVCTRL setting from the common dw_hdmi driver, config
this parameter in platform driver(dw_hdmi-imx and dw_hdmi-rockchip)

Signed-off-by: Yakir Yang <ykk@rock-chips.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
drivers/gpu/drm/bridge/dw_hdmi.c
drivers/gpu/drm/imx/dw_hdmi-imx.c
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
include/drm/bridge/dw_hdmi.h

index 7943cedd63ce566b7801d32f4387ddda62594689..49cafb61d29075530840a78766541ad4e9ceb478 100644 (file)
@@ -758,7 +758,7 @@ static int hdmi_phy_configure(struct dw_hdmi *hdmi, unsigned char prep,
        const struct dw_hdmi_plat_data *plat_data = hdmi->plat_data;
        const struct dw_hdmi_mpll_config *mpll_config = plat_data->mpll_cfg;
        const struct dw_hdmi_curr_ctrl *curr_ctrl = plat_data->cur_ctr;
-       const struct dw_hdmi_sym_term *sym_term = plat_data->sym_term;
+       const struct dw_hdmi_phy_config *phy_config = plat_data->phy_config;
 
        if (prep)
                return -EINVAL;
@@ -829,18 +829,18 @@ static int hdmi_phy_configure(struct dw_hdmi *hdmi, unsigned char prep,
        hdmi_phy_i2c_write(hdmi, 0x0000, 0x13);  /* PLLPHBYCTRL */
        hdmi_phy_i2c_write(hdmi, 0x0006, 0x17);
 
-       for (i = 0; sym_term[i].mpixelclock != (~0UL); i++)
+       for (i = 0; phy_config[i].mpixelclock != (~0UL); i++)
                if (hdmi->hdmi_data.video_mode.mpixelclock <=
-                   sym_term[i].mpixelclock)
+                   phy_config[i].mpixelclock)
                        break;
 
        /* RESISTANCE TERM 133Ohm Cfg */
-       hdmi_phy_i2c_write(hdmi, sym_term[i].term, 0x19);  /* TXTERM */
+       hdmi_phy_i2c_write(hdmi, phy_config[i].term, 0x19);  /* TXTERM */
        /* PREEMP Cgf 0.00 */
-       hdmi_phy_i2c_write(hdmi, sym_term[i].sym_ctr, 0x09);  /* CKSYMTXCTRL */
-
+       hdmi_phy_i2c_write(hdmi, phy_config[i].sym_ctr, 0x09); /* CKSYMTXCTRL */
        /* TX/CK LVL 10 */
-       hdmi_phy_i2c_write(hdmi, 0x01ad, 0x0E);  /* VLEVCTRL */
+       hdmi_phy_i2c_write(hdmi, phy_config[i].vlev_ctr, 0x0E); /* VLEVCTRL */
+
        /* REMOVE CLK TERM */
        hdmi_phy_i2c_write(hdmi, 0x8000, 0x05);  /* CKCALCTRL */
 
index 121d30ca2d4448f379c743ac781bb9910ccd2d44..1032c07773e38d22ca6ebaf4c5639483ebee10cf 100644 (file)
@@ -73,10 +73,10 @@ static const struct dw_hdmi_curr_ctrl imx_cur_ctr[] = {
        }
 };
 
-static const struct dw_hdmi_sym_term imx_sym_term[] = {
-       /*pixelclk   symbol   term*/
-       { 148500000, 0x800d, 0x0005 },
-       { ~0UL,      0x0000, 0x0000 }
+static const struct dw_hdmi_phy_config imx_phy_config[] = {
+       /*pixelclk   symbol   term   vlev */
+       { 148500000, 0x800d, 0x0005, 0x01ad},
+       { ~0UL,      0x0000, 0x0000, 0x0000}
 };
 
 static int dw_hdmi_imx_parse_dt(struct imx_hdmi *hdmi)
@@ -137,17 +137,17 @@ static struct drm_encoder_funcs dw_hdmi_imx_encoder_funcs = {
 };
 
 static struct dw_hdmi_plat_data imx6q_hdmi_drv_data = {
-       .mpll_cfg = imx_mpll_cfg,
-       .cur_ctr  = imx_cur_ctr,
-       .sym_term = imx_sym_term,
-       .dev_type = IMX6Q_HDMI,
+       .mpll_cfg   = imx_mpll_cfg,
+       .cur_ctr    = imx_cur_ctr,
+       .phy_config = imx_phy_config,
+       .dev_type   = IMX6Q_HDMI,
 };
 
 static struct dw_hdmi_plat_data imx6dl_hdmi_drv_data = {
-       .mpll_cfg = imx_mpll_cfg,
-       .cur_ctr  = imx_cur_ctr,
-       .sym_term = imx_sym_term,
-       .dev_type = IMX6DL_HDMI,
+       .mpll_cfg   = imx_mpll_cfg,
+       .cur_ctr    = imx_cur_ctr,
+       .phy_config = imx_phy_config,
+       .dev_type   = IMX6DL_HDMI,
 };
 
 static const struct of_device_id dw_hdmi_imx_dt_ids[] = {
index d236faa05b1956c2d2f3c4cd9066d66d7c71c391..65b0f7bf5b52119bcbc8353332cb0d9fba4fe732 100644 (file)
@@ -133,12 +133,12 @@ static const struct dw_hdmi_curr_ctrl rockchip_cur_ctr[] = {
        }
 };
 
-static const struct dw_hdmi_sym_term rockchip_sym_term[] = {
-       /*pixelclk   symbol   term*/
-       { 74250000,  0x8009, 0x0004 },
-       { 148500000, 0x8029, 0x0004 },
-       { 297000000, 0x8039, 0x0005 },
-       { ~0UL,      0x0000, 0x0000 }
+static const struct dw_hdmi_phy_config rockchip_phy_config[] = {
+       /*pixelclk   symbol   term   vlev*/
+       { 74250000,  0x8009, 0x0004, 0x01ad},
+       { 148500000, 0x8029, 0x0004, 0x01ad},
+       { 297000000, 0x8039, 0x0005, 0x01ad},
+       { ~0UL,      0x0000, 0x0000, 0x0000}
 };
 
 static int rockchip_hdmi_parse_dt(struct rockchip_hdmi *hdmi)
@@ -230,7 +230,7 @@ static const struct dw_hdmi_plat_data rockchip_hdmi_drv_data = {
        .mode_valid = dw_hdmi_rockchip_mode_valid,
        .mpll_cfg   = rockchip_mpll_cfg,
        .cur_ctr    = rockchip_cur_ctr,
-       .sym_term   = rockchip_sym_term,
+       .phy_config = rockchip_phy_config,
        .dev_type   = RK3288_HDMI,
 };
 
index 5a4f4900516920278ee89834ea76efc2a7c5c20d..de13bfc3563470b8569278bbd426793d65a31ac4 100644 (file)
@@ -38,17 +38,18 @@ struct dw_hdmi_curr_ctrl {
        u16 curr[DW_HDMI_RES_MAX];
 };
 
-struct dw_hdmi_sym_term {
+struct dw_hdmi_phy_config {
        unsigned long mpixelclock;
        u16 sym_ctr;    /*clock symbol and transmitter control*/
        u16 term;       /*transmission termination value*/
+       u16 vlev_ctr;   /* voltage level control */
 };
 
 struct dw_hdmi_plat_data {
        enum dw_hdmi_devtype dev_type;
        const struct dw_hdmi_mpll_config *mpll_cfg;
        const struct dw_hdmi_curr_ctrl *cur_ctr;
-       const struct dw_hdmi_sym_term *sym_term;
+       const struct dw_hdmi_phy_config *phy_config;
        enum drm_mode_status (*mode_valid)(struct drm_connector *connector,
                                           struct drm_display_mode *mode);
 };