login
Login
/
Register
Search
Search this site:
Forums
News
Blogs
Features
Site
Home
»
Mailing list archives
»
linux-kernel
»
2008
»
August
»
26
Re: [RFC] Driver for Real Time Clock chip ST M41T65
view
thread
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
[view in full thread]
From: Will Newton
Subject:
Re: [RFC] Driver for Real Time Clock chip ST M41T65
Date: Tuesday, August 26, 2008 - 7:00 am
On Tue, Aug 26, 2008 at 2:55 PM, Steven A. Falco <sfalco@harris.com> wrote:
quoted text
> Will Newton wrote: >> On Mon, Aug 25, 2008 at 6:27 PM, Steven A. Falco <sfalco@harris.com> wrote: >>> I will be using a Real Time Clock chip, ST M41T65, on a new embedded system. >>> The chip is quite similar to the M41T8x family, which already has driver >>> rtc-m41t80.c. >>> >>> Would it be more acceptible to generalize rtc-m41t80.c (perhaps renaming it to >>> rtc-m41txx.c) or would it be better to create a new rtc-m41t6x.c? > > Thanks for the feedback. Here is a respin which addresses your comments. > > I'd also like to know if I should submit a new driver or mod the existing > one. If I mod the existing one, should it be renamed, should I update the > Kconfig, existing defconfigs, etc?
I've ccd the rtc-linux list.
quoted text
> Signed-off-by: Steven A. Falco <sfalco@harris.com> > > diff --git a/drivers/rtc/rtc-m41t80.c b/drivers/rtc/rtc-m41t80.c > index a3e0880..7eb4e05 100644 > --- a/drivers/rtc/rtc-m41t80.c > +++ b/drivers/rtc/rtc-m41t80.c > @@ -55,21 +55,27 @@ > #define M41T80_ALHOUR_HT (1 << 6) /* HT: Halt Update Bit */ > #define M41T80_FLAGS_AF (1 << 6) /* AF: Alarm Flag Bit */ > #define M41T80_FLAGS_BATT_LOW (1 << 4) /* BL: Battery Low Bit */ > +#define M41T80_WATCHDOG_RB2 (1 << 7) /* RB: Watchdog resolution */ > +#define M41T80_WATCHDOG_RB1 (1 << 1) /* RB: Watchdog resolution */ > +#define M41T80_WATCHDOG_RB0 (1 << 0) /* RB: Watchdog resolution */ > > -#define M41T80_FEATURE_HT (1 << 0) > -#define M41T80_FEATURE_BL (1 << 1) > +#define M41T80_FEATURE_HT (1 << 0) /* Halt feature */ > +#define M41T80_FEATURE_BL (1 << 1) /* Battery low indicator */ > +#define M41T80_FEATURE_SQ (1 << 2) /* Squarewave feature */ > +#define M41T80_FEATURE_WD (1 << 3) /* Extra watchdog resolution */ > > #define DRV_VERSION "0.05" > > static const struct i2c_device_id m41t80_id[] = { > - { "m41t80", 0 }, > - { "m41t81", M41T80_FEATURE_HT }, > - { "m41t81s", M41T80_FEATURE_HT | M41T80_FEATURE_BL }, > - { "m41t82", M41T80_FEATURE_HT | M41T80_FEATURE_BL }, > - { "m41t83", M41T80_FEATURE_HT | M41T80_FEATURE_BL }, > - { "m41st84", M41T80_FEATURE_HT | M41T80_FEATURE_BL }, > - { "m41st85", M41T80_FEATURE_HT | M41T80_FEATURE_BL }, > - { "m41st87", M41T80_FEATURE_HT | M41T80_FEATURE_BL }, > + { "m41t65", M41T80_FEATURE_HT | M41T80_FEATURE_WD }, > + { "m41t80", M41T80_FEATURE_SQ }, > + { "m41t81", M41T80_FEATURE_HT | M41T80_FEATURE_SQ}, > + { "m41t81s", M41T80_FEATURE_HT | M41T80_FEATURE_BL | M41T80_FEATURE_SQ }, > + { "m41t82", M41T80_FEATURE_HT | M41T80_FEATURE_BL | M41T80_FEATURE_SQ }, > + { "m41t83", M41T80_FEATURE_HT | M41T80_FEATURE_BL | M41T80_FEATURE_SQ }, > + { "m41st84", M41T80_FEATURE_HT | M41T80_FEATURE_BL | M41T80_FEATURE_SQ }, > + { "m41st85", M41T80_FEATURE_HT | M41T80_FEATURE_BL | M41T80_FEATURE_SQ }, > + { "m41st87", M41T80_FEATURE_HT | M41T80_FEATURE_BL | M41T80_FEATURE_SQ }, > { } > }; > MODULE_DEVICE_TABLE(i2c, m41t80_id); > @@ -385,8 +391,12 @@ static ssize_t m41t80_sysfs_show_sqwfreq(struct device *dev, > struct device_attribute *attr, char *buf) > { > struct i2c_client *client = to_i2c_client(dev); > + struct m41t80_data *clientdata = i2c_get_clientdata(client); > int val; > > + if (!(clientdata->features & M41T80_FEATURE_SQ)) > + return -EINVAL; > + > val = i2c_smbus_read_byte_data(client, M41T80_REG_SQW); > if (val < 0) > return -EIO; > @@ -407,9 +417,13 @@ static ssize_t m41t80_sysfs_set_sqwfreq(struct device *dev, > const char *buf, size_t count) > { > struct i2c_client *client = to_i2c_client(dev); > + struct m41t80_data *clientdata = i2c_get_clientdata(client); > int almon, sqw; > int val = simple_strtoul(buf, NULL, 0); > > + if (!(clientdata->features & M41T80_FEATURE_SQ)) > + return -EINVAL; > + > if (val) { > if (!is_power_of_2(val)) > return -EINVAL; > @@ -498,6 +512,8 @@ static void wdt_ping(void) > .buf = i2c_data, > }, > }; > + struct m41t80_data *clientdata = i2c_get_clientdata(save_client); > + > i2c_data[0] = 0x09; /* watchdog register */ > > if (wdt_margin > 31) > @@ -508,6 +524,13 @@ static void wdt_ping(void) > */ > i2c_data[1] = wdt_margin<<2 | 0x82; > > + /* > + * M41T65 has three bits for watchdog resolution. Don't set bit 7, as > + * that would be an invalid resolution. > + */ > + if (clientdata->features & M41T80_FEATURE_WD) > + i2c_data[1] &= ~M41T80_WATCHDOG_RB2; > + > i2c_transfer(save_client->adapter, msgs1, 1); > } > >
--
unsubscribe notice
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to
majordomo@vger.kernel.org
More majordomo info at
http://vger.kernel.org/majordomo-info.html
Please read the FAQ at
http://www.tux.org/lkml/
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
Messages in current thread:
[RFC] Driver for Real Time Clock chip ST M41T65
, Steven A. Falco
, (Mon Aug 25, 10:27 am)
Re: [RFC] Driver for Real Time Clock chip ST M41T65
, Will Newton
, (Tue Aug 26, 1:30 am)
Re: [RFC] Driver for Real Time Clock chip ST M41T65
, Steven A. Falco
, (Tue Aug 26, 6:55 am)
Re: [RFC] Driver for Real Time Clock chip ST M41T65
, Will Newton
, (Tue Aug 26, 7:00 am)
Re: [rtc-linux] Re: [RFC] Driver for Real Time Clock chip ...
, Alessandro Zummo
, (Tue Aug 26, 7:13 am)
Re: [rtc-linux] Re: [RFC] Driver for Real Time Clock chip ...
, Steven A. Falco
, (Tue Aug 26, 7:39 am)
Re: [RFC] Driver for Real Time Clock chip ST M41T65
, Maciej W. Rozycki
, (Tue Aug 26, 7:42 am)
Re: [rtc-linux] Re: [RFC] Driver for Real Time Clock chip ...
, Atsushi Nemoto
, (Wed Aug 27, 5:35 am)
Re: [rtc-linux] Re: [RFC] Driver for Real Time Clock chip ...
, Steven A. Falco
, (Wed Aug 27, 6:32 am)
Re: [rtc-linux] Re: [RFC] Driver for Real Time Clock chip ...
, Atsushi Nemoto
, (Wed Aug 27, 6:53 am)
Re: [rtc-linux] Re: [RFC] Driver for Real Time Clock chip ...
, Maciej W. Rozycki
, (Wed Aug 27, 9:25 am)
Re: [rtc-linux] Re: [RFC] Driver for Real Time Clock chip ...
, Steven A. Falco
, (Wed Aug 27, 10:22 am)
Re: [rtc-linux] Re: [RFC] Driver for Real Time Clock chip ...
, Maciej W. Rozycki
, (Wed Aug 27, 12:27 pm)
Re: [rtc-linux] Re: [RFC] Driver for Real Time Clock chip ...
, Alessandro Zummo
, (Wed Aug 27, 12:44 pm)
Navigation
Create content
Mailing list archives
Recent posts
Popular discussions
linux-kernel
:
Greg Kroah-Hartman
[PATCH 17/36] sysdev: detect multiple driver registrations
Sam Ravnborg
Re: [PATCH] kbuild: fix make V=1
Nick Piggin
Re: [PATCH 0/24] make atomic_read() behave consistently across all architectures
Greg Kroah-Hartman
[PATCH 16/36] driver core: cpu: fix section mismatch in cpu.c:store_online
David Howells
Re: [Re: 2.6.21-rc2-mm1] #error no ROMFS backing store interface configured
git
:
fantasy1215
Will tortoisesvn conflict with tortoisegit?
Stephen R. van den Berg
Re: [RFC] origin link for cherry-pick and revert
Junio C Hamano
Re: [PATCH 1/2] Teach git-describe to display distances from tags.
Johannes Schindelin
Re: [PATCH 2/2] git-svn: support fetch with autocrlf on
Junio C Hamano
Re: [PATCH 6/6] Teach core object handling functions about gitlinks
linux-netdev
:
Jarek Poplawski
Re: [PATCH] flush_work_sync vs. flush_scheduled_work Re: [PATCH] PHYLIB: IRQ event...
Lennert Buytenhek
Re: Distributed Switch Architecture(DSA)
Daniel Schaffrath
Re: tcp bw in 2.6
Guo-Fu Tseng
Re: jme: UDP checksum error, and lots of them
Gerrit Renker
[PATCH 37/37] dccp: Debugging functions for feature negotiation
openbsd-misc
:
Claudio Jeker
Re: Vlan Tag on Vlan Tag (l2tunneling)
Josh Grosse
ssh/sshd challenge-response seems to have stopped working in -current
Pieter Verberne
File collision while using pkg_add
Tomas Bodzar
bsd: uvm_mapent_alloc: out of static map entries
Community First Financial
Teacher A+ Loan
git-commits-head
:
Linux Kernel Mailing List
ath9k: Added get_survey callback in order to get channel noise
Linux Kernel Mailing List
tracing: protect reader of cmdline output
Linux Kernel Mailing List
kconfig: recalc symbol value before showing search results
Linux Kernel Mailing List
[ARM] 5185/1: Fix spi num_chipselect for lubbock
Linux Kernel Mailing List
ath9k_htc: Allocate URBs properly
Colocation donated by:
Syndicate