| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Pinctrl driver for Rockchip RK805 PMIC |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (c) 2017, Fuzhou Rockchip Electronics Co., Ltd |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * Author: Joseph Chen <chenjh@rock-chips.com> |
|---|
| 7 | | - * |
|---|
| 8 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 9 | | - * under the terms of the GNU General Public License as published by the |
|---|
| 10 | | - * Free Software Foundation; either version 2 of the License, or (at your |
|---|
| 11 | | - * option) any later version. |
|---|
| 12 | 8 | * |
|---|
| 13 | 9 | * Based on the pinctrl-as3722 driver |
|---|
| 14 | 10 | */ |
|---|
| .. | .. |
|---|
| 347 | 343 | |
|---|
| 348 | 344 | /* default output*/ |
|---|
| 349 | 345 | if (!pci->pin_cfg[offset].dir_msk) |
|---|
| 350 | | - return 0; |
|---|
| 346 | + return GPIO_LINE_DIRECTION_OUT; |
|---|
| 351 | 347 | |
|---|
| 352 | 348 | ret = regmap_read(pci->rk808->regmap, |
|---|
| 353 | 349 | pci->pin_cfg[offset].reg, |
|---|
| .. | .. |
|---|
| 357 | 353 | return ret; |
|---|
| 358 | 354 | } |
|---|
| 359 | 355 | |
|---|
| 360 | | - return !(val & pci->pin_cfg[offset].dir_msk); |
|---|
| 356 | + if (val & pci->pin_cfg[offset].dir_msk) |
|---|
| 357 | + return GPIO_LINE_DIRECTION_OUT; |
|---|
| 358 | + |
|---|
| 359 | + return GPIO_LINE_DIRECTION_IN; |
|---|
| 361 | 360 | } |
|---|
| 362 | 361 | |
|---|
| 363 | 362 | static const struct gpio_chip rk805_gpio_chip = { |
|---|
| .. | .. |
|---|
| 571 | 570 | |
|---|
| 572 | 571 | static int rk805_pinctrl_gpio_request_enable(struct pinctrl_dev *pctldev, |
|---|
| 573 | 572 | struct pinctrl_gpio_range *range, |
|---|
| 574 | | - unsigned offset) |
|---|
| 573 | + unsigned int offset) |
|---|
| 575 | 574 | { |
|---|
| 576 | 575 | struct rk805_pctrl_info *pci = pinctrl_dev_get_drvdata(pctldev); |
|---|
| 577 | 576 | |
|---|