lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Thu, 8 Feb 2018 11:02:50 +0000
From:   Hugues FRUCHET <hugues.fruchet@...com>
To:     Hans Verkuil <hverkuil@...all.nl>,
        Maxime Coquelin <mcoquelin.stm32@...il.com>,
        Alexandre TORGUE <alexandre.torgue@...com>,
        Mauro Carvalho Chehab <mchehab@...nel.org>
CC:     "devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
        "linux-arm-kernel@...ts.infradead.org" 
        <linux-arm-kernel@...ts.infradead.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-media@...r.kernel.org" <linux-media@...r.kernel.org>,
        Benjamin Gaignard <benjamin.gaignard@...aro.org>,
        Yannick FERTRE <yannick.fertre@...com>
Subject: Re: [PATCH] media: stm32-dcmi: add g/s_parm framerate support

Thanks Hans,
v2 sent, rebased on your helpers !
Best regards,
Hugues.

On 02/07/2018 06:52 PM, Hans Verkuil wrote:
> On 02/07/2018 06:43 PM, Hugues Fruchet wrote:
>> Add g/s_parm framerate support by calling subdev
>> g/s_frame_interval ops.
>> This allows user to control sensor framerate by
>> calling ioctl G/S_PARM.
>>
>> Signed-off-by: Hugues Fruchet <hugues.fruchet@...com>
>> ---
>>   drivers/media/platform/stm32/stm32-dcmi.c | 49 +++++++++++++++++++++++++++++++
>>   1 file changed, 49 insertions(+)
>>
>> diff --git a/drivers/media/platform/stm32/stm32-dcmi.c b/drivers/media/platform/stm32/stm32-dcmi.c
>> index ab555d4..8197554 100644
>> --- a/drivers/media/platform/stm32/stm32-dcmi.c
>> +++ b/drivers/media/platform/stm32/stm32-dcmi.c
>> @@ -1151,6 +1151,52 @@ static int dcmi_enum_framesizes(struct file *file, void *fh,
>>   	return 0;
>>   }
>>   
>> +static int dcmi_g_parm(struct file *file, void *priv,
>> +		       struct v4l2_streamparm *p)
>> +{
>> +	struct stm32_dcmi *dcmi = video_drvdata(file);
>> +	struct v4l2_subdev_frame_interval ival = { 0 };
>> +	int ret;
>> +
>> +	if (p->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
>> +		return -EINVAL;
>> +
>> +	p->parm.capture.capability = V4L2_CAP_TIMEPERFRAME;
>> +	ret = v4l2_subdev_call(dcmi->entity.subdev, video,
>> +			       g_frame_interval, &ival);
>> +	if (ret)
>> +		return ret;
>> +
>> +	p->parm.capture.timeperframe = ival.interval;
>> +
>> +	return ret;
>> +}
> 
> This function and the next can be simplified by using the help functions
> introduced here:
> 
> https://git.linuxtv.org/hverkuil/media_tree.git/log/?h=parm
> 
> I'll make a pull request for this later this week, so it's probably a good
> idea to base your code on this as well.
> 
> Regards,
> 
> 	Hans
> 
>> +
>> +static int dcmi_s_parm(struct file *file, void *priv,
>> +		       struct v4l2_streamparm *p)
>> +{
>> +	struct stm32_dcmi *dcmi = video_drvdata(file);
>> +	struct v4l2_subdev_frame_interval ival = {
>> +		0,
>> +		p->parm.capture.timeperframe
>> +	};
>> +	int ret;
>> +
>> +	if (p->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
>> +		return -EINVAL;
>> +
>> +	memset(&p->parm, 0, sizeof(p->parm));
>> +	p->parm.capture.capability = V4L2_CAP_TIMEPERFRAME;
>> +	ret = v4l2_subdev_call(dcmi->entity.subdev, video,
>> +			       s_frame_interval, &ival);
>> +	if (ret)
>> +		return ret;
>> +
>> +	p->parm.capture.timeperframe = ival.interval;
>> +
>> +	return ret;
>> +}
>> +
>>   static int dcmi_enum_frameintervals(struct file *file, void *fh,
>>   				    struct v4l2_frmivalenum *fival)
>>   {
>> @@ -1253,6 +1299,9 @@ static int dcmi_release(struct file *file)
>>   	.vidioc_g_input			= dcmi_g_input,
>>   	.vidioc_s_input			= dcmi_s_input,
>>   
>> +	.vidioc_g_parm			= dcmi_g_parm,
>> +	.vidioc_s_parm			= dcmi_s_parm,
>> +
>>   	.vidioc_enum_framesizes		= dcmi_enum_framesizes,
>>   	.vidioc_enum_frameintervals	= dcmi_enum_frameintervals,
>>   
>>
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