From: Krzysztof Kozlowski <k.kozlowski@samsung.com>
To: Robert Baldyga <r.baldyga@samsung.com>
Cc: sameo@linux.intel.com, lee.jones@linaro.org,
myungjoo.ham@samsung.com, cw00.choi@samsung.com,
dmitry.torokhov@gmail.com, cooloney@gmail.com, rpurdie@rpsys.net,
dbaryshkov@gmail.com, dwmw2@infradead.org, lgirdwood@gmail.com,
broonie@kernel.org, a.zummo@towertech.it,
paul.gortmaker@windriver.com, linux-kernel@vger.kernel.org,
linux-input@vger.kernel.org, linux-leds@vger.kernel.org,
rtc-linux@googlegroups.com, m.szyprowski@samsung.com
Subject: Re: [PATCH 1/3] mfd: max8997: use regmap to access registers
Date: Tue, 11 Mar 2014 16:20:11 +0100 [thread overview]
Message-ID: <1394551211.24263.34.camel@AMDC1943> (raw)
In-Reply-To: <531F24C0.3070603@samsung.com>
On Tue, 2014-03-11 at 15:59 +0100, Robert Baldyga wrote:
> >> @@ -180,12 +167,12 @@ static struct irq_chip max8997_irq_chip = {
> >> static irqreturn_t max8997_irq_thread(int irq, void *data) {
> >> struct max8997_dev *max8997 = data; - u8
> >> irq_reg[MAX8997_IRQ_GROUP_NR] = {}; - u8 irq_src; + unsigned int
> >> irq_reg[MAX8997_IRQ_GROUP_NR] = {}; + unsigned int irq_src; int
> >> ret; int i, cur_irq;
> >>
> >> - ret = max8997_read_reg(max8997->i2c, MAX8997_REG_INTSRC,
> >> &irq_src); + ret = regmap_read(max8997->regmap,
> >> MAX8997_REG_INTSRC, &irq_src); if (ret < 0) { dev_err(max8997->dev,
> >> "Failed to read interrupt source: %d\n", ret); @@ -194,8 +181,9 @@
> >> static irqreturn_t max8997_irq_thread(int irq, void *data)
> >>
> >> if (irq_src & MAX8997_IRQSRC_PMIC) { /* PMIC INT1 ~ INT4 */ -
> >> max8997_bulk_read(max8997->i2c, MAX8997_REG_INT1, 4, -
> >> &irq_reg[PMIC_INT1]); + for (i = 0; i < 4; ++i) +
> >> regmap_read(max8997->regmap, + MAX8997_REG_INT1+i,
> >> &irq_reg[PMIC_INT1+i]);
> >
> > Can't you use here one bulk read instead of 4xregmap_read()?
>
> Mixing regmap_read and regmap_bulk_read is not good idea, because the
> first function returns register value as unsigned int, but the second
> returns reg value to each single byte. So it would need to do some
> additional operations, and makes things more complicated.
The only mixing I see would be in reading FLASHSTATUS register which
could be resolved with:
if (irq_src & MAX8997_IRQSRC_FLASH) {
/* Flash Status Interrupt */
unsigned int data;
ret = regmap_read(max8997->regmap, MAX8997_REG_FLASHSTATUS,
&data);
irq_reg[FLASH_STATUS] = data;
}
This isn't more complicated than replacing bulk read with a loop :).
Best regards,
Krzysztof
next prev parent reply other threads:[~2014-03-11 15:20 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-11 13:58 [PATCH 0/3] mfd: max8997: add regmap support Robert Baldyga
2014-03-11 13:58 ` [PATCH 1/3] mfd: max8997: use regmap to access registers Robert Baldyga
2014-03-11 14:32 ` Krzysztof Kozlowski
2014-03-11 14:59 ` Robert Baldyga
2014-03-11 15:20 ` Krzysztof Kozlowski [this message]
2014-03-11 13:58 ` [PATCH 2/3] mfd: max8997: handle IRQs using regmap Robert Baldyga
2014-03-11 14:43 ` Krzysztof Kozlowski
2014-03-11 13:58 ` [PATCH 3/3] mfd: max8997: move regmap handling to function drivers Robert Baldyga
2014-03-11 15:07 ` Krzysztof Kozlowski
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=1394551211.24263.34.camel@AMDC1943 \
--to=k.kozlowski@samsung.com \
--cc=a.zummo@towertech.it \
--cc=broonie@kernel.org \
--cc=cooloney@gmail.com \
--cc=cw00.choi@samsung.com \
--cc=dbaryshkov@gmail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=dwmw2@infradead.org \
--cc=lee.jones@linaro.org \
--cc=lgirdwood@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=myungjoo.ham@samsung.com \
--cc=paul.gortmaker@windriver.com \
--cc=r.baldyga@samsung.com \
--cc=rpurdie@rpsys.net \
--cc=rtc-linux@googlegroups.com \
--cc=sameo@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 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.