diff options
Diffstat (limited to 'include/media/soc_camera.h')
-rw-r--r-- | include/media/soc_camera.h | 44 |
1 files changed, 17 insertions, 27 deletions
diff --git a/include/media/soc_camera.h b/include/media/soc_camera.h index 238bd334fd8..7582952dcea 100644 --- a/include/media/soc_camera.h +++ b/include/media/soc_camera.h | |||
@@ -20,14 +20,15 @@ | |||
20 | #include <media/videobuf2-core.h> | 20 | #include <media/videobuf2-core.h> |
21 | #include <media/v4l2-device.h> | 21 | #include <media/v4l2-device.h> |
22 | 22 | ||
23 | extern struct bus_type soc_camera_bus_type; | ||
24 | |||
25 | struct file; | 23 | struct file; |
24 | struct soc_camera_link; | ||
26 | 25 | ||
27 | struct soc_camera_device { | 26 | struct soc_camera_device { |
28 | struct list_head list; | 27 | struct list_head list; /* list of all registered devices */ |
29 | struct device dev; | 28 | struct soc_camera_link *link; |
30 | struct device *pdev; /* Platform device */ | 29 | struct device *pdev; /* Platform device */ |
30 | struct device *parent; /* Camera host device */ | ||
31 | struct device *control; /* E.g., the i2c client */ | ||
31 | s32 user_width; | 32 | s32 user_width; |
32 | s32 user_height; | 33 | s32 user_height; |
33 | u32 bytesperline; /* for padding, zero if unused */ | 34 | u32 bytesperline; /* for padding, zero if unused */ |
@@ -66,8 +67,6 @@ struct soc_camera_host_ops { | |||
66 | struct module *owner; | 67 | struct module *owner; |
67 | int (*add)(struct soc_camera_device *); | 68 | int (*add)(struct soc_camera_device *); |
68 | void (*remove)(struct soc_camera_device *); | 69 | void (*remove)(struct soc_camera_device *); |
69 | int (*suspend)(struct soc_camera_device *, pm_message_t); | ||
70 | int (*resume)(struct soc_camera_device *); | ||
71 | /* | 70 | /* |
72 | * .get_formats() is called for each client device format, but | 71 | * .get_formats() is called for each client device format, but |
73 | * .put_formats() is only called once. Further, if any of the calls to | 72 | * .put_formats() is only called once. Further, if any of the calls to |
@@ -109,12 +108,6 @@ struct soc_camera_host_ops { | |||
109 | #define SOCAM_SENSOR_INVERT_HSYNC (1 << 2) | 108 | #define SOCAM_SENSOR_INVERT_HSYNC (1 << 2) |
110 | #define SOCAM_SENSOR_INVERT_VSYNC (1 << 3) | 109 | #define SOCAM_SENSOR_INVERT_VSYNC (1 << 3) |
111 | #define SOCAM_SENSOR_INVERT_DATA (1 << 4) | 110 | #define SOCAM_SENSOR_INVERT_DATA (1 << 4) |
112 | #define SOCAM_MIPI_1LANE (1 << 5) | ||
113 | #define SOCAM_MIPI_2LANE (1 << 6) | ||
114 | #define SOCAM_MIPI_3LANE (1 << 7) | ||
115 | #define SOCAM_MIPI_4LANE (1 << 8) | ||
116 | #define SOCAM_MIPI (SOCAM_MIPI_1LANE | SOCAM_MIPI_2LANE | \ | ||
117 | SOCAM_MIPI_3LANE | SOCAM_MIPI_4LANE) | ||
118 | 111 | ||
119 | struct i2c_board_info; | 112 | struct i2c_board_info; |
120 | struct regulator_bulk_data; | 113 | struct regulator_bulk_data; |
@@ -134,11 +127,11 @@ struct soc_camera_link { | |||
134 | int num_regulators; | 127 | int num_regulators; |
135 | 128 | ||
136 | /* | 129 | /* |
137 | * For non-I2C devices platform platform has to provide methods to | 130 | * For non-I2C devices platform has to provide methods to add a device |
138 | * add a device to the system and to remove | 131 | * to the system and to remove it |
139 | */ | 132 | */ |
140 | int (*add_device)(struct soc_camera_link *, struct device *); | 133 | int (*add_device)(struct soc_camera_device *); |
141 | void (*del_device)(struct soc_camera_link *); | 134 | void (*del_device)(struct soc_camera_device *); |
142 | /* Optional callbacks to power on or off and reset the sensor */ | 135 | /* Optional callbacks to power on or off and reset the sensor */ |
143 | int (*power)(struct device *, int); | 136 | int (*power)(struct device *, int); |
144 | int (*reset)(struct device *); | 137 | int (*reset)(struct device *); |
@@ -152,12 +145,6 @@ struct soc_camera_link { | |||
152 | void (*free_bus)(struct soc_camera_link *); | 145 | void (*free_bus)(struct soc_camera_link *); |
153 | }; | 146 | }; |
154 | 147 | ||
155 | static inline struct soc_camera_device *to_soc_camera_dev( | ||
156 | const struct device *dev) | ||
157 | { | ||
158 | return container_of(dev, struct soc_camera_device, dev); | ||
159 | } | ||
160 | |||
161 | static inline struct soc_camera_host *to_soc_camera_host( | 148 | static inline struct soc_camera_host *to_soc_camera_host( |
162 | const struct device *dev) | 149 | const struct device *dev) |
163 | { | 150 | { |
@@ -169,13 +156,13 @@ static inline struct soc_camera_host *to_soc_camera_host( | |||
169 | static inline struct soc_camera_link *to_soc_camera_link( | 156 | static inline struct soc_camera_link *to_soc_camera_link( |
170 | const struct soc_camera_device *icd) | 157 | const struct soc_camera_device *icd) |
171 | { | 158 | { |
172 | return icd->dev.platform_data; | 159 | return icd->link; |
173 | } | 160 | } |
174 | 161 | ||
175 | static inline struct device *to_soc_camera_control( | 162 | static inline struct device *to_soc_camera_control( |
176 | const struct soc_camera_device *icd) | 163 | const struct soc_camera_device *icd) |
177 | { | 164 | { |
178 | return dev_get_drvdata(&icd->dev); | 165 | return icd->control; |
179 | } | 166 | } |
180 | 167 | ||
181 | static inline struct v4l2_subdev *soc_camera_to_subdev( | 168 | static inline struct v4l2_subdev *soc_camera_to_subdev( |
@@ -207,11 +194,8 @@ struct soc_camera_format_xlate { | |||
207 | }; | 194 | }; |
208 | 195 | ||
209 | struct soc_camera_ops { | 196 | struct soc_camera_ops { |
210 | int (*suspend)(struct soc_camera_device *, pm_message_t state); | ||
211 | int (*resume)(struct soc_camera_device *); | ||
212 | unsigned long (*query_bus_param)(struct soc_camera_device *); | 197 | unsigned long (*query_bus_param)(struct soc_camera_device *); |
213 | int (*set_bus_param)(struct soc_camera_device *, unsigned long); | 198 | int (*set_bus_param)(struct soc_camera_device *, unsigned long); |
214 | int (*enum_input)(struct soc_camera_device *, struct v4l2_input *); | ||
215 | const struct v4l2_queryctrl *controls; | 199 | const struct v4l2_queryctrl *controls; |
216 | int num_controls; | 200 | int num_controls; |
217 | }; | 201 | }; |
@@ -270,6 +254,12 @@ static inline struct v4l2_queryctrl const *soc_camera_find_qctrl( | |||
270 | #define SOCAM_PCLK_SAMPLE_FALLING (1 << 13) | 254 | #define SOCAM_PCLK_SAMPLE_FALLING (1 << 13) |
271 | #define SOCAM_DATA_ACTIVE_HIGH (1 << 14) | 255 | #define SOCAM_DATA_ACTIVE_HIGH (1 << 14) |
272 | #define SOCAM_DATA_ACTIVE_LOW (1 << 15) | 256 | #define SOCAM_DATA_ACTIVE_LOW (1 << 15) |
257 | #define SOCAM_MIPI_1LANE (1 << 16) | ||
258 | #define SOCAM_MIPI_2LANE (1 << 17) | ||
259 | #define SOCAM_MIPI_3LANE (1 << 18) | ||
260 | #define SOCAM_MIPI_4LANE (1 << 19) | ||
261 | #define SOCAM_MIPI (SOCAM_MIPI_1LANE | SOCAM_MIPI_2LANE | \ | ||
262 | SOCAM_MIPI_3LANE | SOCAM_MIPI_4LANE) | ||
273 | 263 | ||
274 | #define SOCAM_DATAWIDTH_MASK (SOCAM_DATAWIDTH_4 | SOCAM_DATAWIDTH_8 | \ | 264 | #define SOCAM_DATAWIDTH_MASK (SOCAM_DATAWIDTH_4 | SOCAM_DATAWIDTH_8 | \ |
275 | SOCAM_DATAWIDTH_9 | SOCAM_DATAWIDTH_10 | \ | 265 | SOCAM_DATAWIDTH_9 | SOCAM_DATAWIDTH_10 | \ |