H A D | max8660.c | 2 * max8660.c -- Voltage regulation for the Maxim 8660/8661 46 #include <linux/regulator/max8660.h> 81 struct max8660 { struct 86 static int max8660_write(struct max8660 *max8660, u8 reg, u8 mask, u8 val) max8660_write() argument 93 u8 reg_val = (max8660->shadow_regs[reg] & mask) | val; max8660_write() 95 dev_vdbg(&max8660->client->dev, "Writing reg %02x with %02x\n", max8660_write() 98 ret = i2c_smbus_write_byte_data(max8660->client, max8660_write() 101 max8660->shadow_regs[reg] = reg_val; max8660_write() 113 struct max8660 *max8660 = rdev_get_drvdata(rdev); max8660_dcdc_is_enabled() local 114 u8 val = max8660->shadow_regs[MAX8660_OVER1]; max8660_dcdc_is_enabled() 122 struct max8660 *max8660 = rdev_get_drvdata(rdev); max8660_dcdc_enable() local 125 return max8660_write(max8660, MAX8660_OVER1, 0xff, bit); max8660_dcdc_enable() 130 struct max8660 *max8660 = rdev_get_drvdata(rdev); max8660_dcdc_disable() local 133 return max8660_write(max8660, MAX8660_OVER1, mask, 0); max8660_dcdc_disable() 138 struct max8660 *max8660 = rdev_get_drvdata(rdev); max8660_dcdc_get_voltage_sel() local 140 u8 selector = max8660->shadow_regs[reg]; max8660_dcdc_get_voltage_sel() 148 struct max8660 *max8660 = rdev_get_drvdata(rdev); max8660_dcdc_set_voltage_sel() local 153 ret = max8660_write(max8660, reg, 0, selector); max8660_dcdc_set_voltage_sel() 159 return max8660_write(max8660, MAX8660_VCC1, 0xff, bits); max8660_dcdc_set_voltage_sel() 177 struct max8660 *max8660 = rdev_get_drvdata(rdev); max8660_ldo5_get_voltage_sel() local 179 u8 selector = max8660->shadow_regs[MAX8660_MDTV2]; max8660_ldo5_get_voltage_sel() 186 struct max8660 *max8660 = rdev_get_drvdata(rdev); max8660_ldo5_set_voltage_sel() local 189 ret = max8660_write(max8660, MAX8660_MDTV2, 0, selector); max8660_ldo5_set_voltage_sel() 194 return max8660_write(max8660, MAX8660_VCC1, 0xff, 0xc0); max8660_ldo5_set_voltage_sel() 211 struct max8660 *max8660 = rdev_get_drvdata(rdev); max8660_ldo67_is_enabled() local 212 u8 val = max8660->shadow_regs[MAX8660_OVER2]; max8660_ldo67_is_enabled() 220 struct max8660 *max8660 = rdev_get_drvdata(rdev); max8660_ldo67_enable() local 223 return max8660_write(max8660, MAX8660_OVER2, 0xff, bit); max8660_ldo67_enable() 228 struct max8660 *max8660 = rdev_get_drvdata(rdev); max8660_ldo67_disable() local 231 return max8660_write(max8660, MAX8660_OVER2, mask, 0); max8660_ldo67_disable() 236 struct max8660 *max8660 = rdev_get_drvdata(rdev); max8660_ldo67_get_voltage_sel() local 238 u8 selector = (max8660->shadow_regs[MAX8660_L12VCR] >> shift) & 0xf; max8660_ldo67_get_voltage_sel() 246 struct max8660 *max8660 = rdev_get_drvdata(rdev); max8660_ldo67_set_voltage_sel() local 249 return max8660_write(max8660, MAX8660_L12VCR, 0xf0, selector); max8660_ldo67_set_voltage_sel() 251 return max8660_write(max8660, MAX8660_L12VCR, 0x0f, max8660_ldo67_set_voltage_sel() 325 { .compatible = "maxim,max8660", .data = (void *) MAX8660 }, 387 struct max8660 *max8660; max8660_probe() local 415 max8660 = devm_kzalloc(dev, sizeof(struct max8660), GFP_KERNEL); max8660_probe() 416 if (!max8660) max8660_probe() 419 max8660->client = client; max8660_probe() 423 max8660->shadow_regs[MAX8660_OVER1] = 5; max8660_probe() 435 max8660->shadow_regs[MAX8660_ADTV1] = max8660_probe() 436 max8660->shadow_regs[MAX8660_ADTV2] = max8660_probe() 437 max8660->shadow_regs[MAX8660_SDTV1] = max8660_probe() 438 max8660->shadow_regs[MAX8660_SDTV2] = 0x1b; max8660_probe() 439 max8660->shadow_regs[MAX8660_MDTV1] = max8660_probe() 440 max8660->shadow_regs[MAX8660_MDTV2] = 0x04; max8660_probe() 452 max8660->shadow_regs[MAX8660_OVER1] |= 1; max8660_probe() 457 max8660->shadow_regs[MAX8660_OVER1] |= 4; max8660_probe() 465 max8660->shadow_regs[MAX8660_OVER2] |= 2; max8660_probe() 475 max8660->shadow_regs[MAX8660_OVER2] |= 4; max8660_probe() 494 config.driver_data = max8660; max8660_probe() 506 i2c_set_clientdata(client, max8660); max8660_probe() 511 { .name = "max8660", .driver_data = MAX8660 }, 520 .name = "max8660",
|