[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <570ed4780c37bc456cf3d4509207335738b52c08.camel@mediatek.com>
Date: Tue, 5 Nov 2024 03:01:58 +0000
From: CK Hu (胡俊光) <ck.hu@...iatek.com>
To: "sumit.semwal@...aro.org" <sumit.semwal@...aro.org>,
"christian.koenig@....com" <christian.koenig@....com>, "mchehab@...nel.org"
<mchehab@...nel.org>, "conor+dt@...nel.org" <conor+dt@...nel.org>,
"robh@...nel.org" <robh@...nel.org>, "matthias.bgg@...il.com"
<matthias.bgg@...il.com>, "krzk+dt@...nel.org" <krzk+dt@...nel.org>,
AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>,
Shu-hsiang Yang (楊舒翔)
<Shu-hsiang.Yang@...iatek.com>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-mediatek@...ts.infradead.org" <linux-mediatek@...ts.infradead.org>,
"yunkec@...omium.org" <yunkec@...omium.org>, "linaro-mm-sig@...ts.linaro.org"
<linaro-mm-sig@...ts.linaro.org>, "linux-media@...r.kernel.org"
<linux-media@...r.kernel.org>, "devicetree@...r.kernel.org"
<devicetree@...r.kernel.org>, Yaya Chang (張雅清)
<Yaya.Chang@...iatek.com>, Project_Global_Chrome_Upstream_Group
<Project_Global_Chrome_Upstream_Group@...iatek.com>,
"dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
Teddy Chen (陳乾元) <Teddy.Chen@...iatek.com>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>, "hidenorik@...omium.org"
<hidenorik@...omium.org>, Shun-Yi Wang (王順億)
<Shun-Yi.Wang@...iatek.com>
Subject: Re: [PATCH v1 04/10] media: platform: mediatek: add isp_7x cam-raw
unit
Hi, Shu-hsiang:
On Wed, 2024-10-09 at 19:15 +0800, Shu-hsiang Yang wrote:
> Introduces the ISP pipeline driver for the MediaTek ISP raw and yuv
> modules. Key functionalities include data processing, V4L2 integration,
> resource management, debug support, and various control operations.
> Additionally, IRQ handling, platform device management, and MediaTek
> ISP DMA format support are also included.
>
> Signed-off-by: Shu-hsiang Yang <Shu-hsiang.Yang@...iatek.com>
> ---
[snip]
> +static int mtk_raw_of_probe(struct platform_device *pdev,
> + struct mtk_raw_device *raw)
> +{
> + struct device *dev = &pdev->dev;
> + struct resource *res;
> + int ret;
> + int n_clks;
> +
> + ret = of_property_read_u32(dev->of_node, "mediatek,cam-id", &raw->id);
You don't need raw->id.
I think each raw could work independently.
Each raw has its own 'struct mtk_raw_device' context data.
It's not necessary to know which one it is.
When you use dev_dbg() or dev_err(), it would show register base so you could identify which raw print this message.
Regards,
CK
> + if (ret) {
> + dev_dbg(dev, "missing camid property\n");
> + return ret;
> + }
> +
> + if (dma_set_mask_and_coherent(dev, DMA_BIT_MASK(34))) {
> + dev_err(dev, "%s: No suitable DMA available\n", __func__);
> + return -EIO;
> + }
> +
> + if (!dev->dma_parms) {
> + dev->dma_parms =
> + devm_kzalloc(dev, sizeof(*dev->dma_parms), GFP_KERNEL);
> + if (!dev->dma_parms)
> + return -ENOMEM;
> + }
> +
> + dma_set_max_seg_size(dev, UINT_MAX);
> +
> + /* base outer register */
> + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "base");
> + if (!res) {
> + dev_err(dev, "failed to get mem\n");
> + return -ENODEV;
> + }
> +
> + raw->base = devm_ioremap_resource(dev, res);
> + if (IS_ERR(raw->base)) {
> + dev_err(dev, "failed to map register base\n");
> + return PTR_ERR(raw->base);
> + }
> +
> + /* base inner register */
> + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "inner_base");
> + if (!res) {
> + dev_err(dev, "failed to get mem\n");
> + return -ENODEV;
> + }
> +
> + raw->base_inner = devm_ioremap_resource(dev, res);
> + if (IS_ERR(raw->base_inner)) {
> + dev_err(dev, "failed to map register inner base\n");
> + return PTR_ERR(raw->base_inner);
> + }
> +
> + /* will be assigned later */
> + raw->yuv_base = NULL;
> +
> + raw->irq = platform_get_irq(pdev, 0);
> + if (raw->irq < 0) {
> + dev_err(dev, "failed to get irq\n");
> + return -ENODEV;
> + }
> +
> + ret = devm_request_threaded_irq(dev, raw->irq,
> + mtk_irq_raw, mtk_thread_irq_raw,
> + 0, dev_name(dev), raw);
> + if (ret) {
> + dev_err(dev, "failed to request irq=%d\n", raw->irq);
> + return ret;
> + }
> + dev_dbg(dev, "registered irq=%d\n", raw->irq);
> +
> + disable_irq(raw->irq);
> +
> + n_clks = devm_clk_bulk_get_all(dev, &raw->clk_b);
> + if (n_clks < 0) {
> + dev_err(dev, "failed to devm_clk_bulk_get_all=%d\n", n_clks);
> + return n_clks;
> + }
> +
> + raw->num_clks = n_clks;
> + dev_info(dev, "clk_num:%d\n", raw->num_clks);
> +
> +#ifdef CONFIG_PM_SLEEP
> + raw->pm_notifier.notifier_call = raw_pm_notifier;
> + ret = register_pm_notifier(&raw->pm_notifier);
> + if (ret) {
> + dev_info(dev, "failed to register notifier block.\n");
> + return ret;
> + }
> +#endif
> + return 0;
> +}
> +
Powered by blists - more mailing lists