All of lore.kernel.org
 help / color / mirror / Atom feed
* [lm-sensors] Problems with i2c_i801
From: James Davis @ 2006-03-31 10:28 UTC (permalink / raw)
  To: lm-sensors
In-Reply-To: <1143796746.10346.10.camel@cressida.cert>

On Fri, 2006-03-31 at 12:15 +0200, Jean Delvare wrote:

> Where do the "sensors" program come from? Debian package?
> Hand-compiled? Which version ("sensors -v")?

The Debian package

cressida:/home/james# sensors -v
sensors version 2.10.0 with libsensors version 2.10.0

> Note that no hardware monitoring chip was detected on your system, so
> if that's what you are after, fixing the problem above won't help you
> much. Either your system has no hardware monitoring chip, or
> sensors-detect failed to detect it for some reason. The complete output
> of "sensors-detect" may let us help you in the second case.

cressida:/home/james# sensors-detect
# sensors-detect revision 1.413 (2006/01/19 20:28:00)

This program will help you determine which I2C/SMBus modules you need to
load to use lm_sensors most effectively. You need to have i2c and
lm_sensors installed before running this program.
Also, you need to be `root', or at least have access to the /dev/i2c-*
files, for most things.
If you have patched your kernel and have some drivers built in, you can
safely answer NO if asked to load some modules. In this case, things may
seem a bit confusing, but they will still work.

It is generally safe and recommended to accept the default answers to
all
questions, unless you know what you're doing.

 We can start with probing for (PCI) I2C or SMBus adapters.
 You do not need any special privileges for this.
 Do you want to probe now? (YES/no):
Probing for PCI bus adapters...
Use driver `i2c-i801' for device 00:1f.3: Intel 82801FB ICH6
Probe succesfully concluded.

We will now try to load each adapter module in turn.
Module `i2c-i801' already loaded.
If you have undetectable or unsupported adapters, you can have them
scanned by manually loading the modules before running this script.

 To continue, we need module `i2c-dev' to be loaded.
 If it is built-in into your kernel, you can safely skip this.
i2c-dev is already loaded.

 We are now going to do the adapter probings. Some adapters may hang
halfway
 through; we can't really help that. Also, some chips will be double
detected;
 we choose the one with the highest confidence value in that case.
 If you found that the adapter hung after probing a certain address, you
can
 specify that address to remain unprobed. That often
 includes address 0x69 (clock chip).

Next adapter: SMBus I801 adapter at e8a0
Do you want to scan it? (YES/no/selectively):
Client found at address 0x08
Client found at address 0x30
Client found at address 0x32
Client found at address 0x44
Probing for `Maxim MAX6633/MAX6634/MAX6635'... Failed!
Client at address 0x50 can not be probed - unload all client drivers
first!
Client at address 0x52 can not be probed - unload all client drivers
first!
Client found at address 0x69

Some chips are also accessible through the ISA bus. ISA probes are
typically a bit more dangerous, as we have to write to I/O ports to do
this. This is usually safe though.

Do you want to scan the ISA bus? (YES/no):
Probing for `National Semiconductor LM78'
  Trying address 0x0290... Failed!
Probing for `National Semiconductor LM78-J'
  Trying address 0x0290... Failed!
Probing for `National Semiconductor LM79'
  Trying address 0x0290... Failed!
Probing for `Winbond W83781D'
  Trying address 0x0290... Failed!
Probing for `Winbond W83782D'
  Trying address 0x0290... Failed!
Probing for `Winbond W83627HF'
  Trying address 0x0290... Failed!
Probing for `Winbond W83627EHF'
  Trying address 0x0290... Failed!
Probing for `Silicon Integrated Systems SIS5595'
  Trying general detect... Failed!
Probing for `VIA Technologies VT82C686 Integrated Sensors'
  Trying general detect... Failed!
Probing for `VIA Technologies VT8231 Integrated Sensors'
  Trying general detect... Failed!
Probing for `ITE IT8712F'
  Trying address 0x0290... Failed!
Probing for `ITE IT8705F / SiS 950'
  Trying address 0x0290... Failed!
Probing for `IPMI BMC KCS'
  Trying address 0x0ca0... Failed!
Probing for `IPMI BMC SMIC'
  Trying address 0x0ca8... Failed!

Some Super I/O chips may also contain sensors. Super I/O probes are
typically a bit more dangerous, as we have to write to I/O ports to do
this. This is usually safe though.

Do you want to scan for Super I/O sensors? (YES/no):
Probing for `ITE 8702F Super IO Sensors'
  Failed! (0x7601)
Probing for `ITE 8705F Super IO Sensors'
  Failed! (0x7601)
Probing for `ITE 8712F Super IO Sensors'
  Failed! (0x7601)
Probing for `Nat. Semi. PC87351 Super IO Fan Sensors'
  Failed! (0x76)
Probing for `Nat. Semi. PC87360 Super IO Fan Sensors'
  Failed! (0x76)
Probing for `Nat. Semi. PC87363 Super IO Fan Sensors'
  Failed! (0x76)
Probing for `Nat. Semi. PC87364 Super IO Fan Sensors'
  Failed! (0x76)
Probing for `Nat. Semi. PC87365 Super IO Fan Sensors'
  Failed! (0x76)
Probing for `Nat. Semi. PC87365 Super IO Voltage Sensors'
  Failed! (0x76)
Probing for `Nat. Semi. PC87365 Super IO Thermal Sensors'
  Failed! (0x76)
Probing for `Nat. Semi. PC87366 Super IO Fan Sensors'
  Failed! (0x76)
Probing for `Nat. Semi. PC87366 Super IO Voltage Sensors'
  Failed! (0x76)
Probing for `Nat. Semi. PC87366 Super IO Thermal Sensors'
  Failed! (0x76)
Probing for `Nat. Semi. PC87372 Super IO Fan Sensors'
  Failed! (0x76)
Probing for `Nat. Semi. PC87373 Super IO Fan Sensors'
  Failed! (0x76)
Probing for `Nat. Semi. PC87591 Super IO'
  Failed! (0x76)
Probing for `Nat. Semi. PC87371 Super IO'
  Failed! (0x76)
Probing for `Nat. Semi. PC97371 Super IO'
  Failed! (0x76)
Probing for `Nat. Semi. PC8739x Super IO'
  Failed! (0x76)
Probing for `Nat. Semi. PC8741x Super IO'
  Failed! (0x76)
Probing for `Nat. Semi. PCPC87427 Super IO'
  Failed! (0x76)
Probing for `SMSC 47B27x Super IO Fan Sensors'
  Failed! (0x76)
Probing for `SMSC 47M10x/13x Super IO Fan Sensors'
  Failed! (0x76)
Probing for `SMSC 47M14x Super IO Fan Sensors'
  Failed! (0x76)
Probing for `SMSC 47M15x/192/997 Super IO Fan Sensors'
  Failed! (0x76)
Probing for `SMSC 47S42x Super IO Fan Sensors'
  Failed! (0x76)
Probing for `SMSC 47S45x Super IO Fan Sensors'
  Failed! (0x76)
Probing for `SMSC 47M172 Super IO'
  Failed! (0x76)
Probing for `SMSC LPC47B397-NC Super IO'
  Failed! (0x76)
Probing for `SMSC SCH5307-NS Super IO'
  Failed! (0x76)
Probing for `VT1211 Super IO Sensors'
  Failed! (skipping family)
Probing for `Winbond W83627EHF/EHG Super IO Sensors'
  Failed! (skipping family)

Do you want to scan for secondary Super I/O sensors? (YES/no):
Probing for `ITE 8702F Super IO Sensors'
  Failed! (skipping family)
Probing for `Nat. Semi. PC87351 Super IO Fan Sensors'
  Failed! (skipping family)
Probing for `SMSC 47B27x Super IO Fan Sensors'
  Failed! (skipping family)
Probing for `VT1211 Super IO Sensors'
  Failed! (skipping family)
Probing for `Winbond W83627EHF/EHG Super IO Sensors'
  Failed! (skipping family)

 Sorry, no chips were detected.
 Either your sensors are not supported, or they are
 connected to an I2C bus adapter that we do not support.
 See doc/FAQ, doc/lm_sensors-FAQ.html, or
 http://www2.lm-sensors.nu/~lm78/cvs/lm_sensors2/doc/lm_sensors-FAQ.html
 (FAQ #4.24.3) for further information.
 If you find out what chips are on your board, see
 http://secure.netroedge.com/~lm78/newdrivers.html for driver status.


:-( doesn't look hopeful.

James



^ permalink raw reply

* [lm-sensors] Question on my mainboard
From: Jean Delvare @ 2006-03-31 10:27 UTC (permalink / raw)
  To: lm-sensors
In-Reply-To: <200603282150.16130.dieter.jurzitza@t-online.de>

Hi Dieter,

> I am using several Tyan Tiger 2460 motherboards since quite a while. And I am 
> observing a strange behaviour someone in the list (might) have a clue about.
> 
> I am reading the sensors data periodically every 10 seconds. After an 
> undefined time (maybe one week, maybe one day, maybe three weeks) sensors 
> "hangs" after start and cannot be killed any more. A manual call to sensors 
> ends in a hang as well (of sensors, the board is running on).
> 
> What is my configuration:
> I am loading 
> MODULE_0=i2c-amd756
> MODULE_1=i2c-isa
> MODULE_2=w83781d
> MODULE_3îprom
> MODULE_4=w83627hf
> (in this sequence).
> 
> By recommendation from Tyan I use the line:
> options w83781d force_w83782d=0,0x2d force_subclients=0,0x2d,0x48,0x49 
> force_w83627hf=0,0x2c force_subclients=0,0x2c,0x4a,0x4b init=0
> 
> in /etc/modprobe.conf.local

This doesn't make much sense. You ask the w83781d driver to take care
of the W83627HF chip, but also load the w83627hf driver. Both drivers
will attempt to handle the same chip, this might explain the deadlock.

I'd suggest that you try without loading the w83627hf driver. If the
w83781d driver is able to handle both chips (the W83782D and the
W83627HF) then the w83627hf driver is not needed at all.

-- 
Jean Delvare


^ permalink raw reply

* Re: Recommendations for supported 4-port SATA PCI card ?
From: Joshua Baker-LePain @ 2006-03-31 10:25 UTC (permalink / raw)
  To: Mattias Wadenstein; +Cc: Mark Hahn, linux-raid
In-Reply-To: <Pine.GSO.4.64.0603311122330.2115@montezuma.acc.umu.se>

On Fri, 31 Mar 2006 at 11:28am, Mattias Wadenstein wrote

> On Thu, 30 Mar 2006, Mark Hahn wrote:
>
>>> 3ware.  Period.  If you're going to use md, get the 8506-4 series rather
>>> than either of the 9xxx series cards.
>> 
>> before the 9550, I never found attractive in price/performance:
>> expensive as hell and a lot slower than MD.  but the 9550 is really
>> quite impressive...
>
> I'd still recommend 3ware for the md case, because of reliability. For my 
> 6-disk raid a 8506-4 was actually slightly faster than two sil3114s running 
> md raid5. The 3ware card has the additional advantage of not pushing the 
> machine into a hard hang once per day or so when doing io over the raid 
> layer.

That's exactly why I recommended them.  3w-xxxx has been in the kernel a 
*long* time and is extremely stable.  Sure, it's expensive for "just" a 
SATA controller, but not for a solid one that doesn't fall over at random 
times.

-- 
Joshua Baker-LePain
Department of Biomedical Engineering
Duke University

^ permalink raw reply

* Re: [Xenomai-help] rt_task_delete() question
From: Philippe Gerum @ 2006-03-31 10:22 UTC (permalink / raw)
  To: Sean McGranaghan; +Cc: xenomai
In-Reply-To: <442C19F2.206@domain.hid>

Sean McGranaghan wrote:
> Hello all,
> 
> I am posting this for a co-worker who is having problems with killing a 
> real-time task. (He is joining the email list shortly but for now I will 
> pass responses on to him.) Here is the scenario:
> 
> 1. A Linux process starts up and detaches from the tty (daemon)
> 2. The daemon creates a xeno message queue
> 2. The daemon spawns a xeno task
> 3. The xeno task on startup binds to the queue rt_queue_bind()
> 4. The xeno task waits on the queue recv with infinite timeout
> 5. The daemon process goes to sleep in a join, waiting for the task to exit
> 6. Some time later another program starts
> 7. The other non-realtime program looks up the xeno task name via 
> rt_task_bind()
> 8. The other non-realtime program attempts to delete the task via 
> rt_task_delete()
>         Failed Attempt #1 - Non-realtime program calls rt_task_delete() 
> and gets
>                             a segmentation fault
>         Failed Attempt #2 - Non-realtime program spawns a realtime task 
> which
>                             binds to original task and tries 
> rt_task_delete().
>                             Also gets segmentation fault.
> 

Eeek... 100% reproducible here. Blatant bug. More later. Thanks for 
reporting.

> The was attempted one a system running the latest Xenomai 2.1 release.
> 
> What is the preferred method to start/join threads from a non-realtime 
> context?
> 
> Any help is appreciated.
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Xenomai-help mailing list
> Xenomai-help@domain.hid
> https://mail.gna.org/listinfo/xenomai-help


-- 

Philippe.


^ permalink raw reply

* PM support for au1000_eth.c
From: Rodolfo Giometti @ 2006-03-31 10:30 UTC (permalink / raw)
  To: Linux MIPS; +Cc: ppopov

Hello,

I'd like to add a power management support to this driver. That is I'd
like to suspend and resume this device during sleep.Which should be
the better way to do it?

I think it should be correct adding this driver into file
arch/mips/au1000/common/platform.c and then definying the suspend()
and resume() functions, but I'm not sure...

Suggestions?

Thanks,

Rodolfo

-- 

GNU/Linux Solutions                  e-mail:    giometti@enneenne.com
Linux Device Driver                             giometti@gnudd.com
Embedded Systems                     		giometti@linux.it
UNIX programming                     phone:     +39 349 2432127

^ permalink raw reply

* Re: [PATCH/RFC] MTD: Striping layer core
From: Artem B. Bityutskiy @ 2006-03-31 10:18 UTC (permalink / raw)
  To: Jörn Engel
  Cc: Alexander Belyakov, Korolev, Alexey, Vitaly Wool,
	Kutergin, Timofey, linux-mtd
In-Reply-To: <20060331100709.GD14713@wohnheim.fh-wedel.de>

On Fri, 2006-03-31 at 12:07 +0200, Jörn Engel wrote:
> I take it that mtd->type is not exported to userspace yet.  Which is
> good, because imho it shouldn't be.  Flash should me a step towards a
> standard interface, something that hard disk have had for years.
> Knowing every little detail about every single flash chip bears more
> harm than good.

Again, imagine mtd->type is the only flash-specific field in mtd_info.
You work with any flash the same way. But if you still want to do some
flash-specific things, you look at mtd->type, determine which kind of
flash is this, then work with the flash-specific subsystem.

> And as far as in-kernel users are concerned, JFFS2 is the only one
> that really matters.  For JFFS2, my previous statement still stand
> that it should base decisions on the existence of a feature, not a
> type.

It looks at mtd->type, finds out the type, and it knows what features
must be there. No flash-specific features are available in mtd_info. It
only contains generic stuff. For example, mtd_info should not even
contain the OOB-handling stuff. If you want to work with OOB then your
application is NAND-bound. Then you look at mtd->type, see this is NAND,
and happily start working with NAND subsystem of MTD.

Note, what I'm saying is far from the current things, again, I'm saying
how things should look like in my oppinion.


> You could still have flash types, but merely as aggregates of
> features, nothing else.  For example, NAND flash could have
> FEATURE_OOB, FEATURE_WBUF, FEATURE_ECC etc.  Which of these feature
> make sense and are really needed is another matter, but you should get
> the idea.

Decomposition on features is not very nice IMO. It is better to specify
type. Each type has its own set of features. It is too difficult to
recognize all features, classify them nicely and put into mtd_info.
Features go and come, the change.

There may be some feature-bound decomposition, but in parallel to the
decomposition by type, which is the main and more natural decomposition.


-- 
Best Regards,
Artem B. Bityuckiy,
St.-Petersburg, Russia.

^ permalink raw reply

* Re: [e1000 debug] KERNEL: assertion (!sk_forward_alloc) failed...
From: Boris B. Zhmurov @ 2006-03-31 10:16 UTC (permalink / raw)
  To: David S. Miller
  Cc: herbert, jesse.brandeburg, nipsy, jrlundgren, cat, djani22,
	yoseph.basri, mykleb, olel, michal, chris, netdev,
	jesse.brandeburg, E1000-devel
In-Reply-To: <20060331.011245.26474207.davem@davemloft.net>

Hello, David S. Miller.

On 31.03.2006 13:12 you said the following:

> From: "Boris B. Zhmurov" <bb@kernelpanic.ru>
> Date: Thu, 30 Mar 2006 17:29:09 +0400
> 
> 
>>Hello, Herbert Xu.
>>
>>On 30.03.2006 14:12 you said the following:
>>
>>
>>>On Thu, Mar 30, 2006 at 10:02:01AM +0000, Boris B. Zhmurov wrote:
>>>
>>>
>>>>[zhmurov@builds linux-2.6.16]$ patch -p1 < 
>>>>../../../SOURCES/linux-2.6.16-e1000-try-to-fix-assertion_sk_forward_alloc_failed_by_Herbert_Xu.patch 
>>>>
>>>>patching file drivers/net/e1000/e1000_main.c
>>>>Reversed (or previously applied) patch detected!  Assume -R? [n]
>>>>
>>>>Herbert, is that patch already included in 2.6.16.1?
>>>
>>>
>>>Not really.  It's just patch being silly (or too smart :)
>>>
>>>Here it is again rediffed against 2.6.16.
>>
>>
>>Nope, with this patch the problem still exists. After 25 min. uptime 
>>with patched kernel 2.6.16.1, I have:
> 
> 
> Can you please double and triple check that you're really running a
> kernel with the fix from Herbert applied?  I make this mistake all
> the time :-)
> 
> Thanks.
> 


[zhmurov@builds redhat]$ rpmbuild --sign --rebuild --target=i686 
/usr/src/redhat/SRPMS/kernel-2.6.16-1.14.bbel4.src.rpm
Enter pass phrase:
Pass phrase is good.
..... SKIP.....
+ echo 'Patch #295 
(linux-2.6.16-e1000-try-to-fix-assertion_sk_forward_alloc_failed_by_Herbert_Xu.patch):'
Patch #295 
(linux-2.6.16-e1000-try-to-fix-assertion_sk_forward_alloc_failed_by_Herbert_Xu.patch):
+ patch -p1 -s
...... SKIP .....


And xdelta tells, that e1000.ko was modified :)


