From: Hugues FRUCHET <hugues.fruchet@st.com>
To: Hans Verkuil <hverkuil@xs4all.nl>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
Alexandre TORGUE <alexandre.torgue@st.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: "devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
Benjamin Gaignard <benjamin.gaignard@linaro.org>,
Yannick FERTRE <yannick.fertre@st.com>
Subject: Re: [PATCH v1 4/5] [media] stm32-dcmi: set default format at open()
Date: Mon, 21 Aug 2017 10:20:25 +0000 [thread overview]
Message-ID: <47cc9905-27d8-abec-2e28-f97a073249c9@st.com> (raw)
In-Reply-To: <a5a158b3-b502-d220-52bb-8138328c1773@xs4all.nl>
On 08/04/2017 02:00 PM, Hans Verkuil wrote:
> On 28/07/17 12:05, Hugues Fruchet wrote:
>> Ensure that we start with default pixel format and resolution
>> when opening a new instance.
>
> Why? The format is persistent in V4L2 and (re)opening the video device
> shouldn't change the format.
>
> Suppose you use v4l2-ctl to set up a format. E.g. v4l2-ctl -v width=320,height-240.
> Now run v4l2-ctl -V to get the format and with this code it would suddenly be
> back to the default!
>
> You set up the default format in the dcmi_graph_notify_complete, but after that
> it is only changed if userspace explicitly requests it.
>
> Regards,
>
> Hans
>
Thanks Hans, I didn't catch this before, thanks for explanation.
>>
>> Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
>> ---
>> drivers/media/platform/stm32/stm32-dcmi.c | 49 ++++++++++++++++++-------------
>> 1 file changed, 28 insertions(+), 21 deletions(-)
>>
>> diff --git a/drivers/media/platform/stm32/stm32-dcmi.c b/drivers/media/platform/stm32/stm32-dcmi.c
>> index 4733d1f..2be56b6 100644
>> --- a/drivers/media/platform/stm32/stm32-dcmi.c
>> +++ b/drivers/media/platform/stm32/stm32-dcmi.c
>> @@ -890,6 +890,28 @@ static int dcmi_enum_frameintervals(struct file *file, void *fh,
>> return 0;
>> }
>>
>> +static int dcmi_set_default_fmt(struct stm32_dcmi *dcmi)
>> +{
>> + struct v4l2_format f = {
>> + .type = V4L2_BUF_TYPE_VIDEO_CAPTURE,
>> + .fmt.pix = {
>> + .width = CIF_WIDTH,
>> + .height = CIF_HEIGHT,
>> + .field = V4L2_FIELD_NONE,
>> + .pixelformat = dcmi->sd_formats[0]->fourcc,
>> + },
>> + };
>> + int ret;
>> +
>> + ret = dcmi_try_fmt(dcmi, &f, NULL);
>> + if (ret)
>> + return ret;
>> + dcmi->sd_format = dcmi->sd_formats[0];
>> + dcmi->fmt = f;
>> +
>> + return 0;
>> +}
>> +
>> static const struct of_device_id stm32_dcmi_of_match[] = {
>> { .compatible = "st,stm32-dcmi"},
>> { /* end node */ },
>> @@ -916,7 +938,13 @@ static int dcmi_open(struct file *file)
>> if (ret < 0 && ret != -ENOIOCTLCMD)
>> goto fh_rel;
>>
>> + ret = dcmi_set_default_fmt(dcmi);
>> + if (ret)
>> + goto power_off;
>> +
>> ret = dcmi_set_fmt(dcmi, &dcmi->fmt);
>> +
>> +power_off:
>> if (ret)
>> v4l2_subdev_call(sd, core, s_power, 0);
>> fh_rel:
>> @@ -991,27 +1019,6 @@ static int dcmi_release(struct file *file)
>> .read = vb2_fop_read,
>> };
>>
>> -static int dcmi_set_default_fmt(struct stm32_dcmi *dcmi)
>> -{
>> - struct v4l2_format f = {
>> - .type = V4L2_BUF_TYPE_VIDEO_CAPTURE,
>> - .fmt.pix = {
>> - .width = CIF_WIDTH,
>> - .height = CIF_HEIGHT,
>> - .field = V4L2_FIELD_NONE,
>> - .pixelformat = dcmi->sd_formats[0]->fourcc,
>> - },
>> - };
>> - int ret;
>> -
>> - ret = dcmi_try_fmt(dcmi, &f, NULL);
>> - if (ret)
>> - return ret;
>> - dcmi->sd_format = dcmi->sd_formats[0];
>> - dcmi->fmt = f;
>> - return 0;
>> -}
>> -
>> static const struct dcmi_format dcmi_formats[] = {
>> {
>> .fourcc = V4L2_PIX_FMT_RGB565,
>>
>
next prev parent reply other threads:[~2017-08-21 10:23 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-28 10:04 [PATCH v1 0/5] STM32 DCMI camera interface crop support Hugues Fruchet
2017-07-28 10:04 ` [PATCH v1 1/5] [media] stm32-dcmi: catch dma submission error Hugues Fruchet
2017-07-28 10:04 ` [PATCH v1 2/5] [media] stm32-dcmi: revisit control register handling Hugues Fruchet
2017-07-28 10:05 ` [PATCH v1 3/5] [media] stm32-dcmi: cleanup variable/fields namings Hugues Fruchet
2017-08-04 11:51 ` Hans Verkuil
2017-07-28 10:05 ` [PATCH v1 4/5] [media] stm32-dcmi: set default format at open() Hugues Fruchet
2017-08-04 12:00 ` Hans Verkuil
2017-08-21 10:20 ` Hugues FRUCHET [this message]
2017-07-28 10:05 ` [PATCH v1 5/5] [media] stm32-dcmi: g_/s_selection crop support Hugues Fruchet
2017-07-30 4:26 ` kbuild test robot
2017-08-04 12:26 ` Hans Verkuil
2017-08-21 10:19 ` Hugues FRUCHET
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=47cc9905-27d8-abec-2e28-f97a073249c9@st.com \
--to=hugues.fruchet@st.com \
--cc=alexandre.torgue@st.com \
--cc=benjamin.gaignard@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=hverkuil@xs4all.nl \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=mcoquelin.stm32@gmail.com \
--cc=yannick.fertre@st.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
all inboxes | Powered by JetHome®