@@ -617,12 +617,6 @@ static int mali_c55_check_hwcfg(struct mali_c55 *mali_c55)
static void mali_c55_swap_next_config(struct mali_c55 *mali_c55)
{
struct mali_c55_context *ctx = mali_c55_get_active_context(mali_c55);
- u32 curr_config;
-
- curr_config = mali_c55_read(mali_c55, MALI_C55_REG_PING_PONG_READ);
- curr_config = (curr_config & MALI_C55_REG_PING_PONG_READ_MASK)
- >> (ffs(MALI_C55_REG_PING_PONG_READ_MASK) - 1);
- mali_c55->next_config = curr_config ^ 1;
mali_c55_config_write(ctx, mali_c55->next_config ?
MALI_C55_CONFIG_PING : MALI_C55_CONFIG_PONG,
@@ -644,6 +638,7 @@ static irqreturn_t mali_c55_isr(int irq, void *context)
struct mali_c55 *mali_c55 = dev_get_drvdata(dev);
u32 interrupt_status;
unsigned int i, j;
+ u32 curr_config;
interrupt_status = mali_c55_read(mali_c55,
MALI_C55_REG_INTERRUPT_STATUS_VECTOR);
@@ -666,6 +661,22 @@ static irqreturn_t mali_c55_isr(int irq, void *context)
for (j = i; j < MALI_C55_NUM_CAP_DEVS; j++)
mali_c55_set_next_buffer(&mali_c55->cap_devs[j]);
+ /*
+ * When the ISP starts a frame we have some work to do:
+ *
+ * 1. Copy over the config for the **next** frame
+ * 2. Read out the metering stats for the **last** frame
+ */
+
+ curr_config = mali_c55_read(mali_c55,
+ MALI_C55_REG_PING_PONG_READ);
+ curr_config &= MALI_C55_REG_PING_PONG_READ_MASK;
+ curr_config >>= ffs(MALI_C55_REG_PING_PONG_READ_MASK) - 1;
+ mali_c55->next_config = curr_config ^ 1;
+
+ mali_c55_stats_fill_buffer(mali_c55,
+ mali_c55->next_config ? MALI_C55_CONFIG_PING :
+ MALI_C55_CONFIG_PONG);
mali_c55_swap_next_config(mali_c55);
break;