Release 4.12 drivers/mfd/wm8400-core.c
  
  
  
/*
 * Core driver for WM8400.
 *
 * Copyright 2008 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/module.h>
#include <linux/bug.h>
#include <linux/err.h>
#include <linux/i2c.h>
#include <linux/kernel.h>
#include <linux/mfd/core.h>
#include <linux/mfd/wm8400-private.h>
#include <linux/mfd/wm8400-audio.h>
#include <linux/regmap.h>
#include <linux/slab.h>
static bool wm8400_volatile(struct device *dev, unsigned int reg)
{
	switch (reg) {
	case WM8400_INTERRUPT_STATUS_1:
	case WM8400_INTERRUPT_LEVELS:
	case WM8400_SHUTDOWN_REASON:
		return true;
	default:
		return false;
	}
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Mark Brown | 37 | 100.00% | 2 | 100.00% | 
| Total | 37 | 100.00% | 2 | 100.00% | 
int wm8400_block_read(struct wm8400 *wm8400, u8 reg, int count, u16 *data)
{
	return regmap_bulk_read(wm8400->regmap, reg, data, count);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Mark Brown | 34 | 100.00% | 2 | 100.00% | 
| Total | 34 | 100.00% | 2 | 100.00% | 
EXPORT_SYMBOL_GPL(wm8400_block_read);
static int wm8400_register_codec(struct wm8400 *wm8400)
{
	const struct mfd_cell cell = {
		.name = "wm8400-codec",
		.platform_data = wm8400,
		.pdata_size = sizeof(*wm8400),
        };
	return devm_mfd_add_devices(wm8400->dev, -1, &cell, 1, NULL, 0, NULL);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Mark Brown | 47 | 79.66% | 2 | 40.00% | 
| Samuel Ortiz | 10 | 16.95% | 1 | 20.00% | 
| Laxman Dewangan | 1 | 1.69% | 1 | 20.00% | 
| Krzysztof Kozlowski | 1 | 1.69% | 1 | 20.00% | 
| Total | 59 | 100.00% | 5 | 100.00% | 
/*
 * wm8400_init - Generic initialisation
 *
 * The WM8400 can be configured as either an I2C or SPI device.  Probe
 * functions for each bus set up the accessors then call into this to
 * set up the device itself.
 */
