Linux Media Controller development
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Daniel Scally <djrscally@gmail.com>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Kate Hsuan <hpa@redhat.com>
Cc: Linux Media Mailing List <linux-media@vger.kernel.org>,
	libcamera-devel@lists.libcamera.org,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: Re: Fwd: Surface Go VCM type (was: Need to pass acpi_enforce_resources=lax on the Surface Go (version1))
Date: Thu, 11 Nov 2021 11:35:02 +0100	[thread overview]
Message-ID: <495cbb6b-656d-6c3b-669a-f4b588e970cc@redhat.com> (raw)
In-Reply-To: <6ee7c491-4636-8819-c954-dfc6abcfd1a5@gmail.com>

Hi,

On 11/10/21 01:01, Daniel Scally wrote:
> Hi Hans
> 
> On 09/11/2021 16:35, Daniel Scally wrote:
>>>>> That's not working correctly for me at the moment, but I think this is a
>>>>> surmountable problem rather than the wrong approach, so I'm just working
>>>>> through the differences to try and get the matching working.
>>>> OK, I eventually got this working - the dw9719 registers as
>>>> /dev/v4l-subdev7 for me now ... long story short is the attached patch
>>>> was needed to make the references work, as the internals of v4l2 aren't
>>>> checking for fwnode->secondary. Prior to your latest series as well, an
>>>> additional problem was that once the VCMs fwnode was linked to the
>>>> sensor's the .complete() callback for ipu3-cio2 would never call
>>>> (because it needs ALL the devices for the linked fwnodes to be bound to
>>>> do that)...which meant the VCMs never got instantiated, because that was
>>>> where that function was called. With your new set separating those
>>>> processes it works well, so yes I like that new approach very much :D
>>>>
>>>>
>>>> In the end we don't have to add a call creating the subdev's - it turns
>>>> out that v4l2 knows it's part of ipu3-cio2's v4l2-device so it registers
>>>> the nodes for the vcm when .complete() is called for that driver. I
>>>> still think we should add a bit creating the link to expose to userspace
>>>> in match_notify() though.
>>>>
>>>>
>>>> Trying to list controls for the dw9719 with v4l2-ctl -d /dev/v4l-subdev7
>>>> -L fails with an IOCTL error, so I have some remedial work on the driver
>>>> which I'll do tonight; I'd expect to be able to control focus with
>>>> v4l2-ctl -d /dev/v4l-subdev7 -c absolute_focus=n once this is sorted.
>>> That is great, thank you so much. I wanted to look into this myself
>>> today but I got distracted by other stuff.
>>
>> No problem; I'll link you the patches for the updated versions of
>> everything once I've sorted the IOCTL error tonight.
> 
> 
> OK, this is running now. With the attached patches on top of your v5
> series and the 4-patch series from earlier today, the dw9719 registers
> as a v4l2 subdev and I can control it with v4l2-ctl -d /dev/v4l-subdev7
> -c focus_absolute=1200 (or whatever value).

Great, thank you! I've given this a quick test and indeed everything
works :)

I did notice a typo in a comment in the dw9719.c file which I added
myself, can you squash in this fix pleas? :

diff --git a/drivers/media/i2c/dw9719.c b/drivers/media/i2c/dw9719.c
index 047f7636efde..c647b50c2ebf 100644
--- a/drivers/media/i2c/dw9719.c
+++ b/drivers/media/i2c/dw9719.c
@@ -283,7 +283,7 @@ static int dw9719_probe(struct i2c_client *client)
 	 * the TPS68470 PMIC have I2C passthrough capability, to disconnect the
 	 * sensor's I2C pins from the I2C bus when the sensors VSIO (Sensor-IO)
 	 * is off, because some sensors then short these pins to ground;
-	 * and the DW9719 might sit behind this passthrough, this it needs to
+	 * and the DW9719 might sit behind this passthrough, thus it needs to
 	 * enable VSIO as that will also enable the I2C passthrough.
 	 */
 	dw9719->regulators[1].supply = "vsio";

Also I think that the 

"device property: Check fwnode->secondary when finding properties"

That patch looks good to me, so please add my:

Reviewed-by: Hans de Goede <hdegoede@redhat.com>

Can you submit this upstream please?

I will prepare a new version of my:

"[PATCH v5 00/11] Add support for X86/ACPI camera sensor/PMIC setup with clk and regulator platform data"

