- Jul 01, 2021
-
-
Jérôme Glisse authored
We need to append device id even if eeprom have a label property set as some platform can have multiple eeproms with same label and we can not register each of those with same label. Failing to register those eeproms trigger cascade failures on such platform (system is no longer working). This fix regression on such platform introduced with 4e302c3b Reported-by:
Alexander Fomichev <fomichev.ru@gmail.com> Fixes: 4e302c3b ("misc: eeprom: at24: fix NVMEM name with custom AT24 device name") Cc: stable@vger.kernel.org Signed-off-by:
Jérôme Glisse <jglisse@redhat.com> Signed-off-by:
Bartosz Golaszewski <bgolaszewski@baylibre.com>
-
- May 14, 2021
-
-
Hsin-Yi Wang authored
cd5676db ("misc: eeprom: at24: support pm_runtime control") disables regulator in runtime suspend. If runtime suspend is called before regulator disable, it will results in regulator unbalanced disabling. Fixes: cd5676db ("misc: eeprom: at24: support pm_runtime control") Cc: stable <stable@vger.kernel.org> Acked-by:
Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by:
Hsin-Yi Wang <hsinyi@chromium.org> Link: https://lore.kernel.org/r/20210420133050.377209-1-hsinyi@chromium.org Signed-off-by:
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
- Dec 04, 2020
-
-
Diego Santa Cruz authored
When the "label" property is set on the AT24 EEPROM the NVMEM devid is set to NVMEM_DEVID_NONE, but it is not effective since there is a leftover line setting it back to NVMEM_DEVID_AUTO a few lines after. Fixes: 61f764c3 ("eeprom: at24: Support custom device names for AT24 EEPROMs") Signed-off-by:
Diego Santa Cruz <Diego.SantaCruz@spinetix.com> Signed-off-by:
Bartosz Golaszewski <bgolaszewski@baylibre.com>
-
- Sep 25, 2020
-
-
Jon Hunter authored
By using the label property, a more descriptive name can be populated for AT24 EEPROMs NVMEM device. Update the AT24 driver to check to see if the label property is present and if so, use this as the name for NVMEM device. Please note that when the 'label' property is present for the AT24 EEPROM, we do not want the NVMEM driver to append the 'devid' to the name and so the nvmem_config.id is initialised to NVMEM_DEVID_NONE. Signed-off-by:
Jon Hunter <jonathanh@nvidia.com> Signed-off-by:
Bartosz Golaszewski <bgolaszewski@baylibre.com>
-
- Sep 24, 2020
-
-
Jon Hunter authored
The AT24 EEPROM driver does not initialise the 'id' field of the nvmem_config structure and because the entire structure is not initialised, it ends up with a random value. This causes the NVMEM driver to append the device 'devid' value to name of the NVMEM device. Ideally for I2C devices such as the AT24 that already have a unique name, we would not bother to append the 'devid'. However, given that this has always been done for AT24 devices, we cannot remove the 'devid' as this will change the name of the userspace sysfs node for the NVMEM device. Nonetheless we should ensure that the 'id' field of the nvmem_config structure is initialised so that there is no chance of a random value causes problems in the future. Therefore, set the NVMEM config.id to NVMEM_DEVID_AUTO for AT24 EEPROMs so that the 'devid' is always appended. Signed-off-by:
Jon Hunter <jonathanh@nvidia.com> Signed-off-by:
Bartosz Golaszewski <bgolaszewski@baylibre.com>
-
- Sep 17, 2020
-
-
Vadym Kochan authored
Set type as NVMEM_TYPE_EEPROM to expose this info via sysfs: $ cat /sys/bus/nvmem/devices/{DEVICE}/type EEPROM Signed-off-by:
Vadym Kochan <vadym.kochan@plvision.eu> Signed-off-by:
Bartosz Golaszewski <bgolaszewski@baylibre.com>
-
- Sep 01, 2020
-
-
Vadym Kochan authored
During nvmem_register() the nvmem core sends notifications when: - cell added - nvmem added and during these notifications some callback func may access the nvmem device, which will fail in case of at24 eeprom because regulator and pm are enabled after nvmem_register(). Fixes: cd5676db ("misc: eeprom: at24: support pm_runtime control") Fixes: b20eb4c1 ("eeprom: at24: drop unnecessary label") Cc: stable@vger.kernel.org Signed-off-by:
Vadym Kochan <vadym.kochan@plvision.eu> Signed-off-by:
Bartosz Golaszewski <bgolaszewski@baylibre.com>
-
- Aug 25, 2020
-
-
Jean Delvare authored
The elegant code in at24_read() has the drawback that we now need to make a copy of all parameters to pass them to the post-processing callback function if there is one. Rewrite the loop in such a way that the parameters are not modified, so saving them is no longer needed. Signed-off-by:
Jean Delvare <jdelvare@suse.de> Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by:
Bartosz Golaszewski <bgolaszewski@baylibre.com>
-
- Aug 18, 2020
-
-
Jean Delvare authored
Special handling of the Sony VAIO EEPROMs is the last feature of the legacy eeprom driver that the at24 driver does not support. Adding this would let us deprecate and eventually remove the legacy eeprom driver. So add the option to specify a post-processing callback function that is called after reading data from the EEPROM, before it is returned to the user. The 24c02-vaio type is the first use case of that option: the callback function will mask the sensitive data for non-root users exactly as the legacy eeprom driver was doing. Signed-off-by:
Jean Delvare <jdelvare@suse.de> Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> [Bartosz: removed a stray newline] Signed-off-by:
Bartosz Golaszewski <bgolaszewski@baylibre.com>
-
- Jul 10, 2020
-
-
Lee Jones authored
... as is the case when !CONFIG_ACPI. Fixes the following W=1 kernel build warning: drivers/misc/eeprom/at24.c:228:36: warning: ‘at24_acpi_ids’ defined but not used [-Wunused-const-variable=] Signed-off-by:
Lee Jones <lee.jones@linaro.org> Acked-by:
Bartosz Golaszewski <bgolaszewski@baylibre.com> Link: https://lore.kernel.org/r/20200701093616.GX1179328@dell Signed-off-by:
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
- Mar 12, 2020
-
-
Michael Auchter authored
The at24 driver attempts to read a byte from the device to validate that it's actually present, and if not, disables the vcc regulator and returns -ENODEV. However, between the read and the error handling path, pm_runtime_idle() is called and invokes the driver's suspend callback, which also disables the vcc regulator. This leads to an underflow of the regulator enable count if the EEPROM is not present. Move the pm_runtime_suspend() call to be after the error handling path to resolve this. Fixes: cd5676db ("misc: eeprom: at24: support pm_runtime control") Signed-off-by:
Michael Auchter <michael.auchter@ni.com> Signed-off-by:
Bartosz Golaszewski <bgolaszewski@baylibre.com>
-
- Feb 10, 2020
-
-
Markus Pietrek authored
This ID is used at leas on some variants of MSC C6B-SLH board. Signed-off-by:
Markus Pietrek <mpie@msc-ge.com> Signed-off-by:
Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by:
Bartosz Golaszewski <bgolaszewski@baylibre.com>
-
- Jan 23, 2020
-
-
Bibby Hsieh authored
Although in the most platforms, the power of eeprom are alway on, some platforms disable the eeprom power in order to meet low power request. This patch add the pm_runtime ops to control power to support all platforms. Signed-off-by:
Bibby Hsieh <bibby.hsieh@mediatek.com> [Bartosz: rebased on top of current at24/for-next] Signed-off-by:
Bartosz Golaszewski <bgolaszewski@baylibre.com>
-
- Jan 09, 2020
-
-
Khouloud Touil authored
NVMEM framework is an interface for the at24 EEPROMs as well as for other drivers, instead of passing the wp-gpios over the different drivers each time, it would be better to pass it over the NVMEM subsystem once and for all. Removing the support for the write-protect pin after adding it to the NVMEM subsystem. Signed-off-by:
Khouloud Touil <ktouil@baylibre.com> Reviewed-by:
Linus Walleij <linus.walleij@linaro.org> Signed-off-by:
Bartosz Golaszewski <bgolaszewski@baylibre.com>
-
- Jan 02, 2020
-
-
Bartosz Golaszewski authored
For consistency and easier maintenance: sort the headers alphabetically. Signed-off-by:
Bartosz Golaszewski <bgolaszewski@baylibre.com>
-
Bartosz Golaszewski authored
The current GPL v2.0 or later SPDX tag is 'GPL-2.0-or-later' as defined at https://spdx.org/licenses/ . Signed-off-by:
Bartosz Golaszewski <bgolaszewski@baylibre.com>
-
- Oct 04, 2019
-
-
Jean Delvare authored
Currently when binding to an spd EEPROM, the at24 drivers logs the following message: 256 byte spd EEPROM, read-only, 0 bytes/write The last part is confusing, as by definition you don't write to a read-only EEPROM, plus "0 bytes/write" makes no sense whatsoever. I propose to have a different message for read-only EEPROMs, which does not include this last part. Signed-off-by:
Jean Delvare <jdelvare@suse.de> Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by:
Wolfram Sang <wsa@the-dreams.de> Signed-off-by:
Bartosz Golaszewski <bgolaszewski@baylibre.com>
-
- Jul 28, 2019
-
-
Jean Delvare authored
The integration of the at24 driver into the nvmem framework broke the world-readability of spd EEPROMs. Fix it. Signed-off-by:
Jean Delvare <jdelvare@suse.de> Cc: stable@vger.kernel.org Fixes: 57d15550 ("eeprom: at24: extend driver to plug into the NVMEM framework") Cc: Andrew Lunn <andrew@lunn.ch> Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Bartosz Golaszewski <brgl@bgdev.pl> Cc: Arnd Bergmann <arnd@arndb.de> Signed-off-by:
Bartosz Golaszewski <bgolaszewski@baylibre.com>
-
- Jul 22, 2019
-
-
Bartosz Golaszewski authored
We used to have a call to ilog2() in AT24_DEVICE_MAGIC(). That's long gone so this header is no longer needed. Signed-off-by:
Bartosz Golaszewski <bgolaszewski@baylibre.com> Acked-by:
Wolfram Sang <wsa@the-dreams.de>
-
- Jun 27, 2019
-
-
Bartosz Golaszewski authored
We no longer have platform data in at24, so this comment is invalid. Make it refer to device tree & properties instead. Signed-off-by:
Bartosz Golaszewski <bgolaszewski@baylibre.com> Acked-by:
Wolfram Sang <wsa@the-dreams.de>
-
- May 31, 2019
-
-
Gustavo A. R. Silva authored
One of the more common cases of allocation size calculations is finding the size of a structure that has a zero-sized array at the end, along with memory for some number of elements for that array. For example: struct foo { int stuff; struct boo entry[]; }; size = sizeof(struct foo) + count * sizeof(struct boo); instance = devm_kzalloc(dev, size, GFP_KERNEL); Instead of leaving these open-coded and prone to type mistakes, we can now use the new struct_size() helper: instance = devm_kzalloc(dev, struct_size(instance, entry, count), GFP_KERNEL); Notice that, in this case, variable at24_size is not necessary, hence it is removed. This code was detected with the help of Coccinelle. Signed-off-by:
Gustavo A. R. Silva <gustavo@embeddedor.com> Signed-off-by:
Bartosz Golaszewski <bgolaszewski@baylibre.com>
-
YueHaibing authored
Fixes gcc '-Wunused-but-set-variable' warning: drivers/misc/eeprom/at24.c: In function at24_make_dummy_client: drivers/misc/eeprom/at24.c:514:21: warning: variable addr set but not used [-Wunused-but-set-variable] It's not used since commit e7308628 ("eeprom: at24: use devm_i2c_new_dummy_device()") Signed-off-by:
YueHaibing <yuehaibing@huawei.com> Signed-off-by:
Bartosz Golaszewski <bgolaszewski@baylibre.com>
-
- May 28, 2019
-
-
Bartosz Golaszewski authored
If we move the nvmem registration above the pm enable calls and the test read, we can drop the error label and make the code more readable as there's now only a single place where we must call pm_runtime_disable() in error path. Signed-off-by:
Bartosz Golaszewski <bgolaszewski@baylibre.com>
-
Bartosz Golaszewski authored
Now that it's upstream, use the resource managed version of i2c_new_dummy_device(). Signed-off-by:
Bartosz Golaszewski <bgolaszewski@baylibre.com> Reviewed-by:
Wolfram Sang <wsa+renesas@sang-engineering.com>
-
- Feb 14, 2019
-
-
Bartosz Golaszewski authored
If the device node defines 'num-addresses', let it override the default behavior. Signed-off-by:
Bartosz Golaszewski <bgolaszewski@baylibre.com>
-
Bartosz Golaszewski authored
There are no more users of at24_platform_data. Remove the relevant header and modify the driver code to not use it anymore. Signed-off-by:
Bartosz Golaszewski <bgolaszewski@baylibre.com>
-
- Dec 10, 2018
-
-
Adrian Bunk authored
Works with ST M24M02. Signed-off-by:
Adrian Bunk <bunk@kernel.org> Signed-off-by:
Bartosz Golaszewski <brgl@bgdev.pl>
-
- Oct 02, 2018
-
-
Wang Xin authored
Within at24_loop_until_timeout the timestamp used for timeout checking is recorded after the I2C transfer and sleep_range(). Under high CPU load either the execution time for I2C transfer or sleep_range() could actually be larger than the timeout value. Worst case the I2C transfer is only tried once because the loop will exit due to the timeout although the EEPROM is now ready. To fix this issue the timestamp is recorded at the beginning of each iteration. That is, before I2C transfer and sleep. Then the timeout is actually checked against the timestamp of the previous iteration. This makes sure that even if the timeout is reached, there is still one more chance to try the I2C transfer in case the EEPROM is ready. Example: If you have a system which combines high CPU load with repeated EEPROM writes you will run into the following scenario. - System makes a successful regmap_bulk_write() to EEPROM. - System wants to perform another write to EEPROM but EEPROM is still busy with the last write. - Because of high CPU load the usleep_range() will sleep more than 25 ms (at24_write_timeout). - Within the over-long sleeping the EEPROM finished the previous write operation and is ready again. - at24_loop_until_timeout() will detect timeout and won't try to write. Signed-off-by:
Wang Xin <xin.wang7@cn.bosch.com> Signed-off-by:
Mark Jonas <mark.jonas@de.bosch.com> Signed-off-by:
Bartosz Golaszewski <brgl@bgdev.pl>
-
- Jul 25, 2018
-
-
Alan Chiang authored
Provide a flexible way to determine the addressing bits of eeprom. Pass the addressing bits to driver through address-width property. Signed-off-by:
Alan Chiang <alanx.chiang@intel.com> Signed-off-by:
Andy Yeh <andy.yeh@intel.com> Signed-off-by:
Bartosz Golaszewski <brgl@bgdev.pl>
-
- May 16, 2018
-
-
Bartosz Golaszewski authored
Move the code responsible for creating the dummy i2c clients used by chips taking multiple slave addresses to a separate function. Signed-off-by:
Bartosz Golaszewski <brgl@bgdev.pl> Reviewed-by:
Peter Rosin <peda@axentia.se>
-
Bartosz Golaszewski authored
This allows us to drop two opencoded for loops. We also don't need to check if the i2c client is NULL before calling i2c_unregister_device(). Signed-off-by:
Bartosz Golaszewski <brgl@bgdev.pl> Reviewed-by:
Peter Rosin <peda@axentia.se>
-
Bartosz Golaszewski authored
We now have a managed variant of nvmem_register(). Use it in at24_probe(). Signed-off-by:
Bartosz Golaszewski <brgl@bgdev.pl> Reviewed-by:
Peter Rosin <peda@axentia.se>
-
Bartosz Golaszewski authored
Commit feb2f19b ("eeprom: at24: move platform data processing into a separate routine") introduced a bug where we incorrectly retireve the at24_chip_data structure. Remove the unnecessary ampersand operator. Fixes: feb2f19b ("eeprom: at24: move platform data processing into a separate routine") Reported-by:
Vadim Pasternak <vadimp@mellanox.com> Signed-off-by:
Bartosz Golaszewski <brgl@bgdev.pl>
-
- May 09, 2018
-
-
Bartosz Golaszewski authored
Commit feb2f19b ("eeprom: at24: move platform data processing into a separate routine") introduced a bug where we incorrectly retireve the at24_chip_data structure. Remove the unnecessary ampersand operator. Fixes: feb2f19b ("eeprom: at24: move platform data processing into a separate routine") Reported-by:
Vadim Pasternak <vadimp@mellanox.com> Signed-off-by:
Bartosz Golaszewski <brgl@bgdev.pl>
-
- Mar 23, 2018
-
-
Bartosz Golaszewski authored
Replace the GPL (or later) header with the SPDX identifier for GPL-2.0+. Signed-off-by:
Bartosz Golaszewski <brgl@bgdev.pl> Tested-by:
Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by:
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Bartosz Golaszewski authored
Save one call and make code prettier by checking the i2c functionality in the beginning of at24_probe(), saving the relevant values and reusing them later. Signed-off-by:
Bartosz Golaszewski <brgl@bgdev.pl> Tested-by:
Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by:
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Bartosz Golaszewski authored
Align the broken line with the opening parenthesis to stay consistent with the rest of the driver code. Signed-off-by:
Bartosz Golaszewski <brgl@bgdev.pl> Tested-by:
Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by:
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Bartosz Golaszewski authored
Remove the newline between the nvmem registration and its return value check. This is consistent with the rest of the driver code. Add a missing newline between two pdata checks to stay consistent with all the others. Signed-off-by:
Bartosz Golaszewski <brgl@bgdev.pl> Tested-by:
Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by:
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Bartosz Golaszewski authored
The code in at24_probe() is pretty mangled. It can be cleaned up a bit by doing things one by one. Let's group the code by logic: parse and verify pdata, initialize the regmap, allocate and fill the fields of at24_data, allocate dummy i2c devices, initialize pm & register with nvmem. Signed-off-by:
Bartosz Golaszewski <brgl@bgdev.pl> Tested-by:
Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by:
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Bartosz Golaszewski authored
Not all fields from at24_platform_data are needed in at24_data. Let's keep just the ones we need and not carry the whole platform_data structure all the time. Signed-off-by:
Bartosz Golaszewski <brgl@bgdev.pl> Tested-by:
Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by:
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-