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

Commit 3d1eeeed 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 b1aa5935 d4523438
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -147,6 +147,7 @@ enum qpnp_pon_version {

#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
@@ -244,6 +245,7 @@ struct qpnp_pon {
	bool			resin_pon_reset;
	ktime_t			kpdpwr_last_release_time;
	bool			legacy_hard_reset_offset;
	bool			log_kpd_event;
};

static struct qpnp_pon *sys_reset_dev;
@@ -1041,6 +1043,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);
@@ -1446,6 +1452,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) {
@@ -1484,6 +1491,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;
}

@@ -2466,6 +2483,8 @@ 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)