From: Jonathan Cameron <kernel@jic23.retrosnub.co.uk>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Onkalo Samu <samu.p.onkalo@nokia.com>,
ext Alan Cox <alan@lxorguk.ukuu.org.uk>,
"linux-i2c@vger.kernel.org" <linux-i2c@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
"linux-input@vger.kernel.org" <linux-input@vger.kernel.org>
Subject: Re: [PATCH 1/3] drivers: misc: ak8974 / ami305 magnetometer driver
Date: Sat, 28 Aug 2010 14:44:07 +0100 [thread overview]
Message-ID: <4C7912A7.5020008@jic23.retrosnub.co.uk> (raw)
In-Reply-To: <20100827180837.GB13154@core.coreip.homeip.net>
On 08/27/10 19:08, Dmitry Torokhov wrote:
> On Fri, Aug 27, 2010 at 07:59:13PM +0300, Onkalo Samu wrote:
>>>
>>>> +static ssize_t ak8974_misc_read(struct file *file, char __user *buf,
>>>> + size_t count, loff_t *offset)
>>>> +{
>>>> + struct ak8974_chip *chip = container_of(file->private_data,
>>>> + struct ak8974_chip,
>>>> + miscdev);
>>>> + struct ak8974_data data;
>>>
>>> So we have a different API to the ak8975 just posted and to the other
>>> existing devices. This needs sorting out across the devices before there
>>> is a complete disaster. Right now we have a mix of submissions pending
>>> which variously use
>>>
>>> misc + sysfs
>>> sysfs
>>> input (reporting X Y Z etc axes)
>>>
>>
>> About year ago I send driver for the same chip with input-device
>> interface. During that time I asked from Dmitry Torokhov that is that a
>> correct interface for this kind of driver. I understood that input
>> should not be used for this kind of sensors.
>>
>> sysfs is quite handy interface for small sensors. However, one problem
>> is that the driver doesn't know when the interface is in use.
>> I ended up to misc device to get information about the usercount for PM
>> purposes.
>>
>> Dmitry, what is your opinion about using input device interface for this
>> kind of sensors?
>>
>
> This is really hard question and I am going back and forth myself.
>
> When considering using input subsystem try answering the following
> question - is the device's main purpose is indeed to be a human
> interface device or do you want to use input subystem because evdev
> interface is convenient? If the answer is former- then it should be in
> input (or available through input - let's say IIO-to-input bridge
> module). If the answer is latter then input is not the right place for
> the device.
The iio to input bridge is still on the todo list. Unfortunately none
of the core developers are particularly interested in that so it isn't
a high priority. Of course we would welcome someone working on it!
If not it we will get to it.
>
> Lately I was persuaded that 3-axis accelerometers are mainly used as
> input devices so I took adxl driver in and I need to get back and review
> cma3000 patch...
>
>>> Someone needs to decide on a single API before it's too late.
>>>
>>
>> That is definitely true. Could it be IIO?
>>
I'm in favour ;)
We already have one straight magnetometer and one imu which includes
a magnetometer. I'd love to see more and would certainly welcome this
driver.
>
> I was hpoing that IIO would take care of "unnamed" sensors. Here I mean
> sensors that measure something and only user/application know exactly
> what it is; the same device might measure different things depending on
> setup. Take a temperature sensor - ambient temperature, temperature of
> some technological process, patient temperature - it is hard for the
> kernel to know which one it would be.
>
> This is in contrast with input system that tries to classify
> events so that the event has the same meaning regarless of which device
> emitted it - KEY_A means the same regardless of keybord; we may route
> them differently (multiseat for example), but the meaning is the same.
>
That's certainly our intent.
The down side of going with IIO is that it is taking a while to cleanup
the userspace abi (and the core code for that matter!).
Manuel Stahl has been recently pinning down a few issues made apparent via
the generic userspace code he has been working on, so there will be patches
relating to that over the next week. Ultimately the lack of interface stability
is on reason IIO is still in staging. All help on this and more general code
review of IIO is welcomed!
For the sysfs devices I'd request that people either match our naming convention
or that of hwmon (which the IIO one extends). By this I mean the individual
attributes, not the directory naming etc. That way whatever the resulting
subsystems of the future, we will at least have one naming convention!
The chrdev end of things are more complex. (I'm happy to go into why we have two
types etc but that's a much larger discussion) As a quick note though, the
structure you have used is obviously very much device (or at least narrow class of)
device specific. Our approach to this is a description of the format via a set of
sysfs params. Much as you have done we need to maintain the linkage between a 'scan'
of the channels and this approach allows us to do this.
Jonathan
next prev parent reply other threads:[~2010-08-28 13:44 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-27 11:54 [PATCH 0/3] ak8974 / ami305 magnetometer driver Samu Onkalo
[not found] ` <1282910083-8629-1-git-send-email-samu.p.onkalo-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
2010-08-27 11:54 ` [PATCH 1/3] drivers: misc: " Samu Onkalo
[not found] ` <1282910083-8629-2-git-send-email-samu.p.onkalo-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
2010-08-27 12:31 ` Alan Cox
[not found] ` <20100827133109.1eb974ed-qBU/x9rampVanCEyBjwyrvXRex20P6io@public.gmane.org>
2010-08-27 16:59 ` Onkalo Samu
[not found] ` <1282928353.2194.27.camel-Vo7XL3ix0D0UEupzmRo7jhl4MBrZKKet0E9HWUfgJXw@public.gmane.org>
2010-08-27 18:08 ` Dmitry Torokhov
2010-08-28 13:44 ` Jonathan Cameron [this message]
2010-08-27 18:53 ` Mark Brown
[not found] ` <20100827185343.GA6626-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2010-08-30 6:55 ` Onkalo Samu
2010-08-31 11:11 ` Mark Brown
2010-08-28 16:10 ` Sundar
2010-08-30 7:12 ` Onkalo Samu
2010-08-31 7:13 ` Sundar
2010-08-27 11:54 ` [PATCH 2/3] drivers: misc: ak8974 support to Kconfig and Makefile Samu Onkalo
2010-08-27 11:54 ` [PATCH 3/3] Documentation: Documentation for ak8974 magnetometer chip driver Samu Onkalo
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=4C7912A7.5020008@jic23.retrosnub.co.uk \
--to=kernel@jic23.retrosnub.co.uk \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=samu.p.onkalo@nokia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox