From patchwork Sun Jul 4 09:02:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 12357401 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=-18.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,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 D65F8C07E95 for ; Sun, 4 Jul 2021 09:10:49 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 9E715613B2 for ; Sun, 4 Jul 2021 09:10:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9E715613B2 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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=+BHhFXne+eqWUTdCi1Q4ZTbdfCN07Gkgbqaub0tcbmM=; b=33Fhg7uLg7Y9xW wQTste0/3YSE60DmO3rIUiMm+/Sidgirxv3ZCqOYkkiuLgs5/XZsKEZ1PHr0WjsSD7odxbwJ8ePSZ hm3Sxpu/lX8DlnWuhmeI4GukDTVevp3tlAeIXZPOi2bbeVOGJFthgalJE1vTgTPTOWuBoJDHWSWz2 vwGiXNESETEOfGN9s6B+V6BZA2tpKFl5ICJ7nc6QtNQN+7EHojfFW2nz7TAowT7BlodT92ollvZnc XK/yFZuiTTmORhR1+ujra/clvpCbzlziBejmEhP8pOq7pKbudZWZtLNBMQIYoBGkM04JbQdgg0gjv uHgJAKAoMX9colddlgFg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lzy7k-0062iU-WE; Sun, 04 Jul 2021 09:09:13 +0000 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lzy3y-0060vH-Gq for linux-arm-kernel@lists.infradead.org; Sun, 04 Jul 2021 09:05:20 +0000 Received: by mail-pl1-x631.google.com with SMTP id c15so8408566pls.13 for ; Sun, 04 Jul 2021 02:05:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hL+MLrJHBCEnouqDulLM6emOyYNPKN/7WWcJffUZVgI=; b=Ox7OeoxRhsCb8+mFylAYS173jFpOscjCTjnvDIGRdJMYounC5wKIgTpSP7XnVg6xAC raQssnG27OHHwoo4hz6T2qjygVeAqh3HXvS+HJMRwVeeW5DhzGewSdUD7BEygrqp0kmC oVtikcLRGUxzib5wVnpfq3lHqX/Oe7x+NPzK8= 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=hL+MLrJHBCEnouqDulLM6emOyYNPKN/7WWcJffUZVgI=; b=k5I9Tjts9cmAFLQEq/eapewsYhtZBLosEyjjUDjVq3z59+otnM3z7gAH8SgAUBmswA /HKnEdqzaCS/rDoJQZvaYAxXvr2cuPdMoSBlJHQpF4V9wZF33YFVlUrQjlSylLbFgFT/ e40hTYUQ0UX8mjvY2ygYXFXg1t29u+ytNnVZ3zSaijlf+c4wmNgJFGItwvytemAH1FjZ yjWQ25ivf6ef5v+7kxvUm9xhvvLH9NQoY/KOmStV5Rpt3klpf3Mg+gK98Bvaos0l+9Xf eecjXlbWm/qwr0KrYsvrSVjl9lgQC0COhXKA3sgcv5B7XMpwglZg8I6kfbYoDSwSMJv3 5JAg== X-Gm-Message-State: AOAM530NJUG+dD1kSom9Xeg6HOmVBp3cLTgoXlvIjBZNjdy9iDK2vFXD IRUZ9+iHAeX8d5lD5J0zJgKSLg== X-Google-Smtp-Source: ABdhPJyVk/7w3gX4oYTDufJRP1VggAbeuygq98DTjeKrWXsuGHlnrvYPSoR5wfCpShhHU3GcMAL8IQ== X-Received: by 2002:a17:90b:14a:: with SMTP id em10mr8827443pjb.154.1625389517778; Sun, 04 Jul 2021 02:05:17 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a884:1ae9:772f:6f0f:3e24]) by smtp.gmail.com with ESMTPSA id m24sm3360793pgd.60.2021.07.04.02.05.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 04 Jul 2021 02:05:17 -0700 (PDT) From: Jagan Teki To: Inki Dae , Joonyoung Shim , Seung-Woo Kim , Kyungmin Park , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Frieder Schrempf , Daniel Vetter , Marek Vasut , Krzysztof Kozlowski , Fabio Estevam Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, NXP Linux Team , linux-amarula , Jagan Teki Subject: [RFC PATCH 11/17] drm: bridge: samsung-dsim: Find the possible DSI devices Date: Sun, 4 Jul 2021 14:32:24 +0530 Message-Id: <20210704090230.26489-12-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210704090230.26489-1-jagan@amarulasolutions.com> References: <20210704090230.26489-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210704_020518_662327_7DDB9D34 X-CRM114-Status: GOOD ( 16.21 ) 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 Finding panel_or_bridge might vary based on associated DSI device drivers like DSI panel, bridge, and I2C based DSI bridge. All of these DSI drivers will invoke the DSI host in order to find the panel_or_bridge from probe to host attach and bridge_attach to host bridge attach. So, in order to handle all these cases of finding the panel_or_bridge invoke the finding API in host attach and bridge attach with the DSIM_STATE_DEVICE_FOUND flag. This way we can handle all possible cases of finding the DSI devices. Signed-off-by: Jagan Teki --- drivers/gpu/drm/bridge/samsung-dsim.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c index 2222c27feffd..9a2df1212d0f 100644 --- a/drivers/gpu/drm/bridge/samsung-dsim.c +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -248,6 +248,7 @@ struct samsung_dsim_transfer { #define DSIM_STATE_INITIALIZED BIT(1) #define DSIM_STATE_CMD_LPM BIT(2) #define DSIM_STATE_VIDOUT_AVAILABLE BIT(3) +#define DSIM_STATE_DEVICE_FOUND BIT(4) struct samsung_dsim_driver_data { const unsigned int *reg_ofs; @@ -1475,6 +1476,15 @@ static int samsung_dsim_bridge_attach(struct drm_bridge *bridge, enum drm_bridge_attach_flags flags) { struct samsung_dsim *dsi = bridge_to_dsi(bridge); + int ret; + + if (!(dsi->state & DSIM_STATE_DEVICE_FOUND)) { + ret = samsung_dsim_panel_or_bridge(dsi, dsi->dev->of_node); + if (ret) + return ret; + + dsi->state |= DSIM_STATE_DEVICE_FOUND; + } dsi->drm = bridge->dev; @@ -1498,9 +1508,13 @@ static int samsung_dsim_host_attach(struct mipi_dsi_host *host, struct drm_device *drm = dsi->drm; int ret; - ret = samsung_dsim_panel_or_bridge(dsi, device->dev.of_node); - if (ret) - return ret; + if (!(dsi->state & DSIM_STATE_DEVICE_FOUND)) { + ret = samsung_dsim_panel_or_bridge(dsi, device->dev.of_node); + if (ret) + return ret; + + dsi->state |= DSIM_STATE_DEVICE_FOUND; + } /* * This is a temporary solution and should be made by more generic way.