Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp923129pxb; Fri, 22 Jan 2021 02:40:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJzbX6tgJ0KVzKsDikGvold9wWFcPI7LS0lIW29AmmJrd8NzTQ5QsZLSV0TyNDqYVFNYxioV X-Received: by 2002:a05:6402:34d2:: with SMTP id w18mr2837009edc.102.1611312052996; Fri, 22 Jan 2021 02:40:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611312052; cv=none; d=google.com; s=arc-20160816; b=M7/Iync7isd0s6s9KFRh+jRB9uP7NZC6bVwjjIZ+kOUU1FxvMpnv6IRDuLzdnI56X2 J7EDpKkDW5+TB0xuuGK00jyjL4uBNEX7dSYdzLUTJnPsbbbqxeMnG5Ec93Q3PySV3185 r2hmiTazdWJFDqq/3UVrEtDHvsyh6Ss/hIEJFRjwPOJOaOeS6wafkFSAZeiDiZYCzmAX lMFxpllY0VHKzcSVrrLU0RdxIwEvAxuj2w11SSpt4+lC3Hn48u8ZkTIWosOIZnGfIVwy lyztllD4bu16ftGYh4Mem0PCjW0UPyFt9pvplZm1VzIZDdkAsjJABa8iAWg2rHyiR4ZB nhCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=zqPi5MJbj1ms2b0Q8q7oOCrglElwMPk+QoWvn6qZ8Lg=; b=wI0iLH4LcpaqTtIkSPb8T5J8yXJpS3ZhqwOtgUr9Lyk1CxCaxXxBZ+wr2+6Amat4OY 60kBHs2OVQIHq+BrBNvpzOomm+FOTcl2scGpnrpHupE/nxLZGYxSTf16aIS30Hiejg74 UJ2goErkztYlur6kA1ycq7sDKpSc92v+Eu5zHYUtezeKVhwHrW+83M+CzdqMPIb8r9X7 /IgqXpwbd2W9hvHniL+wvTvmuxGLsAX5hAOFGMvdRz/jnp6zYd8oNFsbbiaUp/4PfHwn Gl+oK/atf2wv+9AmKBKVqa+APFD83gCr7RE4uZbaHghbMjMFRXnZjFDeAwgdKSjwH2nN yAjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@raspberrypi.com header.s=google header.b=H6BDzO8w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=raspberrypi.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gx11si2859154ejb.357.2021.01.22.02.40.29; Fri, 22 Jan 2021 02:40:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@raspberrypi.com header.s=google header.b=H6BDzO8w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=raspberrypi.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727676AbhAVKhO (ORCPT + 99 others); Fri, 22 Jan 2021 05:37:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727829AbhAVKcv (ORCPT ); Fri, 22 Jan 2021 05:32:51 -0500 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED1AEC06174A for ; Fri, 22 Jan 2021 02:32:09 -0800 (PST) Received: by mail-wm1-x335.google.com with SMTP id u14so3882518wmq.4 for ; Fri, 22 Jan 2021 02:32:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=zqPi5MJbj1ms2b0Q8q7oOCrglElwMPk+QoWvn6qZ8Lg=; b=H6BDzO8wt0zPd6IO4WofunMxSNshx5vl4o49LxSFogf+BCn/vCC98TIqePtTm+5h1x yDVKOa6am8btjgY6xmYocEO3sKTXo/j5sGlKyPVb01mODw69yYenSPEmmJqreultpMc+ pPoqPqSNIGNzoVdenVvvuZ2hF9qZQLTgm5B9ViaW6zn75oXHq5/w0AF8gehobqmXsQD9 d/r5mCeBkE1m63az/u6sD2pg7hYzXSmMERBgwYc1aIKdD8UDD+NS9zjberNwTsJ5m3ba idj1NpnscvnWVUtl9Fn6mpJi5BMN+96RRV0QvmGGIo1iUMwCjFb7RRJ3fgJKdgPwTUz0 h6VA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=zqPi5MJbj1ms2b0Q8q7oOCrglElwMPk+QoWvn6qZ8Lg=; b=iD6FQrqrRVF+HDPVIClcupohXG5ytbjo6Qa+KW2oEn9mu/kMKQi3H7w/7akqU9iCo/ lQLF4NwgCmmAjX+87OLRt+EEi9Ifz0oNRlYEs4g1jcg42hgiLMJp5JpCkkTzt+d2clm1 SA/WNFqVZgorjP/scN25ocCyBEjb05mEeSkD1ZflRLn18Vz+6WgX1LeEJ0VTHG4iL5w0 9ydHuPvuZNjwXdHD6+0oi42bUGvbJ4X9ytyAS6pGfiebMJGEGHdnGf4vUbVVDoQYv0PS b3aj32IzE91wXxPM2HJyk0aqZpPl9TDF7VzT8dh0uEmKhKUjj7NXUxdMg0Z2iRx32s6J penA== X-Gm-Message-State: AOAM532tHzBrSUMwKxTyZJlxl1Mnu4gOs+Lss/Ad4Ineu2rmSjrPF1vh d96yUna4gG9aSnRa09HluW8V1y/pYqvIEIm4hWZUOQ== X-Received: by 2002:a1c:f201:: with SMTP id s1mr3237293wmc.158.1611311528710; Fri, 22 Jan 2021 02:32:08 -0800 (PST) MIME-Version: 1.0 References: <20210111142309.193441-1-maxime@cerno.tech> <20210111142309.193441-6-maxime@cerno.tech> In-Reply-To: <20210111142309.193441-6-maxime@cerno.tech> From: Dave Stevenson Date: Fri, 22 Jan 2021 10:31:53 +0000 Message-ID: Subject: Re: [PATCH v2 05/15] drm/vc4: hdmi: Restore cec physical address on reconnect To: Maxime Ripard Cc: Eric Anholt , Maarten Lankhorst , Thomas Zimmermann , Daniel Vetter , David Airlie , linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Hans Verkuil , LKML , DRI Development , bcm-kernel-feedback-list@broadcom.com, Mauro Carvalho Chehab , Linux Media Mailing List , Dom Cobley Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Maxime Sorry for the slow reply on these patches. On Mon, 11 Jan 2021 at 14:23, Maxime Ripard wrote: > > From: Dom Cobley > > Currently we call cec_phys_addr_invalidate on a hotplug deassert. > That may be due to a TV power cycling, or an AVR being switched > on (and switching edid). > > This makes CEC unusable since our controller wouldn't have a physical > address anymore. > > Set it back up again on the hotplug assert. > > Fixes: 15b4511a4af6 ("drm/vc4: add HDMI CEC support") > Signed-off-by: Dom Cobley > Signed-off-by: Maxime Ripard I follow the logic, and trust Dom that it works, but I don't know if that is the correct thing within CEC. Ideally Hans will comment as the original author of the CEC code - I believe he's testing the series anyway. Acked-by: Dave Stevenson > --- > drivers/gpu/drm/vc4/vc4_hdmi.c | 24 ++++++++++++++++++------ > 1 file changed, 18 insertions(+), 6 deletions(-) > > diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c > index 7945dbcee78c..c3a301396aad 100644 > --- a/drivers/gpu/drm/vc4/vc4_hdmi.c > +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c > @@ -136,20 +136,32 @@ static enum drm_connector_status > vc4_hdmi_connector_detect(struct drm_connector *connector, bool force) > { > struct vc4_hdmi *vc4_hdmi = connector_to_vc4_hdmi(connector); > + bool connected = false; > > if (vc4_hdmi->hpd_gpio) { > if (gpio_get_value_cansleep(vc4_hdmi->hpd_gpio) ^ > vc4_hdmi->hpd_active_low) > - return connector_status_connected; > - cec_phys_addr_invalidate(vc4_hdmi->cec_adap); > - return connector_status_disconnected; > + connected = true; > + } else if (drm_probe_ddc(vc4_hdmi->ddc)) { > + connected = true; > + } else if (HDMI_READ(HDMI_HOTPLUG) & VC4_HDMI_HOTPLUG_CONNECTED) { > + connected = true; > } > > - if (drm_probe_ddc(vc4_hdmi->ddc)) > - return connector_status_connected; > + if (connected) { > + if (connector->status != connector_status_connected) { > + struct edid *edid = drm_get_edid(connector, vc4_hdmi->ddc); > + > + if (edid) { > + cec_s_phys_addr_from_edid(vc4_hdmi->cec_adap, edid); > + vc4_hdmi->encoder.hdmi_monitor = drm_detect_hdmi_monitor(edid); > + kfree(edid); > + } > + } > > - if (HDMI_READ(HDMI_HOTPLUG) & VC4_HDMI_HOTPLUG_CONNECTED) > return connector_status_connected; > + } > + > cec_phys_addr_invalidate(vc4_hdmi->cec_adap); > return connector_status_disconnected; > } > -- > 2.29.2 >