public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Lenz Grimmer <lenz@grimmer.com>
To: Jesper Juhl <jesper.juhl@gmail.com>
Cc: Alejandro Bonilla <abonilla@linuxwireless.org>,
	Dave Hansen <dave@sr71.net>,
	Henrik Brix Andersen <brix@gentoo.org>,
	hdaps-devel@lists.sourceforge.net,
	LKML List <linux-kernel@vger.kernel.org>,
	Jens Axboe <axboe@suse.de>
Subject: Re: IBM HDAPS things are looking up (was: Re: [Hdaps-devel] Re: [ltp] IBM HDAPS Someone interested? (Accelerometer))
Date: Mon, 04 Jul 2005 08:00:12 +0200	[thread overview]
Message-ID: <42C8D06C.2020608@grimmer.com> (raw)
In-Reply-To: <9a8748490507031832546f383a@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3615 bytes --]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Jesper,

Jesper Juhl wrote:

> I just had a nice chat with the guys there and we got some
> improvements made by them and us merged up. And I /think/ we agreed
> that I'll maintain the driver, merge fixes/features etc and eventually
> try to get it merged.

Thanks a ton! I am really excited to see that you guys made so much
progress over the past few days! Of course, I immediately had to give it
a try :)

> Currently the driver loads, initializes the accelerometer and we can
> read data from it.

And here is a first support request - the kernel module does not load
for me :(

I have a Thinkpad T42, running SUSE Linux 9.3 (Kernel 2.6.11 with SUSE
patches). The APS works on Windows, so I know the accelerometer is there.

I have downloaded the sources from your site mentioned below, ran "make"
and "make install". Then I created the /dev/hdaps0 device node by
running "mknod hdaps0 c 228 0". (I picked this out of another message in
the discussion)

However, running "modprobe ibm_hdaps" only yields an error:

FATAL: Error inserting ibm_hdaps
(/lib/modules/2.6.11.4-21.7-default/kernel/drivers/misc/ibm_hdaps.ko):
No such device or address

In /var/log/messages, I only see:

Jul  4 07:17:20 metis kernel: ibm_hdaps: unsupported module, tainting
kernel.
Jul  4 07:17:20 metis kernel: init 1 50239260

(The last number differs every time I load the module)
Passing "debug=1" did not really reveal any more info. How could I
provide you with more detail?

I also tried to load Henrik's module, but it also spits out an error
"failed to allocate I/O", then a long number of "latch_check" lines and
"initialize() ret: -5".

Maybe the accelerometer on the T42 uses a different port range? Or could
it be that some other kernel module is blocking this I/O range? I have
no clue...

> I'll be working on adding sysfs stuff to it tomorrow so it's generally
> useful (at least for monitoring things - not yet for parking disk
> heads).

Maybe there is some kind of all-purpose ATA command that instructs the
disk drive to park the heads? Jens, could you give us a hint on how a
userspace application would do that?

> Once I've got the sysfs stuff sorted I'll publish a new version.
> 
> The most recent version of the driver is currently at
> http://lemonshop.dk/ibm_hpaps/ (note: this is most likely not going to
> be the permanent home of this driver, but it's where it lives for
> now).

Should we try to move the sources over to the hdaps.sf.net CVS tree?
Even though I am more a Subversion fan, having at least some kind of
version control would make it easier for others to participate and make
sure we can send patches against the latest version.

> Patches are welcome at jesper.juhl@gmail.com

Attached please find a diff against ibm_hdaps.c I found on the URL above
- - I moved some stuff to a separate header file (attached) and added
printing out the driver name and copyright during module initialization
(taken from Henrik's files). I also added an "uninstall" target to the
Makefile.

I hope you find it useful!

Bye,
	LenZ
- --
- ------------------------------------------------------------------
 Lenz Grimmer <lenz@grimmer.com>                             -o)
 [ICQ: 160767607 | Jabber: LenZGr@jabber.org]                /\\
 http://www.lenzg.org/                                       V_V
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCyNBpSVDhKrJykfIRAmLjAJwI1xaQEeW98M4yLVema2u+b9gX9wCfSufx
BuNm1Kcfk48FAn1e3pMa27M=
=yy24
-----END PGP SIGNATURE-----

