From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=185.70.43.100 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795943067; b=LB7GaAg4m71gCsjqpCf0dg76DS4l3zUO1nHDXnLeihUP9d0p/6FhnQRMSpjZoag/hv0L vLP5ACNYUlND2M1UZWDJ8l8urwqStlWJlojyUJtn6zjFonJ/8ECWx4JKtyzIVrMnhKszv 53Yuy1iXv7+sIH1SJ/QCZodqlzcON9O8KTX3CYFJIqjn5+53OuiTMRexcGvDohpTQV8n7 xhl88nvNmlWBhSDwLUbeiHv/V75ZkckcuLJkTLfufn3JBr4MAAUPYnl9H10cm0s/WsKg+ yCHfS2SKyRyeCVm8PN9JDUmdZcuFqahzTKGtuODVDSZ0WAob1X1x9l5u/fv3cEfZgvA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795943067; h=DMARC-Filter:DKIM-Signature:Date:To:From:Cc:Subject:Message-ID: Feedback-ID:X-Pm-Message-ID:MIME-Version:Content-Type: Content-Transfer-Encoding; bh=oRXWY4TFCg9LvtEqxcbVC1iCw6ATVWZPcDB0QgwXPIw=; b=jQQZsrkA0UjYKuVhHhAOlOoayBFhUVSkNPvfmrIlRyAPNiUHLFC0my2OCcMunhAcGdKv hHKFgs50fLepmekTMd/QA7hl5GlhQwmK7GPzqFiN62M8gXRiLvD95q7oS4nlM6nEhXI4e t7DnWNSdzlLCJ6Op8v3qlEmqerqmJKng7EZ9ewCdLfUy8JNSauoG8eRXxcb/YGbvu+wZG wZgVUFExGBTSt0Yw40nePlA912YJaGB9FbHV/gXx/psH/Aw7F7WLorqFw6N0IZxshxVFL 5+s2YzrK9oUwD06UTdKJNIiCJ0Fy6yESBb3Ww2ny/iaH6qbnSDHlAshY0r6HNjNNRJQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=pm.me; spf=pass smtp.mailfrom=pm.me; dkim=pass header.d=pm.me header.i=@pm.me header.a=rsa-sha256 header.s=protonmail3 header.b=jebuYoSH; arc=none smtp.remote-ip=185.70.43.100 Received: from mail-43100.protonmail.ch (mail-43100.protonmail.ch [185.70.43.100]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8B40D606A31C; Sun, 29 Nov 2026 09:04:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 8B40D606A31C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=pm.me Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pm.me Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pm.me header.i=@pm.me header.a=rsa-sha256 header.s=protonmail3 header.b=jebuYoSH DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail3; t=1795943064; x=1796202264; bh=oRXWY4TFCg9LvtEqxcbVC1iCw6ATVWZPcDB0QgwXPIw=; h=Date:To:From:Cc:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=jebuYoSHANxKtIZvsI5+75s+rB8FHC6Krc1EOVzBwuV+Ab5RP8PbBhriqlnN1r/oU VMwGprkSOZ2KF/kXiEK0+XbRWNJ5Mfd7hi0IP1ptzSvJ1PrgdH9ifmKcyl6UH+0fUC SrXvj8eaM8H1tBdDTWmTzu5NZDtkChIxN5hhhdF1IpuYP732VWzJXmuRFVDyEDSPXC 6fk/A/MmDneDUmEjpJbQjl7tF7OjGDM2eTRD4Lz9qzbstV54C+gHkVd91iLbtjn0To x2awave5GPLzJIw5s9z6F5jegyiJ/sch4ptkprfNcOioEKrApSsMuV2zzJGML66EjE /ov+FQRFyK6uQ== Date: Sun, 29 Nov 2026 09:04:19 +0000 To: Sakari Ailus , Mauro Carvalho Chehab From: Sergey Lebedev Cc: Hans de Goede , Emfox Zhou , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3] media: i2c: ov13858: cap analogue gain at 15.5x Message-ID: <20261129090413.57128-1-lsa.uz@pm.me> Feedback-ID: 113843758:user:proton X-Pm-Message-ID: e32250d5062daeed80dcc5bc086432267e6823cd X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable The analogue gain control is advertised up to 0x1fff, but the gain only follows it up to 0x7c0. Measured on raw Bayer at fixed exposure, on a Surface Pro 11: register requested measured 1984 15.5x 14.23x 2047 15.99x 13.71x 2048 16x 7.54x 8191 64x 14.28x At 0x800 the gain halves, and above it the gain repeats values from below 0x800, so an auto exposure loop that raises the gain can get less signal back. Cap the control at 0x7c0, as ov13b10 and ov08x40 do. Tested-by: Emfox Zhou Signed-off-by: Sergey Lebedev --- v3: - Assisted-by dropped; see the note on tool use below. The code is v2's, byte for byte. - Emfox Zhou's Tested-by from the v2 thread (Surface Pro 8, Tiger Lake, IPU6). With libcamera's auto exposure he saw the gain park at 63.99x without the patch and settle at 15.5x with it. v2: https://lore.kernel.org/all/20261002093507.43584-1-lsa.uz@pm.me/ v1: https://lore.kernel.org/all/20260831180746.68878-1-lsa.uz@pm.me/ Tool use, per Documentation/process/generated-content.rst (Assisted-by tags in commits were dropped in 7.4-rc1): * My contributions to this series were prepared with Claude Code (claude-opus-5-5); work by others in it is their own. * This replaces any Assisted-by tags in earlier versions. drivers/media/i2c/ov13858.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/i2c/ov13858.c b/drivers/media/i2c/ov13858.c index c086d529253..394f0fe097f 100644 --- a/drivers/media/i2c/ov13858.c +++ b/drivers/media/i2c/ov13858.c @@ -63,7 +63,7 @@ /* Analog gain control */ #define OV13858_REG_ANALOG_GAIN=09=090x3508 #define OV13858_ANA_GAIN_MIN=09=090 -#define OV13858_ANA_GAIN_MAX=09=090x1fff +#define OV13858_ANA_GAIN_MAX=09=090x07c0 #define OV13858_ANA_GAIN_STEP=09=091 #define OV13858_ANA_GAIN_DEFAULT=090x80 =20 --=20 2.54.0