media: video: tegra: pass device as argument in power_on
Mallikarjun Kasoju [Fri, 12 Oct 2012 16:04:17 +0000 (21:04 +0530)]
modify power_on api to pass device as argument so that from
board files it can be used to get the regulator in place of NULL

Bug 1154495

Change-Id: I5164fa04a14ef0d405e6c9d51f42efc8e6ce14bf
Signed-off-by: Mallikarjun Kasoju <mkasoju@nvidia.com>
Reviewed-on: http://git-master/r/143748
Reviewed-by: Mrutyunjay Sawant <msawant@nvidia.com>
Tested-by: Mrutyunjay Sawant <msawant@nvidia.com>

28 files changed:
arch/arm/mach-tegra/board-cardhu-sensors.c
arch/arm/mach-tegra/board-curacao-sensors.c
arch/arm/mach-tegra/board-dalmore-sensors.c
arch/arm/mach-tegra/board-enterprise-sensors.c
arch/arm/mach-tegra/board-kai-sensors.c
arch/arm/mach-tegra/board-pluto-sensors.c
arch/arm/mach-tegra/board-ventana-sensors.c
arch/arm/mach-tegra/board-whistler-sensors.c
drivers/media/video/tegra/ar0832_main.c
drivers/media/video/tegra/imx091.c
drivers/media/video/tegra/imx132.c
drivers/media/video/tegra/ov14810.c
drivers/media/video/tegra/ov2710.c
drivers/media/video/tegra/ov5640.c
drivers/media/video/tegra/ov5650.c
drivers/media/video/tegra/ov9726.c
drivers/media/video/tegra/ov9772.c
drivers/media/video/tegra/soc380.c
include/media/ar0832_main.h
include/media/imx091.h
include/media/imx132.h
include/media/ov14810.h
include/media/ov2710.h
include/media/ov5640.h
include/media/ov5650.h
include/media/ov9726.h
include/media/ov9772.h
include/media/soc380.h

index cc6e93d..1e7b53c 100644 (file)
@@ -134,7 +134,7 @@ static int cardhu_camera_init(void)
        return 0;
 }
 
