From patchwork Wed Nov 6 10:05:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Scally X-Patchwork-Id: 841979 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 14BF51DD889; Wed, 6 Nov 2024 10:06:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730887575; cv=none; b=VDDNPmcg17KKK07X96Xw8Eyq6QI+LktE1G7rrUI/c+V3cz/7+YLdUpNWr4AT289pZ5+lWGh/Iodb4s+TZ15P09q2DOG8biwRrJCvcsSQKqrjwLR9v0KPymJgk8OoVNxE9frznFEQLGctlSAtrn0lUKzoneKVr1GNaZgHfK+Qvs4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730887575; c=relaxed/simple; bh=GIh8ffFOaeFmTPT3AaowZKFMAhna0qeJyLGXGIJyY9g=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=D02G0P7LlH8S7eEyFCheQmQlEs6HtjtuCJlnGVVJQ9QH4uUIsB56pDQV4cCOnky3eooe7yjZj99oh5XB1p/UIKZRoTSkbDTDuPXzDLfxafYr9evcZuuQzbzNRswQodCcryZM4pkzin2ueq9bPavPdSuWAmtGfKbanILL6jF4gJc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=jrC3ON2m; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="jrC3ON2m" Received: from mail.ideasonboard.com (cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net [86.13.91.161]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id AEC061F0D; Wed, 6 Nov 2024 11:05:42 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1730887543; bh=GIh8ffFOaeFmTPT3AaowZKFMAhna0qeJyLGXGIJyY9g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jrC3ON2mh+aevAjPt62cCeckCgCAxf/mFHSOFvnAX7kql0dBdqz0nku739nEQFOIq sWOrw0ev4yWjETKYTFZPVvhk8D5JeEQhgBQNRSBn2UPPjSOfS0Nw4VyxFJh8XkKV5F KOU9YGVirMKpr+eAkJSX/6I4Br6EEG7FgZGUnskA= From: Daniel Scally To: linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Anthony.McGivern@arm.com, jacopo.mondi@ideasonboard.com, nayden.kanchev@arm.com, robh+dt@kernel.org, mchehab@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, jerome.forissier@linaro.org, kieran.bingham@ideasonboard.com, laurent.pinchart@ideasonboard.com, sakari.ailus@iki.fi, Daniel Scally Subject: [PATCH v8 12/17] media: platform: Fill stats buffer on ISP_START Date: Wed, 6 Nov 2024 10:05:29 +0000 Message-Id: <20241106100534.768400-13-dan.scally@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241106100534.768400-1-dan.scally@ideasonboard.com> References: <20241106100534.768400-1-dan.scally@ideasonboard.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On ISP_START, fill the stats buffer by reading out the metering space in the ISP's memory. This is done for the non-active config just as the dma transfer of the registers is. To acheive that, move the checking of the current config outside of mali_c55_swap_next_config() so we can use it for both functions. Acked-by: Nayden Kanchev Co-developed-by: Jacopo Mondi Signed-off-by: Jacopo Mondi Signed-off-by: Daniel Scally --- Changes in v8: - None Changes in v7: - Reworked how the config is swapped on ISP start Changes in v6: - None Changes in v5: - New patch .../platform/arm/mali-c55/mali-c55-core.c | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/arm/mali-c55/mali-c55-core.c b/drivers/media/platform/arm/mali-c55/mali-c55-core.c index b225d41f8000..8c6cae9a3a4d 100644 --- a/drivers/media/platform/arm/mali-c55/mali-c55-core.c +++ b/drivers/media/platform/arm/mali-c55/mali-c55-core.c @@ -625,12 +625,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, @@ -651,6 +645,7 @@ static irqreturn_t mali_c55_isr(int irq, void *context) struct device *dev = context; struct mali_c55 *mali_c55 = dev_get_drvdata(dev); u32 interrupt_status; + u32 curr_config; unsigned int i; interrupt_status = mali_c55_read(mali_c55, @@ -675,6 +670,22 @@ static irqreturn_t mali_c55_isr(int irq, void *context) if (mali_c55->capabilities & MALI_C55_GPS_DS_PIPE_FITTED) mali_c55_set_next_buffer(&mali_c55->cap_devs[MALI_C55_CAP_DEV_DS]); + /* + * 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;