Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp262409pxj; Thu, 10 Jun 2021 21:34:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/PXjlQEJNPIqSwQXp5TQNQ2aMz3UgTghXLPMmOMfArLDgYauCMPkaXX9nEDc6LEsEmm9p X-Received: by 2002:aa7:cb45:: with SMTP id w5mr1671120edt.170.1623386076022; Thu, 10 Jun 2021 21:34:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623386076; cv=none; d=google.com; s=arc-20160816; b=T9ZEuqed9KxLnGVeLYRQ/2WexilrKL3L9Iww349kYEvVhRNg0UXZse7gALCRIY343E +fENRonuDBN2M8F7YWTKLzxaBfYQNwjNnVFPJtmLM8OqlWD2cK+Fj8bNqOvkem3+FogT 5zFGN0yFSodI4zrbR8lwjj9BSJlc22zBpymCpL3Pg4w15IrfL51DctDnajJgXzKonJkS tSbFtmreJ2Cjbw2C9p9eLXJ6q2vP3zZbIc22yGb2H1hzcFmGzd9Fi7mOAX4N5kkRVeUZ +mTQPOJnNv5BXGaAOY8ciQ0hhCShBZN7eztHq08yDX8zkTI51aczaeh8GOJDOyCXZrrU 1lcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=BL7wwDaE4EopB7RkjbdBsNrvrzyStVzJ+eECImab9V8=; b=RoCN/j6DptFFQ7p89ZdId0qx6vsx+1O6M8ATTWhM9ctUbGAHlF9geN1SCyvQa6hXhk G/4hBd8xN17fFxd9IQJpSoZF3RRQSakhzYFnYZHIHdbQtxbtoyAF6/Kv2Du6V9tl5ptG UDF9C+RhLYcQGPoGziLV1lw0yayy0SM9p8WoymsJWY65WoBpzzhGw8h3x61la8bj9DjY yfAKV6QcNlnd8IiG3PaI31oR7jhwFTM/ltn06jcHaLqz9WP8vscqCzq088ArbZ1h4/6K ThtXOAvUqVLMOlPpNLmx14lSO7yUXACHmhOGJnIhiD/QlTgRzzqW80W6sBrCfZ5YwccU eWhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="lrK/fMQo"; 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 c1si3732782edv.260.2021.06.10.21.34.13; Thu, 10 Jun 2021 21:34:36 -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="lrK/fMQo"; 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 S230377AbhFKEeJ (ORCPT + 99 others); Fri, 11 Jun 2021 00:34:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230353AbhFKEeI (ORCPT ); Fri, 11 Jun 2021 00:34:08 -0400 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC6ACC061574 for ; Thu, 10 Jun 2021 21:31:56 -0700 (PDT) Received: by mail-lf1-x135.google.com with SMTP id a1so6579595lfr.12 for ; Thu, 10 Jun 2021 21:31:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=BL7wwDaE4EopB7RkjbdBsNrvrzyStVzJ+eECImab9V8=; b=lrK/fMQoR3Vm9tVm5ZFY4Iz3lGCN0Tv+1wOejKEMQrk/HKh7Sfln8F9wUxLYSiEyvp dnFp0ZaI9BZpfbGSrXKVcdvLy+BEnHCtxHZBhKWVZGVt9aVou9KH3glQbtWkZCUTqDRL NDFBuPc8y04i7r6s3pA3GsvEB0PiA02LJcx6A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=BL7wwDaE4EopB7RkjbdBsNrvrzyStVzJ+eECImab9V8=; b=j1+B7eQnWkowAfulI4CqdEptCKs+3fc+yFH3nmD6TAgy/etOD9SiixJntN6wo+Gyof Z70vRkxnptoxTnUYxNOJoGcLzskirkSjunrqpmFofzmkIS2Dz32T1a+OuRlFQIqaou3k cURer1xfLQHJltpIFqgPMB44GuvbSbFhy45SNN82q32kV6+cwnkw7OSNkF4pnUXgOsMH Vb/SsE998ssDSfo2w4P9tGIidxZ6FPutF5UkFAHfMvOzE8+DUhCTtKQC/+Ic7tSTOuos 9P4Gn+pMI5zBgZYc5jmgI4AEpPQghN/QPDXXlC1UIskCuzjFUVZ6XSdPtjnS5wMXkEFq 0hsA== X-Gm-Message-State: AOAM532ZtJzCD0t/0eBQJcG5BKaSJBzy6zeRnEpi8A5WwCg71czJUIlb NOT/o03wd3E00YgKpbr7CZ2gCE78Mz8KY5vngjfkLA== X-Received: by 2002:a19:9145:: with SMTP id y5mr1368993lfj.444.1623385911180; Thu, 10 Jun 2021 21:31:51 -0700 (PDT) MIME-Version: 1.0 References: <20210611040145.2085329-1-eizan@chromium.org> <20210611140124.v2.7.I2049e180dca12e0d1b3178bfc7292dcf9e05ac28@changeid> In-Reply-To: <20210611140124.v2.7.I2049e180dca12e0d1b3178bfc7292dcf9e05ac28@changeid> From: Chen-Yu Tsai Date: Fri, 11 Jun 2021 12:31:39 +0800 Message-ID: Subject: Re: [PATCH v2 7/8] media: mtk-mdp: treat rdma@14001000 specially when probing To: Eizan Miyamoto Cc: linux-kernel@vger.kernel.org, houlong.wei@mediatek.com, enric.balletbo@collabora.com, yong.wu@mediatek.com, chunkuang.hu@kernel.org, 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Fri, Jun 11, 2021 at 12:05 PM Eizan Miyamoto wrote: > > ... 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. */ This seems quite fragile as it likely doesn't hold true across different SoCs. You would then end up with a bunch of of_device_is_compatible() and name checking combinations. Would it make more sense to check against DT aliases? Since this device already has the mdp-rdma0 alias associated with it, we could mandate some alias naming scheme going forward? ChenYu > 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 finddrivers/soc/mediatek/mtk-mmsys.c vpu node"); > -- > 2.32.0.272.g935e593368-goog > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel