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 <brendan.le.foll@intel.com>
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user