All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tim Harvey <tharvey@gateworks.com>
To: Lee Jones <lee.jones@linaro.org>
Cc: Jean Delvare <jdelvare@suse.com>,
	Guenter Roeck <linux@roeck-us.net>,
	Linux HWMON List <linux-hwmon@vger.kernel.org>,
	Rob Herring <robh+dt@kernel.org>,
	Frank Rowand <frowand.list@gmail.com>,
	Device Tree Mailing List <devicetree@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>,
	Robert Jones <rjones@gateworks.com>,
	Randy Dunlap <rdunlap@infradead.org>
Subject: Re: [PATCH v8 2/3] mfd: add Gateworks System Controller core driver
Date: Wed, 29 Apr 2020 07:50:09 -0700	[thread overview]
Message-ID: <CAJ+vNU1e10F_g51UXgJ+o1R9zhf_1J9xHJ6SYEuZC4615QfG1w@mail.gmail.com> (raw)
In-Reply-To: <20200429063319.GV3559@dell>

On Tue, Apr 28, 2020 at 11:33 PM Lee Jones <lee.jones@linaro.org> wrote:
>
> On Tue, 28 Apr 2020, Tim Harvey wrote:
>
> > On Tue, Apr 28, 2020 at 2:44 AM Lee Jones <lee.jones@linaro.org> wrote:
> > >
> > <snip>
> > > > +
> > > > +static int gsc_probe(struct i2c_client *client)
> > > > +{
> > > > +     struct device *dev = &client->dev;
> > > > +     struct gsc_dev *gsc;
> > > > +     int ret;
> > > > +     unsigned int reg;
> > > > +
> > > > +     gsc = devm_kzalloc(dev, sizeof(*gsc), GFP_KERNEL);
> > > > +     if (!gsc)
> > > > +             return -ENOMEM;
> > > > +
> > > > +     gsc->dev = &client->dev;
> > > > +     gsc->i2c = client;
> > > > +     i2c_set_clientdata(client, gsc);
> > > > +
> > > > +     gsc->bus.reg_write = gsc_regmap_regwrite;
> > > > +     gsc->bus.reg_read = gsc_regmap_regread;
> > >
> > > Why do you need to store these in ddata?
> >
> > Lee,
> >
> > Thanks for the review!
> >
> > I need the remap_bus* for devm_regmap_init() in the hwmon sub-module driver:
> >
> > hwmon->regmap = devm_regmap_init(dev, &gsc->bus, gsc->i2c_hwmon,
> > &gsc_hwmon_regmap_config);
> >
> > Is there something easier I'm missing?
>
> This is an odd setup.  I haven't seen one driver registering another
> driver's Regmap call-backs before, related or otherwise.  Normally the
> Regmap is setup (initialised) in the parent driver and child drivers
> just make use of it.  Here it looks like you are registering 2
> separate Regmaps, but using the same call-backs for both, which seems
> wrong to me.
>

Lee,

It is perhaps an odd setup. The hwmon sub-device is at a different i2c
slave address than the other sub-devices. The same callbacks are used
for reg read/write to take advantage of the retries due to the errata
resulting in occasional NAK'd register reads.

Tim

  reply	other threads:[~2020-04-29 14:50 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-27 20:33 [PATCH v8 0/3] Add support for the Gateworks System Controller Tim Harvey
2020-03-27 20:33 ` [PATCH v8 1/3] dt-bindings: mfd: Add Gateworks System Controller bindings Tim Harvey
2020-03-30 16:03   ` Rob Herring
2020-04-17  9:58   ` Lee Jones
2020-04-20 15:28     ` Tim Harvey
2020-03-27 20:33 ` [PATCH v8 2/3] mfd: add Gateworks System Controller core driver Tim Harvey
2020-04-08 15:36   ` Tim Harvey
2020-04-14  8:09     ` Lee Jones
2020-04-28  9:44   ` Lee Jones
2020-04-28 19:21     ` Tim Harvey
2020-04-29  6:33       ` Lee Jones
2020-04-29 14:50         ` Tim Harvey [this message]
2020-04-30  8:28           ` Lee Jones
2020-03-27 20:33 ` [PATCH v8 3/3] hwmon: add Gateworks System Controller support Tim Harvey
2020-03-31 15:49   ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJ+vNU1e10F_g51UXgJ+o1R9zhf_1J9xHJ6SYEuZC4615QfG1w@mail.gmail.com \
    --to=tharvey@gateworks.com \
    --cc=devicetree@vger.kernel.org \
    --cc=frowand.list@gmail.com \
    --cc=jdelvare@suse.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=rdunlap@infradead.org \
    --cc=rjones@gateworks.com \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.