mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stefan Wahren <stefan.wahren@i2se.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org,
	wsa@the-dreams.de, srinivas.kandagatla@linaro.org
Subject: Re: [PATCH RFC] eeprom: at24: extend driver to plug into the NVMEM framework
Date: Sun, 16 Aug 2015 10:28:06 +0200 (CEST)	[thread overview]
Message-ID: <2080648987.23864.1439713686409.JavaMail.open-xchange@oxbsltgw04.schlund.de> (raw)
In-Reply-To: <1439693649-10809-1-git-send-email-andrew@lunn.ch>

Hi Andrew,

> Andrew Lunn <andrew@lunn.ch> hat am 16. August 2015 um 04:54 geschrieben:
>
>
> Add a read only regmap for accessing the EEPROM, and then use that
> with the NVMEM framework.
>
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>
> ---
> drivers/misc/eeprom/at24.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 65 insertions(+)
>
> diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
> index 2d3db81be099..0e80c0c09d4e 100644
> --- a/drivers/misc/eeprom/at24.c
> +++ b/drivers/misc/eeprom/at24.c
> @@ -22,6 +22,8 @@
> #include <linux/jiffies.h>
> #include <linux/of.h>
> #include <linux/i2c.h>
> +#include <linux/nvmem-provider.h>
> +#include <linux/regmap.h>

shouldn't the dependancies in Kconfig updated (depends on REGMAP) too?

> #include <linux/platform_data/at24.h>
>
> /*
> @@ -69,6 +71,10 @@ struct at24_data {
> unsigned write_max;
> unsigned num_addresses;
>
> + struct regmap_config regmap_config;
> + struct nvmem_config nvmem_config;
> + struct nvmem_device *nvmem;
> +
> /*
> * Some chips tie up multiple I2C addresses; dummy devices reserve
> * them for us, and we'll use them with SMBus calls.
> @@ -471,6 +477,34 @@ static ssize_t at24_macc_write(struct memory_accessor
> *macc, const char *buf,
>
> /*-------------------------------------------------------------------------*/
>
> +/*
> + * Provide a regmap interface, which is registered with the NVMEM
> + * framework
> +*/
> +static int at24_regmap_read(void *context, const void *reg, size_t reg_size,
> + void *val, size_t val_size)
> +{
> + struct at24_data *at24 = context;
> + off_t offset = *(u32 *)reg;
> +
> + return at24_read(at24, val, offset, val_size);
> +}
> +
> +static int at24_regmap_write(void *context, const void *data, size_t count)
> +{
> + struct at24_data *at24 = context;
> +
> + return at24_write(at24, data, 0, count);

Since the patch only provides read only support this function could return 0.

Regards
Stefan

  reply	other threads:[~2015-08-16  8:28 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-16  2:54 Andrew Lunn
2015-08-16  8:28 ` Stefan Wahren [this message]
2015-08-16 13:11   ` Andrew Lunn
2015-08-16 15:37     ` Stefan Wahren
2015-08-17 13:01       ` Srinivas Kandagatla
2015-08-17 13:09         ` Andrew Lunn
2015-08-17 14:59           ` Srinivas Kandagatla
2015-08-17 15:25             ` Andrew Lunn
2015-08-17 15:41               ` Srinivas Kandagatla
2015-08-20 15:57               ` Maxime Ripard
2015-08-20 16:38                 ` Andrew Lunn
2015-08-20 21:52                   ` Maxime Ripard
2015-08-20 20:33               ` Wolfram Sang
2015-08-17  9:48 ` Srinivas Kandagatla

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=2080648987.23864.1439713686409.JavaMail.open-xchange@oxbsltgw04.schlund.de \
    --to=stefan.wahren@i2se.com \
    --cc=andrew@lunn.ch \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=srinivas.kandagatla@linaro.org \
    --cc=wsa@the-dreams.de \
    /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

all inboxes | Powered by JetHome®