]> rtime.felk.cvut.cz Git - hercules2020/nv-tegra/linux-4.4.git/commitdiff
IIO: Sensors rebase for kernel-next
authorAkhilesh Reddy Khumbum <akhumbum@nvidia.com>
Thu, 21 Apr 2016 21:08:13 +0000 (14:08 -0700)
committerAkhilesh Reddy Khumbum <akhumbum@nvidia.com>
Thu, 21 Apr 2016 23:43:19 +0000 (16:43 -0700)
Change-Id: Ia3df0707e21ad445ef650052fa81c027745ac679
Signed-off-by: Akhilesh Reddy Khumbum <akhumbum@nvidia.com>
drivers/iio/common/nvs/nvs_iio.c
drivers/iio/common/nvs/nvs_light.c
drivers/iio/common/nvs/nvs_proximity.c
drivers/iio/imu/Kconfig
drivers/iio/industrialio-core.c
drivers/iio/proximity/Kconfig
include/linux/iio/types.h
include/uapi/linux/iio/types.h

index 52c0d698d301788423369e07487b5f454dc1cb20..96e61e50c27170b87e78d3fe8c5853ad97be6b63 100644 (file)
@@ -1636,7 +1636,6 @@ static int nvs_remove(void *handle)
                iio_trigger_free(st->trig);
        }
        if (indio_dev->buffer != NULL) {
-               iio_buffer_unregister(indio_dev);
                iio_kfifo_free(indio_dev->buffer);
        }
        if (st->ch)
@@ -1669,7 +1668,11 @@ static int nvs_init(struct iio_dev *indio_dev, struct nvs_state *st)
                return ret;
        }
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0)
        indio_dev->buffer = iio_kfifo_allocate(indio_dev);
