summaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl/pinctrl-imx.h
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2013-07-28 16:29:22 +0200
committerLinus Walleij <linus.walleij@linaro.org>2013-08-16 14:43:56 +0200
commit8f903f8a342e466f3da33b21ae60f1b11626b81a (patch)
treec7a12a3a2d8dbfdc368242485e559afdd7a484c2 /drivers/pinctrl/pinctrl-imx.h
parent7ea46e0f9df44ce3dea5a54f7c182f98eeef7bee (diff)
downloadlinux-8f903f8a342e466f3da33b21ae60f1b11626b81a.tar.gz
linux-8f903f8a342e466f3da33b21ae60f1b11626b81a.tar.bz2
linux-8f903f8a342e466f3da33b21ae60f1b11626b81a.zip
pinctrl: imx: Use struct type for pins
The i.MX pinctrl driver uses 5 different arrays for storing the informations for pins. This requires five allocations. Instead, use a struct type which is more cache friendly, readable and requires less allocations. One array of integers is still needed since the pinctrl framework forces us to maintain it. This also adds checks whether the allocations are succesful which were missing. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Acked-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/pinctrl-imx.h')
-rw-r--r--drivers/pinctrl/pinctrl-imx.h36
1 files changed, 21 insertions, 15 deletions
diff --git a/drivers/pinctrl/pinctrl-imx.h b/drivers/pinctrl/pinctrl-imx.h
index bcedd991c9f3..db408b057000 100644
--- a/drivers/pinctrl/pinctrl-imx.h
+++ b/drivers/pinctrl/pinctrl-imx.h
@@ -18,29 +18,35 @@
struct platform_device;
/**
+ * struct imx_pin_group - describes a single i.MX pin
+ * @pin: the pin_id of this pin
+ * @mux_mode: the mux mode for this pin.
+ * @input_reg: the select input register offset for this pin if any
+ * 0 if no select input setting needed.
+ * @input_val: the select input value for this pin.
+ * @configs: the config for this pin.
+ */
+struct imx_pin {
+ unsigned int pin;
+ unsigned int mux_mode;
+ u16 input_reg;
+ unsigned int input_val;
+ unsigned long config;
+};
+
+/**
* struct imx_pin_group - describes an IMX pin group
* @name: the name of this specific pin group
- * @pins: an array of discrete physical pins used in this group, taken
- * from the driver-local pin enumeration space
* @npins: the number of pins in this group array, i.e. the number of
* elements in .pins so we can iterate over that array
- * @mux_mode: the mux mode for each pin in this group. The size of this
- * array is the same as pins.
- * @input_reg: select input register offset for this mux if any
- * 0 if no select input setting needed.
- * @input_val: the select input value for each pin in this group. The size of
- * this array is the same as pins.
- * @configs: the config for each pin in this group. The size of this
- * array is the same as pins.
+ * @pin_ids: array of pin_ids. pinctrl forces us to maintain such an array
+ * @pins: array of pins
*/
struct imx_pin_group {
const char *name;
- unsigned int *pins;
unsigned npins;
- unsigned int *mux_mode;
- u16 *input_reg;
- unsigned int *input_val;
- unsigned long *configs;
+ unsigned int *pin_ids;
+ struct imx_pin *pins;
};
/**