[-- Attachment #2: ibm_hdaps.diff --]
[-- Type: text/x-patch, Size: 2133 bytes --]

--- ibm_hdaps.c.org	2005-07-04 07:33:17.000000000 +0200
+++ ibm_hdaps.c	2005-07-04 07:42:58.000000000 +0200
@@ -34,31 +34,18 @@
 #include <linux/delay.h>
 #include <asm/io.h>
 #include <asm/uaccess.h>
+#include "ibm_hdaps.h"
 
 
+#define DRV_NAME        "ibm_hdaps"
+#define DRV_DESCRIPTION	"IBM ThinkPad Accelerometer driver"
+#define DRV_COPYRIGHT  	"Copyright (c) 2005 Jesper Juhl <jesper.juhl@gmail.com>"
+#define DRV_VERSION     "0.2"
 
-#define HDAPS_LOW_PORT	0x1600	/* first port used by accelerometer */
-#define HDAPS_NR_PORTS	0x30	/* nr of ports total - 0x1600 through 0x162f */
-
-#define STATE_STALE	0x00	/* accelerometer data is stale */
-#define STATE_FRESH	0x50	/* accelerometer data fresh fresh */
-
-#define REFRESH_ASYNC	0x00	/* do asynchronous refresh */
-#define REFRESH_SYNC	0x01	/* do synchronous refresh */
-
-/* 
- * where to find the various accelerometer data
- * these map to the members of struct hdaps_accel_data
- */
-#define HDAPS_PORT_STATE	0x1611
-#define	HDAPS_PORT_XACCEL	0x1612
-#define HDAPS_PORT_YACCEL	0x1614
-#define HDAPS_PORT_TEMP		0x1616
-#define HDAPS_PORT_XVAR		0x1617
-#define HDAPS_PORT_YVAR		0x1619
-#define HDAPS_PORT_TEMP2	0x161b
-#define HDAPS_PORT_UNKNOWN	0x161c
-#define HDAPS_PORT_KMACCT	0x161d
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR(DRV_COPYRIGHT);
+MODULE_DESCRIPTION(DRV_DESCRIPTION);
+MODULE_VERSION(DRV_VERSION);
 
 static short debug = 0;
  
@@ -345,6 +332,9 @@
 	int retval;
 	struct hdaps_accel_data data;
 
+	printk(KERN_INFO DRV_NAME ": " DRV_DESCRIPTION ", " DRV_VERSION "\n");
+	printk(KERN_INFO DRV_NAME ": " DRV_COPYRIGHT "\n");
+
 	printk(KERN_WARNING "init 1 %08ld\n", jiffies);
 	if (!request_region(HDAPS_LOW_PORT, HDAPS_NR_PORTS, "ibm_hdaps"))
 		return -ENXIO;
@@ -367,7 +357,6 @@
 	}
 	
 	if (0) for (i = 0; i < 50; i++) {
-		int j;
 		unsigned long tmp;
 		accelerometer_read(&data);
 		printk(KERN_WARNING "state = %d\n", data.state);
@@ -405,8 +394,3 @@
 module_init(ibm_hdaps_init);
 module_exit(ibm_hdaps_exit);
 
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Jesper Juhl");
-
-MODULE_DESCRIPTION("IBM ThinkPad Accelerometer driver");
-MODULE_VERSION("0.2");

[-- Attachment #3: ibm_hdaps.h --]
[-- Type: text/plain, Size: 1832 bytes --]

/*
 * Driver for IBM HDAPS (HardDisk Active Protection system)
 *
 * Based on the document by Mark A. Smith available at
 * http://www.almaden.ibm.com/cs/people/marksmith/tpaps.html
 *
 * Copyright (c) 2005  Jesper Juhl <jesper.juhl@gmail.com>
 *
 * 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.
 */

#ifndef __IBM_HDAPS_H__
#define __IBM_HDAPS_H__

#define HDAPS_LOW_PORT	0x1600	/* first port used by accelerometer */
#define HDAPS_NR_PORTS	0x30	/* nr of ports total - 0x1600 through 0x162f */

#define STATE_STALE	0x00	/* accelerometer data is stale */
#define STATE_FRESH	0x50	/* accelerometer data fresh fresh */

#define REFRESH_ASYNC	0x00	/* do asynchronous refresh */
#define REFRESH_SYNC	0x01	/* do synchronous refresh */

/* 
 * where to find the various accelerometer data
 * these map to the members of struct hdaps_accel_data
 */
#define HDAPS_PORT_STATE	0x1611
#define	HDAPS_PORT_XACCEL	0x1612
#define HDAPS_PORT_YACCEL	0x1614
#define HDAPS_PORT_TEMP		0x1616
#define HDAPS_PORT_XVAR		0x1617
#define HDAPS_PORT_YVAR		0x1619
#define HDAPS_PORT_TEMP2	0x161b
#define HDAPS_PORT_UNKNOWN	0x161c
#define HDAPS_PORT_KMACCT	0x161d

#endif /*  __IBM_HDAPS_H__  */

[-- Attachment #4: Makefile.diff --]
[-- Type: text/x-patch, Size: 292 bytes --]

--- Makefile.org	2005-07-04 07:58:53.000000000 +0200
+++ Makefile	2005-07-04 07:57:50.000000000 +0200
@@ -26,3 +26,7 @@
 	install -d $(KMISC)
 	install -m 644 -c $(addsuffix .ko,$(list-m)) $(KMISC)
 	/sbin/depmod -a
+
+uninstall:
+	rm -f $(KMISC)/$(addsuffix .ko,$(list-m))
+	/sbin/depmod -a

  parent reply	other threads:[~2005-07-04  6:00 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-04  1:32 IBM HDAPS things are looking up (was: Re: [Hdaps-devel] Re: [ltp] IBM HDAPS Someone interested? (Accelerometer)) Jesper Juhl
2005-07-04  2:12 ` Alejandro Bonilla
2005-07-04  6:00 ` Lenz Grimmer [this message]
2005-07-04  6:17   ` Jens Axboe
2005-07-04  5:30     ` Alejandro Bonilla
2005-07-04  6:37       ` Jens Axboe
2005-07-04  7:16         ` Arjan van de Ven
2005-07-04  7:22           ` Jens Axboe
2005-07-04  7:27             ` Arjan van de Ven
2005-07-04  7:30               ` Jens Axboe
2005-07-04 10:33                 ` Lenz Grimmer
2005-07-04 11:06                   ` Jens Axboe
2005-07-04 13:18                     ` IBM HDAPS things are looking up Lenz Grimmer
2005-07-04 13:25                       ` Jens Axboe
2005-07-04 14:32                         ` [Hdaps-devel] " Shawn Starr
2005-07-07  8:03                     ` IBM HDAPS things are looking up (was: Re: [Hdaps-devel] Re: [ltp] IBM HDAPS Someone interested? (Accelerometer)) Jens Axboe
2005-07-07  8:41                       ` Head parking (was: IBM HDAPS things are looking up) Lenz Grimmer
2005-07-07  8:48                         ` Jens Axboe
2005-07-07 10:17                           ` [Hdaps-devel] " Lenz Grimmer
2005-07-07 15:06                           ` Shawn Starr
2005-07-07  9:07                         ` Pekka Enberg
2005-07-07 11:44                           ` Jens Axboe
2005-07-07 13:28                             ` Pekka Enberg
2005-07-07 14:28                       ` IBM HDAPS things are looking up (was: Re: [Hdaps-devel] Re: [ltp] IBM HDAPS Someone interested? (Accelerometer)) Shawn Starr
2005-07-07 14:37                         ` Alejandro Bonilla
2005-07-07 15:06                           ` Jens Axboe
2005-07-07 20:43                           ` Folkert van Heusden
2005-07-07 15:05                         ` Jens Axboe
2005-07-07 23:00                           ` Jon Escombe
2005-07-07 23:31                             ` Alejandro Bonilla
2005-07-08  6:31                             ` Jens Axboe
2005-07-08 18:32                               ` Shawn Starr
2005-07-07 15:03                       ` Shawn Starr
2005-07-07 17:02                       ` Clemens Koller
2005-07-07 17:15                         ` Alejandro Bonilla
2005-07-07 17:34                           ` Jens Axboe
2005-07-07 17:49                             ` Matthew Garrett
2005-07-07 18:52                               ` Jens Axboe
2005-07-07 17:27                         ` Jens Axboe
2005-07-07 17:38                           ` Dave Hansen
2005-07-07 18:01                             ` Lee Revell
2005-07-07 18:03                               ` Dave Hansen
2005-07-07 18:48                             ` Jens Axboe
2005-07-04 13:03             ` Pavel Machek
2005-07-04 20:30               ` IBM HDAPS things are looking up Lenz Grimmer
2005-07-04 22:12                 ` Pavel Machek
2005-07-04 21:08               ` IBM HDAPS things are looking up (was: Re: [Hdaps-devel] Re: [ltp] IBM HDAPS Someone interested? (Accelerometer)) Alejandro Bonilla
2005-07-05  7:14                 ` Jens Axboe
2005-07-05 12:29                   ` Alejandro Bonilla
2005-07-05 15:41                     ` Sander
2005-07-05 15:52                       ` Alejandro Bonilla
2005-07-05 15:45                     ` Lee Revell
2005-07-04 10:28     ` Lenz Grimmer
2005-07-04 14:27     ` Shawn Starr
2005-07-04 14:46       ` Jens Axboe
2005-07-04 17:24         ` IBM HDAPS things are looking up Alejandro Bonilla
2005-07-04 18:36           ` dean gaudet
2005-07-05  5:13             ` Lee Revell
2005-07-04 18:40           ` Jens Axboe
2005-07-04 18:59     ` IBM HDAPS things are looking up (was: Re: [Hdaps-devel] Re: [ltp] IBM HDAPS Someone interested? (Accelerometer)) Aaron Cohen
2005-07-04 19:27       ` Lenz Grimmer
2005-07-04  8:45   ` Andrey Panin
2005-07-04 10:49 ` Pekka Enberg
2005-07-04 11:00   ` Jesper Juhl
2005-07-04 12:32 ` Pavel Machek
     [not found] <4msjB-DS-9@gated-at.bofh.it>
     [not found] ` <4mste-IL-1@gated-at.bofh.it>
     [not found]   ` <4msME-SM-9@gated-at.bofh.it>
     [not found]     ` <4msWl-Yq-5@gated-at.bofh.it>
     [not found]       ` <4mtza-1vg-15@gated-at.bofh.it>
     [not found]         ` <4mtII-1Ab-13@gated-at.bofh.it>
     [not found]           ` <4mtSm-1FA-5@gated-at.bofh.it>
     [not found]             ` <4mtSn-1FA-11@gated-at.bofh.it>
     [not found]               ` <4mwx1-3N9-25@gated-at.bofh.it>
     [not found]                 ` <4mx9A-4qm-1@gated-at.bofh.it>
     [not found]                   ` <4nzCr-6fN-19@gated-at.bofh.it>
     [not found]                     ` <4nI36-527-9@gated-at.bofh.it>
2005-07-08  0:56                       ` Bodo Eggert
2005-07-08  6:26                         ` Jens Axboe
2005-07-08  8:49                         ` Vojtech Pavlik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=42C8D06C.2020608@grimmer.com \
    --to=lenz@grimmer.com \
    --cc=abonilla@linuxwireless.org \
    --cc=axboe@suse.de \
    --cc=brix@gentoo.org \
    --cc=dave@sr71.net \
    --cc=hdaps-devel@lists.sourceforge.net \
    --cc=jesper.juhl@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox