Re: [PATCH 6/6] pinctrl: mt8173: set GPIO16 to usb iddig mode

2016-11-30 Thread Hongzhou Yang
On Wed, 2016-11-23 at 19:32 +0100, Matthias Brugger wrote:
> Hi Hongzhou,
> 
> On 12/05/16 04:55, Hongzhou Yang wrote:
> > On Wed, 2016-05-11 at 19:09 -0700, Hongzhou Yang wrote:
> >> On Thu, 2016-05-12 at 09:41 +0800, chunfeng yun wrote:
> >>> Hi,
> >>>
> >>> On Wed, 2016-05-11 at 11:32 -0700, Hongzhou Yang wrote:
> >>>> On Wed, 2016-05-11 at 13:56 +0200, Linus Walleij wrote:
> >>>>> On Tue, May 10, 2016 at 10:23 AM, Chunfeng Yun
> >>>>> <chunfeng@mediatek.com> wrote:
> >>>>>
> >>>>>> the default mode of GPIO16 pin is gpio, when set EINT16 to
> >>>>>> IRQ_TYPE_LEVEL_HIGH, no interrupt is triggered, it can be
> >>>>>> fixed when set its default mode as usb iddig.
> >>>>>>
> >>>>>> Signed-off-by: Chunfeng Yun <chunfeng@mediatek.com>
> >>>>>
> >>>>
> >>>> Chunfeng, GPIO16 can be used as EINT16 mode, but the pinmux should be 0.
> >>>> If you want to set its default mode to iddig, you should set it in dts.
> >>>>
> >>> I set it in DTS, but it didn't work, because when usb driver requested
> >>> IRQ, pinmux was switched back to default mode set by
> >>> MTK_EINT_FUNCTION().
> >>>
> >>
> >> After confirmed, there are something wrong with data sheet and pinmux
> >> table, and GPIO16 can only receive interrupt by mode 1. So
> >>
> >> Acked-by: Hongzhou Yang <hongzhou.y...@mediatek.com>
> >>
> >
> > Linus,
> >
> > We find there are some other pins still have the same problem, so please
> > hold on it. Sorry for so much noise.
> >
> 
> Did you made any progress on this? I didn't see any patch on the mailing 
> list.
> 
> Regards,
> Matthias

Hi Matthias,

Sorry for the late reply.

I have double confirmed with HW designer, other special EINTs are
built-in and they are using internal signal, they are not triggered 
by GPIO, only GPIO16 should set to mode 1.

And, Chunfeng already re-sent this patch.

Thank you very much.

Yours,
Hongzhou



Re: [PATCH 6/6] pinctrl: mt8173: set GPIO16 to usb iddig mode

2016-11-30 Thread Hongzhou Yang
On Wed, 2016-11-23 at 19:32 +0100, Matthias Brugger wrote:
> Hi Hongzhou,
> 
> On 12/05/16 04:55, Hongzhou Yang wrote:
> > On Wed, 2016-05-11 at 19:09 -0700, Hongzhou Yang wrote:
> >> On Thu, 2016-05-12 at 09:41 +0800, chunfeng yun wrote:
> >>> Hi,
> >>>
> >>> On Wed, 2016-05-11 at 11:32 -0700, Hongzhou Yang wrote:
> >>>> On Wed, 2016-05-11 at 13:56 +0200, Linus Walleij wrote:
> >>>>> On Tue, May 10, 2016 at 10:23 AM, Chunfeng Yun
> >>>>>  wrote:
> >>>>>
> >>>>>> the default mode of GPIO16 pin is gpio, when set EINT16 to
> >>>>>> IRQ_TYPE_LEVEL_HIGH, no interrupt is triggered, it can be
> >>>>>> fixed when set its default mode as usb iddig.
> >>>>>>
> >>>>>> Signed-off-by: Chunfeng Yun 
> >>>>>
> >>>>
> >>>> Chunfeng, GPIO16 can be used as EINT16 mode, but the pinmux should be 0.
> >>>> If you want to set its default mode to iddig, you should set it in dts.
> >>>>
> >>> I set it in DTS, but it didn't work, because when usb driver requested
> >>> IRQ, pinmux was switched back to default mode set by
> >>> MTK_EINT_FUNCTION().
> >>>
> >>
> >> After confirmed, there are something wrong with data sheet and pinmux
> >> table, and GPIO16 can only receive interrupt by mode 1. So
> >>
> >> Acked-by: Hongzhou Yang 
> >>
> >
> > Linus,
> >
> > We find there are some other pins still have the same problem, so please
> > hold on it. Sorry for so much noise.
> >
> 
> Did you made any progress on this? I didn't see any patch on the mailing 
> list.
> 
> Regards,
> Matthias

Hi Matthias,

Sorry for the late reply.

I have double confirmed with HW designer, other special EINTs are
built-in and they are using internal signal, they are not triggered 
by GPIO, only GPIO16 should set to mode 1.

And, Chunfeng already re-sent this patch.

Thank you very much.

Yours,
Hongzhou



Re: [RESEND PATCH] pinctrl: mt8173: set GPIO16 to usb iddig mode

2016-11-30 Thread Hongzhou Yang
On Wed, 2016-11-30 at 10:21 +0800, Chunfeng Yun wrote:
> the default mode of GPIO16 pin is gpio, when set EINT16 to
> IRQ_TYPE_LEVEL_HIGH, no interrupt is triggered, it can be
> fixed when set its default mode as usb iddig.
> 
> Signed-off-by: Chunfeng Yun <chunfeng@mediatek.com>
> ---
>  drivers/pinctrl/mediatek/pinctrl-mtk-mt8173.h |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-mt8173.h 
> b/drivers/pinctrl/mediatek/pinctrl-mtk-mt8173.h
> index 13e5b68..9b018fd 100644
> --- a/drivers/pinctrl/mediatek/pinctrl-mtk-mt8173.h
> +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-mt8173.h
> @@ -201,7 +201,7 @@
>   MTK_PIN(
>   PINCTRL_PIN(16, "IDDIG"),
>   NULL, "mt8173",
> - MTK_EINT_FUNCTION(0, 16),
> + MTK_EINT_FUNCTION(1, 16),
>   MTK_FUNCTION(0, "GPIO16"),
>   MTK_FUNCTION(1, "IDDIG"),
>   MTK_FUNCTION(2, "CMFLASH"),

Acked-by: Hongzhou Yang <hongzhou.y...@mediatek.com>

Thanks,
Hongzhou



Re: [RESEND PATCH] pinctrl: mt8173: set GPIO16 to usb iddig mode

2016-11-30 Thread Hongzhou Yang
On Wed, 2016-11-30 at 10:21 +0800, Chunfeng Yun wrote:
> the default mode of GPIO16 pin is gpio, when set EINT16 to
> IRQ_TYPE_LEVEL_HIGH, no interrupt is triggered, it can be
> fixed when set its default mode as usb iddig.
> 
> Signed-off-by: Chunfeng Yun 
> ---
>  drivers/pinctrl/mediatek/pinctrl-mtk-mt8173.h |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-mt8173.h 
> b/drivers/pinctrl/mediatek/pinctrl-mtk-mt8173.h
> index 13e5b68..9b018fd 100644
> --- a/drivers/pinctrl/mediatek/pinctrl-mtk-mt8173.h
> +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-mt8173.h
> @@ -201,7 +201,7 @@
>   MTK_PIN(
>   PINCTRL_PIN(16, "IDDIG"),
>   NULL, "mt8173",
> - MTK_EINT_FUNCTION(0, 16),
> + MTK_EINT_FUNCTION(1, 16),
>   MTK_FUNCTION(0, "GPIO16"),
>   MTK_FUNCTION(1, "IDDIG"),
>   MTK_FUNCTION(2, "CMFLASH"),

Acked-by: Hongzhou Yang 

Thanks,
Hongzhou



Re: [PATCH] pinctrl: mediatek: use builtin_platform_driver

2016-11-18 Thread Hongzhou Yang
On Fri, 2016-11-18 at 22:12 +0800, Geliang Tang wrote:
> Use builtin_platform_driver() helper to simplify the code.
> 
> Signed-off-by: Geliang Tang <geliangt...@gmail.com>
> ---
>  drivers/pinctrl/mediatek/pinctrl-mt6397.c | 6 +-
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/drivers/pinctrl/mediatek/pinctrl-mt6397.c 
> b/drivers/pinctrl/mediatek/pinctrl-mt6397.c
> index 6eccb85..afcede7 100644
> --- a/drivers/pinctrl/mediatek/pinctrl-mt6397.c
> +++ b/drivers/pinctrl/mediatek/pinctrl-mt6397.c
> @@ -64,8 +64,4 @@ static struct platform_driver mtk_pinctrl_driver = {
>   },
>  };
>  
> -static int __init mtk_pinctrl_init(void)
> -{
> - return platform_driver_register(_pinctrl_driver);
> -}
> -device_initcall(mtk_pinctrl_init);
> +builtin_platform_driver(mtk_pinctrl_driver);

Acked-by: Hongzhou Yang <hongzhou.y...@mediatek.com>

Thanks,
Hongzhou



Re: [PATCH] pinctrl: mediatek: use builtin_platform_driver

2016-11-18 Thread Hongzhou Yang
On Fri, 2016-11-18 at 22:12 +0800, Geliang Tang wrote:
> Use builtin_platform_driver() helper to simplify the code.
> 
> Signed-off-by: Geliang Tang 
> ---
>  drivers/pinctrl/mediatek/pinctrl-mt6397.c | 6 +-
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/drivers/pinctrl/mediatek/pinctrl-mt6397.c 
> b/drivers/pinctrl/mediatek/pinctrl-mt6397.c
> index 6eccb85..afcede7 100644
> --- a/drivers/pinctrl/mediatek/pinctrl-mt6397.c
> +++ b/drivers/pinctrl/mediatek/pinctrl-mt6397.c
> @@ -64,8 +64,4 @@ static struct platform_driver mtk_pinctrl_driver = {
>   },
>  };
>  
> -static int __init mtk_pinctrl_init(void)
> -{
> - return platform_driver_register(_pinctrl_driver);
> -}
> -device_initcall(mtk_pinctrl_init);
> +builtin_platform_driver(mtk_pinctrl_driver);

Acked-by: Hongzhou Yang 

Thanks,
Hongzhou



Re: [PATCH 6/6] pinctrl: mt8173: set GPIO16 to usb iddig mode

2016-05-11 Thread Hongzhou Yang
On Wed, 2016-05-11 at 19:09 -0700, Hongzhou Yang wrote:
> On Thu, 2016-05-12 at 09:41 +0800, chunfeng yun wrote:
> > Hi,
> > 
> > On Wed, 2016-05-11 at 11:32 -0700, Hongzhou Yang wrote:
> > > On Wed, 2016-05-11 at 13:56 +0200, Linus Walleij wrote:
> > > > On Tue, May 10, 2016 at 10:23 AM, Chunfeng Yun
> > > > <chunfeng@mediatek.com> wrote:
> > > > 
> > > > > the default mode of GPIO16 pin is gpio, when set EINT16 to
> > > > > IRQ_TYPE_LEVEL_HIGH, no interrupt is triggered, it can be
> > > > > fixed when set its default mode as usb iddig.
> > > > >
> > > > > Signed-off-by: Chunfeng Yun <chunfeng@mediatek.com>
> > > > 
> > > 
> > > Chunfeng, GPIO16 can be used as EINT16 mode, but the pinmux should be 0.
> > > If you want to set its default mode to iddig, you should set it in dts.
> > > 
> > I set it in DTS, but it didn't work, because when usb driver requested
> > IRQ, pinmux was switched back to default mode set by
> > MTK_EINT_FUNCTION().
> > 
> 
> After confirmed, there are something wrong with data sheet and pinmux
> table, and GPIO16 can only receive interrupt by mode 1. So
> 
> Acked-by: Hongzhou Yang <hongzhou.y...@mediatek.com>
> 

Linus,

We find there are some other pins still have the same problem, so please
hold on it. Sorry for so much noise.

Thanks,
Hongzhou



Re: [PATCH 6/6] pinctrl: mt8173: set GPIO16 to usb iddig mode

2016-05-11 Thread Hongzhou Yang
On Wed, 2016-05-11 at 19:09 -0700, Hongzhou Yang wrote:
> On Thu, 2016-05-12 at 09:41 +0800, chunfeng yun wrote:
> > Hi,
> > 
> > On Wed, 2016-05-11 at 11:32 -0700, Hongzhou Yang wrote:
> > > On Wed, 2016-05-11 at 13:56 +0200, Linus Walleij wrote:
> > > > On Tue, May 10, 2016 at 10:23 AM, Chunfeng Yun
> > > >  wrote:
> > > > 
> > > > > the default mode of GPIO16 pin is gpio, when set EINT16 to
> > > > > IRQ_TYPE_LEVEL_HIGH, no interrupt is triggered, it can be
> > > > > fixed when set its default mode as usb iddig.
> > > > >
> > > > > Signed-off-by: Chunfeng Yun 
> > > > 
> > > 
> > > Chunfeng, GPIO16 can be used as EINT16 mode, but the pinmux should be 0.
> > > If you want to set its default mode to iddig, you should set it in dts.
> > > 
> > I set it in DTS, but it didn't work, because when usb driver requested
> > IRQ, pinmux was switched back to default mode set by
> > MTK_EINT_FUNCTION().
> > 
> 
> After confirmed, there are something wrong with data sheet and pinmux
> table, and GPIO16 can only receive interrupt by mode 1. So
> 
> Acked-by: Hongzhou Yang 
> 

Linus,

We find there are some other pins still have the same problem, so please
hold on it. Sorry for so much noise.

Thanks,
Hongzhou



Re: [PATCH 6/6] pinctrl: mt8173: set GPIO16 to usb iddig mode

2016-05-11 Thread Hongzhou Yang
On Thu, 2016-05-12 at 09:41 +0800, chunfeng yun wrote:
> Hi,
> 
> On Wed, 2016-05-11 at 11:32 -0700, Hongzhou Yang wrote:
> > On Wed, 2016-05-11 at 13:56 +0200, Linus Walleij wrote:
> > > On Tue, May 10, 2016 at 10:23 AM, Chunfeng Yun
> > > <chunfeng@mediatek.com> wrote:
> > > 
> > > > the default mode of GPIO16 pin is gpio, when set EINT16 to
> > > > IRQ_TYPE_LEVEL_HIGH, no interrupt is triggered, it can be
> > > > fixed when set its default mode as usb iddig.
> > > >
> > > > Signed-off-by: Chunfeng Yun <chunfeng@mediatek.com>
> > > 
> > 
> > Chunfeng, GPIO16 can be used as EINT16 mode, but the pinmux should be 0.
> > If you want to set its default mode to iddig, you should set it in dts.
> > 
> I set it in DTS, but it didn't work, because when usb driver requested
> IRQ, pinmux was switched back to default mode set by
> MTK_EINT_FUNCTION().
> 

After confirmed, there are something wrong with data sheet and pinmux
table, and GPIO16 can only receive interrupt by mode 1. So

Acked-by: Hongzhou Yang <hongzhou.y...@mediatek.com>

Yours,
Hongzhou




Re: [PATCH 6/6] pinctrl: mt8173: set GPIO16 to usb iddig mode

2016-05-11 Thread Hongzhou Yang
On Thu, 2016-05-12 at 09:41 +0800, chunfeng yun wrote:
> Hi,
> 
> On Wed, 2016-05-11 at 11:32 -0700, Hongzhou Yang wrote:
> > On Wed, 2016-05-11 at 13:56 +0200, Linus Walleij wrote:
> > > On Tue, May 10, 2016 at 10:23 AM, Chunfeng Yun
> > >  wrote:
> > > 
> > > > the default mode of GPIO16 pin is gpio, when set EINT16 to
> > > > IRQ_TYPE_LEVEL_HIGH, no interrupt is triggered, it can be
> > > > fixed when set its default mode as usb iddig.
> > > >
> > > > Signed-off-by: Chunfeng Yun 
> > > 
> > 
> > Chunfeng, GPIO16 can be used as EINT16 mode, but the pinmux should be 0.
> > If you want to set its default mode to iddig, you should set it in dts.
> > 
> I set it in DTS, but it didn't work, because when usb driver requested
> IRQ, pinmux was switched back to default mode set by
> MTK_EINT_FUNCTION().
> 

After confirmed, there are something wrong with data sheet and pinmux
table, and GPIO16 can only receive interrupt by mode 1. So

Acked-by: Hongzhou Yang 

Yours,
Hongzhou




Re: [PATCH 6/6] pinctrl: mt8173: set GPIO16 to usb iddig mode

2016-05-11 Thread Hongzhou Yang
On Wed, 2016-05-11 at 13:56 +0200, Linus Walleij wrote:
> On Tue, May 10, 2016 at 10:23 AM, Chunfeng Yun
>  wrote:
> 
> > the default mode of GPIO16 pin is gpio, when set EINT16 to
> > IRQ_TYPE_LEVEL_HIGH, no interrupt is triggered, it can be
> > fixed when set its default mode as usb iddig.
> >
> > Signed-off-by: Chunfeng Yun 
> 

Chunfeng, GPIO16 can be used as EINT16 mode, but the pinmux should be 0.
If you want to set its default mode to iddig, you should set it in dts.

Yours,
Hongzhou



Re: [PATCH 6/6] pinctrl: mt8173: set GPIO16 to usb iddig mode

2016-05-11 Thread Hongzhou Yang
On Wed, 2016-05-11 at 13:56 +0200, Linus Walleij wrote:
> On Tue, May 10, 2016 at 10:23 AM, Chunfeng Yun
>  wrote:
> 
> > the default mode of GPIO16 pin is gpio, when set EINT16 to
> > IRQ_TYPE_LEVEL_HIGH, no interrupt is triggered, it can be
> > fixed when set its default mode as usb iddig.
> >
> > Signed-off-by: Chunfeng Yun 
> 

Chunfeng, GPIO16 can be used as EINT16 mode, but the pinmux should be 0.
If you want to set its default mode to iddig, you should set it in dts.

Yours,
Hongzhou



Re: [PATCH v2] pinctrl: mediatek: correct debounce time unit in mtk_gpio_set_debounce

2016-04-13 Thread Hongzhou Yang
On Sat, 2016-04-02 at 14:57 +0800, Yingjoe Chen wrote:
> The debounce time unit for gpio_chip.set_debounce is us but
> mtk_gpio_set_debounce regard it as ms.
> Fix this by correct debounce time array dbnc_arr so it can find correct
> debounce setting. Debounce time for first debounce setting is 500us,
> correct this as well.
> 
> While I'm at it, also change the debounce time array name to
> "debounce_time" for readability.
> 
> Signed-off-by: Yingjoe Chen <yingjoe.c...@mediatek.com>

Acked-by: Hongzhou Yang <hongzhou.y...@mediatek.com>

