This will fully initialize the pin.
The problem is that edge attribute cannot be modified without explicitly
defining pin's direction after boot.
It seems like a kernel issue. This is just a workaround.
Change-Id: I6c9a2c8d20757c3f9d04779a820015c839b8ea5c
Signed-off-by: Konrad Kuchciak <k.kuchciak@samsung.com>
if (!strncmp(gpio_buf, types[index].type, types[index].len)) {
// PERIPHERAL_GPIO_DIRECTION_OUT_INITIALLY_HIGH and PERIPHERAL_GPIO_DIRECTION_OUT_INITIALLY_LOW : out type
gpio->direction = (peripheral_gpio_direction_e)index;
+
+ /*
+ * Also write to direction for the very first time after boot
+ * to ensure that the pin is fully initialized.
+ * Without this, writing to 'edge' is not possible.
+ */
+ ret = write(gpio->fd_direction, types[index].type, types[index].len);
+ CHECK_ERROR(ret != types[index].len);
+
return PERIPHERAL_ERROR_NONE;
}
}