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: 12026751 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 143E1C433E6 for ; Mon, 18 Jan 2021 08:25:59 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C919B22525 for ; Mon, 18 Jan 2021 08:25:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C919B22525 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id ADE1B6E1CD; Mon, 18 Jan 2021 08:25:50 +0000 (UTC) Received: from mail-lj1-x231.google.com (mail-lj1-x231.google.com [IPv6:2a00:1450:4864:20::231]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1B7B989B49 for ; Sun, 17 Jan 2021 00:24:00 +0000 (UTC) Received: by mail-lj1-x231.google.com with SMTP id p13so14497441ljg.2 for ; Sat, 16 Jan 2021 16:24:00 -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=LDtqBFt8BkLFCT2itd8rHVMd6PW8sAdTs0nJV4qmOo4itN7aDLLuvZ2yqWPeKcZqKQ KH3IEG7vb72tpJMiHlWfhB/2yk/f71daXgwdjWne++xBttAxh9rCW1QxwM/6gyVQVhBc nWBI5mlZlGklAU+kCRomyp7xYKtToLHI9LHfXlqvYZxivjAXMOJogHkxahZsuP/VGe2I 1AqOdxTrUsaq25xiOXQ6DHmRBOBXpEpcuJqsjtK9dc3joAmJWPuhNbRK3bsbtmiqOlxW 6WtelJfQEHs0WQX7lod3MIop4bf5QfSyt+FSxYHyCwVG1ZGPFOjmrZCfmx7gV+P5+wBj vRJg== X-Gm-Message-State: AOAM531N7kQbPbxTW5V5UTo8Rs4zKYxqJD4GtN15M+xHxK8LBQher0jH UgXhoGxS8N7VYTE5SdDoMcoX7JA3Xp0i3LIl X-Google-Smtp-Source: ABdhPJxRg3eJAQoDyiUkVKBvBiFd2B9eEiPA2IEMEdjLSpsknS2wV9RDFNyeQd9YpoVEE2kPJavj2g== 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 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 X-Mailman-Approved-At: Mon, 18 Jan 2021 08:25:29 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jernej Skrabec , Jonas Karlman , David Airlie , Neil Armstrong , Andrzej Hajda , Vinod Koul , Laurent Pinchart , Manivannan Sadhasivam , Sam Ravnborg Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" - 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(-) 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: 12026739 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 422CAC433DB for ; Mon, 18 Jan 2021 08:25:44 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EAB372253A for ; Mon, 18 Jan 2021 08:25:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EAB372253A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B6D6D6E17C; Mon, 18 Jan 2021 08:25:31 +0000 (UTC) Received: from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com [IPv6:2a00:1450:4864:20::22e]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9D71689B49 for ; Sun, 17 Jan 2021 00:24:01 +0000 (UTC) Received: by mail-lj1-x22e.google.com with SMTP id m10so14469660lji.1 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=FaNesa+JsQ2zE8zliKgnD0EvWeKSeGamNLeq8KmYMYsoy2/5ZjWSP2IfmQSVnWVDM0 9057glNUXTm8Qf2uC79bIZTTDPEGEQYkCalaaBltKdzpnCyqAV/Q8f5AmtvCY2DZ+9oH r7dC+Bh83aMQO65GEdZvZ3S15N6rZfpYKhwFHGt2YcWfj71EdM4xrPokX28gzl7e0pqM RVh4Ly4PNKHDpfdozi274GajJlbzMZ0afXp404tLP+H4Rk0A3x4FVawTaUZqWYtDPUxt R6wwxlqg8LAjr9efCoVuvXVNZ2Nn5htlNrn48pSc8CcW2y4Mq6Vj/5vbMBotvuvOHAnN hylA== X-Gm-Message-State: AOAM531Y3DFrIS7YomxoDauZU0qsCbnkdU4h/OmfFIjaUT3OcjjRwo9Z lywqnhQ3o7pOHElU1t8GB5lyswxtT+ua/8Of X-Google-Smtp-Source: ABdhPJyLeADw2VKPRMAvtHVWtCOxRs38E8QehKF4XvsxxSU6wP3pWJnlkTEPqdMsIhPMrt4Htm5nxQ== 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 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 X-Mailman-Approved-At: Mon, 18 Jan 2021 08:25:29 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jernej Skrabec , Jonas Karlman , David Airlie , Neil Armstrong , Andrzej Hajda , Vinod Koul , Laurent Pinchart , Manivannan Sadhasivam , Sam Ravnborg Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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(-) 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: 12026733 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9717FC433E0 for ; Mon, 18 Jan 2021 08:25:35 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 475FD22525 for ; Mon, 18 Jan 2021 08:25:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 475FD22525 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7926D6E18E; Mon, 18 Jan 2021 08:25:31 +0000 (UTC) Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [IPv6:2a00:1450:4864:20::22d]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4380589B49 for ; Sun, 17 Jan 2021 00:24:03 +0000 (UTC) Received: by mail-lj1-x22d.google.com with SMTP id m13so14409821ljo.11 for ; Sat, 16 Jan 2021 16:24:03 -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=LxgYkPuInYm0Z2Uy3wUwZy8KOe/Wmqqfl2kSlxuAIHyy4QYfLoFn30CcjhFK7dCarQ LFYafCqmZvImd7bg/E2m5P7u7nVmrJcyMRkNuhG7qwGXIDsiM55dmQukGycaG5C43XfA 3fzzWn1DFzln9alpNsm2i83cjsUJH6M/mXosl2ZjLYMJwFu84U1tE1T0Ld8L6dAlJ7jj IxKzILZ8ivJkRAyCNCeFCiB55E/6ajLQ/uVS1nrcggp3g2GuzwHKAmRXdGPs76LH89c7 S1Kx6ZvI54Qz+JEAvxzs5zFQmgsCPoOgfoTlUASSOcVPK0dfNTKjAUQQ6EWq+ekbes9O 4uJA== X-Gm-Message-State: AOAM531eBJSo1ud92Dx8VPo4v0dczyj1DoRLlafiFvxI9D3HqL1+shDS DtfajOXCDGy8e99COriisTkPrajboAD5VaNb X-Google-Smtp-Source: ABdhPJwp+3c4UawnfMfiibpSuOeBivbcydMHbWe7SDn4oYEPLEsvlmM2fMkBplA4OrxhFJSJdRMnrQ== 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 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 X-Mailman-Approved-At: Mon, 18 Jan 2021 08:25:29 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jernej Skrabec , Jonas Karlman , David Airlie , Neil Armstrong , Bjorn Andersson , Andrzej Hajda , Vinod Koul , Laurent Pinchart , Manivannan Sadhasivam , Sam Ravnborg Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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(-) 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);