We have runtime_pm for this (and in fact to switch from the bma023 driverI posted to yours we'd need runtime pm)

> +> +> +What: /sys/bus/i2c/devices/<busnum>-<devaddr>/value> +Date: May 2011> +Contact: Eric Andersson <eric.andersson@unixphere.com>> +Description: This is used to get the current acceleration values for each> + axis. The values are represented as (x,y,z), where each axis can> + hold a value between -512 and 511.> +> + Reading: returns the current acceleration values.

This was nacked in the bma023 driver by the IIO folks - and Dmitrypointed out you can do this without a sysfs hack. The trick is to do aninitial poll in input_open at which point the ioctl query for theposition will have data that is current and open/ioctl/close works andproviding we go nail that into other drivers that need that kind of usethe API is generic and input event based.

> +> +> +What: /sys/bus/i2c/devices/<busnum>-<devaddr>/delay> +Date: May 2011> +Contact: Eric Andersson <eric.andersson@unixphere.com>> +Description: This is used to select the polling rate of the driver. The> + value is represented in ms and can be between 0 and 200. Any

0-200 whats ?

> +What: /sys/bus/i2c/devices/<busnum>-<devaddr>/enable> +Date: May 2011> +Contact: Eric Andersson <eric.andersson@unixphere.com>> +Description: This is used to enable and disable the chip. The chip will only> + be disabled if there are no input device users.

How does this differ from the power one and why is it needed, why doesn'tit disable when not in use ? How does this interact with runtime pm

From the Intel side to use your driver instead of bma023 we'd need IRQsupport and runtime pm but otherwise it looks basically ok. I reallydon't see how to reconcile proper power management with all your sysfsenables and power bits though ?