P.S.
there is src.rpm of my kernel for RHEL4 and my RHEL4-clone:
ftp://builds.kernelpanic.ru/pub/linux/BBEL/updates/kernel_of_the_day/4/SRPMS/

and yum'able repo of 2.6.16 kernels _with_ Herbert's patch :), if 
anybody interested:
ftp://builds.kernelpanic.ru/pub/linux/BBEL/updates/kernel_of_the_day/4/


-- 
Boris B. Zhmurov
mailto: bb@kernelpanic.ru
"wget http://kernelpanic.ru/bb_public_key.pgp -O - | gpg --import"



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

^ permalink raw reply

* [lm-sensors] Problems with i2c_i801
From: Jean Delvare @ 2006-03-31 10:15 UTC (permalink / raw)
  To: lm-sensors
In-Reply-To: <1143796746.10346.10.camel@cressida.cert>

Hi James,

> I'm running Debian/Etch with a 2.6.15-1-686 kernel. The I think the
> system is a Dell Optiplex GX280 which from reading Dell's website gives
> me an Intel 915G chipset (if I've correctly identified the system!).
> Running sensors detect gave me the following to add to my modules.conf.
> 
> #----cut here----
> # I2C adapter drivers
> i2c-i801
> # I2C chip drivers
> eeprom
> #----cut here----
> 
> I've loaded these modules Looking through the output of lsmod I get:
> 
> cressida:/home/james# lsmod | grep i2c
> i2c_dev                 8640  0
> i2c_i801                7916  0
> i2c_core               19280  3 eeprom,i2c_dev,i2c_i801
> 
> sysfs appears to be correctly mounted:
> 
> cressida:/home/james# mount | grep sys
> sysfs on /sys type sysfs (rw)
> 
> But when I run sensors I get the following output:
> 
> cressida:/home/james# sensors
> Can't access procfs/sysfs file
> Unable to find i2c bus information;
> For 2.6 kernels, make sure you have mounted sysfs and libsensors
> was compiled with sysfs support!
> For older kernels, make sure you have done 'modprobe i2c-proc'!
> cressida:/home/james#
> 
> Any idea what I'm doing wrong? :(

Where do the "sensors" program come from? Debian package?
Hand-compiled? Which version ("sensors -v")?

Note that no hardware monitoring chip was detected on your system, so
if that's what you are after, fixing the problem above won't help you
much. Either your system has no hardware monitoring chip, or
sensors-detect failed to detect it for some reason. The complete output
of "sensors-detect" may let us help you in the second case.

-- 
Jean Delvare


^ permalink raw reply

* Re: Re: [ALSA - driver 0001938]: EPIPE on Audigy with surround sound when seeking in 6 channel sound file
From: Takashi Iwai @ 2006-03-31 10:15 UTC (permalink / raw)
  To: Robert Hardy; +Cc: alsa-devel
In-Reply-To: <Pine.LNX.4.64.0603301317280.20572@thor.webcon.net>

At Thu, 30 Mar 2006 18:53:23 -0500 (EST),
Robert Hardy wrote:
> 
> On Thu, 30 Mar 2006, Takashi Iwai wrote:
> > At Thu, 30 Mar 2006 12:09:06 -0500 (EST), Robert Hardy wrote:
> >> cd /el4_i386_chroot
> >> setarch i386 chroot .
> >>
> >> # mplayer -vo xv -ao alsa -channels 6 An_AC3_movie.avi |& less
> >>
> >> MPlayer dev-Fedora-GS-CVS-060328-14:45-3.4.5 (C) 2000-2006 MPlayer Team
> >> [...]
> >> [ attempt to seek with right arrow ]
> >> alsa-lib: pcm.c:6300:(snd_pcm_mmap_commit) commit offset (0) doesn't match with appl_ptr (291840) % buf_size (16384)
> >> alsa-play: write error: Broken pipe
> >> alsa-play: trying to reset soundcard
> >> alsa-lib: pcm.c:6300:(snd_pcm_mmap_commit) commit offset (0) doesn't match with appl_ptr (291840) % buf_size (16384)
> >
> > That looks bad.  Could you set $LIBASOUND_DEBUG=2 and run it from gdb?
> > It will send abort() at that place, then you can see backtrace what is
> > the original caller.
> >
> > does it happen if you play via aplay like
> > 	% aplay -Dplug:surround51 some.wav
> > too?
> 
> No it only happens when I seek 6 channel audio. I can play something with
> mplayer -ao alsa -channels 6  and it will play fine _UNTIL_ I seek. Then it
> blows up.
> 
> So something like this will immediately fail:
> mplayer -ao alsa -channels 6 -ss 00:01:00 An_AC3_movie.avi
> 
> With this stuff:
> alsa-lib: pcm.c:6300:(snd_pcm_mmap_commit) commit offset (0) doesn't match with appl_ptr (291840) % buf_size (16384)
> alsa-play: write error: Broken pipe
> alsa-play: trying to reset soundcard
> 
> If I switch to a 64 bit chrooted environment with a 64 bit mplayer the audio
> works properly. But then I can't use any of the 32 bit codecs.
> 
> >> Is there some way I can comment directly on bug 1938 in Mantis?
> >
> > I don't know.  I heard it should be fixed now.
> 
> The author of the bug seems to think it's still broken and seems to have
> beat me to posting a backtrace. It's been a busy day here. If you still want
> me to do this let me know.
> 
> > Honestly, I hate bugtracking systems.  Bug reports and communcations
> > on ML motivates me much better :)
> 
> k email it is 8o) I'd love to get this fixed...

I think I got it.  It looks like the old applptr that are not updated
by the prepare call due to pcm links.

Try the patch below.


Takashi

Index: alsa-lib/src/pcm/pcm_hw.c
===================================================================
RCS file: /home/iwai/cvs/alsa/alsa-lib/src/pcm/pcm_hw.c,v
retrieving revision 1.114
diff -u -r1.114 pcm_hw.c
--- alsa-lib/src/pcm/pcm_hw.c	29 Mar 2006 09:30:49 -0000	1.114
+++ alsa-lib/src/pcm/pcm_hw.c	31 Mar 2006 10:04:17 -0000
@@ -624,6 +624,9 @@
 		SYSMSG("SNDRV_PCM_IOCTL_REWIND failed");
 		return err;
 	}
+	err = sync_ptr(hw, SNDRV_PCM_SYNC_PTR_APPL);
+	if (err < 0)
+		return err;
 	return frames;
 }
 
@@ -637,6 +640,9 @@
 			SYSMSG("SNDRV_PCM_IOCTL_FORWARD failed");
 			return err;
 		}
