All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Cc: "Linux Media Mailing List" <linux-media@vger.kernel.org>,
	"Hans Verkuil" <hans.verkuil@cisco.com>,
	"Rafael Lourenço de Lima Chehab" <chehabrafael@gmail.com>,
	"Shuah Khan" <shuahkh@osg.samsung.com>,
	"Matthias Schwarzott" <zzam@gentoo.org>,
	"Antti Palosaari" <crope@iki.fi>,
	"Olli Salonen" <olli.salonen@iki.fi>,
	"Tommi Rantala" <tt.rantala@gmail.com>,
	"Lad, Prabhakar" <prabhakar.csengg@gmail.com>,
	"Sakari Ailus" <sakari.ailus@linux.intel.com>,
	"Krzysztof Kozlowski" <k.kozlowski@samsung.com>
Subject: Re: [PATCH 01/18] [media] tuner-core: add an input pad
Date: Mon, 23 Nov 2015 22:01:23 +0200	[thread overview]
Message-ID: <2280184.FRmr0h2MEz@avalon> (raw)
In-Reply-To: <7e90c4ecdcdc15ebb3b32ac075168a93a6b63f4f.1441559233.git.mchehab@osg.samsung.com>

Hi Mauro,

Thank you for the patch.

On Sunday 06 September 2015 14:30:44 Mauro Carvalho Chehab wrote:
> Tuners actually have at least one connector on its
> input.
> 
> Add a PAD to connect it.

The patch looks fine to me, but have you checked that there are no driver 
instantiating a tuner that would get confused by this additional pad, for 
instance in graph traversal code ?

Additionally it should be documented somewhere that drivers instantiating 
tuners are responsible for creating and linking a connector to the tuner 
input.

> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
> 
> diff --git a/drivers/media/dvb-core/dvbdev.c
> b/drivers/media/dvb-core/dvbdev.c index f00f1a5f279c..a8e7e2398f7a 100644
> --- a/drivers/media/dvb-core/dvbdev.c
> +++ b/drivers/media/dvb-core/dvbdev.c
> @@ -34,6 +34,9 @@
>  #include <linux/mutex.h>
>  #include "dvbdev.h"
> 
> +/* Due to enum tuner_pad_index */
> +#include <media/tuner.h>
> +
>  static DEFINE_MUTEX(dvbdev_mutex);
>  static int dvbdev_debug;
> 
> @@ -552,7 +555,7 @@ void dvb_create_media_graph(struct dvb_adapter *adap)
>  	}
> 
>  	if (tuner && demod)
> -		media_create_pad_link(tuner, 0, demod, 0, 0);
> +		media_create_pad_link(tuner, TUNER_PAD_IF_OUTPUT, demod, 0, 0);
> 
>  	if (demod && demux)
>  		media_create_pad_link(demod, 1, demux, 0, MEDIA_LNK_FL_ENABLED);
> diff --git a/drivers/media/usb/au0828/au0828-core.c
> b/drivers/media/usb/au0828/au0828-core.c index e28cabe65934..f54c7d10f350
> 100644
> --- a/drivers/media/usb/au0828/au0828-core.c
> +++ b/drivers/media/usb/au0828/au0828-core.c
> @@ -27,6 +27,9 @@
>  #include <media/v4l2-common.h>
>  #include <linux/mutex.h>
> 
> +/* Due to enum tuner_pad_index */
> +#include <media/tuner.h>
> +
>  /*
>   * 1 = General debug messages
>   * 2 = USB handling
> @@ -260,7 +263,7 @@ static void au0828_create_media_graph(struct au0828_dev
> *dev) return;
> 
>  	if (tuner)
> -		media_create_pad_link(tuner, 0, decoder, 0,
> +		media_create_pad_link(tuner, TUNER_PAD_IF_OUTPUT, decoder, 0,
>  				      MEDIA_LNK_FL_ENABLED);
>  	media_create_pad_link(decoder, 1, &dev->vdev.entity, 0,
>  			      MEDIA_LNK_FL_ENABLED);
> diff --git a/drivers/media/usb/cx231xx/cx231xx-cards.c
> b/drivers/media/usb/cx231xx/cx231xx-cards.c index
> 3b5c9ae39ad3..1070d87efc65 100644
> --- a/drivers/media/usb/cx231xx/cx231xx-cards.c
> +++ b/drivers/media/usb/cx231xx/cx231xx-cards.c
> @@ -1264,7 +1264,7 @@ static void cx231xx_create_media_graph(struct cx231xx
> *dev) return;
> 
>  	if (tuner)
> -		media_create_pad_link(tuner, 0, decoder, 0,
> +		media_create_pad_link(tuner, TUNER_PAD_IF_OUTPUT, decoder, 0,
>  					 MEDIA_LNK_FL_ENABLED);
>  	media_create_pad_link(decoder, 1, &dev->vdev.entity, 0,
>  				 MEDIA_LNK_FL_ENABLED);
> diff --git a/drivers/media/v4l2-core/tuner-core.c
> b/drivers/media/v4l2-core/tuner-core.c index 100b8f069640..b90f2a52db96
> 100644
> --- a/drivers/media/v4l2-core/tuner-core.c
> +++ b/drivers/media/v4l2-core/tuner-core.c
> @@ -134,8 +134,9 @@ struct tuner {
>  	unsigned int        type; /* chip type id */
>  	void                *config;
>  	const char          *name;
> +
>  #if defined(CONFIG_MEDIA_CONTROLLER)
> -	struct media_pad	pad;
> +	struct media_pad	pad[TUNER_NUM_PADS];
>  #endif
>  };
> 
> @@ -695,11 +696,12 @@ static int tuner_probe(struct i2c_client *client,
>  	/* Should be just before return */
>  register_client:
>  #if defined(CONFIG_MEDIA_CONTROLLER)
> -	t->pad.flags = MEDIA_PAD_FL_SOURCE;
> +	t->pad[TUNER_PAD_RF_INPUT].flags = MEDIA_PAD_FL_SINK;
> +	t->pad[TUNER_PAD_IF_OUTPUT].flags = MEDIA_PAD_FL_SOURCE;
>  	t->sd.entity.type = MEDIA_ENT_T_V4L2_SUBDEV_TUNER;
>  	t->sd.entity.name = t->name;
> 
> -	ret = media_entity_init(&t->sd.entity, 1, &t->pad);
> +	ret = media_entity_init(&t->sd.entity, TUNER_NUM_PADS, &t->pad[0]);
>  	if (ret < 0) {
>  		tuner_err("failed to initialize media entity!\n");
>  		kfree(t);
> diff --git a/include/media/tuner.h b/include/media/tuner.h
> index b46ebb48fe74..95835c8069dd 100644
> --- a/include/media/tuner.h
> +++ b/include/media/tuner.h
> @@ -25,6 +25,14 @@
> 
>  #include <linux/videodev2.h>
> 
> +/* Tuner PADs */
> +/* FIXME: is this the right place for it? */
> +enum tuner_pad_index {
> +	TUNER_PAD_RF_INPUT,
> +	TUNER_PAD_IF_OUTPUT,
> +	TUNER_NUM_PADS
> +};
> +
>  #define ADDR_UNSET (255)
> 
>  #define TUNER_TEMIC_PAL			0        /* 4002 FH5 (3X 7756, 9483) */

-- 
Regards,

Laurent Pinchart


  parent reply	other threads:[~2015-11-23 20:01 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-06 17:30 [PATCH 00/18] MC fixes, improvements and cleanups Mauro Carvalho Chehab
2015-09-06 17:30 ` [PATCH 01/18] [media] tuner-core: add an input pad Mauro Carvalho Chehab
2015-09-11 14:48   ` Hans Verkuil
2015-11-23 20:01   ` Laurent Pinchart [this message]
2015-11-24 11:00     ` Mauro Carvalho Chehab
2015-09-06 17:30 ` [PATCH 02/18] [media] au0828: add support for the connectors Mauro Carvalho Chehab
2015-09-11 14:57   ` Hans Verkuil
2015-12-10 18:24     ` Mauro Carvalho Chehab
2015-09-06 17:30 ` [PATCH 03/18] [media] au0828: Create connector links Mauro Carvalho Chehab
2015-09-06 17:30 ` [PATCH 04/18] [media] media-device: supress backlinks at G_TOPOLOGY ioctl Mauro Carvalho Chehab
2015-09-11 14:58   ` Hans Verkuil
2015-11-23 19:56   ` Laurent Pinchart
2015-11-24 10:57     ` Mauro Carvalho Chehab
2015-09-06 17:30 ` [PATCH 05/18] [media] media-controller: enable all interface links at init Mauro Carvalho Chehab
2015-09-11 15:18   ` Hans Verkuil
2015-11-23 19:46   ` Laurent Pinchart
2015-12-10 11:37     ` Mauro Carvalho Chehab
2015-09-06 17:30 ` [PATCH 06/18] [media] media.h: create connector entities for hybrid TV devices Mauro Carvalho Chehab
2015-09-11 15:19   ` Hans Verkuil
2015-09-11 15:19     ` Hans Verkuil
2015-11-23 18:09   ` Laurent Pinchart
2015-11-23 18:09     ` Laurent Pinchart
2015-12-10 18:43     ` Mauro Carvalho Chehab
2015-12-10 18:43       ` Mauro Carvalho Chehab
2015-09-06 17:30 ` [PATCH 07/18] [media] dvbdev: returns error if graph object creation fails Mauro Carvalho Chehab
2015-09-11 15:20   ` Hans Verkuil
2015-12-10 17:33     ` Mauro Carvalho Chehab
2015-09-06 17:30 ` [PATCH 08/18] [media] dvb core: must check dvb_create_media_graph() Mauro Carvalho Chehab
2015-09-11 15:22   ` Hans Verkuil
2015-09-06 17:30 ` [PATCH 09/18] [media] media-entity: enforce check of interface and links creation Mauro Carvalho Chehab
2015-09-11 15:23   ` Hans Verkuil
2015-09-06 17:30 ` [PATCH 10/18] [media] cx231xx: enforce check for graph creation Mauro Carvalho Chehab
2015-09-11 15:23   ` Hans Verkuil
2015-09-06 17:30 ` [PATCH 11/18] [media] au0828:: " Mauro Carvalho Chehab
2015-09-11 15:23   ` Hans Verkuil
2015-09-06 17:30 ` [PATCH 12/18] [media] media-entity: must check media_create_pad_link() Mauro Carvalho Chehab
2015-09-11 15:24   ` Hans Verkuil
2015-11-23 17:54   ` Laurent Pinchart
2015-12-10 19:13     ` Mauro Carvalho Chehab
2015-09-06 17:30 ` [PATCH 13/18] [media] media-entity.h: rename entity.type to entity.function Mauro Carvalho Chehab
2015-09-06 17:30   ` Mauro Carvalho Chehab
2015-09-11 15:25   ` Hans Verkuil
2015-09-11 15:25     ` Hans Verkuil
2015-11-23 17:51   ` Laurent Pinchart
2015-11-23 17:51     ` Laurent Pinchart
2015-11-24 10:32     ` Mauro Carvalho Chehab
2015-11-24 10:32       ` Mauro Carvalho Chehab
2015-09-06 17:30 ` [PATCH 14/18] [media] media-device: export the entity function via new ioctl Mauro Carvalho Chehab
2015-09-06 17:30   ` Mauro Carvalho Chehab
2015-09-11 15:26   ` Hans Verkuil
2015-11-23 17:46   ` Laurent Pinchart
2015-11-23 17:46     ` Laurent Pinchart
2015-11-24 10:27     ` Mauro Carvalho Chehab
2015-11-24 10:27       ` Mauro Carvalho Chehab
2015-09-06 17:30 ` [PATCH 15/18] [media] uapi/media.h: Rename entities types to functions Mauro Carvalho Chehab
2015-09-06 17:30   ` Mauro Carvalho Chehab
2015-09-06 17:30   ` Mauro Carvalho Chehab
2015-09-11 15:36   ` Hans Verkuil
2015-09-11 15:36     ` Hans Verkuil
2015-09-11 15:36     ` Hans Verkuil
2015-12-10 19:54     ` Mauro Carvalho Chehab
2015-12-10 19:54       ` Mauro Carvalho Chehab
2015-12-10 19:54       ` Mauro Carvalho Chehab
2015-09-06 17:30 ` [PATCH 16/18] [media] DocBook: update entities documentation Mauro Carvalho Chehab
2015-09-06 17:31 ` [PATCH 17/18] [media] dvbdev: move indirect links on dvr/demux to a separate function Mauro Carvalho Chehab
2015-09-11 15:38   ` Hans Verkuil
2015-09-06 17:31 ` [PATCH 18/18] [media] dvbdev: Don't create indirect links Mauro Carvalho Chehab
2015-09-11 15:48   ` Hans Verkuil
2015-12-10 20:20     ` Mauro Carvalho Chehab

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=2280184.FRmr0h2MEz@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=chehabrafael@gmail.com \
    --cc=crope@iki.fi \
    --cc=hans.verkuil@cisco.com \
    --cc=k.kozlowski@samsung.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@osg.samsung.com \
    --cc=olli.salonen@iki.fi \
    --cc=prabhakar.csengg@gmail.com \
    --cc=sakari.ailus@linux.intel.com \
    --cc=shuahkh@osg.samsung.com \
    --cc=tt.rantala@gmail.com \
    --cc=zzam@gentoo.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.