^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Copyright (C) ST-Ericsson SA 2010
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Authors: Sundar Iyer <sundar.iyer@stericsson.com> for ST-Ericsson
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Bengt Jonsson <bengt.g.jonsson@stericsson.com> for ST-Ericsson
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) * Power domain regulators on DB8500
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/err.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/spinlock.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <linux/mfd/dbx500-prcmu.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <linux/regulator/driver.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include <linux/regulator/machine.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include <linux/regulator/db8500-prcmu.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #include <linux/regulator/of_regulator.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #include <linux/of.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #include "dbx500-prcmu.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) static int db8500_regulator_enable(struct regulator_dev *rdev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) struct dbx500_regulator_info *info = rdev_get_drvdata(rdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) if (info == NULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) dev_vdbg(rdev_get_dev(rdev), "regulator-%s-enable\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) info->desc.name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) if (!info->is_enabled) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) info->is_enabled = true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) if (!info->exclude_from_power_state)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) power_state_active_enable();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) static int db8500_regulator_disable(struct regulator_dev *rdev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) struct dbx500_regulator_info *info = rdev_get_drvdata(rdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) int ret = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) if (info == NULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) dev_vdbg(rdev_get_dev(rdev), "regulator-%s-disable\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) info->desc.name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) if (info->is_enabled) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) info->is_enabled = false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) if (!info->exclude_from_power_state)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) ret = power_state_active_disable();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) static int db8500_regulator_is_enabled(struct regulator_dev *rdev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) struct dbx500_regulator_info *info = rdev_get_drvdata(rdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) if (info == NULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) dev_vdbg(rdev_get_dev(rdev), "regulator-%s-is_enabled (is_enabled):"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) " %i\n", info->desc.name, info->is_enabled);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) return info->is_enabled;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) /* db8500 regulator operations */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) static const struct regulator_ops db8500_regulator_ops = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) .enable = db8500_regulator_enable,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) .disable = db8500_regulator_disable,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) .is_enabled = db8500_regulator_is_enabled,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) * EPOD control
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) static bool epod_on[NUM_EPOD_ID];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) static bool epod_ramret[NUM_EPOD_ID];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) static int enable_epod(u16 epod_id, bool ramret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) if (ramret) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) if (!epod_on[epod_id]) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) ret = prcmu_set_epod(epod_id, EPOD_STATE_RAMRET);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) if (ret < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) epod_ramret[epod_id] = true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) ret = prcmu_set_epod(epod_id, EPOD_STATE_ON);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) if (ret < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) epod_on[epod_id] = true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) static int disable_epod(u16 epod_id, bool ramret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) if (ramret) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) if (!epod_on[epod_id]) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) ret = prcmu_set_epod(epod_id, EPOD_STATE_OFF);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) if (ret < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) epod_ramret[epod_id] = false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) if (epod_ramret[epod_id]) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) ret = prcmu_set_epod(epod_id, EPOD_STATE_RAMRET);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) if (ret < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) ret = prcmu_set_epod(epod_id, EPOD_STATE_OFF);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) if (ret < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) epod_on[epod_id] = false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) * Regulator switch
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) static int db8500_regulator_switch_enable(struct regulator_dev *rdev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) struct dbx500_regulator_info *info = rdev_get_drvdata(rdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) if (info == NULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) dev_vdbg(rdev_get_dev(rdev), "regulator-switch-%s-enable\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) info->desc.name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) ret = enable_epod(info->epod_id, info->is_ramret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) if (ret < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) dev_err(rdev_get_dev(rdev),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) "regulator-switch-%s-enable: prcmu call failed\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) info->desc.name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) info->is_enabled = true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) out:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) static int db8500_regulator_switch_disable(struct regulator_dev *rdev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) struct dbx500_regulator_info *info = rdev_get_drvdata(rdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) if (info == NULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) dev_vdbg(rdev_get_dev(rdev), "regulator-switch-%s-disable\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) info->desc.name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) ret = disable_epod(info->epod_id, info->is_ramret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) if (ret < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) dev_err(rdev_get_dev(rdev),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) "regulator_switch-%s-disable: prcmu call failed\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) info->desc.name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) info->is_enabled = false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) out:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) static int db8500_regulator_switch_is_enabled(struct regulator_dev *rdev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) struct dbx500_regulator_info *info = rdev_get_drvdata(rdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) if (info == NULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) dev_vdbg(rdev_get_dev(rdev),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) "regulator-switch-%s-is_enabled (is_enabled): %i\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) info->desc.name, info->is_enabled);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) return info->is_enabled;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) static const struct regulator_ops db8500_regulator_switch_ops = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) .enable = db8500_regulator_switch_enable,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) .disable = db8500_regulator_switch_disable,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) .is_enabled = db8500_regulator_switch_is_enabled,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) * Regulator information
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) static struct dbx500_regulator_info
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) dbx500_regulator_info[DB8500_NUM_REGULATORS] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) [DB8500_REGULATOR_VAPE] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) .desc = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) .name = "db8500-vape",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) .of_match = of_match_ptr("db8500_vape"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) .id = DB8500_REGULATOR_VAPE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) .ops = &db8500_regulator_ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) .type = REGULATOR_VOLTAGE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) .owner = THIS_MODULE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) [DB8500_REGULATOR_VARM] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) .desc = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) .name = "db8500-varm",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) .of_match = of_match_ptr("db8500_varm"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) .id = DB8500_REGULATOR_VARM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) .ops = &db8500_regulator_ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) .type = REGULATOR_VOLTAGE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) .owner = THIS_MODULE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) [DB8500_REGULATOR_VMODEM] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) .desc = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) .name = "db8500-vmodem",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) .of_match = of_match_ptr("db8500_vmodem"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) .id = DB8500_REGULATOR_VMODEM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) .ops = &db8500_regulator_ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) .type = REGULATOR_VOLTAGE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) .owner = THIS_MODULE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) [DB8500_REGULATOR_VPLL] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) .desc = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) .name = "db8500-vpll",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) .of_match = of_match_ptr("db8500_vpll"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) .id = DB8500_REGULATOR_VPLL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) .ops = &db8500_regulator_ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) .type = REGULATOR_VOLTAGE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) .owner = THIS_MODULE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) [DB8500_REGULATOR_VSMPS1] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) .desc = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) .name = "db8500-vsmps1",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) .of_match = of_match_ptr("db8500_vsmps1"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) .id = DB8500_REGULATOR_VSMPS1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) .ops = &db8500_regulator_ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) .type = REGULATOR_VOLTAGE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) .owner = THIS_MODULE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) [DB8500_REGULATOR_VSMPS2] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) .desc = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) .name = "db8500-vsmps2",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) .of_match = of_match_ptr("db8500_vsmps2"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) .id = DB8500_REGULATOR_VSMPS2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) .ops = &db8500_regulator_ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) .type = REGULATOR_VOLTAGE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) .owner = THIS_MODULE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) .fixed_uV = 1800000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) .n_voltages = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) .exclude_from_power_state = true,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) [DB8500_REGULATOR_VSMPS3] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) .desc = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) .name = "db8500-vsmps3",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) .of_match = of_match_ptr("db8500_vsmps3"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) .id = DB8500_REGULATOR_VSMPS3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) .ops = &db8500_regulator_ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) .type = REGULATOR_VOLTAGE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) .owner = THIS_MODULE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) [DB8500_REGULATOR_VRF1] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) .desc = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) .name = "db8500-vrf1",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) .of_match = of_match_ptr("db8500_vrf1"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) .id = DB8500_REGULATOR_VRF1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) .ops = &db8500_regulator_ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) .type = REGULATOR_VOLTAGE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) .owner = THIS_MODULE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) [DB8500_REGULATOR_SWITCH_SVAMMDSP] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) .desc = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) .name = "db8500-sva-mmdsp",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) .of_match = of_match_ptr("db8500_sva_mmdsp"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) .id = DB8500_REGULATOR_SWITCH_SVAMMDSP,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) .ops = &db8500_regulator_switch_ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) .type = REGULATOR_VOLTAGE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) .owner = THIS_MODULE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) .epod_id = EPOD_ID_SVAMMDSP,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) [DB8500_REGULATOR_SWITCH_SVAMMDSPRET] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) .desc = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) .name = "db8500-sva-mmdsp-ret",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) .of_match = of_match_ptr("db8500_sva_mmdsp_ret"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) .id = DB8500_REGULATOR_SWITCH_SVAMMDSPRET,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) .ops = &db8500_regulator_switch_ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) .type = REGULATOR_VOLTAGE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) .owner = THIS_MODULE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) .epod_id = EPOD_ID_SVAMMDSP,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) .is_ramret = true,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) [DB8500_REGULATOR_SWITCH_SVAPIPE] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) .desc = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) .name = "db8500-sva-pipe",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) .of_match = of_match_ptr("db8500_sva_pipe"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) .id = DB8500_REGULATOR_SWITCH_SVAPIPE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) .ops = &db8500_regulator_switch_ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) .type = REGULATOR_VOLTAGE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) .owner = THIS_MODULE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) .epod_id = EPOD_ID_SVAPIPE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) [DB8500_REGULATOR_SWITCH_SIAMMDSP] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) .desc = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) .name = "db8500-sia-mmdsp",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) .of_match = of_match_ptr("db8500_sia_mmdsp"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) .id = DB8500_REGULATOR_SWITCH_SIAMMDSP,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) .ops = &db8500_regulator_switch_ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) .type = REGULATOR_VOLTAGE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) .owner = THIS_MODULE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) .epod_id = EPOD_ID_SIAMMDSP,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) [DB8500_REGULATOR_SWITCH_SIAMMDSPRET] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) .desc = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) .name = "db8500-sia-mmdsp-ret",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) .of_match = of_match_ptr("db8500_sia_mmdsp_ret"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) .id = DB8500_REGULATOR_SWITCH_SIAMMDSPRET,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) .ops = &db8500_regulator_switch_ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) .type = REGULATOR_VOLTAGE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) .owner = THIS_MODULE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) .epod_id = EPOD_ID_SIAMMDSP,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) .is_ramret = true,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) [DB8500_REGULATOR_SWITCH_SIAPIPE] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) .desc = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) .name = "db8500-sia-pipe",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) .of_match = of_match_ptr("db8500_sia_pipe"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) .id = DB8500_REGULATOR_SWITCH_SIAPIPE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) .ops = &db8500_regulator_switch_ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) .type = REGULATOR_VOLTAGE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) .owner = THIS_MODULE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) .epod_id = EPOD_ID_SIAPIPE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) [DB8500_REGULATOR_SWITCH_SGA] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) .desc = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) .name = "db8500-sga",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) .of_match = of_match_ptr("db8500_sga"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) .id = DB8500_REGULATOR_SWITCH_SGA,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) .ops = &db8500_regulator_switch_ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) .type = REGULATOR_VOLTAGE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) .owner = THIS_MODULE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) .epod_id = EPOD_ID_SGA,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) [DB8500_REGULATOR_SWITCH_B2R2_MCDE] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) .desc = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) .name = "db8500-b2r2-mcde",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) .of_match = of_match_ptr("db8500_b2r2_mcde"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) .id = DB8500_REGULATOR_SWITCH_B2R2_MCDE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) .ops = &db8500_regulator_switch_ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) .type = REGULATOR_VOLTAGE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) .owner = THIS_MODULE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) .epod_id = EPOD_ID_B2R2_MCDE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) [DB8500_REGULATOR_SWITCH_ESRAM12] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) .desc = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) .name = "db8500-esram12",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) .of_match = of_match_ptr("db8500_esram12"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) .id = DB8500_REGULATOR_SWITCH_ESRAM12,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) .ops = &db8500_regulator_switch_ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) .type = REGULATOR_VOLTAGE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) .owner = THIS_MODULE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) .epod_id = EPOD_ID_ESRAM12,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) .is_enabled = true,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) [DB8500_REGULATOR_SWITCH_ESRAM12RET] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) .desc = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) .name = "db8500-esram12-ret",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) .of_match = of_match_ptr("db8500_esram12_ret"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) .id = DB8500_REGULATOR_SWITCH_ESRAM12RET,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) .ops = &db8500_regulator_switch_ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) .type = REGULATOR_VOLTAGE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) .owner = THIS_MODULE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) .epod_id = EPOD_ID_ESRAM12,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) .is_ramret = true,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) [DB8500_REGULATOR_SWITCH_ESRAM34] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) .desc = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) .name = "db8500-esram34",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) .of_match = of_match_ptr("db8500_esram34"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) .id = DB8500_REGULATOR_SWITCH_ESRAM34,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) .ops = &db8500_regulator_switch_ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) .type = REGULATOR_VOLTAGE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) .owner = THIS_MODULE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) .epod_id = EPOD_ID_ESRAM34,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) .is_enabled = true,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) [DB8500_REGULATOR_SWITCH_ESRAM34RET] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) .desc = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) .name = "db8500-esram34-ret",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) .of_match = of_match_ptr("db8500_esram34_ret"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) .id = DB8500_REGULATOR_SWITCH_ESRAM34RET,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) .ops = &db8500_regulator_switch_ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) .type = REGULATOR_VOLTAGE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) .owner = THIS_MODULE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) .epod_id = EPOD_ID_ESRAM34,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) .is_ramret = true,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) static int db8500_regulator_probe(struct platform_device *pdev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) struct regulator_init_data *db8500_init_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) struct dbx500_regulator_info *info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) struct regulator_config config = { };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) struct regulator_dev *rdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) int err, i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) db8500_init_data = dev_get_platdata(&pdev->dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) for (i = 0; i < ARRAY_SIZE(dbx500_regulator_info); i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) /* assign per-regulator data */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) info = &dbx500_regulator_info[i];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) config.driver_data = info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) config.dev = &pdev->dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) if (db8500_init_data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) config.init_data = &db8500_init_data[i];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) rdev = devm_regulator_register(&pdev->dev, &info->desc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) &config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) if (IS_ERR(rdev)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) err = PTR_ERR(rdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) dev_err(&pdev->dev, "failed to register %s: err %i\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) info->desc.name, err);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) return err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) dev_dbg(&pdev->dev, "regulator-%s-probed\n", info->desc.name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) ux500_regulator_debug_init(pdev, dbx500_regulator_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) ARRAY_SIZE(dbx500_regulator_info));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) static int db8500_regulator_remove(struct platform_device *pdev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) ux500_regulator_debug_exit();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479) static struct platform_driver db8500_regulator_driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) .driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) .name = "db8500-prcmu-regulators",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) .probe = db8500_regulator_probe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484) .remove = db8500_regulator_remove,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) static int __init db8500_regulator_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489) return platform_driver_register(&db8500_regulator_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492) static void __exit db8500_regulator_exit(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) platform_driver_unregister(&db8500_regulator_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) arch_initcall(db8500_regulator_init);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498) module_exit(db8500_regulator_exit);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500) MODULE_AUTHOR("STMicroelectronics/ST-Ericsson");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501) MODULE_DESCRIPTION("DB8500 regulator driver");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502) MODULE_LICENSE("GPL v2");