@@ -83,6 +83,9 @@ struct gmin_subdev {
83
83
bool v1p2_on ;
84
84
bool v2p8_vcm_on ;
85
85
86
+ int v1p8_gpio ;
87
+ int v2p8_gpio ;
88
+
86
89
u8 pwm_i2c_addr ;
87
90
88
91
/* For PMIC AXP */
@@ -122,24 +125,6 @@ static const struct atomisp_platform_data pdata = {
122
125
.subdevs = pdata_subdevs ,
123
126
};
124
127
125
- /*
126
- * Something of a hack. The ECS E7 board drives camera 2.8v from an
127
- * external regulator instead of the PMIC. There's a gmin_CamV2P8
128
- * config variable that specifies the GPIO to handle this particular
129
- * case, but this needs a broader architecture for handling camera
130
- * power.
131
- */
132
- enum { V2P8_GPIO_UNSET = -2 , V2P8_GPIO_NONE = -1 };
133
- static int v2p8_gpio = V2P8_GPIO_UNSET ;
134
-
135
- /*
136
- * Something of a hack. The CHT RVP board drives camera 1.8v from an
137
- * external regulator instead of the PMIC just like ECS E7 board, see the
138
- * comments above.
139
- */
140
- enum { V1P8_GPIO_UNSET = -2 , V1P8_GPIO_NONE = -1 };
141
- static int v1p8_gpio = V1P8_GPIO_UNSET ;
142
-
143
128
static LIST_HEAD (vcm_devices );
144
129
static DEFINE_MUTEX (vcm_lock );
145
130
@@ -548,6 +533,23 @@ static struct gmin_subdev *gmin_subdev_add(struct v4l2_subdev *subdev)
548
533
else
549
534
dev_info (dev , "will handle gpio1 via ACPI\n" );
550
535
536
+ /*
537
+ * Those are used only when there is an external regulator apart
538
+ * from the PMIC that would be providing power supply, like on the
539
+ * two cases below:
540
+ *
541
+ * The ECS E7 board drives camera 2.8v from an external regulator
542
+ * instead of the PMIC. There's a gmin_CamV2P8 config variable
543
+ * that specifies the GPIO to handle this particular case,
544
+ * but this needs a broader architecture for handling camera power.
545
+ *
546
+ * The CHT RVP board drives camera 1.8v from an* external regulator
547
+ * instead of the PMIC just like ECS E7 board.
548
+ */
549
+
550
+ gs -> v1p8_gpio = gmin_get_var_int (dev , true, "V1P8GPIO" , -1 );
551
+ gs -> v2p8_gpio = gmin_get_var_int (dev , true, "V2P8GPIO" , -1 );
552
+
551
553
/*
552
554
* FIXME:
553
555
*
@@ -830,26 +832,22 @@ static int gmin_v1p8_ctrl(struct v4l2_subdev *subdev, int on)
830
832
831
833
dev = & client -> dev ;
832
834
833
- if (v1p8_gpio == V1P8_GPIO_UNSET ) {
834
- v1p8_gpio = gmin_get_var_int (dev , true,
835
- "V1P8GPIO" , V1P8_GPIO_NONE );
836
- if (v1p8_gpio != V1P8_GPIO_NONE ) {
837
- pr_info ("atomisp_gmin_platform: 1.8v power on GPIO %d\n" ,
838
- v1p8_gpio );
839
- ret = gpio_request (v1p8_gpio , "camera_v1p8_en" );
840
- if (!ret )
841
- ret = gpio_direction_output (v1p8_gpio , 0 );
842
- if (ret )
843
- pr_err ("V1P8 GPIO initialization failed\n" );
844
- }
835
+ if (gs -> v1p8_gpio >= 0 ) {
836
+ pr_info ("atomisp_gmin_platform: 1.8v power on GPIO %d\n" ,
837
+ gs -> v1p8_gpio );
838
+ ret = gpio_request (gs -> v1p8_gpio , "camera_v1p8_en" );
839
+ if (!ret )
840
+ ret = gpio_direction_output (gs -> v1p8_gpio , 0 );
841
+ if (ret )
842
+ pr_err ("V1P8 GPIO initialization failed\n" );
845
843
}
846
844
847
845
if (!gs || gs -> v1p8_on == on )
848
846
return 0 ;
849
847
gs -> v1p8_on = on ;
850
848
851
- if (v1p8_gpio >= 0 )
852
- gpio_set_value (v1p8_gpio , on );
849
+ if (gs -> v1p8_gpio >= 0 )
850
+ gpio_set_value (gs -> v1p8_gpio , on );
853
851
854
852
if (gs -> v1p8_reg ) {
855
853
regulator_set_voltage (gs -> v1p8_reg , 1800000 , 1800000 );
@@ -892,26 +890,22 @@ static int gmin_v2p8_ctrl(struct v4l2_subdev *subdev, int on)
892
890
893
891
dev = & client -> dev ;
894
892
895
- if (v2p8_gpio == V2P8_GPIO_UNSET ) {
896
- v2p8_gpio = gmin_get_var_int (dev , true,
897
- "V2P8GPIO" , V2P8_GPIO_NONE );
898
- if (v2p8_gpio != V2P8_GPIO_NONE ) {
899
- pr_info ("atomisp_gmin_platform: 2.8v power on GPIO %d\n" ,
900
- v2p8_gpio );
901
- ret = gpio_request (v2p8_gpio , "camera_v2p8" );
902
- if (!ret )
903
- ret = gpio_direction_output (v2p8_gpio , 0 );
904
- if (ret )
905
- pr_err ("V2P8 GPIO initialization failed\n" );
906
- }
893
+ if (gs -> v2p8_gpio >= 0 ) {
894
+ pr_info ("atomisp_gmin_platform: 2.8v power on GPIO %d\n" ,
895
+ gs -> v2p8_gpio );
896
+ ret = gpio_request (gs -> v2p8_gpio , "camera_v2p8" );
897
+ if (!ret )
898
+ ret = gpio_direction_output (gs -> v2p8_gpio , 0 );
899
+ if (ret )
900
+ pr_err ("V2P8 GPIO initialization failed\n" );
907
901
}
908
902
909
903
if (!gs || gs -> v2p8_on == on )
910
904
return 0 ;
911
905
gs -> v2p8_on = on ;
912
906
913
- if (v2p8_gpio >= 0 )
914
- gpio_set_value (v2p8_gpio , on );
907
+ if (gs -> v2p8_gpio >= 0 )
908
+ gpio_set_value (gs -> v2p8_gpio , on );
915
909
916
910
if (gs -> v2p8_reg ) {
917
911
regulator_set_voltage (gs -> v2p8_reg , 2900000 , 2900000 );
0 commit comments