public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Philippe De Muyter <phdm@macqel.be>
To: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Alessandro Zummo <a.zummo@towertech.it>,
	rtc-linux@googlegroups.com, linux-kernel@vger.kernel.org,
	Arnd Bergmann <arnd@arndb.de>
Subject: Re: [PATCH v2 2/2] rtc: add rtc-abx80x, a driver for the Abracon AB x80x i2c rtc
Date: Thu, 9 Apr 2015 15:31:22 +0200	[thread overview]
Message-ID: <20150409133122.GA4969@frolo.macqel> (raw)
In-Reply-To: <1427856743-26625-3-git-send-email-alexandre.belloni@free-electrons.com>

Hi Alexandre,

On Wed, Apr 01, 2015 at 04:52:23AM +0200, Alexandre Belloni wrote:
> From: Philippe De Muyter <phdm@macqel.be>
> 
> This is a basic driver for the ultra-low-power Abracon AB x80x series of RTC
> chips. It supports in particular, the supersets AB0805 and AB1805.
> It allows reading and writing the time, and enables the supercapacitor/
> battery charger.
> 
> [arnd@arndb.de: abx805 depends on i2c]
> Signed-off-by: Philippe De Muyter <phdm@macqel.be>
> Cc: Alessandro Zummo <a.zummo@towertech.it>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
...
> +static int abx80x_rtc_read_time(struct device *dev, struct rtc_time *tm)
> +{
> +	struct i2c_client *client = to_i2c_client(dev);
> +	unsigned char date[8];
> +	int err;
> +
> +	err = i2c_smbus_read_i2c_block_data(client, ABX8XX_REG_HTH,
> +					    sizeof(date), date);
> +	if (err < 0) {
> +		dev_err(&client->dev, "Unable to read date\n");
> +		return -EIO;
> +	}
> +
> +	tm->tm_sec = bcd2bin(date[ABX8XX_REG_SC] & 0x7F);
> +	tm->tm_min = bcd2bin(date[ABX8XX_REG_MN] & 0x7F);
> +	tm->tm_hour = bcd2bin(date[ABX8XX_REG_HR] & 0x3F);
> +	tm->tm_wday = date[ABX8XX_REG_WD] & 0x7;
> +	tm->tm_mday = bcd2bin(date[ABX8XX_REG_DA] & 0x3F);
> +	tm->tm_mon = bcd2bin(date[ABX8XX_REG_MO] & 0x1F) - 1;
> +	tm->tm_year = bcd2bin(date[ABX8XX_REG_YR]) + 100;

Just a minor nit: I would rather not name the buffer 'date', but 'buf' like
in abx80x_rtc_set_time.

> +
> +	err = rtc_valid_tm(tm);
> +	if (err < 0)
> +		dev_err(&client->dev, "retrieved date/time is not valid.\n");
> +
> +	return err;
> +}
> +
> +static int abx80x_rtc_set_time(struct device *dev, struct rtc_time *tm)
> +{
> +	struct i2c_client *client = to_i2c_client(dev);
> +	unsigned char buf[8];
> +	int err;
> +
...
> +static const struct i2c_device_id abx80x_id[] = {
> +	{ "abx80x", ABX80X },

should become
	{ "abx80x-rtc", ABX80X },
> +	{ "ab0801", AB0801 },
> +	{ "ab0803", AB0803 },
> +	{ "ab0804", AB0804 },
> +	{ "ab0805", AB0805 },
> +	{ "ab1801", AB1801 },
> +	{ "ab1803", AB1803 },
> +	{ "ab1804", AB1804 },
> +	{ "ab1805", AB1805 },
> +	{ }
and likewise

Best regards

Philippe

-- 
Philippe De Muyter +32 2 6101532 Macq SA rue de l'Aeronef 2 B-1140 Bruxelles

  reply	other threads:[~2015-04-09 13:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-01  2:52 [PATCH v2 0/2] rtc: add Abracon ABx80x Alexandre Belloni
2015-04-01  2:52 ` [PATCH v2 1/2] Documentation: bindings: add abracon,abx80x Alexandre Belloni
2015-04-09 13:25   ` Philippe De Muyter
2015-04-09 16:52     ` [rtc-linux] " Alexandre Belloni
2015-04-01  2:52 ` [PATCH v2 2/2] rtc: add rtc-abx80x, a driver for the Abracon AB x80x i2c rtc Alexandre Belloni
2015-04-09 13:31   ` Philippe De Muyter [this message]
2015-04-09 16:56     ` [rtc-linux] " Alexandre Belloni

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=20150409133122.GA4969@frolo.macqel \
    --to=phdm@macqel.be \
    --cc=a.zummo@towertech.it \
    --cc=akpm@linux-foundation.org \
    --cc=alexandre.belloni@free-electrons.com \
    --cc=arnd@arndb.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rtc-linux@googlegroups.com \
    /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