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

Commit 5723deb4 authored by Ajit Kumar's avatar Ajit Kumar
Browse files

soc: qcom: bgspi: soft reset Blackghost on failure to resume



BGCOM driver tries for 2ms to resume BG. On failure to resume
BGCOM soft resets BG to recover.

Change-Id: Ia7d3965c8ccdb188f7cf16cad256be9bae9e3c51
Signed-off-by: default avatarAjit Kumar <kajit@codeaurora.org>
parent 9fa863fa
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@
#include <soc/qcom/subsystem_notif.h>
#include "bgcom.h"
#include "linux/bgcom_interface.h"
#include "bgcom_interface.h"
#include <linux/of.h>
#include <linux/of_gpio.h>
#include <linux/gpio.h>
@@ -176,7 +177,7 @@ static int bgchar_write_cmd(struct bg_ui_data *fui_obj_msg, int type)
	return ret;
}

static int bg_soft_reset(void)
int bg_soft_reset(void)
{
	/*pull down reset gpio */
	gpio_direction_output(bgreset_gpio, 0);
@@ -184,6 +185,7 @@ static int bg_soft_reset(void)
	gpio_set_value(bgreset_gpio, 1);
	return 0;
}
EXPORT_SYMBOL(bg_soft_reset);

static long bg_com_ioctl(struct file *filp,
		unsigned int ui_bgcom_cmd, unsigned long arg)
+22 −0
Original line number Diff line number Diff line
/* Copyright (c) 2018, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * only version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 */
#ifndef BGCOM_INTERFACE_H
#define BGCOM_INTERFACE_H

/**
 * bg_soft_reset() - soft reset Blackghost
 * Return 0 on success or -Ve on error
*/
int bg_soft_reset(void);

#endif /* BGCOM_INTERFACE_H */
+8 −1
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@
#include <linux/kthread.h>
#include "bgcom.h"
#include "bgrsb.h"
#include "bgcom_interface.h"

#define BG_SPI_WORD_SIZE (0x04)
#define BG_SPI_READ_LEN (0x04)
@@ -783,8 +784,14 @@ int bgcom_resume(void *handle)

unlock:
	mutex_unlock(&bg_resume_mutex);
	if (retry == MAX_RETRY) {
		/* BG failed to resume. Trigger BG soft reset. */
		pr_err("BG failed to resume\n");
		bg_soft_reset();
		return -ETIMEDOUT;
	}
	pr_info("BG retries for wake up : %d\n", retry);
	return (retry == MAX_RETRY ? -ETIMEDOUT : 0);
	return 0;
}
EXPORT_SYMBOL(bgcom_resume);