From: Krzysztof Kozlowski <krzk@kernel.org>
To: Shu-hsiang Yang <Shu-hsiang.Yang@mediatek.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
Sumit Semwal <sumit.semwal@linaro.org>,
Christian Konig <christian.koenig@amd.com>
Cc: linux-media@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org,
dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org,
Project_Global_Chrome_Upstream_Group@mediatek.com,
yaya.chang@mediatek.com, teddy.chen@mediatek.com,
hidenorik@chromium.org, yunkec@chromium.org,
shun-yi.wang@mediatek.com
Subject: Re: [PATCH v1 04/10] media: platform: mediatek: add isp_7x cam-raw unit
Date: Tue, 22 Oct 2024 07:43:40 +0200 [thread overview]
Message-ID: <3fe52ed8-aeb2-49d9-9b81-b6cd53b83425@kernel.org> (raw)
In-Reply-To: <20241009111551.27052-5-Shu-hsiang.Yang@mediatek.com>
On 09/10/2024 13:15, 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@mediatek.com>
...
> +
> +static int mtk_yuv_of_probe(struct platform_device *pdev,
> + struct mtk_yuv_device *drvdata)
> +{
> + struct device *dev = &pdev->dev;
> + struct resource *res;
> + int irq, ret;
> + int n_clks;
> +
> + ret = of_property_read_u32(dev->of_node, "mediatek,cam-id",
> + &drvdata->id);
> + if (ret) {
> + dev_dbg(dev, "missing camid property\n");
Debug? Or error?
> + 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;
> + }
> +
> + drvdata->base = devm_ioremap_resource(dev, res);
> + if (IS_ERR(drvdata->base)) {
> + dev_dbg(dev, "failed to map register base\n");
Dbg? What?
> + return PTR_ERR(drvdata->base);
> + }
> +
> + irq = platform_get_irq(pdev, 0);
> + if (irq < 0) {
> + dev_err(dev, "failed to get irq\n");
> + return -ENODEV;
> + }
> +
> + ret = devm_request_irq(dev, irq, mtk_irq_yuv, 0,
> + dev_name(dev), drvdata);
> + if (ret) {
> + dev_err(dev, "failed to request irq=%d\n", irq);
> + return ret;
> + }
> + dev_dbg(dev, "registered irq=%d\n", irq);
Drop
> +
> + n_clks = devm_clk_bulk_get_all(dev, &drvdata->clk_b);
> + if (n_clks < 0) {
> + dev_err(dev, "failed to devm_clk_bulk_get_all=%d\n", n_clks);
Syntax is: return dev_err_probe()
> + return n_clks;
> + }
> +
> + drvdata->num_clks = n_clks;
> + dev_info(dev, "clk_num:%d\n", drvdata->num_clks);
Drop
> +
> +#ifdef CONFIG_PM_SLEEP
> + drvdata->pm_notifier.notifier_call = yuv_pm_notifier;
> + ret = register_pm_notifier(&drvdata->pm_notifier);
> + if (ret) {
> + dev_err(dev, "failed to register notifier block.\n");
> + return ret;
> + }
> +#endif
> +
> + return 0;
> +}
> +
> +static int mtk_yuv_probe(struct platform_device *pdev)
> +{
> + struct device *dev = &pdev->dev;
> + struct mtk_yuv_device *drvdata;
> + struct v4l2_subdev *sd;
> + int ret;
> +
> + dev_dbg(dev, "camsys | start %s\n", __func__);
NAK
> +
> + drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL);
> + if (!drvdata)
> + return -ENOMEM;
> +
> + drvdata->dev = dev;
> + dev_set_drvdata(dev, drvdata);
> +
> + ret = mtk_yuv_of_probe(pdev, drvdata);
> + if (ret) {
> + dev_info(dev, "mtk_yuv_of_probe failed\n");
NAK. Neither info nor proper for memory allocation errors. Drop.
> + return ret;
> + }
> +
> + /* register yuv as mtk_cam async child */
> + sd = &drvdata->subdev;
> + v4l2_subdev_init(sd, &mtk_raw_subdev_ops);
> + sd->internal_ops = &mtk_raw_subdev_internal_ops;
> + snprintf(sd->name, sizeof(sd->name), "%s",
> + of_node_full_name(dev->of_node));
> + sd->dev = dev;
> + sd->owner = THIS_MODULE;
> +
> + ret = v4l2_async_register_subdev(sd);
> + if (ret) {
> + dev_err(dev, "%s failed on async_register_subdev\n", __func__);
> + return ret;
> + }
> +
> + pm_runtime_enable(dev);
> +
> + dev_info(dev, "camsys | [%s] success\n", __func__);
NAK
> +
> + return 0;
> +}
> +
> +static void mtk_yuv_remove(struct platform_device *pdev)
> +{
> + struct device *dev = &pdev->dev;
> + struct mtk_yuv_device *yuv_dev = dev_get_drvdata(dev);
> + struct v4l2_subdev *sd = &yuv_dev->subdev;
> +
> + dev_dbg(dev, "camsys | start %s\n", __func__);
NAK
> +
> + unregister_pm_notifier(&yuv_dev->pm_notifier);
> +
> + pm_runtime_disable(dev);
> +
> + v4l2_async_unregister_subdev(sd);
> +}
> +
> +/* driver for yuv part */
> +static int mtk_yuv_runtime_suspend(struct device *dev)
> +{
> + struct mtk_yuv_device *drvdata = dev_get_drvdata(dev);
> +
> + dev_info(dev, "%s:disable clock\n", __func__);
NAK
> +
> + clk_bulk_disable_unprepare(drvdata->num_clks, drvdata->clk_b);
> +
> + return 0;
> +}
> +
> +static int mtk_yuv_runtime_resume(struct device *dev)
> +{
> + struct mtk_yuv_device *drvdata = dev_get_drvdata(dev);
> + int ret;
> +
> + dev_info(dev, "%s:enable clock\n", __func__);
NAK. Not even dev_dbg. Please don't ever post such code.
> +
> + ret = clk_bulk_prepare_enable(drvdata->num_clks, drvdata->clk_b);
> + if (ret) {
> + dev_info(dev, "failed at clk_bulk_prepare_enable, ret = %d\n", ret);
> + clk_bulk_disable_unprepare(drvdata->num_clks, drvdata->clk_b);
> + return ret;
> + }
> +
> + return 0;
> +}
> +
> +static const struct dev_pm_ops mtk_yuv_pm_ops = {
> + SET_RUNTIME_PM_OPS(mtk_yuv_runtime_suspend, mtk_yuv_runtime_resume,
> + NULL)
> +};
> +
> +static const struct of_device_id mtk_yuv_of_ids[] = {
> + {.compatible = "mediatek,cam-yuv",},
> + {}
> +};
> +MODULE_DEVICE_TABLE(of, mtk_yuv_of_ids);
> +
> +struct platform_driver mtk_cam_yuv_driver = {
> + .probe = mtk_yuv_probe,
> + .remove = mtk_yuv_remove,
> + .driver = {
> + .name = "mtk-cam yuv",
> + .of_match_table = of_match_ptr(mtk_yuv_of_ids),
Drop of_match_ptr(), you will have here warnings.
> + .pm = &mtk_yuv_pm_ops,
> + }
> +};
...
> diff --git a/drivers/media/platform/mediatek/isp/isp_7x/camsys/mtk_camera-v4l2-controls.h b/drivers/media/platform/mediatek/isp/isp_7x/camsys/mtk_camera-v4l2-controls.h
> new file mode 100644
> index 000000000000..b775e6c30aa1
> --- /dev/null
> +++ b/drivers/media/platform/mediatek/isp/isp_7x/camsys/mtk_camera-v4l2-controls.h
> @@ -0,0 +1,65 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +/*
> + * Copyright (c) 2022 MediaTek Inc.
> + */
> +
> +#ifndef __MTK_CAMERA_V4l2_CONTROLS_H
> +#define __MTK_CAMERA_V4l2_CONTROLS_H
> +
> +#include <linux/videodev2.h>
> +#include <linux/v4l2-controls.h>
> +#include <linux/mtkisp_camsys.h>
How these headers are used here? I don't see. Don't include unrelated
stuff in your files.
> +
> +/* Allowed value of V4L2_CID_MTK_CAM_RAW_PATH_SELECT */
> +#define V4L2_MTK_CAM_RAW_PATH_SELECT_BPC 1
> +#define V4L2_MTK_CAM_RAW_PATH_SELECT_FUS 3
> +#define V4L2_MTK_CAM_RAW_PATH_SELECT_DGN 4
> +#define V4L2_MTK_CAM_RAW_PATH_SELECT_LSC 5
> +#define V4L2_MTK_CAM_RAW_PATH_SELECT_LTM 7
> +
> +#define V4L2_MBUS_FRAMEFMT_PAD_ENABLE BIT(1)
Best regards,
Krzysztof
next prev parent reply other threads:[~2024-10-22 5:43 UTC|newest]
Thread overview: 93+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-09 11:15 [PATCH v1 00/10] Add MediaTek ISP7 camera system driver Shu-hsiang Yang
2024-10-09 11:15 ` [PATCH v1 01/10] dt-bindings: media: mediatek: add camsys device Shu-hsiang Yang
2024-10-09 21:00 ` Rob Herring
2024-10-11 1:29 ` CK Hu (胡俊光)
2024-10-11 3:20 ` CK Hu (胡俊光)
2024-10-22 5:36 ` Krzysztof Kozlowski
2024-11-11 1:37 ` CK Hu (胡俊光)
2024-11-11 2:38 ` CK Hu (胡俊光)
2024-10-09 11:15 ` [PATCH v1 02/10] media: platform: mediatek: add seninf controller Shu-hsiang Yang
2024-10-09 12:50 ` AngeloGioacchino Del Regno
2024-10-11 1:36 ` CK Hu (胡俊光)
2024-10-11 2:38 ` CK Hu (胡俊光)
2024-10-22 4:16 ` CK Hu (胡俊光)
2024-10-28 1:55 ` CK Hu (胡俊光)
2024-10-09 11:15 ` [PATCH v1 03/10] media: platform: mediatek: add isp_7x seninf unit Shu-hsiang Yang
2024-10-14 9:25 ` CK Hu (胡俊光)
2024-10-18 8:54 ` CK Hu (胡俊光)
2024-10-28 1:27 ` CK Hu (胡俊光)
2024-10-28 1:30 ` CK Hu (胡俊光)
2024-11-06 5:58 ` CK Hu (胡俊光)
2024-11-18 9:23 ` CK Hu (胡俊光)
2024-11-18 9:28 ` CK Hu (胡俊光)
2024-11-19 1:46 ` CK Hu (胡俊光)
2024-11-19 1:50 ` CK Hu (胡俊光)
2024-11-20 6:35 ` CK Hu (胡俊光)
2024-10-09 11:15 ` [PATCH v1 04/10] media: platform: mediatek: add isp_7x cam-raw unit Shu-hsiang Yang
2024-10-10 12:49 ` AngeloGioacchino Del Regno
2024-10-11 2:23 ` CK Hu (胡俊光)
2024-10-11 2:55 ` CK Hu (胡俊光)
2024-10-11 5:40 ` CK Hu (胡俊光)
2024-10-11 6:03 ` CK Hu (胡俊光)
2024-10-22 5:43 ` Krzysztof Kozlowski [this message]
2024-10-22 6:14 ` CK Hu (胡俊光)
2024-10-22 6:30 ` CK Hu (胡俊光)
2024-10-23 10:05 ` CK Hu (胡俊光)
2024-10-25 6:30 ` CK Hu (胡俊光)
2024-10-28 6:48 ` CK Hu (胡俊光)
2024-11-04 2:35 ` CK Hu (胡俊光)
2024-11-04 8:04 ` CK Hu (胡俊光)
2024-11-05 3:01 ` CK Hu (胡俊光)
2024-10-09 11:15 ` [PATCH v1 05/10] media: platform: mediatek: add isp_7x camsys unit Shu-hsiang Yang
2024-10-14 9:40 ` CK Hu (胡俊光)
2024-10-16 3:43 ` CK Hu (胡俊光)
2024-11-19 5:56 ` CK Hu (胡俊光)
2024-10-22 5:44 ` Krzysztof Kozlowski
2024-10-22 6:48 ` CK Hu (胡俊光)
2024-10-29 2:35 ` CK Hu (胡俊光)
2024-10-29 6:47 ` CK Hu (胡俊光)
2024-10-29 7:03 ` CK Hu (胡俊光)
2024-10-30 3:20 ` CK Hu (胡俊光)
2024-10-30 5:43 ` CK Hu (胡俊光)
2024-11-04 6:08 ` CK Hu (胡俊光)
2024-11-04 13:06 ` [PATCH " Markus Elfring
2024-11-06 7:52 ` [PATCH v1 " CK Hu (胡俊光)
2024-11-13 7:24 ` CK Hu (胡俊光)
2024-11-20 6:10 ` CK Hu (胡俊光)
2024-10-09 11:15 ` [PATCH v1 06/10] media: platform: mediatek: add isp_7x utility Shu-hsiang Yang
2024-10-14 5:21 ` CK Hu (胡俊光)
2024-10-22 5:30 ` CK Hu (胡俊光)
2024-10-28 3:46 ` CK Hu (胡俊光)
2024-10-29 5:35 ` CK Hu (胡俊光)
2024-11-04 2:26 ` CK Hu (胡俊光)
2024-11-05 3:33 ` CK Hu (胡俊光)
2024-11-05 8:43 ` CK Hu (胡俊光)
2024-11-05 9:14 ` CK Hu (胡俊光)
2024-11-06 3:35 ` CK Hu (胡俊光)
2024-11-06 3:41 ` CK Hu (胡俊光)
2024-11-06 3:48 ` CK Hu (胡俊光)
2024-11-06 7:01 ` CK Hu (胡俊光)
2024-11-19 8:23 ` CK Hu (胡俊光)
2024-11-19 8:29 ` CK Hu (胡俊光)
2024-11-19 9:41 ` CK Hu (胡俊光)
2024-11-20 2:21 ` CK Hu (胡俊光)
2024-11-20 6:03 ` CK Hu (胡俊光)
2024-11-20 5:21 ` CK Hu (胡俊光)
2024-10-09 11:15 ` [PATCH v1 07/10] media: platform: mediatek: add isp_7x video ops Shu-hsiang Yang
2024-11-04 3:24 ` CK Hu (胡俊光)
2024-11-20 1:05 ` CK Hu (胡俊光)
2024-10-09 11:15 ` [PATCH v1 08/10] media: platform: mediatek: add isp_7x state ctrl Shu-hsiang Yang
2024-10-16 1:35 ` CK Hu (胡俊光)
2024-10-28 5:20 ` CK Hu (胡俊光)
2024-10-28 5:25 ` CK Hu (胡俊光)
2024-10-28 5:34 ` CK Hu (胡俊光)
2024-10-09 11:15 ` [PATCH v1 09/10] media: platform: mediatek: add isp_7x build config Shu-hsiang Yang
2024-10-16 1:56 ` CK Hu (胡俊光)
2024-10-09 11:15 ` [PATCH v1 10/10] uapi: linux: add mediatek isp_7x camsys user api Shu-hsiang Yang
2024-10-11 7:47 ` CK Hu (胡俊光)
2024-10-14 5:56 ` CK Hu (胡俊光)
2024-11-06 13:04 ` Laurent Pinchart
2024-11-18 9:58 ` Laurent Pinchart
2024-11-05 5:36 ` CK Hu (胡俊光)
2024-10-15 18:40 ` [PATCH v1 00/10] Add MediaTek ISP7 camera system driver Nicolas Dufresne
2024-11-18 10:00 ` Laurent Pinchart
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3fe52ed8-aeb2-49d9-9b81-b6cd53b83425@kernel.org \
--to=krzk@kernel.org \
--cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
--cc=Shu-hsiang.Yang@mediatek.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=christian.koenig@amd.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=hidenorik@chromium.org \
--cc=krzk+dt@kernel.org \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=mchehab@kernel.org \
--cc=robh@kernel.org \
--cc=shun-yi.wang@mediatek.com \
--cc=sumit.semwal@linaro.org \
--cc=teddy.chen@mediatek.com \
--cc=yaya.chang@mediatek.com \
--cc=yunkec@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).