linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hans de Goede <hansg@kernel.org>
To: Kieran Bingham <kieran.bingham@ideasonboard.com>,
	Andy Shevchenko <andy@kernel.org>,
	Hans de Goede <hdegoede@redhat.com>,
	Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
	linux-media@vger.kernel.org, linux-staging@lists.linux.dev
Subject: Re: [PATCH 06/23] media: atomisp: gc0310: Add selection API support
Date: Sun, 6 Jul 2025 11:52:34 +0200	[thread overview]
Message-ID: <c389587a-483b-43f7-9393-cdfd8132df20@kernel.org> (raw)
In-Reply-To: <174751450775.281096.10701361397332094857@ping.linuxembedded.co.uk>

Hi Kieran,

On 17-May-25 10:41 PM, Kieran Bingham wrote:
> Quoting Hans de Goede (2025-05-17 12:40:49)
>> Add support for the selection API as expected by libcamera.
>>
>> Note the driver only supports a single fixed resolution and
>> no cropping, so this is a simple read-only implementation.
>>
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>> ---
>>  .../media/atomisp/i2c/atomisp-gc0310.c        | 42 ++++++++++++++++++-
>>  1 file changed, 41 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c b/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
>> index 756e56f639b7..7902e732a3ca 100644
>> --- a/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
>> +++ b/drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
>> @@ -3,7 +3,7 @@
>>   * Support for GalaxyCore GC0310 VGA camera sensor.
>>   *
>>   * Copyright (c) 2013 Intel Corporation. All Rights Reserved.
>> - * Copyright (c) 2023 Hans de Goede <hdegoede@redhat.com>
>> + * Copyright (c) 2023-2025 Hans de Goede <hansg@kernel.org>
>>   */
>>  
>>  #include <linux/delay.h>
>> @@ -352,6 +352,43 @@ static int gc0310_get_fmt(struct v4l2_subdev *sd,
>>         return 0;
>>  }
>>  
>> +static int gc0310_get_selection(struct v4l2_subdev *sd,
>> +                               struct v4l2_subdev_state *state,
>> +                               struct v4l2_subdev_selection *sel)
>> +{
>> +       /* Only the single fixed 656x496 mode is supported, without croping */
>> +       switch (sel->target) {
>> +       case V4L2_SEL_TGT_CROP:
>> +       case V4L2_SEL_TGT_CROP_BOUNDS:
>> +       case V4L2_SEL_TGT_CROP_DEFAULT:
>> +       case V4L2_SEL_TGT_NATIVE_SIZE:
>> +               sel->r.top = 0;
>> +               sel->r.left = 0;
>> +               sel->r.width = GC0310_NATIVE_WIDTH;
>> +               sel->r.height = GC0310_NATIVE_HEIGHT;
>> +               break;
>> +       default:
>> +               return -EINVAL;
>> +       }
>> +
>> +       return 0;
>> +}
>> +
>> +static int gc0310_set_selection(struct v4l2_subdev *sd,
>> +                               struct v4l2_subdev_state *state,
>> +                               struct v4l2_subdev_selection *sel)
>> +{
>> +       if (sel->target != V4L2_SEL_TGT_CROP)
>> +               return -EINVAL;
>> +
>> +       /* Only the single fixed 656x496 mode is supported, without croping */
>> +       sel->r.top = 0;
>> +       sel->r.left = 0;
>> +       sel->r.width = GC0310_NATIVE_WIDTH;
>> +       sel->r.height = GC0310_NATIVE_HEIGHT;
>> +       return 0;
>> +}
>> +
>>  static int gc0310_detect(struct gc0310_device *sensor)
>>  {
>>         struct i2c_client *client = v4l2_get_subdevdata(&sensor->sd);
>> @@ -509,6 +546,8 @@ static const struct v4l2_subdev_pad_ops gc0310_pad_ops = {
>>         .enum_frame_size = gc0310_enum_frame_size,
>>         .get_fmt = gc0310_get_fmt,
>>         .set_fmt = gc0310_set_fmt,
>> +       .get_selection = gc0310_get_selection,
>> +       .set_selection = gc0310_set_selection,
> 
> On other sensors I've worked on, we haven't implemented .set_selection()
> unless it can be changed. I think this could be simplified here? - Just
> the implementation in .get_selection should be enough I think ?
> 
> Saves a few lines when it's not configurable.

Right. I'm working on merging this series now (minus the last
patch), preparing an atomisp pull-request for 6.17, addressing
review comments as I go.

I've gone with using get_selection for set_selection while
merging this.

Regards,

Hans





> 
> In imx283.c we have no implementation of .set_selection; though in
> imx335.c - we simply set .set_selection = imx335_get_selection;
> 
> imx415.c also only sets the .get_selection callback ... so maybe I could
> already simplify imx335 too!
> 
> 
> 
>>         .get_frame_interval = gc0310_get_frame_interval,
>>  };
>>  
>> @@ -671,5 +710,6 @@ static struct i2c_driver gc0310_driver = {
>>  module_i2c_driver(gc0310_driver);
>>  
>>  MODULE_AUTHOR("Lai, Angie <angie.lai@intel.com>");
>> +MODULE_AUTHOR("Hans de Goede <hansg@kernel.org>");
>>  MODULE_DESCRIPTION("A low-level driver for GalaxyCore GC0310 sensors");
>>  MODULE_LICENSE("GPL");
>> -- 
>> 2.49.0
>>
> 


  reply	other threads:[~2025-07-06  9:52 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-17 11:40 [PATCH 00/23] media: atomisp: gc0310: Modernize and move to drivers/media Hans de Goede
2025-05-17 11:40 ` [PATCH 01/23] media: atomisp: gc0310: Rename "dev" function variable to "sensor" Hans de Goede
2025-05-17 20:42   ` Kieran Bingham
2025-05-17 11:40 ` [PATCH 02/23] media: atomisp: gc0310: Drop unused GC0310_FOCAL_LENGTH_NUM define Hans de Goede
2025-05-17 20:43   ` Kieran Bingham
2025-05-17 11:40 ` [PATCH 03/23] media: atomisp: gc0310: Modify vblank value to run at 30 fps Hans de Goede
2025-05-17 20:45   ` Kieran Bingham
2025-05-17 11:40 ` [PATCH 04/23] media: atomisp: gc0310: Switch to CCI register access helpers Hans de Goede
2025-05-19 11:09   ` Andy Shevchenko
2025-05-17 11:40 ` [PATCH 05/23] media: atomisp: gc0310: Use V4L2_CID_ANALOGUE_GAIN for gain control Hans de Goede
2025-05-17 21:09   ` Kieran Bingham
2025-05-18  9:42     ` Kieran Bingham
2025-05-21 14:04       ` Laurent Pinchart
2025-07-04 20:53     ` Hans de Goede
2025-05-17 11:40 ` [PATCH 06/23] media: atomisp: gc0310: Add selection API support Hans de Goede
2025-05-17 20:41   ` Kieran Bingham
2025-07-06  9:52     ` Hans de Goede [this message]
2025-05-17 11:40 ` [PATCH 07/23] media: atomisp: gc0310: Add link-frequency and pixelrate controls Hans de Goede
2025-05-19 11:30   ` Andy Shevchenko
2025-07-06  9:57     ` Hans de Goede
2025-07-08  8:04       ` Sakari Ailus
2025-07-08  9:47         ` Hans de Goede
2025-05-17 11:40 ` [PATCH 08/23] media: atomisp: gc0310: Add vblank and hblank controls Hans de Goede
2025-05-19 11:32   ` Andy Shevchenko
2025-05-17 11:40 ` [PATCH 09/23] media: atomisp: gc0310: Add camera orientation and sensor rotation controls Hans de Goede
2025-05-17 11:40 ` [PATCH 10/23] media: atomisp: gc0310: Limit max exposure value to mode-height + vblank Hans de Goede
2025-05-17 11:40 ` [PATCH 11/23] media: atomisp: gc0310: Add check_hwcfg() function Hans de Goede
2025-05-19 11:35   ` Andy Shevchenko
2025-07-06  9:58     ` Hans de Goede
2025-05-17 11:40 ` [PATCH 12/23] media: atomisp: gc0310: Fix power on/off sleep times Hans de Goede
2025-05-19 11:40   ` Andy Shevchenko
2025-05-17 11:40 ` [PATCH 13/23] media: atomisp: gc0310: Remove unused is_streaming variable Hans de Goede
2025-05-17 11:40 ` [PATCH 14/23] media: atomisp: gc0310: Switch to {enable,disable}_streams Hans de Goede
2025-05-19 11:43   ` Andy Shevchenko
2025-07-06 13:45     ` Hans de Goede
2025-05-17 11:40 ` [PATCH 15/23] media: atomisp: gc0310: Switch to using the sub-device state lock Hans de Goede
2025-05-19 11:44   ` Andy Shevchenko
2025-07-06 13:51     ` Hans de Goede
2025-05-17 11:40 ` [PATCH 16/23] media: atomisp: gc0310: Implement internal_ops.init_state Hans de Goede
2025-05-17 11:41 ` [PATCH 17/23] media: atomisp: gc0310: Use v4l2_subdev_get_fmt() as v4l2_subdev_pad_ops.get_fmt() Hans de Goede
2025-05-17 11:41 ` [PATCH 18/23] media: atomisp: gc0310: Switch to using sd.active_state fmt Hans de Goede
2025-05-17 11:41 ` [PATCH 19/23] media: atomisp: gc0310: Move and rename suspend/resume functions Hans de Goede
2025-05-19 11:50   ` Andy Shevchenko
2025-07-06 14:01     ` Hans de Goede
2025-05-17 11:41 ` [PATCH 20/23] media: atomisp: gc0310: runtime-PM fixes Hans de Goede
2025-05-17 11:41 ` [PATCH 21/23] media: atomisp: gc0310: Drop gc0310_get_frame_interval() Hans de Goede
2025-05-18  9:44   ` Kieran Bingham
2025-05-17 11:41 ` [PATCH 22/23] media: atomisp: gc0310: Drop gc0310_g_skip_frames() Hans de Goede
2025-05-17 14:12   ` Kieran Bingham
2025-05-17 11:41 ` [PATCH 23/23] media: Move gc0310 sensor drivers to drivers/media/i2c/ Hans de Goede
2025-05-19 12:19   ` Sakari Ailus
2025-05-23 10:17   ` Dan Carpenter
2025-07-06 13:55     ` Hans de Goede
2025-05-19 11:54 ` [PATCH 00/23] media: atomisp: gc0310: Modernize and move to drivers/media Andy Shevchenko

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=c389587a-483b-43f7-9393-cdfd8132df20@kernel.org \
    --to=hansg@kernel.org \
    --cc=andy@kernel.org \
    --cc=hdegoede@redhat.com \
    --cc=kieran.bingham@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=mchehab@kernel.org \
    --cc=sakari.ailus@linux.intel.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;
as well as URLs for NNTP newsgroup(s).