Lines Matching refs:max8660
2 * max8660.c -- Voltage regulation for the Maxim 8660/8661
46 #include <linux/regulator/max8660.h>
78 struct max8660 {
84 static int max8660_write(struct max8660 *max8660, u8 reg, u8 mask, u8 val)
90 u8 reg_val = (max8660->shadow_regs[reg] & mask) | val;
91 dev_vdbg(&max8660->client->dev, "Writing reg %02x with %02x\n",
94 ret = i2c_smbus_write_byte_data(max8660->client,
97 max8660->shadow_regs[reg] = reg_val;
109 struct max8660 *max8660 = rdev_get_drvdata(rdev);
110 u8 val = max8660->shadow_regs[MAX8660_OVER1];
117 struct max8660 *max8660 = rdev_get_drvdata(rdev);
119 return max8660_write(max8660, MAX8660_OVER1, 0xff, bit);
124 struct max8660 *max8660 = rdev_get_drvdata(rdev);
126 return max8660_write(max8660, MAX8660_OVER1, mask, 0);
138 struct max8660 *max8660 = rdev_get_drvdata(rdev);
140 u8 selector = max8660->shadow_regs[reg];
146 struct max8660 *max8660 = rdev_get_drvdata(rdev);
163 ret = max8660_write(max8660, reg, 0, selector);
169 return max8660_write(max8660, MAX8660_VCC1, 0xff, bits);
193 struct max8660 *max8660 = rdev_get_drvdata(rdev);
194 u8 selector = max8660->shadow_regs[MAX8660_MDTV2];
201 struct max8660 *max8660 = rdev_get_drvdata(rdev);
216 ret = max8660_write(max8660, MAX8660_MDTV2, 0, selector);
221 return max8660_write(max8660, MAX8660_VCC1, 0xff, 0xc0);
237 struct max8660 *max8660 = rdev_get_drvdata(rdev);
238 u8 val = max8660->shadow_regs[MAX8660_OVER2];
245 struct max8660 *max8660 = rdev_get_drvdata(rdev);
247 return max8660_write(max8660, MAX8660_OVER2, 0xff, bit);
252 struct max8660 *max8660 = rdev_get_drvdata(rdev);
254 return max8660_write(max8660, MAX8660_OVER2, mask, 0);
266 struct max8660 *max8660 = rdev_get_drvdata(rdev);
268 u8 selector = (max8660->shadow_regs[MAX8660_L12VCR] >> shift) & 0xf;
275 struct max8660 *max8660 = rdev_get_drvdata(rdev);
292 return max8660_write(max8660, MAX8660_L12VCR, 0xf0, selector);
294 return max8660_write(max8660, MAX8660_L12VCR, 0x0f, selector << 4);
354 struct max8660 *max8660;
362 max8660 = kzalloc(sizeof(struct max8660) +
365 if (!max8660) {
370 max8660->client = client;
371 rdev = max8660->rdev;
375 max8660->shadow_regs[MAX8660_OVER1] = 5;
387 max8660->shadow_regs[MAX8660_ADTV1] =
388 max8660->shadow_regs[MAX8660_ADTV2] =
389 max8660->shadow_regs[MAX8660_SDTV1] =
390 max8660->shadow_regs[MAX8660_SDTV2] = 0x1b;
391 max8660->shadow_regs[MAX8660_MDTV1] =
392 max8660->shadow_regs[MAX8660_MDTV2] = 0x04;
404 max8660->shadow_regs[MAX8660_OVER1] |= 1;
409 max8660->shadow_regs[MAX8660_OVER1] |= 4;
417 max8660->shadow_regs[MAX8660_OVER2] |= 2;
427 max8660->shadow_regs[MAX8660_OVER2] |= 4;
444 max8660);
453 i2c_set_clientdata(client, max8660);
461 kfree(max8660);
468 struct max8660 *max8660 = i2c_get_clientdata(client);
472 if (max8660->rdev[i])
473 regulator_unregister(max8660->rdev[i]);
474 kfree(max8660);
480 { "max8660", 0 },
490 .name = "max8660",