Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 192264e0 authored by Axel Lin's avatar Axel Lin Committed by Mark Brown
Browse files

regulator: as3711: Remove unused fields from as3711_regulator_info and as3711_regulator



The max_uV is not used, so remove it from struct as3711_regulator_info.
Current code is using devm_regulator_register(), so we don't need to store *rdev
in struct as3711_regulator for clean up.

Also clean up AS3711_REG macro to remove _vshift, _min_uV and _max_uV arguments.
_vshift is always 0, so remove it.
_min_uV and _max_uV are not required, all required settings are set in
REGULATOR_LINEAR_RANGE macro.

Signed-off-by: default avatarAxel Lin <axel.lin@ingics.com>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent 7d1311b9
Loading
Loading
Loading
Loading
+28 −33
Original line number Diff line number Diff line
@@ -22,12 +22,10 @@

struct as3711_regulator_info {
	struct regulator_desc	desc;
	unsigned int		max_uV;
};

struct as3711_regulator {
	struct as3711_regulator_info *reg_info;
	struct regulator_dev *rdev;
};

/*
@@ -132,7 +130,7 @@ static const struct regulator_linear_range as3711_dldo_ranges[] = {
	REGULATOR_LINEAR_RANGE(1750000, 0x20, 0x3f, 50000),
};

#define AS3711_REG(_id, _en_reg, _en_bit, _vmask, _vshift, _min_uV, _max_uV, _sfx)	\
#define AS3711_REG(_id, _en_reg, _en_bit, _vmask, _sfx)			   \
	[AS3711_REGULATOR_ ## _id] = {					   \
	.desc = {							   \
		.name = "as3711-regulator-" # _id,			   \
@@ -142,29 +140,27 @@ static const struct regulator_linear_range as3711_dldo_ranges[] = {
		.type = REGULATOR_VOLTAGE,				   \
		.owner = THIS_MODULE,					   \
		.vsel_reg = AS3711_ ## _id ## _VOLTAGE,			   \
		.vsel_mask = _vmask << _vshift,						\
		.vsel_mask = _vmask,					   \
		.enable_reg = AS3711_ ## _en_reg,			   \
		.enable_mask = BIT(_en_bit),				   \
		.min_uV	= _min_uV,							\
		.linear_ranges = as3711_ ## _sfx ## _ranges,		   \
		.n_linear_ranges = ARRAY_SIZE(as3711_ ## _sfx ## _ranges), \
	},								   \
	.max_uV = _max_uV,								\
}

static struct as3711_regulator_info as3711_reg_info[] = {
	AS3711_REG(SD_1, SD_CONTROL, 0, 0x7f, 0, 612500, 3350000, sd),
	AS3711_REG(SD_2, SD_CONTROL, 1, 0x7f, 0, 612500, 3350000, sd),
	AS3711_REG(SD_3, SD_CONTROL, 2, 0x7f, 0, 612500, 3350000, sd),
	AS3711_REG(SD_4, SD_CONTROL, 3, 0x7f, 0, 612500, 3350000, sd),
	AS3711_REG(LDO_1, LDO_1_VOLTAGE, 7, 0x1f, 0, 1200000, 3300000, aldo),
	AS3711_REG(LDO_2, LDO_2_VOLTAGE, 7, 0x1f, 0, 1200000, 3300000, aldo),
	AS3711_REG(LDO_3, LDO_3_VOLTAGE, 7, 0x3f, 0, 900000, 3300000, dldo),
	AS3711_REG(LDO_4, LDO_4_VOLTAGE, 7, 0x3f, 0, 900000, 3300000, dldo),
	AS3711_REG(LDO_5, LDO_5_VOLTAGE, 7, 0x3f, 0, 900000, 3300000, dldo),
	AS3711_REG(LDO_6, LDO_6_VOLTAGE, 7, 0x3f, 0, 900000, 3300000, dldo),
	AS3711_REG(LDO_7, LDO_7_VOLTAGE, 7, 0x3f, 0, 900000, 3300000, dldo),
	AS3711_REG(LDO_8, LDO_8_VOLTAGE, 7, 0x3f, 0, 900000, 3300000, dldo),
	AS3711_REG(SD_1, SD_CONTROL, 0, 0x7f, sd),
	AS3711_REG(SD_2, SD_CONTROL, 1, 0x7f, sd),
	AS3711_REG(SD_3, SD_CONTROL, 2, 0x7f, sd),
	AS3711_REG(SD_4, SD_CONTROL, 3, 0x7f, sd),
	AS3711_REG(LDO_1, LDO_1_VOLTAGE, 7, 0x1f, aldo),
	AS3711_REG(LDO_2, LDO_2_VOLTAGE, 7, 0x1f, aldo),
	AS3711_REG(LDO_3, LDO_3_VOLTAGE, 7, 0x3f, dldo),
	AS3711_REG(LDO_4, LDO_4_VOLTAGE, 7, 0x3f, dldo),
	AS3711_REG(LDO_5, LDO_5_VOLTAGE, 7, 0x3f, dldo),
	AS3711_REG(LDO_6, LDO_6_VOLTAGE, 7, 0x3f, dldo),
	AS3711_REG(LDO_7, LDO_7_VOLTAGE, 7, 0x3f, dldo),
	AS3711_REG(LDO_8, LDO_8_VOLTAGE, 7, 0x3f, dldo),
	/* StepUp output voltage depends on supplying regulator */
};

@@ -263,7 +259,6 @@ static int as3711_regulator_probe(struct platform_device *pdev)
				ri->desc.name);
			return PTR_ERR(rdev);
		}
		reg->rdev = rdev;
	}
	platform_set_drvdata(pdev, regs);
	return 0;