Re: [PATCH 1/2] media: entity: Add pad_from_dt_regs entity operation

Sakari Ailus
2017-04-28T10:33:00Z

Hi Niklas,

On Fri, Apr 28, 2017 at 12:33:22AM +0200, Niklas Söderlund wrote:
> The optional operation can be used by entities to report how it maps its
> DT node ports and endpoints to media pad numbers. This is useful for
> devices which require more advanced mappings of pads then DT port
> number is equivalent with media port number.
>
> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> ---
> include/media/media-entity.h | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/include/media/media-entity.h b/include/media/media-entity.h
> index c7c254c5bca1761b..47efaf4d825e671b 100644
> --- a/include/media/media-entity.h
> +++ b/include/media/media-entity.h
> @@ -171,6 +171,9 @@ struct media_pad {
>
> /**
> * struct media_entity_operations - Media entity operations
> + * @pad_from_dt_regs: Return the pad number based on DT port and reg
> + * properties. This operation can be used to map a
> + * DT port and reg to a media pad number. Optional.

Don't you need to provide entity as an argument as well? The driver will be
a little bit loss due to lack of context. :-)

How about using the endpoint's device node (or fwnode; you can get it using
of_fwnode_handle() soon) instead? You can always obtain the port node by
just getting the parent.

> * @link_setup: Notify the entity of link changes. The operation can
> * return an error, in which case link setup will be
> * cancelled. Optional.
> @@ -184,6 +187,7 @@ struct media_pad {
> * mutex held.
> */
> struct media_entity_operations {
> + int (*pad_from_dt_regs)(int port_reg, int reg, unsigned int *pad);
> int (*link_setup)(struct media_entity *entity,
> const struct media_pad *local,
> const struct media_pad *remote, u32 flags);

--
Kind regards,

Sakari Ailus
e-mail: sakari.ailus@iki.fi XMPP: sailus@retiisi.org.uk