Discussion:
[ADV7393] DRM Encoder Slave or DRM Bridge
Vikas Patil
2016-09-12 12:29:36 UTC
Permalink
Dear All,

I am trying to understand difference between "DRM Encoder slave
driver" and "DRM bridge driver" as I need to write one for ADV7393
Video Encoder Chip for the custom target
based on DRA74x having following display connection.

VOUT1 --> ADV7393 --> CVBS Out (ADV7393 is on I2C)

Could anyone here explain what is the difference between two and which
I need to implement for ADV7393 and why?

I could see adv7393 driver available at "drivers/media/i2c/adv7393.c"
in linux 4.4.14. Can I use this driver? My feeling is I can not use
but why could not much understand.
or Do I need to base my driver something like
"drivers/gpu/drm/i2c/adv7511.c", however I also see it is converted to
bridge driver and moved to "drivers/gpu/drm/bridge/adv7511.c" [1]

[1] http://www.spinics.net/lists/dri-devel/msg113244.html

Thanking you all in advance.

Thanks & Regards,
Vikash
Tomi Valkeinen
2016-09-13 08:57:59 UTC
Permalink
Hi,
Post by Vikas Patil
Dear All,
I also see some of the encoder driver are at
"drivers/gpu/drm/omapdrm/displays/". I am confused about which driver
I should consider for reference for adv7393 driver development.
Do I need to use
"drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c" too along
with adv7393 driver?
At the moment omapdrm has its own encoder driver architecture, and you
have to use those if you use omapdrm. So yes, for DRA74x, you should
look at drivers/gpu/drm/omapdrm/displays/.

Tomi
Vikas Patil
2016-09-13 13:13:45 UTC
Permalink
Thanks Tomi for quick comment.

I am thinking to base adv7393 driver on
"drivers\gpu\drm\omapdrm\displays\encoder-tc358768.c" as I don't think
any similar to adv7393 chip driver available. Could you please comment
if this will help to get adv chip running?

I tried to add the device tree config but after adding device
configuration related to adv7393, my first display stopped working and
whenever I run kmscube or modetest it fails.

I have following configuration related to displays. Could anyone tell
me if I am doing anything wrong in DTS configuration? What could be
going wrong when I enable adv7393 related config so display 1 stops
working?

I am not sure if I have to use "composite-video-connector" driver.
Could you please suggest?

display1: VOUT3 --> LCD display
display2: VOUT1 --> ADV7393 --> CVBS OUT --> DISPLAY

dts configs:


aliases {
display0 = &lcd;
display1 = &cvbs_out;
};


lcd: display {

compatible = "omapdss,panel-dpi";

label = "lcd";

panel-timing {
clock-frequency = <27000000>;
hactive = <800>;
vactive = <480>;

hfront-porch = <15>;
hback-porch = <7>;
hsync-len = <7>;

vfront-porch = <40>;
vback-porch = <4>;
vsync-len = <3>;

hsync-active = <1>;
vsync-active = <1>;
de-active = <0>;
pixelclk-active = <0>;
};

***@lcd3 {
lcd_in: endpoint {
remote-endpoint = <&dpi_out3>;
};
};

};

cvbs_out: connector {
compatible = "omapdss,composite-video-connector";
label = "cvbs_out";

port {
cvbs_con: endpoint {
remote-endpoint = <&adv7393_out>;
};
};
};


&i2c2 {
status = "okay";
clock-frequency = <400000>;

***@54 {
compatible = "adi,adv7393";
reg = <0x54>;

pinctrl-names = "i2c", "ddc";

ddc-i2c-bus = <&i2c2>;

ports {
#address-cells = <1>;
#size-cells = <0>;

***@0 {
reg = <0>;

adv7393_in: ***@0 {
remote-endpoint = <&dpi_out>;
};
};

***@1 {
reg = <1>;

adv7393_out: ***@0 {
remote-endpoint = <&cvbs_con>;
};
};
};
};
};

&dss {
status = "okay";


ports {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";

***@lcd3 {
reg = <2>;

dpi_out3: endpoint {
remote-endpoint = <&lcd_in>;
data-lines = <24>;
};
};

***@lcd1 {
reg = <0>;

dpi_out: endpoint {
remote-endpoint = <&adv7393_in>;
data-lines = <24>;
};
};
};
};




***@dra7xx-evm:~# modetest
trying to open device 'i915'...failed
trying to open device 'radeon'...failed
trying to open device 'nouveau'...failed
trying to open device 'vmwgfx'...failed
trying to open device 'omapdrm'...failed
trying to open device 'exynos'...failed
trying to open device 'tilcdc'...failed
trying to open device 'msm'...failed
trying to open device 'sti'...failed
trying to open device 'tegra'...failed
trying to open device 'imx-drm'...failed
trying to open device 'rockchip'...failed
trying to open device 'atmel-hlcdc'...failed
trying to open device 'fsl-dcu-drm'...failed
trying to open device 'vc4'...failed
no device found

***@dra7xx-evm:~# kmscube
trying to load module omapdrm...failed.
trying to load module tilcdc...failed.
trying to load module i915...failed.
trying to load module radeon...failed.
trying to load module nouveau...failed.
trying to load module vmwgfx...failed.
trying to load module exynos...failed.
could not open drm device
failed to initialize DRM

Thanks & Regards,
Vikash
Post by Tomi Valkeinen
Hi,
Post by Vikas Patil
Dear All,
I also see some of the encoder driver are at
"drivers/gpu/drm/omapdrm/displays/". I am confused about which driver
I should consider for reference for adv7393 driver development.
Do I need to use
"drivers/gpu/drm/omapdrm/displays/connector-analog-tv.c" too along
with adv7393 driver?
At the moment omapdrm has its own encoder driver architecture, and you
have to use those if you use omapdrm. So yes, for DRA74x, you should
look at drivers/gpu/drm/omapdrm/displays/.
Tomi
Dear All,

