diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/iio/common/st_sensors.h | 14 | ||||
-rw-r--r-- | include/linux/iio/iio.h | 54 | ||||
-rw-r--r-- | include/linux/iio/sysfs.h | 5 | ||||
-rw-r--r-- | include/linux/olpc-ec.h | 1 | ||||
-rw-r--r-- | include/linux/platform_data/at91_adc.h | 4 | ||||
-rw-r--r-- | include/linux/platform_data/st_sensors_pdata.h | 24 |
6 files changed, 94 insertions, 8 deletions
diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h index 72b26940730d..e51f65480ea5 100644 --- a/include/linux/iio/common/st_sensors.h +++ b/include/linux/iio/common/st_sensors.h | |||
@@ -17,6 +17,8 @@ | |||
17 | #include <linux/iio/trigger.h> | 17 | #include <linux/iio/trigger.h> |
18 | #include <linux/bitops.h> | 18 | #include <linux/bitops.h> |
19 | 19 | ||
20 | #include <linux/platform_data/st_sensors_pdata.h> | ||
21 | |||
20 | #define ST_SENSORS_TX_MAX_LENGTH 2 | 22 | #define ST_SENSORS_TX_MAX_LENGTH 2 |
21 | #define ST_SENSORS_RX_MAX_LENGTH 6 | 23 | #define ST_SENSORS_RX_MAX_LENGTH 6 |
22 | 24 | ||
@@ -118,14 +120,16 @@ struct st_sensor_bdu { | |||
118 | /** | 120 | /** |
119 | * struct st_sensor_data_ready_irq - ST sensor device data-ready interrupt | 121 | * struct st_sensor_data_ready_irq - ST sensor device data-ready interrupt |
120 | * @addr: address of the register. | 122 | * @addr: address of the register. |
121 | * @mask: mask to write the on/off value. | 123 | * @mask_int1: mask to enable/disable IRQ on INT1 pin. |
124 | * @mask_int2: mask to enable/disable IRQ on INT2 pin. | ||
122 | * struct ig1 - represents the Interrupt Generator 1 of sensors. | 125 | * struct ig1 - represents the Interrupt Generator 1 of sensors. |
123 | * @en_addr: address of the enable ig1 register. | 126 | * @en_addr: address of the enable ig1 register. |
124 | * @en_mask: mask to write the on/off value for enable. | 127 | * @en_mask: mask to write the on/off value for enable. |
125 | */ | 128 | */ |
126 | struct st_sensor_data_ready_irq { | 129 | struct st_sensor_data_ready_irq { |
127 | u8 addr; | 130 | u8 addr; |
128 | u8 mask; | 131 | u8 mask_int1; |
132 | u8 mask_int2; | ||
129 | struct { | 133 | struct { |
130 | u8 en_addr; | 134 | u8 en_addr; |
131 | u8 en_mask; | 135 | u8 en_mask; |
@@ -201,6 +205,7 @@ struct st_sensors { | |||
201 | * @buffer_data: Data used by buffer part. | 205 | * @buffer_data: Data used by buffer part. |
202 | * @odr: Output data rate of the sensor [Hz]. | 206 | * @odr: Output data rate of the sensor [Hz]. |
203 | * num_data_channels: Number of data channels used in buffer. | 207 | * num_data_channels: Number of data channels used in buffer. |
208 | * @drdy_int_pin: Redirect DRDY on pin 1 (1) or pin 2 (2). | ||
204 | * @get_irq_data_ready: Function to get the IRQ used for data ready signal. | 209 | * @get_irq_data_ready: Function to get the IRQ used for data ready signal. |
205 | * @tf: Transfer function structure used by I/O operations. | 210 | * @tf: Transfer function structure used by I/O operations. |
206 | * @tb: Transfer buffers and mutex used by I/O operations. | 211 | * @tb: Transfer buffers and mutex used by I/O operations. |
@@ -219,6 +224,8 @@ struct st_sensor_data { | |||
219 | unsigned int odr; | 224 | unsigned int odr; |
220 | unsigned int num_data_channels; | 225 | unsigned int num_data_channels; |
221 | 226 | ||
227 | u8 drdy_int_pin; | ||
228 | |||
222 | unsigned int (*get_irq_data_ready) (struct iio_dev *indio_dev); | 229 | unsigned int (*get_irq_data_ready) (struct iio_dev *indio_dev); |
223 | 230 | ||
224 | const struct st_sensor_transfer_function *tf; | 231 | const struct st_sensor_transfer_function *tf; |
@@ -249,7 +256,8 @@ static inline void st_sensors_deallocate_trigger(struct iio_dev *indio_dev) | |||
249 | } | 256 | } |
250 | #endif | 257 | #endif |
251 | 258 | ||
252 | int st_sensors_init_sensor(struct iio_dev *indio_dev); | 259 | int st_sensors_init_sensor(struct iio_dev *indio_dev, |
260 | struct st_sensors_platform_data *pdata); | ||
253 | 261 | ||
254 | int st_sensors_set_enable(struct iio_dev *indio_dev, bool enable); | 262 | int st_sensors_set_enable(struct iio_dev *indio_dev, bool enable); |
255 | 263 | ||
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h index 3d35b7023591..2103cc32a5fb 100644 --- a/include/linux/iio/iio.h +++ b/include/linux/iio/iio.h | |||
@@ -532,6 +532,60 @@ static inline struct iio_dev *iio_priv_to_dev(void *priv) | |||
532 | void iio_device_free(struct iio_dev *indio_dev); | 532 | void iio_device_free(struct iio_dev *indio_dev); |
533 | 533 | ||
534 | /** | 534 | /** |
535 | * devm_iio_device_alloc - Resource-managed iio_device_alloc() | ||
536 | * @dev: Device to allocate iio_dev for | ||
537 | * @sizeof_priv: Space to allocate for private structure. | ||
538 | * | ||
539 | * Managed iio_device_alloc. iio_dev allocated with this function is | ||
540 | * automatically freed on driver detach. | ||
541 | * | ||
542 | * If an iio_dev allocated with this function needs to be freed separately, | ||
543 | * devm_iio_device_free() must be used. | ||
544 | * | ||
545 | * RETURNS: | ||
546 | * Pointer to allocated iio_dev on success, NULL on failure. | ||
547 | */ | ||
548 | struct iio_dev *devm_iio_device_alloc(struct device *dev, int sizeof_priv); | ||
549 | |||
550 | /** | ||
551 | * devm_iio_device_free - Resource-managed iio_device_free() | ||
552 | * @dev: Device this iio_dev belongs to | ||
553 | * @indio_dev: the iio_dev associated with the device | ||
554 | * | ||
555 | * Free iio_dev allocated with devm_iio_device_alloc(). | ||
556 | */ | ||
557 | void devm_iio_device_free(struct device *dev, struct iio_dev *indio_dev); | ||
558 | |||
559 | /** | ||
560 | * devm_iio_trigger_alloc - Resource-managed iio_trigger_alloc() | ||
561 | * @dev: Device to allocate iio_trigger for | ||
562 | * @fmt: trigger name format. If it includes format | ||
563 | * specifiers, the additional arguments following | ||
564 | * format are formatted and inserted in the resulting | ||
565 | * string replacing their respective specifiers. | ||
566 | * | ||
567 | * Managed iio_trigger_alloc. iio_trigger allocated with this function is | ||
568 | * automatically freed on driver detach. | ||
569 | * | ||
570 | * If an iio_trigger allocated with this function needs to be freed separately, | ||
571 | * devm_iio_trigger_free() must be used. | ||
572 | * | ||
573 | * RETURNS: | ||
574 | * Pointer to allocated iio_trigger on success, NULL on failure. | ||
575 | */ | ||
576 | struct iio_trigger *devm_iio_trigger_alloc(struct device *dev, | ||
577 | const char *fmt, ...); | ||
578 | |||
579 | /** | ||
580 | * devm_iio_trigger_free - Resource-managed iio_trigger_free() | ||
581 | * @dev: Device this iio_dev belongs to | ||
582 | * @iio_trig: the iio_trigger associated with the device | ||
583 | * | ||
584 | * Free iio_trigger allocated with devm_iio_trigger_alloc(). | ||
585 | */ | ||
586 | void devm_iio_trigger_free(struct device *dev, struct iio_trigger *iio_trig); | ||
587 | |||
588 | /** | ||
535 | * iio_buffer_enabled() - helper function to test if the buffer is enabled | 589 | * iio_buffer_enabled() - helper function to test if the buffer is enabled |
536 | * @indio_dev: IIO device structure for device | 590 | * @indio_dev: IIO device structure for device |
537 | **/ | 591 | **/ |
diff --git a/include/linux/iio/sysfs.h b/include/linux/iio/sysfs.h index b7a934b9431b..2958c960003a 100644 --- a/include/linux/iio/sysfs.h +++ b/include/linux/iio/sysfs.h | |||
@@ -73,11 +73,6 @@ struct iio_const_attr { | |||
73 | .dev_attr = __ATTR(_name, S_IRUGO, iio_read_const_attr, NULL)} | 73 | .dev_attr = __ATTR(_name, S_IRUGO, iio_read_const_attr, NULL)} |
74 | 74 | ||
75 | /* Generic attributes of onetype or another */ | 75 | /* Generic attributes of onetype or another */ |
76 | /** | ||
77 | * IIO_DEV_ATTR_RESET: resets the device | ||
78 | **/ | ||
79 | #define IIO_DEV_ATTR_RESET(_store) \ | ||
80 | IIO_DEVICE_ATTR(reset, S_IWUSR, NULL, _store, 0) | ||
81 | 76 | ||
82 | /** | 77 | /** |
83 | * IIO_DEV_ATTR_SAMP_FREQ - sets any internal clock frequency | 78 | * IIO_DEV_ATTR_SAMP_FREQ - sets any internal clock frequency |
diff --git a/include/linux/olpc-ec.h b/include/linux/olpc-ec.h index 5bb6e760aa61..2925df3ce78a 100644 --- a/include/linux/olpc-ec.h +++ b/include/linux/olpc-ec.h | |||
@@ -6,6 +6,7 @@ | |||
6 | #define EC_WRITE_SCI_MASK 0x1b | 6 | #define EC_WRITE_SCI_MASK 0x1b |
7 | #define EC_WAKE_UP_WLAN 0x24 | 7 | #define EC_WAKE_UP_WLAN 0x24 |
8 | #define EC_WLAN_LEAVE_RESET 0x25 | 8 | #define EC_WLAN_LEAVE_RESET 0x25 |
9 | #define EC_DCON_POWER_MODE 0x26 | ||
9 | #define EC_READ_EB_MODE 0x2a | 10 | #define EC_READ_EB_MODE 0x2a |
10 | #define EC_SET_SCI_INHIBIT 0x32 | 11 | #define EC_SET_SCI_INHIBIT 0x32 |
11 | #define EC_SET_SCI_INHIBIT_RELEASE 0x34 | 12 | #define EC_SET_SCI_INHIBIT_RELEASE 0x34 |
diff --git a/include/linux/platform_data/at91_adc.h b/include/linux/platform_data/at91_adc.h index e15745b4f3a5..b3ca1e94e0c8 100644 --- a/include/linux/platform_data/at91_adc.h +++ b/include/linux/platform_data/at91_adc.h | |||
@@ -14,12 +14,16 @@ | |||
14 | (Interruptions registers mostly) | 14 | (Interruptions registers mostly) |
15 | * @status_register: Offset of the Interrupt Status Register | 15 | * @status_register: Offset of the Interrupt Status Register |
16 | * @trigger_register: Offset of the Trigger setup register | 16 | * @trigger_register: Offset of the Trigger setup register |
17 | * @mr_prescal_mask: Mask of the PRESCAL field in the adc MR register | ||
18 | * @mr_startup_mask: Mask of the STARTUP field in the adc MR register | ||
17 | */ | 19 | */ |
18 | struct at91_adc_reg_desc { | 20 | struct at91_adc_reg_desc { |
19 | u8 channel_base; | 21 | u8 channel_base; |
20 | u32 drdy_mask; | 22 | u32 drdy_mask; |
21 | u8 status_register; | 23 | u8 status_register; |
22 | u8 trigger_register; | 24 | u8 trigger_register; |
25 | u32 mr_prescal_mask; | ||
26 | u32 mr_startup_mask; | ||
23 | }; | 27 | }; |
24 | 28 | ||
25 | /** | 29 | /** |
diff --git a/include/linux/platform_data/st_sensors_pdata.h b/include/linux/platform_data/st_sensors_pdata.h new file mode 100644 index 000000000000..753839187ba0 --- /dev/null +++ b/include/linux/platform_data/st_sensors_pdata.h | |||
@@ -0,0 +1,24 @@ | |||
1 | /* | ||
2 | * STMicroelectronics sensors platform-data driver | ||
3 | * | ||
4 | * Copyright 2013 STMicroelectronics Inc. | ||
5 | * | ||
6 | * Denis Ciocca <denis.ciocca@st.com> | ||
7 | * | ||
8 | * Licensed under the GPL-2. | ||
9 | */ | ||
10 | |||
11 | #ifndef ST_SENSORS_PDATA_H | ||
12 | #define ST_SENSORS_PDATA_H | ||
13 | |||
14 | /** | ||
15 | * struct st_sensors_platform_data - Platform data for the ST sensors | ||
16 | * @drdy_int_pin: Redirect DRDY on pin 1 (1) or pin 2 (2). | ||
17 | * Available only for accelerometer and pressure sensors. | ||
18 | * Accelerometer DRDY on LSM330 available only on pin 1 (see datasheet). | ||
19 | */ | ||
20 | struct st_sensors_platform_data { | ||
21 | u8 drdy_int_pin; | ||
22 | }; | ||
23 | |||
24 | #endif /* ST_SENSORS_PDATA_H */ | ||