Robert Marko | e7a34f1 | 2020-07-06 10:37:54 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
| 2 | /* |
Robert Marko | 51bf26f | 2024-04-22 13:43:25 +0200 | [diff] [blame^] | 3 | * Qualcomm common pin control data. |
Robert Marko | e7a34f1 | 2020-07-06 10:37:54 +0200 | [diff] [blame] | 4 | * |
Robert Marko | 51bf26f | 2024-04-22 13:43:25 +0200 | [diff] [blame^] | 5 | * Copyright (C) 2023 Linaro Ltd. |
Robert Marko | e7a34f1 | 2020-07-06 10:37:54 +0200 | [diff] [blame] | 6 | */ |
Robert Marko | 51bf26f | 2024-04-22 13:43:25 +0200 | [diff] [blame^] | 7 | #ifndef _QCOM_GPIO_H_ |
| 8 | #define _QCOM_GPIO_H_ |
| 9 | |
| 10 | #include <asm/types.h> |
| 11 | #include <stdbool.h> |
| 12 | |
| 13 | struct msm_pin_data { |
| 14 | int pin_count; |
| 15 | const unsigned int *pin_offsets; |
| 16 | /* Index of first special pin, these are ignored for now */ |
| 17 | unsigned int special_pins_start; |
| 18 | }; |
| 19 | |
| 20 | static inline u32 qcom_pin_offset(const unsigned int *offs, unsigned int selector) |
| 21 | { |
| 22 | u32 out = (selector * 0x1000); |
| 23 | |
| 24 | if (offs) |
| 25 | return out + offs[selector]; |
| 26 | |
| 27 | return out; |
| 28 | } |
| 29 | |
| 30 | static inline bool qcom_is_special_pin(const struct msm_pin_data *pindata, unsigned int pin) |
| 31 | { |
| 32 | return pindata->special_pins_start && pin >= pindata->special_pins_start; |
| 33 | } |
| 34 | |
| 35 | #endif /* _QCOM_GPIO_H_ */ |