From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Cc: matthias.bgg@gmail.com, mkorpershoek@baylibre.com,
linux-input@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/5] Input: mtk-pmic-keys - Use regmap_{set,clear}_bits where possible
Date: Mon, 23 May 2022 09:58:50 -0700 [thread overview]
Message-ID: <You9SjGt4UjJk17/@google.com> (raw)
In-Reply-To: <926ce818-4f42-898d-aca8-185b5c7434ba@collabora.com>
On Mon, May 23, 2022 at 10:58:47AM +0200, AngeloGioacchino Del Regno wrote:
> Il 23/05/22 06:51, Dmitry Torokhov ha scritto:
> > On Fri, May 20, 2022 at 02:51:29PM +0200, AngeloGioacchino Del Regno wrote:
> > > Instead of always using regmap_update_bits(), let's go for the shorter
> > > regmap_set_bits() and regmap_clear_bits() where possible.
> > >
> > > No functional change.
> > >
> > > Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> > > ---
> > > drivers/input/keyboard/mtk-pmic-keys.c | 24 ++++++------------------
> > > 1 file changed, 6 insertions(+), 18 deletions(-)
> > >
> > > diff --git a/drivers/input/keyboard/mtk-pmic-keys.c b/drivers/input/keyboard/mtk-pmic-keys.c
> > > index 8e4fa7cd16e6..83d0b90cc8cb 100644
> > > --- a/drivers/input/keyboard/mtk-pmic-keys.c
> > > +++ b/drivers/input/keyboard/mtk-pmic-keys.c
> > > @@ -157,28 +157,16 @@ static void mtk_pmic_keys_lp_reset_setup(struct mtk_pmic_keys *keys,
> > > switch (long_press_mode) {
> > > case LP_ONEKEY:
> > > - regmap_update_bits(keys->regmap, pmic_rst_reg,
> > > - MTK_PMIC_PWRKEY_RST,
> > > - MTK_PMIC_PWRKEY_RST);
> > > - regmap_update_bits(keys->regmap, pmic_rst_reg,
> > > - MTK_PMIC_HOMEKEY_RST,
> > > - 0);
> > > + regmap_set_bits(keys->regmap, pmic_rst_reg, MTK_PMIC_PWRKEY_RST);
> > > + regmap_clear_bits(keys->regmap, pmic_rst_reg, MTK_PMIC_HOMEKEY_RST);
> >
> > Why not combine this into a single update instead? I.e. assuming
> >
>
> All downstream kernels (at least, I checked 4 different kernel versions for 4
> different SoCs) are doing these updates one-at-a-time, never combining them.
It is not like drivers in these downstream kernels were developed
separately and each of them discovered this as a requirement. It was
written once by someone and then either copied as is, or maybe
additional key handling was added later.
>
> Even though I agree with you about one single update being simply more logical,
> I am afraid that (on some SoCs) the IP will not like that so - since I don't have
> any *clear* documentation saying that this is possible, or that this is not, I
> would leave it like that.
If we go with that we will never be able to touch any of the hardware
interfaces, as I do not recall when spec would explicitly document every
register and call out that individual bits can be changed together in
one write.
Thanks.
--
Dmitry
WARNING: multiple messages have this Message-ID (diff)
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Cc: matthias.bgg@gmail.com, mkorpershoek@baylibre.com,
linux-input@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/5] Input: mtk-pmic-keys - Use regmap_{set,clear}_bits where possible
Date: Mon, 23 May 2022 09:58:50 -0700 [thread overview]
Message-ID: <You9SjGt4UjJk17/@google.com> (raw)
In-Reply-To: <926ce818-4f42-898d-aca8-185b5c7434ba@collabora.com>
On Mon, May 23, 2022 at 10:58:47AM +0200, AngeloGioacchino Del Regno wrote:
> Il 23/05/22 06:51, Dmitry Torokhov ha scritto:
> > On Fri, May 20, 2022 at 02:51:29PM +0200, AngeloGioacchino Del Regno wrote:
> > > Instead of always using regmap_update_bits(), let's go for the shorter
> > > regmap_set_bits() and regmap_clear_bits() where possible.
> > >
> > > No functional change.
> > >
> > > Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> > > ---
> > > drivers/input/keyboard/mtk-pmic-keys.c | 24 ++++++------------------
> > > 1 file changed, 6 insertions(+), 18 deletions(-)
> > >
> > > diff --git a/drivers/input/keyboard/mtk-pmic-keys.c b/drivers/input/keyboard/mtk-pmic-keys.c
> > > index 8e4fa7cd16e6..83d0b90cc8cb 100644
> > > --- a/drivers/input/keyboard/mtk-pmic-keys.c
> > > +++ b/drivers/input/keyboard/mtk-pmic-keys.c
> > > @@ -157,28 +157,16 @@ static void mtk_pmic_keys_lp_reset_setup(struct mtk_pmic_keys *keys,
> > > switch (long_press_mode) {
> > > case LP_ONEKEY:
> > > - regmap_update_bits(keys->regmap, pmic_rst_reg,
> > > - MTK_PMIC_PWRKEY_RST,
> > > - MTK_PMIC_PWRKEY_RST);
> > > - regmap_update_bits(keys->regmap, pmic_rst_reg,
> > > - MTK_PMIC_HOMEKEY_RST,
> > > - 0);
> > > + regmap_set_bits(keys->regmap, pmic_rst_reg, MTK_PMIC_PWRKEY_RST);
> > > + regmap_clear_bits(keys->regmap, pmic_rst_reg, MTK_PMIC_HOMEKEY_RST);
> >
> > Why not combine this into a single update instead? I.e. assuming
> >
>
> All downstream kernels (at least, I checked 4 different kernel versions for 4
> different SoCs) are doing these updates one-at-a-time, never combining them.
It is not like drivers in these downstream kernels were developed
separately and each of them discovered this as a requirement. It was
written once by someone and then either copied as is, or maybe
additional key handling was added later.
>
> Even though I agree with you about one single update being simply more logical,
> I am afraid that (on some SoCs) the IP will not like that so - since I don't have
> any *clear* documentation saying that this is possible, or that this is not, I
> would leave it like that.
If we go with that we will never be able to touch any of the hardware
interfaces, as I do not recall when spec would explicitly document every
register and call out that individual bits can be changed together in
one write.
Thanks.
--
Dmitry
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
WARNING: multiple messages have this Message-ID (diff)
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Cc: matthias.bgg@gmail.com, mkorpershoek@baylibre.com,
linux-input@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/5] Input: mtk-pmic-keys - Use regmap_{set,clear}_bits where possible
Date: Mon, 23 May 2022 09:58:50 -0700 [thread overview]
Message-ID: <You9SjGt4UjJk17/@google.com> (raw)
In-Reply-To: <926ce818-4f42-898d-aca8-185b5c7434ba@collabora.com>
On Mon, May 23, 2022 at 10:58:47AM +0200, AngeloGioacchino Del Regno wrote:
> Il 23/05/22 06:51, Dmitry Torokhov ha scritto:
> > On Fri, May 20, 2022 at 02:51:29PM +0200, AngeloGioacchino Del Regno wrote:
> > > Instead of always using regmap_update_bits(), let's go for the shorter
> > > regmap_set_bits() and regmap_clear_bits() where possible.
> > >
> > > No functional change.
> > >
> > > Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> > > ---
> > > drivers/input/keyboard/mtk-pmic-keys.c | 24 ++++++------------------
> > > 1 file changed, 6 insertions(+), 18 deletions(-)
> > >
> > > diff --git a/drivers/input/keyboard/mtk-pmic-keys.c b/drivers/input/keyboard/mtk-pmic-keys.c
> > > index 8e4fa7cd16e6..83d0b90cc8cb 100644
> > > --- a/drivers/input/keyboard/mtk-pmic-keys.c
> > > +++ b/drivers/input/keyboard/mtk-pmic-keys.c
> > > @@ -157,28 +157,16 @@ static void mtk_pmic_keys_lp_reset_setup(struct mtk_pmic_keys *keys,
> > > switch (long_press_mode) {
> > > case LP_ONEKEY:
> > > - regmap_update_bits(keys->regmap, pmic_rst_reg,
> > > - MTK_PMIC_PWRKEY_RST,
> > > - MTK_PMIC_PWRKEY_RST);
> > > - regmap_update_bits(keys->regmap, pmic_rst_reg,
> > > - MTK_PMIC_HOMEKEY_RST,
> > > - 0);
> > > + regmap_set_bits(keys->regmap, pmic_rst_reg, MTK_PMIC_PWRKEY_RST);
> > > + regmap_clear_bits(keys->regmap, pmic_rst_reg, MTK_PMIC_HOMEKEY_RST);
> >
> > Why not combine this into a single update instead? I.e. assuming
> >
>
> All downstream kernels (at least, I checked 4 different kernel versions for 4
> different SoCs) are doing these updates one-at-a-time, never combining them.
It is not like drivers in these downstream kernels were developed
separately and each of them discovered this as a requirement. It was
written once by someone and then either copied as is, or maybe
additional key handling was added later.
>
> Even though I agree with you about one single update being simply more logical,
> I am afraid that (on some SoCs) the IP will not like that so - since I don't have
> any *clear* documentation saying that this is possible, or that this is not, I
> would leave it like that.
If we go with that we will never be able to touch any of the hardware
interfaces, as I do not recall when spec would explicitly document every
register and call out that individual bits can be changed together in
one write.
Thanks.
--
Dmitry
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-05-23 16:59 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-20 12:51 [PATCH 0/5] MediaTek Helio X10 MT6795 - MT6331 PMIC Keys AngeloGioacchino Del Regno
2022-05-20 12:51 ` AngeloGioacchino Del Regno
2022-05-20 12:51 ` AngeloGioacchino Del Regno
2022-05-20 12:51 ` [PATCH 1/5] Input: mtk-pmic-keys - Add kerneldoc to driver structures AngeloGioacchino Del Regno
2022-05-20 12:51 ` AngeloGioacchino Del Regno
2022-05-20 12:51 ` AngeloGioacchino Del Regno
2022-05-20 15:38 ` Mattijs Korpershoek
2022-05-20 15:38 ` Mattijs Korpershoek
2022-05-20 15:38 ` Mattijs Korpershoek
2022-05-23 4:33 ` Dmitry Torokhov
2022-05-23 4:33 ` Dmitry Torokhov
2022-05-23 4:33 ` Dmitry Torokhov
2022-05-23 8:54 ` AngeloGioacchino Del Regno
2022-05-23 8:54 ` AngeloGioacchino Del Regno
2022-05-23 8:54 ` AngeloGioacchino Del Regno
2022-05-23 16:17 ` Dmitry Torokhov
2022-05-23 16:17 ` Dmitry Torokhov
2022-05-23 16:17 ` Dmitry Torokhov
2022-05-20 12:51 ` [PATCH 2/5] Input: mtk-pmic-keys - Use regmap_{set,clear}_bits where possible AngeloGioacchino Del Regno
2022-05-20 12:51 ` [PATCH 2/5] Input: mtk-pmic-keys - Use regmap_{set, clear}_bits " AngeloGioacchino Del Regno
2022-05-20 12:51 ` AngeloGioacchino Del Regno
2022-05-20 15:38 ` [PATCH 2/5] Input: mtk-pmic-keys - Use regmap_{set,clear}_bits " Mattijs Korpershoek
2022-05-20 15:38 ` Mattijs Korpershoek
2022-05-20 15:38 ` Mattijs Korpershoek
2022-05-23 4:51 ` Dmitry Torokhov
2022-05-23 4:51 ` Dmitry Torokhov
2022-05-23 4:51 ` Dmitry Torokhov
2022-05-23 8:58 ` AngeloGioacchino Del Regno
2022-05-23 8:58 ` AngeloGioacchino Del Regno
2022-05-23 8:58 ` AngeloGioacchino Del Regno
2022-05-23 16:58 ` Dmitry Torokhov [this message]
2022-05-23 16:58 ` Dmitry Torokhov
2022-05-23 16:58 ` Dmitry Torokhov
2022-05-20 12:51 ` [PATCH 3/5] Input: mtk-pmic-keys - Transfer per-key bit in mtk_pmic_keys_regs AngeloGioacchino Del Regno
2022-05-20 12:51 ` AngeloGioacchino Del Regno
2022-05-20 12:51 ` AngeloGioacchino Del Regno
2022-05-20 15:38 ` Mattijs Korpershoek
2022-05-20 15:38 ` Mattijs Korpershoek
2022-05-20 15:38 ` Mattijs Korpershoek
2022-05-20 12:51 ` [PATCH 4/5] Input: mtk-pmic-keys - Move long press debounce mask to mtk_pmic_regs AngeloGioacchino Del Regno
2022-05-20 12:51 ` AngeloGioacchino Del Regno
2022-05-20 12:51 ` AngeloGioacchino Del Regno
2022-05-20 15:38 ` Mattijs Korpershoek
2022-05-20 15:38 ` Mattijs Korpershoek
2022-05-20 15:38 ` Mattijs Korpershoek
2022-05-20 12:51 ` [PATCH 5/5] Input: mtk-pmic-keys - Add support for MT6331 PMIC keys AngeloGioacchino Del Regno
2022-05-20 12:51 ` AngeloGioacchino Del Regno
2022-05-20 12:51 ` AngeloGioacchino Del Regno
2022-05-20 15:38 ` Mattijs Korpershoek
2022-05-20 15:38 ` Mattijs Korpershoek
2022-05-20 15:38 ` Mattijs Korpershoek
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=You9SjGt4UjJk17/@google.com \
--to=dmitry.torokhov@gmail.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=mkorpershoek@baylibre.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.