devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sylvain Petinot <sylvain.petinot@foss.st.com>
To: Sakari Ailus <sakari.ailus@iki.fi>
Cc: <benjamin.mugnier@foss.st.com>, <mchehab@kernel.org>,
	<robh@kernel.org>, <krzysztof.kozlowski+dt@linaro.org>,
	<conor+dt@kernel.org>, <linux-media@vger.kernel.org>,
	<devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 2/2] media: i2c: Add driver for ST VD56G3 camera sensor
Date: Mon, 9 Sep 2024 10:42:16 +0200	[thread overview]
Message-ID: <4b37dccd-bfc6-4355-847f-f613a4a87263@foss.st.com> (raw)
In-Reply-To: <Zt6ei2-orFC4Jq1g@valkosipuli.retiisi.eu>

Hello Sakari,

Thanks for your feedback, no worries about the delay ...

On 9/9/2024 9:06 AM, Sakari Ailus wrote:
> Hi Sylwain,
> 
> Apologies for the delay...
> 
> On Mon, Jun 03, 2024 at 11:59:29AM +0200, Sylvain Petinot wrote:
>>>> +/*
>>>> + * The VD56G3 pixel array is organized as follows:
>>>> + *
>>>> + * +--------------------------------+
>>>> + * |                                | \
>>>> + * |   +------------------------+   |  |
>>>> + * |   |                        |   |  |
>>>> + * |   |                        |   |  |
>>>> + * |   |                        |   |  |
>>>> + * |   |                        |   |  |
>>>> + * |   |                        |   |  |
>>>> + * |   |   Default resolution   |   |  | Native height (1364)
>>>
>>> What's outside the default resolution? It doesn't appear the driver would
>>> allow capturing pixels out side this area.
>>
>> Well both native and default resolutions are supported in the
>> 'vd56g3_supported_modes' below.
>> However this quite exotic resolution (1364 x 1124) isn't well supported
>> by csi receivers, ISPs. That's why the default resolution of the driver
>> is 1120 x 1360 (multiple of 16).
> 
> Ack.
> 
> I'd still keep the native resolution as the default and allow configuring
> something else if the user space wants to.
> 
> The desired resolution really depends on the use case (as well as the ISP).

Sure, I can change the default to the native... The choice I made was
more a way to simplify (my) life (several times we went into debugging
before realizing that it was the exotic resolution causing the unwanted
behavior).
But, that's probably better, I'll change it for V4.

> 
>>>> +		break;
>>>> +	case V4L2_CID_EXPOSURE_AUTO:
>>>> +		is_auto = (ctrl->val == V4L2_EXPOSURE_AUTO);
>>>> +		__v4l2_ctrl_grab(sensor->ae_lock_ctrl, !is_auto);
>>>> +		__v4l2_ctrl_grab(sensor->ae_bias_ctrl, !is_auto);
>>>> +		break;
>>>> +	default:
>>>> +		break;
>>>
>>> You could omit default here.
>>
>> I don't really like switch case without default. For sure I can omit,
>> but I prefer making it explicit.
> 
> I'm ok with that.
> 
> ...
> 
>>>> +static int vd56g3_power_off(struct vd56g3 *sensor)
>>>> +{
>>>> +	clk_disable_unprepare(sensor->xclk);
>>>> +	gpiod_set_value_cansleep(sensor->reset_gpio, 1);
>>>> +	regulator_bulk_disable(ARRAY_SIZE(sensor->supplies), sensor->supplies);
>>>> +	return 0;
>>>
>>> You can make the return type void.
>>>
>>> Do you need two pairs of functions doing the same, or could you call
>>> vd56g3_runtime_resume and vd56g3_runtime_suspend from driver's probe and
>>> remove functions, too?
>>
>> "Well, in fact, I tested both options before submitting V2 (I mean the
>> unification of vd56g3_runtime_resume/suspend functions with
>> vd56g3_power_on/off).
>>
>> The unification option has the advantage of simplifying the code and
>> removing two "useless" functions. The only drawback is that I had to
>> call v4l2_i2c_subdev_init() earlier in the probe() function, whereas
>> it's currently called in vd56g3_subdev_init() (currently at the end of
>> the probe()). OK, it's not a big deal, but I find that the resulting
>> code is not as well structured/divided (thus readable).
>>
>> I'm interested to get your feedback to decide wich option to push for V3.
> 
> I'd prefer calling v4l2_i2c_subdev_init() earlier, in order to set the
> device context. These are usually among those things that should be done as
> early as possible, in order to avoid invalid pointers where much of the
> driver code expects something else.

Yes, the V3 I pushed include this modification.

> 
> Btw. if you're not in too much hurry (I guess so?), we're just about to
> rework the sensor API, to include internal pads and embedded data, for
> better sensor configurability. It'll take a while before we're there
> though, but when this driver is merged, the existing API must continue to
> work.
> 

I have a few branches with stream API (notably for the support of status
lines), but I need a to test a bit more before pushing.


--
Sylvain

      reply	other threads:[~2024-09-09  8:45 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-21 16:29 [PATCH v2 0/2] media: Add driver for ST VD56G3 camera sensor Sylvain Petinot
2024-05-21 16:29 ` [PATCH v2 1/2] media: dt-bindings: Add ST VD56G3 camera sensor binding Sylvain Petinot
2024-05-21 17:37   ` Krzysztof Kozlowski
2024-05-27 13:14     ` Sylvain Petinot
2024-05-27 19:00       ` Krzysztof Kozlowski
2024-06-03  8:46         ` Sylvain Petinot
2024-05-27 20:08       ` Sakari Ailus
2024-05-27 19:04   ` Krzysztof Kozlowski
2024-05-28  9:22     ` Sakari Ailus
2024-05-28  9:46       ` Krzysztof Kozlowski
2024-05-28 10:01         ` Sakari Ailus
2024-06-03  8:47           ` Sylvain Petinot
2024-05-21 16:29 ` [PATCH v2 2/2] media: i2c: Add driver for ST VD56G3 camera sensor Sylvain Petinot
2024-05-28 11:49   ` Sakari Ailus
2024-06-03  9:59     ` Sylvain Petinot
2024-09-09  7:06       ` Sakari Ailus
2024-09-09  8:42         ` Sylvain Petinot [this message]

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=4b37dccd-bfc6-4355-847f-f613a4a87263@foss.st.com \
    --to=sylvain.petinot@foss.st.com \
    --cc=benjamin.mugnier@foss.st.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=robh@kernel.org \
    --cc=sakari.ailus@iki.fi \
    /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).