I am trying to understand difference between "DRM Encoder slave
driver" and "DRM bridge driver" as I need to write one for ADV7393
Video Encoder Chip for the custom target
based on DRA74x having following display connection.

VOUT1 --> ADV7393 --> CVBS Out (ADV7393 is on I2C)

Could anyone here explain what is the difference between two and which
I need to implement for ADV7393 and why?

I could see adv7393 driver available at "drivers/media/i2c/adv7393.c"
in linux 4.4.14. Can I use this driver? My feeling is I can not use
but why could not much understand.
or Do I need to base my driver something like
"drivers/gpu/drm/i2c/adv7511.c", however I also see it is converted to
bridge driver and moved to "drivers/gpu/drm/bridge/adv7511.c" [1]

[1] http://www.spinics.net/lists/dri-devel/msg113244.html

Thanking you all in advance.

Thanks & Regards,
Vikash
Tomi Valkeinen
2016-09-14 09:34:16 UTC
Permalink
Post by Vikas Patil
Thanks Tomi for quick comment.
I am thinking to base adv7393 driver on
"drivers\gpu\drm\omapdrm\displays\encoder-tc358768.c" as I don't think
any similar to adv7393 chip driver available. Could you please comment
if this will help to get adv chip running?
I presume you're not using mainline kernel, as that driver is not there.
I'm not familiar with adv7393, but yes, I think you can use that as an
example.
Post by Vikas Patil
I tried to add the device tree config but after adding device
configuration related to adv7393, my first display stopped working and
whenever I run kmscube or modetest it fails.
If you don't have all the display pipelines working (i.e. the drivers
present and working), none of the displays will work.
Post by Vikas Patil
I have following configuration related to displays. Could anyone tell
me if I am doing anything wrong in DTS configuration? What could be
going wrong when I enable adv7393 related config so display 1 stops
working?
The dts looks ok.

Tomi
Tomi Valkeinen
2016-09-15 09:53:57 UTC
Permalink
Post by Tomi Valkeinen
Post by Vikas Patil
Thanks Tomi for quick comment.
I am thinking to base adv7393 driver on
"drivers\gpu\drm\omapdrm\displays\encoder-tc358768.c" as I don't think
any similar to adv7393 chip driver available. Could you please comment
if this will help to get adv chip running?
I presume you're not using mainline kernel, as that driver is not there.
I'm not familiar with adv7393, but yes, I think you can use that as an
example.
Thanks a lot for your comments. I am using latest (i.e. 3.00.00.03 )
Processor SDK Linux Automotive which is based on linux 4.4.14.
As my display panel is connected as follows. I am little confused over
the values I need to set for following properties in probe function.
DPI1/VOUT1 -----16bit DRGB---> ADV7393 (Digital to Analog video
encoder) ------> CVBS Out ------> Display Panel
dssdev->ops.dpi = &adv7393_dpi_ops; (atv?)
dssdev->type = OMAP_DISPLAY_TYPE_DPI;
dssdev->output_type = OMAP_DISPLAY_TYPE_DPI; (Do I need to use
OMAP_DISPLAY_TYPE_VENC, but DRA74x do not have VENC Encoder I think)
dssdev->phy.dpi.data_lines = ddata->dpi_ndl;
dssdev->port_num = 1;
As adv7393 takes 16-bit DRGB as input and gives composite as output,
does above configuration looks correct? or Do I need to change to
something else (e.g. dpi,sdi,dvi, hdmi, atv, dsi)?
The API is quite messy (full of legacy)...

But the "ops" there are for the "downstream" direction, i.e. towards the
connector. So here you should have atv ops. You should then have
connector-analog-tv as a device after adv7393, and that connector driver
will be calling those atv ops.

adv7393 itself will be calling dpi ops, offered by the DSS.

