move io definitions from unipi_spi.h to iio.h and iio.c
authorMiroslav Ondra <ondra@faster.cz>
Wed, 5 Sep 2018 09:17:29 +0000 (11:17 +0200)
committerMiroslav Ondra <ondra@faster.cz>
Wed, 5 Sep 2018 09:17:29 +0000 (11:17 +0200)
modules/unipi/src/unipi_common.h
modules/unipi/src/unipi_iio.c
modules/unipi/src/unipi_iio.h
modules/unipi/src/unipi_spi.h

index be2902f7e37e0fbfa6c8f448d37e76f09ba83b1f..a63b0d12fe61bbaf27611f93e4ece1ab4c83e0d8 100644 (file)
@@ -263,18 +263,6 @@ struct neuronspi_led_driver
        spinlock_t                      lock;
 };
 
-/*
-struct neuronspi_file_data
-{
-       struct spi_device** spi_device;
-       struct mutex            lock;
-    struct neuronspi_op_buffer send_buf;
-    struct neuronspi_op_buffer recv_buf;
-       u32                             message_len;
-       u8                                      device_index;
-       u8                                      has_first_message;
-};
-*/
 
 struct neuronspi_direct_acc
 {
index 2ff053fd80c2c9969d656832dc8c05f3d848cf33..033e44ad2e609098c94b58fec7a7c0468f6d838a 100644 (file)
@@ -393,6 +393,35 @@ int neuronspi_iio_sec_ao_write_raw(struct iio_dev *indio_dev, struct iio_chan_sp
        }
 }
 
+/*****************************************************************
+ * Probe data and functions 
+ * 
+ *****************************************************************/ 
+static const struct iio_info neuronspi_stm_ai_info = {
+       .read_raw = neuronspi_iio_stm_ai_read_raw,
+       .driver_module = THIS_MODULE,
+       .attrs = &neuron_stm_ai_group,
+};
+
+static const struct iio_info neuronspi_stm_ao_info = {
+       .read_raw = neuronspi_iio_stm_ao_read_raw,
+       .write_raw = neuronspi_iio_stm_ao_write_raw,
+       .driver_module = THIS_MODULE,
+       .attrs = &neuron_stm_ao_group,
+};
+
+static const struct iio_info neuronspi_sec_ai_info = {
+       .read_raw = neuronspi_iio_sec_ai_read_raw,
+       .driver_module = THIS_MODULE,
+       .attrs = &neuron_sec_ai_group,
+};
+
+static const struct iio_info neuronspi_sec_ao_info = {
+       .write_raw = neuronspi_iio_sec_ao_write_raw,
+       .driver_module = THIS_MODULE,
+       //.attrs = &neuron_sec_ao_group,
+};
+
 
 struct iio_dev* neuronspi_stm_ai_probe(int io_count, int neuron_index, struct platform_device *board_device)
 {
index 86c77aebabd3739615401920a4514a32383fa64e..2b0eb9ea05c4d20b4ccc16bdbb9c1965a377b5df 100644 (file)
 
 #include "unipi_common.h"
 
+
+/********************
+ * Data Definitions *
+ ********************/
+static const struct iio_chan_spec neuronspi_stm_ai_chan_spec[] = {
+       {
+                       .type = IIO_VOLTAGE,
+                       .indexed = 1,
+                       .channel = 0,
+                       .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
+                       .output = 0
+       },
+       {
+                       .type = IIO_CURRENT,
+                       .indexed = 1,
+                       .channel = 1,
+                       .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
+                       .output = 0
+       }
+};
+
+static const struct iio_chan_spec neuronspi_stm_ao_chan_spec[] = {
+       {
+                       .type = IIO_VOLTAGE,
+                       .indexed = 1,
+                       .channel = 0,
+                       .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
+                       .output = 1
+       },
+       {
+                       .type = IIO_CURRENT,
+                       .indexed = 1,
+                       .channel = 1,
+                       .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
+                       .output = 1
+       },
+       {
+                       .type = IIO_RESISTANCE,
+                       .indexed = 1,
+                       .channel = 2,
+                       .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
+                       .output = 0
+       }
+};
+
+static const struct iio_chan_spec neuronspi_sec_ai_chan_spec[] = {
+       {
+                       .type = IIO_VOLTAGE,
+                       .indexed = 1,
+                       .channel = 0,
+                       .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
+                       .output = 0
+       },
+       {
+                       .type = IIO_CURRENT,
+                       .indexed = 1,
+                       .channel = 1,
+                       .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
+                       .output = 0
+       },
+       {
+                       .type = IIO_RESISTANCE,
+                       .indexed = 1,
+                       .channel = 2,
+                       .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
+                       .output = 0
+       }
+};
+
+static const struct iio_chan_spec neuronspi_sec_ao_chan_spec[] = {
+       {
+                       .type = IIO_VOLTAGE,
+                       .indexed = 1,
+                       .channel = 0,
+                       .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
+                       .output = 1
+       }
+};
+
+
 /*************************
  * Function Declarations *
  *************************/
@@ -36,4 +117,6 @@ struct iio_dev* neuronspi_stm_ao_probe(int io_count, int neuron_index, struct pl
 struct iio_dev** neuronspi_sec_ai_probe(int io_count, int neuron_index, struct platform_device *board_device);
 struct iio_dev** neuronspi_sec_ao_probe(int io_count, int neuron_index, struct platform_device *board_device);
 
+
+
 #endif /* MODULES_NEURON_SPI_SRC_UNIPI_IIO_H_ */
index 2ed625d607c3d3f9261a4ffe53b642e0163d8840..b3f24d299e8cf6e400810653a96c9a8b70ab9735 100644 (file)
@@ -165,6 +165,7 @@ static const struct regmap_config neuronspi_regmap_config_default =
                .can_multi_write                = 1,
 };
 
+/*
 static const struct iio_chan_spec neuronspi_stm_ai_chan_spec[] = {
        {
                        .type = IIO_VOLTAGE,
@@ -264,7 +265,7 @@ static const struct iio_info neuronspi_sec_ao_info = {
        .driver_module = THIS_MODULE,
        //.attrs = &neuron_sec_ao_group,
 };
-
+*/
 // These defines need to be at the end
 #define to_neuronspi_uart_data(p,e)  ((container_of((p), struct neuronspi_uart_data, e)))
 #define to_neuronspi_port(p,e) ((container_of((p), struct neuronspi_port, e)))