GNU Linux-libre 4.14.290-gnu1
[releases.git] / drivers / staging / media / atomisp / i2c / imx / vcm.c
1 /*
2  * Copyright (c) 2012 Intel Corporation. All Rights Reserved.
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License version
6  * 2 as published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
16  * 02110-1301, USA.
17  *
18  */
19 #include <linux/errno.h>
20 #include <linux/kernel.h>
21 #include <linux/types.h>
22 #include <media/v4l2-device.h>
23 #include "../../include/linux/atomisp_platform.h"
24
25 int vcm_power_up(struct v4l2_subdev *sd)
26 {
27         const struct camera_af_platform_data *vcm_platform_data;
28
29         vcm_platform_data = camera_get_af_platform_data();
30         if (NULL == vcm_platform_data)
31                 return -ENODEV;
32         /* Enable power */
33         return vcm_platform_data->power_ctrl(sd, 1);
34 }
35
36 int vcm_power_down(struct v4l2_subdev *sd)
37 {
38         const struct camera_af_platform_data *vcm_platform_data;
39
40         vcm_platform_data = camera_get_af_platform_data();
41         if (NULL == vcm_platform_data)
42                 return -ENODEV;
43         return vcm_platform_data->power_ctrl(sd, 0);
44 }
45