media: v4l2: taint pads with the signal types for consumer devices
authorMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Tue, 31 Jul 2018 12:03:48 +0000 (08:03 -0400)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Mon, 17 Sep 2018 17:16:19 +0000 (13:16 -0400)
Consumer devices are provided with a wide different range of types
supported by the same driver, allowing different configutations.

In order to make easier to setup media controller links, "taint"
pads with the signal type it carries.

While here, get rid of DEMOD_PAD_VBI_OUT, as the signal it carries
is actually the same as the normal video output.

The difference happens at the video/VBI interface:
- for VBI, only the hidden lines are streamed;
- for video, the stream is usually cropped to hide the
  vbi lines.

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/dvb-frontends/au8522_decoder.c
drivers/media/i2c/msp3400-driver.c
drivers/media/i2c/saa7115.c
drivers/media/i2c/tvp5150.c
drivers/media/pci/saa7134/saa7134-core.c
drivers/media/tuners/si2157.c
drivers/media/usb/dvb-usb-v2/mxl111sf.c
drivers/media/v4l2-core/tuner-core.c
include/media/media-entity.h

index 198dd2b6f326380d7ff30ae65f7cc08e4ff4f450..583fdaa7339fabe42628636edafc5817ec9a0b00 100644 (file)
@@ -719,8 +719,11 @@ static int au8522_probe(struct i2c_client *client,
 #if defined(CONFIG_MEDIA_CONTROLLER)
 
        state->pads[DEMOD_PAD_IF_INPUT].flags = MEDIA_PAD_FL_SINK;
+       state->pads[DEMOD_PAD_IF_INPUT].sig_type = PAD_SIGNAL_ANALOG;
        state->pads[DEMOD_PAD_VID_OUT].flags = MEDIA_PAD_FL_SOURCE;
+       state->pads[DEMOD_PAD_VID_OUT].sig_type = PAD_SIGNAL_DV;
        state->pads[DEMOD_PAD_AUDIO_OUT].flags = MEDIA_PAD_FL_SOURCE;
+       state->pads[DEMOD_PAD_AUDIO_OUT].sig_type = PAD_SIGNAL_AUDIO;
        sd->entity.function = MEDIA_ENT_F_ATV_DECODER;
 
        ret = media_entity_pads_init(&sd->entity, ARRAY_SIZE(state->pads),
index 98d20479b65114fbfd102aed6844d83af5f17173..226854ccbd195fc172623390495d29ffef43730d 100644 (file)
@@ -704,7 +704,9 @@ static int msp_probe(struct i2c_client *client, const struct i2c_device_id *id)
 
 #if defined(CONFIG_MEDIA_CONTROLLER)
        state->pads[IF_AUD_DEC_PAD_IF_INPUT].flags = MEDIA_PAD_FL_SINK;
+       state->pads[IF_AUD_DEC_PAD_IF_INPUT].sig_type = PAD_SIGNAL_AUDIO;
        state->pads[IF_AUD_DEC_PAD_OUT].flags = MEDIA_PAD_FL_SOURCE;
+       state->pads[IF_AUD_DEC_PAD_OUT].sig_type = PAD_SIGNAL_AUDIO;
 
        sd->entity.function = MEDIA_ENT_F_IF_AUD_DECODER;
 
index 471d1b7af1645115f2a33346b64a4758469bb4ec..7b2dbe7c59b208fdd3b5789ce747f400f5e771fc 100644 (file)
@@ -1835,7 +1835,9 @@ static int saa711x_probe(struct i2c_client *client,
 
 #if defined(CONFIG_MEDIA_CONTROLLER)
        state->pads[DEMOD_PAD_IF_INPUT].flags = MEDIA_PAD_FL_SINK;
+       state->pads[DEMOD_PAD_IF_INPUT].sig_type = PAD_SIGNAL_ANALOG;
        state->pads[DEMOD_PAD_VID_OUT].flags = MEDIA_PAD_FL_SOURCE;
+       state->pads[DEMOD_PAD_VID_OUT].sig_type = PAD_SIGNAL_DV;
 
        sd->entity.function = MEDIA_ENT_F_ATV_DECODER;
 
index 93c373c20efde8f4ffa1a523f4aef552fc6479a3..94841cf81a7d3bc0fabdb84c88ed3f7a2827ee79 100644 (file)
@@ -1500,7 +1500,9 @@ static int tvp5150_probe(struct i2c_client *c,
 
 #if defined(CONFIG_MEDIA_CONTROLLER)
        core->pads[DEMOD_PAD_IF_INPUT].flags = MEDIA_PAD_FL_SINK;
+       core->pads[DEMOD_PAD_IF_INPUT].sig_type = PAD_SIGNAL_ANALOG;
        core->pads[DEMOD_PAD_VID_OUT].flags = MEDIA_PAD_FL_SOURCE;
+       core->pads[DEMOD_PAD_VID_OUT].sig_type = PAD_SIGNAL_DV;
 
        sd->entity.function = MEDIA_ENT_F_ATV_DECODER;
 
index 267d143c3a484f81c3f233d09c3a7c61d510b982..c4e2df197bf9f01eb01069493c483fe31579e082 100644 (file)
@@ -846,7 +846,9 @@ static void saa7134_create_entities(struct saa7134_dev *dev)
        if (!decoder) {
                dev->demod.name = "saa713x";
                dev->demod_pad[DEMOD_PAD_IF_INPUT].flags = MEDIA_PAD_FL_SINK;
+               dev->demod_pad[DEMOD_PAD_IF_INPUT].sig_type = PAD_SIGNAL_ANALOG;
                dev->demod_pad[DEMOD_PAD_VID_OUT].flags = MEDIA_PAD_FL_SOURCE;
+               dev->demod_pad[DEMOD_PAD_VID_OUT].sig_type = PAD_SIGNAL_DV;
                dev->demod.function = MEDIA_ENT_F_ATV_DECODER;
 
                ret = media_entity_pads_init(&dev->demod, DEMOD_NUM_PADS,
index a08d8fe2bb1b035e40e8004602d4b4dbe42db037..0e39810922fcc9fb3ab44d24c27cbe452a3b477d 100644 (file)
@@ -467,10 +467,12 @@ static int si2157_probe(struct i2c_client *client,
 
                dev->ent.name = KBUILD_MODNAME;
                dev->ent.function = MEDIA_ENT_F_TUNER;
-
                dev->pad[TUNER_PAD_RF_INPUT].flags = MEDIA_PAD_FL_SINK;
+               dev->pad[TUNER_PAD_RF_INPUT].sig_type = PAD_SIGNAL_ANALOG;
                dev->pad[TUNER_PAD_OUTPUT].flags = MEDIA_PAD_FL_SOURCE;
+               dev->pad[TUNER_PAD_OUTPUT].sig_type = PAD_SIGNAL_ANALOG;
                dev->pad[TUNER_PAD_AUD_OUT].flags = MEDIA_PAD_FL_SOURCE;
+               dev->pad[TUNER_PAD_AUD_OUT].sig_type = PAD_SIGNAL_AUDIO;
 
                ret = media_entity_pads_init(&dev->ent, TUNER_NUM_PADS,
                                             &dev->pad[0]);
index 4713ba65e1c228b71c1a4c51ecc015cb58a610ad..ecd75838874558a3e71cc8f079e21405307e69d0 100644 (file)
@@ -893,7 +893,9 @@ static int mxl111sf_attach_tuner(struct dvb_usb_adapter *adap)
        state->tuner.function = MEDIA_ENT_F_TUNER;
        state->tuner.name = "mxl111sf tuner";
        state->tuner_pads[TUNER_PAD_RF_INPUT].flags = MEDIA_PAD_FL_SINK;
+       state->tuner_pads[TUNER_PAD_RF_INPUT].sig_type = PAD_SIGNAL_ANALOG;
        state->tuner_pads[TUNER_PAD_OUTPUT].flags = MEDIA_PAD_FL_SOURCE;
+       state->tuner_pads[TUNER_PAD_OUTPUT].sig_type = PAD_SIGNAL_ANALOG;
 
        ret = media_entity_pads_init(&state->tuner,
                                     TUNER_NUM_PADS, state->tuner_pads);
index 7f858c39753c1f1aaacbe0cd70cdcb07b1cd6f21..2f3b7fb092b9deb876998941e306b177d5c74e61 100644 (file)
@@ -685,15 +685,20 @@ register_client:
         */
        if (t->type == TUNER_TDA9887) {
                t->pad[IF_VID_DEC_PAD_IF_INPUT].flags = MEDIA_PAD_FL_SINK;
+               t->pad[IF_VID_DEC_PAD_IF_INPUT].sig_type = PAD_SIGNAL_ANALOG;
                t->pad[IF_VID_DEC_PAD_OUT].flags = MEDIA_PAD_FL_SOURCE;
+               t->pad[IF_VID_DEC_PAD_OUT].sig_type = PAD_SIGNAL_ANALOG;
                ret = media_entity_pads_init(&t->sd.entity,
                                             IF_VID_DEC_PAD_NUM_PADS,
                                             &t->pad[0]);
                t->sd.entity.function = MEDIA_ENT_F_IF_VID_DECODER;
        } else {
                t->pad[TUNER_PAD_RF_INPUT].flags = MEDIA_PAD_FL_SINK;
+               t->pad[TUNER_PAD_RF_INPUT].sig_type = PAD_SIGNAL_ANALOG;
                t->pad[TUNER_PAD_OUTPUT].flags = MEDIA_PAD_FL_SOURCE;
+               t->pad[TUNER_PAD_OUTPUT].sig_type = PAD_SIGNAL_ANALOG;
                t->pad[TUNER_PAD_AUD_OUT].flags = MEDIA_PAD_FL_SOURCE;
+               t->pad[TUNER_PAD_AUD_OUT].sig_type = PAD_SIGNAL_AUDIO;
                ret = media_entity_pads_init(&t->sd.entity, TUNER_NUM_PADS,
                                             &t->pad[0]);
                t->sd.entity.function = MEDIA_ENT_F_TUNER;
index 3aa3d58d1d586dc2c0417bb8ecb76c7f7c19e2e8..b7a53f5d3e129e51afda2ea6766c50c25c83b17e 100644 (file)
@@ -155,12 +155,41 @@ struct media_link {
        bool is_backlink;
 };
 
+/**
+ * enum media_pad_signal_type - type of the signal inside a media pad
+ *
+ * @PAD_SIGNAL_DEFAULT:
+ *     Default signal. Use this when all inputs or all outputs are
+ *     uniquely identified by the pad number.
+ * @PAD_SIGNAL_ANALOG:
+ *     The pad contains an analog signal. It can be Radio Frequency,
+ *     Intermediate Frequency, a baseband signal or sub-cariers.
+ *     Tuner inputs, IF-PLL demodulators, composite and s-video signals
+ *     should use it.
+ * @PAD_SIGNAL_DV:
+ *     Contains a digital video signal, with can be a bitstream of samples
+ *     taken from an analog TV video source. On such case, it usually
+ *     contains the VBI data on it.
+ * @PAD_SIGNAL_AUDIO:
+ *     Contains an Intermediate Frequency analog signal from an audio
+ *     sub-carrier or an audio bitstream. IF signals are provided by tuners
+ *     and consumed by audio AM/FM decoders. Bitstream audio is provided by
+ *     an audio decoder.
+ */
+enum media_pad_signal_type {
+       PAD_SIGNAL_DEFAULT = 0,
+       PAD_SIGNAL_ANALOG,
+       PAD_SIGNAL_DV,
+       PAD_SIGNAL_AUDIO,
+};
+
 /**
  * struct media_pad - A media pad graph object.
  *
  * @graph_obj: Embedded structure containing the media object common data
  * @entity:    Entity this pad belongs to
  * @index:     Pad index in the entity pads array, numbered from 0 to n
+ * @sig_type:  Type of the signal inside a media pad
  * @flags:     Pad flags, as defined in
  *             :ref:`include/uapi/linux/media.h <media_header>`
  *             (seek for ``MEDIA_PAD_FL_*``)
@@ -169,6 +198,7 @@ struct media_pad {
        struct media_gobj graph_obj;    /* must be first field in struct */
        struct media_entity *entity;
        u16 index;
+       enum media_pad_signal_type sig_type;
        unsigned long flags;
 };