},
 };
 
+static struct gpiod_lookup_table h1940_audio_gpio_table = {
+       .dev_id = "h1940-audio",
+       .table = {
+               GPIO_LOOKUP("H1940_LATCH",
+                           H1940_LATCH_AUDIO_POWER - H1940_LATCH_GPIO(0),
+                           "speaker-power", GPIO_ACTIVE_HIGH),
+               GPIO_LOOKUP("GPIOG", 4, "hp", GPIO_ACTIVE_HIGH),
+               { },
+       },
+};
+
+static struct platform_device h1940_audio = {
+       .name = "h1940-audio",
+       .id   = -1,
+};
+
 static struct pwm_lookup h1940_pwm_lookup[] = {
        PWM_LOOKUP("samsung-pwm", 0, "pwm-backlight", NULL, 36296,
                   PWM_POLARITY_NORMAL),
        &s3c_device_ts,
        &power_supply,
        &h1940_battery,
+       &h1940_audio,
 };
 
 static void __init h1940_map_io(void)
 
        s3c24xx_fb_set_platdata(&h1940_fb_info);
        gpiod_add_lookup_table(&h1940_mmc_gpio_table);
+       gpiod_add_lookup_table(&h1940_audio_gpio_table);
        s3c24xx_mci_set_platdata(&h1940_mmc_cfg);
        s3c24xx_udc_set_platdata(&h1940_udc_cfg);
        s3c24xx_ts_set_platdata(&h1940_ts_cfg);
 
 #include <sound/jack.h>
 
 #include "regs-iis.h"
-#include <asm/mach-types.h>
-
-#include <mach/gpio-samsung.h>
 #include "s3c24xx-i2s.h"
 
 static const unsigned int rates[] = {
        .list = rates,
 };
 
+static struct gpio_desc *gpiod_speaker_power;
+
 static struct snd_soc_jack hp_jack;
 
 static struct snd_soc_jack_pin hp_jack_pins[] = {
 
 static struct snd_soc_jack_gpio hp_jack_gpios[] = {
        {
-               .gpio                   = S3C2410_GPG(4),
                .name                   = "hp-gpio",
                .report                 = SND_JACK_HEADPHONE,
                .invert                 = 1,
                                struct snd_kcontrol *kcontrol, int event)
 {
        if (SND_SOC_DAPM_EVENT_ON(event))
-               gpio_set_value(S3C_GPIO_END + 9, 1);
+               gpiod_set_value(gpiod_speaker_power, 1);
        else
-               gpio_set_value(S3C_GPIO_END + 9, 0);
+               gpiod_set_value(gpiod_speaker_power, 0);
 
        return 0;
 }
        {"VINM", NULL, "Mic Jack"},
 };
 
-static struct platform_device *s3c24xx_snd_device;
-
 static int h1940_uda1380_init(struct snd_soc_pcm_runtime *rtd)
 {
        snd_soc_card_jack_new(rtd->card, "Headphone Jack", SND_JACK_HEADPHONE,
        .num_dapm_routes = ARRAY_SIZE(audio_map),
 };
 
-static int __init h1940_init(void)
+static int h1940_probe(struct platform_device *pdev)
 {
-       int ret;
+       struct device *dev = &pdev->dev;
 
-       if (!machine_is_h1940())
-               return -ENODEV;
+       h1940_asoc.dev = dev;
+       hp_jack_gpios[0].gpiod_dev = dev;
+       gpiod_speaker_power = devm_gpiod_get(&pdev->dev, "speaker-power",
+                                            GPIOD_OUT_LOW);
 
-       /* configure some gpios */
-       ret = gpio_request(S3C_GPIO_END + 9, "speaker-power");
-       if (ret)
-               goto err_out;
-
-       ret = gpio_direction_output(S3C_GPIO_END + 9, 0);
-       if (ret)
-               goto err_gpio;
-
-       s3c24xx_snd_device = platform_device_alloc("soc-audio", -1);
-       if (!s3c24xx_snd_device) {
-               ret = -ENOMEM;
-               goto err_gpio;
+       if (IS_ERR(gpiod_speaker_power)) {
+               dev_err(dev, "Could not get gpio\n");
+               return PTR_ERR(gpiod_speaker_power);
        }
 
-       platform_set_drvdata(s3c24xx_snd_device, &h1940_asoc);
-       ret = platform_device_add(s3c24xx_snd_device);
-
-       if (ret)
-               goto err_plat;
-
-       return 0;
-
-err_plat:
-       platform_device_put(s3c24xx_snd_device);
-err_gpio:
-       gpio_free(S3C_GPIO_END + 9);
-
-err_out:
-       return ret;
-}
-
-static void __exit h1940_exit(void)
-{
-       platform_device_unregister(s3c24xx_snd_device);
-       gpio_free(S3C_GPIO_END + 9);
+       return devm_snd_soc_register_card(dev, &h1940_asoc);
 }
 
-module_init(h1940_init);
-module_exit(h1940_exit);
+static struct platform_driver h1940_audio_driver = {
+       .driver = {
+               .name = "h1940-audio",
+               .pm = &snd_soc_pm_ops,
+       },
+       .probe = h1940_probe,
+};
+module_platform_driver(h1940_audio_driver);
 
 /* Module information */
 MODULE_AUTHOR("Arnaud Patard, Vasily Khoruzhick");
 MODULE_DESCRIPTION("ALSA SoC H1940");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:h1940-audio");