From patchwork Thu May 7 10:23:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eizan Miyamoto X-Patchwork-Id: 11532997 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 0161E139A for ; Thu, 7 May 2020 10:24:51 +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 D3839208E4 for ; Thu, 7 May 2020 10:24:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Nev3DFrP"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="bFZX//5u" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D3839208E4 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-mediatek-bounces+patchwork-linux-mediatek=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=NeL/i2HR0/tWsIa0O/f1KuTshfaNYNWaigYZh9rbdF0=; b=Nev3DFrP1QpnA9 cAP2baZq20FeJbPCZytNTpw8gSlXz8V42bHin/VVlR+M7Lc9BHHi+cv5TNI4xC9WNT7e++wJmRFAw Eb1nbSuW9eRR4oLyS3WYLNIp+z80QpRqH8gGXZPb/On0Du+wn5ZbH1gmp7IcMzIpqU12xHVrrM9nz y090cCcl9fE9JFMar394R6ROjEtZ2obuZWwK7Ffet+Hh49m1TWStWzpOEnbepJg/KHmS4MtYdYokp 2457L5vYctk3Sd1C9MqpSO/X+ad2XXE1+4yPhyrX2gwcSGCpSTmTokDZK9qKdXZ9mXJyJptKMRYBM KNXPiQ+DkYZBO7e2PiEg==; 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 1jWdhw-00084y-Rt; Thu, 07 May 2020 10:24:48 +0000 Received: from mail-pj1-x1043.google.com ([2607:f8b0:4864:20::1043]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jWdhQ-0007c5-9v for linux-mediatek@lists.infradead.org; Thu, 07 May 2020 10:24:17 +0000 Received: by mail-pj1-x1043.google.com with SMTP id e6so2428102pjt.4 for ; Thu, 07 May 2020 03:24:15 -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=oo1xnFJoKnJRPCb1k/kpUqpuervQpCi0IylZD35uCtU=; b=bFZX//5u1biNAhAdVXKnxlQhgXZg0E2/qIYtejPF3hTyPzdudv+Hhol6yhMhe+pLXR qi4+lJDJD7wqFhb1fbU2HQ7nJpMx8oxCrZRVXU3DeP/7FtrWOGlSHLeIoomLn/ZIuZt1 UiMxHSLmOE2/9gbS6u8Dw1em28VAE3YDr4jx0= 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=oo1xnFJoKnJRPCb1k/kpUqpuervQpCi0IylZD35uCtU=; b=t+ghJ9XVZ6N9CRCcddpScJ8RWm8YrOTHIJMDFz4n2w8detxI+MsArErLcxiqkCMp6V lZ6bNDsErxzt46y5rgTeAVOiRb+MzRE+zbi+SIPoeoClMb/SZ1AiUrQHNUzx2XS2gbgk TSZa5OZdteg0GZczx9IVmDPREbKoOonwmUk9cA4uUW6/n3O3myNFNGHTO5+UlBo1w0Lb lffbo5jJgh2/Kl4Zf3m17nwBw2l6Q+6NRRutyAvl1GI1xk/8zvPJDf46GuB6aQ/J/6oe KETjWf+eIvm5/a32l8onEmhYPV3Hhyw5egEC70oOmLn1lZRZOgHiMnkXAso5iOsiYFQi 28AA== X-Gm-Message-State: AGi0PuYL+zFvTWKeg6J4AJTQ9W7a/707d7giTvUmZaFY890dUydNlyEe S5uT19BgsqW5Tp1t2waKUjS53Q== X-Google-Smtp-Source: APiQypK0Yj463Sz55i7hlJ8Wfduxc6jBmzjwL3+Xbpt0RRZaW6Bed1aBCs2s4nzl9RneQvMrKQc2Lw== X-Received: by 2002:a17:90a:24e6:: with SMTP id i93mr14512370pje.13.1588847055212; Thu, 07 May 2020 03:24:15 -0700 (PDT) Received: from localhost ([2401:fa00:9:14:a92f:c47d:76a8:b09e]) by smtp.gmail.com with ESMTPSA id i185sm4408872pfg.14.2020.05.07.03.24.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 07 May 2020 03:24:14 -0700 (PDT) From: Eizan Miyamoto To: LKML Subject: [PATCH v3 1/5] [media] mtk-mdp: remove mtk_mdp_comp.regs from mtk_mdp_comp.h Date: Thu, 7 May 2020 20:23:42 +1000 Message-Id: <20200507202337.v3.1.I0d52fd84fe481e254a10960b060f32c47ce0d202@changeid> X-Mailer: git-send-email 2.26.2.526.g744177e7f7-goog In-Reply-To: <20200507102345.81849-1-eizan@chromium.org> References: <20200507102345.81849-1-eizan@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200507_032416_369682_C8CECEFE X-CRM114-Status: UNSURE ( 8.63 ) 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:1043 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -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 Message has at least one valid DKIM or DK signature -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender X-BeenThere: linux-mediatek@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 , Matthias Brugger , Enric Balletbo I Serra , linux-mediatek@lists.infradead.org, Mauro Carvalho Chehab , linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org These fields are not used and can be removed. Signed-off-by: Eizan Miyamoto Reviewed-by: Enric Balletbo I Serra --- Changes in v3: None Changes in v2: None 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 58abfbdfb82d..c76cd61fb178 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 Thu May 7 10:23: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: 11533005 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 39B83139A for ; Thu, 7 May 2020 10:25:22 +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 157C6208E4 for ; Thu, 7 May 2020 10:25:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="rm5KPoK7"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="GNMgHUHa" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 157C6208E4 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-mediatek-bounces+patchwork-linux-mediatek=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=x7kQXlYzh3iRsjNHX9ATiofTPjoelePcpDOx3slkDUQ=; b=rm5KPoK7GGb1ro aVDDuBH4xwyC6TTR5r77DnnNL0g4Br38LR0xmoBy2qt6VKStIrERkLePjksBfzuq4r+ztvmS+73b/ SlYXqfjTkUj5D48+H3RdCbRnbv7/xX9Is8Z5qK4Zk0UrWh/OBfBtMDxY1tWMM8Q+JB2PTC1ZfPGcY TaGR701aAqkvX9t5T5vA/jtku28A1qX754Re6q4BNtcTPSXNMZd4IvvGovi5TLbkYFplKy5CeZK0s 6lrsf4Uf602mJa/6s4cMGcBQ44Gqzg0x2Y6KQP8IC32c4rDuTTjZzqmNsHY4jo6NYKNjtAJR1i9MO GWgsefrCy9YbtyrT1I3Q==; 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 1jWdiS-0002O3-IL; Thu, 07 May 2020 10:25:20 +0000 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jWdhh-0007rh-8s for linux-mediatek@lists.infradead.org; Thu, 07 May 2020 10:24:34 +0000 Received: by mail-pg1-x544.google.com with SMTP id s18so2323945pgl.12 for ; Thu, 07 May 2020 03:24:32 -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=uayLP2IQIIMajpdlHbzdkBKHnRVFxtyMOMcfphNpLD0=; b=GNMgHUHacwUvRBlDY0qArxRb4Pu+eWtZHMaGVHLWsilTyL8VGV+tTJxWb2nMRZdoEr xamhmauOh8CrNbLvXypYcr9cM5xkCl36Xi5ODaECqcmO8/fbNNAhFJBSKsPF8+d+2rW6 t52imrK2WKyuJMQ4xYUNExzjoG8mXm/7OAnQE= 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=uayLP2IQIIMajpdlHbzdkBKHnRVFxtyMOMcfphNpLD0=; b=ZO7VGBeb2M+V7r7RoGbZ+B9rBaemloYKMq8XWrRLzar1LUZYkg9iyTpstUgLAKJwyu al/B8JOS6/zgmcmPbJIWuiQg4W8jUKT3hNufXMYOdv5hG8ygsvXyIvczoepCfTqgAFBM HZoElzcCOwhuk++lmu7mxTu6XDqeXmMViM6g/rN2vh3BSPuB4YuqLJ7O1F1K50sq3fkK 3IqvTSc02f5HkEtdPjswRqi+L1bTwHPqfUtlkSAw216862pmNPhn2kkEp039/7Fvw95I 2HifnHkMLQhLk/D9GO9k2+ksLzQu6FYGc+zVVU9TDzHw+3+yoJm/wHTqGCak/p6PYBwW Z+4w== X-Gm-Message-State: AGi0PubvZX9L5pbXloOreA0pvUjYfqOKnLfBXZWHTWkvdkubM1cq72qA nvHsh2vSztBgim1L2iIPY/0abQ== X-Google-Smtp-Source: APiQypLYecQMcanYHXpWS67HlqoWpLrEJDzi2gez5ZNWrCDgTREBk/pph4o5wU3OqaQZOryRyKhRBw== X-Received: by 2002:a63:a61:: with SMTP id z33mr10826593pgk.440.1588847071729; Thu, 07 May 2020 03:24:31 -0700 (PDT) Received: from localhost ([2401:fa00:9:14:a92f:c47d:76a8:b09e]) by smtp.gmail.com with ESMTPSA id 6sm4503318pfj.123.2020.05.07.03.24.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 07 May 2020 03:24:31 -0700 (PDT) From: Eizan Miyamoto To: LKML Subject: [PATCH v3 2/5] [media] mtk-mdp: handle vb2_dma_contig_set_max_seg_size errors during probe Date: Thu, 7 May 2020 20:23:44 +1000 Message-Id: <20200507202337.v3.2.If340fa06d86053aaea25841b36741fe69c3126dd@changeid> X-Mailer: git-send-email 2.26.2.526.g744177e7f7-goog In-Reply-To: <20200507102345.81849-1-eizan@chromium.org> References: <20200507102345.81849-1-eizan@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200507_032433_323959_D20A038D X-CRM114-Status: GOOD ( 10.70 ) 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:544 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -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 Message has at least one valid DKIM or DK signature -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender X-BeenThere: linux-mediatek@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 , Matthias Brugger , Enric Balletbo i Serra , linux-mediatek@lists.infradead.org, Mauro Carvalho Chehab , linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org This is a cleanup to better handle errors during MDP probe. Signed-off-by: Eizan Miyamoto Reviewed-by: Enric Balletbo i Serra --- Changes in v3: None Changes in v2: - remove unnecessary error handling labels in favor of err_m2m_register drivers/media/platform/mtk-mdp/mtk_mdp_core.c | 6 +++++- 1 file changed, 5 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..9b24b8d46eb7 100644 --- a/drivers/media/platform/mtk-mdp/mtk_mdp_core.c +++ b/drivers/media/platform/mtk-mdp/mtk_mdp_core.c @@ -193,7 +193,11 @@ 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_m2m_register; + } pm_runtime_enable(dev); dev_dbg(dev, "mdp-%d registered successfully\n", mdp->id); From patchwork Thu May 7 10:23: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: 11533007 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 CD459139A for ; Thu, 7 May 2020 10:25:24 +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 AB8C92075E for ; Thu, 7 May 2020 10:25:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="jCRfwF/D"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="Uw9tkn4t" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AB8C92075E 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-mediatek-bounces+patchwork-linux-mediatek=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=Iy4eq1Xg3ESLPuhB0X4iEAwyQaOgfPXs2XKOBDE2Mzo=; b=jCRfwF/D/FTKEf aM962Lx8Sc8ZbDevsPmOc2NtXwkY+9j4RDx/ZP1P0yWfEUPYLFD0fBPzQKRqeO0zxxIXD8+tEY7kc WIFkSAKOsh1CRkGzbFUFqYviA1qKAV7+rsJ0OrWD4KKMO5HsUBkyEuzBrN7wh+PUhSyRVuAhJfNay Xeq4u0hKH2cT0PeH9DyqzUUF1WOWgpKn1g7CtgLDg1dthAlec3osZdpy8R+At68XNnYoZOP3eKM3t AnwRQ+fbnBJPywRP4pQJLSuS8UW25GGi9ZM4DDh+AfzArZ8nim+kuT8ydtP5Aussx5WaINkH5XWPZ T1U8KcEYb7nNjNY2Y3jA==; 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 1jWdiU-0002RH-UE; Thu, 07 May 2020 10:25:22 +0000 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jWdhw-00084V-Mf for linux-mediatek@lists.infradead.org; Thu, 07 May 2020 10:24:51 +0000 Received: by mail-pl1-x642.google.com with SMTP id f8so1902139plt.2 for ; Thu, 07 May 2020 03:24:48 -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=B/Mk9PnpQZ4xKWEBXlLMDvhktcZ9bgwGO85pTWBmd1Q=; b=Uw9tkn4tmqYAbTMf70CLe39oO9q1CC6aVjLT1Rme6khxLYX4hxUID3ZnvBSZGakv5P cGKuKJqk2HPHbQ4P1iQd69NwgL2xHQejKzAHF3MGaRFbXyURliEk1oHrAxQepDxSyXed VFbE4tH2UIH74TV9w+cRWY5I37BG/H1vO1EhM= 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=B/Mk9PnpQZ4xKWEBXlLMDvhktcZ9bgwGO85pTWBmd1Q=; b=IqsDLtDNjHVwKKJirs2pe4hWC8V++CAqnEn3wUdcx40XjQuxbFEluGHewT8mszhweF LSyCWdtmdzEyQLbGXjV67PQsMUqUvqoxsBbIttsO09Xr2796PTI4RnF8+gBwreNijS62 iUttWF6Bjt8IygxZAo32ETt8ioK+FnJ7PVQ1SYTJAQWMoT2nl6aY1LiV2HvtmCtzHDR6 DKUyKYlQwS7WA6BbU9ozAcRAbYcsZKlL160DuXPm0AZYl0SoahWQixy6Nwd4ZLtc6Pai NQy4t7oj1ikR4cqw/NR1XGYEqwQzvzZYY0dVSsZEUp2K4zzo39y6ANutQyDwSJWTC2L0 xSig== X-Gm-Message-State: AGi0Pub8BlTO+wHI0Yhi4HSMU0Sy9yNVUKw+QFr222UtFttGYnHoQLmS st9AbDG81UMBSNheBhCECYMfaQ== X-Google-Smtp-Source: APiQypIfdyYf1DVe2NADcLWJNyPuVcmkF60Nyz26uFMfQ6Htik4/hMklktg3MMP3+ePUbdo+ebw1vA== X-Received: by 2002:a17:90a:b78e:: with SMTP id m14mr2742862pjr.114.1588847088130; Thu, 07 May 2020 03:24:48 -0700 (PDT) Received: from localhost ([2401:fa00:9:14:a92f:c47d:76a8:b09e]) by smtp.gmail.com with ESMTPSA id a138sm4514903pfd.32.2020.05.07.03.24.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 07 May 2020 03:24:47 -0700 (PDT) From: Eizan Miyamoto To: LKML Subject: [PATCH v3 3/5] [media] mtk-mdp: handle vpu_wdt_reg_handler() errors during probe Date: Thu, 7 May 2020 20:23:46 +1000 Message-Id: <20200507202337.v3.3.Ia8efd7905e2fcfc81f547e27a51f06373624b3da@changeid> X-Mailer: git-send-email 2.26.2.526.g744177e7f7-goog In-Reply-To: <20200507102345.81849-1-eizan@chromium.org> References: <20200507102345.81849-1-eizan@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200507_032448_749167_0B9D0154 X-CRM114-Status: GOOD ( 10.65 ) 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:642 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -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 Message has at least one valid DKIM or DK signature -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender X-BeenThere: linux-mediatek@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 , Matthias Brugger , Enric Balletbo i Serra , linux-mediatek@lists.infradead.org, Mauro Carvalho Chehab , linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org This is a cleanup to better handle errors during MDP probe. Signed-off-by: Eizan Miyamoto Reviewed-by: Enric Balletbo i Serra --- Changes in v3: None Changes in v2: - remove unnecessary error handling labels in favor of err_m2m_register drivers/media/platform/mtk-mdp/mtk_mdp_core.c | 8 ++++++-- 1 file changed, 6 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 9b24b8d46eb7..17d155219ba2 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_m2m_register; + } platform_set_drvdata(pdev, mdp); From patchwork Thu May 7 10:23: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: 11533017 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 AC66C14C0 for ; Thu, 7 May 2020 10:26:19 +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 7B8FE2075E for ; Thu, 7 May 2020 10:26:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="kh1stidB"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="H7j39yb2" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7B8FE2075E 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-mediatek-bounces+patchwork-linux-mediatek=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=voQC2E6kPOJZ9THxVuAVQ+u9VMTSdeUiQGJoF1COedc=; b=kh1stidBf9AchG 0hBOGIleEAWDp1lWcylopyFJN7f2ad9kUYuzj6t8QjdFSqxvBzX394VUmBJ+duPN3awxABw+wp0tJ NRr8p0ITDWbD9dUe41EPgfVYgSML7zcC6WWAb2YemruPHRjVd/usrec47Nm+iQCX0gE4M2JrcctMG RWp4XfmerzqzztZtSEBuqRPcQlJCKqXgMx7EYa7BBLnYNWzGWJNhwg7Zb3kjNtem7/68GpTJ5NUNr ibAeIG2mPUaRE0h3j6ShaecUNSkQzMmwzIO5pr5RKonPImqx54fmUT89AWQb0RLxyatTgBujQewqS mUJs5UG70fwUB0WWt1rw==; 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 1jWdjN-0003D5-LX; Thu, 07 May 2020 10:26:17 +0000 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jWdiI-0001Bi-Lc for linux-mediatek@lists.infradead.org; Thu, 07 May 2020 10:25:15 +0000 Received: by mail-pl1-x642.google.com with SMTP id f15so1902265plr.3 for ; Thu, 07 May 2020 03:25:10 -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=8cJsBp+EOXNRCmgk1ug3bfc2/ttTB2kMHJOkU+Y+o8w=; b=H7j39yb2k+XzcTJ6ncmva9Oe4ssQ47Z5wYyQS0/DnmAGms7PhCqbCH6niF7jW/W274 tU4PHWbVunVxDfKxT2ms9w9sL8Nc0qzCujiLi2rYkgAlCOLOZSUxglIh3lsPvmWLbeeQ zKMgALmUvPZWJw1CuKp75LwMIA/DRKBK52Jxc= 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=8cJsBp+EOXNRCmgk1ug3bfc2/ttTB2kMHJOkU+Y+o8w=; b=umaMn9LXdrzQoZEqfN7A6LIQ1NEsRe8zpG0Ld6CKUUziicbowPtUf+CY65u8g+oyB1 O77ez3g/29SG+6dUkKBWyxjAr2/5HsOuWj73pPCttZm+fC+u8o8bjWkYJOETlCIP4oCE lD99+EFEVEImqiQNS+x54JBpY7htlLkHKNf/6Lim99T+N5pQSZuSJuPDY6BSlnegS4hp OVzcjtd+INS37plggzM8a9nLj6cCwBJQa1Se+xdQtPMShBkIak6mOM29BgCT2Q9gOoGr IPji4HTdkAXXJQEq2bwE6Zpsa88jDOovu7eYT4me9muZQRlCtGYKqHTFr6tiLIPx66oX Amzw== X-Gm-Message-State: AGi0PuYSG8rqArFM2AdAI87DLWGqYkKjSyz73cA4A+p4lBIa4YVclE30 oubzh+K0sQZ5SSkulmkx+y3VaTb7U24= X-Google-Smtp-Source: APiQypKVroCJHaGCjBiL6U8KsbIvrlrx4Udr2zwOYfB1N8nXUOGsewudXLu4qjQ/SI19VwYVg9KMdQ== X-Received: by 2002:a17:902:40a:: with SMTP id 10mr12231101ple.183.1588847109077; Thu, 07 May 2020 03:25:09 -0700 (PDT) Received: from localhost ([2401:fa00:9:14:a92f:c47d:76a8:b09e]) by smtp.gmail.com with ESMTPSA id g14sm4458765pfh.49.2020.05.07.03.25.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 07 May 2020 03:25:08 -0700 (PDT) From: Eizan Miyamoto To: LKML Subject: [PATCH v3 4/5] [media] mtk-mdp: convert mtk_mdp_dev.comp array to list Date: Thu, 7 May 2020 20:23:48 +1000 Message-Id: <20200507202337.v3.4.I22b7dfc5e6977f5c149f82594832b5bd1d978af9@changeid> X-Mailer: git-send-email 2.26.2.526.g744177e7f7-goog In-Reply-To: <20200507102345.81849-1-eizan@chromium.org> References: <20200507102345.81849-1-eizan@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200507_032511_747200_80D7B825 X-CRM114-Status: GOOD ( 15.01 ) 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:642 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -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 Message has at least one valid DKIM or DK signature -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender X-BeenThere: linux-mediatek@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 , Matthias Brugger , Enric Balletbo I Serra , linux-mediatek@lists.infradead.org, Mauro Carvalho Chehab , linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=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 Miyamoto Reviewed-by: Enric Balletbo I Serra --- Changes in v3: None Changes in v2: None 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 c76cd61fb178..da2bdad7a8d1 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 17d155219ba2..40b9fda8b03b 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); @@ -220,8 +234,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; @@ -230,7 +246,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); @@ -243,8 +259,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 bafcccd71f31..1de825386da7 100644 --- a/drivers/media/platform/mtk-mdp/mtk_mdp_core.h +++ b/drivers/media/platform/mtk-mdp/mtk_mdp_core.h @@ -138,7 +138,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 @@ -156,7 +156,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; @@ -223,6 +223,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 Thu May 7 10:23:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eizan Miyamoto X-Patchwork-Id: 11533019 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 573A614C0 for ; Thu, 7 May 2020 10:26: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 357E72075E for ; Thu, 7 May 2020 10:26: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="q+LfOEqn"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="HwjlF1N6" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 357E72075E 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-mediatek-bounces+patchwork-linux-mediatek=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=+Tl+dclb0cGrPfimfaI2iemrzuZ/z3mHJimjqwm/zHk=; b=q+LfOEqnschKoO Dd4lNLHQUKoMLM9l6hyxIQC8J7OmfwKORj7WY27FnG6y6qNuar2bOod1ak3eFPq84dH6TRzm5Mt2J ToLV9qqTGqJp57ry+IO10u5sN5h58M4Nq6cMecnL98H+q5qlnFT+vz3+J3NdcfkdB8hzNEOYrVrXL GOXlO/I/Xu2PJO7GJAqeNzMa17KehXyVWHtmOixaQKZ4ES3H+41Z4SDO5JnaO9nZpm32gd9PnabaX EGRmXNLS47luikrZtqpkKtCkdRW6KnliOQv439x3oXKpByQrSBMzql7hkwohDE2Pj6kDr7F3vCUjC MwXyAd/tRlUGn9avcvEA==; 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 1jWdjP-0003F2-Hn; Thu, 07 May 2020 10:26:19 +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 1jWdiY-0002UZ-DR for linux-mediatek@lists.infradead.org; Thu, 07 May 2020 10:25:28 +0000 Received: by mail-pg1-x542.google.com with SMTP id l12so2322073pgr.10 for ; Thu, 07 May 2020 03:25:26 -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=m1M6EdnOTsv5mYtPnihqd4eZRs9V55SUnoYnhKRTw60=; b=HwjlF1N670a6UIxoX4jc+7S21D3dNMoGa25afnNqJh6KjJGj+57eSKRmfw2/EMUzvf cPy/MmPNeNicYqplputtipeNWtBNJlddEQclmvyl/DJg9t3PK0GJv7ZuM8fbWt+l0Kao y0PuJrbYPFPRqDaJ+nlA3QoNGve6jD7+SVXsU= 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=m1M6EdnOTsv5mYtPnihqd4eZRs9V55SUnoYnhKRTw60=; b=UPHPdnsgiaavBaY1CV/amB/YZXeNkqB3kAMHrXcW8hIQEBPPk3cYci/tsIiF68qayR 1dDtuIbeAmXR0EMIvpyklSuBUChQnb0XV/L6wxjRYYJ1o5UFNSsvEPNq0sZaSs1JlM6N 1LPJeHkjNm9mk+1+yvtFUFadQDsvNbYyddbPgSlPR7ypNS/rb9hhKZn+RxykMJEZ53j/ E2RVfwzFn/AuWWxo/hKPIQRDyRKf301PZEkfTHrj9mUC9XT8Jlpp40f3r02lx6Wf7vPe lBzUZbgzS6GHJJEOHLNeIdJJ1lDfmUr8JujZlm4q7PrHkMBKbEnbg/eC6j+TI1puyT05 404Q== X-Gm-Message-State: AGi0Pubykft0Y+BA8GWH1nElGs+gnK5qEFsk6M3XzHOYgN/fskylwYix mBt9AxQvevCoO5PrzhfNJXLBew== X-Google-Smtp-Source: APiQypIFdxY72dNnDd+L8I5eCKKhglDYkZTVnaPRNiYzoyqLwW0BwDrjFVs7rHZGjweW5a4tNMMIPw== X-Received: by 2002:a62:4ec8:: with SMTP id c191mr13321613pfb.30.1588847125369; Thu, 07 May 2020 03:25:25 -0700 (PDT) Received: from localhost ([2401:fa00:9:14:a92f:c47d:76a8:b09e]) by smtp.gmail.com with ESMTPSA id m6sm7058940pjo.5.2020.05.07.03.25.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 07 May 2020 03:25:24 -0700 (PDT) From: Eizan Miyamoto To: LKML Subject: [PATCH v3 5/5] [media] mtk-mdp: Remove mtk_mdp_comp.id and supporting functionality Date: Thu, 7 May 2020 20:23:50 +1000 Message-Id: <20200507202337.v3.5.I1c85bddc262913b8572d892dd6bf9bc03fbe0ec7@changeid> X-Mailer: git-send-email 2.26.2.526.g744177e7f7-goog In-Reply-To: <20200507102345.81849-1-eizan@chromium.org> References: <20200507102345.81849-1-eizan@chromium.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200507_032526_498892_C59B792D X-CRM114-Status: GOOD ( 14.71 ) 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_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -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 Message has at least one valid DKIM or DK signature -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender X-BeenThere: linux-mediatek@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 , linux-mediatek@lists.infradead.org, Matthias Brugger , Mauro Carvalho Chehab , linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=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 Miyamoto Reviewed-by: Enric Balletbo i Serra --- Changes in v3: - Removed extra Signed-off-by: tag from commit messages. - Removed extra line break in mtk_mdp_core.c - Update cover letter with dependent commit Changes in v2: - rebase onto linux-next/master to pick up 757570f11fa4b0ce5472a6583de6f06e996a8527 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 | 9 +-- 3 files changed, 10 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 da2bdad7a8d1..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 40b9fda8b03b..f96c8b3bf861 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,6 @@ 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 +157,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;