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

drm/tegra: dpaux: Configure pads as I2C by default

The DPAUX code paths already configure the pads in AUX mode, but there
is no way to reconfigure them in I2C mode for HDMI (the DPAUX module is
unused in that case). Enabling the pads in I2C mode by default is the
quickest way to support HDMI. Eventually this may need an explicit call
in the user drivers.

Signed-off-by: Thierry Reding <treding@nvidia.com>

+27
+25
drivers/gpu/drm/tegra/dpaux.c
··· 359 359 if (err < 0) 360 360 return err; 361 361 362 + /* 363 + * Assume that by default the DPAUX/I2C pads will be used for HDMI, 364 + * so power them up and configure them in I2C mode. 365 + * 366 + * The DPAUX code paths reconfigure the pads in AUX mode, but there 367 + * is no possibility to perform the I2C mode configuration in the 368 + * HDMI path. 369 + */ 370 + value = tegra_dpaux_readl(dpaux, DPAUX_HYBRID_SPARE); 371 + value &= ~DPAUX_HYBRID_SPARE_PAD_POWER_DOWN; 372 + tegra_dpaux_writel(dpaux, value, DPAUX_HYBRID_SPARE); 373 + 374 + value = tegra_dpaux_readl(dpaux, DPAUX_HYBRID_PADCTL); 375 + value = DPAUX_HYBRID_PADCTL_I2C_SDA_INPUT_RCV | 376 + DPAUX_HYBRID_PADCTL_I2C_SCL_INPUT_RCV | 377 + DPAUX_HYBRID_PADCTL_MODE_I2C; 378 + tegra_dpaux_writel(dpaux, value, DPAUX_HYBRID_PADCTL); 379 + 362 380 /* enable and clear all interrupts */ 363 381 value = DPAUX_INTR_AUX_DONE | DPAUX_INTR_IRQ_EVENT | 364 382 DPAUX_INTR_UNPLUG_EVENT | DPAUX_INTR_PLUG_EVENT; ··· 395 377 static int tegra_dpaux_remove(struct platform_device *pdev) 396 378 { 397 379 struct tegra_dpaux *dpaux = platform_get_drvdata(pdev); 380 + u32 value; 381 + 382 + /* make sure pads are powered down when not in use */ 383 + value = tegra_dpaux_readl(dpaux, DPAUX_HYBRID_SPARE); 384 + value |= DPAUX_HYBRID_SPARE_PAD_POWER_DOWN; 385 + tegra_dpaux_writel(dpaux, value, DPAUX_HYBRID_SPARE); 398 386 399 387 drm_dp_aux_unregister(&dpaux->aux); 400 388 ··· 418 394 } 419 395 420 396 static const struct of_device_id tegra_dpaux_of_match[] = { 397 + { .compatible = "nvidia,tegra210-dpaux", }, 421 398 { .compatible = "nvidia,tegra124-dpaux", }, 422 399 { }, 423 400 };
+2
drivers/gpu/drm/tegra/dpaux.h
··· 57 57 #define DPAUX_DP_AUX_CONFIG 0x45 58 58 59 59 #define DPAUX_HYBRID_PADCTL 0x49 60 + #define DPAUX_HYBRID_PADCTL_I2C_SDA_INPUT_RCV (1 << 15) 61 + #define DPAUX_HYBRID_PADCTL_I2C_SCL_INPUT_RCV (1 << 14) 60 62 #define DPAUX_HYBRID_PADCTL_AUX_CMH(x) (((x) & 0x3) << 12) 61 63 #define DPAUX_HYBRID_PADCTL_AUX_DRVZ(x) (((x) & 0x7) << 8) 62 64 #define DPAUX_HYBRID_PADCTL_AUX_DRVI(x) (((x) & 0x3f) << 2)