summaryrefslogtreecommitdiff
path: root/drivers/misc/eeprom
AgeCommit message (Collapse)AuthorFilesLines
2021-12-03misc: at25: Reorganize headers for better maintenanceAndy Shevchenko1-6/+7
Split headers to three groups and sort alphabetically in each of them. Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20211125213203.86693-9-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-12-03misc: at25: Factor out at_fram_to_chip()Andy Shevchenko1-41/+44
In the similar way as it's done for EEPROM, factor out a new helper function for FRAM. Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20211125213203.86693-8-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-12-03misc: at25: Switch to use BIT() instead of custom approachesAndy Shevchenko1-4/+4
It's obvious that custom approach of getting power of 2 number with int_pow() kinda interesting. Replace it and some others approaches by using a simple BIT() operation. Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20211125213203.86693-7-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-12-03misc: at25: Get rid of intermediate storage for AT25 chip dataAndy Shevchenko1-17/+15
There is no need to copy twice the same data. Drop needless local variable. Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20211125213203.86693-6-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-12-03misc: at25: Get platform data via dev_get_platdata()Andy Shevchenko1-3/+4
Access to platform data via dev_get_platdata() getter to make code cleaner. Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20211125213203.86693-5-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-12-03misc: at25: Check new property ("address-width") firstAndy Shevchenko1-4/+4
As it's done elsewhere in at25_fw_to_chip() check new property ("address-width") first. Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20211125213203.86693-4-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-12-03misc: at25: Unshadow error codes in at25_fw_to_chip()Andy Shevchenko1-18/+22
device_property_read_u32() may return different error codes. Unshadow them in the at25_fw_to_chip() to give better error report. Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20211125213203.86693-3-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-12-03misc: at25: Use at25->chip instead of local chip everywhere in ->probe()Andy Shevchenko1-7/+7
Currently some values are compared against the contents of the chip structure and most are from its updated copy in at25->chip. Use the latter one everywhere in ->probe(). Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20211125213203.86693-2-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-12-03misc: at25: Check proper value of chip length in FRAM caseAndy Shevchenko1-2/+2
Obviously the byte_len value should be checked from the chip and not from at25->chip. Fixes: fd307a4ad332 ("nvmem: prepare basics for FRAM support") Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20211125212729.86585-4-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-12-03misc: at25: Don't copy garbage to the at25->chip in FRAM caseAndy Shevchenko1-1/+4
Even if we know that we are going to fill everything later on it's bad style and fragile to copy garbage from the stack to the data structure that will be used in the driver. Fixes: fd307a4ad332 ("nvmem: prepare basics for FRAM support") Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20211125212729.86585-3-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-12-03misc: at25: Make driver OF independent againAndy Shevchenko1-7/+6
The commit f60e7074902a ("misc: at25: Make use of device property API") made a good job by enabling the driver for non-OF platforms, but the recent commit 604288bc6196 ("nvmem: eeprom: at25: fix type compiler warnings") brought that back. Restore greatness of the driver once again. Fixes: eab61fb1cc2e ("nvmem: eeprom: at25: fram discovery simplification") Fixes: fd307a4ad332 ("nvmem: prepare basics for FRAM support") Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20211125212729.86585-2-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-12-03nvmem: eeprom: at25: fix FRAM byte_lenRalph Siemsen1-20/+18
Commit fd307a4ad332 ("nvmem: prepare basics for FRAM support") added support for FRAM devices such as the Cypress FM25V. During testing, it was found that the FRAM detects properly, however reads and writes fail. Upon further investigation, two problem were found in at25_probe() routine. 1) In the case of an FRAM device without platform data, eg. fram == true && spi->dev.platform_data == NULL the stack local variable "struct spi_eeprom chip" is not initialized fully, prior to being copied into at25->chip. The chip.flags field in particular can cause problems. 2) The byte_len of FRAM is computed from its ID register, and is stored into the stack local "struct spi_eeprom chip" structure. This happens after the same structure has been copied into at25->chip. As a result, at25->chip.byte_len does not contain the correct length of the device. In turn this can cause checks at beginning of at25_ee_read() to fail (or equally, it could allow reads beyond the end of the device length). Fix both of these issues by eliminating the on-stack struct spi_eeprom. Instead use the one inside at25_data structure, which starts of zeroed. Fixes: fd307a4ad332 ("nvmem: prepare basics for FRAM support") Cc: stable <stable@vger.kernel.org> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Ralph Siemsen <ralph.siemsen@linaro.org> Link: https://lore.kernel.org/r/20211108181627.645638-1-ralph.siemsen@linaro.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-12-01eeprom: at24: remove struct at24_clientHeiner Kallweit1-35/+18
We use member client only to get a reference to the associated struct device, via &client->dev. However we can get the same reference from the associated regmap, via regmap_get_device(regmap). Therefore struct at24_client can be removed and replaced with a regmap pointer. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
2021-11-03at24: Support probing while in non-zero ACPI D stateSakari Ailus1-18/+27
In certain use cases (where the chip is part of a camera module, and the camera module is wired together with a camera privacy LED), powering on the device during probe is undesirable. Add support for the at24 to execute probe while being in ACPI D state other than 0 (which means fully powered on). Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Tomasz Figa <tfiga@chromium.org> Acked-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2021-10-15eeprom: 93xx46: fix MODULE_DEVICE_TABLEArnd Bergmann1-1/+1
The newly added SPI device ID table does not work because the entry is incorrectly copied from the OF device table. During build testing, this shows as a compile failure when building it as a loadable module: drivers/misc/eeprom/eeprom_93xx46.c:424:1: error: redefinition of '__mod_of__eeprom_93xx46_of_table_device_table' MODULE_DEVICE_TABLE(of, eeprom_93xx46_of_table); Change the entry to refer to the correct symbol. Fixes: 137879f7ff23 ("eeprom: 93xx46: Add SPI device ID table") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Link: https://lore.kernel.org/r/20211014153730.3821376-1-arnd@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-10-05eeprom: 93xx46: Add SPI device ID tableMark Brown1-0/+18
Currently autoloading for SPI devices does not use the DT ID table, it uses SPI modalises. Supporting OF modalises is going to be difficult if not impractical, an attempt was made but has been reverted, so ensure that module autoloading works for this driver by adding a SPI device ID table. Fixes: 96c8395e2166 ("spi: Revert modalias changes") Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20210922184048.34770-1-broonie@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-10-05eeprom: at25: Add SPI ID tableMark Brown1-0/+8
Currently autoloading for SPI devices does not use the DT ID table, it uses SPI modalises. Supporting OF modalises is going to be difficult if not impractical, an attempt was made but has been reverted, so ensure that module autoloading works for this driver by adding an id_table listing the SPI IDs for everything. Fixes: 96c8395e2166 ("spi: Revert modalias changes") Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20210923172453.4921-1-broonie@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-07-20Merge tag 'at24-fixes-for-v5.14' of ↵Wolfram Sang1-10/+7
git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux into i2c/for-current at24 fixes for v5.14 - fix a problem with repeating labels not getting a device id
2021-07-01misc: eeprom: at24: Always append device id even if label property is set.Jérôme Glisse1-10/+7
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 4e302c3b568e Reported-by: Alexander Fomichev <fomichev.ru@gmail.com> Fixes: 4e302c3b568e ("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>
2021-06-12nvmem: eeprom: at25: fram discovery simplificationJiri Prchal1-8/+5
Changed "is_fram" to bool and set it based on compatible string. Signed-off-by: Jiri Prchal <jiri.prchal@aksignal.cz> Link: https://lore.kernel.org/r/20210611152416.68386-1-jiri.prchal@aksignal.cz Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-06-11nvmem: eeprom: at25: fix type compiler warningsJiri Prchal1-3/+3
Fixes: drivers/misc/eeprom/at25.c:181:28: warning: field width should have type 'int', but argument has type 'unsigned long' drivers/misc/eeprom/at25.c:386:13: warning: cast to smaller integer type 'int' from 'const void *' Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Jiri Prchal <jiri.prchal@aksignal.cz> Fixes: fd307a4ad332 ("nvmem: prepare basics for FRAM support") Link: https://lore.kernel.org/r/20210611142706.27336-1-jiri.prchal@aksignal.cz Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-06-11nvmem: prepare basics for FRAM supportJiri Prchal2-32/+134
Added enum and string for FRAM (ferroelectric RAM) to expose it as file named "fram". Added documentation of sysfs file. Signed-off-by: Jiri Prchal <jiri.prchal@aksignal.cz> Link: https://lore.kernel.org/r/20210611094601.95131-2-jiri.prchal@aksignal.cz Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-06-09eeprom: idt_89hpesx: use SPDX-License-IdentifierAndy Shevchenko1-32/+1
Use SPDX-License-Identifier: GPL-2.0-only, instead of hand writing it. Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20210607221757.81465-3-andy.shevchenko@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-06-09eeprom: idt_89hpesx: Restore printing the unsupported fwnode nameAndy Shevchenko1-4/+3
When iterating over child firmware nodes restore printing the name of ones that are not supported. While at it, refactor loop body to clearly show that we stop at the first match. Fixes: db15d73e5f0e ("eeprom: idt_89hpesx: Support both ACPI and OF probing") Cc: Huy Duong <qhuyduong@hotmail.com> Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20210607221757.81465-2-andy.shevchenko@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-06-09eeprom: idt_89hpesx: Put fwnode in matching case during ->probe()Andy Shevchenko1-0/+1
device_get_next_child_node() bumps a reference counting of a returned variable. We have to balance it whenever we return to the caller. Fixes: db15d73e5f0e ("eeprom: idt_89hpesx: Support both ACPI and OF probing") Cc: Huy Duong <qhuyduong@hotmail.com> Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20210607221757.81465-1-andy.shevchenko@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-06-04eeprom: ee1004: Remove not needed debug messageHeiner Kallweit1-5/+1
If a user is interested in such transfer statistics he can simply switch on smbus tracing. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Link: https://lore.kernel.org/r/6169f52e-6ede-d7cc-7f8b-cced55b693d0@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-05-27eeprom: ee1004: Add helper ee1004_cleanupHeiner Kallweit1-14/+11
Factor out the cleanup code to a new helper ee1004_cleanup(). Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Link: https://lore.kernel.org/r/9738cbc7-458d-276f-4012-66551f105d90@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-05-27eeprom: ee1004: Add constant EE1004_NUM_PAGESHeiner Kallweit1-4/+5
Add a constant for the number of pages. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Link: https://lore.kernel.org/r/6167f9c5-995a-03c3-c324-e93e2a6c969b@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-05-27eeprom: ee1004: Move call to ee1004_set_current_page to ee1004_eeprom_readHeiner Kallweit1-17/+9
Moving the call to ee1004_set_current_page() to ee1004_eeprom_read() allows to simplify the code. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Link: https://lore.kernel.org/r/2829a131-51e3-8865-462a-564080158b0b@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-05-27eeprom: ee1004: Improve error handling in ee1004_readHeiner Kallweit1-18/+13
Simplify the error handling and make it better readable. No functional change intended. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Link: https://lore.kernel.org/r/13ad7b39-e722-d70a-e25b-03d1fb1734a7@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-05-27eeprom: ee1004: Factor out setting page to ee1004_set_current_pageHeiner Kallweit1-22/+30
Factor out setting the page, this makes the code better readable. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Link: https://lore.kernel.org/r/21e0966f-e6c9-045f-b130-bd9fb071f0d7@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-05-27eeprom: ee1004: Cache current page at initialization of first device onlyHeiner Kallweit1-8/+7
The value of ee1004_current_page applies to all SPD eeproms connected to the adapter. Therefore it's sufficient if we set ee1004_current_page when the first device is added. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Link: https://lore.kernel.org/r/b9240e58-08bb-3d71-7a9c-9a323b470ab6@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-05-27eeprom: ee1004: Switch to i2c probe_new callbackHeiner Kallweit1-3/+2
Switch to the new i2c_driver probe callback version. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Link: https://lore.kernel.org/r/eb5be659-7427-46c5-66c2-b39650e08ea3@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-05-27eeprom: ee1004: Improve creating dummy devicesHeiner Kallweit1-7/+6
i2c_new_dummy_device() calls i2c_new_client_device() that complains if it fails to create the device. Therefore we don't have to emit an error message in case of failure. In addition ensure that ee1004_set_page is only set if creating the device succeeded. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Link: https://lore.kernel.org/r/d38df5ac-6ecb-7d5f-b5c3-39bfc6a1e8a1@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-05-27eeprom: ee1004: Improve check for SMBUS featuresHeiner Kallweit1-18/+4
We have to read 512 bytes only, therefore read performance isn't really a concern. Don't bother the user if i2c block read isn't supported. For i2c_smbus_read_i2c_block_data_or_emulated() to work it's sufficient if I2C_FUNC_SMBUS_READ_I2C_BLOCK or I2C_FUNC_SMBUS_READ_BYTE_DATA is supported. Therefore remove the check for I2C_FUNC_SMBUS_READ_WORD_DATA. In addition check for I2C_FUNC_SMBUS_WRITE_BYTE (included in I2C_FUNC_SMBUS_BYTE) which is needed for setting the page. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Link: https://lore.kernel.org/r/840c668e-6310-e933-e50e-5abeaecfb39c@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-05-27eeprom: ee1004: Remove usage of i2c_adapter_id in adapter comparisonHeiner Kallweit1-2/+1
We can compare the adapter pointers directly instead of using i2c_adapter_id(). Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Link: https://lore.kernel.org/r/99a3f94d-e7ca-e01d-6a78-81e109fde086@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-05-27eeprom: ee1004: Remove not needed check in ee1004_eeprom_readHeiner Kallweit1-3/+1
i2c_smbus_read_i2c_block_data_or_emulated() checks its length argument, so we don't have to do it. In addition remove the unlikely hint from the checks, we do i2c reads and therefore are in a slow path. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Link: https://lore.kernel.org/r/eb2a8bff-43ec-c763-a417-9d741e6f0034@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-05-27eeprom: ee1004: Remove not needed check in ee1004_readHeiner Kallweit1-3/+0
sysfs_kf_bin_read() checks this for us already. In addition the function works correctly also w/o this check. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Link: https://lore.kernel.org/r/33889bff-3614-4b73-5010-701635e1edab@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-05-27eeprom: ee1004: Use kobj_to_i2c_client to simplify the codeHeiner Kallweit1-2/+1
Switch to helper kobj_to_i2c_client() to simplify the code. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Link: https://lore.kernel.org/r/4ae57f09-b803-6ae3-c734-87e733a56eb8@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-05-21eeprom: ee1004: Let device core handle attribute eepromHeiner Kallweit1-17/+9
Instead of creating/removing the attribute ourselves, just declare the attribute and let the device core handle it. This allows to simplify the code. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Link: https://lore.kernel.org/r/8a6c77f2-f84a-311b-c2b9-21798f690e4d@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-05-21Merge 50f09a3dd587 ("Merge tag 'char-misc-5.13-rc3' of ↵Greg Kroah-Hartman1-2/+4
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc") into char-misc-next We want the char/misc driver fixes in here as well Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-05-14misc: eeprom: at24: check suspend status before disable regulatorHsin-Yi Wang1-2/+4
cd5676db0574 ("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: cd5676db0574 ("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>
2021-05-14misc: eeprom_93xx46: Add new 93c56 and 93c66 compatible stringsEmmanuel Gil Peyrot1-3/+32
These two devices have respectively 2048 and 4096 bits of storage, compared to 1024 for the 93c46. Reviewed-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net> Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> Link: https://lore.kernel.org/r/20210511210727.24895-3-linkmauve@linkmauve.fr Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-05-14misc: eeprom_93xx46: Remove hardcoded bit lengthsEmmanuel Gil Peyrot1-25/+32
This avoids using magic numbers based on the length of an address or a command, while we only want to differentiate between 8-bit and 16-bit. The driver was previously wrapping around the offset in the write operation, this now returns -EINVAL instead (but should never happen in the first place). If two pointer indirections are too many, we could move the flags to the main struct instead, but I doubt it’s going to make any sensible difference on any hardware. Reviewed-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net> Signed-off-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> Link: https://lore.kernel.org/r/20210511210727.24895-2-linkmauve@linkmauve.fr Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-01-20misc: eeprom_93xx46: Add quirk to support Microchip 93LC46B eepromAswath Govindraju1-0/+15
A dummy zero bit is sent preceding the data during a read transfer by the Microchip 93LC46B eeprom (section 2.7 of[1]). This results in right shift of data during a read. In order to ignore this bit a quirk can be added to send an extra zero bit after the read address. Add a quirk to ignore the zero bit sent before data by adding a zero bit after the read address. [1] - https://www.mouser.com/datasheet/2/268/20001749K-277859.pdf Signed-off-by: Aswath Govindraju <a-govindraju@ti.com> Link: https://lore.kernel.org/r/20210105105817.17644-3-a-govindraju@ti.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-01-13misc: eeprom_93xx46: Add module alias to avoid breaking support for non ↵Aswath Govindraju1-0/+1
device tree users Module alias "spi:93xx46" is used by non device tree users like drivers/misc/eeprom/digsy_mtc_eeprom.c and removing it will break support for them. Fix this by adding back the module alias "spi:93xx46". Fixes: 13613a2246bf ("misc: eeprom_93xx46: Fix module alias to enable module autoprobe") Signed-off-by: Aswath Govindraju <a-govindraju@ti.com> Link: https://lore.kernel.org/r/20210113051253.15061-1-a-govindraju@ti.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-01-07misc: eeprom_93xx46: Enable module autoprobe for microchip 93LC46B eepromAswath Govindraju1-0/+1
Add module alias to enable autoprobe for microchip 93LC46B eeprom by using /sys/class/.../spi1.0/modalias content. Signed-off-by: Aswath Govindraju <a-govindraju@ti.com> Link: https://lore.kernel.org/r/20210107163957.28664-3-a-govindraju@ti.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-01-07misc: eeprom_93xx46: Fix module alias to enable module autoprobeAswath Govindraju1-1/+1
Fix module autoprobe by correcting module alias to match the string from /sys/class/.../spi1.0/modalias content. Fixes: 06b4501e88ad ("misc/eeprom: add driver for microwire 93xx46 EEPROMs") Signed-off-by: Aswath Govindraju <a-govindraju@ti.com> Link: https://lore.kernel.org/r/20210107163957.28664-2-a-govindraju@ti.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-12-16Merge tag 'char-misc-5.11-rc1' of ↵Linus Torvalds1-0/+3
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc Pull char / misc driver updates from Greg KH: "Here is the big char/misc driver update for 5.11-rc1. Continuing the tradition of previous -rc1 pulls, there seems to be more and more tiny driver subsystems flowing through this tree. Lots of different things, all of which have been in linux-next for a while with no reported issues: - extcon driver updates - habannalab driver updates - mei driver updates - uio driver updates - binder fixes and features added - soundwire driver updates - mhi bus driver updates - phy driver updates - coresight driver updates - fpga driver updates - speakup driver updates - slimbus driver updates - various small char and misc driver updates" * tag 'char-misc-5.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (305 commits) extcon: max77693: Fix modalias string extcon: fsa9480: Support TI TSU6111 variant extcon: fsa9480: Rewrite bindings in YAML and extend dt-bindings: extcon: add binding for TUSB320 extcon: Add driver for TI TUSB320 slimbus: qcom: fix potential NULL dereference in qcom_slim_prg_slew() siox: Make remove callback return void siox: Use bus_type functions for probe, remove and shutdown spmi: Add driver shutdown support spmi: fix some coding style issues at the spmi core spmi: get rid of a warning when built with W=1 uio: uio_hv_generic: use devm_kzalloc() for private data alloc uio: uio_fsl_elbc_gpcm: use device-managed allocators uio: uio_aec: use devm_kzalloc() for uio_info object uio: uio_cif: use devm_kzalloc() for uio_info object uio: uio_netx: use devm_kzalloc() for or uio_info object uio: uio_mf624: use devm_kzalloc() for uio_info object uio: uio_sercos3: use device-managed functions for simple allocs uio: uio_dmem_genirq: finalize conversion of probe to devm_ handlers uio: uio_dmem_genirq: convert simple allocations to device-managed ...
2020-12-04misc: eeprom: at24: fix NVMEM name with custom AT24 device nameDiego Santa Cruz1-1/+0
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: 61f764c307f6 ("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>