You should set dssdev->type to DPI (that's the input).
dssdev->output_type to OMAP_DISPLAY_TYPE_VENC (output, although "venc"
is not quite correct here, but closest match we have). DRA74x doesn't
have VENC, but this is what the adv7393 outputs.

Tomi
Vikas Patil
2016-09-22 13:22:53 UTC
Permalink
Hi Tomi,


Now with the adv7393 driver in place, I was getting following error.
After debugging found out that this is due to the “.interlace= true”
in display timings
“drivers\gpu\drm\omapdrm\displays\connector-analog-tv.c”.


[ 14.564872] [drm:drm_helper_probe_single_connector_modes_merge_bits]
[CONNECTOR:32:Unknown-1]
[ 14.564882] [drm:omap_connector_get_modes] cvbs_out
[ 14.564898] ------>adv7393_check_timings: start
[ 14.569646] [drm:omap_connector_mode_valid] connector: mode
invalid: 45:"720x480i" 120 27000 720 739 801 858 480 490 493 527 0x48
0x2a000015
[ 14.569659] [drm:drm_mode_debug_printmodeline] Modeline
45:"720x480i" 120 27000 720 739 801 858 480 490 493 527 0x48
0x2a000015
[ 14.569668] [drm:drm_mode_prune_invalid] Not using 720x480i mode: BAD

After setting “.interlace= false” in display timings
“\displays\connector-analog-tv.c” mode seems to be valid but still
nothing on display probably because connector still doesn’t seem to be
enabled from the below drm log.

[ 14.787200] [drm:drm_setup_crtcs]
[ 14.787211] [drm:drm_enable_connectors] connector 32 enabled? no
[ 14.787220] [drm:drm_enable_connectors] connector 36 enabled? Yes

Could you help me to understand if I could use “interlace=false”?
ADV7393 seems to be supporting non-interlaced mode. From datasheet:
“The ADV7390/ADV7391/ADV7392/ADV7393 support an SD noninterlaced mode.
Using this mode, progressive inputs at twice the frame rate of NTSC
and PAL (240p/59.94 Hz and 288p/50 Hz, respectively) can be input into
the ADV7390/ ADV7391/ADV7392/ADV7393. The SD noninterlaced mode can be
enabled using Subaddress 0x88, Bit 1.”

What/Where should I need to look for enabling the above connector and
attached to the correct encoder/crtc?

Also looking at function dispc_mgr_timings_ok () in
drivers/gpu/drm/omapdrm/dss/dispc.c, it seems driver of DSS doesn’t
support interlace out as comment suggests below. Would this be a
problem for me for driving ADV7393? What does this means?


if (dss_mgr_is_lcd(channel)) {
/* TODO: OMAP4+ supports interlace for LCD outputs */
if (timings->interlace)
{
DSSWARN("vikas----->: interlace failed\n");
return false;
}

if (!_dispc_lcd_timings_ok(timings->hsw, timings->hfp,
timings->hbp, timings->vsw, timings->vfp,
timings->vbp))
{
return false;
}
}


Thanks & Regards,
Vikash
Post by Tomi Valkeinen
Post by Tomi Valkeinen
Post by Vikas Patil
Thanks Tomi for quick comment.
I am thinking to base adv7393 driver on
"drivers\gpu\drm\omapdrm\displays\encoder-tc358768.c" as I don't think
any similar to adv7393 chip driver available. Could you please comment
if this will help to get adv chip running?
I presume you're not using mainline kernel, as that driver is not there.
I'm not familiar with adv7393, but yes, I think you can use that as an
example.
Thanks a lot for your comments. I am using latest (i.e. 3.00.00.03 )
Processor SDK Linux Automotive which is based on linux 4.4.14.
As my display panel is connected as follows. I am little confused over
the values I need to set for following properties in probe function.
DPI1/VOUT1 -----16bit DRGB---> ADV7393 (Digital to Analog video
encoder) ------> CVBS Out ------> Display Panel
dssdev->ops.dpi = &adv7393_dpi_ops; (atv?)
dssdev->type = OMAP_DISPLAY_TYPE_DPI;
dssdev->output_type = OMAP_DISPLAY_TYPE_DPI; (Do I need to use
OMAP_DISPLAY_TYPE_VENC, but DRA74x do not have VENC Encoder I think)
dssdev->phy.dpi.data_lines = ddata->dpi_ndl;
dssdev->port_num = 1;
As adv7393 takes 16-bit DRGB as input and gives composite as output,
does above configuration looks correct? or Do I need to change to
something else (e.g. dpi,sdi,dvi, hdmi, atv, dsi)?
The API is quite messy (full of legacy)...
But the "ops" there are for the "downstream" direction, i.e. towards the
connector. So here you should have atv ops. You should then have
connector-analog-tv as a device after adv7393, and that connector driver
will be calling those atv ops.
adv7393 itself will be calling dpi ops, offered by the DSS.
You should set dssdev->type to DPI (that's the input).
dssdev->output_type to OMAP_DISPLAY_TYPE_VENC (output, although "venc"
is not quite correct here, but closest match we have). DRA74x doesn't
have VENC, but this is what the adv7393 outputs.
Tomi
Tomi Valkeinen
2016-09-23 11:00:05 UTC
Permalink
Could you help me to understand if I could use “interlace=false”?
“The ADV7390/ADV7391/ADV7392/ADV7393 support an SD noninterlaced mode.
Using this mode, progressive inputs at twice the frame rate of NTSC
and PAL (240p/59.94 Hz and 288p/50 Hz, respectively) can be input into
the ADV7390/ ADV7391/ADV7392/ADV7393. The SD noninterlaced mode can be
enabled using Subaddress 0x88, Bit 1.”
Difficult to say... So OMAP4+ DSS hardware does support interlace output
for DPI. The driver has never supported it, nor do I have any hardware
to test it. It might be quite easy to add, though.

If I read the above snippet right, to use progressive input, the DISPC
needs to output at double refresh rate. So probably what you would have
to do is in ADV driver, you have your set_timings function, where you
should double the pix clock before you pass the timings forward to the
DISPC's DPI driver.

Tomi
Tomi Valkeinen
2016-09-26 12:30:04 UTC
Permalink
Post by Tomi Valkeinen
Could you help me to understand if I could use “interlace=false”?
“The ADV7390/ADV7391/ADV7392/ADV7393 support an SD noninterlaced mode.
Using this mode, progressive inputs at twice the frame rate of NTSC
and PAL (240p/59.94 Hz and 288p/50 Hz, respectively) can be input into
the ADV7390/ ADV7391/ADV7392/ADV7393. The SD noninterlaced mode can be
enabled using Subaddress 0x88, Bit 1.”
Difficult to say... So OMAP4+ DSS hardware does support interlace output
for DPI. The driver has never supported it, nor do I have any hardware
to test it. It might be quite easy to add, though.
If it is easy and doable then could you describe what I need to do to
support it?
I think there are a few problems there, as the analog connector wasn't
designed to support detection. But you can check the detect callback
from the encoder/connector drivers.

The problem is, it returns a bool, whereas we need a tristate return
value here to represent connected, not connected, unknown.
Post by Tomi Valkeinen
If I read the above snippet right, to use progressive input, the DISPC
needs to output at double refresh rate. So probably what you would have
to do is in ADV driver, you have your set_timings function, where you
should double the pix clock before you pass the timings forward to the
DISPC's DPI driver.
I have configured ADV7393 chip in following mode with the timing below
in connector-analog.tv.c. With this I am seeing continuous flicker
with nothing on display (black screen) and sometime could see the
kmscube but it seems it renders in four quadrant(i.e. once in each
quadrant). I have also tried doubling the pixel clock from 27MHz to
54MHz in timing for non-interlaced mode of ADV7393 but with it also
nothing on display and continuous flicker.
Do you know what might be going wrong? What should I look for to fix this?
- 16-bit SD RGB input
- NTSC mode
- YPrPb component output (CVBS)
- non-interlaced mode
** Timing configured in in connector-analog.tv.c
static const struct omap_video_timings harman_ntsc_timings = {
.x_res = 720,
.y_res = 480,
.pixelclock = 270000000,
That's 270MHz.

Tomi
Tomi Valkeinen
2016-09-26 12:41:43 UTC
Permalink
Will check once I get display working, for time being I think it shows
connected with the hack I mentioned. I was taking about supporting
"interlace" via LCD here.
Ah, sorry, I didn't check the context =).

I don't know if adding interlace to LCD output is easy. It might be. To
answer that, one needs to read the relevant parts of the TRM and the
driver and see how difficult it is. I cannot give you step to step
instructions on how to do it.
Post by Tomi Valkeinen
Post by Tomi Valkeinen
If I read the above snippet right, to use progressive input, the DISPC
needs to output at double refresh rate. So probably what you would have
to do is in ADV driver, you have your set_timings function, where you
should double the pix clock before you pass the timings forward to the
DISPC's DPI driver.
I have configured ADV7393 chip in following mode with the timing below
in connector-analog.tv.c. With this I am seeing continuous flicker
with nothing on display (black screen) and sometime could see the
kmscube but it seems it renders in four quadrant(i.e. once in each
quadrant). I have also tried doubling the pixel clock from 27MHz to
54MHz in timing for non-interlaced mode of ADV7393 but with it also
nothing on display and continuous flicker.
Do you know what might be going wrong? What should I look for to fix this?
- 16-bit SD RGB input
- NTSC mode
- YPrPb component output (CVBS)
- non-interlaced mode
** Timing configured in in connector-analog.tv.c
static const struct omap_video_timings harman_ntsc_timings = {
.x_res = 720,
.y_res = 480,
.pixelclock = 270000000,
That's 270MHz.
It was a typo. I have confirmed it is 27Mhz.
Ok.

Well, I'm not familiar with ADV7393 so it's very difficult to say
anything. If you're certain that the video mode you give above should
work with ADV7393 with the configuration you have done to it, then you
might want to check the HW. Is ADV7393 connected correctly? Perhaps
probe the lines to make sure the signal is correct?

And if that's correct, then you'd need to do the same for the output.

Tomi
Vikas Patil
2016-09-26 12:46:45 UTC
Permalink
Post by Tomi Valkeinen
Will check once I get display working, for time being I think it shows
connected with the hack I mentioned. I was taking about supporting
"interlace" via LCD here.
Ah, sorry, I didn't check the context =).
I don't know if adding interlace to LCD output is easy. It might be. To
answer that, one needs to read the relevant parts of the TRM and the
driver and see how difficult it is. I cannot give you step to step
instructions on how to do it.
Thanks a lot for your quick comments. I will check that.
Post by Tomi Valkeinen
Post by Tomi Valkeinen
Post by Tomi Valkeinen
If I read the above snippet right, to use progressive input, the DISPC
needs to output at double refresh rate. So probably what you would have
to do is in ADV driver, you have your set_timings function, where you
should double the pix clock before you pass the timings forward to the
DISPC's DPI driver.
I have configured ADV7393 chip in following mode with the timing below
in connector-analog.tv.c. With this I am seeing continuous flicker
with nothing on display (black screen) and sometime could see the
kmscube but it seems it renders in four quadrant(i.e. once in each
quadrant). I have also tried doubling the pixel clock from 27MHz to
54MHz in timing for non-interlaced mode of ADV7393 but with it also
nothing on display and continuous flicker.
Do you know what might be going wrong? What should I look for to fix this?
- 16-bit SD RGB input
- NTSC mode
- YPrPb component output (CVBS)
- non-interlaced mode
** Timing configured in in connector-analog.tv.c
static const struct omap_video_timings harman_ntsc_timings = {
.x_res = 720,
.y_res = 480,
.pixelclock = 270000000,
That's 270MHz.
It was a typo. I have confirmed it is 27Mhz.
Ok.
Well, I'm not familiar with ADV7393 so it's very difficult to say
anything. If you're certain that the video mode you give above should
work with ADV7393 with the configuration you have done to it, then you
might want to check the HW. Is ADV7393 connected correctly? Perhaps
probe the lines to make sure the signal is correct?
And if that's correct, then you'd need to do the same for the output.
Same video mode is working fine in other OS (qnx) with the same
target. Will check further.

Thanks & Regards,
Vikash

Tomi Valkeinen
2016-09-23 11:02:16 UTC
Permalink
Post by Vikas Patil
Hi Tomi,
I added the missing check for "OMAP_DISPLAY_TYPE_VENC" in function
modetest seems to be showing correct status and connections.
Is there a cable detection support in the ADV hardware & driver? If not,
then the cable connection status is "unknown". It should still work if
the output is enabled manually. I think. I don't have any boards with
analog tv out..

But yes, your change is an easy hack to force the output on.
Post by Vikas Patil
But still I could not see kmscube on panel and can see some flicker is
going on display. I think I need to understand about what display
timing I could use as interlace doesn't seems to be supported as I
mentioned above.
Yes, sounds like a video timings issue.

Tomi
Vikas Patil
2016-09-26 06:57:40 UTC
Permalink
Post by Tomi Valkeinen
Post by Vikas Patil
Hi Tomi,
I added the missing check for "OMAP_DISPLAY_TYPE_VENC" in function
modetest seems to be showing correct status and connections.
Is there a cable detection support in the ADV hardware & driver? If not,
then the cable connection status is "unknown". It should still work if
the output is enabled manually. I think. I don't have any boards with
analog tv out..
It seems adv7393 has the support for "cable detection" but I am not
sure How to utilize it in driver? Also what ddi you mean by " It
should still work if
the output is enabled manually."?

From Datasheet:
CABLE DETECTION
Subaddress 0x10, Bits[1:0]
The ADV7390/ADV7391/ADV7392/ADV7393 include an Analog Devices
proprietary cable detection feature. The cable detection feature is
available on DAC 1 and DAC 2 when operating in full-drive mode (RSET =
510 Ω, RL = 37.5 Ω, assuming a connected cable). The feature is not
available in low-drive mode (RSET = 4.12 kΩ, RL = 300 Ω). For a DAC to
be monitored, the DAC must be powered up in Subaddress 0x00.
The cable detection feature can be used with all SD, ED, and HD video
standards. It is available for all output configurations, that is,
CVBS, Y-C, YPrPb, and RGB output configurations.
Post by Tomi Valkeinen
But yes, your change is an easy hack to force the output on.
Post by Vikas Patil
But still I could not see kmscube on panel and can see some flicker is
going on display. I think I need to understand about what display
timing I could use as interlace doesn't seems to be supported as I
mentioned above.
Yes, sounds like a video timings issue.
Will check with different timing and doubling the clock as suggested
for non-interlace format.

Thanks & Regards,
Vikash
Tomi Valkeinen
2016-09-26 11:55:45 UTC
Permalink
Post by Vikas Patil
Post by Tomi Valkeinen
Post by Vikas Patil
Hi Tomi,
I added the missing check for "OMAP_DISPLAY_TYPE_VENC" in function
modetest seems to be showing correct status and connections.
Is there a cable detection support in the ADV hardware & driver? If not,
then the cable connection status is "unknown". It should still work if
the output is enabled manually. I think. I don't have any boards with
analog tv out..
It seems adv7393 has the support for "cable detection" but I am not
sure How to utilize it in driver? Also what ddi you mean by " It
You can see hdmi for examples. But it should work fine without the
detection.
Post by Vikas Patil
should still work if
the output is enabled manually."?
The userspace should be able to enable a connector with unknown status.

Tomi
Vikas Patil
2016-09-21 10:59:11 UTC
Permalink
Post by Tomi Valkeinen
Post by Tomi Valkeinen
Post by Vikas Patil
Thanks Tomi for quick comment.
I am thinking to base adv7393 driver on
"drivers\gpu\drm\omapdrm\displays\encoder-tc358768.c" as I don't think
any similar to adv7393 chip driver available. Could you please comment
if this will help to get adv chip running?
I presume you're not using mainline kernel, as that driver is not there.
I'm not familiar with adv7393, but yes, I think you can use that as an
example.
Thanks a lot for your comments. I am using latest (i.e. 3.00.00.03 )
Processor SDK Linux Automotive which is based on linux 4.4.14.
As my display panel is connected as follows. I am little confused over
the values I need to set for following properties in probe function.
DPI1/VOUT1 -----16bit DRGB---> ADV7393 (Digital to Analog video
encoder) ------> CVBS Out ------> Display Panel
dssdev->ops.dpi = &adv7393_dpi_ops; (atv?)
dssdev->type = OMAP_DISPLAY_TYPE_DPI;
dssdev->output_type = OMAP_DISPLAY_TYPE_DPI; (Do I need to use
OMAP_DISPLAY_TYPE_VENC, but DRA74x do not have VENC Encoder I think)
dssdev->phy.dpi.data_lines = ddata->dpi_ndl;
dssdev->port_num = 1;
As adv7393 takes 16-bit DRGB as input and gives composite as output,
does above configuration looks correct? or Do I need to change to
something else (e.g. dpi,sdi,dvi, hdmi, atv, dsi)?
The API is quite messy (full of legacy)...
But the "ops" there are for the "downstream" direction, i.e. towards the
connector. So here you should have atv ops. You should then have
connector-analog-tv as a device after adv7393, and that connector driver
will be calling those atv ops.
adv7393 itself will be calling dpi ops, offered by the DSS.
You should set dssdev->type to DPI (that's the input).
dssdev->output_type to OMAP_DISPLAY_TYPE_VENC (output, although "venc"
is not quite correct here, but closest match we have). DRA74x doesn't
have VENC, but this is what the adv7393 outputs.
Thanks a lot for explaining it. It really helped. I have created the
driver and configured the registers of ADV7393 as required. Even
though encoders and connectors are visible using "modetest" now, but
it seems adv7393 encoder and cvbs-out connector not connected (sttaus
in modetest shows unknown) and might be failing in mode setting (from
DRM logs).

Could you please suggest where should I need to look for fixing this?
Do I need to configure the display timing as per the ADV7393
configuration or as per the attached panel in
\omapdrm\displays\connector-analog-tv.c ?

Also one doubt I have is, as I know DRA74x has 1 GFX pipeline/overlay
and 3 video pipeline/overlay and now with my first LCD display GFX
pipeline would have been connected to vout3/lcd3/dpi3 to LCD panel.
How could I now configure the GFX overlay to vout1/lcd1/dpi1 and
further to adv7393 so that weston could show up on both the displays?
Will second display show kmscube, weston etc?

DRM log snippets: (Attached here the complete drm log when i run modetest)

[ 226.862242] [drm:drm_ioctl] pid=1853, dev=0xe200, auth=1,
DRM_IOCTL_MODE_GETRESOURCES
[ 226.862254] [drm:drm_mode_getresources] CRTC[2] CONNECTORS[2] ENCODERS[2]
[ 226.862266] [drm:drm_ioctl] pid=1853, dev=0xe200, auth=1,
DRM_IOCTL_MODE_GETRESOURCES
[ 226.862276] [drm:drm_mode_getresources] [CRTC:34]
[ 226.862284] [drm:drm_mode_getresources] [CRTC:38]
[ 226.862292] [drm:drm_mode_getresources] [ENCODER:31:TMDS-31]
[ 226.862301] [drm:drm_mode_getresources] [ENCODER:35:TMDS-35]
[ 226.862309] [drm:drm_mode_getresources] [CONNECTOR:32:Unknown-1]
[ 226.862317] [drm:drm_mode_getresources] [CONNECTOR:36:Unknown-2]
[ 226.862325] [drm:drm_mode_getresources] CRTC[2] CONNECTORS[2] ENCODERS[2]
[ 226.862456] [drm:drm_ioctl] pid=1853, dev=0xe200, auth=1,
DRM_IOCTL_MODE_GETCRTC
[ 226.862475] [drm:drm_ioctl] pid=1853, dev=0xe200, auth=1,
DRM_IOCTL_MODE_GETCRTC
[ 226.862498] [drm:drm_ioctl] pid=1853, dev=0xe200, auth=1,
DRM_IOCTL_MODE_GETENCODER
[ 226.862512] [drm:drm_ioctl] pid=1853, dev=0xe200, auth=1,
DRM_IOCTL_MODE_GETENCODER
[ 226.862527] [drm:drm_ioctl] pid=1853, dev=0xe200, auth=1,
DRM_IOCTL_MODE_GETCONNECTOR
[ 226.862536] [drm:drm_mode_getconnector] [CONNECTOR:32:?]
[ 226.862547] [drm:drm_helper_probe_single_connector_modes_merge_bits]
[CONNECTOR:32:Unknown-1]
[ 226.862557] [drm:omap_connector_get_modes] cvbs_out
[ 226.862571] ------>adv7393_check_timings: start
[ 226.870369] [drm:omap_connector_mode_valid] connector: mode
invalid: 42:"720x574i" 50 13500 720 732 796 864 574 579 584 625 0x48
0x2a00001a
[ 226.870383] [drm:drm_mode_debug_printmodeline] Modeline
42:"720x574i" 50 13500 720 732 796 864 574 579 584 625 0x48 0x2a00001a
[ 226.870392] [drm:drm_mode_prune_invalid] Not using 720x574i mode: BAD
[ 226.870408] [drm:drm_ioctl] pid=1853, dev=0xe200, auth=1,
DRM_IOCTL_MODE_GETCONNECTOR
[ 226.870418] [drm:drm_mode_getconnector] [CONNECTOR:32:?]
[ 226.870436] [drm:drm_ioctl] pid=1853, dev=0xe200, auth=1,
DRM_IOCTL_MODE_GETCONNECTOR
[ 226.870445] [drm:drm_mode_getconnector] [CONNECTOR:36:?]
[ 226.870455] [drm:drm_helper_probe_single_connector_modes_merge_bits]
[CONNECTOR:36:Unknown-2]
[ 226.870463] [drm:omap_connector_get_modes] lcd
[ 226.871670] [drm:omap_connector_mode_valid] connector: mode valid:
45:"800x480" 62 26999 800 815 822 829 480 520 523 527 0x48 0x2a000005
[ 226.871682] [drm:drm_helper_probe_single_connector_modes_merge_bits]
[CONNECTOR:36:Unknown-2] probed modes :
[ 226.871695] [drm:drm_mode_debug_printmodeline] Modeline
45:"800x480" 62 26999 800 815 822 829 480 520 523 527 0x48 0x2a000005
[ 226.871710] [drm:drm_ioctl] pid=1853, dev=0xe200, auth=1,
DRM_IOCTL_MODE_GETCONNECTOR
[ 226.871719] [drm:drm_mode_getconnector] [CONNECTOR:36:?]
[ 226.871760] [drm:drm_ioctl] pid=1853, dev=0xe200, auth=1,
DRM_IOCTL_MODE_OBJ_GETPROPERTIES
[ 226.871779] [drm:drm_ioctl] pid=1853, dev=0xe200, auth=1,
DRM_IOCTL_MODE_OBJ_GETPROPERTIES

***@dra7xx-evm:~# modetest
trying to open device 'i915'...failed
trying to open device 'radeon'...failed
trying to open device 'nouveau'...failed
trying to open device 'vmwgfx'...failed
trying to open device 'omapdrm'...done[ 226.862571]
------>adv7393_check_timings: start

Encoders:
id crtc type possible crtcs possible clones
31 0 TMDS 0x00000001 0x00000000
35 38 TMDS 0x00000002 0x00000000

Connectors:
id encoder status name size (mm) modes encoders
32 0 unknown unknown-1 0x0 0 31
props:
1 EDID:
flags: immutable blob
blobs:

value:
2 DPMS:
flags: enum
enums: On=0 Standby=1 Suspend=2 Off=3
value: 0
36 35 connected unknown-2 0x0 1 35
modes:
name refresh (Hz) hdisp hss hse htot vdisp vss vse vtot)
800x480 62 800 815 822 829 480 520 523 527 flags: phsync, pvsync;
type: preferred, driver
props:
1 EDID:
flags: immutable blob
blobs:

value:
2 DPMS:
flags: enum
enums: On=0 Standby=1 Suspend=2 Off=3
value: 0

CRTCs:
id fb pos size
34 0 (0,0) (0x0)
0 0 0 0 0 0 0 0 0 flags: ; type:
props:
27 trans-key-mode:
flags: enum
enums: disable=0 gfx-dst=1 vid-src=2
value: 0
28 trans-key:
flags: range
values: 0 16777215
value: 0
29 background:
flags: range
values: 0 16777215
value: 0
30 alpha_blender:
flags: range
values: 0 1
value: 0
21 GAMMA_LUT:
flags: blob
blobs:

value:
22 GAMMA_LUT_SIZE:
flags: immutable range
values: 0 4294967295
value: 256
23 rotation:
flags: bitmask
values: rotate-0=0x1 rotate-90=0x2 rotate-180=0x4
rotate-270=0x8 reflect-x=0x10 reflect-y=0x20
value: 1
24 zorder:
flags: range
values: 0 3
value: 0
38 43 (0,0) (800x480)
800x480 62 800 815 822 829 480 520 523 527 flags: phsync, pvsync;
type: preferred, driver
props:
27 trans-key-mode:
flags: enum
enums: disable=0 gfx-dst=1 vid-src=2
value: 0
28 trans-key:
flags: range
values: 0 16777215
value: 0
29 background:
flags: range
values: 0 16777215
value: 0
30 alpha_blender:
flags: range
values: 0 1
value: 0
21 GAMMA_LUT:
flags: blob
blobs:

value:
22 GAMMA_LUT_SIZE:
flags: immutable range
values: 0 4294967295
value: 256
23 rotation:
flags: bitmask
values: rotate-0=0x1 rotate-90=0x2 rotate-180=0x4
rotate-270=0x8 reflect-x=0x10 reflect-y=0x20
value: 1
24 zorder:
flags: range
values: 0 3
value: 0

Planes:
id crtc fb CRTC x,y x,y gamma size possible crtcs
33 0 0 0,0 0,0 0 0x00000001
formats: RG16 RX12 XR12 RA12 AR12 XR15 AR15 RG24 RX24 XR24 RA24 AR24
props:
5 type:
flags: immutable enum
enums: Overlay=0 Primary=1 Cursor=2
value: 1
23 rotation:
flags: bitmask
values: rotate-0=0x1 rotate-90=0x2 rotate-180=0x4
rotate-270=0x8 reflect-x=0x10 reflect-y=0x20
value: 1
24 zorder:
flags: range
values: 0 3
value: 0
25 global_alpha:
flags: range
values: 0 255
value: 255
26 pre_mult_alpha:
flags: range
values: 0 1
value: 0
37 38 43 0,0 0,0 0 0x00000002
formats: RG16 RX12 XR12 RA12 AR12 XR15 AR15 RG24 RX24 XR24 RA24 AR24
NV12 YUYV UYVY
props:
5 type:
flags: immutable enum
enums: Overlay=0 Primary=1 Cursor=2
value: 1
23 rotation:
flags: bitmask
values: rotate-0=0x1 rotate-90=0x2 rotate-180=0x4
rotate-270=0x8 reflect-x=0x10 reflect-y=0x20
value: 1
24 zorder:
flags: range
values: 0 3
value: 0
25 global_alpha:
flags: range
values: 0 255
value: 255
26 pre_mult_alpha:
flags: range
values: 0 1
value: 0
39 0 0 0,0 0,0 0 0x00000003
formats: RG16 RX12 XR12 RA12 AR12 XR15 AR15 RG24 RX24 XR24 RA24 AR24
NV12 YUYV UYVY
props:
5 type:
flags: immutable enum
enums: Overlay=0 Primary=1 Cursor=2
value: 0
23 rotation:
flags: bitmask
values: rotate-0=0x1 rotate-90=0x2 rotate-180=0x4
rotate-270=0x8 reflect-x=0x10 reflect-y=0x20
value: 1
24 zorder:
flags: range
values: 0 3
value: 2
25 global_alpha:
flags: range
values: 0 255
value: 255
26 pre_mult_alpha:
flags: range
values: 0 1
value: 0
40 0 0 0,0 0,0 0 0x00000003
formats: RG16 RX12 XR12 RA12 AR12 XR15 AR15 RG24 RX24 XR24 RA24 AR24
NV12 YUYV UYVY
props:
5 type:
flags: immutable enum
enums: Overlay=0 Primary=1 Cursor=2
value: 0
23 rotation:
flags: bitmask
values: rotate-0=0x1 rotate-90=0x2 rotate-180=0x4
rotate-270=0x8 reflect-x=0x10 reflect-y=0x20
value: 1
24 zorder:
flags: range
values: 0 3
value: 3
25 global_alpha:
flags: range
values: 0 255
value: 255
26 pre_mult_alpha:
flags: range
values: 0 1
value: 0

Frame buffers:
id size pitch

Here is the modetest output:

***@dra7xx-evm:~# modetest
trying to open device 'i915'...failed
trying to open device 'radeon'...failed
trying to open device 'nouveau'...failed
trying to open device 'vmwgfx'...failed
trying to open device 'omapdrm'...done[ 226.862571]
------>adv7393_check_timings: start

Encoders:
id crtc type possible crtcs possible clones
31 0 TMDS 0x00000001 0x00000000
35 38 TMDS 0x00000002 0x00000000

Connectors:
id encoder status name size (mm) modes encoders
32 0 unknown unknown-1 0x0 0 31
props:
1 EDID:
flags: immutable blob
blobs:

value:
2 DPMS:
flags: enum
enums: On=0 Standby=1 Suspend=2 Off=3
value: 0
36 35 connected unknown-2 0x0 1 35
modes:
name refresh (Hz) hdisp hss hse htot vdisp vss vse vtot)
800x480 62 800 815 822 829 480 520 523 527 flags: phsync, pvsync;
type: preferred, driver
props:
1 EDID:
flags: immutable blob
blobs:

value:
2 DPMS:
flags: enum
enums: On=0 Standby=1 Suspend=2 Off=3
value: 0

CRTCs:
id fb pos size
34 0 (0,0) (0x0)
0 0 0 0 0 0 0 0 0 flags: ; type:
props:
27 trans-key-mode:
flags: enum
enums: disable=0 gfx-dst=1 vid-src=2
value: 0
28 trans-key:
flags: range
values: 0 16777215
value: 0
29 background:
flags: range
values: 0 16777215
value: 0
30 alpha_blender:
flags: range
values: 0 1
value: 0
21 GAMMA_LUT:
flags: blob
blobs:

value:
22 GAMMA_LUT_SIZE:
flags: immutable range
values: 0 4294967295
value: 256
23 rotation:
flags: bitmask
values: rotate-0=0x1 rotate-90=0x2 rotate-180=0x4
rotate-270=0x8 reflect-x=0x10 reflect-y=0x20
value: 1
24 zorder:
flags: range
values: 0 3
value: 0
38 43 (0,0) (800x480)
800x480 62 800 815 822 829 480 520 523 527 flags: phsync, pvsync;
type: preferred, driver
props:
27 trans-key-mode:
flags: enum
enums: disable=0 gfx-dst=1 vid-src=2
value: 0
28 trans-key:
flags: range
values: 0 16777215
value: 0
29 background:
flags: range
values: 0 16777215
value: 0
30 alpha_blender:
flags: range
values: 0 1
value: 0
21 GAMMA_LUT:
flags: blob
blobs:

value:
22 GAMMA_LUT_SIZE:
flags: immutable range
values: 0 4294967295
value: 256
23 rotation:
flags: bitmask
values: rotate-0=0x1 rotate-90=0x2 rotate-180=0x4
rotate-270=0x8 reflect-x=0x10 reflect-y=0x20
value: 1
24 zorder:
flags: range
values: 0 3
value: 0

Planes:
id crtc fb CRTC x,y x,y gamma size possible crtcs
33 0 0 0,0 0,0 0 0x00000001
formats: RG16 RX12 XR12 RA12 AR12 XR15 AR15 RG24 RX24 XR24 RA24 AR24
props:
5 type:
flags: immutable enum
enums: Overlay=0 Primary=1 Cursor=2
value: 1
23 rotation:
flags: bitmask
values: rotate-0=0x1 rotate-90=0x2 rotate-180=0x4
rotate-270=0x8 reflect-x=0x10 reflect-y=0x20
value: 1
24 zorder:
flags: range
values: 0 3
value: 0
25 global_alpha:
flags: range
values: 0 255
value: 255
26 pre_mult_alpha:
flags: range
values: 0 1
value: 0
37 38 43 0,0 0,0 0 0x00000002
formats: RG16 RX12 XR12 RA12 AR12 XR15 AR15 RG24 RX24 XR24 RA24 AR24
NV12 YUYV UYVY
props:
5 type:
flags: immutable enum
enums: Overlay=0 Primary=1 Cursor=2
value: 1
23 rotation:
flags: bitmask
values: rotate-0=0x1 rotate-90=0x2 rotate-180=0x4
rotate-270=0x8 reflect-x=0x10 reflect-y=0x20
value: 1
24 zorder:
flags: range
values: 0 3
value: 0
25 global_alpha:
flags: range
values: 0 255
value: 255
26 pre_mult_alpha:
flags: range
values: 0 1
value: 0
39 0 0 0,0 0,0 0 0x00000003
formats: RG16 RX12 XR12 RA12 AR12 XR15 AR15 RG24 RX24 XR24 RA24 AR24
NV12 YUYV UYVY
props:
5 type:
flags: immutable enum
enums: Overlay=0 Primary=1 Cursor=2
value: 0
23 rotation:
flags: bitmask
values: rotate-0=0x1 rotate-90=0x2 rotate-180=0x4
rotate-270=0x8 reflect-x=0x10 reflect-y=0x20
value: 1
24 zorder:
flags: range
values: 0 3
value: 2
25 global_alpha:
flags: range
values: 0 255
value: 255
26 pre_mult_alpha:
flags: range
values: 0 1
value: 0
40 0 0 0,0 0,0 0 0x00000003
formats: RG16 RX12 XR12 RA12 AR12 XR15 AR15 RG24 RX24 XR24 RA24 AR24
NV12 YUYV UYVY
props:
5 type:
flags: immutable enum
enums: Overlay=0 Primary=1 Cursor=2
value: 0
23 rotation:
flags: bitmask
values: rotate-0=0x1 rotate-90=0x2 rotate-180=0x4
rotate-270=0x8 reflect-x=0x10 reflect-y=0x20
value: 1
24 zorder:
flags: range
values: 0 3
value: 3
25 global_alpha:
flags: range
values: 0 255
value: 255
26 pre_mult_alpha:
flags: range
values: 0 1
value: 0

Frame buffers:
id size pitch


Thanks & Regards,
Vikash
Laurent Pinchart
2016-09-18 10:15:07 UTC
Permalink
Hi Vikas,
Post by Vikas Patil
Dear All,
I am trying to understand difference between "DRM Encoder slave
driver" and "DRM bridge driver" as I need to write one for ADV7393
Video Encoder Chip for the custom target
based on DRA74x having following display connection.
VOUT1 --> ADV7393 --> CVBS Out (ADV7393 is on I2C)
Could anyone here explain what is the difference between two and which
I need to implement for ADV7393 and why?
The DRM slave encoder predates the DRM bridge frameworks. It's now considered
as legacy and should not be used. All new code should target DRM bridge.
Post by Vikas Patil
I could see adv7393 driver available at "drivers/media/i2c/adv7393.c"
in linux 4.4.14. Can I use this driver? My feeling is I can not use
but why could not much understand.
or Do I need to base my driver something like
"drivers/gpu/drm/i2c/adv7511.c", however I also see it is converted to
bridge driver and moved to "drivers/gpu/drm/bridge/adv7511.c" [1]
[1] http://www.spinics.net/lists/dri-devel/msg113244.html
--
Regards,

Laurent Pinchart
Loading...