Skip to contentSkip to conversation

media: atomisp: gmin: Remove GPIO driven regulator support

PATCH In review Hans de Goede 3 participants 3 messages Nov 7, 2024 – Nov 8, 2024

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: atomisp: gmin: Remove GPIO driven regulator support

The GMIN code has support for sensors using external regulators enabled by GPIOS, rather then using regulators build into the PMIC.

With the exception of the Trekstor ST70408-4 (1) tablet there are no known devices which actually use external regulators for the sensors and the code for this is using deprecated old style GPIO numbers support for which is going away.

Remove the GPIO driven regulator support so that the gmin code no longer depends on deprecated GPIO APIs.

1) The GMIN support itself is also deprecated and all sensor drivers still using it are being moved over to use ACPI + runtime-pm and the ST70408-4 shipped with Android as factory OS and thus will have broken ACPI tables for the sensors, so like other Android factory OS tablets it will need a bespoke solution anyways.

---
Bart reported this to me by an off list email, so no Closes tag

---
 .../media/atomisp/pci/atomisp_gmin_platform.c | 69 -------------------
 1 file changed, 69 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c +0 -69
index 8ec990293b48..e7923dc38f2e 100644
@@ -85,9 +85,6 @@ struct gmin_subdev {
 	bool v2p8_on;
 	bool v1p2_on;
 
-	int v1p8_gpio;
-	int v2p8_gpio;
-
 	u8 pwm_i2c_addr;
 
 	/* For PMIC AXP */
@@ -242,22 +239,6 @@ static struct gmin_cfg_var mrd7_vars[] = {
 	{},
 };
 
-static struct gmin_cfg_var ecs7_vars[] = {
-	{"INT33BE:00_CsiPort", "1"},
-	{"INT33BE:00_CsiLanes", "2"},
-	{"INT33BE:00_CsiFmt", "13"},
-	{"INT33BE:00_CsiBayer", "2"},
-	{"INT33BE:00_CamClk", "0"},
-
-	{"INT33F0:00_CsiPort", "0"},
-	{"INT33F0:00_CsiLanes", "1"},
-	{"INT33F0:00_CsiFmt", "13"},
-	{"INT33F0:00_CsiBayer", "0"},
-	{"INT33F0:00_CamClk", "1"},
-	{"gmin_V2P8GPIO", "402"},
-	{},
-};
-
 static struct gmin_cfg_var i8880_vars[] = {
 	{"XXOV2680:00_CsiPort", "1"},
 	{"XXOV2680:00_CsiLanes", "1"},
@@ -307,13 +288,6 @@ static const struct dmi_system_id gmin_vars[] = {
 		},
 		.driver_data = mrd7_vars,
 	},
-	{
-		.ident = "ST70408",
-		.matches = {
-			DMI_MATCH(DMI_BOARD_NAME, "ST70408"),
-		},
-		.driver_data = ecs7_vars,
-	},
 	{
 		.ident = "VTA0803",
 		.matches = {
@@ -531,23 +505,6 @@ static int gmin_subdev_add(struct gmin_subdev *gs)
 	else
 		dev_info(dev, "will handle gpio1 via ACPI\n");
 
-	/*
-	 * Those are used only when there is an external regulator apart
-	 * from the PMIC that would be providing power supply, like on the
-	 * two cases below:
-	 *
-	 * The ECS E7 board drives camera 2.8v from an external regulator
-	 * instead of the PMIC.  There's a gmin_CamV2P8 config variable
-	 * that specifies the GPIO to handle this particular case,
-	 * but this needs a broader architecture for handling camera power.
-	 *
-	 * The CHT RVP board drives camera 1.8v from an* external regulator
-	 * instead of the PMIC just like ECS E7 board.
-	 */
-
-	gs->v1p8_gpio = gmin_get_var_int(dev, true, "V1P8GPIO", -1);
-	gs->v2p8_gpio = gmin_get_var_int(dev, true, "V2P8GPIO", -1);
-
 	/*
 	 * FIXME:
 	 *
@@ -820,16 +777,6 @@ static int gmin_v1p8_ctrl(struct v4l2_subdev *subdev, int on)
 	if (!gs || gs->v1p8_on == on)
 		return 0;
 
-	if (gs->v1p8_gpio >= 0) {
-		pr_info("atomisp_gmin_platform: 1.8v power on GPIO %d\n",
-			gs->v1p8_gpio);
-		ret = gpio_request(gs->v1p8_gpio, "camera_v1p8_en");
-		if (!ret)
-			ret = gpio_direction_output(gs->v1p8_gpio, 0);
-		if (ret)
-			pr_err("V1P8 GPIO initialization failed\n");
-	}
-
 	gs->v1p8_on = on;
 
 	ret = 0;
@@ -844,9 +791,6 @@ static int gmin_v1p8_ctrl(struct v4l2_subdev *subdev, int on)
 			goto out; /* Still needed */
 	}
 
-	if (gs->v1p8_gpio >= 0)
-		gpio_set_value(gs->v1p8_gpio, on);
-
 	if (gs->v1p8_reg) {
 		regulator_set_voltage(gs->v1p8_reg, 1800000, 1800000);
 		if (on)
@@ -901,16 +845,6 @@ static int gmin_v2p8_ctrl(struct v4l2_subdev *subdev, int on)
 	if (WARN_ON(!gs))
 		return -ENODEV;
 
-	if (gs->v2p8_gpio >= 0) {
-		pr_info("atomisp_gmin_platform: 2.8v power on GPIO %d\n",
-			gs->v2p8_gpio);
-		ret = gpio_request(gs->v2p8_gpio, "camera_v2p8");
-		if (!ret)
-			ret = gpio_direction_output(gs->v2p8_gpio, 0);
-		if (ret)
-			pr_err("V2P8 GPIO initialization failed\n");
-	}
-
 	if (gs->v2p8_on == on)
 		return 0;
 	gs->v2p8_on = on;
@@ -927,9 +861,6 @@ static int gmin_v2p8_ctrl(struct v4l2_subdev *subdev, int on)
 			goto out; /* Still needed */
 	}
 
-	if (gs->v2p8_gpio >= 0)
-		gpio_set_value(gs->v2p8_gpio, on);
-
 	if (gs->v2p8_reg) {
 		regulator_set_voltage(gs->v2p8_reg, 2900000, 2900000);
 		if (on)
Signature · 1 line
2.47.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Hans de Goede

The GMIN code has support for sensors using external regulators enabled by GPIOS, rather then using regulators build into the PMIC.

With the exception of the Trekstor ST70408-4 (1) tablet there are no known devices which actually use external regulators for the sensors and the code for this is using deprecated old style GPIO numbers support for which is going away.

Quoted 8 lines

Remove the GPIO driven regulator support so that the gmin code no longer depends on deprecated GPIO APIs.

1) The GMIN support itself is also deprecated and all sensor drivers still using it are being moved over to use ACPI + runtime-pm and the ST70408-4 shipped with Android as factory OS and thus will have broken ACPI tables for the sensors, so like other Android factory OS tablets it will need a bespoke solution anyways.

Definitely a good patch!

Signature · 2 lines
With Best Regards,
Andy Shevchenko
Reviewed-by on v1 1/1
#2 lore raw
In reply to Hans de Goede
Quoted 17 lines · Hans de Goede

The GMIN code has support for sensors using external regulators enabled by GPIOS, rather then using regulators build into the PMIC.

With the exception of the Trekstor ST70408-4 (1) tablet there are no known devices which actually use external regulators for the sensors and the code for this is using deprecated old style GPIO numbers support for which is going away.

Remove the GPIO driven regulator support so that the gmin code no longer depends on deprecated GPIO APIs.

1) The GMIN support itself is also deprecated and all sensor drivers still using it are being moved over to use ACPI + runtime-pm and the ST70408-4 shipped with Android as factory OS and thus will have broken ACPI tables for the sensors, so like other Android factory OS tablets it will need a bespoke solution anyways.

Quoted 4 lines

---

Thank you for taking the time to do this and removing an instance of using the legacy API!