From aed965c27d30947537c89c91968e7b1a7a4313a3 Mon Sep 17 00:00:00 2001 From: Brendan Le Foll Date: Wed, 3 Aug 2016 13:25:29 +0100 Subject: [PATCH] pwm.c: Remove manual gpio muxing when using a pin that has both pwm & gpio enabled This fixes PWM on the GT platform. The code was only used on gen1 galileo and is rarely used because it's the only platform in mraa that supports 2 functions on the same pin without any time of advanced function pointer being called (gen2/edison). GT however has kernel side muxing which causes the gpio to be initialised meaning the PWM channel is never set to active as it's activated after the GPIO is opened and the GPIO keeps precendence Signed-off-by: Brendan Le Foll --- src/pwm/pwm.c | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/src/pwm/pwm.c b/src/pwm/pwm.c index 43a5ba4..44bb7ad 100644 --- a/src/pwm/pwm.c +++ b/src/pwm/pwm.c @@ -249,28 +249,6 @@ mraa_pwm_init(int pin) return NULL; } - if (board->pins[pin].capabilites.gpio == 1) { - // This deserves more investigation - mraa_gpio_context mux_i; - mux_i = mraa_gpio_init_raw(board->pins[pin].gpio.pinmap); - if (mux_i == NULL) { - syslog(LOG_ERR, "pwm_init: error in gpio->pwm%i transition. gpio_init", pin); - return NULL; - } - if (mraa_gpio_dir(mux_i, MRAA_GPIO_OUT) != MRAA_SUCCESS) { - syslog(LOG_ERR, "pwm_init: error in gpio->pwm%i transition. gpio_dir", pin); - return NULL; - } - if (mraa_gpio_write(mux_i, 1) != MRAA_SUCCESS) { - syslog(LOG_ERR, "pwm_init: error in gpio->pwm%i transition. gpio_write", pin); - return NULL; - } - if (mraa_gpio_close(mux_i) != MRAA_SUCCESS) { - syslog(LOG_ERR, "pwm_init: error in gpio->pwm%i transition. gpio_close", pin); - return NULL; - } - } - if (board->pins[pin].pwm.mux_total > 0) { if (mraa_setup_mux_mapped(board->pins[pin].pwm) != MRAA_SUCCESS) { syslog(LOG_ERR, "pwm_init: Failed to set-up pwm%i multiplexer", pin);