Hi all,

I need help from someone who knows more about CSI driver. I want to use 
16bit YUV422 capture mode for CSI0. However, I have found that this mode is 
not supported in kernel 3.4, so I went on to hack the kernel.
My system is Allwinner A20 on Olinuxino Micro board.
First problem is that 16-bit mode is never applied, even if csi_if is set 
to '1' in the fex file and define d8..d15. The problem is in 
sun4i_csi_core.h:

/*
 * input data format
 */
typedef enum tag_CSI_INPUT_FMT
{
    CSI_RAW=0,     /* raw stream  */
    CSI_BAYER,     /* byer rgb242 */
    CSI_CCIR656,   /* ccir656     */
    CSI_YUV422,    /* yuv422      */
}__csi_input_fmt_t;

So, in this enum, CSI_YUV422 is always set to 3, and as so written to the 
CSI0_CFG register. The correct mode for 16bit is 4, so the simplest way is 
to change the enum like:

/*
 * input data format
 */
typedef enum tag_CSI_INPUT_FMT
{
    CSI_RAW=0,     /* raw stream  */
    CSI_BAYER,     /* byer rgb242 */
    CSI_CCIR656,   /* ccir656     */
    CSI_YUV422=4,    /* yuv422      */
//    CSI_YUV422,    /* yuv422      */
}__csi_input_fmt_t;

However, surprise, surprise, this doesn't work (no capture at all). The 
second problem is that YUV422 16bit is supposed to be using embedded sync 
codes, unlike YUV422 8bit mode, which is not and much like bt.656 (CCIR656) 
mode, which by the way is not supported at all in the driver (just a bunch 
of todos). So, I have enabled embedded sync codes for my sensor system 
(sensor + fpga, so it's quite flexible), but there was a third problem - 
unlike 8bit mode, 16bit mode is latched on the opposite edge, so you need 
to define CSI_FALLING as clock polarity for whichever sensor driver you're 
using (or simply invert pixel clock), otherwise CSI will not capture 
anything (as the sync codes are messed up when latched on the wrong edge).

However, even though now I am successfully capturing the signal coming from 
the camera, I am only capturing the lower 8 bits - I can't get the upper 8 
bits no matter what I do. I am currently suspecting DMA (seems likely) 
and/or GPIO config for 16bits (this also seems strange - I couldn't find 
any references to csi_d* vars from fex file in the entire kernel), but 
other than that I am running out of ideas quite fast. Debug up to this 
point was already hard enough, as there is no clear documentation from 
Allwinner about this at all (I have searched through their entire line-up - 
starting from A10, up to A31).

If someone knows something, please share - if I had some more 
documentation, I would have probably already made the whole thing work, but 
this way I feel like I am more and more just trying out some things blindly 
than actually solving problems...
So please help if you know more. If I get further, I will post my progress 
back of course.

-- 
You received this message because you are subscribed to the Google Groups 
"linux-sunxi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to