| 1 |
/* SPDX-License-Identifier: GPL-2.0 */ |
| 2 |
/* |
| 3 |
* Copyright (C) 2018 MediaTek Inc. |
| 4 |
* |
| 5 |
* Author: Sean Wang <[email protected]> |
| 6 |
* Zhiyong Tao <[email protected]> |
| 7 |
* Hongzhou.Yang <[email protected]> |
| 8 |
*/ |
| 9 |
#ifndef __PINCTRL_PARIS_H |
| 10 |
#define __PINCTRL_PARIS_H |
| 11 |
|
| 12 |
#include <linux/io.h> |
| 13 |
#include <linux/init.h> |
| 14 |
#include <linux/of.h> |
| 15 |
#include <linux/of_platform.h> |
| 16 |
#include <linux/platform_device.h> |
| 17 |
#include <linux/pinctrl/pinctrl.h> |
| 18 |
#include <linux/pinctrl/pinmux.h> |
| 19 |
#include <linux/pinctrl/pinconf.h> |
| 20 |
#include <linux/pinctrl/pinconf-generic.h> |
| 21 |
|
| 22 |
#include "../core.h" |
| 23 |
#include "../pinconf.h" |
| 24 |
#include "../pinctrl-utils.h" |
| 25 |
#include "../pinmux.h" |
| 26 |
#include "mtk-eint.h" |
| 27 |
#include "pinctrl-mtk-common-v2.h" |
| 28 |
|
| 29 |
#define MTK_RANGE(_a) { .range = (_a), .nranges = ARRAY_SIZE(_a), } |
| 30 |
|
| 31 |
#define MTK_EINT_FUNCTION(_eintmux, _eintnum) \ |
| 32 |
{ \ |
| 33 |
.eint_m = _eintmux, \ |
| 34 |
.eint_n = _eintnum, \ |
| 35 |
} |
| 36 |
|
| 37 |
#define MTK_FUNCTION(_val, _name) \ |
| 38 |
{ \ |
| 39 |
.muxval = _val, \ |
| 40 |
.name = _name, \ |
| 41 |
} |
| 42 |
|
| 43 |
#define MTK_PIN(_number, _name, _eint, _drv_n, ...) { \ |
| 44 |
.number = _number, \ |
| 45 |
.name = _name, \ |
| 46 |
.eint = _eint, \ |
| 47 |
.drv_n = _drv_n, \ |
| 48 |
.funcs = (struct mtk_func_desc[]){ \ |
| 49 |
__VA_ARGS__, { } }, \ |
| 50 |
} |
| 51 |
|
| 52 |
#define MTK_EINT_PIN(_number, _instance, _index, _debounce) { \ |
| 53 |
.number = _number, \ |
| 54 |
.instance = _instance, \ |
| 55 |
.index = _index, \ |
| 56 |
.debounce = _debounce, \ |
| 57 |
} |
| 58 |
|
| 59 |
#define PINCTRL_PIN_GROUP(_name_, id) \ |
| 60 |
{ \ |
| 61 |
.grp = PINCTRL_PINGROUP(_name_,id##_pins, ARRAY_SIZE(id##_pins)), \ |
| 62 |
.data = id##_funcs, \ |
| 63 |
} |
| 64 |
|
| 65 |
int mtk_paris_pinctrl_probe(struct platform_device *pdev); |
| 66 |
|
| 67 |
ssize_t mtk_pctrl_show_one_pin(struct mtk_pinctrl *hw, |
| 68 |
unsigned int gpio, char *buf, unsigned int bufLen); |
| 69 |
|
| 70 |
extern const struct dev_pm_ops mtk_paris_pinctrl_pm_ops; |
| 71 |
|
| 72 |
#endif /* __PINCTRL_PARIS_H */ |