Dzmitry Sankouski | e9be204 | 2021-10-17 13:44:29 +0300 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | /* |
| 3 | * Qualcomm SDM845 pinctrl |
| 4 | * |
| 5 | * (C) Copyright 2021 Dzmitry Sankouski <dsankouski@gmail.com> |
| 6 | * |
| 7 | */ |
| 8 | |
| 9 | #include "pinctrl-snapdragon.h" |
| 10 | #include <common.h> |
| 11 | |
| 12 | #define MAX_PIN_NAME_LEN 32 |
| 13 | static char pin_name[MAX_PIN_NAME_LEN] __section(".data"); |
| 14 | |
| 15 | static const struct pinctrl_function msm_pinctrl_functions[] = { |
| 16 | {"qup9", 1}, |
| 17 | {"gpio", 0}, |
| 18 | }; |
| 19 | |
| 20 | static const char *sdm845_get_function_name(struct udevice *dev, |
| 21 | unsigned int selector) |
| 22 | { |
| 23 | return msm_pinctrl_functions[selector].name; |
| 24 | } |
| 25 | |
| 26 | static const char *sdm845_get_pin_name(struct udevice *dev, |
| 27 | unsigned int selector) |
| 28 | { |
| 29 | snprintf(pin_name, MAX_PIN_NAME_LEN, "GPIO_%u", selector); |
| 30 | return pin_name; |
| 31 | } |
| 32 | |
| 33 | static unsigned int sdm845_get_function_mux(unsigned int selector) |
| 34 | { |
| 35 | return msm_pinctrl_functions[selector].val; |
| 36 | } |
| 37 | |
| 38 | struct msm_pinctrl_data sdm845_data = { |
| 39 | .pin_count = 150, |
| 40 | .functions_count = ARRAY_SIZE(msm_pinctrl_functions), |
| 41 | .get_function_name = sdm845_get_function_name, |
| 42 | .get_function_mux = sdm845_get_function_mux, |
| 43 | .get_pin_name = sdm845_get_pin_name, |
| 44 | }; |