> ---
> This was based on v4.6-rc1
> Change since v1:
> - Improve commit message.
> - Change dbnc_arr name to debounce_time
> ---
>  drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 9 +
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c 
> b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> index 2bbe6f7..6ab8c3c 100644
> --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> @@ -1004,7 +1004,8 @@ static int mtk_gpio_set_debounce(struct gpio_chip 
> *chip, unsigned offset,
>   struct mtk_pinctrl *pctl = dev_get_drvdata(chip->parent);
>   int eint_num, virq, eint_offset;
>   unsigned int set_offset, bit, clr_bit, clr_offset, rst, i, unmask, dbnc;
> - static const unsigned int dbnc_arr[] = {0 , 1, 16, 32, 64, 128, 256};
> + static const unsigned int debounce_time[] = {500, 1000, 16000, 32000, 
> 64000,
> + 128000, 256000};
>   const struct mtk_desc_pin *pin;
>   struct irq_data *d;
>  
> @@ -1022,9 +1023,9 @@ static int mtk_gpio_set_debounce(struct gpio_chip 
> *chip, unsigned offset,
>   if (!mtk_eint_can_en_debounce(pctl, eint_num))
>   return -ENOSYS;
>  
> - dbnc = ARRAY_SIZE(dbnc_arr);
> - for (i = 0; i < ARRAY_SIZE(dbnc_arr); i++) {
> - if (debounce <= dbnc_arr[i]) {
> + dbnc = ARRAY_SIZE(debounce_time);
> + for (i = 0; i < ARRAY_SIZE(debounce_time); i++) {
> + if (debounce <= debounce_time[i]) {
>   dbnc = i;
>   break;
>   }




Re: [PATCH v2] pinctrl: mediatek: correct debounce time unit in mtk_gpio_set_debounce

2016-04-13 Thread Hongzhou Yang
On Sat, 2016-04-02 at 14:57 +0800, Yingjoe Chen wrote:
> The debounce time unit for gpio_chip.set_debounce is us but
> mtk_gpio_set_debounce regard it as ms.
> Fix this by correct debounce time array dbnc_arr so it can find correct
> debounce setting. Debounce time for first debounce setting is 500us,
> correct this as well.
> 
> While I'm at it, also change the debounce time array name to
> "debounce_time" for readability.
> 
> Signed-off-by: Yingjoe Chen 

Acked-by: Hongzhou Yang 

> ---
> This was based on v4.6-rc1
> Change since v1:
> - Improve commit message.
> - Change dbnc_arr name to debounce_time
> ---
>  drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 9 +
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c 
> b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> index 2bbe6f7..6ab8c3c 100644
> --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> @@ -1004,7 +1004,8 @@ static int mtk_gpio_set_debounce(struct gpio_chip 
> *chip, unsigned offset,
>   struct mtk_pinctrl *pctl = dev_get_drvdata(chip->parent);
>   int eint_num, virq, eint_offset;
>   unsigned int set_offset, bit, clr_bit, clr_offset, rst, i, unmask, dbnc;
> - static const unsigned int dbnc_arr[] = {0 , 1, 16, 32, 64, 128, 256};
> + static const unsigned int debounce_time[] = {500, 1000, 16000, 32000, 
> 64000,
> + 128000, 256000};
>   const struct mtk_desc_pin *pin;
>   struct irq_data *d;
>  
> @@ -1022,9 +1023,9 @@ static int mtk_gpio_set_debounce(struct gpio_chip 
> *chip, unsigned offset,
>   if (!mtk_eint_can_en_debounce(pctl, eint_num))
>   return -ENOSYS;
>  
> - dbnc = ARRAY_SIZE(dbnc_arr);
> - for (i = 0; i < ARRAY_SIZE(dbnc_arr); i++) {
> - if (debounce <= dbnc_arr[i]) {
> + dbnc = ARRAY_SIZE(debounce_time);
> + for (i = 0; i < ARRAY_SIZE(debounce_time); i++) {
> + if (debounce <= debounce_time[i]) {
>   dbnc = i;
>   break;
>   }




Re: [PATCH 2/8] drivers/pinctrl: make mediatek/pinctrl-mt6397 driver explicitly non-modular

2016-03-01 Thread Hongzhou Yang
On Mon, 2016-02-29 at 15:48 -0500, Paul Gortmaker wrote:
> The Kconfig for this driver is currently:
> 
> config PINCTRL_MT6397
> bool "Mediatek MT6397 pin control" if COMPILE_TEST && !MFD_MT6397
> 
> ...meaning that it is currently not being built as a module by anyone.
> Lets remove the modular code that is essentially orphaned, so that
> when reading the driver there is no doubt it is builtin-only.
> 
> Since module_init translates to device_initcall in the non-modular
> case, the init ordering remains unchanged with this commit.
> 
> We also delete the MODULE_LICENSE tag etc. since all that information
> is already contained at the top of the file in the comments.
> 
> Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.
> 
> Cc: Linus Walleij <linus.wall...@linaro.org>
> Cc: Matthias Brugger <matthias@gmail.com>
> Cc: Hongzhou Yang <hongzhou.y...@mediatek.com>
> Cc: linux-g...@vger.kernel.org
> Cc: linux-media...@lists.infradead.org
> Signed-off-by: Paul Gortmaker <paul.gortma...@windriver.com>
> ---
>  drivers/pinctrl/mediatek/pinctrl-mt6397.c | 10 ++
>  1 file changed, 2 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/pinctrl/mediatek/pinctrl-mt6397.c 
> b/drivers/pinctrl/mediatek/pinctrl-mt6397.c
> index f9751ae28e32..6eccb85c02cd 100644
> --- a/drivers/pinctrl/mediatek/pinctrl-mt6397.c
> +++ b/drivers/pinctrl/mediatek/pinctrl-mt6397.c
> @@ -12,7 +12,7 @@
>   * GNU General Public License for more details.
>   */
>  
> -#include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -55,7 +55,6 @@ static const struct of_device_id mt6397_pctrl_match[] = {
>   { .compatible = "mediatek,mt6397-pinctrl", },
>   { }
>  };
> -MODULE_DEVICE_TABLE(of, mt6397_pctrl_match);
>  
>  static struct platform_driver mtk_pinctrl_driver = {
>   .probe = mt6397_pinctrl_probe,
> @@ -69,9 +68,4 @@ static int __init mtk_pinctrl_init(void)
>  {
>   return platform_driver_register(_pinctrl_driver);
>  }
> -
> -module_init(mtk_pinctrl_init);
> -
> -MODULE_LICENSE("GPL v2");
> -MODULE_DESCRIPTION("MediaTek MT6397 Pinctrl Driver");
> -MODULE_AUTHOR("Hongzhou Yang <hongzhou.y...@mediatek.com>");
> +device_initcall(mtk_pinctrl_init);


Acked-by: Hongzhou Yang <hongzhou.y...@mediatek.com>

Thanks,
Hongzhou




Re: [PATCH 2/8] drivers/pinctrl: make mediatek/pinctrl-mt6397 driver explicitly non-modular

2016-03-01 Thread Hongzhou Yang
On Mon, 2016-02-29 at 15:48 -0500, Paul Gortmaker wrote:
> The Kconfig for this driver is currently:
> 
> config PINCTRL_MT6397
> bool "Mediatek MT6397 pin control" if COMPILE_TEST && !MFD_MT6397
> 
> ...meaning that it is currently not being built as a module by anyone.
> Lets remove the modular code that is essentially orphaned, so that
> when reading the driver there is no doubt it is builtin-only.
> 
> Since module_init translates to device_initcall in the non-modular
> case, the init ordering remains unchanged with this commit.
> 
> We also delete the MODULE_LICENSE tag etc. since all that information
> is already contained at the top of the file in the comments.
> 
> Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.
> 
> Cc: Linus Walleij 
> Cc: Matthias Brugger 
> Cc: Hongzhou Yang 
> Cc: linux-g...@vger.kernel.org
> Cc: linux-media...@lists.infradead.org
> Signed-off-by: Paul Gortmaker 
> ---
>  drivers/pinctrl/mediatek/pinctrl-mt6397.c | 10 ++
>  1 file changed, 2 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/pinctrl/mediatek/pinctrl-mt6397.c 
> b/drivers/pinctrl/mediatek/pinctrl-mt6397.c
> index f9751ae28e32..6eccb85c02cd 100644
> --- a/drivers/pinctrl/mediatek/pinctrl-mt6397.c
> +++ b/drivers/pinctrl/mediatek/pinctrl-mt6397.c
> @@ -12,7 +12,7 @@
>   * GNU General Public License for more details.
>   */
>  
> -#include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -55,7 +55,6 @@ static const struct of_device_id mt6397_pctrl_match[] = {
>   { .compatible = "mediatek,mt6397-pinctrl", },
>   { }
>  };
> -MODULE_DEVICE_TABLE(of, mt6397_pctrl_match);
>  
>  static struct platform_driver mtk_pinctrl_driver = {
>   .probe = mt6397_pinctrl_probe,
> @@ -69,9 +68,4 @@ static int __init mtk_pinctrl_init(void)
>  {
>   return platform_driver_register(_pinctrl_driver);
>  }
> -
> -module_init(mtk_pinctrl_init);
> -
> -MODULE_LICENSE("GPL v2");
> -MODULE_DESCRIPTION("MediaTek MT6397 Pinctrl Driver");
> -MODULE_AUTHOR("Hongzhou Yang ");
> +device_initcall(mtk_pinctrl_init);


Acked-by: Hongzhou Yang 

Thanks,
Hongzhou




Re: [PATCH 13/50] pinctrl: mtk-common: Use devm_pinctrl_register() for pinctrl registration

2016-02-24 Thread Hongzhou Yang
On Wed, 2016-02-24 at 18:45 +0530, Laxman Dewangan wrote:
> Use devm_pinctrl_register() for pin control registration and clean
> the error path.
> 
> Signed-off-by: Laxman Dewangan <ldewan...@nvidia.com>
> Cc: Matthias Brugger <matthias@gmail.com>
> Cc: Hongzhou Yang <hongzhou.y...@mediatek.com>
> Cc: Yingjoe Chen <yingjoe.c...@mediatek.com>
> ---

Acked-by: Hongzhou Yang <hongzhou.y...@mediatek.com>

Thanks,
Hongzhou

>  drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 17 ++---
>  1 file changed, 6 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c 
> b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> index ddc9217..194413d 100644
> --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> @@ -1390,17 +1390,16 @@ int mtk_pctrl_init(struct platform_device *pdev,
>   pctl->pctl_desc.pmxops = _pmx_ops;
>   pctl->dev = >dev;
>  
> - pctl->pctl_dev = pinctrl_register(>pctl_desc, >dev, pctl);
> + pctl->pctl_dev = devm_pinctrl_register(>dev, >pctl_desc,
> +pctl);
>   if (IS_ERR(pctl->pctl_dev)) {
>   dev_err(>dev, "couldn't register pinctrl driver\n");
>   return PTR_ERR(pctl->pctl_dev);
>   }
>  
>   pctl->chip = devm_kzalloc(>dev, sizeof(*pctl->chip), GFP_KERNEL);
> - if (!pctl->chip) {
> - ret = -ENOMEM;
> - goto pctrl_error;
> - }
> + if (!pctl->chip)
> + return -ENOMEM;
>  
>   *pctl->chip = mtk_gpio_chip;
>   pctl->chip->ngpio = pctl->devdata->npins;
> @@ -1409,10 +1408,8 @@ int mtk_pctrl_init(struct platform_device *pdev,
>   pctl->chip->base = -1;
>  
>   ret = gpiochip_add_data(pctl->chip, pctl);
> - if (ret) {
> - ret = -EINVAL;
> - goto pctrl_error;
> - }
> + if (ret)
> + return -EINVAL;
>  
>   /* Register the GPIO to pin mappings. */
>   ret = gpiochip_add_pin_range(pctl->chip, dev_name(>dev),
> @@ -1490,8 +1487,6 @@ int mtk_pctrl_init(struct platform_device *pdev,
>  
>  chip_error:
>   gpiochip_remove(pctl->chip);
> -pctrl_error:
> - pinctrl_unregister(pctl->pctl_dev);
>   return ret;
>  }
>  




Re: [PATCH 13/50] pinctrl: mtk-common: Use devm_pinctrl_register() for pinctrl registration

2016-02-24 Thread Hongzhou Yang
On Wed, 2016-02-24 at 18:45 +0530, Laxman Dewangan wrote:
> Use devm_pinctrl_register() for pin control registration and clean
> the error path.
> 
> Signed-off-by: Laxman Dewangan 
> Cc: Matthias Brugger 
> Cc: Hongzhou Yang 
> Cc: Yingjoe Chen 
> ---

Acked-by: Hongzhou Yang 

Thanks,
Hongzhou

>  drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 17 ++---
>  1 file changed, 6 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c 
> b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> index ddc9217..194413d 100644
> --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> @@ -1390,17 +1390,16 @@ int mtk_pctrl_init(struct platform_device *pdev,
>   pctl->pctl_desc.pmxops = _pmx_ops;
>   pctl->dev = >dev;
>  
> - pctl->pctl_dev = pinctrl_register(>pctl_desc, >dev, pctl);
> + pctl->pctl_dev = devm_pinctrl_register(>dev, >pctl_desc,
> +pctl);
>   if (IS_ERR(pctl->pctl_dev)) {
>   dev_err(>dev, "couldn't register pinctrl driver\n");
>   return PTR_ERR(pctl->pctl_dev);
>   }
>  
>   pctl->chip = devm_kzalloc(>dev, sizeof(*pctl->chip), GFP_KERNEL);
> - if (!pctl->chip) {
> - ret = -ENOMEM;
> - goto pctrl_error;
> - }
> + if (!pctl->chip)
> + return -ENOMEM;
>  
>   *pctl->chip = mtk_gpio_chip;
>   pctl->chip->ngpio = pctl->devdata->npins;
> @@ -1409,10 +1408,8 @@ int mtk_pctrl_init(struct platform_device *pdev,
>   pctl->chip->base = -1;
>  
>   ret = gpiochip_add_data(pctl->chip, pctl);
> - if (ret) {
> - ret = -EINVAL;
> - goto pctrl_error;
> - }
> + if (ret)
> + return -EINVAL;
>  
>   /* Register the GPIO to pin mappings. */
>   ret = gpiochip_add_pin_range(pctl->chip, dev_name(>dev),
> @@ -1490,8 +1487,6 @@ int mtk_pctrl_init(struct platform_device *pdev,
>  
>  chip_error:
>   gpiochip_remove(pctl->chip);
> -pctrl_error:
> - pinctrl_unregister(pctl->pctl_dev);
>   return ret;
>  }
>  




Re: [PATCH 1/2] pinctrl: mediatek: fix direction control issue

2016-02-11 Thread Hongzhou Yang
On Fri, 2016-02-05 at 14:52 +0100, Linus Walleij wrote:
> On Thu, Feb 4, 2016 at 4:03 AM, Hongzhou Yang
>  wrote:
> > On Wed, 2016-02-03 at 09:24 +0800, Biao Huang wrote:
> >> Since input-enable/disable and input-schmitt-enable/disable are
> >> workable when gpio direction is input, so add direction setting
> >> when do input-enable/disable and input-schmitt-enable/disable
> >> properties.
> >>
> >> Signed-off-by: Biao Huang 
> >> ---
> >>  drivers/pinctrl/mediatek/pinctrl-mtk-common.c |2 ++
> >>  1 file changed, 2 insertions(+)
> >>
> >> diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c 
> >> b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> >> index 8cac73d..6eb01c9 100644
> >> --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> >> +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> >> @@ -352,6 +352,7 @@ static int mtk_pconf_parse_conf(struct pinctrl_dev 
> >> *pctldev,
> >>   ret = mtk_pconf_set_pull_select(pctl, pin, true, false, arg);
> >>   break;
> >>   case PIN_CONFIG_INPUT_ENABLE:
> >> + mtk_pmx_gpio_set_direction(pctldev, NULL, pin, true);
> >>   ret = mtk_pconf_set_ies_smt(pctl, pin, arg, param);
> >
> > Hi Linus,
> >
> > From pinctrl-bindings.txt, 'input-enable' property defined as following:
> > input-enable- enable input on pin (no effect on output)
> >
> > Since input enable and input direction are two different settings on our
> > SOC,
> 
> What does this mean? How can input have a "direction"?
> 
> Isn't the direction of an input always inbound, into the SoC?
> 
> Please elaborate.

Sorry for the late reply.
There are two conditions if external device input data into SOC.
1. Change GPIO direction to input.
2. Switch on input.


> > could you tell me the exact meaning of this property? Input enable
> > only? Or set input direction at the same time?
> 
> This was added in commit 8ba3f4d00078e7a49c60c0bd6298f29402c3a0a0
> "pinctrl: Adds slew-rate, input-enable/disable"
> by Sherman Yin so let's ask him first.

Thanks for this info.
>From Sherman's comment, PIN_CONFIG_INPUT_ENABLE seems only to stand for
the condition 2.

* @PIN_CONFIG_INPUT_ENABLE: enable the pin's input.  Note that this does
not affect the pin's ability to drive output.  1 enables input, 0
disables input.

Then I get confuse if we can change direction under this property.

Thanks.
Hongzhou



Re: [PATCH 1/2] pinctrl: mediatek: fix direction control issue

2016-02-11 Thread Hongzhou Yang
On Fri, 2016-02-05 at 14:52 +0100, Linus Walleij wrote:
> On Thu, Feb 4, 2016 at 4:03 AM, Hongzhou Yang
> <hongzhou.y...@mediatek.com> wrote:
> > On Wed, 2016-02-03 at 09:24 +0800, Biao Huang wrote:
> >> Since input-enable/disable and input-schmitt-enable/disable are
> >> workable when gpio direction is input, so add direction setting
> >> when do input-enable/disable and input-schmitt-enable/disable
> >> properties.
> >>
> >> Signed-off-by: Biao Huang <biao.hu...@mediatek.com>
> >> ---
> >>  drivers/pinctrl/mediatek/pinctrl-mtk-common.c |2 ++
> >>  1 file changed, 2 insertions(+)
> >>
> >> diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c 
> >> b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> >> index 8cac73d..6eb01c9 100644
> >> --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> >> +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> >> @@ -352,6 +352,7 @@ static int mtk_pconf_parse_conf(struct pinctrl_dev 
> >> *pctldev,
> >>   ret = mtk_pconf_set_pull_select(pctl, pin, true, false, arg);
> >>   break;
> >>   case PIN_CONFIG_INPUT_ENABLE:
> >> + mtk_pmx_gpio_set_direction(pctldev, NULL, pin, true);
> >>   ret = mtk_pconf_set_ies_smt(pctl, pin, arg, param);
> >
> > Hi Linus,
> >
> > From pinctrl-bindings.txt, 'input-enable' property defined as following:
> > input-enable- enable input on pin (no effect on output)
> >
> > Since input enable and input direction are two different settings on our
> > SOC,
> 
> What does this mean? How can input have a "direction"?
> 
> Isn't the direction of an input always inbound, into the SoC?
> 
> Please elaborate.

Sorry for the late reply.
There are two conditions if external device input data into SOC.
1. Change GPIO direction to input.
2. Switch on input.


> > could you tell me the exact meaning of this property? Input enable
> > only? Or set input direction at the same time?
> 
> This was added in commit 8ba3f4d00078e7a49c60c0bd6298f29402c3a0a0
> "pinctrl: Adds slew-rate, input-enable/disable"
> by Sherman Yin so let's ask him first.

Thanks for this info.
>From Sherman's comment, PIN_CONFIG_INPUT_ENABLE seems only to stand for
the condition 2.

* @PIN_CONFIG_INPUT_ENABLE: enable the pin's input.  Note that this does
not affect the pin's ability to drive output.  1 enables input, 0
disables input.

Then I get confuse if we can change direction under this property.

Thanks.
Hongzhou



Re: [PATCH 1/2] pinctrl: mediatek: fix direction control issue

2016-02-03 Thread Hongzhou Yang
On Wed, 2016-02-03 at 09:24 +0800, Biao Huang wrote:
> Since input-enable/disable and input-schmitt-enable/disable are
> workable when gpio direction is input, so add direction setting
> when do input-enable/disable and input-schmitt-enable/disable
> properties.
> 
> Signed-off-by: Biao Huang 
> ---
>  drivers/pinctrl/mediatek/pinctrl-mtk-common.c |2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c 
> b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> index 8cac73d..6eb01c9 100644
> --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> @@ -352,6 +352,7 @@ static int mtk_pconf_parse_conf(struct pinctrl_dev 
> *pctldev,
>   ret = mtk_pconf_set_pull_select(pctl, pin, true, false, arg);
>   break;
>   case PIN_CONFIG_INPUT_ENABLE:
> + mtk_pmx_gpio_set_direction(pctldev, NULL, pin, true);
>   ret = mtk_pconf_set_ies_smt(pctl, pin, arg, param);

Hi Linus,

>From pinctrl-bindings.txt, 'input-enable' property defined as following:
input-enable- enable input on pin (no effect on output)

Since input enable and input direction are two different settings on our
SOC, could you tell me the exact meaning of this property? Input enable
only? Or set input direction at the same time?

Thanks,
Hongzhou



Re: [PATCH 1/2] pinctrl: mediatek: fix direction control issue

2016-02-03 Thread Hongzhou Yang
On Wed, 2016-02-03 at 09:24 +0800, Biao Huang wrote:
> Since input-enable/disable and input-schmitt-enable/disable are
> workable when gpio direction is input, so add direction setting
> when do input-enable/disable and input-schmitt-enable/disable
> properties.
> 
> Signed-off-by: Biao Huang 
> ---
>  drivers/pinctrl/mediatek/pinctrl-mtk-common.c |2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c 
> b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> index 8cac73d..6eb01c9 100644
> --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> @@ -352,6 +352,7 @@ static int mtk_pconf_parse_conf(struct pinctrl_dev 
> *pctldev,
>   ret = mtk_pconf_set_pull_select(pctl, pin, true, false, arg);
>   break;
>   case PIN_CONFIG_INPUT_ENABLE:
> + mtk_pmx_gpio_set_direction(pctldev, NULL, pin, true);
>   ret = mtk_pconf_set_ies_smt(pctl, pin, arg, param);

Hi Linus,

>From pinctrl-bindings.txt, 'input-enable' property defined as following:
input-enable- enable input on pin (no effect on output)

Since input enable and input direction are two different settings on our
SOC, could you tell me the exact meaning of this property? Input enable
only? Or set input direction at the same time?

Thanks,
Hongzhou



[PATCH] pinctrl: mediatek: fix a memleak when do dt maps.

2015-11-17 Thread Hongzhou Yang
configs will kmemdup to dup_configs in pictrl util function.
So configs need to be freed.

Signed-off-by: Hongzhou Yang 
Reviewed-by: Daniel Kurtz 
Reviewed-by: Matthias Brugger 
---
 Fix a memleak issue.
 According to Yingjoe's comment, add return checek for 
pinconf_generic_parse_dt_config.

 drivers/pinctrl/mediatek/pinctrl-mtk-common.c |   27 -
 1 file changed, 17 insertions(+), 10 deletions(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c 
b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
index 5c71727..8db7cdf 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
@@ -509,6 +509,9 @@ static int mtk_pctrl_dt_subnode_to_map(struct pinctrl_dev 
*pctldev,
 
err = pinconf_generic_parse_dt_config(node, pctldev, ,
_configs);
+   if (err)
+   return err;
+
if (num_configs)
has_config = 1;
 
@@ -520,21 +523,23 @@ static int mtk_pctrl_dt_subnode_to_map(struct pinctrl_dev 
*pctldev,
if (has_config && num_pins >= 1)
maps_per_pin++;
 
-   if (!num_pins || !maps_per_pin)
-   return -EINVAL;
+   if (!num_pins || !maps_per_pin) {
+   err = -EINVAL;
+   goto exit;
+   }
 
reserve = num_pins * maps_per_pin;
 
err = pinctrl_utils_reserve_map(pctldev, map,
reserved_maps, num_maps, reserve);
if (err < 0)
-   goto fail;
+   goto exit;
 
for (i = 0; i < num_pins; i++) {
err = of_property_read_u32_index(node, "pinmux",
i, );
if (err)
-   goto fail;
+   goto exit;
 
pin = MTK_GET_PIN_NO(pinfunc);
func = MTK_GET_PIN_FUNC(pinfunc);
@@ -543,20 +548,21 @@ static int mtk_pctrl_dt_subnode_to_map(struct pinctrl_dev 
*pctldev,
func >= ARRAY_SIZE(mtk_gpio_functions)) {
dev_err(pctl->dev, "invalid pins value.\n");
err = -EINVAL;
-   goto fail;
+   goto exit;
}
 
grp = mtk_pctrl_find_group_by_pin(pctl, pin);
if (!grp) {
dev_err(pctl->dev, "unable to match pin %d to group\n",
pin);
-   return -EINVAL;
+   err = -EINVAL;
+   goto exit;
}
 
err = mtk_pctrl_dt_node_to_map_func(pctl, pin, func, grp, map,
reserved_maps, num_maps);
if (err < 0)
-   goto fail;
+   goto exit;
 
if (has_config) {
err = pinctrl_utils_add_map_configs(pctldev, map,
@@ -564,13 +570,14 @@ static int mtk_pctrl_dt_subnode_to_map(struct pinctrl_dev 
*pctldev,
configs, num_configs,
PIN_MAP_TYPE_CONFIGS_GROUP);
if (err < 0)
-   goto fail;
+   goto exit;
}
}
 
-   return 0;
+   err = 0;
 
-fail:
+exit:
+   kfree(configs);
return err;
 }
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] pinctrl: mediatek: Add get_direction support.

2015-11-17 Thread Hongzhou Yang
Since Linux gpio framework return 0 for output, 1 for input.
But HW use 0 stands for input, and 1 stands for output.
So use negative to correct it.

And gpio_chip.get is used to get input value, no need to get
output value, so removing it.

Signed-off-by: Hongzhou Yang 
---
 Base on v4.4-rc1, resend it.
 Add get direction support.
 Remove gpio_chip.get value for output direction.

 drivers/pinctrl/mediatek/pinctrl-mtk-common.c |   11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c 
b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
index f307f1d..5c71727 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
@@ -747,7 +747,7 @@ static int mtk_gpio_get_direction(struct gpio_chip *chip, 
unsigned offset)
reg_addr =  mtk_get_port(pctl, offset) + pctl->devdata->dir_offset;
bit = BIT(offset & 0xf);
regmap_read(pctl->regmap1, reg_addr, _val);
-   return !!(read_val & bit);
+   return !(read_val & bit);
 }
 
 static int mtk_gpio_get(struct gpio_chip *chip, unsigned offset)
@@ -757,12 +757,8 @@ static int mtk_gpio_get(struct gpio_chip *chip, unsigned 
offset)
unsigned int read_val = 0;
struct mtk_pinctrl *pctl = dev_get_drvdata(chip->dev);
 
-   if (mtk_gpio_get_direction(chip, offset))
-   reg_addr = mtk_get_port(pctl, offset) +
-   pctl->devdata->dout_offset;
-   else
-   reg_addr = mtk_get_port(pctl, offset) +
-   pctl->devdata->din_offset;
+   reg_addr = mtk_get_port(pctl, offset) +
+   pctl->devdata->din_offset;
 
bit = BIT(offset & 0xf);
regmap_read(pctl->regmap1, reg_addr, _val);
@@ -997,6 +993,7 @@ static struct gpio_chip mtk_gpio_chip = {
.owner  = THIS_MODULE,
.request= gpiochip_generic_request,
.free   = gpiochip_generic_free,
+   .get_direction  = mtk_gpio_get_direction,
.direction_input= mtk_gpio_direction_input,
.direction_output   = mtk_gpio_direction_output,
.get= mtk_gpio_get,
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] pinctrl: mediatek: fix a memleak when do dt maps.

2015-11-17 Thread Hongzhou Yang
configs will kmemdup to dup_configs in pictrl util function.
So configs need to be freed.

Signed-off-by: Hongzhou Yang <hongzhou.y...@mediatek.com>
Reviewed-by: Daniel Kurtz <djku...@chromium.org>
Reviewed-by: Matthias Brugger <matthias@gmail.com>
---
 Fix a memleak issue.
 According to Yingjoe's comment, add return checek for 
pinconf_generic_parse_dt_config.

 drivers/pinctrl/mediatek/pinctrl-mtk-common.c |   27 -
 1 file changed, 17 insertions(+), 10 deletions(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c 
b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
index 5c71727..8db7cdf 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
@@ -509,6 +509,9 @@ static int mtk_pctrl_dt_subnode_to_map(struct pinctrl_dev 
*pctldev,
 
err = pinconf_generic_parse_dt_config(node, pctldev, ,
_configs);
+   if (err)
+   return err;
+
if (num_configs)
has_config = 1;
 
@@ -520,21 +523,23 @@ static int mtk_pctrl_dt_subnode_to_map(struct pinctrl_dev 
*pctldev,
if (has_config && num_pins >= 1)
maps_per_pin++;
 
-   if (!num_pins || !maps_per_pin)
-   return -EINVAL;
+   if (!num_pins || !maps_per_pin) {
+   err = -EINVAL;
+   goto exit;
+   }
 
reserve = num_pins * maps_per_pin;
 
err = pinctrl_utils_reserve_map(pctldev, map,
reserved_maps, num_maps, reserve);
if (err < 0)
-   goto fail;
+   goto exit;
 
for (i = 0; i < num_pins; i++) {
err = of_property_read_u32_index(node, "pinmux",
i, );
if (err)
-   goto fail;
+   goto exit;
 
pin = MTK_GET_PIN_NO(pinfunc);
func = MTK_GET_PIN_FUNC(pinfunc);
@@ -543,20 +548,21 @@ static int mtk_pctrl_dt_subnode_to_map(struct pinctrl_dev 
*pctldev,
func >= ARRAY_SIZE(mtk_gpio_functions)) {
dev_err(pctl->dev, "invalid pins value.\n");
err = -EINVAL;
-   goto fail;
+   goto exit;
}
 
grp = mtk_pctrl_find_group_by_pin(pctl, pin);
if (!grp) {
dev_err(pctl->dev, "unable to match pin %d to group\n",
pin);
-   return -EINVAL;
+   err = -EINVAL;
+   goto exit;
}
 
err = mtk_pctrl_dt_node_to_map_func(pctl, pin, func, grp, map,
reserved_maps, num_maps);
if (err < 0)
-   goto fail;
+   goto exit;
 
if (has_config) {
err = pinctrl_utils_add_map_configs(pctldev, map,
@@ -564,13 +570,14 @@ static int mtk_pctrl_dt_subnode_to_map(struct pinctrl_dev 
*pctldev,
configs, num_configs,
PIN_MAP_TYPE_CONFIGS_GROUP);
if (err < 0)
-   goto fail;
+   goto exit;
}
}
 
-   return 0;
+   err = 0;
 
-fail:
+exit:
+   kfree(configs);
return err;
 }
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] pinctrl: mediatek: Add get_direction support.

2015-11-17 Thread Hongzhou Yang
Since Linux gpio framework return 0 for output, 1 for input.
But HW use 0 stands for input, and 1 stands for output.
So use negative to correct it.

And gpio_chip.get is used to get input value, no need to get
output value, so removing it.

Signed-off-by: Hongzhou Yang <hongzhou.y...@mediatek.com>
---
 Base on v4.4-rc1, resend it.
 Add get direction support.
 Remove gpio_chip.get value for output direction.

 drivers/pinctrl/mediatek/pinctrl-mtk-common.c |   11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c 
b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
index f307f1d..5c71727 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
@@ -747,7 +747,7 @@ static int mtk_gpio_get_direction(struct gpio_chip *chip, 
unsigned offset)
reg_addr =  mtk_get_port(pctl, offset) + pctl->devdata->dir_offset;
bit = BIT(offset & 0xf);
regmap_read(pctl->regmap1, reg_addr, _val);
-   return !!(read_val & bit);
+   return !(read_val & bit);
 }
 
 static int mtk_gpio_get(struct gpio_chip *chip, unsigned offset)
@@ -757,12 +757,8 @@ static int mtk_gpio_get(struct gpio_chip *chip, unsigned 
offset)
unsigned int read_val = 0;
struct mtk_pinctrl *pctl = dev_get_drvdata(chip->dev);
 
-   if (mtk_gpio_get_direction(chip, offset))
-   reg_addr = mtk_get_port(pctl, offset) +
-   pctl->devdata->dout_offset;
-   else
-   reg_addr = mtk_get_port(pctl, offset) +
-   pctl->devdata->din_offset;
+   reg_addr = mtk_get_port(pctl, offset) +
+   pctl->devdata->din_offset;
 
bit = BIT(offset & 0xf);
regmap_read(pctl->regmap1, reg_addr, _val);
@@ -997,6 +993,7 @@ static struct gpio_chip mtk_gpio_chip = {
.owner  = THIS_MODULE,
.request= gpiochip_generic_request,
.free   = gpiochip_generic_free,
+   .get_direction  = mtk_gpio_get_direction,
.direction_input= mtk_gpio_direction_input,
.direction_output   = mtk_gpio_direction_output,
.get= mtk_gpio_get,
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] pinctrl: mediatek: fix a memleak when do dt maps.

2015-11-16 Thread Hongzhou Yang
configs will kmemdup to dup_configs in pictrl util function.
So configs need to be freed.

Signed-off-by: Hongzhou Yang 
---
 Fix a memleak issue.

 drivers/pinctrl/mediatek/pinctrl-mtk-common.c |   24 ++--
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c 
b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
index bbf0230..0f9e416 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
@@ -520,21 +520,23 @@ static int mtk_pctrl_dt_subnode_to_map(struct pinctrl_dev 
*pctldev,
if (has_config && num_pins >= 1)
maps_per_pin++;
 
-   if (!num_pins || !maps_per_pin)
-   return -EINVAL;
+   if (!num_pins || !maps_per_pin) {
+   err = -EINVAL;
+   goto exit;
+   }
 
reserve = num_pins * maps_per_pin;
 
err = pinctrl_utils_reserve_map(pctldev, map,
reserved_maps, num_maps, reserve);
if (err < 0)
-   goto fail;
+   goto exit;
 
for (i = 0; i < num_pins; i++) {
err = of_property_read_u32_index(node, "pinmux",
i, );
if (err)
-   goto fail;
+   goto exit;
 
pin = MTK_GET_PIN_NO(pinfunc);
func = MTK_GET_PIN_FUNC(pinfunc);
@@ -543,20 +545,21 @@ static int mtk_pctrl_dt_subnode_to_map(struct pinctrl_dev 
*pctldev,
func >= ARRAY_SIZE(mtk_gpio_functions)) {
dev_err(pctl->dev, "invalid pins value.\n");
err = -EINVAL;
-   goto fail;
+   goto exit;
}
 
grp = mtk_pctrl_find_group_by_pin(pctl, pin);
if (!grp) {
dev_err(pctl->dev, "unable to match pin %d to group\n",
pin);
-   return -EINVAL;
+   err = -EINVAL;
+   goto exit;
}
 
err = mtk_pctrl_dt_node_to_map_func(pctl, pin, func, grp, map,
reserved_maps, num_maps);
if (err < 0)
-   goto fail;
+   goto exit;
 
if (has_config) {
err = pinctrl_utils_add_map_configs(pctldev, map,
@@ -564,13 +567,14 @@ static int mtk_pctrl_dt_subnode_to_map(struct pinctrl_dev 
*pctldev,
configs, num_configs,
PIN_MAP_TYPE_CONFIGS_GROUP);
if (err < 0)
-   goto fail;
+   goto exit;
}
}
 
-   return 0;
+   err = 0;
 
-fail:
+exit:
+   kfree(configs);
return err;
 }
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] pinctrl: mediatek: fix a memleak when do dt maps.

2015-11-16 Thread Hongzhou Yang
configs will kmemdup to dup_configs in pictrl util function.
So configs need to be freed.

Signed-off-by: Hongzhou Yang 
---
 Fix a memleak issue.

 drivers/pinctrl/mediatek/pinctrl-mtk-common.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c 
b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
index bbf0230..b5a 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
@@ -568,9 +568,10 @@ static int mtk_pctrl_dt_subnode_to_map(struct pinctrl_dev 
*pctldev,
}
}
 
-   return 0;
+   err = 0;
 
 fail:
+   kfree(configs);
return err;
 }
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] pinctrl: mediatek: fix a memleak when do dt maps.

2015-11-16 Thread Hongzhou Yang
configs will kmemdup to dup_configs in pictrl util function.
So configs need to be freed.

Signed-off-by: Hongzhou Yang <hongzhou.y...@mediatek.com>
---
 Fix a memleak issue.

 drivers/pinctrl/mediatek/pinctrl-mtk-common.c |   24 ++--
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c 
b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
index bbf0230..0f9e416 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
@@ -520,21 +520,23 @@ static int mtk_pctrl_dt_subnode_to_map(struct pinctrl_dev 
*pctldev,
if (has_config && num_pins >= 1)
maps_per_pin++;
 
-   if (!num_pins || !maps_per_pin)
-   return -EINVAL;
+   if (!num_pins || !maps_per_pin) {
+   err = -EINVAL;
+   goto exit;
+   }
 
reserve = num_pins * maps_per_pin;
 
err = pinctrl_utils_reserve_map(pctldev, map,
reserved_maps, num_maps, reserve);
if (err < 0)
-   goto fail;
+   goto exit;
 
for (i = 0; i < num_pins; i++) {
err = of_property_read_u32_index(node, "pinmux",
i, );
if (err)
-   goto fail;
+   goto exit;
 
pin = MTK_GET_PIN_NO(pinfunc);
func = MTK_GET_PIN_FUNC(pinfunc);
@@ -543,20 +545,21 @@ static int mtk_pctrl_dt_subnode_to_map(struct pinctrl_dev 
*pctldev,
func >= ARRAY_SIZE(mtk_gpio_functions)) {
dev_err(pctl->dev, "invalid pins value.\n");
err = -EINVAL;
-   goto fail;
+   goto exit;
}
 
grp = mtk_pctrl_find_group_by_pin(pctl, pin);
if (!grp) {
dev_err(pctl->dev, "unable to match pin %d to group\n",
pin);
-   return -EINVAL;
+   err = -EINVAL;
+   goto exit;
}
 
err = mtk_pctrl_dt_node_to_map_func(pctl, pin, func, grp, map,
reserved_maps, num_maps);
if (err < 0)
-   goto fail;
+   goto exit;
 
if (has_config) {
err = pinctrl_utils_add_map_configs(pctldev, map,
@@ -564,13 +567,14 @@ static int mtk_pctrl_dt_subnode_to_map(struct pinctrl_dev 
*pctldev,
configs, num_configs,
PIN_MAP_TYPE_CONFIGS_GROUP);
if (err < 0)
-   goto fail;
+   goto exit;
}
}
 
-   return 0;
+   err = 0;
 
-fail:
+exit:
+   kfree(configs);
return err;
 }
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] pinctrl: mediatek: fix a memleak when do dt maps.

2015-11-16 Thread Hongzhou Yang
configs will kmemdup to dup_configs in pictrl util function.
So configs need to be freed.

Signed-off-by: Hongzhou Yang <hongzhou.y...@mediatek.com>
---
 Fix a memleak issue.

 drivers/pinctrl/mediatek/pinctrl-mtk-common.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c 
b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
index bbf0230..b5a 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
@@ -568,9 +568,10 @@ static int mtk_pctrl_dt_subnode_to_map(struct pinctrl_dev 
*pctldev,
}
}
 
-   return 0;
+   err = 0;
 
 fail:
+   kfree(configs);
return err;
 }
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] pinctrl: mediatek: Add get_direction support.

2015-11-13 Thread Hongzhou Yang
Since Linux gpio framework return 0 for output, 1 for input.
But HW use 0 stands for input, and 1 stands for output.
So use negative to correct it.

And gpio_chip.get is used to get input value, no need to get
output value, so removing it.

Signed-off-by: Hongzhou Yang 
---
 Add get direction support.
 Remove gpio_chip.get value for output direction.

 drivers/pinctrl/mediatek/pinctrl-mtk-common.c |   11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c 
b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
index 7726c6c..bbf0230 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
@@ -757,7 +757,7 @@ static int mtk_gpio_get_direction(struct gpio_chip *chip, 
unsigned offset)
reg_addr =  mtk_get_port(pctl, offset) + pctl->devdata->dir_offset;
bit = BIT(offset & 0xf);
regmap_read(pctl->regmap1, reg_addr, _val);
-   return !!(read_val & bit);
+   return !(read_val & bit);
 }
 
 static int mtk_gpio_get(struct gpio_chip *chip, unsigned offset)
@@ -767,12 +767,8 @@ static int mtk_gpio_get(struct gpio_chip *chip, unsigned 
offset)
unsigned int read_val = 0;
struct mtk_pinctrl *pctl = dev_get_drvdata(chip->dev);
 
-   if (mtk_gpio_get_direction(chip, offset))
-   reg_addr = mtk_get_port(pctl, offset) +
-   pctl->devdata->dout_offset;
-   else
-   reg_addr = mtk_get_port(pctl, offset) +
-   pctl->devdata->din_offset;
+   reg_addr = mtk_get_port(pctl, offset) +
+   pctl->devdata->din_offset;
 
bit = BIT(offset & 0xf);
regmap_read(pctl->regmap1, reg_addr, _val);
@@ -1007,6 +1003,7 @@ static struct gpio_chip mtk_gpio_chip = {
.owner  = THIS_MODULE,
.request= mtk_gpio_request,
.free   = mtk_gpio_free,
+   .get_direction  = mtk_gpio_get_direction,
.direction_input= mtk_gpio_direction_input,
.direction_output   = mtk_gpio_direction_output,
.get= mtk_gpio_get,
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] pinctrl: mediatek: Add get_direction support.

2015-11-13 Thread Hongzhou Yang
Since Linux gpio framework return 0 for output, 1 for input.
But HW use 0 stands for input, and 1 stands for output.
So use negative to correct it.

And gpio_chip.get is used to get input value, no need to get
output value, so removing it.

Signed-off-by: Hongzhou Yang <hongzhou.y...@mediatek.com>
---
 Add get direction support.
 Remove gpio_chip.get value for output direction.

 drivers/pinctrl/mediatek/pinctrl-mtk-common.c |   11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c 
b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
index 7726c6c..bbf0230 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
@@ -757,7 +757,7 @@ static int mtk_gpio_get_direction(struct gpio_chip *chip, 
unsigned offset)
reg_addr =  mtk_get_port(pctl, offset) + pctl->devdata->dir_offset;
bit = BIT(offset & 0xf);
regmap_read(pctl->regmap1, reg_addr, _val);
-   return !!(read_val & bit);
+   return !(read_val & bit);
 }
 
 static int mtk_gpio_get(struct gpio_chip *chip, unsigned offset)
@@ -767,12 +767,8 @@ static int mtk_gpio_get(struct gpio_chip *chip, unsigned 
offset)
unsigned int read_val = 0;
struct mtk_pinctrl *pctl = dev_get_drvdata(chip->dev);
 
-   if (mtk_gpio_get_direction(chip, offset))
-   reg_addr = mtk_get_port(pctl, offset) +
-   pctl->devdata->dout_offset;
-   else
-   reg_addr = mtk_get_port(pctl, offset) +
-   pctl->devdata->din_offset;
+   reg_addr = mtk_get_port(pctl, offset) +
+   pctl->devdata->din_offset;
 
bit = BIT(offset & 0xf);
regmap_read(pctl->regmap1, reg_addr, _val);
@@ -1007,6 +1003,7 @@ static struct gpio_chip mtk_gpio_chip = {
.owner  = THIS_MODULE,
.request= mtk_gpio_request,
.free   = mtk_gpio_free,
+   .get_direction  = mtk_gpio_get_direction,
.direction_input= mtk_gpio_direction_input,
.direction_output   = mtk_gpio_direction_output,
.get= mtk_gpio_get,
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 5/6] pinctrl: mediatek: Remove unneded semicolon

2015-09-16 Thread Hongzhou Yang
On Wed, 2015-09-16 at 10:28 +0200, Javier Martinez Canillas wrote:
> It's not needed an is just creating a null statement, so remove it.
> 
> Signed-off-by: Javier Martinez Canillas 
> ---
> 
>  drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c 
> b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> index 7726c6caaf83..652ec125adb3 100644
> --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> @@ -1436,7 +1436,7 @@ int mtk_pctrl_init(struct platform_device *pdev,
>   irq_set_chip_and_handler(virq, _pinctrl_irq_chip,
>   handle_level_irq);
>   irq_set_chip_data(virq, pctl);
> - };
> + }
>  
>   irq_set_chained_handler_and_data(irq, mtk_eint_irq_handler, pctl);
>   return 0;


Acked-by: Hongzhou Yang 

Thanks
Hongzhou

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 5/6] pinctrl: mediatek: Remove unneded semicolon

2015-09-16 Thread Hongzhou Yang
On Wed, 2015-09-16 at 10:28 +0200, Javier Martinez Canillas wrote:
> It's not needed an is just creating a null statement, so remove it.
> 
> Signed-off-by: Javier Martinez Canillas <jav...@osg.samsung.com>
> ---
> 
>  drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c 
> b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> index 7726c6caaf83..652ec125adb3 100644
> --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> @@ -1436,7 +1436,7 @@ int mtk_pctrl_init(struct platform_device *pdev,
>   irq_set_chip_and_handler(virq, _pinctrl_irq_chip,
>   handle_level_irq);
>   irq_set_chip_data(virq, pctl);
> - };
> + }
>  
>   irq_set_chained_handler_and_data(irq, mtk_eint_irq_handler, pctl);
>   return 0;


Acked-by: Hongzhou Yang <hongzhou.y...@mediatek.com>

Thanks
Hongzhou

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v4] pinctrl: mediatek: Fix multiple registration issue.

2015-08-25 Thread Hongzhou Yang
Since our common driver need support main chip and PMU
at the same time, that means it will register two
pinctrl device, and the pinctrl_desc structure should
be used two times.

But pinctrl_desc use global static definition, then
the latest registered pinctrl device will overwrite
the old one's, all members in pinctrl_desc will set to
the new one's, such as name, pins and pins numbers, etc.
This is a bug.

Move pinctrl_desc into mtk_pinctrl, assign new value for
each pinctrl device to fix it.

Cc: sta...@vger.kernel.org # v4.1+
Signed-off-by: Hongzhou Yang 
Reviewed-by: Axel Lin 
---
 In order to fix multiple registration issue, move 
 pinctrl_desc into mtk_pinctrl, assign new value for
 each pinctrl device.

 drivers/pinctrl/mediatek/pinctrl-mtk-common.c |   21 ++---
 drivers/pinctrl/mediatek/pinctrl-mtk-common.h |1 +
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c 
b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
index ad1ea16..4a52072 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
@@ -1202,12 +1202,6 @@ static int mtk_pctrl_build_state(struct platform_device 
*pdev)
return 0;
 }
 
-static struct pinctrl_desc mtk_pctrl_desc = {
-   .confops= _pconf_ops,
-   .pctlops= _pctrl_ops,
-   .pmxops = _pmx_ops,
-};
-
 int mtk_pctrl_init(struct platform_device *pdev,
const struct mtk_pinctrl_devdata *data,
struct regmap *regmap)
@@ -1265,12 +1259,17 @@ int mtk_pctrl_init(struct platform_device *pdev,
 
for (i = 0; i < pctl->devdata->npins; i++)
pins[i] = pctl->devdata->pins[i].pin;
-   mtk_pctrl_desc.name = dev_name(>dev);
-   mtk_pctrl_desc.owner = THIS_MODULE;
-   mtk_pctrl_desc.pins = pins;
-   mtk_pctrl_desc.npins = pctl->devdata->npins;
+
+   pctl->pctl_desc.name = dev_name(>dev);
+   pctl->pctl_desc.owner = THIS_MODULE;
+   pctl->pctl_desc.pins = pins;
+   pctl->pctl_desc.npins = pctl->devdata->npins;
+   pctl->pctl_desc.confops = _pconf_ops;
+   pctl->pctl_desc.pctlops = _pctrl_ops;
+   pctl->pctl_desc.pmxops = _pmx_ops;
pctl->dev = >dev;
-   pctl->pctl_dev = pinctrl_register(_pctrl_desc, >dev, pctl);
+
+   pctl->pctl_dev = pinctrl_register(>pctl_desc, >dev, pctl);
if (IS_ERR(pctl->pctl_dev)) {
dev_err(>dev, "couldn't register pinctrl driver\n");
return PTR_ERR(pctl->pctl_dev);
diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.h 
b/drivers/pinctrl/mediatek/pinctrl-mtk-common.h
index 30213e5..c532c23 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.h
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.h
@@ -256,6 +256,7 @@ struct mtk_pinctrl_devdata {
 struct mtk_pinctrl {
struct regmap   *regmap1;
struct regmap   *regmap2;
+   struct pinctrl_desc pctl_desc;
struct device   *dev;
struct gpio_chip*chip;
struct mtk_pinctrl_group*groups;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v4] pinctrl: mediatek: Fix multiple registration issue.

2015-08-25 Thread Hongzhou Yang
On Tue, 2015-08-25 at 17:16 -0700, Hongzhou Yang wrote:
> Since our common driver need support main chip and PMU
> at the same time, that means it will register two
> pinctrl device, and the pinctrl_desc structure should
> be used two times.
> 
> But pinctrl_desc use global static definition, then
> the latest registered pinctrl device will overwrite
> the old one's, all members in pinctrl_desc will set to
> the new one's, such as name, pins and pins numbers, etc.
> This is a bug. Changing to use devm_kzalloc to fix it.
> 
> Cc: sta...@vger.kernel.org # v4.1+
> Signed-off-by: Hongzhou Yang 
> Reviewed-by: Axel Lin 
> ---
>  Adding pinctrl_desc into mtk_pinctrl, assign new value for each 
>  pinctrl device.
> 
>  drivers/pinctrl/mediatek/pinctrl-mtk-common.c |   21 ++---
>  drivers/pinctrl/mediatek/pinctrl-mtk-common.h |1 +
>  2 files changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c 
> b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> index ad1ea16..4a52072 100644
> --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> @@ -1202,12 +1202,6 @@ static int mtk_pctrl_build_state(struct 
> platform_device *pdev)
>   return 0;
>  }
>  
> -static struct pinctrl_desc mtk_pctrl_desc = {
> - .confops= _pconf_ops,
> - .pctlops= _pctrl_ops,
> - .pmxops = _pmx_ops,
> -};
> -
>  int mtk_pctrl_init(struct platform_device *pdev,
>   const struct mtk_pinctrl_devdata *data,
>   struct regmap *regmap)
> @@ -1265,12 +1259,17 @@ int mtk_pctrl_init(struct platform_device *pdev,
>  
>   for (i = 0; i < pctl->devdata->npins; i++)
>   pins[i] = pctl->devdata->pins[i].pin;
> - mtk_pctrl_desc.name = dev_name(>dev);
> - mtk_pctrl_desc.owner = THIS_MODULE;
> - mtk_pctrl_desc.pins = pins;
> - mtk_pctrl_desc.npins = pctl->devdata->npins;
> +
> + pctl->pctl_desc.name = dev_name(>dev);
> + pctl->pctl_desc.owner = THIS_MODULE;
> + pctl->pctl_desc.pins = pins;
> + pctl->pctl_desc.npins = pctl->devdata->npins;
> + pctl->pctl_desc.confops = _pconf_ops;
> + pctl->pctl_desc.pctlops = _pctrl_ops;
> + pctl->pctl_desc.pmxops = _pmx_ops;
>   pctl->dev = >dev;
> - pctl->pctl_dev = pinctrl_register(_pctrl_desc, >dev, pctl);
> +
> + pctl->pctl_dev = pinctrl_register(>pctl_desc, >dev, pctl);
>   if (IS_ERR(pctl->pctl_dev)) {
>   dev_err(>dev, "couldn't register pinctrl driver\n");
>   return PTR_ERR(pctl->pctl_dev);
> diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.h 
> b/drivers/pinctrl/mediatek/pinctrl-mtk-common.h
> index 30213e5..c532c23 100644
> --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.h
> +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.h
> @@ -256,6 +256,7 @@ struct mtk_pinctrl_devdata {
>  struct mtk_pinctrl {
>   struct regmap   *regmap1;
>   struct regmap   *regmap2;
> + struct pinctrl_desc pctl_desc;
>   struct device   *dev;
>   struct gpio_chip*chip;
>   struct mtk_pinctrl_group*groups;

Please ignore this patch, I will send another one.
Sorry about this.

Yours,
Hongzhou

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v4] pinctrl: mediatek: Fix multiple registration issue.

2015-08-25 Thread Hongzhou Yang
Since our common driver need support main chip and PMU
at the same time, that means it will register two
pinctrl device, and the pinctrl_desc structure should
be used two times.

But pinctrl_desc use global static definition, then
the latest registered pinctrl device will overwrite
the old one's, all members in pinctrl_desc will set to
the new one's, such as name, pins and pins numbers, etc.
This is a bug. Changing to use devm_kzalloc to fix it.

Cc: sta...@vger.kernel.org # v4.1+
Signed-off-by: Hongzhou Yang 
Reviewed-by: Axel Lin 
---
 Adding pinctrl_desc into mtk_pinctrl, assign new value for each 
 pinctrl device.

 drivers/pinctrl/mediatek/pinctrl-mtk-common.c |   21 ++---
 drivers/pinctrl/mediatek/pinctrl-mtk-common.h |1 +
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c 
b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
index ad1ea16..4a52072 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
@@ -1202,12 +1202,6 @@ static int mtk_pctrl_build_state(struct platform_device 
*pdev)
return 0;
 }
 
-static struct pinctrl_desc mtk_pctrl_desc = {
-   .confops= _pconf_ops,
-   .pctlops= _pctrl_ops,
-   .pmxops = _pmx_ops,
-};
-
 int mtk_pctrl_init(struct platform_device *pdev,
const struct mtk_pinctrl_devdata *data,
struct regmap *regmap)
@@ -1265,12 +1259,17 @@ int mtk_pctrl_init(struct platform_device *pdev,
 
for (i = 0; i < pctl->devdata->npins; i++)
pins[i] = pctl->devdata->pins[i].pin;
-   mtk_pctrl_desc.name = dev_name(>dev);
-   mtk_pctrl_desc.owner = THIS_MODULE;
-   mtk_pctrl_desc.pins = pins;
-   mtk_pctrl_desc.npins = pctl->devdata->npins;
+
+   pctl->pctl_desc.name = dev_name(>dev);
+   pctl->pctl_desc.owner = THIS_MODULE;
+   pctl->pctl_desc.pins = pins;
+   pctl->pctl_desc.npins = pctl->devdata->npins;
+   pctl->pctl_desc.confops = _pconf_ops;
+   pctl->pctl_desc.pctlops = _pctrl_ops;
+   pctl->pctl_desc.pmxops = _pmx_ops;
pctl->dev = >dev;
-   pctl->pctl_dev = pinctrl_register(_pctrl_desc, >dev, pctl);
+
+   pctl->pctl_dev = pinctrl_register(>pctl_desc, >dev, pctl);
if (IS_ERR(pctl->pctl_dev)) {
dev_err(>dev, "couldn't register pinctrl driver\n");
return PTR_ERR(pctl->pctl_dev);
diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.h 
b/drivers/pinctrl/mediatek/pinctrl-mtk-common.h
index 30213e5..c532c23 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.h
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.h
@@ -256,6 +256,7 @@ struct mtk_pinctrl_devdata {
 struct mtk_pinctrl {
struct regmap   *regmap1;
struct regmap   *regmap2;
+   struct pinctrl_desc pctl_desc;
struct device   *dev;
struct gpio_chip*chip;
struct mtk_pinctrl_group*groups;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v4] pinctrl: mediatek: Fix multiple registration issue.

2015-08-25 Thread Hongzhou Yang
Since our common driver need support main chip and PMU
at the same time, that means it will register two
pinctrl device, and the pinctrl_desc structure should
be used two times.

But pinctrl_desc use global static definition, then
the latest registered pinctrl device will overwrite
the old one's, all members in pinctrl_desc will set to
the new one's, such as name, pins and pins numbers, etc.
This is a bug. Changing to use devm_kzalloc to fix it.

Cc: sta...@vger.kernel.org # v4.1+
Signed-off-by: Hongzhou Yang hongzhou.y...@mediatek.com
Reviewed-by: Axel Lin axel@ingics.com
---
 Adding pinctrl_desc into mtk_pinctrl, assign new value for each 
 pinctrl device.

 drivers/pinctrl/mediatek/pinctrl-mtk-common.c |   21 ++---
 drivers/pinctrl/mediatek/pinctrl-mtk-common.h |1 +
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c 
b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
index ad1ea16..4a52072 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
@@ -1202,12 +1202,6 @@ static int mtk_pctrl_build_state(struct platform_device 
*pdev)
return 0;
 }
 
-static struct pinctrl_desc mtk_pctrl_desc = {
-   .confops= mtk_pconf_ops,
-   .pctlops= mtk_pctrl_ops,
-   .pmxops = mtk_pmx_ops,
-};
-
 int mtk_pctrl_init(struct platform_device *pdev,
const struct mtk_pinctrl_devdata *data,
struct regmap *regmap)
@@ -1265,12 +1259,17 @@ int mtk_pctrl_init(struct platform_device *pdev,
 
for (i = 0; i  pctl-devdata-npins; i++)
pins[i] = pctl-devdata-pins[i].pin;
-   mtk_pctrl_desc.name = dev_name(pdev-dev);
-   mtk_pctrl_desc.owner = THIS_MODULE;
-   mtk_pctrl_desc.pins = pins;
-   mtk_pctrl_desc.npins = pctl-devdata-npins;
+
+   pctl-pctl_desc.name = dev_name(pdev-dev);
+   pctl-pctl_desc.owner = THIS_MODULE;
+   pctl-pctl_desc.pins = pins;
+   pctl-pctl_desc.npins = pctl-devdata-npins;
+   pctl-pctl_desc.confops = mtk_pconf_ops;
+   pctl-pctl_desc.pctlops = mtk_pctrl_ops;
+   pctl-pctl_desc.pmxops = mtk_pmx_ops;
pctl-dev = pdev-dev;
-   pctl-pctl_dev = pinctrl_register(mtk_pctrl_desc, pdev-dev, pctl);
+
+   pctl-pctl_dev = pinctrl_register(pctl-pctl_desc, pdev-dev, pctl);
if (IS_ERR(pctl-pctl_dev)) {
dev_err(pdev-dev, couldn't register pinctrl driver\n);
return PTR_ERR(pctl-pctl_dev);
diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.h 
b/drivers/pinctrl/mediatek/pinctrl-mtk-common.h
index 30213e5..c532c23 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.h
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.h
@@ -256,6 +256,7 @@ struct mtk_pinctrl_devdata {
 struct mtk_pinctrl {
struct regmap   *regmap1;
struct regmap   *regmap2;
+   struct pinctrl_desc pctl_desc;
struct device   *dev;
struct gpio_chip*chip;
struct mtk_pinctrl_group*groups;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v4] pinctrl: mediatek: Fix multiple registration issue.

2015-08-25 Thread Hongzhou Yang
On Tue, 2015-08-25 at 17:16 -0700, Hongzhou Yang wrote:
 Since our common driver need support main chip and PMU
 at the same time, that means it will register two
 pinctrl device, and the pinctrl_desc structure should
 be used two times.
 
 But pinctrl_desc use global static definition, then
 the latest registered pinctrl device will overwrite
 the old one's, all members in pinctrl_desc will set to
 the new one's, such as name, pins and pins numbers, etc.
 This is a bug. Changing to use devm_kzalloc to fix it.
 
 Cc: sta...@vger.kernel.org # v4.1+
 Signed-off-by: Hongzhou Yang hongzhou.y...@mediatek.com
 Reviewed-by: Axel Lin axel@ingics.com
 ---
  Adding pinctrl_desc into mtk_pinctrl, assign new value for each 
  pinctrl device.
 
  drivers/pinctrl/mediatek/pinctrl-mtk-common.c |   21 ++---
  drivers/pinctrl/mediatek/pinctrl-mtk-common.h |1 +
  2 files changed, 11 insertions(+), 11 deletions(-)
 
 diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c 
 b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
 index ad1ea16..4a52072 100644
 --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
 +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
 @@ -1202,12 +1202,6 @@ static int mtk_pctrl_build_state(struct 
 platform_device *pdev)
   return 0;
  }
  
 -static struct pinctrl_desc mtk_pctrl_desc = {
 - .confops= mtk_pconf_ops,
 - .pctlops= mtk_pctrl_ops,
 - .pmxops = mtk_pmx_ops,
 -};
 -
  int mtk_pctrl_init(struct platform_device *pdev,
   const struct mtk_pinctrl_devdata *data,
   struct regmap *regmap)
 @@ -1265,12 +1259,17 @@ int mtk_pctrl_init(struct platform_device *pdev,
  
   for (i = 0; i  pctl-devdata-npins; i++)
   pins[i] = pctl-devdata-pins[i].pin;
 - mtk_pctrl_desc.name = dev_name(pdev-dev);
 - mtk_pctrl_desc.owner = THIS_MODULE;
 - mtk_pctrl_desc.pins = pins;
 - mtk_pctrl_desc.npins = pctl-devdata-npins;
 +
 + pctl-pctl_desc.name = dev_name(pdev-dev);
 + pctl-pctl_desc.owner = THIS_MODULE;
 + pctl-pctl_desc.pins = pins;
 + pctl-pctl_desc.npins = pctl-devdata-npins;
 + pctl-pctl_desc.confops = mtk_pconf_ops;
 + pctl-pctl_desc.pctlops = mtk_pctrl_ops;
 + pctl-pctl_desc.pmxops = mtk_pmx_ops;
   pctl-dev = pdev-dev;
 - pctl-pctl_dev = pinctrl_register(mtk_pctrl_desc, pdev-dev, pctl);
 +
 + pctl-pctl_dev = pinctrl_register(pctl-pctl_desc, pdev-dev, pctl);
   if (IS_ERR(pctl-pctl_dev)) {
   dev_err(pdev-dev, couldn't register pinctrl driver\n);
   return PTR_ERR(pctl-pctl_dev);
 diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.h 
 b/drivers/pinctrl/mediatek/pinctrl-mtk-common.h
 index 30213e5..c532c23 100644
 --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.h
 +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.h
 @@ -256,6 +256,7 @@ struct mtk_pinctrl_devdata {
  struct mtk_pinctrl {
   struct regmap   *regmap1;
   struct regmap   *regmap2;
 + struct pinctrl_desc pctl_desc;
   struct device   *dev;
   struct gpio_chip*chip;
   struct mtk_pinctrl_group*groups;

Please ignore this patch, I will send another one.
Sorry about this.

Yours,
Hongzhou

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v4] pinctrl: mediatek: Fix multiple registration issue.

2015-08-25 Thread Hongzhou Yang
Since our common driver need support main chip and PMU
at the same time, that means it will register two
pinctrl device, and the pinctrl_desc structure should
be used two times.

But pinctrl_desc use global static definition, then
the latest registered pinctrl device will overwrite
the old one's, all members in pinctrl_desc will set to
the new one's, such as name, pins and pins numbers, etc.
This is a bug.

Move pinctrl_desc into mtk_pinctrl, assign new value for
each pinctrl device to fix it.

Cc: sta...@vger.kernel.org # v4.1+
Signed-off-by: Hongzhou Yang hongzhou.y...@mediatek.com
Reviewed-by: Axel Lin axel@ingics.com
---
 In order to fix multiple registration issue, move 
 pinctrl_desc into mtk_pinctrl, assign new value for
 each pinctrl device.

 drivers/pinctrl/mediatek/pinctrl-mtk-common.c |   21 ++---
 drivers/pinctrl/mediatek/pinctrl-mtk-common.h |1 +
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c 
b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
index ad1ea16..4a52072 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
@@ -1202,12 +1202,6 @@ static int mtk_pctrl_build_state(struct platform_device 
*pdev)
return 0;
 }
 
-static struct pinctrl_desc mtk_pctrl_desc = {
-   .confops= mtk_pconf_ops,
-   .pctlops= mtk_pctrl_ops,
-   .pmxops = mtk_pmx_ops,
-};
-
 int mtk_pctrl_init(struct platform_device *pdev,
const struct mtk_pinctrl_devdata *data,
struct regmap *regmap)
@@ -1265,12 +1259,17 @@ int mtk_pctrl_init(struct platform_device *pdev,
 
for (i = 0; i  pctl-devdata-npins; i++)
pins[i] = pctl-devdata-pins[i].pin;
-   mtk_pctrl_desc.name = dev_name(pdev-dev);
-   mtk_pctrl_desc.owner = THIS_MODULE;
-   mtk_pctrl_desc.pins = pins;
-   mtk_pctrl_desc.npins = pctl-devdata-npins;
+
+   pctl-pctl_desc.name = dev_name(pdev-dev);
+   pctl-pctl_desc.owner = THIS_MODULE;
+   pctl-pctl_desc.pins = pins;
+   pctl-pctl_desc.npins = pctl-devdata-npins;
+   pctl-pctl_desc.confops = mtk_pconf_ops;
+   pctl-pctl_desc.pctlops = mtk_pctrl_ops;
+   pctl-pctl_desc.pmxops = mtk_pmx_ops;
pctl-dev = pdev-dev;
-   pctl-pctl_dev = pinctrl_register(mtk_pctrl_desc, pdev-dev, pctl);
+
+   pctl-pctl_dev = pinctrl_register(pctl-pctl_desc, pdev-dev, pctl);
if (IS_ERR(pctl-pctl_dev)) {
dev_err(pdev-dev, couldn't register pinctrl driver\n);
return PTR_ERR(pctl-pctl_dev);
diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.h 
b/drivers/pinctrl/mediatek/pinctrl-mtk-common.h
index 30213e5..c532c23 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.h
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.h
@@ -256,6 +256,7 @@ struct mtk_pinctrl_devdata {
 struct mtk_pinctrl {
struct regmap   *regmap1;
struct regmap   *regmap2;
+   struct pinctrl_desc pctl_desc;
struct device   *dev;
struct gpio_chip*chip;
struct mtk_pinctrl_group*groups;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3] pinctrl: mediatek: Fix multiple registration issue.

2015-08-20 Thread Hongzhou Yang
Since our common driver need support main chip and PMU
at the same time, that means it will register two
pinctrl device, and the pinctrl_desc structure should
be used two times.

But pinctrl_desc use global static definition, then
the latest registered pinctrl device will overwrite
the old one's, all members in pinctrl_desc will set to
the new one's, such as name, pins and pins numbers, etc.
This is a bug. Changing to use devm_kzalloc to fix it.

Cc: sta...@vger.kernel.org # v4.1+
Signed-off-by: Hongzhou Yang 
---
 Use dynamic allocation to fix multiple registration issue.

 drivers/pinctrl/mediatek/pinctrl-mtk-common.c |   21 ++---
 drivers/pinctrl/mediatek/pinctrl-mtk-common.h |1 +
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c 
b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
index ad1ea16..4a52072 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
@@ -1202,12 +1202,6 @@ static int mtk_pctrl_build_state(struct platform_device 
*pdev)
return 0;
 }
 
-static struct pinctrl_desc mtk_pctrl_desc = {
-   .confops= _pconf_ops,
-   .pctlops= _pctrl_ops,
-   .pmxops = _pmx_ops,
-};
-
 int mtk_pctrl_init(struct platform_device *pdev,
const struct mtk_pinctrl_devdata *data,
struct regmap *regmap)
@@ -1265,12 +1259,17 @@ int mtk_pctrl_init(struct platform_device *pdev,
 
for (i = 0; i < pctl->devdata->npins; i++)
pins[i] = pctl->devdata->pins[i].pin;
-   mtk_pctrl_desc.name = dev_name(>dev);
-   mtk_pctrl_desc.owner = THIS_MODULE;
-   mtk_pctrl_desc.pins = pins;
-   mtk_pctrl_desc.npins = pctl->devdata->npins;
+
+   pctl->pctl_desc.name = dev_name(>dev);
+   pctl->pctl_desc.owner = THIS_MODULE;
+   pctl->pctl_desc.pins = pins;
+   pctl->pctl_desc.npins = pctl->devdata->npins;
+   pctl->pctl_desc.confops = _pconf_ops;
+   pctl->pctl_desc.pctlops = _pctrl_ops;
+   pctl->pctl_desc.pmxops = _pmx_ops;
pctl->dev = >dev;
-   pctl->pctl_dev = pinctrl_register(_pctrl_desc, >dev, pctl);
+
+   pctl->pctl_dev = pinctrl_register(>pctl_desc, >dev, pctl);
if (IS_ERR(pctl->pctl_dev)) {
dev_err(>dev, "couldn't register pinctrl driver\n");
return PTR_ERR(pctl->pctl_dev);
diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.h 
b/drivers/pinctrl/mediatek/pinctrl-mtk-common.h
index 30213e5..c532c23 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.h
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.h
@@ -256,6 +256,7 @@ struct mtk_pinctrl_devdata {
 struct mtk_pinctrl {
struct regmap   *regmap1;
struct regmap   *regmap2;
+   struct pinctrl_desc pctl_desc;
struct device   *dev;
struct gpio_chip*chip;
struct mtk_pinctrl_group*groups;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3] pinctrl: mediatek: Fix multiple registration issue.

2015-08-20 Thread Hongzhou Yang
Since our common driver need support main chip and PMU
at the same time, that means it will register two
pinctrl device, and the pinctrl_desc structure should
be used two times.

But pinctrl_desc use global static definition, then
the latest registered pinctrl device will overwrite
the old one's, all members in pinctrl_desc will set to
the new one's, such as name, pins and pins numbers, etc.
This is a bug. Changing to use devm_kzalloc to fix it.

Cc: sta...@vger.kernel.org # v4.1+
Signed-off-by: Hongzhou Yang hongzhou.y...@mediatek.com
---
 Use dynamic allocation to fix multiple registration issue.

 drivers/pinctrl/mediatek/pinctrl-mtk-common.c |   21 ++---
 drivers/pinctrl/mediatek/pinctrl-mtk-common.h |1 +
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c 
b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
index ad1ea16..4a52072 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
@@ -1202,12 +1202,6 @@ static int mtk_pctrl_build_state(struct platform_device 
*pdev)
return 0;
 }
 
-static struct pinctrl_desc mtk_pctrl_desc = {
-   .confops= mtk_pconf_ops,
-   .pctlops= mtk_pctrl_ops,
-   .pmxops = mtk_pmx_ops,
-};
-
 int mtk_pctrl_init(struct platform_device *pdev,
const struct mtk_pinctrl_devdata *data,
struct regmap *regmap)
@@ -1265,12 +1259,17 @@ int mtk_pctrl_init(struct platform_device *pdev,
 
for (i = 0; i  pctl-devdata-npins; i++)
pins[i] = pctl-devdata-pins[i].pin;
-   mtk_pctrl_desc.name = dev_name(pdev-dev);
-   mtk_pctrl_desc.owner = THIS_MODULE;
-   mtk_pctrl_desc.pins = pins;
-   mtk_pctrl_desc.npins = pctl-devdata-npins;
+
+   pctl-pctl_desc.name = dev_name(pdev-dev);
+   pctl-pctl_desc.owner = THIS_MODULE;
+   pctl-pctl_desc.pins = pins;
+   pctl-pctl_desc.npins = pctl-devdata-npins;
+   pctl-pctl_desc.confops = mtk_pconf_ops;
+   pctl-pctl_desc.pctlops = mtk_pctrl_ops;
+   pctl-pctl_desc.pmxops = mtk_pmx_ops;
pctl-dev = pdev-dev;
-   pctl-pctl_dev = pinctrl_register(mtk_pctrl_desc, pdev-dev, pctl);
+
+   pctl-pctl_dev = pinctrl_register(pctl-pctl_desc, pdev-dev, pctl);
if (IS_ERR(pctl-pctl_dev)) {
dev_err(pdev-dev, couldn't register pinctrl driver\n);
return PTR_ERR(pctl-pctl_dev);
diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.h 
b/drivers/pinctrl/mediatek/pinctrl-mtk-common.h
index 30213e5..c532c23 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.h
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.h
@@ -256,6 +256,7 @@ struct mtk_pinctrl_devdata {
 struct mtk_pinctrl {
struct regmap   *regmap1;
struct regmap   *regmap2;
+   struct pinctrl_desc pctl_desc;
struct device   *dev;
struct gpio_chip*chip;
struct mtk_pinctrl_group*groups;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2] pinctrl: mediatek: Fix multiple registration issue.

2015-08-19 Thread Hongzhou Yang
Since our common driver need support main chip and PMU
at the same time, that means it will register two
pinctrl device, and the pinctrl_desc structure should
be used two times.

But pinctrl_desc use global static definition, then
the latest registered pinctrl device will overwrite
the old one's, all members in pinctrl_desc will set to
the new one's, such as name, pins and pins numbers, etc.
This is a bug. Changing to use devm_kzalloc to fix it.

Cc: sta...@vger.kernel.org # v4.1+
Signed-off-by: Hongzhou Yang 
---
 Use dynamic allocation to fix multiple registration issue.

 drivers/pinctrl/mediatek/pinctrl-mtk-common.c |   26 ++---
 drivers/pinctrl/mediatek/pinctrl-mtk-common.h |1 +
 2 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c 
b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
index ad1ea16..911c736 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
@@ -1202,12 +1202,6 @@ static int mtk_pctrl_build_state(struct platform_device 
*pdev)
return 0;
 }
 
-static struct pinctrl_desc mtk_pctrl_desc = {
-   .confops= _pconf_ops,
-   .pctlops= _pctrl_ops,
-   .pmxops = _pmx_ops,
-};
-
 int mtk_pctrl_init(struct platform_device *pdev,
const struct mtk_pinctrl_devdata *data,
struct regmap *regmap)
@@ -1265,12 +1259,22 @@ int mtk_pctrl_init(struct platform_device *pdev,
 
for (i = 0; i < pctl->devdata->npins; i++)
pins[i] = pctl->devdata->pins[i].pin;
-   mtk_pctrl_desc.name = dev_name(>dev);
-   mtk_pctrl_desc.owner = THIS_MODULE;
-   mtk_pctrl_desc.pins = pins;
-   mtk_pctrl_desc.npins = pctl->devdata->npins;
+
+   pctl->pctl_desc = devm_kzalloc(>dev, sizeof(*pctl->pctl_desc),
+   GFP_KERNEL);
+   if (!pctl->pctl_desc)
+   return -ENOMEM;
+
+   pctl->pctl_desc->name = dev_name(>dev);
+   pctl->pctl_desc->owner = THIS_MODULE;
+   pctl->pctl_desc->pins = pins;
+   pctl->pctl_desc->npins = pctl->devdata->npins;
+   pctl->pctl_desc->confops = _pconf_ops;
+   pctl->pctl_desc->pctlops = _pctrl_ops;
+   pctl->pctl_desc->pmxops = _pmx_ops;
pctl->dev = >dev;
-   pctl->pctl_dev = pinctrl_register(_pctrl_desc, >dev, pctl);
+
+   pctl->pctl_dev = pinctrl_register(pctl->pctl_desc, >dev, pctl);
if (IS_ERR(pctl->pctl_dev)) {
dev_err(>dev, "couldn't register pinctrl driver\n");
return PTR_ERR(pctl->pctl_dev);
diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.h 
b/drivers/pinctrl/mediatek/pinctrl-mtk-common.h
index 30213e5..93d6f5b 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.h
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.h
@@ -256,6 +256,7 @@ struct mtk_pinctrl_devdata {
 struct mtk_pinctrl {
struct regmap   *regmap1;
struct regmap   *regmap2;
+   struct pinctrl_desc *pctl_desc;
struct device   *dev;
struct gpio_chip*chip;
struct mtk_pinctrl_group*groups;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2] pinctrl: mediatek: Fix multiple registration issue.

2015-08-19 Thread Hongzhou Yang
Since our common driver need support main chip and PMU
at the same time, that means it will register two
pinctrl device, and the pinctrl_desc structure should
be used two times.

But pinctrl_desc use global static definition, then
the latest registered pinctrl device will overwrite
the old one's, all members in pinctrl_desc will set to
the new one's, such as name, pins and pins numbers, etc.
This is a bug. Changing to use devm_kzalloc to fix it.

Cc: sta...@vger.kernel.org # v4.1+
Signed-off-by: Hongzhou Yang hongzhou.y...@mediatek.com
---
 Use dynamic allocation to fix multiple registration issue.

 drivers/pinctrl/mediatek/pinctrl-mtk-common.c |   26 ++---
 drivers/pinctrl/mediatek/pinctrl-mtk-common.h |1 +
 2 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c 
b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
index ad1ea16..911c736 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
@@ -1202,12 +1202,6 @@ static int mtk_pctrl_build_state(struct platform_device 
*pdev)
return 0;
 }
 
-static struct pinctrl_desc mtk_pctrl_desc = {
-   .confops= mtk_pconf_ops,
-   .pctlops= mtk_pctrl_ops,
-   .pmxops = mtk_pmx_ops,
-};
-
 int mtk_pctrl_init(struct platform_device *pdev,
const struct mtk_pinctrl_devdata *data,
struct regmap *regmap)
@@ -1265,12 +1259,22 @@ int mtk_pctrl_init(struct platform_device *pdev,
 
for (i = 0; i  pctl-devdata-npins; i++)
pins[i] = pctl-devdata-pins[i].pin;
-   mtk_pctrl_desc.name = dev_name(pdev-dev);
-   mtk_pctrl_desc.owner = THIS_MODULE;
-   mtk_pctrl_desc.pins = pins;
-   mtk_pctrl_desc.npins = pctl-devdata-npins;
+
+   pctl-pctl_desc = devm_kzalloc(pdev-dev, sizeof(*pctl-pctl_desc),
+   GFP_KERNEL);
+   if (!pctl-pctl_desc)
+   return -ENOMEM;
+
+   pctl-pctl_desc-name = dev_name(pdev-dev);
+   pctl-pctl_desc-owner = THIS_MODULE;
+   pctl-pctl_desc-pins = pins;
+   pctl-pctl_desc-npins = pctl-devdata-npins;
+   pctl-pctl_desc-confops = mtk_pconf_ops;
+   pctl-pctl_desc-pctlops = mtk_pctrl_ops;
+   pctl-pctl_desc-pmxops = mtk_pmx_ops;
pctl-dev = pdev-dev;
-   pctl-pctl_dev = pinctrl_register(mtk_pctrl_desc, pdev-dev, pctl);
+
+   pctl-pctl_dev = pinctrl_register(pctl-pctl_desc, pdev-dev, pctl);
if (IS_ERR(pctl-pctl_dev)) {
dev_err(pdev-dev, couldn't register pinctrl driver\n);
return PTR_ERR(pctl-pctl_dev);
diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.h 
b/drivers/pinctrl/mediatek/pinctrl-mtk-common.h
index 30213e5..93d6f5b 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.h
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.h
@@ -256,6 +256,7 @@ struct mtk_pinctrl_devdata {
 struct mtk_pinctrl {
struct regmap   *regmap1;
struct regmap   *regmap2;
+   struct pinctrl_desc *pctl_desc;
struct device   *dev;
struct gpio_chip*chip;
struct mtk_pinctrl_group*groups;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v4] pinctrl: mediatek: Implement wake handler and suspend resume

2015-08-17 Thread Hongzhou Yang
On Mon, 2015-08-17 at 21:25 +0800, Yingjoe Chen wrote:
> On Mon, 2015-08-17 at 17:09 +0800, Daniel Kurtz wrote:
> > On Mon, Aug 17, 2015 at 3:52 PM, Yingjoe Chen  
> > wrote:
> > > On Fri, 2015-08-14 at 16:38 +0800, maoguang.m...@mediatek.com wrote:
> > >> From: Maoguang Meng 
> > >>
> > >> This patch implement irq_set_wake to get who is wakeup source and
> > >> setup on suspend resume.
> > >>
> > >> Signed-off-by: Maoguang Meng 
> > >>
> > >> ---
> > >> changes since v3:
> > >> -add a comment in mtk_eint_chip_read_mask.
> > >> -delete ALIGN when allocate eint_offsets.ports.
> > >> -fix unrelated change.
> > >>
> > >> changes since v2:
> > >> -modify irq_wake to handle irq wakeup source.
> > >> -allocate two buffers separately.
> > >> -fix some codestyle.
> > >>
> > >> Changes since v1:
> > >> -implement irq_wake handler.
> > >> ---
> > >>
> > >>  drivers/pinctrl/mediatek/pinctrl-mt8173.c |  1 +
> > >>  drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 91 
> > >> ++-
> > >>  drivers/pinctrl/mediatek/pinctrl-mtk-common.h |  4 ++
> > >>  3 files changed, 95 insertions(+), 1 deletion(-)
> > >>
> > >> diff --git a/drivers/pinctrl/mediatek/pinctrl-mt8173.c 
> > >> b/drivers/pinctrl/mediatek/pinctrl-mt8173.c
> > >> index d0c811d..ad27184 100644
> > >> --- a/drivers/pinctrl/mediatek/pinctrl-mt8173.c
> > >> +++ b/drivers/pinctrl/mediatek/pinctrl-mt8173.c
> > >> @@ -385,6 +385,7 @@ static struct platform_driver mtk_pinctrl_driver = {
> > >>   .driver = {
> > >>   .name = "mediatek-mt8173-pinctrl",
> > >>   .of_match_table = mt8173_pctrl_match,
> > >> + .pm = _eint_pm_ops,
> > >>   },
> > >>  };
> > >>
> > >> diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c 
> > >> b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> > >> index ad1ea16..fe34ce9 100644
> > >> --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> > >> +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> > >> @@ -33,6 +33,7 @@
> > >>  #include 
> > >>  #include 
> > >>  #include 
> > >> +#include 
> > >>  #include 
> > >>
> > >>  #include "../core.h"
> > >> @@ -1062,6 +1063,77 @@ static int mtk_eint_set_type(struct irq_data *d,
> > >>   return 0;
> > >>  }
> > >>
> > >> +static int mtk_eint_irq_set_wake(struct irq_data *d, unsigned int on)
> > >> +{
> > >> + struct mtk_pinctrl *pctl = irq_data_get_irq_chip_data(d);
> > >> + int shift = d->hwirq & 0x1f;
> > >> + int reg = d->hwirq >> 5;
> > >> +
> > >> + if (on)
> > >> + pctl->wake_mask[reg] |= BIT(shift);
> > >> + else
> > >> + pctl->wake_mask[reg] &= ~BIT(shift);
> > >> +
> > >> + return 0;
> > >> +}
> > >
> > > Hi Maoguang,
> > >
> > > You changed from set_bit/clear_bit to this, but didn't add any locking.
> > > Since this is basic read/modify/write, is it OK to do it without
> > > locking?
> > 
> > I believe calling .irq_set_wake() concurrently with itself is
> > protected by irq_get_desc_buslock():
> > 
> >  int irq_set_irq_wake(unsigned int irq, unsigned int on)
> >  {
> >  unsigned long flags;
> >  struct irq_desc *desc = irq_get_desc_buslock(irq, ,
> > IRQ_GET_DESC_CHECK_GLOBAL);
> >  int ret = 0;
> > ...
> >  ret = set_irq_wake_real(irq, on);
> > ...
> >  irq_put_desc_busunlock(desc, flags);
> >  return ret;
> >  }
> 
> Hi Dan,
> 
> You are right, irq_get_desc_buslock will acquire desc lock even when
> irq_chip didn't provide irq_bus_lock callback. So this should be OK.
> Sorry for the noise.
> 
> For this patch:
> 
> Acked-by: Yingjoe Chen 
> 
> Joe.C
> 


Acked-by: Hongzhou Yang 

Thanks.
Hongzhou


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v4] pinctrl: mediatek: Implement wake handler and suspend resume

2015-08-17 Thread Hongzhou Yang
On Mon, 2015-08-17 at 21:25 +0800, Yingjoe Chen wrote:
 On Mon, 2015-08-17 at 17:09 +0800, Daniel Kurtz wrote:
  On Mon, Aug 17, 2015 at 3:52 PM, Yingjoe Chen yingjoe.c...@mediatek.com 
  wrote:
   On Fri, 2015-08-14 at 16:38 +0800, maoguang.m...@mediatek.com wrote:
   From: Maoguang Meng maoguang.m...@mediatek.com
  
   This patch implement irq_set_wake to get who is wakeup source and
   setup on suspend resume.
  
   Signed-off-by: Maoguang Meng maoguang.m...@mediatek.com
  
   ---
   changes since v3:
   -add a comment in mtk_eint_chip_read_mask.
   -delete ALIGN when allocate eint_offsets.ports.
   -fix unrelated change.
  
   changes since v2:
   -modify irq_wake to handle irq wakeup source.
   -allocate two buffers separately.
   -fix some codestyle.
  
   Changes since v1:
   -implement irq_wake handler.
   ---
  
drivers/pinctrl/mediatek/pinctrl-mt8173.c |  1 +
drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 91 
   ++-
drivers/pinctrl/mediatek/pinctrl-mtk-common.h |  4 ++
3 files changed, 95 insertions(+), 1 deletion(-)
  
   diff --git a/drivers/pinctrl/mediatek/pinctrl-mt8173.c 
   b/drivers/pinctrl/mediatek/pinctrl-mt8173.c
   index d0c811d..ad27184 100644
   --- a/drivers/pinctrl/mediatek/pinctrl-mt8173.c
   +++ b/drivers/pinctrl/mediatek/pinctrl-mt8173.c
   @@ -385,6 +385,7 @@ static struct platform_driver mtk_pinctrl_driver = {
 .driver = {
 .name = mediatek-mt8173-pinctrl,
 .of_match_table = mt8173_pctrl_match,
   + .pm = mtk_eint_pm_ops,
 },
};
  
   diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c 
   b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
   index ad1ea16..fe34ce9 100644
   --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
   +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
   @@ -33,6 +33,7 @@
#include linux/mfd/syscon.h
#include linux/delay.h
#include linux/interrupt.h
   +#include linux/pm.h
#include dt-bindings/pinctrl/mt65xx.h
  
#include ../core.h
   @@ -1062,6 +1063,77 @@ static int mtk_eint_set_type(struct irq_data *d,
 return 0;
}
  
   +static int mtk_eint_irq_set_wake(struct irq_data *d, unsigned int on)
   +{
   + struct mtk_pinctrl *pctl = irq_data_get_irq_chip_data(d);
   + int shift = d-hwirq  0x1f;
   + int reg = d-hwirq  5;
   +
   + if (on)
   + pctl-wake_mask[reg] |= BIT(shift);
   + else
   + pctl-wake_mask[reg] = ~BIT(shift);
   +
   + return 0;
   +}
  
   Hi Maoguang,
  
   You changed from set_bit/clear_bit to this, but didn't add any locking.
   Since this is basic read/modify/write, is it OK to do it without
   locking?
  
  I believe calling .irq_set_wake() concurrently with itself is
  protected by irq_get_desc_buslock():
  
   int irq_set_irq_wake(unsigned int irq, unsigned int on)
   {
   unsigned long flags;
   struct irq_desc *desc = irq_get_desc_buslock(irq, flags,
  IRQ_GET_DESC_CHECK_GLOBAL);
   int ret = 0;
  ...
   ret = set_irq_wake_real(irq, on);
  ...
   irq_put_desc_busunlock(desc, flags);
   return ret;
   }
 
 Hi Dan,
 
 You are right, irq_get_desc_buslock will acquire desc lock even when
 irq_chip didn't provide irq_bus_lock callback. So this should be OK.
 Sorry for the noise.
 
 For this patch:
 
 Acked-by: Yingjoe Chen yingjoe.c...@mediatek.com
 
 Joe.C
 


Acked-by: Hongzhou Yang hongzhou.y...@mediatek.com

Thanks.
Hongzhou


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] pinctrl: mediatek: Fix multiple registeration issue.

2015-08-12 Thread Hongzhou Yang
On Tue, 2015-08-11 at 15:45 +0800, Daniel Kurtz wrote:
> On Tue, Aug 11, 2015 at 12:49 PM, Hongzhou Yang
>  wrote:
> > Use dynamic allocation to fix multiple registeration issue.
> 
> s/registeration/registration   - here and in the patch subject.
> 
> >
> > --8<
> 
> I don't think this is required.
> 
> > Since our common driver need support main chip and PMU
> > at the same time, that means it will register two
> > pinctrl device, and the pinctrl_desc structure should
> > be used two times.
> >
> > But pinctrl_desc use global static definition, then
> > the latest registered pinctrl device will overwrite
> > the old one's, all members in pinctrl_desc will set to
> > the new one's, such as name, pins and pins numbers, etc.
> > This is a bug. Changing to use devm_kzalloc to fix it.
> >
> > Cc: sta...@vger.kernel.org # v4.1+
> > Signed-off-by: Hongzhou Yang 
> > ---
> >  drivers/pinctrl/mediatek/pinctrl-mtk-common.c |   27 
> > +++--
> >  1 file changed, 16 insertions(+), 11 deletions(-)
> >
> > diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c 
> > b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> > index ad1ea16..2bba504 100644
> > --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> > +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> > @@ -1202,17 +1202,12 @@ static int mtk_pctrl_build_state(struct 
> > platform_device *pdev)
> > return 0;
> >  }
> >
> > -static struct pinctrl_desc mtk_pctrl_desc = {
> > -   .confops= _pconf_ops,
> > -   .pctlops= _pctrl_ops,
> > -   .pmxops = _pmx_ops,
> > -};
> > -
> >  int mtk_pctrl_init(struct platform_device *pdev,
> > const struct mtk_pinctrl_devdata *data,
> > struct regmap *regmap)
> >  {
> > struct pinctrl_pin_desc *pins;
> > +   struct pinctrl_desc *mtk_pctrl_desc;
> > struct mtk_pinctrl *pctl;
> > struct device_node *np = pdev->dev.of_node, *node;
> > struct property *prop;
> > @@ -1265,12 +1260,22 @@ int mtk_pctrl_init(struct platform_device *pdev,
> >
> > for (i = 0; i < pctl->devdata->npins; i++)
> > pins[i] = pctl->devdata->pins[i].pin;
> > -   mtk_pctrl_desc.name = dev_name(>dev);
> > -   mtk_pctrl_desc.owner = THIS_MODULE;
> > -   mtk_pctrl_desc.pins = pins;
> > -   mtk_pctrl_desc.npins = pctl->devdata->npins;
> > +
> > +   mtk_pctrl_desc = devm_kzalloc(>dev, sizeof(*mtk_pctrl_desc),
> > +   GFP_KERNEL);
> > +   if (!mtk_pctrl_desc)
> > +   return -ENOMEM;
> 
> Just embed a struct pinctrl_desc in your struct mtk_pinctrl.
> 
> Best Regards,
> -Dan

Ok, I will send another patch to fix them, thank you.

Yours,
Hongzhou


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] pinctrl: mediatek: Fix multiple registeration issue.

2015-08-12 Thread Hongzhou Yang
On Tue, 2015-08-11 at 15:45 +0800, Daniel Kurtz wrote:
 On Tue, Aug 11, 2015 at 12:49 PM, Hongzhou Yang
 hongzhou.y...@mediatek.com wrote:
  Use dynamic allocation to fix multiple registeration issue.
 
 s/registeration/registration   - here and in the patch subject.
 
 
  --8
 
 I don't think this is required.
 
  Since our common driver need support main chip and PMU
  at the same time, that means it will register two
  pinctrl device, and the pinctrl_desc structure should
  be used two times.
 
  But pinctrl_desc use global static definition, then
  the latest registered pinctrl device will overwrite
  the old one's, all members in pinctrl_desc will set to
  the new one's, such as name, pins and pins numbers, etc.
  This is a bug. Changing to use devm_kzalloc to fix it.
 
  Cc: sta...@vger.kernel.org # v4.1+
  Signed-off-by: Hongzhou Yang hongzhou.y...@mediatek.com
  ---
   drivers/pinctrl/mediatek/pinctrl-mtk-common.c |   27 
  +++--
   1 file changed, 16 insertions(+), 11 deletions(-)
 
  diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c 
  b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
  index ad1ea16..2bba504 100644
  --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
  +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
  @@ -1202,17 +1202,12 @@ static int mtk_pctrl_build_state(struct 
  platform_device *pdev)
  return 0;
   }
 
  -static struct pinctrl_desc mtk_pctrl_desc = {
  -   .confops= mtk_pconf_ops,
  -   .pctlops= mtk_pctrl_ops,
  -   .pmxops = mtk_pmx_ops,
  -};
  -
   int mtk_pctrl_init(struct platform_device *pdev,
  const struct mtk_pinctrl_devdata *data,
  struct regmap *regmap)
   {
  struct pinctrl_pin_desc *pins;
  +   struct pinctrl_desc *mtk_pctrl_desc;
  struct mtk_pinctrl *pctl;
  struct device_node *np = pdev-dev.of_node, *node;
  struct property *prop;
  @@ -1265,12 +1260,22 @@ int mtk_pctrl_init(struct platform_device *pdev,
 
  for (i = 0; i  pctl-devdata-npins; i++)
  pins[i] = pctl-devdata-pins[i].pin;
  -   mtk_pctrl_desc.name = dev_name(pdev-dev);
  -   mtk_pctrl_desc.owner = THIS_MODULE;
  -   mtk_pctrl_desc.pins = pins;
  -   mtk_pctrl_desc.npins = pctl-devdata-npins;
  +
  +   mtk_pctrl_desc = devm_kzalloc(pdev-dev, sizeof(*mtk_pctrl_desc),
  +   GFP_KERNEL);
  +   if (!mtk_pctrl_desc)
  +   return -ENOMEM;
 
 Just embed a struct pinctrl_desc in your struct mtk_pinctrl.
 
 Best Regards,
 -Dan

Ok, I will send another patch to fix them, thank you.

Yours,
Hongzhou


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] pinctrl: mediatek: Fix multiple registeration issue.

2015-08-10 Thread Hongzhou Yang
Use dynamic allocation to fix multiple registeration issue.

--8<
Since our common driver need support main chip and PMU
at the same time, that means it will register two
pinctrl device, and the pinctrl_desc structure should
be used two times.

But pinctrl_desc use global static definition, then
the latest registered pinctrl device will overwrite
the old one's, all members in pinctrl_desc will set to
the new one's, such as name, pins and pins numbers, etc.
This is a bug. Changing to use devm_kzalloc to fix it.

Cc: sta...@vger.kernel.org # v4.1+
Signed-off-by: Hongzhou Yang 
---
 drivers/pinctrl/mediatek/pinctrl-mtk-common.c |   27 +++--
 1 file changed, 16 insertions(+), 11 deletions(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c 
b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
index ad1ea16..2bba504 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
@@ -1202,17 +1202,12 @@ static int mtk_pctrl_build_state(struct platform_device 
*pdev)
return 0;
 }
 
-static struct pinctrl_desc mtk_pctrl_desc = {
-   .confops= _pconf_ops,
-   .pctlops= _pctrl_ops,
-   .pmxops = _pmx_ops,
-};
-
 int mtk_pctrl_init(struct platform_device *pdev,
const struct mtk_pinctrl_devdata *data,
struct regmap *regmap)
 {
struct pinctrl_pin_desc *pins;
+   struct pinctrl_desc *mtk_pctrl_desc;
struct mtk_pinctrl *pctl;
struct device_node *np = pdev->dev.of_node, *node;
struct property *prop;
@@ -1265,12 +1260,22 @@ int mtk_pctrl_init(struct platform_device *pdev,
 
for (i = 0; i < pctl->devdata->npins; i++)
pins[i] = pctl->devdata->pins[i].pin;
-   mtk_pctrl_desc.name = dev_name(>dev);
-   mtk_pctrl_desc.owner = THIS_MODULE;
-   mtk_pctrl_desc.pins = pins;
-   mtk_pctrl_desc.npins = pctl->devdata->npins;
+
+   mtk_pctrl_desc = devm_kzalloc(>dev, sizeof(*mtk_pctrl_desc),
+   GFP_KERNEL);
+   if (!mtk_pctrl_desc)
+   return -ENOMEM;
+
+   mtk_pctrl_desc->name = dev_name(>dev);
+   mtk_pctrl_desc->owner = THIS_MODULE;
+   mtk_pctrl_desc->pins = pins;
+   mtk_pctrl_desc->npins = pctl->devdata->npins;
+   mtk_pctrl_desc->confops = _pconf_ops;
+   mtk_pctrl_desc->pctlops = _pctrl_ops;
+   mtk_pctrl_desc->pmxops = _pmx_ops;
pctl->dev = >dev;
-   pctl->pctl_dev = pinctrl_register(_pctrl_desc, >dev, pctl);
+
+   pctl->pctl_dev = pinctrl_register(mtk_pctrl_desc, >dev, pctl);
if (IS_ERR(pctl->pctl_dev)) {
dev_err(>dev, "couldn't register pinctrl driver\n");
return PTR_ERR(pctl->pctl_dev);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] pinctrl: mediatek: Implement pictrl irq wake handler

2015-08-10 Thread Hongzhou Yang
On Mon, 2015-08-10 at 14:43 +0200, Linus Walleij wrote:
> On Wed, Jul 29, 2015 at 11:36 AM,   wrote:
> 
> > From: Maoguang Meng 
> >
> > This patch implement irq_set_wake for suspend resume.
> >
> > Signed-off-by: Maoguang Meng 
> 
> Hongzhou/Yingjoe: are you OK with this patch? Can I have your ACKs?
> 
> Yours,
> Linus Walleij

Hi Linus,

Yes, you can. Thank you.

Acked-by: Hongzhou Yang 

Hongzhou

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] pinctrl: mediatek: Fix multiple registeration issue.

2015-08-10 Thread Hongzhou Yang
Use dynamic allocation to fix multiple registeration issue.

--8
Since our common driver need support main chip and PMU
at the same time, that means it will register two
pinctrl device, and the pinctrl_desc structure should
be used two times.

But pinctrl_desc use global static definition, then
the latest registered pinctrl device will overwrite
the old one's, all members in pinctrl_desc will set to
the new one's, such as name, pins and pins numbers, etc.
This is a bug. Changing to use devm_kzalloc to fix it.

Cc: sta...@vger.kernel.org # v4.1+
Signed-off-by: Hongzhou Yang hongzhou.y...@mediatek.com
---
 drivers/pinctrl/mediatek/pinctrl-mtk-common.c |   27 +++--
 1 file changed, 16 insertions(+), 11 deletions(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c 
b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
index ad1ea16..2bba504 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
@@ -1202,17 +1202,12 @@ static int mtk_pctrl_build_state(struct platform_device 
*pdev)
return 0;
 }
 
-static struct pinctrl_desc mtk_pctrl_desc = {
-   .confops= mtk_pconf_ops,
-   .pctlops= mtk_pctrl_ops,
-   .pmxops = mtk_pmx_ops,
-};
-
 int mtk_pctrl_init(struct platform_device *pdev,
const struct mtk_pinctrl_devdata *data,
struct regmap *regmap)
 {
struct pinctrl_pin_desc *pins;
+   struct pinctrl_desc *mtk_pctrl_desc;
struct mtk_pinctrl *pctl;
struct device_node *np = pdev-dev.of_node, *node;
struct property *prop;
@@ -1265,12 +1260,22 @@ int mtk_pctrl_init(struct platform_device *pdev,
 
for (i = 0; i  pctl-devdata-npins; i++)
pins[i] = pctl-devdata-pins[i].pin;
-   mtk_pctrl_desc.name = dev_name(pdev-dev);
-   mtk_pctrl_desc.owner = THIS_MODULE;
-   mtk_pctrl_desc.pins = pins;
-   mtk_pctrl_desc.npins = pctl-devdata-npins;
+
+   mtk_pctrl_desc = devm_kzalloc(pdev-dev, sizeof(*mtk_pctrl_desc),
+   GFP_KERNEL);
+   if (!mtk_pctrl_desc)
+   return -ENOMEM;
+
+   mtk_pctrl_desc-name = dev_name(pdev-dev);
+   mtk_pctrl_desc-owner = THIS_MODULE;
+   mtk_pctrl_desc-pins = pins;
+   mtk_pctrl_desc-npins = pctl-devdata-npins;
+   mtk_pctrl_desc-confops = mtk_pconf_ops;
+   mtk_pctrl_desc-pctlops = mtk_pctrl_ops;
+   mtk_pctrl_desc-pmxops = mtk_pmx_ops;
pctl-dev = pdev-dev;
-   pctl-pctl_dev = pinctrl_register(mtk_pctrl_desc, pdev-dev, pctl);
+
+   pctl-pctl_dev = pinctrl_register(mtk_pctrl_desc, pdev-dev, pctl);
if (IS_ERR(pctl-pctl_dev)) {
dev_err(pdev-dev, couldn't register pinctrl driver\n);
return PTR_ERR(pctl-pctl_dev);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] pinctrl: mediatek: Implement pictrl irq wake handler

2015-08-10 Thread Hongzhou Yang
On Mon, 2015-08-10 at 14:43 +0200, Linus Walleij wrote:
 On Wed, Jul 29, 2015 at 11:36 AM,  maoguang.m...@mediatek.com wrote:
 
  From: Maoguang Meng maoguang.m...@mediatek.com
 
  This patch implement irq_set_wake for suspend resume.
 
  Signed-off-by: Maoguang Meng maoguang.m...@mediatek.com
 
 Hongzhou/Yingjoe: are you OK with this patch? Can I have your ACKs?
 
 Yours,
 Linus Walleij

Hi Linus,

Yes, you can. Thank you.

Acked-by: Hongzhou Yang hongzhou.y...@mediatek.com

Hongzhou

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] pinctrl/mediatek: fix spelling mistake in dev_err error message

2015-08-03 Thread Hongzhou Yang
On Mon, 2015-08-03 at 00:10 +0100, Colin King wrote:
> From: Colin Ian King 
> 
> Trivial change, fix spelling mistake 'invaild' -> 'invalid' in
> dev_err message.
> 
> Signed-off-by: Colin Ian King 
> ---
>  drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c 
> b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> index ad1ea16..5af5441 100644
> --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
> @@ -702,7 +702,7 @@ static int mtk_pmx_set_mux(struct pinctrl_dev *pctldev,
>  
>   ret = mtk_pctrl_is_function_valid(pctl, g->pin, function);
>   if (!ret) {
> - dev_err(pctl->dev, "invaild function %d on group %d .\n",
> + dev_err(pctl->dev, "invalid function %d on group %d .\n",
>   function, group);
>   return -EINVAL;
>   }

Hi Colin,

Thank you very much.

Acked-by: Hongzhou Yang 

Hongzhou

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] pinctrl/mediatek: fix spelling mistake in dev_err error message

2015-08-03 Thread Hongzhou Yang
On Mon, 2015-08-03 at 00:10 +0100, Colin King wrote:
 From: Colin Ian King colin.k...@canonical.com
 
 Trivial change, fix spelling mistake 'invaild' - 'invalid' in
 dev_err message.
 
 Signed-off-by: Colin Ian King colin.k...@canonical.com
 ---
  drivers/pinctrl/mediatek/pinctrl-mtk-common.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c 
 b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
 index ad1ea16..5af5441 100644
 --- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
 +++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
 @@ -702,7 +702,7 @@ static int mtk_pmx_set_mux(struct pinctrl_dev *pctldev,
  
   ret = mtk_pctrl_is_function_valid(pctl, g-pin, function);
   if (!ret) {
 - dev_err(pctl-dev, invaild function %d on group %d .\n,
 + dev_err(pctl-dev, invalid function %d on group %d .\n,
   function, group);
   return -EINVAL;
   }

Hi Colin,

Thank you very much.

Acked-by: Hongzhou Yang hongzhou.y...@mediatek.com

Hongzhou

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATH] Fix ies/smt and register irq fail bug.

2015-06-01 Thread Hongzhou Yang
On Wed, 2015-05-27 at 02:43 -0700, Hongzhou Yang wrote:
> Hi Linus,
> After integration test, we found some bugs in the code you just merged.
> The first is that I missed ies/smt configuration for MSDC3.
> The seconed is the if judgement for "interrupt-controller" I added last
> time should on the contrary. So adding these two patches to fix them.
> Sorry about this. And please help to merge them, many thanks.
> 
> These patches include below changes:
> - Adding MSDC3 ies/smt support for mt8173.
> - Since mt6397 is no need to support interrupt controller,
> I judged "interrupt-controller" property to skip it last time,
> but the if judgement should on the contrary, this is a bug.
> so adding this patch to fix it. 
>  
> Hongzhou Yang (2):
>   pinctrl: mediatek: Fix bug of ies/smt setting for mt8173.
>   pinctrl: mediatek: Fix pinctrl register irq fail bug.
> 
>  drivers/pinctrl/mediatek/pinctrl-mt8173.c |   10 +-
>  drivers/pinctrl/mediatek/pinctrl-mtk-common.c |4 ++--
>  2 files changed, 11 insertions(+), 3 deletions(-)
> 
> --
> 1.7.9.5
> 

Hi Linus,

Do you have any suggestion about these two patches?
Since we can't boot up device without these two patches, could
you please help to merge them?
Thank you very much.

Yours,
Hongzhou



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATH] Fix ies/smt and register irq fail bug.

2015-06-01 Thread Hongzhou Yang
On Wed, 2015-05-27 at 02:43 -0700, Hongzhou Yang wrote:
 Hi Linus,
 After integration test, we found some bugs in the code you just merged.
 The first is that I missed ies/smt configuration for MSDC3.
 The seconed is the if judgement for interrupt-controller I added last
 time should on the contrary. So adding these two patches to fix them.
 Sorry about this. And please help to merge them, many thanks.
 
 These patches include below changes:
 - Adding MSDC3 ies/smt support for mt8173.
 - Since mt6397 is no need to support interrupt controller,
 I judged interrupt-controller property to skip it last time,
 but the if judgement should on the contrary, this is a bug.
 so adding this patch to fix it. 
  
 Hongzhou Yang (2):
   pinctrl: mediatek: Fix bug of ies/smt setting for mt8173.
   pinctrl: mediatek: Fix pinctrl register irq fail bug.
 
  drivers/pinctrl/mediatek/pinctrl-mt8173.c |   10 +-
  drivers/pinctrl/mediatek/pinctrl-mtk-common.c |4 ++--
  2 files changed, 11 insertions(+), 3 deletions(-)
 
 --
 1.7.9.5
 

Hi Linus,

Do you have any suggestion about these two patches?
Since we can't boot up device without these two patches, could
you please help to merge them?
Thank you very much.

Yours,
Hongzhou



--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] mfd: mediatek: Add GPIO sub module support into mfd.

2015-05-27 Thread Hongzhou Yang
On Wed, 2015-05-27 at 11:32 +0100, Lee Jones wrote:
> On Wed, 27 May 2015, Hongzhou Yang wrote:
> 
> > Base on Lee Jones' comment, change pinctrl subnode name.
> > 
> > ---
> > Register pinctrl subnode into 6397 mfd cell.
> 
> Sascha already mentioned what's wrong here, so I'll not labour the
> point.
> 
> I'm feeling generous, I'll apply this and make the necessary changes
> myself.  Please bear the points in mind for next time however.
> 
> Applied, thanks.
> 

Ok, I will pay more attention to it next time.
Thank you very much.

Yours,
Hongzhou


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/2] pinctrl: mediatek: Fix bug of ies/smt setting for mt8173.

2015-05-27 Thread Hongzhou Yang
Add ies/smt support for MSDC3.
Also fix ies bug for pin 106 and 107.

Signed-off-by: Hongzhou Yang 
---
 drivers/pinctrl/mediatek/pinctrl-mt8173.c |   10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-mt8173.c 
b/drivers/pinctrl/mediatek/pinctrl-mt8173.c
index cf4ed6e..d0c811d 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mt8173.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mt8173.c
@@ -84,6 +84,10 @@ static const struct mtk_pin_ies_smt_set mt8173_smt_set[] = {
MTK_PIN_IES_SMT_SPEC(16, 16, 0x930, 0),
MTK_PIN_IES_SMT_SPEC(17, 17, 0x950, 2),
MTK_PIN_IES_SMT_SPEC(18, 21, 0x940, 3),
+   MTK_PIN_IES_SMT_SPEC(22, 25, 0xce0, 13),
+   MTK_PIN_IES_SMT_SPEC(26, 26, 0xcc0, 13),
+   MTK_PIN_IES_SMT_SPEC(27, 27, 0xcd0, 13),
+   MTK_PIN_IES_SMT_SPEC(28, 28, 0xd70, 13),
MTK_PIN_IES_SMT_SPEC(29, 32, 0x930, 3),
MTK_PIN_IES_SMT_SPEC(33, 33, 0x930, 4),
MTK_PIN_IES_SMT_SPEC(34, 36, 0x930, 5),
@@ -133,6 +137,10 @@ static const struct mtk_pin_ies_smt_set mt8173_ies_set[] = 
{
MTK_PIN_IES_SMT_SPEC(16, 16, 0x900, 0),
MTK_PIN_IES_SMT_SPEC(17, 17, 0x920, 2),
MTK_PIN_IES_SMT_SPEC(18, 21, 0x910, 3),
+   MTK_PIN_IES_SMT_SPEC(22, 25, 0xce0, 14),
+   MTK_PIN_IES_SMT_SPEC(26, 26, 0xcc0, 14),
+   MTK_PIN_IES_SMT_SPEC(27, 27, 0xcd0, 14),
+   MTK_PIN_IES_SMT_SPEC(28, 28, 0xd70, 14),
MTK_PIN_IES_SMT_SPEC(29, 32, 0x900, 3),
MTK_PIN_IES_SMT_SPEC(33, 33, 0x900, 4),
MTK_PIN_IES_SMT_SPEC(34, 36, 0x900, 5),
@@ -161,7 +169,7 @@ static const struct mtk_pin_ies_smt_set mt8173_ies_set[] = {
MTK_PIN_IES_SMT_SPEC(100, 103, 0xca0, 14),
MTK_PIN_IES_SMT_SPEC(104, 104, 0xc80, 14),
MTK_PIN_IES_SMT_SPEC(105, 105, 0xc90, 14),
-   MTK_PIN_IES_SMT_SPEC(106, 107, 0x91, 4),
+   MTK_PIN_IES_SMT_SPEC(106, 107, 0x910, 4),
MTK_PIN_IES_SMT_SPEC(108, 112, 0x910, 1),
MTK_PIN_IES_SMT_SPEC(113, 116, 0x910, 2),
MTK_PIN_IES_SMT_SPEC(117, 118, 0x910, 5),
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATH] Fix ies/smt and register irq fail bug.

2015-05-27 Thread Hongzhou Yang
Hi Linus,
After integration test, we found some bugs in the code you just merged.
The first is that I missed ies/smt configuration for MSDC3.
The seconed is the if judgement for "interrupt-controller" I added last
time should on the contrary. So adding these two patches to fix them.
Sorry about this. And please help to merge them, many thanks.

These patches include below changes:
- Adding MSDC3 ies/smt support for mt8173.
- Since mt6397 is no need to support interrupt controller,
I judged "interrupt-controller" property to skip it last time,
but the if judgement should on the contrary, this is a bug.
so adding this patch to fix it. 
 
Hongzhou Yang (2):
  pinctrl: mediatek: Fix bug of ies/smt setting for mt8173.
  pinctrl: mediatek: Fix pinctrl register irq fail bug.

 drivers/pinctrl/mediatek/pinctrl-mt8173.c |   10 +-
 drivers/pinctrl/mediatek/pinctrl-mtk-common.c |4 ++--
 2 files changed, 11 insertions(+), 3 deletions(-)

--
1.7.9.5


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/2] pinctrl: mediatek: Fix pinctrl register irq fail bug.

2015-05-27 Thread Hongzhou Yang
Since mt6397 is no need to support interrupt controller,
I judged "interrupt-controller" property to skip it last patch.
But the if judgement should on the contrary, this is a bug.

And find of_property_read_bool is better for this case.
So using of_property_read_bool instead of of_find_property.

Also fix bug of misuse pointer.

Signed-off-by: Hongzhou Yang 
---
 drivers/pinctrl/mediatek/pinctrl-mtk-common.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c 
b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
index cd22729..f206a54 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
@@ -1280,7 +1280,7 @@ int mtk_pctrl_init(struct platform_device *pdev,
goto pctrl_error;
}
 
-   pctl->chip = _gpio_chip;
+   *pctl->chip = mtk_gpio_chip;
pctl->chip->ngpio = pctl->devdata->npins;
pctl->chip->label = dev_name(>dev);
pctl->chip->dev = >dev;
@@ -1300,7 +1300,7 @@ int mtk_pctrl_init(struct platform_device *pdev,
goto chip_error;
}
 
-   if (of_find_property(np, "interrupt-controller", NULL))
+   if (!of_property_read_bool(np, "interrupt-controller"))
return 0;
 
/* Get EINT register base from dts. */
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] mfd: mediatek: Add GPIO sub module support into mfd.

2015-05-27 Thread Hongzhou Yang
Base on Lee Jones' comment, change pinctrl subnode name.

---
Register pinctrl subnode into 6397 mfd cell.

Signed-off-by: Hongzhou Yang 
Acked-by: Linus Walleij 
---
 drivers/mfd/mt6397-core.c |3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/mfd/mt6397-core.c b/drivers/mfd/mt6397-core.c
index 09bc780..e50a9bc 100644
--- a/drivers/mfd/mt6397-core.c
+++ b/drivers/mfd/mt6397-core.c
@@ -34,6 +34,9 @@ static const struct mfd_cell mt6397_devs[] = {
}, {
.name = "mt6397-clk",
.of_compatible = "mediatek,mt6397-clk",
+   }, {
+   .name = "mt6397-pinctrl",
+   .of_compatible = "mediatek,mt6397-pinctrl",
},
 };
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/2] pinctrl: mediatek: Fix bug of ies/smt setting for mt8173.

2015-05-27 Thread Hongzhou Yang
Add ies/smt support for MSDC3.
Also fix ies bug for pin 106 and 107.

Signed-off-by: Hongzhou Yang hongzhou.y...@mediatek.com
---
 drivers/pinctrl/mediatek/pinctrl-mt8173.c |   10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-mt8173.c 
b/drivers/pinctrl/mediatek/pinctrl-mt8173.c
index cf4ed6e..d0c811d 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mt8173.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mt8173.c
@@ -84,6 +84,10 @@ static const struct mtk_pin_ies_smt_set mt8173_smt_set[] = {
MTK_PIN_IES_SMT_SPEC(16, 16, 0x930, 0),
MTK_PIN_IES_SMT_SPEC(17, 17, 0x950, 2),
MTK_PIN_IES_SMT_SPEC(18, 21, 0x940, 3),
+   MTK_PIN_IES_SMT_SPEC(22, 25, 0xce0, 13),
+   MTK_PIN_IES_SMT_SPEC(26, 26, 0xcc0, 13),
+   MTK_PIN_IES_SMT_SPEC(27, 27, 0xcd0, 13),
+   MTK_PIN_IES_SMT_SPEC(28, 28, 0xd70, 13),
MTK_PIN_IES_SMT_SPEC(29, 32, 0x930, 3),
MTK_PIN_IES_SMT_SPEC(33, 33, 0x930, 4),
MTK_PIN_IES_SMT_SPEC(34, 36, 0x930, 5),
@@ -133,6 +137,10 @@ static const struct mtk_pin_ies_smt_set mt8173_ies_set[] = 
{
MTK_PIN_IES_SMT_SPEC(16, 16, 0x900, 0),
MTK_PIN_IES_SMT_SPEC(17, 17, 0x920, 2),
MTK_PIN_IES_SMT_SPEC(18, 21, 0x910, 3),
+   MTK_PIN_IES_SMT_SPEC(22, 25, 0xce0, 14),
+   MTK_PIN_IES_SMT_SPEC(26, 26, 0xcc0, 14),
+   MTK_PIN_IES_SMT_SPEC(27, 27, 0xcd0, 14),
+   MTK_PIN_IES_SMT_SPEC(28, 28, 0xd70, 14),
MTK_PIN_IES_SMT_SPEC(29, 32, 0x900, 3),
MTK_PIN_IES_SMT_SPEC(33, 33, 0x900, 4),
MTK_PIN_IES_SMT_SPEC(34, 36, 0x900, 5),
@@ -161,7 +169,7 @@ static const struct mtk_pin_ies_smt_set mt8173_ies_set[] = {
MTK_PIN_IES_SMT_SPEC(100, 103, 0xca0, 14),
MTK_PIN_IES_SMT_SPEC(104, 104, 0xc80, 14),
MTK_PIN_IES_SMT_SPEC(105, 105, 0xc90, 14),
-   MTK_PIN_IES_SMT_SPEC(106, 107, 0x91, 4),
+   MTK_PIN_IES_SMT_SPEC(106, 107, 0x910, 4),
MTK_PIN_IES_SMT_SPEC(108, 112, 0x910, 1),
MTK_PIN_IES_SMT_SPEC(113, 116, 0x910, 2),
MTK_PIN_IES_SMT_SPEC(117, 118, 0x910, 5),
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] mfd: mediatek: Add GPIO sub module support into mfd.

2015-05-27 Thread Hongzhou Yang
Base on Lee Jones' comment, change pinctrl subnode name.

---
Register pinctrl subnode into 6397 mfd cell.

Signed-off-by: Hongzhou Yang hongzhou.y...@mediatek.com
Acked-by: Linus Walleij linus.wall...@linaro.org
---
 drivers/mfd/mt6397-core.c |3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/mfd/mt6397-core.c b/drivers/mfd/mt6397-core.c
index 09bc780..e50a9bc 100644
--- a/drivers/mfd/mt6397-core.c
+++ b/drivers/mfd/mt6397-core.c
@@ -34,6 +34,9 @@ static const struct mfd_cell mt6397_devs[] = {
}, {
.name = mt6397-clk,
.of_compatible = mediatek,mt6397-clk,
+   }, {
+   .name = mt6397-pinctrl,
+   .of_compatible = mediatek,mt6397-pinctrl,
},
 };
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATH] Fix ies/smt and register irq fail bug.

2015-05-27 Thread Hongzhou Yang
Hi Linus,
After integration test, we found some bugs in the code you just merged.
The first is that I missed ies/smt configuration for MSDC3.
The seconed is the if judgement for interrupt-controller I added last
time should on the contrary. So adding these two patches to fix them.
Sorry about this. And please help to merge them, many thanks.

These patches include below changes:
- Adding MSDC3 ies/smt support for mt8173.
- Since mt6397 is no need to support interrupt controller,
I judged interrupt-controller property to skip it last time,
but the if judgement should on the contrary, this is a bug.
so adding this patch to fix it. 
 
Hongzhou Yang (2):
  pinctrl: mediatek: Fix bug of ies/smt setting for mt8173.
  pinctrl: mediatek: Fix pinctrl register irq fail bug.

 drivers/pinctrl/mediatek/pinctrl-mt8173.c |   10 +-
 drivers/pinctrl/mediatek/pinctrl-mtk-common.c |4 ++--
 2 files changed, 11 insertions(+), 3 deletions(-)

--
1.7.9.5


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/2] pinctrl: mediatek: Fix pinctrl register irq fail bug.

2015-05-27 Thread Hongzhou Yang
Since mt6397 is no need to support interrupt controller,
I judged interrupt-controller property to skip it last patch.
But the if judgement should on the contrary, this is a bug.

And find of_property_read_bool is better for this case.
So using of_property_read_bool instead of of_find_property.

Also fix bug of misuse pointer.

Signed-off-by: Hongzhou Yang hongzhou.y...@mediatek.com
---
 drivers/pinctrl/mediatek/pinctrl-mtk-common.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c 
b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
index cd22729..f206a54 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
@@ -1280,7 +1280,7 @@ int mtk_pctrl_init(struct platform_device *pdev,
goto pctrl_error;
}
 
-   pctl-chip = mtk_gpio_chip;
+   *pctl-chip = mtk_gpio_chip;
pctl-chip-ngpio = pctl-devdata-npins;
pctl-chip-label = dev_name(pdev-dev);
pctl-chip-dev = pdev-dev;
@@ -1300,7 +1300,7 @@ int mtk_pctrl_init(struct platform_device *pdev,
goto chip_error;
}
 
-   if (of_find_property(np, interrupt-controller, NULL))
+   if (!of_property_read_bool(np, interrupt-controller))
return 0;
 
/* Get EINT register base from dts. */
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] mfd: mediatek: Add GPIO sub module support into mfd.

2015-05-27 Thread Hongzhou Yang
On Wed, 2015-05-27 at 11:32 +0100, Lee Jones wrote:
 On Wed, 27 May 2015, Hongzhou Yang wrote:
 
  Base on Lee Jones' comment, change pinctrl subnode name.
  
  ---
  Register pinctrl subnode into 6397 mfd cell.
 
 Sascha already mentioned what's wrong here, so I'll not labour the
 point.
 
 I'm feeling generous, I'll apply this and make the necessary changes
 myself.  Please bear the points in mind for next time however.
 
 Applied, thanks.
 

Ok, I will pay more attention to it next time.
Thank you very much.

Yours,
Hongzhou


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 08/11] mfd: mediatek: Add GPIO sub module support into mfd.

2015-05-20 Thread Hongzhou Yang
On Tue, 2015-05-19 at 10:34 +0100, Lee Jones wrote:
> On Mon, 18 May 2015, Hongzhou Yang wrote:
> 
> > Register pinctrl subnode into 6397 mfd cell.
> > 
> > Signed-off-by: Hongzhou Yang 
> > ---
> >  drivers/mfd/mt6397-core.c |3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/drivers/mfd/mt6397-core.c b/drivers/mfd/mt6397-core.c
> > index 09bc780..012c620 100644
> > --- a/drivers/mfd/mt6397-core.c
> > +++ b/drivers/mfd/mt6397-core.c
> > @@ -34,6 +34,9 @@ static const struct mfd_cell mt6397_devs[] = {
> > }, {
> > .name = "mt6397-clk",
> > .of_compatible = "mediatek,mt6397-clk",
> > +   }, {
> > +   .name = "mediatek-mt6397-pinctrl",
> 
> I think the "mediatek-" part should be removed, no?


Ok, I will send another patch to change it, thank you.

Yours,
Hongzhou

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 08/11] mfd: mediatek: Add GPIO sub module support into mfd.

2015-05-20 Thread Hongzhou Yang
On Tue, 2015-05-19 at 10:34 +0100, Lee Jones wrote:
 On Mon, 18 May 2015, Hongzhou Yang wrote:
 
  Register pinctrl subnode into 6397 mfd cell.
  
  Signed-off-by: Hongzhou Yang hongzhou.y...@mediatek.com
  ---
   drivers/mfd/mt6397-core.c |3 +++
   1 file changed, 3 insertions(+)
  
  diff --git a/drivers/mfd/mt6397-core.c b/drivers/mfd/mt6397-core.c
  index 09bc780..012c620 100644
  --- a/drivers/mfd/mt6397-core.c
  +++ b/drivers/mfd/mt6397-core.c
  @@ -34,6 +34,9 @@ static const struct mfd_cell mt6397_devs[] = {
  }, {
  .name = mt6397-clk,
  .of_compatible = mediatek,mt6397-clk,
  +   }, {
  +   .name = mediatek-mt6397-pinctrl,
 
 I think the mediatek- part should be removed, no?


Ok, I will send another patch to change it, thank you.

Yours,
Hongzhou

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 10/11] arm64: dts: mt8173-evb: Add pinctrl/GPIO node for mt6397.

2015-05-19 Thread Hongzhou Yang
Add pinctrl and GPIO node to mt8173-evb.dts.

Signed-off-by: Hongzhou Yang 
---
 arch/arm64/boot/dts/mediatek/mt8173-evb.dts |8 
 1 file changed, 8 insertions(+)

diff --git a/arch/arm64/boot/dts/mediatek/mt8173-evb.dts 
b/arch/arm64/boot/dts/mediatek/mt8173-evb.dts
index c9bc71b..bd473c8 100644
--- a/arch/arm64/boot/dts/mediatek/mt8173-evb.dts
+++ b/arch/arm64/boot/dts/mediatek/mt8173-evb.dts
@@ -14,6 +14,7 @@
 
 /dts-v1/;
 #include "mt8173.dtsi"
+#include 
 
 / {
model = "mediatek,mt8173-evb";
@@ -43,6 +44,13 @@
interrupt-controller;
#interrupt-cells = <2>;
 
+   pio6397: pinctrl@c000 {
+   compatible = "mediatek,mt6397-pinctrl";
+   pins-are-numbered;
+   gpio-controller;
+   #gpio-cells = <2>;
+   };
+
rtc: rtc@e000 {
compatible = "mediatek,mt6397-rtc";
};
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 11/11] ARM: dts: mt8135-evbp1: Add pinctrl/GPIO node for mt6397.

2015-05-19 Thread Hongzhou Yang
Add pinctrl and GPIO node to mt8135-evbp1.dts.

Signed-off-by: Hongzhou Yang 
---
 arch/arm/boot/dts/mt8135-evbp1.dts |8 
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/boot/dts/mt8135-evbp1.dts 
b/arch/arm/boot/dts/mt8135-evbp1.dts
index 357a91f..332233b 100644
--- a/arch/arm/boot/dts/mt8135-evbp1.dts
+++ b/arch/arm/boot/dts/mt8135-evbp1.dts
@@ -14,6 +14,7 @@
 
 /dts-v1/;
 #include "mt8135.dtsi"
+#include 
 
 / {
model = "MediaTek MT8135 evaluation board";
@@ -28,6 +29,13 @@
pmic: mt6397 {
compatible = "mediatek,mt6397";
 
+   pio6397: pinctrl@c000 {
+   compatible = "mediatek,mt6397-pinctrl";
+   pins-are-numbered;
+   gpio-controller;
+   #gpio-cells = <2>;
+   };
+
mt6397regulator: mt6397regulator {
compatible = "mediatek,mt6397-regulator";
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 09/11] ARM: dts: mt8127: add pinctrl/GPIO/EINT node for mt8127

2015-05-19 Thread Hongzhou Yang
From: Yingjoe Chen 

Add pinctrl,GPIO and EINT node to mt8127.dtsi.

Signed-off-by: Yingjoe Chen 
Signed-off-by: Hongzhou Yang 
---
 arch/arm/boot/dts/mt8127-pinfunc.h |  742 
 arch/arm/boot/dts/mt8127.dtsi  |   22 ++
 2 files changed, 764 insertions(+)
 create mode 100644 arch/arm/boot/dts/mt8127-pinfunc.h

diff --git a/arch/arm/boot/dts/mt8127-pinfunc.h 
b/arch/arm/boot/dts/mt8127-pinfunc.h
new file mode 100644
index 000..9198331
--- /dev/null
+++ b/arch/arm/boot/dts/mt8127-pinfunc.h
@@ -0,0 +1,742 @@
+#ifndef __DTS_MT8127_PINFUNC_H
+#define __DTS_MT8127_PINFUNC_H
+
+#include 
+
+#define MT8127_PIN_0_PWRAP_SPI0_MI__FUNC_GPIO0 (MTK_PIN_NO(0) | 0)
+#define MT8127_PIN_0_PWRAP_SPI0_MI__FUNC_PWRAP_SPIDO (MTK_PIN_NO(0) | 1)
+#define MT8127_PIN_0_PWRAP_SPI0_MI__FUNC_PWRAP_SPIDI (MTK_PIN_NO(0) | 2)
+
+#define MT8127_PIN_1_PWRAP_SPI0_MO__FUNC_GPIO1 (MTK_PIN_NO(1) | 0)
+#define MT8127_PIN_1_PWRAP_SPI0_MO__FUNC_PWRAP_SPIDI (MTK_PIN_NO(1) | 1)
+#define MT8127_PIN_1_PWRAP_SPI0_MO__FUNC_PWRAP_SPIDO (MTK_PIN_NO(1) | 2)
+
+#define MT8127_PIN_2_PWRAP_INT__FUNC_GPIO2 (MTK_PIN_NO(2) | 0)
+
+#define MT8127_PIN_3_PWRAP_SPI0_CK__FUNC_GPIO3 (MTK_PIN_NO(3) | 0)
+#define MT8127_PIN_3_PWRAP_SPI0_CK__FUNC_PWRAP_SPICK_I (MTK_PIN_NO(3) | 1)
+
+#define MT8127_PIN_4_PWRAP_SPI0_CSN__FUNC_GPIO4 (MTK_PIN_NO(4) | 0)
+#define MT8127_PIN_4_PWRAP_SPI0_CSN__FUNC_PWRAP_SPICS_B_I (MTK_PIN_NO(4) | 1)
+
+#define MT8127_PIN_5_PWRAP_SPI0_CK2__FUNC_GPIO5 (MTK_PIN_NO(5) | 0)
+#define MT8127_PIN_5_PWRAP_SPI0_CK2__FUNC_PWRAP_SPICK2_I (MTK_PIN_NO(5) | 1)
+#define MT8127_PIN_5_PWRAP_SPI0_CK2__FUNC_ANT_SEL1 (MTK_PIN_NO(5) | 2)
+#define MT8127_PIN_5_PWRAP_SPI0_CK2__FUNC_VDEC_TEST_CK (MTK_PIN_NO(5) | 3)
+#define MT8127_PIN_5_PWRAP_SPI0_CK2__FUNC_DBG_MON_B_0 (MTK_PIN_NO(5) | 7)
+
+#define MT8127_PIN_6_PWRAP_SPI0_CSN2__FUNC_GPIO6 (MTK_PIN_NO(6) | 0)
+#define MT8127_PIN_6_PWRAP_SPI0_CSN2__FUNC_PWRAP_SPICS2_B_I (MTK_PIN_NO(6) | 1)
+#define MT8127_PIN_6_PWRAP_SPI0_CSN2__FUNC_ANT_SEL0 (MTK_PIN_NO(6) | 2)
+#define MT8127_PIN_6_PWRAP_SPI0_CSN2__FUNC_MM_TEST_CK (MTK_PIN_NO(6) | 3)
+#define MT8127_PIN_6_PWRAP_SPI0_CSN2__FUNC_DBG_MON_B_1 (MTK_PIN_NO(6) | 7)
+
+#define MT8127_PIN_7_AUD_CLK_MOSI__FUNC_GPIO7 (MTK_PIN_NO(7) | 0)
+#define MT8127_PIN_7_AUD_CLK_MOSI__FUNC_AUD_CLK (MTK_PIN_NO(7) | 1)
+#define MT8127_PIN_7_AUD_CLK_MOSI__FUNC_ADC_CK (MTK_PIN_NO(7) | 2)
+
+#define MT8127_PIN_8_AUD_DAT_MISO__FUNC_GPIO8 (MTK_PIN_NO(8) | 0)
+#define MT8127_PIN_8_AUD_DAT_MISO__FUNC_AUD_MISO (MTK_PIN_NO(8) | 1)
+#define MT8127_PIN_8_AUD_DAT_MISO__FUNC_ADC_DAT_IN (MTK_PIN_NO(8) | 2)
+#define MT8127_PIN_8_AUD_DAT_MISO__FUNC_AUD_MOSI (MTK_PIN_NO(8) | 3)
+
+#define MT8127_PIN_9_AUD_DAT_MOSI__FUNC_GPIO9 (MTK_PIN_NO(9) | 0)
+#define MT8127_PIN_9_AUD_DAT_MOSI__FUNC_AUD_MOSI (MTK_PIN_NO(9) | 1)
+#define MT8127_PIN_9_AUD_DAT_MOSI__FUNC_ADC_WS (MTK_PIN_NO(9) | 2)
+#define MT8127_PIN_9_AUD_DAT_MOSI__FUNC_AUD_MISO (MTK_PIN_NO(9) | 3)
+
+#define MT8127_PIN_10_RTC32K_CK__FUNC_GPIO10 (MTK_PIN_NO(10) | 0)
+#define MT8127_PIN_10_RTC32K_CK__FUNC_RTC32K_CK (MTK_PIN_NO(10) | 1)
+
+#define MT8127_PIN_11_WATCHDOG__FUNC_GPIO11 (MTK_PIN_NO(11) | 0)
+#define MT8127_PIN_11_WATCHDOG__FUNC_WATCHDOG (MTK_PIN_NO(11) | 1)
+
+#define MT8127_PIN_12_SRCLKENA__FUNC_GPIO12 (MTK_PIN_NO(12) | 0)
+#define MT8127_PIN_12_SRCLKENA__FUNC_SRCLKENA (MTK_PIN_NO(12) | 1)
+
+#define MT8127_PIN_13_SRCLKENAI__FUNC_GPIO13 (MTK_PIN_NO(13) | 0)
+#define MT8127_PIN_13_SRCLKENAI__FUNC_SRCLKENAI (MTK_PIN_NO(13) | 1)
+
+#define MT8127_PIN_14_URXD2__FUNC_GPIO14 (MTK_PIN_NO(14) | 0)
+#define MT8127_PIN_14_URXD2__FUNC_URXD2 (MTK_PIN_NO(14) | 1)
+#define MT8127_PIN_14_URXD2__FUNC_DPI_D5 (MTK_PIN_NO(14) | 2)
+#define MT8127_PIN_14_URXD2__FUNC_UTXD2 (MTK_PIN_NO(14) | 3)
+#define MT8127_PIN_14_URXD2__FUNC_SRCCLKENAI2 (MTK_PIN_NO(14) | 5)
+#define MT8127_PIN_14_URXD2__FUNC_KROW4 (MTK_PIN_NO(14) | 6)
+
+#define MT8127_PIN_15_UTXD2__FUNC_GPIO15 (MTK_PIN_NO(15) | 0)
+#define MT8127_PIN_15_UTXD2__FUNC_UTXD2 (MTK_PIN_NO(15) | 1)
+#define MT8127_PIN_15_UTXD2__FUNC_DPI_HSYNC (MTK_PIN_NO(15) | 2)
+#define MT8127_PIN_15_UTXD2__FUNC_URXD2 (MTK_PIN_NO(15) | 3)
+#define MT8127_PIN_15_UTXD2__FUNC_KROW5 (MTK_PIN_NO(15) | 6)
+
+#define MT8127_PIN_16_URXD3__FUNC_GPIO16 (MTK_PIN_NO(16) | 0)
+#define MT8127_PIN_16_URXD3__FUNC_URXD3 (MTK_PIN_NO(16) | 1)
+#define MT8127_PIN_16_URXD3__FUNC_DPI_DE (MTK_PIN_NO(16) | 2)
+#define MT8127_PIN_16_URXD3__FUNC_UTXD3 (MTK_PIN_NO(16) | 3)
+#define MT8127_PIN_16_URXD3__FUNC_UCTS2 (MTK_PIN_NO(16) | 4)
+#define MT8127_PIN_16_URXD3__FUNC_PWM3 (MTK_PIN_NO(16) | 5)
+#define MT8127_PIN_16_URXD3__FUNC_KROW6 (MTK_PIN_NO(16) | 6)
+
+#define MT8127_PIN_17_UTXD3__FUNC_GPIO17 (MTK_PIN_NO(17) | 0)
+#define MT8127_PIN_17_UTXD3__FUNC_UTXD3 (MTK_PIN_NO(17) | 1)
+#define MT8127_PIN_17_UTXD3__FUNC_DPI_VSYNC (MTK_PIN_NO(17) | 2)
+#define MT8127_PIN_17_UTXD3__FUNC_URXD3 (MTK_PIN_NO(17) | 3)
+#define MT8127_PIN_17_UTXD3__FUNC_URTS2 (MTK_PIN_NO(17) | 4)
+#define MT8127_PIN_17_UTXD3__FUNC_PWM4 (MTK_PIN_NO(17

[PATCH v2 08/11] mfd: mediatek: Add GPIO sub module support into mfd.

2015-05-19 Thread Hongzhou Yang
Register pinctrl subnode into 6397 mfd cell.

Signed-off-by: Hongzhou Yang 
---
 drivers/mfd/mt6397-core.c |3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/mfd/mt6397-core.c b/drivers/mfd/mt6397-core.c
index 09bc780..012c620 100644
--- a/drivers/mfd/mt6397-core.c
+++ b/drivers/mfd/mt6397-core.c
@@ -34,6 +34,9 @@ static const struct mfd_cell mt6397_devs[] = {
}, {
.name = "mt6397-clk",
.of_compatible = "mediatek,mt6397-clk",
+   }, {
+   .name = "mediatek-mt6397-pinctrl",
+   .of_compatible = "mediatek,mt6397-pinctrl",
},
 };
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 07/11] pinctrl: mediatek: add pinctrl/GPIO/EINT driver for mt8127

2015-05-19 Thread Hongzhou Yang
From: Yingjoe Chen 

MT8127 pinctrl/eint are similar to mt8135 and mt8173, add
support for mt8127 using mediatek common pinctrl driver.

Signed-off-by: Yingjoe Chen 
Signed-off-by: Hongzhou Yang 
---
 drivers/pinctrl/mediatek/Kconfig  |6 +
 drivers/pinctrl/mediatek/Makefile |1 +
 drivers/pinctrl/mediatek/pinctrl-mt8127.c |  359 +++
 drivers/pinctrl/mediatek/pinctrl-mtk-mt8127.h | 1318 +
 4 files changed, 1684 insertions(+)
 create mode 100644 drivers/pinctrl/mediatek/pinctrl-mt8127.c
 create mode 100644 drivers/pinctrl/mediatek/pinctrl-mtk-mt8127.h

diff --git a/drivers/pinctrl/mediatek/Kconfig b/drivers/pinctrl/mediatek/Kconfig
index ddae479..0bc84fb 100644
--- a/drivers/pinctrl/mediatek/Kconfig
+++ b/drivers/pinctrl/mediatek/Kconfig
@@ -15,6 +15,12 @@ config PINCTRL_MT8135
default MACH_MT8135
select PINCTRL_MTK_COMMON
 
+config PINCTRL_MT8127
+   bool "Mediatek MT8127 pin control" if COMPILE_TEST && !MACH_MT8127
+   depends on OF
+   default MACH_MT8127
+   select PINCTRL_MTK_COMMON
+
 # For ARMv8 SoCs
 config PINCTRL_MT8173
bool "Mediatek MT8173 pin control"
diff --git a/drivers/pinctrl/mediatek/Makefile 
b/drivers/pinctrl/mediatek/Makefile
index ad0180c..eb923d6 100644
--- a/drivers/pinctrl/mediatek/Makefile
+++ b/drivers/pinctrl/mediatek/Makefile
@@ -3,5 +3,6 @@ obj-$(CONFIG_PINCTRL_MTK_COMMON)+= pinctrl-mtk-common.o
 
 # SoC Drivers
 obj-$(CONFIG_PINCTRL_MT8135)   += pinctrl-mt8135.o
+obj-$(CONFIG_PINCTRL_MT8127)   += pinctrl-mt8127.o
 obj-$(CONFIG_PINCTRL_MT8173)   += pinctrl-mt8173.o
 obj-$(CONFIG_PINCTRL_MT6397)   += pinctrl-mt6397.o
diff --git a/drivers/pinctrl/mediatek/pinctrl-mt8127.c 
b/drivers/pinctrl/mediatek/pinctrl-mt8127.c
new file mode 100644
index 000..6a26cfa
--- /dev/null
+++ b/drivers/pinctrl/mediatek/pinctrl-mt8127.c
@@ -0,0 +1,359 @@
+/*
+ * Copyright (c) 2015 MediaTek Inc.
+ * Author: Hongzhou.Yang 
+ * Yingjoe Chen 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "pinctrl-mtk-common.h"
+#include "pinctrl-mtk-mt8127.h"
+
+static const struct mtk_drv_group_desc mt8127_drv_grp[] =  {
+   /* 0E4E8SR 4/8/12/16 */
+   MTK_DRV_GRP(4, 16, 1, 2, 4),
+   /* 0E2E4SR  2/4/6/8 */
+   MTK_DRV_GRP(2, 8, 1, 2, 2),
+   /* E8E4E2  2/4/6/8/10/12/14/16 */
+   MTK_DRV_GRP(2, 16, 0, 2, 2)
+};
+
+static const struct mtk_pin_drv_grp mt8127_pin_drv[] = {
+   MTK_PIN_DRV_GRP(0,   0xb00,  0, 1),
+   MTK_PIN_DRV_GRP(1,   0xb00,  0, 1),
+   MTK_PIN_DRV_GRP(2,   0xb00,  0, 1),
+   MTK_PIN_DRV_GRP(3,   0xb00,  0, 1),
+   MTK_PIN_DRV_GRP(4,   0xb00,  0, 1),
+   MTK_PIN_DRV_GRP(5,   0xb00,  0, 1),
+   MTK_PIN_DRV_GRP(6,   0xb00,  0, 1),
+   MTK_PIN_DRV_GRP(7,   0xb00, 12, 1),
+   MTK_PIN_DRV_GRP(8,   0xb00, 12, 1),
+   MTK_PIN_DRV_GRP(9,   0xb00, 12, 1),
+   MTK_PIN_DRV_GRP(10,  0xb00,  8, 1),
+   MTK_PIN_DRV_GRP(11,  0xb00,  8, 1),
+   MTK_PIN_DRV_GRP(12,  0xb00,  8, 1),
+   MTK_PIN_DRV_GRP(13,  0xb00,  8, 1),
+   MTK_PIN_DRV_GRP(14,  0xb10,  4, 0),
+   MTK_PIN_DRV_GRP(15,  0xb10,  4, 0),
+   MTK_PIN_DRV_GRP(16,  0xb10,  4, 0),
+   MTK_PIN_DRV_GRP(17,  0xb10,  4, 0),
+   MTK_PIN_DRV_GRP(18,  0xb10,  8, 0),
+   MTK_PIN_DRV_GRP(19,  0xb10,  8, 0),
+   MTK_PIN_DRV_GRP(20,  0xb10,  8, 0),
+   MTK_PIN_DRV_GRP(21,  0xb10,  8, 0),
+   MTK_PIN_DRV_GRP(22,  0xb20,  0, 0),
+   MTK_PIN_DRV_GRP(23,  0xb20,  0, 0),
+   MTK_PIN_DRV_GRP(24,  0xb20,  0, 0),
+   MTK_PIN_DRV_GRP(25,  0xb20,  0, 0),
+   MTK_PIN_DRV_GRP(26,  0xb20,  0, 0),
+   MTK_PIN_DRV_GRP(27,  0xb20,  4, 0),
+   MTK_PIN_DRV_GRP(28,  0xb20,  4, 0),
+   MTK_PIN_DRV_GRP(29,  0xb20,  4, 0),
+   MTK_PIN_DRV_GRP(30,  0xb20,  4, 0),
+   MTK_PIN_DRV_GRP(31,  0xb20,  4, 0),
+   MTK_PIN_DRV_GRP(32,  0xb20,  4, 0),
+   MTK_PIN_DRV_GRP(33,  0xb30,  4, 1),
+   MTK_PIN_DRV_GRP(34,  0xb30,  8, 1),
+   MTK_PIN_DRV_GRP(35,  0xb30,  8, 1),
+   MTK_PIN_DRV_GRP(36,  0xb30,  8, 1),
+   MTK_PIN_DRV_GRP(37,  0xb30,  8, 1),
+   MTK_PIN_DRV_GRP(38,  0xb30,  8, 1),
+   MTK_PIN_DRV_GRP(39,  0xb30, 12, 1),
+   MTK_PIN_DRV_GRP(40,  0xb30, 12, 1),
+   MTK_PIN_DRV_GRP(41,  0xb30, 12, 1),
+   MTK_PIN_DRV_GRP(42,  0xb30, 12, 1),
+   MTK_PIN_DRV_GRP(43,  0xb40, 12, 0),
+   MTK_PIN_DRV_GRP(44,  0xb40, 1

[PATCH v2 06/11] pinctrl: mediatek: Add Pinctrl/GPIO driver for mt6397.

2015-05-19 Thread Hongzhou Yang
Add mt6397 support using mediatek common pinctrl driver.

mt6397 is a PMIC, and pinctrl/GPIO is part of 6397 chip.
Pinctrl/GPIO driver should obtain regmap from PMIC,
so adding this support to common code.

Also, mt6397 is no need to support interrupt controller,
so changing common code to skip it.

Signed-off-by: Hongzhou Yang 
---
 drivers/pinctrl/mediatek/Kconfig  |6 +
 drivers/pinctrl/mediatek/Makefile |1 +
 drivers/pinctrl/mediatek/pinctrl-mt6397.c |   78 +
 drivers/pinctrl/mediatek/pinctrl-mt8135.c |2 +-
 drivers/pinctrl/mediatek/pinctrl-mt8173.c |2 +-
 drivers/pinctrl/mediatek/pinctrl-mtk-common.c |   13 +-
 drivers/pinctrl/mediatek/pinctrl-mtk-common.h |3 +-
 drivers/pinctrl/mediatek/pinctrl-mtk-mt6397.h |  424 +
 8 files changed, 524 insertions(+), 5 deletions(-)
 create mode 100644 drivers/pinctrl/mediatek/pinctrl-mt6397.c
 create mode 100644 drivers/pinctrl/mediatek/pinctrl-mtk-mt6397.h

diff --git a/drivers/pinctrl/mediatek/Kconfig b/drivers/pinctrl/mediatek/Kconfig
index 6b3551c..ddae479 100644
--- a/drivers/pinctrl/mediatek/Kconfig
+++ b/drivers/pinctrl/mediatek/Kconfig
@@ -23,4 +23,10 @@ config PINCTRL_MT8173
default ARM64 && ARCH_MEDIATEK
select PINCTRL_MTK_COMMON
 
+# For PMIC
+config PINCTRL_MT6397
+   bool "Mediatek MT6397 pin control" if COMPILE_TEST && !MFD_MT6397
+   default MFD_MT6397
+   select PINCTRL_MTK_COMMON
+
 endif
diff --git a/drivers/pinctrl/mediatek/Makefile 
b/drivers/pinctrl/mediatek/Makefile
index d8606a2..ad0180c 100644
--- a/drivers/pinctrl/mediatek/Makefile
+++ b/drivers/pinctrl/mediatek/Makefile
@@ -4,3 +4,4 @@ obj-$(CONFIG_PINCTRL_MTK_COMMON)+= pinctrl-mtk-common.o
 # SoC Drivers
 obj-$(CONFIG_PINCTRL_MT8135)   += pinctrl-mt8135.o
 obj-$(CONFIG_PINCTRL_MT8173)   += pinctrl-mt8173.o
+obj-$(CONFIG_PINCTRL_MT6397)   += pinctrl-mt6397.o
diff --git a/drivers/pinctrl/mediatek/pinctrl-mt6397.c 
b/drivers/pinctrl/mediatek/pinctrl-mt6397.c
new file mode 100644
index 000..767bbdf
--- /dev/null
+++ b/drivers/pinctrl/mediatek/pinctrl-mt6397.c
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2015 MediaTek Inc.
+ * Author: Hongzhou.Yang 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "pinctrl-mtk-common.h"
+#include "pinctrl-mtk-mt6397.h"
+
+#define MT6397_PIN_REG_BASE  0xc000
+
+static const struct mtk_pinctrl_devdata mt6397_pinctrl_data = {
+   .pins = mtk_pins_mt6397,
+   .npins = ARRAY_SIZE(mtk_pins_mt6397),
+   .dir_offset = (MT6397_PIN_REG_BASE + 0x000),
+   .ies_offset = MTK_PINCTRL_NOT_SUPPORT,
+   .smt_offset = MTK_PINCTRL_NOT_SUPPORT,
+   .pullen_offset = (MT6397_PIN_REG_BASE + 0x020),
+   .pullsel_offset = (MT6397_PIN_REG_BASE + 0x040),
+   .dout_offset = (MT6397_PIN_REG_BASE + 0x080),
+   .din_offset = (MT6397_PIN_REG_BASE + 0x0a0),
+   .pinmux_offset = (MT6397_PIN_REG_BASE + 0x0c0),
+   .type1_start = 41,
+   .type1_end = 41,
+   .port_shf = 3,
+   .port_mask = 0x3,
+   .port_align = 2,
+};
+
+static int mt6397_pinctrl_probe(struct platform_device *pdev)
+{
+   struct mt6397_chip *mt6397;
+
+   mt6397 = dev_get_drvdata(pdev->dev.parent);
+   return mtk_pctrl_init(pdev, _pinctrl_data, mt6397->regmap);
+}
+
+static const struct of_device_id mt6397_pctrl_match[] = {
+   { .compatible = "mediatek,mt6397-pinctrl", },
+   { }
+};
+MODULE_DEVICE_TABLE(of, mt6397_pctrl_match);
+
+static struct platform_driver mtk_pinctrl_driver = {
+   .probe = mt6397_pinctrl_probe,
+   .driver = {
+   .name = "mediatek-mt6397-pinctrl",
+   .owner = THIS_MODULE,
+   .of_match_table = mt6397_pctrl_match,
+   },
+};
+
+static int __init mtk_pinctrl_init(void)
+{
+   return platform_driver_register(_pinctrl_driver);
+}
+
+module_init(mtk_pinctrl_init);
+
+MODULE_LICENSE("GPL v2");
+MODULE_DESCRIPTION("MediaTek MT6397 Pinctrl Driver");
+MODULE_AUTHOR("Hongzhou Yang ");
diff --git a/drivers/pinctrl/mediatek/pinctrl-mt8135.c 
b/drivers/pinctrl/mediatek/pinctrl-mt8135.c
index 8e6abd5..203bd2a 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mt8135.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mt8135.c
@@ -342,7 +342,7 @@ static const struct mtk_pinctrl_devdata mt8135_pinctrl_data 
= {
 
 static int mt8135_pinctrl_probe(struct platform_device *pdev)
 {

[PATCH v2 05/11] pinctrl: mediatek: add ies/smt control to common code.

2015-05-19 Thread Hongzhou Yang
Input enable and smt setting have different register,
modify code to fix it.

Several mediatek soc use similar input enable/smt setting
procedure as mt8173, some soc use generic input enable/smt
setting, some soc has no input enable/smt setting. Adding
common code to handle all those cases, so future soc driver
can use it.

Signed-off-by: Hongzhou Yang 
---
 drivers/pinctrl/mediatek/pinctrl-mt8173.c |  201 +
 drivers/pinctrl/mediatek/pinctrl-mtk-common.c |   82 +++---
 drivers/pinctrl/mediatek/pinctrl-mtk-common.h |   31 +++-
 3 files changed, 198 insertions(+), 116 deletions(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-mt8173.c 
b/drivers/pinctrl/mediatek/pinctrl-mt8173.c
index cc44b27..a7e5b24 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mt8173.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mt8173.c
@@ -18,6 +18,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include "pinctrl-mtk-common.h"
@@ -25,28 +26,6 @@
 
 #define DRV_BASE   0xb00
 
-/**
- * struct mtk_pin_ies_smt_set - For special pins' ies and smt setting.
- * @start: The start pin number of those special pins.
- * @end: The end pin number of those special pins.
- * @offset: The offset of special setting register.
- * @bit: The bit of special setting register.
- */
-struct mtk_pin_ies_smt_set {
-   unsigned int start;
-   unsigned int end;
-   unsigned int offset;
-   unsigned char bit;
-};
-
-#define MTK_PIN_IES_SMT_SET(_start, _end, _offset, _bit)   \
-   {   \
-   .start = _start,\
-   .end = _end,\
-   .bit = _bit,\
-   .offset = _offset,  \
-   }
-
 static const struct mtk_pin_spec_pupd_set_samereg mt8173_spec_pupd[] = {
MTK_PIN_PUPD_SPEC_SR(119, 0xe00, 2, 1, 0),  /* KROW0 */
MTK_PIN_PUPD_SPEC_SR(120, 0xe00, 6, 5, 4),  /* KROW1 */
@@ -97,80 +76,114 @@ static int mt8173_spec_pull_set(struct regmap *regmap, 
unsigned int pin,
ARRAY_SIZE(mt8173_spec_pupd), pin, align, isup, r1r0);
 }
 
-static const struct mtk_pin_ies_smt_set mt8173_ies_smt_set[] = {
-   MTK_PIN_IES_SMT_SET(0, 4, 0x930, 1),
-   MTK_PIN_IES_SMT_SET(5, 9, 0x930, 2),
-   MTK_PIN_IES_SMT_SET(10, 13, 0x930, 10),
-   MTK_PIN_IES_SMT_SET(14, 15, 0x940, 10),
-   MTK_PIN_IES_SMT_SET(16, 16, 0x930, 0),
-   MTK_PIN_IES_SMT_SET(17, 17, 0x950, 2),
-   MTK_PIN_IES_SMT_SET(18, 21, 0x940, 3),
-   MTK_PIN_IES_SMT_SET(29, 32, 0x930, 3),
-   MTK_PIN_IES_SMT_SET(33, 33, 0x930, 4),
-   MTK_PIN_IES_SMT_SET(34, 36, 0x930, 5),
-   MTK_PIN_IES_SMT_SET(37, 38, 0x930, 6),
-   MTK_PIN_IES_SMT_SET(39, 39, 0x930, 7),
-   MTK_PIN_IES_SMT_SET(40, 41, 0x930, 9),
-   MTK_PIN_IES_SMT_SET(42, 42, 0x940, 0),
-   MTK_PIN_IES_SMT_SET(43, 44, 0x930, 11),
-   MTK_PIN_IES_SMT_SET(45, 46, 0x930, 12),
-   MTK_PIN_IES_SMT_SET(57, 64, 0xc20, 13),
-   MTK_PIN_IES_SMT_SET(65, 65, 0xc10, 13),
-   MTK_PIN_IES_SMT_SET(66, 66, 0xc00, 13),
-   MTK_PIN_IES_SMT_SET(67, 67, 0xd10, 13),
-   MTK_PIN_IES_SMT_SET(68, 68, 0xd00, 13),
-   MTK_PIN_IES_SMT_SET(69, 72, 0x940, 14),
-   MTK_PIN_IES_SMT_SET(73, 76, 0xc60, 13),
-   MTK_PIN_IES_SMT_SET(77, 77, 0xc40, 13),
-   MTK_PIN_IES_SMT_SET(78, 78, 0xc50, 13),
-   MTK_PIN_IES_SMT_SET(79, 82, 0x940, 15),
-   MTK_PIN_IES_SMT_SET(83, 83, 0x950, 0),
-   MTK_PIN_IES_SMT_SET(84, 85, 0x950, 1),
-   MTK_PIN_IES_SMT_SET(86, 91, 0x950, 2),
-   MTK_PIN_IES_SMT_SET(92, 92, 0x930, 13),
-   MTK_PIN_IES_SMT_SET(93, 95, 0x930, 14),
-   MTK_PIN_IES_SMT_SET(96, 99, 0x930, 15),
-   MTK_PIN_IES_SMT_SET(100, 103, 0xca0, 13),
-   MTK_PIN_IES_SMT_SET(104, 104, 0xc80, 13),
-   MTK_PIN_IES_SMT_SET(105, 105, 0xc90, 13),
-   MTK_PIN_IES_SMT_SET(106, 107, 0x940, 4),
-   MTK_PIN_IES_SMT_SET(108, 112, 0x940, 1),
-   MTK_PIN_IES_SMT_SET(113, 116, 0x940, 2),
-   MTK_PIN_IES_SMT_SET(117, 118, 0x940, 5),
-   MTK_PIN_IES_SMT_SET(119, 124, 0x940, 6),
-   MTK_PIN_IES_SMT_SET(125, 126, 0x940, 7),
-   MTK_PIN_IES_SMT_SET(127, 127, 0x940, 0),
-   MTK_PIN_IES_SMT_SET(128, 128, 0x950, 8),
-   MTK_PIN_IES_SMT_SET(129, 130, 0x950, 9),
-   MTK_PIN_IES_SMT_SET(131, 132, 0x950, 8),
-   MTK_PIN_IES_SMT_SET(133, 134, 0x910, 8)
+static const struct mtk_pin_ies_smt_set mt8173_smt_set[] = {
+   MTK_PIN_IES_SMT_SPEC(0, 4, 0x930, 1),
+   MTK_PIN_IES_SMT_SPEC(5, 9, 0x930, 2),
+   MTK_PIN_IES_SMT_SPEC(10, 13, 0x930, 10),
+   MTK_PIN_IES_SMT_SPEC(14, 15, 0x940, 10),
+   MTK_PIN_IES_SMT_SPEC(16, 16, 0x930, 0),
+   MTK_PIN_IES_SMT_SPEC(17, 17, 0x950, 2),
+   MTK_PIN_IES_SMT_SPEC(18, 21, 0x940, 3),
+   MTK_PIN_IES_SMT_SPEC(29, 32, 0x930, 3),
+   MTK_PIN_IES_SMT_SPEC(33, 33, 0x930, 4),
+   MTK_PIN_IES_SMT_SPEC(34, 36, 0x930, 5),
+   MTK_PIN_IES_SMT_SPEC(37, 38, 0x930, 6),
+   MTK_PIN_IES_SMT_SPEC(39, 39

[PATCH v2 04/11] pinctrl: mediatek: add mtk_pctrl_spec_pull_set_samereg common code

2015-05-19 Thread Hongzhou Yang
From: Yingjoe Chen 

Several mediatek soc use similar pull setting procedure as mt8173,
the pupd enable and resistance setting are in the same register.
Add common code mtk_pctrl_spec_pull_set_samereg out of spec_pull_set
in mt8173 to handle this case, so future soc driver can use it.

Signed-off-by: Yingjoe Chen 
Signed-off-by: Hongzhou Yang 
---
 drivers/pinctrl/mediatek/pinctrl-mt8173.c |  166 +++--
 drivers/pinctrl/mediatek/pinctrl-mtk-common.c |   60 +
 drivers/pinctrl/mediatek/pinctrl-mtk-common.h |   31 +
 3 files changed, 136 insertions(+), 121 deletions(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-mt8173.c 
b/drivers/pinctrl/mediatek/pinctrl-mt8173.c
index 412ea84..cc44b27 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mt8173.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mt8173.c
@@ -47,130 +47,54 @@ struct mtk_pin_ies_smt_set {
.offset = _offset,  \
}
 
-/**
- * struct mtk_pin_spec_pupd_set - For special pins' pull up/down setting.
- * @pin: The pin number.
- * @offset: The offset of special pull up/down setting register.
- * @pupd_bit: The pull up/down bit in this register.
- * @r0_bit: The r0 bit of pull resistor.
- * @r1_bit: The r1 bit of pull resistor.
- */
-struct mtk_pin_spec_pupd_set {
-   unsigned int pin;
-   unsigned int offset;
-   unsigned char pupd_bit;
-   unsigned char r1_bit;
-   unsigned char r0_bit;
-};
-
-#define MTK_PIN_PUPD_SPEC(_pin, _offset, _pupd, _r1, _r0)  \
-   {   \
-   .pin = _pin,\
-   .offset = _offset,  \
-   .pupd_bit = _pupd,  \
-   .r1_bit = _r1,  \
-   .r0_bit = _r0,  \
-   }
-
-static const struct mtk_pin_spec_pupd_set mt8173_spec_pupd[] = {
-   MTK_PIN_PUPD_SPEC(119, 0xe00, 2, 1, 0),  /* KROW0 */
-   MTK_PIN_PUPD_SPEC(120, 0xe00, 6, 5, 4),  /* KROW1 */
-   MTK_PIN_PUPD_SPEC(121, 0xe00, 10, 9, 8), /* KROW2 */
-   MTK_PIN_PUPD_SPEC(122, 0xe10, 2, 1, 0),  /* KCOL0 */
-   MTK_PIN_PUPD_SPEC(123, 0xe10, 6, 5, 4),  /* KCOL1 */
-   MTK_PIN_PUPD_SPEC(124, 0xe10, 10, 9, 8), /* KCOL2 */
-
-   MTK_PIN_PUPD_SPEC(67, 0xd10, 2, 1, 0),   /* ms0 DS */
-   MTK_PIN_PUPD_SPEC(68, 0xd00, 2, 1, 0),   /* ms0 RST */
-   MTK_PIN_PUPD_SPEC(66, 0xc10, 2, 1, 0),   /* ms0 cmd */
-   MTK_PIN_PUPD_SPEC(65, 0xc00, 2, 1, 0),   /* ms0 clk */
-   MTK_PIN_PUPD_SPEC(57, 0xc20, 2, 1, 0),   /* ms0 data0 */
-   MTK_PIN_PUPD_SPEC(58, 0xc20, 2, 1, 0),   /* ms0 data1 */
-   MTK_PIN_PUPD_SPEC(59, 0xc20, 2, 1, 0),   /* ms0 data2 */
-   MTK_PIN_PUPD_SPEC(60, 0xc20, 2, 1, 0),   /* ms0 data3 */
-   MTK_PIN_PUPD_SPEC(61, 0xc20, 2, 1, 0),   /* ms0 data4 */
-   MTK_PIN_PUPD_SPEC(62, 0xc20, 2, 1, 0),   /* ms0 data5 */
-   MTK_PIN_PUPD_SPEC(63, 0xc20, 2, 1, 0),   /* ms0 data6 */
-   MTK_PIN_PUPD_SPEC(64, 0xc20, 2, 1, 0),   /* ms0 data7 */
-
-   MTK_PIN_PUPD_SPEC(78, 0xc50, 2, 1, 0),/* ms1 cmd */
-   MTK_PIN_PUPD_SPEC(73, 0xd20, 2, 1, 0),/* ms1 dat0 */
-   MTK_PIN_PUPD_SPEC(74, 0xd20, 6, 5, 4),/* ms1 dat1 */
-   MTK_PIN_PUPD_SPEC(75, 0xd20, 10, 9, 8),   /* ms1 dat2 */
-   MTK_PIN_PUPD_SPEC(76, 0xd20, 14, 13, 12), /* ms1 dat3 */
-   MTK_PIN_PUPD_SPEC(77, 0xc40, 2, 1, 0),/* ms1 clk */
-
-   MTK_PIN_PUPD_SPEC(100, 0xd40, 2, 1, 0),/* ms2 dat0 */
-   MTK_PIN_PUPD_SPEC(101, 0xd40, 6, 5, 4),/* ms2 dat1 */
-   MTK_PIN_PUPD_SPEC(102, 0xd40, 10, 9, 8),   /* ms2 dat2 */
-   MTK_PIN_PUPD_SPEC(103, 0xd40, 14, 13, 12), /* ms2 dat3 */
-   MTK_PIN_PUPD_SPEC(104, 0xc80, 2, 1, 0),/* ms2 clk */
-   MTK_PIN_PUPD_SPEC(105, 0xc90, 2, 1, 0),/* ms2 cmd */
-
-   MTK_PIN_PUPD_SPEC(22, 0xd60, 2, 1, 0),/* ms3 dat0 */
-   MTK_PIN_PUPD_SPEC(23, 0xd60, 6, 5, 4),/* ms3 dat1 */
-   MTK_PIN_PUPD_SPEC(24, 0xd60, 10, 9, 8),   /* ms3 dat2 */
-   MTK_PIN_PUPD_SPEC(25, 0xd60, 14, 13, 12), /* ms3 dat3 */
-   MTK_PIN_PUPD_SPEC(26, 0xcc0, 2, 1, 0),/* ms3 clk */
-   MTK_PIN_PUPD_SPEC(27, 0xcd0, 2, 1, 0) /* ms3 cmd */
+static const struct mtk_pin_spec_pupd_set_samereg mt8173_spec_pupd[] = {
+   MTK_PIN_PUPD_SPEC_SR(119, 0xe00, 2, 1, 0),  /* KROW0 */
+   MTK_PIN_PUPD_SPEC_SR(120, 0xe00, 6, 5, 4),  /* KROW1 */
+   MTK_PIN_PUPD_SPEC_SR(121, 0xe00, 10, 9, 8), /* KROW2 */
+   MTK_PIN_PUPD_SPEC_SR(122, 0xe10, 2, 1, 0),  /* KCOL0 */
+   MTK_PIN_PUPD_SPEC_SR(123, 0xe10, 6, 5, 4),  /* KCOL1 */
+   MTK_PIN_PUPD_SPEC_SR(124, 0xe10, 10, 9, 8), /* KCOL2 */
+
+   MTK_PIN_PUPD_SPEC_SR(67, 0xd10, 2, 1, 0),   /* ms0 DS */
+   MTK_PIN_PUPD_SPEC_SR(68, 0xd00, 2, 1, 0),   /* ms0 RST */
+   MTK_PIN_PUPD_SPEC_SR(66, 0xc10, 2, 1, 0),   /* ms0 cmd */
+   MTK_PIN_PUPD_SPEC_SR(65, 0xc00, 2, 1, 0),   /* ms0 clk */
+   MTK_PIN_PUPD_SPEC_SR(57, 0xc20, 2, 1, 0),   /* ms0 data0 */
+   MTK_PIN_PUPD_SPEC_SR(58, 0xc20, 2, 1, 0),   /* ms0 data1

[PATCH v2 03/11] pinctrl: mediatek: data struct optimize and remove unused member

2015-05-19 Thread Hongzhou Yang
From: Yingjoe Chen 

struct mtk_desc_pin.chip, mtk_pinctrl_devdata.invser_offset
and mtk_pinctrl_devdata.chip_type are never used in code.
Remove them.

Some per-pin data are using int for pin number and offsets.
Change to short and rearrange to reduce const data size.

Signed-off-by: Yingjoe Chen 
Signed-off-by: Hongzhou Yang 
---
 drivers/pinctrl/mediatek/pinctrl-mt8135.c |   10 --
 drivers/pinctrl/mediatek/pinctrl-mtk-common.h |   10 ++
 2 files changed, 6 insertions(+), 14 deletions(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-mt8135.c 
b/drivers/pinctrl/mediatek/pinctrl-mt8135.c
index f1e1e18..8e6abd5 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mt8135.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mt8135.c
@@ -32,12 +32,12 @@
 #define R1_BASE2   0x250
 
 struct mtk_spec_pull_set {
-   unsigned int pin;
-   unsigned int pupd_offset;
+   unsigned char pin;
unsigned char pupd_bit;
-   unsigned int r0_offset;
+   unsigned short pupd_offset;
+   unsigned short r0_offset;
+   unsigned short r1_offset;
unsigned char r0_bit;
-   unsigned int r1_offset;
unsigned char r1_bit;
 };
 
@@ -305,7 +305,6 @@ static const struct mtk_pinctrl_devdata mt8135_pinctrl_data 
= {
.pullen_offset = 0x0200,
.smt_offset = 0x0300,
.pullsel_offset = 0x0400,
-   .invser_offset = 0x0600,
.dout_offset = 0x0800,
.din_offset = 0x0A00,
.pinmux_offset = 0x0C00,
@@ -314,7 +313,6 @@ static const struct mtk_pinctrl_devdata mt8135_pinctrl_data 
= {
.port_shf = 4,
.port_mask = 0xf,
.port_align = 4,
-   .chip_type = MTK_CHIP_TYPE_BASE,
.eint_offsets = {
.name = "mt8135_eint",
.stat  = 0x000,
diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.h 
b/drivers/pinctrl/mediatek/pinctrl-mtk-common.h
index 375771d..1508849 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.h
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.h
@@ -19,8 +19,6 @@
 #include 
 
 #define NO_EINT_SUPPORT255
-#define MTK_CHIP_TYPE_BASE 0
-#define MTK_CHIP_TYPE_PMIC 1
 #define MT_EDGE_SENSITIVE   0
 #define MT_LEVEL_SENSITIVE  1
 #define EINT_DBNC_SET_DBNC_BITS 4
@@ -39,7 +37,6 @@ struct mtk_desc_eint {
 
 struct mtk_desc_pin {
struct pinctrl_pin_desc pin;
-   const char *chip;
const struct mtk_desc_eint eint;
const struct mtk_desc_function  *functions;
 };
@@ -47,7 +44,6 @@ struct mtk_desc_pin {
 #define MTK_PIN(_pin, _pad, _chip, _eint, ...) \
{   \
.pin = _pin,\
-   .chip = _chip,  \
.eint = _eint,  \
.functions = (struct mtk_desc_function[]){  \
__VA_ARGS__, { } }, \
@@ -107,8 +103,8 @@ struct mtk_drv_group_desc {
  * @grp: The group for this pin belongs to.
  */
 struct mtk_pin_drv_grp {
-   unsigned int pin;
-   unsigned int offset;
+   unsigned short pin;
+   unsigned short offset;
unsigned char bit;
unsigned char grp;
 };
@@ -193,7 +189,6 @@ struct mtk_pinctrl_devdata {
unsigned int pullen_offset;
unsigned int pullsel_offset;
unsigned int drv_offset;
-   unsigned int invser_offset;
unsigned int dout_offset;
unsigned int din_offset;
unsigned int pinmux_offset;
@@ -202,7 +197,6 @@ struct mtk_pinctrl_devdata {
unsigned char  port_shf;
unsigned char  port_mask;
unsigned char  port_align;
-   unsigned char   chip_type;
struct mtk_eint_offsets eint_offsets;
unsigned intap_num;
unsigned intdb_cnt;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 02/11] pinctrl: dt bindings: mt6397: Add pinfunc header file for mt6397.

2015-05-19 Thread Hongzhou Yang
Add pinfunc header file, mt8135/mt8173 relate dts will include it.

Signed-off-by: Hongzhou Yang 
---
 include/dt-bindings/pinctrl/mt6397-pinfunc.h |  256 ++
 1 file changed, 256 insertions(+)
 create mode 100644 include/dt-bindings/pinctrl/mt6397-pinfunc.h

diff --git a/include/dt-bindings/pinctrl/mt6397-pinfunc.h 
b/include/dt-bindings/pinctrl/mt6397-pinfunc.h
new file mode 100644
index 000..85739b3
--- /dev/null
+++ b/include/dt-bindings/pinctrl/mt6397-pinfunc.h
@@ -0,0 +1,256 @@
+#ifndef __DTS_MT6397_PINFUNC_H
+#define __DTS_MT6397_PINFUNC_H
+
+#include 
+
+#define MT6397_PIN_0_INT__FUNC_GPIO0 (MTK_PIN_NO(0) | 0)
+#define MT6397_PIN_0_INT__FUNC_INT (MTK_PIN_NO(0) | 1)
+
+#define MT6397_PIN_1_SRCVOLTEN__FUNC_GPIO1 (MTK_PIN_NO(1) | 0)
+#define MT6397_PIN_1_SRCVOLTEN__FUNC_SRCVOLTEN (MTK_PIN_NO(1) | 1)
+#define MT6397_PIN_1_SRCVOLTEN__FUNC_TEST_CK1 (MTK_PIN_NO(1) | 6)
+
+#define MT6397_PIN_2_SRCLKEN_PERI__FUNC_GPIO2 (MTK_PIN_NO(2) | 0)
+#define MT6397_PIN_2_SRCLKEN_PERI__FUNC_SRCLKEN_PERI (MTK_PIN_NO(2) | 1)
+#define MT6397_PIN_2_SRCLKEN_PERI__FUNC_TEST_CK2 (MTK_PIN_NO(2) | 6)
+
+#define MT6397_PIN_3_RTC_32K1V8__FUNC_GPIO3 (MTK_PIN_NO(3) | 0)
+#define MT6397_PIN_3_RTC_32K1V8__FUNC_RTC_32K1V8 (MTK_PIN_NO(3) | 1)
+#define MT6397_PIN_3_RTC_32K1V8__FUNC_TEST_CK3 (MTK_PIN_NO(3) | 6)
+
+#define MT6397_PIN_4_WRAP_EVENT__FUNC_GPIO4 (MTK_PIN_NO(4) | 0)
+#define MT6397_PIN_4_WRAP_EVENT__FUNC_WRAP_EVENT (MTK_PIN_NO(4) | 1)
+
+#define MT6397_PIN_5_SPI_CLK__FUNC_GPIO5 (MTK_PIN_NO(5) | 0)
+#define MT6397_PIN_5_SPI_CLK__FUNC_SPI_CLK (MTK_PIN_NO(5) | 1)
+
+#define MT6397_PIN_6_SPI_CSN__FUNC_GPIO6 (MTK_PIN_NO(6) | 0)
+#define MT6397_PIN_6_SPI_CSN__FUNC_SPI_CSN (MTK_PIN_NO(6) | 1)
+
+#define MT6397_PIN_7_SPI_MOSI__FUNC_GPIO7 (MTK_PIN_NO(7) | 0)
+#define MT6397_PIN_7_SPI_MOSI__FUNC_SPI_MOSI (MTK_PIN_NO(7) | 1)
+
+#define MT6397_PIN_8_SPI_MISO__FUNC_GPIO8 (MTK_PIN_NO(8) | 0)
+#define MT6397_PIN_8_SPI_MISO__FUNC_SPI_MISO (MTK_PIN_NO(8) | 1)
+
+#define MT6397_PIN_9_AUD_CLK_MOSI__FUNC_GPIO9 (MTK_PIN_NO(9) | 0)
+#define MT6397_PIN_9_AUD_CLK_MOSI__FUNC_AUD_CLK (MTK_PIN_NO(9) | 1)
+#define MT6397_PIN_9_AUD_CLK_MOSI__FUNC_TEST_IN0 (MTK_PIN_NO(9) | 6)
+#define MT6397_PIN_9_AUD_CLK_MOSI__FUNC_TEST_OUT0 (MTK_PIN_NO(9) | 7)
+
+#define MT6397_PIN_10_AUD_DAT_MISO__FUNC_GPIO10 (MTK_PIN_NO(10) | 0)
+#define MT6397_PIN_10_AUD_DAT_MISO__FUNC_AUD_MISO (MTK_PIN_NO(10) | 1)
+#define MT6397_PIN_10_AUD_DAT_MISO__FUNC_TEST_IN1 (MTK_PIN_NO(10) | 6)
+#define MT6397_PIN_10_AUD_DAT_MISO__FUNC_TEST_OUT1 (MTK_PIN_NO(10) | 7)
+
+#define MT6397_PIN_11_AUD_DAT_MOSI__FUNC_GPIO11 (MTK_PIN_NO(11) | 0)
+#define MT6397_PIN_11_AUD_DAT_MOSI__FUNC_AUD_MOSI (MTK_PIN_NO(11) | 1)
+#define MT6397_PIN_11_AUD_DAT_MOSI__FUNC_TEST_IN2 (MTK_PIN_NO(11) | 6)
+#define MT6397_PIN_11_AUD_DAT_MOSI__FUNC_TEST_OUT2 (MTK_PIN_NO(11) | 7)
+
+#define MT6397_PIN_12_COL0__FUNC_GPIO12 (MTK_PIN_NO(12) | 0)
+#define MT6397_PIN_12_COL0__FUNC_COL0_USBDL (MTK_PIN_NO(12) | 1)
+#define MT6397_PIN_12_COL0__FUNC_EINT10_1X (MTK_PIN_NO(12) | 2)
+#define MT6397_PIN_12_COL0__FUNC_PWM1_3X (MTK_PIN_NO(12) | 3)
+#define MT6397_PIN_12_COL0__FUNC_TEST_IN3 (MTK_PIN_NO(12) | 6)
+#define MT6397_PIN_12_COL0__FUNC_TEST_OUT3 (MTK_PIN_NO(12) | 7)
+
+#define MT6397_PIN_13_COL1__FUNC_GPIO13 (MTK_PIN_NO(13) | 0)
+#define MT6397_PIN_13_COL1__FUNC_COL1 (MTK_PIN_NO(13) | 1)
+#define MT6397_PIN_13_COL1__FUNC_EINT11_1X (MTK_PIN_NO(13) | 2)
+#define MT6397_PIN_13_COL1__FUNC_SCL0_2X (MTK_PIN_NO(13) | 3)
+#define MT6397_PIN_13_COL1__FUNC_TEST_IN4 (MTK_PIN_NO(13) | 6)
+#define MT6397_PIN_13_COL1__FUNC_TEST_OUT4 (MTK_PIN_NO(13) | 7)
+
+#define MT6397_PIN_14_COL2__FUNC_GPIO14 (MTK_PIN_NO(14) | 0)
+#define MT6397_PIN_14_COL2__FUNC_COL2 (MTK_PIN_NO(14) | 1)
+#define MT6397_PIN_14_COL2__FUNC_EINT12_1X (MTK_PIN_NO(14) | 2)
+#define MT6397_PIN_14_COL2__FUNC_SDA0_2X (MTK_PIN_NO(14) | 3)
+#define MT6397_PIN_14_COL2__FUNC_TEST_IN5 (MTK_PIN_NO(14) | 6)
+#define MT6397_PIN_14_COL2__FUNC_TEST_OUT5 (MTK_PIN_NO(14) | 7)
+
+#define MT6397_PIN_15_COL3__FUNC_GPIO15 (MTK_PIN_NO(15) | 0)
+#define MT6397_PIN_15_COL3__FUNC_COL3 (MTK_PIN_NO(15) | 1)
+#define MT6397_PIN_15_COL3__FUNC_EINT13_1X (MTK_PIN_NO(15) | 2)
+#define MT6397_PIN_15_COL3__FUNC_SCL1_2X (MTK_PIN_NO(15) | 3)
+#define MT6397_PIN_15_COL3__FUNC_TEST_IN6 (MTK_PIN_NO(15) | 6)
+#define MT6397_PIN_15_COL3__FUNC_TEST_OUT6 (MTK_PIN_NO(15) | 7)
+
+#define MT6397_PIN_16_COL4__FUNC_GPIO16 (MTK_PIN_NO(16) | 0)
+#define MT6397_PIN_16_COL4__FUNC_COL4 (MTK_PIN_NO(16) | 1)
+#define MT6397_PIN_16_COL4__FUNC_EINT14_1X (MTK_PIN_NO(16) | 2)
+#define MT6397_PIN_16_COL4__FUNC_SDA1_2X (MTK_PIN_NO(16) | 3)
+#define MT6397_PIN_16_COL4__FUNC_TEST_IN7 (MTK_PIN_NO(16) | 6)
+#define MT6397_PIN_16_COL4__FUNC_TEST_OUT7 (MTK_PIN_NO(16) | 7)
+
+#define MT6397_PIN_17_COL5__FUNC_GPIO17 (MTK_PIN_NO(17) | 0)
+#define MT6397_PIN_17_COL5__FUNC_COL5 (MTK_PIN_NO(17) | 1)
+#define MT6397_PIN_17_COL5__FUNC_EINT15_1X (MTK_PIN_NO(17) | 2)
+#define MT6397_PIN_17_COL5__FUNC_SCL2_2X (MTK_PIN_NO(17

[PATCH v2 01/11] dt-bindings: mediatek: Modify pinctrl bindings for mt6397.

2015-05-19 Thread Hongzhou Yang
Since 6397 is no need to support interrupt controller,
moving interrupt controller relate property to optional list.
Also adding mt8173 and mt8127 to bindings.

Signed-off-by: Hongzhou Yang 
---
 .../devicetree/bindings/pinctrl/pinctrl-mt65xx.txt |9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/pinctrl/pinctrl-mt65xx.txt 
b/Documentation/devicetree/bindings/pinctrl/pinctrl-mt65xx.txt
index 5868a0f..0480bc3 100644
--- a/Documentation/devicetree/bindings/pinctrl/pinctrl-mt65xx.txt
+++ b/Documentation/devicetree/bindings/pinctrl/pinctrl-mt65xx.txt
@@ -3,9 +3,11 @@
 The Mediatek's Pin controller is used to control SoC pins.
 
 Required properties:
-- compatible: value should be either of the following.
+- compatible: value should be one of the following.
 (a) "mediatek,mt8135-pinctrl", compatible with mt8135 pinctrl.
-- mediatek,pctl-regmap: Should be a phandle of the syscfg node.
+(b) "mediatek,mt8173-pinctrl", compatible with mt8173 pinctrl.
+(c) "mediatek,mt6397-pinctrl", compatible with mt6397 pinctrl.
+(d) "mediatek,mt8127-pinctrl", compatible with mt8127 pinctrl.
 - pins-are-numbered: Specify the subnodes are using numbered pinmux to
   specify pins.
 - gpio-controller : Marks the device node as a gpio controller.
@@ -24,6 +26,9 @@ Required properties:
 Only the following flags are supported:
 0 - GPIO_ACTIVE_HIGH
 1 - GPIO_ACTIVE_LOW
+
+Optional properties:
+- mediatek,pctl-regmap: Should be a phandle of the syscfg node.
 - reg: physicall address base for EINT registers
 - interrupt-controller: Marks the device node as an interrupt controller
 - #interrupt-cells: Should be two.
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 0/11] Mediatek pinctrl driver optimize and add Mediatek SoC Pinctrl/GPIO/EINT driver for mt6397/mt8127.

2015-05-19 Thread Hongzhou Yang
Due to these patches haven't sent to ML, just resend them.

Changes in v2:
  - Break mfd relate change out into a sparate patch.
  - Rearrange order of patches.

Hongzhou Yang (7):
  dt-bindings: mediatek: Modify pinctrl bindings for mt6397.
  pinctrl: dt bindings: mt6397: Add pinfunc header file for mt6397.
  pinctrl: mediatek: add ies/smt control to common code.
  pinctrl: mediatek: Add Pinctrl/GPIO driver for mt6397.
  mfd: mediatek: Add GPIO sub module support into mfd.
  arm64: dts: mt8173-evb: Add pinctrl/GPIO node for mt6397.
  ARM: dts: mt8135-evbp1: Add pinctrl/GPIO node for mt6397.

Yingjoe Chen (4):
  pinctrl: mediatek: data struct optimize and remove unused member
  pinctrl: mediatek: add mtk_pctrl_spec_pull_set_samereg common code
  pinctrl: mediatek: add pinctrl/GPIO/EINT driver for mt8127
  ARM: dts: mt8127: add pinctrl/GPIO/EINT node for mt8127

 .../devicetree/bindings/pinctrl/pinctrl-mt65xx.txt |9 +-
 arch/arm/boot/dts/mt8127-pinfunc.h |  742 +++
 arch/arm/boot/dts/mt8127.dtsi  |   22 +
 arch/arm/boot/dts/mt8135-evbp1.dts |9 +
 arch/arm64/boot/dts/mediatek/mt8173-evb.dts|8 +
 drivers/mfd/mt6397-core.c  |3 +
 drivers/pinctrl/mediatek/Kconfig   |   12 +
 drivers/pinctrl/mediatek/Makefile  |2 +
 drivers/pinctrl/mediatek/pinctrl-mt6397.c  |   78 ++
 drivers/pinctrl/mediatek/pinctrl-mt8127.c  |  359 ++
 drivers/pinctrl/mediatek/pinctrl-mt8135.c  |   12 +-
 drivers/pinctrl/mediatek/pinctrl-mt8173.c  |  369 +++---
 drivers/pinctrl/mediatek/pinctrl-mtk-common.c  |  155 ++-
 drivers/pinctrl/mediatek/pinctrl-mtk-common.h  |   75 +-
 drivers/pinctrl/mediatek/pinctrl-mtk-mt6397.h  |  424 +++
 drivers/pinctrl/mediatek/pinctrl-mtk-mt8127.h  | 1318 
 include/dt-bindings/pinctrl/mt6397-pinfunc.h   |  256 
 17 files changed, 3595 insertions(+), 258 deletions(-)  create mode 100644 
arch/arm/boot/dts/mt8127-pinfunc.h
 create mode 100644 drivers/pinctrl/mediatek/pinctrl-mt6397.c
 create mode 100644 drivers/pinctrl/mediatek/pinctrl-mt8127.c
 create mode 100644 drivers/pinctrl/mediatek/pinctrl-mtk-mt6397.h
 create mode 100644 drivers/pinctrl/mediatek/pinctrl-mtk-mt8127.h
 create mode 100644 include/dt-bindings/pinctrl/mt6397-pinfunc.h

--
1.7.9.5




--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 08/11] mfd: mediatek: Add GPIO sub module support into mfd.

2015-05-19 Thread Hongzhou Yang
Register pinctrl subnode into 6397 mfd cell.

Signed-off-by: Hongzhou Yang hongzhou.y...@mediatek.com
---
 drivers/mfd/mt6397-core.c |3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/mfd/mt6397-core.c b/drivers/mfd/mt6397-core.c
index 09bc780..012c620 100644
--- a/drivers/mfd/mt6397-core.c
+++ b/drivers/mfd/mt6397-core.c
@@ -34,6 +34,9 @@ static const struct mfd_cell mt6397_devs[] = {
}, {
.name = mt6397-clk,
.of_compatible = mediatek,mt6397-clk,
+   }, {
+   .name = mediatek-mt6397-pinctrl,
+   .of_compatible = mediatek,mt6397-pinctrl,
},
 };
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 07/11] pinctrl: mediatek: add pinctrl/GPIO/EINT driver for mt8127

2015-05-19 Thread Hongzhou Yang
From: Yingjoe Chen yingjoe.c...@mediatek.com

MT8127 pinctrl/eint are similar to mt8135 and mt8173, add
support for mt8127 using mediatek common pinctrl driver.

Signed-off-by: Yingjoe Chen yingjoe.c...@mediatek.com
Signed-off-by: Hongzhou Yang hongzhou.y...@mediatek.com
---
 drivers/pinctrl/mediatek/Kconfig  |6 +
 drivers/pinctrl/mediatek/Makefile |1 +
 drivers/pinctrl/mediatek/pinctrl-mt8127.c |  359 +++
 drivers/pinctrl/mediatek/pinctrl-mtk-mt8127.h | 1318 +
 4 files changed, 1684 insertions(+)
 create mode 100644 drivers/pinctrl/mediatek/pinctrl-mt8127.c
 create mode 100644 drivers/pinctrl/mediatek/pinctrl-mtk-mt8127.h

diff --git a/drivers/pinctrl/mediatek/Kconfig b/drivers/pinctrl/mediatek/Kconfig
index ddae479..0bc84fb 100644
--- a/drivers/pinctrl/mediatek/Kconfig
+++ b/drivers/pinctrl/mediatek/Kconfig
@@ -15,6 +15,12 @@ config PINCTRL_MT8135
default MACH_MT8135
select PINCTRL_MTK_COMMON
 
+config PINCTRL_MT8127
+   bool Mediatek MT8127 pin control if COMPILE_TEST  !MACH_MT8127
+   depends on OF
+   default MACH_MT8127
+   select PINCTRL_MTK_COMMON
+
 # For ARMv8 SoCs
 config PINCTRL_MT8173
bool Mediatek MT8173 pin control
diff --git a/drivers/pinctrl/mediatek/Makefile 
b/drivers/pinctrl/mediatek/Makefile
index ad0180c..eb923d6 100644
--- a/drivers/pinctrl/mediatek/Makefile
+++ b/drivers/pinctrl/mediatek/Makefile
@@ -3,5 +3,6 @@ obj-$(CONFIG_PINCTRL_MTK_COMMON)+= pinctrl-mtk-common.o
 
 # SoC Drivers
 obj-$(CONFIG_PINCTRL_MT8135)   += pinctrl-mt8135.o
+obj-$(CONFIG_PINCTRL_MT8127)   += pinctrl-mt8127.o
 obj-$(CONFIG_PINCTRL_MT8173)   += pinctrl-mt8173.o
 obj-$(CONFIG_PINCTRL_MT6397)   += pinctrl-mt6397.o
diff --git a/drivers/pinctrl/mediatek/pinctrl-mt8127.c 
b/drivers/pinctrl/mediatek/pinctrl-mt8127.c
new file mode 100644
index 000..6a26cfa
--- /dev/null
+++ b/drivers/pinctrl/mediatek/pinctrl-mt8127.c
@@ -0,0 +1,359 @@
+/*
+ * Copyright (c) 2015 MediaTek Inc.
+ * Author: Hongzhou.Yang hongzhou.y...@mediatek.com
+ * Yingjoe Chen yingjoe.c...@mediatek.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include linux/module.h
+#include linux/platform_device.h
+#include linux/of.h
+#include linux/of_device.h
+#include linux/pinctrl/pinctrl.h
+#include linux/regmap.h
+#include dt-bindings/pinctrl/mt65xx.h
+
+#include pinctrl-mtk-common.h
+#include pinctrl-mtk-mt8127.h
+
+static const struct mtk_drv_group_desc mt8127_drv_grp[] =  {
+   /* 0E4E8SR 4/8/12/16 */
+   MTK_DRV_GRP(4, 16, 1, 2, 4),
+   /* 0E2E4SR  2/4/6/8 */
+   MTK_DRV_GRP(2, 8, 1, 2, 2),
+   /* E8E4E2  2/4/6/8/10/12/14/16 */
+   MTK_DRV_GRP(2, 16, 0, 2, 2)
+};
+
+static const struct mtk_pin_drv_grp mt8127_pin_drv[] = {
+   MTK_PIN_DRV_GRP(0,   0xb00,  0, 1),
+   MTK_PIN_DRV_GRP(1,   0xb00,  0, 1),
+   MTK_PIN_DRV_GRP(2,   0xb00,  0, 1),
+   MTK_PIN_DRV_GRP(3,   0xb00,  0, 1),
+   MTK_PIN_DRV_GRP(4,   0xb00,  0, 1),
+   MTK_PIN_DRV_GRP(5,   0xb00,  0, 1),
+   MTK_PIN_DRV_GRP(6,   0xb00,  0, 1),
+   MTK_PIN_DRV_GRP(7,   0xb00, 12, 1),
+   MTK_PIN_DRV_GRP(8,   0xb00, 12, 1),
+   MTK_PIN_DRV_GRP(9,   0xb00, 12, 1),
+   MTK_PIN_DRV_GRP(10,  0xb00,  8, 1),
+   MTK_PIN_DRV_GRP(11,  0xb00,  8, 1),
+   MTK_PIN_DRV_GRP(12,  0xb00,  8, 1),
+   MTK_PIN_DRV_GRP(13,  0xb00,  8, 1),
+   MTK_PIN_DRV_GRP(14,  0xb10,  4, 0),
+   MTK_PIN_DRV_GRP(15,  0xb10,  4, 0),
+   MTK_PIN_DRV_GRP(16,  0xb10,  4, 0),
+   MTK_PIN_DRV_GRP(17,  0xb10,  4, 0),
+   MTK_PIN_DRV_GRP(18,  0xb10,  8, 0),
+   MTK_PIN_DRV_GRP(19,  0xb10,  8, 0),
+   MTK_PIN_DRV_GRP(20,  0xb10,  8, 0),
+   MTK_PIN_DRV_GRP(21,  0xb10,  8, 0),
+   MTK_PIN_DRV_GRP(22,  0xb20,  0, 0),
+   MTK_PIN_DRV_GRP(23,  0xb20,  0, 0),
+   MTK_PIN_DRV_GRP(24,  0xb20,  0, 0),
+   MTK_PIN_DRV_GRP(25,  0xb20,  0, 0),
+   MTK_PIN_DRV_GRP(26,  0xb20,  0, 0),
+   MTK_PIN_DRV_GRP(27,  0xb20,  4, 0),
+   MTK_PIN_DRV_GRP(28,  0xb20,  4, 0),
+   MTK_PIN_DRV_GRP(29,  0xb20,  4, 0),
+   MTK_PIN_DRV_GRP(30,  0xb20,  4, 0),
+   MTK_PIN_DRV_GRP(31,  0xb20,  4, 0),
+   MTK_PIN_DRV_GRP(32,  0xb20,  4, 0),
+   MTK_PIN_DRV_GRP(33,  0xb30,  4, 1),
+   MTK_PIN_DRV_GRP(34,  0xb30,  8, 1),
+   MTK_PIN_DRV_GRP(35,  0xb30,  8, 1),
+   MTK_PIN_DRV_GRP(36,  0xb30,  8, 1),
+   MTK_PIN_DRV_GRP(37,  0xb30,  8, 1),
+   MTK_PIN_DRV_GRP(38,  0xb30,  8, 1),
+   MTK_PIN_DRV_GRP(39,  0xb30, 12, 1

[PATCH v2 09/11] ARM: dts: mt8127: add pinctrl/GPIO/EINT node for mt8127

2015-05-19 Thread Hongzhou Yang
From: Yingjoe Chen yingjoe.c...@mediatek.com

Add pinctrl,GPIO and EINT node to mt8127.dtsi.

Signed-off-by: Yingjoe Chen yingjoe.c...@mediatek.com
Signed-off-by: Hongzhou Yang hongzhou.y...@mediatek.com
---
 arch/arm/boot/dts/mt8127-pinfunc.h |  742 
 arch/arm/boot/dts/mt8127.dtsi  |   22 ++
 2 files changed, 764 insertions(+)
 create mode 100644 arch/arm/boot/dts/mt8127-pinfunc.h

diff --git a/arch/arm/boot/dts/mt8127-pinfunc.h 
b/arch/arm/boot/dts/mt8127-pinfunc.h
new file mode 100644
index 000..9198331
--- /dev/null
+++ b/arch/arm/boot/dts/mt8127-pinfunc.h
@@ -0,0 +1,742 @@
+#ifndef __DTS_MT8127_PINFUNC_H
+#define __DTS_MT8127_PINFUNC_H
+
+#include dt-bindings/pinctrl/mt65xx.h
+
+#define MT8127_PIN_0_PWRAP_SPI0_MI__FUNC_GPIO0 (MTK_PIN_NO(0) | 0)
+#define MT8127_PIN_0_PWRAP_SPI0_MI__FUNC_PWRAP_SPIDO (MTK_PIN_NO(0) | 1)
+#define MT8127_PIN_0_PWRAP_SPI0_MI__FUNC_PWRAP_SPIDI (MTK_PIN_NO(0) | 2)
+
+#define MT8127_PIN_1_PWRAP_SPI0_MO__FUNC_GPIO1 (MTK_PIN_NO(1) | 0)
+#define MT8127_PIN_1_PWRAP_SPI0_MO__FUNC_PWRAP_SPIDI (MTK_PIN_NO(1) | 1)
+#define MT8127_PIN_1_PWRAP_SPI0_MO__FUNC_PWRAP_SPIDO (MTK_PIN_NO(1) | 2)
+
+#define MT8127_PIN_2_PWRAP_INT__FUNC_GPIO2 (MTK_PIN_NO(2) | 0)
+
+#define MT8127_PIN_3_PWRAP_SPI0_CK__FUNC_GPIO3 (MTK_PIN_NO(3) | 0)
+#define MT8127_PIN_3_PWRAP_SPI0_CK__FUNC_PWRAP_SPICK_I (MTK_PIN_NO(3) | 1)
+
+#define MT8127_PIN_4_PWRAP_SPI0_CSN__FUNC_GPIO4 (MTK_PIN_NO(4) | 0)
+#define MT8127_PIN_4_PWRAP_SPI0_CSN__FUNC_PWRAP_SPICS_B_I (MTK_PIN_NO(4) | 1)
+
+#define MT8127_PIN_5_PWRAP_SPI0_CK2__FUNC_GPIO5 (MTK_PIN_NO(5) | 0)
+#define MT8127_PIN_5_PWRAP_SPI0_CK2__FUNC_PWRAP_SPICK2_I (MTK_PIN_NO(5) | 1)
+#define MT8127_PIN_5_PWRAP_SPI0_CK2__FUNC_ANT_SEL1 (MTK_PIN_NO(5) | 2)
+#define MT8127_PIN_5_PWRAP_SPI0_CK2__FUNC_VDEC_TEST_CK (MTK_PIN_NO(5) | 3)
+#define MT8127_PIN_5_PWRAP_SPI0_CK2__FUNC_DBG_MON_B_0 (MTK_PIN_NO(5) | 7)
+
+#define MT8127_PIN_6_PWRAP_SPI0_CSN2__FUNC_GPIO6 (MTK_PIN_NO(6) | 0)
+#define MT8127_PIN_6_PWRAP_SPI0_CSN2__FUNC_PWRAP_SPICS2_B_I (MTK_PIN_NO(6) | 1)
+#define MT8127_PIN_6_PWRAP_SPI0_CSN2__FUNC_ANT_SEL0 (MTK_PIN_NO(6) | 2)
+#define MT8127_PIN_6_PWRAP_SPI0_CSN2__FUNC_MM_TEST_CK (MTK_PIN_NO(6) | 3)
+#define MT8127_PIN_6_PWRAP_SPI0_CSN2__FUNC_DBG_MON_B_1 (MTK_PIN_NO(6) | 7)
+
+#define MT8127_PIN_7_AUD_CLK_MOSI__FUNC_GPIO7 (MTK_PIN_NO(7) | 0)
+#define MT8127_PIN_7_AUD_CLK_MOSI__FUNC_AUD_CLK (MTK_PIN_NO(7) | 1)
+#define MT8127_PIN_7_AUD_CLK_MOSI__FUNC_ADC_CK (MTK_PIN_NO(7) | 2)
+
+#define MT8127_PIN_8_AUD_DAT_MISO__FUNC_GPIO8 (MTK_PIN_NO(8) | 0)
+#define MT8127_PIN_8_AUD_DAT_MISO__FUNC_AUD_MISO (MTK_PIN_NO(8) | 1)
+#define MT8127_PIN_8_AUD_DAT_MISO__FUNC_ADC_DAT_IN (MTK_PIN_NO(8) | 2)
+#define MT8127_PIN_8_AUD_DAT_MISO__FUNC_AUD_MOSI (MTK_PIN_NO(8) | 3)
+
+#define MT8127_PIN_9_AUD_DAT_MOSI__FUNC_GPIO9 (MTK_PIN_NO(9) | 0)
+#define MT8127_PIN_9_AUD_DAT_MOSI__FUNC_AUD_MOSI (MTK_PIN_NO(9) | 1)
+#define MT8127_PIN_9_AUD_DAT_MOSI__FUNC_ADC_WS (MTK_PIN_NO(9) | 2)
+#define MT8127_PIN_9_AUD_DAT_MOSI__FUNC_AUD_MISO (MTK_PIN_NO(9) | 3)
+
+#define MT8127_PIN_10_RTC32K_CK__FUNC_GPIO10 (MTK_PIN_NO(10) | 0)
+#define MT8127_PIN_10_RTC32K_CK__FUNC_RTC32K_CK (MTK_PIN_NO(10) | 1)
+
+#define MT8127_PIN_11_WATCHDOG__FUNC_GPIO11 (MTK_PIN_NO(11) | 0)
+#define MT8127_PIN_11_WATCHDOG__FUNC_WATCHDOG (MTK_PIN_NO(11) | 1)
+
+#define MT8127_PIN_12_SRCLKENA__FUNC_GPIO12 (MTK_PIN_NO(12) | 0)
+#define MT8127_PIN_12_SRCLKENA__FUNC_SRCLKENA (MTK_PIN_NO(12) | 1)
+
+#define MT8127_PIN_13_SRCLKENAI__FUNC_GPIO13 (MTK_PIN_NO(13) | 0)
+#define MT8127_PIN_13_SRCLKENAI__FUNC_SRCLKENAI (MTK_PIN_NO(13) | 1)
+
+#define MT8127_PIN_14_URXD2__FUNC_GPIO14 (MTK_PIN_NO(14) | 0)
+#define MT8127_PIN_14_URXD2__FUNC_URXD2 (MTK_PIN_NO(14) | 1)
+#define MT8127_PIN_14_URXD2__FUNC_DPI_D5 (MTK_PIN_NO(14) | 2)
+#define MT8127_PIN_14_URXD2__FUNC_UTXD2 (MTK_PIN_NO(14) | 3)
+#define MT8127_PIN_14_URXD2__FUNC_SRCCLKENAI2 (MTK_PIN_NO(14) | 5)
+#define MT8127_PIN_14_URXD2__FUNC_KROW4 (MTK_PIN_NO(14) | 6)
+
+#define MT8127_PIN_15_UTXD2__FUNC_GPIO15 (MTK_PIN_NO(15) | 0)
+#define MT8127_PIN_15_UTXD2__FUNC_UTXD2 (MTK_PIN_NO(15) | 1)
+#define MT8127_PIN_15_UTXD2__FUNC_DPI_HSYNC (MTK_PIN_NO(15) | 2)
+#define MT8127_PIN_15_UTXD2__FUNC_URXD2 (MTK_PIN_NO(15) | 3)
+#define MT8127_PIN_15_UTXD2__FUNC_KROW5 (MTK_PIN_NO(15) | 6)
+
+#define MT8127_PIN_16_URXD3__FUNC_GPIO16 (MTK_PIN_NO(16) | 0)
+#define MT8127_PIN_16_URXD3__FUNC_URXD3 (MTK_PIN_NO(16) | 1)
+#define MT8127_PIN_16_URXD3__FUNC_DPI_DE (MTK_PIN_NO(16) | 2)
+#define MT8127_PIN_16_URXD3__FUNC_UTXD3 (MTK_PIN_NO(16) | 3)
+#define MT8127_PIN_16_URXD3__FUNC_UCTS2 (MTK_PIN_NO(16) | 4)
+#define MT8127_PIN_16_URXD3__FUNC_PWM3 (MTK_PIN_NO(16) | 5)
+#define MT8127_PIN_16_URXD3__FUNC_KROW6 (MTK_PIN_NO(16) | 6)
+
+#define MT8127_PIN_17_UTXD3__FUNC_GPIO17 (MTK_PIN_NO(17) | 0)
+#define MT8127_PIN_17_UTXD3__FUNC_UTXD3 (MTK_PIN_NO(17) | 1)
+#define MT8127_PIN_17_UTXD3__FUNC_DPI_VSYNC (MTK_PIN_NO(17) | 2)
+#define MT8127_PIN_17_UTXD3__FUNC_URXD3 (MTK_PIN_NO(17) | 3)
+#define

[PATCH v2 06/11] pinctrl: mediatek: Add Pinctrl/GPIO driver for mt6397.

2015-05-19 Thread Hongzhou Yang
Add mt6397 support using mediatek common pinctrl driver.

mt6397 is a PMIC, and pinctrl/GPIO is part of 6397 chip.
Pinctrl/GPIO driver should obtain regmap from PMIC,
so adding this support to common code.

Also, mt6397 is no need to support interrupt controller,
so changing common code to skip it.

Signed-off-by: Hongzhou Yang hongzhou.y...@mediatek.com
---
 drivers/pinctrl/mediatek/Kconfig  |6 +
 drivers/pinctrl/mediatek/Makefile |1 +
 drivers/pinctrl/mediatek/pinctrl-mt6397.c |   78 +
 drivers/pinctrl/mediatek/pinctrl-mt8135.c |2 +-
 drivers/pinctrl/mediatek/pinctrl-mt8173.c |2 +-
 drivers/pinctrl/mediatek/pinctrl-mtk-common.c |   13 +-
 drivers/pinctrl/mediatek/pinctrl-mtk-common.h |3 +-
 drivers/pinctrl/mediatek/pinctrl-mtk-mt6397.h |  424 +
 8 files changed, 524 insertions(+), 5 deletions(-)
 create mode 100644 drivers/pinctrl/mediatek/pinctrl-mt6397.c
 create mode 100644 drivers/pinctrl/mediatek/pinctrl-mtk-mt6397.h

diff --git a/drivers/pinctrl/mediatek/Kconfig b/drivers/pinctrl/mediatek/Kconfig
index 6b3551c..ddae479 100644
--- a/drivers/pinctrl/mediatek/Kconfig
+++ b/drivers/pinctrl/mediatek/Kconfig
@@ -23,4 +23,10 @@ config PINCTRL_MT8173
default ARM64  ARCH_MEDIATEK
select PINCTRL_MTK_COMMON
 
+# For PMIC
+config PINCTRL_MT6397
+   bool Mediatek MT6397 pin control if COMPILE_TEST  !MFD_MT6397
+   default MFD_MT6397
+   select PINCTRL_MTK_COMMON
+
 endif
diff --git a/drivers/pinctrl/mediatek/Makefile 
b/drivers/pinctrl/mediatek/Makefile
index d8606a2..ad0180c 100644
--- a/drivers/pinctrl/mediatek/Makefile
+++ b/drivers/pinctrl/mediatek/Makefile
@@ -4,3 +4,4 @@ obj-$(CONFIG_PINCTRL_MTK_COMMON)+= pinctrl-mtk-common.o
 # SoC Drivers
 obj-$(CONFIG_PINCTRL_MT8135)   += pinctrl-mt8135.o
 obj-$(CONFIG_PINCTRL_MT8173)   += pinctrl-mt8173.o
+obj-$(CONFIG_PINCTRL_MT6397)   += pinctrl-mt6397.o
diff --git a/drivers/pinctrl/mediatek/pinctrl-mt6397.c 
b/drivers/pinctrl/mediatek/pinctrl-mt6397.c
new file mode 100644
index 000..767bbdf
--- /dev/null
+++ b/drivers/pinctrl/mediatek/pinctrl-mt6397.c
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2015 MediaTek Inc.
+ * Author: Hongzhou.Yang hongzhou.y...@mediatek.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include linux/module.h
+#include linux/platform_device.h
+#include linux/of.h
+#include linux/of_device.h
+#include linux/pinctrl/pinctrl.h
+#include linux/pinctrl/pinconf-generic.h
+#include linux/mfd/mt6397/core.h
+
+#include pinctrl-mtk-common.h
+#include pinctrl-mtk-mt6397.h
+
+#define MT6397_PIN_REG_BASE  0xc000
+
+static const struct mtk_pinctrl_devdata mt6397_pinctrl_data = {
+   .pins = mtk_pins_mt6397,
+   .npins = ARRAY_SIZE(mtk_pins_mt6397),
+   .dir_offset = (MT6397_PIN_REG_BASE + 0x000),
+   .ies_offset = MTK_PINCTRL_NOT_SUPPORT,
+   .smt_offset = MTK_PINCTRL_NOT_SUPPORT,
+   .pullen_offset = (MT6397_PIN_REG_BASE + 0x020),
+   .pullsel_offset = (MT6397_PIN_REG_BASE + 0x040),
+   .dout_offset = (MT6397_PIN_REG_BASE + 0x080),
+   .din_offset = (MT6397_PIN_REG_BASE + 0x0a0),
+   .pinmux_offset = (MT6397_PIN_REG_BASE + 0x0c0),
+   .type1_start = 41,
+   .type1_end = 41,
+   .port_shf = 3,
+   .port_mask = 0x3,
+   .port_align = 2,
+};
+
+static int mt6397_pinctrl_probe(struct platform_device *pdev)
+{
+   struct mt6397_chip *mt6397;
+
+   mt6397 = dev_get_drvdata(pdev-dev.parent);
+   return mtk_pctrl_init(pdev, mt6397_pinctrl_data, mt6397-regmap);
+}
+
+static const struct of_device_id mt6397_pctrl_match[] = {
+   { .compatible = mediatek,mt6397-pinctrl, },
+   { }
+};
+MODULE_DEVICE_TABLE(of, mt6397_pctrl_match);
+
+static struct platform_driver mtk_pinctrl_driver = {
+   .probe = mt6397_pinctrl_probe,
+   .driver = {
+   .name = mediatek-mt6397-pinctrl,
+   .owner = THIS_MODULE,
+   .of_match_table = mt6397_pctrl_match,
+   },
+};
+
+static int __init mtk_pinctrl_init(void)
+{
+   return platform_driver_register(mtk_pinctrl_driver);
+}
+
+module_init(mtk_pinctrl_init);
+
+MODULE_LICENSE(GPL v2);
+MODULE_DESCRIPTION(MediaTek MT6397 Pinctrl Driver);
+MODULE_AUTHOR(Hongzhou Yang hongzhou.y...@mediatek.com);
diff --git a/drivers/pinctrl/mediatek/pinctrl-mt8135.c 
b/drivers/pinctrl/mediatek/pinctrl-mt8135.c
index 8e6abd5..203bd2a 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mt8135.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mt8135.c
@@ -342,7 +342,7 @@ static const struct

[PATCH v2 03/11] pinctrl: mediatek: data struct optimize and remove unused member

2015-05-19 Thread Hongzhou Yang
From: Yingjoe Chen yingjoe.c...@mediatek.com

struct mtk_desc_pin.chip, mtk_pinctrl_devdata.invser_offset
and mtk_pinctrl_devdata.chip_type are never used in code.
Remove them.

Some per-pin data are using int for pin number and offsets.
Change to short and rearrange to reduce const data size.

Signed-off-by: Yingjoe Chen yingjoe.c...@mediatek.com
Signed-off-by: Hongzhou Yang hongzhou.y...@mediatek.com
---
 drivers/pinctrl/mediatek/pinctrl-mt8135.c |   10 --
 drivers/pinctrl/mediatek/pinctrl-mtk-common.h |   10 ++
 2 files changed, 6 insertions(+), 14 deletions(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-mt8135.c 
b/drivers/pinctrl/mediatek/pinctrl-mt8135.c
index f1e1e18..8e6abd5 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mt8135.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mt8135.c
@@ -32,12 +32,12 @@
 #define R1_BASE2   0x250
 
 struct mtk_spec_pull_set {
-   unsigned int pin;
-   unsigned int pupd_offset;
+   unsigned char pin;
unsigned char pupd_bit;
-   unsigned int r0_offset;
+   unsigned short pupd_offset;
+   unsigned short r0_offset;
+   unsigned short r1_offset;
unsigned char r0_bit;
-   unsigned int r1_offset;
unsigned char r1_bit;
 };
 
@@ -305,7 +305,6 @@ static const struct mtk_pinctrl_devdata mt8135_pinctrl_data 
= {
.pullen_offset = 0x0200,
.smt_offset = 0x0300,
.pullsel_offset = 0x0400,
-   .invser_offset = 0x0600,
.dout_offset = 0x0800,
.din_offset = 0x0A00,
.pinmux_offset = 0x0C00,
@@ -314,7 +313,6 @@ static const struct mtk_pinctrl_devdata mt8135_pinctrl_data 
= {
.port_shf = 4,
.port_mask = 0xf,
.port_align = 4,
-   .chip_type = MTK_CHIP_TYPE_BASE,
.eint_offsets = {
.name = mt8135_eint,
.stat  = 0x000,
diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.h 
b/drivers/pinctrl/mediatek/pinctrl-mtk-common.h
index 375771d..1508849 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.h
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.h
@@ -19,8 +19,6 @@
 #include linux/regmap.h
 
 #define NO_EINT_SUPPORT255
-#define MTK_CHIP_TYPE_BASE 0
-#define MTK_CHIP_TYPE_PMIC 1
 #define MT_EDGE_SENSITIVE   0
 #define MT_LEVEL_SENSITIVE  1
 #define EINT_DBNC_SET_DBNC_BITS 4
@@ -39,7 +37,6 @@ struct mtk_desc_eint {
 
 struct mtk_desc_pin {
struct pinctrl_pin_desc pin;
-   const char *chip;
const struct mtk_desc_eint eint;
const struct mtk_desc_function  *functions;
 };
@@ -47,7 +44,6 @@ struct mtk_desc_pin {
 #define MTK_PIN(_pin, _pad, _chip, _eint, ...) \
{   \
.pin = _pin,\
-   .chip = _chip,  \
.eint = _eint,  \
.functions = (struct mtk_desc_function[]){  \
__VA_ARGS__, { } }, \
@@ -107,8 +103,8 @@ struct mtk_drv_group_desc {
  * @grp: The group for this pin belongs to.
  */
 struct mtk_pin_drv_grp {
-   unsigned int pin;
-   unsigned int offset;
+   unsigned short pin;
+   unsigned short offset;
unsigned char bit;
unsigned char grp;
 };
@@ -193,7 +189,6 @@ struct mtk_pinctrl_devdata {
unsigned int pullen_offset;
unsigned int pullsel_offset;
unsigned int drv_offset;
-   unsigned int invser_offset;
unsigned int dout_offset;
unsigned int din_offset;
unsigned int pinmux_offset;
@@ -202,7 +197,6 @@ struct mtk_pinctrl_devdata {
unsigned char  port_shf;
unsigned char  port_mask;
unsigned char  port_align;
-   unsigned char   chip_type;
struct mtk_eint_offsets eint_offsets;
unsigned intap_num;
unsigned intdb_cnt;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 05/11] pinctrl: mediatek: add ies/smt control to common code.

2015-05-19 Thread Hongzhou Yang
Input enable and smt setting have different register,
modify code to fix it.

Several mediatek soc use similar input enable/smt setting
procedure as mt8173, some soc use generic input enable/smt
setting, some soc has no input enable/smt setting. Adding
common code to handle all those cases, so future soc driver
can use it.

Signed-off-by: Hongzhou Yang hongzhou.y...@mediatek.com
---
 drivers/pinctrl/mediatek/pinctrl-mt8173.c |  201 +
 drivers/pinctrl/mediatek/pinctrl-mtk-common.c |   82 +++---
 drivers/pinctrl/mediatek/pinctrl-mtk-common.h |   31 +++-
 3 files changed, 198 insertions(+), 116 deletions(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-mt8173.c 
b/drivers/pinctrl/mediatek/pinctrl-mt8173.c
index cc44b27..a7e5b24 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mt8173.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mt8173.c
@@ -18,6 +18,7 @@
 #include linux/of_device.h
 #include linux/pinctrl/pinctrl.h
 #include linux/regmap.h
+#include linux/pinctrl/pinconf-generic.h
 #include dt-bindings/pinctrl/mt65xx.h
 
 #include pinctrl-mtk-common.h
@@ -25,28 +26,6 @@
 
 #define DRV_BASE   0xb00
 
-/**
- * struct mtk_pin_ies_smt_set - For special pins' ies and smt setting.
- * @start: The start pin number of those special pins.
- * @end: The end pin number of those special pins.
- * @offset: The offset of special setting register.
- * @bit: The bit of special setting register.
- */
-struct mtk_pin_ies_smt_set {
-   unsigned int start;
-   unsigned int end;
-   unsigned int offset;
-   unsigned char bit;
-};
-
-#define MTK_PIN_IES_SMT_SET(_start, _end, _offset, _bit)   \
-   {   \
-   .start = _start,\
-   .end = _end,\
-   .bit = _bit,\
-   .offset = _offset,  \
-   }
-
 static const struct mtk_pin_spec_pupd_set_samereg mt8173_spec_pupd[] = {
MTK_PIN_PUPD_SPEC_SR(119, 0xe00, 2, 1, 0),  /* KROW0 */
MTK_PIN_PUPD_SPEC_SR(120, 0xe00, 6, 5, 4),  /* KROW1 */
@@ -97,80 +76,114 @@ static int mt8173_spec_pull_set(struct regmap *regmap, 
unsigned int pin,
ARRAY_SIZE(mt8173_spec_pupd), pin, align, isup, r1r0);
 }
 
-static const struct mtk_pin_ies_smt_set mt8173_ies_smt_set[] = {
-   MTK_PIN_IES_SMT_SET(0, 4, 0x930, 1),
-   MTK_PIN_IES_SMT_SET(5, 9, 0x930, 2),
-   MTK_PIN_IES_SMT_SET(10, 13, 0x930, 10),
-   MTK_PIN_IES_SMT_SET(14, 15, 0x940, 10),
-   MTK_PIN_IES_SMT_SET(16, 16, 0x930, 0),
-   MTK_PIN_IES_SMT_SET(17, 17, 0x950, 2),
-   MTK_PIN_IES_SMT_SET(18, 21, 0x940, 3),
-   MTK_PIN_IES_SMT_SET(29, 32, 0x930, 3),
-   MTK_PIN_IES_SMT_SET(33, 33, 0x930, 4),
-   MTK_PIN_IES_SMT_SET(34, 36, 0x930, 5),
-   MTK_PIN_IES_SMT_SET(37, 38, 0x930, 6),
-   MTK_PIN_IES_SMT_SET(39, 39, 0x930, 7),
-   MTK_PIN_IES_SMT_SET(40, 41, 0x930, 9),
-   MTK_PIN_IES_SMT_SET(42, 42, 0x940, 0),
-   MTK_PIN_IES_SMT_SET(43, 44, 0x930, 11),
-   MTK_PIN_IES_SMT_SET(45, 46, 0x930, 12),
-   MTK_PIN_IES_SMT_SET(57, 64, 0xc20, 13),
-   MTK_PIN_IES_SMT_SET(65, 65, 0xc10, 13),
-   MTK_PIN_IES_SMT_SET(66, 66, 0xc00, 13),
-   MTK_PIN_IES_SMT_SET(67, 67, 0xd10, 13),
-   MTK_PIN_IES_SMT_SET(68, 68, 0xd00, 13),
-   MTK_PIN_IES_SMT_SET(69, 72, 0x940, 14),
-   MTK_PIN_IES_SMT_SET(73, 76, 0xc60, 13),
-   MTK_PIN_IES_SMT_SET(77, 77, 0xc40, 13),
-   MTK_PIN_IES_SMT_SET(78, 78, 0xc50, 13),
-   MTK_PIN_IES_SMT_SET(79, 82, 0x940, 15),
-   MTK_PIN_IES_SMT_SET(83, 83, 0x950, 0),
-   MTK_PIN_IES_SMT_SET(84, 85, 0x950, 1),
-   MTK_PIN_IES_SMT_SET(86, 91, 0x950, 2),
-   MTK_PIN_IES_SMT_SET(92, 92, 0x930, 13),
-   MTK_PIN_IES_SMT_SET(93, 95, 0x930, 14),
-   MTK_PIN_IES_SMT_SET(96, 99, 0x930, 15),
-   MTK_PIN_IES_SMT_SET(100, 103, 0xca0, 13),
-   MTK_PIN_IES_SMT_SET(104, 104, 0xc80, 13),
-   MTK_PIN_IES_SMT_SET(105, 105, 0xc90, 13),
-   MTK_PIN_IES_SMT_SET(106, 107, 0x940, 4),
-   MTK_PIN_IES_SMT_SET(108, 112, 0x940, 1),
-   MTK_PIN_IES_SMT_SET(113, 116, 0x940, 2),
-   MTK_PIN_IES_SMT_SET(117, 118, 0x940, 5),
-   MTK_PIN_IES_SMT_SET(119, 124, 0x940, 6),
-   MTK_PIN_IES_SMT_SET(125, 126, 0x940, 7),
-   MTK_PIN_IES_SMT_SET(127, 127, 0x940, 0),
-   MTK_PIN_IES_SMT_SET(128, 128, 0x950, 8),
-   MTK_PIN_IES_SMT_SET(129, 130, 0x950, 9),
-   MTK_PIN_IES_SMT_SET(131, 132, 0x950, 8),
-   MTK_PIN_IES_SMT_SET(133, 134, 0x910, 8)
+static const struct mtk_pin_ies_smt_set mt8173_smt_set[] = {
+   MTK_PIN_IES_SMT_SPEC(0, 4, 0x930, 1),
+   MTK_PIN_IES_SMT_SPEC(5, 9, 0x930, 2),
+   MTK_PIN_IES_SMT_SPEC(10, 13, 0x930, 10),
+   MTK_PIN_IES_SMT_SPEC(14, 15, 0x940, 10),
+   MTK_PIN_IES_SMT_SPEC(16, 16, 0x930, 0),
+   MTK_PIN_IES_SMT_SPEC(17, 17, 0x950, 2),
+   MTK_PIN_IES_SMT_SPEC(18, 21, 0x940, 3),
+   MTK_PIN_IES_SMT_SPEC(29, 32, 0x930, 3),
+   MTK_PIN_IES_SMT_SPEC(33, 33, 0x930, 4

[PATCH v2 04/11] pinctrl: mediatek: add mtk_pctrl_spec_pull_set_samereg common code

2015-05-19 Thread Hongzhou Yang
From: Yingjoe Chen yingjoe.c...@mediatek.com

Several mediatek soc use similar pull setting procedure as mt8173,
the pupd enable and resistance setting are in the same register.
Add common code mtk_pctrl_spec_pull_set_samereg out of spec_pull_set
in mt8173 to handle this case, so future soc driver can use it.

Signed-off-by: Yingjoe Chen yingjoe.c...@mediatek.com
Signed-off-by: Hongzhou Yang hongzhou.y...@mediatek.com
---
 drivers/pinctrl/mediatek/pinctrl-mt8173.c |  166 +++--
 drivers/pinctrl/mediatek/pinctrl-mtk-common.c |   60 +
 drivers/pinctrl/mediatek/pinctrl-mtk-common.h |   31 +
 3 files changed, 136 insertions(+), 121 deletions(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-mt8173.c 
b/drivers/pinctrl/mediatek/pinctrl-mt8173.c
index 412ea84..cc44b27 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mt8173.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mt8173.c
@@ -47,130 +47,54 @@ struct mtk_pin_ies_smt_set {
.offset = _offset,  \
}
 
-/**
- * struct mtk_pin_spec_pupd_set - For special pins' pull up/down setting.
- * @pin: The pin number.
- * @offset: The offset of special pull up/down setting register.
- * @pupd_bit: The pull up/down bit in this register.
- * @r0_bit: The r0 bit of pull resistor.
- * @r1_bit: The r1 bit of pull resistor.
- */
-struct mtk_pin_spec_pupd_set {
-   unsigned int pin;
-   unsigned int offset;
-   unsigned char pupd_bit;
-   unsigned char r1_bit;
-   unsigned char r0_bit;
-};
-
-#define MTK_PIN_PUPD_SPEC(_pin, _offset, _pupd, _r1, _r0)  \
-   {   \
-   .pin = _pin,\
-   .offset = _offset,  \
-   .pupd_bit = _pupd,  \
-   .r1_bit = _r1,  \
-   .r0_bit = _r0,  \
-   }
-
-static const struct mtk_pin_spec_pupd_set mt8173_spec_pupd[] = {
-   MTK_PIN_PUPD_SPEC(119, 0xe00, 2, 1, 0),  /* KROW0 */
-   MTK_PIN_PUPD_SPEC(120, 0xe00, 6, 5, 4),  /* KROW1 */
-   MTK_PIN_PUPD_SPEC(121, 0xe00, 10, 9, 8), /* KROW2 */
-   MTK_PIN_PUPD_SPEC(122, 0xe10, 2, 1, 0),  /* KCOL0 */
-   MTK_PIN_PUPD_SPEC(123, 0xe10, 6, 5, 4),  /* KCOL1 */
-   MTK_PIN_PUPD_SPEC(124, 0xe10, 10, 9, 8), /* KCOL2 */
-
-   MTK_PIN_PUPD_SPEC(67, 0xd10, 2, 1, 0),   /* ms0 DS */
-   MTK_PIN_PUPD_SPEC(68, 0xd00, 2, 1, 0),   /* ms0 RST */
-   MTK_PIN_PUPD_SPEC(66, 0xc10, 2, 1, 0),   /* ms0 cmd */
-   MTK_PIN_PUPD_SPEC(65, 0xc00, 2, 1, 0),   /* ms0 clk */
-   MTK_PIN_PUPD_SPEC(57, 0xc20, 2, 1, 0),   /* ms0 data0 */
-   MTK_PIN_PUPD_SPEC(58, 0xc20, 2, 1, 0),   /* ms0 data1 */
-   MTK_PIN_PUPD_SPEC(59, 0xc20, 2, 1, 0),   /* ms0 data2 */
-   MTK_PIN_PUPD_SPEC(60, 0xc20, 2, 1, 0),   /* ms0 data3 */
-   MTK_PIN_PUPD_SPEC(61, 0xc20, 2, 1, 0),   /* ms0 data4 */
-   MTK_PIN_PUPD_SPEC(62, 0xc20, 2, 1, 0),   /* ms0 data5 */
-   MTK_PIN_PUPD_SPEC(63, 0xc20, 2, 1, 0),   /* ms0 data6 */
-   MTK_PIN_PUPD_SPEC(64, 0xc20, 2, 1, 0),   /* ms0 data7 */
-
-   MTK_PIN_PUPD_SPEC(78, 0xc50, 2, 1, 0),/* ms1 cmd */
-   MTK_PIN_PUPD_SPEC(73, 0xd20, 2, 1, 0),/* ms1 dat0 */
-   MTK_PIN_PUPD_SPEC(74, 0xd20, 6, 5, 4),/* ms1 dat1 */
-   MTK_PIN_PUPD_SPEC(75, 0xd20, 10, 9, 8),   /* ms1 dat2 */
-   MTK_PIN_PUPD_SPEC(76, 0xd20, 14, 13, 12), /* ms1 dat3 */
-   MTK_PIN_PUPD_SPEC(77, 0xc40, 2, 1, 0),/* ms1 clk */
-
-   MTK_PIN_PUPD_SPEC(100, 0xd40, 2, 1, 0),/* ms2 dat0 */
-   MTK_PIN_PUPD_SPEC(101, 0xd40, 6, 5, 4),/* ms2 dat1 */
-   MTK_PIN_PUPD_SPEC(102, 0xd40, 10, 9, 8),   /* ms2 dat2 */
-   MTK_PIN_PUPD_SPEC(103, 0xd40, 14, 13, 12), /* ms2 dat3 */
-   MTK_PIN_PUPD_SPEC(104, 0xc80, 2, 1, 0),/* ms2 clk */
-   MTK_PIN_PUPD_SPEC(105, 0xc90, 2, 1, 0),/* ms2 cmd */
-
-   MTK_PIN_PUPD_SPEC(22, 0xd60, 2, 1, 0),/* ms3 dat0 */
-   MTK_PIN_PUPD_SPEC(23, 0xd60, 6, 5, 4),/* ms3 dat1 */
-   MTK_PIN_PUPD_SPEC(24, 0xd60, 10, 9, 8),   /* ms3 dat2 */
-   MTK_PIN_PUPD_SPEC(25, 0xd60, 14, 13, 12), /* ms3 dat3 */
-   MTK_PIN_PUPD_SPEC(26, 0xcc0, 2, 1, 0),/* ms3 clk */
-   MTK_PIN_PUPD_SPEC(27, 0xcd0, 2, 1, 0) /* ms3 cmd */
+static const struct mtk_pin_spec_pupd_set_samereg mt8173_spec_pupd[] = {
+   MTK_PIN_PUPD_SPEC_SR(119, 0xe00, 2, 1, 0),  /* KROW0 */
+   MTK_PIN_PUPD_SPEC_SR(120, 0xe00, 6, 5, 4),  /* KROW1 */
+   MTK_PIN_PUPD_SPEC_SR(121, 0xe00, 10, 9, 8), /* KROW2 */
+   MTK_PIN_PUPD_SPEC_SR(122, 0xe10, 2, 1, 0),  /* KCOL0 */
+   MTK_PIN_PUPD_SPEC_SR(123, 0xe10, 6, 5, 4),  /* KCOL1 */
+   MTK_PIN_PUPD_SPEC_SR(124, 0xe10, 10, 9, 8), /* KCOL2 */
+
+   MTK_PIN_PUPD_SPEC_SR(67, 0xd10, 2, 1, 0),   /* ms0 DS */
+   MTK_PIN_PUPD_SPEC_SR(68, 0xd00, 2, 1, 0),   /* ms0 RST */
+   MTK_PIN_PUPD_SPEC_SR(66, 0xc10, 2, 1, 0),   /* ms0 cmd */
+   MTK_PIN_PUPD_SPEC_SR(65, 0xc00, 2, 1, 0),   /* ms0 clk */
+   MTK_PIN_PUPD_SPEC_SR(57, 0xc20, 2, 1, 0),   /* ms0 data0

[PATCH v2 02/11] pinctrl: dt bindings: mt6397: Add pinfunc header file for mt6397.

2015-05-19 Thread Hongzhou Yang
Add pinfunc header file, mt8135/mt8173 relate dts will include it.

Signed-off-by: Hongzhou Yang hongzhou.y...@mediatek.com
---
 include/dt-bindings/pinctrl/mt6397-pinfunc.h |  256 ++
 1 file changed, 256 insertions(+)
 create mode 100644 include/dt-bindings/pinctrl/mt6397-pinfunc.h

diff --git a/include/dt-bindings/pinctrl/mt6397-pinfunc.h 
b/include/dt-bindings/pinctrl/mt6397-pinfunc.h
new file mode 100644
index 000..85739b3
--- /dev/null
+++ b/include/dt-bindings/pinctrl/mt6397-pinfunc.h
@@ -0,0 +1,256 @@
+#ifndef __DTS_MT6397_PINFUNC_H
+#define __DTS_MT6397_PINFUNC_H
+
+#include dt-bindings/pinctrl/mt65xx.h
+
+#define MT6397_PIN_0_INT__FUNC_GPIO0 (MTK_PIN_NO(0) | 0)
+#define MT6397_PIN_0_INT__FUNC_INT (MTK_PIN_NO(0) | 1)
+
+#define MT6397_PIN_1_SRCVOLTEN__FUNC_GPIO1 (MTK_PIN_NO(1) | 0)
+#define MT6397_PIN_1_SRCVOLTEN__FUNC_SRCVOLTEN (MTK_PIN_NO(1) | 1)
+#define MT6397_PIN_1_SRCVOLTEN__FUNC_TEST_CK1 (MTK_PIN_NO(1) | 6)
+
+#define MT6397_PIN_2_SRCLKEN_PERI__FUNC_GPIO2 (MTK_PIN_NO(2) | 0)
+#define MT6397_PIN_2_SRCLKEN_PERI__FUNC_SRCLKEN_PERI (MTK_PIN_NO(2) | 1)
+#define MT6397_PIN_2_SRCLKEN_PERI__FUNC_TEST_CK2 (MTK_PIN_NO(2) | 6)
+
+#define MT6397_PIN_3_RTC_32K1V8__FUNC_GPIO3 (MTK_PIN_NO(3) | 0)
+#define MT6397_PIN_3_RTC_32K1V8__FUNC_RTC_32K1V8 (MTK_PIN_NO(3) | 1)
+#define MT6397_PIN_3_RTC_32K1V8__FUNC_TEST_CK3 (MTK_PIN_NO(3) | 6)
+
+#define MT6397_PIN_4_WRAP_EVENT__FUNC_GPIO4 (MTK_PIN_NO(4) | 0)
+#define MT6397_PIN_4_WRAP_EVENT__FUNC_WRAP_EVENT (MTK_PIN_NO(4) | 1)
+
+#define MT6397_PIN_5_SPI_CLK__FUNC_GPIO5 (MTK_PIN_NO(5) | 0)
+#define MT6397_PIN_5_SPI_CLK__FUNC_SPI_CLK (MTK_PIN_NO(5) | 1)
+
+#define MT6397_PIN_6_SPI_CSN__FUNC_GPIO6 (MTK_PIN_NO(6) | 0)
+#define MT6397_PIN_6_SPI_CSN__FUNC_SPI_CSN (MTK_PIN_NO(6) | 1)
+
+#define MT6397_PIN_7_SPI_MOSI__FUNC_GPIO7 (MTK_PIN_NO(7) | 0)
+#define MT6397_PIN_7_SPI_MOSI__FUNC_SPI_MOSI (MTK_PIN_NO(7) | 1)
+
+#define MT6397_PIN_8_SPI_MISO__FUNC_GPIO8 (MTK_PIN_NO(8) | 0)
+#define MT6397_PIN_8_SPI_MISO__FUNC_SPI_MISO (MTK_PIN_NO(8) | 1)
+
+#define MT6397_PIN_9_AUD_CLK_MOSI__FUNC_GPIO9 (MTK_PIN_NO(9) | 0)
+#define MT6397_PIN_9_AUD_CLK_MOSI__FUNC_AUD_CLK (MTK_PIN_NO(9) | 1)
+#define MT6397_PIN_9_AUD_CLK_MOSI__FUNC_TEST_IN0 (MTK_PIN_NO(9) | 6)
+#define MT6397_PIN_9_AUD_CLK_MOSI__FUNC_TEST_OUT0 (MTK_PIN_NO(9) | 7)
+
+#define MT6397_PIN_10_AUD_DAT_MISO__FUNC_GPIO10 (MTK_PIN_NO(10) | 0)
+#define MT6397_PIN_10_AUD_DAT_MISO__FUNC_AUD_MISO (MTK_PIN_NO(10) | 1)
+#define MT6397_PIN_10_AUD_DAT_MISO__FUNC_TEST_IN1 (MTK_PIN_NO(10) | 6)
+#define MT6397_PIN_10_AUD_DAT_MISO__FUNC_TEST_OUT1 (MTK_PIN_NO(10) | 7)
+
+#define MT6397_PIN_11_AUD_DAT_MOSI__FUNC_GPIO11 (MTK_PIN_NO(11) | 0)
+#define MT6397_PIN_11_AUD_DAT_MOSI__FUNC_AUD_MOSI (MTK_PIN_NO(11) | 1)
+#define MT6397_PIN_11_AUD_DAT_MOSI__FUNC_TEST_IN2 (MTK_PIN_NO(11) | 6)
+#define MT6397_PIN_11_AUD_DAT_MOSI__FUNC_TEST_OUT2 (MTK_PIN_NO(11) | 7)
+
+#define MT6397_PIN_12_COL0__FUNC_GPIO12 (MTK_PIN_NO(12) | 0)
+#define MT6397_PIN_12_COL0__FUNC_COL0_USBDL (MTK_PIN_NO(12) | 1)
+#define MT6397_PIN_12_COL0__FUNC_EINT10_1X (MTK_PIN_NO(12) | 2)
+#define MT6397_PIN_12_COL0__FUNC_PWM1_3X (MTK_PIN_NO(12) | 3)
+#define MT6397_PIN_12_COL0__FUNC_TEST_IN3 (MTK_PIN_NO(12) | 6)
+#define MT6397_PIN_12_COL0__FUNC_TEST_OUT3 (MTK_PIN_NO(12) | 7)
+
+#define MT6397_PIN_13_COL1__FUNC_GPIO13 (MTK_PIN_NO(13) | 0)
+#define MT6397_PIN_13_COL1__FUNC_COL1 (MTK_PIN_NO(13) | 1)
+#define MT6397_PIN_13_COL1__FUNC_EINT11_1X (MTK_PIN_NO(13) | 2)
+#define MT6397_PIN_13_COL1__FUNC_SCL0_2X (MTK_PIN_NO(13) | 3)
+#define MT6397_PIN_13_COL1__FUNC_TEST_IN4 (MTK_PIN_NO(13) | 6)
+#define MT6397_PIN_13_COL1__FUNC_TEST_OUT4 (MTK_PIN_NO(13) | 7)
+
+#define MT6397_PIN_14_COL2__FUNC_GPIO14 (MTK_PIN_NO(14) | 0)
+#define MT6397_PIN_14_COL2__FUNC_COL2 (MTK_PIN_NO(14) | 1)
+#define MT6397_PIN_14_COL2__FUNC_EINT12_1X (MTK_PIN_NO(14) | 2)
+#define MT6397_PIN_14_COL2__FUNC_SDA0_2X (MTK_PIN_NO(14) | 3)
+#define MT6397_PIN_14_COL2__FUNC_TEST_IN5 (MTK_PIN_NO(14) | 6)
+#define MT6397_PIN_14_COL2__FUNC_TEST_OUT5 (MTK_PIN_NO(14) | 7)
+
+#define MT6397_PIN_15_COL3__FUNC_GPIO15 (MTK_PIN_NO(15) | 0)
+#define MT6397_PIN_15_COL3__FUNC_COL3 (MTK_PIN_NO(15) | 1)
+#define MT6397_PIN_15_COL3__FUNC_EINT13_1X (MTK_PIN_NO(15) | 2)
+#define MT6397_PIN_15_COL3__FUNC_SCL1_2X (MTK_PIN_NO(15) | 3)
+#define MT6397_PIN_15_COL3__FUNC_TEST_IN6 (MTK_PIN_NO(15) | 6)
+#define MT6397_PIN_15_COL3__FUNC_TEST_OUT6 (MTK_PIN_NO(15) | 7)
+
+#define MT6397_PIN_16_COL4__FUNC_GPIO16 (MTK_PIN_NO(16) | 0)
+#define MT6397_PIN_16_COL4__FUNC_COL4 (MTK_PIN_NO(16) | 1)
+#define MT6397_PIN_16_COL4__FUNC_EINT14_1X (MTK_PIN_NO(16) | 2)
+#define MT6397_PIN_16_COL4__FUNC_SDA1_2X (MTK_PIN_NO(16) | 3)
+#define MT6397_PIN_16_COL4__FUNC_TEST_IN7 (MTK_PIN_NO(16) | 6)
+#define MT6397_PIN_16_COL4__FUNC_TEST_OUT7 (MTK_PIN_NO(16) | 7)
+
+#define MT6397_PIN_17_COL5__FUNC_GPIO17 (MTK_PIN_NO(17) | 0)
+#define MT6397_PIN_17_COL5__FUNC_COL5 (MTK_PIN_NO(17) | 1)
+#define MT6397_PIN_17_COL5__FUNC_EINT15_1X (MTK_PIN_NO(17) | 2

[PATCH v2 0/11] Mediatek pinctrl driver optimize and add Mediatek SoC Pinctrl/GPIO/EINT driver for mt6397/mt8127.

2015-05-19 Thread Hongzhou Yang
Due to these patches haven't sent to ML, just resend them.

Changes in v2:
  - Break mfd relate change out into a sparate patch.
  - Rearrange order of patches.

Hongzhou Yang (7):
  dt-bindings: mediatek: Modify pinctrl bindings for mt6397.
  pinctrl: dt bindings: mt6397: Add pinfunc header file for mt6397.
  pinctrl: mediatek: add ies/smt control to common code.
  pinctrl: mediatek: Add Pinctrl/GPIO driver for mt6397.
  mfd: mediatek: Add GPIO sub module support into mfd.
  arm64: dts: mt8173-evb: Add pinctrl/GPIO node for mt6397.
  ARM: dts: mt8135-evbp1: Add pinctrl/GPIO node for mt6397.

Yingjoe Chen (4):
  pinctrl: mediatek: data struct optimize and remove unused member
  pinctrl: mediatek: add mtk_pctrl_spec_pull_set_samereg common code
  pinctrl: mediatek: add pinctrl/GPIO/EINT driver for mt8127
  ARM: dts: mt8127: add pinctrl/GPIO/EINT node for mt8127

 .../devicetree/bindings/pinctrl/pinctrl-mt65xx.txt |9 +-
 arch/arm/boot/dts/mt8127-pinfunc.h |  742 +++
 arch/arm/boot/dts/mt8127.dtsi  |   22 +
 arch/arm/boot/dts/mt8135-evbp1.dts |9 +
 arch/arm64/boot/dts/mediatek/mt8173-evb.dts|8 +
 drivers/mfd/mt6397-core.c  |3 +
 drivers/pinctrl/mediatek/Kconfig   |   12 +
 drivers/pinctrl/mediatek/Makefile  |2 +
 drivers/pinctrl/mediatek/pinctrl-mt6397.c  |   78 ++
 drivers/pinctrl/mediatek/pinctrl-mt8127.c  |  359 ++
 drivers/pinctrl/mediatek/pinctrl-mt8135.c  |   12 +-
 drivers/pinctrl/mediatek/pinctrl-mt8173.c  |  369 +++---
 drivers/pinctrl/mediatek/pinctrl-mtk-common.c  |  155 ++-
 drivers/pinctrl/mediatek/pinctrl-mtk-common.h  |   75 +-
 drivers/pinctrl/mediatek/pinctrl-mtk-mt6397.h  |  424 +++
 drivers/pinctrl/mediatek/pinctrl-mtk-mt8127.h  | 1318 
 include/dt-bindings/pinctrl/mt6397-pinfunc.h   |  256 
 17 files changed, 3595 insertions(+), 258 deletions(-)  create mode 100644 
arch/arm/boot/dts/mt8127-pinfunc.h
 create mode 100644 drivers/pinctrl/mediatek/pinctrl-mt6397.c
 create mode 100644 drivers/pinctrl/mediatek/pinctrl-mt8127.c
 create mode 100644 drivers/pinctrl/mediatek/pinctrl-mtk-mt6397.h
 create mode 100644 drivers/pinctrl/mediatek/pinctrl-mtk-mt8127.h
 create mode 100644 include/dt-bindings/pinctrl/mt6397-pinfunc.h

--
1.7.9.5




--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 01/11] dt-bindings: mediatek: Modify pinctrl bindings for mt6397.

2015-05-19 Thread Hongzhou Yang
Since 6397 is no need to support interrupt controller,
moving interrupt controller relate property to optional list.
Also adding mt8173 and mt8127 to bindings.

Signed-off-by: Hongzhou Yang hongzhou.y...@mediatek.com
---
 .../devicetree/bindings/pinctrl/pinctrl-mt65xx.txt |9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/pinctrl/pinctrl-mt65xx.txt 
b/Documentation/devicetree/bindings/pinctrl/pinctrl-mt65xx.txt
index 5868a0f..0480bc3 100644
--- a/Documentation/devicetree/bindings/pinctrl/pinctrl-mt65xx.txt
+++ b/Documentation/devicetree/bindings/pinctrl/pinctrl-mt65xx.txt
@@ -3,9 +3,11 @@
 The Mediatek's Pin controller is used to control SoC pins.
 
 Required properties:
-- compatible: value should be either of the following.
+- compatible: value should be one of the following.
 (a) mediatek,mt8135-pinctrl, compatible with mt8135 pinctrl.
-- mediatek,pctl-regmap: Should be a phandle of the syscfg node.
+(b) mediatek,mt8173-pinctrl, compatible with mt8173 pinctrl.
+(c) mediatek,mt6397-pinctrl, compatible with mt6397 pinctrl.
+(d) mediatek,mt8127-pinctrl, compatible with mt8127 pinctrl.
 - pins-are-numbered: Specify the subnodes are using numbered pinmux to
   specify pins.
 - gpio-controller : Marks the device node as a gpio controller.
@@ -24,6 +26,9 @@ Required properties:
 Only the following flags are supported:
 0 - GPIO_ACTIVE_HIGH
 1 - GPIO_ACTIVE_LOW
+
+Optional properties:
+- mediatek,pctl-regmap: Should be a phandle of the syscfg node.
 - reg: physicall address base for EINT registers
 - interrupt-controller: Marks the device node as an interrupt controller
 - #interrupt-cells: Should be two.
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 11/11] ARM: dts: mt8135-evbp1: Add pinctrl/GPIO node for mt6397.

2015-05-19 Thread Hongzhou Yang
Add pinctrl and GPIO node to mt8135-evbp1.dts.

Signed-off-by: Hongzhou Yang hongzhou.y...@mediatek.com
---
 arch/arm/boot/dts/mt8135-evbp1.dts |8 
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/boot/dts/mt8135-evbp1.dts 
b/arch/arm/boot/dts/mt8135-evbp1.dts
index 357a91f..332233b 100644
--- a/arch/arm/boot/dts/mt8135-evbp1.dts
+++ b/arch/arm/boot/dts/mt8135-evbp1.dts
@@ -14,6 +14,7 @@
 
 /dts-v1/;
 #include mt8135.dtsi
+#include dt-bindings/pinctrl/mt6397-pinfunc.h
 
 / {
model = MediaTek MT8135 evaluation board;
@@ -28,6 +29,13 @@
pmic: mt6397 {
compatible = mediatek,mt6397;
 
+   pio6397: pinctrl@c000 {
+   compatible = mediatek,mt6397-pinctrl;
+   pins-are-numbered;
+   gpio-controller;
+   #gpio-cells = 2;
+   };
+
mt6397regulator: mt6397regulator {
compatible = mediatek,mt6397-regulator;
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 10/11] arm64: dts: mt8173-evb: Add pinctrl/GPIO node for mt6397.

2015-05-19 Thread Hongzhou Yang
Add pinctrl and GPIO node to mt8173-evb.dts.

Signed-off-by: Hongzhou Yang hongzhou.y...@mediatek.com
---
 arch/arm64/boot/dts/mediatek/mt8173-evb.dts |8 
 1 file changed, 8 insertions(+)

diff --git a/arch/arm64/boot/dts/mediatek/mt8173-evb.dts 
b/arch/arm64/boot/dts/mediatek/mt8173-evb.dts
index c9bc71b..bd473c8 100644
--- a/arch/arm64/boot/dts/mediatek/mt8173-evb.dts
+++ b/arch/arm64/boot/dts/mediatek/mt8173-evb.dts
@@ -14,6 +14,7 @@
 
 /dts-v1/;
 #include mt8173.dtsi
+#include dt-bindings/pinctrl/mt6397-pinfunc.h
 
 / {
model = mediatek,mt8173-evb;
@@ -43,6 +44,13 @@
interrupt-controller;
#interrupt-cells = 2;
 
+   pio6397: pinctrl@c000 {
+   compatible = mediatek,mt6397-pinctrl;
+   pins-are-numbered;
+   gpio-controller;
+   #gpio-cells = 2;
+   };
+
rtc: rtc@e000 {
compatible = mediatek,mt6397-rtc;
};
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 35/35 linux-next] pinctrl: constify of_device_id array

2015-03-19 Thread Hongzhou Yang
On Thu, 2015-03-19 at 19:41 +0100, Fabian Frederick wrote:
> 
> > On 19 March 2015 at 02:58 Hongzhou Yang  wrote:
> >
> >
> > On Mon, 2015-03-16 at 20:59 +0100, Fabian Frederick wrote:
> > > of_device_id is always used as const.
> > > (See driver.of_match_table and open firmware functions)
> > >
> > > Signed-off-by: Fabian Frederick 
> > > ---
> > >  drivers/pinctrl/bcm/pinctrl-bcm2835.c   | 2 +-
> > >  drivers/pinctrl/mediatek/pinctrl-mt8135.c   | 2 +-
> > >  drivers/pinctrl/mediatek/pinctrl-mt8173.c   | 2 +-
> > > 
> >
> > For the pinctrl-mt81xx driver,
> > Acked-by: Hongzhou Yang 
> >
> > By the way, Axel has sent same patch to linux-gpio.
> > http://article.gmane.org/gmane.linux.kernel.gpio/6815
> >
> > Thanks.
> > Hongzhou
> >
> Axel's version is better (it also improves display) but doesn't
> include bcm. I'll resend if necessary.
> 
> Regards,
> Fabian

Hi Fabian,

Sorry, it's my fault. Our patch only include pinctrl-mt8135.c and
pinctrl-mt8173.c, bcm is not ours. 
Thank you.

Yours,
Hongzhou

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 35/35 linux-next] pinctrl: constify of_device_id array

2015-03-19 Thread Hongzhou Yang
On Thu, 2015-03-19 at 19:41 +0100, Fabian Frederick wrote:
 
  On 19 March 2015 at 02:58 Hongzhou Yang hongzhou.y...@mediatek.com wrote:
 
 
  On Mon, 2015-03-16 at 20:59 +0100, Fabian Frederick wrote:
   of_device_id is always used as const.
   (See driver.of_match_table and open firmware functions)
  
   Signed-off-by: Fabian Frederick f...@skynet.be
   ---
drivers/pinctrl/bcm/pinctrl-bcm2835.c   | 2 +-
drivers/pinctrl/mediatek/pinctrl-mt8135.c   | 2 +-
drivers/pinctrl/mediatek/pinctrl-mt8173.c   | 2 +-
   
 
  For the pinctrl-mt81xx driver,
  Acked-by: Hongzhou Yang hongzhou.y...@mediatek.com
 
  By the way, Axel has sent same patch to linux-gpio.
  http://article.gmane.org/gmane.linux.kernel.gpio/6815
 
  Thanks.
  Hongzhou
 
 Axel's version is better (it also improves display) but doesn't
 include bcm. I'll resend if necessary.
 
 Regards,
 Fabian

Hi Fabian,

Sorry, it's my fault. Our patch only include pinctrl-mt8135.c and
pinctrl-mt8173.c, bcm is not ours. 
Thank you.

Yours,
Hongzhou

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 35/35 linux-next] pinctrl: constify of_device_id array

2015-03-18 Thread Hongzhou Yang
On Mon, 2015-03-16 at 20:59 +0100, Fabian Frederick wrote:
> of_device_id is always used as const.
> (See driver.of_match_table and open firmware functions)
> 
> Signed-off-by: Fabian Frederick 
> ---
>  drivers/pinctrl/bcm/pinctrl-bcm2835.c   | 2 +-
>  drivers/pinctrl/mediatek/pinctrl-mt8135.c   | 2 +-
>  drivers/pinctrl/mediatek/pinctrl-mt8173.c   | 2 +-
>  

For the pinctrl-mt81xx driver,
Acked-by: Hongzhou Yang 

By the way, Axel has sent same patch to linux-gpio.
http://article.gmane.org/gmane.linux.kernel.gpio/6815

Thanks.
Hongzhou

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 35/35 linux-next] pinctrl: constify of_device_id array

2015-03-18 Thread Hongzhou Yang
On Mon, 2015-03-16 at 20:59 +0100, Fabian Frederick wrote:
 of_device_id is always used as const.
 (See driver.of_match_table and open firmware functions)
 
 Signed-off-by: Fabian Frederick f...@skynet.be
 ---
  drivers/pinctrl/bcm/pinctrl-bcm2835.c   | 2 +-
  drivers/pinctrl/mediatek/pinctrl-mt8135.c   | 2 +-
  drivers/pinctrl/mediatek/pinctrl-mt8173.c   | 2 +-
  

For the pinctrl-mt81xx driver,
Acked-by: Hongzhou Yang hongzhou.y...@mediatek.com

By the way, Axel has sent same patch to linux-gpio.
http://article.gmane.org/gmane.linux.kernel.gpio/6815

Thanks.
Hongzhou

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/