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

Commit ffd4d9e7 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 wcnss wlan module power up sequence"

parents 1c3176ef 7e3bf35f
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -64,6 +64,10 @@ support for pronto hardware.
to use for VBATT feature.
- qcom,has-a2xb-split-reg: boolean flag to determine A2xb split timeout limit
register is available or not.
- qcom,wcn-external-gpio-support: boolean flag to determine 3.3v gpio support
for pronto hardware for a target.
- qcom,wcn-external-gpio: The wcnss wlan module 3.3v external GPIO for
the pronto hardware.

Example:

@@ -85,6 +89,8 @@ Example:

        gpios = <&msmgpio 36 0>, <&msmgpio 37 0>, <&msmgpio 38 0>,
                <&msmgpio 39 0>, <&msmgpio 40 0>;
        qcom,wcn-external-gpio = <&msmgpio 64 0>;
        qcom,wcn-external-gpio-support;
        qcom,has-48mhz-xo;
        qcom,is-pronto-vt;
        qcom,wlan-rx-buff-count = <512>;
+62 −1
Original line number Diff line number Diff line
@@ -102,6 +102,45 @@ enum {
	IRIS_3610
};

static int wcnss_external_gpio_set_state(bool state)
{
	int ret;
	struct wcnss_wlan_config *cfg = wcnss_get_wlan_config();

	if (!cfg)
		return -EINVAL;

	if (state) {
		ret = gpio_request(cfg->wcn_external_gpio,
				   WCNSS_EXTERNAL_GPIO_NAME);
		if (ret) {
			pr_err("%s: Can't get GPIO %s, ret = %d\n",
			       __func__, WCNSS_EXTERNAL_GPIO_NAME, ret);
			return ret;
		}

		ret = gpio_direction_output(cfg->wcn_external_gpio,
					    WCNSS_EXTERNAL_GPIO_DIR_OUT);
		if (ret) {
			pr_err("%s: Can't set GPIO %s direction, ret = %d\n",
			       __func__, WCNSS_EXTERNAL_GPIO_NAME, ret);
			gpio_free(cfg->wcn_external_gpio);
			return ret;
		}

		gpio_set_value(cfg->wcn_external_gpio,
			       WCNSS_EXTERNAL_GPIO_HIGH);
	} else {
		gpio_set_value(cfg->wcn_external_gpio, WCNSS_EXTERNAL_GPIO_LOW);
		gpio_free(cfg->wcn_external_gpio);
	}

	pr_debug("%s: %d gpio is now %s\n", __func__,
		 cfg->wcn_external_gpio,
		 state ? "enabled" : "disabled");

	return 0;
}

