Re: [PATCH 2/4] media: ov2740: Add camera orientation and sensor rotation controls

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On 28-Nov-24 5:44 PM, Ricardo Ribalda Delgado wrote:
> Hi
> 
> On Thu, Nov 28, 2024 at 4:24 PM Hans de Goede <hdegoede@xxxxxxxxxx> wrote:
>>
>> Add camera orientation and sensor rotation controls using
>> the v4l2_fwnode_device_parse() and v4l2_ctrl_new_fwnode_properties()
>> helpers.
>>
>> Signed-off-by: Hans de Goede <hdegoede@xxxxxxxxxx>
>> ---
>>  drivers/media/i2c/ov2740.c | 11 ++++++++++-
>>  1 file changed, 10 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/media/i2c/ov2740.c b/drivers/media/i2c/ov2740.c
>> index e7a611967b40..998e1977978d 100644
>> --- a/drivers/media/i2c/ov2740.c
>> +++ b/drivers/media/i2c/ov2740.c
>> @@ -755,15 +755,17 @@ static const struct v4l2_ctrl_ops ov2740_ctrl_ops = {
>>
>>  static int ov2740_init_controls(struct ov2740 *ov2740)
>>  {
>> +       struct i2c_client *client = v4l2_get_subdevdata(&ov2740->sd);
> nit: dont you prefer to pass the i2c_client as a parameter?

The client is retrieved from the sub-device in the same way in other
places.

>>         struct v4l2_ctrl_handler *ctrl_hdlr;
>>         const struct ov2740_mode *cur_mode;
>>         s64 exposure_max, h_blank, pixel_rate;
>>         u32 vblank_min, vblank_max, vblank_default;
>> +       struct v4l2_fwnode_device_properties props;
>>         int size;
>>         int ret;
>>
>>         ctrl_hdlr = &ov2740->ctrl_handler;
>> -       ret = v4l2_ctrl_handler_init(ctrl_hdlr, 8);
>> +       ret = v4l2_ctrl_handler_init(ctrl_hdlr, 10);
>>         if (ret)
>>                 return ret;
>>
>> @@ -813,6 +815,13 @@ static int ov2740_init_controls(struct ov2740 *ov2740)
>>                                      V4L2_CID_TEST_PATTERN,
>>                                      ARRAY_SIZE(ov2740_test_pattern_menu) - 1,
>>                                      0, 0, ov2740_test_pattern_menu);
>> +
>> +       ret = v4l2_fwnode_device_parse(&client->dev, &props);
>> +       if (ret)
> There is no need to v4l2_ctrl_handler_free(ctrl_hdlr); here?

There is, good catch. I'll fix this for v2.

Regards,

Hans


> 
>> +               return ret;
>> +
>> +       v4l2_ctrl_new_fwnode_properties(ctrl_hdlr, &ov2740_ctrl_ops, &props);
>> +
>>         if (ctrl_hdlr->error) {
>>                 v4l2_ctrl_handler_free(ctrl_hdlr);
>>                 return ctrl_hdlr->error;
>> --
>> 2.47.0
>>
>>
> 
> 





[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux