diff options
-rw-r--r-- | arch/arm/plat-mxc/audmux-v1.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/arch/arm/plat-mxc/audmux-v1.c b/arch/arm/plat-mxc/audmux-v1.c index 70ab5aff2b9e..da6387dcdf21 100644 --- a/arch/arm/plat-mxc/audmux-v1.c +++ b/arch/arm/plat-mxc/audmux-v1.c | |||
@@ -28,7 +28,9 @@ | |||
28 | 28 | ||
29 | static void __iomem *audmux_base; | 29 | static void __iomem *audmux_base; |
30 | 30 | ||
31 | #define MXC_AUDMUX_V1_PCR(x) ((x) * 4) | 31 | static unsigned char port_mapping[] = { |
32 | 0x0, 0x4, 0x8, 0x10, 0x14, 0x1c, | ||
33 | }; | ||
32 | 34 | ||
33 | int mxc_audmux_v1_configure_port(unsigned int port, unsigned int pcr) | 35 | int mxc_audmux_v1_configure_port(unsigned int port, unsigned int pcr) |
34 | { | 36 | { |
@@ -37,7 +39,10 @@ int mxc_audmux_v1_configure_port(unsigned int port, unsigned int pcr) | |||
37 | return -ENOSYS; | 39 | return -ENOSYS; |
38 | } | 40 | } |
39 | 41 | ||
40 | writel(pcr, audmux_base + MXC_AUDMUX_V1_PCR(port)); | 42 | if (port >= ARRAY_SIZE(port_mapping)) |
43 | return -EINVAL; | ||
44 | |||
45 | writel(pcr, audmux_base + port_mapping[port]); | ||
41 | 46 | ||
42 | return 0; | 47 | return 0; |
43 | } | 48 | } |