* [PATCH 1/2] There are several eeprom drivers
@ 2020-08-27 13:25 Jean Delvare
2020-08-27 13:28 ` [PATCH 2/2] decode-vaio: Add support for the at24 driver Jean Delvare
2020-08-28 8:43 ` [PATCH 1/2] There are several eeprom drivers Wolfram Sang
0 siblings, 2 replies; 5+ messages in thread
From: Jean Delvare @ 2020-08-27 13:25 UTC (permalink / raw)
To: Linux I2C
There used to be only 1 eeprom driver (named "eeprom") but now
there are 3 and the legacy "eeprom" driver is not the preferred
option. So list all 3 drivers in our documentation to prevent
confusion.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
---
README | 3 ++-
eeprom/Module.mk | 4 ++--
2 files changed, 4 insertions(+), 3 deletions(-)
--- i2c-tools.orig/README 2020-08-27 10:28:54.972629860 +0200
+++ i2c-tools/README 2020-08-27 10:41:42.169866472 +0200
@@ -20,7 +20,8 @@ The various tools included in this packa
* eeprom
Perl scripts for decoding different types of EEPROMs (SPD, EDID...) These
- scripts rely on the "eeprom" kernel driver. They are installed by default.
+ scripts rely on the eeprom kernel drivers ("at24" and "ee1004", "eeprom" on
+ older kernels). They are installed by default.
* eeprog, eepromer
Tools for writing to EEPROMs. These tools rely on the "i2c-dev" kernel
--- i2c-tools.orig/eeprom/Module.mk 2020-08-27 10:28:54.972629860 +0200
+++ i2c-tools/eeprom/Module.mk 2020-08-27 10:56:11.760402361 +0200
@@ -1,6 +1,6 @@
-# EEPROM decoding scripts for the Linux eeprom driver
+# EEPROM decoding scripts for the Linux eeprom drivers
#
-# Copyright (C) 2007-2013 Jean Delvare <jdelvare@suse.de>
+# Copyright (C) 2007-2020 Jean Delvare <jdelvare@suse.de>
#
# 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
--
Jean Delvare
SUSE L3 Support
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH 2/2] decode-vaio: Add support for the at24 driver 2020-08-27 13:25 [PATCH 1/2] There are several eeprom drivers Jean Delvare @ 2020-08-27 13:28 ` Jean Delvare 2020-08-28 8:47 ` Wolfram Sang 2020-08-28 8:43 ` [PATCH 1/2] There are several eeprom drivers Wolfram Sang 1 sibling, 1 reply; 5+ messages in thread From: Jean Delvare @ 2020-08-27 13:28 UTC (permalink / raw) To: Linux I2C We have just added support for the VAIO EEPROM to the at24 kernel driver, so let this script handle it. Signed-off-by: Jean Delvare <jdelvare@suse.de> --- eeprom/decode-vaio | 40 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 36 insertions(+), 4 deletions(-) --- i2c-tools.orig/eeprom/decode-vaio 2020-08-27 10:55:47.615109809 +0200 +++ i2c-tools/eeprom/decode-vaio 2020-08-27 15:23:21.874934933 +0200 @@ -1,6 +1,6 @@ #!/usr/bin/perl -w # -# Copyright (C) 2002-2008 Jean Delvare <jdelvare@suse.de> +# Copyright (C) 2002-2020 Jean Delvare <jdelvare@suse.de> # # 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 @@ -19,7 +19,7 @@ # # EEPROM data decoding for Sony Vaio laptops. # -# The eeprom driver must be loaded. For kernels older than 2.6.0, the +# The at24 or eeprom driver must be loaded. For kernels older than 2.6.0, the # eeprom driver can be found in the lm-sensors package. # # Please note that this is a guess-only work. Sony support refused to help @@ -53,11 +53,39 @@ use strict; use Fcntl qw(:DEFAULT :seek); +use File::Basename; use vars qw($sysfs $found); -use constant VERSION => "1.6"; +use constant VERSION => "1.7"; use constant ONLYROOT => "Readable only by root"; +# From a sysfs device path and an attribute name, return the attribute +# value, or undef (stolen from sensors-detect) +sub sysfs_device_attribute +{ + my ($device, $attr) = @_; + my $value; + + open(local *FILE, "$device/$attr") or return ""; + $value = <FILE>; + close(FILE); + return unless defined $value; + + chomp($value); + return $value; +} + +# From a sysfs device path, return the driver name, or undef (stolen from +# sensors-detect) +sub sysfs_device_driver +{ + my $device = shift; + + my $link = readlink("$device/driver"); + return unless defined $link; + return basename($link); +} + sub print_item { my ($label,$value) = @_; @@ -209,10 +237,14 @@ END print("\n"); } -for (my $i = 0, $found=0; $i <= 4 && !$found; $i++) +for (my $i = 0, $found=0; $i <= 31 && !$found; $i++) { if (-r "/sys/bus/i2c/devices/$i-0057/eeprom") { + my $driver = sysfs_device_driver("/sys/bus/i2c/devices/$i-0057"); + my $name = sysfs_device_attribute("/sys/bus/i2c/devices/$i-0057", "name"); + next if ($driver eq "at24" && $name ne "24c02-vaio"); + $sysfs = 1; $found += vaio_decode($i, '57'); } -- Jean Delvare SUSE L3 Support ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] decode-vaio: Add support for the at24 driver 2020-08-27 13:28 ` [PATCH 2/2] decode-vaio: Add support for the at24 driver Jean Delvare @ 2020-08-28 8:47 ` Wolfram Sang 2020-08-29 8:18 ` Jean Delvare 0 siblings, 1 reply; 5+ messages in thread From: Wolfram Sang @ 2020-08-28 8:47 UTC (permalink / raw) To: Jean Delvare; +Cc: Linux I2C [-- Attachment #1: Type: text/plain, Size: 227 bytes --] > -for (my $i = 0, $found=0; $i <= 4 && !$found; $i++) > +for (my $i = 0, $found=0; $i <= 31 && !$found; $i++) Isn't this an unrelated change, scanning more busses? Should be at least mentioned in the commit message, if so. [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] decode-vaio: Add support for the at24 driver 2020-08-28 8:47 ` Wolfram Sang @ 2020-08-29 8:18 ` Jean Delvare 0 siblings, 0 replies; 5+ messages in thread From: Jean Delvare @ 2020-08-29 8:18 UTC (permalink / raw) To: Wolfram Sang; +Cc: Linux I2C On Fri, 28 Aug 2020 10:47:03 +0200, Wolfram Sang wrote: > > -for (my $i = 0, $found=0; $i <= 4 && !$found; $i++) > > +for (my $i = 0, $found=0; $i <= 31 && !$found; $i++) > > Isn't this an unrelated change, scanning more busses? Should be at least > mentioned in the commit message, if so. You're right, it should be a separate commit. I had to do this to be able to test my changes with i2c-stub instead of using the actual old Sony laptop. Then I forgot the change was there. I'll push that change anyway as it can't hurt and everything that makes testing easier is welcome. Thanks, -- Jean Delvare SUSE L3 Support ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] There are several eeprom drivers 2020-08-27 13:25 [PATCH 1/2] There are several eeprom drivers Jean Delvare 2020-08-27 13:28 ` [PATCH 2/2] decode-vaio: Add support for the at24 driver Jean Delvare @ 2020-08-28 8:43 ` Wolfram Sang 1 sibling, 0 replies; 5+ messages in thread From: Wolfram Sang @ 2020-08-28 8:43 UTC (permalink / raw) To: Jean Delvare; +Cc: Linux I2C [-- Attachment #1: Type: text/plain, Size: 404 bytes --] On Thu, Aug 27, 2020 at 03:25:23PM +0200, Jean Delvare wrote: > There used to be only 1 eeprom driver (named "eeprom") but now > there are 3 and the legacy "eeprom" driver is not the preferred > option. So list all 3 drivers in our documentation to prevent > confusion. > > Signed-off-by: Jean Delvare <jdelvare@suse.de> Oh yes, that is needed! Reviewed-by: Wolfram Sang <wsa@kernel.org> [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-08-29 8:18 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2020-08-27 13:25 [PATCH 1/2] There are several eeprom drivers Jean Delvare 2020-08-27 13:28 ` [PATCH 2/2] decode-vaio: Add support for the at24 driver Jean Delvare 2020-08-28 8:47 ` Wolfram Sang 2020-08-29 8:18 ` Jean Delvare 2020-08-28 8:43 ` [PATCH 1/2] There are several eeprom drivers Wolfram Sang
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox