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

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

Merge "msm: qpnp-power-on: modify logic to enable/disable S2 reset"

parents f78f58cb 8113b579
Loading
Loading
Loading
Loading
+10 −11
Original line number Diff line number Diff line
@@ -75,29 +75,28 @@ Sub-node optional properties:
				reset functionality.
				0 = Not supported
				1 = Supported
				This property is set to '0' if not specified.
				If this property is not defined, then do not modify S2 reset
				values.
- qcom,use-bark                 Specify if this pon type needs to handle bark irq
- linux,code                    The input key-code associated with the reset source.
                                The reset source in its default configuration can be
                                used to support standard keys.

The below mentioned properties are required only when qcom,support-reset DT property is defined
and is set to 1.

- qcom,s1-timer			The debounce timer for the BARK interrupt for
				that reset source. Value is specified in ms.
				Supported values are -
				- 0, 32, 56, 80, 128, 184, 272, 408, 608, 904
				  1352, 2048, 3072, 4480, 6720, 10256
				This property must be specified only if
				'support-reset' is set to 1.
- qcom,s2-timer			The debounce timer for the S2 reset specified
				in ms. On the expiry of this timer, the PMIC
				executes the reset sequence. Supported values -
				- 0, 10, 50, 100, 250, 500, 1000, 2000
				This property is required only if
				'support-reset' is set to 1.
- qcom,s2-type			The type of reset associated with this source.
				The supported resets are -
				SOFT(0), WARM(1), SHUTDOWN(4), HARD(7)
				This property is required only if
				'support-reset' is set to 1.
- linux,code			The input key-code associated with the reset source.
				The reset source in its default configuration can be
				used to support standard keys.

Example:
	qcom,power-on@800 {
+58 −27
Original line number Diff line number Diff line
@@ -141,6 +141,7 @@ struct qpnp_pon_config {
	u16 s2_cntl2_addr;
	bool old_state;
	bool use_bark;
	bool config_reset;
};

struct qpnp_pon {
@@ -1044,11 +1045,19 @@ static int qpnp_pon_config_init(struct qpnp_pon *pon)

			rc = of_property_read_u32(pp, "qcom,support-reset",
							&cfg->support_reset);
			if (rc && rc != -EINVAL) {

			if (rc) {
				if (rc == -EINVAL) {
					dev_dbg(&pon->spmi->dev,
						"'qcom,support-reset' DT property doesn't exist\n");
				 } else {
					dev_err(&pon->spmi->dev,
					"Unable to read 'support-reset'\n");
						"Unable to read 'qcom,support-reset'\n");
					return rc;
				}
			} else {
				cfg->config_reset = true;
			}

			cfg->use_bark = of_property_read_bool(pp,
							"qcom,use-bark");
@@ -1088,11 +1097,19 @@ static int qpnp_pon_config_init(struct qpnp_pon *pon)

			rc = of_property_read_u32(pp, "qcom,support-reset",
							&cfg->support_reset);
			if (rc && rc != -EINVAL) {

			if (rc) {
				if (rc == -EINVAL) {
					dev_dbg(&pon->spmi->dev,
						"'qcom,support-reset' DT property doesn't exist\n");
				} else {
					dev_err(&pon->spmi->dev,
					"Unable to read 'support-reset'\n");
						"Unable to read 'qcom,support-reset'\n");
					return rc;
				}
			} else {
				cfg->config_reset = true;
			}

			cfg->use_bark = of_property_read_bool(pp,
							"qcom,use-bark");
@@ -1161,11 +1178,19 @@ static int qpnp_pon_config_init(struct qpnp_pon *pon)
		case PON_KPDPWR_RESIN:
			rc = of_property_read_u32(pp, "qcom,support-reset",
							&cfg->support_reset);
			if (rc && rc != -EINVAL) {

			if (rc) {
				if (rc == -EINVAL) {
					dev_dbg(&pon->spmi->dev,
						"'qcom,support-reset' DT property doesn't exist\n");
				} else {
					dev_err(&pon->spmi->dev,
					"Unable to read 'support-reset'\n");
						"Unable to read 'qcom,support-reset'\n");
					return rc;
				}
			} else {
				cfg->config_reset = true;
			}

			cfg->use_bark = of_property_read_bool(pp,
							"qcom,use-bark");
@@ -1296,6 +1321,8 @@ static int qpnp_pon_config_init(struct qpnp_pon *pon)
			dev_err(&pon->spmi->dev, "Unable to config pull-up\n");
			goto unreg_input_dev;
		}

		if (cfg->config_reset) {
			/* Configure the reset-configuration */
			if (cfg->support_reset) {
				rc = qpnp_config_reset(pon, cfg);
@@ -1304,9 +1331,11 @@ static int qpnp_pon_config_init(struct qpnp_pon *pon)
						"Unable to config pon reset\n");
					goto unreg_input_dev;
				}
		} else if (cfg->pon_type != PON_CBLPWR) {
			} else {
				if (cfg->pon_type != PON_CBLPWR) {
					/* disable S2 reset */
			rc = qpnp_pon_masked_write(pon, cfg->s2_cntl2_addr,
					rc = qpnp_pon_masked_write(pon,
						cfg->s2_cntl2_addr,
						QPNP_PON_S2_CNTL_EN, 0);
					if (rc) {
						dev_err(&pon->spmi->dev,
@@ -1314,6 +1343,8 @@ static int qpnp_pon_config_init(struct qpnp_pon *pon)
						goto unreg_input_dev;
					}
				}
			}
		}

		rc = qpnp_pon_request_irqs(pon, cfg);
		if (rc) {