[Intel-gfx] [PATCH] drm/i915/hotplug: Use phy to get the hpd_pin instead of the port (v2)
Souza, Jose
jose.souza at intel.com
Thu Jan 30 23:03:00 UTC 2020
On Thu, 2020-01-30 at 14:43 -0800, Vivek Kasireddy wrote:
> On some platforms such as Elkhart Lake, although we may use DDI D
> to drive a connector, we have to use PHY A (Combo Phy PORT A) to
> detect the hotplug interrupts as per the spec because there is no
> one-to-one mapping between DDIs and PHYs. Therefore, use the
> function intel_port_to_phy() which contains the logic for such
> mapping(s) to find the correct hpd_pin.
>
> This change should not affect other platforms as there is always
> a one-to-one mapping between DDIs and PHYs.
>
> v2:
> - Convert the case statements to use PHYs instead of PORTs (Jani)
>
> Cc: Jani Nikula <jani.nikula at intel.com>
> Cc: Matt Roper <matthew.d.roper at intel.com>
> Cc: José Roberto de Souza <jose.souza at intel.com>
> Signed-off-by: Vivek Kasireddy <vivek.kasireddy at intel.com>
> ---
> drivers/gpu/drm/i915/display/intel_hotplug.c | 24 +++++++++++-------
> --
> 1 file changed, 13 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_hotplug.c
> b/drivers/gpu/drm/i915/display/intel_hotplug.c
> index 042d98bae1ea..2bcfa4682511 100644
> --- a/drivers/gpu/drm/i915/display/intel_hotplug.c
> +++ b/drivers/gpu/drm/i915/display/intel_hotplug.c
> @@ -89,29 +89,31 @@
> enum hpd_pin intel_hpd_pin_default(struct drm_i915_private
> *dev_priv,
> enum port port)
> {
> - switch (port) {
> - case PORT_A:
> + enum phy phy = intel_port_to_phy(dev_priv, port);
> +
> + switch (phy) {
> + case PHY_A:
> return HPD_PORT_A;
> - case PORT_B:
> + case PHY_B:
> return HPD_PORT_B;
> - case PORT_C:
> + case PHY_C:
> return HPD_PORT_C;
> - case PORT_D:
> + case PHY_D:
> return HPD_PORT_D;
> - case PORT_E:
> + case PHY_E:
> return HPD_PORT_E;
> - case PORT_F:
> + case PHY_F:
> if (IS_CNL_WITH_PORT_F(dev_priv))
> return HPD_PORT_E;
> return HPD_PORT_F;
> - case PORT_G:
> + case PHY_G:
> return HPD_PORT_G;
> - case PORT_H:
> + case PHY_H:
> return HPD_PORT_H;
> - case PORT_I:
> + case PHY_I:
> return HPD_PORT_I;
> default:
> - MISSING_CASE(port);
> + MISSING_CASE(phy);
> return HPD_NONE;
> }
> }
Looks good but while you are at it why not optimize with something
like:
switch(phy) {
PHY_F:
if (IS_CNL_WITH_PORT_F(dev_priv))
return HPD_PORT_E;
return HPD_PORT_F;
PHY_A:
PHY_B:
..:
return HPD_PORT_A + phy
default:
...
More information about the Intel-gfx
mailing list