From: Lee Jones <lee.jones@linaro.org>
To: patrice.chotard@st.com
Cc: linus.walleij@linaro.org, gnurou@gmail.com,
linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, maxime.coquelin@st.com,
amelie.delaunay@st.com, shawnguo@kernel.org,
kernel@pengutronix.de, dinguyen@opensource.altera.com,
vireshk@kernel.org, shiraz.linux.kernel@gmail.com,
swarren@wwwdotorg.org, thierry.reding@gmail.com
Subject: Re: [PATCH 2/8] mfd: stmpe: Add reset support for all STMPE variant
Date: Tue, 26 Apr 2016 09:18:48 +0100 [thread overview]
Message-ID: <20160426081848.GA6881@dell> (raw)
In-Reply-To: <1461068317-28016-3-git-send-email-patrice.chotard@st.com>
On Tue, 19 Apr 2016, patrice.chotard@st.com wrote:
> From: Patrice Chotard <patrice.chotard@st.com>
>
> Reset was only implemented for STMPE1801 variant despite
> all variant have a SOFT_RESET bit.
>
> For STMPE2401/2403/801/1601/1801 SOFT_RESET bit is bit 7
> of SYS_CTRL register.
> For STMPE610/811 (which have the same variant id) SOFT_RESET
> bit is bit 1 of SYS_CTRL register.
>
> Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
> ---
> drivers/mfd/stmpe.c | 23 +++++++++++++++--------
> drivers/mfd/stmpe.h | 7 +++++--
> 2 files changed, 20 insertions(+), 10 deletions(-)
When you fix and resubmit, please add my:
Acked-by: Lee Jones <lee.jones@linaro.org>
... for my own personal reference.
> diff --git a/drivers/mfd/stmpe.c b/drivers/mfd/stmpe.c
> index c553b73..af682d0 100644
> --- a/drivers/mfd/stmpe.c
> +++ b/drivers/mfd/stmpe.c
> @@ -735,13 +735,22 @@ static int stmpe1801_enable(struct stmpe *stmpe, unsigned int blocks,
> enable ? mask : 0);
> }
>
> -static int stmpe1801_reset(struct stmpe *stmpe)
> +static int stmpe_reset(struct stmpe *stmpe)
> {
> + u16 id_val = stmpe->variant->id_val;
> unsigned long timeout;
> int ret = 0;
> + u8 reset_bit;
> +
> + if (id_val == STMPE811_ID)
> + /* STMPE801 and STMPE610 use bit 1 of SYS_CTRL register */
> + reset_bit = STMPE811_SYS_CTRL_RESET;
> + else
> + /* all other STMPE variant use bit 7 of SYS_CTRL register */
> + reset_bit = STMPE_SYS_CTRL_RESET;
>
> ret = __stmpe_set_bits(stmpe, stmpe->regs[STMPE_IDX_SYS_CTRL],
> - STMPE1801_MSK_SYS_CTRL_RESET, STMPE1801_MSK_SYS_CTRL_RESET);
> + reset_bit, reset_bit);
> if (ret < 0)
> return ret;
>
> @@ -750,7 +759,7 @@ static int stmpe1801_reset(struct stmpe *stmpe)
> ret = __stmpe_reg_read(stmpe, stmpe->regs[STMPE_IDX_SYS_CTRL]);
> if (ret < 0)
> return ret;
> - if (!(ret & STMPE1801_MSK_SYS_CTRL_RESET))
> + if (!(ret & reset_bit))
> return 0;
> usleep_range(100, 200);
> }
> @@ -1074,11 +1083,9 @@ static int stmpe_chip_init(struct stmpe *stmpe)
> if (ret)
> return ret;
>
> - if (id == STMPE1801_ID) {
> - ret = stmpe1801_reset(stmpe);
> - if (ret < 0)
> - return ret;
> - }
> + ret = stmpe_reset(stmpe);
> + if (ret < 0)
> + return ret;
>
> if (stmpe->irq >= 0) {
> if (id == STMPE801_ID)
> diff --git a/drivers/mfd/stmpe.h b/drivers/mfd/stmpe.h
> index 406f9f2..4ae343d 100644
> --- a/drivers/mfd/stmpe.h
> +++ b/drivers/mfd/stmpe.h
> @@ -104,6 +104,8 @@ int stmpe_remove(struct stmpe *stmpe);
> #define STMPE_ICR_LSB_EDGE (1 << 1)
> #define STMPE_ICR_LSB_GIM (1 << 0)
>
> +#define STMPE_SYS_CTRL_RESET (1 << 7)
> +
> /*
> * STMPE801
> */
> @@ -126,6 +128,7 @@ int stmpe_remove(struct stmpe *stmpe);
> /*
> * STMPE811
> */
> +#define STMPE811_ID 0x0811
>
> #define STMPE811_IRQ_TOUCH_DET 0
> #define STMPE811_IRQ_FIFO_TH 1
> @@ -155,6 +158,8 @@ int stmpe_remove(struct stmpe *stmpe);
> #define STMPE811_REG_GPIO_FE 0x16
> #define STMPE811_REG_GPIO_AF 0x17
>
> +#define STMPE811_SYS_CTRL_RESET (1 << 1)
> +
> #define STMPE811_SYS_CTRL2_ADC_OFF (1 << 0)
> #define STMPE811_SYS_CTRL2_TSC_OFF (1 << 1)
> #define STMPE811_SYS_CTRL2_GPIO_OFF (1 << 2)
> @@ -244,8 +249,6 @@ int stmpe_remove(struct stmpe *stmpe);
> #define STMPE1801_REG_GPIO_PULL_UP_MID 0x23
> #define STMPE1801_REG_GPIO_PULL_UP_HIGH 0x24
>
> -#define STMPE1801_MSK_SYS_CTRL_RESET (1 << 7)
> -
> #define STMPE1801_MSK_INT_EN_KPC (1 << 1)
> #define STMPE1801_MSK_INT_EN_GPIO (1 << 3)
>
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
WARNING: multiple messages have this Message-ID (diff)
From: lee.jones@linaro.org (Lee Jones)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/8] mfd: stmpe: Add reset support for all STMPE variant
Date: Tue, 26 Apr 2016 09:18:48 +0100 [thread overview]
Message-ID: <20160426081848.GA6881@dell> (raw)
In-Reply-To: <1461068317-28016-3-git-send-email-patrice.chotard@st.com>
On Tue, 19 Apr 2016, patrice.chotard at st.com wrote:
> From: Patrice Chotard <patrice.chotard@st.com>
>
> Reset was only implemented for STMPE1801 variant despite
> all variant have a SOFT_RESET bit.
>
> For STMPE2401/2403/801/1601/1801 SOFT_RESET bit is bit 7
> of SYS_CTRL register.
> For STMPE610/811 (which have the same variant id) SOFT_RESET
> bit is bit 1 of SYS_CTRL register.
>
> Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
> ---
> drivers/mfd/stmpe.c | 23 +++++++++++++++--------
> drivers/mfd/stmpe.h | 7 +++++--
> 2 files changed, 20 insertions(+), 10 deletions(-)
When you fix and resubmit, please add my:
Acked-by: Lee Jones <lee.jones@linaro.org>
... for my own personal reference.
> diff --git a/drivers/mfd/stmpe.c b/drivers/mfd/stmpe.c
> index c553b73..af682d0 100644
> --- a/drivers/mfd/stmpe.c
> +++ b/drivers/mfd/stmpe.c
> @@ -735,13 +735,22 @@ static int stmpe1801_enable(struct stmpe *stmpe, unsigned int blocks,
> enable ? mask : 0);
> }
>
> -static int stmpe1801_reset(struct stmpe *stmpe)
> +static int stmpe_reset(struct stmpe *stmpe)
> {
> + u16 id_val = stmpe->variant->id_val;
> unsigned long timeout;
> int ret = 0;
> + u8 reset_bit;
> +
> + if (id_val == STMPE811_ID)
> + /* STMPE801 and STMPE610 use bit 1 of SYS_CTRL register */
> + reset_bit = STMPE811_SYS_CTRL_RESET;
> + else
> + /* all other STMPE variant use bit 7 of SYS_CTRL register */
> + reset_bit = STMPE_SYS_CTRL_RESET;
>
> ret = __stmpe_set_bits(stmpe, stmpe->regs[STMPE_IDX_SYS_CTRL],
> - STMPE1801_MSK_SYS_CTRL_RESET, STMPE1801_MSK_SYS_CTRL_RESET);
> + reset_bit, reset_bit);
> if (ret < 0)
> return ret;
>
> @@ -750,7 +759,7 @@ static int stmpe1801_reset(struct stmpe *stmpe)
> ret = __stmpe_reg_read(stmpe, stmpe->regs[STMPE_IDX_SYS_CTRL]);
> if (ret < 0)
> return ret;
> - if (!(ret & STMPE1801_MSK_SYS_CTRL_RESET))
> + if (!(ret & reset_bit))
> return 0;
> usleep_range(100, 200);
> }
> @@ -1074,11 +1083,9 @@ static int stmpe_chip_init(struct stmpe *stmpe)
> if (ret)
> return ret;
>
> - if (id == STMPE1801_ID) {
> - ret = stmpe1801_reset(stmpe);
> - if (ret < 0)
> - return ret;
> - }
> + ret = stmpe_reset(stmpe);
> + if (ret < 0)
> + return ret;
>
> if (stmpe->irq >= 0) {
> if (id == STMPE801_ID)
> diff --git a/drivers/mfd/stmpe.h b/drivers/mfd/stmpe.h
> index 406f9f2..4ae343d 100644
> --- a/drivers/mfd/stmpe.h
> +++ b/drivers/mfd/stmpe.h
> @@ -104,6 +104,8 @@ int stmpe_remove(struct stmpe *stmpe);
> #define STMPE_ICR_LSB_EDGE (1 << 1)
> #define STMPE_ICR_LSB_GIM (1 << 0)
>
> +#define STMPE_SYS_CTRL_RESET (1 << 7)
> +
> /*
> * STMPE801
> */
> @@ -126,6 +128,7 @@ int stmpe_remove(struct stmpe *stmpe);
> /*
> * STMPE811
> */
> +#define STMPE811_ID 0x0811
>
> #define STMPE811_IRQ_TOUCH_DET 0
> #define STMPE811_IRQ_FIFO_TH 1
> @@ -155,6 +158,8 @@ int stmpe_remove(struct stmpe *stmpe);
> #define STMPE811_REG_GPIO_FE 0x16
> #define STMPE811_REG_GPIO_AF 0x17
>
> +#define STMPE811_SYS_CTRL_RESET (1 << 1)
> +
> #define STMPE811_SYS_CTRL2_ADC_OFF (1 << 0)
> #define STMPE811_SYS_CTRL2_TSC_OFF (1 << 1)
> #define STMPE811_SYS_CTRL2_GPIO_OFF (1 << 2)
> @@ -244,8 +249,6 @@ int stmpe_remove(struct stmpe *stmpe);
> #define STMPE1801_REG_GPIO_PULL_UP_MID 0x23
> #define STMPE1801_REG_GPIO_PULL_UP_HIGH 0x24
>
> -#define STMPE1801_MSK_SYS_CTRL_RESET (1 << 7)
> -
> #define STMPE1801_MSK_INT_EN_KPC (1 << 1)
> #define STMPE1801_MSK_INT_EN_GPIO (1 << 3)
>
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org ? Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
WARNING: multiple messages have this Message-ID (diff)
From: Lee Jones <lee.jones@linaro.org>
To: patrice.chotard@st.com
Cc: linus.walleij@linaro.org, gnurou@gmail.com,
linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, maxime.coquelin@st.com,
amelie.delaunay@st.com, shawnguo@kernel.org,
kernel@pengutronix.de, dinguyen@opensource.altera.com,
vireshk@kernel.org, shiraz.linux.kernel@gmail.com,
swarren@wwwdotorg.org, thierry.reding@gmail.com
Subject: Re: [PATCH 2/8] mfd: stmpe: Add reset support for all STMPE variant
Date: Tue, 26 Apr 2016 09:18:48 +0100 [thread overview]
Message-ID: <20160426081848.GA6881@dell> (raw)
In-Reply-To: <1461068317-28016-3-git-send-email-patrice.chotard@st.com>
On Tue, 19 Apr 2016, patrice.chotard@st.com wrote:
> From: Patrice Chotard <patrice.chotard@st.com>
>
> Reset was only implemented for STMPE1801 variant despite
> all variant have a SOFT_RESET bit.
>
> For STMPE2401/2403/801/1601/1801 SOFT_RESET bit is bit 7
> of SYS_CTRL register.
> For STMPE610/811 (which have the same variant id) SOFT_RESET
> bit is bit 1 of SYS_CTRL register.
>
> Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
> ---
> drivers/mfd/stmpe.c | 23 +++++++++++++++--------
> drivers/mfd/stmpe.h | 7 +++++--
> 2 files changed, 20 insertions(+), 10 deletions(-)
When you fix and resubmit, please add my:
Acked-by: Lee Jones <lee.jones@linaro.org>
... for my own personal reference.
> diff --git a/drivers/mfd/stmpe.c b/drivers/mfd/stmpe.c
> index c553b73..af682d0 100644
> --- a/drivers/mfd/stmpe.c
> +++ b/drivers/mfd/stmpe.c
> @@ -735,13 +735,22 @@ static int stmpe1801_enable(struct stmpe *stmpe, unsigned int blocks,
> enable ? mask : 0);
> }
>
> -static int stmpe1801_reset(struct stmpe *stmpe)
> +static int stmpe_reset(struct stmpe *stmpe)
> {
> + u16 id_val = stmpe->variant->id_val;
> unsigned long timeout;
> int ret = 0;
> + u8 reset_bit;
> +
> + if (id_val == STMPE811_ID)
> + /* STMPE801 and STMPE610 use bit 1 of SYS_CTRL register */
> + reset_bit = STMPE811_SYS_CTRL_RESET;
> + else
> + /* all other STMPE variant use bit 7 of SYS_CTRL register */
> + reset_bit = STMPE_SYS_CTRL_RESET;
>
> ret = __stmpe_set_bits(stmpe, stmpe->regs[STMPE_IDX_SYS_CTRL],
> - STMPE1801_MSK_SYS_CTRL_RESET, STMPE1801_MSK_SYS_CTRL_RESET);
> + reset_bit, reset_bit);
> if (ret < 0)
> return ret;
>
> @@ -750,7 +759,7 @@ static int stmpe1801_reset(struct stmpe *stmpe)
> ret = __stmpe_reg_read(stmpe, stmpe->regs[STMPE_IDX_SYS_CTRL]);
> if (ret < 0)
> return ret;
> - if (!(ret & STMPE1801_MSK_SYS_CTRL_RESET))
> + if (!(ret & reset_bit))
> return 0;
> usleep_range(100, 200);
> }
> @@ -1074,11 +1083,9 @@ static int stmpe_chip_init(struct stmpe *stmpe)
> if (ret)
> return ret;
>
> - if (id == STMPE1801_ID) {
> - ret = stmpe1801_reset(stmpe);
> - if (ret < 0)
> - return ret;
> - }
> + ret = stmpe_reset(stmpe);
> + if (ret < 0)
> + return ret;
>
> if (stmpe->irq >= 0) {
> if (id == STMPE801_ID)
> diff --git a/drivers/mfd/stmpe.h b/drivers/mfd/stmpe.h
> index 406f9f2..4ae343d 100644
> --- a/drivers/mfd/stmpe.h
> +++ b/drivers/mfd/stmpe.h
> @@ -104,6 +104,8 @@ int stmpe_remove(struct stmpe *stmpe);
> #define STMPE_ICR_LSB_EDGE (1 << 1)
> #define STMPE_ICR_LSB_GIM (1 << 0)
>
> +#define STMPE_SYS_CTRL_RESET (1 << 7)
> +
> /*
> * STMPE801
> */
> @@ -126,6 +128,7 @@ int stmpe_remove(struct stmpe *stmpe);
> /*
> * STMPE811
> */
> +#define STMPE811_ID 0x0811
>
> #define STMPE811_IRQ_TOUCH_DET 0
> #define STMPE811_IRQ_FIFO_TH 1
> @@ -155,6 +158,8 @@ int stmpe_remove(struct stmpe *stmpe);
> #define STMPE811_REG_GPIO_FE 0x16
> #define STMPE811_REG_GPIO_AF 0x17
>
> +#define STMPE811_SYS_CTRL_RESET (1 << 1)
> +
> #define STMPE811_SYS_CTRL2_ADC_OFF (1 << 0)
> #define STMPE811_SYS_CTRL2_TSC_OFF (1 << 1)
> #define STMPE811_SYS_CTRL2_GPIO_OFF (1 << 2)
> @@ -244,8 +249,6 @@ int stmpe_remove(struct stmpe *stmpe);
> #define STMPE1801_REG_GPIO_PULL_UP_MID 0x23
> #define STMPE1801_REG_GPIO_PULL_UP_HIGH 0x24
>
> -#define STMPE1801_MSK_SYS_CTRL_RESET (1 << 7)
> -
> #define STMPE1801_MSK_INT_EN_KPC (1 << 1)
> #define STMPE1801_MSK_INT_EN_GPIO (1 << 3)
>
--
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:[~2016-04-26 8:18 UTC|newest]
Thread overview: 78+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-19 12:18 [PATCH 0/8] STMPE fixes/rework and add STMPE1600 support patrice.chotard
2016-04-19 12:18 ` patrice.chotard
2016-04-19 12:18 ` patrice.chotard at st.com
2016-04-19 12:18 ` [PATCH 1/8] mfd: stmpe: Add STMPE_IDX_SYS_CTRL/2 enum patrice.chotard
2016-04-19 12:18 ` patrice.chotard
2016-04-19 12:18 ` patrice.chotard at st.com
2016-04-20 14:32 ` Linus Walleij
2016-04-20 14:32 ` Linus Walleij
2016-04-26 8:19 ` Lee Jones
2016-04-26 8:19 ` Lee Jones
2016-04-26 8:19 ` Lee Jones
2016-04-19 12:18 ` [PATCH 2/8] mfd: stmpe: Add reset support for all STMPE variant patrice.chotard
2016-04-19 12:18 ` patrice.chotard
2016-04-19 12:18 ` patrice.chotard at st.com
2016-04-20 14:34 ` Linus Walleij
2016-04-20 14:34 ` Linus Walleij
2016-04-26 8:18 ` Lee Jones [this message]
2016-04-26 8:18 ` Lee Jones
2016-04-26 8:18 ` Lee Jones
2016-04-19 12:18 ` [PATCH 3/8] gpio: stmpe: fix edge and rising/falling edge detection patrice.chotard
2016-04-19 12:18 ` patrice.chotard
2016-04-19 12:18 ` patrice.chotard at st.com
2016-04-19 12:38 ` kbuild test robot
2016-04-19 12:38 ` kbuild test robot
2016-04-19 12:38 ` kbuild test robot
2016-04-20 14:37 ` Linus Walleij
2016-04-20 14:37 ` Linus Walleij
2016-04-21 13:48 ` Patrice Chotard
2016-04-21 13:48 ` Patrice Chotard
2016-04-21 13:48 ` Patrice Chotard
2016-04-19 12:18 ` [PATCH 4/8] gpio: stmpe: write int status register only when needed patrice.chotard
2016-04-19 12:18 ` patrice.chotard
2016-04-19 12:18 ` patrice.chotard at st.com
2016-04-20 14:38 ` Linus Walleij
2016-04-20 14:38 ` Linus Walleij
2016-04-19 12:18 ` [PATCH 5/8] Documentation: dt: add stmpe1600 compatible string to stmpe mfd patrice.chotard
2016-04-19 12:18 ` patrice.chotard
2016-04-19 12:18 ` patrice.chotard at st.com
2016-04-20 14:39 ` Linus Walleij
2016-04-20 14:39 ` Linus Walleij
2016-04-19 12:18 ` [PATCH 6/8] mfd: Add STMPE1600 support patrice.chotard
2016-04-19 12:18 ` patrice.chotard
2016-04-19 12:18 ` patrice.chotard at st.com
2016-04-20 14:43 ` Linus Walleij
2016-04-20 14:43 ` Linus Walleij
2016-04-21 13:51 ` Patrice Chotard
2016-04-21 13:51 ` Patrice Chotard
2016-04-21 13:51 ` Patrice Chotard
2016-04-19 12:18 ` [PATCH 7/8] gpio: stmpe: " patrice.chotard
2016-04-19 12:18 ` patrice.chotard
2016-04-19 12:18 ` patrice.chotard at st.com
2016-04-20 14:53 ` Linus Walleij
2016-04-20 14:53 ` Linus Walleij
2016-04-22 7:17 ` Patrice Chotard
2016-04-22 7:17 ` Patrice Chotard
2016-04-22 7:17 ` Patrice Chotard
2016-04-19 12:18 ` [PATCH 8/8] gpio: stmpe: configure GPIO as output by default patrice.chotard
2016-04-19 12:18 ` patrice.chotard
2016-04-19 12:18 ` patrice.chotard at st.com
2016-04-20 14:56 ` Linus Walleij
2016-04-20 14:56 ` Linus Walleij
2016-04-19 12:41 ` [PATCH 0/8] STMPE fixes/rework and add STMPE1600 support Thierry Reding
2016-04-19 12:41 ` Thierry Reding
2016-04-20 16:15 ` Marcel Ziswiler
2016-04-20 16:15 ` Marcel Ziswiler
2016-04-20 16:15 ` Marcel Ziswiler
2016-04-19 15:53 ` Stephen Warren
2016-04-19 15:53 ` Stephen Warren
2016-04-20 7:40 ` Patrice Chotard
2016-04-20 7:40 ` Patrice Chotard
2016-04-20 7:40 ` Patrice Chotard
2016-04-20 16:02 ` Stephen Warren
2016-04-20 16:02 ` Stephen Warren
2016-04-21 2:39 ` Marcel Ziswiler
2016-04-21 2:39 ` Marcel Ziswiler
2016-04-21 2:39 ` Marcel Ziswiler
2016-04-20 14:25 ` Linus Walleij
2016-04-20 14:25 ` Linus Walleij
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=20160426081848.GA6881@dell \
--to=lee.jones@linaro.org \
--cc=amelie.delaunay@st.com \
--cc=dinguyen@opensource.altera.com \
--cc=gnurou@gmail.com \
--cc=kernel@pengutronix.de \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maxime.coquelin@st.com \
--cc=patrice.chotard@st.com \
--cc=shawnguo@kernel.org \
--cc=shiraz.linux.kernel@gmail.com \
--cc=swarren@wwwdotorg.org \
--cc=thierry.reding@gmail.com \
--cc=vireshk@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.