* @connection: the greybus connection for camera control
* @data_connected: whether the data connection has been established
* @debugfs: debugfs entries for camera protocol operations testing
+ * @module: Greybus camera module registered to HOST processor.
*/
struct gb_camera {
struct gb_connection *connection;
struct dentry *root;
struct gb_camera_debugfs_buffer *buffers;
} debugfs;
+
+ struct gb_camera_module module;
};
struct gb_camera_stream_config {
return gb_camera_flush(priv, request_id);
}
-struct gb_camera_ops gb_cam_ops = {
- .capabilities = gb_camera_op_capabilities,
- .configure_streams = gb_camera_op_configure_streams,
- .capture = gb_camera_op_capture,
- .flush = gb_camera_op_flush,
-};
-
static int gb_camera_register_intf_ops(struct gb_camera *gcam)
{
- return gb_camera_register(&gb_cam_ops, gcam);
+ gcam->module.priv = gcam;
+ gcam->module.ops.capabilities = gb_camera_op_capabilities;
+ gcam->module.ops.configure_streams = gb_camera_op_configure_streams;
+ gcam->module.ops.capture = gb_camera_op_capture;
+ gcam->module.ops.flush = gb_camera_op_flush;
+
+ return gb_camera_register(&gcam->module);
+}
+
+static int gb_camera_unregister_intf_ops(struct gb_camera *gcam)
+{
+ return gb_camera_unregister(&gcam->module);
}
/* -----------------------------------------------------------------------------
{
struct gb_camera *gcam = connection->private;
+ gb_camera_unregister_intf_ops(gcam);
+
gb_camera_cleanup(gcam);
}
int (*flush)(void *priv, u32 *request_id);
};
-#define gb_camera_call(f, p, op, args...) \
- (((f)->op) ? (f)->op(p, ##args) : -ENOIOCTLCMD)
+struct gb_camera_module {
+ void *priv;
+ struct gb_camera_ops ops;
-int gb_camera_register(struct gb_camera_ops *ops, void *priv);
+ struct list_head list; /* Global list */
+};
+
+#define gb_camera_call(f, op, args...) \
+ ((!(f) ? -ENODEV : ((f)->ops.op) ? \
+ (f)->ops.op((f)->priv, ##args) : -ENOIOCTLCMD))
+
+int gb_camera_register(struct gb_camera_module *module);
+int gb_camera_unregister(struct gb_camera_module *module);
#endif /* __GB_CAMERA_H */