From: Hans Verkuil <hans.verkuil@xxxxxxxxx> Add properties to entities and pads to be able to test the properties API. Signed-off-by: Hans Verkuil <hans.verkuil@xxxxxxxxx> --- drivers/media/platform/vimc/vimc-common.c | 50 +++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/drivers/media/platform/vimc/vimc-common.c b/drivers/media/platform/vimc/vimc-common.c index 867e24dbd6b5..e3d5d4b3b44d 100644 --- a/drivers/media/platform/vimc/vimc-common.c +++ b/drivers/media/platform/vimc/vimc-common.c @@ -417,6 +417,7 @@ int vimc_ent_sd_register(struct vimc_ent_device *ved, const unsigned long *pads_flag, const struct v4l2_subdev_ops *sd_ops) { + struct media_prop *prop = NULL; int ret; /* Allocate the pads */ @@ -454,6 +455,55 @@ int vimc_ent_sd_register(struct vimc_ent_device *ved, goto err_clean_m_ent; } + ret = media_entity_add_prop_u64(&sd->entity, "u64", ~1); + if (!ret) + ret = media_entity_add_prop_s64(&sd->entity, "s64", -5); + if (!ret) + ret = media_entity_add_prop_string(&sd->entity, "string", + sd->name); + if (!ret) { + prop = media_entity_add_prop_group(&sd->entity, "empty-group"); + ret = PTR_ERR_OR_ZERO(prop); + } + if (!ret) { + prop = media_entity_add_prop_group(&sd->entity, "group"); + ret = PTR_ERR_OR_ZERO(prop); + } + if (!ret) + ret = media_prop_add_prop_u64(prop, "u64", 42); + if (!ret) + ret = media_prop_add_prop_s64(prop, "s64", -42); + if (!ret) + ret = media_prop_add_prop_string(prop, "string", "42"); + if (!ret) + ret = media_pad_add_prop_u64(&sd->entity.pads[num_pads - 1], + "u64", ~1); + if (!ret) + ret = media_pad_add_prop_s64(&sd->entity.pads[num_pads - 1], + "s64", -5); + if (!ret) { + prop = media_pad_add_prop_group(&sd->entity.pads[num_pads - 1], + "group"); + ret = PTR_ERR_OR_ZERO(prop); + } + if (!ret) + ret = media_prop_add_prop_u64(prop, "u64", 24); + if (!ret) + ret = media_prop_add_prop_s64(prop, "s64", -24); + if (!ret) + ret = media_pad_add_prop_string(&sd->entity.pads[0], + "string", sd->name); + if (!ret) + ret = media_prop_add_prop_string(prop, "string", "24"); + if (!ret) { + prop = media_prop_add_prop_group(prop, "subgroup"); + ret = PTR_ERR_OR_ZERO(prop); + } + if (!ret) + ret = media_prop_add_prop_string(prop, "string", "substring"); + if (ret) + goto err_clean_m_ent; + return 0; err_clean_m_ent: -- 2.19.2