cregit-Linux how code gets into the kernel

Release 4.7 drivers/mfd/mc13xxx-i2c.c

Directory: drivers/mfd
/*
 * Copyright 2009-2010 Creative Product Design
 * Marc Reilly marc@cpdesign.com.au
 *
 * 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.
 */

#include <linux/slab.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/mfd/core.h>
#include <linux/mfd/mc13xxx.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/of_gpio.h>
#include <linux/i2c.h>
#include <linux/err.h>

#include "mc13xxx.h"


static const struct i2c_device_id mc13xxx_i2c_device_id[] = {
	{
		.name = "mc13892",
		.driver_data = (kernel_ulong_t)&mc13xxx_variant_mc13892,
        }, {
		.name = "mc34708",
		.driver_data = (kernel_ulong_t)&mc13xxx_variant_mc34708,
        }, {
		/* sentinel */
	}
};
MODULE_DEVICE_TABLE(i2c, mc13xxx_i2c_device_id);


static const struct of_device_id mc13xxx_dt_ids[] = {
	{
		.compatible = "fsl,mc13892",
		.data = &mc13xxx_variant_mc13892,
        }, {
		.compatible = "fsl,mc34708",
		.data = &mc13xxx_variant_mc34708,
        }, {
		/* sentinel */
	}
};
MODULE_DEVICE_TABLE(of, mc13xxx_dt_ids);


static const struct regmap_config mc13xxx_regmap_i2c_config = {
	.reg_bits = 8,
	.val_bits = 24,

	.max_register = MC13XXX_NUMREGS,

	.cache_type = REGCACHE_NONE,
};


static int mc13xxx_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct mc13xxx *mc13xxx; int ret; mc13xxx = devm_kzalloc(&client->dev, sizeof(*mc13xxx), GFP_KERNEL); if (!mc13xxx) return -ENOMEM; dev_set_drvdata(&client->dev, mc13xxx); mc13xxx->irq = client->irq; mc13xxx->regmap = devm_regmap_init_i2c(client, &mc13xxx_regmap_i2c_config); if (IS_ERR(mc13xxx->regmap)) { ret = PTR_ERR(mc13xxx->regmap); dev_err(&client->dev, "Failed to initialize regmap: %d\n", ret); return ret; } if (client->dev.of_node) { const struct of_device_id *of_id = of_match_device(mc13xxx_dt_ids, &client->dev); mc13xxx->variant = of_id->data; } else { mc13xxx->variant = (void *)id->driver_data; } return mc13xxx_common_init(&client->dev); }

Contributors

PersonTokensPropCommitsCommitProp
marc reillymarc reilly11867.43%125.00%
uwe kleine-koeniguwe kleine-koenig4224.00%125.00%
alexander shiyanalexander shiyan84.57%125.00%
axel linaxel lin74.00%125.00%
Total175100.00%4100.00%


static int mc13xxx_i2c_remove(struct i2c_client *client) { return mc13xxx_common_exit(&client->dev); }

Contributors

PersonTokensPropCommitsCommitProp
marc reillymarc reilly1890.00%150.00%
alexander shiyanalexander shiyan210.00%150.00%
Total20100.00%2100.00%

static struct i2c_driver mc13xxx_i2c_driver = { .id_table = mc13xxx_i2c_device_id, .driver = { .name = "mc13xxx", .of_match_table = mc13xxx_dt_ids, }, .probe = mc13xxx_i2c_probe, .remove = mc13xxx_i2c_remove, };
static int __init mc13xxx_i2c_init(void) { return i2c_add_driver(&mc13xxx_i2c_driver); }

Contributors

PersonTokensPropCommitsCommitProp
marc reillymarc reilly16100.00%1100.00%
Total16100.00%1100.00%

subsys_initcall(mc13xxx_i2c_init);
static void __exit mc13xxx_i2c_exit(void) { i2c_del_driver(&mc13xxx_i2c_driver); }

Contributors

PersonTokensPropCommitsCommitProp
marc reillymarc reilly15100.00%1100.00%
Total15100.00%1100.00%

module_exit(mc13xxx_i2c_exit); MODULE_DESCRIPTION("i2c driver for Freescale MC13XXX PMIC"); MODULE_AUTHOR("Marc Reilly <marc@cpdesign.com.au"); MODULE_LICENSE("GPL v2");

Overall Contributors

PersonTokensPropCommitsCommitProp
marc reillymarc reilly35980.13%116.67%
uwe kleine-koeniguwe kleine-koenig7115.85%233.33%
alexander shiyanalexander shiyan102.23%116.67%
axel linaxel lin71.56%116.67%
krzysztof kozlowskikrzysztof kozlowski10.22%116.67%
Total448100.00%6100.00%
Directory: drivers/mfd
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
{% endraw %}