| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) ST-Ericsson SA 2010 |
|---|
| 3 | | - * |
|---|
| 4 | | - * License Terms: GNU General Public License v2 |
|---|
| 5 | 4 | * |
|---|
| 6 | 5 | * Authors: Sundar Iyer <sundar.iyer@stericsson.com> for ST-Ericsson |
|---|
| 7 | 6 | * Bengt Jonsson <bengt.g.jonsson@stericsson.com> for ST-Ericsson |
|---|
| .. | .. |
|---|
| 44 | 43 | * struct ab8500_regulator_info - ab8500 regulator information |
|---|
| 45 | 44 | * @dev: device pointer |
|---|
| 46 | 45 | * @desc: regulator description |
|---|
| 47 | | - * @regulator_dev: regulator device |
|---|
| 48 | 46 | * @shared_mode: used when mode is shared between two regulators |
|---|
| 49 | 47 | * @load_lp_uA: maximum load in idle (low power) mode |
|---|
| 50 | 48 | * @update_bank: bank to control on/off |
|---|
| .. | .. |
|---|
| 61 | 59 | * @voltage_bank: bank to control regulator voltage |
|---|
| 62 | 60 | * @voltage_reg: register to control regulator voltage |
|---|
| 63 | 61 | * @voltage_mask: mask to control regulator voltage |
|---|
| 62 | + * @expand_register: |
|---|
| 64 | 63 | */ |
|---|
| 65 | 64 | struct ab8500_regulator_info { |
|---|
| 66 | 65 | struct device *dev; |
|---|
| 67 | 66 | struct regulator_desc desc; |
|---|
| 68 | | - struct regulator_dev *regulator; |
|---|
| 69 | 67 | struct ab8500_shared_mode *shared_mode; |
|---|
| 70 | 68 | int load_lp_uA; |
|---|
| 71 | 69 | u8 update_bank; |
|---|
| .. | .. |
|---|
| 82 | 80 | u8 voltage_bank; |
|---|
| 83 | 81 | u8 voltage_reg; |
|---|
| 84 | 82 | u8 voltage_mask; |
|---|
| 85 | | - struct { |
|---|
| 86 | | - u8 voltage_limit; |
|---|
| 87 | | - u8 voltage_bank; |
|---|
| 88 | | - u8 voltage_reg; |
|---|
| 89 | | - u8 voltage_mask; |
|---|
| 90 | | - } expand_register; |
|---|
| 91 | 83 | }; |
|---|
| 92 | 84 | |
|---|
| 93 | 85 | /* voltage tables for the vauxn/vintcore supplies */ |
|---|
| .. | .. |
|---|
| 142 | 134 | 1350000, |
|---|
| 143 | 135 | }; |
|---|
| 144 | 136 | |
|---|
| 145 | | -static const unsigned int ldo_sdio_voltages[] = { |
|---|
| 146 | | - 1160000, |
|---|
| 147 | | - 1050000, |
|---|
| 148 | | - 1100000, |
|---|
| 149 | | - 1500000, |
|---|
| 150 | | - 1800000, |
|---|
| 151 | | - 2200000, |
|---|
| 152 | | - 2910000, |
|---|
| 153 | | - 3050000, |
|---|
| 154 | | -}; |
|---|
| 155 | | - |
|---|
| 156 | 137 | static const unsigned int fixed_1200000_voltage[] = { |
|---|
| 157 | 138 | 1200000, |
|---|
| 158 | 139 | }; |
|---|
| .. | .. |
|---|
| 167 | 148 | |
|---|
| 168 | 149 | static const unsigned int fixed_2050000_voltage[] = { |
|---|
| 169 | 150 | 2050000, |
|---|
| 170 | | -}; |
|---|
| 171 | | - |
|---|
| 172 | | -static const unsigned int fixed_3300000_voltage[] = { |
|---|
| 173 | | - 3300000, |
|---|
| 174 | 151 | }; |
|---|
| 175 | 152 | |
|---|
| 176 | 153 | static const unsigned int ldo_vana_voltages[] = { |
|---|
| .. | .. |
|---|
| 193 | 170 | 2500000, |
|---|
| 194 | 171 | 2600000, |
|---|
| 195 | 172 | 2600000, /* Duplicated in Vaudio and IsoUicc Control register. */ |
|---|
| 196 | | -}; |
|---|
| 197 | | - |
|---|
| 198 | | -static const unsigned int ldo_vdmic_voltages[] = { |
|---|
| 199 | | - 1800000, |
|---|
| 200 | | - 1900000, |
|---|
| 201 | | - 2000000, |
|---|
| 202 | | - 2850000, |
|---|
| 203 | 173 | }; |
|---|
| 204 | 174 | |
|---|
| 205 | 175 | static DEFINE_MUTEX(shared_mode_mutex); |
|---|
| .. | .. |
|---|
| 510 | 480 | return ret; |
|---|
| 511 | 481 | } |
|---|
| 512 | 482 | |
|---|
| 513 | | -static struct regulator_ops ab8500_regulator_volt_mode_ops = { |
|---|
| 483 | +static const struct regulator_ops ab8500_regulator_volt_mode_ops = { |
|---|
| 514 | 484 | .enable = ab8500_regulator_enable, |
|---|
| 515 | 485 | .disable = ab8500_regulator_disable, |
|---|
| 516 | 486 | .is_enabled = ab8500_regulator_is_enabled, |
|---|
| .. | .. |
|---|
| 522 | 492 | .list_voltage = regulator_list_voltage_table, |
|---|
| 523 | 493 | }; |
|---|
| 524 | 494 | |
|---|
| 525 | | -static struct regulator_ops ab8500_regulator_volt_ops = { |
|---|
| 495 | +static const struct regulator_ops ab8500_regulator_volt_ops = { |
|---|
| 526 | 496 | .enable = ab8500_regulator_enable, |
|---|
| 527 | 497 | .disable = ab8500_regulator_disable, |
|---|
| 528 | 498 | .is_enabled = ab8500_regulator_is_enabled, |
|---|
| .. | .. |
|---|
| 531 | 501 | .list_voltage = regulator_list_voltage_table, |
|---|
| 532 | 502 | }; |
|---|
| 533 | 503 | |
|---|
| 534 | | -static struct regulator_ops ab8500_regulator_mode_ops = { |
|---|
| 504 | +static const struct regulator_ops ab8500_regulator_mode_ops = { |
|---|
| 535 | 505 | .enable = ab8500_regulator_enable, |
|---|
| 536 | 506 | .disable = ab8500_regulator_disable, |
|---|
| 537 | 507 | .is_enabled = ab8500_regulator_is_enabled, |
|---|
| .. | .. |
|---|
| 541 | 511 | .list_voltage = regulator_list_voltage_table, |
|---|
| 542 | 512 | }; |
|---|
| 543 | 513 | |
|---|
| 544 | | -static struct regulator_ops ab8500_regulator_ops = { |
|---|
| 514 | +static const struct regulator_ops ab8500_regulator_ops = { |
|---|
| 545 | 515 | .enable = ab8500_regulator_enable, |
|---|
| 546 | 516 | .disable = ab8500_regulator_disable, |
|---|
| 547 | 517 | .is_enabled = ab8500_regulator_is_enabled, |
|---|
| 548 | 518 | .list_voltage = regulator_list_voltage_table, |
|---|
| 549 | 519 | }; |
|---|
| 550 | 520 | |
|---|
| 551 | | -static struct regulator_ops ab8500_regulator_anamic_mode_ops = { |
|---|
| 521 | +static const struct regulator_ops ab8500_regulator_anamic_mode_ops = { |
|---|
| 552 | 522 | .enable = ab8500_regulator_enable, |
|---|
| 553 | 523 | .disable = ab8500_regulator_disable, |
|---|
| 554 | 524 | .is_enabled = ab8500_regulator_is_enabled, |
|---|
| .. | .. |
|---|
| 1583 | 1553 | struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent); |
|---|
| 1584 | 1554 | struct ab8500_regulator_info *info = NULL; |
|---|
| 1585 | 1555 | struct regulator_config config = { }; |
|---|
| 1556 | + struct regulator_dev *rdev; |
|---|
| 1586 | 1557 | |
|---|
| 1587 | 1558 | /* assign per-regulator data */ |
|---|
| 1588 | 1559 | info = &abx500_regulator.info[id]; |
|---|
| .. | .. |
|---|
| 1604 | 1575 | } |
|---|
| 1605 | 1576 | |
|---|
| 1606 | 1577 | /* register regulator with framework */ |
|---|
| 1607 | | - info->regulator = devm_regulator_register(&pdev->dev, &info->desc, |
|---|
| 1608 | | - &config); |
|---|
| 1609 | | - if (IS_ERR(info->regulator)) { |
|---|
| 1578 | + rdev = devm_regulator_register(&pdev->dev, &info->desc, &config); |
|---|
| 1579 | + if (IS_ERR(rdev)) { |
|---|
| 1610 | 1580 | dev_err(&pdev->dev, "failed to register regulator %s\n", |
|---|
| 1611 | 1581 | info->desc.name); |
|---|
| 1612 | | - return PTR_ERR(info->regulator); |
|---|
| 1582 | + return PTR_ERR(rdev); |
|---|
| 1613 | 1583 | } |
|---|
| 1614 | 1584 | |
|---|
| 1615 | 1585 | return 0; |
|---|