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()
148 mutex_unlock(&sensor->lock); in s5k6a3_set_fmt()
157 struct s5k6a3 *sensor = sd_to_s5k6a3(sd); in s5k6a3_get_fmt() local
160 mf = __s5k6a3_get_format(sensor, cfg, fmt->pad, fmt->which); in s5k6a3_get_fmt()
162 mutex_lock(&sensor->lock); in s5k6a3_get_fmt()
164 mutex_unlock(&sensor->lock); in s5k6a3_get_fmt()
189 static int __s5k6a3_power_on(struct s5k6a3 *sensor) in __s5k6a3_power_on() argument
194 ret = clk_set_rate(sensor->clock, sensor->clock_frequency); in __s5k6a3_power_on()
198 ret = pm_runtime_get(sensor->dev); in __s5k6a3_power_on()
202 ret = regulator_enable(sensor->supplies[i].consumer); in __s5k6a3_power_on()
206 ret = clk_prepare_enable(sensor->clock); in __s5k6a3_power_on()
211 ret = regulator_enable(sensor->supplies[i].consumer); in __s5k6a3_power_on()
216 gpio_set_value(sensor->gpio_reset, 1); in __s5k6a3_power_on()
218 gpio_set_value(sensor->gpio_reset, 0); in __s5k6a3_power_on()
220 gpio_set_value(sensor->gpio_reset, 1); in __s5k6a3_power_on()
228 regulator_disable(sensor->supplies[i].consumer); in __s5k6a3_power_on()
230 pm_runtime_put(sensor->dev); in __s5k6a3_power_on()
234 static int __s5k6a3_power_off(struct s5k6a3 *sensor) in __s5k6a3_power_off() argument
238 gpio_set_value(sensor->gpio_reset, 0); in __s5k6a3_power_off()
241 regulator_disable(sensor->supplies[i].consumer); in __s5k6a3_power_off()
243 clk_disable_unprepare(sensor->clock); in __s5k6a3_power_off()
244 pm_runtime_put(sensor->dev); in __s5k6a3_power_off()
250 struct s5k6a3 *sensor = sd_to_s5k6a3(sd); in s5k6a3_s_power() local
253 mutex_lock(&sensor->lock); in s5k6a3_s_power()
255 if (sensor->power_count == !on) { in s5k6a3_s_power()
257 ret = __s5k6a3_power_on(sensor); in s5k6a3_s_power()
259 ret = __s5k6a3_power_off(sensor); in s5k6a3_s_power()
262 sensor->power_count += on ? 1 : -1; in s5k6a3_s_power()
265 mutex_unlock(&sensor->lock); in s5k6a3_s_power()
281 struct s5k6a3 *sensor; in s5k6a3_probe() local
285 sensor = devm_kzalloc(dev, sizeof(*sensor), GFP_KERNEL); in s5k6a3_probe()
286 if (!sensor) in s5k6a3_probe()
289 mutex_init(&sensor->lock); in s5k6a3_probe()
290 sensor->gpio_reset = -EINVAL; in s5k6a3_probe()
291 sensor->clock = ERR_PTR(-EINVAL); in s5k6a3_probe()
292 sensor->dev = dev; in s5k6a3_probe()
294 sensor->clock = devm_clk_get(sensor->dev, S5K6A3_CLK_NAME); in s5k6a3_probe()
295 if (IS_ERR(sensor->clock)) in s5k6a3_probe()
296 return PTR_ERR(sensor->clock); in s5k6a3_probe()
307 sensor->gpio_reset = gpio; in s5k6a3_probe()
310 &sensor->clock_frequency)) { in s5k6a3_probe()
311 sensor->clock_frequency = S5K6A3_DEFAULT_CLK_FREQ; in s5k6a3_probe()
313 sensor->clock_frequency); in s5k6a3_probe()
317 sensor->supplies[i].supply = s5k6a3_supply_names[i]; in s5k6a3_probe()
320 sensor->supplies); in s5k6a3_probe()
324 sd = &sensor->subdev; in s5k6a3_probe()
326 sensor->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; in s5k6a3_probe()
329 sensor->format.code = s5k6a3_formats[0].code; in s5k6a3_probe()
330 sensor->format.width = S5K6A3_DEFAULT_WIDTH; in s5k6a3_probe()
331 sensor->format.height = S5K6A3_DEFAULT_HEIGHT; in s5k6a3_probe()
334 sensor->pad.flags = MEDIA_PAD_FL_SOURCE; in s5k6a3_probe()
335 ret = media_entity_pads_init(&sd->entity, 1, &sensor->pad); in s5k6a3_probe()