+#else
+       indio_dev->buffer = iio_kfifo_allocate();
+#endif
        if (!indio_dev->buffer) {
                dev_err(st->dev, "%s iio_kfifo_allocate ERR\n", __func__);
                return -ENOMEM;
@@ -1686,13 +1689,6 @@ static int nvs_init(struct iio_dev *indio_dev, struct nvs_state *st)
        st->info.write_raw = &nvs_write_raw;
        indio_dev->info = &st->info;
        indio_dev->setup_ops = &nvs_buffer_setup_ops;
-       ret = iio_buffer_register(indio_dev, indio_dev->channels,
-                                 indio_dev->num_channels);
-       if (ret) {
-               dev_err(st->dev, "%s iio_buffer_register ERR\n", __func__);
-               return ret;
-       }
-
        if (st->cfg->kbuf_sz) {
                indio_dev->buffer->access->set_length(indio_dev->buffer,
                                                      st->cfg->kbuf_sz);
index 8d3824c2d7785335b663cde0fa2b655f1969bcc8..238494f12bd025ecbddacabf2f8b63f8a0f2a60c 100644 (file)
@@ -264,7 +264,11 @@ static u32 nvs_light_interpolate(int x1, s64 x2, int x3, int y1, int y3)
 
        dividend = (x2 - x1) * (y3 - y1);
        if (dividend < 0) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0)
                dividend = abs64(dividend);
+#else
+               dividend = abs(dividend);
+#endif
                do_div(dividend, divisor);
                dividend = 0 - dividend;
        } else {
index 93d636c6ecf7801ed06e171c7d124c3efb2cb555..833cc60c003e928e7a8c027a5e025630ce978fca 100644 (file)
@@ -244,7 +244,11 @@ static void nvs_proximity_interpolate(int x1, s64 x2, int x3,
 
        dividend = (x2 - x1) * (y3 - y1);
        if (dividend < 0) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0)
                dividend = abs64(dividend);
+#else
+               dividend = abs(dividend);
+#endif
                do_div(dividend, divisor);
                dividend = 0 - dividend;
        } else {
index cc07df1b43753aaa7613014361908a3c6dccf14c..9f52dfe6a55f8e5d7a3b55f677f6d9b8eec79c53 100644 (file)
@@ -39,7 +39,6 @@ config KMX61
 source "drivers/iio/imu/inv_mpu6050/Kconfig"
 source "drivers/iio/imu/nvi_mpu/Kconfig"
 
-endmenu
 
 config IIO_ADIS_LIB
        tristate
@@ -52,3 +51,5 @@ config IIO_ADIS_LIB_BUFFER
        help
          A set of buffer helper functions for the Analog Devices ADIS* device
          family.
+
+endmenu
index 297ea0d97b571ffbaa365acd77bcaac6358f5ead..4a600f81f8e80cf128cae77b3f07b5006083877c 100644 (file)
@@ -1,7 +1,7 @@
 /* The industrial I/O core
  *
  * Copyright (c) 2008 Jonathan Cameron
- * Copyright (c) 2014-2015, NVIDIA CORPORATION.  All rights reserved.
+ * Copyright (c) 2014-2016, NVIDIA CORPORATION.  All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 as published by
@@ -1330,6 +1330,8 @@ int iio_device_register(struct iio_dev *indio_dev)
        }
 
        return 0;
+error_del_device:
+       device_del(&indio_dev->dev);
 error_cdev_del:
        cdev_del(&indio_dev->chrdev);
 error_unreg_eventset:
@@ -1367,8 +1369,8 @@ void iio_device_unregister(struct iio_dev *indio_dev)
 
        mutex_unlock(&indio_dev->info_exist_lock);
 
-       iio_buffer_free_sysfs_and_mask(indio_dev);
        kfree(indio_dev->link_name);
+       iio_buffer_free_sysfs_and_mask(indio_dev);
 }
 EXPORT_SYMBOL(iio_device_unregister);
 
@@ -1436,3 +1438,4 @@ module_exit(iio_exit);
 MODULE_AUTHOR("Jonathan Cameron <jic23@kernel.org>");
 MODULE_DESCRIPTION("Industrial I/O core");
 MODULE_LICENSE("GPL");
+
index 44cc4de33cfa35ec31d16aacc23433956af7581f..6c4b3a68c1680aeb1a57e0cf0a5869bc4805aba2 100644 (file)
@@ -44,10 +44,6 @@ config SX9500
 
          To compile this driver as a module, choose M here: the
          module will be called sx9500.
-#
-# proximity sensors
-#
-menu "Proximity sensors"
 
 config NVS_IQS2X3
        tristate "Azoteq IQS253/IQS263 SAR proximity"
index f96bb94df01157c50c7dd9b8023ca89b7a2947b2..f0bd8bf08411eb497e163740eb360f7953162126 100644 (file)
 #define _IIO_TYPES_H_
 
 #include <uapi/linux/iio/types.h>
-enum iio_chan_type {
-       IIO_VOLTAGE,
-       IIO_CURRENT,
-       IIO_POWER,
-       IIO_ACCEL,
-       IIO_ANGL_VEL,
-       IIO_MAGN,
-       IIO_LIGHT,
-       IIO_INTENSITY,
-       IIO_PROXIMITY,
-       IIO_TEMP,
-       IIO_INCLI,
-       IIO_ROT,
-       IIO_ANGL,
-       IIO_TIMESTAMP,
-       IIO_CAPACITANCE,
-       IIO_ALTVOLTAGE,
-       IIO_CCT,
-       IIO_PRESSURE,
-       IIO_HUMIDITYRELATIVE,
-       IIO_ORIENTATION,
-       IIO_GRAVITY,
-       IIO_LINEAR_ACCEL,
-       IIO_HUMIDITY,
-       IIO_MAGN_UNCAL,
-       IIO_ANGLVEL_UNCAL,
-       IIO_GAME_ROT,
-       IIO_MOTION,
-       IIO_STEP,
-       IIO_STEP_COUNT,
-       IIO_GEOMAGN_ROT,
-       IIO_HEART_RATE,
-       IIO_GESTURE_WAKE,
-       IIO_GESTURE_GLANCE,
-       IIO_GESTURE_PICKUP,
-       IIO_GENERIC,
-};
-
-enum iio_modifier {
-       IIO_NO_MOD,
-       IIO_MOD_X,
-       IIO_MOD_Y,
-       IIO_MOD_Z,
-       IIO_MOD_COS,
-       IIO_MOD_X_AND_Y,
-       IIO_MOD_X_AND_Z,
-       IIO_MOD_Y_AND_Z,
-       IIO_MOD_X_AND_Y_AND_Z,
-       IIO_MOD_X_OR_Y,
-       IIO_MOD_X_OR_Z,
-       IIO_MOD_Y_OR_Z,
-       IIO_MOD_X_OR_Y_OR_Z,
-       IIO_MOD_LIGHT_BOTH,
-       IIO_MOD_LIGHT_IR,
-       IIO_MOD_ROOT_SUM_SQUARED_X_Y,
-       IIO_MOD_SUM_SQUARED_X_Y_Z,
-       IIO_MOD_LIGHT_CLEAR,
-       IIO_MOD_LIGHT_RED,
-       IIO_MOD_LIGHT_GREEN,
-       IIO_MOD_LIGHT_BLUE,
-       IIO_MOD_QUATERNION,
-       IIO_MOD_TEMP_AMBIENT,
-       IIO_MOD_TEMP_OBJECT,
-       IIO_MOD_NORTH_MAGN,
-       IIO_MOD_NORTH_TRUE,
-       IIO_MOD_NORTH_MAGN_TILT_COMP,
-       IIO_MOD_NORTH_TRUE_TILT_COMP,
-       IIO_MOD_X_UNCALIB,
-       IIO_MOD_Y_UNCALIB,
-       IIO_MOD_Z_UNCALIB,
-       IIO_MOD_X_BIAS,
-       IIO_MOD_Y_BIAS,
-       IIO_MOD_Z_BIAS,
-       IIO_MOD_STATUS,
-       IIO_MOD_BPM,
-};
-
-enum iio_event_type {
-       IIO_EV_TYPE_THRESH,
-       IIO_EV_TYPE_MAG,
-       IIO_EV_TYPE_ROC,
-       IIO_EV_TYPE_THRESH_ADAPTIVE,
-       IIO_EV_TYPE_MAG_ADAPTIVE,
-};
 
 enum iio_event_info {
        IIO_EV_INFO_ENABLE,
index 7c63bd67c36e274f933a857b23ee00e5e1c2daed..ac47d3144fe66b38caaed7471ddba617b33b353d 100644 (file)
@@ -1,6 +1,7 @@
 /* industrial I/O data types needed both in and out of kernel
  *
  * Copyright (c) 2008 Jonathan Cameron
+ * Copyright (c) 2014-2016, NVIDIA CORPORATION.  All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 as published by
@@ -37,13 +38,31 @@ enum iio_chan_type {
        IIO_VELOCITY,
        IIO_CONCENTRATION,
        IIO_RESISTANCE,
+       IIO_ORIENTATION,
+       IIO_GRAVITY,
+       IIO_LINEAR_ACCEL,
+       IIO_HUMIDITY,
+       IIO_MAGN_UNCAL,
+       IIO_ANGLVEL_UNCAL,
+       IIO_GAME_ROT,
+       IIO_MOTION,
+       IIO_STEP,
+       IIO_STEP_COUNT,
+       IIO_GEOMAGN_ROT,
+       IIO_HEART_RATE,
+       IIO_GESTURE_WAKE,
+       IIO_GESTURE_GLANCE,
+       IIO_GESTURE_PICKUP,
+       IIO_GENERIC,
 };
 
+
 enum iio_modifier {
        IIO_NO_MOD,
        IIO_MOD_X,
        IIO_MOD_Y,
        IIO_MOD_Z,
+       IIO_MOD_COS,
        IIO_MOD_X_AND_Y,
        IIO_MOD_X_AND_Z,
        IIO_MOD_Y_AND_Z,
@@ -76,6 +95,14 @@ enum iio_modifier {
        IIO_MOD_Q,
        IIO_MOD_CO2,
        IIO_MOD_VOC,
+       IIO_MOD_X_UNCALIB,
+       IIO_MOD_Y_UNCALIB,
+       IIO_MOD_Z_UNCALIB,
+       IIO_MOD_X_BIAS,
+       IIO_MOD_Y_BIAS,
+       IIO_MOD_Z_BIAS,
+       IIO_MOD_STATUS,
+       IIO_MOD_BPM,
 };
 
 enum iio_event_type {