devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
To: Marco Felsch <m.felsch@pengutronix.de>
Cc: Javier Martinez Canillas <javierm@redhat.com>,
	mchehab@kernel.org, robh+dt@kernel.org, mark.rutland@arm.com,
	p.zabel@pengutronix.de, afshin.nasser@gmail.com,
	sakari.ailus@linux.intel.com, laurent.pinchart@ideasonboard.com,
	linux-media@vger.kernel.org, devicetree@vger.kernel.org,
	kernel@pengutronix.de
Subject: Re: [PATCH 18/22] partial revert of "[media] tvp5150: add HW input connectors support"
Date: Tue, 31 Jul 2018 10:01:27 -0300	[thread overview]
Message-ID: <20180731100127.27339b10@coco.lan> (raw)
In-Reply-To: <20180731123652.r23m4zlkdulet22z@pengutronix.de>

Em Tue, 31 Jul 2018 14:36:52 +0200
Marco Felsch <m.felsch@pengutronix.de> escreveu:

> Hi Javier,
> Hi Mauro,
> 
> On 18-07-31 13:26, Javier Martinez Canillas wrote:
> > Hi Mauro,
> > 
> > On 07/31/2018 12:06 PM, Mauro Carvalho Chehab wrote:  
> > > Em Tue, 31 Jul 2018 10:52:56 +0200
> > > Javier Martinez Canillas <javierm@redhat.com> escreveu:
> > >   
> > >> Hello Mauro,
> > >>
> > >> On 07/30/2018 08:18 PM, Mauro Carvalho Chehab wrote:  
> > >>> Em Thu, 28 Jun 2018 18:20:50 +0200
> > >>> Marco Felsch <m.felsch@pengutronix.de> escreveu:
> > >>>     
> > >>>> From: Javier Martinez Canillas <javierm@redhat.com>
> > >>>>
> > >>>> Commit f7b4b54e6364 ("[media] tvp5150: add HW input connectors support")
> > >>>> added input signals support for the tvp5150, but the approach was found
> > >>>> to be incorrect so the corresponding DT binding commit 82c2ffeb217a
> > >>>> ("[media] tvp5150: document input connectors DT bindings") was reverted.
> > >>>>
> > >>>> This left the driver with an undocumented (and wrong) DT parsing logic,
> > >>>> so lets get rid of this code as well until the input connectors support
> > >>>> is implemented properly.
> > >>>>
> > >>>> It's a partial revert due other patches added on top of mentioned commit
> > >>>> not allowing the commit to be reverted cleanly anymore. But all the code
> > >>>> related to the DT parsing logic and input entities creation are removed.
> > >>>>
> > >>>> Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > >>>> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
> > >>>> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > >>>> [m.felsch@pengutronix.de: rm TVP5150_INPUT_NUM define]
> > >>>> Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
> > >>>> ---    
> > >>>
> > >>> ...
> > >>>     
> > >>>> -static int tvp5150_registered(struct v4l2_subdev *sd)
> > >>>> -{
> > >>>> -#ifdef CONFIG_MEDIA_CONTROLLER
> > >>>> -	struct tvp5150 *decoder = to_tvp5150(sd);
> > >>>> -	int ret = 0;
> > >>>> -	int i;
> > >>>> -
> > >>>> -	for (i = 0; i < TVP5150_INPUT_NUM; i++) {
> > >>>> -		struct media_entity *input = &decoder->input_ent[i];
> > >>>> -		struct media_pad *pad = &decoder->input_pad[i];
> > >>>> -
> > >>>> -		if (!input->name)
> > >>>> -			continue;
> > >>>> -
> > >>>> -		decoder->input_pad[i].flags = MEDIA_PAD_FL_SOURCE;
> > >>>> -
> > >>>> -		ret = media_entity_pads_init(input, 1, pad);
> > >>>> -		if (ret < 0)
> > >>>> -			return ret;
> > >>>> -
> > >>>> -		ret = media_device_register_entity(sd->v4l2_dev->mdev, input);
> > >>>> -		if (ret < 0)
> > >>>> -			return ret;
> > >>>> -
> > >>>> -		ret = media_create_pad_link(input, 0, &sd->entity,
> > >>>> -					    DEMOD_PAD_IF_INPUT, 0);
> > >>>> -		if (ret < 0) {
> > >>>> -			media_device_unregister_entity(input);
> > >>>> -			return ret;
> > >>>> -		}
> > >>>> -	}
> > >>>> -#endif    
> > >>>
> > >>> Hmm... I suspect that reverting this part may cause problems for drivers
> > >>> like em28xx when compiled with MC, as they rely that the supported demods
> > >>> will have 3 pads (DEMOD_NUM_PADS).
> > >>>    
> > >>
> > >> I don't see how this change could affect em28xx and other drivers. The function
> > >> tvp5150_registered() being removed here, only register the media entity and add
> > >> a link if input->name was set. This is set in tvp5150_parse_dt() and only if a
> > >> input connector as defined in the Device Tree file.
> > >>
> > >> In other words, all the code removed by this patch is DT-only and isn't used by
> > >> any media driver that makes use of the tvp5151.
> > >>
> > >> As mentioned in the commit message, this code has never been used (besides from
> > >> my testings) and should had been removed when the DT binding was reverted, but
> > >> for some reasons the first patch landed and the second didn't at the time.  
> > > 
> > > Short answer: 
> > > 
> > > Yeah, you're right. Yet, patch 19/22 will cause regressions.
> > >
> > > Long answer:
> > > 
> > > That's easy enough to test.
> > > 
> > > Without this patch, a em28xx-based board (Terratec Grabster AV350) reports:
> > > 
> > > $ ./mc_nextgen_test -D
> > > digraph board {
> > > 	rankdir=TB
> > > 	colorscheme=x11
> > > 	labelloc="t"
> > > 	label="Grabster AV 350
> > >  driver:em28xx, bus: usb-0000:00:14.0-2
> > > "
> > > 	intf_devnode_7 [label="intf_devnode_7\nvideo\n/dev/video0", shape=box, style=filled, fillcolor=yellow]
> > > 	intf_devnode_10 [label="intf_devnode_10\nvbi\n/dev/vbi0", shape=box, style=filled, fillcolor=yellow]
> > > 	entity_1 [label="{{<pad_2> 0} | entity_1\nATV decoder\ntvp5150 0-005c | {<pad_3> 1 | <pad_4> 2}}", shape=Mrecord, style=filled, fillcolor=lightblue]
> > > 	entity_6 [label="{{<pad_12> 0} | entity_6\nV4L I/O\n2-2:1.0 video}", shape=Mrecord, style=filled, fillcolor=aquamarine]
> > > 	entity_9 [label="{{<pad_13> 0} | entity_9\nVBI I/O\n2-2:1.0 vbi}", shape=Mrecord, style=filled, fillcolor=aquamarine]
> > > 	entity_14 [label="{entity_14\nunknown entity type\nComposite | {<pad_15> 0}}", shape=Mrecord, style=filled, fillcolor=cadetblue]
> > > 	entity_16 [label="{entity_16\nunknown entity type\nS-Video | {<pad_17> 0}}", shape=Mrecord, style=filled, fillcolor=cadetblue]
> > > 	intf_devnode_7 -> entity_6 [dir="none" color="orange"]
> > > 	intf_devnode_10 -> entity_9 [dir="none" color="orange"]
> > > 	entity_1:pad_3 -> entity_6:pad_12 [color=blue]
> > > 	entity_1:pad_4 -> entity_9:pad_13 [color=blue]
> > > 	entity_14:pad_15 -> entity_1:pad_2 [color=blue]
> > > 	entity_16:pad_17 -> entity_1:pad_2 [color=blue style="dashed"]
> > > }
> > > 
> > > tvp5150 reports 3 pads (one input, two output pads), and media core
> > > properly connects the source pads.
> > > 
> > > With patch 18/22, I got the same graph. So, yeah, applying this patch
> > > won't cause regressions.
> > >  
> > 
> > Yes, I didn't have time to review the other patches in the set yet. I was just
> > referring to patch 18/22 that it is really a standalone change and I've posted
> > it several times already. So I think that one is safe to merge.
> >   
> > > However, when we apply patch 19/22:
> > > 
> > > $ mc_nextgen_test -D
> > > digraph board {
> > > 	rankdir=TB
> > > 	colorscheme=x11
> > > 	labelloc="t"
> > > 	label="Grabster AV 350
> > >  driver:em28xx, bus: usb-0000:00:14.0-2
> > > "
> > > 	intf_devnode_7 [label="intf_devnode_7\nvideo\n/dev/video0", shape=box, style=filled, fillcolor=yellow]
> > > 	intf_devnode_10 [label="intf_devnode_10\nvbi\n/dev/vbi0", shape=box, style=filled, fillcolor=yellow]
> > > 	entity_1 [label="{{<pad_2> 0 | <pad_3> 1 | <pad_4> 2} | entity_1\nATV decoder\ntvp5150 0-005c | {<pad_5> 3}}", shape=Mrecord, style=filled, fillcolor=lightblue]
> > > 	entity_6 [label="{{<pad_12> 0} | entity_6\nV4L I/O\n2-2:1.0 video}", shape=Mrecord, style=filled, fillcolor=aquamarine]
> > > 	entity_9 [label="{{<pad_13> 0} | entity_9\nVBI I/O\n2-2:1.0 vbi}", shape=Mrecord, style=filled, fillcolor=aquamarine]
> > > 	entity_14 [label="{entity_14\nunknown entity type\nComposite | {<pad_15> 0}}", shape=Mrecord, style=filled, fillcolor=cadetblue]
> > > 	entity_16 [label="{entity_16\nunknown entity type\nS-Video | {<pad_17> 0}}", shape=Mrecord, style=filled, fillcolor=cadetblue]
> > > 	intf_devnode_7 -> entity_6 [dir="none" color="orange"]
> > > 	intf_devnode_10 -> entity_9 [dir="none" color="orange"]
> > > 	entity_1:pad_3 -> entity_6:pad_12 [color=blue]
> > > 	entity_1:pad_4 -> entity_9:pad_13 [color=blue]
> > > 	entity_14:pad_15 -> entity_1:pad_2 [color=blue]
> > > 	entity_16:pad_17 -> entity_1:pad_2 [color=blue style="dashed"]
> > > }
> > > 
> > > The graph is not built correct, as it is linking tvp5150's input pads as
> > > if they were output ones.  
> 
> Maybe I misunderstand the mc-pads. I tought the pads represents the
> physical ports. So I mapped these two things togehter.

We had a long discussion about that on IRC and at the ML some time ago.

There are different ways to map it, and different opinions if either a
PAD is a physical or a logical port.

In the case of tvp5150, from the logical standpoint, there's just one
input port (as it can't stream from multiple ports at the same time)
and two physical ports (AIP1A and AIP1B).

Internally, tvp5150 has a switch that allows 3 possible configurations:
	- composite 0 - switching to AIP1A
	- composite 1 - switching to AIP1B
	- s-video - using both AIP1A and AIP1B

So, depending on the way you see, it may have 1, 2 or 3 pads.

We ended by mapping it to just 1 pad. The idea is that, when a link is
created from a connector to it, it will set the input switch.

We did a mistake at the mapping, as VBI and video is actually a single
output pad, with can be connected to two different entities: one that
does the video stream and the other one that filters just some rows of
the video, in order to stream it trough the vbi interface.

If we ever implement a sliced VBI interface - with is now possible with
the interrupt handler - then we'll have a second output pad with sliced
VBI output.

> > > 
> > > The problem is that now you need to teach drivers/media/v4l2-core/v4l2-mc.c
> > > to do the proper wiring for tvp5150.
> > > 
> > > I suspect that fixing v4l2-mc for doing that is not hard, but it may
> > > require changes at the other demods. Thankfully there aren't many
> > > demod drivers, but such patch should be applied before patch 19/22.
> > > 
> > > In the specific case of demods that don't support sliced VBI (or
> > > where sliced VBI is not coded), there should be just one source pad.
> > > 
> > > On demods with sliced VBI, there are actually two source pads,
> > > although, for simplicity, maybe we could map them as just one.
> > > 
> > > If we map as just one source pad, it is probably easy to change the
> > > code at v4l2-mc to do the right thing.
> > > 
> > > I'll do some tests here and try to code it.
> > >  
> > 
> > Yes, another thing that patch 19/22 should take into account is DTs that
> > don't have input connectors defined. So probably TVP5150_PORT_YOUT should
> > be 0 instead of TVP5150_PORT_NUM - 1 as is the case in the current patch.
> > 
> > In other words, it should work both when input connectors are defined in
> > the DT and when these are not defined and only an output port is defined.  
> 
> Yes, it would be a approach to map the output port dynamicaly to the
> highest port number. I tried to keep things easy by a static mapping.
> Maybe a follow up patch can change this behaviour.
> 
> Anyway, input connectors aren't required. There must be at least one
> port child node with a correct port-number in the DT.

If we want to switch the input connector via MC, then it is required.

There are some OMAP3-based boards with 2 composite inputs and tvp5151
(with is almost identical, from software standpoint, to tvp5150).

Thanks,
Mauro

  parent reply	other threads:[~2018-07-31 13:01 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-28 16:20 [PATCH 00/21] TVP5150 fixes and new features Marco Felsch
2018-06-28 16:20 ` [PATCH 01/22] [media] tvp5150: fix width alignment during set_selection() Marco Felsch
2018-06-28 16:20 ` [PATCH 02/22] [media] tvp5150: fix switch exit in set control handler Marco Felsch
2018-06-28 16:20 ` [PATCH 03/22] [media] tvp5150: convert register access to regmap Marco Felsch
2018-06-28 16:20 ` [PATCH 04/22] [media] tvp5150: make use of regmap_update_bits Marco Felsch
2018-06-28 16:20 ` [PATCH 05/22] [media] v4l2-rect.h: add position and equal helpers Marco Felsch
2018-06-29 14:12   ` Sakari Ailus
2018-06-28 16:20 ` [PATCH 06/22] [media] tvp5150: add FORMAT_TRY support for get/set selection handlers Marco Felsch
2018-07-31  0:01   ` Mauro Carvalho Chehab
2018-06-28 16:20 ` [PATCH 07/22] [media] tvp5150: add default format helper Marco Felsch
2018-06-28 16:20 ` [PATCH 08/22] [media] tvp5150: trigger autodetection on subdev open to reset cropping Marco Felsch
2018-06-28 16:20 ` [PATCH 09/22] [media] tvp5150: fix standard autodetection Marco Felsch
2018-06-28 16:20 ` [PATCH 10/22] [media] tvp5150: split reset/enable routine Marco Felsch
2018-06-28 16:20 ` [PATCH 11/22] [media] tvp5150: remove pin configuration from initialization tables Marco Felsch
2018-06-28 16:20 ` [PATCH 12/22] [media] tvp5150: Add sync lock interrupt handling Marco Felsch
2018-06-28 16:20 ` [PATCH 13/22] [media] tvp5150: disable output while signal not locked Marco Felsch
2018-07-30 18:00   ` Mauro Carvalho Chehab
2018-07-30 18:06     ` Mauro Carvalho Chehab
2018-07-31  6:02     ` Marco Felsch
2018-06-28 16:20 ` [PATCH 14/22] [media] tvp5150: issue source change events Marco Felsch
2018-06-28 16:20 ` [PATCH 15/22] [media] tvp5150: add sync lock/loss signal debug messages Marco Felsch
2018-06-28 16:20 ` [PATCH 16/22] [media] tvp5150: add querystd Marco Felsch
2018-07-30 18:09   ` Mauro Carvalho Chehab
2018-08-01 13:21     ` Marco Felsch
2018-08-01 14:22       ` Mauro Carvalho Chehab
2018-08-01 14:49         ` Marco Felsch
2018-08-01 15:50           ` Mauro Carvalho Chehab
2018-08-02  8:01             ` Marco Felsch
2018-08-02  9:49               ` Mauro Carvalho Chehab
2018-08-02 10:16                 ` Marco Felsch
2018-08-02 14:38                   ` Mauro Carvalho Chehab
2018-08-02 10:54                 ` Ian Arkver
2018-08-02 11:58                   ` Marco Felsch
2018-06-28 16:20 ` [PATCH 17/22] [media] tvp5150: add g_std callback Marco Felsch
2018-06-28 16:20 ` [PATCH 18/22] partial revert of "[media] tvp5150: add HW input connectors support" Marco Felsch
2018-07-03 23:19   ` Rob Herring
2018-07-30 18:18   ` Mauro Carvalho Chehab
2018-07-31  7:01     ` Marco Felsch
2018-07-31  8:52     ` Javier Martinez Canillas
2018-07-31 10:06       ` Mauro Carvalho Chehab
2018-07-31 11:26         ` Javier Martinez Canillas
2018-07-31 12:36           ` Marco Felsch
2018-07-31 12:52             ` Javier Martinez Canillas
2018-07-31 13:30               ` Marco Felsch
2018-07-31 19:56                 ` Mauro Carvalho Chehab
2018-08-01 12:10                   ` Marco Felsch
2018-08-01 13:32                     ` Mauro Carvalho Chehab
2018-08-01 15:49                 ` Marco Felsch
2018-08-01 16:23                   ` Javier Martinez Canillas
2018-07-31 13:01             ` Mauro Carvalho Chehab [this message]
2018-07-31 13:22         ` Mauro Carvalho Chehab
2018-06-28 16:20 ` [PATCH 19/22] [media] tvp5150: add input source selection of_graph support Marco Felsch
2018-07-30 18:29   ` Mauro Carvalho Chehab
2018-08-08 15:29     ` Marco Felsch
2018-08-08 18:52       ` Mauro Carvalho Chehab
2018-08-09 12:55         ` Marco Felsch
2018-08-09 13:36           ` Mauro Carvalho Chehab
2018-08-09 14:35             ` Marco Felsch
2018-08-09 16:04               ` Mauro Carvalho Chehab
2018-08-09 16:34                 ` Marco Felsch
2018-06-28 16:20 ` [PATCH 20/22] [media] tvp5150: Add input port connectors DT bindings Marco Felsch
2018-07-03 23:23   ` Rob Herring
2018-07-11  8:50     ` Marco Felsch
2018-08-03  7:29     ` Marco Felsch
2018-08-03 17:30       ` Mauro Carvalho Chehab
2018-08-04  9:04         ` Marco Felsch
2018-06-28 16:20 ` [PATCH 21/22] [media] tvp5150: initialize subdev before parsing device tree Marco Felsch
2018-06-28 16:20 ` [PATCH 22/22] [media] tvp5150: Change default input source selection behaviour Marco Felsch
2018-06-28 20:57 ` [PATCH 00/21] TVP5150 fixes and new features Javier Martinez Canillas

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=20180731100127.27339b10@coco.lan \
    --to=mchehab+samsung@kernel.org \
    --cc=afshin.nasser@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=javierm@redhat.com \
    --cc=kernel@pengutronix.de \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=m.felsch@pengutronix.de \
    --cc=mark.rutland@arm.com \
    --cc=mchehab@kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=robh+dt@kernel.org \
    --cc=sakari.ailus@linux.intel.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 NNTP newsgroup(s).