History log of /linux-master/drivers/i2c/i2c-slave-eeprom.c
Revision Date Author Comments
# 834a9dc4 26-Feb-2023 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

i2c: Convert drivers to new .probe() callback

Now that .probe() was changed not to get the id parameter, drivers can
be converted back to that with the eventual goal to drop .probe_new().

Implement that for the i2c drivers that are part of the i2c core.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Wolfram Sang <wsa@kernel.org>


# 87ab7269 18-Nov-2022 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

i2c: slave-eeprom: Convert to i2c's .probe_new()

.probe_new() doesn't get the i2c_device_id * parameter, so determine
that explicitly in the probe function.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Wolfram Sang <wsa@kernel.org>


# ed5c2f5f 15-Aug-2022 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

i2c: Make remove callback return void

The value returned by an i2c driver's remove function is mostly ignored.
(Only an error message is printed if the value is non-zero that the
error is ignored.)

So change the prototype of the remove function to return no value. This
way driver authors are not tempted to assume that passing an error to
the upper layer is a good idea. All drivers are adapted accordingly.
There is no intended change of behaviour, all callbacks were prepared to
return 0 before.

Reviewed-by: Peter Senna Tschudin <peter.senna@gmail.com>
Reviewed-by: Jeremy Kerr <jk@codeconstruct.com.au>
Reviewed-by: Benjamin Mugnier <benjamin.mugnier@foss.st.com>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Crt Mori <cmo@melexis.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Marek Behún <kabel@kernel.org> # for leds-turris-omnia
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Petr Machata <petrm@nvidia.com> # for mlxsw
Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com> # for surface3_power
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> # for bmc150-accel-i2c + kxcjk-1013
Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> # for media/* + staging/media/*
Acked-by: Miguel Ojeda <ojeda@kernel.org> # for auxdisplay/ht16k33 + auxdisplay/lcd2s
Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com> # for versaclock5
Reviewed-by: Ajay Gupta <ajayg@nvidia.com> # for ucsi_ccg
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> # for iio
Acked-by: Peter Rosin <peda@axentia.se> # for i2c-mux-*, max9860
Acked-by: Adrien Grassein <adrien.grassein@gmail.com> # for lontium-lt8912b
Reviewed-by: Jean Delvare <jdelvare@suse.de> # for hwmon, i2c-core and i2c/muxes
Acked-by: Corey Minyard <cminyard@mvista.com> # for IPMI
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com> # for drivers/power
Acked-by: Krzysztof Hałasa <khalasa@piap.pl>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Wolfram Sang <wsa@kernel.org>


# 4db7e178 21-Jul-2020 Gustavo A. R. Silva <gustavoars@kernel.org>

i2c: busses: Use fallthrough pseudo-keyword

Replace the existing /* fall through */ comments and its variants with
the new pseudo-keyword macro fallthrough[1].

