Release 4.7 drivers/mmc/core/pwrseq_simple.c
  
  
/*
 *  Copyright (C) 2014 Linaro Ltd
 *
 * Author: Ulf Hansson <ulf.hansson@linaro.org>
 *
 * License terms: GNU General Public License (GPL) version 2
 *
 *  Simple MMC power sequence management
 */
#include <linux/clk.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/platform_device.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/device.h>
#include <linux/err.h>
#include <linux/gpio/consumer.h>
#include <linux/mmc/host.h>
#include "pwrseq.h"
struct mmc_pwrseq_simple {
	
struct mmc_pwrseq pwrseq;
	
bool clk_enabled;
	
struct clk *ext_clk;
	
struct gpio_descs *reset_gpios;
};
#define to_pwrseq_simple(p) container_of(p, struct mmc_pwrseq_simple, pwrseq)
static void mmc_pwrseq_simple_set_gpios_value(struct mmc_pwrseq_simple *pwrseq,
					      int value)
{
	struct gpio_descs *reset_gpios = pwrseq->reset_gpios;
	if (!IS_ERR(reset_gpios)) {
		int i;
		int values[reset_gpios->ndescs];
		for (i = 0; i < reset_gpios->ndescs; i++)
			values[i] = value;
		gpiod_set_array_value_cansleep(
			reset_gpios->ndescs, reset_gpios->desc, values);
	}
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| javier martinez canillas | javier martinez canillas | 66 | 83.54% | 2 | 66.67% | 
| martin fuzzey | martin fuzzey | 13 | 16.46% | 1 | 33.33% | 
 | Total | 79 | 100.00% | 3 | 100.00% | 
static void mmc_pwrseq_simple_pre_power_on(struct mmc_host *host)
{
	struct mmc_pwrseq_simple *pwrseq = to_pwrseq_simple(host->pwrseq);
	if (!IS_ERR(pwrseq->ext_clk) && !pwrseq->clk_enabled) {
		clk_prepare_enable(pwrseq->ext_clk);
		pwrseq->clk_enabled = true;
	}
	mmc_pwrseq_simple_set_gpios_value(pwrseq, 1);
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| javier martinez canillas | javier martinez canillas | 31 | 51.67% | 2 | 50.00% | 
| ulf hansson | ulf hansson | 28 | 46.67% | 1 | 25.00% | 
| srinivas kandagatla | srinivas kandagatla | 1 | 1.67% | 1 | 25.00% | 
 | Total | 60 | 100.00% | 4 | 100.00% | 
static void mmc_pwrseq_simple_post_power_on(struct mmc_host *host)
{
	struct mmc_pwrseq_simple *pwrseq = to_pwrseq_simple(host->pwrseq);
	mmc_pwrseq_simple_set_gpios_value(pwrseq, 0);
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| ulf hansson | ulf hansson | 28 | 93.33% | 1 | 33.33% | 
| javier martinez canillas | javier martinez canillas | 1 | 3.33% | 1 | 33.33% | 
| srinivas kandagatla | srinivas kandagatla | 1 | 3.33% | 1 | 33.33% | 
 | Total | 30 | 100.00% | 3 | 100.00% | 
static void mmc_pwrseq_simple_power_off(struct mmc_host *host)
{
	struct mmc_pwrseq_simple *pwrseq = to_pwrseq_simple(host->pwrseq);
	mmc_pwrseq_simple_set_gpios_value(pwrseq, 1);
	if (!IS_ERR(pwrseq->ext_clk) && pwrseq->clk_enabled) {
		clk_disable_unprepare(pwrseq->ext_clk);
		pwrseq->clk_enabled = false;
	}
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| javier martinez canillas | javier martinez canillas | 58 | 98.31% | 1 | 50.00% | 
| srinivas kandagatla | srinivas kandagatla | 1 | 1.69% | 1 | 50.00% | 
 | Total | 59 | 100.00% | 2 | 100.00% | 
static const struct mmc_pwrseq_ops mmc_pwrseq_simple_ops = {
	.pre_power_on = mmc_pwrseq_simple_pre_power_on,
	.post_power_on = mmc_pwrseq_simple_post_power_on,
	.power_off = mmc_pwrseq_simple_power_off,
};
static const struct of_device_id mmc_pwrseq_simple_of_match[] = {
	{ .compatible = "mmc-pwrseq-simple",},
	{/* sentinel */},
};
MODULE_DEVICE_TABLE(of, mmc_pwrseq_simple_of_match);
static int mmc_pwrseq_simple_probe(struct platform_device *pdev)
{
	struct mmc_pwrseq_simple *pwrseq;
	struct device *dev = &pdev->dev;
	pwrseq = devm_kzalloc(dev, sizeof(*pwrseq), GFP_KERNEL);
	if (!pwrseq)
		return -ENOMEM;
	pwrseq->ext_clk = devm_clk_get(dev, "ext_clock");
	if (IS_ERR(pwrseq->ext_clk) && PTR_ERR(pwrseq->ext_clk) != -ENOENT)
		return PTR_ERR(pwrseq->ext_clk);
	pwrseq->reset_gpios = devm_gpiod_get_array(dev, "reset",
							GPIOD_OUT_HIGH);
	if (IS_ERR(pwrseq->reset_gpios) &&
	    PTR_ERR(pwrseq->reset_gpios) != -ENOENT &&
	    PTR_ERR(pwrseq->reset_gpios) != -ENOSYS) {
		return PTR_ERR(pwrseq->reset_gpios);
	}
	pwrseq->pwrseq.dev = dev;
	pwrseq->pwrseq.ops = &mmc_pwrseq_simple_ops;
	pwrseq->pwrseq.owner = THIS_MODULE;
	platform_set_drvdata(pdev, pwrseq);
	return mmc_pwrseq_register(&pwrseq->pwrseq);
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| ulf hansson | ulf hansson | 68 | 37.57% | 2 | 28.57% | 
| javier martinez canillas | javier martinez canillas | 48 | 26.52% | 3 | 42.86% | 
| srinivas kandagatla | srinivas kandagatla | 45 | 24.86% | 1 | 14.29% | 
| martin fuzzey | martin fuzzey | 20 | 11.05% | 1 | 14.29% | 
 | Total | 181 | 100.00% | 7 | 100.00% | 
static int mmc_pwrseq_simple_remove(struct platform_device *pdev)
{
	struct mmc_pwrseq_simple *pwrseq = platform_get_drvdata(pdev);
	mmc_pwrseq_unregister(&pwrseq->pwrseq);
	return 0;
}
Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| srinivas kandagatla | srinivas kandagatla | 25 | 78.12% | 1 | 33.33% | 
| ulf hansson | ulf hansson | 7 | 21.88% | 2 | 66.67% | 
 | Total | 32 | 100.00% | 3 | 100.00% | 
static struct platform_driver mmc_pwrseq_simple_driver = {
	.probe = mmc_pwrseq_simple_probe,
	.remove = mmc_pwrseq_simple_remove,
	.driver = {
		.name = "pwrseq_simple",
		.of_match_table = mmc_pwrseq_simple_of_match,
        },
};
module_platform_driver(mmc_pwrseq_simple_driver);
MODULE_LICENSE("GPL v2");
Overall Contributors
 | Person | Tokens | Prop | Commits | CommitProp | 
| javier martinez canillas | javier martinez canillas | 218 | 36.58% | 3 | 33.33% | 
| ulf hansson | ulf hansson | 188 | 31.54% | 2 | 22.22% | 
| srinivas kandagatla | srinivas kandagatla | 156 | 26.17% | 2 | 22.22% | 
| martin fuzzey | martin fuzzey | 33 | 5.54% | 1 | 11.11% | 
| julia lawall | julia lawall | 1 | 0.17% | 1 | 11.11% | 
 | Total | 596 | 100.00% | 9 | 100.00% | 
  
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.