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

Commit edc38353 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "power: qpnp-fg-gen3: Use DMA grant interrupt efficiently"

parents e2260db0 2d385064
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -328,7 +328,8 @@
				reg = <0x4400 0x100>;
				interrupts = <0x2 0x44 0x0 IRQ_TYPE_EDGE_BOTH>,
					     <0x2 0x44 0x1 IRQ_TYPE_EDGE_BOTH>,
					     <0x2 0x44 0x2 IRQ_TYPE_EDGE_BOTH>;
					     <0x2 0x44 0x2
							IRQ_TYPE_EDGE_RISING>;
				interrupt-names = "ima-rdy",
						  "mem-xcp",
						  "dma-grant";
+1 −0
Original line number Diff line number Diff line
@@ -507,6 +507,7 @@ extern int fg_direct_mem_write(struct fg_chip *chip, u16 address,
extern int fg_read(struct fg_chip *chip, int addr, u8 *val, int len);
extern int fg_write(struct fg_chip *chip, int addr, u8 *val, int len);
extern int fg_masked_write(struct fg_chip *chip, int addr, u8 mask, u8 val);
extern int fg_dump_regs(struct fg_chip *chip);
extern int fg_ima_init(struct fg_chip *chip);
extern int fg_dma_init(struct fg_chip *chip);
extern int fg_clear_ima_errors_if_any(struct fg_chip *chip, bool check_hw_sts);
+1 −0
Original line number Diff line number Diff line
@@ -792,6 +792,7 @@ static int fg_direct_mem_request(struct fg_chip *chip, bool request)
		} else {
			pr_err("wait for mem_grant timed out ret=%d\n",
				ret);
			fg_dump_regs(chip);
		}
	}

+27 −0
Original line number Diff line number Diff line
@@ -492,6 +492,33 @@ int fg_masked_write(struct fg_chip *chip, int addr, u8 mask, u8 val)
	return rc;
}

int fg_dump_regs(struct fg_chip *chip)
{
	int i, rc;
	u8 buf[256];

	if (!chip)
		return -EINVAL;

	rc = fg_read(chip, chip->batt_soc_base, buf, sizeof(buf));
	if (rc < 0)
		return rc;

	pr_info("batt_soc_base registers:\n");
	for (i = 0; i < sizeof(buf); i++)
		pr_info("%04x:%02x\n", chip->batt_soc_base + i, buf[i]);

	rc = fg_read(chip, chip->mem_if_base, buf, sizeof(buf));
	if (rc < 0)
		return rc;

	pr_info("mem_if_base registers:\n");
	for (i = 0; i < sizeof(buf); i++)
		pr_info("%04x:%02x\n", chip->mem_if_base + i, buf[i]);

	return 0;
}

int64_t twos_compliment_extend(int64_t val, int sign_bit_pos)
{
	int i, nbytes = DIV_ROUND_UP(sign_bit_pos, 8);
+1 −2
Original line number Diff line number Diff line
@@ -4117,7 +4117,6 @@ static irqreturn_t fg_dma_grant_irq_handler(int irq, void *data)
	}

	fg_dbg(chip, FG_IRQ, "irq %d triggered, status:%d\n", irq, status);
	if (status & MEM_GNT_BIT)
	complete_all(&chip->mem_grant);

	return IRQ_HANDLED;