Release 4.7 drivers/mfd/wm831x-spi.c
/*
* wm831x-spi.c -- SPI access for Wolfson WM831x PMICs
*
* Copyright 2009,2010 Wolfson Microelectronics PLC.
*
* Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/pm.h>
#include <linux/spi/spi.h>
#include <linux/regmap.h>
#include <linux/err.h>
#include <linux/mfd/wm831x/core.h>
static int wm831x_spi_probe(struct spi_device *spi)
{
const struct spi_device_id *id = spi_get_device_id(spi);
struct wm831x *wm831x;
enum wm831x_parent type;
int ret;
type = (enum wm831x_parent)id->driver_data;
wm831x = devm_kzalloc(&spi->dev, sizeof(struct wm831x), GFP_KERNEL);
if (wm831x == NULL)
return -ENOMEM;
spi->mode = SPI_MODE_0;
spi_set_drvdata(spi, wm831x);
wm831x->dev = &spi->dev;
wm831x->regmap = devm_regmap_init_spi(spi, &wm831x_regmap_config);
if (IS_ERR(wm831x->regmap)) {
ret = PTR_ERR(wm831x->regmap);
dev_err(wm831x->dev, "Failed to allocate register map: %d\n",
ret);
return ret;
}
return wm831x_device_init(wm831x, type, spi->irq);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
mark brown | mark brown | 151 | 99.34% | 5 | 83.33% |
jingoo han | jingoo han | 1 | 0.66% | 1 | 16.67% |
| Total | 152 | 100.00% | 6 | 100.00% |
static int wm831x_spi_remove(struct spi_device *spi)
{
struct wm831x *wm831x = spi_get_drvdata(spi);
wm831x_device_exit(wm831x);
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
mark brown | mark brown | 28 | 96.55% | 1 | 50.00% |
jingoo han | jingoo han | 1 | 3.45% | 1 | 50.00% |
| Total | 29 | 100.00% | 2 | 100.00% |
static int wm831x_spi_suspend(struct device *dev)
{
struct wm831x *wm831x = dev_get_drvdata(dev);
return wm831x_device_suspend(wm831x);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
mark brown | mark brown | 27 | 100.00% | 2 | 100.00% |
| Total | 27 | 100.00% | 2 | 100.00% |
static int wm831x_spi_poweroff(struct device *dev)
{
struct wm831x *wm831x = dev_get_drvdata(dev);
wm831x_device_shutdown(wm831x);
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
mark brown | mark brown | 29 | 100.00% | 2 | 100.00% |
| Total | 29 | 100.00% | 2 | 100.00% |
static const struct dev_pm_ops wm831x_spi_pm = {
.freeze = wm831x_spi_suspend,
.suspend = wm831x_spi_suspend,
.poweroff = wm831x_spi_poweroff,
};
static const struct spi_device_id wm831x_spi_ids[] = {
{ "wm8310", WM8310 },
{ "wm8311", WM8311 },
{ "wm8312", WM8312 },
{ "wm8320", WM8320 },
{ "wm8321", WM8321 },
{ "wm8325", WM8325 },
{ "wm8326", WM8326 },
{ },
};
MODULE_DEVICE_TABLE(spi, wm831x_spi_ids);
static struct spi_driver wm831x_spi_driver = {
.driver = {
.name = "wm831x",
.pm = &wm831x_spi_pm,
},
.id_table = wm831x_spi_ids,
.probe = wm831x_spi_probe,
.remove = wm831x_spi_remove,
};
static int __init wm831x_spi_init(void)
{
int ret;
ret = spi_register_driver(&wm831x_spi_driver);
if (ret != 0)
pr_err("Failed to register WM831x SPI driver: %d\n", ret);
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
mark brown | mark brown | 36 | 100.00% | 3 | 100.00% |
| Total | 36 | 100.00% | 3 | 100.00% |
subsys_initcall(wm831x_spi_init);
static void __exit wm831x_spi_exit(void)
{
spi_unregister_driver(&wm831x_spi_driver);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
mark brown | mark brown | 15 | 100.00% | 2 | 100.00% |
| Total | 15 | 100.00% | 2 | 100.00% |
module_exit(wm831x_spi_exit);
MODULE_DESCRIPTION("SPI support for WM831x/2x AudioPlus PMICs");
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Mark Brown");
Overall Contributors
| Person | Tokens | Prop | Commits | CommitProp |
mark brown | mark brown | 453 | 99.34% | 9 | 81.82% |
jingoo han | jingoo han | 2 | 0.44% | 1 | 9.09% |
hai dong | hai dong | 1 | 0.22% | 1 | 9.09% |
| Total | 456 | 100.00% | 11 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.