Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/rockchip: dw_hdmi: add basic rk3228 support

Like the RK3328, RK322x SoCs offer a Synopsis DesignWare HDMI transmitter
and an Innosilicon HDMI PHY.

Add a new dw_hdmi_plat_data struct, rk3228_hdmi_drv_data.
Assign a set of mostly generic rk3228_hdmi_phy_ops functions.
Add dw_hdmi_rk3228_setup_hpd() to enable the HDMI HPD and DDC lines.

Signed-off-by: Justin Swartz <justin.swartz@risingedge.co.za>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20190522224631.25164-1-justin.swartz@risingedge.co.za

authored by

Justin Swartz and committed by
Heiko Stuebner
53ffa1ee bcc07111

+54
+1
Documentation/devicetree/bindings/display/rockchip/dw_hdmi-rockchip.txt
··· 12 12 Required properties: 13 13 14 14 - compatible: should be one of the following: 15 + "rockchip,rk3228-dw-hdmi" 15 16 "rockchip,rk3288-dw-hdmi" 16 17 "rockchip,rk3328-dw-hdmi" 17 18 "rockchip,rk3399-dw-hdmi"
+53
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
··· 23 23 #include "rockchip_drm_drv.h" 24 24 #include "rockchip_drm_vop.h" 25 25 26 + #define RK3228_GRF_SOC_CON2 0x0408 27 + #define RK3228_HDMI_SDAIN_MSK BIT(14) 28 + #define RK3228_HDMI_SCLIN_MSK BIT(13) 29 + #define RK3228_GRF_SOC_CON6 0x0418 30 + #define RK3228_HDMI_HPD_VSEL BIT(6) 31 + #define RK3228_HDMI_SDA_VSEL BIT(5) 32 + #define RK3228_HDMI_SCL_VSEL BIT(4) 33 + 26 34 #define RK3288_GRF_SOC_CON6 0x025C 27 35 #define RK3288_HDMI_LCDC_SEL BIT(4) 28 36 #define RK3328_GRF_SOC_CON2 0x0408 ··· 333 325 phy_power_off(hdmi->phy); 334 326 } 335 327 328 + static void dw_hdmi_rk3228_setup_hpd(struct dw_hdmi *dw_hdmi, void *data) 329 + { 330 + struct rockchip_hdmi *hdmi = (struct rockchip_hdmi *)data; 331 + 332 + dw_hdmi_phy_setup_hpd(dw_hdmi, data); 333 + 334 + regmap_write(hdmi->regmap, 335 + RK3228_GRF_SOC_CON6, 336 + HIWORD_UPDATE(RK3228_HDMI_HPD_VSEL | RK3228_HDMI_SDA_VSEL | 337 + RK3228_HDMI_SCL_VSEL, 338 + RK3228_HDMI_HPD_VSEL | RK3228_HDMI_SDA_VSEL | 339 + RK3228_HDMI_SCL_VSEL)); 340 + 341 + regmap_write(hdmi->regmap, 342 + RK3228_GRF_SOC_CON2, 343 + HIWORD_UPDATE(RK3228_HDMI_SDAIN_MSK | RK3228_HDMI_SCLIN_MSK, 344 + RK3228_HDMI_SDAIN_MSK | RK3228_HDMI_SCLIN_MSK)); 345 + } 346 + 336 347 static enum drm_connector_status 337 348 dw_hdmi_rk3328_read_hpd(struct dw_hdmi *dw_hdmi, void *data) 338 349 { ··· 396 369 RK3328_HDMI_SDAIN_MSK | RK3328_HDMI_SCLIN_MSK | 397 370 RK3328_HDMI_HPD_IOE)); 398 371 } 372 + 373 + static const struct dw_hdmi_phy_ops rk3228_hdmi_phy_ops = { 374 + .init = dw_hdmi_rockchip_genphy_init, 375 + .disable = dw_hdmi_rockchip_genphy_disable, 376 + .read_hpd = dw_hdmi_phy_read_hpd, 377 + .update_hpd = dw_hdmi_phy_update_hpd, 378 + .setup_hpd = dw_hdmi_rk3228_setup_hpd, 379 + }; 380 + 381 + static struct rockchip_hdmi_chip_data rk3228_chip_data = { 382 + .lcdsel_grf_reg = -1, 383 + }; 384 + 385 + static const struct dw_hdmi_plat_data rk3228_hdmi_drv_data = { 386 + .mode_valid = dw_hdmi_rockchip_mode_valid, 387 + .mpll_cfg = rockchip_mpll_cfg, 388 + .cur_ctr = rockchip_cur_ctr, 389 + .phy_config = rockchip_phy_config, 390 + .phy_data = &rk3228_chip_data, 391 + .phy_ops = &rk3228_hdmi_phy_ops, 392 + .phy_name = "inno_dw_hdmi_phy2", 393 + .phy_force_vendor = true, 394 + }; 399 395 400 396 static struct rockchip_hdmi_chip_data rk3288_chip_data = { 401 397 .lcdsel_grf_reg = RK3288_GRF_SOC_CON6, ··· 472 422 }; 473 423 474 424 static const struct of_device_id dw_hdmi_rockchip_dt_ids[] = { 425 + { .compatible = "rockchip,rk3228-dw-hdmi", 426 + .data = &rk3228_hdmi_drv_data 427 + }, 475 428 { .compatible = "rockchip,rk3288-dw-hdmi", 476 429 .data = &rk3288_hdmi_drv_data 477 430 },