spi: expose defined CS
authorThomas Ingleby <thomas.c.ingleby@intel.com>
Thu, 30 Oct 2014 17:35:35 +0000 (17:35 +0000)
committerThomas Ingleby <thomas.c.ingleby@intel.com>
Mon, 17 Nov 2014 17:40:48 +0000 (17:40 +0000)
Signed-off-by: Thomas Ingleby <thomas.c.ingleby@intel.com>
src/mraa.c

index 11c21ac..d35c9ee 100644 (file)
@@ -274,6 +274,11 @@ mraa_setup_spi(int bus)
         if (mraa_setup_mux_mapped(plat->pins[pos].spi) != MRAA_SUCCESS)
              return NULL;
 
+    pos = plat->spi_bus[bus].cs;
+    if (plat->pins[pos].spi.mux_total > 0)
+        if (mraa_setup_mux_mapped(plat->pins[pos].spi) != MRAA_SUCCESS)
+             return NULL;
+
     mraa_spi_bus_t *spi = &(plat->spi_bus[bus]);
     return spi;
 }