summaryrefslogtreecommitdiffstats
path: root/include/media/camera_common.h
diff options
context:
space:
mode:
authorBhanu Murthy V <bmurthyv@nvidia.com>2017-12-05 20:56:46 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2017-12-13 20:20:49 -0500
commit07857ffeb5a350e6d5fc9d5c4b3d56ff4434d7ab (patch)
tree1dc3fb7db0008f8ec82f52b9f417219dc0850e03 /include/media/camera_common.h
parentd00c9880a68fb83d1696e74f841d8226681ce586 (diff)
drivers: media: tegra: Tegra Camera framework
Tegra camera device register - Takes care of necessary initialization to work with common framework for tegra Tegra camera v4l2device register - Takes care of v4l2 subdevice initialization and Async framework initialization to bind with v4l2device. In addition, tegra camera control layer is setup for the sensor drivers to add controls selectively. As next step all the v4l2 controls in tegra camera drivers will be added here. The common framework initializes the drivers based on the device tree properties to setup for each sensor mode. Bug 1946718 Change-Id: I1f8dbce452248e9749c473bb83c4ea86e42ef531 Signed-off-by: Bhanu Murthy V <bmurthyv@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1611726 Reviewed-by: Frank Chen <frankc@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Jihoon Bang <jbang@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'include/media/camera_common.h')
-rw-r--r--include/media/camera_common.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/include/media/camera_common.h b/include/media/camera_common.h
index 674a29e6c..6c3ae9531 100644
--- a/include/media/camera_common.h
+++ b/include/media/camera_common.h
@@ -158,16 +158,42 @@ struct camera_common_framesync {
158struct camera_common_data; 158struct camera_common_data;
159 159
160struct camera_common_sensor_ops { 160struct camera_common_sensor_ops {
161 u32 numfrmfmts;
162 const struct camera_common_frmfmt *frmfmt_table;
161 int (*power_on)(struct camera_common_data *s_data); 163 int (*power_on)(struct camera_common_data *s_data);
162 int (*power_off)(struct camera_common_data *s_data); 164 int (*power_off)(struct camera_common_data *s_data);
163 int (*write_reg)(struct camera_common_data *s_data, 165 int (*write_reg)(struct camera_common_data *s_data,
164 u16 addr, u8 val); 166 u16 addr, u8 val);
165 int (*read_reg)(struct camera_common_data *s_data, 167 int (*read_reg)(struct camera_common_data *s_data,
166 u16 addr, u8 *val); 168 u16 addr, u8 *val);
169 struct camera_common_pdata *(*parse_dt)(struct device *dev);
170 int (*power_get)(struct camera_common_data *s_data);
171 int (*power_put)(struct camera_common_data *s_data);
167 int (*get_framesync)(struct camera_common_data *s_data, 172 int (*get_framesync)(struct camera_common_data *s_data,
168 struct camera_common_framesync *vshs); 173 struct camera_common_framesync *vshs);
169}; 174};
170 175
176struct tegracam_ctrl_ops {
177 u32 numctrls;
178 u32 string_ctrl_size[TEGRA_CAM_MAX_STRING_CONTROLS];
179 const u32 *ctrl_cid_list;
180 int (*set_gain)(struct camera_common_data *s_data, s64 val);
181 int (*set_exposure)(struct camera_common_data *s_data, s64 val);
182 int (*set_frame_rate)(struct camera_common_data *s_data, s64 val);
183 int (*set_group_hold)(struct camera_common_data *s_data, bool val);
184 int (*fill_string_ctrl)(struct camera_common_data *s_data,
185 struct v4l2_ctrl *ctrl);
186};
187
188struct tegracam_ctrl_handler {
189 struct v4l2_ctrl_handler ctrl_handler;
190 const struct tegracam_ctrl_ops *ctrl_ops;
191 struct camera_common_data *s_data;
192
193 int numctrls;
194 struct v4l2_ctrl *ctrls[MAX_CID_CONTROLS];
195};
196
171struct camera_common_data { 197struct camera_common_data {
172 struct camera_common_sensor_ops *ops; 198 struct camera_common_sensor_ops *ops;
173 struct v4l2_ctrl_handler *ctrl_handler; 199 struct v4l2_ctrl_handler *ctrl_handler;
@@ -181,6 +207,10 @@ struct camera_common_data {
181 struct v4l2_ctrl **ctrls; 207 struct v4l2_ctrl **ctrls;
182 208
183 struct sensor_properties sensor_props; 209 struct sensor_properties sensor_props;
210 /* TODO: cleanup neeeded once all the sensors adapt new framework */
211 struct tegracam_ctrl_handler *tegracam_ctrl_hdl;
212 struct regmap *regmap;
213 struct camera_common_pdata *pdata;
184 214
185 void *priv; 215 void *priv;
186 int numctrls; 216 int numctrls;
@@ -247,6 +277,9 @@ int camera_common_parse_clocks(struct device *dev,
247 struct camera_common_pdata *pdata); 277 struct camera_common_pdata *pdata);
248int camera_common_parse_ports(struct device *dev, 278int camera_common_parse_ports(struct device *dev,
249 struct camera_common_data *s_data); 279 struct camera_common_data *s_data);
280int camera_common_mclk_enable(struct camera_common_data *s_data);
281void camera_common_mclk_disable(struct camera_common_data *s_data);
282
250 283
251int camera_common_debugfs_show(struct seq_file *s, void *unused); 284int camera_common_debugfs_show(struct seq_file *s, void *unused);
252ssize_t camera_common_debugfs_write( 285ssize_t camera_common_debugfs_write(
@@ -294,6 +327,15 @@ void camera_common_cleanup(struct camera_common_data *s_data);
294int camera_common_focuser_init(struct camera_common_focuser_data *s_data); 327int camera_common_focuser_init(struct camera_common_focuser_data *s_data);
295int camera_common_focuser_s_power(struct v4l2_subdev *sd, int on); 328int camera_common_focuser_s_power(struct v4l2_subdev *sd, int on);
296 329
330const struct camera_common_colorfmt *camera_common_find_pixelfmt(
331 unsigned int pix_fmt);
332
333/* common control layer init */
334int tegracam_ctrl_handler_init(struct tegracam_ctrl_handler *handler);
335int tegracam_init_ctrl_ranges_by_mode(
336 struct tegracam_ctrl_handler *handler,
337 u32 modeidx);
338
297/* Regmap / RTCPU I2C driver interface */ 339/* Regmap / RTCPU I2C driver interface */
298struct tegra_i2c_rtcpu_sensor; 340struct tegra_i2c_rtcpu_sensor;
299struct tegra_i2c_rtcpu_config; 341struct tegra_i2c_rtcpu_config;