Lines Matching refs:sensor
126 struct s5k6a3 *sensor, struct v4l2_subdev_pad_config *cfg, in __s5k6a3_get_format() argument
130 return cfg ? v4l2_subdev_get_try_format(&sensor->subdev, cfg, pad) : NULL; in __s5k6a3_get_format()
132 return &sensor->format; in __s5k6a3_get_format()
139 struct s5k6a3 *sensor = sd_to_s5k6a3(sd); in s5k6a3_set_fmt() local
144 mf = __s5k6a3_get_format(sensor, cfg, fmt->pad, fmt->which); in s5k6a3_set_fmt()
146 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, cfg, 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()
190 static int __s5k6a3_power_on(struct s5k6a3 *sensor) in __s5k6a3_power_on() argument
195 ret = clk_set_rate(sensor->clock, sensor->clock_frequency); in __s5k6a3_power_on()
199 ret = pm_runtime_get(sensor->dev); in __s5k6a3_power_on()
203 ret = regulator_enable(sensor->supplies[i].consumer); in __s5k6a3_power_on()
207 ret = clk_prepare_enable(sensor->clock); in __s5k6a3_power_on()
212 ret = regulator_enable(sensor->supplies[i].consumer); in __s5k6a3_power_on()
217 gpio_set_value(sensor->gpio_reset, 1); in __s5k6a3_power_on()
219 gpio_set_value(sensor->gpio_reset, 0); in __s5k6a3_power_on()
221 gpio_set_value(sensor->gpio_reset, 1); in __s5k6a3_power_on()
229 regulator_disable(sensor->supplies[i].consumer); in __s5k6a3_power_on()
231 pm_runtime_put(sensor->dev); in __s5k6a3_power_on()
235 static int __s5k6a3_power_off(struct s5k6a3 *sensor) in __s5k6a3_power_off() argument
239 gpio_set_value(sensor->gpio_reset, 0); in __s5k6a3_power_off()
242 regulator_disable(sensor->supplies[i].consumer); in __s5k6a3_power_off()
244 clk_disable_unprepare(sensor->clock); in __s5k6a3_power_off()
245 pm_runtime_put(sensor->dev); in __s5k6a3_power_off()
251 struct s5k6a3 *sensor = sd_to_s5k6a3(sd); in s5k6a3_s_power() local
254 mutex_lock(&sensor->lock); in s5k6a3_s_power()
256 if (sensor->power_count == !on) { in s5k6a3_s_power()
258 ret = __s5k6a3_power_on(sensor); in s5k6a3_s_power()
260 ret = __s5k6a3_power_off(sensor); in s5k6a3_s_power()
263 sensor->power_count += on ? 1 : -1; in s5k6a3_s_power()
266 mutex_unlock(&sensor->lock); in s5k6a3_s_power()
283 struct s5k6a3 *sensor; in s5k6a3_probe() local
287 sensor = devm_kzalloc(dev, sizeof(*sensor), GFP_KERNEL); in s5k6a3_probe()
288 if (!sensor) in s5k6a3_probe()
291 mutex_init(&sensor->lock); in s5k6a3_probe()
292 sensor->gpio_reset = -EINVAL; in s5k6a3_probe()
293 sensor->clock = ERR_PTR(-EINVAL); in s5k6a3_probe()
294 sensor->dev = dev; in s5k6a3_probe()
296 sensor->clock = devm_clk_get(sensor->dev, S5K6A3_CLK_NAME); in s5k6a3_probe()
297 if (IS_ERR(sensor->clock)) in s5k6a3_probe()
298 return PTR_ERR(sensor->clock); in s5k6a3_probe()
309 sensor->gpio_reset = gpio; in s5k6a3_probe()
312 &sensor->clock_frequency)) { in s5k6a3_probe()
313 sensor->clock_frequency = S5K6A3_DEFAULT_CLK_FREQ; in s5k6a3_probe()
315 sensor->clock_frequency); in s5k6a3_probe()
319 sensor->supplies[i].supply = s5k6a3_supply_names[i]; in s5k6a3_probe()
322 sensor->supplies); in s5k6a3_probe()
326 sd = &sensor->subdev; in s5k6a3_probe()
328 sensor->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; in s5k6a3_probe()
331 sensor->format.code = s5k6a3_formats[0].code; in s5k6a3_probe()
332 sensor->format.width = S5K6A3_DEFAULT_WIDTH; in s5k6a3_probe()
333 sensor->format.height = S5K6A3_DEFAULT_HEIGHT; in s5k6a3_probe()
335 sensor->pad.flags = MEDIA_PAD_FL_SOURCE; in s5k6a3_probe()
336 ret = media_entity_init(&sd->entity, 1, &sensor->pad, 0); in s5k6a3_probe()