Skip to contentSkip to conversation

media: i2c: st-vd55g1: Genericize driver and add VD55G0 support

PATCH Sergey Lebedev 2 participants 6 messages Sep 10 – Sep 16

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Following up on the firmware blocker I raised on 7 September, since it is still the thing that stops anyone but the author from using VD55G0. Relayed with Peter Marshall's agreement.

Peter sourced the firmware the same way I did for testing: the version 2.11 patch array in Andre Gilerson's out-of-tree VD55G0 driver, which he reports is identical to the one in ST's standalone driver. He has published the extracted blobs for testing at

https://github.com/petm5/vd55g-firmware

and would prefer submission to linux-firmware over a built-in array, so that firmware can be updated independently of the kernel version. I agree that is the better end state.

Worth adding, because it may lower the bar for getting there: the built-in arrangement is already in the tree, from ST, for the sibling part. drivers/media/i2c/vd55g1.c is Copyright (C) 2025 STMicroelectronics SA under
SPDX-License-Identifier: GPL-2.0, and it carries vd55g1_patch_array[] - 3512 bytes, firmware revision 2.9 by its own defines. That file has no request_firmware path at all; the built-in array is its only mechanism.

Different sensor and a different binary from the VD55G0 one, which measures 6868 bytes at revision 2.11, so it is precedent for the arrangement rather than for the blob. But it does mean a built-in for VD55G0 would not be asking ST for something they have not already done one part number over, whereas linux-firmware needs an explicit redistribution grant in WHENCE from the copyright holder.

So the two routes are not equally hard today, and they are not exclusive: a built-in now and linux-firmware when ST are ready is not a wasted step.

Whether GPL-2.0 on the surrounding code carries the blob with it is a licence question and not one I will answer.

Benjamin, Sylvain - this is the one blocker on the series that nobody outside ST can clear.

Sergey

#1 lore raw

Hi Sergey,

Le 10/09/2026 à 23:33, Sergey Lebedev a écrit :

Quoted 15 lines

Following up on the firmware blocker I raised on 7 September, since it is still the thing that stops anyone but the author from using VD55G0. Relayed with Peter Marshall's agreement.

Peter sourced the firmware the same way I did for testing: the version 2.11 patch array in Andre Gilerson's out-of-tree VD55G0 driver, which he reports is identical to the one in ST's standalone driver. He has published the extracted blobs for testing at

https://github.com/petm5/vd55g-firmware

and would prefer submission to linux-firmware over a built-in array, so that firmware can be updated independently of the kernel version. I agree that is the better end state.

Quoted 6 lines

Worth adding, because it may lower the bar for getting there: the built-in arrangement is already in the tree, from ST, for the sibling part. drivers/media/i2c/vd55g1.c is Copyright (C) 2025 STMicroelectronics SA under
SPDX-License-Identifier: GPL-2.0, and it carries vd55g1_patch_array[] - 3512 bytes, firmware revision 2.9 by its own defines. That file has no request_firmware path at all; the built-in array is its only mechanism.

We initially thought of using linux-firmware, and we didn't for several reasons :
- The firmware is reasonably small.
- The driver source code is directly dependant on the firmware, as some behaviors may be altered by the firmware. Keeping it in the source code allows easy synchronisation.
- A lot of mainline sensor do the same thing, with exception for only 4 drivers (ccs included) that use request-firmware.

It has been discussed with maintainers back to the vgxy61.

Unless I'm proven moving to the request_firmware API allows more upsides than the above points, unfortunately I will not ack a serie that moves from the builtin patch to the request_firmware API.

Quoted 7 lines

Different sensor and a different binary from the VD55G0 one, which measures 6868 bytes at revision 2.11, so it is precedent for the arrangement rather than for the blob. But it does mean a built-in for VD55G0 would not be asking ST for something they have not already done one part number over, whereas linux-firmware needs an explicit redistribution grant in WHENCE from the copyright holder.

I'm not sure I get you. Is this a licence problem of some sort ? Could you rephrase ?

Anyway if we don't move to request_firmware I guess this is a non issue ?

By the way we didn't upstream the vd55g0 because it requires a bit of cleaning, but this is something that could also be done.

Quoted 12 lines

So the two routes are not equally hard today, and they are not exclusive: a built-in now and linux-firmware when ST are ready is not a wasted step.

Whether GPL-2.0 on the surrounding code carries the blob with it is a licence question and not one I will answer.

Benjamin, Sylvain - this is the one blocker on the series that nobody outside ST can clear.

