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

Commit 85d294e5 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "input: misc: qcom-power-on: Add support to log KPDPWR status"

parents 6640a8c5 1583e6d9
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -132,6 +132,7 @@

#define QPNP_PON_UVLO_DLOAD_EN			BIT(7)
#define QPNP_PON_SMPL_EN			BIT(7)
#define QPNP_PON_KPDPWR_ON			BIT(0)

/* Limits */
#define QPNP_PON_S1_TIMER_MAX			10256
@@ -225,6 +226,7 @@ struct qpnp_pon {
	bool			kpdpwr_dbc_enable;
	bool			resin_pon_reset;
	ktime_t			kpdpwr_last_release_time;
	bool			log_kpd_event;
};

static int pon_ship_mode_en;
@@ -968,6 +970,10 @@ static int qpnp_pon_input_dispatch(struct qpnp_pon *pon, u32 pon_type)
	 * Simulate a press event in case release event occurred without a press
	 * event
	 */
	if (pon->log_kpd_event && (cfg->pon_type == PON_KPDPWR))
		pr_info_ratelimited("PMIC input: KPDPWR status=0x%02x, KPDPWR_ON=%d\n",
			pon_rt_sts, (pon_rt_sts & QPNP_PON_KPDPWR_ON));

	if (!cfg->old_state && !key_status) {
		input_report_key(pon->pon_input, cfg->key_code, 1);
		input_sync(pon->pon_input);
@@ -1356,6 +1362,7 @@ static int qpnp_pon_config_kpdpwr_init(struct qpnp_pon *pon,
				       struct device_node *node)
{
	int rc;
	uint pon_rt_sts;

	cfg->state_irq = platform_get_irq_byname(pdev, "kpdpwr");
	if (cfg->state_irq < 0) {
@@ -1394,6 +1401,16 @@ static int qpnp_pon_config_kpdpwr_init(struct qpnp_pon *pon,
		cfg->s2_cntl2_addr = QPNP_PON_KPDPWR_S2_CNTL2(pon);
	}

	if (pon->log_kpd_event) {
		/* Read PON_RT_STS status during driver initialization. */
		rc = qpnp_pon_read(pon, QPNP_PON_RT_STS(pon), &pon_rt_sts);
		if (rc < 0)
			pr_err("failed to read QPNP_PON_RT_STS rc=%d\n", rc);

		pr_info("KPDPWR status at init=0x%02x, KPDPWR_ON=%d\n",
			pon_rt_sts, (pon_rt_sts & QPNP_PON_KPDPWR_ON));
	}

	return 0;
}

@@ -2360,6 +2377,9 @@ static int qpnp_pon_probe(struct platform_device *pdev)
		pon->is_spon = true;
	}

	pon->log_kpd_event = of_property_read_bool(dev->of_node,
				"qcom,log-kpd-event");

	/* Register the PON configurations */
	rc = qpnp_pon_config_init(pon, pdev);
	if (rc)