media: v4l2-cci/ov9282: support single-read I2C transactions
cover media: v4l2-cci/ov9282: support single-read I2C transactions
This series adds support for configuring transport-specific CCI regmap behavior for I2C sensors, which is then used in the OV9282 driver to force single-register read transactions.
The motivation for this change is that some OV9282 camera modules require single-read I2C transactions to operate correctly. In particular, OV9282 modules from Vision Components return invalid data on multi-byte reads, while switching the regmap to single-read transactions fixes the problem.
This series does not change the default behavior of existing CCI users. Only ov9282 opts into single-read transactions.
---
Richard Leitner (2):
media: v4l2-cci: Add support for custom regmap configuration
media: ov9282: enable single-read I2C transactions
drivers/media/i2c/ov9282.c | 7 ++++++- drivers/media/v4l2-core/v4l2-cci.c | 23 +++++++++++++++++++---- include/media/v4l2-cci.h | 37 ++++++++++++++++++++++++++++++++++++- 3 files changed, 61 insertions(+), 6 deletions(-)
---
base-commit: 1590cf0329716306e948a8fc29f1d3ee87d3989f
change-id: 20260717-cci-single-29bbb89775c4
Best regards,
Signature · 1 line
Richard Leitner <[email protected]>
PATCH 1/2 media: v4l2-cci: Add support for custom regmap configuration
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.
--- drivers/media/v4l2-core/v4l2-cci.c | 23 +++++++++++++++++++---- include/media/v4l2-cci.h | 37 ++++++++++++++++++++++++++++++++++++- 2 files changed, 55 insertions(+), 5 deletions(-)
drivers/media/v4l2-core/v4l2-cci.c +19 -4
@@ -183,18 +183,33 @@ int cci_multi_reg_write(struct regmap *map, const struct cci_reg_sequence *regs,EXPORT_SYMBOL_GPL (cci_multi_reg_write);#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 = { - .reg_bits = reg_addr_bits, +const struct regmap_config config = { + .reg_bits = cci_cfg->reg_addr_bits, .val_bits =8 , .reg_format_endian =REGMAP_ENDIAN_BIG , .disable_locking = true, + .use_single_read = cci_cfg->use_single_read, + .use_single_write = cci_cfg->use_single_write, };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 = { + .reg_addr_bits = reg_addr_bits, + .use_single_read = false, + .use_single_write = false, + }; + +return devm_cci_regmap_init_i2c_cfg (client, &cci_cfg); +}EXPORT_SYMBOL_GPL (devm_cci_regmap_init_i2c);#endif
include/media/v4l2-cci.h +36 -1
@@ -27,6 +27,27 @@ struct cci_reg_sequence {u64 val; }; +/** +* struct cci_regmap_config - Optional configuration for CCI I2C regmap creation +* +* @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 configuration 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 struct cci_reg_sequence *regs, unsigned int num_regs, int *err);#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 client. +* +* Return: a pointer to the regmap on success, or an ERR_PTR() encoded error 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 struct cci_reg_sequence *regs,* * Note the memory for the created regmap is devm() managed, tied to the client. * -* Return: %0 on success or a negative error code on failure. +* Return: a pointer to the regmap on success, or an ERR_PTR() encoded error on failure. */ struct regmap *devm_cci_regmap_init_i2c (struct i2c_client *client,int reg_addr_bits);
Signature · 1 line
2.53.0
PATCH 2/2 media: ov9282: enable single-read I2C transactions
In reply to Richard LeitnerSome 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.
--- drivers/media/i2c/ov9282.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/media/i2c/ov9282.c +6 -1
@@ -1283,6 +1283,11 @@ static int ov9282_probe(struct i2c_client *client)struct ov9282 *ov9282;int ret; +const struct cci_regmap_config config = { + .reg_addr_bits =16 , + .use_single_read = true, + }; + ov9282 =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; } - ov9282->regmap =devm_cci_regmap_init_i2c (client,16 ); + ov9282->regmap =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" );
Signature · 1 line
2.53.0
Re: [PATCH 2/2] media: ov9282: enable single-read I2C transactions
Hi Richard,
thanks for addressing this long-standing issue.
Am Dienstag, 21. Juli 2026, 15:25:29 CEST schrieb Richard Leitner:
Quoted 7 lines
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_readfor OV9282 unconditionally when creating the CCI regmap.
What about a property in the DT instead? In DT it should be clear if a Vision Components camera is used.
Best regards,
Alexander
Quoted 35 lines
Tested on an i.M8MP system with OV9282 modules from Vision Components.
Signed-off-by Richard Leitner <[email protected]>--- drivers/media/i2c/ov9282.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/media/i2c/ov9282.c +6
-1@@ -1283,6 +1283,11 @@ static int ov9282_probe(struct i2c_client *client)struct ov9282 *ov9282;int ret; +const struct cci_regmap_config config = { + .reg_addr_bits =16 , + .use_single_read = true, + }; + ov9282 =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; } - ov9282->regmap =devm_cci_regmap_init_i2c (client,16 ); + ov9282->regmap =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" );
Signature · 4 lines
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany Amtsgericht München, HRB 105018 Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider http://www.tq-group.com/
Re: [PATCH 2/2] media: ov9282: enable single-read I2C transactions
Quoted 10 lines · Alexander Stein
Hi Richard,
thanks for addressing this long-standing issue.
Am Dienstag, 21. Juli 2026, 15:25:29 CEST schrieb Richard Leitner:
Quoted 5 lines
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.
Quoted 5 lines
Quoted 2 lines
As the driver has no reliable way to identify affected modules enable
use_single_readfor OV9282 unconditionally when creating the CCI regmap.What about a property in the DT instead? In DT it should be clear if a Vision Components camera is used.
Yes, this should not be done by default, or we'll have to do the same for all sensors used in any module from Vision Components.
Quoted 32 lines
Quoted 32 lines
Tested on an i.M8MP system with OV9282 modules from Vision Components.
Signed-off-by Richard Leitner <[email protected]>--- drivers/media/i2c/ov9282.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/media/i2c/ov9282.c +6
-1@@ -1283,6 +1283,11 @@ static int ov9282_probe(struct i2c_client *client)struct ov9282 *ov9282;int ret; +const struct cci_regmap_config config = { + .reg_addr_bits =16 , + .use_single_read = true, + }; + ov9282 =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; } - ov9282->regmap =devm_cci_regmap_init_i2c (client,16 ); + ov9282->regmap =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" );
Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH 2/2] media: ov9282: enable single-read I2C transactions
In reply to Alexander SteinHi Alexander,
thanks for your feedback!
Quoted 10 lines · Alexander Stein
Hi Richard,
thanks for addressing this long-standing issue.
Am Dienstag, 21. Juli 2026, 15:25:29 CEST schrieb Richard Leitner:
Quoted 5 lines
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.
Quoted 5 lines
Quoted 2 lines
As the driver has no reliable way to identify affected modules enable
use_single_readfor OV9282 unconditionally when creating the CCI regmap.What about a property in the DT instead? In DT it should be clear if a Vision Components camera is used.
I've talked to Laurent about this topic (I guess a year ago or so...) and he pointed me to his downstream work regarding the vc-mipi driver (which I am currently also using):
https://gitlab.com/ideasonboard/nxp/linux/-/commits/v7.0/sensors/vcmipi
There is a new driver (and therefore DT compatible) for the controller (without the sensor) on the Vision Components board implemented. This separates basically the "regulator" part of the VC microprocessor from the "forward I2C traffic to the sensor" part. AFAICT...
Talking about that separation I vaguely remember he argued against a new device-tree property or compatible for the vcmipi variants of the ov9282. Therefore I went for the "easy" approach of just enabling single register reads.
Nonetheless if I understood this wrong or "things" changed, please feel free to correct me.
Just to be clear: I'm also perfectly fine with introducing a new "vcmipi,ov9282" compatible or something like a "quirk-vision-components" property if that's preferred.
Thanks & regards;rl
Quoted 48 lines
Best regards,
AlexanderQuoted 35 lines
Tested on an i.M8MP system with OV9282 modules from Vision Components.
Signed-off-by Richard Leitner <[email protected]>--- drivers/media/i2c/ov9282.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/media/i2c/ov9282.c +6
-1@@ -1283,6 +1283,11 @@ static int ov9282_probe(struct i2c_client *client)struct ov9282 *ov9282;int ret; +const struct cci_regmap_config config = { + .reg_addr_bits =16 , + .use_single_read = true, + }; + ov9282 =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; } - ov9282->regmap =devm_cci_regmap_init_i2c (client,16 ); + ov9282->regmap =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" );Signature · 4 lines
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany Amtsgericht München, HRB 105018 Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider http://www.tq-group.com/
Re: [PATCH 2/2] media: ov9282: enable single-read I2C transactions
Hi Richard,
Quoted 29 lines · Richard Leitner
Quoted 11 lines · Alexander Stein
Am Dienstag, 21. Juli 2026, 15:25:29 CEST schrieb Richard Leitner:
Quoted 7 lines
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_readfor OV9282 unconditionally when creating the CCI regmap.What about a property in the DT instead? In DT it should be clear if a Vision Components camera is used.
I've talked to Laurent about this topic (I guess a year ago or so...) and he pointed me to his downstream work regarding the vc-mipi driver (which I am currently also using):
https://gitlab.com/ideasonboard/nxp/linux/-/commits/v7.0/sensors/vcmipi
There is a new driver (and therefore DT compatible) for the controller (without the sensor) on the Vision Components board implemented. This separates basically the "regulator" part of the VC microprocessor from the "forward I2C traffic to the sensor" part. AFAICT...
Talking about that separation I vaguely remember he argued against a new device-tree property or compatible for the vcmipi variants of the ov9282. Therefore I went for the "easy" approach of just enabling single register reads.
Quoted 6 lines
Nonetheless if I understood this wrong or "things" changed, please feel free to correct me.
Just to be clear: I'm also perfectly fine with introducing a new "vcmipi,ov9282" compatible or something like a "quirk-vision-components" property if that's preferred.
My main concern is that I don't want to see this being handled manually in drivers. Whatever solution we decide to implement (I proposed two in a separate e-mail in this thread) should not require modifying image sensor drivers to implement logic specific to the Vision Components module. I'm fine relying on drivers using specific helpers (for instance requiring drivers to be ported to regmap or v4l2-cci in order to support the quirk).
Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
Tested on an i.M8MP system with OV9282 modules from Vision Components.
Signed-off-by Richard Leitner <[email protected]>--- drivers/media/i2c/ov9282.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/media/i2c/ov9282.c +6
-1@@ -1283,6 +1283,11 @@ static int ov9282_probe(struct i2c_client *client)struct ov9282 *ov9282;int ret; +const struct cci_regmap_config config = { + .reg_addr_bits =16 , + .use_single_read = true, + }; + ov9282 =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; } - ov9282->regmap =devm_cci_regmap_init_i2c (client,16 ); + ov9282->regmap =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" );
Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH 2/2] media: ov9282: enable single-read I2C transactions
Hi Laurent,
Quoted 39 lines · Laurent Pinchart
Hi Richard,
Quoted 29 lines · Richard Leitner
Quoted 11 lines · Alexander Stein
Am Dienstag, 21. Juli 2026, 15:25:29 CEST schrieb Richard Leitner:
Quoted 7 lines
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_readfor OV9282 unconditionally when creating the CCI regmap.What about a property in the DT instead? In DT it should be clear if a Vision Components camera is used.
I've talked to Laurent about this topic (I guess a year ago or so...) and he pointed me to his downstream work regarding the vc-mipi driver (which I am currently also using):
https://gitlab.com/ideasonboard/nxp/linux/-/commits/v7.0/sensors/vcmipi
There is a new driver (and therefore DT compatible) for the controller (without the sensor) on the Vision Components board implemented. This separates basically the "regulator" part of the VC microprocessor from the "forward I2C traffic to the sensor" part. AFAICT...
Talking about that separation I vaguely remember he argued against a new device-tree property or compatible for the vcmipi variants of the ov9282. Therefore I went for the "easy" approach of just enabling single register reads.
Quoted 6 lines
Nonetheless if I understood this wrong or "things" changed, please feel free to correct me.
Just to be clear: I'm also perfectly fine with introducing a new "vcmipi,ov9282" compatible or something like a "quirk-vision-components" property if that's preferred.
Quoted 7 lines
My main concern is that I don't want to see this being handled manually in drivers. Whatever solution we decide to implement (I proposed two in a separate e-mail in this thread) should not require modifying image sensor drivers to implement logic specific to the Vision Components module. I'm fine relying on drivers using specific helpers (for instance requiring drivers to be ported to regmap or v4l2-cci in order to support the quirk).
Sure. That makes perfect sense. I've answered that e-mail already.
Just wanted to share my current downstream solution to start the discussion ;-)
Thanks for those quick replies and feedback!
regards;rl
Quoted 38 lines
Quoted 33 lines
Quoted 33 lines
Quoted 33 lines
Tested on an i.M8MP system with OV9282 modules from Vision Components.
Signed-off-by Richard Leitner <[email protected]>--- drivers/media/i2c/ov9282.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/media/i2c/ov9282.c +6
-1@@ -1283,6 +1283,11 @@ static int ov9282_probe(struct i2c_client *client)struct ov9282 *ov9282;int ret; +const struct cci_regmap_config config = { + .reg_addr_bits =16 , + .use_single_read = true, + }; + ov9282 =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; } - ov9282->regmap =devm_cci_regmap_init_i2c (client,16 ); + ov9282->regmap =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" );Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH 2/2] media: ov9282: enable single-read I2C transactions
In reply to Laurent PinchartHi everyone,
Am Dienstag, 21. Juli 2026, 17:32:12 CEST schrieb Laurent Pinchart:
Quoted 21 lines
Hi Richard,
Quoted 18 lines · Richard Leitner
Quoted 11 lines · Alexander Stein
Am Dienstag, 21. Juli 2026, 15:25:29 CEST schrieb Richard Leitner:
Quoted 7 lines
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_readfor OV9282 unconditionally when creating the CCI regmap.What about a property in the DT instead? In DT it should be clear if a Vision Components camera is used.
I've talked to Laurent about this topic (I guess a year ago or so...) and he pointed me to his downstream work regarding the vc-mipi driver (which I am currently also using):
https://gitlab.com/ideasonboard/nxp/linux/-/commits/v7.0/sensors/vcmipi
Yep, I've also been using that one. And yes, this I2C access peculiarity has been an issue for a long time already.
Quoted 17 lines
Quoted 10 lines
There is a new driver (and therefore DT compatible) for the controller (without the sensor) on the Vision Components board implemented. This separates basically the "regulator" part of the VC microprocessor from the "forward I2C traffic to the sensor" part. AFAICT...
Talking about that separation I vaguely remember he argued against a new device-tree property or compatible for the vcmipi variants of the ov9282. Therefore I went for the "easy" approach of just enabling single register reads.
Quoted 6 lines
Nonetheless if I understood this wrong or "things" changed, please feel free to correct me.
Just to be clear: I'm also perfectly fine with introducing a new "vcmipi,ov9282" compatible or something like a "quirk-vision-components" property if that's preferred.
Quoted 7 lines
My main concern is that I don't want to see this being handled manually in drivers. Whatever solution we decide to implement (I proposed two in a separate e-mail in this thread) should not require modifying image sensor drivers to implement logic specific to the Vision Components module. I'm fine relying on drivers using specific helpers (for instance requiring drivers to be ported to regmap or v4l2-cci in order to support the quirk).
I had the idea of a generic property like 'i2c-disable-autoincrement' usable on all i2c devices. This property might be parsed in regmap-i2c (or even i2c-core) so it is enabled and available for all i2c devices without modifying any driver.
Best regards,
Alexander
Quoted 34 lines
Quoted 32 lines
Quoted 32 lines
Quoted 32 lines
Tested on an i.M8MP system with OV9282 modules from Vision Components.
Signed-off-by Richard Leitner <[email protected]>--- drivers/media/i2c/ov9282.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/media/i2c/ov9282.c +6
-1@@ -1283,6 +1283,11 @@ static int ov9282_probe(struct i2c_client *client)struct ov9282 *ov9282;int ret; +const struct cci_regmap_config config = { + .reg_addr_bits =16 , + .use_single_read = true, + }; + ov9282 =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; } - ov9282->regmap =devm_cci_regmap_init_i2c (client,16 ); + ov9282->regmap =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" );
Signature · 4 lines
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany Amtsgericht München, HRB 105018 Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider http://www.tq-group.com/
Re: [PATCH 2/2] media: ov9282: enable single-read I2C transactions
In reply to Richard LeitnerHi Richard
Quoted 5 lines · Richard Leitner
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.
Those damn stupid Vision Components modules with the MCU that prevents you reading registers.
I seem to recall Laurent had a plan for how to handle those without having to patch all the drivers, however I can't find that thread quickly.
Quoted 6 lines
As the driver has no reliable way to identify affected modules enable
use_single_readfor OV9282 unconditionally when creating the CCI regmap.Tested on an i.M8MP system with OV9282 modules from Vision Components.
Signed-off-by Richard Leitner <[email protected]>
As regmap does provide a simple way to request this behaviour, and the only read is the ID register from ov9282_detect, I'll give it an
but it's not an ideal situation. Others can debate the alternative approaches for handling VC modules.
Dave
Quoted 34 lines
--- drivers/media/i2c/ov9282.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/media/i2c/ov9282.c +6
-2@@ -1283,6 +1283,11 @@ static int ov9282_probe(struct i2c_client *client)struct ov9282 *ov9282;int ret; +const struct cci_regmap_config config = { + .reg_addr_bits =16 , + .use_single_read = true, + }; + ov9282 =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; } - ov9282->regmap =devm_cci_regmap_init_i2c (client,16 ); + ov9282->regmap =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" ); --2.53.0
Re: [PATCH 2/2] media: ov9282: enable single-read I2C transactions
Quoted 9 lines · Dave Stevenson
Quoted 5 lines · Richard Leitner
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.
Those damn stupid Vision Components modules with the MCU that prevents you reading registers.
There's good news, the situation is improving with recent modules. We still have to handle the other ones of course.
Quoted 3 lines
I seem to recall Laurent had a plan for how to handle those without having to patch all the drivers, however I can't find that thread quickly.
I'm thinking of two options:
- We can introduce a new standard DT property for I2C device that will be parsed by regmap or the I2C core directly, and switch to single reads.
- We could model the MCU as some sort of I2C mux, sitting in DT between the I2C controller and the image sensor, and translate multi-byte reads to single-byte reads in that driver.
Quoted 44 lines
Quoted 6 lines
As the driver has no reliable way to identify affected modules enable
use_single_readfor OV9282 unconditionally when creating the CCI regmap.Tested on an i.M8MP system with OV9282 modules from Vision Components.
Signed-off-by Richard Leitner <[email protected]>As regmap does provide a simple way to request this behaviour, and the only read is the ID register from
ov9282_detect, I'll give it anAcked-by Dave Stevenson <[email protected]>but it's not an ideal situation. Others can debate the alternative approaches for handling VC modules.
Quoted 29 lines
--- drivers/media/i2c/ov9282.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/media/i2c/ov9282.c +6
-1@@ -1283,6 +1283,11 @@ static int ov9282_probe(struct i2c_client *client)struct ov9282 *ov9282;int ret; +const struct cci_regmap_config config = { + .reg_addr_bits =16 , + .use_single_read = true, + }; + ov9282 =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; } - ov9282->regmap =devm_cci_regmap_init_i2c (client,16 ); + ov9282->regmap =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" );
Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH 2/2] media: ov9282: enable single-read I2C transactions
Hi Laurent,
thank you very much for your quick feedback!
Quoted 20 lines · Laurent Pinchart
Quoted 9 lines · Dave Stevenson
Quoted 5 lines · Richard Leitner
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.
Those damn stupid Vision Components modules with the MCU that prevents you reading registers.
There's good news, the situation is improving with recent modules. We still have to handle the other ones of course.
Quoted 3 lines
I seem to recall Laurent had a plan for how to handle those without having to patch all the drivers, however I can't find that thread quickly.
I'm thinking of two options:
Quoted 7 lines
- We can introduce a new standard DT property for I2C device that will be parsed by regmap or the I2C core directly, and switch to single reads.
- We could model the MCU as some sort of I2C mux, sitting in DT between the I2C controller and the image sensor, and translate multi-byte reads to single-byte reads in that driver.
I'm basically fine with both. Personally I would prefer the first option, as this would be a generic approach which other devices could also use. Furthermore it's IMHO the simpler solution. But that's just my 2 cents.
regards;rl
Quoted 50 lines
Quoted 45 lines
Quoted 7 lines
As the driver has no reliable way to identify affected modules enable
use_single_readfor OV9282 unconditionally when creating the CCI regmap.Tested on an i.M8MP system with OV9282 modules from Vision Components.
Signed-off-by Richard Leitner <[email protected]>As regmap does provide a simple way to request this behaviour, and the only read is the ID register from
ov9282_detect, I'll give it anAcked-by Dave Stevenson <[email protected]>but it's not an ideal situation. Others can debate the alternative approaches for handling VC modules.
Quoted 29 lines
--- drivers/media/i2c/ov9282.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/media/i2c/ov9282.c +6
-1@@ -1283,6 +1283,11 @@ static int ov9282_probe(struct i2c_client *client)struct ov9282 *ov9282;int ret; +const struct cci_regmap_config config = { + .reg_addr_bits =16 , + .use_single_read = true, + }; + ov9282 =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; } - ov9282->regmap =devm_cci_regmap_init_i2c (client,16 ); + ov9282->regmap =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" );Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH 2/2] media: ov9282: enable single-read I2C transactions
Quoted 29 lines · Richard Leitner
Hi Laurent,
thank you very much for your quick feedback!
Quoted 24 lines · Laurent Pinchart
Quoted 9 lines · Dave Stevenson
Quoted 5 lines · Richard Leitner
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.
Those damn stupid Vision Components modules with the MCU that prevents you reading registers.
There's good news, the situation is improving with recent modules. We still have to handle the other ones of course.
Quoted 3 lines
I seem to recall Laurent had a plan for how to handle those without having to patch all the drivers, however I can't find that thread quickly.
I'm thinking of two options:
- We can introduce a new standard DT property for I2C device that will be parsed by regmap or the I2C core directly, and switch to single reads.
Quoted 7 lines
Quoted 3 lines
- We could model the MCU as some sort of I2C mux, sitting in DT between the I2C controller and the image sensor, and translate multi-byte reads to single-byte reads in that driver.
I'm basically fine with both. Personally I would prefer the first option, as this would be a generic approach which other devices could also use. Furthermore it's IMHO the simpler solution. But that's just my 2 cents.
The next step is to then write and send an RFC, to get feedback on the idea from the DT and I2C maintainers (and possibly regmap, if we handle the quirk at that level). Is that something you could work on ?
Quoted 44 lines
Quoted 44 lines
Quoted 44 lines
Quoted 6 lines
As the driver has no reliable way to identify affected modules enable
use_single_readfor OV9282 unconditionally when creating the CCI regmap.Tested on an i.M8MP system with OV9282 modules from Vision Components.
Signed-off-by Richard Leitner <[email protected]>As regmap does provide a simple way to request this behaviour, and the only read is the ID register from
ov9282_detect, I'll give it anAcked-by Dave Stevenson <[email protected]>but it's not an ideal situation. Others can debate the alternative approaches for handling VC modules.
Quoted 29 lines
--- drivers/media/i2c/ov9282.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)drivers/media/i2c/ov9282.c +6
-1@@ -1283,6 +1283,11 @@ static int ov9282_probe(struct i2c_client *client)struct ov9282 *ov9282;int ret; +const struct cci_regmap_config config = { + .reg_addr_bits =16 , + .use_single_read = true, + }; + ov9282 =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; } - ov9282->regmap =devm_cci_regmap_init_i2c (client,16 ); + ov9282->regmap =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" );
Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH 2/2] media: ov9282: enable single-read I2C transactions
Quoted 34 lines · Laurent Pinchart
Quoted 33 lines · Richard Leitner
Hi Laurent,
thank you very much for your quick feedback!
Quoted 27 lines · Laurent Pinchart
Quoted 9 lines · Dave Stevenson
Quoted 5 lines · Richard Leitner
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.
Those damn stupid Vision Components modules with the MCU that prevents you reading registers.
There's good news, the situation is improving with recent modules. We still have to handle the other ones of course.
Quoted 3 lines
I seem to recall Laurent had a plan for how to handle those without having to patch all the drivers, however I can't find that thread quickly.
I'm thinking of two options:
- We can introduce a new standard DT property for I2C device that will be parsed by regmap or the I2C core directly, and switch to single reads.
- We could model the MCU as some sort of I2C mux, sitting in DT between the I2C controller and the image sensor, and translate multi-byte reads to single-byte reads in that driver.
Quoted 7 lines
Quoted 3 lines
I'm basically fine with both. Personally I would prefer the first option, as this would be a generic approach which other devices could also use. Furthermore it's IMHO the simpler solution. But that's just my 2 cents.
The next step is to then write and send an RFC, to get feedback on the idea from the DT and I2C maintainers (and possibly regmap, if we handle the quirk at that level). Is that something you could work on ?
Sure. I'll take a more detailled look at it tomorrow.
regards;rl
...
Quoted 4 lines
Signature · 3 lines
Regards, Laurent Pinchart