Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Match data improvements for pv880x0 regulator

Merge series from Biju Das <biju.das.jz@bp.renesas.com>:

This patch series aims to add match data improvements for pv880x0
regulator driver.

These patches are only compile tested.

+17 -41
+17 -41
drivers/regulator/pv88080-regulator.c
··· 5 5 6 6 #include <linux/err.h> 7 7 #include <linux/i2c.h> 8 + #include <linux/mod_devicetable.h> 8 9 #include <linux/module.h> 9 10 #include <linux/of.h> 10 11 #include <linux/init.h> ··· 27 26 PV88080_ID_BUCK2, 28 27 PV88080_ID_BUCK3, 29 28 PV88080_ID_HVBUCK, 30 - }; 31 - 32 - enum pv88080_types { 33 - TYPE_PV88080_AA, 34 - TYPE_PV88080_BA, 35 29 }; 36 30 37 31 struct pv88080_regulator { ··· 191 195 .hvbuck_enable_mask = PV88080_HVBUCK_EN, 192 196 .hvbuck_vsel_mask = PV88080_VHVBUCK_MASK, 193 197 }; 194 - 195 - #ifdef CONFIG_OF 196 - static const struct of_device_id pv88080_dt_ids[] = { 197 - { .compatible = "pvs,pv88080", .data = (void *)TYPE_PV88080_AA }, 198 - { .compatible = "pvs,pv88080-aa", .data = (void *)TYPE_PV88080_AA }, 199 - { .compatible = "pvs,pv88080-ba", .data = (void *)TYPE_PV88080_BA }, 200 - {}, 201 - }; 202 - MODULE_DEVICE_TABLE(of, pv88080_dt_ids); 203 - #endif 204 198 205 199 static unsigned int pv88080_buck_get_mode(struct regulator_dev *rdev) 206 200 { ··· 362 376 */ 363 377 static int pv88080_i2c_probe(struct i2c_client *i2c) 364 378 { 365 - const struct i2c_device_id *id = i2c_client_get_device_id(i2c); 366 379 struct regulator_init_data *init_data = dev_get_platdata(&i2c->dev); 367 380 struct pv88080 *chip; 368 381 const struct pv88080_compatible_regmap *regmap_config; 369 - const struct of_device_id *match; 370 382 struct regulator_config config = { }; 371 383 int i, error, ret; 372 384 unsigned int conf2, conf5; ··· 382 398 return error; 383 399 } 384 400 385 - if (i2c->dev.of_node) { 386 - match = of_match_node(pv88080_dt_ids, i2c->dev.of_node); 387 - if (!match) { 388 - dev_err(chip->dev, "Failed to get of_match_node\n"); 389 - return -EINVAL; 390 - } 391 - chip->type = (unsigned long)match->data; 392 - } else { 393 - chip->type = id->driver_data; 394 - } 401 + chip->regmap_config = i2c_get_match_data(i2c); 402 + if (!chip->regmap_config) 403 + return -ENODEV; 395 404 396 405 i2c_set_clientdata(i2c, chip); 397 406 ··· 427 450 } 428 451 } else { 429 452 dev_warn(chip->dev, "No IRQ configured\n"); 430 - } 431 - 432 - switch (chip->type) { 433 - case TYPE_PV88080_AA: 434 - chip->regmap_config = &pv88080_aa_regs; 435 - break; 436 - case TYPE_PV88080_BA: 437 - chip->regmap_config = &pv88080_ba_regs; 438 - break; 439 453 } 440 454 441 455 regmap_config = chip->regmap_config; ··· 514 546 return 0; 515 547 } 516 548 549 + static const struct of_device_id pv88080_dt_ids[] = { 550 + { .compatible = "pvs,pv88080", .data = &pv88080_aa_regs }, 551 + { .compatible = "pvs,pv88080-aa", .data = &pv88080_aa_regs }, 552 + { .compatible = "pvs,pv88080-ba", .data = &pv88080_ba_regs }, 553 + {} 554 + }; 555 + MODULE_DEVICE_TABLE(of, pv88080_dt_ids); 556 + 517 557 static const struct i2c_device_id pv88080_i2c_id[] = { 518 - { "pv88080", TYPE_PV88080_AA }, 519 - { "pv88080-aa", TYPE_PV88080_AA }, 520 - { "pv88080-ba", TYPE_PV88080_BA }, 521 - {}, 558 + { "pv88080", (kernel_ulong_t)&pv88080_aa_regs }, 559 + { "pv88080-aa", (kernel_ulong_t)&pv88080_aa_regs }, 560 + { "pv88080-ba", (kernel_ulong_t)&pv88080_ba_regs }, 561 + {} 522 562 }; 523 563 MODULE_DEVICE_TABLE(i2c, pv88080_i2c_id); 524 564 ··· 534 558 .driver = { 535 559 .name = "pv88080", 536 560 .probe_type = PROBE_PREFER_ASYNCHRONOUS, 537 - .of_match_table = of_match_ptr(pv88080_dt_ids), 561 + .of_match_table = pv88080_dt_ids, 538 562 }, 539 563 .probe = pv88080_i2c_probe, 540 564 .id_table = pv88080_i2c_id,