Lines Matching refs:sd
133 struct v4l2_subdev sd; member
235 static inline struct noon010_info *to_noon010(struct v4l2_subdev *sd) in to_noon010() argument
237 return container_of(sd, struct noon010_info, sd); in to_noon010()
242 return &container_of(ctrl->handler, struct noon010_info, hdl)->sd; in to_sd()
259 static int cam_i2c_read(struct v4l2_subdev *sd, u32 reg_addr) in cam_i2c_read() argument
261 struct i2c_client *client = v4l2_get_subdevdata(sd); in cam_i2c_read()
262 struct noon010_info *info = to_noon010(sd); in cam_i2c_read()
270 static int cam_i2c_write(struct v4l2_subdev *sd, u32 reg_addr, u32 val) in cam_i2c_write() argument
272 struct i2c_client *client = v4l2_get_subdevdata(sd); in cam_i2c_write()
273 struct noon010_info *info = to_noon010(sd); in cam_i2c_write()
281 static inline int noon010_bulk_write_reg(struct v4l2_subdev *sd, in noon010_bulk_write_reg() argument
285 int ret = cam_i2c_write(sd, msg->addr, msg->val); in noon010_bulk_write_reg()
295 static int noon010_power_ctrl(struct v4l2_subdev *sd, bool reset, bool sleep) in noon010_power_ctrl() argument
297 struct noon010_info *info = to_noon010(sd); in noon010_power_ctrl()
302 ret = cam_i2c_write(sd, POWER_CTRL_REG, reg | 0x02); in noon010_power_ctrl()
306 ret = cam_i2c_write(sd, POWER_CTRL_REG, reg); in noon010_power_ctrl()
314 static int noon010_enable_autowhitebalance(struct v4l2_subdev *sd, int on) in noon010_enable_autowhitebalance() argument
318 ret = cam_i2c_write(sd, AWB_CTL_REG(1), on ? 0x2E : 0x2F); in noon010_enable_autowhitebalance()
320 ret = cam_i2c_write(sd, AWB_CTL_REG(0), on ? 0xFB : 0x7B); in noon010_enable_autowhitebalance()
325 static int noon010_set_flip(struct v4l2_subdev *sd, int hflip, int vflip) in noon010_set_flip() argument
327 struct noon010_info *info = to_noon010(sd); in noon010_set_flip()
330 reg = cam_i2c_read(sd, VDO_CTL_REG(1)); in noon010_set_flip()
340 ret = cam_i2c_write(sd, VDO_CTL_REG(1), reg | 0x80); in noon010_set_flip()
349 static int noon010_set_params(struct v4l2_subdev *sd) in noon010_set_params() argument
351 struct noon010_info *info = to_noon010(sd); in noon010_set_params()
353 int ret = cam_i2c_write(sd, VDO_CTL_REG(0), in noon010_set_params()
357 return cam_i2c_write(sd, ISP_CTL_REG(0), in noon010_set_params()
396 v4l2_info(&info->sd, "%s: sensor is already on\n", __func__); in power_enable()
427 v4l2_dbg(1, debug, &info->sd, "%s: sensor is on\n", __func__); in power_enable()
437 v4l2_info(&info->sd, "%s: sensor is already off\n", __func__); in power_disable()
453 v4l2_dbg(1, debug, &info->sd, "%s: sensor is off\n", __func__); in power_disable()
460 struct v4l2_subdev *sd = to_sd(ctrl); in noon010_s_ctrl() local
461 struct noon010_info *info = to_noon010(sd); in noon010_s_ctrl()
464 v4l2_dbg(1, debug, sd, "%s: ctrl_id: %d, value: %d\n", in noon010_s_ctrl()
478 ret = noon010_enable_autowhitebalance(sd, ctrl->val); in noon010_s_ctrl()
481 ret = cam_i2c_write(sd, MWB_BGAIN_REG, ctrl->val); in noon010_s_ctrl()
484 ret = cam_i2c_write(sd, MWB_RGAIN_REG, ctrl->val); in noon010_s_ctrl()
494 static int noon010_enum_mbus_code(struct v4l2_subdev *sd, in noon010_enum_mbus_code() argument
505 static int noon010_get_fmt(struct v4l2_subdev *sd, in noon010_get_fmt() argument
509 struct noon010_info *info = to_noon010(sd); in noon010_get_fmt()
514 mf = v4l2_subdev_get_try_format(sd, cfg, 0); in noon010_get_fmt()
533 static const struct noon010_format *noon010_try_fmt(struct v4l2_subdev *sd, in noon010_try_fmt() argument
546 static int noon010_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, in noon010_set_fmt() argument
549 struct noon010_info *info = to_noon010(sd); in noon010_set_fmt()
555 nf = noon010_try_fmt(sd, &fmt->format); in noon010_set_fmt()
562 mf = v4l2_subdev_get_try_format(sd, cfg, 0); in noon010_set_fmt()
580 static int noon010_base_config(struct v4l2_subdev *sd) in noon010_base_config() argument
582 int ret = noon010_bulk_write_reg(sd, noon010_base_regs); in noon010_base_config()
584 ret = noon010_set_params(sd); in noon010_base_config()
586 ret = noon010_set_flip(sd, 1, 0); in noon010_base_config()
591 static int noon010_s_power(struct v4l2_subdev *sd, int on) in noon010_s_power() argument
593 struct noon010_info *info = to_noon010(sd); in noon010_s_power()
600 ret = noon010_base_config(sd); in noon010_s_power()
602 noon010_power_ctrl(sd, false, true); in noon010_s_power()
614 static int noon010_s_stream(struct v4l2_subdev *sd, int on) in noon010_s_stream() argument
616 struct noon010_info *info = to_noon010(sd); in noon010_s_stream()
621 ret = noon010_power_ctrl(sd, false, !on); in noon010_s_stream()
626 ret = noon010_set_params(sd); in noon010_s_stream()
634 static int noon010_log_status(struct v4l2_subdev *sd) in noon010_log_status() argument
636 struct noon010_info *info = to_noon010(sd); in noon010_log_status()
638 v4l2_ctrl_handler_log_status(&info->hdl, sd->name); in noon010_log_status()
642 static int noon010_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) in noon010_open() argument
644 struct v4l2_mbus_framefmt *mf = v4l2_subdev_get_try_format(sd, fh->pad, 0); in noon010_open()
705 struct v4l2_subdev *sd; in noon010_probe() local
721 sd = &info->sd; in noon010_probe()
722 v4l2_i2c_subdev_init(sd, client, &noon010_ops); in noon010_probe()
723 strlcpy(sd->name, MODULE_NAME, sizeof(sd->name)); in noon010_probe()
725 sd->internal_ops = &noon010_subdev_internal_ops; in noon010_probe()
726 sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; in noon010_probe()
737 sd->ctrl_handler = &info->hdl; in noon010_probe()
782 sd->entity.type = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR; in noon010_probe()
783 ret = media_entity_init(&sd->entity, 1, &info->pad, 0); in noon010_probe()
793 v4l2_device_unregister_subdev(sd); in noon010_probe()
799 struct v4l2_subdev *sd = i2c_get_clientdata(client); in noon010_remove() local
800 struct noon010_info *info = to_noon010(sd); in noon010_remove()
802 v4l2_device_unregister_subdev(sd); in noon010_remove()
804 media_entity_cleanup(&sd->entity); in noon010_remove()