Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2)  * pbias-regulator.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  * Copyright (C) 2014 Texas Instruments Incorporated - https://www.ti.com/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * Author: Balaji T K <balajitk@ti.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  * This program is free software; you can redistribute it and/or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  * modify it under the terms of the GNU General Public License as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  * published by the Free Software Foundation version 2.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)  * This program is distributed "as is" WITHOUT ANY WARRANTY of any
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12)  * kind, whether express or implied; without even the implied warranty
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13)  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14)  * GNU General Public License for more details.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #include <linux/err.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #include <linux/io.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) #include <linux/mfd/syscon.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) #include <linux/regulator/driver.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) #include <linux/regulator/machine.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) #include <linux/regulator/of_regulator.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) #include <linux/regmap.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) #include <linux/slab.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) #include <linux/of.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) #include <linux/of_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) struct pbias_reg_info {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 	u32 enable;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 	u32 enable_mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 	u32 disable_val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 	u32 vmode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 	unsigned int enable_time;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 	char *name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 	const unsigned int *pbias_volt_table;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 	int n_voltages;
^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) struct pbias_of_data {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	unsigned int offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) static const unsigned int pbias_volt_table_3_0V[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	1800000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	3000000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) static const unsigned int pbias_volt_table_3_3V[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	1800000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	3300000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) static const struct regulator_ops pbias_regulator_voltage_ops = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	.list_voltage = regulator_list_voltage_table,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	.get_voltage_sel = regulator_get_voltage_sel_regmap,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	.set_voltage_sel = regulator_set_voltage_sel_regmap,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	.enable = regulator_enable_regmap,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	.disable = regulator_disable_regmap,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	.is_enabled = regulator_is_enabled_regmap,
^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 const struct pbias_reg_info pbias_mmc_omap2430 = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	.enable = BIT(1),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	.enable_mask = BIT(1),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	.vmode = BIT(0),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	.disable_val = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	.enable_time = 100,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 	.pbias_volt_table = pbias_volt_table_3_0V,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	.n_voltages = 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	.name = "pbias_mmc_omap2430"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) static const struct pbias_reg_info pbias_sim_omap3 = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	.enable = BIT(9),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	.enable_mask = BIT(9),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	.vmode = BIT(8),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	.enable_time = 100,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	.pbias_volt_table = pbias_volt_table_3_0V,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	.n_voltages = 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	.name = "pbias_sim_omap3"
^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) static const struct pbias_reg_info pbias_mmc_omap4 = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	.enable = BIT(26) | BIT(22),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	.enable_mask = BIT(26) | BIT(25) | BIT(22),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	.disable_val = BIT(25),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 	.vmode = BIT(21),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	.enable_time = 100,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	.pbias_volt_table = pbias_volt_table_3_0V,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	.n_voltages = 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	.name = "pbias_mmc_omap4"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) static const struct pbias_reg_info pbias_mmc_omap5 = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	.enable = BIT(27) | BIT(26),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	.enable_mask = BIT(27) | BIT(25) | BIT(26),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	.disable_val = BIT(25),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	.vmode = BIT(21),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	.enable_time = 100,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	.pbias_volt_table = pbias_volt_table_3_3V,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	.n_voltages = 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	.name = "pbias_mmc_omap5"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) static struct of_regulator_match pbias_matches[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	{ .name = "pbias_mmc_omap2430", .driver_data = (void *)&pbias_mmc_omap2430},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	{ .name = "pbias_sim_omap3", .driver_data = (void *)&pbias_sim_omap3},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	{ .name = "pbias_mmc_omap4", .driver_data = (void *)&pbias_mmc_omap4},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	{ .name = "pbias_mmc_omap5", .driver_data = (void *)&pbias_mmc_omap5},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) #define PBIAS_NUM_REGS	ARRAY_SIZE(pbias_matches)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) /* Offset from SCM general area (and syscon) base */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) static const struct pbias_of_data pbias_of_data_omap2 = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	.offset = 0x230,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) static const struct pbias_of_data pbias_of_data_omap3 = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	.offset = 0x2b0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) static const struct pbias_of_data pbias_of_data_omap4 = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	.offset = 0x60,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) static const struct pbias_of_data pbias_of_data_omap5 = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 	.offset = 0x60,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) static const struct pbias_of_data pbias_of_data_dra7 = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 	.offset = 0xe00,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) static const struct of_device_id pbias_of_match[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 	{ .compatible = "ti,pbias-omap", },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	{ .compatible = "ti,pbias-omap2", .data = &pbias_of_data_omap2, },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	{ .compatible = "ti,pbias-omap3", .data = &pbias_of_data_omap3, },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 	{ .compatible = "ti,pbias-omap4", .data = &pbias_of_data_omap4, },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	{ .compatible = "ti,pbias-omap5", .data = &pbias_of_data_omap5, },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 	{ .compatible = "ti,pbias-dra7", .data = &pbias_of_data_dra7, },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 	{},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) MODULE_DEVICE_TABLE(of, pbias_of_match);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) static int pbias_regulator_probe(struct platform_device *pdev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	struct device_node *np = pdev->dev.of_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 	struct resource *res;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	struct regulator_config cfg = { };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	struct regulator_desc *desc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 	struct regulator_dev *rdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	struct regmap *syscon;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 	const struct pbias_reg_info *info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 	int ret, count, idx;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	const struct pbias_of_data *data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	unsigned int offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	count = of_regulator_match(&pdev->dev, np, pbias_matches,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 						PBIAS_NUM_REGS);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 	if (count < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 		return count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	desc = devm_kcalloc(&pdev->dev, count, sizeof(*desc), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 	if (!desc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 		return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 	syscon = syscon_regmap_lookup_by_phandle(np, "syscon");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 	if (IS_ERR(syscon))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 		return PTR_ERR(syscon);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 	data = of_device_get_match_data(&pdev->dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 	if (data) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 		offset = data->offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 	} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 		res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 		if (!res)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 			return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 		offset = res->start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 		dev_WARN(&pdev->dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 			 "using legacy dt data for pbias offset\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 	cfg.regmap = syscon;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	cfg.dev = &pdev->dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 	for (idx = 0; idx < PBIAS_NUM_REGS && count; idx++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 		if (!pbias_matches[idx].init_data ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 			!pbias_matches[idx].of_node)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 			continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 		info = pbias_matches[idx].driver_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 		if (!info)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 			return -ENODEV;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 		desc->name = info->name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 		desc->owner = THIS_MODULE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 		desc->type = REGULATOR_VOLTAGE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 		desc->ops = &pbias_regulator_voltage_ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 		desc->volt_table = info->pbias_volt_table;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 		desc->n_voltages = info->n_voltages;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 		desc->enable_time = info->enable_time;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 		desc->vsel_reg = offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 		desc->vsel_mask = info->vmode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 		desc->enable_reg = offset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 		desc->enable_mask = info->enable_mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 		desc->enable_val = info->enable;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 		desc->disable_val = info->disable_val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 		cfg.init_data = pbias_matches[idx].init_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 		cfg.of_node = pbias_matches[idx].of_node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 		rdev = devm_regulator_register(&pdev->dev, desc, &cfg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 		if (IS_ERR(rdev)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 			ret = PTR_ERR(rdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 			dev_err(&pdev->dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 				"Failed to register regulator: %d\n", ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 			return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 		desc++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 		count--;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) static struct platform_driver pbias_regulator_driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 	.probe		= pbias_regulator_probe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 	.driver		= {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 		.name		= "pbias-regulator",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 		.of_match_table = of_match_ptr(pbias_of_match),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) module_platform_driver(pbias_regulator_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) MODULE_AUTHOR("Balaji T K <balajitk@ti.com>");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) MODULE_DESCRIPTION("pbias voltage regulator");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) MODULE_LICENSE("GPL");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) MODULE_ALIAS("platform:pbias-regulator");