]> rtime.felk.cvut.cz Git - hercules2020/nv-tegra/linux-4.4.git/commitdiff
drivers: LC898212 Media controller driver
authorBhanu Murthy V <bmurthyv@nvidia.com>
Thu, 3 Dec 2015 02:54:13 +0000 (18:54 -0800)
committerWenjia Zhou <wenjiaz@nvidia.com>
Thu, 12 May 2016 01:30:12 +0000 (18:30 -0700)
Add lc898212 focuser driver support
Add camera common focuser APIs and the init
routines for v4l2 focusers
Add multiple subdevices programming in the
media links connected to single video node

Bug 1701610
Bug 1700211

Change-Id: Ibbbabf631002e5ce2d381bab7fdc91ee05ec14a3
Signed-off-by: Bhanu Murthy V <bmurthyv@nvidia.com>
Reviewed-on: http://git-master/r/842478
Reviewed-by: Frank Chen <frankc@nvidia.com>
Reviewed-by: David Wang (SW-TEGRA) <davidw@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Jihoon Bang <jbang@nvidia.com>
include/media/camera_common.h

index 0acc292b91d118b58f0d1a1912dcc74b7e57523e..31e56c237d41408044d32b813e476a7bed0db137 100644 (file)
@@ -35,6 +35,7 @@
 #include <media/v4l2-subdev.h>
 #include <media/v4l2-ctrls.h>
 #include <media/soc_camera.h>
+#include <media/nvc_focus.h>
 
 #define V4L2_CID_TEGRA_CAMERA_BASE     (V4L2_CTRL_CLASS_CAMERA | 0x2000)
 
@@ -171,6 +172,28 @@ struct camera_common_data {
        int     fmt_width, fmt_height;
 };
 
+struct camera_common_focuser_data;
+
+struct camera_common_focuser_ops {
+       int (*power_on)(struct camera_common_focuser_data *s_data);
+       void (*power_off)(struct camera_common_focuser_data *s_data);
+       void (*load_config)(struct camera_common_focuser_data *s_data);
+       int (*ctrls_init)(struct camera_common_focuser_data *s_data);
+};
+
+struct camera_common_focuser_data {
+       struct camera_common_focuser_ops        *ops;
+       struct v4l2_ctrl_handler                *ctrl_handler;
+       struct v4l2_subdev                      subdev;
+       struct v4l2_ctrl                        **ctrls;
+       struct i2c_client                       *i2c_client;
+
+       struct nv_focuser_config                config;
+       void                                    *priv;
+       int                                     pwr_dev;
+       int                                     def_position;
+};
+
 static inline void msleep_range(unsigned int delay_base)
 {
        usleep_range(delay_base * 1000, delay_base * 1000 + 500);
@@ -183,6 +206,13 @@ static inline struct camera_common_data *to_camera_common_data(
                            struct camera_common_data, subdev);
 }
 
+static inline struct camera_common_focuser_data *to_camera_common_focuser_data(
+       const struct i2c_client *client)
+{
+       return container_of(i2c_get_clientdata(client),
+                           struct camera_common_focuser_data, subdev);
+}
+
 int camera_common_g_ctrl(struct camera_common_data *s_data,
                         struct v4l2_control *control);
 
@@ -215,6 +245,8 @@ int camera_common_g_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf);
 int camera_common_s_power(struct v4l2_subdev *sd, int on);
 int camera_common_g_mbus_config(struct v4l2_subdev *sd,
                              struct v4l2_mbus_config *cfg);
-
+/* Focuser */
+int camera_common_focuser_init(struct camera_common_focuser_data *s_data);
+int camera_common_focuser_s_power(struct v4l2_subdev *sd, int on);
 
 #endif /* __camera_common__ */