From: Heiner Kallweit <hkallweit1@gmail.com>
To: Jean Delvare <jdelvare@suse.com>, Arnd Bergmann <arnd@arndb.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "linux-i2c@vger.kernel.org" <linux-i2c@vger.kernel.org>
Subject: Re: [PATCH RFC] eeprom: ee1004: add support for temperature sensor
Date: Mon, 18 Dec 2023 17:36:35 +0100 [thread overview]
Message-ID: <5ae9cb9f-cb56-445f-903b-9b6139c11bf2@gmail.com> (raw)
In-Reply-To: <c295881f-77aa-4f54-b06c-d48031d76339@gmail.com>
On 15.11.2023 12:17, Heiner Kallweit wrote:
> Jean and me are discussing how to best instantiate temperature sensors
> that can be found on RAM modules. First idea was to extend
> i2c_register_spd() but I think reading the "temp sensor present" flag
> from SPD can't be properly done from an i2c core level.
> Therefore, for DDR4, do it from the ee1004 driver.
>
> The temp sensor i2c address can be derived from the SPD i2c address,
> so I think we can directly instantiate the device and don't have to
> probe for it.
> If the temp sensor has been instantiated already by other means
> (e.g. class-based auto-detection), then the busy-check in
> i2c_new_client_device will detect this.
>
> Link: https://www.spinics.net/lists/linux-i2c/msg65963.html
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
> drivers/misc/eeprom/ee1004.c | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)
>
> diff --git a/drivers/misc/eeprom/ee1004.c b/drivers/misc/eeprom/ee1004.c
> index a1acd7713..4bce8f9d9 100644
> --- a/drivers/misc/eeprom/ee1004.c
> +++ b/drivers/misc/eeprom/ee1004.c
> @@ -158,6 +158,22 @@ static struct bin_attribute *ee1004_attrs[] = {
>
> BIN_ATTRIBUTE_GROUPS(ee1004);
>
> +static void ee1004_probe_temp_sensor(struct i2c_client *client)
> +{
> + struct i2c_board_info info = { .type = "jc42" };
> + u8 byte14;
> + int ret;
> +
> + /* byte 14, bit 7 is set if temp sensor is present */
> + ret = ee1004_eeprom_read(client, &byte14, 14, 1);
> + if (ret != 1 || !(byte14 & BIT(7)))
> + return;
> +
> + info.addr = 0x18 | (client->addr & 7);
> +
> + i2c_new_client_device(client->adapter, &info);
> +}
> +
> static void ee1004_cleanup(int idx)
> {
> if (--ee1004_dev_count == 0)
> @@ -204,6 +220,9 @@ static int ee1004_probe(struct i2c_client *client)
> err = -EOPNOTSUPP;
> goto err_clients;
> }
> +
> + ee1004_probe_temp_sensor(client);
> +
> mutex_unlock(&ee1004_bus_lock);
>
> dev_info(&client->dev,
Jean, do you have any feedback on this one?
Also not sure why this patch is marked "superseded" in patchwork.
next prev parent reply other threads:[~2023-12-18 16:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-15 11:17 [PATCH RFC] eeprom: ee1004: add support for temperature sensor Heiner Kallweit
2023-12-18 16:36 ` Heiner Kallweit [this message]
2023-12-19 10:27 ` Wolfram Sang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5ae9cb9f-cb56-445f-903b-9b6139c11bf2@gmail.com \
--to=hkallweit1@gmail.com \
--cc=arnd@arndb.de \
--cc=gregkh@linuxfoundation.org \
--cc=jdelvare@suse.com \
--cc=linux-i2c@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox