Skip to contentSkip to conversation

media: vimc: add ancillary lens

PATCH Superseded Yunke Cao 2 participants 9 messages Jun 17, 2022 – Jun 28, 2022

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Yunke Cao

author
#0 lore raw

v2 cover media: vimc: add ancillary lens

Add a basic version of vimc lens.
Link lens with sensors using ancillary links.
Update vimc documentation to reflect this change.

Changelog from v1:
-Better commit log.
-A bit more detailed documentation in 2/2.

Yunke Cao (2):
media: vimc: add ancillary lens
media: vimc: documentation for lens

 Documentation/admin-guide/media/vimc.dot      |   4 +
 Documentation/admin-guide/media/vimc.rst      |   4 +
 drivers/media/test-drivers/vimc/Makefile      |   2 +-
 drivers/media/test-drivers/vimc/vimc-common.h |   1 +
 drivers/media/test-drivers/vimc/vimc-core.c   |  86 +++++++++++----
 drivers/media/test-drivers/vimc/vimc-lens.c   | 102 ++++++++++++++++++
 6 files changed, 178 insertions(+), 21 deletions(-)
 create mode 100644 drivers/media/test-drivers/vimc/vimc-lens.c
Signature · 1 line
2.37.0.rc0.104.g0611611a94-goog
author
#1 lore raw

PATCH v2 1/2 media: vimc: add ancillary lens

Add a basic version of vimc lens.
The lens supports V4L2_CID_FOCUS_ABSOLUTE control. Link the lens with vimc sensors using media-controller ancillary links.

This change can be used to test the recently added ancillary links.

---
 drivers/media/test-drivers/vimc/Makefile      |   2 +-
 drivers/media/test-drivers/vimc/vimc-common.h |   1 +
 drivers/media/test-drivers/vimc/vimc-core.c   |  86 +++++++++++----
 drivers/media/test-drivers/vimc/vimc-lens.c   | 102 ++++++++++++++++++
 4 files changed, 170 insertions(+), 21 deletions(-)
 create mode 100644 drivers/media/test-drivers/vimc/vimc-lens.c
drivers/media/test-drivers/vimc/Makefile +1 -1
index a53b2b532e9f..9b9631562473 100644
@@ -1,6 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
 vimc-y := vimc-core.o vimc-common.o vimc-streamer.o vimc-capture.o \
-		vimc-debayer.o vimc-scaler.o vimc-sensor.o
+		vimc-debayer.o vimc-scaler.o vimc-sensor.o vimc-lens.o
 
 obj-$(CONFIG_VIDEO_VIMC) += vimc.o
 
drivers/media/test-drivers/vimc/vimc-common.h +1 -0
index ba1930772589..37f6b687ce10 100644
@@ -171,6 +171,7 @@ extern struct vimc_ent_type vimc_sen_type;
 extern struct vimc_ent_type vimc_deb_type;
 extern struct vimc_ent_type vimc_sca_type;
 extern struct vimc_ent_type vimc_cap_type;
+extern struct vimc_ent_type vimc_len_type;
 
 /**
  * vimc_pix_map_by_index - get vimc_pix_map struct by its index
drivers/media/test-drivers/vimc/vimc-core.c +66 -20

139 lines not on this page · raw message

drivers/media/test-drivers/vimc/vimc-lens.c new file +102 -0

102 lines not on this page · raw message

Signature · 1 line
2.37.0.rc0.104.g0611611a94-goog
maintainer
#2 lore raw
Quoted 5 lines · Yunke Cao

Add a basic version of vimc lens.
The lens supports V4L2_CID_FOCUS_ABSOLUTE control. Link the lens with vimc sensors using media-controller ancillary links.

Commit log lines are usually ~75 charracters long. Make it easier to read.

Quoted 3 lines

This change can be used to test the recently added ancillary links.

Care to add instructions on how one would test ancillary with this feature?

Quoted 11 lines
---
  drivers/media/test-drivers/vimc/Makefile      |   2 +-
  drivers/media/test-drivers/vimc/vimc-common.h |   1 +
  drivers/media/test-drivers/vimc/vimc-core.c   |  86 +++++++++++----
  drivers/media/test-drivers/vimc/vimc-lens.c   | 102 ++++++++++++++++++
  4 files changed, 170 insertions(+), 21 deletions(-)

create mode 100644 drivers/media/test-drivers/vimc/vimc-lens.c

thanks,
-- Shuah

author
#3 lore raw

Hi Shuah,

Thanks for the review.

Quoted 10 lines · Shuah Khan
Quoted 5 lines · Yunke Cao

Add a basic version of vimc lens.
The lens supports V4L2_CID_FOCUS_ABSOLUTE control. Link the lens with vimc sensors using media-controller ancillary links.

Commit log lines are usually ~75 charracters long. Make it easier to read.

That's good to know. Thanks!
Should I send v3 and trim the commit log?
I'm thinking something like this:

The lens supports FOCUS_ABSOLUTE control.
Link the lens with sensors using ancillary links.

Quoted 7 lines
Quoted 4 lines

This change can be used to test the recently added ancillary links.

Care to add instructions on how one would test ancillary with this feature?

The lens shows up in the media topology. I documented it in 2/2. Not sure what else is necessary here.

Best,
Yunke

Quoted 15 lines
Quoted 4 lines
Quoted 8 lines
---
  drivers/media/test-drivers/vimc/Makefile      |   2 +-
  drivers/media/test-drivers/vimc/vimc-common.h |   1 +
  drivers/media/test-drivers/vimc/vimc-core.c   |  86 +++++++++++----
  drivers/media/test-drivers/vimc/vimc-lens.c   | 102 ++++++++++++++++++
  4 files changed, 170 insertions(+), 21 deletions(-)

create mode 100644 drivers/media/test-drivers/vimc/vimc-lens.c

thanks,
-- Shuah

maintainer
#4 lore raw
Quoted 13 lines · Yunke Cao

Hi Shuah,

Thanks for the review.

Quoted 8 lines · Shuah Khan
Quoted 5 lines · Yunke Cao

Add a basic version of vimc lens.
The lens supports V4L2_CID_FOCUS_ABSOLUTE control. Link the lens with vimc sensors using media-controller ancillary links.

Quoted 9 lines
Quoted 2 lines

Commit log lines are usually ~75 charracters long. Make it easier to read.

That's good to know. Thanks!
Should I send v3 and trim the commit log?
I'm thinking something like this:

The lens supports FOCUS_ABSOLUTE control.
Link the lens with sensors using ancillary links.

Why is this necessary? How did you test this change? How could one use this feature?

Quoted 11 lines
Quoted 7 lines
Quoted 4 lines

This change can be used to test the recently added ancillary links.

Care to add instructions on how one would test ancillary with this feature?

The lens shows up in the media topology. I documented it in 2/2. Not sure what else is necessary here.

Why is this necessary? How did you test this change? How could one use this feature?

Take a look at the some of the other commit messages e.g:
4a2e0a806cb58a4d3106add079488e0b56a221b6 5f3fb5c54d67670fa6743d2434a5bd43a97c01de

This one is a good example of what would a commit log adding a new feature should include.

commit 9b4a9b31b9aeef262b4fa211f2083c30c4391df7

Author: Pedro Terra <[email protected]>
Date:   Tue Aug 31 19:48:22 2021 +0200

media: vimc: Enable set resolution at the scaler src pad

thanks,
-- Shuah

author
#5 lore raw

Hi Shuah,

Thanks for the pointers.

Quoted 21 lines · Shuah Khan
Quoted 19 lines · Yunke Cao

Hi Shuah,

Thanks for the review.

Quoted 10 lines · Shuah Khan
Quoted 5 lines · Yunke Cao

Add a basic version of vimc lens.
The lens supports V4L2_CID_FOCUS_ABSOLUTE control. Link the lens with vimc sensors using media-controller ancillary links.

Commit log lines are usually ~75 charracters long. Make it easier to read.

That's good to know. Thanks!
Should I send v3 and trim the commit log?
I'm thinking something like this:

Quoted 7 lines
Quoted 3 lines

The lens supports FOCUS_ABSOLUTE control.
Link the lens with sensors using ancillary links.

Why is this necessary? How did you test this change? How could one use this feature?

Add lens to vimc driver and link them with sensors using ancillary links. Provides an example of ancillary link usage.The lens supports FOCUS_ABSOLUTE control.

Test example: With default vimc topology

Quoted 1 line

media-ctl -p

Media controller API version 5.18.0
…
- entity 28: Lens A (0 pad, 0 link)
type V4L2 subdev subtype Lens flags 0 device node name /dev/v4l-subdev6
- entity 29: Lens B (0 pad, 0 link)
type V4L2 subdev subtype Lens flags 0 device node name /dev/v4l-subdev7

Quoted 1 line

v4l2-ctl -d /dev/v4l-subdev7 -C focus_absolute

focus_absolute: 0

Let me know what you think. Thanks!

Best,
Yunke

Quoted 30 lines
Quoted 11 lines
Quoted 7 lines
Quoted 4 lines

This change can be used to test the recently added ancillary links.

Care to add instructions on how one would test ancillary with this feature?

The lens shows up in the media topology. I documented it in 2/2. Not sure what else is necessary here.

Why is this necessary? How did you test this change? How could one use this feature?

Take a look at the some of the other commit messages e.g:
4a2e0a806cb58a4d3106add079488e0b56a221b6 5f3fb5c54d67670fa6743d2434a5bd43a97c01de

This one is a good example of what would a commit log adding a new feature should include.

commit 9b4a9b31b9aeef262b4fa211f2083c30c4391df7

Author: Pedro Terra <[email protected]>
Date:   Tue Aug 31 19:48:22 2021 +0200

media: vimc: Enable set resolution at the scaler src pad

thanks,
-- Shuah

maintainer
#6 lore raw
Quoted 24 lines · Yunke Cao

Hi Shuah,

Thanks for the pointers.

Quoted 4 lines

Why is this necessary? How did you test this change? How could one use this feature?

Add lens to vimc driver and link them with sensors using ancillary links. Provides an example of ancillary link usage.The lens supports FOCUS_ABSOLUTE control.

Test example: With default vimc topology

Quoted 1 line

media-ctl -p

Media controller API version 5.18.0
…
- entity 28: Lens A (0 pad, 0 link)
type V4L2 subdev subtype Lens flags 0 device node name /dev/v4l-subdev6
- entity 29: Lens B (0 pad, 0 link)
type V4L2 subdev subtype Lens flags 0 device node name /dev/v4l-subdev7

Quoted 3 lines
Quoted 1 line

v4l2-ctl -d /dev/v4l-subdev7 -C focus_absolute

focus_absolute: 0

Send me v3 with all of this information in the commit log and add this to document as well.

thanks,
-- Shuah

author
#7 lore raw

Thanks Shuah. Just sent out v3.

Quoted 35 lines · Shuah Khan
Quoted 24 lines · Yunke Cao

Hi Shuah,

Thanks for the pointers.

Quoted 4 lines

Why is this necessary? How did you test this change? How could one use this feature?

Add lens to vimc driver and link them with sensors using ancillary links. Provides an example of ancillary link usage.The lens supports FOCUS_ABSOLUTE control.

Test example: With default vimc topology

Quoted 1 line

media-ctl -p

Media controller API version 5.18.0
…
- entity 28: Lens A (0 pad, 0 link)
type V4L2 subdev subtype Lens flags 0 device node name /dev/v4l-subdev6
- entity 29: Lens B (0 pad, 0 link)
type V4L2 subdev subtype Lens flags 0 device node name /dev/v4l-subdev7

Quoted 3 lines
Quoted 1 line

v4l2-ctl -d /dev/v4l-subdev7 -C focus_absolute

focus_absolute: 0

Send me v3 with all of this information in the commit log and add this to document as well.

thanks,
-- Shuah

author
#8 lore raw

PATCH v2 2/2 media: vimc: documentation for lens

In reply to Yunke Cao

Add documentation for vimc-lens.
Add a lens into the vimc topology graph.

---
 Documentation/admin-guide/media/vimc.dot | 4 ++++
 Documentation/admin-guide/media/vimc.rst | 4 ++++
 2 files changed, 8 insertions(+)
Documentation/admin-guide/media/vimc.dot +4 -0
index 57863a13fa39..5a6e231c3d21 100644
@@ -5,9 +5,13 @@ digraph board {
 	n00000001 [label="{{} | Sensor A\n/dev/v4l-subdev0 | {<port0> 0}}", shape=Mrecord, style=filled, fillcolor=green]
 	n00000001:port0 -> n00000005:port0 [style=bold]
 	n00000001:port0 -> n0000000b [style=bold]
+	n00000001 -> n00000002
+	n00000002 [label="{{} | Lens A\n/dev/v4l-subdev5 | {<port0>}}", shape=Mrecord, style=filled, fillcolor=green]
 	n00000003 [label="{{} | Sensor B\n/dev/v4l-subdev1 | {<port0> 0}}", shape=Mrecord, style=filled, fillcolor=green]
 	n00000003:port0 -> n00000008:port0 [style=bold]
 	n00000003:port0 -> n0000000f [style=bold]
+	n00000003 -> n00000004
+	n00000004 [label="{{} | Lens B\n/dev/v4l-subdev6 | {<port0>}}", shape=Mrecord, style=filled, fillcolor=green]
 	n00000005 [label="{{<port0> 0} | Debayer A\n/dev/v4l-subdev2 | {<port1> 1}}", shape=Mrecord, style=filled, fillcolor=green]
 	n00000005:port1 -> n00000017:port0
 	n00000008 [label="{{<port0> 0} | Debayer B\n/dev/v4l-subdev3 | {<port1> 1}}", shape=Mrecord, style=filled, fillcolor=green]
Documentation/admin-guide/media/vimc.rst +4 -0
index 0b07f05dde25..3ec2198ce68d 100644
@@ -53,6 +53,10 @@ vimc-sensor:
 
 	* 1 Pad source
 
+vimc-lens:
+	Ancillary lens for a sensor. Supports auto focus control. Linked to
+	a vimc-sensor using an ancillary link.
+
 vimc-debayer:
 	Transforms images in bayer format into a non-bayer format.
 	Exposes:
Signature · 1 line
2.37.0.rc0.104.g0611611a94-goog