2 * bma180.c - IIO driver for Bosch BMA180 triaxial acceleration sensor
4 * Copyright 2013 Oleksandr Kravchenko <x0199363@ti.com>
6 * Support for BMA250 (c) Peter Meerwald <pmeerw@pmeerw.net>
8 * This file is subject to the terms and conditions of version 2 of
9 * the GNU General Public License. See the file COPYING in the main
10 * directory of this archive for more details.
12 * SPI is not supported by driver
13 * BMA180: 7-bit I2C slave address 0x40 or 0x41
14 * BMA250: 7-bit I2C slave address 0x18 or 0x19
17 #include <linux/module.h>
18 #include <linux/i2c.h>
19 #include <linux/interrupt.h>
20 #include <linux/delay.h>
22 #include <linux/bitops.h>
23 #include <linux/slab.h>
24 #include <linux/string.h>
25 #include <linux/iio/iio.h>
26 #include <linux/iio/sysfs.h>
27 #include <linux/iio/buffer.h>
28 #include <linux/iio/trigger.h>
29 #include <linux/iio/trigger_consumer.h>
30 #include <linux/iio/triggered_buffer.h>
32 #define BMA180_DRV_NAME "bma180"
33 #define BMA180_IRQ_NAME "bma180_event"
42 struct bma180_part_info
{
43 const struct iio_chan_spec
*channels
;
44 unsigned num_channels
;
45 const int *scale_table
;
50 u8 int_reset_reg
, int_reset_mask
;
51 u8 sleep_reg
, sleep_mask
;
53 u8 scale_reg
, scale_mask
;
54 u8 power_reg
, power_mask
, lowpower_val
;
55 u8 int_enable_reg
, int_enable_mask
;
58 int (*chip_config
)(struct bma180_data
*data
);
59 void (*chip_disable
)(struct bma180_data
*data
);
63 #define BMA180_CHIP_ID 0x00 /* Need to distinguish BMA180 from other */
64 #define BMA180_ACC_X_LSB 0x02 /* First of 6 registers of accel data */
65 #define BMA180_TEMP 0x08
66 #define BMA180_CTRL_REG0 0x0d
67 #define BMA180_RESET 0x10
68 #define BMA180_BW_TCS 0x20
69 #define BMA180_CTRL_REG3 0x21
70 #define BMA180_TCO_Z 0x30
71 #define BMA180_OFFSET_LSB1 0x35
73 /* BMA180_CTRL_REG0 bits */
74 #define BMA180_DIS_WAKE_UP BIT(0) /* Disable wake up mode */
75 #define BMA180_SLEEP BIT(1) /* 1 - chip will sleep */
76 #define BMA180_EE_W BIT(4) /* Unlock writing to addr from 0x20 */
77 #define BMA180_RESET_INT BIT(6) /* Reset pending interrupts */
79 /* BMA180_CTRL_REG3 bits */
80 #define BMA180_NEW_DATA_INT BIT(1) /* Intr every new accel data is ready */
82 /* BMA180_OFFSET_LSB1 skipping mode bit */
83 #define BMA180_SMP_SKIP BIT(0)
85 /* Bit masks for registers bit fields */
86 #define BMA180_RANGE 0x0e /* Range of measured accel values */
87 #define BMA180_BW 0xf0 /* Accel bandwidth */
88 #define BMA180_MODE_CONFIG 0x03 /* Config operation modes */
90 /* We have to write this value in reset register to do soft reset */
91 #define BMA180_RESET_VAL 0xb6
93 #define BMA180_ID_REG_VAL 0x03
95 /* Chip power modes */
96 #define BMA180_LOW_POWER 0x03
98 #define BMA250_RANGE_REG 0x0f
99 #define BMA250_BW_REG 0x10
100 #define BMA250_POWER_REG 0x11
101 #define BMA250_RESET_REG 0x14
102 #define BMA250_INT_ENABLE_REG 0x17
103 #define BMA250_INT_MAP_REG 0x1a
104 #define BMA250_INT_RESET_REG 0x21
106 #define BMA250_RANGE_MASK GENMASK(3, 0) /* Range of accel values */
107 #define BMA250_BW_MASK GENMASK(4, 0) /* Accel bandwidth */
108 #define BMA250_SUSPEND_MASK BIT(7) /* chip will sleep */
109 #define BMA250_LOWPOWER_MASK BIT(6)
110 #define BMA250_DATA_INTEN_MASK BIT(4)
111 #define BMA250_INT1_DATA_MASK BIT(0)
112 #define BMA250_INT_RESET_MASK BIT(7) /* Reset pending interrupts */
115 struct i2c_client
*client
;
116 struct iio_trigger
*trig
;
117 const struct bma180_part_info
*part_info
;
123 u8 buff
[16]; /* 3x 16-bit + 8-bit + padding + timestamp */
133 static int bma180_bw_table
[] = { 10, 20, 40, 75, 150, 300 }; /* Hz */
134 static int bma180_scale_table
[] = { 1275, 1863, 2452, 3727, 4903, 9709, 19417 };
136 static int bma250_bw_table
[] = { 8, 16, 31, 63, 125, 250 }; /* Hz */
137 static int bma250_scale_table
[] = { 0, 0, 0, 38344, 0, 76590, 0, 0, 153180, 0,
140 static int bma180_get_data_reg(struct bma180_data
*data
, enum bma180_chan chan
)
144 if (data
->sleep_state
)
149 ret
= i2c_smbus_read_byte_data(data
->client
, BMA180_TEMP
);
151 dev_err(&data
->client
->dev
, "failed to read temp register\n");
154 ret
= i2c_smbus_read_word_data(data
->client
,
155 BMA180_ACC_X_LSB
+ chan
* 2);
157 dev_err(&data
->client
->dev
,
158 "failed to read accel_%c register\n",
165 static int bma180_set_bits(struct bma180_data
*data
, u8 reg
, u8 mask
, u8 val
)
167 int ret
= i2c_smbus_read_byte_data(data
->client
, reg
);
168 u8 reg_val
= (ret
& ~mask
) | (val
<< (ffs(mask
) - 1));
173 return i2c_smbus_write_byte_data(data
->client
, reg
, reg_val
);
176 static int bma180_reset_intr(struct bma180_data
*data
)
178 int ret
= bma180_set_bits(data
, data
->part_info
->int_reset_reg
,
179 data
->part_info
->int_reset_mask
, 1);
182 dev_err(&data
->client
->dev
, "failed to reset interrupt\n");
187 static int bma180_set_new_data_intr_state(struct bma180_data
*data
, bool state
)
189 int ret
= bma180_set_bits(data
, data
->part_info
->int_enable_reg
,
190 data
->part_info
->int_enable_mask
, state
);
193 ret
= bma180_reset_intr(data
);
200 dev_err(&data
->client
->dev
,
201 "failed to set new data interrupt state %d\n", state
);
205 static int bma180_set_sleep_state(struct bma180_data
*data
, bool state
)
207 int ret
= bma180_set_bits(data
, data
->part_info
->sleep_reg
,
208 data
->part_info
->sleep_mask
, state
);
211 dev_err(&data
->client
->dev
,
212 "failed to set sleep state %d\n", state
);
215 data
->sleep_state
= state
;
220 static int bma180_set_ee_writing_state(struct bma180_data
*data
, bool state
)
222 int ret
= bma180_set_bits(data
, BMA180_CTRL_REG0
, BMA180_EE_W
, state
);
225 dev_err(&data
->client
->dev
,
226 "failed to set ee writing state %d\n", state
);
231 static int bma180_set_bw(struct bma180_data
*data
, int val
)
235 if (data
->sleep_state
)
238 for (i
= 0; i
< data
->part_info
->num_bw
; ++i
) {
239 if (data
->part_info
->bw_table
[i
] == val
) {
240 ret
= bma180_set_bits(data
, data
->part_info
->bw_reg
,
241 data
->part_info
->bw_mask
, i
);
243 dev_err(&data
->client
->dev
,
244 "failed to set bandwidth\n");
255 static int bma180_set_scale(struct bma180_data
*data
, int val
)
259 if (data
->sleep_state
)
262 for (i
= 0; i
< data
->part_info
->num_scales
; ++i
)
263 if (data
->part_info
->scale_table
[i
] == val
) {
264 ret
= bma180_set_bits(data
, data
->part_info
->scale_reg
,
265 data
->part_info
->scale_mask
, i
);
267 dev_err(&data
->client
->dev
,
268 "failed to set scale\n");
278 static int bma180_set_pmode(struct bma180_data
*data
, bool mode
)
280 u8 reg_val
= mode
? data
->part_info
->lowpower_val
: 0;
281 int ret
= bma180_set_bits(data
, data
->part_info
->power_reg
,
282 data
->part_info
->power_mask
, reg_val
);
285 dev_err(&data
->client
->dev
, "failed to set power mode\n");
293 static int bma180_soft_reset(struct bma180_data
*data
)
295 int ret
= i2c_smbus_write_byte_data(data
->client
,
296 data
->part_info
->softreset_reg
, BMA180_RESET_VAL
);
299 dev_err(&data
->client
->dev
, "failed to reset the chip\n");
304 static int bma180_chip_init(struct bma180_data
*data
)
306 /* Try to read chip_id register. It must return 0x03. */
307 int ret
= i2c_smbus_read_byte_data(data
->client
, BMA180_CHIP_ID
);
311 if (ret
!= BMA180_ID_REG_VAL
)
314 ret
= bma180_soft_reset(data
);
318 * No serial transaction should occur within minimum 10 us
319 * after soft_reset command
323 ret
= bma180_set_new_data_intr_state(data
, false);
327 return bma180_set_pmode(data
, false);
330 static int bma180_chip_config(struct bma180_data
*data
)
332 int ret
= bma180_chip_init(data
);
336 ret
= bma180_set_bits(data
, BMA180_CTRL_REG0
, BMA180_DIS_WAKE_UP
, 1);
339 ret
= bma180_set_ee_writing_state(data
, true);
342 ret
= bma180_set_bits(data
, BMA180_OFFSET_LSB1
, BMA180_SMP_SKIP
, 1);
345 ret
= bma180_set_bw(data
, 20); /* 20 Hz */
348 ret
= bma180_set_scale(data
, 2452); /* 2 G */
355 dev_err(&data
->client
->dev
, "failed to config the chip\n");
359 static int bma250_chip_config(struct bma180_data
*data
)
361 int ret
= bma180_chip_init(data
);
365 ret
= bma180_set_bw(data
, 16); /* 16 Hz */
368 ret
= bma180_set_scale(data
, 38344); /* 2 G */
371 ret
= bma180_set_bits(data
, BMA250_INT_MAP_REG
,
372 BMA250_INT1_DATA_MASK
, 1);
379 dev_err(&data
->client
->dev
, "failed to config the chip\n");
383 static void bma180_chip_disable(struct bma180_data
*data
)
385 if (bma180_set_new_data_intr_state(data
, false))
387 if (bma180_set_ee_writing_state(data
, false))
389 if (bma180_set_sleep_state(data
, true))
395 dev_err(&data
->client
->dev
, "failed to disable the chip\n");
398 static void bma250_chip_disable(struct bma180_data
*data
)
400 if (bma180_set_new_data_intr_state(data
, false))
402 if (bma180_set_sleep_state(data
, true))
408 dev_err(&data
->client
->dev
, "failed to disable the chip\n");
411 static ssize_t
bma180_show_avail(char *buf
, const int *vals
, unsigned n
,
417 for (i
= 0; i
< n
; i
++) {
420 len
+= scnprintf(buf
+ len
, PAGE_SIZE
- len
,
421 micros
? "0.%06d " : "%d ", vals
[i
]);
428 static ssize_t
bma180_show_filter_freq_avail(struct device
*dev
,
429 struct device_attribute
*attr
, char *buf
)
431 struct bma180_data
*data
= iio_priv(dev_to_iio_dev(dev
));
433 return bma180_show_avail(buf
, data
->part_info
->bw_table
,
434 data
->part_info
->num_bw
, false);
437 static ssize_t
bma180_show_scale_avail(struct device
*dev
,
438 struct device_attribute
*attr
, char *buf
)
440 struct bma180_data
*data
= iio_priv(dev_to_iio_dev(dev
));
442 return bma180_show_avail(buf
, data
->part_info
->scale_table
,
443 data
->part_info
->num_scales
, true);
446 static IIO_DEVICE_ATTR(in_accel_filter_low_pass_3db_frequency_available
,
447 S_IRUGO
, bma180_show_filter_freq_avail
, NULL
, 0);
449 static IIO_DEVICE_ATTR(in_accel_scale_available
,
450 S_IRUGO
, bma180_show_scale_avail
, NULL
, 0);
452 static struct attribute
*bma180_attributes
[] = {
453 &iio_dev_attr_in_accel_filter_low_pass_3db_frequency_available
.
455 &iio_dev_attr_in_accel_scale_available
.dev_attr
.attr
,
459 static const struct attribute_group bma180_attrs_group
= {
460 .attrs
= bma180_attributes
,
463 static int bma180_read_raw(struct iio_dev
*indio_dev
,
464 struct iio_chan_spec
const *chan
, int *val
, int *val2
,
467 struct bma180_data
*data
= iio_priv(indio_dev
);
471 case IIO_CHAN_INFO_RAW
:
472 ret
= iio_device_claim_direct_mode(indio_dev
);
476 mutex_lock(&data
->mutex
);
477 ret
= bma180_get_data_reg(data
, chan
->scan_index
);
478 mutex_unlock(&data
->mutex
);
479 iio_device_release_direct_mode(indio_dev
);
482 *val
= sign_extend32(ret
>> chan
->scan_type
.shift
,
483 chan
->scan_type
.realbits
- 1);
485 case IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY
:
488 case IIO_CHAN_INFO_SCALE
:
489 switch (chan
->type
) {
493 return IIO_VAL_INT_PLUS_MICRO
;
500 case IIO_CHAN_INFO_OFFSET
:
501 *val
= 48; /* 0 LSB @ 24 degree C */
508 static int bma180_write_raw(struct iio_dev
*indio_dev
,
509 struct iio_chan_spec
const *chan
, int val
, int val2
, long mask
)
511 struct bma180_data
*data
= iio_priv(indio_dev
);
515 case IIO_CHAN_INFO_SCALE
:
518 mutex_lock(&data
->mutex
);
519 ret
= bma180_set_scale(data
, val2
);
520 mutex_unlock(&data
->mutex
);
522 case IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY
:
525 mutex_lock(&data
->mutex
);
526 ret
= bma180_set_bw(data
, val
);
527 mutex_unlock(&data
->mutex
);
534 static const struct iio_info bma180_info
= {
535 .attrs
= &bma180_attrs_group
,
536 .read_raw
= bma180_read_raw
,
537 .write_raw
= bma180_write_raw
,
538 .driver_module
= THIS_MODULE
,
541 static const char * const bma180_power_modes
[] = { "low_noise", "low_power" };
543 static int bma180_get_power_mode(struct iio_dev
*indio_dev
,
544 const struct iio_chan_spec
*chan
)
546 struct bma180_data
*data
= iio_priv(indio_dev
);
551 static int bma180_set_power_mode(struct iio_dev
*indio_dev
,
552 const struct iio_chan_spec
*chan
, unsigned int mode
)
554 struct bma180_data
*data
= iio_priv(indio_dev
);
557 mutex_lock(&data
->mutex
);
558 ret
= bma180_set_pmode(data
, mode
);
559 mutex_unlock(&data
->mutex
);
564 static const struct iio_enum bma180_power_mode_enum
= {
565 .items
= bma180_power_modes
,
566 .num_items
= ARRAY_SIZE(bma180_power_modes
),
567 .get
= bma180_get_power_mode
,
568 .set
= bma180_set_power_mode
,
571 static const struct iio_chan_spec_ext_info bma180_ext_info
[] = {
572 IIO_ENUM("power_mode", true, &bma180_power_mode_enum
),
573 IIO_ENUM_AVAILABLE("power_mode", &bma180_power_mode_enum
),
577 #define BMA180_ACC_CHANNEL(_axis, _bits) { \
580 .channel2 = IIO_MOD_##_axis, \
581 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \
582 .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE) | \
583 BIT(IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY), \
584 .scan_index = AXIS_##_axis, \
589 .shift = 16 - _bits, \
591 .ext_info = bma180_ext_info, \
594 #define BMA180_TEMP_CHANNEL { \
596 .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | \
597 BIT(IIO_CHAN_INFO_SCALE) | BIT(IIO_CHAN_INFO_OFFSET), \
598 .scan_index = TEMP, \
606 static const struct iio_chan_spec bma180_channels
[] = {
607 BMA180_ACC_CHANNEL(X
, 14),
608 BMA180_ACC_CHANNEL(Y
, 14),
609 BMA180_ACC_CHANNEL(Z
, 14),
611 IIO_CHAN_SOFT_TIMESTAMP(4),
614 static const struct iio_chan_spec bma250_channels
[] = {
615 BMA180_ACC_CHANNEL(X
, 10),
616 BMA180_ACC_CHANNEL(Y
, 10),
617 BMA180_ACC_CHANNEL(Z
, 10),
619 IIO_CHAN_SOFT_TIMESTAMP(4),
622 static const struct bma180_part_info bma180_part_info
[] = {
624 bma180_channels
, ARRAY_SIZE(bma180_channels
),
625 bma180_scale_table
, ARRAY_SIZE(bma180_scale_table
),
626 bma180_bw_table
, ARRAY_SIZE(bma180_bw_table
),
627 BMA180_CTRL_REG0
, BMA180_RESET_INT
,
628 BMA180_CTRL_REG0
, BMA180_SLEEP
,
629 BMA180_BW_TCS
, BMA180_BW
,
630 BMA180_OFFSET_LSB1
, BMA180_RANGE
,
631 BMA180_TCO_Z
, BMA180_MODE_CONFIG
, BMA180_LOW_POWER
,
632 BMA180_CTRL_REG3
, BMA180_NEW_DATA_INT
,
638 bma250_channels
, ARRAY_SIZE(bma250_channels
),
639 bma250_scale_table
, ARRAY_SIZE(bma250_scale_table
),
640 bma250_bw_table
, ARRAY_SIZE(bma250_bw_table
),
641 BMA250_INT_RESET_REG
, BMA250_INT_RESET_MASK
,
642 BMA250_POWER_REG
, BMA250_SUSPEND_MASK
,
643 BMA250_BW_REG
, BMA250_BW_MASK
,
644 BMA250_RANGE_REG
, BMA250_RANGE_MASK
,
645 BMA250_POWER_REG
, BMA250_LOWPOWER_MASK
, 1,
646 BMA250_INT_ENABLE_REG
, BMA250_DATA_INTEN_MASK
,
653 static irqreturn_t
bma180_trigger_handler(int irq
, void *p
)
655 struct iio_poll_func
*pf
= p
;
656 struct iio_dev
*indio_dev
= pf
->indio_dev
;
657 struct bma180_data
*data
= iio_priv(indio_dev
);
658 s64 time_ns
= iio_get_time_ns(indio_dev
);
661 mutex_lock(&data
->mutex
);
663 for_each_set_bit(bit
, indio_dev
->active_scan_mask
,
664 indio_dev
->masklength
) {
665 ret
= bma180_get_data_reg(data
, bit
);
667 mutex_unlock(&data
->mutex
);
670 ((s16
*)data
->buff
)[i
++] = ret
;
673 mutex_unlock(&data
->mutex
);
675 iio_push_to_buffers_with_timestamp(indio_dev
, data
->buff
, time_ns
);
677 iio_trigger_notify_done(indio_dev
->trig
);
682 static int bma180_data_rdy_trigger_set_state(struct iio_trigger
*trig
,
685 struct iio_dev
*indio_dev
= iio_trigger_get_drvdata(trig
);
686 struct bma180_data
*data
= iio_priv(indio_dev
);
688 return bma180_set_new_data_intr_state(data
, state
);
691 static int bma180_trig_try_reen(struct iio_trigger
*trig
)
693 struct iio_dev
*indio_dev
= iio_trigger_get_drvdata(trig
);
694 struct bma180_data
*data
= iio_priv(indio_dev
);
696 return bma180_reset_intr(data
);
699 static const struct iio_trigger_ops bma180_trigger_ops
= {
700 .set_trigger_state
= bma180_data_rdy_trigger_set_state
,
701 .try_reenable
= bma180_trig_try_reen
,
702 .owner
= THIS_MODULE
,
705 static int bma180_probe(struct i2c_client
*client
,
706 const struct i2c_device_id
*id
)
708 struct bma180_data
*data
;
709 struct iio_dev
*indio_dev
;
712 indio_dev
= devm_iio_device_alloc(&client
->dev
, sizeof(*data
));
716 data
= iio_priv(indio_dev
);
717 i2c_set_clientdata(client
, indio_dev
);
718 data
->client
= client
;
719 data
->part_info
= &bma180_part_info
[id
->driver_data
];
721 ret
= data
->part_info
->chip_config(data
);
723 goto err_chip_disable
;
725 mutex_init(&data
->mutex
);
726 indio_dev
->dev
.parent
= &client
->dev
;
727 indio_dev
->channels
= data
->part_info
->channels
;
728 indio_dev
->num_channels
= data
->part_info
->num_channels
;
729 indio_dev
->name
= id
->name
;
730 indio_dev
->modes
= INDIO_DIRECT_MODE
;
731 indio_dev
->info
= &bma180_info
;
733 if (client
->irq
> 0) {
734 data
->trig
= iio_trigger_alloc("%s-dev%d", indio_dev
->name
,
738 goto err_chip_disable
;
741 ret
= devm_request_irq(&client
->dev
, client
->irq
,
742 iio_trigger_generic_data_rdy_poll
, IRQF_TRIGGER_RISING
,
743 "bma180_event", data
->trig
);
745 dev_err(&client
->dev
, "unable to request IRQ\n");
746 goto err_trigger_free
;
749 data
->trig
->dev
.parent
= &client
->dev
;
750 data
->trig
->ops
= &bma180_trigger_ops
;
751 iio_trigger_set_drvdata(data
->trig
, indio_dev
);
752 indio_dev
->trig
= iio_trigger_get(data
->trig
);
754 ret
= iio_trigger_register(data
->trig
);
756 goto err_trigger_free
;
759 ret
= iio_triggered_buffer_setup(indio_dev
, NULL
,
760 bma180_trigger_handler
, NULL
);
762 dev_err(&client
->dev
, "unable to setup iio triggered buffer\n");
763 goto err_trigger_unregister
;
766 ret
= iio_device_register(indio_dev
);
768 dev_err(&client
->dev
, "unable to register iio device\n");
769 goto err_buffer_cleanup
;
775 iio_triggered_buffer_cleanup(indio_dev
);
776 err_trigger_unregister
:
778 iio_trigger_unregister(data
->trig
);
780 iio_trigger_free(data
->trig
);
782 data
->part_info
->chip_disable(data
);
787 static int bma180_remove(struct i2c_client
*client
)
789 struct iio_dev
*indio_dev
= i2c_get_clientdata(client
);
790 struct bma180_data
*data
= iio_priv(indio_dev
);
792 iio_device_unregister(indio_dev
);
793 iio_triggered_buffer_cleanup(indio_dev
);
795 iio_trigger_unregister(data
->trig
);
796 iio_trigger_free(data
->trig
);
799 mutex_lock(&data
->mutex
);
800 data
->part_info
->chip_disable(data
);
801 mutex_unlock(&data
->mutex
);
806 #ifdef CONFIG_PM_SLEEP
807 static int bma180_suspend(struct device
*dev
)
809 struct iio_dev
*indio_dev
= i2c_get_clientdata(to_i2c_client(dev
));
810 struct bma180_data
*data
= iio_priv(indio_dev
);
813 mutex_lock(&data
->mutex
);
814 ret
= bma180_set_sleep_state(data
, true);
815 mutex_unlock(&data
->mutex
);
820 static int bma180_resume(struct device
*dev
)
822 struct iio_dev
*indio_dev
= i2c_get_clientdata(to_i2c_client(dev
));
823 struct bma180_data
*data
= iio_priv(indio_dev
);
826 mutex_lock(&data
->mutex
);
827 ret
= bma180_set_sleep_state(data
, false);
828 mutex_unlock(&data
->mutex
);
833 static SIMPLE_DEV_PM_OPS(bma180_pm_ops
, bma180_suspend
, bma180_resume
);
834 #define BMA180_PM_OPS (&bma180_pm_ops)
836 #define BMA180_PM_OPS NULL
839 static struct i2c_device_id bma180_ids
[] = {
840 { "bma180", BMA180
},
841 { "bma250", BMA250
},
845 MODULE_DEVICE_TABLE(i2c
, bma180_ids
);
847 static struct i2c_driver bma180_driver
= {
852 .probe
= bma180_probe
,
853 .remove
= bma180_remove
,
854 .id_table
= bma180_ids
,
857 module_i2c_driver(bma180_driver
);
859 MODULE_AUTHOR("Kravchenko Oleksandr <x0199363@ti.com>");
860 MODULE_AUTHOR("Texas Instruments, Inc.");
861 MODULE_DESCRIPTION("Bosch BMA180/BMA250 triaxial acceleration sensor");
862 MODULE_LICENSE("GPL");