diff options
-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 | ||