* Re: [PATCH 1/3] drivers: misc: ak8974 / ami305 magnetometer driver [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> 0 siblings, 1 reply; 7+ messages in thread From: Alan Cox @ 2010-08-27 12:31 UTC (permalink / raw) To: Samu Onkalo Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b, linux-input-u79uwXL29TY76Z2rM5mHXA > +static int ak8974_regulators_on(struct ak8974_chip *chip) > +{ > + int ret; > + ret = regulator_bulk_enable(ARRAY_SIZE(chip->regs), chip->regs); > + if (ret == 0) > + msleep(AK8974_POWERON_DELAY); > + > + return ret; > +} > + > +static inline void ak8974_regulators_off(struct ak8974_chip *chip) > +{ > + regulator_bulk_disable(ARRAY_SIZE(chip->regs), chip->regs); > +} That bit seems platform specific but in generic code ? > +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) Someone needs to decide on a single API before it's too late. > + > + if (count < sizeof(data)) > + return -EINVAL; > + > + if (*offset >= chip->offset) { > + schedule_work(&chip->work); > + if (file->f_flags & O_NONBLOCK) > + return -EAGAIN; > + if (wait_event_interruptible(chip->misc_wait, > + (*offset < chip->offset))) > + return -ERESTARTSYS; > + } > + > + mutex_lock(&chip->lock); > + data.x = chip->x; > + data.y = chip->y; > + data.z = chip->z; > + data.valid = chip->valid; > + *offset = chip->offset; > + mutex_unlock(&chip->lock); What happens if you have two readers - is it fine they get copies of the same event when it races ? > + > + return copy_to_user(buf, &data, sizeof(data)) ? -EFAULT : sizeof(data); Pedantically if data is consumed and a partial copy occurs you should return the bytes successfully copied. > +static DEVICE_ATTR(chip_id, S_IRUGO, ak8974_show_chip_id, NULL); > + > +static ssize_t ak8974_show_range(struct device *dev, > + struct device_attribute *attr, char *buf) > +{ > + struct ak8974_chip *chip = dev_get_drvdata(dev); > + return sprintf(buf, "%d\n", chip->max_range); > +} Other devices make all of this sysfs or use input. We need to work out what the right interface actually is. > + snprintf(chip->name, sizeof(chip->name), "ak8974%d", > + atomic_add_return(1, &device_number) - 1); Surely this is serialized anyway ? > +#ifdef CONFIG_PM > +static int ak8974_suspend(struct i2c_client *client, pm_message_t mesg) > +{ > + struct ak8974_chip *chip = i2c_get_clientdata(client); > + mutex_lock(&chip->users_lock); > + if (chip->users > 0) > + ak8974_enable(chip, AK8974_PWR_OFF); > + mutex_unlock(&chip->users_lock); > + return 0; > +} > + > +static int ak8974_resume(struct i2c_client *client) > +{ > + struct ak8974_chip *chip = i2c_get_clientdata(client); > + mutex_lock(&chip->users_lock); > + if (chip->users > 0) > + ak8974_enable(chip, AK8974_PWR_ON); > + mutex_unlock(&chip->users_lock); > + return 0; > +} The whole chip->users thing you are implementing is basically a reimplementation of the kernel runtime pm stuff - so can that be used instead ? > +#ifndef __LINUX_I2C_AK8974_H > +#define __LINUX_I2C_AK8974_H > + > +#define AK8974_NO_MAP 0 > +#define AK8974_DEV_X 1 > +#define AK8974_DEV_Y 2 > +#define AK8974_DEV_Z 3 > +#define AK8974_INV_DEV_X -1 > +#define AK8974_INV_DEV_Y -2 > +#define AK8974_INV_DEV_Z -3 > + > +struct ak8974_platform_data { > + s8 axis_x; > + s8 axis_y; > + s8 axis_z; > +}; > + > +/* Device name: /dev/ak8974n, where n is a running number */ > +struct ak8974_data { > + __s16 x; > + __s16 y; > + __s16 z; > + __u16 valid; > +} __attribute__((packed)); This could go in the C file. ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <20100827133109.1eb974ed-qBU/x9rampVanCEyBjwyrvXRex20P6io@public.gmane.org>]
* Re: [PATCH 1/3] drivers: misc: ak8974 / ami305 magnetometer driver [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:53 ` Mark Brown 0 siblings, 2 replies; 7+ messages in thread From: Onkalo Samu @ 2010-08-27 16:59 UTC (permalink / raw) To: ext Alan Cox, ext Dmitry Torokhov Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org, linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Alan, Thank you for the comments. Dmitry, there is one question for you. -Samu On Fri, 2010-08-27 at 14:31 +0200, ext Alan Cox wrote: > > +static int ak8974_regulators_on(struct ak8974_chip *chip) > > +{ > > + int ret; > > + ret = regulator_bulk_enable(ARRAY_SIZE(chip->regs), chip->regs); > > + if (ret == 0) > > + msleep(AK8974_POWERON_DELAY); > > + > > + return ret; > > +} > > + > > +static inline void ak8974_regulators_off(struct ak8974_chip *chip) > > +{ > > + regulator_bulk_disable(ARRAY_SIZE(chip->regs), chip->regs); > > +} > > That bit seems platform specific but in generic code ? > If the regulator frame work is not configured, this code does nothing. I have understood (hopefully correctly) that if the frame work is in use drivers could support that directly assuming that regulators are configured for that platform. If that is not the case, this should be platform specific. > > > +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? > Someone needs to decide on a single API before it's too late. > That is definitely true. Could it be IIO? > > + > > + if (count < sizeof(data)) > > + return -EINVAL; > > + > > + if (*offset >= chip->offset) { > > + schedule_work(&chip->work); > > + if (file->f_flags & O_NONBLOCK) > > + return -EAGAIN; > > + if (wait_event_interruptible(chip->misc_wait, > > + (*offset < chip->offset))) > > + return -ERESTARTSYS; > > + } > > + > > + mutex_lock(&chip->lock); > > + data.x = chip->x; > > + data.y = chip->y; > > + data.z = chip->z; > > + data.valid = chip->valid; > > + *offset = chip->offset; > > + mutex_unlock(&chip->lock); > > What happens if you have two readers - is it fine they get copies of the > same event when it races ? Yes, it makes sense to report latest available information for all users. > > > > + > > + return copy_to_user(buf, &data, sizeof(data)) ? -EFAULT : sizeof(data); > > Pedantically if data is consumed and a partial copy occurs you should > return the bytes successfully copied. I need to check that. > > > +static DEVICE_ATTR(chip_id, S_IRUGO, ak8974_show_chip_id, NULL); > > + > > +static ssize_t ak8974_show_range(struct device *dev, > > + struct device_attribute *attr, char *buf) > > +{ > > + struct ak8974_chip *chip = dev_get_drvdata(dev); > > + return sprintf(buf, "%d\n", chip->max_range); > > +} > > Other devices make all of this sysfs or use input. We need to work out > what the right interface actually is. > As mentioned above, sysfs is not used to get information about the user count for PM purposes. > > + snprintf(chip->name, sizeof(chip->name), "ak8974%d", > > + atomic_add_return(1, &device_number) - 1); > > Surely this is serialized anyway ? Is it possible that when there are several chips on the system (in different bussed for example), probe functions are running in parallel? > > > > +#ifdef CONFIG_PM > > +static int ak8974_suspend(struct i2c_client *client, pm_message_t mesg) > > +{ > > + struct ak8974_chip *chip = i2c_get_clientdata(client); > > + mutex_lock(&chip->users_lock); > > + if (chip->users > 0) > > + ak8974_enable(chip, AK8974_PWR_OFF); > > + mutex_unlock(&chip->users_lock); > > + return 0; > > +} > > + > > +static int ak8974_resume(struct i2c_client *client) > > +{ > > + struct ak8974_chip *chip = i2c_get_clientdata(client); > > + mutex_lock(&chip->users_lock); > > + if (chip->users > 0) > > + ak8974_enable(chip, AK8974_PWR_ON); > > + mutex_unlock(&chip->users_lock); > > + return 0; > > +} > > The whole chip->users thing you are implementing is basically a > reimplementation of the kernel runtime pm stuff - so can that be used > instead ? True. Most probably it can be used instead of own implementation. > > > > +#ifndef __LINUX_I2C_AK8974_H > > +#define __LINUX_I2C_AK8974_H > > + > > +#define AK8974_NO_MAP 0 > > +#define AK8974_DEV_X 1 > > +#define AK8974_DEV_Y 2 > > +#define AK8974_DEV_Z 3 > > +#define AK8974_INV_DEV_X -1 > > +#define AK8974_INV_DEV_Y -2 > > +#define AK8974_INV_DEV_Z -3 > > + > > +struct ak8974_platform_data { > > + s8 axis_x; > > + s8 axis_y; > > + s8 axis_z; > > +}; > > + > > +/* Device name: /dev/ak8974n, where n is a running number */ > > +struct ak8974_data { > > + __s16 x; > > + __s16 y; > > + __s16 z; > > + __u16 valid; > > +} __attribute__((packed)); > > This could go in the C file. ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <1282928353.2194.27.camel-Vo7XL3ix0D0UEupzmRo7jhl4MBrZKKet0E9HWUfgJXw@public.gmane.org>]
* Re: [PATCH 1/3] drivers: misc: ak8974 / ami305 magnetometer driver [not found] ` <1282928353.2194.27.camel-Vo7XL3ix0D0UEupzmRo7jhl4MBrZKKet0E9HWUfgJXw@public.gmane.org> @ 2010-08-27 18:08 ` Dmitry Torokhov 2010-08-28 13:44 ` Jonathan Cameron 0 siblings, 1 reply; 7+ messages in thread From: Dmitry Torokhov @ 2010-08-27 18:08 UTC (permalink / raw) To: Onkalo Samu Cc: ext Alan Cox, linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org, linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org 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. 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 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. -- Dmitry ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/3] drivers: misc: ak8974 / ami305 magnetometer driver 2010-08-27 18:08 ` Dmitry Torokhov @ 2010-08-28 13:44 ` Jonathan Cameron 0 siblings, 0 replies; 7+ messages in thread From: Jonathan Cameron @ 2010-08-28 13:44 UTC (permalink / raw) To: Dmitry Torokhov Cc: Onkalo Samu, ext Alan Cox, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, linux-input@vger.kernel.org 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 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/3] drivers: misc: ak8974 / ami305 magnetometer driver 2010-08-27 16:59 ` Onkalo Samu [not found] ` <1282928353.2194.27.camel-Vo7XL3ix0D0UEupzmRo7jhl4MBrZKKet0E9HWUfgJXw@public.gmane.org> @ 2010-08-27 18:53 ` Mark Brown [not found] ` <20100827185343.GA6626-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org> 1 sibling, 1 reply; 7+ messages in thread From: Mark Brown @ 2010-08-27 18:53 UTC (permalink / raw) To: Onkalo Samu Cc: ext Alan Cox, ext Dmitry Torokhov, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, linux-input@vger.kernel.org On Fri, Aug 27, 2010 at 07:59:13PM +0300, Onkalo Samu wrote: > On Fri, 2010-08-27 at 14:31 +0200, ext Alan Cox wrote: > > > +static int ak8974_regulators_on(struct ak8974_chip *chip) > > > +{ > > > + int ret; > > > + ret = regulator_bulk_enable(ARRAY_SIZE(chip->regs), chip->regs); > > That bit seems platform specific but in generic code ? > If the regulator frame work is not configured, this code does nothing. > I have understood (hopefully correctly) that if the frame work is in use > drivers could support that directly assuming that regulators are > configured for that platform. If that is not the case, this should be > platform specific. Your understanding is correct - the regulator API provides separation between the driver and the platform so that the driver code can work with any platform. The driver requests supplies in terms of the physical supplies the chip has (using the struct device and the supply names from the datasheet). The regulator API them matches this with actual regulators on a given system using data provied separately by the code specific to that machine so that the regulator and the consumer using it don't need to know about each other. If the regulator API is disabled then the basic regulator API calls compile to inline stubs that report success, and there's a facility for optionally automatically stubbing out missing supplies when the API is enabled. ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <20100827185343.GA6626-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>]
* Re: [PATCH 1/3] drivers: misc: ak8974 / ami305 magnetometer driver [not found] ` <20100827185343.GA6626-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org> @ 2010-08-30 6:55 ` Onkalo Samu 2010-08-31 11:11 ` Mark Brown 0 siblings, 1 reply; 7+ messages in thread From: Onkalo Samu @ 2010-08-30 6:55 UTC (permalink / raw) To: ext Mark Brown, ext Alan Cox Cc: ext Dmitry Torokhov, linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org, linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org On Fri, 2010-08-27 at 20:53 +0200, ext Mark Brown wrote: > On Fri, Aug 27, 2010 at 07:59:13PM +0300, Onkalo Samu wrote: > > On Fri, 2010-08-27 at 14:31 +0200, ext Alan Cox wrote: > > > > > +static int ak8974_regulators_on(struct ak8974_chip *chip) > > > > +{ > > > > + int ret; > > > > + ret = regulator_bulk_enable(ARRAY_SIZE(chip->regs), chip->regs); > > > > That bit seems platform specific but in generic code ? > > > If the regulator frame work is not configured, this code does nothing. > > I have understood (hopefully correctly) that if the frame work is in use > > drivers could support that directly assuming that regulators are > > configured for that platform. If that is not the case, this should be > > platform specific. > > Your understanding is correct - the regulator API provides separation > between the driver and the platform so that the driver code can work > with any platform. The driver requests supplies in terms of the > physical supplies the chip has (using the struct device and the supply > names from the datasheet). The regulator API them matches this with > actual regulators on a given system using data provied separately by the > code specific to that machine so that the regulator and the consumer > using it don't need to know about each other. > > If the regulator API is disabled then the basic regulator API calls > compile to inline stubs that report success, and there's a facility for > optionally automatically stubbing out missing supplies when the API is > enabled. Mark, thanks for clarification. So is it ok to keep this in the driver code. I would like to get some advice about the following related to PM and regulator control. Small sensor with SYSFS only interface: --------------------------------------- Driver doesn't know when someone opens (or keeps open) sysfs entry. It only knows when someone reads or writes to it. Sensors may have quite long wakeup time from total power off (regulators off) so it takes quite long time to get first result. On the other hand, driver doesn't know when it is ok to turn off the device. At some level, this can be handled with a timer which is is kicked every time when there is read / write operation. However, this is sounds little bit a hack. Would it make sense at all to enhange sysfs to have open / close indication for PM related control? Of course this adds overhead to every sysfs operation and most of the sysfs entries doesn't need this kind of feature. One solution is to have separate disable / enable control entry for the sensor. This needs addional operations from the applications and is little bit tricky in case of several users - should it be on / off type or counting type control. Misc-char-device + sysfs interface: ----------------------------------- PM related issues can be nicely handled with char device. It doesn't matter if there are one or several users. However char device with binary data format is not that handy in scripts. Same is true for input device. Do you have any suggestions what could be the best way to handle this? -Samu ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/3] drivers: misc: ak8974 / ami305 magnetometer driver 2010-08-30 6:55 ` Onkalo Samu @ 2010-08-31 11:11 ` Mark Brown 0 siblings, 0 replies; 7+ messages in thread From: Mark Brown @ 2010-08-31 11:11 UTC (permalink / raw) To: Onkalo Samu Cc: ext Alan Cox, ext Dmitry Torokhov, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, linux-input@vger.kernel.org On Mon, Aug 30, 2010 at 09:55:00AM +0300, Onkalo Samu wrote: > Misc-char-device + sysfs interface: > ----------------------------------- > PM related issues can be nicely handled with char device. > It doesn't matter if there are one or several users. However > char device with binary data format is not that handy in scripts. > Same is true for input device. You could always have a char device with a text mode interface, I guess. > Do you have any suggestions what could be the best way to handle this? Not really without knowing more about how the device will be used and the costs associated with powering it up and down - it's all a question of tradeoffs depending on things like how fast userspace needs a response and the expected usage patterns (many accesses in quick succession, occasional widely spaced accesses...). ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-08-31 11:11 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <1282910083-8629-1-git-send-email-samu.p.onkalo@nokia.com> [not found] ` <1282910083-8629-2-git-send-email-samu.p.onkalo@nokia.com> [not found] ` <1282910083-8629-2-git-send-email-samu.p.onkalo-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org> 2010-08-27 12:31 ` [PATCH 1/3] drivers: misc: ak8974 / ami305 magnetometer driver 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 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
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).