Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1550708

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

From Steve Twiss <stwiss.opensource@diasemi.com>
Newsgroups linux.kernel
Subject RE: [PATCH V5 4/8] mfd: da9061: MFD core support
Date 2017-01-04 13:20 +0100
Message-ID <sVSHU-4z2-11@gated-at.bofh.it> (permalink)
References <sOK2K-1nh-15@gated-at.bofh.it> <sOKcq-1qS-27@gated-at.bofh.it> <sVQG6-3e8-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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:
> > From: Steve Twiss <stwiss.opensource@diasemi.com>

[...]

> > +static const struct of_device_id da9062_dt_ids[] = {
> > +	{ .compatible = "dlg,da9061", .data = (void *)COMPAT_TYPE_DA9061,
> },
> > +	{ .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.

[...]

> > +	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.

[...]

> >  static const struct i2c_device_id da9062_i2c_id[] = {
> > -	{ "da9062", 0 },
> > +	{ "da9061", COMPAT_TYPE_DA9061 },
> > +	{ "da9062", COMPAT_TYPE_DA9062 },
> 
> This too.

Regards,
Steve

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH V5 4/8] mfd: da9061: MFD core support Lee Jones <lee.jones@linaro.org> - 2017-01-04 11:10 +0100
  RE: [PATCH V5 4/8] mfd: da9061: MFD core support Steve Twiss <stwiss.opensource@diasemi.com> - 2017-01-04 13:20 +0100
    Re: [PATCH V5 4/8] mfd: da9061: MFD core support Lee Jones <lee.jones@linaro.org> - 2017-01-04 13:30 +0100

csiph-web