>
>> +#define MC13783_REG_SW1A 0
>> +#define MC13783_REG_SW1B 1
>> +#define MC13783_REG_SW2A 2
>> +#define MC13783_REG_SW2B 3
>> +#define MC13783_REG_SW3 4
>> +#define MC13783_REG_PLL 5
>> +#define MC13783_REG_VAUDIO 6
>> +#define MC13783_REG_VIOHI 7
>> +#define MC13783_REG_VIOLO 8
>> +#define MC13783_REG_VDIG 9
>> +#define MC13783_REG_VGEN 10
>> +#define MC13783_REG_VRFDIG 11
>> +#define MC13783_REG_VRFREF 12
>> +#define MC13783_REG_VRFCP 13
>> +#define MC13783_REG_VSIM 14
>> +#define MC13783_REG_VESIM 15
>> +#define MC13783_REG_VCAM 16
>> +#define MC13783_REG_VRFBG 17
>> +#define MC13783_REG_VVIB 18
>> +#define MC13783_REG_VRF1 19
>> +#define MC13783_REG_VRF2 20
>> +#define MC13783_REG_VMMC1 21
>> +#define MC13783_REG_VMMC2 22
>> +#define MC13783_REG_GPO1 23
>> +#define MC13783_REG_GPO2 24
>> +#define MC13783_REG_GPO3 25
>> +#define MC13783_REG_GPO4 26
>> +#define MC13783_REG_V1 27
>> +#define MC13783_REG_V2 28
>> +#define MC13783_REG_V3 29
>> +#define MC13783_REG_V4 30
>> +#define MC13783_REG_PWGT1SPI 31
>> +#define MC13783_REG_PWGT2SPI 32
>>
>> #define MC13783_IRQ_ADCDONE MC13XXX_IRQ_ADCDONE
>> #define MC13783_IRQ_ADCBISDONE MC13XXX_IRQ_ADCBISDONE
>> diff --git a/include/linux/regulator/mc13xxx.h
>> b/include/linux/regulator/mc13xxx.h
>> new file mode 100644
>> index 0000000..a60c9be
>> --- /dev/null
>> +++ b/include/linux/regulator/mc13xxx.h
>
> The things in this file are private to the driver. IMO this should go to
> drivers/regulator/mc13xxx.h.
>
>> @@ -0,0 +1,101 @@
>> +/*
>> + * mc13xxx.h - regulators for the Freescale mc13xxx PMIC
>> + *
>> + * Copyright (C) 2010 Yong Shen <yong.shen@linaro.org>
>> + *
>> + * 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.
>> + */
>> +
>> +#ifndef __LINUX_REGULATOR_MC13XXX_H
>> +#define __LINUX_REGULATOR_MC13XXX_H
>> +
>> +#include <linux/regulator/driver.h>
>> +
>> +struct mc13xxx_regulator {
>> + struct regulator_desc desc;
>> + int reg;
>> + int enable_bit;
>> + int vsel_reg;
>> + int vsel_shift;
>> + int vsel_mask;
>> + int hi_bit;
>> + int const *voltages;
>> +};
>> +
>> +struct mc13xxx_regulator_priv {
>> + struct mc13xxx *mc13xxx;
>> + u32 powermisc_pwgt_state;
>> + struct mc13xxx_regulator *mc13xxx_regulators;
>> + struct regulator_dev *regulators[];
>> +};
>> +
>> +extern int mc13xxx_sw_regulator(struct regulator_dev *rdev);
>> +extern int mc13xxx_sw_regulator_is_enabled(struct regulator_dev *rdev);
>> +extern int mc13xxx_get_best_voltage_index(struct regulator_dev *rdev,
>> + int min_uV, int max_uV);
>> +extern int mc13xxx_regulator_list_voltage(struct regulator_dev *rdev,
>> + unsigned selector);
>> +extern int mc13xxx_fixed_regulator_set_voltage(struct regulator_dev *rdev,
>> + int min_uV, int max_uV);
>> +extern int mc13xxx_fixed_regulator_get_voltage(struct regulator_dev *rdev);
>> +
>> +extern struct regulator_ops mc13xxx_regulator_ops;
>> +extern struct regulator_ops mc13xxx_fixed_regulator_ops;
>> +
>> +#define MC13xxx_DEFINE(prefix, _name, _reg, _vsel_reg, _voltages, _ops) \
>> + [prefix ## _name] = { \
>> + .desc = { \
>> + .name = #prefix "_" #_name, \
>> + .n_voltages = ARRAY_SIZE(_voltages), \
>> + .ops = &_ops, \
>> + .type = REGULATOR_VOLTAGE, \
>> + .id = prefix ## _name, \
>> + .owner = THIS_MODULE, \
>> + }, \
>> + .reg = prefix ## _reg, \
>> + .enable_bit = prefix ## _reg ## _ ## _name ## EN, \
>> + .vsel_reg = prefix ## _vsel_reg, \
>> + .vsel_shift = prefix ## _vsel_reg ## _ ## _name ## VSEL,\
>> + .vsel_mask = prefix ## _vsel_reg ## _ ## _name ## VSEL_M,\
>> + .voltages = _voltages, \
>> + }
>> +
>> +#define MC13xxx_FIXED_DEFINE(prefix, _name, _reg, _voltages, _ops) \
>> + [prefix ## _name] = { \
>> + .desc = { \
>> + .name = #prefix "_" #_name, \
>> + .n_voltages = ARRAY_SIZE(_voltages), \
>> + .ops = &_ops, \
>> + .type = REGULATOR_VOLTAGE, \
>> + .id = prefix ## _name, \
>> + .owner = THIS_MODULE, \
>> + }, \
>> + .reg = prefix ## _reg, \
>> + .enable_bit = prefix ## _reg ## _ ## _name ## EN, \
>> + .voltages = _voltages, \
>> + }
>> +
>> +#define MC13xxx_GPO_DEFINE(prefix, _name, _reg, _voltages, _ops) \
>> + [prefix ## _name] = { \
>> + .desc = { \
>> + .name = #prefix "_" #_name, \
>> + .n_voltages = ARRAY_SIZE(_voltages), \
>> + .ops = &_ops, \
>> + .type = REGULATOR_VOLTAGE, \
>> + .id = prefix ## _name, \
>> + .owner = THIS_MODULE, \
>> + }, \
>> + .reg = prefix ## _reg, \
>> + .enable_bit = prefix ## _reg ## _ ## _name ## EN, \
>> + .voltages = _voltages, \
>> + }
>> +
>> +#define MC13xxx_DEFINE_SW(_name, _reg, _vsel_reg, _voltages, ops) \
>> + MC13xxx_DEFINE(SW, _name, _reg, _vsel_reg, _voltages, ops)
>> +#define MC13xxx_DEFINE_REGU(_name, _reg, _vsel_reg, _voltages, ops) \
>> + MC13xxx_DEFINE(REGU, _name, _reg, _vsel_reg, _voltages, ops)
>> +
>> +#endif
>> --
>> 1.7.0.4
>>
>> Cheers
>> Yong
>
>
>
> --
> Pengutronix e.K. | |
> Industrial Linux Solutions |
http://www.pengutronix.de/ |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
> Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
>