blob: 53c6ae0649064f1227a7556a179ec06d62edab08 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Mateusz Kulikowski2507d822016-03-31 23:12:32 +02002/*
Caleb Connollyfabb8972023-11-14 12:55:42 +00003 * Qualcomm common pin control data.
Mateusz Kulikowski2507d822016-03-31 23:12:32 +02004 *
Caleb Connollyfabb8972023-11-14 12:55:42 +00005 * Copyright (C) 2023 Linaro Ltd.
Mateusz Kulikowski2507d822016-03-31 23:12:32 +02006 */
Caleb Connollyfabb8972023-11-14 12:55:42 +00007#ifndef _QCOM_GPIO_H_
8#define _QCOM_GPIO_H_
9
10#include <asm/types.h>
11#include <stdbool.h>
12
13struct msm_pin_data {
14 int pin_count;
15 const unsigned int *pin_offsets;
Caleb Connolly190005c2024-02-26 17:26:17 +000016 /* Index of first special pin, these are ignored for now */
17 unsigned int special_pins_start;
Caleb Connollyfabb8972023-11-14 12:55:42 +000018};
19
20static 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
Caleb Connolly190005c2024-02-26 17:26:17 +000030static 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
Caleb Connollyfabb8972023-11-14 12:55:42 +000035#endif /* _QCOM_GPIO_H_ */