static int wm8400_init(struct wm8400 *wm8400,
		       struct wm8400_platform_data *pdata)
{
	unsigned int reg;
	int ret;
	dev_set_drvdata(wm8400->dev, wm8400);
	/* Check that this is actually a WM8400 */
	ret = regmap_read(wm8400->regmap, WM8400_RESET_ID, ®);
	if (ret != 0) {
		dev_err(wm8400->dev, "Chip ID register read failed\n");
		return -EIO;
	}
	if (reg != 0x6172) {
		dev_err(wm8400->dev, "Device is not a WM8400, ID is %x\n",
			reg);
		return -ENODEV;
	}
	ret = regmap_read(wm8400->regmap, WM8400_ID, ®);
	if (ret != 0) {
		dev_err(wm8400->dev, "ID register read failed: %d\n", ret);
		return ret;
	}
	reg = (reg & WM8400_CHIP_REV_MASK) >> WM8400_CHIP_REV_SHIFT;
	dev_info(wm8400->dev, "WM8400 revision %x\n", reg);
	ret = wm8400_register_codec(wm8400);
	if (ret != 0) {
		dev_err(wm8400->dev, "Failed to register codec\n");
		return ret;
	}
	if (pdata && pdata->platform_init) {
		ret = pdata->platform_init(wm8400->dev);
		if (ret != 0) {
			dev_err(wm8400->dev, "Platform init failed: %d\n",
				ret);
			return ret;
		}
	} else
		dev_warn(wm8400->dev, "No platform initialisation supplied\n");
	return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Mark Brown | 221 | 95.67% | 4 | 66.67% | 
| Laxman Dewangan | 6 | 2.60% | 1 | 16.67% | 
| Greg Kroah-Hartman | 4 | 1.73% | 1 | 16.67% | 
| Total | 231 | 100.00% | 6 | 100.00% | 
static const struct regmap_config wm8400_regmap_config = {
	.reg_bits = 8,
	.val_bits = 16,
	.max_register = WM8400_REGISTER_COUNT - 1,
	.volatile_reg = wm8400_volatile,
	.cache_type = REGCACHE_RBTREE,
};
/**
 * wm8400_reset_codec_reg_cache - Reset cached codec registers to
 * their default values.
 */
void wm8400_reset_codec_reg_cache(struct wm8400 *wm8400)
{
	regmap_reinit_cache(wm8400->regmap, &wm8400_regmap_config);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Mark Brown | 20 | 100.00% | 1 | 100.00% | 
| Total | 20 | 100.00% | 1 | 100.00% | 
EXPORT_SYMBOL_GPL(wm8400_reset_codec_reg_cache);
#if IS_ENABLED(CONFIG_I2C)
static int wm8400_i2c_probe(struct i2c_client *i2c,
			    const struct i2c_device_id *id)
{
	struct wm8400 *wm8400;
	wm8400 = devm_kzalloc(&i2c->dev, sizeof(struct wm8400), GFP_KERNEL);
	if (!wm8400)
		return -ENOMEM;
	wm8400->regmap = devm_regmap_init_i2c(i2c, &wm8400_regmap_config);
	if (IS_ERR(wm8400->regmap))
		return PTR_ERR(wm8400->regmap);
	wm8400->dev = &i2c->dev;
	i2c_set_clientdata(i2c, wm8400);
	return wm8400_init(wm8400, dev_get_platdata(&i2c->dev));
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Mark Brown | 98 | 90.74% | 4 | 66.67% | 
| Sachin Kamat | 6 | 5.56% | 1 | 16.67% | 
| Jingoo Han | 4 | 3.70% | 1 | 16.67% | 
| Total | 108 | 100.00% | 6 | 100.00% | 
static const struct i2c_device_id wm8400_i2c_id[] = {
       { "wm8400", 0 },
       { }
};
MODULE_DEVICE_TABLE(i2c, wm8400_i2c_id);
static struct i2c_driver wm8400_i2c_driver = {
	.driver = {
		.name = "WM8400",
        },
	.probe    = wm8400_i2c_probe,
	.id_table = wm8400_i2c_id,
};
#endif
static int __init wm8400_module_init(void)
{
	int ret = -ENODEV;
#if IS_ENABLED(CONFIG_I2C)
	ret = i2c_add_driver(&wm8400_i2c_driver);
	if (ret != 0)
		pr_err("Failed to register I2C driver: %d\n", ret);
#endif
	return ret;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Mark Brown | 46 | 97.87% | 1 | 50.00% | 
| Javier Martinez Canillas | 1 | 2.13% | 1 | 50.00% | 
| Total | 47 | 100.00% | 2 | 100.00% | 
subsys_initcall(wm8400_module_init);
static void __exit wm8400_module_exit(void)
{
#if IS_ENABLED(CONFIG_I2C)
	i2c_del_driver(&wm8400_i2c_driver);
#endif
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Mark Brown | 22 | 95.65% | 1 | 50.00% | 
| Javier Martinez Canillas | 1 | 4.35% | 1 | 50.00% | 
| Total | 23 | 100.00% | 2 | 100.00% | 
module_exit(wm8400_module_exit);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>");
Overall Contributors
| Person | Tokens | Prop | Commits | CommitProp | 
| Mark Brown | 674 | 94.13% | 8 | 44.44% | 
| Samuel Ortiz | 11 | 1.54% | 2 | 11.11% | 
| Laxman Dewangan | 7 | 0.98% | 1 | 5.56% | 
| Sachin Kamat | 6 | 0.84% | 1 | 5.56% | 
| Jingoo Han | 4 | 0.56% | 1 | 5.56% | 
| Greg Kroah-Hartman | 4 | 0.56% | 1 | 5.56% | 
| Tejun Heo | 3 | 0.42% | 1 | 5.56% | 
| Paul Gortmaker | 3 | 0.42% | 1 | 5.56% | 
| Javier Martinez Canillas | 3 | 0.42% | 1 | 5.56% | 
| Krzysztof Kozlowski | 1 | 0.14% | 1 | 5.56% | 
| Total | 716 | 100.00% | 18 | 100.00% | 
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.