-struct neuronspi_led_driver * neuronspi_led_probe(int led_count, int neuron_index, struct platform_device *board_device)
+struct neuronspi_led_driver * neuronspi_led_probe(int uled_count, int sysled_count, int neuron_index, struct platform_device *board_device)
{
struct spi_device* spi = neuronspi_s_dev[neuron_index];
struct neuronspi_driver_data *n_spi = spi_get_drvdata(spi);
struct neuronspi_led_driver * led_driver = kzalloc(sizeof(struct neuronspi_led_driver) * led_count, GFP_ATOMIC);
int i, coil;
+ int led_count = uled_count + sysled_count;
if (n_spi->features != NULL) {
coil = n_spi->features->di_count + n_spi->features->do_count + n_spi->features->ro_count;
}
for (i = 0; i < led_count; i++) {
- scnprintf(led_driver[i].name, sizeof(led_driver[i].name), "unipi:green:uled-x%x", i);
+ if (i < uled_count) {
+ scnprintf(led_driver[i].name, sizeof(led_driver[i].name), "unipi:green:uled-x%x", i);
+ { else {
+ scnprintf(led_driver[i].name, sizeof(led_driver[i].name), "unipi:green:sysled-x%x", i-uled_count);
+ }
// Initialise the rest of the structure
led_driver[i].id = i;
led_driver[i].coil = coil+i;
.ro_count = 0, \
.ds_count = 4, \
.di_count = 4, \
- .led_count = 16, \
+ .led_count = 4, \
.stm_ai_count = 1, \
.stm_ao_count = 1, \
.sec_ai_count = 0, \
.extension_sys_count = 0, \
.light_count = 0, \
.owire_count = 1, \
+ .sysled_count = 16, \
}
#define NEURONSPI_BOARD_B1000_HW_DEFINITION { \
.extension_sys_count = 0, \
.light_count = 0, \
.owire_count = 0, \
+ .sysled_count = 0, \
}
#define NEURONSPI_BOARD_E8DI8RO_HW_DEFINITION { \
.extension_sys_count = 0, \
.light_count = 0, \
.owire_count = 0, \
+ .sysled_count = 0, \
}
#define NEURONSPI_BOARD_E14RO_HW_DEFINITION { \
.extension_sys_count = 0, \
.light_count = 0, \
.owire_count = 0, \
+ .sysled_count = 0, \
}
#define NEURONSPI_BOARD_E16DI_HW_DEFINITION { \
.extension_sys_count = 1, \
.light_count = 0, \
.owire_count = 0, \
+ .sysled_count = 0, \
}
#define NEURONSPI_BOARD_E8DI8ROP11DIR485_HW_DEFINITION { \
.extension_sys_count = 1, \
.light_count = 0, \
.owire_count = 0, \
+ .sysled_count = 0, \
}
#define NEURONSPI_BOARD_E14ROP11DIR485_HW_DEFINITION { \
.extension_sys_count = 1, \
.light_count = 0, \
.owire_count = 0, \
+ .sysled_count = 0, \
}
#define NEURONSPI_BOARD_E16DIP11DIR485_HW_DEFINITION { \
.extension_sys_count = 1, \
.light_count = 0, \
.owire_count = 0, \
+ .sysled_count = 0, \
}
#define NEURONSPI_BOARD_E14ROU14RO_HW_DEFINITION { \
.extension_sys_count = 0, \
.light_count = 0, \
.owire_count = 0, \
+ .sysled_count = 0, \
}
#define NEURONSPI_BOARD_E16DIU14RO_HW_DEFINITION { \
.extension_sys_count = 0, \
.light_count = 0, \
.owire_count = 0, \
+ .sysled_count = 0, \
}
#define NEURONSPI_BOARD_E14ROU14DI_HW_DEFINITION { \
.extension_sys_count = 0, \
.light_count = 0, \
.owire_count = 0, \
+ .sysled_count = 0, \
}
#define NEURONSPI_BOARD_E16DIU14DI_HW_DEFINITION { \
.extension_sys_count = 0, \
.light_count = 0, \
.owire_count = 0, \
+ .sysled_count = 16, \
}
.extension_sys_count = 1, \
.light_count = 0, \
.owire_count = 0, \
+ .sysled_count = 0, \
}
#define NEURONSPI_BOARD_E4AI4AOP6DI5RO_HW_DEFINITION { \
.extension_sys_count = 0, \
.light_count = 0, \
.owire_count = 0, \
+ .sysled_count = 0, \
}
#define NEURONSPI_BOARD_B485_HW_DEFINITION { \
.extension_sys_count = 0, \
.light_count = 4, \
.owire_count = 0, \
+ .sysled_count = 16, \
}
#define NEURONSPI_BOARD_E4LIGHT_HW_DEFINITION { \
.extension_sys_count = 0, \
.light_count = 0, \
.owire_count = 0, \
+ .sysled_count = 0, \
}
#define NEURONSPI_BOARD_E4AI4AOU6DI5RO_HW_DEFINITION { \
.extension_sys_count = 1, \
.light_count = 0, \
.owire_count = 0, \
+ .sysled_count = 0, \
}
#define NEURONSPI_BOARD_E4AI4AOP4DI5RO_HW_DEFINITION { \
.extension_sys_count = 0, \
.light_count = 0, \
.owire_count = 0, \
+ .sysled_count = 0, \
}
#define NEURONSPI_BOARD_E4AI4AOU4DI5RO_HW_DEFINITION { \
if (board->features.led_count > 0) {
out_table->led_val_reg = neuronspi_find_reg_start(board, NEURONSPI_REGFUN_LED_RW);
}
+ if (board->features.sysled_count > 0) {
+ out_table->sysled_val_reg = NEURONSPI_SYSLED_REGISTER;
+ }
if (board->features.light_count > 0) {
// TODO: Fill in light bus registers
}
platform_set_drvdata(board_device, board_data);
if (n_spi->features) {
- if (n_spi->features->led_count) {
- printk(KERN_INFO "UNIPISPI: %d User LEDs detected at nspi%d\n", n_spi->features->led_count, n_spi->neuron_index);
- board_data->led_driver = neuronspi_led_probe(n_spi->features->led_count, n_spi->neuron_index, board_device);
+ if ((n_spi->features->led_count>0) || (n_spi->features->sysled_count>0)) {
+ if (n_spi->features->led_count) printk(KERN_INFO "UNIPISPI: %d User LEDs detected at nspi%d\n", n_spi->features->led_count, n_spi->neuron_index);
+ if (n_spi->features->sysled_count) printk(KERN_INFO "UNIPISPI: %d System LEDs detected at nspi%d\n", n_spi->features->sysled_count, n_spi->neuron_index);
+ board_data->led_driver = neuronspi_led_probe(n_spi->features->led_count, n_spi->features->sysled_count, n_spi->neuron_index, board_device);
}
#ifdef CONFIG_GPIOLIB
if (n_spi->features->di_count) {