From: Yemike Abhilash Chandra <y-abhilashchandra@ti.com>
To: Krzysztof Kozlowski <krzk@kernel.org>, <mchehab@kernel.org>,
<robh@kernel.org>, <krzk+dt@kernel.org>, <conor+dt@kernel.org>
Cc: <linux@armlinux.org.uk>, <ardb@kernel.org>, <ebiggers@kernel.org>,
<geert+renesas@glider.be>, <claudiu.beznea@tuxon.dev>,
<bparrot@ti.com>, <andre.draszik@linaro.org>,
<kuninori.morimoto.gx@renesas.com>,
<prabhakar.mahadev-lad.rj@bp.renesas.com>,
<heikki.krogerus@linux.intel.com>, <kory.maincent@bootlin.com>,
<florian.fainelli@broadcom.com>, <lumag@kernel.org>,
<dale@farnsworth.org>, <sbellary@baylibre.com>,
<linux-media@vger.kernel.org>, <devicetree@vger.kernel.org>,
<linux-kernel@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<dagriego@biglakesoftware.com>, <u-kumar1@ti.com>
Subject: Re: [PATCH V2 4/4] media: ti-vpe: Add the VIP driver
Date: Tue, 26 Aug 2025 13:59:42 +0530 [thread overview]
Message-ID: <dcaaf0ee-2cfc-419e-8c4a-8834372f1948@ti.com> (raw)
In-Reply-To: <b8149d7d-65ca-47c1-9338-45a0db614e77@kernel.org>
Hi Krzysztof,
Thanks for the review.
On 16/07/25 19:39, Krzysztof Kozlowski wrote:
> On 16/07/2025 13:19, Yemike Abhilash Chandra wrote:
>
>> +static int vip_probe_complete(struct platform_device *pdev)
>> +{
>> + struct vip_shared *shared = platform_get_drvdata(pdev);
>> + struct regmap *syscon_pol = NULL;
>> + u32 syscon_pol_offset = 0;
>> + struct vip_port *port;
>> + struct vip_dev *dev;
>> + struct device_node *parent = pdev->dev.of_node;
>> + struct fwnode_handle *ep = NULL;
>> + int ret, slice_id, port_id, p;
>> +
>> + if (parent && of_property_read_bool(parent, "ti,vip-clk-polarity")) {
>> + syscon_pol = syscon_regmap_lookup_by_phandle(parent,
>> + "ti,vip-clk-polarity");
>> + if (IS_ERR(syscon_pol)) {
>> + dev_err(&pdev->dev, "failed to get ti,vip-clk-polarity regmap\n");
>> + return PTR_ERR(syscon_pol);
>
> Syntax is return dev_err_probe. If this is not probe path, then this has
> to be fixed.
>
I will fix this in v3.
>> + }
>> +
>> + if (of_property_read_u32_index(parent, "ti,vip-clk-polarity",
>> + 1, &syscon_pol_offset)) {
>> + dev_err(&pdev->dev, "failed to get ti,vip-clk-polarity offset\n");
>> + return -EINVAL;
>> + }
>> + }
>> +
>> + for (p = 0; p < (VIP_NUM_PORTS * VIP_NUM_SLICES); p++) {
>> + ep = fwnode_graph_get_next_endpoint_by_regs(of_fwnode_handle(parent),
>> + p, 0);
>> + if (!ep)
>> + continue;
>> +
>> + switch (p) {
>> + case 0:
>> + slice_id = VIP_SLICE1; port_id = VIP_PORTA;
>> + break;
>> + case 1:
>> + slice_id = VIP_SLICE2; port_id = VIP_PORTA;
>> + break;
>> + case 2:
>> + slice_id = VIP_SLICE1; port_id = VIP_PORTB;
>> + break;
>> + case 3:
>> + slice_id = VIP_SLICE2; port_id = VIP_PORTB;
>> + break;
>> + default:
>> + dev_err(&pdev->dev, "Unknown port reg=<%d>\n", p);
>> + continue;
>> + }
>> +
>> + ret = alloc_port(shared->devs[slice_id], port_id);
>> + if (ret < 0)
>> + continue;
>> +
>> + dev = shared->devs[slice_id];
>> + dev->syscon_pol = syscon_pol;
>> + dev->syscon_pol_offset = syscon_pol_offset;
>> + port = dev->ports[port_id];
>> +
>> + vip_register_subdev_notif(port, ep);
>> + fwnode_handle_put(ep);
>> + }
>> + return 0;
>> +}
>> +
>> +static int vip_probe_slice(struct platform_device *pdev, int slice, int instance_id)
>> +{
>> + struct vip_shared *shared = platform_get_drvdata(pdev);
>> + struct vip_dev *dev;
>> + struct vip_parser_data *parser;
>> + u32 vin_id;
>> + int ret;
>> +
>> + dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL);
>> + if (!dev)
>> + return -ENOMEM;
>> +
>> + dev->instance_id = instance_id;
>> + vin_id = 1 + ((dev->instance_id - 1) * 2) + slice;
>> + snprintf(dev->name, sizeof(dev->name), "vin%d", vin_id);
>> +
>> + dev->irq = platform_get_irq(pdev, slice);
>> + if (dev->irq < 0)
>> + return dev->irq;
>> +
>> + ret = devm_request_irq(&pdev->dev, dev->irq, vip_irq,
>> + 0, dev->name, dev);
>> + if (ret < 0)
>> + return -ENOMEM;
>> +
>> + spin_lock_init(&dev->slock);
>> + mutex_init(&dev->mutex);
>> +
>> + dev->slice_id = slice;
>> + dev->pdev = pdev;
>> + dev->res = shared->res;
>> + dev->base = shared->base;
>> + dev->v4l2_dev = &shared->v4l2_dev;
>> +
>> + dev->shared = shared;
>> + shared->devs[slice] = dev;
>> +
>> + vip_top_reset(dev);
>> + vip_set_slice_path(dev, VIP_MULTI_CHANNEL_DATA_SELECT, 1);
>> +
>> + parser = devm_kzalloc(&pdev->dev, sizeof(*dev->parser), GFP_KERNEL);
>> + if (!parser)
>> + return PTR_ERR(parser);
>> +
>> + parser->res = platform_get_resource_byname(pdev,
>> + IORESOURCE_MEM,
>> + (slice == 0) ?
>> + "parser0" :
>> + "parser1");
>> + parser->base = devm_ioremap_resource(&pdev->dev, parser->res);
>> + if (IS_ERR(parser->base))
>> + return PTR_ERR(parser->base);
>> +
>> + parser->pdev = pdev;
>> + dev->parser = parser;
>> +
>> + dev->sc_assigned = VIP_NOT_ASSIGNED;
>> + dev->sc = sc_create(pdev, (slice == 0) ? "sc0" : "sc1");
>> + if (IS_ERR(dev->sc))
>> + return PTR_ERR(dev->sc);
>> +
>> + dev->csc_assigned = VIP_NOT_ASSIGNED;
>> + dev->csc = csc_create(pdev, (slice == 0) ? "csc0" : "csc1");
>> + if (IS_ERR(dev->sc))
>> + return PTR_ERR(dev->sc);
>> +
>> + return 0;
>> +}
>> +
>> +static int vip_probe(struct platform_device *pdev)
>> +{
>> + struct vip_shared *shared;
>> + struct pinctrl *pinctrl;
>> + int ret, slice = VIP_SLICE1;
>> + int instance_id;
>> + u32 tmp, pid;
>> + const char *label;
>> +
>> + if (!of_property_read_string(pdev->dev.of_node, "label", &label)) {
>> + if (strcmp(label, "vip1") == 0)
>> + instance_id = 1;
>> + else if (strcmp(label, "vip2") == 0)
>> + instance_id = 2;
>> + else if (strcmp(label, "vip3") == 0)
>
>
> Heh, nice try. You cannot encode instance ID as different property (and
> instance ID is not allowed, see writing bindings in next).
>
> And how does it work with label called "krzk"? Your binding said that
> "krzk" is a perfectly correct label.
>
> You need to think about such cases.
>
>
>> + instance_id = 3;
>
> And past here you use uninitialized instance_id, because you did not
> consider "krzk".
>
Understood. I will avoid this in v3
Thanks and Regards,
Yemike Abhilash Chandra
>
>
> Best regards,
> Krzysztof
next prev parent reply other threads:[~2025-08-26 8:30 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-16 11:19 [PATCH V2 0/4] Add support for VIP Yemike Abhilash Chandra
2025-07-16 11:19 ` [PATCH V2 1/4] MAINTAINERS: Update maintainers of TI VPE and CAL Yemike Abhilash Chandra
2025-07-16 11:19 ` [PATCH V2 2/4] Revert "media: platform: ti: Remove unused vpdma_update_dma_addr" Yemike Abhilash Chandra
2025-07-16 14:23 ` Krzysztof Kozlowski
2025-08-26 8:26 ` Yemike Abhilash Chandra
2025-07-16 11:19 ` [PATCH V2 3/4] dt-bindings: media: ti: vpe: Add bindings for Video Input Port Yemike Abhilash Chandra
2025-07-16 12:47 ` Rob Herring (Arm)
2025-07-16 14:05 ` Krzysztof Kozlowski
2025-08-26 8:21 ` Yemike Abhilash Chandra
2025-07-16 11:19 ` [PATCH V2 4/4] media: ti-vpe: Add the VIP driver Yemike Abhilash Chandra
2025-07-16 14:09 ` Krzysztof Kozlowski
2025-08-26 8:29 ` Yemike Abhilash Chandra [this message]
2025-07-17 10:49 ` kernel test robot
2025-08-25 14:53 ` Hans Verkuil
2025-08-25 14:34 ` [PATCH V2 0/4] Add support for VIP Hans Verkuil
2025-08-26 8:49 ` Yemike Abhilash Chandra
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=dcaaf0ee-2cfc-419e-8c4a-8834372f1948@ti.com \
--to=y-abhilashchandra@ti.com \
--cc=andre.draszik@linaro.org \
--cc=ardb@kernel.org \
--cc=bparrot@ti.com \
--cc=claudiu.beznea@tuxon.dev \
--cc=conor+dt@kernel.org \
--cc=dagriego@biglakesoftware.com \
--cc=dale@farnsworth.org \
--cc=devicetree@vger.kernel.org \
--cc=ebiggers@kernel.org \
--cc=florian.fainelli@broadcom.com \
--cc=geert+renesas@glider.be \
--cc=heikki.krogerus@linux.intel.com \
--cc=kory.maincent@bootlin.com \
--cc=krzk+dt@kernel.org \
--cc=krzk@kernel.org \
--cc=kuninori.morimoto.gx@renesas.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=lumag@kernel.org \
--cc=mchehab@kernel.org \
--cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
--cc=robh@kernel.org \
--cc=sbellary@baylibre.com \
--cc=u-kumar1@ti.com \
/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).