imx.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
To: Joffrey <joffrey575@freewind.fr>,
	gregkh@linuxfoundation.org, imx@lists.linux.dev
Cc: dmitry.baryshkov@linaro.org, konrad.dybcio@linaro.org,
	andrey.konovalov@linaro.org,
	Luca Weiss <luca.weiss@fairphone.com>,
	Kieran Bingham <kieran.bingham@ideasonboard.com>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Subject: Re: SM6350-mainline : IMX412 Hack to IMX576 driver and CAMSS
Date: Fri, 3 May 2024 14:31:58 +0100	[thread overview]
Message-ID: <0d1b703c-5cad-4888-8966-d2a33fe19ce8@linaro.org> (raw)
In-Reply-To: <487-6634c200-31-76b8f080@88927481>

On 03/05/2024 11:52, Joffrey wrote:
> Hi all,
> 
> I'm working in my free time on camss driver and *imx412 hack for imx576 
> driver camera* for Fairphone 4 (*sm7225 from sm6350-mainline*).
> I want the sm6350-mainline progress in the futur, postmarketos and linux 
> for mobile.
> 
> Targets are 750G (SM7225) and 690G (SM6350) Qualcomm Snapdragon.
> 
> The source code is : 
> https://github.com/sm6350-mainline/linux/tree/sm6350-6.9-wip-camera 
> <https://github.com/sm6350-mainline/linux/tree/sm6350-6.9-wip-camera>
> 
> **Some work have been initialised by z3ntu (lweiss-fairphone) but he 
> don't arrived to get data from imx576 camera.
> Just arrived to generate a test_pattern = 2 from msm_csid0 until 
> msm_vfe0_rdi0.*
> 
> *The relation between v4l2 and msm entity is the following what i've 
> create from dot file.
> https://debian-facile.org/images/file-Rc0e5e8df8ab6edd1812f4be9187b1ad3 
> <https://debian-facile.org/images/file-Rc0e5e8df8ab6edd1812f4be9187b1ad3>
> 
> I followed his advice and adapt command to get data from imx576 camera.
> 
> fairphone-fp4:~$ media-ctl -d /dev/media0 -l 
> '"msm_csid0":1->"msm_vfe0_rdi0":0[1]'
> fairphone-fp4:~$ media-ctl -d /dev/media0 -l 
> '"msm_csiphy3":1->"msm_csid0":0[1]'
> fairphone-fp4:~$ media-ctl -d /dev/media0 -V 
> '"msm_csid0":1[fmt:UYVY8_2X8/1920x1080 field:none],"msm_vfe0_rdi0":0[fmt:UY
> VY8_2X8/1920x1080 field:none]'
> fairphone-fp4:~$ media-ctl -d /dev/media0 -V 
> '"msm_csiphy3":1[fmt:UYVY8_2X8/1920x1080 field:none],"msm_csid0":0[fmt:UYVY
> 8_2X8/1920x1080 field:none]'
> fairphone-fp4:~$ gst-launch-1.0 -v v4l2src device=/dev/video0 
> num-buffers=1 ! 'video/x-raw,format=UYVY,width=1920,height
> =1080' ! jpegenc ! filesink location=image01.jpg
> 
> I have this error log.
> https://debian-facile.org/paste-BEAC75F7C4-6eda8795dcd0e61b297cbbeac1aa0f26 <https://debian-facile.org/paste-BEAC75F7C4-6eda8795dcd0e61b297cbbeac1aa0f26>
> 
> And dmesg log.
> https://debian-facile.org/paste-E52C41445A-f50445aa608fd5a868d84f8253db091b <https://debian-facile.org/paste-E52C41445A-f50445aa608fd5a868d84f8253db091b>
> 
> 
> I talk about this problem to the community and said it to me.
> 
>     Yeah we need to find a tag in that repo
>     that matches in some way one of the tags here
>     https://git.codelinaro.org/clo/la/platform/vendor/opensource/camera-kernel.git
>     that's the CPHY/CSID/IFE version to target
>     i.e. know which CSIPHY init sequence to use - if we can reuse an
>     upstream CSID/IFE - and get the reg offsets right
> 
> 
> Here is the good tree about sm6350/sm7225.
> LA.QSSI.11.0.R1.11.00.00.668.170.00
> https://git.codelinaro.org/clo/la/platform/vendor/opensource/camera-kernel/-/tree/camera-kernel.lnx.3.1.r9-rel?ref_type=heads <https://git.codelinaro.org/clo/la/platform/vendor/opensource/camera-kernel/-/tree/camera-kernel.lnx.3.1.r9-rel?ref_type=heads>
> 
> 
> => What are differencies to adapt between camss driver and imx driver 
> architecture between this two project ?
> -this link 
> https://github.com/sm6350-mainline/linux/tree/sm6350-6.9-wip-camera 
> <https://github.com/sm6350-mainline/linux/tree/sm6350-6.9-wip-camera>
> -this link 
> https://git.codelinaro.org/clo/la/platform/vendor/opensource/camera-kernel/-/tree/camera-kernel.lnx.3.1.r9-rel?ref_type=heads <https://git.codelinaro.org/clo/la/platform/vendor/opensource/camera-kernel/-/tree/camera-kernel.lnx.3.1.r9-rel?ref_type=heads>
> 
> @bryan,
> I contact you for your work here [PATCH v2 0/3] Add imx577 compatible to 
> imx412.
> https://www.spinics.net/lists/linux-media/msg215880.html 
> <https://www.spinics.net/lists/linux-media/msg215880.html>
> Have you arrived to get data from imx577 camera ?

