Skip to contentSkip to conversation

media: atomisp: Fix AXP288 PMIC and dual-cam support

PATCH In review Hans de Goede 3 participants 13 messages Jan 16, 2022 – Jan 24, 2022

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

cover media: atomisp: Fix AXP288 PMIC and dual-cam support

Hi All,

Here is a patch series fixing various bugs in the current atomisp_gmin_platform AXP288 support (it was completely broken before this series) as well as adding support for devices with front and back sensors.

This has been tested on a Teclast Tbook11 and a
Trekstor Surftab Duo W1 10.1, both of which use ov2680 sensors as both there front and back sensors.

I think this should also make things work on the Cyberbook T116, but I did not get around to testing that yet.

This series also contains some code to try and get things to work on Bay Trail devices. This at least makes the driver load, but it does not work yet and actually getting it to work may very well be quite tricky.

Regards,

Hans

Hans de Goede (9):
media: atomisp: Don't use ifdef on IS_ISP2401
media: atomisp: Don't use ifdef ISP2400
media: atomisp: Use irci_stable_candrpv_0415_20150423_1753 fw for byt
media: atomisp_gmin_platform: Fix axp_regulator_set() writing to the
wrong register
media: atomisp_gmin_platform: Add enable-count to

    gmin_[v1p8|v2p8]_ctrl()
  media: atomisp_gmin_platform: Set ELDO1 to 1.6V on devices with an
    AXP288 PMIC

media: atomisp_gmin_platform: Do not turn ELDO2 off from axp_v1p8_on()
media: atomisp_gmin_platform: Base CsiPort default on detected CLK
media: atomisp_gmin_platform: Add DMI quirk to not turn AXP ELDO2
regulator off on some boards

 .../media/atomisp/pci/atomisp_compat_css20.c  |   4 +-
 .../media/atomisp/pci/atomisp_gmin_platform.c | 148 +++++++++++++-----
 .../staging/media/atomisp/pci/atomisp_v4l2.c  |   2 +-
 .../media/atomisp/pci/sh_css_firmware.c       |   4 +
 4 files changed, 114 insertions(+), 44 deletions(-)
Signature · 1 line
2.33.1
#1 lore raw

PATCH 1/9 media: atomisp: Don't use ifdef on IS_ISP2401

IS_ISP2401 is a function like macro which is always defined, so it must not be used together with #ifdef. #ifdef checks should check for "ISP2401", not "IS_ISP2401".

---
 drivers/staging/media/atomisp/pci/atomisp_compat_css20.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_compat_css20.c +2 -2
