diff options
author | Michael Hennerich <michael.hennerich@analog.com> | 2011-12-14 14:25:13 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-12-16 13:55:02 -0500 |
commit | 617156fb71dd95574194ea022c0b076afd1b27ca (patch) | |
tree | 5f4faf482325a5c34a17832b2f4b7b71576ff8b6 /drivers | |
parent | 9631135dd9396aca149a3041197bce452fa0ce90 (diff) |
iio: gyro: ADXRS450: Add support for ADXRS453 Digital Gyroscope
Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/iio/gyro/Kconfig | 6 | ||||
-rw-r--r-- | drivers/staging/iio/gyro/adxrs450.h | 5 | ||||
-rw-r--r-- | drivers/staging/iio/gyro/adxrs450_core.c | 60 |
3 files changed, 50 insertions, 21 deletions
diff --git a/drivers/staging/iio/gyro/Kconfig b/drivers/staging/iio/gyro/Kconfig index 22aea5b4e61d..ea295b25308c 100644 --- a/drivers/staging/iio/gyro/Kconfig +++ b/drivers/staging/iio/gyro/Kconfig | |||
@@ -37,11 +37,11 @@ config ADIS16260 | |||
37 | will be called adis16260. | 37 | will be called adis16260. |
38 | 38 | ||
39 | config ADXRS450 | 39 | config ADXRS450 |
40 | tristate "Analog Devices ADXRS450 Digital Output Gyroscope SPI driver" | 40 | tristate "Analog Devices ADXRS450/3 Digital Output Gyroscope SPI driver" |
41 | depends on SPI | 41 | depends on SPI |
42 | help | 42 | help |
43 | Say yes here to build support for Analog Devices ADXRS450 programmable | 43 | Say yes here to build support for Analog Devices ADXRS450 and ADXRS453 |
44 | digital output gyroscope. | 44 | programmable digital output gyroscope. |
45 | 45 | ||
46 | This driver can also be built as a module. If so, the module | 46 | This driver can also be built as a module. If so, the module |
47 | will be called adxrs450. | 47 | will be called adxrs450. |
diff --git a/drivers/staging/iio/gyro/adxrs450.h b/drivers/staging/iio/gyro/adxrs450.h index b6b682876406..af0c870100b6 100644 --- a/drivers/staging/iio/gyro/adxrs450.h +++ b/drivers/staging/iio/gyro/adxrs450.h | |||
@@ -39,6 +39,11 @@ | |||
39 | 39 | ||
40 | #define ADXRS450_GET_ST(a) ((a >> 26) & 0x3) | 40 | #define ADXRS450_GET_ST(a) ((a >> 26) & 0x3) |
41 | 41 | ||
42 | enum { | ||
43 | ID_ADXRS450, | ||
44 | ID_ADXRS453, | ||
45 | }; | ||
46 | |||
42 | /** | 47 | /** |
43 | * struct adxrs450_state - device instance specific data | 48 | * struct adxrs450_state - device instance specific data |
44 | * @us: actual spi_device | 49 | * @us: actual spi_device |
diff --git a/drivers/staging/iio/gyro/adxrs450_core.c b/drivers/staging/iio/gyro/adxrs450_core.c index a146d55c37c8..61690e26f22d 100644 --- a/drivers/staging/iio/gyro/adxrs450_core.c +++ b/drivers/staging/iio/gyro/adxrs450_core.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * ADXRS450 Digital Output Gyroscope Driver | 2 | * ADXRS450/ADXRS453 Digital Output Gyroscope Driver |
3 | * | 3 | * |
4 | * Copyright 2011 Analog Devices Inc. | 4 | * Copyright 2011 Analog Devices Inc. |
5 | * | 5 | * |
@@ -323,20 +323,36 @@ static int adxrs450_read_raw(struct iio_dev *indio_dev, | |||
323 | return ret; | 323 | return ret; |
324 | } | 324 | } |
325 | 325 | ||
326 | static const struct iio_chan_spec adxrs450_channels[] = { | 326 | static const struct iio_chan_spec adxrs450_channels[2][2] = { |
327 | { | 327 | [ID_ADXRS450] = { |
328 | .type = IIO_ANGL_VEL, | 328 | { |
329 | .modified = 1, | 329 | .type = IIO_ANGL_VEL, |
330 | .channel2 = IIO_MOD_Z, | 330 | .modified = 1, |
331 | .info_mask = IIO_CHAN_INFO_CALIBBIAS_SEPARATE_BIT | | 331 | .channel2 = IIO_MOD_Z, |
332 | IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW_SEPARATE_BIT | | 332 | .info_mask = IIO_CHAN_INFO_CALIBBIAS_SEPARATE_BIT | |
333 | IIO_CHAN_INFO_SCALE_SEPARATE_BIT, | 333 | IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW_SEPARATE_BIT | |
334 | }, { | 334 | IIO_CHAN_INFO_SCALE_SEPARATE_BIT, |
335 | .type = IIO_TEMP, | 335 | }, { |
336 | .indexed = 1, | 336 | .type = IIO_TEMP, |
337 | .channel = 0, | 337 | .indexed = 1, |
338 | .info_mask = IIO_CHAN_INFO_SCALE_SEPARATE_BIT, | 338 | .channel = 0, |
339 | } | 339 | .info_mask = IIO_CHAN_INFO_SCALE_SEPARATE_BIT, |
340 | } | ||
341 | }, | ||
342 | [ID_ADXRS453] = { | ||
343 | { | ||
344 | .type = IIO_ANGL_VEL, | ||
345 | .modified = 1, | ||
346 | .channel2 = IIO_MOD_Z, | ||
347 | .info_mask = IIO_CHAN_INFO_SCALE_SEPARATE_BIT | | ||
348 | IIO_CHAN_INFO_QUADRATURE_CORRECTION_RAW_SEPARATE_BIT, | ||
349 | }, { | ||
350 | .type = IIO_TEMP, | ||
351 | .indexed = 1, | ||
352 | .channel = 0, | ||
353 | .info_mask = IIO_CHAN_INFO_SCALE_SEPARATE_BIT, | ||
354 | } | ||
355 | }, | ||
340 | }; | 356 | }; |
341 | 357 | ||
342 | static const struct iio_info adxrs450_info = { | 358 | static const struct iio_info adxrs450_info = { |
@@ -366,7 +382,8 @@ static int __devinit adxrs450_probe(struct spi_device *spi) | |||
366 | indio_dev->dev.parent = &spi->dev; | 382 | indio_dev->dev.parent = &spi->dev; |
367 | indio_dev->info = &adxrs450_info; | 383 | indio_dev->info = &adxrs450_info; |
368 | indio_dev->modes = INDIO_DIRECT_MODE; | 384 | indio_dev->modes = INDIO_DIRECT_MODE; |
369 | indio_dev->channels = adxrs450_channels; | 385 | indio_dev->channels = |
386 | adxrs450_channels[spi_get_device_id(spi)->driver_data]; | ||
370 | indio_dev->num_channels = ARRAY_SIZE(adxrs450_channels); | 387 | indio_dev->num_channels = ARRAY_SIZE(adxrs450_channels); |
371 | indio_dev->name = spi->dev.driver->name; | 388 | indio_dev->name = spi->dev.driver->name; |
372 | 389 | ||
@@ -396,6 +413,13 @@ static int adxrs450_remove(struct spi_device *spi) | |||
396 | return 0; | 413 | return 0; |
397 | } | 414 | } |
398 | 415 | ||
416 | static const struct spi_device_id adxrs450_id[] = { | ||
417 | {"adxrs450", ID_ADXRS450}, | ||
418 | {"adxrs453", ID_ADXRS453}, | ||
419 | {} | ||
420 | }; | ||
421 | MODULE_DEVICE_TABLE(spi, adxrs450_id); | ||
422 | |||
399 | static struct spi_driver adxrs450_driver = { | 423 | static struct spi_driver adxrs450_driver = { |
400 | .driver = { | 424 | .driver = { |
401 | .name = "adxrs450", | 425 | .name = "adxrs450", |
@@ -403,6 +427,7 @@ static struct spi_driver adxrs450_driver = { | |||
403 | }, | 427 | }, |
404 | .probe = adxrs450_probe, | 428 | .probe = adxrs450_probe, |
405 | .remove = __devexit_p(adxrs450_remove), | 429 | .remove = __devexit_p(adxrs450_remove), |
430 | .id_table = adxrs450_id, | ||
406 | }; | 431 | }; |
407 | 432 | ||
408 | static __init int adxrs450_init(void) | 433 | static __init int adxrs450_init(void) |
@@ -418,6 +443,5 @@ static __exit void adxrs450_exit(void) | |||
418 | module_exit(adxrs450_exit); | 443 | module_exit(adxrs450_exit); |
419 | 444 | ||
420 | MODULE_AUTHOR("Cliff Cai <cliff.cai@xxxxxxxxxx>"); | 445 | MODULE_AUTHOR("Cliff Cai <cliff.cai@xxxxxxxxxx>"); |
421 | MODULE_DESCRIPTION("Analog Devices ADXRS450 Gyroscope SPI driver"); | 446 | MODULE_DESCRIPTION("Analog Devices ADXRS450/ADXRS453 Gyroscope SPI driver"); |
422 | MODULE_LICENSE("GPL v2"); | 447 | MODULE_LICENSE("GPL v2"); |
423 | MODULE_ALIAS("spi:adxrs450"); | ||