From: Lee Jones <lee.jones@linaro.org>
To: "Opensource [Adam Thomson]" <Adam.Thomson.Opensource@diasemi.com>
Cc: Samuel Ortiz <sameo@linux.intel.com>,
Jonathan Cameron <jic23@kernel.org>,
Hartmut Knaack <knaack.h@gmx.de>,
"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
Sebastian Reichel <sre@kernel.org>,
Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>,
David Woodhouse <dwmw2@infradead.org>,
"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>,
Mark Rutland <mark.rutland@arm.com>,
Ian Campbell <ijc+devicetree@hellion.org.uk>,
Kumar Gala <galak@codeaurora.org>,
Grant Likely <grant.likely@linaro.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Joe Perches <joe@perches.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Support Opensource <Support.Opensource@diasemi.com>
Subject: Re: [PATCH v5 1/7] mfd: Add support for DA9150 combined charger & fuel-gauge device
Date: Tue, 20 Jan 2015 10:50:22 +0000 [thread overview]
Message-ID: <20150120105022.GA13701@x1> (raw)
In-Reply-To: <2E89032DDAA8B9408CB92943514A0337AB52874E@SW-EX-MBX01.diasemi.com>
On Mon, 19 Jan 2015, Opensource [Adam Thomson] wrote:
> On January 19, 2015 11:34, Lee Jones wrote:
>
> > On Mon, 22 Dec 2014, Adam Thomson wrote:
> >
> > > DA9150 is a combined Charger and Fuel-Gauge IC, with additional
> > > GPIO and GPADC functionality.
> > >
> > > Signed-off-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
> > > ---
> > > drivers/mfd/Kconfig | 12 +
> > > drivers/mfd/Makefile | 2 +-
> > > drivers/mfd/da9150-core.c | 413 ++++++++++++
> > > include/linux/mfd/da9150/core.h | 68 ++
> > > include/linux/mfd/da9150/registers.h | 1155
> > ++++++++++++++++++++++++++++++++++
> > > 5 files changed, 1649 insertions(+), 1 deletion(-)
> > > create mode 100644 drivers/mfd/da9150-core.c
> > > create mode 100644 include/linux/mfd/da9150/core.h
> > > create mode 100644 include/linux/mfd/da9150/registers.h
> > >
> > > diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
> > > index 2e6b731..56e80d2 100644
> > > --- a/drivers/mfd/Kconfig
> > > +++ b/drivers/mfd/Kconfig
> > > @@ -195,6 +195,18 @@ config MFD_DA9063
> > > Additional drivers must be enabled in order to use the functionality
> > > of the device.
> > >
> > > +config MFD_DA9150
> > > + tristate "Dialog Semiconductor DA9150 Charger Fuel-Gauge chip"
> > > + depends on I2C=y
> > > + select MFD_CORE
> > > + select REGMAP_I2C
> > > + select REGMAP_IRQ
> > > + help
> > > + This adds support for the DA9150 integrated charger and fuel-gauge
> > > + chip. This driver provides common support for accessing the device.
> > > + Additional drivers must be enabled in order to use the specific
> > > + features of the device.
> > > +
> > > config MFD_DLN2
> > > tristate "Diolan DLN2 support"
> > > select MFD_CORE
> > > diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
> > > index 53467e2..f06f4c6 100644
> > > --- a/drivers/mfd/Makefile
> > > +++ b/drivers/mfd/Makefile
> > > @@ -113,7 +113,7 @@ obj-$(CONFIG_MFD_DA9055) += da9055.o
> > >
> > > da9063-objs := da9063-core.o da9063-irq.o da9063-i2c.o
> > > obj-$(CONFIG_MFD_DA9063) += da9063.o
> > > -
> > > +obj-$(CONFIG_MFD_DA9150) += da9150-core.o
> > > obj-$(CONFIG_MFD_MAX14577) += max14577.o
> > > obj-$(CONFIG_MFD_MAX77686) += max77686.o
> > > obj-$(CONFIG_MFD_MAX77693) += max77693.o
> > > diff --git a/drivers/mfd/da9150-core.c b/drivers/mfd/da9150-core.c
> > > new file mode 100644
> > > index 0000000..4d757b9
> > > --- /dev/null
> > > +++ b/drivers/mfd/da9150-core.c
> > > @@ -0,0 +1,413 @@
> > > +/*
> > > + * DA9150 Core MFD Driver
> > > + *
> > > + * Copyright (c) 2014 Dialog Semiconductor
> > > + *
> > > + * Author: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
> > > + *
> > > + * This program is free software; you can redistribute it and/or modify it
> > > + * under the terms of the GNU General Public License as published by the
> > > + * Free Software Foundation; either version 2 of the License, or (at your
> > > + * option) any later version.
> > > + */
> >
> > [...]
> >
> > > +u8 da9150_reg_read(struct da9150 *da9150, u16 reg)
> > > +{
> > > + int val, ret;
> > > +
> > > + ret = regmap_read(da9150->regmap, reg, &val);
> > > + if (ret)
> > > + dev_err(da9150->dev, "Failed to read from reg 0x%x: %d\n",
> > > + reg, ret);
> > > +
> > > + return (u8) val;
> > > +}
> > > +EXPORT_SYMBOL_GPL(da9150_reg_read);
> > > +
> > > +void da9150_reg_write(struct da9150 *da9150, u16 reg, u8 val)
> > > +{
> > > + int ret;
> > > +
> > > + ret = regmap_write(da9150->regmap, reg, val);
> > > + if (ret)
> > > + dev_err(da9150->dev, "Failed to write to reg 0x%x: %d\n",
> > > + reg, ret);
> > > +}
> > > +EXPORT_SYMBOL_GPL(da9150_reg_write);
> > > +
> > > +void da9150_set_bits(struct da9150 *da9150, u16 reg, u8 mask, u8 val)
> > > +{
> > > + int ret;
> > > +
> > > + ret = regmap_update_bits(da9150->regmap, reg, mask, val);
> > > + if (ret)
> > > + dev_err(da9150->dev, "Failed to set bits in reg 0x%x: %d\n",
> > > + reg, ret);
> > > +}
> > > +EXPORT_SYMBOL_GPL(da9150_set_bits);
> > > +
> > > +void da9150_bulk_read(struct da9150 *da9150, u16 reg, int count, u8 *buf)
> > > +{
> > > + int ret;
> > > +
> > > + ret = regmap_bulk_read(da9150->regmap, reg, buf, count);
> > > + if (ret)
> > > + dev_err(da9150->dev, "Failed to bulk read from reg 0x%x: %d\n",
> > > + reg, ret);
> > > +}
> > > +EXPORT_SYMBOL_GPL(da9150_bulk_read);
> > > +
> > > +void da9150_bulk_write(struct da9150 *da9150, u16 reg, int count, const u8
> > *buf)
> > > +{
> > > + int ret;
> > > +
> > > + ret = regmap_raw_write(da9150->regmap, reg, buf, count);
> > > + if (ret)
> > > + dev_err(da9150->dev, "Failed to bulk write to reg 0x%x %d\n",
> > > + reg, ret);
> > > +}
> > > +EXPORT_SYMBOL_GPL(da9150_bulk_write);
> >
> > I've never been a fan of this type of aggregation. Can you explain to
> > me what the point of them is?
>
> I refer you back to our previous discussion some time back:
>
> https://lkml.org/lkml/2014/9/9/284
>
> 'The reason for these is because future patches to add additional functionality
> will introduce I2C access functions which do not use regmap and access the
> device via a separate I2C address for this purpose. I will need to provide
> access functions for that, and so having a common style of I2C access makes
> sense for this driver. Means any access just needs to provide the MFD private
> data, and the relevant functions take care of the rest. I think this is cleaner
> in this instance.'
Well at least I'm consistent.
For my own reference:
Acked-by: Lee Jones <lee.jones@linaro.org>
--
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:[~2015-01-20 10:50 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-22 16:50 [PATCH v5 0/7] Add initial support for DA9150 Charger & Fuel-Gauge IC Adam Thomson
2014-12-22 16:50 ` Adam Thomson
2014-12-22 16:51 ` [PATCH v5 1/7] mfd: Add support for DA9150 combined charger & fuel-gauge device Adam Thomson
2014-12-22 16:51 ` Adam Thomson
2015-01-19 11:33 ` Lee Jones
2015-01-19 13:23 ` Opensource [Adam Thomson]
2015-01-19 13:23 ` Opensource [Adam Thomson]
2015-01-19 13:23 ` Opensource [Adam Thomson]
2015-01-20 10:50 ` Lee Jones [this message]
2014-12-22 16:51 ` [PATCH v5 2/7] mfd: da9150: Add DT binding documentation for core Adam Thomson
2014-12-22 16:51 ` Adam Thomson
2014-12-22 16:51 ` [PATCH v5 3/7] iio: Add support for DA9150 GPADC Adam Thomson
2014-12-22 16:51 ` Adam Thomson
2015-01-01 20:51 ` Hartmut Knaack
2015-01-01 20:51 ` Hartmut Knaack
2015-01-04 17:22 ` Jonathan Cameron
2015-01-04 17:22 ` Jonathan Cameron
2015-01-07 16:03 ` Opensource [Adam Thomson]
2015-01-07 16:03 ` Opensource [Adam Thomson]
2015-01-07 16:03 ` Opensource [Adam Thomson]
2015-01-10 22:19 ` Jonathan Cameron
2015-01-10 22:19 ` Jonathan Cameron
2015-01-14 11:30 ` Opensource [Adam Thomson]
2015-01-14 11:30 ` Opensource [Adam Thomson]
2015-01-14 11:30 ` Opensource [Adam Thomson]
2015-01-20 20:49 ` Jonathan Cameron
2015-01-21 11:02 ` Opensource [Adam Thomson]
2015-01-21 11:02 ` Opensource [Adam Thomson]
2015-01-21 11:02 ` Opensource [Adam Thomson]
2014-12-22 16:51 ` [PATCH v5 4/7] iio: da9150: Add DT binding documentation for GPADC Adam Thomson
2014-12-22 16:51 ` Adam Thomson
2014-12-22 16:51 ` [PATCH v5 5/7] power: Add support for DA9150 Charger Adam Thomson
2014-12-22 16:51 ` Adam Thomson
2015-01-04 17:26 ` Jonathan Cameron
2015-01-04 17:26 ` Jonathan Cameron
2015-01-07 16:04 ` Opensource [Adam Thomson]
2015-01-07 16:04 ` Opensource [Adam Thomson]
2015-01-07 16:04 ` Opensource [Adam Thomson]
2014-12-22 16:51 ` [PATCH v5 6/7] power: da9150: Add DT binding documentation for charger Adam Thomson
2014-12-22 16:51 ` Adam Thomson
2014-12-22 16:51 ` [PATCH v5 7/7] MAINTAINERS: Include DA9150 files in Dialog Semiconductor support list Adam Thomson
2014-12-22 16:51 ` Adam Thomson
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=20150120105022.GA13701@x1 \
--to=lee.jones@linaro.org \
--cc=Adam.Thomson.Opensource@diasemi.com \
--cc=Support.Opensource@diasemi.com \
--cc=akpm@linux-foundation.org \
--cc=dbaryshkov@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=dwmw2@infradead.org \
--cc=galak@codeaurora.org \
--cc=grant.likely@linaro.org \
--cc=ijc+devicetree@hellion.org.uk \
--cc=jic23@kernel.org \
--cc=joe@perches.com \
--cc=knaack.h@gmx.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=pawel.moll@arm.com \
--cc=robh+dt@kernel.org \
--cc=sameo@linux.intel.com \
--cc=sre@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.