Thread (14 messages) flat view 14 messages, 3 authors, 2017-01-04

RE: [PATCH V5 4/8] mfd: da9061: MFD core support

From: Steve Twiss <hidden>
Date: 2017-01-04 12:08:54
Also in: linux-devicetree, linux-pm, linux-watchdog, lkml

Hi Lee,

On 04 January 2017 10:12, Lee Jones wrote:
Subject: Re: [PATCH V5 4/8] mfd: da9061: MFD core support
On Thu, 15 Dec 2016, Steve Twiss wrote:
quoted
From: Steve Twiss <redacted>
[...]
quoted
+static const struct of_device_id da9062_dt_ids[] = {
+	{ .compatible = "dlg,da9061", .data = (void *)COMPAT_TYPE_DA9061,
},
quoted
+	{ .compatible = "dlg,da9062", .data = (void *)COMPAT_TYPE_DA9062,
},

It looks like this device can dynamically obtain this information from
the device.  Please use that method instead.
As I mentioned in an earlier post,
https://lkml.org/lkml/2016/11/7/418

The 61/62 device type has been defined by the device tree in this case, and
that definition is used to set the register map. With the regmap defined,
access to the registers is then possible.

It is not possible to detect the device type automatically in this case because
it suggests a predefined regmap.

This is the reason I define the chip type (DA9061 or DA9062) in the device
tree and then assign the correct regmap first before accessing any registers.

[...]
quoted
+	if (i2c->dev.of_node) {
+		match = of_match_node(da9062_dt_ids, i2c->dev.of_node);
+		if (!match)
+			return -EINVAL;
+
+		chip->chip_type = (int)match->data;
+	} else
+		chip->chip_type = id->driver_data;
Please obtain this information from DA9062AA_VARIANT_ID.
The variant ID does contain the information about whether it is a 61 or 62, but
in order to read the register the regmap definition needs to be defined
first.

[...]
quoted
 static const struct i2c_device_id da9062_i2c_id[] = {
-	{ "da9062", 0 },
+	{ "da9061", COMPAT_TYPE_DA9061 },
+	{ "da9062", COMPAT_TYPE_DA9062 },
This too.
Regards,
Steve
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help