Remove unneeded check for the platform data in s_power operation.
Do not reset the image resolution and pixel format set by user
when cycling sensor's power.
Add a small delay for a proper reset signal shape.

Signed-off-by: Sylwester Nawrocki <s.nawro...@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.p...@samsung.com>
---
 drivers/media/video/noon010pc30.c |   24 ++++++++++++------------
 1 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/media/video/noon010pc30.c 
b/drivers/media/video/noon010pc30.c
index 3e24783..d05db4b 100644
--- a/drivers/media/video/noon010pc30.c
+++ b/drivers/media/video/noon010pc30.c
@@ -297,8 +297,10 @@ static int noon010_power_ctrl(struct v4l2_subdev *sd, bool 
reset, bool sleep)
        u8 reg = sleep ? 0xF1 : 0xF0;
        int ret = 0;
 
-       if (reset)
+       if (reset) {
                ret = cam_i2c_write(sd, POWER_CTRL_REG, reg | 0x02);
+               udelay(20);
+       }
        if (!ret) {
                ret = cam_i2c_write(sd, POWER_CTRL_REG, reg);
                if (reset && !ret)
@@ -587,24 +589,20 @@ static int noon010_base_config(struct v4l2_subdev *sd)
 static int noon010_s_power(struct v4l2_subdev *sd, int on)
 {
        struct noon010_info *info = to_noon010(sd);
-       const struct noon010pc30_platform_data *pdata = info->pdata;
-       int ret = 0;
-
-       if (WARN(pdata == NULL, "No platform data!\n"))
-               return -ENOMEM;
+       int ret;
 
+       mutex_lock(&info->lock);
        if (on) {
                ret = power_enable(info);
-               if (ret)
-                       return ret;
-               ret = noon010_base_config(sd);
+               if (!ret)
+                       ret = noon010_base_config(sd);
+               if (!ret)
+                       ret = noon010_set_params(sd);
        } else {
                noon010_power_ctrl(sd, false, true);
                ret = power_disable(info);
-               info->curr_win = NULL;
-               info->curr_fmt = NULL;
        }
-
+       mutex_unlock(&info->lock);
        return ret;
 }
 
@@ -735,6 +733,8 @@ static int noon010_probe(struct i2c_client *client,
        info->i2c_reg_page      = -1;
        info->gpio_nreset       = -EINVAL;
        info->gpio_nstby        = -EINVAL;
+       info->curr_fmt          = &noon010_formats[0];
+       info->curr_win          = &noon010_sizes[0];
 
        if (gpio_is_valid(pdata->gpio_nreset)) {
                ret = gpio_request(pdata->gpio_nreset, "NOON010PC30 NRST");
-- 
1.7.5.4

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to