aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/iio
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-07-09 16:39:08 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-07-09 16:39:08 -0400
commitf12db36d3fd7ab75c29015c32a12d49697e11f61 (patch)
tree614b33f6b8b2ac6fe429ab26984d20a605b7885f /drivers/staging/iio
parent8b67527113a3396b2d66402a4fe83b08e74acc63 (diff)
parentc732a24c5a9392cf3738f5957e0d97d37c09e6e1 (diff)
Merge tag 'togreg_8_7_2012' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
Mixed back of updates and trivial examples fixes. Nothing terribly interesting in this one. 8 July 2012
Diffstat (limited to 'drivers/staging/iio')
-rw-r--r--drivers/staging/iio/Documentation/iio_event_monitor.c12
-rw-r--r--drivers/staging/iio/Documentation/iio_utils.h2
-rw-r--r--drivers/staging/iio/adc/adt7410.c28
3 files changed, 30 insertions, 12 deletions
diff --git a/drivers/staging/iio/Documentation/iio_event_monitor.c b/drivers/staging/iio/Documentation/iio_event_monitor.c
index 4326e9e764c..3a9b0008740 100644
--- a/drivers/staging/iio/Documentation/iio_event_monitor.c
+++ b/drivers/staging/iio/Documentation/iio_event_monitor.c
@@ -68,6 +68,12 @@ static const char * const iio_modifier_names[] = {
68 [IIO_MOD_Z] = "z", 68 [IIO_MOD_Z] = "z",
69 [IIO_MOD_LIGHT_BOTH] = "both", 69 [IIO_MOD_LIGHT_BOTH] = "both",
70 [IIO_MOD_LIGHT_IR] = "ir", 70 [IIO_MOD_LIGHT_IR] = "ir",
71 [IIO_MOD_ROOT_SUM_SQUARED_X_Y] = "sqrt(x^2+y^2)",
72 [IIO_MOD_SUM_SQUARED_X_Y_Z] = "x^2+y^2+z^2",
73 [IIO_MOD_LIGHT_CLEAR] = "clear",
74 [IIO_MOD_LIGHT_RED] = "red",
75 [IIO_MOD_LIGHT_GREEN] = "green",
76 [IIO_MOD_LIGHT_BLUE] = "blue",
71}; 77};
72 78
73static bool event_is_known(struct iio_event_data *event) 79static bool event_is_known(struct iio_event_data *event)
@@ -106,6 +112,12 @@ static bool event_is_known(struct iio_event_data *event)
106 case IIO_MOD_Z: 112 case IIO_MOD_Z:
107 case IIO_MOD_LIGHT_BOTH: 113 case IIO_MOD_LIGHT_BOTH:
108 case IIO_MOD_LIGHT_IR: 114 case IIO_MOD_LIGHT_IR:
115 case IIO_MOD_ROOT_SUM_SQUARED_X_Y:
116 case IIO_MOD_SUM_SQUARED_X_Y_Z:
117 case IIO_MOD_LIGHT_CLEAR:
118 case IIO_MOD_LIGHT_RED:
119 case IIO_MOD_LIGHT_GREEN:
120 case IIO_MOD_LIGHT_BLUE:
109 break; 121 break;
110 default: 122 default:
111 return false; 123 return false;
diff --git a/drivers/staging/iio/Documentation/iio_utils.h b/drivers/staging/iio/Documentation/iio_utils.h
index 5244fa0dfd2..cf32ae099cd 100644
--- a/drivers/staging/iio/Documentation/iio_utils.h
+++ b/drivers/staging/iio/Documentation/iio_utils.h
@@ -453,7 +453,7 @@ inline int find_type_by_name(const char *name, const char *type)
453 453
454 dp = opendir(iio_dir); 454 dp = opendir(iio_dir);
455 if (dp == NULL) { 455 if (dp == NULL) {
456 printf("No industrialio devices available"); 456 printf("No industrialio devices available\n");
457 return -ENODEV; 457 return -ENODEV;
458 } 458 }
459 459
diff --git a/drivers/staging/iio/adc/adt7410.c b/drivers/staging/iio/adc/adt7410.c
index f87992cd1ac..4157596ea3b 100644
--- a/drivers/staging/iio/adc/adt7410.c
+++ b/drivers/staging/iio/adc/adt7410.c
@@ -711,6 +711,7 @@ static int __devinit adt7410_probe(struct i2c_client *client,
711 struct iio_dev *indio_dev; 711 struct iio_dev *indio_dev;
712 int ret = 0; 712 int ret = 0;
713 unsigned long *adt7410_platform_data = client->dev.platform_data; 713 unsigned long *adt7410_platform_data = client->dev.platform_data;
714 unsigned long local_pdata[] = {0, 0};
714 715
715 indio_dev = iio_device_alloc(sizeof(*chip)); 716 indio_dev = iio_device_alloc(sizeof(*chip));
716 if (indio_dev == NULL) { 717 if (indio_dev == NULL) {
@@ -728,6 +729,9 @@ static int __devinit adt7410_probe(struct i2c_client *client,
728 indio_dev->info = &adt7410_info; 729 indio_dev->info = &adt7410_info;
729 indio_dev->modes = INDIO_DIRECT_MODE; 730 indio_dev->modes = INDIO_DIRECT_MODE;
730 731
732 if (!adt7410_platform_data)
733 adt7410_platform_data = local_pdata;
734
731 /* CT critcal temperature event. line 0 */ 735 /* CT critcal temperature event. line 0 */
732 if (client->irq) { 736 if (client->irq) {
733 ret = request_threaded_irq(client->irq, 737 ret = request_threaded_irq(client->irq,
@@ -753,13 +757,15 @@ static int __devinit adt7410_probe(struct i2c_client *client,
753 goto error_unreg_ct_irq; 757 goto error_unreg_ct_irq;
754 } 758 }
755 759
756 if (client->irq && adt7410_platform_data[0]) { 760 ret = adt7410_i2c_read_byte(chip, ADT7410_CONFIG, &chip->config);
761 if (ret) {
762 ret = -EIO;
763 goto error_unreg_int_irq;
764 }
757 765
758 ret = adt7410_i2c_read_byte(chip, ADT7410_CONFIG, &chip->config); 766 chip->config |= ADT7410_RESOLUTION;
759 if (ret) { 767
760 ret = -EIO; 768 if (client->irq && adt7410_platform_data[0]) {
761 goto error_unreg_int_irq;
762 }
763 769
764 /* set irq polarity low level */ 770 /* set irq polarity low level */
765 chip->config &= ~ADT7410_CT_POLARITY; 771 chip->config &= ~ADT7410_CT_POLARITY;
@@ -768,12 +774,12 @@ static int __devinit adt7410_probe(struct i2c_client *client,
768 chip->config |= ADT7410_INT_POLARITY; 774 chip->config |= ADT7410_INT_POLARITY;
769 else 775 else
770 chip->config &= ~ADT7410_INT_POLARITY; 776 chip->config &= ~ADT7410_INT_POLARITY;
777 }
771 778
772 ret = adt7410_i2c_write_byte(chip, ADT7410_CONFIG, chip->config); 779 ret = adt7410_i2c_write_byte(chip, ADT7410_CONFIG, chip->config);
773 if (ret) { 780 if (ret) {
774 ret = -EIO; 781 ret = -EIO;
775 goto error_unreg_int_irq; 782 goto error_unreg_int_irq;
776 }
777 } 783 }
778 ret = iio_device_register(indio_dev); 784 ret = iio_device_register(indio_dev);
779 if (ret) 785 if (ret)