Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp166642rwe; Fri, 26 Aug 2022 02:51:34 -0700 (PDT) X-Google-Smtp-Source: AA6agR68Duicl6V3QtcJU54zFl8vdHz3hmsxIO1fh7RkPcJv6hdAoEpWYPtkVA/k75NxQHdIr49U X-Received: by 2002:a17:90a:6b4c:b0:1fa:d973:e4eb with SMTP id x12-20020a17090a6b4c00b001fad973e4ebmr3474018pjl.15.1661507494331; Fri, 26 Aug 2022 02:51:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661507494; cv=none; d=google.com; s=arc-20160816; b=bl/uq3+s9QtDpgmmdSwfEG445a3AuON9p7GvfnAmVJlpqROjeJ4A3DMIe9NpPyebtH +3BqOzmxSVhNgO6SzxmqFaXNHDAtjI+AEH4fWYGoGL/TSm7T8V67UnBxghrsB6kxGvvu Irml8hFY8LzXaOiD7bnrm/J6EdiNAgH6Xbij/zWivayzNUWuZOTNJ16PWP6P4OU8VXxZ qqoRalUZ5lhpVx4PAab4NrigcRPBI1VT2vQU95o+tW8sfuqazHAg+GFLsC5snR5/sGkY w9pnL6TsVHkDPeLufR/cmSn8M4+aeiiGNsVFiTrUvqFRiVPDc+qe2YZiJmP+YheQlSM1 U6CQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=H0Cwp/qf8EDRET9M4VGUdzFYa+bK7cQz5rPimLRT4SU=; b=zAJ5JxwpkaNqzZa7hguEY4IIMBjSu6w7jmzpzJ3MloE0pDowb+Oq+iaXMAPxlBUXT0 ElOrHrCCnXX77AT9RqHo0Z8KwmjrBBTX1ZGVWQV7w2MDzvWi3zQnwsSABjLZG4HVglsM faQ6DQ40+4tc2a8jEBEYnm0Zl2U29A5pmn2rKcrcl4e+pl/gxSDRdCnh7nzURJmI5pyG Pk+JZEnP7VZe+AN3pRcY8WXzv3Czz5TpM2jIV0eWRrvRu8yvkmu72pRgcojaCoMwHQnT f50YBG/vlD1HALsLKQbhzTEoEMNqvCSPSZfI+bJKF/MAs9J4WlFEGmf0khob9AzKmkFn LDmw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j74-20020a636e4d000000b0042ae3d2c134si1450500pgc.129.2022.08.26.02.51.23; Fri, 26 Aug 2022 02:51:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245663AbiHZJLx (ORCPT + 99 others); Fri, 26 Aug 2022 05:11:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245728AbiHZJLq (ORCPT ); Fri, 26 Aug 2022 05:11:46 -0400 Received: from hi1smtp01.de.adit-jv.com (smtp1.de.adit-jv.com [93.241.18.167]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62DBAD6B8D for ; Fri, 26 Aug 2022 02:11:44 -0700 (PDT) Received: from hi2exch02.adit-jv.com (hi2exch02.adit-jv.com [10.72.92.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by hi1smtp01.de.adit-jv.com (Postfix) with ESMTPS id C5A1A5208BD; Fri, 26 Aug 2022 11:11:41 +0200 (CEST) Received: from vmlxhi-182.adit-jv.com (10.72.94.19) by hi2exch02.adit-jv.com (10.72.92.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.27; Fri, 26 Aug 2022 11:11:41 +0200 From: Michael Rodin To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Alex Deucher , Philipp Zabel , Sean Paul , Vincent Abriou , , CC: Michael Rodin , , Subject: [PATCH] drm: do not call detect for connectors which are forced on Date: Fri, 26 Aug 2022 11:11:21 +0200 Message-ID: <20220826091121.389315-1-mrodin@de.adit-jv.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.72.94.19] X-ClientProxiedBy: hi2exch02.adit-jv.com (10.72.92.28) To hi2exch02.adit-jv.com (10.72.92.28) X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,KHOP_HELO_FCRDNS, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org "detect" should not be called and its return value shall not be used when a connector is forced as hinted in the commit d50ba256b5f1 ("drm/kms: start adding command line interface using fb.") and the commit 6fe14acd496e ("drm: Document drm_connector_funcs"). One negative side effect of doing this is observed on the RCar3 SoCs which use the dw-hdmi driver. It continues executing drm_helper_hpd_irq_event even if its connector is forced to ON. As consequence drm_helper_hpd_irq_event calls "detect" so the connector status is updated to "disconnected": [ 420.201527] [drm:drm_helper_hpd_irq_event] [CONNECTOR:76:HDMI-A-1] status updated from connected to disconnected This status is corrected by drm_helper_probe_single_connector_modes shortly after this because this function checks if a connector is forced: [ 420.218703] [drm:drm_helper_probe_single_connector_modes] [CONNECTOR:76:HDMI-A-1] status updated from disconnected to connected To avoid similar issues this commit adapts functions which call "detect" so they check if a connector is forced and return the correct status. Fixes: 949f08862d66 ("drm: Make the connector .detect() callback optional") Signed-off-by: Michael Rodin --- drivers/gpu/drm/drm_probe_helper.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c index bb427c5a4f1f..1691047d0472 100644 --- a/drivers/gpu/drm/drm_probe_helper.c +++ b/drivers/gpu/drm/drm_probe_helper.c @@ -289,7 +289,12 @@ drm_helper_probe_detect_ctx(struct drm_connector *connector, bool force) retry: ret = drm_modeset_lock(&connector->dev->mode_config.connection_mutex, &ctx); if (!ret) { - if (funcs->detect_ctx) + if (connector->force == DRM_FORCE_ON || + connector->force == DRM_FORCE_ON_DIGITAL) + ret = connector_status_connected; + else if (connector->force == DRM_FORCE_OFF) + ret = connector_status_disconnected; + else if (funcs->detect_ctx) ret = funcs->detect_ctx(connector, &ctx, force); else if (connector->funcs->detect) ret = connector->funcs->detect(connector, force); @@ -340,7 +345,14 @@ drm_helper_probe_detect(struct drm_connector *connector, if (ret) return ret; - if (funcs->detect_ctx) + if (connector->force == DRM_FORCE_ON || + connector->force == DRM_FORCE_ON_DIGITAL) + ret = connector_status_connected; + else if (connector->force == DRM_FORCE_OFF) + ret = connector_status_disconnected; + else if (funcs->detect_ctx) + ret = funcs->detect_ctx(connector, ctx, force); + else if (funcs->detect_ctx) ret = funcs->detect_ctx(connector, ctx, force); else if (connector->funcs->detect) ret = connector->funcs->detect(connector, force); -- 2.25.1