From patchwork Tue May 5 04:00:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eizan Miyamoto X-Patchwork-Id: 11528147 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7612181 for ; Tue, 5 May 2020 04:01:21 +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 4D9F520721 for ; Tue, 5 May 2020 04:01:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="bDWmzivn"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="GiPNnuzU" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4D9F520721 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=hNvRpgLhkRFycQEvj+5NkBHL33P9L/3O6y7vtKLzqTY=; b=bDWmzivnKCy/Du bkb+LnBB7/4HDcNp5msn2C54+mnXgefsnikG6kloq89mTaHorBlgYHZ3vneh08NQnE5w8QyfTmK7z kdPscjvwQY9NTmxpIh0J9SRpa+ui4CfwzTdqPwYCz2LudNmYaF52SwzMP5xafCARzFLdyCMHuagvv 2OBBWxz2xE2BQrpfirE/Y/dJgv/+luuZE9VigsgNYo8A/7i0pRgs4ktUmhzuGxpf5O4D208w+m3zP KNwmgunCl2YZfNSWVpT284vxGWYsSpu3Wz2X2aFs8u06Cg+PmxGPUitSvkip8avkqWJr4NG3EhB4o Q8G1nkTKZMMwT8WvwDGQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jVolg-0003Dn-PX; Tue, 05 May 2020 04:01:16 +0000 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jVole-0003B9-AL for linux-arm-kernel@lists.infradead.org; Tue, 05 May 2020 04:01:15 +0000 Received: by mail-pl1-x643.google.com with SMTP id u22so254605plq.12 for ; Mon, 04 May 2020 21:01:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DcuOwTL7vWeGU4BHEEgCAhZYtrZvgsB0gLbKKMhZqVM=; b=GiPNnuzUK9FnG/VS1XegNdexL4Voi0zdwNKKzBwte2k3acVUCL9EDxBGjFfpHnwGM9 U3HUEPcRukJqgs/g4K3X1ytfDAtPMZ+zsuhuv2WLphAXSTkov9EC7OsdRqoHK/Q3bYwr mwEsCzhKWmouicpjYsefvdkcrfumYNZx1glZM= 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=DcuOwTL7vWeGU4BHEEgCAhZYtrZvgsB0gLbKKMhZqVM=; b=rkuCWzTFtyK/ZqZ2x8MjdwfJ1r5vVsDGaTdyqPBA/4X/a/XEf7DUu4wfZmPqkfhzyp dnU2/I8NFZo7L175C/LpGOWWMRucwBPG7nYNgg4nKyrGBbI/oz4JkGc5HesagBZXfP6K JjdK6WLUn9vFUGDqNoo4kjSZfo2lu4DPRYDaIxNfumXlDAz/+1TaKcpGmHQ3N8KphkDv Ndvc6Nj0I8YOzczvOjccmJ0dN8ysmPXKGK390e/BefoT1RdFUzlCJIQYNswNqetOnXyU H68cpBguifizJaVNKzFOCb97cbhn5DQ3YZk7T5QfpOKU3axxnuF4m+WyaMS/iVLvdilC o6NQ== X-Gm-Message-State: AGi0PuZx1hvlqE/CYglAPGEaloEbH5K/qae4Rxtx01F9x8bp0nyv6zxA 0vrAYYrWqTEFO4DkkGGd0Dv87A== X-Google-Smtp-Source: APiQypL9b1gOcDXoI9Aau8wQwRN9YSmxnUKqOC75g2zmvbguz1b03VlXqH1TYxFDmN7LQ4AbJ86ZJw== X-Received: by 2002:a17:90a:9f8a:: with SMTP id o10mr489319pjp.118.1588651272798; Mon, 04 May 2020 21:01:12 -0700 (PDT) Received: from localhost ([2401:fa00:9:14:a92f:c47d:76a8:b09e]) by smtp.gmail.com with ESMTPSA id c10sm629631pfm.50.2020.05.04.21.01.08 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 04 May 2020 21:01:12 -0700 (PDT) From: Eizan Miyamoto X-Google-Original-From: Eizan Miyamoto To: LKML Subject: [PATCH v1 1/5] [media] mtk-mdp: remove mtk_mdp_comp.regs from mtk_mdp_comp.h Date: Tue, 5 May 2020 14:00:44 +1000 Message-Id: <20200505125042.v1.1.If0cdd88c5399a38cff7163298cc8794f8c40a401@changeid> X-Mailer: git-send-email 2.26.2.526.g744177e7f7-goog In-Reply-To: <20200505040048.132493-1-eizan@google.com> References: <20200505040048.132493-1-eizan@google.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200504_210114_368632_B4F0EA4F X-CRM114-Status: UNSURE ( 9.83 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:643 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew-CT Chen , Minghsiu Tsai , Houlong Wei , Eizan Miyamoto , eizan@chromium.org, linux-mediatek@lists.infradead.org, Matthias Brugger , Mauro Carvalho Chehab , linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org These fields are not used and can be removed. Signed-off-by: eizan@chromium.org Signed-off-by: Eizan Miyamoto Reviewed-by: Enric Balletbo i Serra --- drivers/media/platform/mtk-mdp/mtk_mdp_comp.c | 1 - drivers/media/platform/mtk-mdp/mtk_mdp_comp.h | 2 -- 2 files changed, 3 deletions(-) diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c b/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c index 14991685adb7..facc6104b91f 100644 --- a/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c +++ b/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c @@ -106,7 +106,6 @@ int mtk_mdp_comp_init(struct device *dev, struct device_node *node, comp->dev_node = of_node_get(node); comp->id = comp_id; comp->type = mtk_mdp_matches[comp_id].type; - comp->regs = of_iomap(node, 0); for (i = 0; i < ARRAY_SIZE(comp->clk); i++) { comp->clk[i] = of_clk_get(node, i); diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_comp.h b/drivers/media/platform/mtk-mdp/mtk_mdp_comp.h index 998a4b953025..3b83bd6e0d8b 100644 --- a/drivers/media/platform/mtk-mdp/mtk_mdp_comp.h +++ b/drivers/media/platform/mtk-mdp/mtk_mdp_comp.h @@ -38,7 +38,6 @@ enum mtk_mdp_comp_id { * struct mtk_mdp_comp - the MDP's function component data * @dev_node: component device node * @clk: clocks required for component - * @regs: Mapped address of component registers. * @larb_dev: SMI device required for component * @type: component type * @id: component ID @@ -46,7 +45,6 @@ enum mtk_mdp_comp_id { struct mtk_mdp_comp { struct device_node *dev_node; struct clk *clk[2]; - void __iomem *regs; struct device *larb_dev; enum mtk_mdp_comp_type type; enum mtk_mdp_comp_id id; From patchwork Tue May 5 04:00:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eizan Miyamoto X-Patchwork-Id: 11528157 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ED86092A for ; Tue, 5 May 2020 04:01:38 +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 C8641206B8 for ; Tue, 5 May 2020 04:01:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="HhRmDQ1E"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="Ii8+KtIL" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C8641206B8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=x2fydbB6pjQ0CijaajfAnB9gWSB6BtInqsRI5fXGYJE=; b=HhRmDQ1E+WoSJL KLfcE3I+H1Cf06y3kQwU/nA+D4ZzBLZNgVboL3hn5I+8kinQeLKuqvp+RMeqaMoZjny530itEeYoW R0SqLM1jU4BTq4guWGfhhCJc5M6qoVkj7SbkN4cxN15iQGT/8d7pLjxBK4nFoWqdQR/ZbfwburJE+ kmpspDa+h2f8IkbODBvqpLLXrqg8yiiXwMApMtka2uQtU2s5+7sHYWR+KW9rN9sI9jzmjjICon645 wlwpx35esqbTBS7nWQU1wGKi2IGeQ2ZNBvdYQuiAyQviBrwEJ5AQE0M7q4YkcRkCj5L7eJETGKq4f gxDBIefkZzAWrRlgoKLw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jVolx-0003XQ-Rf; Tue, 05 May 2020 04:01:33 +0000 Received: from mail-pj1-x1044.google.com ([2607:f8b0:4864:20::1044]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jVolo-0003Mh-VG for linux-arm-kernel@lists.infradead.org; Tue, 05 May 2020 04:01:27 +0000 Received: by mail-pj1-x1044.google.com with SMTP id 7so671475pjo.0 for ; Mon, 04 May 2020 21:01:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ctoh4fSKKdbnfncF1YOVBJD74K9A/+MRfOMQ6EjpdWU=; b=Ii8+KtILgS8kUQw30kWi/g6X8rQQSL7btnKUADBZbiGPsB7xgLrjW/n8WdNDKbgQWN tD0CyhvsndPuo5olMQnHe7XkJqOToYWcqesKzfNx4Cr9zVrfqs44PzQD1F0/aSptMOBL eUsczSXbwqFmnb3O1kmfFjGdB5/HS/Xh7TVSI= 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=ctoh4fSKKdbnfncF1YOVBJD74K9A/+MRfOMQ6EjpdWU=; b=F/XskPUjEDk4ENbhUVKDqvHyD03UKJFfL+EhQ3l/qVyKIoSmRbQvMAefWUJoeXFD9m sh4ueSxBI3s1CFGnz6I1KxiFQltCvyt8NJGvBbiTS0MbrYBJP170hA46GnPyLlLf9reL f9aOBl4nY0yC1Z1NTZVOTozeBWhG0uwl5LjCxtQn1BeZCD0PzXB0l4mabwpHiROdBAO6 qP1LQPnN1H5yEz1a8q5PGtAcQo2UEWeZB6YFv3UNbqhG8LE0j6mxhF1nobCtBkKAkMWx YNOPfLc07Sdlihh1dmfZTNSqP7z1jNhhlMqaHDff5s2SgcR9VKYXNsJw6wihz7MK6FSK 7Q/A== X-Gm-Message-State: AGi0PubtbdadeCVPJybA4fQ707GWgoDVqChVYaAWrgciCNkMgdEJeRiy RhuCqUPdqe8vOp5ZJLlg27mgxg== X-Google-Smtp-Source: APiQypIIEru/mWi8soSg13FgeYsWH8bdQu/U7isUmQMJNW8Y7jDjPHye4EUxOyOGu5+scYfufol+BQ== X-Received: by 2002:a17:90a:7f83:: with SMTP id m3mr525112pjl.147.1588651283555; Mon, 04 May 2020 21:01:23 -0700 (PDT) Received: from localhost ([2401:fa00:9:14:a92f:c47d:76a8:b09e]) by smtp.gmail.com with ESMTPSA id w2sm565152pfc.194.2020.05.04.21.01.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 04 May 2020 21:01:23 -0700 (PDT) From: Eizan Miyamoto X-Google-Original-From: Eizan Miyamoto To: LKML Subject: [PATCH v1 2/5] [media] mtk-mdp: handle vb2_dma_contig_set_max_seg_size errors during probe Date: Tue, 5 May 2020 14:00:45 +1000 Message-Id: <20200505125042.v1.2.Ie596e59e0a18935f0b7321ff45e5c5f2ce8082b1@changeid> X-Mailer: git-send-email 2.26.2.526.g744177e7f7-goog In-Reply-To: <20200505040048.132493-1-eizan@google.com> References: <20200505040048.132493-1-eizan@google.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200504_210125_010144_F236D3D0 X-CRM114-Status: GOOD ( 10.98 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:1044 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew-CT Chen , Minghsiu Tsai , Houlong Wei , Eizan Miyamoto , eizan@chromium.org, linux-mediatek@lists.infradead.org, Matthias Brugger , Mauro Carvalho Chehab , linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org This is a cleanup to better handle errors during MDP probe. Signed-off-by: eizan@chromium.org Signed-off-by: Eizan Miyamoto --- drivers/media/platform/mtk-mdp/mtk_mdp_core.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_core.c b/drivers/media/platform/mtk-mdp/mtk_mdp_core.c index aeaed2cf4458..c20ac7681c6f 100644 --- a/drivers/media/platform/mtk-mdp/mtk_mdp_core.c +++ b/drivers/media/platform/mtk-mdp/mtk_mdp_core.c @@ -193,13 +193,19 @@ static int mtk_mdp_probe(struct platform_device *pdev) platform_set_drvdata(pdev, mdp); - vb2_dma_contig_set_max_seg_size(&pdev->dev, DMA_BIT_MASK(32)); + ret = vb2_dma_contig_set_max_seg_size(&pdev->dev, DMA_BIT_MASK(32)); + if (ret) { + dev_err(&pdev->dev, "Failed to set vb2 dma mag seg size\n"); + goto err_set_max_seg_size; + } pm_runtime_enable(dev); dev_dbg(dev, "mdp-%d registered successfully\n", mdp->id); return 0; +err_set_max_seg_size: + err_m2m_register: v4l2_device_unregister(&mdp->v4l2_dev); From patchwork Tue May 5 04:00:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eizan Miyamoto X-Patchwork-Id: 11528165 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A5B8492A for ; Tue, 5 May 2020 04:01:57 +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 52ABB20721 for ; Tue, 5 May 2020 04:01:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="JIaeQ7fR"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="doZmY9Xx" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 52ABB20721 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=c3ibY82bT4+7CiVIlESF3kCcI+MndaczKJ4ZqO0Dr1s=; b=JIaeQ7fRM2CEdb a66EiXO5kHdWp/aM/hxycnzE5cF9JxgfSH8x8DGUR6ygj0xIPoBkL++AzI0dm3ZxKiU7s3g4eHHJg KmPHSMVuyar6pkIu8NweDqJUJNlzcUH8lHBockVV4ueJ8jMHkYxjx/Q7SfdPUMjiTUGti5pkncKrU kmYl4DLzJV2AeUy1Y6cvHHkRiHci79Xrjvlnejx7SgQbVkjvc2lkijxCmWgUv3ynkCFJ7LCCGUXFm v7vhCYH4jdwZETTgT9UcZlZIxiqxYp2oz57FoWFqoUzNsPRDcVTARYmGxaVAl9xukm70zhI080BdM cyfitm6xf2Q5CFrtykjg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jVomE-0003ow-GH; Tue, 05 May 2020 04:01:50 +0000 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jVolv-0003U9-RP for linux-arm-kernel@lists.infradead.org; Tue, 05 May 2020 04:01:33 +0000 Received: by mail-pg1-x542.google.com with SMTP id a4so510559pgc.0 for ; Mon, 04 May 2020 21:01:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=fX+wHjDnbtvEkbbVe2K/ppkZQlF0JTMhhwiYwZiHruM=; b=doZmY9XxEuZl1yzo+blKvEuGksayzqeE2OAKNN0mF76DL6R0CrL75vtszNR4kDzPyW 4GEREd5uYoerxfbJSi4kbGiHtp9dKhMwE3I7zjjEorWnm8Dj/vrkXc1V8tlEWlX3YY9P Qb6DJuLF66dcjaD/xB/cOn7IqyTVNpGm/HaVM= 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=fX+wHjDnbtvEkbbVe2K/ppkZQlF0JTMhhwiYwZiHruM=; b=YSpEhUxbcdkUK+x52z+TlK5aelkms0a/Jet+Z4aC1YkUQy67cZktIUYRHZVnv/GSSD 6NGVwpKy6xq2C4zdBWwX+DWSeuD3NAsKnA/hoV+zO7QdyEd/ORVnpBzQ6hK/m1hT4pgl biwjog5NrRHS1+uEf8wLTJy0ZTy9jJ+DntLNfvxVipjXPir94Z/mW3E2Oqs23zZbBZ9P NsElwGAXkeGXaILnvpUOlY8J6glc6qDvYimNROCI4ERqRjNGxGOfgvxqlQNa11bL8o4l E0xbDX2M1e0hMyG/vd2l4A1YB9TmFda4mK3UVWD7Z7N+FFHOXOU8td9mZ3aqzaSAQCT7 o+Kg== X-Gm-Message-State: AGi0PuaP2sKAApFVJQ/ONL9Rk+9uFmbNCYTTFaYAhX1z9BMYmvQEcSBq C6E+E4fIiKIFVO9eFuKR0uoQ1w== X-Google-Smtp-Source: APiQypKM9NF4PxwZF3k6P93G5Qq80LCDj9yb7AloapK0ymyBsN163/1s0pe5MmUpsS7vgZq1MO+WEw== X-Received: by 2002:aa7:9683:: with SMTP id f3mr1280844pfk.278.1588651291099; Mon, 04 May 2020 21:01:31 -0700 (PDT) Received: from localhost ([2401:fa00:9:14:a92f:c47d:76a8:b09e]) by smtp.gmail.com with ESMTPSA id s44sm481696pjc.28.2020.05.04.21.01.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 04 May 2020 21:01:30 -0700 (PDT) From: Eizan Miyamoto X-Google-Original-From: Eizan Miyamoto To: LKML Subject: [PATCH v1 3/5] [media] mtk-mdp: handle vpu_wdt_reg_handler() errors during probe Date: Tue, 5 May 2020 14:00:46 +1000 Message-Id: <20200505125042.v1.3.Ieebc5dcb6dcc116119a570f14786ba47c9007ec8@changeid> X-Mailer: git-send-email 2.26.2.526.g744177e7f7-goog In-Reply-To: <20200505040048.132493-1-eizan@google.com> References: <20200505040048.132493-1-eizan@google.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200504_210131_914769_2F190CC5 X-CRM114-Status: GOOD ( 11.52 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:542 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew-CT Chen , Minghsiu Tsai , Houlong Wei , Eizan Miyamoto , eizan@chromium.org, linux-mediatek@lists.infradead.org, Matthias Brugger , Mauro Carvalho Chehab , linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org This is a cleanup to better handle errors during MDP probe. Signed-off-by: eizan@chromium.org Signed-off-by: Eizan Miyamoto --- drivers/media/platform/mtk-mdp/mtk_mdp_core.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_core.c b/drivers/media/platform/mtk-mdp/mtk_mdp_core.c index c20ac7681c6f..f974242663dc 100644 --- a/drivers/media/platform/mtk-mdp/mtk_mdp_core.c +++ b/drivers/media/platform/mtk-mdp/mtk_mdp_core.c @@ -188,8 +188,12 @@ static int mtk_mdp_probe(struct platform_device *pdev) } mdp->vpu_dev = vpu_get_plat_device(pdev); - vpu_wdt_reg_handler(mdp->vpu_dev, mtk_mdp_reset_handler, mdp, - VPU_RST_MDP); + ret = vpu_wdt_reg_handler(mdp->vpu_dev, mtk_mdp_reset_handler, mdp, + VPU_RST_MDP); + if (ret) { + dev_err(&pdev->dev, "Failed to register reset handler\n"); + goto err_wdt_reg; + } platform_set_drvdata(pdev, mdp); @@ -206,6 +210,8 @@ static int mtk_mdp_probe(struct platform_device *pdev) err_set_max_seg_size: +err_wdt_reg: + err_m2m_register: v4l2_device_unregister(&mdp->v4l2_dev); From patchwork Tue May 5 04:00:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eizan Miyamoto X-Patchwork-Id: 11528167 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 65C5881 for ; Tue, 5 May 2020 04:02:14 +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 2E8EC20721 for ; Tue, 5 May 2020 04:02:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="o4Wa3IFT"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="ejlplvyT" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2E8EC20721 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=iOKhKVEm21L5XfcWxicCDDCgWR06vWRjToTVo2feCxk=; b=o4Wa3IFTeiNdUm yGUjHk76lXeVNC2MFTVmuEWRVSBbDFWYfbmbpeOmn87FHU/BaKIMcfR6DLeT4CHlgXNcDwnBfDERu F40kOfGdi8CpvpoFjD6+f6sayItF5Gr2QB4d1B1jqb4qlDl5j3YTAUn7In6YiNj0Vlet85UxQJd+G MQEGhMj4LTcH2vddx+T4yjyYItbqtStTTNO0bA/ZRZnnT2DLcnOjSpl/ktkkd48SC21A4/IZZYHFm muOUptPup5F3yumdKNgNBgLYCckns4DweoshZZTZrBvldu3ODNRNo4qu7/uAQtcJX1WBdOzCEyKBs o2z018Rz+tMtqxt6xUBw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jVomW-00045J-RV; Tue, 05 May 2020 04:02:08 +0000 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jVom4-0003eG-7n for linux-arm-kernel@lists.infradead.org; Tue, 05 May 2020 04:01:42 +0000 Received: by mail-pf1-x443.google.com with SMTP id w65so242176pfc.12 for ; Mon, 04 May 2020 21:01:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3oGP3pb2YQcoVFS636U5L7BXYbLlD9YsNQfZperb2ZY=; b=ejlplvyTeo0/KgSsZWL3mS1VMmKanPpa5A4Sr/QFJrwxSgpKTHXnzu7ZU24W5UjTUe wHmUlJ1wx+T+qHq64EB9zFO2wANrBTcIUlzaV0NYnUQo1eWKGc9bM3nmlPqyXymP8RQt w3mii57uXk8DY4lNvLWKvYty0JSAqAo/5vtwY= 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=3oGP3pb2YQcoVFS636U5L7BXYbLlD9YsNQfZperb2ZY=; b=NuJeAcxI4KbPHlPTAl1p3zyddRju5fvGz2go5mKuXztllAk55GZ/Rr4FI1bT1S01TM NC1l029IbKXnKhUBqORtYvMXXNkDI7CUAeMwHEax+9tP1nFaMVlM70oR6EpwkVbCwnH+ VqMZDa5LTp4ItqoCDfaZhxruZbVU3LVoPP8hXnjUpoCBxDcOt2HPH9jHgWexGvD5mgC3 Pj2YU0iSocO4XTKu34sV4vM2Qs3iO8nhNqJXw852diR9bZ/KO0oB5MtX1lLPKoDGhgMg M2+1e/h7SkYKyupM4h8wx84zh2YhuLIGhl7dRemZYcPnHMwXpSBeVsjBdxedPb/3HLJX qSPg== X-Gm-Message-State: AGi0PuYuNwfw1I5204Urt7kmbq86hHzmIga2oOGZTR2NiZCbkrr9Mq5+ ZsdPMCMUPh7YSFE9eyoXwliv6A== X-Google-Smtp-Source: APiQypJ4ja0R3c4RvhfWxgL/dfFAC0z3AQJuwUuK5l/cvpvBttg/svPGQo2uPuIF9pjoD8/y090GcA== X-Received: by 2002:a62:2cd7:: with SMTP id s206mr1192195pfs.183.1588651299545; Mon, 04 May 2020 21:01:39 -0700 (PDT) Received: from localhost ([2401:fa00:9:14:a92f:c47d:76a8:b09e]) by smtp.gmail.com with ESMTPSA id o9sm437040pje.47.2020.05.04.21.01.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 04 May 2020 21:01:38 -0700 (PDT) From: Eizan Miyamoto X-Google-Original-From: Eizan Miyamoto To: LKML Subject: [PATCH v1 4/5] [media] mtk-mdp: convert mtk_mdp_dev.comp array to list Date: Tue, 5 May 2020 14:00:47 +1000 Message-Id: <20200505125042.v1.4.I7bbf54189e21badc5cc251dae85f2993b7c4ab69@changeid> X-Mailer: git-send-email 2.26.2.526.g744177e7f7-goog In-Reply-To: <20200505040048.132493-1-eizan@google.com> References: <20200505040048.132493-1-eizan@google.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200504_210140_326350_C0331EAC X-CRM114-Status: GOOD ( 16.41 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:443 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew-CT Chen , Minghsiu Tsai , Houlong Wei , Eizan Miyamoto , eizan@chromium.org, linux-mediatek@lists.infradead.org, Matthias Brugger , Mauro Carvalho Chehab , linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The functions mtk_mdp_register/unregister_component have been created to add / remove items from the list of components. This will eventually enable us to specify a list of components in the device tree instead of hardcoding them into this driver. The list is modified by a single thread at driver probe time, and will not be traversed by another thread until the call to pm_runtime_enable at the end of probing. Signed-off-by: eizan@chromium.org Signed-off-by: Eizan Miyamoto Reviewed-by: Enric Balletbo i Serra --- drivers/media/platform/mtk-mdp/mtk_mdp_comp.c | 1 + drivers/media/platform/mtk-mdp/mtk_mdp_comp.h | 2 + drivers/media/platform/mtk-mdp/mtk_mdp_core.c | 46 +++++++++++++------ drivers/media/platform/mtk-mdp/mtk_mdp_core.h | 10 +++- 4 files changed, 43 insertions(+), 16 deletions(-) diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c b/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c index facc6104b91f..d4afed1363d5 100644 --- a/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c +++ b/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c @@ -103,6 +103,7 @@ int mtk_mdp_comp_init(struct device *dev, struct device_node *node, return -EINVAL; } + INIT_LIST_HEAD(&comp->node); comp->dev_node = of_node_get(node); comp->id = comp_id; comp->type = mtk_mdp_matches[comp_id].type; diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_comp.h b/drivers/media/platform/mtk-mdp/mtk_mdp_comp.h index 3b83bd6e0d8b..1f745891c6c3 100644 --- a/drivers/media/platform/mtk-mdp/mtk_mdp_comp.h +++ b/drivers/media/platform/mtk-mdp/mtk_mdp_comp.h @@ -36,6 +36,7 @@ enum mtk_mdp_comp_id { /** * struct mtk_mdp_comp - the MDP's function component data + * @node: list node to track sibing MDP components * @dev_node: component device node * @clk: clocks required for component * @larb_dev: SMI device required for component @@ -43,6 +44,7 @@ enum mtk_mdp_comp_id { * @id: component ID */ struct mtk_mdp_comp { + struct list_head node; struct device_node *dev_node; struct clk *clk[2]; struct device *larb_dev; diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_core.c b/drivers/media/platform/mtk-mdp/mtk_mdp_core.c index f974242663dc..e6e702d9cb69 100644 --- a/drivers/media/platform/mtk-mdp/mtk_mdp_core.c +++ b/drivers/media/platform/mtk-mdp/mtk_mdp_core.c @@ -55,19 +55,19 @@ MODULE_DEVICE_TABLE(of, mtk_mdp_of_ids); static void mtk_mdp_clock_on(struct mtk_mdp_dev *mdp) { struct device *dev = &mdp->pdev->dev; - int i; + struct mtk_mdp_comp *comp_node; - for (i = 0; i < ARRAY_SIZE(mdp->comp); i++) - mtk_mdp_comp_clock_on(dev, mdp->comp[i]); + list_for_each_entry(comp_node, &mdp->comp_list, node) + mtk_mdp_comp_clock_on(dev, comp_node); } static void mtk_mdp_clock_off(struct mtk_mdp_dev *mdp) { struct device *dev = &mdp->pdev->dev; - int i; + struct mtk_mdp_comp *comp_node; - for (i = 0; i < ARRAY_SIZE(mdp->comp); i++) - mtk_mdp_comp_clock_off(dev, mdp->comp[i]); + list_for_each_entry(comp_node, &mdp->comp_list, node) + mtk_mdp_comp_clock_off(dev, comp_node); } static void mtk_mdp_wdt_worker(struct work_struct *work) @@ -91,12 +91,25 @@ static void mtk_mdp_reset_handler(void *priv) queue_work(mdp->wdt_wq, &mdp->wdt_work); } +void mtk_mdp_register_component(struct mtk_mdp_dev *mdp, + struct mtk_mdp_comp *comp) +{ + list_add(&mdp->comp_list, &comp->node); +} + +void mtk_mdp_unregister_component(struct mtk_mdp_dev *mdp, + struct mtk_mdp_comp *comp) +{ + list_del(&comp->node); +} + static int mtk_mdp_probe(struct platform_device *pdev) { struct mtk_mdp_dev *mdp; struct device *dev = &pdev->dev; struct device_node *node, *parent; - int i, ret = 0; + struct mtk_mdp_comp *comp, *comp_temp; + int ret = 0; mdp = devm_kzalloc(dev, sizeof(*mdp), GFP_KERNEL); if (!mdp) @@ -104,6 +117,7 @@ static int mtk_mdp_probe(struct platform_device *pdev) mdp->id = pdev->id; mdp->pdev = pdev; + INIT_LIST_HEAD(&mdp->comp_list); INIT_LIST_HEAD(&mdp->ctx_list); mutex_init(&mdp->lock); @@ -124,7 +138,6 @@ static int mtk_mdp_probe(struct platform_device *pdev) const struct of_device_id *of_id; enum mtk_mdp_comp_type comp_type; int comp_id; - struct mtk_mdp_comp *comp; of_id = of_match_node(mtk_mdp_comp_dt_ids, node); if (!of_id) @@ -150,13 +163,14 @@ static int mtk_mdp_probe(struct platform_device *pdev) of_node_put(node); goto err_comp; } - mdp->comp[comp_id] = comp; ret = mtk_mdp_comp_init(dev, node, comp, comp_id); if (ret) { of_node_put(node); goto err_comp; } + + mtk_mdp_register_component(mdp, comp); } mdp->job_wq = create_singlethread_workqueue(MTK_MDP_MODULE_NAME); @@ -224,8 +238,10 @@ static int mtk_mdp_probe(struct platform_device *pdev) err_alloc_job_wq: err_comp: - for (i = 0; i < ARRAY_SIZE(mdp->comp); i++) - mtk_mdp_comp_deinit(dev, mdp->comp[i]); + list_for_each_entry_safe(comp, comp_temp, &mdp->comp_list, node) { + mtk_mdp_unregister_component(mdp, comp); + mtk_mdp_comp_deinit(dev, comp); + } dev_dbg(dev, "err %d\n", ret); return ret; @@ -234,7 +250,7 @@ static int mtk_mdp_probe(struct platform_device *pdev) static int mtk_mdp_remove(struct platform_device *pdev) { struct mtk_mdp_dev *mdp = platform_get_drvdata(pdev); - int i; + struct mtk_mdp_comp *comp, *comp_temp; pm_runtime_disable(&pdev->dev); vb2_dma_contig_clear_max_seg_size(&pdev->dev); @@ -247,8 +263,10 @@ static int mtk_mdp_remove(struct platform_device *pdev) flush_workqueue(mdp->job_wq); destroy_workqueue(mdp->job_wq); - for (i = 0; i < ARRAY_SIZE(mdp->comp); i++) - mtk_mdp_comp_deinit(&pdev->dev, mdp->comp[i]); + list_for_each_entry_safe(comp, comp_temp, &mdp->comp_list, node) { + mtk_mdp_unregister_component(mdp, comp); + mtk_mdp_comp_deinit(&pdev->dev, comp); + } dev_dbg(&pdev->dev, "%s driver unloaded\n", pdev->name); return 0; diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_core.h b/drivers/media/platform/mtk-mdp/mtk_mdp_core.h index dd130cc218c9..a7da14b97077 100644 --- a/drivers/media/platform/mtk-mdp/mtk_mdp_core.h +++ b/drivers/media/platform/mtk-mdp/mtk_mdp_core.h @@ -136,7 +136,7 @@ struct mtk_mdp_variant { * @pdev: pointer to the image processor platform device * @variant: the IP variant information * @id: image processor device index (0..MTK_MDP_MAX_DEVS) - * @comp: MDP function components + * @comp_list: list of MDP function components * @m2m_dev: v4l2 memory-to-memory device data * @ctx_list: list of struct mtk_mdp_ctx * @vdev: video device for image processor driver @@ -154,7 +154,7 @@ struct mtk_mdp_dev { struct platform_device *pdev; struct mtk_mdp_variant *variant; u16 id; - struct mtk_mdp_comp *comp[MTK_MDP_COMP_ID_MAX]; + struct list_head comp_list; struct v4l2_m2m_dev *m2m_dev; struct list_head ctx_list; struct video_device *vdev; @@ -221,6 +221,12 @@ struct mtk_mdp_ctx { extern int mtk_mdp_dbg_level; +void mtk_mdp_register_component(struct mtk_mdp_dev *mdp, + struct mtk_mdp_comp *comp); + +void mtk_mdp_unregister_component(struct mtk_mdp_dev *mdp, + struct mtk_mdp_comp *comp); + #if defined(DEBUG) #define mtk_mdp_dbg(level, fmt, args...) \ From patchwork Tue May 5 04:00:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eizan Miyamoto X-Patchwork-Id: 11528173 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9ABF792A for ; Tue, 5 May 2020 04:02:39 +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 781E720752 for ; Tue, 5 May 2020 04:02:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="lSzgWSjL"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="VbujnOEQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 781E720752 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=CaHI8h1xu1EfdycKl/4DriOKXI8/180QTFjXe7mG0+4=; b=lSzgWSjL67fFwz EqaZVXnUSmtb+m8yF/YTz3GOHb7QHqouGVIxvVPI7FAIOCkD8baOS43ddvTIxEYpzcJA9sf0nelnk oR0F2h8F1fdoPbVrUNfScbltv8AflXiIvKS4kf9EpaQtZ4CFLgH9GWF9voyF6K0KyE7MJfKJ4Hi7r LkiuXZ3cNRKUV//KXj6eeP729twKyikPx27dscHiArPkqX386IM4sj9Qli6Gpdm2cXPsDDoxQV6FB xsUB7Y8YdUYpu9nB2MmWW5ASDy7AWuUZXc52M8ZZduegBqtUrsqJWXQgW+zyEVFA9IR+zl1zB+vUt /atSQNZd1vUyUzHX53IA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jVomu-0004Ty-OR; Tue, 05 May 2020 04:02:32 +0000 Received: from mail-pj1-x1044.google.com ([2607:f8b0:4864:20::1044]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jVomB-0003mK-RS for linux-arm-kernel@lists.infradead.org; Tue, 05 May 2020 04:01:49 +0000 Received: by mail-pj1-x1044.google.com with SMTP id a7so440316pju.2 for ; Mon, 04 May 2020 21:01:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bpjBtLncAz/kkdJRFvfwLGKHTuYx2q9S+ZoV2LMI0sk=; b=VbujnOEQMZDOvKD6JgULstaRPp5TbWOJsPdLxFzzgVi40j4j8tuBRSRFvpvzoBkYSf lO0M+ZVsf9myuBszhMt2QSGHGtU8kRpUIR3mj4IohA7wnTGIa+SgSww71z3yb4RyOP7h GcXDBs1AcsM+5xTCfeK0etclI1e+Xtsxuhr5M= 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=bpjBtLncAz/kkdJRFvfwLGKHTuYx2q9S+ZoV2LMI0sk=; b=qBqA7rs4SKwbHBKAluFMFl8+fzDDJVEq+ZJQLEK2YbojoLvGfWrKYGZk7/XLYCl/K8 HI1lm10joFHdmGgWaDE9A5EczC2YQQiJ8+IHYfHQSS1a/WUHdDbCH2xCmu+zSaqlLFhE amAey2SCoUPQi6DKnK7njJNq3n4kFlg3EaOaQBpXxYKTm9yBqd91fPu6hWq1biwyQ96N k06tG8Yg/9BmBIedQHVW+bhBEvuFDeCcgpgahIkSPA++T+THC9wrWfPYT2loDm0FV69D P+ayFGUOX5O/hcKG1aShpj1JFYfgSwAN7ssFaaqzWtQEDn01FkI7QB5hjMjF3BqXcOGY aucQ== X-Gm-Message-State: AGi0PuZlQ+sa3S8Du1CEa3hc+hli+T0/bQxPsvsrfWks529NWZ4JnH5k U27lDSswAs0YJSqV9j0QrCnhFA== X-Google-Smtp-Source: APiQypIIT08h1AWzqb1iRTGb9ruvQSlZZOU8/i1YaxP5EHPA9oPU9ul/hj4nqNSO5G0FMS7NhYGjDA== X-Received: by 2002:a17:90a:25cb:: with SMTP id k69mr514820pje.93.1588651307182; Mon, 04 May 2020 21:01:47 -0700 (PDT) Received: from localhost ([2401:fa00:9:14:a92f:c47d:76a8:b09e]) by smtp.gmail.com with ESMTPSA id x132sm588010pfc.57.2020.05.04.21.01.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 04 May 2020 21:01:46 -0700 (PDT) From: Eizan Miyamoto X-Google-Original-From: Eizan Miyamoto To: LKML Subject: [PATCH v1 5/5] [media] mtk-mdp: Remove mtk_mdp_comp.id and supporting functionality Date: Tue, 5 May 2020 14:00:48 +1000 Message-Id: <20200505125042.v1.5.I1c85bddc262913b8572d892dd6bf9bc03fbe0ec7@changeid> X-Mailer: git-send-email 2.26.2.526.g744177e7f7-goog In-Reply-To: <20200505040048.132493-1-eizan@google.com> References: <20200505040048.132493-1-eizan@google.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200504_210147_894398_DC4B6941 X-CRM114-Status: GOOD ( 15.24 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:1044 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew-CT Chen , Minghsiu Tsai , Houlong Wei , Eizan Miyamoto , eizan@chromium.org, linux-mediatek@lists.infradead.org, Matthias Brugger , Mauro Carvalho Chehab , linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Since components are registered in a list, the numeric component id that specified a location in an array is not necessary. Signed-off-by: eizan@chromium.org Signed-off-by: Eizan Miyamoto --- drivers/media/platform/mtk-mdp/mtk_mdp_comp.c | 60 +++---------------- drivers/media/platform/mtk-mdp/mtk_mdp_comp.h | 19 +----- drivers/media/platform/mtk-mdp/mtk_mdp_core.c | 10 +--- 3 files changed, 11 insertions(+), 78 deletions(-) diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c b/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c index d4afed1363d5..362fff924aef 100644 --- a/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c +++ b/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c @@ -14,46 +14,6 @@ #include "mtk_mdp_comp.h" -static const char * const mtk_mdp_comp_stem[MTK_MDP_COMP_TYPE_MAX] = { - "mdp_rdma", - "mdp_rsz", - "mdp_wdma", - "mdp_wrot", -}; - -struct mtk_mdp_comp_match { - enum mtk_mdp_comp_type type; - int alias_id; -}; - -static const struct mtk_mdp_comp_match mtk_mdp_matches[MTK_MDP_COMP_ID_MAX] = { - { MTK_MDP_RDMA, 0 }, - { MTK_MDP_RDMA, 1 }, - { MTK_MDP_RSZ, 0 }, - { MTK_MDP_RSZ, 1 }, - { MTK_MDP_RSZ, 2 }, - { MTK_MDP_WDMA, 0 }, - { MTK_MDP_WROT, 0 }, - { MTK_MDP_WROT, 1 }, -}; - -int mtk_mdp_comp_get_id(struct device *dev, struct device_node *node, - enum mtk_mdp_comp_type comp_type) -{ - int id = of_alias_get_id(node, mtk_mdp_comp_stem[comp_type]); - int i; - - for (i = 0; i < ARRAY_SIZE(mtk_mdp_matches); i++) { - if (comp_type == mtk_mdp_matches[i].type && - id == mtk_mdp_matches[i].alias_id) - return i; - } - - dev_err(dev, "Failed to get id. type: %d, id: %d\n", comp_type, id); - - return -EINVAL; -} - void mtk_mdp_comp_clock_on(struct device *dev, struct mtk_mdp_comp *comp) { int i, err; @@ -62,8 +22,8 @@ void mtk_mdp_comp_clock_on(struct device *dev, struct mtk_mdp_comp *comp) err = mtk_smi_larb_get(comp->larb_dev); if (err) dev_err(dev, - "failed to get larb, err %d. type:%d id:%d\n", - err, comp->type, comp->id); + "failed to get larb, err %d. type:%d\n", + err, comp->type); } for (i = 0; i < ARRAY_SIZE(comp->clk); i++) { @@ -72,8 +32,8 @@ void mtk_mdp_comp_clock_on(struct device *dev, struct mtk_mdp_comp *comp) err = clk_prepare_enable(comp->clk[i]); if (err) dev_err(dev, - "failed to enable clock, err %d. type:%d id:%d i:%d\n", - err, comp->type, comp->id, i); + "failed to enable clock, err %d. type:%d i:%d\n", + err, comp->type, i); } } @@ -92,21 +52,15 @@ void mtk_mdp_comp_clock_off(struct device *dev, struct mtk_mdp_comp *comp) } int mtk_mdp_comp_init(struct device *dev, struct device_node *node, - struct mtk_mdp_comp *comp, enum mtk_mdp_comp_id comp_id) + struct mtk_mdp_comp *comp, + enum mtk_mdp_comp_type comp_type) { struct device_node *larb_node; struct platform_device *larb_pdev; int i; - if (comp_id < 0 || comp_id >= MTK_MDP_COMP_ID_MAX) { - dev_err(dev, "Invalid comp_id %d\n", comp_id); - return -EINVAL; - } - - INIT_LIST_HEAD(&comp->node); comp->dev_node = of_node_get(node); - comp->id = comp_id; - comp->type = mtk_mdp_matches[comp_id].type; + comp->type = comp_type; for (i = 0; i < ARRAY_SIZE(comp->clk); i++) { comp->clk[i] = of_clk_get(node, i); diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_comp.h b/drivers/media/platform/mtk-mdp/mtk_mdp_comp.h index 1f745891c6c3..1bf0242cce46 100644 --- a/drivers/media/platform/mtk-mdp/mtk_mdp_comp.h +++ b/drivers/media/platform/mtk-mdp/mtk_mdp_comp.h @@ -22,18 +22,6 @@ enum mtk_mdp_comp_type { MTK_MDP_COMP_TYPE_MAX, }; -enum mtk_mdp_comp_id { - MTK_MDP_COMP_RDMA0, - MTK_MDP_COMP_RDMA1, - MTK_MDP_COMP_RSZ0, - MTK_MDP_COMP_RSZ1, - MTK_MDP_COMP_RSZ2, - MTK_MDP_COMP_WDMA, - MTK_MDP_COMP_WROT0, - MTK_MDP_COMP_WROT1, - MTK_MDP_COMP_ID_MAX, -}; - /** * struct mtk_mdp_comp - the MDP's function component data * @node: list node to track sibing MDP components @@ -41,7 +29,6 @@ enum mtk_mdp_comp_id { * @clk: clocks required for component * @larb_dev: SMI device required for component * @type: component type - * @id: component ID */ struct mtk_mdp_comp { struct list_head node; @@ -49,14 +36,12 @@ struct mtk_mdp_comp { struct clk *clk[2]; struct device *larb_dev; enum mtk_mdp_comp_type type; - enum mtk_mdp_comp_id id; }; int mtk_mdp_comp_init(struct device *dev, struct device_node *node, - struct mtk_mdp_comp *comp, enum mtk_mdp_comp_id comp_id); + struct mtk_mdp_comp *comp, + enum mtk_mdp_comp_type comp_type); void mtk_mdp_comp_deinit(struct device *dev, struct mtk_mdp_comp *comp); -int mtk_mdp_comp_get_id(struct device *dev, struct device_node *node, - enum mtk_mdp_comp_type comp_type); void mtk_mdp_comp_clock_on(struct device *dev, struct mtk_mdp_comp *comp); void mtk_mdp_comp_clock_off(struct device *dev, struct mtk_mdp_comp *comp); diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_core.c b/drivers/media/platform/mtk-mdp/mtk_mdp_core.c index e6e702d9cb69..b1227c99569a 100644 --- a/drivers/media/platform/mtk-mdp/mtk_mdp_core.c +++ b/drivers/media/platform/mtk-mdp/mtk_mdp_core.c @@ -137,7 +137,6 @@ static int mtk_mdp_probe(struct platform_device *pdev) for_each_child_of_node(parent, node) { const struct of_device_id *of_id; enum mtk_mdp_comp_type comp_type; - int comp_id; of_id = of_match_node(mtk_mdp_comp_dt_ids, node); if (!of_id) @@ -150,12 +149,7 @@ static int mtk_mdp_probe(struct platform_device *pdev) } comp_type = (enum mtk_mdp_comp_type)of_id->data; - comp_id = mtk_mdp_comp_get_id(dev, node, comp_type); - if (comp_id < 0) { - dev_warn(dev, "Skipping unknown component %pOF\n", - node); - continue; - } + comp = devm_kzalloc(dev, sizeof(*comp), GFP_KERNEL); if (!comp) { @@ -164,7 +158,7 @@ static int mtk_mdp_probe(struct platform_device *pdev) goto err_comp; } - ret = mtk_mdp_comp_init(dev, node, comp, comp_id); + ret = mtk_mdp_comp_init(dev, node, comp, comp_type); if (ret) { of_node_put(node); goto err_comp;