From patchwork Mon Jun 17 20:03:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 11000367 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9EA3913AF for ; Mon, 17 Jun 2019 20:04:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9108028862 for ; Mon, 17 Jun 2019 20:04:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 851872887E; Mon, 17 Jun 2019 20:04:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2C3A228862 for ; Mon, 17 Jun 2019 20:04:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726023AbfFQUEX (ORCPT ); Mon, 17 Jun 2019 16:04:23 -0400 Received: from mail-qt1-f196.google.com ([209.85.160.196]:34642 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726455AbfFQUEX (ORCPT ); Mon, 17 Jun 2019 16:04:23 -0400 Received: by mail-qt1-f196.google.com with SMTP id m29so12398232qtu.1 for ; Mon, 17 Jun 2019 13:04:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poorly.run; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=MoDrWcvfQIcbjX6EFfofy9wV3QW/5fjWQ7KMcAwGXck=; b=MumptO/KQTle/dU4X+lru1AwzqTHc7POxytAWgmfzMtGqNJsIhXYNDV5qaXc6Xn1TX 1mLrzP1fnFoiY3kSI0+6YLdEnNNK1Org6t3K4fsAMyuWCsgGqoE0HHPhujrlGl7Padl2 mvvM6Ovf231kvYoTs5CnBnorccuHuVDn5U7McUK8qGTErjFGJcqcIyf6n8kJGMUJ/P6K JWBPxicTjDG3AiisHnACEAnnO5XdwNIv4ZSXRJMS02tZMjSTHNygu+vKow6tKv9SwLgn aD5BkRWNphH5fsTEfwndhMA7NOQACUXiE8EQ+b7bqZfamXHVsYbzSIUXhZiS0DjG008+ Iylw== 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:mime-version :content-transfer-encoding; bh=MoDrWcvfQIcbjX6EFfofy9wV3QW/5fjWQ7KMcAwGXck=; b=Q3XhZ75jMKH6hdJoCmY6+cr7KKw2WCo7gdhXa7bQmHo8EHyukhDMAT58SAHyPnWX3a /ufmvsJ9leHaACMXBpMAXUbgU5eiXjXI/iBcHjiyyFgPsY2A4NH2Md5HPTw6BYXTgFdv jyJu5azKWrT4CPJmJU2S0VJpbDJaKPW9i/haX7SyIMpatTwgI87yh/bnG8hpjRwORZx0 zJacJRqpDl/Rmpzp3N/RCKjBy3bDXI602t9XwDAIzmHiq5f9FEtIOebuf01JjFUYnPiv lOQdbYq8vbPUD2MXUJ3CPon7n9//4WLiXa11zeQXlp4oBhIie6DGTC7QdMH9H6XIQuuM +siw== X-Gm-Message-State: APjAAAXf1Ablahna3jmcn+wgFyMgpzvD7CmDlF4jITORWfAtTHh1YwLS j7hEqYSx2CC5rm3qG1emWZazKQ== X-Google-Smtp-Source: APXvYqzKCGN0GuBRRJjvS3GtjbuIGUvGbilM0CRluPyrXr7aW8sG4a6kPDpW5N9YYxuzSOeFFQxsxg== X-Received: by 2002:ac8:1796:: with SMTP id o22mr89481668qtj.98.1560801862295; Mon, 17 Jun 2019 13:04:22 -0700 (PDT) Received: from rosewood.cam.corp.google.com ([100.100.175.19]) by smtp.gmail.com with ESMTPSA id j26sm8584794qtj.70.2019.06.17.13.04.21 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 17 Jun 2019 13:04:21 -0700 (PDT) From: Sean Paul To: dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Cc: Sean Paul , Rob Clark , Sean Paul , David Airlie , Daniel Vetter , linux-arm-msm@vger.kernel.org Subject: [RESEND PATCH 01/13] drm/msm/dpu: Remove call to drm_mode_set_crtcinfo Date: Mon, 17 Jun 2019 16:03:45 -0400 Message-Id: <20190617200405.131843-1-sean@poorly.run> X-Mailer: git-send-email 2.22.0.410.gd8fdbe21b5-goog MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Sean Paul Now that mode_fixup has been removed, we can just rely on the call from drm_helper_probe_single_connector_modes(), Signed-off-by: Sean Paul --- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c index 82bf16d61a45..94ba4a577ee1 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c @@ -622,9 +622,6 @@ static int dpu_encoder_virt_atomic_check( } } - if (!ret) - drm_mode_set_crtcinfo(adj_mode, 0); - trace_dpu_enc_atomic_check_flags(DRMID(drm_enc), adj_mode->flags, adj_mode->private_flags); From patchwork Mon Jun 17 20:03:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 11000371 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EF78614B6 for ; Mon, 17 Jun 2019 20:04:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E27582886F for ; Mon, 17 Jun 2019 20:04:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D5CD02889E; Mon, 17 Jun 2019 20:04:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 727002886F for ; Mon, 17 Jun 2019 20:04:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726642AbfFQUEj (ORCPT ); Mon, 17 Jun 2019 16:04:39 -0400 Received: from mail-qt1-f193.google.com ([209.85.160.193]:46830 "EHLO mail-qt1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726455AbfFQUEi (ORCPT ); Mon, 17 Jun 2019 16:04:38 -0400 Received: by mail-qt1-f193.google.com with SMTP id h21so12320579qtn.13 for ; Mon, 17 Jun 2019 13:04:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poorly.run; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hAfYkP7d2WvxOZhRBCRJTvRlF3xI0tTIFNDwNnfuAj0=; b=IzC6Yy+dyUFQKAxj9w03NH/zDg/rd4E2TwI45rSFseDlnwX6v6+kw8gp9VzqmxCDIk vJB6gvNsKZeEfPQSLfmv0f8EIe9wnUf6b29SjNovXXgi/+5FcZo4I8vsBkGqRnRBL8XO 5UwD/IvU1nCgpQ49aNWBT9qoVIaZlHeP3dAm+nYmmOxT0hjEWc7nC8OVfaARo5YOXAX2 ktOc87n3NNWW3Ml6qgLtu2Rda09quP3phgUuyD52cU10F4aJFECK1Q6eqVeL+sCFoI9U KgMEtLHvE9NjShWyK6S6KFd1RIIxLzJgJuKZ2eTmlgTSNS5orC2XSbAbpY6KZkuBoH97 kM0Q== 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=hAfYkP7d2WvxOZhRBCRJTvRlF3xI0tTIFNDwNnfuAj0=; b=GVDjJkFpqLBVk5ShMMd580k8xbCGQZfFHF3zHS1q513VaRgS8Flvn1AB6Kkpb4WHEd CRiKmJ2qGUxdHNdnRIclarx9CLdPRFX17MBMI+QtiP57ZMtoVEimnyotRdUyBzMzB6eh Jbrh1IoaPEPsDo3fDCWHF25GDRxmjMC05rpYs1pKNlh/9yZQ1hnEKdGDRL20dtI0fKMN 2URBthyRHl2VFzisPwiBaDPwTHPWrvlgX1+Xa7tdr5K08UBTJ3JZa+BmO5HWndtGqzxc sgsZ7WmuNUwftAEr7XO5FKVryyaiVctkw4YXfTGcvBq/7V3FtXf9FILO8IwQlHKOjj0Y acrA== X-Gm-Message-State: APjAAAU6b/FxQbT9WCBA6Vre6YV8w0txaai3nCPAjt7EMNuWQ75etMDM GT9xGOeyazayB9SDTLj3lZoDDA== X-Google-Smtp-Source: APXvYqwF2TgSDN5Rp6djhjPuzRXU95E/oIoie46EqS3shh+tm7T9bkobuH8gat0UT8KQouFk+bGu9A== X-Received: by 2002:ac8:38c5:: with SMTP id g5mr97751585qtc.299.1560801877766; Mon, 17 Jun 2019 13:04:37 -0700 (PDT) Received: from rosewood.cam.corp.google.com ([100.100.175.19]) by smtp.gmail.com with ESMTPSA id j26sm8584794qtj.70.2019.06.17.13.04.37 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 17 Jun 2019 13:04:37 -0700 (PDT) From: Sean Paul To: dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Cc: Sean Paul , Rob Clark , Sean Paul , David Airlie , Daniel Vetter , linux-arm-msm@vger.kernel.org Subject: [RESEND PATCH 02/13] drm/msm/dpu: Fix mmu init/destroy functions Date: Mon, 17 Jun 2019 16:03:46 -0400 Message-Id: <20190617200405.131843-2-sean@poorly.run> X-Mailer: git-send-email 2.22.0.410.gd8fdbe21b5-goog In-Reply-To: <20190617200405.131843-1-sean@poorly.run> References: <20190617200405.131843-1-sean@poorly.run> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Sean Paul There's a comment in _dpu_kms_hw_destroy() that reads "safe to call these more than once during shutdown", referring to _dpu_kms_mmu_destroy(). Unfortunately that's not the case, mmu_destroy will fail hard if it's called twice. So fix that function to ensure it can be called multiple times without burning. While I'm at it, fix the error paths in _dpu_kms_mmu_init() to properly clean up the iommu domain and not call _dpu_kms_mmu_destroy() when things are only partially setup. Signed-off-by: Sean Paul --- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c index 885bf88afa3e..d50afbb37a0a 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -729,12 +729,16 @@ static int _dpu_kms_mmu_destroy(struct dpu_kms *dpu_kms) { struct msm_mmu *mmu; + if (!dpu_kms->base.aspace) + return 0; + mmu = dpu_kms->base.aspace->mmu; mmu->funcs->detach(mmu, (const char **)iommu_ports, ARRAY_SIZE(iommu_ports)); msm_gem_address_space_put(dpu_kms->base.aspace); + dpu_kms->base.aspace = NULL; return 0; } @@ -754,25 +758,20 @@ static int _dpu_kms_mmu_init(struct dpu_kms *dpu_kms) aspace = msm_gem_address_space_create(dpu_kms->dev->dev, domain, "dpu1"); if (IS_ERR(aspace)) { - ret = PTR_ERR(aspace); - goto fail; + iommu_domain_free(domain); + return PTR_ERR(aspace); } - dpu_kms->base.aspace = aspace; - ret = aspace->mmu->funcs->attach(aspace->mmu, iommu_ports, ARRAY_SIZE(iommu_ports)); if (ret) { DPU_ERROR("failed to attach iommu %d\n", ret); msm_gem_address_space_put(aspace); - goto fail; + return ret; } + dpu_kms->base.aspace = aspace; return 0; -fail: - _dpu_kms_mmu_destroy(dpu_kms); - - return ret; } static struct dss_clk *_dpu_kms_get_clk(struct dpu_kms *dpu_kms, From patchwork Mon Jun 17 20:09:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 11000375 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2ED451398 for ; Mon, 17 Jun 2019 20:09:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1D18F26E54 for ; Mon, 17 Jun 2019 20:09:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0E7292886F; Mon, 17 Jun 2019 20:09:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ABACC26E54 for ; Mon, 17 Jun 2019 20:09:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727875AbfFQUJi (ORCPT ); Mon, 17 Jun 2019 16:09:38 -0400 Received: from mail-qk1-f194.google.com ([209.85.222.194]:46580 "EHLO mail-qk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726023AbfFQUJi (ORCPT ); Mon, 17 Jun 2019 16:09:38 -0400 Received: by mail-qk1-f194.google.com with SMTP id x18so7011499qkn.13 for ; Mon, 17 Jun 2019 13:09:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poorly.run; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rnuYMa6vIBfYmE14DNuXdWYP2V9cYpPN1XP5Rkgp6fA=; b=IpQnUzLOlbu+Z8jGufVfx562/7WbHg41yXFqDIQIi/BDind+eo4DiBrXchQ5WX0KqX HEyXsjSljsaXbvdxgD4jW9j8AigGx1JbUhrbQUsTZkB+qPxKxCw8ryGoMYEjnkqcLq97 Yy53/Ir6PneTDgVfMIHrUb7XbYotmhcfaxyxeYef2LS3RXeaM2fmVjMvAl838spPVeAJ Eaj5KkvdmS5lsvBNwM5JYTVgP9eXdfmVI3+cgtAhMVj9+j0dskQCbI4r70QX3UwtO+Mf LuQqvX0Rm4FcOt0rALKeSDiy1SwjGsiBXzPSxbBlarDBruZG1U/VAwHYDmtBDMGwzxBR nFLQ== 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=rnuYMa6vIBfYmE14DNuXdWYP2V9cYpPN1XP5Rkgp6fA=; b=U/VUJK8ZMWgaJ8V5Ok16KcN9R5awe9dwUJeYLH6iz9qDYm8/a8fC4ZFqdHLxfL0RW7 6/dhhhvVn6tr8gnA050IcWQD0ZWxAiBwtsjIeZXcd9qQRtLcVOelSNlWirD2XbGNvbai 0YAp9T1uxIcqbkEAZyAugH57LjgcbmNukVSgbGPuarhO85baxAUEWeeKtMDv5xhFSbfq KO5u1RSHx5okUW76uZ6Yzgq+0PTQvgQCv0JzlNK48l0tYYzTMQDjRpNPk5HyS53BY3Ui 6Gm93EsiPLvzlSYN0f/EFDnFA04cLe2ZHENKV/R56JdqEwsJRRbY8i8xJonNkcD9fz9B mwkg== X-Gm-Message-State: APjAAAXCB7Qf/mFkf5Bmxk15KE1pG+0wKsMtT1H7LV9p6SbFHBLCp1DA MKZDkaCyVoUjtUzQahSFHULDNA== X-Google-Smtp-Source: APXvYqzsEntNgVAPgcjag9ZN8RYTpVZ7OhVksMaCG0wgtxyD8CuLCaHM1I/CD5xcFOVbil7MXHowtw== X-Received: by 2002:a37:4d82:: with SMTP id a124mr19092881qkb.72.1560802177050; Mon, 17 Jun 2019 13:09:37 -0700 (PDT) Received: from rosewood.cam.corp.google.com ([100.100.175.19]) by smtp.gmail.com with ESMTPSA id n5sm7962291qta.29.2019.06.17.13.09.36 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 17 Jun 2019 13:09:36 -0700 (PDT) From: Sean Paul To: dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Cc: Sean Paul , Rob Clark , Sean Paul , David Airlie , Daniel Vetter , linux-arm-msm@vger.kernel.org Subject: [PATCH 03/13] drm/msm/phy/dsi_phy: Set pll to NULL in case initialization fails Date: Mon, 17 Jun 2019 16:09:17 -0400 Message-Id: <20190617200920.133104-1-sean@poorly.run> X-Mailer: git-send-email 2.22.0.410.gd8fdbe21b5-goog In-Reply-To: <20190617200405.131843-1-sean@poorly.run> References: <20190617200405.131843-1-sean@poorly.run> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Sean Paul We have if (!phy->pll) checks scattered through the driver and if phy->pll is an error pointer, those checks will pass and bad things will happen :( Signed-off-by: Sean Paul --- drivers/gpu/drm/msm/dsi/phy/dsi_phy.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c index 1760483b247e..6491b0ceab23 100644 --- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c +++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c @@ -616,10 +616,12 @@ static int dsi_phy_driver_probe(struct platform_device *pdev) goto fail; phy->pll = msm_dsi_pll_init(pdev, phy->cfg->type, phy->id); - if (IS_ERR_OR_NULL(phy->pll)) + if (IS_ERR_OR_NULL(phy->pll)) { DRM_DEV_INFO(dev, "%s: pll init failed: %ld, need separate pll clk driver\n", __func__, PTR_ERR(phy->pll)); + phy->pll = NULL; + } dsi_phy_disable_resource(phy); From patchwork Mon Jun 17 20:12:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 11000385 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7CECB14B6 for ; Mon, 17 Jun 2019 20:13:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6EF16289CF for ; Mon, 17 Jun 2019 20:13:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6388028A04; Mon, 17 Jun 2019 20:13:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B818E289CF for ; Mon, 17 Jun 2019 20:13:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726642AbfFQUNU (ORCPT ); Mon, 17 Jun 2019 16:13:20 -0400 Received: from mail-qt1-f196.google.com ([209.85.160.196]:38470 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726048AbfFQUNU (ORCPT ); Mon, 17 Jun 2019 16:13:20 -0400 Received: by mail-qt1-f196.google.com with SMTP id n11so12400533qtl.5 for ; Mon, 17 Jun 2019 13:13:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poorly.run; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=oZYBTzCjKl2+1Vgv9NNnipN1E2J5Z7VwpWjiIbQjaNw=; b=GWOBQ419n5oF+8HQsviBMRPtRatpWMfyes95hd9YGvJdinh/P+2Tx/qitZdSyKi9FR eRnhgBUJJ38ZcpGaZnrAX8w+tZQqICIT1txV7cDsnB/KVEQr79kY17KQr8vzijzj1UTt Gc6bvxWExOhAsh8x/y7s2U4fWS7gwWwGj5iNTmP8HQ9EGb35vd+SXD39GoXki/54Ktk9 Vvr4LUsL5OuVVy/m4MdtVnuG63Sr6g4hrEPqUtKM61+KfViYf0vblSExVsUFEqCxJvY9 76dDFoG3j0v37Bq59696fjsuZ3TTKTPMTT6Tnc7t8RXvxSCFg72tIMiglK718Q+muePY Am8w== 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=oZYBTzCjKl2+1Vgv9NNnipN1E2J5Z7VwpWjiIbQjaNw=; b=CM0zMLokxT7a0Oi8fWNIfKQSPfxEzpdT9I2E4VZZycOtx3JXMJsHsd9OqZdggLZt5h cpEvAVTNPO2NNxBeEBdc+k/WCOvgm/cEZZhxMCO9gi0eIXhEXAlf37TDq0QedqSoJ9ID 08xaow942jKvG/MY95G79mR1Glob3aBL+w7VP0+TJxi2F4MTNrVEh6yCx1V7iZ+qY/4n J31IB+mwCfCfsR5UV0fSfwrFNC22Ztdl1CyaG3Pp/EtEpyTheZZqFkXo62vrTerBxRkB byKldsoDPPRcplOGr+Rxky6zEyMBoiah+26lystaL6VdqsCQnSPkDysJXtsG5qtRUBCK 5EZg== X-Gm-Message-State: APjAAAUsuusKVJf1qGWWi+rIf7W7S4VnMDY8v7AacdXfmt+vdQtprus9 dzL1RVqLXYJqH/fdo81K0jUCtOEDmVY= X-Google-Smtp-Source: APXvYqwr1QbLxwuGqTLwnzoQMv5ob2tdJ8f6VUT6NfVZIIQQojxgAuLnnyVAWJhOKSWNGNY7YKALKg== X-Received: by 2002:ac8:5297:: with SMTP id s23mr59148485qtn.230.1560802398810; Mon, 17 Jun 2019 13:13:18 -0700 (PDT) Received: from rosewood.cam.corp.google.com ([100.100.175.19]) by smtp.gmail.com with ESMTPSA id r36sm7071563qte.71.2019.06.17.13.13.17 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 17 Jun 2019 13:13:17 -0700 (PDT) From: Sean Paul To: dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Cc: Sean Paul , Rob Clark , Sean Paul , David Airlie , Daniel Vetter , linux-arm-msm@vger.kernel.org Subject: [PATCH 04/13] drm/msm/dsi_pll_10nm: Release clk hw on destroy and failure Date: Mon, 17 Jun 2019 16:12:49 -0400 Message-Id: <20190617201301.133275-1-sean@poorly.run> X-Mailer: git-send-email 2.22.0.410.gd8fdbe21b5-goog In-Reply-To: <20190617200405.131843-1-sean@poorly.run> References: <20190617200405.131843-1-sean@poorly.run> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Sean Paul The 10nm pll driver didn't have any failure-path cleanup in register, and the destroy function didn't unregister any of the hardware. This patch adds both. The reason things haven't been blowing up horribly is that msm_drv has a reference count issue that keeps devices alive, so the destroy function was never called. That will be fixed in a follow-up patch. Signed-off-by: Sean Paul --- drivers/gpu/drm/msm/dsi/pll/dsi_pll_10nm.c | 103 +++++++++++++++------ 1 file changed, 73 insertions(+), 30 deletions(-) diff --git a/drivers/gpu/drm/msm/dsi/pll/dsi_pll_10nm.c b/drivers/gpu/drm/msm/dsi/pll/dsi_pll_10nm.c index aabab6311043..618b49838293 100644 --- a/drivers/gpu/drm/msm/dsi/pll/dsi_pll_10nm.c +++ b/drivers/gpu/drm/msm/dsi/pll/dsi_pll_10nm.c @@ -104,8 +104,13 @@ struct dsi_pll_10nm { struct dsi_pll_regs reg_setup; /* private clocks: */ - struct clk_hw *hws[NUM_DSI_CLOCKS_MAX]; - u32 num_hws; + struct clk_hw *out_div_clk_hw; + struct clk_hw *bit_clk_hw; + struct clk_hw *byte_clk_hw; + struct clk_hw *by_2_bit_clk_hw; + struct clk_hw *post_out_div_clk_hw; + struct clk_hw *pclk_mux_hw; + struct clk_hw *out_dsiclk_hw; /* clock-provider: */ struct clk_hw_onecell_data *hw_data; @@ -617,8 +622,19 @@ static int dsi_pll_10nm_get_provider(struct msm_dsi_pll *pll, static void dsi_pll_10nm_destroy(struct msm_dsi_pll *pll) { struct dsi_pll_10nm *pll_10nm = to_pll_10nm(pll); + struct device *dev = &pll_10nm->pdev->dev; DBG("DSI PLL%d", pll_10nm->id); + of_clk_del_provider(dev->of_node); + + clk_hw_unregister_divider(pll_10nm->out_dsiclk_hw); + clk_hw_unregister_mux(pll_10nm->pclk_mux_hw); + clk_hw_unregister_fixed_factor(pll_10nm->post_out_div_clk_hw); + clk_hw_unregister_fixed_factor(pll_10nm->by_2_bit_clk_hw); + clk_hw_unregister_fixed_factor(pll_10nm->byte_clk_hw); + clk_hw_unregister_divider(pll_10nm->bit_clk_hw); + clk_hw_unregister_divider(pll_10nm->out_div_clk_hw); + clk_hw_unregister(&pll_10nm->base.clk_hw); } /* @@ -639,10 +655,8 @@ static int pll_10nm_register(struct dsi_pll_10nm *pll_10nm) .ops = &clk_ops_dsi_pll_10nm_vco, }; struct device *dev = &pll_10nm->pdev->dev; - struct clk_hw **hws = pll_10nm->hws; struct clk_hw_onecell_data *hw_data; struct clk_hw *hw; - int num = 0; int ret; DBG("DSI%d", pll_10nm->id); @@ -660,8 +674,6 @@ static int pll_10nm_register(struct dsi_pll_10nm *pll_10nm) if (ret) return ret; - hws[num++] = &pll_10nm->base.clk_hw; - snprintf(clk_name, 32, "dsi%d_pll_out_div_clk", pll_10nm->id); snprintf(parent, 32, "dsi%dvco_clk", pll_10nm->id); @@ -670,10 +682,12 @@ static int pll_10nm_register(struct dsi_pll_10nm *pll_10nm) pll_10nm->mmio + REG_DSI_10nm_PHY_PLL_PLL_OUTDIV_RATE, 0, 2, CLK_DIVIDER_POWER_OF_TWO, NULL); - if (IS_ERR(hw)) - return PTR_ERR(hw); + if (IS_ERR(hw)) { + ret = PTR_ERR(hw); + goto err_base_clk_hw; + } - hws[num++] = hw; + pll_10nm->out_div_clk_hw = hw; snprintf(clk_name, 32, "dsi%d_pll_bit_clk", pll_10nm->id); snprintf(parent, 32, "dsi%d_pll_out_div_clk", pll_10nm->id); @@ -685,10 +699,12 @@ static int pll_10nm_register(struct dsi_pll_10nm *pll_10nm) REG_DSI_10nm_PHY_CMN_CLK_CFG0, 0, 4, CLK_DIVIDER_ONE_BASED, &pll_10nm->postdiv_lock); - if (IS_ERR(hw)) - return PTR_ERR(hw); + if (IS_ERR(hw)) { + ret = PTR_ERR(hw); + goto err_out_div_clk_hw; + } - hws[num++] = hw; + pll_10nm->bit_clk_hw = hw; snprintf(clk_name, 32, "dsi%d_phy_pll_out_byteclk", pll_10nm->id); snprintf(parent, 32, "dsi%d_pll_bit_clk", pll_10nm->id); @@ -696,10 +712,12 @@ static int pll_10nm_register(struct dsi_pll_10nm *pll_10nm) /* DSI Byte clock = VCO_CLK / OUT_DIV / BIT_DIV / 8 */ hw = clk_hw_register_fixed_factor(dev, clk_name, parent, CLK_SET_RATE_PARENT, 1, 8); - if (IS_ERR(hw)) - return PTR_ERR(hw); + if (IS_ERR(hw)) { + ret = PTR_ERR(hw); + goto err_bit_clk_hw; + } - hws[num++] = hw; + pll_10nm->byte_clk_hw = hw; hw_data->hws[DSI_BYTE_PLL_CLK] = hw; snprintf(clk_name, 32, "dsi%d_pll_by_2_bit_clk", pll_10nm->id); @@ -707,20 +725,24 @@ static int pll_10nm_register(struct dsi_pll_10nm *pll_10nm) hw = clk_hw_register_fixed_factor(dev, clk_name, parent, 0, 1, 2); - if (IS_ERR(hw)) - return PTR_ERR(hw); + if (IS_ERR(hw)) { + ret = PTR_ERR(hw); + goto err_byte_clk_hw; + } - hws[num++] = hw; + pll_10nm->by_2_bit_clk_hw = hw; snprintf(clk_name, 32, "dsi%d_pll_post_out_div_clk", pll_10nm->id); snprintf(parent, 32, "dsi%d_pll_out_div_clk", pll_10nm->id); hw = clk_hw_register_fixed_factor(dev, clk_name, parent, 0, 1, 4); - if (IS_ERR(hw)) - return PTR_ERR(hw); + if (IS_ERR(hw)) { + ret = PTR_ERR(hw); + goto err_by_2_bit_clk_hw; + } - hws[num++] = hw; + pll_10nm->post_out_div_clk_hw = hw; snprintf(clk_name, 32, "dsi%d_pclk_mux", pll_10nm->id); snprintf(parent, 32, "dsi%d_pll_bit_clk", pll_10nm->id); @@ -734,10 +756,12 @@ static int pll_10nm_register(struct dsi_pll_10nm *pll_10nm) }, 4, 0, pll_10nm->phy_cmn_mmio + REG_DSI_10nm_PHY_CMN_CLK_CFG1, 0, 2, 0, NULL); - if (IS_ERR(hw)) - return PTR_ERR(hw); + if (IS_ERR(hw)) { + ret = PTR_ERR(hw); + goto err_post_out_div_clk_hw; + } - hws[num++] = hw; + pll_10nm->pclk_mux_hw = hw; snprintf(clk_name, 32, "dsi%d_phy_pll_out_dsiclk", pll_10nm->id); snprintf(parent, 32, "dsi%d_pclk_mux", pll_10nm->id); @@ -748,14 +772,14 @@ static int pll_10nm_register(struct dsi_pll_10nm *pll_10nm) REG_DSI_10nm_PHY_CMN_CLK_CFG0, 4, 4, CLK_DIVIDER_ONE_BASED, &pll_10nm->postdiv_lock); - if (IS_ERR(hw)) - return PTR_ERR(hw); + if (IS_ERR(hw)) { + ret = PTR_ERR(hw); + goto err_pclk_mux_hw; + } - hws[num++] = hw; + pll_10nm->out_dsiclk_hw = hw; hw_data->hws[DSI_PIXEL_PLL_CLK] = hw; - pll_10nm->num_hws = num; - hw_data->num = NUM_PROVIDED_CLKS; pll_10nm->hw_data = hw_data; @@ -763,10 +787,29 @@ static int pll_10nm_register(struct dsi_pll_10nm *pll_10nm) pll_10nm->hw_data); if (ret) { DRM_DEV_ERROR(dev, "failed to register clk provider: %d\n", ret); - return ret; + goto err_dsiclk_hw; } return 0; + +err_dsiclk_hw: + clk_hw_unregister_divider(pll_10nm->out_dsiclk_hw); +err_pclk_mux_hw: + clk_hw_unregister_mux(pll_10nm->pclk_mux_hw); +err_post_out_div_clk_hw: + clk_hw_unregister_fixed_factor(pll_10nm->post_out_div_clk_hw); +err_by_2_bit_clk_hw: + clk_hw_unregister_fixed_factor(pll_10nm->by_2_bit_clk_hw); +err_byte_clk_hw: + clk_hw_unregister_fixed_factor(pll_10nm->byte_clk_hw); +err_bit_clk_hw: + clk_hw_unregister_divider(pll_10nm->bit_clk_hw); +err_out_div_clk_hw: + clk_hw_unregister_divider(pll_10nm->out_div_clk_hw); +err_base_clk_hw: + clk_hw_unregister(&pll_10nm->base.clk_hw); + + return ret; } struct msm_dsi_pll *msm_dsi_pll_10nm_init(struct platform_device *pdev, int id) From patchwork Mon Jun 17 20:12:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 11000389 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7542A1398 for ; Mon, 17 Jun 2019 20:13:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 68F00288BB for ; Mon, 17 Jun 2019 20:13:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5CE02289D2; Mon, 17 Jun 2019 20:13:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0BEA7288BB for ; Mon, 17 Jun 2019 20:13:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726872AbfFQUNX (ORCPT ); Mon, 17 Jun 2019 16:13:23 -0400 Received: from mail-qt1-f196.google.com ([209.85.160.196]:32776 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726048AbfFQUNX (ORCPT ); Mon, 17 Jun 2019 16:13:23 -0400 Received: by mail-qt1-f196.google.com with SMTP id x2so12444456qtr.0 for ; Mon, 17 Jun 2019 13:13:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poorly.run; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=04YV4222yTbQVoaNkjtoFrmBfJ73jHzJG/awNg4EaWI=; b=DXsH9rEQvO/T3DNNhX4I4Wrag8DtZOeR9pSCQJAE8tKznywa6tSYOjTPPh/4eOvwXh eDG92ifV/tMg6EKFPvyb5fVYFzhjrhsqpprXjmjnHKA0D7qkqRhYt/R978yc8XXe31n3 kBxzTa4a9Q8O6XXRxKEw0HA3GIRL7nbGI5Pqh843Z/003qKq04ga+n6a8AARLQd6vtar nnU0or1+YVP6FgVocha9d6BYSYwJaA1sqbTp33KEhNezefxaG5zhIQAvmquL/df7/XPJ TNRos8HV7GhFCL1sI6WZMaWGmRo+q5ODdQSk2rkVZpd58wIol5qmkf8V6vQ+Euquf7Ib J28w== 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=04YV4222yTbQVoaNkjtoFrmBfJ73jHzJG/awNg4EaWI=; b=ZK8Oo2Zf8IoWPIVxuAGuvnbxnWbigf5rVAVN8WnnUo9SLk4RBN2v6rEyAlevL1G/ze nb+kndxJCQX5/A5P71kzCg1CNUCrS36fThdvlUeR6L3mQ5A6rDu5oloeRrOx0J7DDnWN g+M5qm9ACEpWJSWI+68P5XSRR07POS4pVn61FyrDZbswmMF8WK8mKVTJfP7mCy3bi5T/ Sum/5Cu2BJNCgKHBH385ttGj3QL+ztb0K22P8yv9SJxABxzikYxhVj8sXjPh5F+lzNs/ Ebg1qAEwanB+KuOGRGGdq/EnsInGbHOy92J+dV/X9kIyicQW99e0K3GvKMjbWy/Jlc48 +uOg== X-Gm-Message-State: APjAAAW4cm/iNX9Npv3YCQdrBkkv5mKRH7Yjv73GcwO/hT8uZRHRj+Yt F2rqyzD9Ug9aurRg6t8/8lCRvQ== X-Google-Smtp-Source: APXvYqzjE27Gg02/YlB9NekL0Cxe6H7ZZEq8eqq8VORWjDi9njYAJ+CGvuJso74VxB3+WTAYE1fXVQ== X-Received: by 2002:aed:3ed5:: with SMTP id o21mr94179519qtf.369.1560802402527; Mon, 17 Jun 2019 13:13:22 -0700 (PDT) Received: from rosewood.cam.corp.google.com ([100.100.175.19]) by smtp.gmail.com with ESMTPSA id r36sm7071563qte.71.2019.06.17.13.13.21 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 17 Jun 2019 13:13:22 -0700 (PDT) From: Sean Paul To: dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Cc: Sean Paul , Rob Clark , Sean Paul , David Airlie , Daniel Vetter , linux-arm-msm@vger.kernel.org Subject: [PATCH 05/13] drm/msm/dsi_pll_10nm: Remove impossible check Date: Mon, 17 Jun 2019 16:12:50 -0400 Message-Id: <20190617201301.133275-2-sean@poorly.run> X-Mailer: git-send-email 2.22.0.410.gd8fdbe21b5-goog In-Reply-To: <20190617201301.133275-1-sean@poorly.run> References: <20190617200405.131843-1-sean@poorly.run> <20190617201301.133275-1-sean@poorly.run> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Sean Paul While I'm in here, cut this out, pdev can't be NULL Signed-off-by: Sean Paul --- drivers/gpu/drm/msm/dsi/pll/dsi_pll_10nm.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/gpu/drm/msm/dsi/pll/dsi_pll_10nm.c b/drivers/gpu/drm/msm/dsi/pll/dsi_pll_10nm.c index 618b49838293..8f6100db90ed 100644 --- a/drivers/gpu/drm/msm/dsi/pll/dsi_pll_10nm.c +++ b/drivers/gpu/drm/msm/dsi/pll/dsi_pll_10nm.c @@ -818,9 +818,6 @@ struct msm_dsi_pll *msm_dsi_pll_10nm_init(struct platform_device *pdev, int id) struct msm_dsi_pll *pll; int ret; - if (!pdev) - return ERR_PTR(-ENODEV); - pll_10nm = devm_kzalloc(&pdev->dev, sizeof(*pll_10nm), GFP_KERNEL); if (!pll_10nm) return ERR_PTR(-ENOMEM); From patchwork Mon Jun 17 20:12:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 11000393 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8A16B1398 for ; Mon, 17 Jun 2019 20:13:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7D193289CF for ; Mon, 17 Jun 2019 20:13:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7195F289F7; Mon, 17 Jun 2019 20:13:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 19951289CF for ; Mon, 17 Jun 2019 20:13:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726378AbfFQUN1 (ORCPT ); Mon, 17 Jun 2019 16:13:27 -0400 Received: from mail-qk1-f195.google.com ([209.85.222.195]:40483 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726048AbfFQUN1 (ORCPT ); Mon, 17 Jun 2019 16:13:27 -0400 Received: by mail-qk1-f195.google.com with SMTP id c70so7033232qkg.7 for ; Mon, 17 Jun 2019 13:13:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poorly.run; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=D9vtTE1uu7WSSe5bzXxeqh5Pv0FUN5RIu6vYbEXrF8A=; b=fpd+XlVHxuYShYaEvyip30CxvwKcR0saECXTR4hqh332wfxPDlqHVxiftFD6mMr/+b QnrtlgIxMp9OgSi2jCgHZpN2axclpw+fdiqs2nqOjT2k/PSyb7PWQQ10X+19NKoJgcGA 22XOkETtu7qGUZ0fPveEILO+TxrB6X26yjwYxHpkfAKBYC32FGuuoGCCPW06klLd6tiK UT6kFoymg9yakYGmDy4RE0djd0ePY/bYBi0PM5wvHAKDcQlkRkvI3KyDyL/YtnNLrHWX 1z/tup9VjhNqHhDtRACg8LqF4IiQy1sUR3EVIIMxDFE3ZNCY88qeMHjSbKX2puf18ctg bTXQ== 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=D9vtTE1uu7WSSe5bzXxeqh5Pv0FUN5RIu6vYbEXrF8A=; b=CZ+dWxNIvqp+xbmKbJRZvUOuO34ykoaOE0Y2tFjFD4+iIztV3imWmthyoz/itCc1XU iIMUFme2oNCobpStoxx264F7HgGPNr5AqlA/90A6toAN2dNpzg+uNsRsOXTKYTwWfOao hBr76Dw6nKYFGf9wVTSMrhnl5xxqgWnsk0Km+FetPOJY9T0VNwghIMD1wmPAKApi3u0P 5evMrsnpl6OknHOWIqs+Dz0pzHhnXeC6BaajxBLDToWHwl/RGCZKjsRTS0iB5qw6CwWf 59ejXbH9JiwILm3qnZWuZ2jMUOvWIst4G4+rFL+s0UKF+l3VmIRQQx+TUEmYB9UUXYFb zciw== X-Gm-Message-State: APjAAAXPTflK0CVw+YqQbn7MFpsdqCL7P8cJhqngPD0hBfpexSsravBI M9iM/nFbCQZNYagKa5qyYPrJVw== X-Google-Smtp-Source: APXvYqwRttgaGQFTtNVWoB5PmdoUs3ejqU2sykdk+7qCjJiTQMBg5n+8PdNRbeKOTmjf13lBs2t1qQ== X-Received: by 2002:a37:e409:: with SMTP id y9mr3320964qkf.109.1560802406629; Mon, 17 Jun 2019 13:13:26 -0700 (PDT) Received: from rosewood.cam.corp.google.com ([100.100.175.19]) by smtp.gmail.com with ESMTPSA id r36sm7071563qte.71.2019.06.17.13.13.25 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 17 Jun 2019 13:13:26 -0700 (PDT) From: Sean Paul To: dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Cc: Sean Paul , Rob Clark , Sean Paul , David Airlie , Daniel Vetter , linux-arm-msm@vger.kernel.org Subject: [PATCH 06/13] drm/msm: Depopulate platform on probe failure Date: Mon, 17 Jun 2019 16:12:51 -0400 Message-Id: <20190617201301.133275-3-sean@poorly.run> X-Mailer: git-send-email 2.22.0.410.gd8fdbe21b5-goog In-Reply-To: <20190617201301.133275-1-sean@poorly.run> References: <20190617200405.131843-1-sean@poorly.run> <20190617201301.133275-1-sean@poorly.run> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Sean Paul add_display_components() calls of_platform_populate, and we depopluate on pdev remove, but not when probe fails. So if we get a probe deferral in one of the components, we won't depopulate the platform. This causes the core to keep references to devices which should be destroyed, which causes issues when those same devices try to re-initialize on the next probe attempt. I think this is the reason we had issues with the gmu's device-managed resources on deferral (worked around in commit 94e3a17f33a5). Signed-off-by: Sean Paul --- drivers/gpu/drm/msm/msm_drv.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 31deb87abfc6..bf99ee138601 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -1317,16 +1317,24 @@ static int msm_pdev_probe(struct platform_device *pdev) ret = add_gpu_components(&pdev->dev, &match); if (ret) - return ret; + goto fail; /* on all devices that I am aware of, iommu's which can map * any address the cpu can see are used: */ ret = dma_set_mask_and_coherent(&pdev->dev, ~0); if (ret) - return ret; + goto fail; + + ret = component_master_add_with_match(&pdev->dev, &msm_drm_ops, match); + if (ret) + goto fail; - return component_master_add_with_match(&pdev->dev, &msm_drm_ops, match); + return 0; + +fail: + of_platform_depopulate(&pdev->dev); + return ret; } static int msm_pdev_remove(struct platform_device *pdev) From patchwork Mon Jun 17 20:12:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 11000397 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4FDBC14B6 for ; Mon, 17 Jun 2019 20:13:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 43229289F7 for ; Mon, 17 Jun 2019 20:13:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 372A8289FB; Mon, 17 Jun 2019 20:13:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C2FC7289F7 for ; Mon, 17 Jun 2019 20:13:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726683AbfFQUNb (ORCPT ); Mon, 17 Jun 2019 16:13:31 -0400 Received: from mail-qt1-f194.google.com ([209.85.160.194]:39802 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726048AbfFQUNb (ORCPT ); Mon, 17 Jun 2019 16:13:31 -0400 Received: by mail-qt1-f194.google.com with SMTP id i34so7118468qta.6 for ; Mon, 17 Jun 2019 13:13:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poorly.run; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=uNOx45kFSG/Yc9D3NQVx4HiI/G/jW8KW7kdSijKdY50=; b=Zqvo1ZzApoS+VMx0AyAw9fTnBJqSz0oHFbN/BkF1zoCdv1DXE6wUEOwlxf3v8nDcbb M8S7690MJAMScFNAmmhHtmbNb46FoAjzXcEbS6mWHkDn+r6J823VwBtlx4wlIJ/QJ4fU lOmXK/9A+Q/p6oTWB9amjHhoRgrqHJJxEgOlRqdODAvJhKU5VrhChs49kNq+ifY7uI68 5fEyhER4UbzlsEXgilPeSpHRA/RiDV3d9DcA6vwy/y2M0tOyRPXHoeReQZhvdNui+MW3 6OcP8a3livBABvBqN/dfMX7cNGJ7QBcMoy3nImcc4F96nkYE1+3J+1rkIGHhvNvb1QV0 20+Q== 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=uNOx45kFSG/Yc9D3NQVx4HiI/G/jW8KW7kdSijKdY50=; b=tQA0qh+Rbh2DvYxRQPIyLeMLwfeAfmS678/gXsFC5HsXuTwX6IGeF4VKIa/UqN6wKn I1VWFyw17gsplsrXU0PzrPuXc4LIJ/KjXAWmI2cpeY41a0cqwfkh9NYay6eDkWODWRM6 3G/fnTx2fXutH1sB25+5VIAKuGWDliNoAOzBSTuVFENPwXmIoiThrHKqYFkO1MsuGzCf 5pcsl771ja9XCcquPdGD1HrykcmZUHiyOssnCau5tFVZdWNLUfy0x9nHAES4AXnNpA65 PZ2wVhmaXWKmIyiq000/c2IQLLVfMXzc+x6YQnfeK8rs0A8dwXLLM0e5JQKLzEzrzxM/ l0xQ== X-Gm-Message-State: APjAAAUDSO7sPxvwljCA3P8hsw1zzVjpVVg6Jtagq8X/xd8LrsFYkHQE Gq4NhfReSZL53vb8XM1DfWlxcfwE1mQ= X-Google-Smtp-Source: APXvYqwEpErj+2U/OoJfqGOB2tT/tidvt52SvFAphs/SqZTqCnQIzDPyLz6+/84OKTLRvERkXF3Agw== X-Received: by 2002:aed:3e3d:: with SMTP id l58mr46894640qtf.382.1560802410359; Mon, 17 Jun 2019 13:13:30 -0700 (PDT) Received: from rosewood.cam.corp.google.com ([100.100.175.19]) by smtp.gmail.com with ESMTPSA id r36sm7071563qte.71.2019.06.17.13.13.29 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 17 Jun 2019 13:13:29 -0700 (PDT) From: Sean Paul To: dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Cc: Sean Paul , Rob Clark , Sean Paul , David Airlie , Daniel Vetter , linux-arm-msm@vger.kernel.org Subject: [PATCH 07/13] drm/msm/dsi: Split mode_flags out of msm_dsi_host_get_panel() Date: Mon, 17 Jun 2019 16:12:52 -0400 Message-Id: <20190617201301.133275-4-sean@poorly.run> X-Mailer: git-send-email 2.22.0.410.gd8fdbe21b5-goog In-Reply-To: <20190617201301.133275-1-sean@poorly.run> References: <20190617200405.131843-1-sean@poorly.run> <20190617201301.133275-1-sean@poorly.run> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Sean Paul We use the flags in more places than just get_panel, so split them out into a separate function. Signed-off-by: Sean Paul --- drivers/gpu/drm/msm/dsi/dsi.h | 4 ++-- drivers/gpu/drm/msm/dsi/dsi_host.c | 15 ++++++--------- drivers/gpu/drm/msm/dsi/dsi_manager.c | 7 ++++--- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/msm/dsi/dsi.h b/drivers/gpu/drm/msm/dsi/dsi.h index 9c6b31c2d79f..8bdc48ca0b67 100644 --- a/drivers/gpu/drm/msm/dsi/dsi.h +++ b/drivers/gpu/drm/msm/dsi/dsi.h @@ -169,8 +169,8 @@ int msm_dsi_host_power_on(struct mipi_dsi_host *host, int msm_dsi_host_power_off(struct mipi_dsi_host *host); int msm_dsi_host_set_display_mode(struct mipi_dsi_host *host, const struct drm_display_mode *mode); -struct drm_panel *msm_dsi_host_get_panel(struct mipi_dsi_host *host, - unsigned long *panel_flags); +struct drm_panel *msm_dsi_host_get_panel(struct mipi_dsi_host *host); +unsigned long msm_dsi_host_get_mode_flags(struct mipi_dsi_host *host); struct drm_bridge *msm_dsi_host_get_bridge(struct mipi_dsi_host *host); int msm_dsi_host_register(struct mipi_dsi_host *host, bool check_defer); void msm_dsi_host_unregister(struct mipi_dsi_host *host); diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c index 610183db1daf..daa08a033b59 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_host.c +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c @@ -2442,17 +2442,14 @@ int msm_dsi_host_set_display_mode(struct mipi_dsi_host *host, return 0; } -struct drm_panel *msm_dsi_host_get_panel(struct mipi_dsi_host *host, - unsigned long *panel_flags) +struct drm_panel *msm_dsi_host_get_panel(struct mipi_dsi_host *host) { - struct msm_dsi_host *msm_host = to_msm_dsi_host(host); - struct drm_panel *panel; - - panel = of_drm_find_panel(msm_host->device_node); - if (panel_flags) - *panel_flags = msm_host->mode_flags; + return of_drm_find_panel(to_msm_dsi_host(host)->device_node); +} - return panel; +unsigned long msm_dsi_host_get_mode_flags(struct mipi_dsi_host *host) +{ + return to_msm_dsi_host(host)->mode_flags; } struct drm_bridge *msm_dsi_host_get_bridge(struct mipi_dsi_host *host) diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/dsi/dsi_manager.c index 979a8e929341..56b8091b75e7 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_manager.c +++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c @@ -244,8 +244,9 @@ static enum drm_connector_status dsi_mgr_connector_detect( DBG("id=%d", id); if (!msm_dsi->panel) { - msm_dsi->panel = msm_dsi_host_get_panel(msm_dsi->host, - &msm_dsi->device_flags); + msm_dsi->panel = msm_dsi_host_get_panel(msm_dsi->host); + msm_dsi->device_flags = msm_dsi_host_get_mode_flags( + msm_dsi->host); /* There is only 1 panel in the global panel list * for dual DSI mode. Therefore slave dsi should get @@ -255,7 +256,7 @@ static enum drm_connector_status dsi_mgr_connector_detect( if (!msm_dsi->panel && IS_DUAL_DSI() && !IS_MASTER_DSI_LINK(id) && other_dsi) msm_dsi->panel = msm_dsi_host_get_panel( - other_dsi->host, NULL); + other_dsi->host); if (msm_dsi->panel && kms->funcs->set_encoder_mode) { From patchwork Mon Jun 17 20:12:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 11000401 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 38C0814B6 for ; Mon, 17 Jun 2019 20:13:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2AA8E28A07 for ; Mon, 17 Jun 2019 20:13:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1F0FB289FF; Mon, 17 Jun 2019 20:13:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ADCCE28A04 for ; Mon, 17 Jun 2019 20:13:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727027AbfFQUNe (ORCPT ); Mon, 17 Jun 2019 16:13:34 -0400 Received: from mail-qt1-f196.google.com ([209.85.160.196]:42549 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726048AbfFQUNe (ORCPT ); Mon, 17 Jun 2019 16:13:34 -0400 Received: by mail-qt1-f196.google.com with SMTP id s15so12383016qtk.9 for ; Mon, 17 Jun 2019 13:13:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poorly.run; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Jxs1S2d2hEiLW82WrQt+RxzLo4SztRkqjbe0RaFo6/s=; b=O0ax73sp/+EuyzNDsfHkAAsUf01j89TC19eFeVjyMhAJUyZBseS7i+o3vyhXU4+kQb Qfp+/WmglUwkpelFJfRmAmrKs+mLPd0yY2NpFF1175iGrouehTBzW2E0zwTMmR0vdxv5 3vTg6NSaVTshR+GKQNLU3mdAxrED5JF0wTxmWt7EZm7woMaTRlvMuotfkUbDP3h3Yypb hkfr3DYmJ6DKxz22HEGkVaj0eZCKfebHZZY+ftqSS3KKgHKn6HndcpnROlgPdin5BJMf JNeFXLKkZDYcmUTBtlzoODykuOYO/yzwv7HBowQwUnsTqZpMOLazwxmBR+B3dZkqN1oG k03g== 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=Jxs1S2d2hEiLW82WrQt+RxzLo4SztRkqjbe0RaFo6/s=; b=KBFEBSVNLigylZOcoWvTeYnMoIYoGmmko9htfPj5dUuxSrrwxYc9q6kbL1ISbeCGvJ 1i7ZDHm/uycXj9sfAI3gNgaAamkUZHO7hv5OKVT4EAVbVDnpn9OqV1AdWk+pseNRM2zu ZGnfo9xZwhajgxlQPkbryJfGmUUkda8uCnujOxatNvq6WNcaZ/kwN0Fbf1/JjMp89dS7 J94em0wfk/+zN81WRpwuCk7O5EgQoZ47+9H4lLfnsTB6v0xyifkkSQo/gGoz+Tw5SbLg L6Z6rkBRyda2C2GBmFsXijF5BxGXYzQGChuCdewgMrlhoEEBqInGVSl1qWCZBW3cd0Id frJg== X-Gm-Message-State: APjAAAVivW92+eo2BmIZedQBJk1QOTr0RSLrDYt+Qdtau8RZkYiz+PMv uAK5RH4v+gFmmWI1hbVXsqtMWg== X-Google-Smtp-Source: APXvYqxrCCqUNZYscrPplWQuYI6u4SH9DgjdX5HyNqBtvGiURcPXRZ1zswf+fS5gy+aDHRDdNa7TWg== X-Received: by 2002:aed:3ac5:: with SMTP id o63mr24476334qte.309.1560802413064; Mon, 17 Jun 2019 13:13:33 -0700 (PDT) Received: from rosewood.cam.corp.google.com ([100.100.175.19]) by smtp.gmail.com with ESMTPSA id r36sm7071563qte.71.2019.06.17.13.13.32 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 17 Jun 2019 13:13:32 -0700 (PDT) From: Sean Paul To: dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Cc: Sean Paul , Rob Clark , Sean Paul , David Airlie , Daniel Vetter , linux-arm-msm@vger.kernel.org Subject: [PATCH 08/13] drm/msm/dsi: Don't store dsi host mode_flags in msm_dsi Date: Mon, 17 Jun 2019 16:12:53 -0400 Message-Id: <20190617201301.133275-5-sean@poorly.run> X-Mailer: git-send-email 2.22.0.410.gd8fdbe21b5-goog In-Reply-To: <20190617201301.133275-1-sean@poorly.run> References: <20190617200405.131843-1-sean@poorly.run> <20190617201301.133275-1-sean@poorly.run> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Sean Paul It's a bit dangerous to store the flags in msm_dsi since there's no way to tell when they're populated. Fortunately the only place that uses them is the same place that fills them. So just use a local variable and delete the struct member. Signed-off-by: Sean Paul --- drivers/gpu/drm/msm/dsi/dsi.h | 1 - drivers/gpu/drm/msm/dsi/dsi_manager.c | 17 +++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/msm/dsi/dsi.h b/drivers/gpu/drm/msm/dsi/dsi.h index 8bdc48ca0b67..e0bbe8128aef 100644 --- a/drivers/gpu/drm/msm/dsi/dsi.h +++ b/drivers/gpu/drm/msm/dsi/dsi.h @@ -79,7 +79,6 @@ struct msm_dsi { */ struct drm_panel *panel; struct drm_bridge *external_bridge; - unsigned long device_flags; struct device *phy_dev; bool phy_enabled; diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/dsi/dsi_manager.c index 56b8091b75e7..735fff79ae67 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_manager.c +++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c @@ -233,6 +233,12 @@ static int dsi_mgr_bridge_get_id(struct drm_bridge *bridge) return dsi_bridge->id; } +static bool dsi_mgr_is_cmd_mode(struct msm_dsi *msm_dsi) +{ + unsigned long host_flags = msm_dsi_host_get_mode_flags(msm_dsi->host); + return !(host_flags & MIPI_DSI_MODE_VIDEO); +} + static enum drm_connector_status dsi_mgr_connector_detect( struct drm_connector *connector, bool force) { @@ -241,17 +247,15 @@ static enum drm_connector_status dsi_mgr_connector_detect( struct msm_dsi *other_dsi = dsi_mgr_get_other_dsi(id); struct msm_drm_private *priv = connector->dev->dev_private; struct msm_kms *kms = priv->kms; + bool cmd_mode; DBG("id=%d", id); if (!msm_dsi->panel) { msm_dsi->panel = msm_dsi_host_get_panel(msm_dsi->host); - msm_dsi->device_flags = msm_dsi_host_get_mode_flags( - msm_dsi->host); /* There is only 1 panel in the global panel list * for dual DSI mode. Therefore slave dsi should get - * the drm_panel instance from master dsi, and - * keep using the panel flags got from the current DSI link. + * the drm_panel instance from master dsi. */ if (!msm_dsi->panel && IS_DUAL_DSI() && !IS_MASTER_DSI_LINK(id) && other_dsi) @@ -259,9 +263,8 @@ static enum drm_connector_status dsi_mgr_connector_detect( other_dsi->host); + cmd_mode = dsi_mgr_is_cmd_mode(msm_dsi); if (msm_dsi->panel && kms->funcs->set_encoder_mode) { - bool cmd_mode = !(msm_dsi->device_flags & - MIPI_DSI_MODE_VIDEO); struct drm_encoder *encoder = msm_dsi_get_encoder(msm_dsi); @@ -277,8 +280,6 @@ static enum drm_connector_status dsi_mgr_connector_detect( */ if (msm_dsi->panel && IS_DUAL_DSI() && other_dsi && other_dsi->panel) { - bool cmd_mode = !(msm_dsi->device_flags & - MIPI_DSI_MODE_VIDEO); struct drm_encoder *encoder = msm_dsi_get_encoder( dsi_mgr_get_dsi(DSI_ENCODER_MASTER)); struct drm_encoder *slave_enc = msm_dsi_get_encoder( From patchwork Mon Jun 17 20:12:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 11000405 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D63C514DB for ; Mon, 17 Jun 2019 20:13:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C5C96289CF for ; Mon, 17 Jun 2019 20:13:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BA569289FC; Mon, 17 Jun 2019 20:13:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 39865289CF for ; Mon, 17 Jun 2019 20:13:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726685AbfFQUNg (ORCPT ); Mon, 17 Jun 2019 16:13:36 -0400 Received: from mail-qt1-f195.google.com ([209.85.160.195]:35872 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726048AbfFQUNg (ORCPT ); Mon, 17 Jun 2019 16:13:36 -0400 Received: by mail-qt1-f195.google.com with SMTP id p15so12424210qtl.3 for ; Mon, 17 Jun 2019 13:13:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poorly.run; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=eW5UYe8I4qvCNc714+7hSZS3b/NQZnllHNBPJZkv2eY=; b=cTj2H0fFpMLV68ZtM8KoMdCOc4uIpHZdR68OxZTYdpYvkn8ssFMPpu+rO9RxdPNA9a 9Nqzd+cVkEe1tOuxwJTnJ87Gge3kDSG8kYngKvZfUyOY4lKUH2fUeAxjd8IDC/z0/FXa LcWXJaKSkrnASvMWWDkpT4S645E2cRsdNGaxXecflkaUnnqhDZfIK+qIbxx8VSeF4JBR Rix4NO3lIrUV//pL71dWZWyYr3MNzgNyWD2DmUu8Fqn+yT2rwysJoNudAYfUZJlxXK9B 3AtEASA43KTp+jtX1spMSmx+HtzgOy5CKeNMhKH+1BsXHVyMni937yC6aRKMQHQsXYGH RajQ== 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=eW5UYe8I4qvCNc714+7hSZS3b/NQZnllHNBPJZkv2eY=; b=rrNODSFd+7OEJzzHSqJAkyOqhVeBuMEN8lOjj48vr3pCWCorl9FAmWLDFveyIh2Wfn 0BxLQEGZ6PaphTvlsOZWd6zvz+Fiuct5edEm5KHbjMMgh/WKGTLxYt1tH2/1kEIvr1lJ GoJYDgsEtThtzf5XFTY8ypy59+5HtO9pguWGw/3Icza8Tc7HrCYLb+pkXyuoZ1C+jKmW x6couI4Yvs6XVqC5M5GlnXzQs5YA+Z3RU7U/IIdA13X6AZ0Uc33VxFciQYY8dIWX53nB kkOB9nbhbzSbpbZr4+YsZGVZeG4XBzrhiq/5RFo7m4glPvD/NPsh8RvD52fTYhVC4ru1 6VBw== X-Gm-Message-State: APjAAAXnwpUbPuBKoFg4ZCe71pu6VPL3mvtQMYdyN7SbjfJhXqbd/L4K 5AjYed8OsBi7HjEMzrg51ph9ZA== X-Google-Smtp-Source: APXvYqy0nkpRBCX5jT4q6yqC4LA6QLk30UxErp74KBr3V96+SlASaTXo3caNWvDOhCc9VLbG+OJ5zw== X-Received: by 2002:a0c:aed0:: with SMTP id n16mr23668643qvd.101.1560802415854; Mon, 17 Jun 2019 13:13:35 -0700 (PDT) Received: from rosewood.cam.corp.google.com ([100.100.175.19]) by smtp.gmail.com with ESMTPSA id r36sm7071563qte.71.2019.06.17.13.13.35 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 17 Jun 2019 13:13:35 -0700 (PDT) From: Sean Paul To: dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Cc: Sean Paul , Rob Clark , Sean Paul , David Airlie , Daniel Vetter , linux-arm-msm@vger.kernel.org Subject: [PATCH 09/13] drm/msm/dsi: Pull out panel init code into function Date: Mon, 17 Jun 2019 16:12:54 -0400 Message-Id: <20190617201301.133275-6-sean@poorly.run> X-Mailer: git-send-email 2.22.0.410.gd8fdbe21b5-goog In-Reply-To: <20190617201301.133275-1-sean@poorly.run> References: <20190617200405.131843-1-sean@poorly.run> <20190617201301.133275-1-sean@poorly.run> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Sean Paul Pull all of the panel init code out of detect() and put it in its own function. This will be useful in future patches where it's moved from detect(). Signed-off-by: Sean Paul --- drivers/gpu/drm/msm/dsi/dsi_manager.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/dsi/dsi_manager.c index 735fff79ae67..855139195769 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_manager.c +++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c @@ -239,17 +239,14 @@ static bool dsi_mgr_is_cmd_mode(struct msm_dsi *msm_dsi) return !(host_flags & MIPI_DSI_MODE_VIDEO); } -static enum drm_connector_status dsi_mgr_connector_detect( - struct drm_connector *connector, bool force) +static void msm_dsi_manager_panel_init(struct drm_connector *connector, u8 id) { - int id = dsi_mgr_connector_get_id(connector); struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id); struct msm_dsi *other_dsi = dsi_mgr_get_other_dsi(id); struct msm_drm_private *priv = connector->dev->dev_private; struct msm_kms *kms = priv->kms; bool cmd_mode; - DBG("id=%d", id); if (!msm_dsi->panel) { msm_dsi->panel = msm_dsi_host_get_panel(msm_dsi->host); @@ -292,6 +289,17 @@ static enum drm_connector_status dsi_mgr_connector_detect( pr_err("mdp does not support dual DSI\n"); } } +} + +static enum drm_connector_status dsi_mgr_connector_detect( + struct drm_connector *connector, bool force) +{ + int id = dsi_mgr_connector_get_id(connector); + struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id); + + DBG("id=%d", id); + if (!msm_dsi->panel) + msm_dsi_manager_panel_init(connector, id); return msm_dsi->panel ? connector_status_connected : connector_status_disconnected; From patchwork Mon Jun 17 20:12:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 11000407 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 27B1814B6 for ; Mon, 17 Jun 2019 20:13:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1AE0A28981 for ; Mon, 17 Jun 2019 20:13:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0EB30289FF; Mon, 17 Jun 2019 20:13:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 85346289F7 for ; Mon, 17 Jun 2019 20:13:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726834AbfFQUNk (ORCPT ); Mon, 17 Jun 2019 16:13:40 -0400 Received: from mail-qt1-f195.google.com ([209.85.160.195]:42569 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726048AbfFQUNk (ORCPT ); Mon, 17 Jun 2019 16:13:40 -0400 Received: by mail-qt1-f195.google.com with SMTP id s15so12383414qtk.9 for ; Mon, 17 Jun 2019 13:13:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poorly.run; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KEzDz4BPwaXyOzKMYCDNx7vRyXhUAqPWeV1ESTD5Msw=; b=RmwMLFgADM/Y4oOIGfOByWNQ7s+7D6P7ii2gtAZKBobXJy53BAUzHSI5Qw0KDF3zxk X3YGx06UTge38Yuoeb/8kgrBdfwR214UiSxRYcPBJk8FGNNp3C+lPwbmI8eimI3xdpXe UZiZYRsQGHopnaoGSXrMPtnxFbZZtKgITGJg7BzNx5NNcnEIC223j+MafS4tHyzg2DIJ Xkzw4Ty4jFIQXXbM1QyUcGeGOZZngStS6++yDQ/p+jsHeEkUyDr1ExmG2Prbo5+xxfSX wx45F4TqQOlMGOFQu9zquwZ1qGnhbYj7ZR+4zzr0X6kQ9AiQDTuNYnk3Z98bzpgtcTf1 4qBg== 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=KEzDz4BPwaXyOzKMYCDNx7vRyXhUAqPWeV1ESTD5Msw=; b=ABHSSjxa6yzuf6zJQmmmiiIN1F+WjM6yAiAV/sWRFueUQRWJ/I+/1CqezqMQ8xQAKk gyTBz5kK0uTEQKcj5cMCsLZKVO1T7bfg5UQVnaGP6kbLvlGBPurn+dB+Bafm2sk7R8/H +8pP3564lF4ez62Qd/UCP4b5fhn2BXzLzWtl6JmfAu3dToRP6bri6l1d0Teykm6nU60P 2SsTqyLefsZyyJE1Il1C7HAWL8i34862eXR6wKhlQMyEj2Zh0UNP8cbHd0weClZqsfKt 9i7y1o+z4OCpZdTcjxlZwmhHCdpgYJNsHVhBF2AdFy8iqvfQUyZDHvEWsr5ZT6Wvajma Xqiw== X-Gm-Message-State: APjAAAWJRAEZ8PTevN/PDNYkrCfi/atgkS6ZZ1xwLhZmslsd7zdgQ/J/ PWs3Uv2QvL9NBmoiRgsT/6/apQ== X-Google-Smtp-Source: APXvYqyLyxUymcgrRFmmufiz/kOXGnQYyeWV9QnX+UgPcxWMaPbwqGbNet6adg07NnOWiTdeDRSK8Q== X-Received: by 2002:ac8:37b8:: with SMTP id d53mr76369630qtc.227.1560802418627; Mon, 17 Jun 2019 13:13:38 -0700 (PDT) Received: from rosewood.cam.corp.google.com ([100.100.175.19]) by smtp.gmail.com with ESMTPSA id r36sm7071563qte.71.2019.06.17.13.13.37 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 17 Jun 2019 13:13:38 -0700 (PDT) From: Sean Paul To: dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Cc: Sean Paul , Rob Clark , Sean Paul , David Airlie , Daniel Vetter , linux-arm-msm@vger.kernel.org Subject: [PATCH 10/13] drm/msm/dsi: Simplify the logic in msm_dsi_manager_panel_init() Date: Mon, 17 Jun 2019 16:12:55 -0400 Message-Id: <20190617201301.133275-7-sean@poorly.run> X-Mailer: git-send-email 2.22.0.410.gd8fdbe21b5-goog In-Reply-To: <20190617201301.133275-1-sean@poorly.run> References: <20190617200405.131843-1-sean@poorly.run> <20190617201301.133275-1-sean@poorly.run> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Sean Paul This patch moves things around a bit to be a little more readable and pulls out the set_encoder_mode() call into its own function for later use. Signed-off-by: Sean Paul --- drivers/gpu/drm/msm/dsi/dsi_manager.c | 100 +++++++++++++++----------- 1 file changed, 59 insertions(+), 41 deletions(-) diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/dsi/dsi_manager.c index 855139195769..1ee3197a9bdd 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_manager.c +++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c @@ -239,56 +239,71 @@ static bool dsi_mgr_is_cmd_mode(struct msm_dsi *msm_dsi) return !(host_flags & MIPI_DSI_MODE_VIDEO); } -static void msm_dsi_manager_panel_init(struct drm_connector *connector, u8 id) +static void msm_dsi_manager_setup_encoder(int id) { struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id); - struct msm_dsi *other_dsi = dsi_mgr_get_other_dsi(id); - struct msm_drm_private *priv = connector->dev->dev_private; + struct msm_drm_private *priv = msm_dsi->dev->dev_private; struct msm_kms *kms = priv->kms; - bool cmd_mode; + struct drm_encoder *encoder = msm_dsi_get_encoder(msm_dsi); - if (!msm_dsi->panel) { - msm_dsi->panel = msm_dsi_host_get_panel(msm_dsi->host); + if (encoder && kms->funcs->set_encoder_mode) + kms->funcs->set_encoder_mode(kms, encoder, + dsi_mgr_is_cmd_mode(msm_dsi)); +} - /* There is only 1 panel in the global panel list - * for dual DSI mode. Therefore slave dsi should get - * the drm_panel instance from master dsi. - */ - if (!msm_dsi->panel && IS_DUAL_DSI() && - !IS_MASTER_DSI_LINK(id) && other_dsi) - msm_dsi->panel = msm_dsi_host_get_panel( - other_dsi->host); +static int msm_dsi_manager_panel_init(struct drm_connector *conn, u8 id) +{ + struct msm_drm_private *priv = conn->dev->dev_private; + struct msm_kms *kms = priv->kms; + struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id); + struct msm_dsi *other_dsi = dsi_mgr_get_other_dsi(id); + struct msm_dsi *master_dsi, *slave_dsi; + struct drm_panel *panel; + if (IS_DUAL_DSI() && !IS_MASTER_DSI_LINK(id)) { + master_dsi = other_dsi; + slave_dsi = msm_dsi; + } else { + master_dsi = msm_dsi; + slave_dsi = other_dsi; + } - cmd_mode = dsi_mgr_is_cmd_mode(msm_dsi); - if (msm_dsi->panel && kms->funcs->set_encoder_mode) { - struct drm_encoder *encoder = - msm_dsi_get_encoder(msm_dsi); + /* + * There is only 1 panel in the global panel list for dual DSI mode. + * Therefore slave dsi should get the drm_panel instance from master + * dsi. + */ + panel = msm_dsi_host_get_panel(master_dsi->host); + if (IS_ERR(panel)) { + DRM_ERROR("Could not find panel for %u (%ld)\n", msm_dsi->id, + PTR_ERR(panel)); + return PTR_ERR(panel); + } - kms->funcs->set_encoder_mode(kms, encoder, cmd_mode); - } + if (!panel) + return 0; - if (msm_dsi->panel && IS_DUAL_DSI()) - drm_object_attach_property(&connector->base, - connector->dev->mode_config.tile_property, 0); + msm_dsi_manager_setup_encoder(id); - /* Set split display info to kms once dual DSI panel is - * connected to both hosts. - */ - if (msm_dsi->panel && IS_DUAL_DSI() && - other_dsi && other_dsi->panel) { - struct drm_encoder *encoder = msm_dsi_get_encoder( - dsi_mgr_get_dsi(DSI_ENCODER_MASTER)); - struct drm_encoder *slave_enc = msm_dsi_get_encoder( - dsi_mgr_get_dsi(DSI_ENCODER_SLAVE)); - - if (kms->funcs->set_split_display) - kms->funcs->set_split_display(kms, encoder, - slave_enc, cmd_mode); - else - pr_err("mdp does not support dual DSI\n"); - } + if (!IS_DUAL_DSI()) + goto out; + + drm_object_attach_property(&conn->base, + conn->dev->mode_config.tile_property, 0); + + /* + * Set split display info to kms once dual DSI panel is connected to + * both hosts. + */ + if (other_dsi && other_dsi->panel && kms->funcs->set_split_display) { + kms->funcs->set_split_display(kms, master_dsi->encoder, + slave_dsi->encoder, + dsi_mgr_is_cmd_mode(msm_dsi)); } + +out: + msm_dsi->panel = panel; + return 0; } static enum drm_connector_status dsi_mgr_connector_detect( @@ -298,8 +313,11 @@ static enum drm_connector_status dsi_mgr_connector_detect( struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id); DBG("id=%d", id); - if (!msm_dsi->panel) - msm_dsi_manager_panel_init(connector, id); + if (!msm_dsi->panel) { + int ret = msm_dsi_manager_panel_init(connector, id); + if (ret) + return connector_status_disconnected; + } return msm_dsi->panel ? connector_status_connected : connector_status_disconnected; From patchwork Mon Jun 17 20:12:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 11000411 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8C58B1398 for ; Mon, 17 Jun 2019 20:13:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7F6CB288FC for ; Mon, 17 Jun 2019 20:13:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 73F8C289F8; Mon, 17 Jun 2019 20:13:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 10031288FC for ; Mon, 17 Jun 2019 20:13:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726048AbfFQUNm (ORCPT ); Mon, 17 Jun 2019 16:13:42 -0400 Received: from mail-qt1-f196.google.com ([209.85.160.196]:43027 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726677AbfFQUNm (ORCPT ); Mon, 17 Jun 2019 16:13:42 -0400 Received: by mail-qt1-f196.google.com with SMTP id w17so6001839qto.10 for ; Mon, 17 Jun 2019 13:13:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poorly.run; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=q0IYZw+KH0ep1U9uj+KlMGqWaqwAhViNoXO4Kfh8beQ=; b=G4uJYUFMtcTefXKAlRErNW0ANUVg7YuNxp3waBaDItU+/XvEaV64v4+HFc2q+inCPu xE+BYJqIBaR8N6IPnstD/HwIDz3kEz+PGZOZUTK7NVsYpnv01Sdt8dxT/nFA/0w+tm80 M3BB/yHh3FDEgkY9tBCoAsv0OGnJQ2F/vOLi/o3QNLIeVOHQmr0IULbOeswl7BYilBKP FeGeAdr2AJCJsFqIFX30M9KVLqIjBrlv7EGO+Yt6C0ACEdqKzaUlujqjqasfrJoFH5HD 2w7yHGRDMNBK0Mhc6jQiSjwyZZ6+Qo10xAuHU0tj3V27OaLX5klFzpt5DYVFC8NVp+La Yqog== 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=q0IYZw+KH0ep1U9uj+KlMGqWaqwAhViNoXO4Kfh8beQ=; b=RwgAzQfr30rDGqbboHyl8HuV1yQ9uy1tDAqNUhn7J62jzlDUVk12j2puqOQC8co0Ny In8Kd86daO01+gGGONgiS3MdUsCbV9wyxDRfONzGaQJclffxmAK18v99JRxr4EMu94kD ghAVLBmd1XpHPPZTCucEGDdZbVRjw96ut5QKc/nXm337Dy80qYOV0I/tlEQkAWDy6Pft Hme1MZl0e5GNqaClMpdATBT0Jr4SXep2iki6i1Byu680EgjEdmYbVmAg9NfIpou63epd 05HAAxji9u4HVK6jpXO8pH+C4pLZloZdEaCugafsDfSyfJuEx49zWk1b5fkkmFCQVLLI 0PpA== X-Gm-Message-State: APjAAAW4NL9YE5lXhV8cbwXyc2fZqC72dk4Xs6jXGv9A+Z/+KJhbj6Yq ylJKS03Yvc518vxoZ/vv0rIMSw== X-Google-Smtp-Source: APXvYqy+jk+BfnzTYGY88EaSeelKmL4/FugRI08hWufUcxI6WAllfyoDpbco0gKpGs4EEpE6pKrO7w== X-Received: by 2002:ac8:38cc:: with SMTP id g12mr95183704qtc.68.1560802421456; Mon, 17 Jun 2019 13:13:41 -0700 (PDT) Received: from rosewood.cam.corp.google.com ([100.100.175.19]) by smtp.gmail.com with ESMTPSA id r36sm7071563qte.71.2019.06.17.13.13.40 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 17 Jun 2019 13:13:41 -0700 (PDT) From: Sean Paul To: dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Cc: Sean Paul , Rob Clark , Sean Paul , David Airlie , Daniel Vetter , linux-arm-msm@vger.kernel.org Subject: [PATCH 11/13] drm/msm/dsi: Use the new setup_encoder function in attach_dsi_device Date: Mon, 17 Jun 2019 16:12:56 -0400 Message-Id: <20190617201301.133275-8-sean@poorly.run> X-Mailer: git-send-email 2.22.0.410.gd8fdbe21b5-goog In-Reply-To: <20190617201301.133275-1-sean@poorly.run> References: <20190617200405.131843-1-sean@poorly.run> <20190617201301.133275-1-sean@poorly.run> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Sean Paul Now that we have a function to call set_encoder_mode() for us, use it. Signed-off-by: Sean Paul --- drivers/gpu/drm/msm/dsi/dsi.h | 2 +- drivers/gpu/drm/msm/dsi/dsi_host.c | 2 +- drivers/gpu/drm/msm/dsi/dsi_manager.c | 15 ++------------- 3 files changed, 4 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/msm/dsi/dsi.h b/drivers/gpu/drm/msm/dsi/dsi.h index e0bbe8128aef..f8a611725f2e 100644 --- a/drivers/gpu/drm/msm/dsi/dsi.h +++ b/drivers/gpu/drm/msm/dsi/dsi.h @@ -96,7 +96,7 @@ struct drm_connector *msm_dsi_manager_connector_init(u8 id); struct drm_connector *msm_dsi_manager_ext_bridge_init(u8 id); int msm_dsi_manager_cmd_xfer(int id, const struct mipi_dsi_msg *msg); bool msm_dsi_manager_cmd_xfer_trigger(int id, u32 dma_base, u32 len); -void msm_dsi_manager_attach_dsi_device(int id, u32 device_flags); +void msm_dsi_manager_attach_dsi_device(int id); int msm_dsi_manager_register(struct msm_dsi *msm_dsi); void msm_dsi_manager_unregister(struct msm_dsi *msm_dsi); bool msm_dsi_manager_validate_current_config(u8 id); diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c index daa08a033b59..effea0db5626 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_host.c +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c @@ -1598,7 +1598,7 @@ static int dsi_host_attach(struct mipi_dsi_host *host, msm_host->format = dsi->format; msm_host->mode_flags = dsi->mode_flags; - msm_dsi_manager_attach_dsi_device(msm_host->id, dsi->mode_flags); + msm_dsi_manager_attach_dsi_device(msm_host->id); /* Some gpios defined in panel DT need to be controlled by host */ ret = dsi_host_init_panel_gpios(msm_host, &dsi->dev); diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/dsi/dsi_manager.c index 1ee3197a9bdd..602953b90cab 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_manager.c +++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c @@ -787,14 +787,10 @@ bool msm_dsi_manager_cmd_xfer_trigger(int id, u32 dma_base, u32 len) return true; } -void msm_dsi_manager_attach_dsi_device(int id, u32 device_flags) +void msm_dsi_manager_attach_dsi_device(int id) { struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id); struct drm_device *dev = msm_dsi->dev; - struct msm_drm_private *priv; - struct msm_kms *kms; - struct drm_encoder *encoder; - bool cmd_mode; /* * drm_device pointer is assigned to msm_dsi only in the modeset_init @@ -806,14 +802,7 @@ void msm_dsi_manager_attach_dsi_device(int id, u32 device_flags) if (!dev) return; - priv = dev->dev_private; - kms = priv->kms; - encoder = msm_dsi_get_encoder(msm_dsi); - cmd_mode = !(device_flags & - MIPI_DSI_MODE_VIDEO); - - if (encoder && kms->funcs->set_encoder_mode) - kms->funcs->set_encoder_mode(kms, encoder, cmd_mode); + msm_dsi_manager_setup_encoder(id); } int msm_dsi_manager_register(struct msm_dsi *msm_dsi) From patchwork Mon Jun 17 20:12:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 11000417 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D6F6C14B6 for ; Mon, 17 Jun 2019 20:13:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CA6AD2887E for ; Mon, 17 Jun 2019 20:13:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BF063289D2; Mon, 17 Jun 2019 20:13:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6686C2888A for ; Mon, 17 Jun 2019 20:13:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726920AbfFQUNq (ORCPT ); Mon, 17 Jun 2019 16:13:46 -0400 Received: from mail-qt1-f196.google.com ([209.85.160.196]:46964 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726677AbfFQUNp (ORCPT ); Mon, 17 Jun 2019 16:13:45 -0400 Received: by mail-qt1-f196.google.com with SMTP id h21so12357105qtn.13 for ; Mon, 17 Jun 2019 13:13:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poorly.run; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=fDopIqI87NuKfsetWNyXbj/fkfbEd9K2X1YOScDx9RI=; b=JPWAGxKksuKYU8RDsDDM4EUum72rinZkJzX8ksj/hS6MtLwM93Dq9MD1dhV/pZ690v wcT8tW5WKLwDCa+GcSlLgFLAC8bVOP/SDUNsvLrWknjSOR8RGqd/iDOfm3t4MN4DXpw3 uS0qZBhoZ88UUCd1IabRJ8KzNcTjWgybF3IQZtG8DYJl1WxRXqXZVP0kWmms7s5vt85n sUiXOXJK5pl5Rq67Pgzc1ScZXrpKcr72YEbvMfBvC7HunKOJHpcQTnji9kRG31UGktqC gNiXOpfwmBps9Fukc03SvQRw7GpYeArH1RExjUUCjSUuNOHlIc5HZX4zzGf47o9Iw49X edtw== 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=fDopIqI87NuKfsetWNyXbj/fkfbEd9K2X1YOScDx9RI=; b=sfJ1txG9BZDTDH2lrw4ZOpPSQbvgy2b+eAUiML7baVtGSJ/YIUY+WwRcKauNOGVeoK nkS5BkJEqP0mvRnilpF+J2OJNt3U8ukOWaeXKe8OQChkk1H3/L335/ebwX1ZX8gzssts J2xkEJlLureqjWnqOsmK0HLMKGiUUDs1znsNjyTEFA/18+J8a3NGOkdRCy4s3Vh0seFr oNkkNrqU4LR/FN3SSP17f88lSPqnEZu58fZAyFCSfZZ0JIVLWAMGW9uujOlQy5XYYlBw 7jFzWyoKnAo0BsjWmYIN7dB2pfs26tgp5dpkQnd6n03mlXfOIupCC69K7NZCY90gy/eH ePgg== X-Gm-Message-State: APjAAAUF4nTWFSS6AwzeauKHKWbpMgocfZ62yQkV+KooqUFyBjeBQZHS dFwuplZ5qzs26h2aW/IpF4Zljg== X-Google-Smtp-Source: APXvYqy1jTG2HR3hZvPT0PMKE5ePTuohZtRekInTF8heouwOGhe6MshqztZzlb/5YEpiIIyEVpP2KQ== X-Received: by 2002:a0c:ee29:: with SMTP id l9mr23210987qvs.43.1560802424979; Mon, 17 Jun 2019 13:13:44 -0700 (PDT) Received: from rosewood.cam.corp.google.com ([100.100.175.19]) by smtp.gmail.com with ESMTPSA id r36sm7071563qte.71.2019.06.17.13.13.44 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 17 Jun 2019 13:13:44 -0700 (PDT) From: Sean Paul To: dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Cc: Sean Paul , Rob Clark , Sean Paul , David Airlie , Daniel Vetter , linux-arm-msm@vger.kernel.org Subject: [PATCH 12/13] drm/msm/dsi: Move dsi panel init into modeset init path Date: Mon, 17 Jun 2019 16:12:57 -0400 Message-Id: <20190617201301.133275-9-sean@poorly.run> X-Mailer: git-send-email 2.22.0.410.gd8fdbe21b5-goog In-Reply-To: <20190617201301.133275-1-sean@poorly.run> References: <20190617200405.131843-1-sean@poorly.run> <20190617201301.133275-1-sean@poorly.run> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Sean Paul Since deferred probe from the modeset init path now works, we can move the panel initialization from detect() into connector init. This avoids doing work in detect() and hopefully will result in a more deterministic boot sequence between devices with a dsi panel, and those with an external bridge. Signed-off-by: Sean Paul --- drivers/gpu/drm/msm/dsi/dsi_manager.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/dsi/dsi_manager.c index 602953b90cab..5db43c7ffafc 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_manager.c +++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c @@ -312,13 +312,6 @@ static enum drm_connector_status dsi_mgr_connector_detect( int id = dsi_mgr_connector_get_id(connector); struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id); - DBG("id=%d", id); - if (!msm_dsi->panel) { - int ret = msm_dsi_manager_panel_init(connector, id); - if (ret) - return connector_status_disconnected; - } - return msm_dsi->panel ? connector_status_connected : connector_status_disconnected; } @@ -631,7 +624,17 @@ struct drm_connector *msm_dsi_manager_connector_init(u8 id) drm_connector_attach_encoder(connector, msm_dsi->encoder); + ret = msm_dsi_manager_panel_init(connector, id); + if (ret) { + DRM_DEV_ERROR(msm_dsi->dev->dev, "init panel failed %d\n", ret); + goto fail; + } + return connector; + +fail: + connector->funcs->destroy(msm_dsi->connector); + return ERR_PTR(ret); } bool msm_dsi_manager_validate_current_config(u8 id) From patchwork Mon Jun 17 20:12:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 11000419 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 942EF1398 for ; Mon, 17 Jun 2019 20:13:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 85C462888A for ; Mon, 17 Jun 2019 20:13:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 79CA7289FF; Mon, 17 Jun 2019 20:13:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 05BD9289D2 for ; Mon, 17 Jun 2019 20:13:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727077AbfFQUNt (ORCPT ); Mon, 17 Jun 2019 16:13:49 -0400 Received: from mail-qk1-f194.google.com ([209.85.222.194]:42385 "EHLO mail-qk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726677AbfFQUNt (ORCPT ); Mon, 17 Jun 2019 16:13:49 -0400 Received: by mail-qk1-f194.google.com with SMTP id b18so7023729qkc.9 for ; Mon, 17 Jun 2019 13:13:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poorly.run; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8D4fpJmFY4SmM2l/JKOdVtbyAkJaL5JwqyG6lAC7i44=; b=TlA2izxyGxy/AB0BmL6o3peFHfIycGsvRzNH80Dm3Gh+0XagV93JT1nomoZjAwx3Vp 2TLX7RbdRM1gDHAxkxaNIY7mxjOCqVPTSxvtkm0oTbJ8/zyFE3gtdwWIRvWe5joWhklf rYYBCp3a2NQ/UNqWIP0PUkiZK5ChJ/VPtIDJ6b4QNYRt2Wbty9PWYFopbllQmELXpbYd N3bmtgwRVmuarb96TDQ0UeRJvPOHGYW5J9qlJ5hYN7zVYuxpjbVWPLSJVZaEn84YVh0r kpCY0u+8CbOUFdtPB4xLCuZORVHYhJSacGFg3JaUWa7oPZJOlkEqxckly50lah6nMakJ tbXA== 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=8D4fpJmFY4SmM2l/JKOdVtbyAkJaL5JwqyG6lAC7i44=; b=H2bqpRV2Ckr1ciTMBeS8lRbe93eMrxSRerOYsaNqB1ZvWcN80wsuymCL+JvcERTOdB 9ax6B7378EyzYfDcs7X+c2gfFFnbFFw65ypksscBi6m0pgfJO+6pdyvQ4datrnqUycth BXrBn461fRHD2Tc1HJ/YDknA4A4YGirBRS0XZ0GuUJYqKgADn1ZxeipPqQZwFTFiBLFu S9gpd/wgGXL+cDaDMKFLJJuu1OV5oX/VFuJDf6Zbg6rIukqkxvsP7ldxLPueYWDIqH+m NlxLo3eVSXf1+6kemHaqp+Sobh1wMd7NLKYgBox4THs94yGNF6l+Gka+pBdGbpVLeNLt NUrg== X-Gm-Message-State: APjAAAWd9enY070vcxI3E+ydNO1zx8x0clYyFhEeJ3s+/lrZkMIW4zur hh1GrT2LP6xeue5boJmoiFDKJQ== X-Google-Smtp-Source: APXvYqyVopaO7ELEOlR+hgQSDvaXfKt1Dbo8ZDtVFdgbP0AOMItc20y562fsPNfb6gNkN7+n1cwp/Q== X-Received: by 2002:a37:bc03:: with SMTP id m3mr13718582qkf.199.1560802428032; Mon, 17 Jun 2019 13:13:48 -0700 (PDT) Received: from rosewood.cam.corp.google.com ([100.100.175.19]) by smtp.gmail.com with ESMTPSA id r36sm7071563qte.71.2019.06.17.13.13.47 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 17 Jun 2019 13:13:47 -0700 (PDT) From: Sean Paul To: dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org Cc: Sean Paul , Rob Clark , Sean Paul , David Airlie , Daniel Vetter , linux-arm-msm@vger.kernel.org Subject: [PATCH 13/13] drm/msm/dsi: Move setup_encoder to modeset_init Date: Mon, 17 Jun 2019 16:12:58 -0400 Message-Id: <20190617201301.133275-10-sean@poorly.run> X-Mailer: git-send-email 2.22.0.410.gd8fdbe21b5-goog In-Reply-To: <20190617201301.133275-1-sean@poorly.run> References: <20190617200405.131843-1-sean@poorly.run> <20190617201301.133275-1-sean@poorly.run> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Sean Paul Now that the panel probe/setup is in the modeset path, we can call dsi_manager_setup_encoder() in a common place for both internal and external bridge setups. Signed-off-by: Sean Paul --- drivers/gpu/drm/msm/dsi/dsi.c | 2 ++ drivers/gpu/drm/msm/dsi/dsi.h | 2 +- drivers/gpu/drm/msm/dsi/dsi_host.c | 2 -- drivers/gpu/drm/msm/dsi/dsi_manager.c | 27 ++------------------------- 4 files changed, 5 insertions(+), 28 deletions(-) diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c index 7b2a1e6a8810..d45b0a40aaf3 100644 --- a/drivers/gpu/drm/msm/dsi/dsi.c +++ b/drivers/gpu/drm/msm/dsi/dsi.c @@ -250,6 +250,8 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev, goto fail; } + msm_dsi_manager_setup_encoder(msm_dsi->id); + priv->bridges[priv->num_bridges++] = msm_dsi->bridge; priv->connectors[priv->num_connectors++] = msm_dsi->connector; diff --git a/drivers/gpu/drm/msm/dsi/dsi.h b/drivers/gpu/drm/msm/dsi/dsi.h index f8a611725f2e..53bb124e8259 100644 --- a/drivers/gpu/drm/msm/dsi/dsi.h +++ b/drivers/gpu/drm/msm/dsi/dsi.h @@ -96,7 +96,7 @@ struct drm_connector *msm_dsi_manager_connector_init(u8 id); struct drm_connector *msm_dsi_manager_ext_bridge_init(u8 id); int msm_dsi_manager_cmd_xfer(int id, const struct mipi_dsi_msg *msg); bool msm_dsi_manager_cmd_xfer_trigger(int id, u32 dma_base, u32 len); -void msm_dsi_manager_attach_dsi_device(int id); +void msm_dsi_manager_setup_encoder(int id); int msm_dsi_manager_register(struct msm_dsi *msm_dsi); void msm_dsi_manager_unregister(struct msm_dsi *msm_dsi); bool msm_dsi_manager_validate_current_config(u8 id); diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c index effea0db5626..04db0c806aa4 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_host.c +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c @@ -1598,8 +1598,6 @@ static int dsi_host_attach(struct mipi_dsi_host *host, msm_host->format = dsi->format; msm_host->mode_flags = dsi->mode_flags; - msm_dsi_manager_attach_dsi_device(msm_host->id); - /* Some gpios defined in panel DT need to be controlled by host */ ret = dsi_host_init_panel_gpios(msm_host, &dsi->dev); if (ret) diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/dsi/dsi_manager.c index 5db43c7ffafc..ff39ce6150ad 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_manager.c +++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c @@ -239,7 +239,7 @@ static bool dsi_mgr_is_cmd_mode(struct msm_dsi *msm_dsi) return !(host_flags & MIPI_DSI_MODE_VIDEO); } -static void msm_dsi_manager_setup_encoder(int id) +void msm_dsi_manager_setup_encoder(int id) { struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id); struct msm_drm_private *priv = msm_dsi->dev->dev_private; @@ -280,12 +280,7 @@ static int msm_dsi_manager_panel_init(struct drm_connector *conn, u8 id) return PTR_ERR(panel); } - if (!panel) - return 0; - - msm_dsi_manager_setup_encoder(id); - - if (!IS_DUAL_DSI()) + if (!panel || !IS_DUAL_DSI()) goto out; drm_object_attach_property(&conn->base, @@ -790,24 +785,6 @@ bool msm_dsi_manager_cmd_xfer_trigger(int id, u32 dma_base, u32 len) return true; } -void msm_dsi_manager_attach_dsi_device(int id) -{ - struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id); - struct drm_device *dev = msm_dsi->dev; - - /* - * drm_device pointer is assigned to msm_dsi only in the modeset_init - * path. If mipi_dsi_attach() happens in DSI driver's probe path - * (generally the case when we're connected to a drm_panel of the type - * mipi_dsi_device), this would be NULL. In such cases, try to set the - * encoder mode in the DSI connector's detect() op. - */ - if (!dev) - return; - - msm_dsi_manager_setup_encoder(id); -} - int msm_dsi_manager_register(struct msm_dsi *msm_dsi) { struct msm_dsi_manager *msm_dsim = &msm_dsim_glb;