Пример #1
0
static void smsm_state_cb_hdlr(void *data, uint32_t old_state,
					uint32_t new_state)
{
	char *smem_reset_reason;
	char buffer[MAX_BUF_SIZE];
	unsigned smem_reset_size;
	unsigned size;
	int i, rc;
	u8 val;

	riva_crash = true;

	pr_err("%s: smsm state changed\n", MODULE_NAME);

	for (i = 0; i < ARRAY_SIZE(pmic_reg_dump); i++) {
		val = 0;
		rc = pm8xxx_read_register(pmic_reg_dump[i].reg_addr, &val);
		if (rc)
			pr_err("PMIC READ: Failed to read addr = %d\n",
						pmic_reg_dump[i].reg_addr);
		else
			pr_err("PMIC READ: addr = %x, value = %x\n",
					pmic_reg_dump[i].reg_addr, val);
	}

	if (!(new_state & SMSM_RESET))
		return;

	if (ss_restart_inprogress) {
		pr_err("%s: Ignoring smsm reset req, restart in progress\n",
						MODULE_NAME);
		return;
	}

	if (!enable_riva_ssr)
		panic(MODULE_NAME ": SMSM reset request received from Riva");

	smem_reset_reason = smem_get_entry(SMEM_SSR_REASON_WCNSS0,
			&smem_reset_size);

	if (!smem_reset_reason || !smem_reset_size) {
		pr_err("%s: wcnss subsystem failure reason: %s\n",
				__func__, "(unknown, smem_get_entry failed)");
	} else if (!smem_reset_reason[0]) {
		pr_err("%s: wcnss subsystem failure reason: %s\n",
				__func__, "(unknown, init string found)");
	} else {
		size = smem_reset_size < MAX_BUF_SIZE ? smem_reset_size :
			(MAX_BUF_SIZE - 1);
		memcpy(buffer, smem_reset_reason, size);
		buffer[size] = '\0';
		pr_err("%s: wcnss subsystem failure reason: %s\n",
				__func__, buffer);
		memset(smem_reset_reason, 0, smem_reset_size);
		wmb();
	}

	ss_restart_inprogress = true;
	subsystem_restart_dev(riva_8960_dev);
}
Пример #2
0
void wcnss_riva_dump_pmic_regs(void)
{
	int i, rc;
	u8  val;

	for (i = 0; i < ARRAY_SIZE(wcnss_pmic_reg_dump); i++) {
		val = 0;
		rc = pm8xxx_read_register(wcnss_pmic_reg_dump[i].reg_addr,
				&val);
		if (rc)
			pr_err("PMIC READ: Failed to read addr = %d\n",
					wcnss_pmic_reg_dump[i].reg_addr);
		else
			pr_err("PMIC READ: addr = %x, value = %x\n",
					wcnss_pmic_reg_dump[i].reg_addr, val);
	}
}