devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marco Felsch <m.felsch@pengutronix.de>
To: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Cc: mchehab@kernel.org, robh+dt@kernel.org, mark.rutland@arm.com,
	p.zabel@pengutronix.de, afshin.nasser@gmail.com,
	javierm@redhat.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 19/22] [media] tvp5150: add input source selection of_graph support
Date: Thu, 9 Aug 2018 18:34:54 +0200	[thread overview]
Message-ID: <20180809163453.GA30373@pengutronix.de> (raw)
In-Reply-To: <20180809130421.5fdac04d@coco.lan>

Hi Mauro,

On 18-08-09 13:04, Mauro Carvalho Chehab wrote:
> Em Thu, 9 Aug 2018 16:35:20 +0200
> Marco Felsch <m.felsch@pengutronix.de> escreveu:
> 
> > Hi Mauro,
> > 
> > Thanks for your feedback.
> 
> > > > > > +	dev_dbg(sd->dev, "link setup '%s':%d->'%s':%d[%d]",
> > > > > > +		remote->entity->name, remote->index, local->entity->name,
> > > > > > +		local->index, flags & MEDIA_LNK_FL_ENABLED);    
> > > > > 
> > > > > Hmm... the remote is the connector, right? I would switch the
> > > > > print message to point from the connector to tvp5150, as this is
> > > > > the signal flow.    
> > > > 
> > > > I don't know what you mean, I tought that's what I'm already do. If I
> > > > change it it will print something like: tvp5150 2-005d :0 -> Comp0 :0[1]  
> > > 
> > > Hmm... then "local" actually means the connector and "remote"
> > > is the tvp5150?  
> > 
> > Nope, local is the tvp and remote is the connector. Actual the output
> > looks as follows
> > 
> > [   26.339939] tvp5150 2-005d: link setup 'Comp0':0->'tvp5150 2-005d':0[1]
> > [   26.346606] tvp5150 2-005d: Setting 0 active [composite]
> > 
> > I think this is what you mean with '... point from the connector to
> > tvp5150 ...'.
> 
> Yes.
> 
> > 
> > >   
> > > >   
> > > > > 
> > > > > Btw, it would likely be better to call it "connector" or "conn_entity",
> > > > > to make it clearer.    
> > > > 
> > > > I tought remote is the common nomenclature. Also the remote mustn't be a
> > > > connector. In my case it's a soldered camera. With this in mind, you think
> > > > it should be still changed?  
> > > 
> > > I see your point.
> > > 
> > > Yeah, remote is a common nomenclature. Yet, as it can be seen from
> > > the above comment (and your answer), common nomenclature may lead
> > > in to mistakes :-)  
> > 
> > Yeah, I know what you mean ^^
> > 
> > > 
> > > It would be good to have either one of sides better named (either
> > > the connectors side or the tvp5150 side - or both), in order to be
> > > clearer and avoid confusion of someone else touches that part of
> > > the code.  
> > 
> > Yes, I'm with you. Since the local always points to the tvp5150, I will
> > change the local to tvp5150 or tvp5150_pad. Renaming the remote isn't
> > that good since it can be anything.
> 
> OK!
> 
> > 
> > > 
> > > In this specific case, both connectors and tvp5150 are created by
> > > the tvp5150, so both are "local" in the sense that both are
> > > created by this driver.
> > >  
> > 
> > I know.. Maybe there should be a 'common' svideo-/composite-connector
> > code and some helpers to create and link those. Then we can drop the
> > 'local' connectors.
> 
> Yeah, that could be a good idea.
> 
> > > > > > +static int tvp5150_registered(struct v4l2_subdev *sd)
> > > > > > +{
> > > > > > +#ifdef CONFIG_MEDIA_CONTROLLER
> > > > > > +	struct tvp5150 *decoder = to_tvp5150(sd);
> > > > > > +	unsigned int i;
> > > > > > +	int ret;
> > > > > > +
> > > > > > +	for (i = 0; i < decoder->connectors_num; i++) {
> > > > > > +		struct media_entity *con = &decoder->connectors[i].ent;
> > > > > > +		struct media_pad *pad = &decoder->connectors[i].pad;
> > > > > > +		unsigned int port = decoder->connectors[i].port_num;
> > > > > > +		bool is_svideo = decoder->connectors[i].is_svideo;
> > > > > > +
> > > > > > +		pad->flags = MEDIA_PAD_FL_SOURCE;
> > > > > > +		ret = media_entity_pads_init(con, 1, pad);
> > > > > > +		if (ret < 0)
> > > > > > +			return ret;
> > > > > > +
> > > > > > +		ret = media_device_register_entity(sd->v4l2_dev->mdev, con);
> > > > > > +		if (ret < 0)
> > > > > > +			return ret;
> > > > > > +
> > > > > > +		ret = media_create_pad_link(con, 0, &sd->entity, port, 0);
> > > > > > +		if (ret < 0) {
> > > > > > +			media_device_unregister_entity(con);
> > > > > > +			return ret;
> > > > > > +		}
> > > > > > +
> > > > > > +		if (is_svideo) {
> > > > > > +			/* svideo links to both aip1a and aip1b */
> > > > > > +			ret = media_create_pad_link(con, 0, &sd->entity,
> > > > > > +						    port + 1, 0);
> > > > > > +			if (ret < 0) {
> > > > > > +				media_device_unregister_entity(con);
> > > > > > +				return ret;
> > > > > > +			}
> > > > > > +		}
> > > > > > +
> > > > > > +	}    
> > > > > 
> > > > > IMO, it should route to the first available connector.    
> > > > 
> > > > Did you mean to set the link status to enabled?   
> > > 
> > > Yes.
> > >   
> > > > If so I have one
> > > > question else can you tell me what you mean?
> > > > 
> > > > Should I use the media_entity_setup_link() helper or should I mark it as
> > > > enabled during media_create_pad_link()? Now I did something like:
> > > > 
> > > > if (i == 0) {
> > > > 	list_for_each_entry(link, &con->links, list) {
> > > > 		media_entity_setup_link(link, MEDIA_LNK_FL_ENABLED);
> > > > 	}
> > > > }  
> > > 
> > > yeah, I guess this should work for both the cases where the first
> > > connector is a comp or a svideo input.
> > > 
> > > I would prefer coding it differently, e. g. something like:
> > > 
> > > 	
> > > 	for (i = 0; i < decoder->connectors_num; i++) {
> > > 		int flags = i ? 0 : MEDIA_LNK_FL_ENABLED;
> > > 
> > > and then use the flags var as the last argument for media_create_pad_link()
> > > calls. That would avoid an extra loop and would likely reduce a little bit
> > > the code size.  
> > 
> > Sorry for the ambiguous code example. I did the 'if (i == 0)' in the same
> > loop, so no extra loop. I can do it your way, but than unnecessary
> > media_entity_setup_link() are made.
> 
> I got that, but:
> 
> 	list_for_each_entry(link, &con->links, list) {
> 		media_entity_setup_link(link, MEDIA_LNK_FL_ENABLED);
> 	}
> 
> would be a second loop inside it :-)
> 
> What do you mean by an unnecessary media_entity_setup_link()?
> 
> What I was thinking is something like:

Oh, okay I tought you mean I should at the link_flags to the
media_entity_setup_link() call inside the list_for_each_entry(). Now I
got you, I will enable the link the during the media_create_pad_link()
call. This answers my initial question :)

