s32 ret = 0;
// Character device registration
- unipi_spi_trace(KERN_DEBUG "UNIPISPI: Initialising Character Device\n");
+ unipi_spi_trace(KERN_DEBUG "UNIPISPI: CDEV Initialising Character Device\n");
neuronspi_cdrv.major_number = register_chrdev(0, NEURON_DEVICE_NAME, &file_ops);
if (neuronspi_cdrv.major_number < 0){
- printk(KERN_ALERT "NEURONSPI: failed to register a major number\n");
+ printk(KERN_ALERT "NEURONSPI: CDEV Failed to register chrdev\n");
return neuronspi_cdrv.major_number;
}
- unipi_spi_trace(KERN_DEBUG "UNIPISPI: registered correctly with major number %d\n", neuronspi_cdrv.major_number);
+ unipi_spi_trace(KERN_DEBUG "UNIPISPI: CDEV major number %d\n", neuronspi_cdrv.major_number);
// Character class registration
neuronspi_cdrv.driver_class = class_create(THIS_MODULE, NEURON_DEVICE_CLASS);
if (IS_ERR(neuronspi_cdrv.driver_class)) {
unregister_chrdev(neuronspi_cdrv.major_number, NEURON_DEVICE_NAME);
- printk(KERN_ALERT "NEURONSPI: Failed to register device class\n");
+ printk(KERN_ALERT "NEURONSPI: CDEV Failed to register device class\n");
return PTR_ERR(neuronspi_cdrv.driver_class);
}
- unipi_spi_trace(KERN_DEBUG "UNIPISPI: device class registered correctly\n");
+ unipi_spi_trace(KERN_DEBUG "UNIPISPI: CDEV Device class registered\n");
// Device driver registration
neuronspi_cdrv.dev = device_create_with_groups(neuronspi_cdrv.driver_class, &(neuron_plc_dev->dev), MKDEV(neuronspi_cdrv.major_number, 0), NULL, neuron_plc_attr_groups, NEURON_DEVICE_NAME);
if (IS_ERR(neuronspi_cdrv.dev)) {
class_destroy(neuronspi_cdrv.driver_class);
unregister_chrdev(neuronspi_cdrv.major_number, NEURON_DEVICE_NAME);
- printk(KERN_ALERT "NEURONSPI: Failed to create the device\n");
+ printk(KERN_ALERT "NEURONSPI: CDEV Failed to create the device\n");
return PTR_ERR(neuronspi_cdrv.dev);
}
- unipi_spi_trace(KERN_DEBUG "UNIPISPI: device class created correctly\n");
+ unipi_spi_trace(KERN_DEBUG "UNIPISPI: CDEV Device class created\n");
return ret;
}
class_unregister(neuronspi_cdrv.driver_class); // Unregister the class
class_destroy(neuronspi_cdrv.driver_class); // Destroy the class
unregister_chrdev(neuronspi_cdrv.major_number, NEURON_DEVICE_NAME); // Unregister the major number
- printk(KERN_INFO "UNIPISPI: Device unloaded successfully\n");
+ printk(KERN_INFO "UNIPISPI: CDEV unloaded\n");
return 0;
}
ret = spi_register_driver(&neuronspi_spi_driver);
if (ret < 0) {
- printk(KERN_ERR "UNIPISPI: Failed to init neuronspi spi --> %d\n", ret);
+ printk(KERN_ERR "UNIPISPI: Failed to init spi driver --> %d\n", ret);
return ret;
- } else {
- printk(KERN_INFO "UNIPISPI: SPI Driver Registered, Major Version: %s\n", NEURONSPI_MAJOR_VERSIONSTRING);
}
+ printk(KERN_INFO "UNIPISPI: SPI Driver Registered, Major Version: %s\n", NEURONSPI_MAJOR_VERSIONSTRING);
neuronspi_invalidate_thread = kthread_create(neuronspi_regmap_invalidate, NULL, "unipispi_inv");
if (neuronspi_invalidate_thread != NULL) {
.can_multi_write = 1,
};
-/*
-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
- }
-};
-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,
-};
-*/
// 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)))