From patchwork Sun Jan 17 00:23:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 365235 Delivered-To: patch@linaro.org Received: by 2002:a17:906:fb05:0:0:0:0 with SMTP id lz5csp1677654ejb; Sat, 16 Jan 2021 16:26:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJwm8QBvcZdFW+xHJHT0aHGZU6hGkemJAyOjg86F83ZWrsgTPLAPD7KAoja1btRHMzaJJVK7 X-Received: by 2002:a05:6402:20e:: with SMTP id t14mr3103495edv.178.1610843162081; Sat, 16 Jan 2021 16:26:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610843162; cv=none; d=google.com; s=arc-20160816; b=kz4WCn6e/Q4SDVBG/kKwIusKaeDBEe91qdG1XqzDYZENDVlnWi6tbGWJtM1PffqqDu jNI/EKsHE6bfS3Fk7KS9YC4hgmPaiVfCCTmC9e9W3SlVEWvVU9mdS5ufD9W2Kc60fPGs SAhK1oHqKbHR44tYmKxttmKdRCQx8TkSDrmnUky1kyHY+03O00puX6Nsl/z4FjqWjYIE Qv8E0bhPBzdwVU9SZs/wU00C4FcO0Fg4X8wq0LDamH6uP/BsZSrRHRmAse48YOdngQ+O 81Sq4nM/XGkNtBJ7ufGjmaluYkno+vSnnzA06+INsfqW6LC5vQ3LogQOdmDvLgz6/QRE uTFg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=gHRQ0xxynPvZxQkJ0XwkKO8LykVQgvPwVrEG9Eu8CIA=; b=xv+CRTS9FDhKSYRhp4SwFSgSdMaND7G0DA54H+Ie779J9R0q4FOOrYePuq1vsoxZut 56KiuAijFJUIeNIrx0IDQahdtQj4h70c0nc3UZYqjMC+LHePE792D2e1NgbsbCvCaERO vhmiO222b5m1C5NRBZJQqqr7XEzgJ4XPJAMwx00weAJx6NSxh/ICHXRX2v2+PTrlNTIG Nv3kYk8h3O5FWb9/8jscSMqsV/ieoYGwndG4+YX8EUmN1rNLCWwAGi1McEwMZl9bdJ6u WKMFStB2he2B3J/GrlulRVz2IfKgS8xM+/U2LGFMtORwDqTI/jP+BX6da81KZ9KFGa4y oY0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=a6xn4dTZ; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m7si5562839eji.498.2021.01.16.16.26.01; Sat, 16 Jan 2021 16:26:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-arm-msm-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=@linaro.org header.s=google header.b=a6xn4dTZ; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726785AbhAQAYn (ORCPT + 15 others); Sat, 16 Jan 2021 19:24:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726864AbhAQAYm (ORCPT ); Sat, 16 Jan 2021 19:24:42 -0500 Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [IPv6:2a00:1450:4864:20::22b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD61DC061575 for ; Sat, 16 Jan 2021 16:24:01 -0800 (PST) Received: by mail-lj1-x22b.google.com with SMTP id f11so14453945ljm.8 for ; Sat, 16 Jan 2021 16:24:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gHRQ0xxynPvZxQkJ0XwkKO8LykVQgvPwVrEG9Eu8CIA=; b=a6xn4dTZ2IFPAX0OuBOTeKJNnVYS33dqQWXOkWew7MdddpflJN/lH4msVuofd7VNE1 uSdDZWYEmIVjE1pkdkEaoUlcRhhVl8QS7YgwMOa3nUL8T0/6LV89dXyV5cbqm+/On3+B QD3gXecTGRMAgFZnedB4sPbuyf3vOJdVTSDsNInZc4y1cM1utPNxb57fY4fq33AbobcZ uGPj5UGNfFfgTTAnM68lTSoVLNz00eqkd4smeVYNzh0CO/86ISInkRr5NcupXimuJOVH unHFEgPdgxJIZHJEbvxYKJVKodGDIrbZ6Ouxnhy4O2dvxAD6+V99V6FD5rOCPjrjzJOS 3Tsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gHRQ0xxynPvZxQkJ0XwkKO8LykVQgvPwVrEG9Eu8CIA=; b=nYmlZtTDOU0TNh+/8MlsA63MyEz1rUZ/z/NVgm7PrD2whqh7I7488wEvkCLluTnmvq 83w0yVwHt2Yc4NkBHCq4227CsbuH4WnI300clX4wEgXDmcHHh8HLNVWCKN+S8S2TqYKS 5vY2fTCfzu2CNFLuDsSI231APZhBUBBRJ6LdDVeKXuvkIPxANU3n7PzzxSAcnmFK5Qeu 19z4IoW3eOMCGeu1hUZELPtK0KRa1iJxTRe5UjhuO7ju/Vm10sa+N0rYUjJYTRcPF/Lm h4VgE7b9E6QEzllfbWiL4H7FUo+9BWEXY2aoZqd+7HgCF5FO/hS+aUgbNDcXN0OxRICl YuiA== X-Gm-Message-State: AOAM5302UHCAr/0dOrb3fZ8b99Gru1YXfuSuOj5w+XVHpMkD9a9uGhHs Cn0NweLsySMbytZZto/Ax3TmbQ== X-Received: by 2002:a2e:9985:: with SMTP id w5mr8241208lji.122.1610843038203; Sat, 16 Jan 2021 16:23:58 -0800 (PST) Received: from eriador.lumag.spb.ru ([94.25.228.101]) by smtp.gmail.com with ESMTPSA id q1sm962468lfu.48.2021.01.16.16.23.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Jan 2021 16:23:57 -0800 (PST) From: Dmitry Baryshkov To: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Cc: Daniel Vetter , David Airlie , Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Vinod Koul , Sam Ravnborg , Manivannan Sadhasivam Subject: [PATCH v3 1/3] drm/bridge/lontium-lt9611uxc: fix waiting for EDID to become available Date: Sun, 17 Jan 2021 03:23:53 +0300 Message-Id: <20210117002355.435860-2-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210117002355.435860-1-dmitry.baryshkov@linaro.org> References: <20210117002355.435860-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org - Call wake_up() when EDID ready event is received to wake wait_event_interruptible_timeout() - Increase waiting timeout, reading EDID can take longer than 100ms, so let's be on a safe side. Signed-off-by: Dmitry Baryshkov Fixes: 0cbbd5b1a012 ("drm: bridge: add support for lontium LT9611UXC bridge") --- drivers/gpu/drm/bridge/lontium-lt9611uxc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) -- 2.29.2 diff --git a/drivers/gpu/drm/bridge/lontium-lt9611uxc.c b/drivers/gpu/drm/bridge/lontium-lt9611uxc.c index 0c98d27f84ac..a59e811f1705 100644 --- a/drivers/gpu/drm/bridge/lontium-lt9611uxc.c +++ b/drivers/gpu/drm/bridge/lontium-lt9611uxc.c @@ -145,8 +145,10 @@ static irqreturn_t lt9611uxc_irq_thread_handler(int irq, void *dev_id) lt9611uxc_unlock(lt9611uxc); - if (irq_status & BIT(0)) + if (irq_status & BIT(0)) { lt9611uxc->edid_read = !!(hpd_status & BIT(0)); + wake_up_all(<9611uxc->wq); + } if (irq_status & BIT(1)) { if (lt9611uxc->connector.dev) @@ -465,7 +467,7 @@ static enum drm_connector_status lt9611uxc_bridge_detect(struct drm_bridge *brid static int lt9611uxc_wait_for_edid(struct lt9611uxc *lt9611uxc) { return wait_event_interruptible_timeout(lt9611uxc->wq, lt9611uxc->edid_read, - msecs_to_jiffies(100)); + msecs_to_jiffies(500)); } static int lt9611uxc_get_edid_block(void *data, u8 *buf, unsigned int block, size_t len) From patchwork Sun Jan 17 00:23:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 365234 Delivered-To: patch@linaro.org Received: by 2002:a17:906:fb05:0:0:0:0 with SMTP id lz5csp1677649ejb; Sat, 16 Jan 2021 16:26:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJwMMFdYugjvPA6R6qN3vEqA3qehZTfDnBJrHWViBN0E09wd+bPnVXGoZpcE9bIlY52toEtk X-Received: by 2002:a05:6402:26c9:: with SMTP id x9mr1546747edd.365.1610843161611; Sat, 16 Jan 2021 16:26:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610843161; cv=none; d=google.com; s=arc-20160816; b=bpOKq0CWfli+/nwz9egeMfGoJzVDqZfvt0kyGhjLj8JXc9JRrRp+PqRsbTdDx3r48U L0AcNaREqs4k9Q6atuzFMmRyFqPahTj9H3nYTSSetJiG+H6WCz8qqPR8Z4nOSyyo1Cbn 6n+8jTwyuG020U0gB5NDhPclWXBvisTFd6cdsHXXVbQQ041E0XrXEPKesNG6CtogCm8n Tao5ckUhxZ5wtEJXhJCmEejwFHI9QEgol216lwW7YK2ZremECVQ/TcWFZQbCnlNeU7+9 2wV5e9R/PNtA1NzrVCyLga3F2B31+rUxVjw4hyRLRtUFrbCUi4x8Hcw95btpLaYJnAo0 Dqng== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=pngCiC8UVrFmDGTkFK9zXDEQWbuDnES5IXJTMMZSYC4=; b=aWfJ/w4oGXJhrLyPL548lQLEt+E9EGaXlioKGbvlW98sysUdQGaQOsuksubVUC98CU Q5gExYRVaVEe9y5J7YfOaJ9Q/R+oTPmms6PCq03ASxb48eriCyebddTI04HJLDFBH08R DfPXobpWl13wKiM3GDHFNLKRua20fwHE6qBIwqCrMlgqe7KPPmB5EvKJzNPW4nRSkWeM 2w6ZYgsT61j6Uv4qUq2ioCNIzw/VPSiU9frCd3yHwn8QNQAmLTlF85vfL9RR1PgLilMN iZCg7v4LVz2xSKcgRuRZSHewFblyQjDkts/yPUJc2QhxeUrNi9FeNSFk0JtDGxSaPHrz 2Wyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=y7wUaE5u; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m7si5562839eji.498.2021.01.16.16.26.00; Sat, 16 Jan 2021 16:26:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-arm-msm-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=@linaro.org header.s=google header.b=y7wUaE5u; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727062AbhAQAYn (ORCPT + 15 others); Sat, 16 Jan 2021 19:24:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726785AbhAQAYl (ORCPT ); Sat, 16 Jan 2021 19:24:41 -0500 Received: from mail-lj1-x230.google.com (mail-lj1-x230.google.com [IPv6:2a00:1450:4864:20::230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E86EC061574 for ; Sat, 16 Jan 2021 16:24:01 -0800 (PST) Received: by mail-lj1-x230.google.com with SMTP id f11so14453973ljm.8 for ; Sat, 16 Jan 2021 16:24:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pngCiC8UVrFmDGTkFK9zXDEQWbuDnES5IXJTMMZSYC4=; b=y7wUaE5uSs9/X1CgZ0TgeV+nYHROi8wXtaSQXaSFrr/YXaVn4ZkDx/z/CcIGc4aFhj yfVNJ9hRPzVVlnFeOKfOUWdYMiLz9LzYLYEAKKQ3zrd8q06qsc6M8pW99JyJeoZyuv7Q cjRJu7FsGE6ztp3WsT7fUi5dcaFxEtXEe/hj+l3kUoDAjmBD9G9G0bLlQqmUBSXOEFov wV+0IosGaHEy4YLwDUqbPWIT59zLJV2DNI6I8P7k5nqwjSfydOAgydT5n54AVIRR96sV zvNFcWy7ivZi9VH4WUnwO+emzrfy6nZbdocy20g3qHhDt2XzuG8HkyFQSWUXSDwhG71L rk7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pngCiC8UVrFmDGTkFK9zXDEQWbuDnES5IXJTMMZSYC4=; b=X7570E6Hff/Yf/mR0IMOI7atBBPaut+M755hRYGTA0q4vErmq/LiDSsSpObzIpUt/6 J+A6hp/Td1o4l+DthbPYHft+Ufk2TpZh6BB5f/gJtYcjpMxEAzSgQvQyHMrL9wagQr43 U15vjlc8PzflQrtPablP2OjxDpjcb5Ht/5WiMe2k/ytYh6uaJaIXQDYP8U11+xjPJiOd 675tFZcJ/S0B8xHLtEJO+D8SgRyh3Y6lUI2WlY2kkzUbfLNOHcHzXzIn7IkfTGH05gTV e9DUFAAHia55raeVEOK9MDSL3qgFK5C9N750t5IB5P2vTISL7g6xmGAOUnwGamsAw7o9 HP/A== X-Gm-Message-State: AOAM531xMIVK1k3W5D0sVF6pKOBzl/fcWB7gI/lSPAO5F2z+ONspcoFn lRm+ntuuuXXS19xnfaV2rfhP0Q== X-Received: by 2002:a2e:3c01:: with SMTP id j1mr7969902lja.258.1610843039706; Sat, 16 Jan 2021 16:23:59 -0800 (PST) Received: from eriador.lumag.spb.ru ([94.25.228.101]) by smtp.gmail.com with ESMTPSA id q1sm962468lfu.48.2021.01.16.16.23.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Jan 2021 16:23:59 -0800 (PST) From: Dmitry Baryshkov To: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Cc: Daniel Vetter , David Airlie , Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Vinod Koul , Sam Ravnborg , Manivannan Sadhasivam Subject: [PATCH v3 2/3] drm/bridge/lontium-lt9611uxc: fix get_edid return code Date: Sun, 17 Jan 2021 03:23:54 +0300 Message-Id: <20210117002355.435860-3-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210117002355.435860-1-dmitry.baryshkov@linaro.org> References: <20210117002355.435860-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Return NULL pointer from get_edid() callback rather than ERR_PTR() pointer, as DRM code does NULL checks rather than IS_ERR(). Also while we are at it, return NULL if getting EDID timed out. Signed-off-by: Dmitry Baryshkov Fixes: 0cbbd5b1a012 ("drm: bridge: add support for lontium LT9611UXC bridge") --- drivers/gpu/drm/bridge/lontium-lt9611uxc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) -- 2.29.2 diff --git a/drivers/gpu/drm/bridge/lontium-lt9611uxc.c b/drivers/gpu/drm/bridge/lontium-lt9611uxc.c index a59e811f1705..b708700e182d 100644 --- a/drivers/gpu/drm/bridge/lontium-lt9611uxc.c +++ b/drivers/gpu/drm/bridge/lontium-lt9611uxc.c @@ -505,7 +505,10 @@ static struct edid *lt9611uxc_bridge_get_edid(struct drm_bridge *bridge, ret = lt9611uxc_wait_for_edid(lt9611uxc); if (ret < 0) { dev_err(lt9611uxc->dev, "wait for EDID failed: %d\n", ret); - return ERR_PTR(ret); + return NULL; + } else if (ret == 0) { + dev_err(lt9611uxc->dev, "wait for EDID timeout\n"); + return NULL; } return drm_do_get_edid(connector, lt9611uxc_get_edid_block, lt9611uxc); From patchwork Sun Jan 17 00:23:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 365237 Delivered-To: patch@linaro.org Received: by 2002:a17:906:fb05:0:0:0:0 with SMTP id lz5csp1677664ejb; Sat, 16 Jan 2021 16:26:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJzwlo/HIB+q2EUScLa39gTBwrMrA6f+0VuvFBJXwu87x0i4LYjPQhAiAhqoC+RsTWcZ5G9F X-Received: by 2002:a50:becf:: with SMTP id e15mr15272452edk.138.1610843163012; Sat, 16 Jan 2021 16:26:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610843163; cv=none; d=google.com; s=arc-20160816; b=KcwFok58ZFcbrs0O9z8Eaqy2DBIM6M9aRW4XOZRFi8JCYSCO9hOnX740ecqV+exPou pODwlbY9f46Eqvg1qGLD6/LO8ius7hrHBF9Pa/pJhlFjV3E897WhiD9dRZ/iXqFiqCai m2XK18Berqflfds4d9Y5Sy0yDRi7G+2e1UlRpLQByBqZyIgB8cWjo3qdhDxEGtsMBYWA /PUSTqb5YUAlJ6/4PeinNclNbZbQEhscG/na7gfkXHf6RbrlpDNHXU9Li9rPvhXdNzCJ y/crsi1oggf0vPJgCHj1JVOndwtTbxoftq1OquVrDyoWMvVIoSkEOWBU9HRI7HVnxxs8 QNGw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=OeCW5WaAEi/f4EYCyZpY7fzTU42ZpJ70cz2rIQ84WDo=; b=DDjI6+nKpUis+yziQ8ocQ7+v0exktAcEGF9cI4g7aFF23mHzbFFrvW8NZVFGiP8ZQU tzNFcuysupXV+oSAIH4tNorwSx+/w6M0CLjttswfX0Gl49NjW/J6gcQcozKA+XPDzT1t e7jdVWgsCHPdDDCZniClju/2RkOVof8tHV6s/gY3c60l3rBAm6jCa94E/bBA8OQ4vTz6 WLBqTzzJ8IihL2Yg4bZDrDApK/c9ewoSKWSXPRIAJnL7UVVC8wHjnQCqshiIjrAj9wTK GdbYSdB3aie6UU7PZBo1kMNxIwHK63HJskdUR5nGktSksZoL8FIyilbvlQneEeqOBu47 IHCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="SQlq/fZ3"; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m7si5562839eji.498.2021.01.16.16.26.02; Sat, 16 Jan 2021 16:26:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-arm-msm-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=@linaro.org header.s=google header.b="SQlq/fZ3"; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726864AbhAQAYp (ORCPT + 15 others); Sat, 16 Jan 2021 19:24:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727226AbhAQAYn (ORCPT ); Sat, 16 Jan 2021 19:24:43 -0500 Received: from mail-lj1-x233.google.com (mail-lj1-x233.google.com [IPv6:2a00:1450:4864:20::233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF9F2C061757 for ; Sat, 16 Jan 2021 16:24:02 -0800 (PST) Received: by mail-lj1-x233.google.com with SMTP id w26so14462177ljo.4 for ; Sat, 16 Jan 2021 16:24:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=OeCW5WaAEi/f4EYCyZpY7fzTU42ZpJ70cz2rIQ84WDo=; b=SQlq/fZ3LehILywvHkujzKUD3DB1RvQPPRmLTp5KedWA6Mutn95xJf+wPC1hQZhODH 66tDrDdp/hwpEt/7cgwdgSkk7Vj9HIk7ykvvCUyef4ibE0SuxHCwyvKedQBXr/Nw9D+B 5QMkU8Ur531FiQQiwpbljW8q+utVFxG1UGm2QE9YOWboyBst4mjUoo0yKZYXPiRSYghl jlvEHfvii2PteQWtZEt4TczWWEGkjGhx6kG19fJUSF6qzDRmUf7IkDX3A3agbMwC7EUC k/Xv8g/cuP0/dcv4UINNeqC6tDsutIzOROvl5Q3BSgggyJmqGlTnNRe2z0UAHIK8e9ay GBdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OeCW5WaAEi/f4EYCyZpY7fzTU42ZpJ70cz2rIQ84WDo=; b=PNrqJFyfoAb2+ByyF2ss03EgDW84LbMYaqEL4iJLC3Klu31Tj9AVVzuKlmTu9nOzN0 PUaPOAWRXc0sOC1xHkT+nV8FfzeUOqQUhYS2VF2rUxapl2jRuBoKjCSTA5O0snW7WFwr xHt/5CwC3mDJaBNAOX2ld3A67c2r1XNQgr24f5/un6PDrnA3cB1RRJCyiSDoOt3CZyEo I2+Z/6HMS6Ny7aBYkdDLhHycfKVTmXbmwCER9vdtKiL9Ibs0WiJJSpK0h/VkcpEeF8lx Cv7fATrZzF5kVmCEBUneD1loqKN2S1ZG5e0PIcXyB5gf67us31Gtf1x1BjZsV/WQbMiq C2OQ== X-Gm-Message-State: AOAM533Hx2syVzplOMQ8Tzg7h2Rz9KgqmDut16zA0RnZD+pMXGMQeYtH tN5bGmY079NXbcWWN/wnTSn0kVV6SjBU1ZgI X-Received: by 2002:a2e:9053:: with SMTP id n19mr8372241ljg.283.1610843041342; Sat, 16 Jan 2021 16:24:01 -0800 (PST) Received: from eriador.lumag.spb.ru ([94.25.228.101]) by smtp.gmail.com with ESMTPSA id q1sm962468lfu.48.2021.01.16.16.23.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Jan 2021 16:24:00 -0800 (PST) From: Dmitry Baryshkov To: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Cc: Daniel Vetter , David Airlie , Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Vinod Koul , Sam Ravnborg , Manivannan Sadhasivam , Bjorn Andersson Subject: [PATCH v3 3/3] drm/bridge/lontium-lt9611uxc: move HPD notification out of IRQ handler Date: Sun, 17 Jan 2021 03:23:55 +0300 Message-Id: <20210117002355.435860-4-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210117002355.435860-1-dmitry.baryshkov@linaro.org> References: <20210117002355.435860-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org drm hotplug handling code (drm_client_dev_hotplug()) can wait on mutex, thus delaying further lt9611uxc IRQ events processing. It was observed occasionally during bootups, when drm_client_modeset_probe() was waiting for EDID ready event, which was delayed because IRQ handler was stuck trying to deliver hotplug event. Move hotplug notifications from IRQ handler to separate work to be able to process IRQ events without delays. Signed-off-by: Dmitry Baryshkov Fixes: 0cbbd5b1a012 ("drm: bridge: add support for lontium LT9611UXC bridge") Reviewed-by: Bjorn Andersson Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/bridge/lontium-lt9611uxc.c | 30 +++++++++++++++++----- 1 file changed, 24 insertions(+), 6 deletions(-) -- 2.29.2 diff --git a/drivers/gpu/drm/bridge/lontium-lt9611uxc.c b/drivers/gpu/drm/bridge/lontium-lt9611uxc.c index b708700e182d..209e39923914 100644 --- a/drivers/gpu/drm/bridge/lontium-lt9611uxc.c +++ b/drivers/gpu/drm/bridge/lontium-lt9611uxc.c @@ -14,6 +14,7 @@ #include #include #include +#include #include @@ -36,6 +37,7 @@ struct lt9611uxc { struct mutex ocm_lock; struct wait_queue_head wq; + struct work_struct work; struct device_node *dsi0_node; struct device_node *dsi1_node; @@ -52,6 +54,7 @@ struct lt9611uxc { bool hpd_supported; bool edid_read; + bool hdmi_connected; uint8_t fw_version; }; @@ -151,15 +154,26 @@ static irqreturn_t lt9611uxc_irq_thread_handler(int irq, void *dev_id) } if (irq_status & BIT(1)) { - if (lt9611uxc->connector.dev) - drm_kms_helper_hotplug_event(lt9611uxc->connector.dev); - else - drm_bridge_hpd_notify(<9611uxc->bridge, !!(hpd_status & BIT(1))); + lt9611uxc->hdmi_connected = !!(hpd_status & BIT(1)); + schedule_work(<9611uxc->work); } return IRQ_HANDLED; } +static void lt9611uxc_hpd_work(struct work_struct *work) +{ + struct lt9611uxc *lt9611uxc = container_of(work, struct lt9611uxc, work); + + if (lt9611uxc->connector.dev) + drm_kms_helper_hotplug_event(lt9611uxc->connector.dev); + else + drm_bridge_hpd_notify(<9611uxc->bridge, + lt9611uxc->hdmi_connected ? + connector_status_connected : + connector_status_disconnected); +} + static void lt9611uxc_reset(struct lt9611uxc *lt9611uxc) { gpiod_set_value_cansleep(lt9611uxc->reset_gpio, 1); @@ -447,7 +461,7 @@ static enum drm_connector_status lt9611uxc_bridge_detect(struct drm_bridge *brid struct lt9611uxc *lt9611uxc = bridge_to_lt9611uxc(bridge); unsigned int reg_val = 0; int ret; - int connected = 1; + bool connected = true; if (lt9611uxc->hpd_supported) { lt9611uxc_lock(lt9611uxc); @@ -457,8 +471,9 @@ static enum drm_connector_status lt9611uxc_bridge_detect(struct drm_bridge *brid if (ret) dev_err(lt9611uxc->dev, "failed to read hpd status: %d\n", ret); else - connected = reg_val & BIT(1); + connected = !!(reg_val & BIT(1)); } + lt9611uxc->hdmi_connected = connected; return connected ? connector_status_connected : connector_status_disconnected; @@ -931,6 +946,8 @@ static int lt9611uxc_probe(struct i2c_client *client, lt9611uxc->fw_version = ret; init_waitqueue_head(<9611uxc->wq); + INIT_WORK(<9611uxc->work, lt9611uxc_hpd_work); + ret = devm_request_threaded_irq(dev, client->irq, NULL, lt9611uxc_irq_thread_handler, IRQF_ONESHOT, "lt9611uxc", lt9611uxc); @@ -967,6 +984,7 @@ static int lt9611uxc_remove(struct i2c_client *client) struct lt9611uxc *lt9611uxc = i2c_get_clientdata(client); disable_irq(client->irq); + flush_scheduled_work(); lt9611uxc_audio_exit(lt9611uxc); drm_bridge_remove(<9611uxc->bridge);