int xo_auto_detect(u32 reg)
{
@@ -419,6 +458,12 @@ static void wcnss_vregs_off(struct vregs_info regulators[], uint size,
		if (regulators[i].state == VREG_NULL_CONFIG)
			continue;

		if (cfg->wcn_external_gpio_support) {
			if (!memcmp(regulators[i].name, VDD_PA,
				    sizeof(VDD_PA)))
				continue;
		}

		/* Remove PWM mode */
		if (regulators[i].state & VREG_OPTIMUM_MODE_MASK) {
			rc = regulator_set_optimum_mode(
@@ -480,6 +525,12 @@ static int wcnss_vregs_on(struct device *dev,
	}

	for (i = 0; i < size; i++) {
		if (cfg->wcn_external_gpio_support) {
			if (!memcmp(regulators[i].name, VDD_PA,
				    sizeof(VDD_PA)))
				continue;
		}

		/* Get regulator source */
		regulators[i].regulator =
			regulator_get(dev, regulators[i].name);
@@ -624,6 +675,12 @@ int wcnss_wlan_power(struct device *dev,

	down(&wcnss_power_on_lock);
	if (on) {
		if (cfg->wcn_external_gpio_support) {
			rc = wcnss_external_gpio_set_state(true);
			if (rc)
				return rc;
		}

		/* RIVA regulator settings */
		rc = wcnss_core_vregs_on(dev, hw_type,
			cfg);
@@ -646,6 +703,8 @@ int wcnss_wlan_power(struct device *dev,

	}  else if (is_power_on) {
		is_power_on = false;
		if (cfg->wcn_external_gpio_support)
			wcnss_external_gpio_set_state(false);
		configure_iris_xo(dev, cfg,
				WCNSS_WLAN_SWITCH_OFF, NULL);
		wcnss_iris_vregs_off(hw_type, cfg);
@@ -662,6 +721,8 @@ fail_iris_on:
	wcnss_core_vregs_off(hw_type, cfg);

fail_wcnss_on:
	if (cfg->wcn_external_gpio_support)
		wcnss_external_gpio_set_state(false);
	up(&wcnss_power_on_lock);
	return rc;
}
+53 −31
Original line number Diff line number Diff line
@@ -2796,23 +2796,42 @@ wcnss_trigger_config(struct platform_device *pdev)
	int is_pronto_vadc;
	int is_pronto_v3;
	int pil_retry = 0;
	int has_pronto_hw = of_property_read_bool(pdev->dev.of_node,
							"qcom,has-pronto-hw");

	is_pronto_vadc = of_property_read_bool(pdev->dev.of_node,
					       "qcom,is-pronto-vadc");

	is_pronto_v3 = of_property_read_bool(pdev->dev.of_node,
							"qcom,is-pronto-v3");

	penv->is_vsys_adc_channel = of_property_read_bool(pdev->dev.of_node,
						"qcom,has-vsys-adc-channel");

	penv->is_a2xb_split_reg = of_property_read_bool(pdev->dev.of_node,
						"qcom,has-a2xb-split-reg");
	struct wcnss_wlan_config *wlan_cfg = &penv->wlan_config;
	struct device_node *node = (&pdev->dev)->of_node;
	int has_pronto_hw = of_property_read_bool(node, "qcom,has-pronto-hw");

	is_pronto_vadc = of_property_read_bool(node, "qcom,is-pronto-vadc");
	is_pronto_v3 = of_property_read_bool(node, "qcom,is-pronto-v3");

	penv->is_vsys_adc_channel =
		of_property_read_bool(node, "qcom,has-vsys-adc-channel");
	penv->is_a2xb_split_reg =
		of_property_read_bool(node, "qcom,has-a2xb-split-reg");

	wlan_cfg->wcn_external_gpio_support =
		of_property_read_bool(node, "qcom,wcn-external-gpio-support");
	if (wlan_cfg->wcn_external_gpio_support) {
		if (of_find_property(node, WCNSS_EXTERNAL_GPIO_NAME, NULL)) {
			wlan_cfg->wcn_external_gpio =
					of_get_named_gpio(
						pdev->dev.of_node,
						WCNSS_EXTERNAL_GPIO_NAME,
						0);
			if (!gpio_is_valid(wlan_cfg->wcn_external_gpio)) {
				pr_err("%s: Invalid %s num defined in DT\n",
				       __func__, WCNSS_EXTERNAL_GPIO_NAME);
				ret = -EINVAL;
				goto fail;
			}
		} else {
			pr_err("%s: %s prop not defined in DT node\n",
			       __func__, WCNSS_EXTERNAL_GPIO_NAME);
			goto fail;
		}
	}

	if (of_property_read_u32(pdev->dev.of_node,
			"qcom,wlan-rx-buff-count", &penv->wlan_rx_buff_count)) {
	if (of_property_read_u32(node, "qcom,wlan-rx-buff-count",
				 &penv->wlan_rx_buff_count)) {
		penv->wlan_rx_buff_count = WCNSS_DEF_WLAN_RX_BUFF_COUNT;
	}

@@ -2873,16 +2892,19 @@ wcnss_trigger_config(struct platform_device *pdev)
		goto fail;
	}

	if (!wlan_cfg->wcn_external_gpio_support) {
		index++;
	ret = wcnss_dt_parse_vreg_level(&pdev->dev, index,
		ret = wcnss_dt_parse_vreg_level(
				&pdev->dev, index,
				"qcom,iris-vddpa-current",
				"qcom,iris-vddpa-voltage-level",
				penv->wlan_config.iris_vlevel);

		if (ret) {
		dev_err(&pdev->dev, "error reading voltage-level property\n");
			dev_err(&pdev->dev,
				"error reading voltage-level property\n");
			goto fail;
		}
	}

	index++;
	ret = wcnss_dt_parse_vreg_level(&pdev->dev, index,
@@ -2904,8 +2926,8 @@ wcnss_trigger_config(struct platform_device *pdev)
	pdata = pdev->dev.platform_data;
	if (WCNSS_CONFIG_UNSPECIFIED == has_48mhz_xo) {
		if (has_pronto_hw) {
			has_48mhz_xo = of_property_read_bool(pdev->dev.of_node,
							"qcom,has-48mhz-xo");
			has_48mhz_xo =
			of_property_read_bool(node, "qcom,has-48mhz-xo");
		} else {
			has_48mhz_xo = pdata->has_48mhz_xo;
		}
@@ -2916,8 +2938,8 @@ wcnss_trigger_config(struct platform_device *pdev)
	penv->wlan_config.is_pronto_v3 = is_pronto_v3;

	if (WCNSS_CONFIG_UNSPECIFIED == has_autodetect_xo && has_pronto_hw) {
		has_autodetect_xo = of_property_read_bool(pdev->dev.of_node,
							"qcom,has-autodetect-xo");
		has_autodetect_xo =
			of_property_read_bool(node, "qcom,has-autodetect-xo");
	}

	penv->thermal_mitigation = 0;
@@ -3198,8 +3220,8 @@ wcnss_trigger_config(struct platform_device *pdev)
			goto fail_ioremap2;
		}

		if (of_property_read_bool(
			pdev->dev.of_node, "qcom,is-dual-band-disabled")) {
		if (of_property_read_bool(node,
					  "qcom,is-dual-band-disabled")) {
			ret = wcnss_get_dual_band_capability_info(pdev);
			if (ret) {
				pr_err(
+7 −0
Original line number Diff line number Diff line
@@ -20,6 +20,11 @@
#define IRIS_REGULATORS		4
#define PRONTO_REGULATORS	3

#define WCNSS_EXTERNAL_GPIO_NAME "qcom,wcn-external-gpio"
#define WCNSS_EXTERNAL_GPIO_HIGH 1
#define WCNSS_EXTERNAL_GPIO_LOW 0
#define WCNSS_EXTERNAL_GPIO_DIR_OUT 1

enum wcnss_opcode {
	WCNSS_WLAN_SWITCH_OFF = 0,
	WCNSS_WLAN_SWITCH_ON,
@@ -38,6 +43,8 @@ struct vregs_level {
};

struct wcnss_wlan_config {
	bool	wcn_external_gpio_support;
	int	wcn_external_gpio;
	int	use_48mhz_xo;
	int	is_pronto_vadc;
	int	is_pronto_v3;