From patchwork Fri Jan 15 11:02:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 363545 Delivered-To: patch@linaro.org Received: by 2002:a02:ccad:0:0:0:0:0 with SMTP id t13csp184599jap; Fri, 15 Jan 2021 03:04:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJxgKzHHyxEyH1uIiZJEDKeAIfnIZN5cQ5eOfTFKpiJ0VvFhmEypIGE6aaHGz8C6DuaxZOja X-Received: by 2002:aa7:cd15:: with SMTP id b21mr9254851edw.114.1610708669047; Fri, 15 Jan 2021 03:04:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610708669; cv=none; d=google.com; s=arc-20160816; b=e53P7I37kdFMaJogbVMk98V8OhKLwd4jvHlfscHlC059S3vZMb6c8k8pgpe3+X2S54 Cv2E2/LXGBEpIdkG2vE7KQrCXOkqwDexhcrIYEdq2+yHHcqX0x9J9sfqX6KDrenwPcbT UCl6e+KL9UOqffY0qR3dR9YBAyL1ltf/C/Hss/2PhCErZzn3Bi3ojhaP8R7fsYPLbJcP 4XOg+pw9TzCANiLFLvv69fGH/tVYs20FSf5B2ngu5gRNP7QZtp7sNRMzsLSPykqsLtGT DJoVLl1mo+GRJL4spUEesvHIp82YP9MdkpHvDQ0g+WPVCwGsJ22us1fB/ydDaRSzc2Uo aQnA== 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=jSChnRbVL3LIpHlZ71yiNTdT7EdTTbSBxAIEKIyjKkddXFaXg5iDyQDNzscFUi9vUm 4DCqdKGz7nyJPOAZ2aJxAO8Diqhcq0F26Um+/HNNpD+i2ORQJyWmfVrZ4a6o4jWqrU0q Ccu3ILOALxrrZagD3riH2jQ+IpqmKAgBPFRtF1ncHuWHc2LHgknulJ3RY6s7BvR2njdA MU5BNKidhhKrS4cgtjJ4mqijUKL/+YjnjTXmKLY1wJwmY5GPugS69zb39lBnduLUBN0S hF5Wf5sWoVechb26Nl1QRBFHF8suon74womKBLJvLuy1EhTO4HIQOqqGGY3i+kbh/yRn BS1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Q6OSfsKH; 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 m10si3877144eda.139.2021.01.15.03.04.28; Fri, 15 Jan 2021 03:04:29 -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=Q6OSfsKH; 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 S1726455AbhAOLDN (ORCPT + 15 others); Fri, 15 Jan 2021 06:03:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726045AbhAOLDN (ORCPT ); Fri, 15 Jan 2021 06:03:13 -0500 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C16DC061757 for ; Fri, 15 Jan 2021 03:02:32 -0800 (PST) Received: by mail-lf1-x135.google.com with SMTP id x20so12501106lfe.12 for ; Fri, 15 Jan 2021 03:02:32 -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=Q6OSfsKHIRau6OEp7U8C5Y+6jgIDFkbJL5vZk91Nuv0NpTmw5qQ5axByZ0pzivn+Si owKkBlxjCDFJSDxUZFD1Ehqk9+kxyKCa260yDW+BtNDdqS4QyCv0hAypajTGyz+UGXgH INO1yAMhbBbZ6ju1YmkaWYKJjix5mvZP6dTrZa/lro9WUF6ykREP9qqiOFZVPv9vOPT1 N999vz7F0m/nUByMdKPhktsyjnCkqSnJr1hKKMJvSJCEgJgNXS7gJQMTlEPqOt3krd4y 0aP7+OAYAsWeLdhAFW6Yoi+DM4Q7vZA/lb5hM2kkxB9+eEold3C44pOIVRXBc5tvoxng v7ww== 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=sN2wX/BlHsjm/4qgolsuTV2EKyg3VGliDlZrssMiA0980C6nSNozBGdvjx5ecAXUVC Wr1js9crF7vCIle96vaVFqk0agByAc3EfJUfgGl6B0vkT6O8R4luuw37CUcywvIklKE7 sgk3RiHeainLDidPLQY6f+6tEIcxfeJZGrDvdKkKa+e1fm9dRSgfEKfUV05lnbl/VLt3 XEhHV24n17ylaR3KS7idQuntd017m0FqGLhmi2+9r0tz4KoDpFxqC1D/chbDhor2nJHL 9nHBQ+sXzcHSNw/bEon/Ee4EKOgeeDeaJom5hsYEqxlCBLTNPYowa/Kpj9H4RNP4sRW2 eE+w== X-Gm-Message-State: AOAM532c7NiB7JScitpmRlGd/ezPYCXIcZq6gdAHd11UqQfcfeGDqImw odC4ZjD2xlQZEhlZ8jOtTrVELQ== X-Received: by 2002:a19:c711:: with SMTP id x17mr5344738lff.56.1610708551013; Fri, 15 Jan 2021 03:02:31 -0800 (PST) Received: from eriador.lumag.spb.ru ([188.162.64.106]) by smtp.gmail.com with ESMTPSA id s8sm862020lfi.21.2021.01.15.03.02.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Jan 2021 03:02:30 -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 v2 1/3] drm/bridge/lontium-lt9611uxc: fix waiting for EDID to become available Date: Fri, 15 Jan 2021 14:02:23 +0300 Message-Id: <20210115110225.127075-2-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210115110225.127075-1-dmitry.baryshkov@linaro.org> References: <20210115110225.127075-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 Reviewed-by: Bjorn Andersson 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 Fri Jan 15 11:02:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 363546 Delivered-To: patch@linaro.org Received: by 2002:a02:ccad:0:0:0:0:0 with SMTP id t13csp184611jap; Fri, 15 Jan 2021 03:04:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJz9r63LXuQuD/OK5LhqgWwh0+W4TxqbOnoZ6QmJTh5Tc8Li8/r6/q0D1sWitIC8y7fOe7QR X-Received: by 2002:a17:906:b51:: with SMTP id v17mr8656309ejg.8.1610708669612; Fri, 15 Jan 2021 03:04:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610708669; cv=none; d=google.com; s=arc-20160816; b=If/aCdiVJyf5iEcAEBJDgJ8svyHeYGg46J6nCfyjsGT56m+79EYf3i1f+CceY/EpQs RRRkZv4Y0ESVuiFB/Pb81PVrIcz+9mvbQ8URicFN2jP5IzemMCafoFRYbec3Wfr8LTca HT5AzU4WVRATVIk449t7pt8TWMSiNZCWiF/XdFZo9z32GLuPQeiOm25PF3cROPVk456Y isWf3SDRoxsV1JIsXqgCrg2DRPpK73uZGDFNuAe7zpCLf40SbfWkBDbRLQtX87ITLN/6 pe39VhFNFVhUgSN3HKlMjJqsdOuNVzzJgMz3T0O57DhYW/6Gh7U38oOFGN48NpDl7+yd CClw== 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=DqFR45U1N2XP3NccldXpdPJeTXVL3bDa06J/rceWY/RBvt+w+Qe/5LFIXKnj0fuE8d DOc13GDKMtr1F8IpR2pxwiRjRirix4nm1vdM72CrTVU/k6yTeGh9fJ7ODcXGKsj0AAgy IJRMkBwWA9/khzQgou1RmdKrdQKuOTYRdIXQYQ9GaeqRLwOcTdJcw8PVn5Sx8bNeKERA F2eK13pp0jP7AlML1QhYcOYDG5m3lEAUF+O290zDuBHr0jdMNu5obKn+vsrqwy3AjFyv MROzI1co4XjI8SxjJYW6KahUs5dC0Kzj/daPdV6hsJgE3GDyvo4l5lVpAqs4uOSLwvLY P3aA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="yuOMDW/x"; 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 m10si3877144eda.139.2021.01.15.03.04.29; Fri, 15 Jan 2021 03:04:29 -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="yuOMDW/x"; 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 S1726642AbhAOLDP (ORCPT + 15 others); Fri, 15 Jan 2021 06:03:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726045AbhAOLDO (ORCPT ); Fri, 15 Jan 2021 06:03:14 -0500 Received: from mail-lj1-x229.google.com (mail-lj1-x229.google.com [IPv6:2a00:1450:4864:20::229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F143C0613D3 for ; Fri, 15 Jan 2021 03:02:34 -0800 (PST) Received: by mail-lj1-x229.google.com with SMTP id u11so9881930ljo.13 for ; Fri, 15 Jan 2021 03:02:34 -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=yuOMDW/xAGqHviE9dKa3cO0BxBs30bU+Rvi6uWs/FKsGR73rumUZJIrpMtMd8tSDPE 0rdj4CvQX1eDZwxa1JZNXNTmQrg/5tRO4SLMcHN23O6AxrPw2sAmUC+i2aWdPnN/mfQK 7J6d0eMw7bp/RxH4iRVx/ROHx6xT1mJlgDpcLUYa2qaQyOBkpFu5s86+/EMVccDpio7F GTAOxJAMQ0x0H8JF4OLjZLSdPRuli+YB3y+XZLjMGQ7M9/ZEsoz/dh/X0VGx0raB8+bt FRDFgyFILUJkgfBTz/gIJMCX4q6wqYS+kkZ6JXfVVddzvAHLa0aDNg0gOdEbqoM1CbfD nM1g== 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=p967lCSeBoqrGkc7xrKUpGh9gJBXPsGjPqxlROEJAZ0l7QI+AtpkN8Mgvd3amQJbkQ ullocD38fK/0nc0XW+U5mXYsG2pxVZfBkpHidmu4nR2n0w5+1Yu/pz7R5U0z0JpdtKNS yOAJO82EI723sE1Nuji8lRptsCBKw5M2a5L5lfDGlwfl4XnmxmC3OJLcVcGCVbwiP9pu az6qYeudGu8Fv7nh3rv4siBlxiCxf1cgHQ1isACkyzDdi+XbZ1CbP47sAlUIwjDSxd1I Vg7vBuDk57Xfpcs/dsYHWSUaEHu4Q9X1lpvAI0qr8z41xJucw2BiZsRK4YGLW32XDd2Z qSzw== X-Gm-Message-State: AOAM533yDlE/p8zeBpcyY0E5Ss5AsizQfm/CeWxKeOFtH9oQ/Q55ZKsd 409KlW1aWVQnXKDwlLWpDLuNLA== X-Received: by 2002:a2e:8ec7:: with SMTP id e7mr5053355ljl.249.1610708552728; Fri, 15 Jan 2021 03:02:32 -0800 (PST) Received: from eriador.lumag.spb.ru ([188.162.64.106]) by smtp.gmail.com with ESMTPSA id s8sm862020lfi.21.2021.01.15.03.02.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Jan 2021 03:02:32 -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 v2 2/3] drm/bridge/lontium-lt9611uxc: fix get_edid return code Date: Fri, 15 Jan 2021 14:02:24 +0300 Message-Id: <20210115110225.127075-3-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210115110225.127075-1-dmitry.baryshkov@linaro.org> References: <20210115110225.127075-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 Reviewed-by: Bjorn Andersson 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 Fri Jan 15 11:02:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 363547 Delivered-To: patch@linaro.org Received: by 2002:a02:ccad:0:0:0:0:0 with SMTP id t13csp184621jap; Fri, 15 Jan 2021 03:04:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJxfQ9r17u6IhiQb4RzKdtl595xOiBYdYR6/IfOSiOV1uSPS/ls9wKqYFt4g6/XIVwUTAykk X-Received: by 2002:a50:d5c1:: with SMTP id g1mr9422118edj.299.1610708670057; Fri, 15 Jan 2021 03:04:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610708670; cv=none; d=google.com; s=arc-20160816; b=ZHdeQrXFJV9SgKSgLk8jYw1fs08GOV4tujhpIejcTo0GPJ5f32BTYps+AhPvgCO6HM 8vguJt6PPH6hPCMXvwAMdaHXapp7lNJLBV/ZJlmAh6470e2R5AN2CDFJjq+K8L4KMbSN ArXbq5NaFovT2dt7e1pKAHkYizZOHuW5BHmn1g2nGdPv3C3P7TUcSWavx6ZQWW4l+Hfh 0G0q3+rtKM4qc/VHyXXo4Q0x/Op3+TDlPGrVJe+sLFCFdac18FaTv6ASx44RYoVQvEg7 UDev/+GH86K+7e3QiA52sI2lckk408CxiKqzwAQ5Cd7y0A6+AdfvKxsgMzvfHnmg1+Qc SrxQ== 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=bVcjRs+Ok7w3SNArmcDX5s4jqseIUriYsAY++usO/v4=; b=E2EYBFCK11uWZgJeHstmdxbvpAK+OHtJLXmUShBx+zLAWtQsi1DfCIHuvetJtHpJdy V4a0yM4zJEcUjpA3j6GFrEtiv5FJRxn2U2OGSay3Sb0u+/LgR/cbvdiQo/4e85ExYJQo 76j+WowCdusQ/5ZR81M2KUnC00ixqH8zK+zxYpbVftMN/itFwR/x8wwvBEwzoaKj7gje zn0+ugWSvjK4r5ogd4w9hIXXzKvgzXAA1f5Q/sEf+ENYSOr/Nm7in9VcwXhgpn2K1f+U 5HJceZuvYPrvfqypCcVS4UdDkWkORBVmBr58kXxOaeTkuSsgDBSVmuqx27K+/hSvmL7B Et5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fIxlssTj; 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 m10si3877144eda.139.2021.01.15.03.04.29; Fri, 15 Jan 2021 03:04:30 -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=fIxlssTj; 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 S1726727AbhAOLDR (ORCPT + 15 others); Fri, 15 Jan 2021 06:03:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726045AbhAOLDQ (ORCPT ); Fri, 15 Jan 2021 06:03:16 -0500 Received: from mail-lj1-x231.google.com (mail-lj1-x231.google.com [IPv6:2a00:1450:4864:20::231]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BF6FC061793 for ; Fri, 15 Jan 2021 03:02:36 -0800 (PST) Received: by mail-lj1-x231.google.com with SMTP id u11so9882022ljo.13 for ; Fri, 15 Jan 2021 03:02:35 -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=bVcjRs+Ok7w3SNArmcDX5s4jqseIUriYsAY++usO/v4=; b=fIxlssTjF9bpwqr0geCcR+J3tdYEWhq7wPNyJHJbQiSukYyUEqXPwA9D0TkaDkzxMA zG4lXbdrCx5FT9VSkj2NGhulPDcPyq8fUrXdmTi4VkmvR7UHnuj3rklnQsZE7YYlH6zS cSGJZhD72bBP1DXw12/+s1gAJMnHBdUMme0fyiQG+f3iYu+BPZar4Okhl172YtCc/sFy iczY+MN9pFkpLtNSojxEmFzTIyu46LfHwNLEszbKsNjqIrIyoE0LP/PjItp0vsJ+VC5T GVWib6T2i+uqQacta7ngU6eXf3W2uas4ZXMzy0dC2p4TMs7PlC0evbUip1FWLVqSWn6U CA8g== 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=bVcjRs+Ok7w3SNArmcDX5s4jqseIUriYsAY++usO/v4=; b=ZVgboNuRCEA4bqEL9uXJ7eCxIsSuvFMSvpM9RTi03z6+s2IMnFHyswg31yVPdEQB2l K9bFpaE7ttzSvVAbDypbUDkFH39khFduGLisLdnVqzi/Oriyr/M4sCqOw08/p3XD3gfB Aj25AaQnctUwpA1hQYtSPAg+emVfzJqMR5cEJ/on47YSBky/mBu1ZqScdO33rWWvVA63 cogze8tCvbfj1qYi19kjdGIMR1HtLyNk1ICOfYreo7inJ5MyaTbECqMoDGOmCHBJdCPn vM12gLUYq5dXn6qibgOJ3kxsT4tjjFSrzW7ng6CCfXw7zjbHI1k/lBiC3nAkDVE9+MkS 8Z8Q== X-Gm-Message-State: AOAM5320ZjJH86BLrXNQwi8fdh9NurzAHo9Sk8yTLcB8GHRbd9FoIIeg tDSnzyx4az662Ipyn/k991V2mQ== X-Received: by 2002:a05:651c:228:: with SMTP id z8mr5408367ljn.310.1610708554557; Fri, 15 Jan 2021 03:02:34 -0800 (PST) Received: from eriador.lumag.spb.ru ([188.162.64.106]) by smtp.gmail.com with ESMTPSA id s8sm862020lfi.21.2021.01.15.03.02.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Jan 2021 03:02:33 -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 v2 3/3] drm/bridge/lontium-lt9611uxc: move HPD notification out of IRQ handler Date: Fri, 15 Jan 2021 14:02:25 +0300 Message-Id: <20210115110225.127075-4-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210115110225.127075-1-dmitry.baryshkov@linaro.org> References: <20210115110225.127075-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 --- drivers/gpu/drm/bridge/lontium-lt9611uxc.c | 30 +++++++++++++++++----- 1 file changed, 24 insertions(+), 6 deletions(-) -- 2.29.2 Reported-by: kernel test robot Reported-by: kernel test robot diff --git a/drivers/gpu/drm/bridge/lontium-lt9611uxc.c b/drivers/gpu/drm/bridge/lontium-lt9611uxc.c index b708700e182d..88630bc2921f 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; } +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);