Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3073853ybt; Mon, 29 Jun 2020 14:37:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxxQZfC8sd9S3j+Ordnb989TPRo2qO5jesL7xOZlVonapFkmHiYoT8icHgufZYFrXGLf97y X-Received: by 2002:a50:8465:: with SMTP id 92mr19171420edp.388.1593466625087; Mon, 29 Jun 2020 14:37:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593466625; cv=none; d=google.com; s=arc-20160816; b=a89s126Vhf8KROWsuLhRKC6w80dsa5a0+1xaNgrFDosjZ2zJ6aFSruywBV1CZ7pT+x tFkys3VDgfh+AW1b5oA3WrOd/EEVDqrWWT9l8fx/4BFrmo5BjoPUFE4t18Icayso23HX llHStjBN69IC4HZpHFkLNUW4OwED/8Qe9sd6ddsjId4j4ZVkO4NHvH05vGx79VB9FGml etsHpgTB8l+ez34QuH76Bguf8oeDvwxQ4M8ub9r4tadb7Krzq7O2/0zgDF34UoA/Xf61 Ao2vJuo/GuLoTraHjaey46/SGOe0hTSMUrn6Ci8t2HcOuTUXUW9cz8ndw+XA69T8DVZm HsAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=/yqpD3qwCF3723w/KUj8NC8srSuTu8Y6V1b6+TiXhew=; b=V2w6UuFSzq3LCG3drdNz7OVsijc0h8FHdDotD19Jnho3cbOSOEkC6lksq4kt65ouQq awMd6CFsD3cSzHRJBkszniUxKohiRtNNBK39mEFJ8GBd7gf3uumpH1WoWh3KKKboycev SNf5ZhqeESaarNMLP6Sjzz2v9iZ/mxB4k3FDGBE0j70BOej3C20OifKpihltXvg2ZI0C x7e3WpFxIXgUXp4YCBqkS2IiBIbAug6yvDpO+05ykDmeI8qBrUu66XK9Hm2bEl/Tf+pn GNKDl7RNPUV+SYPbvazeuBYHrad9CVAup/EnApkJRS7QaHGnA8Kl29aLf6PvuFIbZBq6 bHdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GRSZFxsR; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lv19si513068ejb.241.2020.06.29.14.36.42; Mon, 29 Jun 2020 14:37:05 -0700 (PDT) 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=@kernel.org header.s=default header.b=GRSZFxsR; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391327AbgF2Vf7 (ORCPT + 99 others); Mon, 29 Jun 2020 17:35:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:60600 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728485AbgF2Skq (ORCPT ); Mon, 29 Jun 2020 14:40:46 -0400 Received: from wens.tw (mirror2.csie.ntu.edu.tw [140.112.194.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 720452312E; Mon, 29 Jun 2020 06:00:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593410447; bh=69KAXq7nSrNne8dVE7YVsV2/lDTgQzzsUVum5KwNVZc=; h=From:To:Cc:Subject:Date:From; b=GRSZFxsRZTWvOaiuzo8KJuHhWg6fv0kcWT84LyI53REIlQNAFJBgWtSDfy0UeBZrb zDuzXx4213NUAaSuiH3mKzaSCcQNusd1UXAOiWVQZ6qcnUZF9DMNA9p/WftCz9AdGk 0cjZOAuZXSdbSxPfzzuRm+wEa09MV4SsfP8A07Dk= Received: by wens.tw (Postfix, from userid 1000) id 13E895FCA9; Mon, 29 Jun 2020 14:00:45 +0800 (CST) From: Chen-Yu Tsai To: Maxime Ripard , David Airlie , Daniel Vetter Cc: Chen-Yu Tsai , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] drm: sun4i: hdmi: Remove extra HPD polling Date: Mon, 29 Jun 2020 14:00:32 +0800 Message-Id: <20200629060032.24134-1-wens@kernel.org> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chen-Yu Tsai The HPD sense mechanism in Allwinner's old HDMI encoder hardware is more or less an input-only GPIO. Other GPIO-based HPD implementations directly return the current state, instead of polling for a specific state and returning the other if that times out. Remove the I/O polling from sun4i_hdmi_connector_detect() and directly return a known state based on the current reading. This also gets rid of excessive CPU usage by kworker as reported on Stack Exchange [1] and Armbian forums [2]. [1] https://superuser.com/questions/1515001/debian-10-buster-on-cubietruck-with-bug-in-sun4i-drm-hdmi [2] https://forum.armbian.com/topic/14282-headless-systems-and-sun4i_drm_hdmi-a10a20/ Fixes: 9c5681011a0c ("drm/sun4i: Add HDMI support") Signed-off-by: Chen-Yu Tsai --- drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c index ce07ddc3e058..557cbe5ab35f 100644 --- a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c +++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c @@ -259,9 +259,8 @@ sun4i_hdmi_connector_detect(struct drm_connector *connector, bool force) struct sun4i_hdmi *hdmi = drm_connector_to_sun4i_hdmi(connector); unsigned long reg; - if (readl_poll_timeout(hdmi->base + SUN4I_HDMI_HPD_REG, reg, - reg & SUN4I_HDMI_HPD_HIGH, - 0, 500000)) { + reg = readl(hdmi->base + SUN4I_HDMI_HPD_REG); + if (reg & SUN4I_HDMI_HPD_HIGH) { cec_phys_addr_invalidate(hdmi->cec_adap); return connector_status_disconnected; } -- 2.27.0