Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp249379pxj; Thu, 10 Jun 2021 21:08:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyuFY/bi6l+HVxXCWZRmwtC/6twIBRhFLj+LETZHi/Iqps+nnunO7+Cwyu8n/M7kpeXibbU X-Received: by 2002:a17:906:6dc3:: with SMTP id j3mr1689057ejt.448.1623384533609; Thu, 10 Jun 2021 21:08:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623384533; cv=none; d=google.com; s=arc-20160816; b=Rnl/4I9lDHYmtdxjcLPTwdUe2Vy0AXnnP2hmWk/AERceF21FDf8MIplbd7bBUrswj7 d5b9rns1DorMWG9Ez7/5Hz7cDmcs9mAfqAaW82A554jwyx/OWO0pdMPv9UsiuoH8Hj5L MsRZrkYbcQrz5dH/qagGval6TwXbnf71Cy7LWINmEzY4+NSANnhErBDkuWfVb1xyx5dt TVqfFkWMyEZVOo8Q7kz28hRiBmAe2wGRg2e1f2w70oYv+2y1jUPzeSrvEyWfvXrCHfKb mD5NUYsu8MAq29riuztZLOTlFCzMBOIOReEe1MIIb8gPU+Xr4UEANv2fBQVfXEuQbMh/ cTHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=8XFKmXX+Z8zBE+LvKxlcbsoweak/MaB5nJN3HXAfDUI=; b=h2N8Y9VuhSlgAT7ICdmuUncUbqNLlNQPlGh+01xeYOeIq+lpoXRBJvijPYhq10FTVk HIuRuUJWZqhcQdjeW7VqZLUe57f18l5VjD0DG5pWJnrQ1dzOwGHupfEELsAgyHkRRnh9 Zt+JKtUyRUrqXBF5e56VPr4qcymCtPQHu0YZi+YCdbX4QLGMIUqDZUp6KrW8sjvHH+2C O2EPaPT6X8kkF1CGtv5Q/8NXofCee6bJY1Jj+dbXoy5W0IQP/DDPqzavWt1zb3VI/9WJ oyd30DAHrGHvasU3UMVxAJV54K5z/C4FokZRu+ba0jn3DXnSO1iqs48shi8/RP9U6Xci U1Nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=TjO2rbze; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gy21si4070531ejb.8.2021.06.10.21.08.30; Thu, 10 Jun 2021 21:08:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=TjO2rbze; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231623AbhFKEGJ (ORCPT + 99 others); Fri, 11 Jun 2021 00:06:09 -0400 Received: from mail-pl1-f181.google.com ([209.85.214.181]:39803 "EHLO mail-pl1-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229530AbhFKEGJ (ORCPT ); Fri, 11 Jun 2021 00:06:09 -0400 Received: by mail-pl1-f181.google.com with SMTP id v11so2160144ply.6 for ; Thu, 10 Jun 2021 21:03:56 -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=8XFKmXX+Z8zBE+LvKxlcbsoweak/MaB5nJN3HXAfDUI=; b=TjO2rbze6Hl1C/ma0Cxmypa4hqczGAiGrDGeahbZ8pF58o9czM7knR42g1jTT3WYfW 5T3rnHte+PlaVAmU9+BSjRwleCx7bY6Ti5WZv/JWrQnPuFSsjOSBtGZ+ZlC4HDYL9w8W 4B1ZPHiXZRyxGxo9l5zn7GsnlhoPgFKQgxEEQ= 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=8XFKmXX+Z8zBE+LvKxlcbsoweak/MaB5nJN3HXAfDUI=; b=DB8+9DLDAiIo1E5/tZWdnOQe3s+p0BKQAqiGRCntMY6gNEuE3vLMp76jIUuR3DCWSY kANx8mJDl+GHd/oLzV8gPM1HQWXMccQrU6q6zQEgkJAC8sf0AZIczHq5IysbBCzK9dPS I6tr8ej/dBB9XfDSu+sRp4LpI3LCjfYL4kAttJhQKjoKK9+wio57lHmsiFW7oyyx/8dT UnjkrC7Fh1LgIhhWXdWsUZGaMufR8w8OwiwaJQhLCkLK41QxpMoFRGkoCyU8CotvaERI YiGVQyfTtCdTeb7k1/HqxCZ6oMA9Cdm/2AoXzknHRJ4ONvMukhnb4eIMez6XnlXDW9KS GspQ== X-Gm-Message-State: AOAM532us8iQuyOaI0Hx1H6JMICr9iq+cjV6qSRJbcg6vzTGrhcSqoeJ rWyyRda1VFF/T/txg7jD9622nr0KKGOqE77i X-Received: by 2002:a17:90b:d81:: with SMTP id bg1mr1055411pjb.112.1623384176460; Thu, 10 Jun 2021 21:02:56 -0700 (PDT) Received: from localhost ([2401:fa00:9:14:db52:e918:e5f9:9e14]) by smtp.gmail.com with UTF8SMTPSA id o9sm3945251pfh.217.2021.06.10.21.02.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 10 Jun 2021 21:02:56 -0700 (PDT) From: Eizan Miyamoto To: linux-kernel@vger.kernel.org Cc: houlong.wei@mediatek.com, enric.balletbo@collabora.com, yong.wu@mediatek.com, chunkuang.hu@kernel.org, Eizan Miyamoto , Andrew-CT Chen , Matthias Brugger , Mauro Carvalho Chehab , Minghsiu Tsai , linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH v2 7/8] media: mtk-mdp: treat rdma@14001000 specially when probing Date: Fri, 11 Jun 2021 14:01:44 +1000 Message-Id: <20210611140124.v2.7.I2049e180dca12e0d1b3178bfc7292dcf9e05ac28@changeid> X-Mailer: git-send-email 2.32.0.272.g935e593368-goog In-Reply-To: <20210611040145.2085329-1-eizan@chromium.org> References: <20210611040145.2085329-1-eizan@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ... Instead of depending on the presence of a mediatek,vpu property in the device node. This property was originally added to link to the vpu node so that the mtk_mdp_core driver could pass the right device to vpu_wdt_reg_handler(). However in a previous patch in this series, the driver has been modified to search the device tree for that node instead. This property was also used to indicate the primary MDP device, so that it can be passed to the V4L2 subsystem as well as register it to be used when setting up queues in the open() callback for the filesystem device node that is created. In this case, assuming that the primary MDP device is the one with a specific name at a specific address seems useable because the alternative is to add a property to the device tree which doesn't actually represent any facet of hardware (i.e., this being the primary MDP device is a software decision). In other words, this solution is equally as arbitrary, but doesn't add a property to a device node which is unrelated to the hardware present. Signed-off-by: Eizan Miyamoto --- (no changes since v1) drivers/media/platform/mtk-mdp/mtk_mdp_comp.c | 15 ++++----------- drivers/media/platform/mtk-mdp/mtk_mdp_core.c | 6 ++++++ 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c b/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c index 59911ee063c1..77ddc18c90e2 100644 --- a/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c +++ b/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c @@ -146,17 +146,11 @@ static int mtk_mdp_comp_bind(struct device *dev, struct device *master, { struct mtk_mdp_comp *comp = dev_get_drvdata(dev); struct mtk_mdp_dev *mdp = data; - struct device_node *vpu_node; mtk_mdp_register_component(mdp, comp); - /* - * If this component has a "mediatek-vpu" property, it is responsible for - * notifying the mdp master driver about it so it can be further initialized - * later. - */ - vpu_node = of_parse_phandle(dev->of_node, "mediatek,vpu", 0); - if (vpu_node) { + if (strcmp(dev->of_node->full_name, "rdma@14001000") == 0) { + /* This is the primary MDP device node. */ int ret; ret = v4l2_device_register(dev, &mdp->v4l2_dev); @@ -172,9 +166,8 @@ static int mtk_mdp_comp_bind(struct device *dev, struct device *master, } /* - * presence of the "mediatek,vpu" property in a device node - * indicates that it is the primary MDP rdma device and MDP DMA - * ops should be handled by its DMA callbacks. + * MDP DMA ops will be handled by the DMA callbacks associated with this + * device; */ mdp->rdma_dev = dev; } diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_core.c b/drivers/media/platform/mtk-mdp/mtk_mdp_core.c index 523e3c2798e1..be7d35b3e3ff 100644 --- a/drivers/media/platform/mtk-mdp/mtk_mdp_core.c +++ b/drivers/media/platform/mtk-mdp/mtk_mdp_core.c @@ -157,6 +157,12 @@ static int mtk_mdp_master_bind(struct device *dev) goto err_component_bind_all; } + if (mdp->rdma_dev == NULL) { + dev_err(dev, "Primary MDP device not found"); + status = -ENODEV; + goto err_component_bind_all; + } + vpu_node = of_find_node_by_name(NULL, "vpu"); if (!vpu_node) { dev_err(dev, "unable to find vpu node"); -- 2.32.0.272.g935e593368-goog