+		err = sync_ptr(hw, SNDRV_PCM_SYNC_PTR_APPL);
+		if (err < 0)
+			return err;
 		return frames;
 	} else {
 		snd_pcm_sframes_t avail;
Index: alsa-lib/src/pcm/pcm_multi.c
===================================================================
RCS file: /home/iwai/cvs/alsa/alsa-lib/src/pcm/pcm_multi.c,v
retrieving revision 1.72
diff -u -r1.72 pcm_multi.c
--- alsa-lib/src/pcm/pcm_multi.c	27 Feb 2006 12:39:29 -0000	1.72
+++ alsa-lib/src/pcm/pcm_multi.c	31 Mar 2006 10:04:17 -0000
@@ -424,8 +424,9 @@
 	int err = 0;
 	unsigned int i;
 	for (i = 0; i < multi->slaves_count; ++i) {
-		if (multi->slaves[i].linked)
-			continue;
+		/* We call prepare to each slave even if it's linked.
+		 * This is to make sure to sync non-mmaped control/status.
+		 */
 		err = snd_pcm_prepare(multi->slaves[i].pcm);
 		if (err < 0)
 			return err;
@@ -439,8 +440,7 @@
 	int err = 0;
 	unsigned int i;
 	for (i = 0; i < multi->slaves_count; ++i) {
-		if (multi->slaves[i].linked)
-			continue;
+		/* Reset each slave, as well as in prepare */
 		err = snd_pcm_reset(multi->slaves[i].pcm);
 		if (err < 0)
 			return err;


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

^ permalink raw reply

* Re: [NETFILTER 00/04]: Netfilter Update
From: David S. Miller @ 2006-03-31 10:15 UTC (permalink / raw)
  To: kaber; +Cc: netfilter-devel
In-Reply-To: <20060331010905.20401.80847.sendpatchset@localhost.localdomain>

From: Patrick McHardy <kaber@trash.net>
Date: Fri, 31 Mar 2006 03:09:05 +0200 (MEST)

> Yasuyuki Kozakai:
>       [NETFILTER]: x_tables: unify IPv4/IPv6 multiport match

This first patch didn't apply, so I'm going to pass on all of these
until you figure out what's wrong here.

The problem is the net/ipv6/netfilter/Makefile hunk.

@@ -10,7 +10,6 @@ obj-$(CONFIG_IP6_NF_MATCH_IPV6HEADER) +=
 obj-$(CONFIG_IP6_NF_MATCH_FRAG) += ip6t_frag.o
 obj-$(CONFIG_IP6_NF_MATCH_AH) += ip6t_ah.o
 obj-$(CONFIG_IP6_NF_MATCH_EUI64) += ip6t_eui64.o
-obj-$(CONFIG_IP6_NF_MATCH_MULTIPORT) += ip6t_multiport.o

in my current tree the ip6t_ah.o line instead reads as:

obj-$(CONFIG_IP6_NF_MATCH_AHESP) += ip6t_esp.o ip6t_ah.o

It seems something is wrong with the tree you generated these
patches against.

Please resubmit once you've fixed this, thanks.

^ permalink raw reply

* Re: Hook collie frontlight into sysfs
From: Richard Purdie @ 2006-03-31 10:13 UTC (permalink / raw)
  To: Pavel Machek; +Cc: lenz, Bompart Cedric, kernel list
In-Reply-To: <20060331082352.GF1663@elf.ucw.cz>

On Fri, 2006-03-31 at 10:23 +0200, Pavel Machek wrote:
> Hi!
> 
> > During our test with Richard, we've been thinking can you implement the
> > full range of brightness intensity values? For example for the others
> > Zaurus, I think the range is between 0 and 63. So the userspace can
> 
> Well, I'm not sure if other values are "legal". They could damage
> frontlight long-term or just eat too much power...

For what its worth, these back/frontlight controllers are normally PWM
driven so the LED is always at full brightness and just the percentage
of time its turned on varies. These numbers in the driver control the
duty cycle of the PWM.

The original code for corgi/spitz only had a limited number of values
and I exposed the whole range into userspace. I doubt you can damage the
hardware with the different values. There are probably optimal points
for power consumption which is perhaps why Sharp limited the values
exposed. My view is that its up to userspace to limit the values for
optimal power consumption :).

> > adjust a wider range of levels for the backlight. Another thing, I
> > didn't see anything different visually between the value 3 and 4.
> 
> You are right, the code to go brightness 4 is attached. It probably
> needs to be converted to writel/readl...

This makes sense as on corgi/spitz there is also this magic bit to set
for the second level of brightness settings...

I'll have a look at these patches and perhaps combine/convert them to
the replacement backlight interface, then we can submit them to Antonino
Daplas/Andrew so all the backlight patches are in one place (currently
-mm).

Given what I've said above, would you be happy to expose the full range
of values to userspace?

Richard


^ permalink raw reply

* Re: FORMAT floppy: Drive_IO error
From: Mike McCarty @ 2006-03-31 10:12 UTC (permalink / raw)
  To: linux-msdos
In-Reply-To: <442CF69C.9020805@sbcglobal.net>

Mike McCarty wrote:
> Bart Oldeman wrote:
> 
>> On Thu, 30 Mar 2006, Mike McCarty wrote:
>>
>>> Alain M. wrote:
>>>
>>>> Make the test with the latest version. Eric made a lot of Fixes 
>>>> while I was making tests. It is much better now, specialy in error 
>>>> conditions.
>>>>
>>>> But... I made oll tests in real dos...
>>>>
>>>> http://www.coli.uni-saarland.de/~eric/stuff/soft/by-others/
>>>>
>>>> Alain
>>>
>>>
>>>
>>> Thanks. I downloaded the latest and tried again. It is very
>>> much faster. It also only found 8 bad sectors (hmm...). But
>>> the very same IO error occurred.
>>>
>>> So, where do I need to report the problem?
>>
>>
>>
>> DOSEMU. It cannot and has never been able to format floppies, to be 
>> precise, BIOS int13/ah=5 is not implemented.
> 
> 
> I don't believe so, for a number of reasons.

[snip reasons]

OTOH, I degaussed a known-good disc, and FORMAT.EXE was unable
to format it under FreeDOS, whereas it was able to under MSDOS
6.0. It failed right away, reporting the FORMAT TRACK call failed.

Nonetheless, it was not the BIOS FORMAT TRACK which failed
in the earlier attempt.

Mike
-- 
p="p=%c%s%c;main(){printf(p,34,p,34);}";main(){printf(p,34,p,34);}
This message made from 100% recycled bits.
You have found the bank of Larn.
I can explain it for you, but I can't understand it for you.
I speak only for myself, and I am unanimous in that!

^ permalink raw reply

* Re: Midi name string in mpu401_uart not unique
From: Takashi Iwai @ 2006-03-31 10:10 UTC (permalink / raw)
  To: Alan Horstmann; +Cc: alsa-devel
In-Reply-To: <200603311102.37785.gineera@aspect135.co.uk>

At Fri, 31 Mar 2006 11:02:37 +0100,
Alan Horstmann wrote:
> 
> [1  <text/plain; iso-8859-1 (7bit)>]
> On Thursday 30 March 2006 18:53, you wrote:
> > At Thu, 30 Mar 2006 18:45:23 +0100,
> > Alan Horstmann wrote:
> 
> > > On Thursday 30 March 2006 12:04, you wrote:
> > > >
> > > > Instead of adding a new argument to snd_mpu401_uart_new, the caller
> > > > can overwrite the string after creating the instace.
> > > >
> > > > 	snd_mpu401_uart_new(card, device, type, ..., &rmidi);
> > > > 	snprintf(rmidi->name, sizeof(rmidi->name),
> > > > 		"MIDI Name As I Like %d", card->number);
> > > >
> > > > Then the change would be less intrusive.
> > > >
> > > > Or am I missing something else?
> > >
> > > Sounds a lot simpler -just involving the driver only; I will try this
> > > later. In the mpu-names.diff midi names were added to
> > > snd_ice1712_card_info to be used in the name string.  Is that still a
> > > reasonable thing to do, or is there a better place, given that the
> > > different sub-vendors might have different requirements?
> >
> > That addition looks OK to me.  What I don't want is to change the
> > existing API if there is a simple solution.
> >
> > > Bearing in mind Clemens' comments, is there any value in improving the
> > > name given by mpu401_uart_new when using ->shortname, as in the diff, by
> > > adding card and device numbers?
> >
> > Maybe the order of "CARD DEVICE" like "DMX6fire WaveTable" is better?
> > Just a matter of taste, though...
> 
> Would it be acceptable to add card, device to ->shortname in mpu401_uart as 
> attached:
> 
> mpu401_uart.c-add-to-shortname.patch
> 
> Add card and device numbers to portnames generated from ->shortnames by 
> snd_mpu401_uart_new.
> 
> Signed-off-by: Alan Horstmann <gineera@aspect135.co.uk>

Thanks for the patch.  But I don't want to change that part at all.
It may break other stuff what you've not tested.

Just change the ice1712 stuff, instead.


Takashi

> [2 mpu401_uart.c-add-to-shortname.patch <text/x-diff; iso-8859-1 (7bit)>]
> --- mpu401_uart-orig.c	2005-11-18 18:52:14.000000000 +0000
> +++ mpu401_uart.c	2006-03-31 10:33:33.000000000 +0100
> @@ -506,7 +506,7 @@
>  	mpu->irq = irq;
>  	mpu->irq_flags = irq_flags;
>  	if (card->shortname[0])
> -		snprintf(rmidi->name, sizeof(rmidi->name), "%s MIDI", card->shortname);
> +		snprintf(rmidi->name, sizeof(rmidi->name), "%s MIDI %d-%d", card->shortname, card->number, device);
>  	else
>  		sprintf(rmidi->name, "MPU-401 MIDI %d-%d", card->number, device);
>  	snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT, &snd_mpu401_uart_output);


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

^ permalink raw reply

* Re: [PATCH] cvsimport: use git-update-ref when updating
From: Johannes Schindelin @ 2006-03-31 10:08 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git
In-Reply-To: <7vk6ab1iy2.fsf@assigned-by-dhcp.cox.net>

Hi,

On Thu, 30 Mar 2006, Junio C Hamano wrote:

> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
> > This simplifies code, and also fixes a subtle bug: when importing in a
> > shared repository, where another user last imported from CVS, cvsimport
> > used to complain that it could not open <branch> for update.
> 
> The second hunk look sensible but I do not know about "use Fcntl"
> since I do not see anything you are adding that starts to use it...

O_EXCL. Without "use Fcntl;" perl says I am not allowed to use bareword 
things in strict mode or some such.

Ciao,
Dscho

^ permalink raw reply

* Re: 2.6.16-mm1 leaks in dvb playback (found)
From: David S. Miller @ 2006-03-31 10:07 UTC (permalink / raw)
  To: adrian; +Cc: ak, akpm, linux-kernel
In-Reply-To: <20060331095443.GA8616@smop.co.uk>

From: Adrian Bridgett <adrian@smop.co.uk>
Date: Fri, 31 Mar 2006 10:54:43 +0100

> On Thu, Mar 30, 2006 at 23:48:23 -0800 (-0800), David S. Miller wrote:
> > As I stated, there was a bug in the initial patch, which subsequent
> > patches fix.
> > 
> > Can you try Linus's current tree to see if the problem is there?
> 
> 2-6-16-git18 still has the problem (30th March).

Strange, can you strace the process and follow the socket
operations your application performs?  Something unique
is occuring in that app since there have not been other
reports of this problem that I am aware of.

Thanks.

^ permalink raw reply

* Re: [PATCH/RFC] MTD: Striping layer core
From: Jörn Engel @ 2006-03-31 10:07 UTC (permalink / raw)
  To: Artem B. Bityutskiy
  Cc: Alexander Belyakov, Korolev, Alexey, Vitaly Wool,
	Kutergin, Timofey, linux-mtd
In-Reply-To: <1143799209.3579.74.camel@sauron.oktetlabs.ru>

On Fri, 31 March 2006 14:00:09 +0400, Artem B. Bityutskiy wrote:
> On Fri, 2006-03-31 at 11:40 +0200, Jörn Engel wrote:
> > On Fri, 31 March 2006 13:36:43 +0400, Artem B. Bityutskiy wrote:
> > > 
> > > No, mtd->type has to tell you the type of the MTD device. Ideally, this 
> > > has to me the only flash-specific field in the mtd_info structure. And 
> > > if users want to do some flash specific things, they have to look at 
> > > mtd->type, realize what is the subsystem which handles this flash, and 
> > > start working with this subsystem. For striping, this is the striping 
> > > subsystem. I don't know what for mtd->flags, probably this hast to go at 
> > > all.
> > 
> > Is this exported to userspace via mtdchar?
> > 
> I don't quite understand what is "this".
> 
> Ideally yes...

I take it that mtd->type is not exported to userspace yet.  Which is
good, because imho it shouldn't be.  Flash should me a step towards a
standard interface, something that hard disk have had for years.
Knowing every little detail about every single flash chip bears more
harm than good.

And as far as in-kernel users are concerned, JFFS2 is the only one
that really matters.  For JFFS2, my previous statement still stand
that it should base decisions on the existence of a feature, not a
type.

You could still have flash types, but merely as aggregates of
features, nothing else.  For example, NAND flash could have
FEATURE_OOB, FEATURE_WBUF, FEATURE_ECC etc.  Which of these feature
make sense and are really needed is another matter, but you should get
the idea.

Jörn

-- 
/* Keep these two variables together */
int bar;

^ permalink raw reply

* [PATCH 07/10] RTC subsystem, compact error messages
From: Alessandro Zummo @ 2006-03-31 10:04 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm, akpm, Lennert Buytenhek
In-Reply-To: <20060331100423.175139000@towertech.it>

[-- Attachment #1: rtc-subsys-compact-err-message.patch --]
[-- Type: text/plain, Size: 3979 bytes --]

 - move registration error message from drivers
 to core.

Signed-off-by: Alessandro Zummo <a.zummo@towertech.it>
Cc: Lennert Buytenhek <buytenh@wantstofly.org>

---
 drivers/rtc/class.c       |    2 ++
 drivers/rtc/rtc-ds1672.c  |    2 --
 drivers/rtc/rtc-ep93xx.c  |    1 -
 drivers/rtc/rtc-m48t86.c  |    4 +---
 drivers/rtc/rtc-pcf8563.c |    2 --
 drivers/rtc/rtc-rs5c372.c |    2 --
 drivers/rtc/rtc-sa1100.c  |    1 -
 drivers/rtc/rtc-test.c    |    2 --
 drivers/rtc/rtc-x1205.c   |    2 --
 9 files changed, 3 insertions(+), 15 deletions(-)

--- linux-rtc.orig/drivers/rtc/class.c	2006-03-29 02:14:50.000000000 +0200
+++ linux-rtc/drivers/rtc/class.c	2006-03-29 02:55:47.000000000 +0200
@@ -96,6 +96,8 @@ exit_idr:
 	idr_remove(&rtc_idr, id);
 
 exit:
+	dev_err(dev, "rtc core: unable to register %s, err = %d\n",
+			name, err);
 	return ERR_PTR(err);
 }
 EXPORT_SYMBOL_GPL(rtc_device_register);
--- linux-rtc.orig/drivers/rtc/rtc-x1205.c	2006-03-29 02:50:57.000000000 +0200
+++ linux-rtc/drivers/rtc/rtc-x1205.c	2006-03-29 02:53:01.000000000 +0200
@@ -544,8 +544,6 @@ static int x1205_probe(struct i2c_adapte
 
 	if (IS_ERR(rtc)) {
 		err = PTR_ERR(rtc);
-		dev_err(&client->dev,
-			"unable to register the class device\n");
 		goto exit_detach;
 	}
 
--- linux-rtc.orig/drivers/rtc/rtc-ds1672.c	2006-03-29 02:29:43.000000000 +0200
+++ linux-rtc/drivers/rtc/rtc-ds1672.c	2006-03-29 02:57:10.000000000 +0200
@@ -229,8 +229,6 @@ static int ds1672_probe(struct i2c_adapt
 
 	if (IS_ERR(rtc)) {
 		err = PTR_ERR(rtc);
-		dev_err(&client->dev,
-			"unable to register the class device\n");
 		goto exit_detach;
 	}
 
--- linux-rtc.orig/drivers/rtc/rtc-m48t86.c	2006-03-29 02:50:57.000000000 +0200
+++ linux-rtc/drivers/rtc/rtc-m48t86.c	2006-03-29 02:56:48.000000000 +0200
@@ -151,10 +151,8 @@ static int __devinit m48t86_rtc_probe(st
 	struct rtc_device *rtc = rtc_device_register("m48t86",
 				&dev->dev, &m48t86_rtc_ops, THIS_MODULE);
 
-	if (IS_ERR(rtc)) {
-		dev_err(&dev->dev, "unable to register\n");
+	if (IS_ERR(rtc))
 		return PTR_ERR(rtc);
-	}
 
 	platform_set_drvdata(dev, rtc);
 
--- linux-rtc.orig/drivers/rtc/rtc-pcf8563.c	2006-03-29 02:50:57.000000000 +0200
+++ linux-rtc/drivers/rtc/rtc-pcf8563.c	2006-03-29 02:57:01.000000000 +0200
@@ -290,8 +290,6 @@ static int pcf8563_probe(struct i2c_adap
 
 	if (IS_ERR(rtc)) {
 		err = PTR_ERR(rtc);
-		dev_err(&client->dev,
-			"unable to register the class device\n");
 		goto exit_detach;
 	}
 
--- linux-rtc.orig/drivers/rtc/rtc-test.c	2006-03-29 02:50:57.000000000 +0200
+++ linux-rtc/drivers/rtc/rtc-test.c	2006-03-29 02:56:29.000000000 +0200
@@ -119,8 +119,6 @@ static int test_probe(struct platform_de
 						&test_rtc_ops, THIS_MODULE);
 	if (IS_ERR(rtc)) {
 		err = PTR_ERR(rtc);
-		dev_err(&plat_dev->dev,
-			"unable to register the class device\n");
 		return err;
 	}
 	device_create_file(&plat_dev->dev, &dev_attr_irq);
--- linux-rtc.orig/drivers/rtc/rtc-ep93xx.c	2006-03-29 02:50:57.000000000 +0200
+++ linux-rtc/drivers/rtc/rtc-ep93xx.c	2006-03-29 02:58:03.000000000 +0200
@@ -109,7 +109,6 @@ static int __devinit ep93xx_rtc_probe(st
 				&dev->dev, &ep93xx_rtc_ops, THIS_MODULE);
 
 	if (IS_ERR(rtc)) {
-		dev_err(&dev->dev, "unable to register\n");
 		return PTR_ERR(rtc);
 	}
 
--- linux-rtc.orig/drivers/rtc/rtc-sa1100.c	2006-03-29 02:14:50.000000000 +0200
+++ linux-rtc/drivers/rtc/rtc-sa1100.c	2006-03-29 02:57:38.000000000 +0200
@@ -341,7 +341,6 @@ static int sa1100_rtc_probe(struct platf
 				THIS_MODULE);
 
 	if (IS_ERR(rtc)) {
-		dev_err(&pdev->dev, "Unable to register the RTC device\n");
 		return PTR_ERR(rtc);
 	}
 
--- linux-rtc.orig/drivers/rtc/rtc-rs5c372.c	2006-03-29 02:50:58.000000000 +0200
+++ linux-rtc/drivers/rtc/rtc-rs5c372.c	2006-03-29 02:59:15.000000000 +0200
@@ -233,8 +233,6 @@ static int rs5c372_probe(struct i2c_adap
 
 	if (IS_ERR(rtc)) {
 		err = PTR_ERR(rtc);
-		dev_err(&client->dev,
-			"unable to register the class device\n");
 		goto exit_detach;
 	}
 

--

^ permalink raw reply

* [PATCH 01/10] RTC subsystem, DS1672 oscillator handling
From: Alessandro Zummo @ 2006-03-31 10:04 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm, akpm, Kumar Gala
In-Reply-To: <20060331100423.175139000@towertech.it>

[-- Attachment #1: rtc-subsys-ds1672-fix-osc.patch --]
[-- Type: text/plain, Size: 3706 bytes --]

From: Kumar Gala <galak@kernel.crashing.org>

* Always enable the oscillator when we set the time
* If the oscillator is disable when we probe the RTC report back a warning
  to the user
* Added sysfs attribute to represent the state of the oscillator

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Signed-off-by: Alessandro Zummo <a.zummo@towertech.it>

---
commit 3acc1a4629e70bce7493b5463f3c785379ae8b6b
tree 34463406603ac788697d8d228a2caf2c0ea40b3a
parent 329b10bb0feacb7fb9a41389313ff0a51ae56f2a
author Kumar Gala <galak@kernel.crashing.org> Tue, 28 Mar 2006 16:53:43 -0600
committer Kumar Gala <galak@kernel.crashing.org> Tue, 28 Mar 2006 16:53:43 -0600

 drivers/rtc/rtc-ds1672.c |   61 ++++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 58 insertions(+), 3 deletions(-)

--- linux-rtc.orig/drivers/rtc/rtc-ds1672.c	2006-03-29 02:14:50.000000000 +0200
+++ linux-rtc/drivers/rtc/rtc-ds1672.c	2006-03-29 02:16:01.000000000 +0200
@@ -23,6 +23,7 @@ I2C_CLIENT_INSMOD;
 
 #define DS1672_REG_CNT_BASE	0
 #define DS1672_REG_CONTROL	4
+#define DS1672_REG_CONTROL_EOSC	0x80
 #define DS1672_REG_TRICKLE	5
 
 
@@ -72,16 +73,17 @@ static int ds1672_get_datetime(struct i2
 static int ds1672_set_mmss(struct i2c_client *client, unsigned long secs)
 {
 	int xfer;
-	unsigned char buf[5];
+	unsigned char buf[6];
 
 	buf[0] = DS1672_REG_CNT_BASE;
 	buf[1] = secs & 0x000000FF;
 	buf[2] = (secs & 0x0000FF00) >> 8;
 	buf[3] = (secs & 0x00FF0000) >> 16;
 	buf[4] = (secs & 0xFF000000) >> 24;
+	buf[5] = 0;	/* set control reg to enable counting */
 
-	xfer = i2c_master_send(client, buf, 5);
-	if (xfer != 5) {
+	xfer = i2c_master_send(client, buf, 6);
+	if (xfer != 6) {
 		dev_err(&client->dev, "%s: send: %d\n", __FUNCTION__, xfer);
 		return -EIO;
 	}
@@ -120,6 +122,44 @@ static int ds1672_rtc_set_mmss(struct de
 	return ds1672_set_mmss(to_i2c_client(dev), secs);
 }
 
+static int ds1672_get_control(struct i2c_client *client, u8 *status)
+{
+	unsigned char addr = DS1672_REG_CONTROL;
+
+	struct i2c_msg msgs[] = {
+		{ client->addr, 0, 1, &addr },		/* setup read ptr */
+		{ client->addr, I2C_M_RD, 1, status },	/* read control */
+	};
+
+	/* read control register */
+	if ((i2c_transfer(client->adapter, &msgs[0], 2)) != 2) {
+		dev_err(&client->dev, "%s: read error\n", __FUNCTION__);
+		return -EIO;
+	}
+
+	return 0;
+}
+
+/* following are the sysfs callback functions */
+static ssize_t show_control(struct device *dev, struct device_attribute *attr, char *buf)
+{
+	struct i2c_client *client = to_i2c_client(dev);
+	char *state = "enabled";
+	u8 control;
+	int err;
+
+	err = ds1672_get_control(client, &control);
+	if (err)
+		return err;
+
+	if (control & DS1672_REG_CONTROL_EOSC)
+		state = "disabled";
+
+	return sprintf(buf, "%s\n", state);
+}
+
+static DEVICE_ATTR(control, S_IRUGO, show_control, NULL);
+
 static struct rtc_class_ops ds1672_rtc_ops = {
 	.read_time	= ds1672_rtc_read_time,
 	.set_time	= ds1672_rtc_set_time,
@@ -162,6 +202,7 @@ static struct i2c_driver ds1672_driver =
 static int ds1672_probe(struct i2c_adapter *adapter, int address, int kind)
 {
 	int err = 0;
+	u8 control;
 	struct i2c_client *client;
 	struct rtc_device *rtc;
 
@@ -202,6 +243,20 @@ static int ds1672_probe(struct i2c_adapt
 
 	i2c_set_clientdata(client, rtc);
 
+	/* read control register */
+	err = ds1672_get_control(client, &control);
+	if (err) {
+		dev_err(&client->dev, "%s: read error\n", __FUNCTION__);
+		goto exit_detach;
+	}
+
+	if (control & DS1672_REG_CONTROL_EOSC)
+		dev_warn(&client->dev, "Oscillator not enabled. "
+					"Set time to enable.\n");
+
+	/* Register sysfs hooks */
+	device_create_file(&client->dev, &dev_attr_control);
+
 	return 0;
 
 exit_detach:

--

^ permalink raw reply

* Re: [PATCH/RFC] MTD: Striping layer core
From: Artem B. Bityutskiy @ 2006-03-31 10:06 UTC (permalink / raw)
  To: Jörn Engel
  Cc: Alexander Belyakov, Korolev, Alexey, Vitaly Wool,
	Kutergin, Timofey, linux-mtd
In-Reply-To: <1143799209.3579.74.camel@sauron.oktetlabs.ru>

On Fri, 2006-03-31 at 14:00 +0400, Artem B. Bityutskiy wrote:
> Ideally yes, there should be a /ubi/devices/mtd/mtdX/type file, there

Pardon, typo, I meant /sys/devices/mtd/mtdX/type.

-- 
Best Regards,
Artem B. Bityuckiy,
St.-Petersburg, Russia.

^ permalink raw reply

* [PATCH 02/10] RTC subsystem, DS1672 cleanup
From: Alessandro Zummo @ 2006-03-31 10:04 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm, akpm, Kumar Gala
In-Reply-To: <20060331100423.175139000@towertech.it>

[-- Attachment #1: rtc-subsys-ds1672-tidy.patch --]
[-- Type: text/plain, Size: 3561 bytes --]

 - removed a duplicate error message
 - bumped driver version
 - removed some debugging messages in excess
 - refined the formatting
 - adjusted copyright notice


Signed-off-by: Alessandro Zummo <a.zummo@towertech.it>
Cc: Kumar Gala <galak@kernel.crashing.org>

---
 drivers/rtc/rtc-ds1672.c |   29 ++++++++++-------------------
 1 file changed, 10 insertions(+), 19 deletions(-)

--- linux-rtc.orig/drivers/rtc/rtc-ds1672.c	2006-03-29 02:16:01.000000000 +0200
+++ linux-rtc/drivers/rtc/rtc-ds1672.c	2006-03-29 02:29:43.000000000 +0200
@@ -1,6 +1,8 @@
 /*
  * An rtc/i2c driver for the Dallas DS1672
- * Copyright 2005 Alessandro Zummo
+ * Copyright 2005-06 Tower Technologies
+ *
+ * Author: Alessandro Zummo <a.zummo@towertech.it>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -11,7 +13,7 @@
 #include <linux/i2c.h>
 #include <linux/rtc.h>
 
-#define DRV_VERSION "0.2"
+#define DRV_VERSION "0.3"
 
 /* Addresses to scan: none. This chip cannot be detected. */
 static unsigned short normal_i2c[] = { I2C_CLIENT_END };
@@ -23,9 +25,9 @@ I2C_CLIENT_INSMOD;
 
 #define DS1672_REG_CNT_BASE	0
 #define DS1672_REG_CONTROL	4
-#define DS1672_REG_CONTROL_EOSC	0x80
 #define DS1672_REG_TRICKLE	5
 
+#define DS1672_REG_CONTROL_EOSC	0x80
 
 /* Prototypes */
 static int ds1672_probe(struct i2c_adapter *adapter, int address, int kind);
@@ -54,8 +56,7 @@ static int ds1672_get_datetime(struct i2
 
 	dev_dbg(&client->dev,
 		"%s: raw read data - counters=%02x,%02x,%02x,%02x\n"
-		__FUNCTION__,
-		buf[0], buf[1], buf[2], buf[3]);
+		__FUNCTION__, buf[0], buf[1], buf[2], buf[3]);
 
 	time = (buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | buf[0];
 
@@ -63,8 +64,7 @@ static int ds1672_get_datetime(struct i2
 
 	dev_dbg(&client->dev, "%s: tm is secs=%d, mins=%d, hours=%d, "
 		"mday=%d, mon=%d, year=%d, wday=%d\n",
-		__FUNCTION__,
-		tm->tm_sec, tm->tm_min, tm->tm_hour,
+		__FUNCTION__, tm->tm_sec, tm->tm_min, tm->tm_hour,
 		tm->tm_mday, tm->tm_mon, tm->tm_year, tm->tm_wday);
 
 	return 0;
@@ -144,7 +144,6 @@ static int ds1672_get_control(struct i2c
 static ssize_t show_control(struct device *dev, struct device_attribute *attr, char *buf)
 {
 	struct i2c_client *client = to_i2c_client(dev);
-	char *state = "enabled";
 	u8 control;
 	int err;
 
@@ -152,12 +151,9 @@ static ssize_t show_control(struct devic
 	if (err)
 		return err;
 
-	if (control & DS1672_REG_CONTROL_EOSC)
-		state = "disabled";
-
-	return sprintf(buf, "%s\n", state);
+	return sprintf(buf, "%s\n", (control & DS1672_REG_CONTROL_EOSC)
+					? "disabled" : "enabled");
 }
-
 static DEVICE_ATTR(control, S_IRUGO, show_control, NULL);
 
 static struct rtc_class_ops ds1672_rtc_ops = {
@@ -168,7 +164,6 @@ static struct rtc_class_ops ds1672_rtc_o
 
 static int ds1672_attach(struct i2c_adapter *adapter)
 {
-	dev_dbg(&adapter->dev, "%s\n", __FUNCTION__);
 	return i2c_probe(adapter, &addr_data, ds1672_probe);
 }
 
@@ -177,8 +172,6 @@ static int ds1672_detach(struct i2c_clie
 	int err;
 	struct rtc_device *rtc = i2c_get_clientdata(client);
 
-	dev_dbg(&client->dev, "%s\n", __FUNCTION__);
-
  	if (rtc)
 		rtc_device_unregister(rtc);
 
@@ -245,10 +238,8 @@ static int ds1672_probe(struct i2c_adapt
 
 	/* read control register */
 	err = ds1672_get_control(client, &control);
-	if (err) {
-		dev_err(&client->dev, "%s: read error\n", __FUNCTION__);
+	if (err)
 		goto exit_detach;
-	}
 
 	if (control & DS1672_REG_CONTROL_EOSC)
 		dev_warn(&client->dev, "Oscillator not enabled. "

--

^ permalink raw reply

* [PATCH 08/10] RTC subsystem, SA1100 cleanup
From: Alessandro Zummo @ 2006-03-31 10:04 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm, akpm, Richard Purdie
In-Reply-To: <20060331100423.175139000@towertech.it>

[-- Attachment #1: rtc-subsys-sa1100-tidy.patch --]
[-- Type: text/plain, Size: 1953 bytes --]

 - converted printks to dev_xxx
 - removed messages in excess

Signed-off-by: Alessandro Zummo <a.zummo@towertech.it>
Cc: Richard Purdie <rpurdie@rpsys.net>
---
 drivers/rtc/rtc-sa1100.c |   13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

--- linux-rtc.orig/drivers/rtc/rtc-sa1100.c	2006-03-29 03:15:58.000000000 +0200
+++ linux-rtc/drivers/rtc/rtc-sa1100.c	2006-03-29 03:15:58.000000000 +0200
@@ -160,19 +160,19 @@ static int sa1100_rtc_open(struct device
 	ret = request_irq(IRQ_RTC1Hz, sa1100_rtc_interrupt, SA_INTERRUPT,
 				"rtc 1Hz", dev);
 	if (ret) {
-		printk(KERN_ERR "rtc: IRQ%d already in use.\n", IRQ_RTC1Hz);
+		dev_err(dev, "IRQ %d already in use.\n", IRQ_RTC1Hz);
 		goto fail_ui;
 	}
 	ret = request_irq(IRQ_RTCAlrm, sa1100_rtc_interrupt, SA_INTERRUPT,
 				"rtc Alrm", dev);
 	if (ret) {
-		printk(KERN_ERR "rtc: IRQ%d already in use.\n", IRQ_RTCAlrm);
+		dev_err(dev, "IRQ %d already in use.\n", IRQ_RTCAlrm);
 		goto fail_ai;
 	}
 	ret = request_irq(IRQ_OST1, timer1_interrupt, SA_INTERRUPT,
 				"rtc timer", dev);
 	if (ret) {
-		printk(KERN_ERR "rtc: IRQ%d already in use.\n", IRQ_OST1);
+		dev_err(dev, "IRQ %d already in use.\n", IRQ_OST1);
 		goto fail_pi;
 	}
 	return 0;
@@ -332,7 +332,7 @@ static int sa1100_rtc_probe(struct platf
 	 */
 	if (RTTR == 0) {
 		RTTR = RTC_DEF_DIVIDER + (RTC_DEF_TRIM << 16);
-		printk(KERN_WARNING "rtc: warning: initializing default clock divider/trim value\n");
+		dev_warn(&pdev->dev, "warning: initializing default clock divider/trim value\n");
 		/* The current RTC value probably doesn't make sense either */
 		RCNR = 0;
 	}
@@ -340,14 +340,11 @@ static int sa1100_rtc_probe(struct platf
 	rtc = rtc_device_register(pdev->name, &pdev->dev, &sa1100_rtc_ops,
 				THIS_MODULE);
 
-	if (IS_ERR(rtc)) {
+	if (IS_ERR(rtc))
 		return PTR_ERR(rtc);
-	}
 
 	platform_set_drvdata(pdev, rtc);
 
-	dev_info(&pdev->dev, "SA11xx/PXA2xx RTC Registered\n");
-
 	return 0;
 }
 

--

^ permalink raw reply

* [PATCH 10/10] RTC subsystem, VR41XX cleanup
From: Alessandro Zummo @ 2006-03-31 10:04 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm, akpm, Yoichi Yuasa
In-Reply-To: <20060331100423.175139000@towertech.it>

[-- Attachment #1: rtc-subsys-drv-vr41xx-kconfig.patch --]
[-- Type: text/plain, Size: 852 bytes --]

 Cleaned up kconfig entry for the rtc-vr41xx.

Signed-off-by: Alessandro Zummo <a.zummo@towertech.it>
CC: Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
---
 drivers/rtc/Kconfig |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

--- linux-rtc.orig/drivers/rtc/Kconfig	2006-03-31 11:39:15.000000000 +0200
+++ linux-rtc/drivers/rtc/Kconfig	2006-03-31 11:49:09.000000000 +0200
@@ -148,8 +148,14 @@ config RTC_DRV_SA1100
 	  module will be called rtc-sa1100.
 
 config RTC_DRV_VR41XX
-	tristate "NEC VR4100 series RTC"
+	tristate "NEC VR41XX"
 	depends on RTC_CLASS && CPU_VR41XX
+	help
+	  If you say Y here you will get access to the real time clock
+	  built into your NEC VR41XX CPU.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called rtc-vr41xx.
 
 config RTC_DRV_TEST
 	tristate "Test driver/device"

--

^ permalink raw reply

* [PATCH 09/10] RTC subsystem, VR41XX driver
From: Alessandro Zummo @ 2006-03-31 10:04 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm, akpm, Yoichi Yuasa
In-Reply-To: <20060331100423.175139000@towertech.it>

[-- Attachment #1: rtc-subsys-drv-vr41xx.patch --]
[-- Type: text/plain, Size: 31323 bytes --]

From: Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>

Hi,

This patch updates VR4100 series RTC driver.

* This driver supports new RTC subsystem.
* Simple set time/read time test worked fine.

Yoichi

Signed-off-by: Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>

diff -pruN -X dontdiff mm2-orig/drivers/char/Kconfig mm2/drivers/char/Kconfig
--- mm2-orig/drivers/char/Kconfig	2006-03-31 12:54:47.327851500 +0900
+++ mm2/drivers/char/Kconfig	2006-03-29 11:47:27.440976000 +0900
@@ -788,10 +788,6 @@ config S3C2410_RTC
 	  Samsung S3C2410. This can provide periodic interrupt rates
 	  from 1Hz to 64Hz for user programs, and wakeup from Alarm.
 
-config RTC_VR41XX
-	tristate "NEC VR4100 series Real Time Clock Support"
-	depends on CPU_VR41XX
-
 config COBALT_LCD
 	bool "Support for Cobalt LCD"
 	depends on MIPS_COBALT
diff -pruN -X dontdiff mm2-orig/drivers/char/Makefile mm2/drivers/char/Makefile
--- mm2-orig/drivers/char/Makefile	2006-03-31 12:54:47.327851500 +0900
+++ mm2/drivers/char/Makefile	2006-03-29 11:48:15.283966000 +0900
@@ -65,7 +65,6 @@ obj-$(CONFIG_SGI_DS1286)	+= ds1286.o
 obj-$(CONFIG_SGI_IP27_RTC)	+= ip27-rtc.o
 obj-$(CONFIG_DS1302)		+= ds1302.o
 obj-$(CONFIG_S3C2410_RTC)	+= s3c2410-rtc.o
-obj-$(CONFIG_RTC_VR41XX)	+= vr41xx_rtc.o
 ifeq ($(CONFIG_GENERIC_NVRAM),y)
   obj-$(CONFIG_NVRAM)	+= generic_nvram.o
 else
diff -pruN -X dontdiff mm2-orig/drivers/char/vr41xx_rtc.c mm2/drivers/char/vr41xx_rtc.c
--- mm2-orig/drivers/char/vr41xx_rtc.c	2006-03-31 12:54:51.296099500 +0900
+++ mm2/drivers/char/vr41xx_rtc.c	1970-01-01 09:00:00.000000000 +0900
@@ -1,717 +0,0 @@
-/*
- *  Driver for NEC VR4100 series  Real Time Clock unit.
- *
- *  Copyright (C) 2003-2005  Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
- *
- *  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
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-#include <linux/platform_device.h>
-#include <linux/fs.h>
-#include <linux/init.h>
-#include <linux/ioport.h>
-#include <linux/irq.h>
-#include <linux/mc146818rtc.h>
-#include <linux/miscdevice.h>
-#include <linux/module.h>
-#include <linux/poll.h>
-#include <linux/rtc.h>
-#include <linux/spinlock.h>
-#include <linux/types.h>
-#include <linux/wait.h>
-
-#include <asm/div64.h>
-#include <asm/io.h>
-#include <asm/time.h>
-#include <asm/uaccess.h>
-#include <asm/vr41xx/vr41xx.h>
-
-MODULE_AUTHOR("Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>");
-MODULE_DESCRIPTION("NEC VR4100 series RTC driver");
-MODULE_LICENSE("GPL");
-
-#define RTC1_TYPE1_START	0x0b0000c0UL
-#define RTC1_TYPE1_END		0x0b0000dfUL
-#define RTC2_TYPE1_START	0x0b0001c0UL
-#define RTC2_TYPE1_END		0x0b0001dfUL
-
-#define RTC1_TYPE2_START	0x0f000100UL
-#define RTC1_TYPE2_END		0x0f00011fUL
-#define RTC2_TYPE2_START	0x0f000120UL
-#define RTC2_TYPE2_END		0x0f00013fUL
-
-#define RTC1_SIZE		0x20
-#define RTC2_SIZE		0x20
-
-/* RTC 1 registers */
-#define ETIMELREG		0x00
-#define ETIMEMREG		0x02
-#define ETIMEHREG		0x04
-/* RFU */
-#define ECMPLREG		0x08
-#define ECMPMREG		0x0a
-#define ECMPHREG		0x0c
-/* RFU */
-#define RTCL1LREG		0x10
-#define RTCL1HREG		0x12
-#define RTCL1CNTLREG		0x14
-#define RTCL1CNTHREG		0x16
-#define RTCL2LREG		0x18
-#define RTCL2HREG		0x1a
-#define RTCL2CNTLREG		0x1c
-#define RTCL2CNTHREG		0x1e
-
-/* RTC 2 registers */
-#define TCLKLREG		0x00
-#define TCLKHREG		0x02
-#define TCLKCNTLREG		0x04
-#define TCLKCNTHREG		0x06
-/* RFU */
-#define RTCINTREG		0x1e
- #define TCLOCK_INT		0x08
- #define RTCLONG2_INT		0x04
- #define RTCLONG1_INT		0x02
- #define ELAPSEDTIME_INT	0x01
-
-#define RTC_FREQUENCY		32768
-#define MAX_PERIODIC_RATE	6553
-#define MAX_USER_PERIODIC_RATE	64
-
-static void __iomem *rtc1_base;
-static void __iomem *rtc2_base;
-
-#define rtc1_read(offset)		readw(rtc1_base + (offset))
-#define rtc1_write(offset, value)	writew((value), rtc1_base + (offset))
-
-#define rtc2_read(offset)		readw(rtc2_base + (offset))
-#define rtc2_write(offset, value)	writew((value), rtc2_base + (offset))
-
-static unsigned long epoch = 1970;	/* Jan 1 1970 00:00:00 */
-
-static spinlock_t rtc_task_lock;
-static wait_queue_head_t rtc_wait;
-static unsigned long rtc_irq_data;
-static struct fasync_struct *rtc_async_queue;
-static rtc_task_t *rtc_callback;
-static char rtc_name[] = "RTC";
-static unsigned long periodic_frequency;
-static unsigned long periodic_count;
-
-typedef enum {
-	RTC_RELEASE,
-	RTC_OPEN,
-} rtc_status_t;
-
-static rtc_status_t rtc_status;
-
-typedef enum {
-	FUNCTION_RTC_IOCTL,
-	FUNCTION_RTC_CONTROL,
-} rtc_callfrom_t;
-
-struct resource rtc_resource[2] = {
-	{	.name	= rtc_name,
-		.flags	= IORESOURCE_MEM,	},
-	{	.name	= rtc_name,
-		.flags	= IORESOURCE_MEM,	},
-};
-
-static inline unsigned long read_elapsed_second(void)
-{
-	unsigned long first_low, first_mid, first_high;
-	unsigned long second_low, second_mid, second_high;
-
-	do {
-		first_low = rtc1_read(ETIMELREG);
-		first_mid = rtc1_read(ETIMEMREG);
-		first_high = rtc1_read(ETIMEHREG);
-		second_low = rtc1_read(ETIMELREG);
-		second_mid = rtc1_read(ETIMEMREG);
-		second_high = rtc1_read(ETIMEHREG);
-	} while (first_low != second_low || first_mid != second_mid ||
-	         first_high != second_high);
-
-	return (first_high << 17) | (first_mid << 1) | (first_low >> 15);
-}
-
-static inline void write_elapsed_second(unsigned long sec)
-{
-	spin_lock_irq(&rtc_lock);
-
-	rtc1_write(ETIMELREG, (uint16_t)(sec << 15));
-	rtc1_write(ETIMEMREG, (uint16_t)(sec >> 1));
-	rtc1_write(ETIMEHREG, (uint16_t)(sec >> 17));
-
-	spin_unlock_irq(&rtc_lock);
-}
-
-static void set_alarm(struct rtc_time *time)
-{
-	unsigned long alarm_sec;
-
-	alarm_sec = mktime(time->tm_year + 1900, time->tm_mon + 1, time->tm_mday,
-	                   time->tm_hour, time->tm_min, time->tm_sec);
-
-	spin_lock_irq(&rtc_lock);
-
-	rtc1_write(ECMPLREG, (uint16_t)(alarm_sec << 15));
-	rtc1_write(ECMPMREG, (uint16_t)(alarm_sec >> 1));
-	rtc1_write(ECMPHREG, (uint16_t)(alarm_sec >> 17));
-
-	spin_unlock_irq(&rtc_lock);
-}
-
-static void read_alarm(struct rtc_time *time)
-{
-	unsigned long low, mid, high;
-
-	spin_lock_irq(&rtc_lock);
-
-	low = rtc1_read(ECMPLREG);
-	mid = rtc1_read(ECMPMREG);
-	high = rtc1_read(ECMPHREG);
-
-	spin_unlock_irq(&rtc_lock);
-
-	to_tm((high << 17) | (mid << 1) | (low >> 15), time);
-	time->tm_year -= 1900;
-}
-
-static void read_time(struct rtc_time *time)
-{
-	unsigned long epoch_sec, elapsed_sec;
-
-	epoch_sec = mktime(epoch, 1, 1, 0, 0, 0);
-	elapsed_sec = read_elapsed_second();
-
-	to_tm(epoch_sec + elapsed_sec, time);
-	time->tm_year -= 1900;
-}
-
-static void set_time(struct rtc_time *time)
-{
-	unsigned long epoch_sec, current_sec;
-
-	epoch_sec = mktime(epoch, 1, 1, 0, 0, 0);
-	current_sec = mktime(time->tm_year + 1900, time->tm_mon + 1, time->tm_mday,
-	                     time->tm_hour, time->tm_min, time->tm_sec);
-
-	write_elapsed_second(current_sec - epoch_sec);
-}
-
-static ssize_t rtc_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
-{
-	DECLARE_WAITQUEUE(wait, current);
-	unsigned long irq_data;
-	int retval = 0;
-
-	if (count != sizeof(unsigned int) && count != sizeof(unsigned long))
-		return -EINVAL;
-
-	add_wait_queue(&rtc_wait, &wait);
-
-	do {
-		__set_current_state(TASK_INTERRUPTIBLE);
-
-		spin_lock_irq(&rtc_lock);
-		irq_data = rtc_irq_data;
-		rtc_irq_data = 0;
-		spin_unlock_irq(&rtc_lock);
-
-		if (irq_data != 0)
-			break;
-
-		if (file->f_flags & O_NONBLOCK) {
-			retval = -EAGAIN;
-			break;
-		}
-
-		if (signal_pending(current)) {
-			retval = -ERESTARTSYS;
-			break;
-		}
-	} while (1);
-
-	if (retval == 0) {
-		if (count == sizeof(unsigned int)) {
-			retval = put_user(irq_data, (unsigned int __user *)buf);
-			if (retval == 0)
-				retval = sizeof(unsigned int);
-		} else {
-			retval = put_user(irq_data, (unsigned long __user *)buf);
-			if (retval == 0)
-				retval = sizeof(unsigned long);
-		}
-
-	}
-
-	__set_current_state(TASK_RUNNING);
-	remove_wait_queue(&rtc_wait, &wait);
-
-	return retval;
-}
-
-static unsigned int rtc_poll(struct file *file, struct poll_table_struct *table)
-{
-	poll_wait(file, &rtc_wait, table);
-
-	if (rtc_irq_data != 0)
-		return POLLIN | POLLRDNORM;
-
-	return 0;
-}
-
-static int rtc_do_ioctl(unsigned int cmd, unsigned long arg, rtc_callfrom_t from)
-{
-	struct rtc_time time;
-	unsigned long count;
-
-	switch (cmd) {
-	case RTC_AIE_ON:
-		enable_irq(ELAPSEDTIME_IRQ);
-		break;
-	case RTC_AIE_OFF:
-		disable_irq(ELAPSEDTIME_IRQ);
-		break;
-	case RTC_PIE_ON:
-		enable_irq(RTCLONG1_IRQ);
-		break;
-	case RTC_PIE_OFF:
-		disable_irq(RTCLONG1_IRQ);
-		break;
-	case RTC_ALM_SET:
-		if (copy_from_user(&time, (struct rtc_time __user *)arg,
-		                   sizeof(struct rtc_time)))
-			return -EFAULT;
-
-		set_alarm(&time);
-		break;
-	case RTC_ALM_READ:
-		memset(&time, 0, sizeof(struct rtc_time));
-		read_alarm(&time);
-		break;
-	case RTC_RD_TIME:
-		memset(&time, 0, sizeof(struct rtc_time));
-		read_time(&time);
-		if (copy_to_user((void __user *)arg, &time, sizeof(struct rtc_time)))
-			return -EFAULT;
-		break;
-	case RTC_SET_TIME:
-		if (capable(CAP_SYS_TIME) == 0)
-			return -EACCES;
-
-		if (copy_from_user(&time, (struct rtc_time __user *)arg,
-		                   sizeof(struct rtc_time)))
-			return -EFAULT;
-
-		set_time(&time);
-		break;
-	case RTC_IRQP_READ:
-		return put_user(periodic_frequency, (unsigned long __user *)arg);
-		break;
-	case RTC_IRQP_SET:
-		if (arg > MAX_PERIODIC_RATE)
-			return -EINVAL;
-
-		if (from == FUNCTION_RTC_IOCTL && arg > MAX_USER_PERIODIC_RATE &&
-		    capable(CAP_SYS_RESOURCE) == 0)
-			return -EACCES;
-
-		periodic_frequency = arg;
-
-		count = RTC_FREQUENCY;
-		do_div(count, arg);
-
-		periodic_count = count;
-
-		spin_lock_irq(&rtc_lock);
-
-		rtc1_write(RTCL1LREG, count);
-		rtc1_write(RTCL1HREG, count >> 16);
-
-		spin_unlock_irq(&rtc_lock);
-		break;
-	case RTC_EPOCH_READ:
-		return put_user(epoch, (unsigned long __user *)arg);
-	case RTC_EPOCH_SET:
-		/* Doesn't support before 1900 */
-		if (arg < 1900)
-			return -EINVAL;
-
-		if (capable(CAP_SYS_TIME) == 0)
-			return -EACCES;
-
-		epoch = arg;
-		break;
-	default:
-		return -EINVAL;
-	}
-
-	return 0;
-}
-
-static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
-                     unsigned long arg)
-{
-	return rtc_do_ioctl(cmd, arg, FUNCTION_RTC_IOCTL);
-}
-
-static int rtc_open(struct inode *inode, struct file *file)
-{
-	spin_lock_irq(&rtc_lock);
-
-	if (rtc_status == RTC_OPEN) {
-		spin_unlock_irq(&rtc_lock);
-		return -EBUSY;
-	}
-
-	rtc_status = RTC_OPEN;
-	rtc_irq_data = 0;
-
-	spin_unlock_irq(&rtc_lock);
-
-	return 0;
-}
-
-static int rtc_release(struct inode *inode, struct file *file)
-{
-	if (file->f_flags & FASYNC)
-		(void)fasync_helper(-1, file, 0, &rtc_async_queue);
-
-	spin_lock_irq(&rtc_lock);
-
-	rtc1_write(ECMPLREG, 0);
-	rtc1_write(ECMPMREG, 0);
-	rtc1_write(ECMPHREG, 0);
-	rtc1_write(RTCL1LREG, 0);
-	rtc1_write(RTCL1HREG, 0);
-
-	rtc_status = RTC_RELEASE;
-
-	spin_unlock_irq(&rtc_lock);
-
-	disable_irq(ELAPSEDTIME_IRQ);
-	disable_irq(RTCLONG1_IRQ);
-
-	return 0;
-}
-
-static int rtc_fasync(int fd, struct file *file, int on)
-{
-	return fasync_helper(fd, file, on, &rtc_async_queue);
-}
-
-static struct file_operations rtc_fops = {
-	.owner		= THIS_MODULE,
-	.llseek		= no_llseek,
-	.read		= rtc_read,
-	.poll		= rtc_poll,
-	.ioctl		= rtc_ioctl,
-	.open		= rtc_open,
-	.release	= rtc_release,
-	.fasync		= rtc_fasync,
-};
-
-static irqreturn_t elapsedtime_interrupt(int irq, void *dev_id, struct pt_regs *regs)
-{
-	spin_lock(&rtc_lock);
-	rtc2_write(RTCINTREG, ELAPSEDTIME_INT);
-
-	rtc_irq_data += 0x100;
-	rtc_irq_data &= ~0xff;
-	rtc_irq_data |= RTC_AF;
-	spin_unlock(&rtc_lock);
-
-	spin_lock(&rtc_lock);
-	if (rtc_callback)
-		rtc_callback->func(rtc_callback->private_data);
-	spin_unlock(&rtc_lock);
-
-	wake_up_interruptible(&rtc_wait);
-
-	kill_fasync(&rtc_async_queue, SIGIO, POLL_IN);
-
-	return IRQ_HANDLED;
-}
-
-static irqreturn_t rtclong1_interrupt(int irq, void *dev_id, struct pt_regs *regs)
-{
-	unsigned long count = periodic_count;
-
-	spin_lock(&rtc_lock);
-	rtc2_write(RTCINTREG, RTCLONG1_INT);
-
-	rtc1_write(RTCL1LREG, count);
-	rtc1_write(RTCL1HREG, count >> 16);
-
-	rtc_irq_data += 0x100;
-	rtc_irq_data &= ~0xff;
-	rtc_irq_data |= RTC_PF;
-	spin_unlock(&rtc_lock);
-
-	spin_lock(&rtc_task_lock);
-	if (rtc_callback)
-		rtc_callback->func(rtc_callback->private_data);
-	spin_unlock(&rtc_task_lock);
-
-	wake_up_interruptible(&rtc_wait);
-
-	kill_fasync(&rtc_async_queue, SIGIO, POLL_IN);
-
-	return IRQ_HANDLED;
-}
-
-int rtc_register(rtc_task_t *task)
-{
-	if (task == NULL || task->func == NULL)
-		return -EINVAL;
-
-	spin_lock_irq(&rtc_lock);
-	if (rtc_status == RTC_OPEN) {
-		spin_unlock_irq(&rtc_lock);
-		return -EBUSY;
-	}
-
-	spin_lock(&rtc_task_lock);
-	if (rtc_callback != NULL) {
-		spin_unlock(&rtc_task_lock);
-		spin_unlock_irq(&rtc_task_lock);
-		return -EBUSY;
-	}
-
-	rtc_callback = task;
-	spin_unlock(&rtc_task_lock);
-
-	rtc_status = RTC_OPEN;
-
-	spin_unlock_irq(&rtc_lock);
-
-	return 0;
-}
-
-EXPORT_SYMBOL_GPL(rtc_register);
-
-int rtc_unregister(rtc_task_t *task)
-{
-	spin_lock_irq(&rtc_task_lock);
-	if (task == NULL || rtc_callback != task) {
-		spin_unlock_irq(&rtc_task_lock);
-		return -ENXIO;
-	}
-
-	spin_lock(&rtc_lock);
-
-	rtc1_write(ECMPLREG, 0);
-	rtc1_write(ECMPMREG, 0);
-	rtc1_write(ECMPHREG, 0);
-	rtc1_write(RTCL1LREG, 0);
-	rtc1_write(RTCL1HREG, 0);
-
-	rtc_status = RTC_RELEASE;
-
-	spin_unlock(&rtc_lock);
-
-	rtc_callback = NULL;
-
-	spin_unlock_irq(&rtc_task_lock);
-
-	disable_irq(ELAPSEDTIME_IRQ);
-	disable_irq(RTCLONG1_IRQ);
-
-	return 0;
-}
-
-EXPORT_SYMBOL_GPL(rtc_unregister);
-
-int rtc_control(rtc_task_t *task, unsigned int cmd, unsigned long arg)
-{
-	int retval = 0;
-
-	spin_lock_irq(&rtc_task_lock);
-
-	if (rtc_callback != task)
-		retval = -ENXIO;
-	else
-		rtc_do_ioctl(cmd, arg, FUNCTION_RTC_CONTROL);
-
-	spin_unlock_irq(&rtc_task_lock);
-
-	return retval;
-}
-
-EXPORT_SYMBOL_GPL(rtc_control);
-
-static struct miscdevice rtc_miscdevice = {
-	.minor	= RTC_MINOR,
-	.name	= rtc_name,
-	.fops	= &rtc_fops,
-};
-
-static int __devinit rtc_probe(struct platform_device *pdev)
-{
-	unsigned int irq;
-	int retval;
-
-	if (pdev->num_resources != 2)
-		return -EBUSY;
-
-	rtc1_base = ioremap(pdev->resource[0].start, RTC1_SIZE);
-	if (rtc1_base == NULL)
-		return -EBUSY;
-
-	rtc2_base = ioremap(pdev->resource[1].start, RTC2_SIZE);
-	if (rtc2_base == NULL) {
-		iounmap(rtc1_base);
-		rtc1_base = NULL;
-		return -EBUSY;
-	}
-
-	retval = misc_register(&rtc_miscdevice);
-	if (retval < 0) {
-		iounmap(rtc1_base);
-		iounmap(rtc2_base);
-		rtc1_base = NULL;
-		rtc2_base = NULL;
-		return retval;
-	}
-
-	spin_lock_irq(&rtc_lock);
-
-	rtc1_write(ECMPLREG, 0);
-	rtc1_write(ECMPMREG, 0);
-	rtc1_write(ECMPHREG, 0);
-	rtc1_write(RTCL1LREG, 0);
-	rtc1_write(RTCL1HREG, 0);
-
-	rtc_status = RTC_RELEASE;
-	rtc_irq_data = 0;
-
-	spin_unlock_irq(&rtc_lock);
-
-	init_waitqueue_head(&rtc_wait);
-
-	irq = ELAPSEDTIME_IRQ;
-	retval = request_irq(irq, elapsedtime_interrupt, SA_INTERRUPT,
-	                     "elapsed_time", NULL);
-	if (retval == 0) {
-		irq = RTCLONG1_IRQ;
-		retval = request_irq(irq, rtclong1_interrupt, SA_INTERRUPT,
-		                     "rtclong1", NULL);
-	}
-
-	if (retval < 0) {
-		printk(KERN_ERR "rtc: IRQ%d is busy\n", irq);
-		if (irq == RTCLONG1_IRQ)
-			free_irq(ELAPSEDTIME_IRQ, NULL);
-		iounmap(rtc1_base);
-		iounmap(rtc2_base);
-		rtc1_base = NULL;
-		rtc2_base = NULL;
-		return retval;
-	}
-
-	disable_irq(ELAPSEDTIME_IRQ);
-	disable_irq(RTCLONG1_IRQ);
-
-	spin_lock_init(&rtc_task_lock);
-
-	printk(KERN_INFO "rtc: Real Time Clock of NEC VR4100 series\n");
-
-	return 0;
-}
-
-static int __devexit rtc_remove(struct platform_device *dev)
-{
-	int retval;
-
-	retval = misc_deregister(&rtc_miscdevice);
-	if (retval < 0)
-		return retval;
-
-	free_irq(ELAPSEDTIME_IRQ, NULL);
-	free_irq(RTCLONG1_IRQ, NULL);
-	if (rtc1_base != NULL)
-		iounmap(rtc1_base);
-	if (rtc2_base != NULL)
-		iounmap(rtc2_base);
-
-	return 0;
-}
-
-static struct platform_device *rtc_platform_device;
-
-static struct platform_driver rtc_device_driver = {
-	.probe		= rtc_probe,
-	.remove		= __devexit_p(rtc_remove),
-	.driver		= {
-		.name	= rtc_name,
-		.owner	= THIS_MODULE,
-	},
-};
-
-static int __init vr41xx_rtc_init(void)
-{
-	int retval;
-
-	switch (current_cpu_data.cputype) {
-	case CPU_VR4111:
-	case CPU_VR4121:
-		rtc_resource[0].start = RTC1_TYPE1_START;
-		rtc_resource[0].end = RTC1_TYPE1_END;
-		rtc_resource[1].start = RTC2_TYPE1_START;
-		rtc_resource[1].end = RTC2_TYPE1_END;
-		break;
-	case CPU_VR4122:
-	case CPU_VR4131:
-	case CPU_VR4133:
-		rtc_resource[0].start = RTC1_TYPE2_START;
-		rtc_resource[0].end = RTC1_TYPE2_END;
-		rtc_resource[1].start = RTC2_TYPE2_START;
-		rtc_resource[1].end = RTC2_TYPE2_END;
-		break;
-	default:
-		return -ENODEV;
-		break;
-	}
-
-	rtc_platform_device = platform_device_alloc("RTC", -1);
-	if (!rtc_platform_device)
-		return -ENOMEM;
-
-	retval = platform_device_add_resources(rtc_platform_device,
-				rtc_resource, ARRAY_SIZE(rtc_resource));
-
-	if (retval == 0)
-		retval = platform_device_add(rtc_platform_device);
-
-	if (retval < 0) {
-		platform_device_put(rtc_platform_device);
-		return retval;
-	}
-
-	retval = platform_driver_register(&rtc_device_driver);
-	if (retval < 0)
-		platform_device_unregister(rtc_platform_device);
-
-	return retval;
-}
-
-static void __exit vr41xx_rtc_exit(void)
-{
-	platform_driver_unregister(&rtc_device_driver);
-	platform_device_unregister(rtc_platform_device);
-}
-
-module_init(vr41xx_rtc_init);
-module_exit(vr41xx_rtc_exit);
diff -pruN -X dontdiff mm2-orig/drivers/rtc/Kconfig mm2/drivers/rtc/Kconfig
--- mm2-orig/drivers/rtc/Kconfig	2006-03-31 12:55:36.858947000 +0900
+++ mm2/drivers/rtc/Kconfig	2006-03-29 11:52:56.725555000 +0900
@@ -147,6 +147,10 @@ config RTC_DRV_SA1100
 	  To compile this driver as a module, choose M here: the
 	  module will be called rtc-sa1100.
 
+config RTC_DRV_VR41XX
+	tristate "NEC VR4100 series RTC"
+	depends on RTC_CLASS && CPU_VR41XX
+
 config RTC_DRV_TEST
 	tristate "Test driver/device"
 	depends on RTC_CLASS
diff -pruN -X dontdiff mm2-orig/drivers/rtc/Makefile mm2/drivers/rtc/Makefile
--- mm2-orig/drivers/rtc/Makefile	2006-03-31 12:55:36.858947000 +0900
+++ mm2/drivers/rtc/Makefile	2006-03-29 11:49:17.499854250 +0900
@@ -19,3 +19,4 @@ obj-$(CONFIG_RTC_DRV_RS5C372)	+= rtc-rs5
 obj-$(CONFIG_RTC_DRV_M48T86)	+= rtc-m48t86.o
 obj-$(CONFIG_RTC_DRV_EP93XX)	+= rtc-ep93xx.o
 obj-$(CONFIG_RTC_DRV_SA1100)	+= rtc-sa1100.o
+obj-$(CONFIG_RTC_DRV_VR41XX)	+= rtc-vr41xx.o
diff -pruN -X dontdiff mm2-orig/drivers/rtc/rtc-vr41xx.c mm2/drivers/rtc/rtc-vr41xx.c
--- mm2-orig/drivers/rtc/rtc-vr41xx.c	1970-01-01 09:00:00.000000000 +0900
+++ mm2/drivers/rtc/rtc-vr41xx.c	2006-03-31 15:35:06.909395500 +0900
@@ -0,0 +1,471 @@
+/*
+ *  Driver for NEC VR4100 series Real Time Clock unit.
+ *
+ *  Copyright (C) 2003-2006  Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
+ *
+ *  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
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+#include <linux/fs.h>
+#include <linux/init.h>
+#include <linux/ioport.h>
+#include <linux/irq.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/rtc.h>
+#include <linux/spinlock.h>
+#include <linux/types.h>
+
+#include <asm/div64.h>
+#include <asm/io.h>
+#include <asm/uaccess.h>
+#include <asm/vr41xx/vr41xx.h>
+
+MODULE_AUTHOR("Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>");
+MODULE_DESCRIPTION("NEC VR4100 series RTC driver");
+MODULE_LICENSE("GPL");
+
+#define RTC1_TYPE1_START	0x0b0000c0UL
+#define RTC1_TYPE1_END		0x0b0000dfUL
+#define RTC2_TYPE1_START	0x0b0001c0UL
+#define RTC2_TYPE1_END		0x0b0001dfUL
+
+#define RTC1_TYPE2_START	0x0f000100UL
+#define RTC1_TYPE2_END		0x0f00011fUL
+#define RTC2_TYPE2_START	0x0f000120UL
+#define RTC2_TYPE2_END		0x0f00013fUL
+
+#define RTC1_SIZE		0x20
+#define RTC2_SIZE		0x20
+
+/* RTC 1 registers */
+#define ETIMELREG		0x00
+#define ETIMEMREG		0x02
+#define ETIMEHREG		0x04
+/* RFU */
+#define ECMPLREG		0x08
+#define ECMPMREG		0x0a
+#define ECMPHREG		0x0c
+/* RFU */
+#define RTCL1LREG		0x10
+#define RTCL1HREG		0x12
+#define RTCL1CNTLREG		0x14
+#define RTCL1CNTHREG		0x16
+#define RTCL2LREG		0x18
+#define RTCL2HREG		0x1a
+#define RTCL2CNTLREG		0x1c
+#define RTCL2CNTHREG		0x1e
+
+/* RTC 2 registers */
+#define TCLKLREG		0x00
+#define TCLKHREG		0x02
+#define TCLKCNTLREG		0x04
+#define TCLKCNTHREG		0x06
+/* RFU */
+#define RTCINTREG		0x1e
+ #define TCLOCK_INT		0x08
+ #define RTCLONG2_INT		0x04
+ #define RTCLONG1_INT		0x02
+ #define ELAPSEDTIME_INT	0x01
+
+#define RTC_FREQUENCY		32768
+#define MAX_PERIODIC_RATE	6553
+#define MAX_USER_PERIODIC_RATE	64
+
+static void __iomem *rtc1_base;
+static void __iomem *rtc2_base;
+
+#define rtc1_read(offset)		readw(rtc1_base + (offset))
+#define rtc1_write(offset, value)	writew((value), rtc1_base + (offset))
+
+#define rtc2_read(offset)		readw(rtc2_base + (offset))
+#define rtc2_write(offset, value)	writew((value), rtc2_base + (offset))
+
+static unsigned long epoch = 1970;	/* Jan 1 1970 00:00:00 */
+
+static spinlock_t rtc_lock = SPIN_LOCK_UNLOCKED;
+static char rtc_name[] = "RTC";
+static unsigned long periodic_frequency;
+static unsigned long periodic_count;
+
+struct resource rtc_resource[2] = {
+	{	.name	= rtc_name,
+		.flags	= IORESOURCE_MEM,	},
+	{	.name	= rtc_name,
+		.flags	= IORESOURCE_MEM,	},
+};
+
+static inline unsigned long read_elapsed_second(void)
+{
+
+	unsigned long first_low, first_mid, first_high;
+
+	unsigned long second_low, second_mid, second_high;
+
+	do {
+		first_low = rtc1_read(ETIMELREG);
+		first_mid = rtc1_read(ETIMEMREG);
+		first_high = rtc1_read(ETIMEHREG);
+		second_low = rtc1_read(ETIMELREG);
+		second_mid = rtc1_read(ETIMEMREG);
+		second_high = rtc1_read(ETIMEHREG);
+	} while (first_low != second_low || first_mid != second_mid ||
+	         first_high != second_high);
+
+	return (first_high << 17) | (first_mid << 1) | (first_low >> 15);
+}
+
+static inline void write_elapsed_second(unsigned long sec)
+{
+	spin_lock_irq(&rtc_lock);
+
+	rtc1_write(ETIMELREG, (uint16_t)(sec << 15));
+	rtc1_write(ETIMEMREG, (uint16_t)(sec >> 1));
+	rtc1_write(ETIMEHREG, (uint16_t)(sec >> 17));
+
+	spin_unlock_irq(&rtc_lock);
+}
+
+static void vr41xx_rtc_release(struct device *dev)
+{
+
+	spin_lock_irq(&rtc_lock);
+
+	rtc1_write(ECMPLREG, 0);
+	rtc1_write(ECMPMREG, 0);
+	rtc1_write(ECMPHREG, 0);
+	rtc1_write(RTCL1LREG, 0);
+	rtc1_write(RTCL1HREG, 0);
+
+	spin_unlock_irq(&rtc_lock);
+
+	disable_irq(ELAPSEDTIME_IRQ);
+	disable_irq(RTCLONG1_IRQ);
+}
+
+static int vr41xx_rtc_read_time(struct device *dev, struct rtc_time *time)
+{
+	unsigned long epoch_sec, elapsed_sec;
+
+	epoch_sec = mktime(epoch, 1, 1, 0, 0, 0);
+	elapsed_sec = read_elapsed_second();
+
+	rtc_time_to_tm(epoch_sec + elapsed_sec, time);
+
+	return 0;
+}
+
+static int vr41xx_rtc_set_time(struct device *dev, struct rtc_time *time)
+{
+	unsigned long epoch_sec, current_sec;
+
+	epoch_sec = mktime(epoch, 1, 1, 0, 0, 0);
+	current_sec = mktime(time->tm_year + 1900, time->tm_mon + 1, time->tm_mday,
+	                     time->tm_hour, time->tm_min, time->tm_sec);
+
+	write_elapsed_second(current_sec - epoch_sec);
+
+	return 0;
+}
+
+static int vr41xx_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *wkalrm)
+{
+	unsigned long low, mid, high;
+	struct rtc_time *time = &wkalrm->time;
+
+	spin_lock_irq(&rtc_lock);
+
+	low = rtc1_read(ECMPLREG);
+	mid = rtc1_read(ECMPMREG);
+	high = rtc1_read(ECMPHREG);
+
+	spin_unlock_irq(&rtc_lock);
+
+	rtc_time_to_tm((high << 17) | (mid << 1) | (low >> 15), time);
+
+	return 0;
+}
+
+static int vr41xx_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *wkalrm)
+{
+	unsigned long alarm_sec;
+	struct rtc_time *time = &wkalrm->time;
+
+	alarm_sec = mktime(time->tm_year + 1900, time->tm_mon + 1, time->tm_mday,
+	                   time->tm_hour, time->tm_min, time->tm_sec);
+
+	spin_lock_irq(&rtc_lock);
+
+	rtc1_write(ECMPLREG, (uint16_t)(alarm_sec << 15));
+	rtc1_write(ECMPMREG, (uint16_t)(alarm_sec >> 1));
+	rtc1_write(ECMPHREG, (uint16_t)(alarm_sec >> 17));
+
+	spin_unlock_irq(&rtc_lock);
+
+	return 0;
+}
+
+static int vr41xx_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long arg)
+{
+	unsigned long count;
+
+	switch (cmd) {
+	case RTC_AIE_ON:
+		enable_irq(ELAPSEDTIME_IRQ);
+		break;
+	case RTC_AIE_OFF:
+		disable_irq(ELAPSEDTIME_IRQ);
+		break;
+	case RTC_PIE_ON:
+		enable_irq(RTCLONG1_IRQ);
+		break;
+	case RTC_PIE_OFF:
+		disable_irq(RTCLONG1_IRQ);
+		break;
+	case RTC_IRQP_READ:
+		return put_user(periodic_frequency, (unsigned long __user *)arg);
+		break;
+	case RTC_IRQP_SET:
+		if (arg > MAX_PERIODIC_RATE)
+			return -EINVAL;
+
+		if (arg > MAX_USER_PERIODIC_RATE && capable(CAP_SYS_RESOURCE) == 0)
+			return -EACCES;
+
+		periodic_frequency = arg;
+
+		count = RTC_FREQUENCY;
+		do_div(count, arg);
+
+		periodic_count = count;
+
+		spin_lock_irq(&rtc_lock);
+
+		rtc1_write(RTCL1LREG, count);
+		rtc1_write(RTCL1HREG, count >> 16);
+
+		spin_unlock_irq(&rtc_lock);
+		break;
+	case RTC_EPOCH_READ:
+		return put_user(epoch, (unsigned long __user *)arg);
+	case RTC_EPOCH_SET:
+		/* Doesn't support before 1900 */
+		if (arg < 1900)
+			return -EINVAL;
+
+		if (capable(CAP_SYS_TIME) == 0)
+			return -EACCES;
+
+		epoch = arg;
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+static irqreturn_t elapsedtime_interrupt(int irq, void *dev_id, struct pt_regs *regs)
+{
+	struct platform_device *pdev = (struct platform_device *)dev_id;
+	struct rtc_device *rtc = platform_get_drvdata(pdev);
+
+	rtc2_write(RTCINTREG, ELAPSEDTIME_INT);
+
+	rtc_update_irq(&rtc->class_dev, 1, RTC_AF);
+
+	return IRQ_HANDLED;
+}
+
+static irqreturn_t rtclong1_interrupt(int irq, void *dev_id, struct pt_regs *regs)
+{
+	struct platform_device *pdev = (struct platform_device *)dev_id;
+	struct rtc_device *rtc = platform_get_drvdata(pdev);
+	unsigned long count = periodic_count;
+
+	rtc2_write(RTCINTREG, RTCLONG1_INT);
+
+	rtc1_write(RTCL1LREG, count);
+	rtc1_write(RTCL1HREG, count >> 16);
+
+	rtc_update_irq(&rtc->class_dev, 1, RTC_PF);
+
+	return IRQ_HANDLED;
+}
+
+static struct rtc_class_ops vr41xx_rtc_ops = {
+	.release	= vr41xx_rtc_release,
+	.ioctl		= vr41xx_rtc_ioctl,
+	.read_time	= vr41xx_rtc_read_time,
+	.set_time	= vr41xx_rtc_set_time,
+	.read_alarm	= vr41xx_rtc_read_alarm,
+	.set_alarm	= vr41xx_rtc_set_alarm,
+};
+
+static int __devinit rtc_probe(struct platform_device *pdev)
+{
+	struct rtc_device *rtc;
+	unsigned int irq;
+	int retval;
+
+	if (pdev->num_resources != 2)
+		return -EBUSY;
+
+	rtc1_base = ioremap(pdev->resource[0].start, RTC1_SIZE);
+	if (rtc1_base == NULL)
+		return -EBUSY;
+
+	rtc2_base = ioremap(pdev->resource[1].start, RTC2_SIZE);
+	if (rtc2_base == NULL) {
+		iounmap(rtc1_base);
+		rtc1_base = NULL;
+		return -EBUSY;
+	}
+
+	rtc = rtc_device_register(rtc_name, &pdev->dev, &vr41xx_rtc_ops, THIS_MODULE);
+	if (IS_ERR(rtc)) {
+		iounmap(rtc1_base);
+		iounmap(rtc2_base);
+		rtc1_base = NULL;
+		rtc2_base = NULL;
+		return PTR_ERR(rtc);
+	}
+
+	spin_lock_irq(&rtc_lock);
+
+	rtc1_write(ECMPLREG, 0);
+	rtc1_write(ECMPMREG, 0);
+	rtc1_write(ECMPHREG, 0);
+	rtc1_write(RTCL1LREG, 0);
+	rtc1_write(RTCL1HREG, 0);
+
+	spin_unlock_irq(&rtc_lock);
+
+	irq = ELAPSEDTIME_IRQ;
+	retval = request_irq(irq, elapsedtime_interrupt, SA_INTERRUPT,
+	                     "elapsed_time", pdev);
+	if (retval == 0) {
+		irq = RTCLONG1_IRQ;
+		retval = request_irq(irq, rtclong1_interrupt, SA_INTERRUPT,
+		                     "rtclong1", pdev);
+	}
+
+	if (retval < 0) {
+		printk(KERN_ERR "rtc: IRQ%d is busy\n", irq);
+		rtc_device_unregister(rtc);
+		if (irq == RTCLONG1_IRQ)
+			free_irq(ELAPSEDTIME_IRQ, NULL);
+		iounmap(rtc1_base);
+		iounmap(rtc2_base);
+		rtc1_base = NULL;
+		rtc2_base = NULL;
+		return retval;
+	}
+
+	platform_set_drvdata(pdev, rtc);
+
+	disable_irq(ELAPSEDTIME_IRQ);
+	disable_irq(RTCLONG1_IRQ);
+
+	printk(KERN_INFO "rtc: Real Time Clock of NEC VR4100 series\n");
+
+	return 0;
+}
+
+static int __devexit rtc_remove(struct platform_device *pdev)
+{
+	struct rtc_device *rtc;
+
+	rtc = platform_get_drvdata(pdev);
+	if (rtc != NULL)
+		rtc_device_unregister(rtc);
+
+	platform_set_drvdata(pdev, NULL);
+
+	free_irq(ELAPSEDTIME_IRQ, NULL);
+	free_irq(RTCLONG1_IRQ, NULL);
+	if (rtc1_base != NULL)
+		iounmap(rtc1_base);
+	if (rtc2_base != NULL)
+		iounmap(rtc2_base);
+
+	return 0;
+}
+
+static struct platform_device *rtc_platform_device;
+
+static struct platform_driver rtc_platform_driver = {
+	.probe		= rtc_probe,
+	.remove		= __devexit_p(rtc_remove),
+	.driver		= {
+		.name	= rtc_name,
+		.owner	= THIS_MODULE,
+	},
+};
+
+static int __init vr41xx_rtc_init(void)
+{
+	int retval;
+
+	switch (current_cpu_data.cputype) {
+	case CPU_VR4111:
+	case CPU_VR4121:
+		rtc_resource[0].start = RTC1_TYPE1_START;
+		rtc_resource[0].end = RTC1_TYPE1_END;
+		rtc_resource[1].start = RTC2_TYPE1_START;
+		rtc_resource[1].end = RTC2_TYPE1_END;
+		break;
+	case CPU_VR4122:
+	case CPU_VR4131:
+	case CPU_VR4133:
+		rtc_resource[0].start = RTC1_TYPE2_START;
+		rtc_resource[0].end = RTC1_TYPE2_END;
+		rtc_resource[1].start = RTC2_TYPE2_START;
+		rtc_resource[1].end = RTC2_TYPE2_END;
+		break;
+	default:
+		return -ENODEV;
+		break;
+	}
+
+	rtc_platform_device = platform_device_alloc("RTC", -1);
+	if (rtc_platform_device == NULL)
+		return -ENOMEM;
+
+	retval = platform_device_add_resources(rtc_platform_device,
+				rtc_resource, ARRAY_SIZE(rtc_resource));
+
+	if (retval == 0)
+		retval = platform_device_add(rtc_platform_device);
+
+	if (retval < 0) {
+		platform_device_put(rtc_platform_device);
+		return retval;
+	}
+
+	retval = platform_driver_register(&rtc_platform_driver);
+	if (retval < 0)
+		platform_device_unregister(rtc_platform_device);
+
+	return retval;
+}
+
+static void __exit vr41xx_rtc_exit(void)
+{
+	platform_driver_unregister(&rtc_platform_driver);
+	platform_device_unregister(rtc_platform_device);
+}
+
+module_init(vr41xx_rtc_init);
+module_exit(vr41xx_rtc_exit);

--

^ permalink raw reply

* [PATCH 04/10] RTC subsystem, whitespaces and error messages cleanup
From: Alessandro Zummo @ 2006-03-31 10:04 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm, akpm
In-Reply-To: <20060331100423.175139000@towertech.it>

[-- Attachment #1: rtc-subsys-tidy.patch --]
[-- Type: text/plain, Size: 2355 bytes --]

 - fixed whitespaces
 - removed some debugging in excess

Signed-off-by: Alessandro Zummo <a.zummo@towertech.it>

---
 drivers/rtc/rtc-m48t86.c  |    2 +-
 drivers/rtc/rtc-pcf8563.c |    2 --
 drivers/rtc/rtc-rs5c372.c |    3 ---
 drivers/rtc/rtc-x1205.c   |    3 ---
 4 files changed, 1 insertion(+), 9 deletions(-)

--- linux-rtc.orig/drivers/rtc/rtc-x1205.c	2006-03-29 02:33:58.000000000 +0200
+++ linux-rtc/drivers/rtc/rtc-x1205.c	2006-03-29 03:12:07.000000000 +0200
@@ -498,7 +498,6 @@ static DEVICE_ATTR(dtrim, S_IRUGO, x1205
 
 static int x1205_attach(struct i2c_adapter *adapter)
 {
-	dev_dbg(&adapter->dev, "%s\n", __FUNCTION__);
 	return i2c_probe(adapter, &addr_data, x1205_probe);
 }
 
@@ -587,8 +586,6 @@ static int x1205_detach(struct i2c_clien
 	int err;
 	struct rtc_device *rtc = i2c_get_clientdata(client);
 
-	dev_dbg(&client->dev, "%s\n", __FUNCTION__);
-
  	if (rtc)
 		rtc_device_unregister(rtc);
 
--- linux-rtc.orig/drivers/rtc/rtc-rs5c372.c	2006-03-29 02:47:17.000000000 +0200
+++ linux-rtc/drivers/rtc/rtc-rs5c372.c	2006-03-29 03:12:07.000000000 +0200
@@ -193,7 +193,6 @@ static DEVICE_ATTR(osc, S_IRUGO, rs5c372
 
 static int rs5c372_attach(struct i2c_adapter *adapter)
 {
-	dev_dbg(&adapter->dev, "%s\n", __FUNCTION__);
 	return i2c_probe(adapter, &addr_data, rs5c372_probe);
 }
 
@@ -260,8 +259,6 @@ static int rs5c372_detach(struct i2c_cli
 	int err;
 	struct rtc_device *rtc = i2c_get_clientdata(client);
 
-	dev_dbg(&client->dev, "%s\n", __FUNCTION__);
-
 	if (rtc)
 		rtc_device_unregister(rtc);
 
--- linux-rtc.orig/drivers/rtc/rtc-pcf8563.c	2006-03-29 02:47:17.000000000 +0200
+++ linux-rtc/drivers/rtc/rtc-pcf8563.c	2006-03-29 03:12:07.000000000 +0200
@@ -321,8 +321,6 @@ static int pcf8563_detach(struct i2c_cli
 	int err;
 	struct rtc_device *rtc = i2c_get_clientdata(client);
 
-	dev_dbg(&client->dev, "%s\n", __FUNCTION__);
-
 	if (rtc)
 		rtc_device_unregister(rtc);
 
--- linux-rtc.orig/drivers/rtc/rtc-m48t86.c	2006-03-29 02:47:17.000000000 +0200
+++ linux-rtc/drivers/rtc/rtc-m48t86.c	2006-03-29 03:12:07.000000000 +0200
@@ -23,7 +23,7 @@
 #define M48T86_REG_SECALRM	0x01
 #define M48T86_REG_MIN		0x02
 #define M48T86_REG_MINALRM	0x03
-#define M48T86_REG_HOUR	0x04
+#define M48T86_REG_HOUR		0x04
 #define M48T86_REG_HOURALRM	0x05
 #define M48T86_REG_DOW		0x06 /* 1 = sunday */
 #define M48T86_REG_DOM		0x07

--

^ permalink raw reply

* [PATCH 06/10] RTC subsystem, RS5C372 sysfs fix
From: Alessandro Zummo @ 2006-03-31 10:04 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm, akpm
In-Reply-To: <20060331100423.175139000@towertech.it>

[-- Attachment #1: rtc-subsys-rs5c372-fix-sysfs.patch --]
[-- Type: text/plain, Size: 1372 bytes --]

 fixed sysfs show() return code

Signed-off-by: Alessandro Zummo <a.zummo@towertech.it>

---
 drivers/rtc/rtc-rs5c372.c |   18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

--- linux-rtc.orig/drivers/rtc/rtc-rs5c372.c	2006-03-29 02:41:04.000000000 +0200
+++ linux-rtc/drivers/rtc/rtc-rs5c372.c	2006-03-29 02:46:40.000000000 +0200
@@ -169,24 +169,26 @@ static struct rtc_class_ops rs5c372_rtc_
 static ssize_t rs5c372_sysfs_show_trim(struct device *dev,
 				struct device_attribute *attr, char *buf)
 {
-	int trim;
+	int err, trim;
 
-	if (rs5c372_get_trim(to_i2c_client(dev), NULL, &trim) == 0)
-		return sprintf(buf, "0x%2x\n", trim);
+	err = rs5c372_get_trim(to_i2c_client(dev), NULL, &trim);
+	if (err)
+		return err;
 
-	return 0;
+	return sprintf(buf, "0x%2x\n", trim);
 }
 static DEVICE_ATTR(trim, S_IRUGO, rs5c372_sysfs_show_trim, NULL);
 
 static ssize_t rs5c372_sysfs_show_osc(struct device *dev,
 				struct device_attribute *attr, char *buf)
 {
-	int osc;
+	int err, osc;
 
-	if (rs5c372_get_trim(to_i2c_client(dev), &osc, NULL) == 0)
-		return sprintf(buf, "%d.%03d KHz\n", osc / 1000, osc % 1000);
+	err = rs5c372_get_trim(to_i2c_client(dev), &osc, NULL);
+	if (err)
+		return err;
 
-	return 0;
+	return sprintf(buf, "%d.%03d KHz\n", osc / 1000, osc % 1000);
 }
 static DEVICE_ATTR(osc, S_IRUGO, rs5c372_sysfs_show_osc, NULL);
 

--

^ permalink raw reply


This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.