aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2018-09-28 11:22:39 +0200
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2018-12-13 10:49:11 +0100
commit0960b899a31fc472d084a77390e8e2615335f5c0 (patch)
treeaf50bcba0ec50f32bac3779b0105ae6eb604c4fa
parent23150c9647b5bb2ffa66d41953f966c0bd0f9d71 (diff)
vimc: add property test codemc-props
Add properties to entities and pads to be able to test the properties API. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
-rw-r--r--drivers/media/platform/vimc/vimc-common.c50
1 files changed, 50 insertions, 0 deletions
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:

Privacy Policy