]> git.sur5r.net Git - u-boot/commitdiff
rockchip: pinctrl: rk3399: add support for the HDMI I2C pins
authorPhilipp Tomsich <philipp.tomsich@theobroma-systems.com>
Fri, 28 Apr 2017 16:33:58 +0000 (18:33 +0200)
committerSimon Glass <sjg@chromium.org>
Wed, 10 May 2017 19:37:21 +0000 (13:37 -0600)
To add HDMI support for the RK3399, this commit provides the needed
pinctrl functionality to configure the HDMI I2C pins (used for reading
the screen's EDID).

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
arch/arm/include/asm/arch-rockchip/grf_rk3399.h
drivers/pinctrl/rockchip/pinctrl_rk3399.c

index 2e0e7fe58ce9afbc67f5f2d477271f59bbd87e2f..7df25fd31d10a3dccc30ebbf46d8f2e611092714 100644 (file)
@@ -440,9 +440,11 @@ enum {
        GRF_GPIO4C0_SEL_SHIFT   = 0,
        GRF_GPIO4C0_SEL_MASK    = 3 << GRF_GPIO4C0_SEL_SHIFT,
        GRF_UART2DGBB_SIN       = 2,
+       GRF_HDMII2C_SCL         = 3,
        GRF_GPIO4C1_SEL_SHIFT   = 2,
        GRF_GPIO4C1_SEL_MASK    = 3 << GRF_GPIO4C1_SEL_SHIFT,
        GRF_UART2DGBB_SOUT      = 2,
+       GRF_HDMII2C_SDA         = 3,
        GRF_GPIO4C2_SEL_SHIFT   = 4,
        GRF_GPIO4C2_SEL_MASK    = 3 << GRF_GPIO4C2_SEL_SHIFT,
        GRF_PWM_0               = 1,
index c09cd826f69dbc50a54767c089e3f8616dae173f..d93b90310b0ab3f9aa8647b8779f6daa3ff4fa21 100644 (file)
@@ -265,6 +265,23 @@ static void pinctrl_rk3399_gmac_config(struct rk3399_grf_regs *grf, int mmc_id)
 }
 #endif
 
+#if !defined(CONFIG_SPL_BUILD)
+static void pinctrl_rk3399_hdmi_config(struct rk3399_grf_regs *grf, int hdmi_id)
+{
+       switch (hdmi_id) {
+       case PERIPH_ID_HDMI:
+               rk_clrsetreg(&grf->gpio4c_iomux,
+                            GRF_GPIO4C0_SEL_MASK | GRF_GPIO4C1_SEL_MASK,
+                            (GRF_HDMII2C_SCL << GRF_GPIO4C0_SEL_SHIFT) |
+                            (GRF_HDMII2C_SDA << GRF_GPIO4C1_SEL_SHIFT));
+               break;
+       default:
+               debug("%s: hdmi_id = %d unsupported\n", __func__, hdmi_id);
+               break;
+       }
+}
+#endif
+
 static int rk3399_pinctrl_request(struct udevice *dev, int func, int flags)
 {
        struct rk3399_pinctrl_priv *priv = dev_get_priv(dev);
@@ -313,6 +330,11 @@ static int rk3399_pinctrl_request(struct udevice *dev, int func, int flags)
        case PERIPH_ID_GMAC:
                pinctrl_rk3399_gmac_config(priv->grf, func);
                break;
+#endif
+#if !defined(CONFIG_SPL_BUILD)
+       case PERIPH_ID_HDMI:
+               pinctrl_rk3399_hdmi_config(priv->grf, func);
+               break;
 #endif
        default:
                return -EINVAL;
@@ -359,6 +381,10 @@ static int rk3399_pinctrl_get_periph_id(struct udevice *dev,
 #if CONFIG_IS_ENABLED(GMAC_ROCKCHIP)
        case 12:
                return PERIPH_ID_GMAC;
+#endif
+#if !defined(CONFIG_SPL_BUILD)
+       case 23:
+               return PERIPH_ID_HDMI;
 #endif
        }
 #endif