Release 4.7 drivers/gpio/gpio-max7301.c
/*
* Copyright (C) 2006 Juergen Beisert, Pengutronix
* Copyright (C) 2008 Guennadi Liakhovetski, Pengutronix
* Copyright (C) 2009 Wolfram Sang, Pengutronix
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* Check max730x.c for further details.
*/
#include <linux/module.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/mutex.h>
#include <linux/slab.h>
#include <linux/spi/spi.h>
#include <linux/spi/max7301.h>
/* A write to the MAX7301 means one message with one transfer */
static int max7301_spi_write(struct device *dev, unsigned int reg,
unsigned int val)
{
struct spi_device *spi = to_spi_device(dev);
u16 word = ((reg & 0x7F) << 8) | (val & 0xFF);
return spi_write(spi, (const u8 *)&word, sizeof(word));
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
juergen beisert | juergen beisert | 54 | 80.60% | 1 | 50.00% |
wolfram sang | wolfram sang | 13 | 19.40% | 1 | 50.00% |
| Total | 67 | 100.00% | 2 | 100.00% |
/* A read from the MAX7301 means two transfers; here, one message each */
static int max7301_spi_read(struct device *dev, unsigned int reg)
{
int ret;
u16 word;
struct spi_device *spi = to_spi_device(dev);
word = 0x8000 | (reg << 8);
ret = spi_write(spi, (const u8 *)&word, sizeof(word));
if (ret)
return ret;
/*
* This relies on the fact, that a transfer with NULL tx_buf shifts out
* zero bytes (=NOOP for MAX7301)
*/
ret = spi_read(spi, (u8 *)&word, sizeof(word));
if (ret)
return ret;
return word & 0xff;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
juergen beisert | juergen beisert | 81 | 81.00% | 1 | 50.00% |
wolfram sang | wolfram sang | 19 | 19.00% | 1 | 50.00% |
| Total | 100 | 100.00% | 2 | 100.00% |
static int max7301_probe(struct spi_device *spi)
{
struct max7301 *ts;
int ret;
/* bits_per_word cannot be configured in platform data */
spi->bits_per_word = 16;
ret = spi_setup(spi);
if (ret < 0)
return ret;
ts = devm_kzalloc(&spi->dev, sizeof(struct max7301), GFP_KERNEL);
if (!ts)
return -ENOMEM;
ts->read = max7301_spi_read;
ts->write = max7301_spi_write;
ts->dev = &spi->dev;
ret = __max730x_probe(ts);
return ret;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
juergen beisert | juergen beisert | 87 | 87.00% | 1 | 25.00% |
wolfram sang | wolfram sang | 6 | 6.00% | 1 | 25.00% |
jingoo han | jingoo han | 6 | 6.00% | 1 | 25.00% |
dmitry eremin-baryshkov | dmitry eremin-baryshkov | 1 | 1.00% | 1 | 25.00% |
| Total | 100 | 100.00% | 4 | 100.00% |
static int max7301_remove(struct spi_device *spi)
{
return __max730x_remove(&spi->dev);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
juergen beisert | juergen beisert | 17 | 85.00% | 1 | 50.00% |
wolfram sang | wolfram sang | 3 | 15.00% | 1 | 50.00% |
| Total | 20 | 100.00% | 2 | 100.00% |
static const struct spi_device_id max7301_id[] = {
{ "max7301", 0 },
{ }
};
MODULE_DEVICE_TABLE(spi, max7301_id);
static struct spi_driver max7301_driver = {
.driver = {
.name = "max7301",
},
.probe = max7301_probe,
.remove = max7301_remove,
.id_table = max7301_id,
};
static int __init max7301_init(void)
{
return spi_register_driver(&max7301_driver);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
juergen beisert | juergen beisert | 16 | 100.00% | 1 | 100.00% |
| Total | 16 | 100.00% | 1 | 100.00% |
/* register after spi postcore initcall and before
* subsys initcalls that may rely on these GPIOs
*/
subsys_initcall(max7301_init);
static void __exit max7301_exit(void)
{
spi_unregister_driver(&max7301_driver);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
juergen beisert | juergen beisert | 15 | 100.00% | 1 | 100.00% |
| Total | 15 | 100.00% | 1 | 100.00% |
module_exit(max7301_exit);
MODULE_AUTHOR("Juergen Beisert, Wolfram Sang");
MODULE_LICENSE("GPL v2");
MODULE_DESCRIPTION("MAX7301 GPIO-Expander");
Overall Contributors
| Person | Tokens | Prop | Commits | CommitProp |
juergen beisert | juergen beisert | 334 | 78.77% | 1 | 12.50% |
wolfram sang | wolfram sang | 71 | 16.75% | 1 | 12.50% |
jingoo han | jingoo han | 6 | 1.42% | 1 | 12.50% |
david brownell | david brownell | 6 | 1.42% | 1 | 12.50% |
tejun heo | tejun heo | 3 | 0.71% | 1 | 12.50% |
anton vorontsov | anton vorontsov | 2 | 0.47% | 1 | 12.50% |
grant likely | grant likely | 1 | 0.24% | 1 | 12.50% |
dmitry eremin-baryshkov | dmitry eremin-baryshkov | 1 | 0.24% | 1 | 12.50% |
| Total | 424 | 100.00% | 8 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.