From patchwork Wed Nov 2 18:07:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13028737 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BD213C4332F for ; Wed, 2 Nov 2022 18:10:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=C1/+jw+GO1KKN4Bcl8ckrVGXu9oGQRUNFWOhF94YWiU=; b=MCZTGdeNOykuKP ktNdg1m/WLaPhznFOTXTJeE9imP8OYDVzDdv4peJJ9HH4OoEUYqUyTl6NxDyUXt+rlRV38a3MYAiQ LM28BRhe2iDvS2AM8Uv/MDbRJkK3MDDeXmrSWr9qaNuofa0hccHawzTvMcIQn1xD4Tf8lvjspIQER rxhQU1JRv1HWVjP+NE2G3FRZwChxCvNsx0II/QGTwlFEHhxUd4YT6CPpGiS019ElzvCbBFa1zjOKd 6eUWQz/aRBXtQsvOnsFNw9J/ieWYsIXEyopJRGbA2N2bXQSVWdiben1igYck00x9gmRAuxSul8w6U HfkY44GlRE64kML5FnhA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqIAb-00CpAD-56; Wed, 02 Nov 2022 18:08:57 +0000 Received: from mail-lf1-x131.google.com ([2a00:1450:4864:20::131]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oqI8u-00CnrG-7R for linux-arm-kernel@lists.infradead.org; Wed, 02 Nov 2022 18:07:14 +0000 Received: by mail-lf1-x131.google.com with SMTP id bp15so29466732lfb.13 for ; Wed, 02 Nov 2022 11:07:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=njFUM8grNBCWhY7+2MQ0vp+r8NhDVi4GL0ALpm64CQc=; b=FnZf6NTADaSe0PkC86OPtYawsEUrWL0oiGDdYkE/H6elSvrKnb3/EXr4SBV9nhl+7A B5f1pZMFNNNOb76MlRM+I2gpUlRPwrKIN+epl1/zpPwcKw18qsIMMW3AZDokb4FPt/eb 9H4/C5Ates7fv/Uq6bjTt+gMEdsRYFnSauejLx1eYDLHOAjNjuU5DP4F3BWp4YKrV6Yv tLJLJXOhaKGOUELcx5E9ykC31Mw66jfIHCBr4zydP8DKjy18pH45hDjckSQavtVdtnGc MkCoafW8sPaYFOOSJsMw+RoEpvA2dFQiTfy2QboDWlELd0XAKjqpd9w03ts6YhRq9AbF z12Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=njFUM8grNBCWhY7+2MQ0vp+r8NhDVi4GL0ALpm64CQc=; b=JVIeyjE5WyfVFL/IzU0V1jhvYglBwuU2YosvmRSTJu0fhj+wNVTIh47wsowRiknNsa roAQowySGuykEBGdj0gasRJ8+/tm3Y5BZFU2ECEHKd2bz5jsm4t2nbN9e4IlqUoAoqyp Ih5WUlzmYT+uu8BJDQfu3LsUuUzKNABpzxcaJHQAwJM2qjlbdtFtp/ehZO0rdetUhR+7 aOHPxrQg+C7yqMmzIhOSkM3yCZRqpzrxDlPsOcGXKGy6OEZ39r38JHWWXVtoIVkK8SDU VLEnQhGTeMncYmw8tKbyIGM7llFAlDcYxnEg7NWYnMSxpeCnx11NIJKu9961mRTSbs7x 2CUw== X-Gm-Message-State: ACrzQf3coY6n2mkRzLKT8SHCGhG5UCTCffmcXmHzdC5QQ4vW0D9YSX/Q vDVDdtJMSx/woubR9XK2rIsNZA== X-Google-Smtp-Source: AMsMyM5/YWavo37aOvKzpmvgdmkVEaZu35sKTu0ADp1oLjSun+G/nXyR+D74r6QrPi65ndlPWZjeQw== X-Received: by 2002:a05:6512:308d:b0:4a2:33d3:b8f1 with SMTP id z13-20020a056512308d00b004a233d3b8f1mr10157528lfd.133.1667412428417; Wed, 02 Nov 2022 11:07:08 -0700 (PDT) Received: from eriador.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id r15-20020ac24d0f000000b00485caa0f5dfsm2085232lfi.44.2022.11.02.11.07.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Nov 2022 11:07:08 -0700 (PDT) From: Dmitry Baryshkov To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Laurentiu Palcu , Lucas Stach , Philipp Zabel , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Rob Clark , Sean Paul , Abhinav Kumar , Tomi Valkeinen Cc: dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org Subject: [PATCH v3 3/7] drm/bridge_connector: rely on drm_kms_helper_poll_* for HPD enablement Date: Wed, 2 Nov 2022 21:07:01 +0300 Message-Id: <20221102180705.459294-4-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221102180705.459294-1-dmitry.baryshkov@linaro.org> References: <20221102180705.459294-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221102_110712_309075_EA2A6899 X-CRM114-Status: GOOD ( 16.41 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use drm_connector's helpers enable_hpd and disable_hpd to enable and disable HPD automatically by the means of drm_kms_helper_poll_* functions. As the drm_bridge_connector_enable_hpd() and drm_bridge_connector_disable_hpd() functions are now unused, replace them with stubs to ease driver migration. Enabling the HPD from drm_bridge_connector_init() can happen too early, before the driver is prepared to handle HPD events. As the drm_bridge_connector_enable_hpd() is empty anyway, drop this call anyway. Signed-off-by: Dmitry Baryshkov Reported-by: Marek Szyprowski Tested-by: Marek Szyprowski --- drivers/gpu/drm/drm_bridge_connector.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/drm_bridge_connector.c b/drivers/gpu/drm/drm_bridge_connector.c index 1c7d936523df..0e13bc87a6ac 100644 --- a/drivers/gpu/drm/drm_bridge_connector.c +++ b/drivers/gpu/drm/drm_bridge_connector.c @@ -136,6 +136,11 @@ static void drm_bridge_connector_hpd_cb(void *cb_data, * This is typically used by display drivers in their resume handler. */ void drm_bridge_connector_enable_hpd(struct drm_connector *connector) +{ +} +EXPORT_SYMBOL_GPL(drm_bridge_connector_enable_hpd); + +static void _drm_bridge_connector_enable_hpd(struct drm_connector *connector) { struct drm_bridge_connector *bridge_connector = to_drm_bridge_connector(connector); @@ -145,7 +150,6 @@ void drm_bridge_connector_enable_hpd(struct drm_connector *connector) drm_bridge_hpd_enable(hpd, drm_bridge_connector_hpd_cb, bridge_connector); } -EXPORT_SYMBOL_GPL(drm_bridge_connector_enable_hpd); /** * drm_bridge_connector_disable_hpd - Disable hot-plug detection for the @@ -156,6 +160,11 @@ EXPORT_SYMBOL_GPL(drm_bridge_connector_enable_hpd); * This is typically used by display drivers in their suspend handler. */ void drm_bridge_connector_disable_hpd(struct drm_connector *connector) +{ +} +EXPORT_SYMBOL_GPL(drm_bridge_connector_disable_hpd); + +static void _drm_bridge_connector_disable_hpd(struct drm_connector *connector) { struct drm_bridge_connector *bridge_connector = to_drm_bridge_connector(connector); @@ -164,7 +173,6 @@ void drm_bridge_connector_disable_hpd(struct drm_connector *connector) if (hpd) drm_bridge_hpd_disable(hpd); } -EXPORT_SYMBOL_GPL(drm_bridge_connector_disable_hpd); /* ----------------------------------------------------------------------------- * Bridge Connector Functions @@ -305,6 +313,8 @@ static int drm_bridge_connector_get_modes(struct drm_connector *connector) static const struct drm_connector_helper_funcs drm_bridge_connector_helper_funcs = { .get_modes = drm_bridge_connector_get_modes, /* No need for .mode_valid(), the bridges are checked by the core. */ + .enable_hpd = _drm_bridge_connector_enable_hpd, + .disable_hpd = _drm_bridge_connector_disable_hpd, }; /* ----------------------------------------------------------------------------- @@ -387,10 +397,8 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm, connector_type, ddc); drm_connector_helper_add(connector, &drm_bridge_connector_helper_funcs); - if (bridge_connector->bridge_hpd) { + if (bridge_connector->bridge_hpd) connector->polled = DRM_CONNECTOR_POLL_HPD; - drm_bridge_connector_enable_hpd(connector); - } else if (bridge_connector->bridge_detect) connector->polled = DRM_CONNECTOR_POLL_CONNECT | DRM_CONNECTOR_POLL_DISCONNECT;