Permalink
Browse files

S5PC11X: CAMERA: move lens to default position when preview starts

After taking a picture, the focus is maintained.
So if user change from camera mode to video mode after taking
a picture very closely to object,
focus in video mode is not normal.
So move lens to default position when preview starts.
But if latest focus mode is MACRO, the focus should be maintained
as MACRO default after taking a picture.

Change-Id: Ice86ffd9b5932635ba0b4861bc2168559aaafe76
Signed-off-by: kyoungho.yun <kyoungho.yun@samsung.com>
  • Loading branch information...
1 parent 5b5fda5 commit 32b63bf4d7d3701ae495fce814e8256bc0979279 kyoungho.yun committed with Simon Wilson Dec 7, 2010
Showing with 37 additions and 0 deletions.
  1. +36 −0 drivers/media/video/s5k4ecgx.c
  2. +1 −0 include/linux/videodev2_samsung.h
View
36 drivers/media/video/s5k4ecgx.c 100644 → 100755
@@ -1098,6 +1098,38 @@ static int s5k4ecgx_set_face_detection(struct v4l2_subdev *sd, int value)
&state->regs->face_detection_off, 1, 0);
}
+static int s5k4ecgx_return_focus(struct v4l2_subdev *sd)
+{
+ int err;
+ struct i2c_client *client = v4l2_get_subdevdata(sd);
+ struct s5k4ecgx_state *state =
+ container_of(sd, struct s5k4ecgx_state, sd);
+
+ err = s5k4ecgx_set_from_table(sd,
+ "af normal mode 1",
+ &state->regs->af_normal_mode_1, 1, 0);
+ if (err < 0)
+ goto fail;
+ msleep(FIRST_SETTING_FOCUS_MODE_DELAY_MS);
+ err = s5k4ecgx_set_from_table(sd,
+ "af normal mode 2",
+ &state->regs->af_normal_mode_2, 1, 0);
+ if (err < 0)
+ goto fail;
+ msleep(SECOND_SETTING_FOCUS_MODE_DELAY_MS);
+ err = s5k4ecgx_set_from_table(sd,
+ "af normal mode 3",
+ &state->regs->af_normal_mode_3, 1, 0);
+ if (err < 0)
+ goto fail;
+
+ return 0;
+fail:
+ dev_err(&client->dev,
+ "%s: i2c_write failed\n", __func__);
+ return -EIO;
+}
+
static int s5k4ecgx_set_focus_mode(struct v4l2_subdev *sd, int value)
{
struct i2c_client *client = v4l2_get_subdevdata(sd);
@@ -2331,6 +2363,10 @@ static int s5k4ecgx_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
case V4L2_CID_CAMERA_CHECK_DATALINE_STOP:
err = s5k4ecgx_check_dataline_stop(sd);
break;
+ case V4L2_CID_CAMERA_RETURN_FOCUS:
+ if (parms->focus_mode != FOCUS_MODE_MACRO)
+ err = s5k4ecgx_return_focus(sd);
+ break;
default:
dev_err(&client->dev, "%s: unknown set ctrl id 0x%x\n",
__func__, ctrl->id);
View
1 include/linux/videodev2_samsung.h 100644 → 100755
@@ -464,6 +464,7 @@ enum v4l2_slow_ae_mode {
#define V4L2_CID_CAMERA_SENSOR_MODE (V4L2_CID_PRIVATE_BASE + 116)
#define V4L2_CID_ESD_INT (V4L2_CID_PRIVATE_BASE + 117)
#define V4L2_CID_CAMERA_GET_FLASH_ONOFF (V4L2_CID_PRIVATE_BASE + 118)
+#define V4L2_CID_CAMERA_RETURN_FOCUS (V4L2_CID_PRIVATE_BASE + 119)
/* Pixel format FOURCC depth Description */
/* 12 Y/CbCr 4:2:0 64x32 macroblocks */

0 comments on commit 32b63bf

Please sign in to comment.