series, addressing the few remaining comments and adding the regulator
data + instantiating support for the VCM.

> One problem I'm experiencing
> is that the focus position I set isn't maintained; it holds for a couple
> of seconds and then resets to the "normal" focus...this happens when the
> .close() callback for the driver is called, which happens right after
> the control value is applied. All the other VCM drivers in the kernel
> power down on .close() so I did the same>

Right, I believe that this is fine though, we expect people to use
libcamera with this and once libcamera gets autofocus support, then
I would expect libcamera to keep the fd open the entire time while
streaming.

>, but the behaviour is not
> particularly useful - since removing the power seems to reset it, it
> needs to be on whilst the linked sensor is streaming I suppose. Given
> that ascertaining the state of the sensor probably will require some
> link established between them anyway I guess I will look at that next,
> unless you'd rather do it?

I don't think this is necessary, see above.

What is necessary is some way for libcamera to:

1. See if there is a VCM which belongs to the sensor; and
2. If there is a VCM figure out which v4l2-subdev it is.

Also see this email thread, where Hans Verkuil came to the
conclusion that this info is currently missing from the MC
representation (link is to the conclusion):

https://lists.libcamera.org/pipermail/libcamera-devel/2021-October/026144.html

Regards,

Hans


  parent reply	other threads:[~2021-11-11 10:35 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <e2312277-f967-7d3f-5ce9-fbb197d35fd6@gmail.com>
2021-10-29 11:50 ` Fwd: Surface Go VCM type (was: Need to pass acpi_enforce_resources=lax on the Surface Go (version1)) Daniel Scally
2021-11-01 15:55   ` Andy Shevchenko
2021-11-01 15:59     ` Andy Shevchenko
2021-11-01 23:26     ` Daniel Scally
2021-11-01 16:02   ` Hans de Goede
2021-11-01 19:18     ` Andy Shevchenko
2021-11-01 19:51       ` Hans de Goede
2021-11-01 23:43     ` Daniel Scally
2021-11-04 14:49       ` Hans de Goede
2021-11-04 18:14         ` Andy Shevchenko
2021-11-06 14:12           ` Hans de Goede
2021-11-06 18:39             ` Andy Shevchenko
2021-11-04 23:20         ` Daniel Scally
2021-11-08 13:12       ` Hans de Goede
2021-11-08 14:12         ` Andy Shevchenko
2021-11-16  9:54           ` Hans de Goede
2021-11-16 12:26             ` Andy Shevchenko
2021-11-09  0:43         ` Daniel Scally
2021-11-09 12:09           ` Daniel Scally
2021-11-09 16:02             ` Hans de Goede
2021-11-09 16:35               ` Daniel Scally
2021-11-10  0:01                 ` Daniel Scally
2021-11-10  8:15                   ` Andy Shevchenko
2021-11-11 10:35                   ` Hans de Goede [this message]
2021-11-11 11:18                     ` Daniel Scally
2021-11-11 15:23                       ` Hans de Goede
2021-11-11 15:51                         ` Dave Stevenson
2021-11-11 16:50                           ` Hans de Goede
2021-11-11 19:30                             ` Dave Stevenson
2021-11-11 22:04                               ` Laurent Pinchart
2021-11-12 10:32                                 ` Dave Stevenson
2021-11-12 10:46                                   ` Laurent Pinchart
2021-11-12 11:37                                     ` Andy Shevchenko
2021-11-15 13:33                                       ` Laurent Pinchart
2021-11-15 15:03                                         ` Andy Shevchenko
2021-11-12 11:43                                     ` Dave Stevenson
2021-11-15 13:21                                       ` Laurent Pinchart
2021-11-12 12:23                                     ` Sakari Ailus
2021-11-15 12:00                                       ` Laurent Pinchart
2021-11-12 17:51                                     ` [libcamera-devel] " Kieran Bingham
2021-11-15 13:08                                       ` Laurent Pinchart
2021-11-11 15:51                         ` Laurent Pinchart
2021-11-23 12:10                         ` Daniel Scally
2021-11-23 19:02                           ` Hans de Goede
2021-11-11 15:59                 ` Hans de Goede
2021-11-15 23:43                   ` Daniel Scally

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=495cbb6b-656d-6c3b-669a-f4b588e970cc@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=djrscally@gmail.com \
    --cc=hpa@redhat.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=libcamera-devel@lists.libcamera.org \
    --cc=linux-media@vger.kernel.org \
    /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