aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/tty/serial/max310x.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/tty/serial/max310x.c b/drivers/tty/serial/max310x.c
index 97576ff791db..39f635812077 100644
--- a/drivers/tty/serial/max310x.c
+++ b/drivers/tty/serial/max310x.c
@@ -1159,6 +1159,27 @@ static int max310x_gpio_direction_output(struct gpio_chip *chip,
1159 1159
1160 return 0; 1160 return 0;
1161} 1161}
1162
1163static int max310x_gpio_set_config(struct gpio_chip *chip, unsigned int offset,
1164 unsigned long config)
1165{
1166 struct max310x_port *s = gpiochip_get_data(chip);
1167 struct uart_port *port = &s->p[offset / 4].port;
1168
1169 switch (pinconf_to_config_param(config)) {
1170 case PIN_CONFIG_DRIVE_OPEN_DRAIN:
1171 max310x_port_update(port, MAX310X_GPIOCFG_REG,
1172 1 << ((offset % 4) + 4),
1173 1 << ((offset % 4) + 4));
1174 return 0;
1175 case PIN_CONFIG_DRIVE_PUSH_PULL:
1176 max310x_port_update(port, MAX310X_GPIOCFG_REG,
1177 1 << ((offset % 4) + 4), 0);
1178 return 0;
1179 default:
1180 return -ENOTSUPP;
1181 }
1182}
1162#endif 1183#endif
1163 1184
1164static int max310x_probe(struct device *dev, struct max310x_devtype *devtype, 1185static int max310x_probe(struct device *dev, struct max310x_devtype *devtype,
@@ -1302,6 +1323,7 @@ static int max310x_probe(struct device *dev, struct max310x_devtype *devtype,
1302 s->gpio.get = max310x_gpio_get; 1323 s->gpio.get = max310x_gpio_get;
1303 s->gpio.direction_output= max310x_gpio_direction_output; 1324 s->gpio.direction_output= max310x_gpio_direction_output;
1304 s->gpio.set = max310x_gpio_set; 1325 s->gpio.set = max310x_gpio_set;
1326 s->gpio.set_config = max310x_gpio_set_config;
1305 s->gpio.base = -1; 1327 s->gpio.base = -1;
1306 s->gpio.ngpio = devtype->nr * 4; 1328 s->gpio.ngpio = devtype->nr * 4;
1307 s->gpio.can_sleep = 1; 1329 s->gpio.can_sleep = 1;