From nobody Sat Jul 25 00:54:31 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 E9EE73546EC; Tue, 21 Jul 2026 13:25:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784640356; cv=none; b=CUaeqNjskMntOm64amXQfshi55iiiEbTTqeyE7XRYA1i/A1uUPYyl2Agu2v/IIWnx8vF8TYMz9+FwR1WFrA74XAyUzZ6HFR87tb1l38NUbvCxbLNZrFIfOQ2ETod8drnbE84VCGlwwUW8E1roZUnuJjtPIlorzanZfGvTsuO42o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784640356; c=relaxed/simple; bh=ugVEoD7zwl1bbihPti6RaOArdqZkCFDAWPSM9jzL53c=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=B0t4uzbIChmVtdWABgo/rW19PPmL6qEGmNEBauAR0vLiVGHdpZOi2SDiPS+SZc9PGfLBeVv3l1uGf/setMIPXwL0UnrhWSNRN9TbNTcMmyM9/svSzMEfanViGQEiomdmwm/6AsoFidpRWr8OzDHP8fpWjx/aH7P51b44FqBL9cA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=I4db5maa; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="I4db5maa" Received: by smtp.kernel.org (Postfix) with ESMTPS id 9C54FC2BCC7; Tue, 21 Jul 2026 13:25:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux.dev; s=korg; t=1784640355; bh=ugVEoD7zwl1bbihPti6RaOArdqZkCFDAWPSM9jzL53c=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=I4db5maawhZGExoGwae/IOq8aOeYIsc2iY71tWCVBtmO2Mz/BbjFvLPuho8x0G/b6 0yvMImrkU6qMOkCaAiVF0pWULbSwNkscNAWUOVGCN9t7xuc2GQTGaktHPO1J+1syq4 i4TY7wmSpntfjFxznrSsD4fui9/IHNKt76LCx3Vw= Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B4C0C44532; Tue, 21 Jul 2026 13:25:55 +0000 (UTC) From: Richard Leitner Date: Tue, 21 Jul 2026 15:25:28 +0200 Subject: [PATCH 1/2] media: v4l2-cci: Add support for custom regmap configuration Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260721-cci-single-v1-1-8485171e1393@linux.dev> References: <20260721-cci-single-v1-0-8485171e1393@linux.dev> In-Reply-To: <20260721-cci-single-v1-0-8485171e1393@linux.dev> To: Mauro Carvalho Chehab , Sakari Ailus , Dave Stevenson Cc: Laurent Pinchart , Hans de Goede , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Richard Leitner X-Mailer: b4 0.16-dev X-Developer-Signature: v=1; a=ed25519-sha256; t=1784640354; l=4677; i=richard.leitner@linux.dev; s=20250225; h=from:subject:message-id; bh=ugVEoD7zwl1bbihPti6RaOArdqZkCFDAWPSM9jzL53c=; b=SI4foG9zLBL8u2AePY1XlkE8pH8li4kMsRKTN2jiL7TjzfjEGsFzC8jkv4d9PjIQsxNJXKpHL GAe34kj/SxoC+3j53TGXBGfx8PQTHUjO4bpEzg+rmERRWVK0oPoCEb5 X-Developer-Key: i=richard.leitner@linux.dev; a=ed25519; pk=8hZNyyyQFqZ5ruVJsSGBSPIrmJpfDm5HwHU4QVOP1Pk= X-Endpoint-Received: by B4 Relay for richard.leitner@linux.dev/20250225 with auth_id=350 Some sensors, e.g. OV9282, require custom regmap configuration like setting use_single_read. Therefore introduce a new custom cci configuration struct, which exposes optional transport-specific regmap configuration for I2C devices using the cci_*() register access helpers. The existing devm_cci_regmap_init_i2c function is changed to use the newly introduced devm_cci_regmap_init_i2c_cfg and its return value documentation is fixed. Signed-off-by: Richard Leitner --- drivers/media/v4l2-core/v4l2-cci.c | 23 +++++++++++++++++++---- include/media/v4l2-cci.h | 37 ++++++++++++++++++++++++++++++++++= ++- 2 files changed, 55 insertions(+), 5 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-cci.c b/drivers/media/v4l2-core/v= 4l2-cci.c index e9ecf47859465..584ca080bc6e5 100644 --- a/drivers/media/v4l2-core/v4l2-cci.c +++ b/drivers/media/v4l2-core/v4l2-cci.c @@ -183,18 +183,33 @@ int cci_multi_reg_write(struct regmap *map, const str= uct cci_reg_sequence *regs, EXPORT_SYMBOL_GPL(cci_multi_reg_write); =20 #if IS_ENABLED(CONFIG_V4L2_CCI_I2C) -struct regmap *devm_cci_regmap_init_i2c(struct i2c_client *client, - int reg_addr_bits) +struct regmap *devm_cci_regmap_init_i2c_cfg(struct i2c_client *client, + const struct cci_regmap_config *cci_cfg) { - struct regmap_config config =3D { - .reg_bits =3D reg_addr_bits, + const struct regmap_config config =3D { + .reg_bits =3D cci_cfg->reg_addr_bits, .val_bits =3D 8, .reg_format_endian =3D REGMAP_ENDIAN_BIG, .disable_locking =3D true, + .use_single_read =3D cci_cfg->use_single_read, + .use_single_write =3D cci_cfg->use_single_write, }; =20 return devm_regmap_init_i2c(client, &config); } +EXPORT_SYMBOL_GPL(devm_cci_regmap_init_i2c_cfg); + +struct regmap *devm_cci_regmap_init_i2c(struct i2c_client *client, + int reg_addr_bits) +{ + const struct cci_regmap_config cci_cfg =3D { + .reg_addr_bits =3D reg_addr_bits, + .use_single_read =3D false, + .use_single_write =3D false, + }; + + return devm_cci_regmap_init_i2c_cfg(client, &cci_cfg); +} EXPORT_SYMBOL_GPL(devm_cci_regmap_init_i2c); #endif =20 diff --git a/include/media/v4l2-cci.h b/include/media/v4l2-cci.h index 4e96e90ee6369..8296a8c122b4d 100644 --- a/include/media/v4l2-cci.h +++ b/include/media/v4l2-cci.h @@ -27,6 +27,27 @@ struct cci_reg_sequence { u64 val; }; =20 +/** + * struct cci_regmap_config - Optional configuration for CCI I2C regmap cr= eation + * + * @reg_addr_bits: Number of bits in the register address. + * @use_single_read: Force single-register read transactions. + * @use_single_write: Force single-register write transactions. + * + * This structure describes optional transport-specific regmap configurati= on for + * I2C devices using the cci_*() register access helpers. + * + * The CCI helper initializes the underlying regmap with the CCI defaults: + * 16-bit or 8-bit register addresses as selected by @reg_addr_bits, 8-bit + * register values, big-endian register address formatting, and disabled + * regmap locking. + */ +struct cci_regmap_config { + int reg_addr_bits; + bool use_single_read; + bool use_single_write; +}; + /* * Macros to define register address with the register width encoded * into the higher bits. @@ -123,6 +144,20 @@ int cci_multi_reg_write(struct regmap *map, const stru= ct cci_reg_sequence *regs, unsigned int num_regs, int *err); =20 #if IS_ENABLED(CONFIG_V4L2_CCI_I2C) +/** + * devm_cci_regmap_init_i2c_cfg() - Create regmap with a custom config to = use + * with cci_*() register access functions + * + * @client: i2c_client to create the regmap for + * @config: Configuration for CCI register map. + * + * Note the memory for the created regmap is devm() managed, tied to the c= lient. + * + * Return: a pointer to the regmap on success, or an ERR_PTR() encoded err= or on failure. + */ +struct regmap *devm_cci_regmap_init_i2c_cfg(struct i2c_client *client, + const struct cci_regmap_config *config); + /** * devm_cci_regmap_init_i2c() - Create regmap to use with cci_*() register * access functions @@ -132,7 +167,7 @@ int cci_multi_reg_write(struct regmap *map, const struc= t cci_reg_sequence *regs, * * Note the memory for the created regmap is devm() managed, tied to the c= lient. * - * Return: %0 on success or a negative error code on failure. + * Return: a pointer to the regmap on success, or an ERR_PTR() encoded err= or on failure. */ struct regmap *devm_cci_regmap_init_i2c(struct i2c_client *client, int reg_addr_bits); --=20 2.53.0 From nobody Sat Jul 25 00:54:31 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 EA00936213D; Tue, 21 Jul 2026 13:25:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784640356; cv=none; b=Y7vWVJHRYqcrzUzsXvbGd0lWTJlIFNWFf496rGu1HyOBWBTcWGPSfoocrpRHj6yv+4eeVwFzmJpXx9YF9tUHvHA9dWCG0bq5xgltzH3/Z1IKpe1oN0emKnDzn4DFJCbdV7xbWcRZX2TSDfeOQCTWokfE7uIeaELnezvcoIuShck= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784640356; c=relaxed/simple; bh=Au+IQ66lMemkOeUGsHPOhBih0jjxOIJGUEK2eyo1odI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=kZImXSWNRz33z8xpe/nBeuLw/s1t5pEQsG7tZACveAkQiJRBkrdYRNHRdG8m+pNM/+IVMLfIuUFb4zWhZWtOFAQk2WjEUkpdu1rcPboJ0AoAYOQBnprSWqJfUW91Wp1WP+EGh+Mn7Q91s1L1ePoBV+i//R1S6RQ2OPdGybgp7Q0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=MUTkjeqP; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="MUTkjeqP" Received: by smtp.kernel.org (Postfix) with ESMTPS id B091EC2BCFA; Tue, 21 Jul 2026 13:25:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux.dev; s=korg; t=1784640355; bh=Au+IQ66lMemkOeUGsHPOhBih0jjxOIJGUEK2eyo1odI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=MUTkjeqPkrpwdmtsItiuIRNx8cEr5yd2OdzbUZ7d7wAaHsDnJfORPJyAioOCv4SWC HtlDeC8ecSxrOOwxA7F3Na+E6SOjnI6iJbG7xFANu5PnqYYblBl6O2+7wP+B9nYst5 y652eOWR6VaaCtZHagshsPOcUD4v85LDni7PU3MQ= Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 93531C44533; Tue, 21 Jul 2026 13:25:55 +0000 (UTC) From: Richard Leitner Date: Tue, 21 Jul 2026 15:25:29 +0200 Subject: [PATCH 2/2] media: ov9282: enable single-read I2C transactions Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260721-cci-single-v1-2-8485171e1393@linux.dev> References: <20260721-cci-single-v1-0-8485171e1393@linux.dev> In-Reply-To: <20260721-cci-single-v1-0-8485171e1393@linux.dev> To: Mauro Carvalho Chehab , Sakari Ailus , Dave Stevenson Cc: Laurent Pinchart , Hans de Goede , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Richard Leitner X-Mailer: b4 0.16-dev X-Developer-Signature: v=1; a=ed25519-sha256; t=1784640354; l=1545; i=richard.leitner@linux.dev; s=20250225; h=from:subject:message-id; bh=Au+IQ66lMemkOeUGsHPOhBih0jjxOIJGUEK2eyo1odI=; b=M3iizulti+IZgsJg2TCFn3/otsTH0GHXiSPPlzfCOP42UEsdbM+1MjoYXcSV1Nttx5HwFEfLS gIkTHd8s06RC65ZNmkfGDh/aW2gmWPquUZTMFN+B8D4iiE3keNl/ZUM X-Developer-Key: i=richard.leitner@linux.dev; a=ed25519; pk=8hZNyyyQFqZ5ruVJsSGBSPIrmJpfDm5HwHU4QVOP1Pk= X-Endpoint-Received: by B4 Relay for richard.leitner@linux.dev/20250225 with auth_id=350 Some OV9282 camera modules, such as those from Vision Components, fail multi-byte register reads with the default CCI I2C regmap access pattern and only work when single-register read transactions are used. This results in the driver being unable to probe due to a chip id mismatch. As the driver has no reliable way to identify affected modules enable use_single_read for OV9282 unconditionally when creating the CCI regmap. Tested on an i.M8MP system with OV9282 modules from Vision Components. Signed-off-by: Richard Leitner Acked-by: Dave Stevenson --- drivers/media/i2c/ov9282.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/media/i2c/ov9282.c b/drivers/media/i2c/ov9282.c index 5b6f897a74fcd..8267a0a9c6f2d 100644 --- a/drivers/media/i2c/ov9282.c +++ b/drivers/media/i2c/ov9282.c @@ -1283,6 +1283,11 @@ static int ov9282_probe(struct i2c_client *client) struct ov9282 *ov9282; int ret; =20 + const struct cci_regmap_config config =3D { + .reg_addr_bits =3D 16, + .use_single_read =3D true, + }; + ov9282 =3D devm_kzalloc(&client->dev, sizeof(*ov9282), GFP_KERNEL); if (!ov9282) return -ENOMEM; @@ -1301,7 +1306,7 @@ static int ov9282_probe(struct i2c_client *client) return ret; } =20 - ov9282->regmap =3D devm_cci_regmap_init_i2c(client, 16); + ov9282->regmap =3D devm_cci_regmap_init_i2c_cfg(client, &config); if (IS_ERR(ov9282->regmap)) return dev_err_probe(ov9282->dev, PTR_ERR(ov9282->regmap), "Failed to init CCI\n"); --=20 2.53.0