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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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@xxxxxxxxxxx>

[...]

> > +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
��.n��������+%������w��{.n����z�{��ܨ}���Ơz�j:+v�����w����ޙ��&�)ߡ�a����z�ޗ���ݢj��w�f




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]
  Powered by Linux