Sergey

Signature · 2 lines
Regards,
Benjamin
#2 lore raw

Benjamin,

First, an apology: I wrote that badly. Reading it back I can see it lands as a request to move vd55g1 to request_firmware, and it was never meant as one. You have had to defend a position I was not attacking, and that is my fault rather than yours.

What I meant, and should have written: the VD55G0 firmware has to reach users somehow, and I do not mind which of the two mechanisms carries it. Your three reasons settle the mechanism for me - built in, and no more about it. Peter preferred linux-firmware and I relayed that with his agreement; whether your answer changes his view is his to say, not mine.

Quoted 2 lines

I'm not sure I get you. Is this a licence problem of some sort ? Could you rephrase ?

Yes, and it is not about the API at all. It is about who may put ST's firmware into the kernel tree.

vd55g1.c raises no question. ST holds the copyright and ST put its own array in its own file, GPL-2.0, 3512 bytes, no request_firmware path anywhere. Nothing had to be granted, by anyone, to anyone.

VD55G0 is not in that position today. The bytes this series would carry were extracted from a third-party out-of-tree driver, by people who are not ST. That is the same question whether they land as a C array or as a file in linux-firmware - the mechanism does not change who owns them. linux-firmware only makes it audible, because WHENCE asks for the grant out loud, where a built-in array lets the same question pass without being asked.

So there are three routes, and only one of them is clean:

built in, sent by someone outside ST - which is the series as it stands. Works technically. Leaves the provenance question unasked rather than answered.

linux-firmware - needs an explicit grant from ST in WHENCE, and you have now ruled out the API change it would require. So: closed.

ST upstreams VD55G0 itself, with its own array, exactly as you did for vd55g1. Nobody outside ST has to ask for anything, because nothing is being redistributed by anyone who does not own it.

Quoted 2 lines

By the way we didn't upstream the vd55g0 because it requires a bit of cleaning, but this is something that could also be done.

That is the one I would hope for, and it is worth more than getting my own machine working. It is the only route that ends the question rather than moving it. And it puts VD55G0 on the same footing as its sibling, rather than leaving it the part with an awkward history.

If the cleaning is what stands in the way, say what would help and I will do what I can. I cannot clean code I do not have. I can carry the mechanical half of it - checkpatch and sparse, builds across configurations, dt-binding checks, a review pass. And I can test on hardware you may not have: a Surface Pro 11 where the VD55G0 is the face-unlock sensor, so it is exercised by something real rather than by a capture tool. Peter's series in this thread already does a good deal of the genericising, if any of it is useful as a starting point.

Whether GPL-2.0 on the surrounding code carries a blob with it is still a licence question, and still not one I will answer.

Sergey

#3 lore raw

Hi Sergey,

Le 15/09/2026 à 12:07, Sergey Lebedev a écrit :

Quoted 6 lines

Benjamin,

First, an apology: I wrote that badly. Reading it back I can see it lands as a request to move vd55g1 to request_firmware, and it was never meant as one. You have had to defend a position I was not attacking, and that is my fault rather than yours.

No worries, It didn't feel like an attack of any sort ;)

Quoted 7 lines

What I meant, and should have written: the VD55G0 firmware has to reach users somehow, and I do not mind which of the two mechanisms carries it. Your three reasons settle the mechanism for me - built in, and no more about it. Peter preferred linux-firmware and I relayed that with his agreement; whether your answer changes his view is his to say, not mine.

Quoted 5 lines
Quoted 2 lines

I'm not sure I get you. Is this a licence problem of some sort ? Could you rephrase ?

Yes, and it is not about the API at all. It is about who may put ST's firmware into the kernel tree.

Ah I got you. I'm not a licence expert in any way but since we already disclosed the firmware patch in our out of tree driver as GPL2 [1], then I guess it's free to use it as long as you respect GPL2, whether you're from ST or not.

[1]
https://github.com/STMicroelectronics/vd55g0-linux-driver/blob/master/vd55g0_patches.h

Quoted 33 lines

vd55g1.c raises no question. ST holds the copyright and ST put its own array in its own file, GPL-2.0, 3512 bytes, no request_firmware path anywhere. Nothing had to be granted, by anyone, to anyone.

VD55G0 is not in that position today. The bytes this series would carry were extracted from a third-party out-of-tree driver, by people who are not ST. That is the same question whether they land as a C array or as a file in linux-firmware - the mechanism does not change who owns them. linux-firmware only makes it audible, because WHENCE asks for the grant out loud, where a built-in array lets the same question pass without being asked.

