Re: [PATCH v2 3/6] regulator: Add regulator driver for ATC260x PMICs

From
Mark Brown <broonie@kernel.org>
Date
2020-08-24 11:01:34
Also in
linux-input, linux-pm, lkml
Reply to
Cristian Ciocaltea, 2020-08-21
On Sat, Aug 22, 2020 at 01:19:49AM +0300, Cristian Ciocaltea wrote:
quoted hunk ↗ jump to hunk
+static int atc260x_set_voltage_time_sel(struct regulator_dev *rdev,
+					unsigned int old_selector,
+					unsigned int new_selector)
+{
+	struct atc260x_regulator_data *data = rdev_get_drvdata(rdev);
+	int id = rdev_get_id(rdev);
+
+	if (new_selector > old_selector)
+		return id > data->last_dcdc_reg_id ? data->voltage_time_ldo
+						   : data->voltage_time_dcdc;
Please write normal conditional statements to make things easier to
read.  It also looks like this would be more robustly written by just
having separate ops for DCDCs and LDOs, this could easily break if
another device is supported in the driver.
quoted hunk ↗ jump to hunk
+static const struct of_device_id atc260x_regulator_of_match[] = {
+	{ .compatible = "actions,atc2603c-regulator" },
+	{ .compatible = "actions,atc2609a-regulator" },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, atc260x_regulator_of_match);
We don't need compatibles here, this is just reflecting the current
Linux device model into the OS neutral DT bindings.  Another OS may
choose to split regulators up differently.  We should just instantiate
the regulator device from the MFD based on identifying the chip overall.

Attachments

Thread (26 messages) 26 messages, 8 authors, last reply 2020-09-29
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help