Re: [PATCH 12/16] i2c: i2c-s3c2410: Drop class based scanning to improve bootup time
Hi Wolfram, On Thu, Jul 10, 2014 at 5:16 PM, Wolfram Sang wrote: > This driver has been flagged to drop class based instantiation. The removal > improves boot-up time and is unneeded for embedded controllers. Users have > been > warned to switch for some time now, so we can actually do the removal. Keep > the > DEPRECATED flag, so the core can inform users that the behaviour finally > changed now. After another transition period, this flag can go, too. > While we are here, remove the indentation for the array setup because > such things always break after some time. > > Signed-off-by: Wolfram Sang > --- > drivers/i2c/busses/i2c-s3c2410.c | 8 > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-s3c2410.c > b/drivers/i2c/busses/i2c-s3c2410.c > index e828a1dba0e5..6252c051525a 100644 > --- a/drivers/i2c/busses/i2c-s3c2410.c > +++ b/drivers/i2c/busses/i2c-s3c2410.c > @@ -1128,11 +1128,11 @@ static int s3c24xx_i2c_probe(struct platform_device > *pdev) > s3c24xx_i2c_parse_dt(pdev->dev.of_node, i2c); > > strlcpy(i2c->adap.name, "s3c2410-i2c", sizeof(i2c->adap.name)); > - i2c->adap.owner = THIS_MODULE; > - i2c->adap.algo= &s3c24xx_i2c_algorithm; > + i2c->adap.owner = THIS_MODULE; > + i2c->adap.algo = &s3c24xx_i2c_algorithm; > i2c->adap.retries = 2; > - i2c->adap.class = I2C_CLASS_HWMON | I2C_CLASS_SPD | > I2C_CLASS_DEPRECATED; > - i2c->tx_setup = 50; > + i2c->adap.class = I2C_CLASS_DEPRECATED; > + i2c->tx_setup = 50; > > init_waitqueue_head(&i2c->wait); > > -- Tested on Exynos 5250 boards. Tested-by: Sachin Kamat -- Regards, Sachin. -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/2] i2c-stub: Add support for banked register ranges
On 07/10/2014 02:30 PM, Jean Delvare wrote: On Thu, 10 Jul 2014 11:40:36 -0700, Guenter Roeck wrote: On Thu, Jul 10, 2014 at 12:56:59PM +0200, Jean Delvare wrote: Some chips implement banked register ranges. This allows implementing more registers than the limited 8-bit address space originally allows. In order to access a register on these chips, you must first select the proper bank. Add support for this mechanism to the i2c-stub driver so that such chips can be emulated. All the bank settings are passed as module parameters. Signed-off-by: Jean Delvare Cc: Guenter Roeck --- Tested successfully with: http://jdelvare.nerim.net/devel/lm-sensors/dumps/w83793-for-stub.dump Also with NCT7802Y. Tested-by: Guenter Roeck Thanks. Would it make sense to use devm_ functions for memory allocations ? That would simplify cleanup. Sure, no objection from me. If it was that simple :-(. We would have to convert the driver to a platform driver to be able to do that, since the allocations happen from the initialization code, not from a probe function. Guess we'll have to leave that for another day. Guenter -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] i2c: i2c-st: Use %pa to print 'resource_size_t' type
From: Fabio Estevam When building multi_v7_defconfig with CONFIG_ARM_LPAE=y the following warning is seen: drivers/i2c/busses/i2c-st.c:818:2: warning: format '%x' expects argument of type 'unsigned int', but argument 4 has type 'resource_size_t' [-Wformat=] Use %pa to print 'resource_size_t' type to fix the warning. Reported-by: Olof's autobuilder Signed-off-by: Fabio Estevam --- drivers/i2c/busses/i2c-st.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-st.c b/drivers/i2c/busses/i2c-st.c index 95b94767..fc767dd 100644 --- a/drivers/i2c/busses/i2c-st.c +++ b/drivers/i2c/busses/i2c-st.c @@ -815,7 +815,7 @@ static int st_i2c_probe(struct platform_device *pdev) adap = &i2c_dev->adap; i2c_set_adapdata(adap, i2c_dev); - snprintf(adap->name, sizeof(adap->name), "ST I2C(0x%x)", res->start); + snprintf(adap->name, sizeof(adap->name), "ST I2C(0x%pa)", &res->start); adap->owner = THIS_MODULE; adap->timeout = 2 * HZ; adap->retries = 0; -- 1.8.3.2 -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/2] i2c-stub: Add support for banked register ranges
On Thu, Jul 10, 2014 at 11:30:40PM +0200, Jean Delvare wrote: > On Thu, 10 Jul 2014 11:40:36 -0700, Guenter Roeck wrote: > > On Thu, Jul 10, 2014 at 12:56:59PM +0200, Jean Delvare wrote: > > > Some chips implement banked register ranges. This allows implementing > > > more registers than the limited 8-bit address space originally allows. > > > In order to access a register on these chips, you must first select > > > the proper bank. Add support for this mechanism to the i2c-stub driver > > > so that such chips can be emulated. All the bank settings are passed > > > as module parameters. > > > > > > Signed-off-by: Jean Delvare > > > Cc: Guenter Roeck > > > --- > > > Tested successfully with: > > > http://jdelvare.nerim.net/devel/lm-sensors/dumps/w83793-for-stub.dump > > > > > Also with NCT7802Y. > > > > Tested-by: Guenter Roeck > > Thanks. > > > Would it make sense to use devm_ functions for memory allocations ? > > That would simplify cleanup. > > Sure, no objection from me. > Do you want to do it, or do you want me to send a patch on top of yours ? Thanks, Guenter -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/2] i2c-stub: Add support for banked register ranges
On Thu, 10 Jul 2014 11:40:36 -0700, Guenter Roeck wrote: > On Thu, Jul 10, 2014 at 12:56:59PM +0200, Jean Delvare wrote: > > Some chips implement banked register ranges. This allows implementing > > more registers than the limited 8-bit address space originally allows. > > In order to access a register on these chips, you must first select > > the proper bank. Add support for this mechanism to the i2c-stub driver > > so that such chips can be emulated. All the bank settings are passed > > as module parameters. > > > > Signed-off-by: Jean Delvare > > Cc: Guenter Roeck > > --- > > Tested successfully with: > > http://jdelvare.nerim.net/devel/lm-sensors/dumps/w83793-for-stub.dump > > > Also with NCT7802Y. > > Tested-by: Guenter Roeck Thanks. > Would it make sense to use devm_ functions for memory allocations ? > That would simplify cleanup. Sure, no objection from me. -- Jean Delvare SUSE L3 Support -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/2] i2c-stub: Add support for banked register ranges
On Thu, Jul 10, 2014 at 12:56:59PM +0200, Jean Delvare wrote: > Some chips implement banked register ranges. This allows implementing > more registers than the limited 8-bit address space originally allows. > In order to access a register on these chips, you must first select > the proper bank. Add support for this mechanism to the i2c-stub driver > so that such chips can be emulated. All the bank settings are passed > as module parameters. > > Signed-off-by: Jean Delvare > Cc: Guenter Roeck > --- > Tested successfully with: > http://jdelvare.nerim.net/devel/lm-sensors/dumps/w83793-for-stub.dump > Also with NCT7802Y. Tested-by: Guenter Roeck Would it make sense to use devm_ functions for memory allocations ? That would simplify cleanup. Thanks, Guenter -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 14/16] i2c: i2c-stu300: Drop class based scanning to improve bootup time
On Thu, Jul 10, 2014 at 1:46 PM, Wolfram Sang wrote: > This driver has been flagged to drop class based instantiation. The removal > improves boot-up time and is unneeded for embedded controllers. Users have > been > warned to switch for some time now, so we can actually do the removal. Keep > the > DEPRECATED flag, so the core can inform users that the behaviour finally > changed now. After another transition period, this flag can go, too. > > Signed-off-by: Wolfram Sang Acked-by: Linus Walleij Yours, Linus Walleij -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 08/16] i2c: i2c-nomadik: Drop class based scanning to improve bootup time
On Thu, Jul 10, 2014 at 1:46 PM, Wolfram Sang wrote: > This driver has been flagged to drop class based instantiation. The removal > improves boot-up time and is unneeded for embedded controllers. Users have > been > warned to switch for some time now, so we can actually do the removal. Keep > the > DEPRECATED flag, so the core can inform users that the behaviour finally > changed now. After another transition period, this flag can go, too. > While we are here, remove the indentation for the array setup because > such things always break after some time. > > Signed-off-by: Wolfram Sang Acked-by: Linus Walleij Yours, Linus Walleij -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 09/16] i2c: i2c-ocores: Drop class based scanning to improve bootup time
> "Wolfram" == Wolfram Sang writes: > This driver has been flagged to drop class based instantiation. The removal > improves boot-up time and is unneeded for embedded controllers. Users have > been > warned to switch for some time now, so we can actually do the removal. Keep > the > DEPRECATED flag, so the core can inform users that the behaviour finally > changed now. After another transition period, this flag can go, too. > While we are here, remove the indentation for the array setup because > such things always break after some time. > Signed-off-by: Wolfram Sang Acked-by: Peter Korsgaard -- Bye, Peter Korsgaard -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 15/16] i2c: i2c-tegra: Drop class based scanning to improve bootup time
On Thu, Jul 10, 2014 at 01:46:35PM +0200, Wolfram Sang wrote: > This driver has been flagged to drop class based instantiation. The removal > improves boot-up time and is unneeded for embedded controllers. Users have > been > warned to switch for some time now, so we can actually do the removal. Keep > the > DEPRECATED flag, so the core can inform users that the behaviour finally > changed now. After another transition period, this flag can go, too. > > Signed-off-by: Wolfram Sang > --- > drivers/i2c/busses/i2c-tegra.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) It looks as though this currently doesn't do anything on !X86 anyway and I'll trust Mikko's testing, so: Acked-by: Thierry Reding pgpT8X577VTzh.pgp Description: PGP signature
Re: [PATCH 00/16] i2c: drop class based instantiaion for selected drivers
> > + /* Warn that the adapter lost class based instantiation */ > > + if (adapter->class == I2C_CLASS_DEPRECATED) { > > + dev_dbg(&adapter->dev, > > + "This adapter dropped support for I2C classes and " > > + "won't auto-detect %s devices anymore. If you need it, > > check " > > + "'Documentation/i2c/instantiating-devices' for > > alternatives.\n", > > > It's usually a bad idea to split kernel messages across source lines Yes, "usually". Not for this message, though, it's specific. The lines would have been quite long. > You could at least do the split at the sentence boundary. OK, this would have been a compromise. signature.asc Description: Digital signature
[PULL REQUEST] i2c for 3.16
Linus, here is one buildfix for the i2c subsystem. While here, I decided to add the header cleanup as well. Please pull. Thanks, Wolfram The following changes since commit a497c3ba1d97fc69c1e78e7b96435ba8c2cb42ee: Linux 3.16-rc2 (2014-06-21 19:02:54 -1000) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git i2c/for-current for you to fetch changes up to 098aebc30292c10b31f6aa58bf4fe2c4b26001f6: i2c: sun6i-p2wi: Remove duplicate inclusion of module.h (2014-06-27 14:39:36 +0200) Linus Walleij (1): i2c: mux: pca954x: fix dependencies Sachin Kamat (1): i2c: sun6i-p2wi: Remove duplicate inclusion of module.h drivers/i2c/busses/i2c-sun6i-p2wi.c | 1 - drivers/i2c/muxes/Kconfig | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) signature.asc Description: Digital signature
Re: [PATCH 00/16] i2c: drop class based instantiaion for selected drivers
Hi, Wolfram Sang wrote: > Some drivers were flagged to remove class based instantiation soon to improve > boot-up time. Originally, I was planning for a longer deprecation time so > users > could switch over to some other kind of instantiation. However, the demand for > the speed up is high enough and class based instantiation is used rarely, so > the removal takes place now. To make up for the deprecation time, another > warning is added to the i2c core pointing out that the behaviour has now > changed: > > + /* Warn that the adapter lost class based instantiation */ > + if (adapter->class == I2C_CLASS_DEPRECATED) { > + dev_dbg(&adapter->dev, > + "This adapter dropped support for I2C classes and " > + "won't auto-detect %s devices anymore. If you need it, > check " > + "'Documentation/i2c/instantiating-devices' for > alternatives.\n", > It's usually a bad idea to split kernel messages across source lines because it makes searching for the corresponding source line for a message found in the log difficult. You could at least do the split at the sentence boundary. Lothar Waßmann -- ___ Ka-Ro electronics GmbH | Pascalstraße 22 | D - 52076 Aachen Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10 Geschäftsführer: Matthias Kaussen Handelsregistereintrag: Amtsgericht Aachen, HRB 4996 www.karo-electronics.de | i...@karo-electronics.de ___ -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 15/16] i2c: i2c-tegra: Drop class based scanning to improve bootup time
Reviewed-by: Mikko Perttunen Tested-by: Mikko Perttunen On 10/07/14 14:46, Wolfram Sang wrote: This driver has been flagged to drop class based instantiation. The removal improves boot-up time and is unneeded for embedded controllers. Users have been warned to switch for some time now, so we can actually do the removal. Keep the DEPRECATED flag, so the core can inform users that the behaviour finally changed now. After another transition period, this flag can go, too. Signed-off-by: Wolfram Sang --- drivers/i2c/busses/i2c-tegra.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index f1bb2fc06791..87d0371cebb7 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c @@ -792,7 +792,7 @@ static int tegra_i2c_probe(struct platform_device *pdev) i2c_set_adapdata(&i2c_dev->adapter, i2c_dev); i2c_dev->adapter.owner = THIS_MODULE; - i2c_dev->adapter.class = I2C_CLASS_HWMON | I2C_CLASS_DEPRECATED; + i2c_dev->adapter.class = I2C_CLASS_DEPRECATED; strlcpy(i2c_dev->adapter.name, "Tegra I2C adapter", sizeof(i2c_dev->adapter.name)); i2c_dev->adapter.algo = &tegra_i2c_algo; -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/2] i2c-stub: Remember the number of emulated chips
On 07/10/2014 03:45 AM, Jean Delvare wrote: This makes initialization, cleanup and look-up easier. Signed-off-by: Jean Delvare Cc: Guenter Roeck --- This applies on top of Guenter's patch "i2c: stub: Add support for SMBus block commands", v2. Looks good. Reviewed-by: Guenter Roeck drivers/i2c/i2c-stub.c |9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) --- linux-3.16-rc3.orig/drivers/i2c/i2c-stub.c 2014-07-09 12:57:46.383772594 +0200 +++ linux-3.16-rc3/drivers/i2c/i2c-stub.c 2014-07-09 13:09:42.982241933 +0200 @@ -62,6 +62,7 @@ struct stub_chip { }; static struct stub_chip *stub_chips; +static int stub_chips_nr; static struct smbus_block_data *stub_find_block(struct device *dev, struct stub_chip *chip, @@ -95,7 +96,7 @@ static s32 stub_xfer(struct i2c_adapter struct smbus_block_data *b; /* Search for the right chip */ - for (i = 0; i < MAX_CHIPS && chip_addr[i]; i++) { + for (i = 0; i < stub_chips_nr; i++) { if (addr == chip_addr[i]) { chip = stub_chips + i; break; @@ -281,12 +282,14 @@ static int __init i2c_stub_init(void) } /* Allocate memory for all chips at once */ - stub_chips = kzalloc(i * sizeof(struct stub_chip), GFP_KERNEL); + stub_chips_nr = i; + stub_chips = kcalloc(stub_chips_nr, sizeof(struct stub_chip), +GFP_KERNEL); At some point can use devm_kcalloc ... if (!stub_chips) { pr_err("i2c-stub: Out of memory\n"); and get rid of this message. return -ENOMEM; } - for (i--; i >= 0; i--) + for (i = 0; i < stub_chips_nr; i++) INIT_LIST_HEAD(&stub_chips[i].smbus_blocks); ret = i2c_add_adapter(&stub_adapter); -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3] i2c: busses: i2c-pxa.c: Fix for possible null pointer dereferenc
> Ok then, Wolfram! > > Keep only: > > ereqirq: > clk_disable_unprepare(i2c->clk); > > And let everyone else just return? I haven't looked at the details, but when you simply can return, do it. > It is rather pointless to add something in a patch, to remove it in the next. Yup, just say in the patch description that it fixes this bug. signature.asc Description: Digital signature
[PATCH 02/16] i2c: i2c-at91: Drop class based scanning to improve bootup time
This driver has been flagged to drop class based instantiation. The removal improves boot-up time and is unneeded for embedded controllers. Users have been warned to switch for some time now, so we can actually do the removal. Keep the DEPRECATED flag, so the core can inform users that the behaviour finally changed now. After another transition period, this flag can go, too. Signed-off-by: Wolfram Sang --- drivers/i2c/busses/i2c-at91.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c index e95f9ba96790..7033e9166d1f 100644 --- a/drivers/i2c/busses/i2c-at91.c +++ b/drivers/i2c/busses/i2c-at91.c @@ -768,7 +768,7 @@ static int at91_twi_probe(struct platform_device *pdev) snprintf(dev->adapter.name, sizeof(dev->adapter.name), "AT91"); i2c_set_adapdata(&dev->adapter, dev); dev->adapter.owner = THIS_MODULE; - dev->adapter.class = I2C_CLASS_HWMON | I2C_CLASS_DEPRECATED; + dev->adapter.class = I2C_CLASS_DEPRECATED; dev->adapter.algo = &at91_twi_algorithm; dev->adapter.dev.parent = dev->dev; dev->adapter.nr = pdev->id; -- 2.0.0 -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 01/16] i2c: add debug info when class instantiation was dropped
We have a warning already when support for old-fashioned class based instantiation is about to be dropped somewhen soon from a driver. Let's have another one when it was actually dropped. This allows to remove the cruft a little earlier and still let users know what happened in the rare case they are missing devices after the change. However, there is enough interest to get rid of class based instantiation rather sooner than later because it improves boot up time. Signed-off-by: Wolfram Sang --- drivers/i2c/i2c-core.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 4ccff114b147..a1eeb8a5d3f8 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c @@ -1915,6 +1915,16 @@ static int i2c_detect(struct i2c_adapter *adapter, struct i2c_driver *driver) if (!driver->detect || !address_list) return 0; + /* Warn that the adapter lost class based instantiation */ + if (adapter->class == I2C_CLASS_DEPRECATED) { + dev_dbg(&adapter->dev, + "This adapter dropped support for I2C classes and " + "won't auto-detect %s devices anymore. If you need it, check " + "'Documentation/i2c/instantiating-devices' for alternatives.\n", + driver->driver.name); + return 0; + } + /* Stop here if the classes do not match */ if (!(adapter->class & driver->class)) return 0; -- 2.0.0 -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 03/16] i2c: i2c-bcm2835: Drop class based scanning to improve bootup time
This driver has been flagged to drop class based instantiation. The removal improves boot-up time and is unneeded for embedded controllers. Users have been warned to switch for some time now, so we can actually do the removal. Keep the DEPRECATED flag, so the core can inform users that the behaviour finally changed now. After another transition period, this flag can go, too. Signed-off-by: Wolfram Sang --- drivers/i2c/busses/i2c-bcm2835.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-bcm2835.c b/drivers/i2c/busses/i2c-bcm2835.c index 214ff9700efe..4b8ecd0b3661 100644 --- a/drivers/i2c/busses/i2c-bcm2835.c +++ b/drivers/i2c/busses/i2c-bcm2835.c @@ -277,7 +277,7 @@ static int bcm2835_i2c_probe(struct platform_device *pdev) adap = &i2c_dev->adapter; i2c_set_adapdata(adap, i2c_dev); adap->owner = THIS_MODULE; - adap->class = I2C_CLASS_HWMON | I2C_CLASS_DEPRECATED; + adap->class = I2C_CLASS_DEPRECATED; strlcpy(adap->name, "bcm2835 I2C adapter", sizeof(adap->name)); adap->algo = &bcm2835_i2c_algo; adap->dev.parent = &pdev->dev; -- 2.0.0 -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 04/16] i2c: i2c-bfin-twi: Drop class based scanning to improve bootup time
This driver has been flagged to drop class based instantiation. The removal improves boot-up time and is unneeded for embedded controllers. Users have been warned to switch for some time now, so we can actually do the removal. Keep the DEPRECATED flag, so the core can inform users that the behaviour finally changed now. After another transition period, this flag can go, too. Signed-off-by: Wolfram Sang --- drivers/i2c/busses/i2c-bfin-twi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-bfin-twi.c b/drivers/i2c/busses/i2c-bfin-twi.c index 3e271e7558d3..067c1615e968 100644 --- a/drivers/i2c/busses/i2c-bfin-twi.c +++ b/drivers/i2c/busses/i2c-bfin-twi.c @@ -648,7 +648,7 @@ static int i2c_bfin_twi_probe(struct platform_device *pdev) strlcpy(p_adap->name, pdev->name, sizeof(p_adap->name)); p_adap->algo = &bfin_twi_algorithm; p_adap->algo_data = iface; - p_adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD | I2C_CLASS_DEPRECATED; + p_adap->class = I2C_CLASS_DEPRECATED; p_adap->dev.parent = &pdev->dev; p_adap->timeout = 5 * HZ; p_adap->retries = 3; -- 2.0.0 -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 05/16] i2c: i2c-davinci: Drop class based scanning to improve bootup time
This driver has been flagged to drop class based instantiation. The removal improves boot-up time and is unneeded for embedded controllers. Users have been warned to switch for some time now, so we can actually do the removal. Keep the DEPRECATED flag, so the core can inform users that the behaviour finally changed now. After another transition period, this flag can go, too. Signed-off-by: Wolfram Sang --- drivers/i2c/busses/i2c-davinci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c index 389bc68c55ad..4d9614719128 100644 --- a/drivers/i2c/busses/i2c-davinci.c +++ b/drivers/i2c/busses/i2c-davinci.c @@ -712,7 +712,7 @@ static int davinci_i2c_probe(struct platform_device *pdev) adap = &dev->adapter; i2c_set_adapdata(adap, dev); adap->owner = THIS_MODULE; - adap->class = I2C_CLASS_HWMON | I2C_CLASS_DEPRECATED; + adap->class = I2C_CLASS_DEPRECATED; strlcpy(adap->name, "DaVinci I2C adapter", sizeof(adap->name)); adap->algo = &i2c_davinci_algo; adap->dev.parent = &pdev->dev; -- 2.0.0 -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 11/16] i2c: i2c-rcar: Drop class based scanning to improve bootup time
This driver has been flagged to drop class based instantiation. The removal improves boot-up time and is unneeded for embedded controllers. Users have been warned to switch for some time now, so we can actually do the removal. Keep the DEPRECATED flag, so the core can inform users that the behaviour finally changed now. After another transition period, this flag can go, too. While we are here, remove the indentation for the array setup because such things always break after some time. Signed-off-by: Wolfram Sang --- drivers/i2c/busses/i2c-rcar.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c index 899405923678..f3c7139dfa25 100644 --- a/drivers/i2c/busses/i2c-rcar.c +++ b/drivers/i2c/busses/i2c-rcar.c @@ -541,13 +541,13 @@ static int rcar_i2c_probe(struct platform_device *pdev) irq = platform_get_irq(pdev, 0); init_waitqueue_head(&priv->wait); - adap= &priv->adap; - adap->nr= pdev->id; - adap->algo = &rcar_i2c_algo; - adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD | I2C_CLASS_DEPRECATED; - adap->retries = 3; - adap->dev.parent= dev; - adap->dev.of_node = dev->of_node; + adap = &priv->adap; + adap->nr = pdev->id; + adap->algo = &rcar_i2c_algo; + adap->class = I2C_CLASS_DEPRECATED; + adap->retries = 3; + adap->dev.parent = dev; + adap->dev.of_node = dev->of_node; i2c_set_adapdata(adap, priv); strlcpy(adap->name, pdev->name, sizeof(adap->name)); -- 2.0.0 -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 07/16] i2c: i2c-mv64xxx: Drop class based scanning to improve bootup time
This driver has been flagged to drop class based instantiation. The removal improves boot-up time and is unneeded for embedded controllers. Users have been warned to switch for some time now, so we can actually do the removal. Keep the DEPRECATED flag, so the core can inform users that the behaviour finally changed now. After another transition period, this flag can go, too. Signed-off-by: Wolfram Sang --- drivers/i2c/busses/i2c-mv64xxx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c index 9f4b775e2e39..6dc5ded86f62 100644 --- a/drivers/i2c/busses/i2c-mv64xxx.c +++ b/drivers/i2c/busses/i2c-mv64xxx.c @@ -863,7 +863,7 @@ mv64xxx_i2c_probe(struct platform_device *pd) drv_data->adapter.dev.parent = &pd->dev; drv_data->adapter.algo = &mv64xxx_i2c_algo; drv_data->adapter.owner = THIS_MODULE; - drv_data->adapter.class = I2C_CLASS_HWMON | I2C_CLASS_SPD | I2C_CLASS_DEPRECATED; + drv_data->adapter.class = I2C_CLASS_DEPRECATED; drv_data->adapter.nr = pd->id; drv_data->adapter.dev.of_node = pd->dev.of_node; platform_set_drvdata(pd, drv_data); -- 2.0.0 -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 06/16] i2c: i2c-designware-platdrv: Drop class based scanning to improve bootup time
This driver has been flagged to drop class based instantiation. The removal improves boot-up time and is unneeded for embedded controllers. Users have been warned to switch for some time now, so we can actually do the removal. Keep the DEPRECATED flag, so the core can inform users that the behaviour finally changed now. After another transition period, this flag can go, too. Signed-off-by: Wolfram Sang --- drivers/i2c/busses/i2c-designware-platdrv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c index 402ec3970fed..e4e1af959875 100644 --- a/drivers/i2c/busses/i2c-designware-platdrv.c +++ b/drivers/i2c/busses/i2c-designware-platdrv.c @@ -202,7 +202,7 @@ static int dw_i2c_probe(struct platform_device *pdev) adap = &dev->adapter; i2c_set_adapdata(adap, dev); adap->owner = THIS_MODULE; - adap->class = I2C_CLASS_HWMON | I2C_CLASS_DEPRECATED; + adap->class = I2C_CLASS_DEPRECATED; strlcpy(adap->name, "Synopsys DesignWare I2C adapter", sizeof(adap->name)); adap->algo = &i2c_dw_algo; -- 2.0.0 -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 08/16] i2c: i2c-nomadik: Drop class based scanning to improve bootup time
This driver has been flagged to drop class based instantiation. The removal improves boot-up time and is unneeded for embedded controllers. Users have been warned to switch for some time now, so we can actually do the removal. Keep the DEPRECATED flag, so the core can inform users that the behaviour finally changed now. After another transition period, this flag can go, too. While we are here, remove the indentation for the array setup because such things always break after some time. Signed-off-by: Wolfram Sang --- drivers/i2c/busses/i2c-nomadik.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-nomadik.c index 0e55d85fd4ed..9ad038d223c4 100644 --- a/drivers/i2c/busses/i2c-nomadik.c +++ b/drivers/i2c/busses/i2c-nomadik.c @@ -1032,10 +1032,10 @@ static int nmk_i2c_probe(struct amba_device *adev, const struct amba_id *id) adap = &dev->adap; adap->dev.of_node = np; adap->dev.parent = &adev->dev; - adap->owner = THIS_MODULE; - adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD | I2C_CLASS_DEPRECATED; - adap->algo = &nmk_i2c_algo; - adap->timeout = msecs_to_jiffies(dev->timeout); + adap->owner = THIS_MODULE; + adap->class = I2C_CLASS_DEPRECATED; + adap->algo = &nmk_i2c_algo; + adap->timeout = msecs_to_jiffies(dev->timeout); snprintf(adap->name, sizeof(adap->name), "Nomadik I2C at %pR", &adev->res); -- 2.0.0 -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 10/16] i2c: i2c-omap: Drop class based scanning to improve bootup time
This driver has been flagged to drop class based instantiation. The removal improves boot-up time and is unneeded for embedded controllers. Users have been warned to switch for some time now, so we can actually do the removal. Keep the DEPRECATED flag, so the core can inform users that the behaviour finally changed now. After another transition period, this flag can go, too. Signed-off-by: Wolfram Sang --- drivers/i2c/busses/i2c-omap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index b182793a4051..0dffb0e62c3b 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c @@ -1236,7 +1236,7 @@ omap_i2c_probe(struct platform_device *pdev) adap = &dev->adapter; i2c_set_adapdata(adap, dev); adap->owner = THIS_MODULE; - adap->class = I2C_CLASS_HWMON | I2C_CLASS_DEPRECATED; + adap->class = I2C_CLASS_DEPRECATED; strlcpy(adap->name, "OMAP I2C adapter", sizeof(adap->name)); adap->algo = &omap_i2c_algo; adap->dev.parent = &pdev->dev; -- 2.0.0 -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 09/16] i2c: i2c-ocores: Drop class based scanning to improve bootup time
This driver has been flagged to drop class based instantiation. The removal improves boot-up time and is unneeded for embedded controllers. Users have been warned to switch for some time now, so we can actually do the removal. Keep the DEPRECATED flag, so the core can inform users that the behaviour finally changed now. After another transition period, this flag can go, too. While we are here, remove the indentation for the array setup because such things always break after some time. Signed-off-by: Wolfram Sang --- drivers/i2c/busses/i2c-ocores.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/i2c/busses/i2c-ocores.c b/drivers/i2c/busses/i2c-ocores.c index 0e10cc6182f0..2a4fe0b7cfb7 100644 --- a/drivers/i2c/busses/i2c-ocores.c +++ b/drivers/i2c/busses/i2c-ocores.c @@ -239,15 +239,15 @@ static u32 ocores_func(struct i2c_adapter *adap) } static const struct i2c_algorithm ocores_algorithm = { - .master_xfer= ocores_xfer, - .functionality = ocores_func, + .master_xfer = ocores_xfer, + .functionality = ocores_func, }; static struct i2c_adapter ocores_adapter = { - .owner = THIS_MODULE, - .name = "i2c-ocores", - .class = I2C_CLASS_HWMON | I2C_CLASS_SPD | I2C_CLASS_DEPRECATED, - .algo = &ocores_algorithm, + .owner = THIS_MODULE, + .name = "i2c-ocores", + .class = I2C_CLASS_DEPRECATED, + .algo = &ocores_algorithm, }; static const struct of_device_id ocores_i2c_match[] = { -- 2.0.0 -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 14/16] i2c: i2c-stu300: Drop class based scanning to improve bootup time
This driver has been flagged to drop class based instantiation. The removal improves boot-up time and is unneeded for embedded controllers. Users have been warned to switch for some time now, so we can actually do the removal. Keep the DEPRECATED flag, so the core can inform users that the behaviour finally changed now. After another transition period, this flag can go, too. Signed-off-by: Wolfram Sang --- drivers/i2c/busses/i2c-stu300.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-stu300.c b/drivers/i2c/busses/i2c-stu300.c index fefb1c19ec1d..6a44f37798c8 100644 --- a/drivers/i2c/busses/i2c-stu300.c +++ b/drivers/i2c/busses/i2c-stu300.c @@ -909,7 +909,7 @@ static int stu300_probe(struct platform_device *pdev) adap = &dev->adapter; adap->owner = THIS_MODULE; /* DDC class but actually often used for more generic I2C */ - adap->class = I2C_CLASS_DDC | I2C_CLASS_DEPRECATED; + adap->class = I2C_CLASS_DEPRECATED; strlcpy(adap->name, "ST Microelectronics DDC I2C adapter", sizeof(adap->name)); adap->nr = bus_nr; -- 2.0.0 -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 16/16] i2c: i2c-xiic: Drop class based scanning to improve bootup time
This driver has been flagged to drop class based instantiation. The removal improves boot-up time and is unneeded for embedded controllers. Users have been warned to switch for some time now, so we can actually do the removal. Keep the DEPRECATED flag, so the core can inform users that the behaviour finally changed now. After another transition period, this flag can go, too. While we are here, remove the indentation for the array setup because such things always break after some time. Signed-off-by: Wolfram Sang --- drivers/i2c/busses/i2c-xiic.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c index 7731f1795869..ade9223912d3 100644 --- a/drivers/i2c/busses/i2c-xiic.c +++ b/drivers/i2c/busses/i2c-xiic.c @@ -677,15 +677,15 @@ static u32 xiic_func(struct i2c_adapter *adap) } static const struct i2c_algorithm xiic_algorithm = { - .master_xfer= xiic_xfer, - .functionality = xiic_func, + .master_xfer = xiic_xfer, + .functionality = xiic_func, }; static struct i2c_adapter xiic_adapter = { - .owner = THIS_MODULE, - .name = DRIVER_NAME, - .class = I2C_CLASS_HWMON | I2C_CLASS_SPD | I2C_CLASS_DEPRECATED, - .algo = &xiic_algorithm, + .owner = THIS_MODULE, + .name = DRIVER_NAME, + .class = I2C_CLASS_DEPRECATED, + .algo = &xiic_algorithm, }; -- 2.0.0 -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 13/16] i2c: i2c-sirf: Drop class based scanning to improve bootup time
This driver has been flagged to drop class based instantiation. The removal improves boot-up time and is unneeded for embedded controllers. Users have been warned to switch for some time now, so we can actually do the removal. Keep the DEPRECATED flag, so the core can inform users that the behaviour finally changed now. After another transition period, this flag can go, too. Signed-off-by: Wolfram Sang --- drivers/i2c/busses/i2c-sirf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-sirf.c b/drivers/i2c/busses/i2c-sirf.c index a3216defc1d3..b1336d5f0531 100644 --- a/drivers/i2c/busses/i2c-sirf.c +++ b/drivers/i2c/busses/i2c-sirf.c @@ -311,7 +311,7 @@ static int i2c_sirfsoc_probe(struct platform_device *pdev) goto out; } adap = &siic->adapter; - adap->class = I2C_CLASS_HWMON | I2C_CLASS_DEPRECATED; + adap->class = I2C_CLASS_DEPRECATED; mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); siic->base = devm_ioremap_resource(&pdev->dev, mem_res); -- 2.0.0 -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 12/16] i2c: i2c-s3c2410: Drop class based scanning to improve bootup time
This driver has been flagged to drop class based instantiation. The removal improves boot-up time and is unneeded for embedded controllers. Users have been warned to switch for some time now, so we can actually do the removal. Keep the DEPRECATED flag, so the core can inform users that the behaviour finally changed now. After another transition period, this flag can go, too. While we are here, remove the indentation for the array setup because such things always break after some time. Signed-off-by: Wolfram Sang --- drivers/i2c/busses/i2c-s3c2410.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c index e828a1dba0e5..6252c051525a 100644 --- a/drivers/i2c/busses/i2c-s3c2410.c +++ b/drivers/i2c/busses/i2c-s3c2410.c @@ -1128,11 +1128,11 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev) s3c24xx_i2c_parse_dt(pdev->dev.of_node, i2c); strlcpy(i2c->adap.name, "s3c2410-i2c", sizeof(i2c->adap.name)); - i2c->adap.owner = THIS_MODULE; - i2c->adap.algo= &s3c24xx_i2c_algorithm; + i2c->adap.owner = THIS_MODULE; + i2c->adap.algo = &s3c24xx_i2c_algorithm; i2c->adap.retries = 2; - i2c->adap.class = I2C_CLASS_HWMON | I2C_CLASS_SPD | I2C_CLASS_DEPRECATED; - i2c->tx_setup = 50; + i2c->adap.class = I2C_CLASS_DEPRECATED; + i2c->tx_setup = 50; init_waitqueue_head(&i2c->wait); -- 2.0.0 -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 15/16] i2c: i2c-tegra: Drop class based scanning to improve bootup time
This driver has been flagged to drop class based instantiation. The removal improves boot-up time and is unneeded for embedded controllers. Users have been warned to switch for some time now, so we can actually do the removal. Keep the DEPRECATED flag, so the core can inform users that the behaviour finally changed now. After another transition period, this flag can go, too. Signed-off-by: Wolfram Sang --- drivers/i2c/busses/i2c-tegra.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index f1bb2fc06791..87d0371cebb7 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c @@ -792,7 +792,7 @@ static int tegra_i2c_probe(struct platform_device *pdev) i2c_set_adapdata(&i2c_dev->adapter, i2c_dev); i2c_dev->adapter.owner = THIS_MODULE; - i2c_dev->adapter.class = I2C_CLASS_HWMON | I2C_CLASS_DEPRECATED; + i2c_dev->adapter.class = I2C_CLASS_DEPRECATED; strlcpy(i2c_dev->adapter.name, "Tegra I2C adapter", sizeof(i2c_dev->adapter.name)); i2c_dev->adapter.algo = &tegra_i2c_algo; -- 2.0.0 -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 00/16] i2c: drop class based instantiaion for selected drivers
Some drivers were flagged to remove class based instantiation soon to improve boot-up time. Originally, I was planning for a longer deprecation time so users could switch over to some other kind of instantiation. However, the demand for the speed up is high enough and class based instantiation is used rarely, so the removal takes place now. To make up for the deprecation time, another warning is added to the i2c core pointing out that the behaviour has now changed: + /* Warn that the adapter lost class based instantiation */ + if (adapter->class == I2C_CLASS_DEPRECATED) { + dev_dbg(&adapter->dev, + "This adapter dropped support for I2C classes and " + "won't auto-detect %s devices anymore. If you need it, check " + "'Documentation/i2c/instantiating-devices' for alternatives.\n", + driver->driver.name); + return 0; + } A branch can be found here (with two other cleanups -> driver removals): git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git i2c/deprecate_stuff I hope this meets all the needs. Please comment, ack, test... Thanks, Wolfram Wolfram Sang (16): i2c: add debug info when class instantiation was dropped i2c: i2c-at91: Drop class based scanning to improve bootup time i2c: i2c-bcm2835: Drop class based scanning to improve bootup time i2c: i2c-bfin-twi: Drop class based scanning to improve bootup time i2c: i2c-davinci: Drop class based scanning to improve bootup time i2c: i2c-designware-platdrv: Drop class based scanning to improve bootup time i2c: i2c-mv64xxx: Drop class based scanning to improve bootup time i2c: i2c-nomadik: Drop class based scanning to improve bootup time i2c: i2c-ocores: Drop class based scanning to improve bootup time i2c: i2c-omap: Drop class based scanning to improve bootup time i2c: i2c-rcar: Drop class based scanning to improve bootup time i2c: i2c-s3c2410: Drop class based scanning to improve bootup time i2c: i2c-sirf: Drop class based scanning to improve bootup time i2c: i2c-stu300: Drop class based scanning to improve bootup time i2c: i2c-tegra: Drop class based scanning to improve bootup time i2c: i2c-xiic: Drop class based scanning to improve bootup time drivers/i2c/busses/i2c-at91.c | 2 +- drivers/i2c/busses/i2c-bcm2835.c| 2 +- drivers/i2c/busses/i2c-bfin-twi.c | 2 +- drivers/i2c/busses/i2c-davinci.c| 2 +- drivers/i2c/busses/i2c-designware-platdrv.c | 2 +- drivers/i2c/busses/i2c-mv64xxx.c| 2 +- drivers/i2c/busses/i2c-nomadik.c| 8 drivers/i2c/busses/i2c-ocores.c | 12 ++-- drivers/i2c/busses/i2c-omap.c | 2 +- drivers/i2c/busses/i2c-rcar.c | 14 +++--- drivers/i2c/busses/i2c-s3c2410.c| 8 drivers/i2c/busses/i2c-sirf.c | 2 +- drivers/i2c/busses/i2c-stu300.c | 2 +- drivers/i2c/busses/i2c-tegra.c | 2 +- drivers/i2c/busses/i2c-xiic.c | 12 ++-- drivers/i2c/i2c-core.c | 10 ++ 16 files changed, 47 insertions(+), 37 deletions(-) -- 2.0.0 -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/2] i2c-stub: Add support for banked register ranges
Some chips implement banked register ranges. This allows implementing more registers than the limited 8-bit address space originally allows. In order to access a register on these chips, you must first select the proper bank. Add support for this mechanism to the i2c-stub driver so that such chips can be emulated. All the bank settings are passed as module parameters. Signed-off-by: Jean Delvare Cc: Guenter Roeck --- Tested successfully with: http://jdelvare.nerim.net/devel/lm-sensors/dumps/w83793-for-stub.dump Documentation/i2c/i2c-stub | 11 ++- drivers/i2c/i2c-stub.c | 131 + 2 files changed, 128 insertions(+), 14 deletions(-) --- linux-3.16-rc3.orig/drivers/i2c/i2c-stub.c 2014-07-10 12:44:35.705936505 +0200 +++ linux-3.16-rc3/drivers/i2c/i2c-stub.c 2014-07-10 12:47:52.449819728 +0200 @@ -2,7 +2,7 @@ i2c-stub.c - I2C/SMBus chip emulator Copyright (c) 2004 Mark M. Hoffman -Copyright (C) 2007, 2012 Jean Delvare +Copyright (C) 2007-2014 Jean Delvare This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -47,6 +47,24 @@ static unsigned long functionality = STU module_param(functionality, ulong, S_IRUGO | S_IWUSR); MODULE_PARM_DESC(functionality, "Override functionality bitfield"); +/* Some chips have banked register ranges */ + +static u8 bank_reg[MAX_CHIPS]; +module_param_array(bank_reg, byte, NULL, S_IRUGO); +MODULE_PARM_DESC(bank_reg, "Bank register"); + +static u8 bank_mask[MAX_CHIPS]; +module_param_array(bank_mask, byte, NULL, S_IRUGO); +MODULE_PARM_DESC(bank_mask, "Bank value mask"); + +static u8 bank_start[MAX_CHIPS]; +module_param_array(bank_start, byte, NULL, S_IRUGO); +MODULE_PARM_DESC(bank_start, "First banked register"); + +static u8 bank_end[MAX_CHIPS]; +module_param_array(bank_end, byte, NULL, S_IRUGO); +MODULE_PARM_DESC(bank_end, "Last banked register"); + struct smbus_block_data { struct list_head node; u8 command; @@ -59,6 +77,16 @@ struct stub_chip { u16 words[256]; /* Byte operations use the LSB as per SMBus specification */ struct list_head smbus_blocks; + + /* For chips with banks, extra registers are allocated dynamically */ + u8 bank_reg; + u8 bank_shift; + u8 bank_mask; + u8 bank_sel;/* Currently selected bank */ + u8 bank_start; + u8 bank_end; + u16 bank_size; + u16 *bank_words;/* Room for bank_mask * bank_size registers */ }; static struct stub_chip *stub_chips; @@ -86,6 +114,17 @@ static struct smbus_block_data *stub_fin return rb; } +static u16 *stub_get_wordp(struct stub_chip *chip, u8 offset) +{ + if (chip->bank_sel && + offset >= chip->bank_start && offset <= chip->bank_end) + return chip->bank_words + + (chip->bank_sel - 1) * chip->bank_size + + offset - chip->bank_start; + else + return chip->words + offset; +} + /* Return negative errno on error. */ static s32 stub_xfer(struct i2c_adapter *adap, u16 addr, unsigned short flags, char read_write, u8 command, int size, union i2c_smbus_data *data) @@ -94,6 +133,7 @@ static s32 stub_xfer(struct i2c_adapter int i, len; struct stub_chip *chip = NULL; struct smbus_block_data *b; + u16 *wordp; /* Search for the right chip */ for (i = 0; i < stub_chips_nr; i++) { @@ -119,7 +159,8 @@ static s32 stub_xfer(struct i2c_adapter "smbus byte - addr 0x%02x, wrote 0x%02x.\n", addr, command); } else { - data->byte = chip->words[chip->pointer++] & 0xff; + wordp = stub_get_wordp(chip, chip->pointer++); + data->byte = *wordp & 0xff; dev_dbg(&adap->dev, "smbus byte - addr 0x%02x, read 0x%02x.\n", addr, data->byte); @@ -129,14 +170,25 @@ static s32 stub_xfer(struct i2c_adapter break; case I2C_SMBUS_BYTE_DATA: + wordp = stub_get_wordp(chip, command); if (read_write == I2C_SMBUS_WRITE) { - chip->words[command] &= 0xff00; - chip->words[command] |= data->byte; + *wordp &= 0xff00; + *wordp |= data->byte; dev_dbg(&adap->dev, "smbus byte data - addr 0x%02x, wrote 0x%02x at 0x%02x.\n", addr, data->byte, command); + + /* Set the bank as needed */ + if (chip->bank_words && command == chip->bank_reg) { + chip->bank_sel = +
[PATCH 1/2] i2c-stub: Remember the number of emulated chips
This makes initialization, cleanup and look-up easier. Signed-off-by: Jean Delvare Cc: Guenter Roeck --- This applies on top of Guenter's patch "i2c: stub: Add support for SMBus block commands", v2. drivers/i2c/i2c-stub.c |9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) --- linux-3.16-rc3.orig/drivers/i2c/i2c-stub.c 2014-07-09 12:57:46.383772594 +0200 +++ linux-3.16-rc3/drivers/i2c/i2c-stub.c 2014-07-09 13:09:42.982241933 +0200 @@ -62,6 +62,7 @@ struct stub_chip { }; static struct stub_chip *stub_chips; +static int stub_chips_nr; static struct smbus_block_data *stub_find_block(struct device *dev, struct stub_chip *chip, @@ -95,7 +96,7 @@ static s32 stub_xfer(struct i2c_adapter struct smbus_block_data *b; /* Search for the right chip */ - for (i = 0; i < MAX_CHIPS && chip_addr[i]; i++) { + for (i = 0; i < stub_chips_nr; i++) { if (addr == chip_addr[i]) { chip = stub_chips + i; break; @@ -281,12 +282,14 @@ static int __init i2c_stub_init(void) } /* Allocate memory for all chips at once */ - stub_chips = kzalloc(i * sizeof(struct stub_chip), GFP_KERNEL); + stub_chips_nr = i; + stub_chips = kcalloc(stub_chips_nr, sizeof(struct stub_chip), +GFP_KERNEL); if (!stub_chips) { pr_err("i2c-stub: Out of memory\n"); return -ENOMEM; } - for (i--; i >= 0; i--) + for (i = 0; i < stub_chips_nr; i++) INIT_LIST_HEAD(&stub_chips[i].smbus_blocks); ret = i2c_add_adapter(&stub_adapter); -- Jean Delvare SUSE L3 Support -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html