[{"id":28947,"web_url":"https://patchwork.libcamera.org/comment/28947/","msgid":"<axrx5ynlyoyjgkhj3j4r5b6xfaxwetx4c7u5ngq5wunin5ynv6@qmvav4y3xczq>","date":"2024-03-13T16:49:12","subject":"Re: [PATCH] mipi-csis: Emit V4L2_EVENT_FRAME_SYNC events","submitter":{"id":143,"url":"https://patchwork.libcamera.org/api/people/143/","name":"Jacopo Mondi","email":"jacopo.mondi@ideasonboard.com"},"content":"Hi Stefan\n\nIn Subject: missing the 'media:' prefix\n\nOn Wed, Mar 13, 2024 at 04:30:58PM +0100, Stefan Klug wrote:\n> The Samsung CSIS Mipi receiver provides a start-of-frame interrupt and\n\ns/Mipi/MIPI/\n\n> a framecount register. As the CSI receiver is the hardware unit\n> that lies closest to the sensor, the frame counter is the best we can\n> get on these devices.\n> In case of the ISI available on the i.MX8 M Plus it is also the only\n> native start-of-frame signal available.\n>\n> This patch exposes the sof interrupt and the framecount as\n> V4L2_EVENT_FRAME_SYNC event on the subdevice.\n>\n> It was tested on a Debix-Som-A with a 6.8-rc4 kernel.\n>\n> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n> ---\n>  drivers/media/platform/nxp/imx-mipi-csis.c | 34 +++++++++++++++++++++-\n>  1 file changed, 33 insertions(+), 1 deletion(-)\n>\n> diff --git a/drivers/media/platform/nxp/imx-mipi-csis.c b/drivers/media/platform/nxp/imx-mipi-csis.c\n> index db8ff5f5c4d3..caeb1622f741 100644\n> --- a/drivers/media/platform/nxp/imx-mipi-csis.c\n> +++ b/drivers/media/platform/nxp/imx-mipi-csis.c\n> @@ -30,6 +30,7 @@\n>\n>  #include <media/v4l2-common.h>\n>  #include <media/v4l2-device.h>\n> +#include <media/v4l2-event.h>\n>  #include <media/v4l2-fwnode.h>\n>  #include <media/v4l2-mc.h>\n>  #include <media/v4l2-subdev.h>\n> @@ -742,6 +743,18 @@ static void mipi_csis_stop_stream(struct mipi_csis_device *csis)\n>  \tmipi_csis_system_enable(csis, false);\n>  }\n>\n> +static void mipi_csis_queue_event_sof(struct mipi_csis_device *csis)\n> +{\n> +\tstruct v4l2_event event = {\n> +\t\t.type = V4L2_EVENT_FRAME_SYNC,\n> +\t};\n> +\n> +\tu32 frame = mipi_csis_read(csis, MIPI_CSIS_FRAME_COUNTER_CH(0));\n> +\n> +\tevent.u.frame_sync.frame_sequence = frame;\n> +\tv4l2_event_queue(csis->sd.devnode, &event);\n> +}\n> +\n>  static irqreturn_t mipi_csis_irq_handler(int irq, void *dev_id)\n>  {\n>  \tstruct mipi_csis_device *csis = dev_id;\n> @@ -765,6 +778,10 @@ static irqreturn_t mipi_csis_irq_handler(int irq, void *dev_id)\n>  \t\t\t\tevent->counter++;\n>  \t\t}\n>  \t}\n> +\n> +\tif (status & MIPI_CSIS_INT_SRC_FRAME_START)\n> +\t\tmipi_csis_queue_event_sof(csis);\n> +\n>  \tspin_unlock_irqrestore(&csis->slock, flags);\n>\n>  \tmipi_csis_write(csis, MIPI_CSIS_INT_SRC, status);\n> @@ -1154,8 +1171,23 @@ static int mipi_csis_log_status(struct v4l2_subdev *sd)\n>  \treturn 0;\n>  }\n>\n> +static int mipi_csis_subscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh,\n> +\t\t\t       struct v4l2_event_subscription *sub)\n\nPlease align to open ( on the previous line\n\nAll minors, with the above fixed\nReviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n\nThanks\n  j\n\n> +{\n> +\tif (sub->type != V4L2_EVENT_FRAME_SYNC)\n> +\t\treturn -EINVAL;\n> +\n> +\t/* V4L2_EVENT_FRAME_SYNC doesn't require an id, so zero should be set */\n> +\tif (sub->id != 0)\n> +\t\treturn -EINVAL;\n> +\n> +\treturn v4l2_event_subscribe(fh, sub, 0, NULL);\n> +}\n> +\n>  static const struct v4l2_subdev_core_ops mipi_csis_core_ops = {\n>  \t.log_status\t= mipi_csis_log_status,\n> +\t.subscribe_event =  mipi_csis_subscribe_event,\n> +\t.unsubscribe_event = v4l2_event_subdev_unsubscribe,\n>  };\n>\n>  static const struct v4l2_subdev_video_ops mipi_csis_video_ops = {\n> @@ -1358,7 +1390,7 @@ static int mipi_csis_subdev_init(struct mipi_csis_device *csis)\n>  \tsnprintf(sd->name, sizeof(sd->name), \"csis-%s\",\n>  \t\t dev_name(csis->dev));\n>\n> -\tsd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;\n> +\tsd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_HAS_EVENTS;\n>  \tsd->ctrl_handler = NULL;\n>\n>  \tsd->entity.function = MEDIA_ENT_F_VID_IF_BRIDGE;\n> --\n> 2.40.1\n>\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 75E92BD160\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 13 Mar 2024 16:49:19 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id ADBB762C87;\n\tWed, 13 Mar 2024 17:49:18 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E73AF62C87\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 13 Mar 2024 17:49:16 +0100 (CET)","from ideasonboard.com (93-61-96-190.ip145.fastwebnet.it\n\t[93.61.96.190])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id C5D10B1;\n\tWed, 13 Mar 2024 17:48:53 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"LW4Hr5WQ\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1710348533;\n\tbh=2hQ6pSoQbMrt0XkGRzDOdvfmCtR4p2HXgr8RQCNnWOg=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=LW4Hr5WQRELGatP+Rx39XsVdhYqzrluTYRPkZJc07OnmW1sIBdWdkjt8RYM0RfQEc\n\t9VvaLcJpVR9oRFhFrL6chX79fG46ZcWKNoaWgUgpx6LTuGkuSLbjFfqqSI3yHoJYvP\n\txIG4xlhTnNQHgEYlL2gXycDR6GQT+n6jN9bZMz/M=","Date":"Wed, 13 Mar 2024 17:49:12 +0100","From":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","To":"Stefan Klug <stefan.klug@ideasonboard.com>","Subject":"Re: [PATCH] mipi-csis: Emit V4L2_EVENT_FRAME_SYNC events","Message-ID":"<axrx5ynlyoyjgkhj3j4r5b6xfaxwetx4c7u5ngq5wunin5ynv6@qmvav4y3xczq>","References":"<20240313153058.189684-1-stefan.klug@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20240313153058.189684-1-stefan.klug@ideasonboard.com>","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"Purism Kernel Team <kernel@puri.sm>, Fabio Estevam <festevam@gmail.com>, \n\tSascha Hauer <s.hauer@pengutronix.de>, linux-kernel@vger.kernel.org,\n\tRui Miguel Silva <rmfrfs@gmail.com>,\n\tlibcamera-devel@lists.libcamera.org, \n\tPengutronix Kernel Team <kernel@pengutronix.de>,\n\tMartin Kepplinger <martink@posteo.de>,\n\tNXP Linux Team <linux-imx@nxp.com>, \n\tMauro Carvalho Chehab <mchehab@kernel.org>,\n\tShawn Guo <shawnguo@kernel.org>, \n\tlinux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":28952,"web_url":"https://patchwork.libcamera.org/comment/28952/","msgid":"<99069f32-4bad-4cb9-aa03-4c06a596a248@ideasonboard.com>","date":"2024-03-13T19:12:08","subject":"Re: [PATCH] mipi-csis: Emit V4L2_EVENT_FRAME_SYNC events","submitter":{"id":86,"url":"https://patchwork.libcamera.org/api/people/86/","name":"Umang Jain","email":"umang.jain@ideasonboard.com"},"content":"Hi Stefan,\n\nThank you for the patch.\n\nOn 13/03/24 9:00 pm, Stefan Klug wrote:\n> The Samsung CSIS Mipi receiver provides a start-of-frame interrupt and\n> a framecount register. As the CSI receiver is the hardware unit\n> that lies closest to the sensor, the frame counter is the best we can\n> get on these devices.\n> In case of the ISI available on the i.MX8 M Plus it is also the only\n> native start-of-frame signal available.\n>\n> This patch exposes the sof interrupt and the framecount as\n> V4L2_EVENT_FRAME_SYNC event on the subdevice.\n>\n> It was tested on a Debix-Som-A with a 6.8-rc4 kernel.\n>\n> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n> ---\n>   drivers/media/platform/nxp/imx-mipi-csis.c | 34 +++++++++++++++++++++-\n>   1 file changed, 33 insertions(+), 1 deletion(-)\n>\n> diff --git a/drivers/media/platform/nxp/imx-mipi-csis.c b/drivers/media/platform/nxp/imx-mipi-csis.c\n> index db8ff5f5c4d3..caeb1622f741 100644\n> --- a/drivers/media/platform/nxp/imx-mipi-csis.c\n> +++ b/drivers/media/platform/nxp/imx-mipi-csis.c\n> @@ -30,6 +30,7 @@\n>   \n>   #include <media/v4l2-common.h>\n>   #include <media/v4l2-device.h>\n> +#include <media/v4l2-event.h>\n>   #include <media/v4l2-fwnode.h>\n>   #include <media/v4l2-mc.h>\n>   #include <media/v4l2-subdev.h>\n> @@ -742,6 +743,18 @@ static void mipi_csis_stop_stream(struct mipi_csis_device *csis)\n>   \tmipi_csis_system_enable(csis, false);\n>   }\n>   \n> +static void mipi_csis_queue_event_sof(struct mipi_csis_device *csis)\n> +{\n> +\tstruct v4l2_event event = {\n> +\t\t.type = V4L2_EVENT_FRAME_SYNC,\n> +\t};\n> +\n> +\tu32 frame = mipi_csis_read(csis, MIPI_CSIS_FRAME_COUNTER_CH(0));\n\nnit: variables declaration go at the start of function and then need to \nbe assigned.\n\nrest is pointed already on the thread. Otherwise LGTM,\n\nReviewed-by: Umang Jain <umang.jain@ideasonboard.com>\n\n\n\n> +\n> +\tevent.u.frame_sync.frame_sequence = frame;\n> +\tv4l2_event_queue(csis->sd.devnode, &event);\n> +}\n> +\n>   static irqreturn_t mipi_csis_irq_handler(int irq, void *dev_id)\n>   {\n>   \tstruct mipi_csis_device *csis = dev_id;\n> @@ -765,6 +778,10 @@ static irqreturn_t mipi_csis_irq_handler(int irq, void *dev_id)\n>   \t\t\t\tevent->counter++;\n>   \t\t}\n>   \t}\n> +\n> +\tif (status & MIPI_CSIS_INT_SRC_FRAME_START)\n> +\t\tmipi_csis_queue_event_sof(csis);\n> +\n>   \tspin_unlock_irqrestore(&csis->slock, flags);\n>   \n>   \tmipi_csis_write(csis, MIPI_CSIS_INT_SRC, status);\n> @@ -1154,8 +1171,23 @@ static int mipi_csis_log_status(struct v4l2_subdev *sd)\n>   \treturn 0;\n>   }\n>   \n> +static int mipi_csis_subscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh,\n> +\t\t\t       struct v4l2_event_subscription *sub)\n> +{\n> +\tif (sub->type != V4L2_EVENT_FRAME_SYNC)\n> +\t\treturn -EINVAL;\n> +\n> +\t/* V4L2_EVENT_FRAME_SYNC doesn't require an id, so zero should be set */\n> +\tif (sub->id != 0)\n> +\t\treturn -EINVAL;\n> +\n> +\treturn v4l2_event_subscribe(fh, sub, 0, NULL);\n> +}\n> +\n>   static const struct v4l2_subdev_core_ops mipi_csis_core_ops = {\n>   \t.log_status\t= mipi_csis_log_status,\n> +\t.subscribe_event =  mipi_csis_subscribe_event,\n> +\t.unsubscribe_event = v4l2_event_subdev_unsubscribe,\n>   };\n>   \n>   static const struct v4l2_subdev_video_ops mipi_csis_video_ops = {\n> @@ -1358,7 +1390,7 @@ static int mipi_csis_subdev_init(struct mipi_csis_device *csis)\n>   \tsnprintf(sd->name, sizeof(sd->name), \"csis-%s\",\n>   \t\t dev_name(csis->dev));\n>   \n> -\tsd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;\n> +\tsd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_HAS_EVENTS;\n>   \tsd->ctrl_handler = NULL;\n>   \n>   \tsd->entity.function = MEDIA_ENT_F_VID_IF_BRIDGE;","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 97BCCBD808\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 13 Mar 2024 19:12:20 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C247E62C94;\n\tWed, 13 Mar 2024 20:12:19 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2E5C162C80\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 13 Mar 2024 20:12:18 +0100 (CET)","from [192.168.1.104] (unknown [103.251.226.70])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id CA0EA720;\n\tWed, 13 Mar 2024 20:11:50 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"lMKDdus4\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1710357115;\n\tbh=hTfoqgr5I8nbMsecUcmRsIEjs7m0kEe+SvwfjmNPTL4=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:From;\n\tb=lMKDdus4yYsWv68nkNJjncIXF6yzNIPvugGvQPNeGzqqO5tAzVg5O5OWfhyLix7oi\n\tzVsnSroLgDnLIcXdN8M0bgW6IflBC/pjOoRQSA4RTsRgmY3fA9VR1aDnP9yUAEc7WS\n\t5EfNDHWrPAjoaf1/OJ98I33W6RMjpFk5GUE/tm9A=","Message-ID":"<99069f32-4bad-4cb9-aa03-4c06a596a248@ideasonboard.com>","Date":"Thu, 14 Mar 2024 00:42:08 +0530","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH] mipi-csis: Emit V4L2_EVENT_FRAME_SYNC events","To":"Stefan Klug <stefan.klug@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org, linux-media@vger.kernel.org,\n\tlinux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org","References":"<20240313153058.189684-1-stefan.klug@ideasonboard.com>","Content-Language":"en-US","From":"Umang Jain <umang.jain@ideasonboard.com>","In-Reply-To":"<20240313153058.189684-1-stefan.klug@ideasonboard.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"Purism Kernel Team <kernel@puri.sm>, Shawn Guo <shawnguo@kernel.org>,\n\tSascha Hauer <s.hauer@pengutronix.de>,\n\tRui Miguel Silva <rmfrfs@gmail.com>, NXP Linux Team <linux-imx@nxp.com>,\n\tPengutronix Kernel Team <kernel@pengutronix.de>,\n\tMartin Kepplinger <martink@posteo.de>,\n\tMauro Carvalho Chehab <mchehab@kernel.org>,\n\tFabio Estevam <festevam@gmail.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":28953,"web_url":"https://patchwork.libcamera.org/comment/28953/","msgid":"<20240313195408.GE8399@pendragon.ideasonboard.com>","date":"2024-03-13T21:10:10","subject":"Re: [PATCH] mipi-csis: Emit V4L2_EVENT_FRAME_SYNC events","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Wed, Mar 13, 2024 at 05:49:12PM +0100, Jacopo Mondi wrote:\n> Hi Stefan\n> \n> In Subject: missing the 'media:' prefix\n> \n> On Wed, Mar 13, 2024 at 04:30:58PM +0100, Stefan Klug wrote:\n> > The Samsung CSIS Mipi receiver provides a start-of-frame interrupt and\n> \n> s/Mipi/MIPI/\n> \n> > a framecount register. As the CSI receiver is the hardware unit\n> > that lies closest to the sensor, the frame counter is the best we can\n> > get on these devices.\n\nNitpicking: if you intended to start a new paragraph, add a blank line.\nIf not, don't add a line break between sentences.\n\n> > In case of the ISI available on the i.MX8 M Plus it is also the only\n> > native start-of-frame signal available.\n> >\n> > This patch exposes the sof interrupt and the framecount as\n> > V4L2_EVENT_FRAME_SYNC event on the subdevice.\n> >\n> > It was tested on a Debix-Som-A with a 6.8-rc4 kernel.\n> >\n> > Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n> > ---\n> >  drivers/media/platform/nxp/imx-mipi-csis.c | 34 +++++++++++++++++++++-\n> >  1 file changed, 33 insertions(+), 1 deletion(-)\n> >\n> > diff --git a/drivers/media/platform/nxp/imx-mipi-csis.c b/drivers/media/platform/nxp/imx-mipi-csis.c\n> > index db8ff5f5c4d3..caeb1622f741 100644\n> > --- a/drivers/media/platform/nxp/imx-mipi-csis.c\n> > +++ b/drivers/media/platform/nxp/imx-mipi-csis.c\n> > @@ -30,6 +30,7 @@\n> >\n> >  #include <media/v4l2-common.h>\n> >  #include <media/v4l2-device.h>\n> > +#include <media/v4l2-event.h>\n> >  #include <media/v4l2-fwnode.h>\n> >  #include <media/v4l2-mc.h>\n> >  #include <media/v4l2-subdev.h>\n> > @@ -742,6 +743,18 @@ static void mipi_csis_stop_stream(struct mipi_csis_device *csis)\n> >  \tmipi_csis_system_enable(csis, false);\n> >  }\n> >\n> > +static void mipi_csis_queue_event_sof(struct mipi_csis_device *csis)\n> > +{\n> > +\tstruct v4l2_event event = {\n> > +\t\t.type = V4L2_EVENT_FRAME_SYNC,\n> > +\t};\n> > +\n\nNo need for a blank line.\n\n> > +\tu32 frame = mipi_csis_read(csis, MIPI_CSIS_FRAME_COUNTER_CH(0));\n> > +\n> > +\tevent.u.frame_sync.frame_sequence = frame;\n> > +\tv4l2_event_queue(csis->sd.devnode, &event);\n> > +}\n> > +\n> >  static irqreturn_t mipi_csis_irq_handler(int irq, void *dev_id)\n> >  {\n> >  \tstruct mipi_csis_device *csis = dev_id;\n> > @@ -765,6 +778,10 @@ static irqreturn_t mipi_csis_irq_handler(int irq, void *dev_id)\n> >  \t\t\t\tevent->counter++;\n> >  \t\t}\n> >  \t}\n> > +\n> > +\tif (status & MIPI_CSIS_INT_SRC_FRAME_START)\n> > +\t\tmipi_csis_queue_event_sof(csis);\n> > +\n> >  \tspin_unlock_irqrestore(&csis->slock, flags);\n> >\n> >  \tmipi_csis_write(csis, MIPI_CSIS_INT_SRC, status);\n> > @@ -1154,8 +1171,23 @@ static int mipi_csis_log_status(struct v4l2_subdev *sd)\n> >  \treturn 0;\n> >  }\n> >\n> > +static int mipi_csis_subscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh,\n> > +\t\t\t       struct v4l2_event_subscription *sub)\n> \n> Please align to open ( on the previous line\n> \n> All minors, with the above fixed\n> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nIf you don't want to send a v2, I can address the minor comments when\napplying this to my tree. Please let me know what you prefer.\n\n> > +{\n> > +\tif (sub->type != V4L2_EVENT_FRAME_SYNC)\n> > +\t\treturn -EINVAL;\n> > +\n> > +\t/* V4L2_EVENT_FRAME_SYNC doesn't require an id, so zero should be set */\n> > +\tif (sub->id != 0)\n> > +\t\treturn -EINVAL;\n> > +\n> > +\treturn v4l2_event_subscribe(fh, sub, 0, NULL);\n> > +}\n> > +\n> >  static const struct v4l2_subdev_core_ops mipi_csis_core_ops = {\n> >  \t.log_status\t= mipi_csis_log_status,\n> > +\t.subscribe_event =  mipi_csis_subscribe_event,\n> > +\t.unsubscribe_event = v4l2_event_subdev_unsubscribe,\n> >  };\n> >\n> >  static const struct v4l2_subdev_video_ops mipi_csis_video_ops = {\n> > @@ -1358,7 +1390,7 @@ static int mipi_csis_subdev_init(struct mipi_csis_device *csis)\n> >  \tsnprintf(sd->name, sizeof(sd->name), \"csis-%s\",\n> >  \t\t dev_name(csis->dev));\n> >\n> > -\tsd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;\n> > +\tsd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_HAS_EVENTS;\n> >  \tsd->ctrl_handler = NULL;\n> >\n> >  \tsd->entity.function = MEDIA_ENT_F_VID_IF_BRIDGE;","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 1F54CBD160\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 13 Mar 2024 21:10:05 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3955F62C92;\n\tWed, 13 Mar 2024 22:10:04 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0F13562C8C\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 13 Mar 2024 22:10:03 +0100 (CET)","from pendragon.ideasonboard.com (unknown [95.214.66.65])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 11FAF2D6B;\n\tWed, 13 Mar 2024 22:09:40 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"a09Y27gV\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1710364180;\n\tbh=dSNdEew0TvY2dz+P/qyS2VqxJ+0O8XNKI5IRxLVgvAw=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=a09Y27gVrIRYTRA/ANWkT5LNwoF+Z/ehp6m0hnglld9EHUurCsmKRkkQloDG0OZR1\n\tCM4IZ5JrSPCEBjNkEgEGUOwfFAGmPEZsywumIDibfzMqAHtplx+p67LJQF6ui2vGk6\n\tuRfK0X9vR5UIWopJnp40Bzz8ONxFGt+JhKjJuJFk=","Date":"Wed, 13 Mar 2024 23:10:10 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","Subject":"Re: [PATCH] mipi-csis: Emit V4L2_EVENT_FRAME_SYNC events","Message-ID":"<20240313195408.GE8399@pendragon.ideasonboard.com>","References":"<20240313153058.189684-1-stefan.klug@ideasonboard.com>\n\t<axrx5ynlyoyjgkhj3j4r5b6xfaxwetx4c7u5ngq5wunin5ynv6@qmvav4y3xczq>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<axrx5ynlyoyjgkhj3j4r5b6xfaxwetx4c7u5ngq5wunin5ynv6@qmvav4y3xczq>","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"Martin Kepplinger <martink@posteo.de>,\n\tPurism Kernel Team <kernel@puri.sm>, Fabio Estevam <festevam@gmail.com>,\n\tSascha Hauer <s.hauer@pengutronix.de>, \n\tlinux-kernel@vger.kernel.org, Rui Miguel Silva <rmfrfs@gmail.com>,\n\tlibcamera-devel@lists.libcamera.org, NXP Linux Team <linux-imx@nxp.com>, \n\tPengutronix Kernel Team <kernel@pengutronix.de>,\n\tStefan Klug <stefan.klug@ideasonboard.com>,\n\tMauro Carvalho Chehab <mchehab@kernel.org>,\n\tShawn Guo <shawnguo@kernel.org>, \n\tlinux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]