So there are three routes, and only one of them is clean:

built in, sent by someone outside ST - which is the series as it stands. Works technically. Leaves the provenance question unasked rather than answered.

linux-firmware - needs an explicit grant from ST in WHENCE, and you have now ruled out the API change it would require. So: closed.

ST upstreams VD55G0 itself, with its own array, exactly as you did for vd55g1. Nobody outside ST has to ask for anything, because nothing is being redistributed by anyone who does not own it.

Quoted 2 lines

By the way we didn't upstream the vd55g0 because it requires a bit of cleaning, but this is something that could also be done.

That is the one I would hope for, and it is worth more than getting my own machine working. It is the only route that ends the question rather than moving it. And it puts VD55G0 on the same footing as its sibling, rather than leaving it the part with an awkward history.

Quoted 8 lines

If the cleaning is what stands in the way, say what would help and I will do what I can. I cannot clean code I do not have. I can carry the mechanical half of it - checkpatch and sparse, builds across configurations, dt-binding checks, a review pass. And I can test on hardware you may not have: a Surface Pro 11 where the VD55G0 is the face-unlock sensor, so it is exercised by something real rather than by a capture tool. Peter's series in this thread already does a good deal of the genericising, if any of it is useful as a starting point.

I still stand against the refactoring and generalisation. I can elaborate on that point if needed.

Now about mainlining vd55g0 out of tree module, my current priorities won't allow me to do it anytime soon, but if you want to start from the out of tree module and clean the driver to submit it I'll be happy to assist. On top of my head we need to remove the KERNEL_VERSION guards and move to streams api. Having the vd55g1 as reference is also a good idea. I can test on device trees platforms.

Quoted 6 lines

Whether GPL-2.0 on the surrounding code carries a blob with it is still a licence question, and still not one I will answer.

Sergey

Signature · 2 lines
Regards,
Benjamin
#4 lore raw

Benjamin,

Thank you - for the explanation, for the link, and for saying where you stand. All three are worth more than an ack would have been.

Sorry for the slow reply. I spent the hours reading rather than writing: the repository you pointed at, the two drivers side by side, and the in-tree binding. The checking changed what I have to say, so it seemed better than answering quickly. Three things below, separated so you can take whichever is worth your time.

1. The licence question, and my mistake
---------------------------------------

Settled, by your link. vd55g0_patches.h carries "SPDX-License-Identifier: GPL-2.0" and "Copyright (C) 2024 STMicroelectronics SA", with cut1 and cut2 arrays. ST published the firmware itself, two years ago, under a licence that answers the question I was asking.

There is nothing for anyone to grant, and the right source to take those bytes from is yours rather than any third-party copy of them.

I should have found that before raising the point twice. Your standalone driver was named to me in this thread and I did not open it. The blocker I reported on 7 September is not a blocker and never was.

2. What the work would actually be
----------------------------------

I measured it rather than guessed, so that we are talking about the same thing:

- twenty-five LINUX_VERSION_CODE guards, all of the form
"#if KERNEL_VERSION(x,y,z) > LINUX_VERSION_CODE", about 180 lines to drop
- s_stream to enable_streams and disable_streams, with vd55g1 in-tree as a line-by-line reference written by you
- st,vd55g0.yaml, adapted from the 3.3 KB st,vd55g1.yaml
- Kconfig, Makefile, MAINTAINERS
- checkpatch, sparse, builds across configurations, and testing here

That should not take as long as I expected.

3. The question I cannot answer on your behalf
----------------------------------------------

A 2100-line driver arriving beside a 2100-line sibling by the same author invites "why is this not an extension of vd55g1". If I answer that badly, the third version is a rewrite in the direction you have already rejected.

Reading the two files I can see arguments for your position. vd55g0 is monochrome-first, Y8_1X8 and Y10_1X10, where vd55g1 carries the Bayer codes. vd55g0 has real strobe and flash handling that vd55g1 barely touches. The register namespaces are essentially disjoint.

But those are my inferences from one reading. What I would be repeating to a maintainer is your engineering judgement, and I would rather have it from you.

So: you offered to elaborate. Please do, if you have the time. Not to convince me - I have no stake in either shape. It is so that when Sakari or Hans asks why VD55G0 is not folded into vd55g1, the answer comes from the person who wrote both parts.

If a separate driver is right, I will start and send you something to look at. If the two really should converge, that is worth knowing now too, and Peter's series already points that way.

