Lines Matching full:sensor
3 * Samsung S5K6A3 image sensor driver
45 * struct s5k6a3 - fimc-is sensor data structure
47 * @subdev: the image sensor's v4l2 subdev
49 * @supplies: image sensor's voltage regulator supplies
50 * @gpio_reset: GPIO connected to the sensor's reset pin
52 * @format: media bus format at the sensor's source pad
126 struct s5k6a3 *sensor, struct v4l2_subdev_state *sd_state, in __s5k6a3_get_format() argument
130 return sd_state ? v4l2_subdev_get_try_format(&sensor->subdev, in __s5k6a3_get_format()
133 return &sensor->format; in __s5k6a3_get_format()
140 struct s5k6a3 *sensor = sd_to_s5k6a3(sd); in s5k6a3_set_fmt() local
145 mf = __s5k6a3_get_format(sensor, sd_state, fmt->pad, fmt->which); in s5k6a3_set_fmt()
147 mutex_lock(&sensor->lock); in s5k6a3_set_fmt()
149 mutex_unlock(&sensor->lock); in s5k6a3_set_fmt()
158 struct s5k6a3 *sensor = sd_to_s5k6a3(sd); in s5k6a3_get_fmt() local
161 mf = __s5k6a3_get_format(sensor, sd_state, fmt->pad, fmt->which); in s5k6a3_get_fmt()
163 mutex_lock(&sensor->lock); in s5k6a3_get_fmt()
165 mutex_unlock(&sensor->lock); in s5k6a3_get_fmt()
192 static int __s5k6a3_power_on(struct s5k6a3 *sensor) in __s5k6a3_power_on() argument
197 ret = clk_set_rate(sensor->clock, sensor->clock_frequency); in __s5k6a3_power_on()
201 ret = pm_runtime_get(sensor->dev); in __s5k6a3_power_on()
205 ret = regulator_enable(sensor->supplies[i].consumer); in __s5k6a3_power_on()
209 ret = clk_prepare_enable(sensor->clock); in __s5k6a3_power_on()
214 ret = regulator_enable(sensor->supplies[i].consumer); in __s5k6a3_power_on()
219 gpio_set_value(sensor->gpio_reset, 1); in __s5k6a3_power_on()
221 gpio_set_value(sensor->gpio_reset, 0); in __s5k6a3_power_on()
223 gpio_set_value(sensor->gpio_reset, 1); in __s5k6a3_power_on()
225 /* Delay needed for the sensor initialization */ in __s5k6a3_power_on()
230 clk_disable_unprepare(sensor->clock); in __s5k6a3_power_on()
233 regulator_disable(sensor->supplies[i].consumer); in __s5k6a3_power_on()
235 pm_runtime_put(sensor->dev); in __s5k6a3_power_on()
239 static int __s5k6a3_power_off(struct s5k6a3 *sensor) in __s5k6a3_power_off() argument
243 gpio_set_value(sensor->gpio_reset, 0); in __s5k6a3_power_off()
246 regulator_disable(sensor->supplies[i].consumer); in __s5k6a3_power_off()
248 clk_disable_unprepare(sensor->clock); in __s5k6a3_power_off()
249 pm_runtime_put(sensor->dev); in __s5k6a3_power_off()
255 struct s5k6a3 *sensor = sd_to_s5k6a3(sd); in s5k6a3_s_power() local
258 mutex_lock(&sensor->lock); in s5k6a3_s_power()
260 if (sensor->power_count == !on) { in s5k6a3_s_power()
262 ret = __s5k6a3_power_on(sensor); in s5k6a3_s_power()
264 ret = __s5k6a3_power_off(sensor); in s5k6a3_s_power()
267 sensor->power_count += on ? 1 : -1; in s5k6a3_s_power()
270 mutex_unlock(&sensor->lock); in s5k6a3_s_power()
286 struct s5k6a3 *sensor; in s5k6a3_probe() local
290 sensor = devm_kzalloc(dev, sizeof(*sensor), GFP_KERNEL); in s5k6a3_probe()
291 if (!sensor) in s5k6a3_probe()
294 mutex_init(&sensor->lock); in s5k6a3_probe()
295 sensor->gpio_reset = -EINVAL; in s5k6a3_probe()
296 sensor->clock = ERR_PTR(-EINVAL); in s5k6a3_probe()
297 sensor->dev = dev; in s5k6a3_probe()
299 sensor->clock = devm_clk_get(sensor->dev, S5K6A3_CLK_NAME); in s5k6a3_probe()
300 if (IS_ERR(sensor->clock)) in s5k6a3_probe()
301 return PTR_ERR(sensor->clock); in s5k6a3_probe()
312 sensor->gpio_reset = gpio; in s5k6a3_probe()
315 &sensor->clock_frequency)) { in s5k6a3_probe()
316 sensor->clock_frequency = S5K6A3_DEFAULT_CLK_FREQ; in s5k6a3_probe()
318 sensor->clock_frequency); in s5k6a3_probe()
322 sensor->supplies[i].supply = s5k6a3_supply_names[i]; in s5k6a3_probe()
325 sensor->supplies); in s5k6a3_probe()
329 sd = &sensor->subdev; in s5k6a3_probe()
331 sensor->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; in s5k6a3_probe()
334 sensor->format.code = s5k6a3_formats[0].code; in s5k6a3_probe()
335 sensor->format.width = S5K6A3_DEFAULT_WIDTH; in s5k6a3_probe()
336 sensor->format.height = S5K6A3_DEFAULT_HEIGHT; in s5k6a3_probe()
339 sensor->pad.flags = MEDIA_PAD_FL_SOURCE; in s5k6a3_probe()
340 ret = media_entity_pads_init(&sd->entity, 1, &sensor->pad); in s5k6a3_probe()
391 MODULE_DESCRIPTION("S5K6A3 image sensor subdev driver");