From: "Mani, Rajmohan" <rajmohan.mani@intel.com>
To: Lee Jones <lee.jones@linaro.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
Linus Walleij <linus.walleij@linaro.org>,
Alexandre Courbot <gnurou@gmail.com>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>,
Len Brown <lenb@kernel.org>,
"sakari.ailus@linux.intel.com" <sakari.ailus@linux.intel.com>,
"Andy Shevchenko" <andy.shevchenko@gmail.com>
Subject: RE: [PATCH v4 1/3] mfd: Add new mfd device TPS68470
Date: Fri, 28 Jul 2017 23:49:05 +0000 [thread overview]
Message-ID: <6F87890CF0F5204F892DEA1EF0D77A59725DFDBA@FMSMSX114.amr.corp.intel.com> (raw)
In-Reply-To: <20170726082039.tcxbd7ogkmguufqo@dell>
Hi Lee,
> Subject: Re: [PATCH v4 1/3] mfd: Add new mfd device TPS68470
>
> On Tue, 25 Jul 2017, Mani, Rajmohan wrote:
>
> > Hi Lee,
> >
> > > Subject: Re: [PATCH v4 1/3] mfd: Add new mfd device TPS68470
> > >
> > > On Fri, 21 Jul 2017, Mani, Rajmohan wrote:
> > > > > On Wed, 19 Jul 2017, Rajmohan Mani wrote:
> > > > >
> > > > > > The TPS68470 device is an advanced power management unit that
> > > > > > powers
> > > > > a
> > > > > > Compact Camera Module (CCM), generates clocks for image
> > > > > > sensors, drives a dual LED for Flash and incorporates two LED
> > > > > > drivers for general purpose indicators.
> > > > > >
> > > > > > This patch adds support for TPS68470 mfd device.
> > > > > >
> > > > > > Signed-off-by: Rajmohan Mani <rajmohan.mani@intel.com>
> > > > > > ---
> > > > > > drivers/mfd/Kconfig | 18 +++++++
> > > > > > drivers/mfd/Makefile | 1 +
> > > > > > drivers/mfd/tps68470.c | 110
> > > > > +++++++++++++++++++++++++++++++++++++++++++
> > > > > > include/linux/mfd/tps68470.h | 97
> > > > > > ++++++++++++++++++++++++++++++++++++++
> > > > > > 4 files changed, 226 insertions(+) create mode 100644
> > > > > > drivers/mfd/tps68470.c create mode 100644
> > > > > > include/linux/mfd/tps68470.h
> > >
> > > [...]
> > >
> > > > > > +static const struct regmap_config tps68470_regmap_config = {
> > > > > > + .reg_bits = 8,
> > > > > > + .val_bits = 8,
> > > > > > + .max_register = TPS68470_REG_MAX, };
> > > > > > +
> > > > > > +static int tps68470_chip_init(struct device *dev, struct
> > > > > > +regmap
> > > > > > +*regmap) {
> > > > > > + unsigned int version;
> > > > > > + int ret;
> > > > > > +
> > > > > > + /* Force software reset */
> > > > > > + ret = regmap_write(regmap, TPS68470_REG_RESET,
> > > > > TPS68470_REG_RESET_MASK);
> > > > > > + if (ret < 0)
> > > > >
> > > > > Will 'if (!ret)' do?
> > > > >
> > > >
> > > > We intend to check error conditions and bail out. So, if (ret < 0)
> > > > works for
> > > this.
> > >
> > > Yes, 'if (!ret)' does that too.
> > >
> >
> > regmap_write() and regmap_read() functions return 0 on success. Hence
> we can not use 'if (!ret)' here, since we check for error conditions.
>
> Sorry, this was a typo.
>
> It should be 'if (ret)'.
>
> What I'm trying to get at is the " < 0" is not required.
>
Ack
> > > > > > + return ret;
> > > > > > +
> > > > > > + ret = regmap_read(regmap, TPS68470_REG_REVID,
> &version);
> > > > > > + if (ret < 0) {
> > > > >
> > > > > Same
> > > > >
> > > >
> > > > We intend to check error conditions and bail out. So, if (ret < 0)
> > > > works for
> > > this.
> > >
> > > As above.
> > >
> >
> > Same as above
> >
> > > > > > + dev_err(dev, "Failed to read revision register: %d\n",
> ret);
> > > > > > + return ret;
> > > > > > + }
> > > > > > +
> > > > > > + dev_info(dev, "TPS68470 REVID: 0x%x\n", version);
> > > > > > +
> > > > > > + return 0;
> > > > > > +}
> > > > > > +
> > > > > > +static int tps68470_probe(struct i2c_client *client) {
> > > > > > + struct device *dev = &client->dev;
> > > > > > + struct regmap *regmap;
> > > > > > + int ret;
> > > > > > +
> > > > > > + regmap = devm_regmap_init_i2c(client,
> &tps68470_regmap_config);
> > > > > > + if (IS_ERR(regmap)) {
> > > > > > + dev_err(dev, "devm_regmap_init_i2c Error %ld\n",
> > > > > > + PTR_ERR(regmap));
> > > > > > + return PTR_ERR(regmap);
> > > > > > + }
> > > > > > +
> > > > > > + i2c_set_clientdata(client, regmap);
> > > > > > +
> > > > > > + ret = tps68470_chip_init(dev, regmap);
> > > > > > + if (ret < 0) {
> > > > >
> > > > > Same
> > > > >
> > > >
> > > > We intend to check error conditions and bail out. So, if (ret < 0)
> > > > works for
> > > this.
> > >
> > > As above.
> > >
> >
> > Same as above
>
> --
> Lee Jones
> Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source
> software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
next prev parent reply other threads:[~2017-07-28 23:49 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-19 23:20 [PATCH v4 0/3] TPS68470 PMIC drivers Rajmohan Mani
2017-07-19 23:20 ` [PATCH v4 1/3] mfd: Add new mfd device TPS68470 Rajmohan Mani
2017-07-20 9:03 ` Lee Jones
2017-07-21 0:57 ` Mani, Rajmohan
2017-07-25 9:10 ` Lee Jones
2017-07-25 10:29 ` Andy Shevchenko
2017-07-26 8:23 ` Lee Jones
2017-07-26 10:26 ` Andy Shevchenko
2017-07-28 0:30 ` Mani, Rajmohan
2017-07-28 9:16 ` Andy Shevchenko
2017-07-28 23:48 ` Mani, Rajmohan
2017-07-25 17:05 ` Mani, Rajmohan
2017-07-26 8:20 ` Lee Jones
2017-07-28 23:49 ` Mani, Rajmohan [this message]
2017-07-21 12:26 ` Mani, Rajmohan
2017-07-19 23:20 ` [PATCH v4 2/3] gpio: Add support for TPS68470 GPIOs Rajmohan Mani
2017-07-19 23:20 ` [PATCH v4 3/3] ACPI / PMIC: Add TI PMIC TPS68470 operation region driver Rajmohan Mani
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=6F87890CF0F5204F892DEA1EF0D77A59725DFDBA@FMSMSX114.amr.corp.intel.com \
--to=rajmohan.mani@intel.com \
--cc=andy.shevchenko@gmail.com \
--cc=gnurou@gmail.com \
--cc=lee.jones@linaro.org \
--cc=lenb@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rjw@rjwysocki.net \
--cc=sakari.ailus@linux.intel.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®