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

Commit b2c68848 authored by bozhilin's avatar bozhilin
Browse files

ARFP3-91: Expose power up and power down reason

Change-Id: If3eaaeaa531d6f2c13aef14966905518a67297f2
parent 5398fee7
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -73,6 +73,15 @@ extern phys_addr_t arm64_dma_phys_limit;
#define ARCH_LOW_ADDRESS_LIMIT	(arm64_dma_phys_limit - 1)

extern unsigned int boot_reason;
/*[Arima_8901][bozhi_lin] ARFP3-91: Expose power up and power down reason 20190221 begin*/
#if 1
extern unsigned int qpnp_pon_reason_extern;
extern unsigned int qpnp_poff_reason_extern;
#else
extern char qpnp_pon_reason_extern[256];
extern char qpnp_poff_reason_extern[256];
#endif
/*[Arima_8901][bozhi_lin] 20190221 end*/
extern unsigned int cold_boot;

struct debug_info {
+26 −0
Original line number Diff line number Diff line
@@ -313,6 +313,16 @@ static const char * const qpnp_poff_reason[] = {
	[39] = "Triggered from S3_RESET_KPDPWR_ANDOR_RESIN (power key and/or reset line)",
};

/*[Arima_8901][bozhi_lin] ARFP3-91: Expose power up and power down reason 20190221 begin*/
#if 1
unsigned int qpnp_pon_reason_extern=0;
unsigned int qpnp_poff_reason_extern=0;
#else
char qpnp_pon_reason_extern[256] = "";
char qpnp_poff_reason_extern[256] = "";
#endif
/*[Arima_8901][bozhi_lin] 20190221 end*/

static int
qpnp_pon_masked_write(struct qpnp_pon *pon, u16 addr, u8 mask, u8 val)
{
@@ -2287,8 +2297,17 @@ static int qpnp_pon_probe(struct platform_device *pdev)
		goto err_out;
	}

/*[Arima_8901][bozhi_lin] ARFP3-91: Expose power up and power down reason 20190221 begin*/
#if 1
	if (sys_reset) {
		boot_reason = ffs(pon_sts);
		qpnp_pon_reason_extern = ffs(pon_sts);
	}
#else
	if (sys_reset)
		boot_reason = ffs(pon_sts);
#endif
/*[Arima_8901][bozhi_lin] 20190221 end*/

	index = ffs(pon_sts) - 1;
	cold_boot = !qpnp_pon_is_warm_reset();
@@ -2322,6 +2341,13 @@ static int qpnp_pon_probe(struct platform_device *pdev)
		}
		poff_sts = buf[0] | (buf[1] << 8);
	}

/*[Arima_8901][bozhi_lin] ARFP3-91: Expose power up and power down reason 20190221 begin*/
	if (sys_reset) {
		qpnp_poff_reason_extern = ffs(poff_sts);
	}
/*[Arima_8901][bozhi_lin] 20190221 end*/

	index = ffs(poff_sts) - 1 + reason_index_offset;
	if (index >= ARRAY_SIZE(qpnp_poff_reason) || index < 0) {
		dev_info(&pon->pdev->dev,

kernel/sysctl.c

100644 → 100755
+47 −0
Original line number Diff line number Diff line
@@ -228,6 +228,9 @@ static struct ctl_table vm_table[];
static struct ctl_table fs_table[];
static struct ctl_table debug_table[];
static struct ctl_table dev_table[];
/*[Arima_8901][bozhi_lin] ARFP3-91: Expose power up and power down reason 20190221 begin*/
static struct ctl_table qpnp_power_on_table[];
/*[Arima_8901][bozhi_lin] 20190221 end*/
extern struct ctl_table random_table[];
#ifdef CONFIG_EPOLL
extern struct ctl_table epoll_table[];
@@ -265,6 +268,13 @@ static struct ctl_table sysctl_base_table[] = {
		.mode		= 0555,
		.child		= dev_table,
	},
/*[Arima_8901][bozhi_lin] ARFP3-91: Expose power up and power down reason 20190221 begin*/
	{
		.procname	= "qpnp-power-on",
		.mode		= 0555,
		.child		= qpnp_power_on_table,
	},
/*[Arima_8901][bozhi_lin] 20190221 end*/
	{ }
};

@@ -2063,6 +2073,43 @@ static struct ctl_table dev_table[] = {
	{ }
};

/*[Arima_8901][bozhi_lin] ARFP3-91: Expose power up and power down reason 20190221 begin*/
static struct ctl_table qpnp_power_on_table[] = {
#if 1
	{
		.procname	= "pon_reason",
		.data		= &qpnp_pon_reason_extern,
		.maxlen		= sizeof(int),
		.mode		= 0444,
		.proc_handler	= proc_dointvec,
	},
	{
		.procname	= "poff_reason",
		.data		= &qpnp_poff_reason_extern,
		.maxlen		= sizeof(int),
		.mode		= 0444,
		.proc_handler	= proc_dointvec,
	},
#else
	{
		.procname	= "pon_reason",
		.data		= &qpnp_pon_reason_extern,
		.maxlen		= 256,
		.mode		= 0444,
		.proc_handler	= proc_dostring,
	},
	{
		.procname	= "poff_reason",
		.data		= &qpnp_poff_reason_extern,
		.maxlen		= 256,
		.mode		= 0444,
		.proc_handler	= proc_dostring,
	},
#endif
	{ }
};
/*[Arima_8901][bozhi_lin] 20190221 end*/

int __init sysctl_init(void)
{
	struct ctl_table_header *hdr;