Re: [PATCH v1 2/3] media:st-mipid02: MIPID02 CSI-2 to PARALLEL bridge driver

From: Sakari Ailus
Date: Tue Mar 26 2019 - 07:37:36 EST


On Mon, Mar 25, 2019 at 12:14:05PM +0000, Mickael GUENE wrote:
> Hi Sakari,
>
> On 3/25/19 12:17, Sakari Ailus wrote:
> > Hi Mickael,
> >
> > On Mon, Mar 18, 2019 at 09:57:44AM +0000, Mickael GUENE wrote:
> >> Hi Sakari,
> >>
> >> Thanks for your review. Find my comments below.
> >>
> >> On 3/16/19 23:14, Sakari Ailus wrote:
> > ...
> >>>> +static struct v4l2_subdev *mipid02_find_sensor(struct mipid02_dev *bridge)
> >>>> +{
> >>>> + struct media_device *mdev = bridge->sd.v4l2_dev->mdev;
> >>>> + struct media_entity *entity;
> >>>> +
> >>>> + if (!mdev)
> >>>> + return NULL;
> >>>> +
> >>>> + media_device_for_each_entity(entity, mdev)
> >>>> + if (entity->function == MEDIA_ENT_F_CAM_SENSOR)
> >>>> + return media_entity_to_v4l2_subdev(entity);
> >>>
> >>> Hmm. Could you instead use the link state to determine which of the
> >>> receivers is active? You'll need one more pad, and then you'd had 1:1
> >>> mapping between ports and pads.
> >>>
> >> Goal here is not to detect which of the receivers is active but to find
> >> sensor in case there are others sub-dev in chain (for example a
> >> serializer/deserializer as found in cars).
> >
> > You shouldn't make assumptions on the rest of the pipeline beyond the
> > device that's directly connected. You might not even have a camera there.
> >
> I have also seen your answer to '[PATCH v2 2/2] media:st-mipid02: MIPID02 CSI-2 to PARALLEL bridge driver'
> concerning support of set_fmt, get_fmt and link_validate.
> My initial idea was to avoid to avoid to implement them and to avoid media ctrl configuration. According
> to your remark is seems a bad idea. Right ?

Yes, you'll need them. This is how the media controller pipeline works: a
driver for a given device is generally only aware of its direct links and
generally only communicate with drivers for devices directly connected to
them.

> In that case I have to also implement enum_mbus_code ?

Yes, please.

> I will drop this code and use connected device only to get link speed.

Ack.

--
Sakari Ailus
sakari.ailus@xxxxxxxxxxxxxxx