Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1/* SPDX-License-Identifier: GPL-2.0+ */
2/*
3 * AMD ISP Pinctrl Driver
4 *
5 * Copyright (C) 2025 Advanced Micro Devices, Inc. All rights reserved.
6 *
7 */
8
9static const struct pinctrl_pin_desc amdisp_pins[] = {
10 PINCTRL_PIN(0, "GPIO_0"), /* sensor0 control */
11 PINCTRL_PIN(1, "GPIO_1"), /* sensor1 control */
12 PINCTRL_PIN(2, "GPIO_2"), /* sensor2 control */
13};
14
15#define AMDISP_GPIO_PINS(pin) \
16static const unsigned int gpio##pin##_pins[] = { pin }
17AMDISP_GPIO_PINS(0);
18AMDISP_GPIO_PINS(1);
19AMDISP_GPIO_PINS(2);
20
21static const unsigned int amdisp_range_pins[] = {
22 0, 1, 2
23};
24
25static const char * const amdisp_range_pins_name[] = {
26 "gpio0", "gpio1", "gpio2"
27};
28
29enum amdisp_functions {
30 mux_gpio,
31 mux_NA
32};
33
34static const char * const gpio_groups[] = {
35 "gpio0", "gpio1", "gpio2"
36};
37
38/**
39 * struct amdisp_function - a pinmux function
40 * @name: Name of the pinmux function.
41 * @groups: List of pingroups for this function.
42 * @ngroups: Number of entries in @groups.
43 */
44struct amdisp_function {
45 const char *name;
46 const char * const *groups;
47 unsigned int ngroups;
48};
49
50#define FUNCTION(fname) \
51 [mux_##fname] = { \
52 .name = #fname, \
53 .groups = fname##_groups, \
54 .ngroups = ARRAY_SIZE(fname##_groups), \
55 }
56
57static const struct amdisp_function amdisp_functions[] = {
58 FUNCTION(gpio),
59};
60
61/**
62 * struct amdisp_pingroup - a pinmux group
63 * @name: Name of the pinmux group.
64 * @pins: List of pins for this group.
65 * @npins: Number of entries in @pins.
66 * @funcs: List of functions belongs to this group.
67 * @nfuncs: Number of entries in @funcs.
68 * @offset: Group offset in amdisp pinmux groups.
69 */
70struct amdisp_pingroup {
71 const char *name;
72 const unsigned int *pins;
73 unsigned int npins;
74 unsigned int *funcs;
75 unsigned int nfuncs;
76 unsigned int offset;
77};
78
79#define PINGROUP(id, f0) \
80 { \
81 .name = "gpio" #id, \
82 .pins = gpio##id##_pins, \
83 .npins = ARRAY_SIZE(gpio##id##_pins), \
84 .funcs = (int[]){ \
85 mux_##f0, \
86 }, \
87 .nfuncs = 1, \
88 .offset = id, \
89 }
90
91static const struct amdisp_pingroup amdisp_groups[] = {
92 PINGROUP(0, gpio),
93 PINGROUP(1, gpio),
94 PINGROUP(2, gpio),
95};