diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2011-04-12 13:31:04 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-04-13 13:34:43 -0400 |
commit | c6f0ede7c563497f6d7fef847a965d7fd63d86f9 (patch) | |
tree | 9f8dec3acd22c4f24f418112449a65fd6d2bbf17 /sound/soc/jz4740/qi_lb60.c | |
parent | 13319699113a78e90625ece124666d3ee53033f6 (diff) |
ASoC: JZ4740: qi_lb60: Use gpio_request_array to request and setup gpios
This patch changes the qi_lb60 setup code to use gpio_request_array instead of
manually calling gpio_request and gpio_direction_output for each gpio.
Doing so makes the code a bit more compact.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/jz4740/qi_lb60.c')
-rw-r--r-- | sound/soc/jz4740/qi_lb60.c | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/sound/soc/jz4740/qi_lb60.c b/sound/soc/jz4740/qi_lb60.c index 875abc94a00b..8c4e84bcc320 100644 --- a/sound/soc/jz4740/qi_lb60.c +++ b/sound/soc/jz4740/qi_lb60.c | |||
@@ -96,6 +96,11 @@ static struct snd_soc_card qi_lb60 = { | |||
96 | 96 | ||
97 | static struct platform_device *qi_lb60_snd_device; | 97 | static struct platform_device *qi_lb60_snd_device; |
98 | 98 | ||
99 | static const struct gpio qi_lb60_gpios[] = { | ||
100 | { QI_LB60_SND_GPIO, GPIOF_OUT_INIT_LOW, "SND" }, | ||
101 | { QI_LB60_AMP_GPIO, GPIOF_OUT_INIT_LOW, "AMP" }, | ||
102 | }; | ||
103 | |||
99 | static int __init qi_lb60_init(void) | 104 | static int __init qi_lb60_init(void) |
100 | { | 105 | { |
101 | int ret; | 106 | int ret; |
@@ -105,23 +110,12 @@ static int __init qi_lb60_init(void) | |||
105 | if (!qi_lb60_snd_device) | 110 | if (!qi_lb60_snd_device) |
106 | return -ENOMEM; | 111 | return -ENOMEM; |
107 | 112 | ||
108 | ret = gpio_request(QI_LB60_SND_GPIO, "SND"); | 113 | ret = gpio_request_array(qi_lb60_gpios, ARRAY_SIZE(qi_lb60_gpios)); |
109 | if (ret) { | 114 | if (ret) { |
110 | pr_err("qi_lb60 snd: Failed to request SND GPIO(%d): %d\n", | 115 | pr_err("qi_lb60 snd: Failed to request gpios: %d\n", ret); |
111 | QI_LB60_SND_GPIO, ret); | ||
112 | goto err_device_put; | 116 | goto err_device_put; |
113 | } | 117 | } |
114 | 118 | ||
115 | ret = gpio_request(QI_LB60_AMP_GPIO, "AMP"); | ||
116 | if (ret) { | ||
117 | pr_err("qi_lb60 snd: Failed to request AMP GPIO(%d): %d\n", | ||
118 | QI_LB60_AMP_GPIO, ret); | ||
119 | goto err_gpio_free_snd; | ||
120 | } | ||
121 | |||
122 | gpio_direction_output(QI_LB60_SND_GPIO, 0); | ||
123 | gpio_direction_output(QI_LB60_AMP_GPIO, 0); | ||
124 | |||
125 | platform_set_drvdata(qi_lb60_snd_device, &qi_lb60); | 119 | platform_set_drvdata(qi_lb60_snd_device, &qi_lb60); |
126 | 120 | ||
127 | ret = platform_device_add(qi_lb60_snd_device); | 121 | ret = platform_device_add(qi_lb60_snd_device); |
@@ -134,10 +128,8 @@ static int __init qi_lb60_init(void) | |||
134 | 128 | ||
135 | err_unset_pdata: | 129 | err_unset_pdata: |
136 | platform_set_drvdata(qi_lb60_snd_device, NULL); | 130 | platform_set_drvdata(qi_lb60_snd_device, NULL); |
137 | /*err_gpio_free_amp:*/ | 131 | /*err_gpio_free_array:*/ |
138 | gpio_free(QI_LB60_AMP_GPIO); | 132 | gpio_free_array(qi_lb60_gpios, ARRAY_SIZE(qi_lb60_gpios)); |
139 | err_gpio_free_snd: | ||
140 | gpio_free(QI_LB60_SND_GPIO); | ||
141 | err_device_put: | 133 | err_device_put: |
142 | platform_device_put(qi_lb60_snd_device); | 134 | platform_device_put(qi_lb60_snd_device); |
143 | 135 | ||
@@ -147,9 +139,8 @@ module_init(qi_lb60_init); | |||
147 | 139 | ||
148 | static void __exit qi_lb60_exit(void) | 140 | static void __exit qi_lb60_exit(void) |
149 | { | 141 | { |
150 | gpio_free(QI_LB60_AMP_GPIO); | ||
151 | gpio_free(QI_LB60_SND_GPIO); | ||
152 | platform_device_unregister(qi_lb60_snd_device); | 142 | platform_device_unregister(qi_lb60_snd_device); |
143 | gpio_free_array(qi_lb60_gpios, ARRAY_SIZE(qi_lb60_gpios)); | ||
153 | } | 144 | } |
154 | module_exit(qi_lb60_exit); | 145 | module_exit(qi_lb60_exit); |
155 | 146 | ||