Sergey

#5 lore raw

Hi Sergey,

Le 15/09/2026 à 19:36, Sergey Lebedev a écrit :

Quoted 19 lines

Benjamin,

Thank you - for the explanation, for the link, and for saying where you stand. All three are worth more than an ack would have been.

Sorry for the slow reply. I spent the hours reading rather than writing: the repository you pointed at, the two drivers side by side, and the in-tree binding. The checking changed what I have to say, so it seemed better than answering quickly. Three things below, separated so you can take whichever is worth your time.

1. The licence question, and my mistake
---------------------------------------

Settled, by your link. vd55g0_patches.h carries "SPDX-License-Identifier: GPL-2.0" and "Copyright (C) 2024 STMicroelectronics SA", with cut1 and cut2 arrays. ST published the firmware itself, two years ago, under a licence that answers the question I was asking.

Quoted 6 lines

There is nothing for anyone to grant, and the right source to take those bytes from is yours rather than any third-party copy of them.

I should have found that before raising the point twice. Your standalone driver was named to me in this thread and I did not open it. The blocker I reported on 7 September is not a blocker and never was.

That's fine, I'm glad you're unblocked :)

Quoted 29 lines

2. What the work would actually be
----------------------------------

I measured it rather than guessed, so that we are talking about the same thing:

- twenty-five LINUX_VERSION_CODE guards, all of the form
"#if KERNEL_VERSION(x,y,z) > LINUX_VERSION_CODE", about 180 lines to drop
- s_stream to enable_streams and disable_streams, with vd55g1 in-tree as a line-by-line reference written by you
- st,vd55g0.yaml, adapted from the 3.3 KB st,vd55g1.yaml
- Kconfig, Makefile, MAINTAINERS
- checkpatch, sparse, builds across configurations, and testing here

That should not take as long as I expected.

3. The question I cannot answer on your behalf
----------------------------------------------

A 2100-line driver arriving beside a 2100-line sibling by the same author invites "why is this not an extension of vd55g1". If I answer that badly, the third version is a rewrite in the direction you have already rejected.

Reading the two files I can see arguments for your position. vd55g0 is monochrome-first, Y8_1X8 and Y10_1X10, where vd55g1 carries the Bayer codes. vd55g0 has real strobe and flash handling that vd55g1 barely touches. The register namespaces are essentially disjoint.

Quoted 8 lines

But those are my inferences from one reading. What I would be repeating to a maintainer is your engineering judgement, and I would rather have it from you.

So: you offered to elaborate. Please do, if you have the time. Not to convince me - I have no stake in either shape. It is so that when Sakari or Hans asks why VD55G0 is not folded into vd55g1, the answer comes from the person who wrote both parts.

I think the fact that the vgxy61, vd56g3 and vd55g1 already coexists as separate files in the kernel file structure, all reviewed by Sakari, could be seen as an implicit agreement. They all share some common IPs but are pretty different. Sakari, if you have anything to add, please do so.

Sorry for repeating myself but I personally think having everything separated is better for code clarity. As the register map is fundamentally different, you will need an indirection map pointing to each register i2c adress for each sensor, like shown in Peter's serie, i.e. :

expoure_register[vd55g1_sensor_type]

While I appreciate the idea, IMHO this boilerplate adds unnecessary complexity and feels pretty error prone.

As you mentioned both sensors don't offer the same functionalities, so you will also need some kind of :

  if (vd55g1_sensor_type)
    foorbar();

On top of that, it makes testing a bit more tedious as each change in a generalised driver might break the other sensor, which you might not want because, well, let's say you made a change for the vd55g0 and don't have a vd55g1 to test you didn't break anything on its flow. This issue disappear if both files are separated.

I'm also a bit concerned about the history, since an heavy refactoring will alter the git history and make git bisect harder. As we already have a v55g0 downstream driver, that I think is mature enough. I see it as a better idea to use it as a starting point.

This are all the downsides I see while typing, of course I might have forgotten some, but you get the idea.

Quoted 4 lines

If a separate driver is right, I will start and send you something to look at. If the two really should converge, that is worth knowing now too, and Peter's series already points that way.

Thanks a ton, I really appreciate the work you and Peter are doing. If you start this journey please add yourself or/and Peter as MODULE_AUTHOR and in the maintainers file. Don't hesitate to contact me either.

Quoted 3 lines

Sergey

Signature · 2 lines
Regards,
Benjamin