|
11 | 11 | #include <device.h> |
12 | 12 | #include <errno.h> |
13 | 13 | #include <drivers/gpio.h> |
| 14 | +#include <dt-bindings/gpio/ti-cc13xx-cc26xx-gpio.h> |
14 | 15 |
|
15 | 16 | #include <driverlib/gpio.h> |
16 | 17 | #include <driverlib/interrupt.h> |
@@ -72,28 +73,21 @@ static int gpio_cc13xx_cc26xx_config(const struct device *port, |
72 | 73 |
|
73 | 74 | config |= IOC_SLEW_DISABLE | IOC_NO_WAKE_UP; |
74 | 75 |
|
75 | | - config |= (flags & GPIO_INT_DEBOUNCE) ? IOC_HYST_ENABLE : |
76 | | - IOC_HYST_DISABLE; |
77 | | - |
78 | | - /* |
79 | | - * The GPIO_DS_ALT_HIGH and GPIO_DS_ALT_LOW flags are for setting |
80 | | - * the highest drive strength for a GPIO in the output HIGH and |
81 | | - * output LOW states, respectively. Since only 1 drive strength |
82 | | - * setting is available for a GPIO (irrespective of output state), |
83 | | - * require both flags to be set for highest drive strength, default |
84 | | - * to low/auto drive strength. |
85 | | - * Not all GPIO support 8ma, but setting that bit will use the highest |
86 | | - * supported drive strength. |
87 | | - */ |
88 | | - switch (flags & (GPIO_DS_ALT_HIGH | GPIO_DS_ALT_LOW)) { |
89 | | - case 0: |
| 76 | + config |= (flags & CC13XX_CC26XX_GPIO_DEBOUNCE) ? |
| 77 | + IOC_HYST_ENABLE : IOC_HYST_DISABLE; |
| 78 | + |
| 79 | + switch (flags & CC13XX_CC26XX_GPIO_DS_MASK) { |
| 80 | + case CC13XX_CC26XX_GPIO_DS_DFLT: |
90 | 81 | config |= IOC_CURRENT_2MA | IOC_STRENGTH_AUTO; |
91 | 82 | break; |
92 | | - case (GPIO_DS_ALT_HIGH | GPIO_DS_ALT_LOW): |
| 83 | + case CC13XX_CC26XX_GPIO_DS_ALT: |
| 84 | + /* |
| 85 | + * Not all GPIO support 8ma, but setting that bit will use the |
| 86 | + * highest supported drive strength. |
| 87 | + */ |
93 | 88 | config |= IOC_CURRENT_8MA | IOC_STRENGTH_MAX; |
94 | 89 | break; |
95 | | - case GPIO_DS_ALT_HIGH: |
96 | | - case GPIO_DS_ALT_LOW: |
| 90 | + default: |
97 | 91 | return -ENOTSUP; |
98 | 92 | } |
99 | 93 |
|
|
0 commit comments