Blame view

drivers/pinctrl/pinctrl-adi2.h 1.81 KB
e9a03add0   Sonic Zhang   pinctrl: ADI PIN ...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
  /*
   * Pinctrl Driver for ADI GPIO2 controller
   *
   * Copyright 2007-2013 Analog Devices Inc.
   *
   * Licensed under the GPLv2 or later
   */
  
  #ifndef PINCTRL_PINCTRL_ADI2_H
  #define PINCTRL_PINCTRL_ADI2_H
  
  #include <linux/pinctrl/pinctrl.h>
  
   /**
   * struct adi_pin_group - describes a pin group
   * @name: the name of this pin group
   * @pins: an array of pins
   * @num: the number of pins in this array
   */
  struct adi_pin_group {
  	const char *name;
  	const unsigned *pins;
  	const unsigned num;
e3653749a   Sonic Zhang   pinctrl: pinctrl-...
24
  	const unsigned short *mux;
e9a03add0   Sonic Zhang   pinctrl: ADI PIN ...
25
  };
e3653749a   Sonic Zhang   pinctrl: pinctrl-...
26
  #define ADI_PIN_GROUP(n, p, m)  \
e9a03add0   Sonic Zhang   pinctrl: ADI PIN ...
27
28
29
30
  	{			\
  		.name = n,	\
  		.pins = p,	\
  		.num = ARRAY_SIZE(p),	\
e3653749a   Sonic Zhang   pinctrl: pinctrl-...
31
  		.mux = m,			\
e9a03add0   Sonic Zhang   pinctrl: ADI PIN ...
32
33
34
35
36
37
38
39
40
41
42
43
44
  	}
  
   /**
   * struct adi_pmx_func - describes function mux setting of pin groups
   * @name: the name of this function mux setting
   * @groups: an array of pin groups
   * @num_groups: the number of pin groups in this array
   * @mux: the function mux setting array, end by zero
   */
  struct adi_pmx_func {
  	const char *name;
  	const char * const *groups;
  	const unsigned num_groups;
e9a03add0   Sonic Zhang   pinctrl: ADI PIN ...
45
  };
e3653749a   Sonic Zhang   pinctrl: pinctrl-...
46
  #define ADI_PMX_FUNCTION(n, g)		\
e9a03add0   Sonic Zhang   pinctrl: ADI PIN ...
47
48
49
50
  	{					\
  		.name = n,			\
  		.groups = g,			\
  		.num_groups = ARRAY_SIZE(g),	\
e9a03add0   Sonic Zhang   pinctrl: ADI PIN ...
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
  	}
  
  /**
   * struct adi_pinctrl_soc_data - ADI pin controller per-SoC configuration
   * @functions:  The functions supported on this SoC.
   * @nfunction:  The number of entries in @functions.
   * @groups:     An array describing all pin groups the pin SoC supports.
   * @ngroups:    The number of entries in @groups.
   * @pins:       An array describing all pins the pin controller affects.
   * @npins:      The number of entries in @pins.
   */
  struct adi_pinctrl_soc_data {
  	const struct adi_pmx_func *functions;
  	int nfunctions;
  	const struct adi_pin_group *groups;
  	int ngroups;
  	const struct pinctrl_pin_desc *pins;
  	int npins;
  };
  
  void adi_pinctrl_soc_init(const struct adi_pinctrl_soc_data **soc);
  
  #endif /* PINCTRL_PINCTRL_ADI2_H */