index 7edee293b132..49f235f9c365 100644
@@ -972,7 +972,7 @@ int atomisp_css_irq_translate(struct atomisp_device *isp,
 void atomisp_css_rx_get_irq_info(enum mipi_port_id port,
 				 unsigned int *infos)
 {
-#ifndef IS_ISP2401
+#ifndef ISP2401
 	ia_css_isys_rx_get_irq_info(port, infos);
 #else
 	*infos = 0;
@@ -982,7 +982,7 @@ void atomisp_css_rx_get_irq_info(enum mipi_port_id port,
 void atomisp_css_rx_clear_irq_info(enum mipi_port_id port,
 				   unsigned int infos)
 {
-#ifndef IS_ISP2401
+#ifndef ISP2401
 	ia_css_isys_rx_clear_irq_info(port, infos);
 #endif
 }
Signature · 1 line
2.33.1
#2 lore raw

PATCH 2/9 media: atomisp: Don't use ifdef ISP2400

In reply to Hans de Goede

IPS2400 is never defined, for ISP2401 builds ISP2401 gets defined and for ISP2400 nothing gets defined, so any #ifdef ISP2400 checks should be #ifndef ISP2401 checks instead.

---
 drivers/staging/media/atomisp/pci/atomisp_v4l2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/atomisp/pci/atomisp_v4l2.c +1 -1
index 1b240891a6e2..52a367feaeee 100644
@@ -1467,7 +1467,7 @@ static bool is_valid_device(struct pci_dev *pdev, const struct pci_device_id *id
 	 * remove the if once the driver become generic
 	 */
 
-#if defined(ISP2400)
+#ifndef ISP2401
 	if (IS_ISP2401) {
 		dev_err(&pdev->dev, "Support for %s (ISP2401) was disabled at compile time\n",
 			name);
Signature · 1 line
2.33.1
#3 lore raw

PATCH 3/9 media: atomisp: Use irci_stable_candrpv_0415_20150423_1753 fw for byt

In reply to Hans de Goede

There is no irci_stable_candrpv_0415_20150521_0458 build for the isp2400/byt version of the atomisp2. There is however an irci_stable_candrpv_0415_20150423_1753 version which according to:
https://github.com/intel/ProductionKernelQuilts/blob/master/uefi/cht-m1stable/patches/cam-041

Has the exact same fw ABI, so use that on the isp2400.

---
 drivers/staging/media/atomisp/pci/sh_css_firmware.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/staging/media/atomisp/pci/sh_css_firmware.c +4 -0
index 94149647b98b..dd688f8ab649 100644
@@ -56,7 +56,11 @@ static struct firmware_header *firmware_header;
  * which will be replaced with the actual RELEASE_VERSION
  * during package generation. Please do not modify
  */
+#ifdef ISP2401
 static const char *release_version = STR(irci_stable_candrpv_0415_20150521_0458);
+#else
+static const char *release_version = STR(irci_stable_candrpv_0415_20150423_1753);
+#endif
 
 #define MAX_FW_REL_VER_NAME	300
 static char FW_rel_ver_name[MAX_FW_REL_VER_NAME] = "---";
Signature · 1 line
2.33.1
#4 lore raw

PATCH 4/9 media: atomisp_gmin_platform: Fix axp_regulator_set() writing to the wrong register

In reply to Hans de Goede

The second write done in axp_regulator_set() must go to the ctrl_reg which turns the various regulators on/off. This replaces the second write writing the sel_reg, which sets the voltage for the regulator, for a second time with a wrong value.

---
 drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c +1 -1
index 1cc581074ba7..a29e5086ffe1 100644
@@ -741,7 +741,7 @@ static int axp_regulator_set(struct device *dev, struct gmin_subdev *gs,
 
 	val = on ? 1 << shift : 0;
 
-	ret = gmin_i2c_write(dev, gs->pwm_i2c_addr, sel_reg, val, 1 << shift);
+	ret = gmin_i2c_write(dev, gs->pwm_i2c_addr, ctrl_reg, val, 1 << shift);
 	if (ret)
 		return ret;
 
Signature · 1 line
2.33.1
#5 lore raw

PATCH 5/9 media: atomisp_gmin_platform: Add enable-count to gmin_[v1p8|v2p8]_ctrl()

In reply to Hans de Goede

On devices with 2 sensors the 2 sensors may get probed simultaneously and the v1p8 and v2p8 regulators are ususally shared between the 2 sensors.

This means that the probe() function of sensor 1 may end up calling gmin_v1p8_ctrl(..., false) turning the regulator off while sensor 2's probe() function still needs it to be on, causing the probe() of sensor 2 to sometimes fail.

Fix this by adding an enable-count for both regulators and only disabling them again when that goes to 0.

Note all this really should be converted to use the standard kernel regulator framework, I have doing this on my long term TODO list, this fix is only meant as a temporary workaround for the issue.

---
 .../media/atomisp/pci/atomisp_gmin_platform.c | 86 ++++++++++++++-----
 1 file changed, 65 insertions(+), 21 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c +65 -21
index a29e5086ffe1..960c64ecdfe4 100644
@@ -118,6 +118,10 @@ static const char *pmic_name[] = {
 	[PMIC_CRYSTALCOVE]	= "Crystal Cove PMIC",
 };
 
+static DEFINE_MUTEX(gmin_regulator_mutex);
+static int gmin_v1p8_enable_count;
+static int gmin_v2p8_enable_count;
+
 /* The atomisp uses type==0 for the end-of-list marker, so leave space. */
 static struct intel_v4l2_subdev_table pdata_subdevs[MAX_SUBDEVS + 1];
 
@@ -851,38 +855,58 @@ static int gmin_v1p8_ctrl(struct v4l2_subdev *subdev, int on)
 
 	gs->v1p8_on = on;
 
+	ret = 0;
+	mutex_lock(&gmin_regulator_mutex);
+	if (on) {
+		gmin_v1p8_enable_count++;
+		if (gmin_v1p8_enable_count > 1)
+			goto out; /* Already on */
+	} else {
+		gmin_v1p8_enable_count--;
+		if (gmin_v1p8_enable_count > 0)
+			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)
-			return regulator_enable(gs->v1p8_reg);
+			ret = regulator_enable(gs->v1p8_reg);
 		else
-			return regulator_disable(gs->v1p8_reg);
+			ret = regulator_disable(gs->v1p8_reg);
+
+		goto out;
 	}
 
 	switch (pmic_id) {
 	case PMIC_AXP:
 		if (on)
-			return axp_v1p8_on(subdev->dev, gs);
+			ret = axp_v1p8_on(subdev->dev, gs);
 		else
-			return axp_v1p8_off(subdev->dev, gs);
+			ret = axp_v1p8_off(subdev->dev, gs);
+		break;
 	case PMIC_TI:
 		value = on ? LDO_1P8V_ON : LDO_1P8V_OFF;
 
-		return gmin_i2c_write(subdev->dev, gs->pwm_i2c_addr,
-				      LDO10_REG, value, 0xff);
+		ret = gmin_i2c_write(subdev->dev, gs->pwm_i2c_addr,
+				     LDO10_REG, value, 0xff);
+		break;
 	case PMIC_CRYSTALCOVE:
 		value = on ? CRYSTAL_ON : CRYSTAL_OFF;
 
-		return gmin_i2c_write(subdev->dev, gs->pwm_i2c_addr,
-				      CRYSTAL_1P8V_REG, value, 0xff);
+		ret = gmin_i2c_write(subdev->dev, gs->pwm_i2c_addr,
+				     CRYSTAL_1P8V_REG, value, 0xff);
+		break;
 	default:
-		dev_err(subdev->dev, "Couldn't set power mode for v1p2\n");
+		dev_err(subdev->dev, "Couldn't set power mode for v1p8\n");
+		ret = -EINVAL;
 	}
 
-	return -EINVAL;
+out:
+	mutex_unlock(&gmin_regulator_mutex);
+	return ret;
 }
 
 static int gmin_v2p8_ctrl(struct v4l2_subdev *subdev, int on)
@@ -908,37 +932,57 @@ static int gmin_v2p8_ctrl(struct v4l2_subdev *subdev, int on)
 		return 0;
 	gs->v2p8_on = on;
 
+	ret = 0;
+	mutex_lock(&gmin_regulator_mutex);
+	if (on) {
+		gmin_v2p8_enable_count++;
+		if (gmin_v2p8_enable_count > 1)
+			goto out; /* Already on */
+	} else {
+		gmin_v2p8_enable_count--;
+		if (gmin_v2p8_enable_count > 0)
+			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)
-			return regulator_enable(gs->v2p8_reg);
+			ret = regulator_enable(gs->v2p8_reg);
 		else
-			return regulator_disable(gs->v2p8_reg);
+			ret = regulator_disable(gs->v2p8_reg);
+
+		goto out;
 	}
 
 	switch (pmic_id) {
 	case PMIC_AXP:
-		return axp_regulator_set(subdev->dev, gs, ALDO1_SEL_REG,
-					 ALDO1_2P8V, ALDO1_CTRL3_REG,
-					 ALDO1_CTRL3_SHIFT, on);
+		ret = axp_regulator_set(subdev->dev, gs, ALDO1_SEL_REG,
+					ALDO1_2P8V, ALDO1_CTRL3_REG,
+					ALDO1_CTRL3_SHIFT, on);
+		break;
 	case PMIC_TI:
 		value = on ? LDO_2P8V_ON : LDO_2P8V_OFF;
 
-		return gmin_i2c_write(subdev->dev, gs->pwm_i2c_addr,
-				      LDO9_REG, value, 0xff);
+		ret = gmin_i2c_write(subdev->dev, gs->pwm_i2c_addr,
+				     LDO9_REG, value, 0xff);
+		break;
 	case PMIC_CRYSTALCOVE:
 		value = on ? CRYSTAL_ON : CRYSTAL_OFF;
 
-		return gmin_i2c_write(subdev->dev, gs->pwm_i2c_addr,
-				      CRYSTAL_2P8V_REG, value, 0xff);
+		ret = gmin_i2c_write(subdev->dev, gs->pwm_i2c_addr,
+				     CRYSTAL_2P8V_REG, value, 0xff);
+		break;
 	default:
-		dev_err(subdev->dev, "Couldn't set power mode for v1p2\n");
+		dev_err(subdev->dev, "Couldn't set power mode for v2p8\n");
+		ret = -EINVAL;
 	}
 
-	return -EINVAL;
+out:
+	mutex_unlock(&gmin_regulator_mutex);
+	return ret;
 }
 
 static int gmin_acpi_pm_ctrl(struct v4l2_subdev *subdev, int on)
Signature · 1 line
2.33.1
#6 lore raw

PATCH 6/9 media: atomisp_gmin_platform: Set ELDO1 to 1.6V on devices with an AXP288 PMIC

In reply to Hans de Goede

Testing on multiple tablet models has shown that Android always uses 1.6V for ELDO1, adjust our code to match.

This also matches with how ELDO1 is used in the DSDTs on these devices, where for Cherry Trail (ISP2401) based devices ELDO1 is used for an ACPI power-resource which is named "P16P".

Note on Bay Trail (ISP2400) based devices the power-resource is called "P15P", which suggests that 1.5V might be a better value there.

---
 .../media/atomisp/pci/atomisp_gmin_platform.c      | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c +7 -7
index 960c64ecdfe4..1c3fd72895ec 100644
@@ -38,7 +38,7 @@ enum clock_rate {
 #define ELDO_CTRL_REG   0x12
 
 #define ELDO1_SEL_REG	0x19
-#define ELDO1_1P8V	0x16
+#define ELDO1_1P6V	0x12
 #define ELDO1_CTRL_SHIFT 0x00
 
 #define ELDO2_SEL_REG	0x1a
@@ -89,7 +89,7 @@ struct gmin_subdev {
 	u8 pwm_i2c_addr;
 
 	/* For PMIC AXP */
-	int eldo1_sel_reg, eldo1_1p8v, eldo1_ctrl_shift;
+	int eldo1_sel_reg, eldo1_1p6v, eldo1_ctrl_shift;
 	int eldo2_sel_reg, eldo2_1p8v, eldo2_ctrl_shift;
 };
 
@@ -685,9 +685,9 @@ static int gmin_subdev_add(struct gmin_subdev *gs)
 		break;
 
 	case PMIC_AXP:
-		gs->eldo1_1p8v = gmin_get_var_int(dev, false,
+		gs->eldo1_1p6v = gmin_get_var_int(dev, false,
 						  "eldo1_1p8v",
-						  ELDO1_1P8V);
+						  ELDO1_1P6V);
 		gs->eldo1_sel_reg = gmin_get_var_int(dev, false,
 						     "eldo1_sel_reg",
 						     ELDO1_SEL_REG);
@@ -767,8 +767,8 @@ static int axp_v1p8_on(struct device *dev, struct gmin_subdev *gs)
 	 */
 	usleep_range(110, 150);
 
-	ret = axp_regulator_set(dev, gs, gs->eldo1_sel_reg, gs->eldo1_1p8v,
-		ELDO_CTRL_REG, gs->eldo1_ctrl_shift, true);
+	ret = axp_regulator_set(dev, gs, gs->eldo1_sel_reg, gs->eldo1_1p6v,
+				ELDO_CTRL_REG, gs->eldo1_ctrl_shift, true);
 	if (ret)
 		return ret;
 
@@ -781,7 +781,7 @@ static int axp_v1p8_off(struct device *dev, struct gmin_subdev *gs)
 {
 	int ret;
 
-	ret = axp_regulator_set(dev, gs, gs->eldo1_sel_reg, gs->eldo1_1p8v,
+	ret = axp_regulator_set(dev, gs, gs->eldo1_sel_reg, gs->eldo1_1p6v,
 				ELDO_CTRL_REG, gs->eldo1_ctrl_shift, false);
 	if (ret)
 		return ret;
Signature · 1 line
2.33.1
#7 lore raw

PATCH 7/9 media: atomisp_gmin_platform: Do not turn ELDO2 off from axp_v1p8_on()

In reply to Hans de Goede

Fix axp_v1p8_on() turning ELDO2 off at the end again by removing the bogus code which turns it off again after just having turned it on.

---
 drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c | 5 -----
 1 file changed, 5 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c +0 -5
index 1c3fd72895ec..84a453118bd9 100644
@@ -769,11 +769,6 @@ static int axp_v1p8_on(struct device *dev, struct gmin_subdev *gs)
 
 	ret = axp_regulator_set(dev, gs, gs->eldo1_sel_reg, gs->eldo1_1p6v,
 				ELDO_CTRL_REG, gs->eldo1_ctrl_shift, true);
-	if (ret)
-		return ret;
-
-	ret = axp_regulator_set(dev, gs, gs->eldo2_sel_reg, gs->eldo2_1p8v,
-				ELDO_CTRL_REG, gs->eldo2_ctrl_shift, false);
 	return ret;
 }
 
Signature · 1 line
2.33.1
#8 lore raw

PATCH 8/9 media: atomisp_gmin_platform: Base CsiPort default on detected CLK

In reply to Hans de Goede

On devices with 2 cameras and no _DSM / EFI-vars providing CsiPort clock info, defaulting to CsiPort 0 obviously is wrong for 1 of the 2 cameras.

The Intel Cherry Trail (ISP2401) reference design combines:
pmc_plt_clk_2 with CsiPort 0
pmc_plt_clk_4 with CsiPort 1

The Intel Bay Trail (ISP2400) reference design combines:
pmc_plt_clk_1 with CsiPort 0
pmc_plt_clk_0 with CsiPort 1

Use this knowledge to set the default CsiPort value based on the detected CLK for the sensor.

---
 .../media/atomisp/pci/atomisp_gmin_platform.c | 23 +++++++++++++------
 1 file changed, 16 insertions(+), 7 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c +16 -7
index 84a453118bd9..544e3e7b3aaf 100644
@@ -540,7 +540,7 @@ static int gmin_subdev_add(struct gmin_subdev *gs)
 	struct i2c_client *client = v4l2_get_subdevdata(gs->subdev);
 	struct device *dev = &client->dev;
 	struct acpi_device *adev = ACPI_COMPANION(dev);
-	int ret, clock_num = -1;
+	int ret, default_val, clock_num = -1;
 
 	dev_info(dev, "%s: ACPI path is %pfw\n", __func__, dev_fwnode(dev));
 
@@ -548,7 +548,20 @@ static int gmin_subdev_add(struct gmin_subdev *gs)
 	gs->clock_src = gmin_get_var_int(dev, false, "ClkSrc",
 				         VLV2_CLK_PLL_19P2MHZ);
 
-	gs->csi_port = gmin_get_var_int(dev, false, "CsiPort", 0);
+	/*
+	 * Get ACPI _PR0 derived clock here already because it is used
+	 * to determine the csi_port default.
+	 */
+	if (acpi_device_power_manageable(adev))
+		clock_num = atomisp_get_acpi_power(dev);
+
+	/* Compare clock to CsiPort 1 pmc-clock used in the CHT/BYT reference designs */
+	if (IS_ISP2401)
+		default_val = clock_num == 4 ? 1 : 0;
+	else
+		default_val = clock_num == 0 ? 1 : 0;
+
+	gs->csi_port = gmin_get_var_int(dev, false, "CsiPort", default_val);
 	gs->csi_lanes = gmin_get_var_int(dev, false, "CsiLanes", 1);
 
 	gs->gpio0 = gpiod_get_index(dev, NULL, 0, GPIOD_OUT_LOW);
@@ -629,11 +642,7 @@ static int gmin_subdev_add(struct gmin_subdev *gs)
 	 * otherwise.
 	 */
 
-	/* Try first to use ACPI to get the clock resource */
-	if (acpi_device_power_manageable(adev))
-		clock_num = atomisp_get_acpi_power(dev);
-
-	/* Fall-back use EFI and/or DMI match */
+	/* If getting the clock from _PR0 above failed, fall-back to EFI and/or DMI match */
 	if (clock_num < 0)
 		clock_num = gmin_get_var_int(dev, false, "CamClk", 0);
 
Signature · 1 line
2.33.1
#9 lore raw

PATCH 9/9 media: atomisp_gmin_platform: Add DMI quirk to not turn AXP ELDO2 regulator off on some boards

In reply to Hans de Goede

The TrekStor SurfTab duo W1 10.1 has a hw bug where turning eldo2 back on after having turned it off causes the CPLM3218 ambient-light-sensor on the front camera sensor's I2C bus to crash, hanging the bus.

Add a DMI quirk table for systems on which to leave eldo2 on.

Note an alternative fix is to turn off the CPLM3218 ambient-light-sensor as long as the camera sensor is being used, this is what Windows seems to do as a workaround (based on analyzing the DSDT). But that is not easy to do cleanly under Linux.

---
 .../media/atomisp/pci/atomisp_gmin_platform.c  | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c +18 -0
index 544e3e7b3aaf..7e47db82de07 100644
@@ -761,6 +761,21 @@ static int axp_regulator_set(struct device *dev, struct gmin_subdev *gs,
 	return 0;
 }
 
+/*
+ * Some boards contain a hw-bug where turning eldo2 back on after having turned
+ * it off causes the CPLM3218 ambient-light-sensor on the image-sensor's I2C bus
+ * to crash, hanging the bus. Do not turn eldo2 off on these systems.
+ */
+static const struct dmi_system_id axp_leave_eldo2_on_ids[] = {
+	{
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "TrekStor"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "SurfTab duo W1 10.1 (VT4)"),
+		},
+	},
+	{ }
+};
+
 static int axp_v1p8_on(struct device *dev, struct gmin_subdev *gs)
 {
 	int ret;
@@ -790,6 +805,9 @@ static int axp_v1p8_off(struct device *dev, struct gmin_subdev *gs)
 	if (ret)
 		return ret;
 
+	if (dmi_check_system(axp_leave_eldo2_on_ids))
+		return 0;
+
 	ret = axp_regulator_set(dev, gs, gs->eldo2_sel_reg, gs->eldo2_1p8v,
 				ELDO_CTRL_REG, gs->eldo2_ctrl_shift, false);
 	return ret;
Signature · 1 line
2.33.1
Reviewed-by on the v1 series
#10 lore raw
In reply to Hans de Goede
Quoted 12 lines · Hans de Goede

Hi All,

Here is a patch series fixing various bugs in the current atomisp_gmin_platform AXP288 support (it was completely broken before this series) as well as adding support for devices with front and back sensors.

This has been tested on a Teclast Tbook11 and a
Trekstor Surftab Duo W1 10.1, both of which use ov2680 sensors as both there front and back sensors.

Quoted 7 lines

I think this should also make things work on the Cyberbook T116, but I did not get around to testing that yet.

This series also contains some code to try and get things to work on Bay Trail devices. This at least makes the driver load, but it does not work yet and actually getting it to work may very well be quite tricky.

Thanks for the series! I have looked into all patches and I found them clean and good.

Quoted 29 lines

Regards,

Hans

Hans de Goede (9):
media: atomisp: Don't use ifdef on IS_ISP2401
media: atomisp: Don't use ifdef ISP2400
media: atomisp: Use irci_stable_candrpv_0415_20150423_1753 fw for byt
media: atomisp_gmin_platform: Fix axp_regulator_set() writing to the
wrong register
media: atomisp_gmin_platform: Add enable-count to

    gmin_[v1p8|v2p8]_ctrl()
  media: atomisp_gmin_platform: Set ELDO1 to 1.6V on devices with an
    AXP288 PMIC

media: atomisp_gmin_platform: Do not turn ELDO2 off from axp_v1p8_on()
media: atomisp_gmin_platform: Base CsiPort default on detected CLK
media: atomisp_gmin_platform: Add DMI quirk to not turn AXP ELDO2
regulator off on some boards

 .../media/atomisp/pci/atomisp_compat_css20.c  |   4 +-
 .../media/atomisp/pci/atomisp_gmin_platform.c | 148 +++++++++++++-----
 .../staging/media/atomisp/pci/atomisp_v4l2.c  |   2 +-
 .../media/atomisp/pci/sh_css_firmware.c       |   4 +
 4 files changed, 114 insertions(+), 44 deletions(-)

--
2.33.1

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#11 lore raw

Bay Trail atomisp support update (was [PATCH 0/9] media: atomisp: ...)

In reply to Hans de Goede

Hi All,

Quoted 4 lines · Hans de Goede

This series also contains some code to try and get things to work on Bay Trail devices. This at least makes the driver load, but it does not work yet and actually getting it to work may very well be quite tricky.

I've spend some more time on Bay Trail this weekend, I decided to start with a49d25364dfb9f8a64037488a39ab1f56c5fa419 which is the first commit adding atomisp to staging, since the commit msg there suggested that at least that commit was tested to work on Bay Trail.

And indeed with the current knowledge about clks + regulators and using the right magic nvt commandline on /dev/video2 I got both the back ov2680 and front gc0310 (300k sensor, ugh) to work on a Chuwi Hi8 tablet easily.

So now I've a mainline kernel with working atomisp on BYT, only problem is, it is kernel 4.11 :)

A full git log of drivers/staging/media/atomisp is 15k lines (I decided to go with a full log and not --oneline because the commit msgs contain useful info).

So my plan is to move forward in time / to newer kernel versions by around 1k lines of the log at a time.

The first 1000 lines took me to 4.12 and that did not work, but after a couple of hours of debugging I found the culprit (which is actually fixed by a later commit already in mainline).

So after that another 1k lines in the changelog jump took me to 4.13 (lots of activity when the driver just got merged) and that worked in one go.

The next jump again does not work and annoyingly it hangs the entire system when I try to use the cams,
so I need to bisect that one, so to be continued.

Hopefully this way I will be able to find fixes to make atomisp in the current mainline work on BYT. This is my main working item wrt atomisp atm because I believe it would be good to have both working (and be able to regression test both) before doing any further refactoring.

If anyone is interested my work on this can be found in various atomisp-byt-chuwi-hi8-4.xx-rcx branches in:
https://github.com/jwrdegoede/linux-sunxi/

When every I've got a newer kernel version working I'll push a branch with the working code there. The idea is to be able to later retest other modes then the preview mode if we ever try to get other modes working; and then if the mode does work in the initial version and not in later version easily be able to find out when it broke.

Regards,

Hans

p.s.

Mauro I see that you have been merging various new patches into https://git.linuxtv.org/media_stage.git/ now that 5.17 is out. I assume you will eventually get around to this patch-set too ?

Quoted 21 lines

Hans de Goede (9):
media: atomisp: Don't use ifdef on IS_ISP2401
media: atomisp: Don't use ifdef ISP2400
media: atomisp: Use irci_stable_candrpv_0415_20150423_1753 fw for byt
media: atomisp_gmin_platform: Fix axp_regulator_set() writing to the
wrong register
media: atomisp_gmin_platform: Add enable-count to

    gmin_[v1p8|v2p8]_ctrl()
  media: atomisp_gmin_platform: Set ELDO1 to 1.6V on devices with an
    AXP288 PMIC

media: atomisp_gmin_platform: Do not turn ELDO2 off from axp_v1p8_on()
media: atomisp_gmin_platform: Base CsiPort default on detected CLK
media: atomisp_gmin_platform: Add DMI quirk to not turn AXP ELDO2
regulator off on some boards

 .../media/atomisp/pci/atomisp_compat_css20.c  |   4 +-
 .../media/atomisp/pci/atomisp_gmin_platform.c | 148 +++++++++++++-----
 .../staging/media/atomisp/pci/atomisp_v4l2.c  |   2 +-
 .../media/atomisp/pci/sh_css_firmware.c       |   4 +
 4 files changed, 114 insertions(+), 44 deletions(-)
#12 lore raw

Re: Bay Trail atomisp support update (was [PATCH 0/9] media: atomisp: ...)

Hi Hans,

Em Mon, 24 Jan 2022 11:37:58 +0100
Hans de Goede <[email protected]> escreveu:

Quoted 51 lines

Hi All,

Quoted 4 lines · Hans de Goede

This series also contains some code to try and get things to work on Bay Trail devices. This at least makes the driver load, but it does not work yet and actually getting it to work may very well be quite tricky.

I've spend some more time on Bay Trail this weekend, I decided to start with a49d25364dfb9f8a64037488a39ab1f56c5fa419 which is the first commit adding atomisp to staging, since the commit msg there suggested that at least that commit was tested to work on Bay Trail.

And indeed with the current knowledge about clks + regulators and using the right magic nvt commandline on /dev/video2 I got both the back ov2680 and front gc0310 (300k sensor, ugh) to work on a Chuwi Hi8 tablet easily.

So now I've a mainline kernel with working atomisp on BYT, only problem is, it is kernel 4.11 :)

A full git log of drivers/staging/media/atomisp is 15k lines (I decided to go with a full log and not --oneline because the commit msgs contain useful info).

So my plan is to move forward in time / to newer kernel versions by around 1k lines of the log at a time.

The first 1000 lines took me to 4.12 and that did not work, but after a couple of hours of debugging I found the culprit (which is actually fixed by a later commit already in mainline).

So after that another 1k lines in the changelog jump took me to 4.13 (lots of activity when the driver just got merged) and that worked in one go.

The next jump again does not work and annoyingly it hangs the entire system when I try to use the cams,
so I need to bisect that one, so to be continued.

Hopefully this way I will be able to find fixes to make atomisp in the current mainline work on BYT. This is my main working item wrt atomisp atm because I believe it would be good to have both working (and be able to regression test both) before doing any further refactoring.

If anyone is interested my work on this can be found in various atomisp-byt-chuwi-hi8-4.xx-rcx branches in:
https://github.com/jwrdegoede/linux-sunxi/

Quoted 6 lines

When every I've got a newer kernel version working I'll push a branch with the working code there. The idea is to be able to later retest other modes then the preview mode if we ever try to get other modes working; and then if the mode does work in the initial version and not in later version easily be able to find out when it broke.

While you're on it, I'd appreciate if you could test both MMAP and USERPTR support. I'm assuming that sometime in the past, MMAP used to work, but some change - either at mm subsytem or at the driver itself - broke it. It would be nice to be able to pinpoint the culprit.

Quoted 6 lines

Regards,

Hans

Quoted 27 lines

p.s.

Mauro I see that you have been merging various new patches into https://git.linuxtv.org/media_stage.git/ now that 5.17 is out. I assume you will eventually get around to this patch-set too ?

Quoted 20 lines

Hans de Goede (9):
media: atomisp: Don't use ifdef on IS_ISP2401
media: atomisp: Don't use ifdef ISP2400
media: atomisp: Use irci_stable_candrpv_0415_20150423_1753 fw for byt
media: atomisp_gmin_platform: Fix axp_regulator_set() writing to the
wrong register
media: atomisp_gmin_platform: Add enable-count to

    gmin_[v1p8|v2p8]_ctrl()
  media: atomisp_gmin_platform: Set ELDO1 to 1.6V on devices with an
    AXP288 PMIC

media: atomisp_gmin_platform: Do not turn ELDO2 off from axp_v1p8_on()
media: atomisp_gmin_platform: Base CsiPort default on detected CLK
media: atomisp_gmin_platform: Add DMI quirk to not turn AXP ELDO2
regulator off on some boards

 .../media/atomisp/pci/atomisp_compat_css20.c  |   4 +-
 .../media/atomisp/pci/atomisp_gmin_platform.c | 148 +++++++++++++-----
 .../staging/media/atomisp/pci/atomisp_v4l2.c  |   2 +-
 .../media/atomisp/pci/sh_css_firmware.c       |   4 +
 4 files changed, 114 insertions(+), 44 deletions(-)

Yeah, I'm planning to pick those too, pending some tests here with camorama on T101. Will try to do it along this week, if time allows.

Thanks,
Mauro