diff options
Diffstat (limited to 'sound/soc/jz4740/qi_lb60.c')
-rw-r--r-- | sound/soc/jz4740/qi_lb60.c | 56 |
1 files changed, 26 insertions, 30 deletions
diff --git a/sound/soc/jz4740/qi_lb60.c b/sound/soc/jz4740/qi_lb60.c index 0097c3b13a1a..e8aaff18d7cc 100644 --- a/sound/soc/jz4740/qi_lb60.c +++ b/sound/soc/jz4740/qi_lb60.c | |||
@@ -91,56 +91,52 @@ static struct snd_soc_card qi_lb60 = { | |||
91 | .num_dapm_routes = ARRAY_SIZE(qi_lb60_routes), | 91 | .num_dapm_routes = ARRAY_SIZE(qi_lb60_routes), |
92 | }; | 92 | }; |
93 | 93 | ||
94 | static struct platform_device *qi_lb60_snd_device; | ||
95 | |||
96 | static const struct gpio qi_lb60_gpios[] = { | 94 | static const struct gpio qi_lb60_gpios[] = { |
97 | { QI_LB60_SND_GPIO, GPIOF_OUT_INIT_LOW, "SND" }, | 95 | { QI_LB60_SND_GPIO, GPIOF_OUT_INIT_LOW, "SND" }, |
98 | { QI_LB60_AMP_GPIO, GPIOF_OUT_INIT_LOW, "AMP" }, | 96 | { QI_LB60_AMP_GPIO, GPIOF_OUT_INIT_LOW, "AMP" }, |
99 | }; | 97 | }; |
100 | 98 | ||
101 | static int __init qi_lb60_init(void) | 99 | static int __devinit qi_lb60_probe(struct platform_device *pdev) |
102 | { | 100 | { |
101 | struct snd_soc_card *card = &qi_lb60; | ||
103 | int ret; | 102 | int ret; |
104 | 103 | ||
105 | qi_lb60_snd_device = platform_device_alloc("soc-audio", -1); | ||
106 | |||
107 | if (!qi_lb60_snd_device) | ||
108 | return -ENOMEM; | ||
109 | |||
110 | ret = gpio_request_array(qi_lb60_gpios, ARRAY_SIZE(qi_lb60_gpios)); | 104 | ret = gpio_request_array(qi_lb60_gpios, ARRAY_SIZE(qi_lb60_gpios)); |
111 | if (ret) { | 105 | if (ret) |
112 | pr_err("qi_lb60 snd: Failed to request gpios: %d\n", ret); | 106 | return ret; |
113 | goto err_device_put; | ||
114 | } | ||
115 | 107 | ||
116 | platform_set_drvdata(qi_lb60_snd_device, &qi_lb60); | 108 | card->dev = &pdev->dev; |
117 | 109 | ||
118 | ret = platform_device_add(qi_lb60_snd_device); | 110 | ret = snd_soc_register_card(card); |
119 | if (ret) { | 111 | if (ret) { |
120 | pr_err("qi_lb60 snd: Failed to add snd soc device: %d\n", ret); | 112 | dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", |
121 | goto err_unset_pdata; | 113 | ret); |
114 | gpio_free_array(qi_lb60_gpios, ARRAY_SIZE(qi_lb60_gpios)); | ||
122 | } | 115 | } |
123 | |||
124 | return 0; | ||
125 | |||
126 | err_unset_pdata: | ||
127 | platform_set_drvdata(qi_lb60_snd_device, NULL); | ||
128 | /*err_gpio_free_array:*/ | ||
129 | gpio_free_array(qi_lb60_gpios, ARRAY_SIZE(qi_lb60_gpios)); | ||
130 | err_device_put: | ||
131 | platform_device_put(qi_lb60_snd_device); | ||
132 | |||
133 | return ret; | 116 | return ret; |
134 | } | 117 | } |
135 | module_init(qi_lb60_init); | ||
136 | 118 | ||
137 | static void __exit qi_lb60_exit(void) | 119 | static int __devexit qi_lb60_remove(struct platform_device *pdev) |
138 | { | 120 | { |
139 | platform_device_unregister(qi_lb60_snd_device); | 121 | struct snd_soc_card *card = platform_get_drvdata(pdev); |
122 | |||
123 | snd_soc_unregister_card(card); | ||
140 | gpio_free_array(qi_lb60_gpios, ARRAY_SIZE(qi_lb60_gpios)); | 124 | gpio_free_array(qi_lb60_gpios, ARRAY_SIZE(qi_lb60_gpios)); |
125 | return 0; | ||
141 | } | 126 | } |
142 | module_exit(qi_lb60_exit); | 127 | |
128 | static struct platform_driver qi_lb60_driver = { | ||
129 | .driver = { | ||
130 | .name = "qi-lb60-audio", | ||
131 | .owner = THIS_MODULE, | ||
132 | }, | ||
133 | .probe = qi_lb60_probe, | ||
134 | .remove = __devexit_p(qi_lb60_remove), | ||
135 | }; | ||
136 | |||
137 | module_platform_driver(qi_lb60_driver); | ||
143 | 138 | ||
144 | MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>"); | 139 | MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>"); |
145 | MODULE_DESCRIPTION("ALSA SoC QI LB60 Audio support"); | 140 | MODULE_DESCRIPTION("ALSA SoC QI LB60 Audio support"); |
146 | MODULE_LICENSE("GPL v2"); | 141 | MODULE_LICENSE("GPL v2"); |
142 | MODULE_ALIAS("platform:qi-lb60-audio"); | ||