From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796387395; b=eT+/2Y26baoIlTtOK/ePn2yJNXEV/xDMHcj37kGicbfB3u9ebiU9BaFG5PChYi5tei/+ /Ncs1TVBCtua3rFPcje7cBZelQFowMx8qSsVWLxoHoEVKnlQ2AWtnN/WMsfujwf7pMnHW pCZD+iaZYNvYEYUpM0oZnSmeNm0TR/XPmmYZ4w6bnJJOLZIO9+duh2/prXJvGchAN07r4 fC5AuFpNMvJ6P6vPt0YPL5FbHFFFbenCHS5Sv6DtNrFtse2eu8P+2p4s08Y7dxk8s4Uit o3ICXCvdKTj1ByMR+snF+zpzafwaHvFJneraCy+KNiEhdCadIgaK5bwzQaoMLi+zoEw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796387395; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=zFkaTjNTBCSHT6Y/GS0H3AdiirfMGbIZ3XVh+feeQWU=; b=4O7UE9NvxKjZ9PovnVq0mpTRFaZ6M4aV7aL9rVOVI1xSVapvxGQjQN+sYFM91zG2jWHa M06xdMg/Gm7VR7bOQR4GeAxrU8ezZhCSu8AI+061dDVNYb1rbUv6cU7KfB8t65CKeFhBX SMyWLgR4XQidWfgTyKRaYayN1NQhJ0ql1dsU9HBmX7fSmbrlYc0hISmUbrGpvYl4Cb9x3 WXDVcnkZ5CmVG54oxpLq4iGyDTf5d3OGKUbDmOTt3YLJwmuX0k03ChzsbDcOydgWwbaAH K5x/+oGJvzSHh1OGPGyDEAw8xogFxbuWBRFkT/22aZbduk3aM/W2LQEsuytHauiPuMw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=2lhtpM9Q; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2A415606A322; Fri, 4 Dec 2026 12:29:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=2lhtpM9Q Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C23D1F000CE; Fri, 4 Dec 2026 12:29:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796387394; bh=zFkaTjNTBCSHT6Y/GS0H3AdiirfMGbIZ3XVh+feeQWU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=2lhtpM9QvxSVddVDZvN5fly0jEKo/1ZYn1i6QOmvk58NPohNTAqrjCQ3MNTiOb3nZ ujee3k4zSiSAU8ve56pBpDc5HHBcfnNN6lGPRyp9zOc9omMJTqESmAinQY8QYtXIei LwDsEZujDCKaUNJYp8mGfrFc+OB6Z48j+T7d6rcI= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Balakrishnan Sambath , Eugen Hristev , Hans Verkuil , Sasha Levin Subject: [PATCH 6.1 0225/1059] media: microchip-isc: disable histogram and flush AWB work on teardown Date: Fri, 4 Dec 2026 18:55:56 +0900 Message-ID: <20261204100650.103119288@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Balakrishnan Sambath [ Upstream commit 00d87c379915a3689b2488bd37f490875d79e20f ] isc_stop_streaming() and the isc_start_streaming() error path dropped the runtime PM reference with the histogram still enabled. A HISDONE firing just before the stop, or a failed isc_update_profile() on the start path, can queue isc_awb_work(), which reads the histogram registers before taking its own PM reference and faults on the unclocked device. Disable the histogram, synchronize the IRQ and flush the work before the device is left unclocked. isc_configure() is the one enabling the histogram and then calling isc_update_profile(), so do the cleanup in its own failure path; isc_stop_streaming() does the same on teardown. synchronize_irq() must come before cancel_work_sync(), so an in-flight handler cannot re-queue awb_work after it is cancelled. Fixes: 93d4a26c3dab ("[media] atmel-isc: add the isc pipeline function") Cc: stable@vger.kernel.org Signed-off-by: Balakrishnan Sambath Reviewed-by: Eugen Hristev Signed-off-by: Hans Verkuil Signed-off-by: Sasha Levin --- drivers/media/platform/atmel/atmel-isc-base.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/atmel/atmel-isc-base.c b/drivers/media/platform/atmel/atmel-isc-base.c index 7ebd2f1cad9ae..db57077ecc31c 100644 --- a/drivers/media/platform/atmel/atmel-isc-base.c +++ b/drivers/media/platform/atmel/atmel-isc-base.c @@ -300,6 +300,7 @@ static int isc_configure(struct isc_device *isc) struct regmap *regmap = isc->regmap; u32 pfe_cfg0, dcfg, mask, pipeline; struct isc_subdev_entity *subdev = isc->current_subdev; + int ret; pfe_cfg0 = isc->config.sd_format->pfe_cfg0_bps; pipeline = isc->config.bits_pipeline; @@ -332,7 +333,15 @@ static int isc_configure(struct isc_device *isc) isc_set_histogram(isc, false); /* Update profile */ - return isc_update_profile(isc); + ret = isc_update_profile(isc); + if (ret) { + /* flush the histogram work before the clocks are gated */ + isc_set_histogram(isc, false); + synchronize_irq(isc->irq); + cancel_work_sync(&isc->awb_work); + } + + return ret; } static int isc_start_streaming(struct vb2_queue *vq, unsigned int count) @@ -423,9 +432,13 @@ static void isc_stop_streaming(struct vb2_queue *vq) /* Disable DMA interrupt */ regmap_write(isc->regmap, ISC_INTDIS, ISC_INT_DDONE); + isc_set_histogram(isc, false); + /* let a running IRQ handler finish before the clock is disabled */ synchronize_irq(isc->irq); + cancel_work_sync(&isc->awb_work); + pm_runtime_put_sync(isc->dev); /* Disable stream on the sub device */ -- 2.53.0