Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 302218
b: refs/heads/master
c: 06c4998
h: refs/heads/master
v: v3
  • Loading branch information
Axel Lin authored and Mark Brown committed Apr 18, 2012
1 parent 8010672 commit 917527b
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 69 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ee7b19142d0e7b88a981fd50b9b8758f697b459e
refs/heads/master: 06c4998be96f2e1f304cf79d5e9d1662d864f7d1
11 changes: 0 additions & 11 deletions trunk/drivers/mfd/tps65090.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,6 @@ static struct mfd_cell tps65090s[] = {
},
};

struct tps65090 {
struct mutex lock;
struct device *dev;
struct i2c_client *client;
struct regmap *rmap;
struct irq_chip irq_chip;
struct mutex irq_lock;
int irq_base;
unsigned int id;
};

int tps65090_write(struct device *dev, int reg, uint8_t val)
{
struct tps65090 *tps = dev_get_drvdata(dev);
Expand Down
64 changes: 7 additions & 57 deletions trunk/drivers/regulator/tps65090-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,82 +29,30 @@

struct tps65090_regulator {
int id;
/* Regulator register address.*/
u8 reg_en_reg;
u8 en_bit;

/* used by regulator core */
struct regulator_desc desc;

/* Device */
struct device *dev;
};

static inline struct device *to_tps65090_dev(struct regulator_dev *rdev)
{
return rdev_get_dev(rdev)->parent->parent;
}

static int tps65090_reg_is_enabled(struct regulator_dev *rdev)
{
struct tps65090_regulator *ri = rdev_get_drvdata(rdev);
struct device *parent = to_tps65090_dev(rdev);
uint8_t control;
int ret;

ret = tps65090_read(parent, ri->reg_en_reg, &control);
if (ret < 0) {
dev_err(&rdev->dev, "Error in reading reg 0x%x\n",
ri->reg_en_reg);
return ret;
}
return (((control >> ri->en_bit) & 1) == 1);
}

static int tps65090_reg_enable(struct regulator_dev *rdev)
{
struct tps65090_regulator *ri = rdev_get_drvdata(rdev);
struct device *parent = to_tps65090_dev(rdev);
int ret;

ret = tps65090_set_bits(parent, ri->reg_en_reg, ri->en_bit);
if (ret < 0)
dev_err(&rdev->dev, "Error in updating reg 0x%x\n",
ri->reg_en_reg);
return ret;
}

static int tps65090_reg_disable(struct regulator_dev *rdev)
{
struct tps65090_regulator *ri = rdev_get_drvdata(rdev);
struct device *parent = to_tps65090_dev(rdev);
int ret;

ret = tps65090_clr_bits(parent, ri->reg_en_reg, ri->en_bit);
if (ret < 0)
dev_err(&rdev->dev, "Error in updating reg 0x%x\n",
ri->reg_en_reg);

return ret;
}

static struct regulator_ops tps65090_ops = {
.enable = tps65090_reg_enable,
.disable = tps65090_reg_disable,
.is_enabled = tps65090_reg_is_enabled,
.enable = regulator_enable_regmap,
.disable = regulator_disable_regmap,
.is_enabled = regulator_is_enabled_regmap,
};

#define tps65090_REG(_id) \
{ \
.reg_en_reg = (TPS65090_ID_##_id) + 12, \
.en_bit = 0, \
.id = TPS65090_ID_##_id, \
.desc = { \
.name = tps65090_rails(_id), \
.id = TPS65090_ID_##_id, \
.ops = &tps65090_ops, \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
.enable_reg = (TPS65090_ID_##_id) + 12, \
.enable_mask = BIT(0), \
}, \
}

Expand Down Expand Up @@ -136,6 +84,7 @@ static inline struct tps65090_regulator *find_regulator_info(int id)

static int __devinit tps65090_regulator_probe(struct platform_device *pdev)
{
struct tps65090 *tps65090_mfd = dev_get_drvdata(pdev->dev.parent);
struct tps65090_regulator *ri = NULL;
struct regulator_config config = { };
struct regulator_dev *rdev;
Expand All @@ -155,6 +104,7 @@ static int __devinit tps65090_regulator_probe(struct platform_device *pdev)
config.dev = &pdev->dev;
config.init_data = &tps_pdata->regulator;
config.driver_data = ri;
config.regmap = tps65090_mfd->rmap;

rdev = regulator_register(&ri->desc, &config);
if (IS_ERR(rdev)) {
Expand Down
13 changes: 13 additions & 0 deletions trunk/include/linux/mfd/tps65090.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,19 @@
#ifndef __LINUX_MFD_TPS65090_H
#define __LINUX_MFD_TPS65090_H

#include <linux/irq.h>

struct tps65090 {
struct mutex lock;
struct device *dev;
struct i2c_client *client;
struct regmap *rmap;
struct irq_chip irq_chip;
struct mutex irq_lock;
int irq_base;
unsigned int id;
};

struct tps65090_subdev_info {
int id;
const char *name;
Expand Down

0 comments on commit 917527b

Please sign in to comment.