Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8bd27e6d authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "wcnss: update the regulator parsing and config method"

parents 724baf5d 1c873eab
Loading
Loading
Loading
Loading
+10 −33
Original line number Diff line number Diff line
@@ -193,27 +193,6 @@ int validate_iris_chip_id(u32 reg)
	}
}

void wcnss_free_regulator(void)
{
	int vreg_i;

	/* Free pronto voltage regulators from device node */
	for (vreg_i = 0; vreg_i < PRONTO_REGULATORS; vreg_i++) {
		if (pronto_vregs[vreg_i].state) {
			regulator_put(pronto_vregs[vreg_i].regulator);
			pronto_vregs[vreg_i].state = VREG_NULL_CONFIG;
		}
	}

	/* Free IRIS voltage regulators from device node */
	for (vreg_i = 0; vreg_i < IRIS_REGULATORS; vreg_i++) {
		if (iris_vregs[vreg_i].state) {
			regulator_put(iris_vregs[vreg_i].regulator);
			iris_vregs[vreg_i].state = VREG_NULL_CONFIG;
		}
	}
}

static int
wcnss_dt_parse_vreg_level(struct device *dev, int index,
			  const char *current_vreg_name, const char *vreg_name,
@@ -256,13 +235,14 @@ wcnss_parse_voltage_regulator(struct wcnss_wlan_config *wlan_config,
	/* Parse pronto voltage regulators from device node */
	for (vreg_i = 0; vreg_i < PRONTO_REGULATORS; vreg_i++) {
		pronto_vregs[vreg_i].regulator =
			regulator_get(dev, pronto_vregs[vreg_i].name);
			devm_regulator_get_optional(dev,
						    pronto_vregs[vreg_i].name);
		if (IS_ERR(pronto_vregs[vreg_i].regulator)) {
			if (pronto_vregs[vreg_i].required) {
				rc = PTR_ERR(pronto_vregs[vreg_i].regulator);
				dev_err(dev, "regulator get of %s failed (%d)\n",
					pronto_vregs[vreg_i].name, rc);
				goto wcnss_vreg_get_err;
				return rc;
			} else {
				dev_dbg(dev, "Skip optional regulator configuration: %s\n",
					pronto_vregs[vreg_i].name);
@@ -270,27 +250,28 @@ wcnss_parse_voltage_regulator(struct wcnss_wlan_config *wlan_config,
			}
		}

		pronto_vregs[vreg_i].state |= VREG_GET_REGULATOR_MASK;
		rc = wcnss_dt_parse_vreg_level(dev, vreg_i,
					       pronto_vregs[vreg_i].curr,
					       pronto_vregs[vreg_i].volt,
					       wlan_config->pronto_vlevel);
		if (rc) {
			dev_err(dev, "error reading voltage-level property\n");
			goto wcnss_vreg_get_err;
			return rc;
		}
		pronto_vregs[vreg_i].state |= VREG_GET_REGULATOR_MASK;
	}

	/* Parse iris voltage regulators from device node */
	for (vreg_i = 0; vreg_i < IRIS_REGULATORS; vreg_i++) {
		iris_vregs[vreg_i].regulator =
			regulator_get(dev, iris_vregs[vreg_i].name);
			devm_regulator_get_optional(dev,
						    iris_vregs[vreg_i].name);
		if (IS_ERR(iris_vregs[vreg_i].regulator)) {
			if (iris_vregs[vreg_i].required) {
				rc = PTR_ERR(iris_vregs[vreg_i].regulator);
				dev_err(dev, "regulator get of %s failed (%d)\n",
					iris_vregs[vreg_i].name, rc);
				goto wcnss_vreg_get_err;
				return rc;
			} else {
				dev_dbg(dev, "Skip optional regulator configuration: %s\n",
					iris_vregs[vreg_i].name);
@@ -298,22 +279,18 @@ wcnss_parse_voltage_regulator(struct wcnss_wlan_config *wlan_config,
			}
		}

		iris_vregs[vreg_i].state |= VREG_GET_REGULATOR_MASK;
		rc = wcnss_dt_parse_vreg_level(dev, vreg_i,
					       iris_vregs[vreg_i].curr,
					       iris_vregs[vreg_i].volt,
					       wlan_config->iris_vlevel);
		if (rc) {
			dev_err(dev, "error reading voltage-level property\n");
			goto wcnss_vreg_get_err;
			return rc;
		}
		iris_vregs[vreg_i].state |= VREG_GET_REGULATOR_MASK;
	}

	return 0;

wcnss_vreg_get_err:
	wcnss_free_regulator();
	return rc;
}

void  wcnss_iris_reset(u32 reg, void __iomem *pmu_conf_reg)
+0 −1
Original line number Diff line number Diff line
@@ -3524,7 +3524,6 @@ wcnss_wlan_probe(struct platform_device *pdev)
static int
wcnss_wlan_remove(struct platform_device *pdev)
{
	wcnss_free_regulator();
	if (penv->wcnss_notif_hdle)
		subsys_notif_unregister_notifier(penv->wcnss_notif_hdle, &wnb);
	wcnss_cdev_unregister(pdev);
+0 −1
Original line number Diff line number Diff line
@@ -132,7 +132,6 @@ int wcnss_device_ready(void);
bool wcnss_cbc_complete(void);
int wcnss_device_is_shutdown(void);
void wcnss_riva_dump_pmic_regs(void);
void wcnss_free_regulator(void);
int wcnss_xo_auto_detect_enabled(void);
u32 wcnss_get_wlan_rx_buff_count(void);
int wcnss_wlan_iris_xo_mode(void);