imx53 and muxing video inputs from adv7180

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

imx53 and muxing video inputs from adv7180

Jump to solution
2,468 Views
mks
Contributor II

Hi all,

I started working with the imx537 for a video application. I already played with the adv7180 and an analog camera. I was wondering, how the imx53 driver for adv7180 is handling muxing video channels ?

Is there any way to set INSEL register from userspace ? or adding input to the v4l2 sub-device ?

Hope, you will understand my need !

Thanks for you answers.

Labels (1)
1 Solution
1,136 Views
compmas2
Contributor V

If you are doing CVBS (composite) video and want to switch between the 3 or 6 inputs (depending on the type of adv7180 you have), you will have to update the driver to do switching of inputs.  The driver defaults to using the first input.

In the Freescale adv7180 driver (drivers/media/video/mxc/capture/adv7180.c), you could add an ioctl item to perform the switching of the inputs.  I am not sure if V4L2 has a predefined ioctl type that you should use for this.  The value of the Input Control register's (address 0x00) 4 least significant bits is where the inputs are controlled.  Take a look at table 13 and 14 in the ADV7180 data sheet (http://www.analog.com/static/imported-files/data_sheets/ADV7180.pdf) to see the possible combinations of values to control the inputs.

The muxing of video channels is left to the default ADV7180 settings in the driver so based on the Input Control register, the ADV7180 performs auto muxing.  If you want to manually control the muxing you need to set the MAN_MUX_EN bit (bit 7 or address 0xC4) and then set the muxing configuration in the ADC Switch1 and ADC Switch 2 registers (address 0xC3 and 0xC4) based on table 15 in the ADV7180 data sheet.  This manual configuration of muxing can also be done by creating a new ioctl type in the driver.

View solution in original post

0 Kudos
6 Replies
1,136 Views
josa
Contributor II

Hi

I am tryining to get an ADV7180 connected to an imx53 (TX53 sodimm) so far i got it registered , but

could not get it registered with v4l since there seems to be no support in the IPU driver for the CSI inputs ...

I was wondering what driver or kernel  you are using to get images from the ADV7180

(my kernel is 3.13.0)

Best regards , Johan

0 Kudos
1,136 Views
compmas2
Contributor V

I am using the Freescale 2.6.35 kernel at the following location: http://git.freescale.com/git/cgit.cgi/imx/linux-2.6-imx.git/log/?h=imx_2.6.35_maintain

Unfortunately there is no driver support for the i.MX5x or i.MX6 CSI interface in the mainline kernels from kernel.org, but it is on the todo list as part of the imx-drm set of drivers that are currently under drivers/staging/imx-drm.

0 Kudos
1,137 Views
compmas2
Contributor V

If you are doing CVBS (composite) video and want to switch between the 3 or 6 inputs (depending on the type of adv7180 you have), you will have to update the driver to do switching of inputs.  The driver defaults to using the first input.

In the Freescale adv7180 driver (drivers/media/video/mxc/capture/adv7180.c), you could add an ioctl item to perform the switching of the inputs.  I am not sure if V4L2 has a predefined ioctl type that you should use for this.  The value of the Input Control register's (address 0x00) 4 least significant bits is where the inputs are controlled.  Take a look at table 13 and 14 in the ADV7180 data sheet (http://www.analog.com/static/imported-files/data_sheets/ADV7180.pdf) to see the possible combinations of values to control the inputs.

The muxing of video channels is left to the default ADV7180 settings in the driver so based on the Input Control register, the ADV7180 performs auto muxing.  If you want to manually control the muxing you need to set the MAN_MUX_EN bit (bit 7 or address 0xC4) and then set the muxing configuration in the ADC Switch1 and ADC Switch 2 registers (address 0xC3 and 0xC4) based on table 15 in the ADV7180 data sheet.  This manual configuration of muxing can also be done by creating a new ioctl type in the driver.

0 Kudos
1,136 Views
mks
Contributor II

Yes, I am doin CVBS video, I want to be able to switch between 2 inputs.

About the input control register, I see that there is a configuration here

/*! ADV7180 Reset function.

*

*  @return None.

*/

static void adv7180_hard_reset(bool cvbs)

{

  dev_dbg(&adv7180_data.i2c_client->dev,

  "In adv7180:adv7180_hard_reset\n");

  if (cvbs) {

  /* Set CVBS input on AIN1 */

  adv7180_write_reg(ADV7180_INPUT_CTL, 0x00);

  } else {

  /*

  * Set YPbPr input on AIN1,4,5 and normal

  * operations(autodection of all stds).

  */

  adv7180_write_reg(ADV7180_INPUT_CTL, 0x09);

  }

  /* Datasheet recommends */

  adv7180_write_reg(ADV7180_VSYNC_FIELD_CTL_1, 0x02);

  adv7180_write_reg(ADV7180_MANUAL_WIN_CTL, 0xa2);

}

But I can't figure out what this code means regarding the register fields from adv7180.pdf,

first he write 0x0 so

INPUT_CTL:

VID_SEL[3] VID_SEL[2] VID_SEL[1] VID_SEL[0] INSEL[3] INSEL[2] INSEL[1] INSEL[0]

0                     0               0               0                    0          0          0               0

and then 0x09

VID_SEL[3] VID_SEL[2] VID_SEL[1] VID_SEL[0] INSEL[3] INSEL[2] INSEL[1] INSEL[0]

     0               0               0                    0               1               0          0          1    

Is that right ?

Thanks for you reply.

1,136 Views
compmas2
Contributor V

The ADV7180_INPUT_CTL register is actually written with 0x00 only if you use cvbs.  The cvbs value is setup in your board specific initialization file where you setup the adv7180.  I am not sure if you are using a Freescale board with an ADV7180 attached or a custom board, but the MX53_ARD has the adv7180 setup for cvbs (in kernel source: arch/arm/mach-mx5/mx53_ard.c).

The value of the ADV7180_INPUT_CTL register is only set to 0x09 if the cvbs value is not set to true (that is an if statement in the source code).  If cvbs is not true then it assumes YPrPb mode.

All the adv7180_hard_reset() function is doing is resetting the ADV7180 to its default state as a hard reset.

You also have to know which ADV7180 type you have (64, 48, 40, or 32 lead) since the selection of inputs is different based on your type.  Also the 4 most significant bits are for setting the video format type (NTSC, PAL, etc) and if the 4 MSB are 0, then it defaults to auto detection.  Auto-detection is assumed in the values below.

If you have the 64 or 48 lead model, you would do the following:

For input 1:

adv7180_write_reg(ADV7180_INPUT_CTL, 0x00

For input 2:

adv7180_write_reg(ADV7180_INPUT_CTL, 0x01


If you have the 40 or 32 lead model, you do the following:

For input 1:

adv7180_write_reg(ADV7180_INPUT_CTL, 0x00

For input 2:

adv7180_write_reg(ADV7180_INPUT_CTL, 0x03

1,136 Views
mks
Contributor II

Ok I understand the manual switch so finally the adv7180 muxer don't perform auto switch from several inputs.

Well, I will look for your first suggestion and i will look forward with the ioctl_s_input to do the job.

Thanks for you help.

0 Kudos