Yes it works on RB5 upstream.

https://github.com/sm6350-mainline/linux/blob/sm6350-6.9-wip-camera/arch/arm64/boot/dts/qcom/qrb5165-rb5-vision-mezzanine.dts

Taking a quick look

https://github.com/sm6350-mainline/linux/blob/sm6350-6.9-wip-camera/arch/arm64/boot/dts/qcom/sm7225-fairphone-fp4.dts#L574

I would double check the MCLK value there - pairing of MCLK1 with 
CSIPHY3 is a bit unusual - 100% valid but, unusual.

> Be appear, the job to adapt is to check in the following code these 
> steps but it's hard to identify for me.
> https://git.codelinaro.org/clo/la/platform/vendor/opensource/camera-kernel/-/tree/camera-kernel.lnx.3.1.r9-rel?ref_type=heads <https://git.codelinaro.org/clo/la/platform/vendor/opensource/camera-kernel/-/tree/camera-kernel.lnx.3.1.r9-rel?ref_type=heads>
> 
> "that's the CPHY/CSID/IFE version to target" -> What mean exactly ?
> 1 - i.e. know which CSIPHY init sequence to use
> 2 - if we can reuse an upstream CSID/IFE
> 3 - and get the reg offsets right

So there are a number of things here.

1. Identify the correct CSIPHY init sequence
    I'd guess @Luca probably has that right but, I suggest
    you double check.

2. Identify the IFE and CSID versions
    As I posted on IRC its definitely IFE 17x
    Probably the same CSID as on sdm845 too

3. My understanding is the TPG partially works on this platform
    I suggest trying different pixel formats and resolutions

Here's an example for the RB5

# CSID0 TPG RB5
media-ctl --reset
yavta --no-query -w '0x009f0903 2' /dev/v4l-subdev6
yavta --list /dev/v4l-subdev6
media-ctl -V '"msm_csid0":0[fmt:SRGGB10/4056x3040]'
media-ctl -V '"msm_vfe0_rdi0":0[fmt:SRGGB10/4056x3040]'
media-ctl -l '"msm_csid0":1->"msm_vfe0_rdi0":0[1]'
media-ctl -d /dev/media0 -p

Figure out which V4L subdev == msm_csid0 on your platform and then set 
the yavta command appropriately.

> If it's possible to have advice, documentation, identifying parts or 
> solution ? (Maybe more simple to do video call or audio ?)

What you need to get say Hangouts or Zoom going is

1. Delivery of data to userpsace via RDI

2. libcamera >= below [1]
    zoom and cheese will work that this stage

3. pipewire compiled up to talk to libcamera
    Assuming this works as below [2] you will get
    Hangouts

4. For postmarketos you will need to adapt the
    camera application - I guess - to talk to libcamera

> 
> Maybe it's better i learn some part before discuss.

I'd suggest replicating Luca's TPG work and then trying different pixel 
formats and resolutions.

Is it always the case you get partial data or do you get a full frame at 
a different _resolution_ ?

Next step then is to bring up the sensor.

The "cam" application in libcamera will probably be lots of help.

[1] SoftISP in libcamera
https://git.libcamera.org/libcamera/libcamera.git/commit/?id=b2ef255295871fb6246d99bdd5b41aa65e3fc3b2

[2] Firefox/pipewire integration with libcamera
https://jgrulich.cz/2023/05/29/pipewire-camera-support-in-firefox/

---
bod


           reply	other threads:[~2024-05-03 13:32 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <487-6634c200-31-76b8f080@88927481>]

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=0d1b703c-5cad-4888-8966-d2a33fe19ce8@linaro.org \
    --to=bryan.odonoghue@linaro.org \
    --cc=andrey.konovalov@linaro.org \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=imx@lists.linux.dev \
    --cc=joffrey575@freewind.fr \
    --cc=kieran.bingham@ideasonboard.com \
    --cc=konrad.dybcio@linaro.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=luca.weiss@fairphone.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 read-only IMAP folder(s) and NNTP newsgroup(s).