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

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

Merge "msm: npu: Add SSR support"

parents 804b77d9 fa8fee30
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -225,6 +225,7 @@ struct npu_device {
	struct npu_regulator regulators[NPU_MAX_DT_NAME_LEN];

	struct npu_irq irq[NPU_MAX_IRQ];
	bool irq_enabled;

	struct device *cb_device;

+0 −11
Original line number Diff line number Diff line
@@ -370,17 +370,6 @@ static ssize_t npu_debug_ctrl_write(struct file *file,
	} else if (strcmp(buf, "off") == 0) {
		NPU_INFO("triggering fw_deinit\n");
		disable_fw(npu_dev);
	} else if (strcmp(buf, "ssr") == 0) {
		NPU_INFO("trigger error irq\n");
		if (npu_enable_core_power(npu_dev))
			return -EPERM;

		REGW(npu_dev, NPU_MASTERn_ERROR_IRQ_SET(1), 2);
		REGW(npu_dev, NPU_MASTERn_ERROR_IRQ_SET(0), 2);
		npu_disable_core_power(npu_dev);
	} else if (strcmp(buf, "ssr_wdt") == 0) {
		NPU_INFO("trigger wdt irq\n");
		npu_disable_post_pil_clocks(npu_dev);
	} else if (strcmp(buf, "loopback") == 0) {
		NPU_DBG("loopback test\n");
		rc = npu_host_loopback_test(npu_dev);
+12 −0
Original line number Diff line number Diff line
@@ -762,6 +762,11 @@ int npu_enable_irq(struct npu_device *npu_dev)
	int i;
	uint32_t reg_val;

	if (npu_dev->irq_enabled) {
		NPU_WARN("Irq is enabled already\n");
		return 0;
	}

	/* setup general irq */
	reg_val = npu_cc_reg_read(npu_dev,
		NPU_CC_NPU_MASTERn_GENERAL_IRQ_OWNER(0));
@@ -781,6 +786,7 @@ int npu_enable_irq(struct npu_device *npu_dev)
			NPU_DBG("enable irq %d\n", npu_dev->irq[i].irq);
		}
	}
	npu_dev->irq_enabled = true;

	return 0;
}
@@ -790,6 +796,11 @@ void npu_disable_irq(struct npu_device *npu_dev)
	int i;
	uint32_t reg_val;

	if (!npu_dev->irq_enabled) {
		NPU_WARN("irq is not enabled\n");
		return;
	}

	for (i = 0; i < NPU_MAX_IRQ; i++) {
		if (npu_dev->irq[i].irq != 0) {
			disable_irq(npu_dev->irq[i].irq);
@@ -809,6 +820,7 @@ void npu_disable_irq(struct npu_device *npu_dev)
		reg_val);
	npu_cc_reg_write(npu_dev, NPU_CC_NPU_MASTERn_GENERAL_IRQ_CLEAR(0),
		RSC_SHUTDOWN_REQ_IRQ_ENABLE | RSC_BRINGUP_REQ_IRQ_ENABLE);
	npu_dev->irq_enabled = false;
}

/* -------------------------------------------------------------------------
+0 −19
Original line number Diff line number Diff line
@@ -372,25 +372,6 @@ void npu_mem_unmap(struct npu_client *client, int buf_hdl, uint64_t addr)
	npu_free_npu_ion_buffer(client, buf_hdl);
}

/* -------------------------------------------------------------------------
 * Functions - Work Queue
 * -------------------------------------------------------------------------
 */
void npu_destroy_wq(struct workqueue_struct *wq)
{
	destroy_workqueue(wq);
}

struct workqueue_struct *npu_create_wq(struct npu_host_ctx *host_ctx,
	const char *name, wq_hdlr_fn hdlr, struct work_struct *irq_work)
{
	struct workqueue_struct *wq = create_workqueue(name);

	INIT_WORK(irq_work, hdlr);

	return wq;
}

/* -------------------------------------------------------------------------
 * Functions - Features
 * -------------------------------------------------------------------------
+0 −5
Original line number Diff line number Diff line
@@ -43,7 +43,6 @@ struct npu_ion_buf_t;
struct npu_host_ctx;
struct npu_client;
typedef irqreturn_t (*intr_hdlr_fn)(int32_t irq, void *ptr);
typedef void (*wq_hdlr_fn) (struct work_struct *work);

/* -------------------------------------------------------------------------
 * Function Prototypes
@@ -76,10 +75,6 @@ void npu_interrupt_ack(struct npu_device *npu_dev, uint32_t intr_num);
int32_t npu_interrupt_raise_m0(struct npu_device *npu_dev);
int32_t npu_interrupt_raise_dsp(struct npu_device *npu_dev);

struct workqueue_struct *npu_create_wq(struct npu_host_ctx *host_ctx,
	const char *name, wq_hdlr_fn hdlr, struct work_struct *irq_work);
void npu_destroy_wq(struct workqueue_struct *wq);

uint8_t npu_hw_clk_gating_enabled(void);
uint8_t npu_hw_log_enabled(void);

Loading