> 
> 	static int tvp5150_registered(struct v4l2_subdev *sd)
> 	{
> 	#ifdef CONFIG_MEDIA_CONTROLLER
> 		struct tvp5150 *decoder = to_tvp5150(sd);
> 		unsigned int i;
> 		int ret;
> 
> 		for (i = 0; i < decoder->connectors_num; i++) {
> 			struct media_entity *con = &decoder->connectors[i].ent;
> 			struct media_pad *pad = &decoder->connectors[i].pad;
> 			unsigned int port = decoder->connectors[i].port_num;
> 			bool is_svideo = decoder->connectors[i].is_svideo;
> +			int link_flags = i ? 0 : MEDIA_LNK_FL_ENABLED;
> 
> 			pad->flags = MEDIA_PAD_FL_SOURCE;
> 			ret = media_entity_pads_init(con, 1, pad);
> 			if (ret < 0)
> 				return ret;
> 
> 			ret = media_device_register_entity(sd->v4l2_dev->mdev, con);
> 			if (ret < 0)
> 				return ret;
> 
> -			ret = media_create_pad_link(con, 0, &sd->entity, port, 0);
> +			ret = media_create_pad_link(con, 0, &sd->entity, port, link_flags);
> 			if (ret < 0) {
> 				media_device_unregister_entity(con);
> 				return ret;
> 			}
> 
> 			if (is_svideo) {
> 				/* svideo links to both aip1a and aip1b */
> 				ret = media_create_pad_link(con, 0, &sd->entity,
> -							    port + 1, 0);
> +							    port + 1, link_flags);
> 				if (ret < 0) {
> 					media_device_unregister_entity(con);
> 					return ret;
> 				}
> 			}
> 		}    
> 
> 
> Thanks,
> Mauro
> 

Thanks a lot for your feedback :) I will prepare the v2. This v2 will
only contain those patches which aren't applied to your tvp5150-3 branch.
Is that okay?

Regards,
Marco

  reply	other threads:[~2018-08-09 16:34 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
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 [this message]
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=20180809163453.GA30373@pengutronix.de \
    --to=m.felsch@pengutronix.de \
    --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=mark.rutland@arm.com \
    --cc=mchehab+samsung@kernel.org \
    --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).