spi.c (1d207cd30b65fdd60d952cb9e100b6f776564f06) spi.c (e4c2e09e1534835c749de362b9b38e2d8b286236)
1/*
2 * This file is part of wl1251
3 *
4 * Copyright (C) 2008 Nokia Corporation
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.

--- 13 unchanged lines hidden (view full) ---

22#include <linux/interrupt.h>
23#include <linux/irq.h>
24#include <linux/module.h>
25#include <linux/slab.h>
26#include <linux/crc7.h>
27#include <linux/spi/spi.h>
28#include <linux/wl12xx.h>
29#include <linux/gpio.h>
1/*
2 * This file is part of wl1251
3 *
4 * Copyright (C) 2008 Nokia Corporation
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.

--- 13 unchanged lines hidden (view full) ---

22#include <linux/interrupt.h>
23#include <linux/irq.h>
24#include <linux/module.h>
25#include <linux/slab.h>
26#include <linux/crc7.h>
27#include <linux/spi/spi.h>
28#include <linux/wl12xx.h>
29#include <linux/gpio.h>
30#include <linux/regulator/consumer.h>
30
31#include "wl1251.h"
32#include "reg.h"
33#include "spi.h"
34
35static irqreturn_t wl1251_irq(int irq, void *cookie)
36{
37 struct wl1251 *wl;

--- 263 unchanged lines hidden (view full) ---

301 DRIVER_NAME, wl);
302 if (ret < 0) {
303 wl1251_error("request_irq() failed: %d", ret);
304 goto out_free;
305 }
306
307 irq_set_irq_type(wl->irq, IRQ_TYPE_EDGE_RISING);
308
31
32#include "wl1251.h"
33#include "reg.h"
34#include "spi.h"
35
36static irqreturn_t wl1251_irq(int irq, void *cookie)
37{
38 struct wl1251 *wl;

--- 263 unchanged lines hidden (view full) ---

302 DRIVER_NAME, wl);
303 if (ret < 0) {
304 wl1251_error("request_irq() failed: %d", ret);
305 goto out_free;
306 }
307
308 irq_set_irq_type(wl->irq, IRQ_TYPE_EDGE_RISING);
309
309 ret = wl1251_init_ieee80211(wl);
310 wl->vio = devm_regulator_get(&spi->dev, "vio");
311 if (IS_ERR(wl->vio)) {
312 ret = PTR_ERR(wl->vio);
313 wl1251_error("vio regulator missing: %d", ret);
314 goto out_free;
315 }
316
317 ret = regulator_enable(wl->vio);
310 if (ret)
311 goto out_free;
312
318 if (ret)
319 goto out_free;
320
321 ret = wl1251_init_ieee80211(wl);
322 if (ret)
323 goto disable_regulator;
324
313 return 0;
314
325 return 0;
326
315 out_free:
327disable_regulator:
328 regulator_disable(wl->vio);
329out_free:
316 ieee80211_free_hw(hw);
317
318 return ret;
319}
320
321static int wl1251_spi_remove(struct spi_device *spi)
322{
323 struct wl1251 *wl = spi_get_drvdata(spi);
324
325 free_irq(wl->irq, wl);
326 wl1251_free_hw(wl);
330 ieee80211_free_hw(hw);
331
332 return ret;
333}
334
335static int wl1251_spi_remove(struct spi_device *spi)
336{
337 struct wl1251 *wl = spi_get_drvdata(spi);
338
339 free_irq(wl->irq, wl);
340 wl1251_free_hw(wl);
341 regulator_disable(wl->vio);
327
328 return 0;
329}
330
331static struct spi_driver wl1251_spi_driver = {
332 .driver = {
333 .name = DRIVER_NAME,
334 .owner = THIS_MODULE,
335 },
336
337 .probe = wl1251_spi_probe,
338 .remove = wl1251_spi_remove,
339};
340
341module_spi_driver(wl1251_spi_driver);
342
343MODULE_LICENSE("GPL");
344MODULE_AUTHOR("Kalle Valo <kvalo@adurom.com>");
345MODULE_ALIAS("spi:wl1251");
342
343 return 0;
344}
345
346static struct spi_driver wl1251_spi_driver = {
347 .driver = {
348 .name = DRIVER_NAME,
349 .owner = THIS_MODULE,
350 },
351
352 .probe = wl1251_spi_probe,
353 .remove = wl1251_spi_remove,
354};
355
356module_spi_driver(wl1251_spi_driver);
357
358MODULE_LICENSE("GPL");
359MODULE_AUTHOR("Kalle Valo <kvalo@adurom.com>");
360MODULE_ALIAS("spi:wl1251");