Re: [RFC v2 05/10] exynos5-fimc-is: Adds the sensor subdev

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 31 May 2013 18:33, Arun Kumar K <arun.kk@xxxxxxxxxxx> wrote:
> FIMC-IS uses certain sensors which are exclusively controlled
> from the IS firmware. This patch adds the sensor subdev for the
> fimc-is sensors.
>
> Signed-off-by: Arun Kumar K <arun.kk@xxxxxxxxxxx>
> Signed-off-by: Kilyeon Im <kilyeon.im@xxxxxxxxxxx>
> ---
>  drivers/media/platform/exynos5-is/fimc-is-sensor.c |  463 ++++++++++++++++++++
>  drivers/media/platform/exynos5-is/fimc-is-sensor.h |  168 +++++++
>  2 files changed, 631 insertions(+)
>  create mode 100644 drivers/media/platform/exynos5-is/fimc-is-sensor.c
>  create mode 100644 drivers/media/platform/exynos5-is/fimc-is-sensor.h
>
[snip]

> +static int sensor_s_stream(struct v4l2_subdev *sd, int enable)
> +{
> +       struct fimc_is_sensor *sensor = sd_to_fimc_is_sensor(sd);
> +       int ret;
> +
> +       if (enable) {
> +               pr_debug("Stream ON\n");
> +               /* Open pipeline */
> +               ret = fimc_is_pipeline_open(sensor->pipeline, sensor);
> +               if (ret < 0) {
> +                       pr_err("Pipeline already opened.\n");
> +                       return -EBUSY;

why not propogate 'ret'? Same for other instances below.

> +               }
> +
> +               /* Start IS pipeline */
> +               ret = fimc_is_pipeline_start(sensor->pipeline);
> +               if (ret < 0) {
> +                       pr_err("Pipeline start failed.\n");
> +                       return -EINVAL;
> +               }
> +       } else {
> +               pr_debug("Stream OFF\n");
> +               /* Stop IS pipeline */
> +               ret = fimc_is_pipeline_stop(sensor->pipeline);
> +               if (ret < 0) {
> +                       pr_err("Pipeline stop failed.\n");
> +                       return -EINVAL;
> +               }
> +
> +               /* Close pipeline */
> +               ret = fimc_is_pipeline_close(sensor->pipeline);
> +               if (ret < 0) {
> +                       pr_err("Pipeline close failed\n");
> +                       return -EBUSY;
> +               }
> +       }
> +
> +       return 0;
> +}
> +

[snip]

> +
> +static int fimc_is_sensor_probe(struct i2c_client *client,
> +                               const struct i2c_device_id *id)
> +{
> +       struct device *dev = &client->dev;
> +       struct fimc_is_sensor *sensor;
> +       const struct of_device_id *of_id;
> +       struct v4l2_subdev *sd;
> +       int gpio, ret;
> +       unsigned int sensor_id;
> +
> +       sensor = devm_kzalloc(dev, sizeof(*sensor), GFP_KERNEL);
> +       if (!sensor)
> +               return -ENOMEM;
> +
> +       sensor->gpio_reset = -EINVAL;
> +
> +       gpio = of_get_gpio_flags(dev->of_node, 0, NULL);
> +       if (gpio_is_valid(gpio)) {
> +               ret = gpio_request_one(gpio, GPIOF_OUT_INIT_LOW, DRIVER_NAME);
> +               if (ret < 0)
> +                       return ret;
> +       }
> +       pr_err("GPIO Request success : %d", gpio);
> +       sensor->gpio_reset = gpio;
> +
> +       of_id = of_match_node(fimc_is_sensor_of_match, dev->of_node);
> +       if (!of_id) {
> +               ret = -ENODEV;
> +               goto err_gpio;
> +       }
> +
> +       sensor->drvdata = (struct fimc_is_sensor_drv_data *) of_id->data;
> +       sensor->dev = dev;
> +
> +       /* Get FIMC-IS context */
> +       ret = sensor_parse_dt(sensor, dev->of_node);
> +       if (ret) {
> +               pr_err("Unable to obtain IS context\n");
> +               ret = -ENODEV;

Why not propagate 'ret' itself?


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




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux