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

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

Merge "input: qpnp-power-on: Fix the argument data-type for regmap_bulk_read"

parents 5636c8be 99f3228f
Loading
Loading
Loading
Loading
+12 −10
Original line number Original line Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
// SPDX-License-Identifier: GPL-2.0-only
/*
/*
 * Copyright (c) 2012-2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
 */
 */


#include <linux/debugfs.h>
#include <linux/debugfs.h>
@@ -1983,7 +1983,8 @@ static void qpnp_pon_debugfs_remove(struct qpnp_pon *pon)
static int qpnp_pon_read_gen2_pon_off_reason(struct qpnp_pon *pon, u16 *reason,
static int qpnp_pon_read_gen2_pon_off_reason(struct qpnp_pon *pon, u16 *reason,
					int *reason_index_offset)
					int *reason_index_offset)
{
{
	unsigned int buf[2], reg;
	unsigned int reg, reg1;
	u8 buf[2];
	int rc;
	int rc;


	rc = qpnp_pon_read(pon, QPNP_PON_OFF_REASON(pon), &reg);
	rc = qpnp_pon_read(pon, QPNP_PON_OFF_REASON(pon), &reg);
@@ -1991,10 +1992,10 @@ static int qpnp_pon_read_gen2_pon_off_reason(struct qpnp_pon *pon, u16 *reason,
		return rc;
		return rc;


	if (reg & QPNP_GEN2_POFF_SEQ) {
	if (reg & QPNP_GEN2_POFF_SEQ) {
		rc = qpnp_pon_read(pon, QPNP_POFF_REASON1(pon), buf);
		rc = qpnp_pon_read(pon, QPNP_POFF_REASON1(pon), &reg1);
		if (rc)
		if (rc)
			return rc;
			return rc;
		*reason = (u8)buf[0];
		*reason = (u8)reg1;
		*reason_index_offset = 0;
		*reason_index_offset = 0;
	} else if (reg & QPNP_GEN2_FAULT_SEQ) {
	} else if (reg & QPNP_GEN2_FAULT_SEQ) {
		rc = regmap_bulk_read(pon->regmap, QPNP_FAULT_REASON1(pon), buf,
		rc = regmap_bulk_read(pon->regmap, QPNP_FAULT_REASON1(pon), buf,
@@ -2004,13 +2005,13 @@ static int qpnp_pon_read_gen2_pon_off_reason(struct qpnp_pon *pon, u16 *reason,
				QPNP_FAULT_REASON1(pon), rc);
				QPNP_FAULT_REASON1(pon), rc);
			return rc;
			return rc;
		}
		}
		*reason = (u8)buf[0] | (u16)(buf[1] << 8);
		*reason = buf[0] | (u16)(buf[1] << 8);
		*reason_index_offset = POFF_REASON_FAULT_OFFSET;
		*reason_index_offset = POFF_REASON_FAULT_OFFSET;
	} else if (reg & QPNP_GEN2_S3_RESET_SEQ) {
	} else if (reg & QPNP_GEN2_S3_RESET_SEQ) {
		rc = qpnp_pon_read(pon, QPNP_S3_RESET_REASON(pon), buf);
		rc = qpnp_pon_read(pon, QPNP_S3_RESET_REASON(pon), &reg1);
		if (rc)
		if (rc)
			return rc;
			return rc;
		*reason = (u8)buf[0];
		*reason = (u8)reg1;
		*reason_index_offset = POFF_REASON_S3_RESET_OFFSET;
		*reason_index_offset = POFF_REASON_S3_RESET_OFFSET;
	}
	}


@@ -2084,7 +2085,7 @@ static int qpnp_pon_read_hardware_info(struct qpnp_pon *pon, bool sys_reset)
{
{
	struct device *dev = pon->dev;
	struct device *dev = pon->dev;
	unsigned int reg = 0;
	unsigned int reg = 0;
	unsigned int buf[2];
	u8 buf[2];
	int reason_index_offset = 0;
	int reason_index_offset = 0;
	unsigned int pon_sts = 0;
	unsigned int pon_sts = 0;
	bool cold_boot;
	bool cold_boot;
@@ -2165,10 +2166,11 @@ static int qpnp_pon_read_hardware_info(struct qpnp_pon *pon, bool sys_reset)
				QPNP_POFF_REASON1(pon), rc);
				QPNP_POFF_REASON1(pon), rc);
			return rc;
			return rc;
		}
		}
		poff_sts = buf[0] | (buf[1] << 8);
		poff_sts = buf[0] | (u16)(buf[1] << 8);
	}
	}
	index = ffs(poff_sts) - 1 + reason_index_offset;
	index = ffs(poff_sts) - 1 + reason_index_offset;
	if (index >= ARRAY_SIZE(qpnp_poff_reason) || index < 0) {
	if (index >= ARRAY_SIZE(qpnp_poff_reason) || index < 0 ||
					index < reason_index_offset) {
		dev_info(dev, "PMIC@SID%d: Unknown power-off reason\n",
		dev_info(dev, "PMIC@SID%d: Unknown power-off reason\n",
			 to_spmi_device(dev->parent)->usid);
			 to_spmi_device(dev->parent)->usid);
	} else {
	} else {