[1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through

Acked-by: Baruch Siach <baruch@tkos.co.il>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Brendan Higgins <brendanhiggins@google.com>
Reviewed-by: Gregory CLEMENT <gregory.clement@bootlin.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Wolfram Sang <wsa@kernel.org>


# 468ed57f 25-May-2020 Wolfram Sang <wsa+renesas@sang-engineering.com>

i2c: slave-eeprom: update documentation to recent changes

Support for 16-bit addresses has been added, so remove it from the todo
list. Also, in the introductory sentence, may clear we talk about "slave
IP cores" to make reading easier.

Fixes: 82d514815441 ("i2c-eeprom_slave: Add support for more eeprom models")
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Wolfram Sang <wsa@kernel.org>


# bee0d92c 25-May-2020 Wolfram Sang <wsa+renesas@sang-engineering.com>

i2c: slave-eeprom: skip useless initialization

We have a kzalloced struct, no need to init to 0.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Wolfram Sang <wsa@kernel.org>


# 5c71ca4d 12-May-2020 Wolfram Sang <wsa+renesas@sang-engineering.com>

i2c: slave-eeprom: add support for 24c512 EEPROMs

I don't plan to support every EEPROM type, but the 24c512 ones need a
tiny code update, so let's have that upstream.

Reported-by: Patrick Williams <patrick@stwcx.xyz>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Patrick Williams <patrick@stwcx.xyz>
Signed-off-by: Wolfram Sang <wsa@kernel.org>


# e804f0a7 24-Apr-2020 Björn Ardö <bjorn.ardo@axis.com>

i2c: slave-eeprom: Make it possible to pre-load eeprom data

If the slave eeprom has a "firmware-name" in devicetree, then pre-load
the data in the eeprom with this file. Otherwise we init the eeprom with
0xFF.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Signed-off-by: Björn Ardö <bjorn.ardo@axis.com>
[wsa: some cosmetic changes]
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>


# 6b060d8a 14-Feb-2020 chenqiwu <chenqiwu@xiaomi.com>

i2c: use kobj_to_dev() API

Use kobj_to_dev() API instead of container_of().

Signed-off-by: chenqiwu <chenqiwu@xiaomi.com>
Reviewed-by: Luca Ceresoli <luca@lucaceresoli.net>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>


# 11af27f4 06-Sep-2019 Björn Ardö <bjorn.ardo@axis.com>

i2c: slave-eeprom: Add read only mode

Add read-only versions of all EEPROMs. These versions are read-only
on the i2c side, but can be written from the sysfs side.

Signed-off-by: Björn Ardö <bjorn.ardo@axis.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>


# fe050f99 05-Sep-2019 Björn Ardö <bjorn.ardo@axis.com>

i2c: slave-eeprom: Add comment about address handling

The behaviour of the EEPROM in the case where we only send an 8bit
address to a 16bit address EEPROM is not defined. Added comment about
that the slave-eeprom might behave differently from how an actual device
does (only one model measured).

Reported-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Björn Ardö <bjorn.ardo@axis.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>


# 82d51481 04-Sep-2019 Björn Ardö <bjorn.ardo@axis.com>

i2c-eeprom_slave: Add support for more eeprom models

Add a 32 and a 64 kbit memory. These needs 16 bit address
so added support for that as well.

Signed-off-by: Björn Ardö <bjorn.ardo@axis.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>


# b886d83c 01-Jun-2019 Thomas Gleixner <tglx@linutronix.de>

treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 441

Based on 1 normalized pattern(s):

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
the free software foundation version 2 of the license

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-only

has been chosen to replace the boilerplate/reference in 315 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Allison Randal <allison@lohutok.net>
Reviewed-by: Armijn Hemel <armijn@tjaldur.nl>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190531190115.503150771@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 069d5b74 09-Jul-2015 Krzysztof Kozlowski <krzk@kernel.org>

i2c: Drop owner assignment from i2c_driver

i2c_driver does not need to set an owner because i2c_register_driver()
will set it.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>


# 1f023297 26-Jul-2015 Vladimir Zapolskiy <vz@mleia.com>

i2c: slave eeprom: clean up sysfs bin attribute read()/write()

The change removes redundant sysfs binary file boundary checks,
since this task is already done on caller side in fs/sysfs/file.c

Note, on file size overflow read() now returns 0, and this is a
correct and expected EOF notification according to POSIX.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>


# 98e982b3a 23-Mar-2015 Wolfram Sang <wsa+renesas@sang-engineering.com>

i2c: slave-eeprom: add more info when to increase the pointer

It is a bit subtle when to correctly increase the buffer index when
reading. Make this clearer by adding some more comments and pointers to
the docs.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>


# 5b77d162 23-Mar-2015 Wolfram Sang <wsa+renesas@sang-engineering.com>

i2c: slave: rework the slave API

After more discussion, brave users, and additional datasheet evaluation,
some API updates for the new I2C slave framework became imminent. The
slave events now get some easier to understand naming. Also, the event
handling has been simplified to only need a single call to the slave
callback when an action by the backend is required.

Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>


# 2541f7f4 19-Jan-2015 Wolfram Sang <wsa+renesas@sang-engineering.com>

i2c: slave-eeprom: fix boundary check when using sysfs

Due to a copy&paste error, the last byte of the shared memory was not
accessible via sysfs.

Reported-by: Debora Grosse <debora@mds.com>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>


# 389be323 18-Nov-2014 Wolfram Sang <wsa+renesas@sang-engineering.com>

i2c: slave-eeprom: add eeprom simulator driver

The first user of the i2c-slave interface is an eeprom simulator. It is
a shared memory which can be accessed by the remote master via I2C and
locally via sysfs.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>