Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: entity: Add support for ancillary links

Add functions to create ancillary links, so that they don't need to
be manually created by users.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Daniel Scally <djrscally@gmail.com>
Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>

authored by

Daniel Scally and committed by
Mauro Carvalho Chehab
012c87f7 9d0c23bf

+41
+22
drivers/media/mc/mc-entity.c
··· 1029 1029 mutex_unlock(&mdev->graph_mutex); 1030 1030 } 1031 1031 EXPORT_SYMBOL_GPL(media_remove_intf_links); 1032 + 1033 + struct media_link *media_create_ancillary_link(struct media_entity *primary, 1034 + struct media_entity *ancillary) 1035 + { 1036 + struct media_link *link; 1037 + 1038 + link = media_add_link(&primary->links); 1039 + if (!link) 1040 + return ERR_PTR(-ENOMEM); 1041 + 1042 + link->gobj0 = &primary->graph_obj; 1043 + link->gobj1 = &ancillary->graph_obj; 1044 + link->flags = MEDIA_LNK_FL_IMMUTABLE | MEDIA_LNK_FL_ENABLED | 1045 + MEDIA_LNK_FL_ANCILLARY_LINK; 1046 + 1047 + /* Initialize graph object embedded in the new link */ 1048 + media_gobj_create(primary->graph_obj.mdev, MEDIA_GRAPH_LINK, 1049 + &link->graph_obj); 1050 + 1051 + return link; 1052 + } 1053 + EXPORT_SYMBOL_GPL(media_create_ancillary_link);
+19
include/media/media-entity.h
··· 1121 1121 (((entity)->ops && (entity)->ops->operation) ? \ 1122 1122 (entity)->ops->operation((entity) , ##args) : -ENOIOCTLCMD) 1123 1123 1124 + /** 1125 + * media_create_ancillary_link() - create an ancillary link between two 1126 + * instances of &media_entity 1127 + * 1128 + * @primary: pointer to the primary &media_entity 1129 + * @ancillary: pointer to the ancillary &media_entity 1130 + * 1131 + * Create an ancillary link between two entities, indicating that they 1132 + * represent two connected pieces of hardware that form a single logical unit. 1133 + * A typical example is a camera lens controller being linked to the sensor that 1134 + * it is supporting. 1135 + * 1136 + * The function sets both MEDIA_LNK_FL_ENABLED and MEDIA_LNK_FL_IMMUTABLE for 1137 + * the new link. 1138 + */ 1139 + struct media_link * 1140 + media_create_ancillary_link(struct media_entity *primary, 1141 + struct media_entity *ancillary); 1142 + 1124 1143 #endif