-static int cardhu_left_ov5650_power_on(void)
+static int cardhu_left_ov5650_power_on(struct device *dev)
 {
        /* Boards E1198 and E1291 are of Cardhu personality
         * and donot have TCA6416 exp for camera */
@@ -142,7 +142,8 @@ static int cardhu_left_ov5650_power_on(void)
                (board_info.board_id == BOARD_E1291)) {
 
                if (cardhu_vdd_2v8_cam1 == NULL) {
-                       cardhu_vdd_2v8_cam1 = regulator_get(NULL, "vdd_2v8_cam1");
+                       cardhu_vdd_2v8_cam1 =
+                               regulator_get(dev, "vdd_2v8_cam1");
                        if (WARN_ON(IS_ERR(cardhu_vdd_2v8_cam1))) {
                                pr_err("%s: couldn't get regulator vdd_2v8_cam1: %ld\n",
                                        __func__, PTR_ERR(cardhu_vdd_2v8_cam1));
@@ -155,7 +156,7 @@ static int cardhu_left_ov5650_power_on(void)
 
        /* Enable VDD_1V8_Cam1 */
        if (cardhu_1v8_cam1 == NULL) {
-               cardhu_1v8_cam1 = regulator_get(NULL, "vdd_1v8_cam1");
+               cardhu_1v8_cam1 = regulator_get(dev, "vdd_1v8_cam1");
                if (WARN_ON(IS_ERR(cardhu_1v8_cam1))) {
                        pr_err("%s: couldn't get regulator vdd_1v8_cam1: %ld\n",
                                __func__, PTR_ERR(cardhu_1v8_cam1));
@@ -196,7 +197,7 @@ reg_alloc_fail:
 
 }
 
-static int cardhu_left_ov5650_power_off(void)
+static int cardhu_left_ov5650_power_off(struct device *dev)
 {
        /* Boards E1198 and E1291 are of Cardhu personality
         * and donot have TCA6416 exp for camera */
@@ -276,7 +277,7 @@ static struct i2c_board_info cardhu_i2c_board_info_e1214[] = {
 #endif
 
 #ifdef CONFIG_VIDEO_IMX091
-static int cardhu_imx091_power_on(void)
+static int cardhu_imx091_power_on(struct device *dev)
 {
        /* Boards E1198 and E1291 are of Cardhu personality
        * and donot have TCA6416 exp for camera */
@@ -284,7 +285,8 @@ static int cardhu_imx091_power_on(void)
                (board_info.board_id == BOARD_E1291)) {
 
                        if (cardhu_vdd_2v8_cam1 == NULL) {
-                               cardhu_vdd_2v8_cam1 = regulator_get(NULL, "vdd_2v8_cam1");
+                               cardhu_vdd_2v8_cam1 =
+                                       regulator_get(dev, "vdd_2v8_cam1");
                                if (WARN_ON(IS_ERR(cardhu_vdd_2v8_cam1))) {
                                        pr_err("%s: couldn't get regulator vdd_2v8_cam1: %ld\n",
                                                        __func__, PTR_ERR(cardhu_vdd_2v8_cam1));
@@ -297,7 +299,7 @@ static int cardhu_imx091_power_on(void)
 
        /* Enable VDD_1V8_Cam1 */
        if (cardhu_1v8_cam1 == NULL) {
-                       cardhu_1v8_cam1 = regulator_get(NULL, "vdd_1v8_cam1");
+                       cardhu_1v8_cam1 = regulator_get(dev, "vdd_1v8_cam1");
                        if (WARN_ON(IS_ERR(cardhu_1v8_cam1))) {
                                        pr_err("%s: couldn't get regulator vdd_1v8_cam1: %ld\n",
                                                        __func__, PTR_ERR(cardhu_1v8_cam1));
@@ -360,7 +362,7 @@ static struct i2c_board_info cardhu_i2c_board_info_e1244[] = {
 
 
 
-static int cardhu_right_ov5650_power_on(void)
+static int cardhu_right_ov5650_power_on(struct device *dev)
 {
        /* CSI-B and front sensor are muxed on cardhu */
        gpio_direction_output(CAMERA_CSI_MUX_SEL_GPIO, 0);
@@ -375,7 +377,8 @@ static int cardhu_right_ov5650_power_on(void)
                mdelay(10);
 
                if (cardhu_vdd_2v8_cam2 == NULL) {
-                       cardhu_vdd_2v8_cam2 = regulator_get(NULL, "vdd_2v8_cam2");
+                       cardhu_vdd_2v8_cam2 =
+                               regulator_get(dev, "vdd_2v8_cam2");
                        if (WARN_ON(IS_ERR(cardhu_vdd_2v8_cam2))) {
                                pr_err("%s: couldn't get regulator vdd_2v8_cam2: %ld\n",
                                        __func__, PTR_ERR(cardhu_vdd_2v8_cam2));
@@ -388,7 +391,7 @@ static int cardhu_right_ov5650_power_on(void)
 
        /* Enable VDD_1V8_Cam2 */
        if (cardhu_1v8_cam2 == NULL) {
-               cardhu_1v8_cam2 = regulator_get(NULL, "vdd_1v8_cam2");
+               cardhu_1v8_cam2 = regulator_get(dev, "vdd_1v8_cam2");
                if (WARN_ON(IS_ERR(cardhu_1v8_cam2))) {
                        pr_err("%s: couldn't get regulator vdd_1v8_cam2: %ld\n",
                                __func__, PTR_ERR(cardhu_1v8_cam2));
@@ -421,7 +424,7 @@ reg_alloc_fail:
 
 }
 
-static int cardhu_right_ov5650_power_off(void)
+static int cardhu_right_ov5650_power_off(struct device *dev)
 {
        /* CSI-B and front sensor are muxed on cardhu */
        gpio_direction_output(CAMERA_CSI_MUX_SEL_GPIO, 0);
@@ -469,14 +472,14 @@ struct ov5650_platform_data cardhu_right_ov5650_data = {
        .synchronize_sensors = cardhu_ov5650_synchronize_sensors,
 };
 
-static int cardhu_ov2710_power_on(void)
+static int cardhu_ov2710_power_on(struct device *dev)
 {
        /* CSI-B and front sensor are muxed on cardhu */
        gpio_direction_output(CAMERA_CSI_MUX_SEL_GPIO, 1);
 
        /* Enable VDD_1V8_Cam3 */
        if (cardhu_1v8_cam3 == NULL) {
-               cardhu_1v8_cam3 = regulator_get(NULL, "vdd_1v8_cam3");
+               cardhu_1v8_cam3 = regulator_get(dev, "vdd_1v8_cam3");
                if (WARN_ON(IS_ERR(cardhu_1v8_cam3))) {
                        pr_err("%s: couldn't get regulator vdd_1v8_cam3: %ld\n",
                                __func__, PTR_ERR(cardhu_1v8_cam3));
@@ -490,7 +493,7 @@ static int cardhu_ov2710_power_on(void)
        if ((board_info.board_id == BOARD_E1198) ||
                (board_info.board_id == BOARD_E1291)) {
                if (cardhu_vdd_cam3 == NULL) {
-                       cardhu_vdd_cam3 = regulator_get(NULL, "vdd_cam3");
+                       cardhu_vdd_cam3 = regulator_get(dev, "vdd_cam3");
                        if (WARN_ON(IS_ERR(cardhu_vdd_cam3))) {
                                pr_err("%s: couldn't get regulator vdd_cam3: %ld\n",
                                        __func__, PTR_ERR(cardhu_vdd_cam3));
@@ -525,7 +528,7 @@ reg_alloc_fail:
        return -ENODEV;
 }
 
-static int cardhu_ov2710_power_off(void)
+static int cardhu_ov2710_power_off(struct device *dev)
 {
        /* CSI-B and front sensor are muxed on cardhu */
        gpio_direction_output(CAMERA_CSI_MUX_SEL_GPIO, 1);
@@ -552,7 +555,7 @@ struct ov2710_platform_data cardhu_ov2710_data = {
        .power_off = cardhu_ov2710_power_off,
 };
 
-static int cardhu_ov5640_power_on(void)
+static int cardhu_ov5640_power_on(struct device *dev)
 {
        /* CSI-B and front sensor are muxed on cardhu */
        gpio_direction_output(CAMERA_CSI_MUX_SEL_GPIO, 1);
@@ -568,7 +571,7 @@ static int cardhu_ov5640_power_on(void)
                mdelay(10);
 
                if (cardhu_vdd_cam3 == NULL) {
-                       cardhu_vdd_cam3 = regulator_get(NULL, "vdd_cam3");
+                       cardhu_vdd_cam3 = regulator_get(dev, "vdd_cam3");
                        if (WARN_ON(IS_ERR(cardhu_vdd_cam3))) {
                                pr_err("%s: couldn't get regulator vdd_cam3: %ld\n",
                                        __func__, PTR_ERR(cardhu_vdd_cam3));
@@ -580,7 +583,7 @@ static int cardhu_ov5640_power_on(void)
 
        /* Enable VDD_1V8_Cam3 */
        if (cardhu_1v8_cam3 == NULL) {
-               cardhu_1v8_cam3 = regulator_get(NULL, "vdd_1v8_cam3");
+               cardhu_1v8_cam3 = regulator_get(dev, "vdd_1v8_cam3");
                if (WARN_ON(IS_ERR(cardhu_1v8_cam3))) {
                        pr_err("%s: couldn't get regulator vdd_1v8_cam3: %ld\n",
                                __func__, PTR_ERR(cardhu_1v8_cam3));
@@ -605,7 +608,7 @@ reg_alloc_fail:
        return -ENODEV;
 }
 
-static int cardhu_ov5640_power_off(void)
+static int cardhu_ov5640_power_off(struct device *dev)
 {
        /* CSI-B and front sensor are muxed on cardhu */
        gpio_direction_output(CAMERA_CSI_MUX_SEL_GPIO, 1);
index acc8aad..b34a776 100644 (file)
@@ -52,12 +52,12 @@ static int curacao_camera_init(void)
        return 0;
 }
 
-static int curacao_left_ov5650_power_on(void)
+static int curacao_left_ov5650_power_on(struct device *dev)
 {
        return 0;
 }
 
-static int curacao_left_ov5650_power_off(void)
+static int curacao_left_ov5650_power_off(struct device *dev)
 {
        return 0;
 }
@@ -68,12 +68,12 @@ struct ov5650_platform_data curacao_ov5650_data = {
 };
 
 #ifdef CONFIG_VIDEO_OV14810
-static int curacao_ov14810_power_on(void)
+static int curacao_ov14810_power_on(struct device *dev)
 {
        return 0;
 }
 
-static int curacao_ov14810_power_off(void)
+static int curacao_ov14810_power_off(struct device *dev)
 {
        return 0;
 }
@@ -109,12 +109,12 @@ static struct i2c_board_info curacao_i2c_board_info_e1214[] = {
 };
 #endif
 
-static int curacao_right_ov5650_power_on(void)
+static int curacao_right_ov5650_power_on(struct device *dev)
 {
        return 0;
 }
 
-static int curacao_right_ov5650_power_off(void)
+static int curacao_right_ov5650_power_off(struct device *dev)
 {
        return 0;
 }
@@ -130,12 +130,12 @@ struct ov5650_platform_data curacao_right_ov5650_data = {
        .synchronize_sensors = curacao_ov5650_synchronize_sensors,
 };
 
-static int curacao_ov2710_power_on(void)
+static int curacao_ov2710_power_on(struct device *dev)
 {
        return 0;
 }
 
-static int curacao_ov2710_power_off(void)
+static int curacao_ov2710_power_off(struct device *dev)
 {
        return 0;
 }
index 6da7f31..3829763 100644 (file)
@@ -69,14 +69,12 @@ static char *dalmore_cam_reg_name[] = {
 
 static struct regulator *dalmore_cam_reg[ARRAY_SIZE(dalmore_cam_reg_name)];
 
-static int dalmore_imx091_power_on(void)
+static int dalmore_imx091_power_on(struct device *dev)
 {
-
        int i;
-
        for (i = 0; i < ARRAY_SIZE(dalmore_cam_reg_name); i++) {
                if (!dalmore_cam_reg[i]) {
-                       dalmore_cam_reg[i] = regulator_get(NULL,
+                       dalmore_cam_reg[i] = regulator_get(dev,
                                        dalmore_cam_reg_name[i]);
                        if (WARN_ON(IS_ERR(dalmore_cam_reg[i]))) {
                                pr_err("%s: didn't get regulator #%d: %ld\n",
@@ -108,7 +106,7 @@ reg_alloc_fail:
        return -ENODEV;
 }
 
-static int dalmore_imx091_power_off(void)
+static int dalmore_imx091_power_off(struct device *dev)
 {
        int i;
        gpio_direction_output(CAM1_POWER_DWN_GPIO, 0);
@@ -124,14 +122,12 @@ static int dalmore_imx091_power_off(void)
        return 0;
 }
 
-static int dalmore_ov9772_power_on(void)
+static int dalmore_ov9772_power_on(struct device *dev)
 {
-
        int i;
-
        for (i = 0; i < ARRAY_SIZE(dalmore_cam_reg_name); i++) {
                if (!dalmore_cam_reg[i]) {
-                       dalmore_cam_reg[i] = regulator_get(NULL,
+                       dalmore_cam_reg[i] = regulator_get(dev,
                                        dalmore_cam_reg_name[i]);
                        if (WARN_ON(IS_ERR(dalmore_cam_reg[i]))) {
                                pr_err("%s: didn't get regulator #%d: %ld\n",
@@ -163,7 +159,7 @@ reg_alloc_fail:
        return -ENODEV;
 }
 
-static int dalmore_ov9772_power_off(void)
+static int dalmore_ov9772_power_off(struct device *dev)
 {
        int i;
        gpio_direction_output(CAM1_POWER_DWN_GPIO, 0);
index 07f8c93..e6a5e11 100644 (file)
@@ -304,7 +304,7 @@ static __initdata struct tegra_clk_init_table tai_front_cam_clk_init_table[] = {
 };
 
 
-static int enterprise_cam_pwr(enum CAMERA_INDEX cam, bool pwr_on)
+static int enterprise_cam_pwr(struct device *dev, enum CAMERA_INDEX cam, bool pwr_on)
 {
        struct enterprise_power_rail *reg_cam = &ent_vicsi_pwr[cam];
        int ret = 0;
@@ -315,7 +315,7 @@ static int enterprise_cam_pwr(enum CAMERA_INDEX cam, bool pwr_on)
        */
        if (pwr_on) {
                if (reg_cam->csi_reg == NULL) {
-                       reg_cam->csi_reg = regulator_get(NULL,
+                       reg_cam->csi_reg = regulator_get(dev,
                                                "avdd_dsi_csi");
                        if (IS_ERR_OR_NULL(reg_cam->csi_reg)) {
                                pr_err("%s: csi pwr err\n", __func__);
@@ -331,7 +331,7 @@ static int enterprise_cam_pwr(enum CAMERA_INDEX cam, bool pwr_on)
                }
 
                if (reg_cam->cam_reg == NULL) {
-                       reg_cam->cam_reg = regulator_get(NULL,
+                       reg_cam->cam_reg = regulator_get(dev,
                                                "vddio_cam");
                        if (IS_ERR_OR_NULL(reg_cam->cam_reg)) {
                                pr_err("%s: vddio pwr err\n", __func__);
@@ -368,12 +368,12 @@ enterprise_cam_pwr_fail:
        return ret;
 }
 
-static int enterprise_ar0832_ri_power_on(int is_stereo)
+static int enterprise_ar0832_ri_power_on(struct device *dev, int is_stereo)
 {
        int ret = 0;
 
        pr_info("%s: ++\n", __func__);
-       ret = enterprise_cam_pwr(CAM_REAR_RIGHT, true);
+       ret = enterprise_cam_pwr(dev, CAM_REAR_RIGHT, true);
 
        /* Release Reset */
        if (is_stereo) {
@@ -392,14 +392,14 @@ static int enterprise_ar0832_ri_power_on(int is_stereo)
        return ret;
 }
 
-static int enterprise_ar0832_le_power_on(int is_stereo)
+static int enterprise_ar0832_le_power_on(struct device *dev, int is_stereo)
 {
        int ret = 0;
 
        pr_info("%s: ++\n", __func__);
 
        if (board_info.board_id != BOARD_E1239) {
-               ret = enterprise_cam_pwr(CAM_REAR_LEFT, true);
+               ret = enterprise_cam_pwr(dev, CAM_REAR_LEFT, true);
                /* Release Reset */
                gpio_set_value(CAM2_RST_L_GPIO, 1);
        }
@@ -418,12 +418,12 @@ static int enterprise_ar0832_le_power_on(int is_stereo)
        return ret;
 }
 
-static int enterprise_ar0832_ri_power_off(int is_stereo)
+static int enterprise_ar0832_ri_power_off(struct device *dev, int is_stereo)
 {
        int ret;
 
        pr_info("%s: ++\n", __func__);
-       ret = enterprise_cam_pwr(CAM_REAR_RIGHT, false);
+       ret = enterprise_cam_pwr(dev, CAM_REAR_RIGHT, false);
 
        /* Assert Reset */
        if (is_stereo) {
@@ -436,13 +436,13 @@ static int enterprise_ar0832_ri_power_off(int is_stereo)
        return ret;
 }
 
-static int enterprise_ar0832_le_power_off(int is_stereo)
+static int enterprise_ar0832_le_power_off(struct device *dev, int is_stereo)
 {
        int ret = 0;
 
        if (board_info.board_id != BOARD_E1239) {
                pr_info("%s: ++\n", __func__);
-               ret = enterprise_cam_pwr(CAM_REAR_LEFT, false);
+               ret = enterprise_cam_pwr(dev, CAM_REAR_LEFT, false);
 
                /* Assert Reset */
                gpio_set_value(CAM2_RST_L_GPIO, 0);
@@ -450,7 +450,7 @@ static int enterprise_ar0832_le_power_off(int is_stereo)
        return ret;
 }
 
-static int enterprise_ov9726_power_on(void)
+static int enterprise_ov9726_power_on(struct device *dev)
 {
        pr_info("ov9726 power on\n");
 
@@ -458,7 +458,7 @@ static int enterprise_ov9726_power_on(void)
                /* switch mipi mux to front camera */
                gpio_set_value(CAM_CSI_MUX_SEL_GPIO, CAM_CSI_MUX_SEL_FRONT);
        }
-       enterprise_cam_pwr(CAM_FRONT, true);
+       enterprise_cam_pwr(dev, CAM_FRONT, true);
 
        if (board_info.board_id == BOARD_E1239)
                clk_enable(tegra_get_clock_by_name("clk_out_3"));
@@ -466,11 +466,11 @@ static int enterprise_ov9726_power_on(void)
        return 0;
 }
 
-static int enterprise_ov9726_power_off(void)
+static int enterprise_ov9726_power_off(struct device *dev)
 {
        pr_info("ov9726 power off\n");
 
-       enterprise_cam_pwr(CAM_FRONT, false);
+       enterprise_cam_pwr(dev, CAM_FRONT, false);
 
        if (board_info.board_id == BOARD_E1239)
                clk_disable(tegra_get_clock_by_name("clk_out_3"));
index 9b7250f..796b815 100644 (file)
@@ -165,10 +165,10 @@ static int kai_camera_init(void)
        return 0;
 }
 
-static int kai_ov2710_power_on(void)
+static int kai_ov2710_power_on(struct device *dev)
 {
        if (kai_1v8_cam3 == NULL) {
-               kai_1v8_cam3 = regulator_get(NULL, "vdd_1v8_cam3");
+               kai_1v8_cam3 = regulator_get(dev, "vdd_1v8_cam3");
                if (WARN_ON(IS_ERR(kai_1v8_cam3))) {
                        pr_err("%s: couldn't get regulator vdd_1v8_cam3: %d\n",
                                __func__, (int)PTR_ERR(kai_1v8_cam3));
@@ -178,7 +178,7 @@ static int kai_ov2710_power_on(void)
        regulator_enable(kai_1v8_cam3);
 
        if (kai_vdd_cam3 == NULL) {
-               kai_vdd_cam3 = regulator_get(NULL, "vdd_cam3");
+               kai_vdd_cam3 = regulator_get(dev, "vdd_cam3");
                if (WARN_ON(IS_ERR(kai_vdd_cam3))) {
                        pr_err("%s: couldn't get regulator vdd_cam3: %d\n",
                                __func__, (int)PTR_ERR(kai_vdd_cam3));
@@ -206,7 +206,7 @@ reg_get_vdd_1v8_cam3_fail:
        return -ENODEV;
 }
 
-static int kai_ov2710_power_off(void)
+static int kai_ov2710_power_off(struct device *dev)
 {
        gpio_direction_output(CAM2_RST_GPIO, 0);
 
index 6915998..ce3b031 100644 (file)
@@ -52,13 +52,13 @@ static char *pluto_cam_reg_name[] = {
 
 static struct regulator *pluto_cam_reg[ARRAY_SIZE(pluto_cam_reg_name)];
 
-static int pluto_imx091_power_on(void)
+static int pluto_imx091_power_on(struct device *dev)
 {
        int i;
 
        for (i = 0; i < ARRAY_SIZE(pluto_cam_reg_name); i++) {
                if (!pluto_cam_reg[i]) {
-                       pluto_cam_reg[i] = regulator_get(NULL,
+                       pluto_cam_reg[i] = regulator_get(dev,
                                        pluto_cam_reg_name[i]);
                        if (WARN_ON(IS_ERR(pluto_cam_reg[i]))) {
                                pr_err("%s: didn't get regulator #%d: %ld\n",
@@ -90,7 +90,7 @@ reg_alloc_fail:
        return -ENODEV;
 }
 
-static int pluto_imx091_power_off(void)
+static int pluto_imx091_power_off(struct device *dev)
 {
        int i;
 
@@ -105,13 +105,13 @@ static int pluto_imx091_power_off(void)
        return 0;
 }
 
-static int pluto_imx132_power_on(void)
+static int pluto_imx132_power_on(struct device *dev)
 {
        int i;
 
        for (i = 0; i < ARRAY_SIZE(pluto_cam_reg_name); i++) {
                if (!pluto_cam_reg[i]) {
-                       pluto_cam_reg[i] = regulator_get(NULL,
+                       pluto_cam_reg[i] = regulator_get(dev,
                                        pluto_cam_reg_name[i]);
                        if (WARN_ON(IS_ERR(pluto_cam_reg[i]))) {
                                pr_err("%s: didn't get regulator #%d: %ld\n",
@@ -142,7 +142,7 @@ reg_alloc_fail:
 }
 
 
-static int pluto_imx132_power_off(void)
+static int pluto_imx132_power_off(struct device *dev)
 {
        int i;
 
index 05f8c50..354082e 100644 (file)
@@ -58,7 +58,7 @@
 static struct regulator *cam1_2v8, *cam2_2v8;
 
 /* left ov5650 is CAM2 which is on csi_a */
-static int ventana_left_ov5650_power_on(void)
+static int ventana_left_ov5650_power_on(struct device *dev)
 {
        gpio_direction_output(CAMERA_CSI_MUX_SEL_GPIO, 0);
        gpio_direction_output(AVDD_DSI_CSI_ENB_GPIO, 1);
@@ -73,7 +73,7 @@ static int ventana_left_ov5650_power_on(void)
        return 0;
 }
 
-static int ventana_left_ov5650_power_off(void)
+static int ventana_left_ov5650_power_off(struct device *dev)
 {
        gpio_direction_output(AVDD_DSI_CSI_ENB_GPIO, 0);
        gpio_direction_output(CAM2_RST_L_GPIO, 0);
@@ -88,7 +88,7 @@ struct ov5650_platform_data ventana_left_ov5650_data = {
 };
 
 /* right ov5650 is CAM1 which is on csi_b */
-static int ventana_right_ov5650_power_on(void)
+static int ventana_right_ov5650_power_on(struct device *dev)
 {
        gpio_direction_output(AVDD_DSI_CSI_ENB_GPIO, 1);
        regulator_enable(cam1_2v8);
@@ -102,7 +102,7 @@ static int ventana_right_ov5650_power_on(void)
        return 0;
 }
 
-static int ventana_right_ov5650_power_off(void)
+static int ventana_right_ov5650_power_off(struct device *dev)
 {
        gpio_direction_output(AVDD_DSI_CSI_ENB_GPIO, 0);
        gpio_direction_output(CAM1_RST_L_GPIO, 0);
@@ -116,7 +116,7 @@ struct ov5650_platform_data ventana_right_ov5650_data = {
        .power_off = ventana_right_ov5650_power_off,
 };
 
-static int ventana_ov2710_power_on(void)
+static int ventana_ov2710_power_on(struct device *dev)
 {
        gpio_direction_output(CAMERA_CSI_MUX_SEL_GPIO, 1);
        gpio_direction_output(AVDD_DSI_CSI_ENB_GPIO, 1);
@@ -130,7 +130,7 @@ static int ventana_ov2710_power_on(void)
        return 0;
 }
 
-static int ventana_ov2710_power_off(void)
+static int ventana_ov2710_power_off(struct device *dev)
 {
        gpio_direction_output(CAM3_RST_L_GPIO, 0);
        gpio_direction_output(CAM3_PWR_DN_GPIO, 1);
@@ -659,9 +659,9 @@ int __init ventana_camera_late_init(void)
 
        i2c_new_device(i2c_get_adapter(3), ventana_i2c3_board_info_pca9546);
 
-       ventana_ov2710_power_off();
-       ventana_left_ov5650_power_off();
-       ventana_right_ov5650_power_off();
+       ventana_ov2710_power_off(NULL);
+       ventana_left_ov5650_power_off(NULL);
+       ventana_right_ov5650_power_off(NULL);
 
        ret = regulator_disable(cam_ldo6);
        if (ret){
index 418976f..33c8e05 100644 (file)
@@ -104,12 +104,12 @@ static int whistler_camera_init(void)
        return 0;
 }
 
-static int whistler_ov5650_power_on(void)
+static int whistler_ov5650_power_on(struct device *dev)
 {
        gpio_set_value(CAMERA1_PWDN_GPIO, 0);
 
        if (!reg_avdd_cam1) {
-               reg_avdd_cam1 = regulator_get(NULL, "vdd_cam1");
+               reg_avdd_cam1 = regulator_get(dev, "vdd_cam1");
                if (IS_ERR_OR_NULL(reg_avdd_cam1)) {
                        pr_err("whistler_ov5650_power_on: vdd_cam1 failed\n");
                        reg_avdd_cam1 = NULL;
@@ -120,7 +120,7 @@ static int whistler_ov5650_power_on(void)
        mdelay(5);
 
        if (!reg_vdd_mipi) {
-               reg_vdd_mipi = regulator_get(NULL, "vddio_mipi");
+               reg_vdd_mipi = regulator_get(dev, "vddio_mipi");
                if (IS_ERR_OR_NULL(reg_vdd_mipi)) {
                        pr_err("whistler_ov5650_power_on: vddio_mipi failed\n");
                        reg_vdd_mipi = NULL;
@@ -131,7 +131,7 @@ static int whistler_ov5650_power_on(void)
        mdelay(5);
 
        if (!reg_vdd_af) {
-               reg_vdd_af = regulator_get(NULL, "vdd_vcore_af");
+               reg_vdd_af = regulator_get(dev, "vdd_vcore_af");
                if (IS_ERR_OR_NULL(reg_vdd_af)) {
                        pr_err("whistler_ov5650_power_on: vdd_vcore_af failed\n");
                        reg_vdd_af = NULL;
@@ -152,7 +152,7 @@ static int whistler_ov5650_power_on(void)
        return 0;
 }
 
-static int whistler_ov5650_power_off(void)
+static int whistler_ov5650_power_off(struct device *dev)
 {
        gpio_set_value(CAMERA_AF_PD_GPIO, 0);
        gpio_set_value(CAMERA1_PWDN_GPIO, 1);
@@ -179,12 +179,12 @@ static int whistler_ov5650_power_off(void)
        return 0;
 }
 
-static int whistler_soc380_power_on(void)
+static int whistler_soc380_power_on(struct device *dev)
 {
        gpio_set_value(CAMERA2_PWDN_GPIO, 0);
 
        if (!reg_vddio_vi) {
-               reg_vddio_vi = regulator_get(NULL, "vddio_vi");
+               reg_vddio_vi = regulator_get(dev, "vddio_vi");
                if (IS_ERR_OR_NULL(reg_vddio_vi)) {
                        pr_err("whistler_soc380_power_on: vddio_vi failed\n");
                        reg_vddio_vi = NULL;
@@ -196,7 +196,7 @@ static int whistler_soc380_power_on(void)
        }
 
        if (!reg_avdd_cam1) {
-               reg_avdd_cam1 = regulator_get(NULL, "vdd_cam1");
+               reg_avdd_cam1 = regulator_get(dev, "vdd_cam1");
                if (IS_ERR_OR_NULL(reg_avdd_cam1)) {
                        pr_err("whistler_soc380_power_on: vdd_cam1 failed\n");
                        reg_avdd_cam1 = NULL;
@@ -217,7 +217,7 @@ static int whistler_soc380_power_on(void)
 
 }
 
-static int whistler_soc380_power_off(void)
+static int whistler_soc380_power_off(struct device *dev)
 {
        gpio_set_value(CAMERA2_PWDN_GPIO, 1);
        gpio_set_value(CAMERA2_RESET_GPIO, 0);
index f1e10e2..759fdb7 100644 (file)
@@ -1884,7 +1884,7 @@ static int ar0832_power_on(struct ar0832_dev *dev)
                                goto fail_regulator_2v8_reg;
                        }
                }
-               dev->pdata->power_on(dev->is_stereo);
+               dev->pdata->power_on(&i2c_client->dev, dev->is_stereo);
        }
        dev->brd_power_cnt++;
 
@@ -1923,7 +1923,7 @@ static void ar0832_power_off(struct ar0832_dev *dev)
                        regulator_disable(dev->power_rail.sen_2v8_reg);
                if (dev->power_rail.sen_1v8_reg)
                        regulator_disable(dev->power_rail.sen_1v8_reg);
-               dev->pdata->power_off(dev->is_stereo);
+               dev->pdata->power_off(&i2c_client->dev, dev->is_stereo);
        }
 
 ar0832_pwdn_exit:
index e9ec730..da67bb1 100644 (file)
@@ -1262,7 +1262,7 @@ imx091_open(struct inode *inode, struct file *file)
        file->private_data = info;
 
        if (info->pdata && info->pdata->power_on)
-               info->pdata->power_on();
+               info->pdata->power_on(&info->i2c_client->dev);
        else{
                pr_err("[IMX091]:%s:no valid power_on function.\n", __func__);
                return -EEXIST;
@@ -1275,7 +1275,7 @@ static int
 imx091_release(struct inode *inode, struct file *file)
 {
        if (info->pdata && info->pdata->power_off)
-               info->pdata->power_off();
+               info->pdata->power_off(&info->i2c_client->dev);
        file->private_data = NULL;
 
        /* warn if device is already released */
index d54426c..f0b521c 100644 (file)
@@ -600,7 +600,7 @@ imx132_open(struct inode *inode, struct file *file)
        file->private_data = info;
 
        if (info->pdata && info->pdata->power_on)
-               info->pdata->power_on();
+               info->pdata->power_on(&info->i2c_client->dev);
        else {
                pr_err("[imx132]:%s:no valid power_on function.\n", __func__);
                return -EEXIST;
@@ -613,7 +613,7 @@ static int
 imx132_release(struct inode *inode, struct file *file)
 {
        if (info->pdata && info->pdata->power_off)
-               info->pdata->power_off();
+               info->pdata->power_off(&info->i2c_client->dev);
        file->private_data = NULL;
 
        /* warn if device is already released */
index 76f5638..626fe42 100644 (file)
@@ -1078,11 +1078,11 @@ static int ov14810_set_power(int powerLevel)
 
        if (info->sensor.pdata) {
                if (powerLevel && info->sensor.pdata->power_on) {
-                       info->sensor.pdata->power_on();
+                       info->sensor.pdata->power_on(&info->sensor.i2c_client->dev);
                        msleep(1000);
                }
                else if (info->sensor.pdata->power_off) {
-                       info->sensor.pdata->power_off();
+                       info->sensor.pdata->power_off(&info->sensor.i2c_client->dev);
                }
        }
 
index df53160..a0ad166 100644 (file)
@@ -680,7 +680,7 @@ static int ov2710_open(struct inode *inode, struct file *file)
 
        file->private_data = info;
        if (info->pdata && info->pdata->power_on)
-               info->pdata->power_on();
+               info->pdata->power_on(&info->i2c_client->dev);
        ov2710_get_status(info, &status);
        return 0;
 }
@@ -688,7 +688,7 @@ static int ov2710_open(struct inode *inode, struct file *file)
 int ov2710_release(struct inode *inode, struct file *file)
 {
        if (info->pdata && info->pdata->power_off)
-               info->pdata->power_off();
+               info->pdata->power_off(&info->i2c_client->dev);
        file->private_data = NULL;
        return 0;
 }
index c3a79ef..32a84b4 100644 (file)
@@ -299,13 +299,13 @@ static int ov5640_set_power(struct ov5640_info *info, u32 level)
        case OV5640_POWER_LEVEL_OFF:
        case OV5640_POWER_LEVEL_SUS:
                if (info->pdata && info->pdata->power_off)
-                       info->pdata->power_off();
+                       info->pdata->power_off(&info->i2c_client->dev);
                info->af_fw_loaded = 0;
                info->mode = 0;
                break;
        case OV5640_POWER_LEVEL_ON:
                if (info->pdata && info->pdata->power_on)
-                       info->pdata->power_on();
+                       info->pdata->power_on(&info->i2c_client->dev);
                break;
        default:
                dev_err(info->dev, "unknown power level %d.\n", level);
index 09ad9e6..f545317 100644 (file)
@@ -1254,18 +1254,18 @@ static int ov5650_test_pattern(struct ov5650_info *info,
 }
 
 static int set_power_helper(struct ov5650_platform_data *pdata,
-                               int powerLevel, int *ref_cnt)
+                       struct device *dev, int powerLevel, int *ref_cnt)
 {
        if (pdata) {
                if (powerLevel && pdata->power_on) {
                        if (*ref_cnt == 0)
-                               pdata->power_on();
+                               pdata->power_on(dev);
                        *ref_cnt = *ref_cnt + 1;
                }
                else if (pdata->power_off) {
                        *ref_cnt = *ref_cnt - 1;
                        if (*ref_cnt <= 0)
-                               pdata->power_off();
+                               pdata->power_off(dev);
                }
        }
        return 0;
@@ -1278,15 +1278,15 @@ static int ov5650_set_power(struct ov5650_info *info, int powerLevel)
 
        if (StereoCameraMode_Left & info->camera_mode) {
                mutex_lock(&info->mutex_le);
-               set_power_helper(info->left.pdata, powerLevel,
-                       &info->power_refcnt_le);
+               set_power_helper(info->left.pdata, &info->left.i2c_client->dev,
+                       powerLevel, &info->power_refcnt_le);
                mutex_unlock(&info->mutex_le);
        }
 
        if (StereoCameraMode_Right & info->camera_mode) {
                mutex_lock(&info->mutex_ri);
-               set_power_helper(info->right.pdata, powerLevel,
-                       &info->power_refcnt_ri);
+               set_power_helper(info->right.pdata, &info->right.i2c_client->dev,
+                       powerLevel, &info->power_refcnt_ri);
                mutex_unlock(&info->mutex_ri);
        }
 
index 52b3b07..129591b 100644 (file)
@@ -337,7 +337,7 @@ ov9726_power(struct ov9726_devinfo *dev, bool pwr_on)
                msleep_range(20);
 
                /* Board specific power-on sequence */
-               dev->pdata->power_on();
+               dev->pdata->power_on(&i2c_client->dev);
        } else {
                /* pull low the RST pin of ov9726 */
                gpio_set_value(dev->pdata->gpio_rst, rst_active_state);
@@ -351,7 +351,7 @@ ov9726_power(struct ov9726_devinfo *dev, bool pwr_on)
                regulator_disable(dev->power_rail.sen_1v8_reg);
 
                /* Board specific power-down sequence */
-               dev->pdata->power_off();
+               dev->pdata->power_off(&i2c_client->dev);
        }
 
        return 0;
index 76592e5..d12496a 100644 (file)
@@ -565,7 +565,7 @@ static int ov9772_open(struct inode *inode, struct file *file)
        file->private_data = info;
 
        if (info->pdata && info->pdata->power_on)
-               info->pdata->power_on();
+               info->pdata->power_on(&info->i2c_client->dev);
        else{
                pr_err("[ov9772]:%s:no valid power_on function.\n",
                       __func__);
@@ -578,7 +578,7 @@ static int ov9772_open(struct inode *inode, struct file *file)
 static int ov9772_release(struct inode *inode, struct file *file)
 {
        if (info->pdata && info->pdata->power_off)
-               info->pdata->power_off();
+               info->pdata->power_off(&info->i2c_client->dev);
        file->private_data = NULL;
 
        /* warn if device is already released */
index 8745e99..f861a44 100644 (file)
@@ -378,7 +378,7 @@ static int soc380_open(struct inode *inode, struct file *file)
 
        file->private_data = info;
        if (info->pdata && info->pdata->power_on)
-               info->pdata->power_on();
+               info->pdata->power_on(&info->i2c_client->dev);
 
        dev_status.data = 0;
        dev_status.status = 0;
@@ -389,7 +389,7 @@ static int soc380_open(struct inode *inode, struct file *file)
 int soc380_release(struct inode *inode, struct file *file)
 {
        if (info->pdata && info->pdata->power_off)
-               info->pdata->power_off();
+               info->pdata->power_off(&info->i2c_client->dev);
        file->private_data = NULL;
        return 0;
 }
index fe46c22..3cc1afc 100644 (file)
@@ -90,8 +90,8 @@ struct ar0832_stereo_region {
 
 #ifdef __KERNEL__
 struct ar0832_platform_data {
-       int (*power_on)(int is_stereo);
-       int (*power_off)(int is_stereo);
+       int (*power_on)(struct device *, int is_stereo);
+       int (*power_off)(struct device *, int is_stereo);
        char *id;
 };
 #endif /* __KERNEL__ */
index b50fc63..1e38dbc 100644 (file)
@@ -45,8 +45,8 @@ struct imx091_sensordata {
 
 #ifdef __KERNEL__
 struct imx091_platform_data {
-       int (*power_on)(void);
-       int (*power_off)(void);
+       int (*power_on)(struct device *);
+       int (*power_off)(struct device *);
 };
 #endif /* __KERNEL__ */
 
index 76354cf..0c64a80 100644 (file)
@@ -56,8 +56,8 @@ struct imx132_sensordata {
 
 #ifdef __KERNEL__
 struct imx132_platform_data {
-       int (*power_on)(void);
-       int (*power_off)(void);
+       int (*power_on)(struct device *);
+       int (*power_off)(struct device *);
 };
 #endif /* __KERNEL__ */
 
index 67a8649..c9d6e81 100644 (file)
@@ -38,8 +38,8 @@ struct ov14810_mode {
 };
 #ifdef __KERNEL__
 struct ov14810_platform_data {
-       int (*power_on)(void);
-       int (*power_off)(void);
+       int (*power_on)(struct device *);
+       int (*power_off)(struct device *);
        void (*synchronize_sensors)(void);
 };
 #endif /* __KERNEL__ */
index aeeaea8..a3e070b 100644 (file)
@@ -48,8 +48,8 @@ struct ov2710_ae {
 
 #ifdef __KERNEL__
 struct ov2710_platform_data {
-       int (*power_on)(void);
-       int (*power_off)(void);
+       int (*power_on)(struct device *);
+       int (*power_off)(struct device *);
 
 };
 #endif /* __KERNEL__ */
index dffe1a3..da6be4d 100644 (file)
@@ -64,8 +64,8 @@ enum {
 
 #ifdef __KERNEL__
 struct ov5640_platform_data {
-       int (*power_on)(void);
-       int (*power_off)(void);
+       int (*power_on)(struct device *);
+       int (*power_off)(struct device *);
 
 };
 #endif /* __KERNEL__ */
index a8f70a5..f1f2f67 100644 (file)
@@ -89,8 +89,8 @@ struct ov5650_ae {
 
 #ifdef __KERNEL__
 struct ov5650_platform_data {
-       int (*power_on)(void);
-       int (*power_off)(void);
+       int (*power_on)(struct device *);
+       int (*power_off)(struct device *);
        void (*synchronize_sensors)(void);
 };
 #endif /* __KERNEL__ */
index fb9995b..e942000 100644 (file)
@@ -59,8 +59,8 @@ struct ov9726_reg {
 #define OV9726_TABLE_END               1
 
 struct ov9726_platform_data {
-       int     (*power_on)(void);
-       int     (*power_off)(void);
+       int     (*power_on)(struct device *);
+       int     (*power_off)(struct device *);
        unsigned    gpio_rst;
        bool        rst_low_active;
        unsigned    gpio_pwdn;
index 40baead..2f49ac5 100644 (file)
@@ -53,8 +53,8 @@ struct ov9772_sensordata {
 #define OV9772_REG_GAIN_LO                     0x205
 
 struct ov9772_platform_data {
-       int     (*power_on)(void);
-       int     (*power_off)(void);
+       int     (*power_on)(struct device *);
+       int     (*power_off)(struct device *);
 };
 #endif /* __KERNEL__ */
 
index 254625f..e732cc0 100644 (file)
@@ -49,8 +49,8 @@ struct soc380_status {
 
 #ifdef __KERNEL__
 struct soc380_platform_data {
-       int (*power_on)(void);
-       int (*power_off)(void);
+       int (*power_on)(struct device *);
+       int (*power_off)(struct device *);
 
 };
 #endif /* __KERNEL__ */