[PATCH] staging: pi433: Use the correct style for SPDX License Identifier

2020-02-08 Thread Nishad Kamdar
This patch corrects the SPDX License Identifier style in
header files related to pi433 radio module drivers.
It assigns explicit block comment to the SPDX License Identifier.

Changes made by using a script provided by Joe Perches here:
https://lkml.org/lkml/2019/2/7/46.

Suggested-by: Joe Perches 
Signed-off-by: Nishad Kamdar 
---
 drivers/staging/pi433/pi433_if.h   | 4 ++--
 drivers/staging/pi433/rf69.h   | 4 ++--
 drivers/staging/pi433/rf69_enum.h  | 4 ++--
 drivers/staging/pi433/rf69_registers.h | 4 ++--
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/pi433/pi433_if.h b/drivers/staging/pi433/pi433_if.h
index 9feb95c431cb..16c5b7fba249 100644
--- a/drivers/staging/pi433/pi433_if.h
+++ b/drivers/staging/pi433/pi433_if.h
@@ -1,5 +1,5 @@
-/* SPDX-License-Identifier: GPL-2.0+
- *
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
  * include/linux/TODO
  *
  * userspace interface for pi433 radio module
diff --git a/drivers/staging/pi433/rf69.h b/drivers/staging/pi433/rf69.h
index d43a8d87d5d3..b648ba5fff89 100644
--- a/drivers/staging/pi433/rf69.h
+++ b/drivers/staging/pi433/rf69.h
@@ -1,5 +1,5 @@
-/* SPDX-License-Identifier: GPL-2.0+
- *
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
  * hardware abstraction/register access for HopeRf rf69 radio module
  *
  * Copyright (C) 2016 Wolf-Entwicklungen
diff --git a/drivers/staging/pi433/rf69_enum.h 
b/drivers/staging/pi433/rf69_enum.h
index 3ee1952245c2..fbf56fcf5fe8 100644
--- a/drivers/staging/pi433/rf69_enum.h
+++ b/drivers/staging/pi433/rf69_enum.h
@@ -1,5 +1,5 @@
-/* SPDX-License-Identifier: GPL-2.0+
- *
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
  * enumerations for HopeRf rf69 radio module
  *
  * Copyright (C) 2016 Wolf-Entwicklungen
diff --git a/drivers/staging/pi433/rf69_registers.h 
b/drivers/staging/pi433/rf69_registers.h
index be5497cdace0..a170c66c3d5b 100644
--- a/drivers/staging/pi433/rf69_registers.h
+++ b/drivers/staging/pi433/rf69_registers.h
@@ -1,5 +1,5 @@
-/* SPDX-License-Identifier: GPL-2.0+
- *
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
  * register description for HopeRf rf69 radio module
  *
  * Copyright (C) 2016 Wolf-Entwicklungen
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: netlogic: Use the correct style for SPDX License Identifier

2020-02-01 Thread Nishad Kamdar
This patch corrects the SPDX License Identifier style in
header files related to Netlogic network devices.
It assigns explicit block comment to the SPDX License Identifier.

Changes made by using a script provided by Joe Perches here:
https://lkml.org/lkml/2019/2/7/46.

Suggested-by: Joe Perches 
Signed-off-by: Nishad Kamdar 
---
 drivers/staging/netlogic/platform_net.h | 4 ++--
 drivers/staging/netlogic/xlr_net.h  | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/netlogic/platform_net.h 
b/drivers/staging/netlogic/platform_net.h
index f152d84099a2..c8d4c13424c6 100644
--- a/drivers/staging/netlogic/platform_net.h
+++ b/drivers/staging/netlogic/platform_net.h
@@ -1,5 +1,5 @@
-/* SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
- *
+/* SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) */
+/*
  * Copyright (c) 2003-2012 Broadcom Corporation
  * All Rights Reserved
  */
diff --git a/drivers/staging/netlogic/xlr_net.h 
b/drivers/staging/netlogic/xlr_net.h
index 518ea809b8fa..8365b744f9b3 100644
--- a/drivers/staging/netlogic/xlr_net.h
+++ b/drivers/staging/netlogic/xlr_net.h
@@ -1,5 +1,5 @@
-/* SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
- *
+/* SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) */
+/*
  * Copyright (c) 2003-2012 Broadcom Corporation
  * All Rights Reserved
  */
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: BUG: Staging: fbtft: Switch to the gpio descriptor interface

2019-07-10 Thread Nishad Kamdar
On Wed, Jul 10, 2019 at 04:31:09PM +0800, Phil Reid wrote:
> G'day Nishad,
> 
> I'm just wondering if the commit
> c440eee1a7a1d0f "Staging: fbtft: Switch to the gpio descriptor interface"
> was tested on anything.
> 
> I've had to apply the following patch to get my display functioning again.
> 
> in particular the devm_gpiod_get_index using dev->driver->name for the gpio 
> lookup seems
> wrong.
> 
> Also I've had to invert the polarity of the reset-gpios in the DT file for 
> the display to function.
> 
> this code:
>   gpiod_set_value_cansleep(par->gpio.reset, 0);
>   usleep_range(20, 40);
>   gpiod_set_value_cansleep(par->gpio.reset, 1);
> 
> could be read as deasserting the reset line and then asserting it.
> So I've had to specify and active high reset line in the DT.
> 
> Regards
> Phil
> 
Hello Phil,

This patch was only compiled successfully.

It hasn't been tested on any hardware.

Sorry for the mistake.

Thanks and regards,
Nishad

> 
> 
> 
> diff --git a/drivers/staging/fbtft/fbtft-core.c 
> b/drivers/staging/fbtft/fbtft-core.c
> index 9b07bad..6fe7cb5 100644
> --- a/drivers/staging/fbtft/fbtft-core.c
> +++ b/drivers/staging/fbtft/fbtft-core.c
> @@ -79,18 +79,16 @@ static int fbtft_request_one_gpio(struct fbtft_par *par,
>   struct device_node *node = dev->of_node;
>   int ret = 0;
> 
> - if (of_find_property(node, name, NULL)) {
> - *gpiop = devm_gpiod_get_index(dev, dev->driver->name, index,
> -   GPIOD_OUT_HIGH);
> - if (IS_ERR(*gpiop)) {
> - ret = PTR_ERR(*gpiop);
> - dev_err(dev,
> - "Failed to request %s GPIO:%d\n", name, ret);
> - return ret;
> - }
> - fbtft_par_dbg(DEBUG_REQUEST_GPIOS, par, "%s: '%s' GPIO\n",
> -   __func__, name);
> + *gpiop = devm_gpiod_get_index_optional(dev, name, index,
> +   GPIOD_OUT_HIGH);
> + if (IS_ERR(*gpiop)) {
> + ret = PTR_ERR(*gpiop);
> + dev_err(dev,
> + "Failed to request %s GPIO: (%d)\n", name, ret);
> + return ret;
>   }
> + fbtft_par_dbg(DEBUG_REQUEST_GPIOS, par, "%s: '%s' GPIO\n",
> +   __func__, name);
> 
>   return ret;
>  }
> @@ -103,34 +101,34 @@ static int fbtft_request_gpios_dt(struct fbtft_par *par)
>   if (!par->info->device->of_node)
>   return -EINVAL;
> 
> - ret = fbtft_request_one_gpio(par, "reset-gpios", 0, >gpio.reset);
> + ret = fbtft_request_one_gpio(par, "reset", 0, >gpio.reset);
>   if (ret)
>   return ret;
> - ret = fbtft_request_one_gpio(par, "dc-gpios", 0, >gpio.dc);
> + ret = fbtft_request_one_gpio(par, "dc", 0, >gpio.dc);
>   if (ret)
>   return ret;
> - ret = fbtft_request_one_gpio(par, "rd-gpios", 0, >gpio.rd);
> + ret = fbtft_request_one_gpio(par, "rd", 0, >gpio.rd);
>   if (ret)
>   return ret;
> - ret = fbtft_request_one_gpio(par, "wr-gpios", 0, >gpio.wr);
> + ret = fbtft_request_one_gpio(par, "wr", 0, >gpio.wr);
>   if (ret)
>   return ret;
> - ret = fbtft_request_one_gpio(par, "cs-gpios", 0, >gpio.cs);
> + ret = fbtft_request_one_gpio(par, "cs", 0, >gpio.cs);
>   if (ret)
>   return ret;
> - ret = fbtft_request_one_gpio(par, "latch-gpios", 0, >gpio.latch);
> + ret = fbtft_request_one_gpio(par, "latch", 0, >gpio.latch);
>   if (ret)
>   return ret;
>   for (i = 0; i < 16; i++) {
> - ret = fbtft_request_one_gpio(par, "db-gpios", i,
> + ret = fbtft_request_one_gpio(par, "db", i,
>>gpio.db[i]);
>   if (ret)
>   return ret;
> - ret = fbtft_request_one_gpio(par, "led-gpios", i,
> + ret = fbtft_request_one_gpio(par, "led", i,
>>gpio.led[i]);
>   if (ret)
>   return ret;
> - ret = fbtft_request_one_gpio(par, "aux-gpios", i,
> + ret = fbtft_request_one_gpio(par, "aux", i,
>>gpio.aux[i]);
>   if (ret)
>   return ret;
> 
> 
> 
> 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Use the correct style for SPDX License Identifier in all header files across the kernel

2019-02-18 Thread Nishad Kamdar
On Sat, Feb 16, 2019 at 08:45:07PM +0100, Greg Kroah-Hartman wrote:
> On Sat, Feb 16, 2019 at 04:04:02PM +0530, Nishad Kamdar wrote:
> >  816 files changed, 970 insertions(+), 970 deletions(-)
> 
> You have to break this up into subsystems at the very least, no one
> person can take this patch, sorry.
> 
> greg k-h

Ok, no problem. I'll do that.

Thanks for the review.

Regards,
Nishad
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: vt6656: Use the correct style for SPDX license Identifier

2019-02-13 Thread Nishad Kamdar
On Wed, Feb 06, 2019 at 11:17:35PM -0800, Joe Perches wrote:
> On Wed, 2019-02-06 at 17:25 +0100, Greg Kroah-Hartman wrote:
> > On Tue, Feb 05, 2019 at 10:59:40AM -0800, Joe Perches wrote:
> > > On Tue, 2019-02-05 at 19:44 +0100, Greg Kroah-Hartman wrote:
> > > > On Tue, Feb 05, 2019 at 08:36:24PM +0530, Nishad Kamdar wrote:
> > > > > This patch corrects the style for SPDX license Identifier in mac.h
> > > > > by using "/* */" in place of "//" as per Linux kernel licensing rules.
> > > > > Issue found by checkpatch.
> > > > > 
> > > > > Signed-off-by: Nishad Kamdar 
> > > > > ---
> > > > >  drivers/staging/vt6656/mac.h | 4 ++--
> > > > >  1 file changed, 2 insertions(+), 2 deletions(-)
> > > > > 
> > > > > diff --git a/drivers/staging/vt6656/mac.h 
> > > > > b/drivers/staging/vt6656/mac.h
> > > > > index 94e700fcd0b6..75166020f7c6 100644
> > > > > --- a/drivers/staging/vt6656/mac.h
> > > > > +++ b/drivers/staging/vt6656/mac.h
> > > > > @@ -1,5 +1,5 @@
> > > > > -// SPDX-License-Identifier: GPL-2.0+
> > > > > -/*
> > > > > +/* SPDX-License-Identifier: GPL-2.0+
> > > > 
> > > > Should really be:
> > > > 
> > > > /* SPDX-License-Identifier: GPL-2.0+ */
> > > 
> > > There's a fair number of style inconsistencies in the kernel
> > > sources for that already.
> > > 
> > > ~8% of the .h files that have an 'SPDX-License-Identifier:'
> > > don't use the recommended style.
> > > 
> > > $ git grep -h "SPDX-License" -- '*.h' | \
> > >   perl -p -e 's@Identifier:.*\*/*@Identifier: ... */@; s@Identifier: 
> > > [^\.].*@Identifier:@' | \
> > >   sort | uniq -c | sort -rn
> > >8506 /* SPDX-License-Identifier: ... */
> > > 593 // SPDX-License-Identifier:
> > > 154 /* SPDX-License-Identifier:
> > >  53  * SPDX-License-Identifier:
> > >   1  * SPDX-License-Identifier:   GPL-2.0
> > >   1 //SPDX-License-Identifier:
> > >   1 /*  SPDX-License-Identifier: ... */
> > 
> > Then let's fix them, the documentation says what the correct format is,
> > there's no reason we can't actually follow what is written...
> 
> So here's a script that does most all of them except
> the 50 or so that use the SPDX-License-Identifier
> in the middle of a comment block.
> 
> Using:
> 
> $ git grep --name-only 'SPDX-License-Identifier:' -- '*.h' | \
>   xargs grep -L '/\* SPDX-License-Identifier:.*\*/'| \
>   while read file ; do perl -i update_spdx.perl $file ; done
> 
> produces
> 
> $ git diff --shortstat
>  748 files changed, 902 insertions(+), 902 deletions(-)
> 
> And
> 
> $ git grep -h "SPDX-License" -- '*.h' | \
>   perl -p -e 's@Identifier:.*\*/*@Identifier: ... */@; s@Identifier: 
> [^\.].*@Identifier:@' | \
>   sort | uniq -c | sort -rn
>9254 /* SPDX-License-Identifier: ... */
>  53  * SPDX-License-Identifier:
>   1  * SPDX-License-Identifier:   GPL-2.0
>   1 /*  SPDX-License-Identifier: ... */
> 
> and the perl script below is also attached
> 
> $ cat update_spdx.perl
> local $/;
> my $file = (<>);
> 
> my $spdx_regex = '/\*[ \t]*SPDX-License-Identifier:[ \t]*';
> my $spdx_actual = '/* SPDX-License-Identifier: ';
> 
> # any // use converted to /* ... */
> $file =~ s@^//[ \t]*SPDX-License-Identifier:[ \t]*(.*)\n@/* 
> SPDX-License-Identifier: $1 */\n@;
> 
> # first line use with /* without trailing */ gets */ added and 2nd line 
> updated
> $file =~ m@^\s*${spdx_regex}([^\n]+)\n@;
> if (defined $1 && $1 !~ m@\*/$@) {
> $file =~ s@^[ \t]*${spdx_regex}([^\n]+)\n@${spdx_actual}$1 */\n/* @;
> $file =~ s@^[ \t]*${spdx_regex}([^\n]+)\n[ \t]*/\*[ 
> \t]+\*@${spdx_actual}$1\n/* @;
> $file =~ s@^\s*${spdx_regex}([^\n]+)\n/\* \n@${spdx_actual}$1\n/*\n@;
> }
> 
> print $file;
> 

Ok, Thanks for the suggestion and the script.

I'll try to use it and correct the format.

Thanks and regards,
Nishad
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: vt6656: Use the correct style for SPDX license Identifier

2019-02-12 Thread Nishad Kamdar
On Tue, Feb 05, 2019 at 07:44:31PM +0100, Greg Kroah-Hartman wrote:
> On Tue, Feb 05, 2019 at 08:36:24PM +0530, Nishad Kamdar wrote:
> > This patch corrects the style for SPDX license Identifier in mac.h
> > by using "/* */" in place of "//" as per Linux kernel licensing rules.
> > Issue found by checkpatch.
> > 
> > Signed-off-by: Nishad Kamdar 
> > ---
> >  drivers/staging/vt6656/mac.h | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/staging/vt6656/mac.h b/drivers/staging/vt6656/mac.h
> > index 94e700fcd0b6..75166020f7c6 100644
> > --- a/drivers/staging/vt6656/mac.h
> > +++ b/drivers/staging/vt6656/mac.h
> > @@ -1,5 +1,5 @@
> > -// SPDX-License-Identifier: GPL-2.0+
> > -/*
> > +/* SPDX-License-Identifier: GPL-2.0+
> 
> Should really be:
> 
> /* SPDX-License-Identifier: GPL-2.0+ */
> 
> thanks,
> 
> greg k-h

Ok, i'll modify it.

Thanks for the review.

Regards,
Nishad
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2] staging: vt6656: Use the correct style for SPDX license Identifier

2019-02-06 Thread Nishad Kamdar
This patch corrects the style for SPDX license Identifier in mac.h
by using "/* */" in place of "//" as per Linux kernel licensing rules.
Issue found by checkpatch.

Signed-off-by: Nishad Kamdar 
---
Changes in v2:
  - Use the "/* */" comment style specifically for the SPDX identifier
as per licensing rules.
---
 drivers/staging/vt6656/mac.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/vt6656/mac.h b/drivers/staging/vt6656/mac.h
index 94e700fcd0b6..3fd87f95c524 100644
--- a/drivers/staging/vt6656/mac.h
+++ b/drivers/staging/vt6656/mac.h
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0+
+/* SPDX-License-Identifier: GPL-2.0+ */
 /*
  * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
  * All rights reserved.
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: vt6656: Use the correct style for SPDX license Identifier

2019-02-05 Thread Nishad Kamdar
This patch corrects the style for SPDX license Identifier in mac.h
by using "/* */" in place of "//" as per Linux kernel licensing rules.
Issue found by checkpatch.

Signed-off-by: Nishad Kamdar 
---
 drivers/staging/vt6656/mac.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/vt6656/mac.h b/drivers/staging/vt6656/mac.h
index 94e700fcd0b6..75166020f7c6 100644
--- a/drivers/staging/vt6656/mac.h
+++ b/drivers/staging/vt6656/mac.h
@@ -1,5 +1,5 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
+/* SPDX-License-Identifier: GPL-2.0+
+ *
  * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
  * All rights reserved.
  *
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] MIPS: Select PINCTRL_RT2880 when RALINK is enabled

2019-01-30 Thread Nishad Kamdar
On Tue, Jan 29, 2019 at 08:09:07PM +, Paul Burton wrote:
> Hi Nishad,
> 
> On Tue, Jan 29, 2019 at 08:55:27PM +0530, Nishad Kamdar wrote:
> > This patch selects config PINCTRL_RT2880 when config RALINK is
> > enabled as per drivers/staging/mt7621-pinctrl/TODO list. PINCTRL
> > is also selected when RALINK is enabled to avoid config dependency
> > warnings.
> > 
> > Signed-off-by: Nishad Kamdar 
> > ---
> >  arch/mips/Kconfig | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
> > index e2fc88da0223..cea529cf6284 100644
> > --- a/arch/mips/Kconfig
> > +++ b/arch/mips/Kconfig
> > @@ -623,6 +623,8 @@ config RALINK
> > select CLKDEV_LOOKUP
> > select ARCH_HAS_RESET_CONTROLLER
> > select RESET_CONTROLLER
> > +   select PINCTRL
> > +   select PINCTRL_RT2880
> >  
> >  config SGI_IP22
> > bool "SGI IP22 (Indy/Indigo2)"
> 
> Wouldn't this also require selecting STAGING? Perhaps that's why it
> wasn't done in the first place?
> 
> Thanks,
> Paul
Ok, got it.

Thanks for the review.

Regards,
Nishad
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: mt7621-pinctrl: Test devm_kzalloc for failure while improving the code

2019-01-29 Thread Nishad Kamdar
This patch tests the return of devm_kzalloc for failure and
improves the code.

Signed-off-by: Nishad Kamdar 
---
 drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c 
b/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
index 3e959fa73703..9b52d44abef1 100644
--- a/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
+++ b/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
@@ -350,7 +350,6 @@ static int rt2880_pinmux_probe(struct platform_device *pdev)
for_each_compatible_node(np, NULL, "ralink,rt2880-gpio") {
const __be32 *ngpio, *gpiobase;
struct pinctrl_gpio_range *range;
-   char *name;
 
if (!of_device_is_available(np))
continue;
@@ -362,9 +361,10 @@ static int rt2880_pinmux_probe(struct platform_device 
*pdev)
return -EINVAL;
}
 
-   range = devm_kzalloc(p->dev, sizeof(*range) + 4, GFP_KERNEL);
-   range->name = name = (char *)[1];
-   sprintf(name, "pio");
+   range = devm_kzalloc(p->dev, sizeof(*range), GFP_KERNEL);
+   if (!range)
+   return -ENOMEM;
+   range->name = "pio";
range->npins = __be32_to_cpu(*ngpio);
range->base = __be32_to_cpu(*gpiobase);
range->pin_base = range->base;
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] MIPS: Select PINCTRL_RT2880 when RALINK is enabled

2019-01-29 Thread Nishad Kamdar
This patch selects config PINCTRL_RT2880 when config RALINK is
enabled as per drivers/staging/mt7621-pinctrl/TODO list. PINCTRL
is also selected when RALINK is enabled to avoid config dependency
warnings.

Signed-off-by: Nishad Kamdar 
---
 arch/mips/Kconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index e2fc88da0223..cea529cf6284 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -623,6 +623,8 @@ config RALINK
select CLKDEV_LOOKUP
select ARCH_HAS_RESET_CONTROLLER
select RESET_CONTROLLER
+   select PINCTRL
+   select PINCTRL_RT2880
 
 config SGI_IP22
bool "SGI IP22 (Indy/Indigo2)"
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: mt7621-pinctrl: Remove space after cast

2019-01-25 Thread Nishad Kamdar
On Wed, Jan 23, 2019 at 09:45:53AM -0800, Joe Perches wrote:
> On Wed, 2019-01-23 at 22:01 +0530, Nishad Kamdar wrote:
> > This patch removes space after a cast as it
> > is not needed.
> > Issue found by checkpatch.
> > 
> > Signed-off-by: Nishad Kamdar 
> > ---
> >  drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c 
> > b/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
> > index 80e7067cfb79..3e959fa73703 100644
> > --- a/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
> > +++ b/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
> > @@ -363,7 +363,7 @@ static int rt2880_pinmux_probe(struct platform_device 
> > *pdev)
> > }
> >  
> > range = devm_kzalloc(p->dev, sizeof(*range) + 4, GFP_KERNEL);
> > -   range->name = name = (char *) [1];
> > +   range->name = name = (char *)[1];
> > sprintf(name, "pio");
> 
> I find this code unsightly and fragile.
> It doesn't test the return of devm_kzalloc for failure.
> 
> This might as well be
> ---
>  drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c 
> b/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
> index 80e7067cfb79..9b52d44abef1 100644
> --- a/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
> +++ b/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
> @@ -350,7 +350,6 @@ static int rt2880_pinmux_probe(struct platform_device 
> *pdev)
>   for_each_compatible_node(np, NULL, "ralink,rt2880-gpio") {
>   const __be32 *ngpio, *gpiobase;
>   struct pinctrl_gpio_range *range;
> - char *name;
>  
>   if (!of_device_is_available(np))
>   continue;
> @@ -362,9 +361,10 @@ static int rt2880_pinmux_probe(struct platform_device 
> *pdev)
>   return -EINVAL;
>   }
>  
> - range = devm_kzalloc(p->dev, sizeof(*range) + 4, GFP_KERNEL);
> - range->name = name = (char *) [1];
> - sprintf(name, "pio");
> + range = devm_kzalloc(p->dev, sizeof(*range), GFP_KERNEL);
> + if (!range)
> + return -ENOMEM;
> + range->name = "pio";
>   range->npins = __be32_to_cpu(*ngpio);
>   range->base = __be32_to_cpu(*gpiobase);
>   range->pin_base = range->base;
>   
>   
> 

Ok, I'll include it as a new patch as I think this one has already been
accepted.

Thanks for the review.

Regards,
Nishad
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: mt7621-pinctrl: Remove space after cast

2019-01-23 Thread Nishad Kamdar
This patch removes space after a cast as it
is not needed.
Issue found by checkpatch.

Signed-off-by: Nishad Kamdar 
---
 drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c 
b/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
index 80e7067cfb79..3e959fa73703 100644
--- a/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
+++ b/drivers/staging/mt7621-pinctrl/pinctrl-rt2880.c
@@ -363,7 +363,7 @@ static int rt2880_pinmux_probe(struct platform_device *pdev)
}
 
range = devm_kzalloc(p->dev, sizeof(*range) + 4, GFP_KERNEL);
-   range->name = name = (char *) [1];
+   range->name = name = (char *)[1];
sprintf(name, "pio");
range->npins = __be32_to_cpu(*ngpio);
range->base = __be32_to_cpu(*gpiobase);
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3] Staging: fbtft: Switch to the gpio descriptor interface

2019-01-16 Thread Nishad Kamdar
This switches the fbtft driver to use GPIO descriptors
rather than numerical gpios:

Utilize the GPIO library's intrinsic handling of OF GPIOs
and polarity. If the line is flagged active low, gpiolib
will deal with this.

Remove gpios from platform device structure. Neither assign
statically numbers to gpios in platform device nor allow
gpios to be parsed as module parameters.

Signed-off-by: Nishad Kamdar 
---
Changes in v3:
 - Correct the changelog position.
Changes in v2:
 - Merge all patches in a single patch. This is because the
   first patch changes par->gpio from an int to a pointer
   so all the checks have to be updated in the same patch.
   Otherwie it breaks 'git bisect'.
---
 drivers/staging/fbtft/fb_agm1264k-fl.c |  52 ++--
 drivers/staging/fbtft/fb_bd663474.c|   6 +-
 drivers/staging/fbtft/fb_ili9163.c |   6 +-
 drivers/staging/fbtft/fb_ili9320.c |   2 +-
 drivers/staging/fbtft/fb_ili9325.c |   6 +-
 drivers/staging/fbtft/fb_ili9340.c |   2 +-
 drivers/staging/fbtft/fb_pcd8544.c |   4 +-
 drivers/staging/fbtft/fb_ra8875.c  |   4 +-
 drivers/staging/fbtft/fb_s6d1121.c |   6 +-
 drivers/staging/fbtft/fb_sh1106.c  |   2 +-
 drivers/staging/fbtft/fb_ssd1289.c |   6 +-
 drivers/staging/fbtft/fb_ssd1305.c |   4 +-
 drivers/staging/fbtft/fb_ssd1306.c |   4 +-
 drivers/staging/fbtft/fb_ssd1325.c |   6 +-
 drivers/staging/fbtft/fb_ssd1331.c |  10 +-
 drivers/staging/fbtft/fb_ssd1351.c |   2 +-
 drivers/staging/fbtft/fb_tls8204.c |   6 +-
 drivers/staging/fbtft/fb_uc1611.c  |   4 +-
 drivers/staging/fbtft/fb_uc1701.c  |   6 +-
 drivers/staging/fbtft/fb_upd161704.c   |   6 +-
 drivers/staging/fbtft/fb_watterott.c   |   4 +-
 drivers/staging/fbtft/fbtft-bus.c  |   6 +-
 drivers/staging/fbtft/fbtft-core.c | 173 +++--
 drivers/staging/fbtft/fbtft-io.c   |  26 +-
 drivers/staging/fbtft/fbtft.h  |  21 +-
 drivers/staging/fbtft/fbtft_device.c   | 344 +
 drivers/staging/fbtft/flexfb.c |  12 +-
 27 files changed, 143 insertions(+), 587 deletions(-)

diff --git a/drivers/staging/fbtft/fb_agm1264k-fl.c 
b/drivers/staging/fbtft/fb_agm1264k-fl.c
index f6f30f5bf15a..8f27bd8da17d 100644
--- a/drivers/staging/fbtft/fb_agm1264k-fl.c
+++ b/drivers/staging/fbtft/fb_agm1264k-fl.c
@@ -8,7 +8,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
@@ -79,14 +79,14 @@ static int init_display(struct fbtft_par *par)
 
 static void reset(struct fbtft_par *par)
 {
-   if (par->gpio.reset == -1)
+   if (!par->gpio.reset)
return;
 
dev_dbg(par->info->device, "%s()\n", __func__);
 
-   gpio_set_value(par->gpio.reset, 0);
+   gpiod_set_value(par->gpio.reset, 0);
udelay(20);
-   gpio_set_value(par->gpio.reset, 1);
+   gpiod_set_value(par->gpio.reset, 1);
mdelay(120);
 }
 
@@ -98,30 +98,30 @@ static int verify_gpios(struct fbtft_par *par)
dev_dbg(par->info->device,
"%s()\n", __func__);
 
-   if (par->EPIN < 0) {
+   if (!par->EPIN) {
dev_err(par->info->device,
"Missing info about 'wr' (aka E) gpio. Aborting.\n");
return -EINVAL;
}
for (i = 0; i < 8; ++i) {
-   if (par->gpio.db[i] < 0) {
+   if (!par->gpio.db[i]) {
dev_err(par->info->device,
"Missing info about 'db[%i]' gpio. Aborting.\n",
i);
return -EINVAL;
}
}
-   if (par->CS0 < 0) {
+   if (!par->CS0) {
dev_err(par->info->device,
"Missing info about 'cs0' gpio. Aborting.\n");
return -EINVAL;
}
-   if (par->CS1 < 0) {
+   if (!par->CS1) {
dev_err(par->info->device,
"Missing info about 'cs1' gpio. Aborting.\n");
return -EINVAL;
}
-   if (par->RW < 0) {
+   if (!par->RW) {
dev_err(par->info->device,
"Missing info about 'rw' gpio. Aborting.\n");
return -EINVAL;
@@ -139,22 +139,22 @@ request_gpios_match(struct fbtft_par *par, const struct 
fbtft_gpio *gpio)
if (strcasecmp(gpio->name, "wr") == 0) {
/* left ks0108 E pin */
par->EPIN = gpio->gpio;
-   return GPIOF_OUT_INIT_LOW;
+   return GPIOD_OUT_LOW;
} else if (strcasecmp(gpio->name, "cs0") == 0) {
/* left ks0108 controller pin */
par->CS0 = gpio->gpio;
-   return GPIOF_OUT_INIT_HIGH;
+   return GPIOD_OUT

Re: [PATCH v2] Staging: fbtft: Switch to the gpio descriptor interface

2019-01-16 Thread Nishad Kamdar
On Tue, Jan 15, 2019 at 04:02:31PM +0100, Greg Kroah-Hartman wrote:
> On Tue, Jan 15, 2019 at 10:17:09AM +0530, Nishad Kamdar wrote:
> > This switches the fbtft driver to use GPIO descriptors
> > rather than numerical gpios:
> > 
> > Utilize the GPIO library's intrinsic handling of OF GPIOs
> > and polarity. If the line is flagged active low, gpiolib
> > will deal with this.
> > 
> > Remove gpios from platform device structure. Neither assign
> > statically numbers to gpios in platform device nor allow
> > gpios to be parsed as module parameters.
> > 
> > Signed-off-by: Nishad Kamdar 
> > Changes in v2:
> >  - Merge all patches in a single patch. This is because the
> >first patch changes par->gpio from an int to a pointer
> >so all the checks have to be updated in the same patch.
> >Otherwie it breaks 'git bisect'.
> 
> The "v2" information goes below the --- line please.
> 
> Also, I got 2 copies of this, both different, so I have no idea which to
> apply.  Please fix up and resend a v3.
> 
Sorry for the confusion. I'll fix and resend.

> thanks,
> 
> greg k-h

Thanks for the review.

Regards,
Nishad
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2] Staging: fbtft: Switch to the gpio descriptor interface

2019-01-14 Thread Nishad Kamdar
This switches the fbtft driver to use GPIO descriptors
rather than numerical gpios:

Utilize the GPIO library's intrinsic handling of OF GPIOs
and polarity. If the line is flagged active low, gpiolib
will deal with this.

Remove gpios from platform device structure. Neither assign
statically numbers to gpios in platform device nor allow
gpios to be parsed as module parameters.

Signed-off-by: Nishad Kamdar 
Changes in v2:
 - Merge all patches in a single patch. This is because the
   first patch changes par->gpio from an int to a pointer
   so all the checks have to be updated in the same patch.
   Otherwie it breaks 'git bisect'.
---
 drivers/staging/fbtft/fb_agm1264k-fl.c |  52 ++--
 drivers/staging/fbtft/fb_bd663474.c|   6 +-
 drivers/staging/fbtft/fb_ili9163.c |   6 +-
 drivers/staging/fbtft/fb_ili9320.c |   2 +-
 drivers/staging/fbtft/fb_ili9325.c |   6 +-
 drivers/staging/fbtft/fb_ili9340.c |   2 +-
 drivers/staging/fbtft/fb_pcd8544.c |   4 +-
 drivers/staging/fbtft/fb_ra8875.c  |   4 +-
 drivers/staging/fbtft/fb_s6d1121.c |   6 +-
 drivers/staging/fbtft/fb_sh1106.c  |   2 +-
 drivers/staging/fbtft/fb_ssd1289.c |   6 +-
 drivers/staging/fbtft/fb_ssd1305.c |   4 +-
 drivers/staging/fbtft/fb_ssd1306.c |   4 +-
 drivers/staging/fbtft/fb_ssd1325.c |   6 +-
 drivers/staging/fbtft/fb_ssd1331.c |  10 +-
 drivers/staging/fbtft/fb_ssd1351.c |   2 +-
 drivers/staging/fbtft/fb_tls8204.c |   6 +-
 drivers/staging/fbtft/fb_uc1611.c  |   4 +-
 drivers/staging/fbtft/fb_uc1701.c  |   6 +-
 drivers/staging/fbtft/fb_upd161704.c   |   6 +-
 drivers/staging/fbtft/fb_watterott.c   |   4 +-
 drivers/staging/fbtft/fbtft-bus.c  |   6 +-
 drivers/staging/fbtft/fbtft-core.c | 173 +++--
 drivers/staging/fbtft/fbtft-io.c   |  26 +-
 drivers/staging/fbtft/fbtft.h  |  21 +-
 drivers/staging/fbtft/fbtft_device.c   | 344 +
 drivers/staging/fbtft/flexfb.c |  12 +-
 27 files changed, 143 insertions(+), 587 deletions(-)

diff --git a/drivers/staging/fbtft/fb_agm1264k-fl.c 
b/drivers/staging/fbtft/fb_agm1264k-fl.c
index f6f30f5bf15a..8f27bd8da17d 100644
--- a/drivers/staging/fbtft/fb_agm1264k-fl.c
+++ b/drivers/staging/fbtft/fb_agm1264k-fl.c
@@ -8,7 +8,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
@@ -79,14 +79,14 @@ static int init_display(struct fbtft_par *par)
 
 static void reset(struct fbtft_par *par)
 {
-   if (par->gpio.reset == -1)
+   if (!par->gpio.reset)
return;
 
dev_dbg(par->info->device, "%s()\n", __func__);
 
-   gpio_set_value(par->gpio.reset, 0);
+   gpiod_set_value(par->gpio.reset, 0);
udelay(20);
-   gpio_set_value(par->gpio.reset, 1);
+   gpiod_set_value(par->gpio.reset, 1);
mdelay(120);
 }
 
@@ -98,30 +98,30 @@ static int verify_gpios(struct fbtft_par *par)
dev_dbg(par->info->device,
"%s()\n", __func__);
 
-   if (par->EPIN < 0) {
+   if (!par->EPIN) {
dev_err(par->info->device,
"Missing info about 'wr' (aka E) gpio. Aborting.\n");
return -EINVAL;
}
for (i = 0; i < 8; ++i) {
-   if (par->gpio.db[i] < 0) {
+   if (!par->gpio.db[i]) {
dev_err(par->info->device,
"Missing info about 'db[%i]' gpio. Aborting.\n",
i);
return -EINVAL;
}
}
-   if (par->CS0 < 0) {
+   if (!par->CS0) {
dev_err(par->info->device,
"Missing info about 'cs0' gpio. Aborting.\n");
return -EINVAL;
}
-   if (par->CS1 < 0) {
+   if (!par->CS1) {
dev_err(par->info->device,
"Missing info about 'cs1' gpio. Aborting.\n");
return -EINVAL;
}
-   if (par->RW < 0) {
+   if (!par->RW) {
dev_err(par->info->device,
"Missing info about 'rw' gpio. Aborting.\n");
return -EINVAL;
@@ -139,22 +139,22 @@ request_gpios_match(struct fbtft_par *par, const struct 
fbtft_gpio *gpio)
if (strcasecmp(gpio->name, "wr") == 0) {
/* left ks0108 E pin */
par->EPIN = gpio->gpio;
-   return GPIOF_OUT_INIT_LOW;
+   return GPIOD_OUT_LOW;
} else if (strcasecmp(gpio->name, "cs0") == 0) {
/* left ks0108 controller pin */
par->CS0 = gpio->gpio;
-   return GPIOF_OUT_INIT_HIGH;
+   return GPIOD_OUT_HIGH;
} else if (strcasecmp(gpio->name, "cs1

[PATCH v2] Staging: fbtft: Switch to the gpio descriptor interface

2019-01-14 Thread Nishad Kamdar
This switches the fbtft driver to use GPIO descriptors
rather than numerical gpios:

Utilize the GPIO library's intrinsic handling of OF GPIOs
and polarity. If the line is flagged active low, gpiolib
will deal with this.

Remove gpios from platform device structure. Neither assign
statically numbers to gpios in platform device nor allow
gpios to be parsed as module parameters.

Signed-off-by: Nishad Kamdar 
Changes in v2:
 - Merge all patches in a single patch. This is because the
   first patch changes par->gpio from an int to a pointer
   so all the checks have to be updated in the same patch.
   Otherwie it breaks 'git bisect'.
---
 drivers/staging/fbtft/fb_agm1264k-fl.c |  52 ++--
 drivers/staging/fbtft/fb_bd663474.c|   6 +-
 drivers/staging/fbtft/fb_ili9163.c |   6 +-
 drivers/staging/fbtft/fb_ili9320.c |   2 +-
 drivers/staging/fbtft/fb_ili9325.c |   6 +-
 drivers/staging/fbtft/fb_ili9340.c |   2 +-
 drivers/staging/fbtft/fb_pcd8544.c |   4 +-
 drivers/staging/fbtft/fb_ra8875.c  |   4 +-
 drivers/staging/fbtft/fb_s6d1121.c |   6 +-
 drivers/staging/fbtft/fb_sh1106.c  |   2 +-
 drivers/staging/fbtft/fb_ssd1289.c |   6 +-
 drivers/staging/fbtft/fb_ssd1305.c |   4 +-
 drivers/staging/fbtft/fb_ssd1306.c |   4 +-
 drivers/staging/fbtft/fb_ssd1325.c |   6 +-
 drivers/staging/fbtft/fb_ssd1331.c |  10 +-
 drivers/staging/fbtft/fb_ssd1351.c |   2 +-
 drivers/staging/fbtft/fb_tls8204.c |   6 +-
 drivers/staging/fbtft/fb_uc1611.c  |   4 +-
 drivers/staging/fbtft/fb_uc1701.c  |   6 +-
 drivers/staging/fbtft/fb_upd161704.c   |   6 +-
 drivers/staging/fbtft/fb_watterott.c   |   4 +-
 drivers/staging/fbtft/fbtft-bus.c  |   6 +-
 drivers/staging/fbtft/fbtft-core.c | 173 +++--
 drivers/staging/fbtft/fbtft-io.c   |  26 +-
 drivers/staging/fbtft/fbtft.h  |  21 +-
 drivers/staging/fbtft/fbtft_device.c   | 344 +
 drivers/staging/fbtft/flexfb.c |  12 +-
 27 files changed, 143 insertions(+), 587 deletions(-)

diff --git a/drivers/staging/fbtft/fb_agm1264k-fl.c 
b/drivers/staging/fbtft/fb_agm1264k-fl.c
index f6f30f5bf15a..8f27bd8da17d 100644
--- a/drivers/staging/fbtft/fb_agm1264k-fl.c
+++ b/drivers/staging/fbtft/fb_agm1264k-fl.c
@@ -8,7 +8,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
@@ -79,14 +79,14 @@ static int init_display(struct fbtft_par *par)
 
 static void reset(struct fbtft_par *par)
 {
-   if (par->gpio.reset == -1)
+   if (!par->gpio.reset)
return;
 
dev_dbg(par->info->device, "%s()\n", __func__);
 
-   gpio_set_value(par->gpio.reset, 0);
+   gpiod_set_value(par->gpio.reset, 0);
udelay(20);
-   gpio_set_value(par->gpio.reset, 1);
+   gpiod_set_value(par->gpio.reset, 1);
mdelay(120);
 }
 
@@ -98,30 +98,30 @@ static int verify_gpios(struct fbtft_par *par)
dev_dbg(par->info->device,
"%s()\n", __func__);
 
-   if (par->EPIN < 0) {
+   if (!par->EPIN) {
dev_err(par->info->device,
"Missing info about 'wr' (aka E) gpio. Aborting.\n");
return -EINVAL;
}
for (i = 0; i < 8; ++i) {
-   if (par->gpio.db[i] < 0) {
+   if (!par->gpio.db[i]) {
dev_err(par->info->device,
"Missing info about 'db[%i]' gpio. Aborting.\n",
i);
return -EINVAL;
}
}
-   if (par->CS0 < 0) {
+   if (!par->CS0) {
dev_err(par->info->device,
"Missing info about 'cs0' gpio. Aborting.\n");
return -EINVAL;
}
-   if (par->CS1 < 0) {
+   if (!par->CS1) {
dev_err(par->info->device,
"Missing info about 'cs1' gpio. Aborting.\n");
return -EINVAL;
}
-   if (par->RW < 0) {
+   if (!par->RW) {
dev_err(par->info->device,
"Missing info about 'rw' gpio. Aborting.\n");
return -EINVAL;
@@ -139,22 +139,22 @@ request_gpios_match(struct fbtft_par *par, const struct 
fbtft_gpio *gpio)
if (strcasecmp(gpio->name, "wr") == 0) {
/* left ks0108 E pin */
par->EPIN = gpio->gpio;
-   return GPIOF_OUT_INIT_LOW;
+   return GPIOD_OUT_LOW;
} else if (strcasecmp(gpio->name, "cs0") == 0) {
/* left ks0108 controller pin */
par->CS0 = gpio->gpio;
-   return GPIOF_OUT_INIT_HIGH;
+   return GPIOD_OUT_HIGH;
} else if (strcasecmp(gpio->name, "cs1

Re: [PATCH v6 0/2] greybus: gpio: Switch to the gpio descriptor interface

2019-01-14 Thread Nishad Kamdar
On Mon, Jan 14, 2019 at 10:05:17AM +0100, Johan Hovold wrote:
> On Fri, Jan 11, 2019 at 09:03:16PM +0530, Nishad Kamdar wrote:
> > This patch series converts uses of the old GPIO API to the GPIO
> > descriptor API. It also converts the GPIO driver to use the
> > GPIO irqchip library GPIOLIB_IRQCHIP instead of repimplementing
> > the same.
> > 
> > Changes in v6:
> >  - Patchset now contains two patches as the patch
> >1 has been accepted.
> 
> All three patches look good now, but since Greg picks these up directly
> and applies them to the staging tree, it is best if you submit all three
> patches (with my reviewed-by tag) in a series.
> 
Sure, I'll do that.
> One last resend as v7?
> 
> Thanks again for doing this.
> 
> Johan

Thanks for all the reviews.

Regards,
Nishad
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v7 3/3] staging: greybus: arche-platform: Switch to the gpio descriptor interface

2019-01-14 Thread Nishad Kamdar
Use the gpiod interface instead of the deprecated old non-descriptor
interface while continuing to ignore gpio flags from device tree in
"svc_reset_onoff()" for now.

Reviewed-by: Johan Hovold 
Signed-off-by: Nishad Kamdar 
---
Changes in v7:
  - No change.
Changes in v6:
  - Make error messages consistent.
Changes in v5:
  - Change the commit message.
  - Restore the names of the gpio device-tree properties without
the "-gpio" suffix.
Changes in v4:
 - Move 'gpio_desc *svc_sysboot' below the reset flag
   as it is more logical to have reset flag below
   reset gpio.
 - Remove a few unnecessary line breaks.
Changes in v3:
 - Add this patch to a patchset.
Changes in v2:
 - Move comment to the same line as to what it applies to.
---
 drivers/staging/greybus/arche-platform.c | 124 ---
 1 file changed, 41 insertions(+), 83 deletions(-)

diff --git a/drivers/staging/greybus/arche-platform.c 
b/drivers/staging/greybus/arche-platform.c
index 4c36e88766e7..6eb842040c22 100644
--- a/drivers/staging/greybus/arche-platform.c
+++ b/drivers/staging/greybus/arche-platform.c
@@ -8,10 +8,9 @@
 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -45,14 +44,14 @@ enum svc_wakedetect_state {
 
 struct arche_platform_drvdata {
/* Control GPIO signals to and from AP <=> SVC */
-   int svc_reset_gpio;
+   struct gpio_desc *svc_reset;
bool is_reset_act_hi;
-   int svc_sysboot_gpio;
-   int wake_detect_gpio; /* bi-dir,maps to WAKE_MOD & WAKE_FRAME signals */
+   struct gpio_desc *svc_sysboot;
+   struct gpio_desc *wake_detect; /* bi-dir,maps to WAKE_MOD & WAKE_FRAME 
signals */
 
enum arche_platform_state state;
 
-   int svc_refclk_req;
+   struct gpio_desc *svc_refclk_req;
struct clk *svc_ref_clk;
 
struct pinctrl *pinctrl;
@@ -85,9 +84,9 @@ static void arche_platform_set_wake_detect_state(
arche_pdata->wake_detect_state = state;
 }
 
-static inline void svc_reset_onoff(unsigned int gpio, bool onoff)
+static inline void svc_reset_onoff(struct gpio_desc *gpio, bool onoff)
 {
-   gpio_set_value(gpio, onoff);
+   gpiod_set_raw_value(gpio, onoff);
 }
 
 static int apb_cold_boot(struct device *dev, void *data)
@@ -116,7 +115,6 @@ static int apb_poweroff(struct device *dev, void *data)
 static void arche_platform_wd_irq_en(struct arche_platform_drvdata 
*arche_pdata)
 {
/* Enable interrupt here, to read event back from SVC */
-   gpio_direction_input(arche_pdata->wake_detect_gpio);
enable_irq(arche_pdata->wake_detect_irq);
 }
 
@@ -160,7 +158,7 @@ static irqreturn_t arche_platform_wd_irq(int irq, void 
*devid)
 
spin_lock_irqsave(_pdata->wake_lock, flags);
 
-   if (gpio_get_value(arche_pdata->wake_detect_gpio)) {
+   if (gpiod_get_value(arche_pdata->wake_detect)) {
/* wake/detect rising */
 
/*
@@ -224,10 +222,9 @@ arche_platform_coldboot_seq(struct arche_platform_drvdata 
*arche_pdata)
 
dev_info(arche_pdata->dev, "Booting from cold boot state\n");
 
-   svc_reset_onoff(arche_pdata->svc_reset_gpio,
-   arche_pdata->is_reset_act_hi);
+   svc_reset_onoff(arche_pdata->svc_reset, arche_pdata->is_reset_act_hi);
 
-   gpio_set_value(arche_pdata->svc_sysboot_gpio, 0);
+   gpiod_set_value(arche_pdata->svc_sysboot, 0);
usleep_range(100, 200);
 
ret = clk_prepare_enable(arche_pdata->svc_ref_clk);
@@ -238,8 +235,7 @@ arche_platform_coldboot_seq(struct arche_platform_drvdata 
*arche_pdata)
}
 
/* bring SVC out of reset */
-   svc_reset_onoff(arche_pdata->svc_reset_gpio,
-   !arche_pdata->is_reset_act_hi);
+   svc_reset_onoff(arche_pdata->svc_reset, !arche_pdata->is_reset_act_hi);
 
arche_platform_set_state(arche_pdata, ARCHE_PLATFORM_STATE_ACTIVE);
 
@@ -259,10 +255,9 @@ arche_platform_fw_flashing_seq(struct 
arche_platform_drvdata *arche_pdata)
 
dev_info(arche_pdata->dev, "Switching to FW flashing state\n");
 
-   svc_reset_onoff(arche_pdata->svc_reset_gpio,
-   arche_pdata->is_reset_act_hi);
+   svc_reset_onoff(arche_pdata->svc_reset, arche_pdata->is_reset_act_hi);
 
-   gpio_set_value(arche_pdata->svc_sysboot_gpio, 1);
+   gpiod_set_value(arche_pdata->svc_sysboot, 1);
 
usleep_range(100, 200);
 
@@ -273,8 +268,7 @@ arche_platform_fw_flashing_seq(struct 
arche_platform_drvdata *arche_pdata)
return ret;
}
 
-   svc_reset_onoff(arche_pdata->svc_reset_gpio,
-   !arche_pdata->is_reset_act_hi);
+   svc_reset_onoff(arche_pdata->svc_reset, !arche_pdata->is_reset_act_hi);
 
arche_platform_set_state(arche_pdata, ARCHE_PLATFORM_STATE_FW_FLASHI

[PATCH v7 2/3] staging: greybus: arche-apb-ctrl.c: Switch to the gpio descriptor interface

2019-01-14 Thread Nishad Kamdar
Use the gpiod interface instead of the deprecated old non-descriptor
interface while continuing to ignore gpio flags from device tree in
functions "deassert_reset()" and "assert_reset()" for now.

Reviewed-by: Johan Hovold 
Signed-off-by: Nishad Kamdar 
---
Changes in v7:
 - No change.
Changes in v6:
 - Remove some unnecessary line breaks.
Changes in v5:
 - Change the commit message.
 - Restore the names of the gpio device-tree properties without
   the "-gpio" suffix.
Changes in v4:
 - Use gpiod_set_raw_value() for deassert_reset() and
   assert_reset() as gpiod_set_value() will change the
   sematics of these calls by taking any gpio flags
   into account.
 - Remove some unnecesssary line breaks.
 - Restore 'spi_en' gpio check in fw_flashing_seq()
   as it is currently optional.
Changes in v3:
 - Add this patch in a patchset.
Changes in v2:
 - Resolved compilation errors.
---
 drivers/staging/greybus/arche-apb-ctrl.c | 152 +--
 1 file changed, 61 insertions(+), 91 deletions(-)

diff --git a/drivers/staging/greybus/arche-apb-ctrl.c 
b/drivers/staging/greybus/arche-apb-ctrl.c
index be5ffed90bcf..bbf3ba744fc4 100644
--- a/drivers/staging/greybus/arche-apb-ctrl.c
+++ b/drivers/staging/greybus/arche-apb-ctrl.c
@@ -8,9 +8,8 @@
 
 #include 
 #include 
-#include 
+#include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -24,12 +23,12 @@ static void apb_bootret_deassert(struct device *dev);
 
 struct arche_apb_ctrl_drvdata {
/* Control GPIO signals to and from AP <=> AP Bridges */
-   int resetn_gpio;
-   int boot_ret_gpio;
-   int pwroff_gpio;
-   int wake_in_gpio;
-   int wake_out_gpio;
-   int pwrdn_gpio;
+   struct gpio_desc *resetn;
+   struct gpio_desc *boot_ret;
+   struct gpio_desc *pwroff;
+   struct gpio_desc *wake_in;
+   struct gpio_desc *wake_out;
+   struct gpio_desc *pwrdn;
 
enum arche_platform_state state;
bool init_disabled;
@@ -37,28 +36,28 @@ struct arche_apb_ctrl_drvdata {
struct regulator *vcore;
struct regulator *vio;
 
-   int clk_en_gpio;
+   struct gpio_desc *clk_en;
struct clk *clk;
 
struct pinctrl *pinctrl;
struct pinctrl_state *pin_default;
 
/* V2: SPI Bus control  */
-   int spi_en_gpio;
+   struct gpio_desc *spi_en;
bool spi_en_polarity_high;
 };
 
 /*
  * Note that these low level api's are active high
  */
-static inline void deassert_reset(unsigned int gpio)
+static inline void deassert_reset(struct gpio_desc *gpio)
 {
-   gpio_set_value(gpio, 1);
+   gpiod_set_raw_value(gpio, 1);
 }
 
-static inline void assert_reset(unsigned int gpio)
+static inline void assert_reset(struct gpio_desc *gpio)
 {
-   gpio_set_value(gpio, 0);
+   gpiod_set_raw_value(gpio, 0);
 }
 
 /*
@@ -75,11 +74,10 @@ static int coldboot_seq(struct platform_device *pdev)
return 0;
 
/* Hold APB in reset state */
-   assert_reset(apb->resetn_gpio);
+   assert_reset(apb->resetn);
 
-   if (apb->state == ARCHE_PLATFORM_STATE_FW_FLASHING &&
-   gpio_is_valid(apb->spi_en_gpio))
-   devm_gpio_free(dev, apb->spi_en_gpio);
+   if (apb->state == ARCHE_PLATFORM_STATE_FW_FLASHING && apb->spi_en)
+   devm_gpiod_put(dev, apb->spi_en);
 
/* Enable power to APB */
if (!IS_ERR(apb->vcore)) {
@@ -101,13 +99,13 @@ static int coldboot_seq(struct platform_device *pdev)
apb_bootret_deassert(dev);
 
/* On DB3 clock was not mandatory */
-   if (gpio_is_valid(apb->clk_en_gpio))
-   gpio_set_value(apb->clk_en_gpio, 1);
+   if (apb->clk_en)
+   gpiod_set_value(apb->clk_en, 1);
 
usleep_range(100, 200);
 
/* deassert reset to APB : Active-low signal */
-   deassert_reset(apb->resetn_gpio);
+   deassert_reset(apb->resetn);
 
apb->state = ARCHE_PLATFORM_STATE_ACTIVE;
 
@@ -136,25 +134,25 @@ static int fw_flashing_seq(struct platform_device *pdev)
return ret;
}
 
-   if (gpio_is_valid(apb->spi_en_gpio)) {
+   if (apb->spi_en) {
unsigned long flags;
 
if (apb->spi_en_polarity_high)
-   flags = GPIOF_OUT_INIT_HIGH;
+   flags = GPIOD_OUT_HIGH;
else
-   flags = GPIOF_OUT_INIT_LOW;
+   flags = GPIOD_OUT_LOW;
 
-   ret = devm_gpio_request_one(dev, apb->spi_en_gpio,
-   flags, "apb_spi_en");
-   if (ret) {
-   dev_err(dev, "Failed requesting SPI bus en gpio %d\n",
-   apb->spi_en_gpio);
+   apb->spi_en = devm_gpiod_get(dev, "spi-en", flags);
+   if (IS_E

[PATCH v7 1/3] staging: greybus: gpio: switch GPIO portions to use GPIOLIB_IRQCHIP

2019-01-14 Thread Nishad Kamdar
Convert the GPIO driver to use the GPIO irqchip library
GPIOLIB_IRQCHIP instead of reimplementing the same.

Reviewed-by: Johan Hovold 
Signed-off-by: Nishad Kamdar 
---
Changes in v7:
 - No change.
Changes in v5:
 - Restore "struct irq_chip irqc" in "struct gb_gpio_controller"
   This is because we cannot use the gpio-chip irqchip, as that
   will register the irqchip automatically and possibly in an
   incompatible way.
Changes in v4:
 - Remove changes related to conversion to gpiochip_get_data() to
   include it as a new patch.
 - Remove the 'struct irq_chip' field from 'struct gb_gpio_controller'
   as struct gpio_chip will have an irqchip whenever
   CONFIG_GPIOLIB_IRQCHIP is selected.
 - Update the TODO file as per the changes.
Changes in v3:
 - Combine patches as into a patch series.
Changes in v2:
 - Retained irq.h and irqdomain.h headers.
 - Dropped function gb_gpio_irqchip_add() and
   called gpiochip_irqchip_add() from probe().
 - Referred 
https://lkml.kernel.org/r/1476054589-28422-1-git-send-email-linus.wall...@linaro.org.
---
 drivers/staging/greybus/Kconfig |   1 +
 drivers/staging/greybus/TODO|   2 -
 drivers/staging/greybus/gpio.c  | 156 ++--
 3 files changed, 11 insertions(+), 148 deletions(-)

diff --git a/drivers/staging/greybus/Kconfig b/drivers/staging/greybus/Kconfig
index ab096bcef98c..b571e4e8060b 100644
--- a/drivers/staging/greybus/Kconfig
+++ b/drivers/staging/greybus/Kconfig
@@ -148,6 +148,7 @@ if GREYBUS_BRIDGED_PHY
 config GREYBUS_GPIO
tristate "Greybus GPIO Bridged PHY driver"
depends on GPIOLIB
+   select GPIOLIB_IRQCHIP
---help---
  Select this option if you have a device that follows the
  Greybus GPIO Bridged PHY Class specification.
diff --git a/drivers/staging/greybus/TODO b/drivers/staging/greybus/TODO
index 3b90a5711998..31f1f2cb401c 100644
--- a/drivers/staging/greybus/TODO
+++ b/drivers/staging/greybus/TODO
@@ -1,5 +1,3 @@
 * Convert all uses of the old GPIO API from  to the
   GPIO descriptor API in  and look up GPIO
   lines from device tree or ACPI.
-* Convert the GPIO driver to use the GPIO irqchip library
-  GPIOLIB_IRQCHIP instead of reimplementing the same.
diff --git a/drivers/staging/greybus/gpio.c b/drivers/staging/greybus/gpio.c
index e110681e6f86..3151004d26fb 100644
--- a/drivers/staging/greybus/gpio.c
+++ b/drivers/staging/greybus/gpio.c
@@ -9,9 +9,9 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
+#include 
 #include 
 
 #include "greybus.h"
@@ -39,11 +39,6 @@ struct gb_gpio_controller {
 
struct gpio_chipchip;
struct irq_chip irqc;
-   struct irq_chip *irqchip;
-   struct irq_domain   *irqdomain;
-   unsigned intirq_base;
-   irq_flow_handler_t  irq_handler;
-   unsigned intirq_default_type;
struct mutexirq_lock;
 };
 #define gpio_chip_to_gb_gpio_controller(chip) \
@@ -391,7 +386,7 @@ static int gb_gpio_request_handler(struct gb_operation *op)
return -EINVAL;
}
 
-   irq = irq_find_mapping(ggc->irqdomain, event->which);
+   irq = irq_find_mapping(ggc->chip.irq.domain, event->which);
if (!irq) {
dev_err(dev, "failed to find IRQ\n");
return -EINVAL;
@@ -506,135 +501,6 @@ static int gb_gpio_controller_setup(struct 
gb_gpio_controller *ggc)
return ret;
 }
 
-/**
- * gb_gpio_irq_map() - maps an IRQ into a GB gpio irqchip
- * @d: the irqdomain used by this irqchip
- * @irq: the global irq number used by this GB gpio irqchip irq
- * @hwirq: the local IRQ/GPIO line offset on this GB gpio
- *
- * This function will set up the mapping for a certain IRQ line on a
- * GB gpio by assigning the GB gpio as chip data, and using the irqchip
- * stored inside the GB gpio.
- */
-static int gb_gpio_irq_map(struct irq_domain *domain, unsigned int irq,
-  irq_hw_number_t hwirq)
-{
-   struct gpio_chip *chip = domain->host_data;
-   struct gb_gpio_controller *ggc = gpio_chip_to_gb_gpio_controller(chip);
-
-   irq_set_chip_data(irq, ggc);
-   irq_set_chip_and_handler(irq, ggc->irqchip, ggc->irq_handler);
-   irq_set_noprobe(irq);
-   /*
-* No set-up of the hardware will happen if IRQ_TYPE_NONE
-* is passed as default type.
-*/
-   if (ggc->irq_default_type != IRQ_TYPE_NONE)
-   irq_set_irq_type(irq, ggc->irq_default_type);
-
-   return 0;
-}
-
-static void gb_gpio_irq_unmap(struct irq_domain *d, unsigned int irq)
-{
-   irq_set_chip_and_handler(irq, NULL, NULL);
-   irq_set_chip_data(irq, NULL);
-}
-
-static const struct irq_domain_ops gb_gpio_domain_ops = {
-   .map= gb_gpio_irq_map,
-   .unmap  = gb_gpio_irq_unmap,
-};
-
-/**
- * gb_gpio_irqchip_remove() - removes an irqchip added to a g

[PATCH v7 0/3] greybus: gpio: Switch to the gpio descriptor interface

2019-01-14 Thread Nishad Kamdar
This patch series converts uses of the old GPIO API to the GPIO
descriptor API. It also converts the GPIO driver to use the
GPIO irqchip library GPIOLIB_IRQCHIP instead of repimplementing
the same.

Chnages in v7:
 - Combine the three patches together.
Changes in v6:
 - Patchset now contains two patches as the patch
   1 has been accepted.
 - Changes mentioned in individual patches of the set.
Changes in v5:
 - Drop the patch which uses gpiochip_get_data() in place of
   gpio_chip_to_gb_gpio_controller() as of now.
 - This is because it currently breaks the driver, since
   gpiochip_add() sets the data pointer to NULL.  
Changes in v4:
 - Changes mentioned in individual patches of the set.
Changes in v3:
 - Combines the latest versions of the three greybus patches together
   in a patch series.

Nishad Kamdar (3):
  staging: greybus: gpio: switch GPIO portions to use GPIOLIB_IRQCHIP
  staging: greybus: arche-apb-ctrl.c: Switch to the gpio descriptor
interface
  staging: greybus: arche-platform: Switch to the gpio descriptor
interface

 drivers/staging/greybus/Kconfig  |   1 +
 drivers/staging/greybus/TODO |   2 -
 drivers/staging/greybus/arche-apb-ctrl.c | 152 +-
 drivers/staging/greybus/arche-platform.c | 124 ++
 drivers/staging/greybus/gpio.c   | 156 ++-
 5 files changed, 113 insertions(+), 322 deletions(-)

-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v5 2/3] staging: greybus: arche-apb-ctrl.c: Switch to the gpio descriptor interface

2019-01-13 Thread Nishad Kamdar
On Fri, Jan 11, 2019 at 09:41:34AM +0100, Johan Hovold wrote:
> On Thu, Jan 10, 2019 at 11:21:04PM +0530, Nishad Kamdar wrote:
> > Use the gpiod interface instead of the deprecated old non-descriptor
> > interface while continuing to ignore gpio flags from device tree in
> > functions "deassert_reset()" and "assert_reset()" for now.
> > 
> > Signed-off-by: Nishad Kamdar 
> > ---
> > Changes in v5:
> >  - Change the commit message.
> >  - Restore the names of the gpio device-tree properties without
> >the "-gpio" suffix.
> > Changes in v4:
> >  - Use gpiod_set_raw_value() for deassert_reset() and
> >assert_reset() as gpiod_set_value() will change the
> >sematics of these calls by taking any gpio flags
> >into account.
> >  - Remove some unnecesssary line breaks.
> >  - Restore 'spi_en' gpio check in fw_flashing_seq()
> >as it is currently optional.
> > Changes in v3:
> >  - Add this patch in a patchset.
> > Changes in v2:
> >  - Resolved compilation errors.
> > ---
> 
> Also looks good now. You can add my
> 
> Reviewed-by: Johan Hovold 
> 
> Found one really minor nit below, which doesn't really need to be fixed,
> but since you may need to update the third patch, you might as well
> consider this too.
> 
Ok, I'll do that.
> > /* It's not mandatory to support power management interface */
> > -   apb->pwroff_gpio = of_get_named_gpio(np, "pwr-off-gpios", 0);
> > -   if (apb->pwroff_gpio < 0) {
> > -   dev_err(dev, "failed to get power off gpio\n");
> > -   return apb->pwroff_gpio;
> > -   }
> > -   ret = devm_gpio_request_one(dev, apb->pwroff_gpio,
> > -   GPIOF_IN, "pwroff_n");
> > -   if (ret) {
> > -   dev_err(dev, "Failed requesting pwroff_n gpio %d\n",
> > -   apb->pwroff_gpio);
> > +   apb->pwroff = devm_gpiod_get_optional(dev, "pwr-off",
> > + GPIOD_IN);
> 
> Looks like you don't need to break the above statement any more either.
> 
> > +   if (IS_ERR(apb->pwroff)) {
> > +   ret = PTR_ERR(apb->pwroff);
> > +   dev_err(dev, "Failed requesting pwroff_n GPIO: %d\n", ret);
> > return ret;
> > }
> >  
> > /* Do not make clock mandatory as of now (for DB3) */
> > -   apb->clk_en_gpio = of_get_named_gpio(np, "clock-en-gpio", 0);
> > -   if (apb->clk_en_gpio < 0) {
> > -   dev_warn(dev, "failed to get clock en gpio\n");
> > -   } else if (gpio_is_valid(apb->clk_en_gpio)) {
> > -   ret = devm_gpio_request_one(dev, apb->clk_en_gpio,
> > -   GPIOF_OUT_INIT_LOW, "apb_clk_en");
> > -   if (ret) {
> > -   dev_warn(dev, "Failed requesting APB clock en gpio 
> > %d\n",
> > -apb->clk_en_gpio);
> > -   return ret;
> > -   }
> > +   apb->clk_en = devm_gpiod_get_optional(dev, "clock-en",
> > + GPIOD_OUT_LOW);
> 
> Same here?
> 
Ok, I'll do that.

Thanks and regards,
Nishad
> > +   if (IS_ERR(apb->clk_en)) {
> > +   ret = PTR_ERR(apb->clk_en);
> > +   dev_err(dev, "Failed requesting APB clock en GPIO: %d\n", ret);
> > +   return ret;
> > }
> 
> Johan
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v5 3/3] staging: greybus: arche-platform: Switch to the gpio descriptor interface

2019-01-13 Thread Nishad Kamdar
On Fri, Jan 11, 2019 at 09:48:21AM +0100, Johan Hovold wrote:
> On Thu, Jan 10, 2019 at 11:23:07PM +0530, Nishad Kamdar wrote:
> > Use the gpiod interface instead of the deprecated old non-descriptor
> > interface while continuing to ignore gpio flags from device tree in
> > "svc_reset_onoff()" for now.
> > 
> > Signed-off-by: Nishad Kamdar 
> > ---
> > Changes in v5:
> >   - Change the commit message.
> >   - Restore the names of the gpio device-tree properties without
> > the "-gpio" suffix.
> > Changes in v4:
> >  - Move 'gpio_desc *svc_sysboot' below the reset flag
> >as it is more logical to have reset flag below
> >reset gpio.
> >  - Remove a few unnecessary line breaks.
> > Changes in v3:
> >  - Add this patch to a patchset.
> > Changes in v2:
> >  - Move comment to the same line as to what it applies to.
> > ---
> 
> Also looks good. Some really minor comments to a couple of the error
> messages. The issues are there in the current code, but since you modify
> these messages anyway you might as well fix them up. Please fix that and
> resend with my
> 
> Reviewed-by: Johan Hovold 
> 
Ok, I'll do that.

> Really good job with this!
> 
Thank you.
> > @@ -435,6 +428,7 @@ static int arche_platform_probe(struct platform_device 
> > *pdev)
> > struct device *dev = >dev;
> > struct device_node *np = dev->of_node;
> > int ret;
> > +   unsigned int flags;
> >  
> > arche_pdata = devm_kzalloc(>dev, sizeof(*arche_pdata),
> >GFP_KERNEL);
> > @@ -444,61 +438,33 @@ static int arche_platform_probe(struct 
> > platform_device *pdev)
> > /* setup svc reset gpio */
> > arche_pdata->is_reset_act_hi = of_property_read_bool(np,
> >  
> > "svc,reset-active-high");
> > -   arche_pdata->svc_reset_gpio = of_get_named_gpio(np,
> > -   "svc,reset-gpio",
> > -   0);
> > -   if (!gpio_is_valid(arche_pdata->svc_reset_gpio)) {
> > -   dev_err(dev, "failed to get reset-gpio\n");
> > -   return arche_pdata->svc_reset_gpio;
> > -   }
> > -   ret = devm_gpio_request(dev, arche_pdata->svc_reset_gpio, "svc-reset");
> > -   if (ret) {
> > -   dev_err(dev, "failed to request svc-reset gpio:%d\n", ret);
> > -   return ret;
> > -   }
> > -   ret = gpio_direction_output(arche_pdata->svc_reset_gpio,
> > -   arche_pdata->is_reset_act_hi);
> > -   if (ret) {
> > -   dev_err(dev, "failed to set svc-reset gpio dir:%d\n", ret);
> > +   if (arche_pdata->is_reset_act_hi)
> > +   flags = GPIOD_OUT_HIGH;
> > +   else
> > +   flags = GPIOD_OUT_LOW;
> > +
> > +   arche_pdata->svc_reset = devm_gpiod_get(dev, "svc,reset", flags);
> > +   if (IS_ERR(arche_pdata->svc_reset)) {
> > +   ret = PTR_ERR(arche_pdata->svc_reset);
> > +   dev_err(dev, "failed to request svc-reset GPIO:%d\n", ret);
> 
> Add a space after ':' for consistency.
> 
Ok. I'll do that.
> > @@ -515,19 +481,11 @@ static int arche_platform_probe(struct 
> > platform_device *pdev)
> > arche_pdata->num_apbs = of_get_child_count(np);
> > dev_dbg(dev, "Number of APB's available - %d\n", arche_pdata->num_apbs);
> >  
> > -   arche_pdata->wake_detect_gpio = of_get_named_gpio(np,
> > - 
> > "svc,wake-detect-gpio",
> > - 0);
> > -   if (arche_pdata->wake_detect_gpio < 0) {
> > -   dev_err(dev, "failed to get wake detect gpio\n");
> > -   return arche_pdata->wake_detect_gpio;
> > -   }
> > -
> > -   ret = devm_gpio_request(dev, arche_pdata->wake_detect_gpio,
> > -   "wake detect");
> > -   if (ret) {
> > -   dev_err(dev, "Failed requesting wake_detect gpio %d\n",
> > -   arche_pdata->wake_detect_gpio);
> > +   arche_pdata->wake_detect = devm_gpiod_get(dev, "svc,wake-detect",
> > + GPIOD_IN);
> > +   if (IS_ERR(arche_pdata->wake_detect)) {
> > +   ret = PTR_ERR(arche_pdata->wake_detect);
> > +   dev_err(dev, "Failed requesting wake_detect GPIO %d\n", ret);
> 
> Add colon after "GPIO" for consistency (and to avoid ambiguity).
> 

Ok, I'll do that.

Thanks for the review,
Nishad
> > return ret;
> > }
> 
> Thanks,
> Johan
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v6 2/2] staging: greybus: arche-platform: Switch to the gpio descriptor interface

2019-01-11 Thread Nishad Kamdar
Use the gpiod interface instead of the deprecated old non-descriptor
interface while continuing to ignore gpio flags from device tree in
"svc_reset_onoff()" for now.

Reviewed-by: Johan Hovold 
Signed-off-by: Nishad Kamdar 
---
Changes in v6:
  - Make error messages consistent.
Changes in v5:
  - Change the commit message.
  - Restore the names of the gpio device-tree properties without
the "-gpio" suffix.
Changes in v4:
 - Move 'gpio_desc *svc_sysboot' below the reset flag
   as it is more logical to have reset flag below
   reset gpio.
 - Remove a few unnecessary line breaks.
Changes in v3:
 - Add this patch to a patchset.
Changes in v2:
 - Move comment to the same line as to what it applies to.
---
 drivers/staging/greybus/arche-platform.c | 124 ---
 1 file changed, 41 insertions(+), 83 deletions(-)

diff --git a/drivers/staging/greybus/arche-platform.c 
b/drivers/staging/greybus/arche-platform.c
index 4c36e88766e7..6eb842040c22 100644
--- a/drivers/staging/greybus/arche-platform.c
+++ b/drivers/staging/greybus/arche-platform.c
@@ -8,10 +8,9 @@
 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -45,14 +44,14 @@ enum svc_wakedetect_state {
 
 struct arche_platform_drvdata {
/* Control GPIO signals to and from AP <=> SVC */
-   int svc_reset_gpio;
+   struct gpio_desc *svc_reset;
bool is_reset_act_hi;
-   int svc_sysboot_gpio;
-   int wake_detect_gpio; /* bi-dir,maps to WAKE_MOD & WAKE_FRAME signals */
+   struct gpio_desc *svc_sysboot;
+   struct gpio_desc *wake_detect; /* bi-dir,maps to WAKE_MOD & WAKE_FRAME 
signals */
 
enum arche_platform_state state;
 
-   int svc_refclk_req;
+   struct gpio_desc *svc_refclk_req;
struct clk *svc_ref_clk;
 
struct pinctrl *pinctrl;
@@ -85,9 +84,9 @@ static void arche_platform_set_wake_detect_state(
arche_pdata->wake_detect_state = state;
 }
 
-static inline void svc_reset_onoff(unsigned int gpio, bool onoff)
+static inline void svc_reset_onoff(struct gpio_desc *gpio, bool onoff)
 {
-   gpio_set_value(gpio, onoff);
+   gpiod_set_raw_value(gpio, onoff);
 }
 
 static int apb_cold_boot(struct device *dev, void *data)
@@ -116,7 +115,6 @@ static int apb_poweroff(struct device *dev, void *data)
 static void arche_platform_wd_irq_en(struct arche_platform_drvdata 
*arche_pdata)
 {
/* Enable interrupt here, to read event back from SVC */
-   gpio_direction_input(arche_pdata->wake_detect_gpio);
enable_irq(arche_pdata->wake_detect_irq);
 }
 
@@ -160,7 +158,7 @@ static irqreturn_t arche_platform_wd_irq(int irq, void 
*devid)
 
spin_lock_irqsave(_pdata->wake_lock, flags);
 
-   if (gpio_get_value(arche_pdata->wake_detect_gpio)) {
+   if (gpiod_get_value(arche_pdata->wake_detect)) {
/* wake/detect rising */
 
/*
@@ -224,10 +222,9 @@ arche_platform_coldboot_seq(struct arche_platform_drvdata 
*arche_pdata)
 
dev_info(arche_pdata->dev, "Booting from cold boot state\n");
 
-   svc_reset_onoff(arche_pdata->svc_reset_gpio,
-   arche_pdata->is_reset_act_hi);
+   svc_reset_onoff(arche_pdata->svc_reset, arche_pdata->is_reset_act_hi);
 
-   gpio_set_value(arche_pdata->svc_sysboot_gpio, 0);
+   gpiod_set_value(arche_pdata->svc_sysboot, 0);
usleep_range(100, 200);
 
ret = clk_prepare_enable(arche_pdata->svc_ref_clk);
@@ -238,8 +235,7 @@ arche_platform_coldboot_seq(struct arche_platform_drvdata 
*arche_pdata)
}
 
/* bring SVC out of reset */
-   svc_reset_onoff(arche_pdata->svc_reset_gpio,
-   !arche_pdata->is_reset_act_hi);
+   svc_reset_onoff(arche_pdata->svc_reset, !arche_pdata->is_reset_act_hi);
 
arche_platform_set_state(arche_pdata, ARCHE_PLATFORM_STATE_ACTIVE);
 
@@ -259,10 +255,9 @@ arche_platform_fw_flashing_seq(struct 
arche_platform_drvdata *arche_pdata)
 
dev_info(arche_pdata->dev, "Switching to FW flashing state\n");
 
-   svc_reset_onoff(arche_pdata->svc_reset_gpio,
-   arche_pdata->is_reset_act_hi);
+   svc_reset_onoff(arche_pdata->svc_reset, arche_pdata->is_reset_act_hi);
 
-   gpio_set_value(arche_pdata->svc_sysboot_gpio, 1);
+   gpiod_set_value(arche_pdata->svc_sysboot, 1);
 
usleep_range(100, 200);
 
@@ -273,8 +268,7 @@ arche_platform_fw_flashing_seq(struct 
arche_platform_drvdata *arche_pdata)
return ret;
}
 
-   svc_reset_onoff(arche_pdata->svc_reset_gpio,
-   !arche_pdata->is_reset_act_hi);
+   svc_reset_onoff(arche_pdata->svc_reset, !arche_pdata->is_reset_act_hi);
 
arche_platform_set_state(arche_pdata, ARCHE_PLATFORM_STATE_FW_FLASHING);
 
@@ -305,8 +299,7 @@ arche_pla

[PATCH v6 1/2] staging: greybus: arche-apb-ctrl.c: Switch to the gpio descriptor interface

2019-01-11 Thread Nishad Kamdar
Use the gpiod interface instead of the deprecated old non-descriptor
interface while continuing to ignore gpio flags from device tree in
functions "deassert_reset()" and "assert_reset()" for now.

Reviewed-by: Johan Hovold 
Signed-off-by: Nishad Kamdar 
---
Changes in v6:
 - Remove some unnecessary line breaks.
Changes in v5:
 - Change the commit message.
 - Restore the names of the gpio device-tree properties without
   the "-gpio" suffix.
Changes in v4:
 - Use gpiod_set_raw_value() for deassert_reset() and
   assert_reset() as gpiod_set_value() will change the
   sematics of these calls by taking any gpio flags
   into account.
 - Remove some unnecesssary line breaks.
 - Restore 'spi_en' gpio check in fw_flashing_seq()
   as it is currently optional.
Changes in v3:
 - Add this patch in a patchset.
Changes in v2:
 - Resolved compilation errors.
---
 drivers/staging/greybus/arche-apb-ctrl.c | 152 +--
 1 file changed, 61 insertions(+), 91 deletions(-)

diff --git a/drivers/staging/greybus/arche-apb-ctrl.c 
b/drivers/staging/greybus/arche-apb-ctrl.c
index be5ffed90bcf..bbf3ba744fc4 100644
--- a/drivers/staging/greybus/arche-apb-ctrl.c
+++ b/drivers/staging/greybus/arche-apb-ctrl.c
@@ -8,9 +8,8 @@
 
 #include 
 #include 
-#include 
+#include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -24,12 +23,12 @@ static void apb_bootret_deassert(struct device *dev);
 
 struct arche_apb_ctrl_drvdata {
/* Control GPIO signals to and from AP <=> AP Bridges */
-   int resetn_gpio;
-   int boot_ret_gpio;
-   int pwroff_gpio;
-   int wake_in_gpio;
-   int wake_out_gpio;
-   int pwrdn_gpio;
+   struct gpio_desc *resetn;
+   struct gpio_desc *boot_ret;
+   struct gpio_desc *pwroff;
+   struct gpio_desc *wake_in;
+   struct gpio_desc *wake_out;
+   struct gpio_desc *pwrdn;
 
enum arche_platform_state state;
bool init_disabled;
@@ -37,28 +36,28 @@ struct arche_apb_ctrl_drvdata {
struct regulator *vcore;
struct regulator *vio;
 
-   int clk_en_gpio;
+   struct gpio_desc *clk_en;
struct clk *clk;
 
struct pinctrl *pinctrl;
struct pinctrl_state *pin_default;
 
/* V2: SPI Bus control  */
-   int spi_en_gpio;
+   struct gpio_desc *spi_en;
bool spi_en_polarity_high;
 };
 
 /*
  * Note that these low level api's are active high
  */
-static inline void deassert_reset(unsigned int gpio)
+static inline void deassert_reset(struct gpio_desc *gpio)
 {
-   gpio_set_value(gpio, 1);
+   gpiod_set_raw_value(gpio, 1);
 }
 
-static inline void assert_reset(unsigned int gpio)
+static inline void assert_reset(struct gpio_desc *gpio)
 {
-   gpio_set_value(gpio, 0);
+   gpiod_set_raw_value(gpio, 0);
 }
 
 /*
@@ -75,11 +74,10 @@ static int coldboot_seq(struct platform_device *pdev)
return 0;
 
/* Hold APB in reset state */
-   assert_reset(apb->resetn_gpio);
+   assert_reset(apb->resetn);
 
-   if (apb->state == ARCHE_PLATFORM_STATE_FW_FLASHING &&
-   gpio_is_valid(apb->spi_en_gpio))
-   devm_gpio_free(dev, apb->spi_en_gpio);
+   if (apb->state == ARCHE_PLATFORM_STATE_FW_FLASHING && apb->spi_en)
+   devm_gpiod_put(dev, apb->spi_en);
 
/* Enable power to APB */
if (!IS_ERR(apb->vcore)) {
@@ -101,13 +99,13 @@ static int coldboot_seq(struct platform_device *pdev)
apb_bootret_deassert(dev);
 
/* On DB3 clock was not mandatory */
-   if (gpio_is_valid(apb->clk_en_gpio))
-   gpio_set_value(apb->clk_en_gpio, 1);
+   if (apb->clk_en)
+   gpiod_set_value(apb->clk_en, 1);
 
usleep_range(100, 200);
 
/* deassert reset to APB : Active-low signal */
-   deassert_reset(apb->resetn_gpio);
+   deassert_reset(apb->resetn);
 
apb->state = ARCHE_PLATFORM_STATE_ACTIVE;
 
@@ -136,25 +134,25 @@ static int fw_flashing_seq(struct platform_device *pdev)
return ret;
}
 
-   if (gpio_is_valid(apb->spi_en_gpio)) {
+   if (apb->spi_en) {
unsigned long flags;
 
if (apb->spi_en_polarity_high)
-   flags = GPIOF_OUT_INIT_HIGH;
+   flags = GPIOD_OUT_HIGH;
else
-   flags = GPIOF_OUT_INIT_LOW;
+   flags = GPIOD_OUT_LOW;
 
-   ret = devm_gpio_request_one(dev, apb->spi_en_gpio,
-   flags, "apb_spi_en");
-   if (ret) {
-   dev_err(dev, "Failed requesting SPI bus en gpio %d\n",
-   apb->spi_en_gpio);
+   apb->spi_en = devm_gpiod_get(dev, "spi-en", flags);
+   if (IS_E

[PATCH v6 0/2] greybus: gpio: Switch to the gpio descriptor interface

2019-01-11 Thread Nishad Kamdar
This patch series converts uses of the old GPIO API to the GPIO
descriptor API. It also converts the GPIO driver to use the
GPIO irqchip library GPIOLIB_IRQCHIP instead of repimplementing
the same.

Changes in v6:
 - Patchset now contains two patches as the patch
   1 has been accepted.
 - Changes mentioned in individual patches of the set.
Changes in v5:
 - Drop the patch which uses gpiochip_get_data() in place of
   gpio_chip_to_gb_gpio_controller() as of now.
 - This is because it currently breaks the driver, since
   gpiochip_add() sets the data pointer to NULL.  
Changes in v4:
 - Changes mentioned in individual patches of the set.
Changes in v3:
 - Combines the latest versions of the three greybus patches together
   in a patch series.

Nishad Kamdar (2):
  staging: greybus: arche-apb-ctrl.c: Switch to the gpio descriptor
interface
  staging: greybus: arche-platform: Switch to the gpio descriptor
interface

 drivers/staging/greybus/arche-apb-ctrl.c | 152 +--
 drivers/staging/greybus/arche-platform.c | 124 ++
 2 files changed, 102 insertions(+), 174 deletions(-)

-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v5 3/3] staging: greybus: arche-platform: Switch to the gpio descriptor interface

2019-01-10 Thread Nishad Kamdar
Use the gpiod interface instead of the deprecated old non-descriptor
interface while continuing to ignore gpio flags from device tree in
"svc_reset_onoff()" for now.

Signed-off-by: Nishad Kamdar 
---
Changes in v5:
  - Change the commit message.
  - Restore the names of the gpio device-tree properties without
the "-gpio" suffix.
Changes in v4:
 - Move 'gpio_desc *svc_sysboot' below the reset flag
   as it is more logical to have reset flag below
   reset gpio.
 - Remove a few unnecessary line breaks.
Changes in v3:
 - Add this patch to a patchset.
Changes in v2:
 - Move comment to the same line as to what it applies to.
---
 drivers/staging/greybus/arche-platform.c | 124 ---
 1 file changed, 41 insertions(+), 83 deletions(-)

diff --git a/drivers/staging/greybus/arche-platform.c 
b/drivers/staging/greybus/arche-platform.c
index 4c36e88766e7..77ac474e2423 100644
--- a/drivers/staging/greybus/arche-platform.c
+++ b/drivers/staging/greybus/arche-platform.c
@@ -8,10 +8,9 @@
 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -45,14 +44,14 @@ enum svc_wakedetect_state {
 
 struct arche_platform_drvdata {
/* Control GPIO signals to and from AP <=> SVC */
-   int svc_reset_gpio;
+   struct gpio_desc *svc_reset;
bool is_reset_act_hi;
-   int svc_sysboot_gpio;
-   int wake_detect_gpio; /* bi-dir,maps to WAKE_MOD & WAKE_FRAME signals */
+   struct gpio_desc *svc_sysboot;
+   struct gpio_desc *wake_detect; /* bi-dir,maps to WAKE_MOD & WAKE_FRAME 
signals */
 
enum arche_platform_state state;
 
-   int svc_refclk_req;
+   struct gpio_desc *svc_refclk_req;
struct clk *svc_ref_clk;
 
struct pinctrl *pinctrl;
@@ -85,9 +84,9 @@ static void arche_platform_set_wake_detect_state(
arche_pdata->wake_detect_state = state;
 }
 
-static inline void svc_reset_onoff(unsigned int gpio, bool onoff)
+static inline void svc_reset_onoff(struct gpio_desc *gpio, bool onoff)
 {
-   gpio_set_value(gpio, onoff);
+   gpiod_set_raw_value(gpio, onoff);
 }
 
 static int apb_cold_boot(struct device *dev, void *data)
@@ -116,7 +115,6 @@ static int apb_poweroff(struct device *dev, void *data)
 static void arche_platform_wd_irq_en(struct arche_platform_drvdata 
*arche_pdata)
 {
/* Enable interrupt here, to read event back from SVC */
-   gpio_direction_input(arche_pdata->wake_detect_gpio);
enable_irq(arche_pdata->wake_detect_irq);
 }
 
@@ -160,7 +158,7 @@ static irqreturn_t arche_platform_wd_irq(int irq, void 
*devid)
 
spin_lock_irqsave(_pdata->wake_lock, flags);
 
-   if (gpio_get_value(arche_pdata->wake_detect_gpio)) {
+   if (gpiod_get_value(arche_pdata->wake_detect)) {
/* wake/detect rising */
 
/*
@@ -224,10 +222,9 @@ arche_platform_coldboot_seq(struct arche_platform_drvdata 
*arche_pdata)
 
dev_info(arche_pdata->dev, "Booting from cold boot state\n");
 
-   svc_reset_onoff(arche_pdata->svc_reset_gpio,
-   arche_pdata->is_reset_act_hi);
+   svc_reset_onoff(arche_pdata->svc_reset, arche_pdata->is_reset_act_hi);
 
-   gpio_set_value(arche_pdata->svc_sysboot_gpio, 0);
+   gpiod_set_value(arche_pdata->svc_sysboot, 0);
usleep_range(100, 200);
 
ret = clk_prepare_enable(arche_pdata->svc_ref_clk);
@@ -238,8 +235,7 @@ arche_platform_coldboot_seq(struct arche_platform_drvdata 
*arche_pdata)
}
 
/* bring SVC out of reset */
-   svc_reset_onoff(arche_pdata->svc_reset_gpio,
-   !arche_pdata->is_reset_act_hi);
+   svc_reset_onoff(arche_pdata->svc_reset, !arche_pdata->is_reset_act_hi);
 
arche_platform_set_state(arche_pdata, ARCHE_PLATFORM_STATE_ACTIVE);
 
@@ -259,10 +255,9 @@ arche_platform_fw_flashing_seq(struct 
arche_platform_drvdata *arche_pdata)
 
dev_info(arche_pdata->dev, "Switching to FW flashing state\n");
 
-   svc_reset_onoff(arche_pdata->svc_reset_gpio,
-   arche_pdata->is_reset_act_hi);
+   svc_reset_onoff(arche_pdata->svc_reset, arche_pdata->is_reset_act_hi);
 
-   gpio_set_value(arche_pdata->svc_sysboot_gpio, 1);
+   gpiod_set_value(arche_pdata->svc_sysboot, 1);
 
usleep_range(100, 200);
 
@@ -273,8 +268,7 @@ arche_platform_fw_flashing_seq(struct 
arche_platform_drvdata *arche_pdata)
return ret;
}
 
-   svc_reset_onoff(arche_pdata->svc_reset_gpio,
-   !arche_pdata->is_reset_act_hi);
+   svc_reset_onoff(arche_pdata->svc_reset, !arche_pdata->is_reset_act_hi);
 
arche_platform_set_state(arche_pdata, ARCHE_PLATFORM_STATE_FW_FLASHING);
 
@@ -305,8 +299,7 @@ arche_platform_poweroff_seq(struct arche_platform_drvdata 
*arche_pdata)
clk_

[PATCH v5 2/3] staging: greybus: arche-apb-ctrl.c: Switch to the gpio descriptor interface

2019-01-10 Thread Nishad Kamdar
Use the gpiod interface instead of the deprecated old non-descriptor
interface while continuing to ignore gpio flags from device tree in
functions "deassert_reset()" and "assert_reset()" for now.

Signed-off-by: Nishad Kamdar 
---
Changes in v5:
 - Change the commit message.
 - Restore the names of the gpio device-tree properties without
   the "-gpio" suffix.
Changes in v4:
 - Use gpiod_set_raw_value() for deassert_reset() and
   assert_reset() as gpiod_set_value() will change the
   sematics of these calls by taking any gpio flags
   into account.
 - Remove some unnecesssary line breaks.
 - Restore 'spi_en' gpio check in fw_flashing_seq()
   as it is currently optional.
Changes in v3:
 - Add this patch in a patchset.
Changes in v2:
 - Resolved compilation errors.
---
 drivers/staging/greybus/arche-apb-ctrl.c | 154 ++-
 1 file changed, 63 insertions(+), 91 deletions(-)

diff --git a/drivers/staging/greybus/arche-apb-ctrl.c 
b/drivers/staging/greybus/arche-apb-ctrl.c
index be5ffed90bcf..35a03ca6bb22 100644
--- a/drivers/staging/greybus/arche-apb-ctrl.c
+++ b/drivers/staging/greybus/arche-apb-ctrl.c
@@ -8,9 +8,8 @@
 
 #include 
 #include 
-#include 
+#include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -24,12 +23,12 @@ static void apb_bootret_deassert(struct device *dev);
 
 struct arche_apb_ctrl_drvdata {
/* Control GPIO signals to and from AP <=> AP Bridges */
-   int resetn_gpio;
-   int boot_ret_gpio;
-   int pwroff_gpio;
-   int wake_in_gpio;
-   int wake_out_gpio;
-   int pwrdn_gpio;
+   struct gpio_desc *resetn;
+   struct gpio_desc *boot_ret;
+   struct gpio_desc *pwroff;
+   struct gpio_desc *wake_in;
+   struct gpio_desc *wake_out;
+   struct gpio_desc *pwrdn;
 
enum arche_platform_state state;
bool init_disabled;
@@ -37,28 +36,28 @@ struct arche_apb_ctrl_drvdata {
struct regulator *vcore;
struct regulator *vio;
 
-   int clk_en_gpio;
+   struct gpio_desc *clk_en;
struct clk *clk;
 
struct pinctrl *pinctrl;
struct pinctrl_state *pin_default;
 
/* V2: SPI Bus control  */
-   int spi_en_gpio;
+   struct gpio_desc *spi_en;
bool spi_en_polarity_high;
 };
 
 /*
  * Note that these low level api's are active high
  */
-static inline void deassert_reset(unsigned int gpio)
+static inline void deassert_reset(struct gpio_desc *gpio)
 {
-   gpio_set_value(gpio, 1);
+   gpiod_set_raw_value(gpio, 1);
 }
 
-static inline void assert_reset(unsigned int gpio)
+static inline void assert_reset(struct gpio_desc *gpio)
 {
-   gpio_set_value(gpio, 0);
+   gpiod_set_raw_value(gpio, 0);
 }
 
 /*
@@ -75,11 +74,10 @@ static int coldboot_seq(struct platform_device *pdev)
return 0;
 
/* Hold APB in reset state */
-   assert_reset(apb->resetn_gpio);
+   assert_reset(apb->resetn);
 
-   if (apb->state == ARCHE_PLATFORM_STATE_FW_FLASHING &&
-   gpio_is_valid(apb->spi_en_gpio))
-   devm_gpio_free(dev, apb->spi_en_gpio);
+   if (apb->state == ARCHE_PLATFORM_STATE_FW_FLASHING && apb->spi_en)
+   devm_gpiod_put(dev, apb->spi_en);
 
/* Enable power to APB */
if (!IS_ERR(apb->vcore)) {
@@ -101,13 +99,13 @@ static int coldboot_seq(struct platform_device *pdev)
apb_bootret_deassert(dev);
 
/* On DB3 clock was not mandatory */
-   if (gpio_is_valid(apb->clk_en_gpio))
-   gpio_set_value(apb->clk_en_gpio, 1);
+   if (apb->clk_en)
+   gpiod_set_value(apb->clk_en, 1);
 
usleep_range(100, 200);
 
/* deassert reset to APB : Active-low signal */
-   deassert_reset(apb->resetn_gpio);
+   deassert_reset(apb->resetn);
 
apb->state = ARCHE_PLATFORM_STATE_ACTIVE;
 
@@ -136,25 +134,25 @@ static int fw_flashing_seq(struct platform_device *pdev)
return ret;
}
 
-   if (gpio_is_valid(apb->spi_en_gpio)) {
+   if (apb->spi_en) {
unsigned long flags;
 
if (apb->spi_en_polarity_high)
-   flags = GPIOF_OUT_INIT_HIGH;
+   flags = GPIOD_OUT_HIGH;
else
-   flags = GPIOF_OUT_INIT_LOW;
+   flags = GPIOD_OUT_LOW;
 
-   ret = devm_gpio_request_one(dev, apb->spi_en_gpio,
-   flags, "apb_spi_en");
-   if (ret) {
-   dev_err(dev, "Failed requesting SPI bus en gpio %d\n",
-   apb->spi_en_gpio);
+   apb->spi_en = devm_gpiod_get(dev, "spi-en", flags);
+   if (IS_ERR(apb->spi_en)) {
+   ret = PTR_ERR(apb->spi_en)

[PATCH v5 1/3] staging: greybus: gpio: switch GPIO portions to use GPIOLIB_IRQCHIP

2019-01-10 Thread Nishad Kamdar
Convert the GPIO driver to use the GPIO irqchip library
GPIOLIB_IRQCHIP instead of reimplementing the same.

Signed-off-by: Nishad Kamdar 
---
Changes in v5:
 - Restore "struct irq_chip irqc" in "struct gb_gpio_controller"
   This is because we cannot use the gpio-chip irqchip, as that
   will register the irqchip automatically and possibly in an
   incompatible way.
Changes in v4:
 - Remove changes related to conversion to gpiochip_get_data() to
   include it as a new patch.
 - Remove the 'struct irq_chip' field from 'struct gb_gpio_controller'
   as struct gpio_chip will have an irqchip whenever
   CONFIG_GPIOLIB_IRQCHIP is selected.
 - Update the TODO file as per the changes.
Changes in v3:
 - Combine patches as into a patch series.
Changes in v2:
 - Retained irq.h and irqdomain.h headers.
 - Dropped function gb_gpio_irqchip_add() and
   called gpiochip_irqchip_add() from probe().
 - Referred 
https://lkml.kernel.org/r/1476054589-28422-1-git-send-email-linus.wall...@linaro.org.
---
 drivers/staging/greybus/Kconfig |   1 +
 drivers/staging/greybus/TODO|   2 -
 drivers/staging/greybus/gpio.c  | 156 ++--
 3 files changed, 11 insertions(+), 148 deletions(-)

diff --git a/drivers/staging/greybus/Kconfig b/drivers/staging/greybus/Kconfig
index ab096bcef98c..b571e4e8060b 100644
--- a/drivers/staging/greybus/Kconfig
+++ b/drivers/staging/greybus/Kconfig
@@ -148,6 +148,7 @@ if GREYBUS_BRIDGED_PHY
 config GREYBUS_GPIO
tristate "Greybus GPIO Bridged PHY driver"
depends on GPIOLIB
+   select GPIOLIB_IRQCHIP
---help---
  Select this option if you have a device that follows the
  Greybus GPIO Bridged PHY Class specification.
diff --git a/drivers/staging/greybus/TODO b/drivers/staging/greybus/TODO
index 3b90a5711998..31f1f2cb401c 100644
--- a/drivers/staging/greybus/TODO
+++ b/drivers/staging/greybus/TODO
@@ -1,5 +1,3 @@
 * Convert all uses of the old GPIO API from  to the
   GPIO descriptor API in  and look up GPIO
   lines from device tree or ACPI.
-* Convert the GPIO driver to use the GPIO irqchip library
-  GPIOLIB_IRQCHIP instead of reimplementing the same.
diff --git a/drivers/staging/greybus/gpio.c b/drivers/staging/greybus/gpio.c
index e110681e6f86..3151004d26fb 100644
--- a/drivers/staging/greybus/gpio.c
+++ b/drivers/staging/greybus/gpio.c
@@ -9,9 +9,9 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
+#include 
 #include 
 
 #include "greybus.h"
@@ -39,11 +39,6 @@ struct gb_gpio_controller {
 
struct gpio_chipchip;
struct irq_chip irqc;
-   struct irq_chip *irqchip;
-   struct irq_domain   *irqdomain;
-   unsigned intirq_base;
-   irq_flow_handler_t  irq_handler;
-   unsigned intirq_default_type;
struct mutexirq_lock;
 };
 #define gpio_chip_to_gb_gpio_controller(chip) \
@@ -391,7 +386,7 @@ static int gb_gpio_request_handler(struct gb_operation *op)
return -EINVAL;
}
 
-   irq = irq_find_mapping(ggc->irqdomain, event->which);
+   irq = irq_find_mapping(ggc->chip.irq.domain, event->which);
if (!irq) {
dev_err(dev, "failed to find IRQ\n");
return -EINVAL;
@@ -506,135 +501,6 @@ static int gb_gpio_controller_setup(struct 
gb_gpio_controller *ggc)
return ret;
 }
 
-/**
- * gb_gpio_irq_map() - maps an IRQ into a GB gpio irqchip
- * @d: the irqdomain used by this irqchip
- * @irq: the global irq number used by this GB gpio irqchip irq
- * @hwirq: the local IRQ/GPIO line offset on this GB gpio
- *
- * This function will set up the mapping for a certain IRQ line on a
- * GB gpio by assigning the GB gpio as chip data, and using the irqchip
- * stored inside the GB gpio.
- */
-static int gb_gpio_irq_map(struct irq_domain *domain, unsigned int irq,
-  irq_hw_number_t hwirq)
-{
-   struct gpio_chip *chip = domain->host_data;
-   struct gb_gpio_controller *ggc = gpio_chip_to_gb_gpio_controller(chip);
-
-   irq_set_chip_data(irq, ggc);
-   irq_set_chip_and_handler(irq, ggc->irqchip, ggc->irq_handler);
-   irq_set_noprobe(irq);
-   /*
-* No set-up of the hardware will happen if IRQ_TYPE_NONE
-* is passed as default type.
-*/
-   if (ggc->irq_default_type != IRQ_TYPE_NONE)
-   irq_set_irq_type(irq, ggc->irq_default_type);
-
-   return 0;
-}
-
-static void gb_gpio_irq_unmap(struct irq_domain *d, unsigned int irq)
-{
-   irq_set_chip_and_handler(irq, NULL, NULL);
-   irq_set_chip_data(irq, NULL);
-}
-
-static const struct irq_domain_ops gb_gpio_domain_ops = {
-   .map= gb_gpio_irq_map,
-   .unmap  = gb_gpio_irq_unmap,
-};
-
-/**
- * gb_gpio_irqchip_remove() - removes an irqchip added to a gb_gpio_controller
- * @ggc: the gb_gpio_controller to remove the irq

[PATCH v5 0/3] greybus: gpio: Switch to the gpio descriptor interface

2019-01-10 Thread Nishad Kamdar
This patch series converts uses of the old GPIO API to the GPIO
descriptor API. It also converts the GPIO driver to use the
GPIO irqchip library GPIOLIB_IRQCHIP instead of repimplementing
the same.

Changes in v5:
 - Drop the patch which uses gpiochip_get_data() in place of
   gpio_chip_to_gb_gpio_controller() as of now.
 - This is because it currently breaks the driver, since
   gpiochip_add() sets the data pointer to NULL.  
Changes in v4:
 - Changes mentioned in individual patches of the set.
Changes in v3:
 - Combines the latest versions of the three greybus patches together
   in a patch series.

Nishad Kamdar (3):
  staging: greybus: gpio: switch GPIO portions to use GPIOLIB_IRQCHIP
  staging: greybus: arche-apb-ctrl.c: Switch to the gpio descriptor
interface
  staging: greybus: arche-platform: Switch to the gpio descriptor
interface

 drivers/staging/greybus/Kconfig  |   1 +
 drivers/staging/greybus/TODO |   2 -
 drivers/staging/greybus/arche-apb-ctrl.c | 154 +-
 drivers/staging/greybus/arche-platform.c | 124 ++
 drivers/staging/greybus/gpio.c   | 156 ++-
 5 files changed, 115 insertions(+), 322 deletions(-)

-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v4 4/4] staging: greybus: arche-platform: Switch to the gpio descriptor interface

2019-01-10 Thread Nishad Kamdar
On Wed, Jan 09, 2019 at 12:35:47PM +0100, Johan Hovold wrote:
> On Sat, Dec 22, 2018 at 08:23:02PM +0530, Nishad Kamdar wrote:
> > Use the gpiod interface instead of the deprecated
> > old non-descriptor interface.
> > 
> > Signed-off-by: Nishad Kamdar 
> > ---
> > Changes in v4:
> >  - Move 'gpio_desc *svc_sysboot' below the reset flag
> >as it is more logical to have reset flag below
> >reset gpio.
> >  - Remove a few unnecessary line breaks.
> > Changes in v3:
> >  - Add this patch to a patchset.
> > Changes in v2:
> >  - Move comment to the same line as to what it applies to.
> > ---
> 
> > -static inline void svc_reset_onoff(unsigned int gpio, bool onoff)
> > +static inline void svc_reset_onoff(struct gpio_desc *gpio, bool onoff)
> >  {
> > -   gpio_set_value(gpio, onoff);
> > +   gpiod_set_value(gpio, onoff);
> >  }
> 
> Please use the raw interface here too, until we've done away with the
> polarity properties and can honour the generic device tree flags. Please
> make a comment about this in the commit message too.
> 
Ok, I'll do that.
> > @@ -444,61 +438,33 @@ static int arche_platform_probe(struct 
> > platform_device *pdev)
> > /* setup svc reset gpio */
> > arche_pdata->is_reset_act_hi = of_property_read_bool(np,
> >  
> > "svc,reset-active-high");
> > -   arche_pdata->svc_reset_gpio = of_get_named_gpio(np,
> > -   "svc,reset-gpio",
> > -   0);
> > -   if (!gpio_is_valid(arche_pdata->svc_reset_gpio)) {
> > -   dev_err(dev, "failed to get reset-gpio\n");
> > -   return arche_pdata->svc_reset_gpio;
> > -   }
> > -   ret = devm_gpio_request(dev, arche_pdata->svc_reset_gpio, "svc-reset");
> > -   if (ret) {
> > -   dev_err(dev, "failed to request svc-reset gpio:%d\n", ret);
> > -   return ret;
> > -   }
> > -   ret = gpio_direction_output(arche_pdata->svc_reset_gpio,
> > -   arche_pdata->is_reset_act_hi);
> > -   if (ret) {
> > -   dev_err(dev, "failed to set svc-reset gpio dir:%d\n", ret);
> > +   if (arche_pdata->is_reset_act_hi)
> > +   flags = GPIOD_OUT_HIGH;
> > +   else
> > +   flags = GPIOD_OUT_LOW;
> > +
> > +   arche_pdata->svc_reset = devm_gpiod_get(dev, "svc,reset-gpio", flags);
> 
> Again, you cannot just rename devicetree properties like this. Keep the
> current names for now (and drop the -gpio suffix when requesting).
> 
Ok, I'll so that.
> Johan

Regards,
Nishad

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v4 3/4] staging: greybus: arche-apb-ctrl.c: Switch to the gpio descriptor interface

2019-01-10 Thread Nishad Kamdar
On Wed, Jan 09, 2019 at 12:30:43PM +0100, Johan Hovold wrote:
> On Sat, Dec 22, 2018 at 08:22:09PM +0530, Nishad Kamdar wrote:
> > Use the gpiod interface instead of the deprecated old non-descriptor
> > interface.
> > 
> > Signed-off-by: Nishad Kamdar 
> > ---
> > Changes in v4:
> >  - Use gpiod_set_raw_value() for deassert_reset() and
> >assert_reset() as gpiod_set_value() will change the
> >sematics of these calls by taking any gpio flags
> >into account.
> 
> Please also mention this in the commit message (i.e. that we continue to
> ignore gpio flags from device tree for now).
> 
Ok, I'll do that.
> >  - Remove some unnecesssary line breaks.
> >  - Restore 'spi_en' gpio check in fw_flashing_seq()
> >as it is currently optional.
> > Changes in v3:
> >  - Add this patch in a patchset.
> > Changes in v2:
> >  - Resolved compilation errors.
> > ---
> 
> > @@ -75,11 +74,10 @@ static int coldboot_seq(struct platform_device *pdev)
> > return 0;
> >  
> > /* Hold APB in reset state */
> > -   assert_reset(apb->resetn_gpio);
> > +   assert_reset(apb->resetn);
> >  
> > -   if (apb->state == ARCHE_PLATFORM_STATE_FW_FLASHING &&
> > -   gpio_is_valid(apb->spi_en_gpio))
> > -   devm_gpio_free(dev, apb->spi_en_gpio);
> > +   if (apb->state == ARCHE_PLATFORM_STATE_FW_FLASHING && apb->spi_en)
> > +   devm_gpiod_put(dev, apb->spi_en);
> >  
> > /* Enable power to APB */
> > if (!IS_ERR(apb->vcore)) {
> > @@ -101,13 +99,13 @@ static int coldboot_seq(struct platform_device *pdev)
> > apb_bootret_deassert(dev);
> >  
> > /* On DB3 clock was not mandatory */
> > -   if (gpio_is_valid(apb->clk_en_gpio))
> > -   gpio_set_value(apb->clk_en_gpio, 1);
> > +   if (apb->clk_en)
> > +   gpiod_set_value(apb->clk_en, 1);
> >  
> > usleep_range(100, 200);
> >  
> > /* deassert reset to APB : Active-low signal */
> > -   deassert_reset(apb->resetn_gpio);
> > +   deassert_reset(apb->resetn);
> >  
> > apb->state = ARCHE_PLATFORM_STATE_ACTIVE;
> >  
> > @@ -136,25 +134,25 @@ static int fw_flashing_seq(struct platform_device 
> > *pdev)
> > return ret;
> > }
> >  
> > -   if (gpio_is_valid(apb->spi_en_gpio)) {
> > +   if (apb->spi_en) {
> > unsigned long flags;
> >  
> > if (apb->spi_en_polarity_high)
> > -   flags = GPIOF_OUT_INIT_HIGH;
> > +   flags = GPIOD_OUT_HIGH;
> > else
> > -   flags = GPIOF_OUT_INIT_LOW;
> > +   flags = GPIOD_OUT_LOW;
> >  
> > -   ret = devm_gpio_request_one(dev, apb->spi_en_gpio,
> > -   flags, "apb_spi_en");
> > -   if (ret) {
> > -   dev_err(dev, "Failed requesting SPI bus en gpio %d\n",
> > -   apb->spi_en_gpio);
> > +   apb->spi_en = devm_gpiod_get(dev, "gb,spi-en-gpio", flags);
> 
> I just noticed that you change the name of the device-tree property here
> (and later in apb_ctrl_get_devtree_data()). How is that expected to
> work without breaking current systems? This will be unavoidable at some
> point, but must not be snuck into a patch like this without any comment.
> Please keep the current names for now.
> 
Ok, I'll do that.
> I do think you need to drop the "-gpio" suffix when requesting the gpio
> though. Please double check to make sure.
> 

Ok, I'll check it.
> Johan

Thanks for the review.

Regards,
Nishad
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v4 2/4] staging: greybus: gpio: Use gpiochip_get_data() in place of gpio_chip_to_gb_gpio_controller()

2019-01-10 Thread Nishad Kamdar
On Wed, Jan 09, 2019 at 11:58:24AM +0100, Johan Hovold wrote:
> On Sat, Dec 22, 2018 at 08:21:00PM +0530, Nishad Kamdar wrote:
> > This patch drops gpio_chip_to_gb_gpio_controller(),
> > and uses gpiochip_get_data() to retrieve the container
> > of struct gpio_chip.
> 
> So this will break the driver, since gpiochip_add() sets the data
> pointer to NULL.
> 
> These kind of changes are getting too complicated to do without
> something to test against. We had a module simulator at one point, but
> not sure what the state of that is now.
> 
Ok, I get it.
> I appreciate the effort though, and since we already started, let's try
> to finish, but please drop this patch for now.
> 
Ok I'll do that.
> Johan

Thanks for the review.

Regards,
Nishad
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v4 1/4] staging: greybus: gpio: switch GPIO portions to use GPIOLIB_IRQCHIP

2019-01-10 Thread Nishad Kamdar
On Wed, Jan 09, 2019 at 11:44:14AM +0100, Johan Hovold wrote:
> On Sat, Dec 22, 2018 at 08:17:02PM +0530, Nishad Kamdar wrote:
> > Convert the GPIO driver to use the GPIO irqchip library
> > GPIOLIB_IRQCHIP instead of reimplementing the same.
> > 
> > Signed-off-by: Nishad Kamdar 
> > ---
> > Changes in v4:
> >  - Remove changes related to conversion to gpiochip_get_data() to
> >include it as a new patch.
> >  - Remove the 'struct irq_chip' field from 'struct gb_gpio_controller'
> >as struct gpio_chip will have an irqchip whenever
> >CONFIG_GPIOLIB_IRQCHIP is selected.
> 
> Ok, sorry for misleading you this. It seems we cannot use the gpio-chip
> irqchip, since that will register the irqchip automatically and possibly
> in an incompatible way. This new functionality is far from well
> documented, and you basically have to review the gpiolib code to figure
> it out.
> 
Ok, I get it.
> Looks like you need to add back the struct irq_chip.
> 
Ok, I'll do that.
> Johan

Thanks for the review.

Regards,
Nishad
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: emxx_udc: Switch to the gpio descriptor interface

2018-12-27 Thread Nishad Kamdar
Convert VBUS GPIO to use GPIO descriptors from 
and stop using the old GPIO API.

Signed-off-by: Nishad Kamdar 
---
 drivers/staging/emxx_udc/emxx_udc.c | 31 +++--
 drivers/staging/emxx_udc/emxx_udc.h |  2 ++
 2 files changed, 18 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/emxx_udc/emxx_udc.c 
b/drivers/staging/emxx_udc/emxx_udc.c
index 8e8f57c4f029..a913d40f0801 100644
--- a/drivers/staging/emxx_udc/emxx_udc.c
+++ b/drivers/staging/emxx_udc/emxx_udc.c
@@ -27,7 +27,7 @@
 #include 
 
 #include 
-#include 
+#include 
 
 #include "emxx_udc.h"
 
@@ -2220,7 +2220,7 @@ static inline void _nbu2ss_check_vbus(struct nbu2ss_udc 
*udc)
mdelay(VBUS_CHATTERING_MDELAY); /* wait (ms) */
 
/* VBUS ON Check*/
-   reg_dt = gpio_get_value(VBUS_VALUE);
+   reg_dt = gpiod_get_value(vbus_gpio);
if (reg_dt == 0) {
udc->linux_suspended = 0;
 
@@ -2247,7 +2247,7 @@ static inline void _nbu2ss_check_vbus(struct nbu2ss_udc 
*udc)
}
} else {
mdelay(5);  /* wait (5ms) */
-   reg_dt = gpio_get_value(VBUS_VALUE);
+   reg_dt = gpiod_get_value(vbus_gpio);
if (reg_dt == 0)
return;
 
@@ -2311,7 +2311,7 @@ static inline void _nbu2ss_int_usb_suspend(struct 
nbu2ss_udc *udc)
u32 reg_dt;
 
if (udc->usb_suspended == 0) {
-   reg_dt = gpio_get_value(VBUS_VALUE);
+   reg_dt = gpiod_get_value(vbus_gpio);
 
if (reg_dt == 0)
return;
@@ -2351,7 +2351,7 @@ static irqreturn_t _nbu2ss_udc_irq(int irq, void *_udc)
struct nbu2ss_udc   *udc = (struct nbu2ss_udc *)_udc;
struct fc_regs __iomem *preg = udc->p_regs;
 
-   if (gpio_get_value(VBUS_VALUE) == 0) {
+   if (gpiod_get_value(vbus_gpio) == 0) {
_nbu2ss_writel(>USB_INT_STA, ~USB_INT_STA_RW);
_nbu2ss_writel(>USB_INT_ENA, 0);
return IRQ_HANDLED;
@@ -2360,7 +2360,7 @@ static irqreturn_t _nbu2ss_udc_irq(int irq, void *_udc)
spin_lock(>lock);
 
for (;;) {
-   if (gpio_get_value(VBUS_VALUE) == 0) {
+   if (gpiod_get_value(vbus_gpio) == 0) {
_nbu2ss_writel(>USB_INT_STA, ~USB_INT_STA_RW);
_nbu2ss_writel(>USB_INT_ENA, 0);
status = 0;
@@ -2750,7 +2750,7 @@ static int nbu2ss_ep_fifo_status(struct usb_ep *_ep)
 
preg = udc->p_regs;
 
-   data = gpio_get_value(VBUS_VALUE);
+   data = gpiod_get_value(vbus_gpio);
if (data == 0)
return -EINVAL;
 
@@ -2790,7 +2790,7 @@ static void  nbu2ss_ep_fifo_flush(struct usb_ep *_ep)
return;
}
 
-   data = gpio_get_value(VBUS_VALUE);
+   data = gpiod_get_value(vbus_gpio);
if (data == 0)
return;
 
@@ -2832,7 +2832,7 @@ static int nbu2ss_gad_get_frame(struct usb_gadget 
*pgadget)
}
 
udc = container_of(pgadget, struct nbu2ss_udc, gadget);
-   data = gpio_get_value(VBUS_VALUE);
+   data = gpiod_get_value(vbus_gpio);
if (data == 0)
return -EINVAL;
 
@@ -2854,7 +2854,7 @@ static int nbu2ss_gad_wakeup(struct usb_gadget *pgadget)
 
udc = container_of(pgadget, struct nbu2ss_udc, gadget);
 
-   data = gpio_get_value(VBUS_VALUE);
+   data = gpiod_get_value(vbus_gpio);
if (data == 0) {
dev_warn(>dev, "VBUS LEVEL = %d\n", data);
return -EINVAL;
@@ -3119,12 +3119,13 @@ static int nbu2ss_drv_probe(struct platform_device 
*pdev)
}
 
/* VBUS Interrupt */
-   irq_set_irq_type(INT_VBUS, IRQ_TYPE_EDGE_BOTH);
-   status = request_irq(INT_VBUS,
+   vbus_irq = gpiod_to_irq(vbus_gpio);
+   irq_set_irq_type(vbus_irq, IRQ_TYPE_EDGE_BOTH);
+   status = request_irq(vbus_irq,
 _nbu2ss_vbus_irq, IRQF_SHARED, driver_name, udc);
 
if (status != 0) {
-   dev_err(udc->dev, "request_irq(INT_VBUS) failed\n");
+   dev_err(udc->dev, "request_irq(vbus_irq) failed\n");
return status;
}
 
@@ -3160,7 +3161,7 @@ static int nbu2ss_drv_remove(struct platform_device *pdev)
}
 
/* Interrupt Handler - Release */
-   free_irq(INT_VBUS, udc);
+   free_irq(vbus_irq, udc);
 
return 0;
 }
@@ -3201,7 +3202,7 @@ static int nbu2ss_drv_resume(struct platform_device *pdev)
if (!udc)
return 0;
 
-   data = gpio_get_value(VBUS_VALUE);
+   data = gpiod_get_value(vbus_gpio);
if (data) {
udc->vbus_active = 1;
udc->devstate = USB_STATE_POWERED;
diff --git a/drivers/staging/emxx_udc/emxx_udc.h 
b/drivers/staging/emxx_udc/emxx_udc.h
index e28a74da9633..b8c3dee5626c 100644
-

[PATCH v4 4/4] staging: greybus: arche-platform: Switch to the gpio descriptor interface

2018-12-22 Thread Nishad Kamdar
Use the gpiod interface instead of the deprecated
old non-descriptor interface.

Signed-off-by: Nishad Kamdar 
---
Changes in v4:
 - Move 'gpio_desc *svc_sysboot' below the reset flag
   as it is more logical to have reset flag below
   reset gpio.
 - Remove a few unnecessary line breaks.
Changes in v3:
 - Add this patch to a patchset.
Changes in v2:
 - Move comment to the same line as to what it applies to.
---
 drivers/staging/greybus/arche-platform.c | 124 ---
 1 file changed, 41 insertions(+), 83 deletions(-)

diff --git a/drivers/staging/greybus/arche-platform.c 
b/drivers/staging/greybus/arche-platform.c
index 4c36e88766e7..b4b101ba96df 100644
--- a/drivers/staging/greybus/arche-platform.c
+++ b/drivers/staging/greybus/arche-platform.c
@@ -8,10 +8,9 @@
 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -45,14 +44,14 @@ enum svc_wakedetect_state {
 
 struct arche_platform_drvdata {
/* Control GPIO signals to and from AP <=> SVC */
-   int svc_reset_gpio;
+   struct gpio_desc *svc_reset;
bool is_reset_act_hi;
-   int svc_sysboot_gpio;
-   int wake_detect_gpio; /* bi-dir,maps to WAKE_MOD & WAKE_FRAME signals */
+   struct gpio_desc *svc_sysboot;
+   struct gpio_desc *wake_detect; /* bi-dir,maps to WAKE_MOD & WAKE_FRAME 
signals */
 
enum arche_platform_state state;
 
-   int svc_refclk_req;
+   struct gpio_desc *svc_refclk_req;
struct clk *svc_ref_clk;
 
struct pinctrl *pinctrl;
@@ -85,9 +84,9 @@ static void arche_platform_set_wake_detect_state(
arche_pdata->wake_detect_state = state;
 }
 
-static inline void svc_reset_onoff(unsigned int gpio, bool onoff)
+static inline void svc_reset_onoff(struct gpio_desc *gpio, bool onoff)
 {
-   gpio_set_value(gpio, onoff);
+   gpiod_set_value(gpio, onoff);
 }
 
 static int apb_cold_boot(struct device *dev, void *data)
@@ -116,7 +115,6 @@ static int apb_poweroff(struct device *dev, void *data)
 static void arche_platform_wd_irq_en(struct arche_platform_drvdata 
*arche_pdata)
 {
/* Enable interrupt here, to read event back from SVC */
-   gpio_direction_input(arche_pdata->wake_detect_gpio);
enable_irq(arche_pdata->wake_detect_irq);
 }
 
@@ -160,7 +158,7 @@ static irqreturn_t arche_platform_wd_irq(int irq, void 
*devid)
 
spin_lock_irqsave(_pdata->wake_lock, flags);
 
-   if (gpio_get_value(arche_pdata->wake_detect_gpio)) {
+   if (gpiod_get_value(arche_pdata->wake_detect)) {
/* wake/detect rising */
 
/*
@@ -224,10 +222,9 @@ arche_platform_coldboot_seq(struct arche_platform_drvdata 
*arche_pdata)
 
dev_info(arche_pdata->dev, "Booting from cold boot state\n");
 
-   svc_reset_onoff(arche_pdata->svc_reset_gpio,
-   arche_pdata->is_reset_act_hi);
+   svc_reset_onoff(arche_pdata->svc_reset, arche_pdata->is_reset_act_hi);
 
-   gpio_set_value(arche_pdata->svc_sysboot_gpio, 0);
+   gpiod_set_value(arche_pdata->svc_sysboot, 0);
usleep_range(100, 200);
 
ret = clk_prepare_enable(arche_pdata->svc_ref_clk);
@@ -238,8 +235,7 @@ arche_platform_coldboot_seq(struct arche_platform_drvdata 
*arche_pdata)
}
 
/* bring SVC out of reset */
-   svc_reset_onoff(arche_pdata->svc_reset_gpio,
-   !arche_pdata->is_reset_act_hi);
+   svc_reset_onoff(arche_pdata->svc_reset, !arche_pdata->is_reset_act_hi);
 
arche_platform_set_state(arche_pdata, ARCHE_PLATFORM_STATE_ACTIVE);
 
@@ -259,10 +255,9 @@ arche_platform_fw_flashing_seq(struct 
arche_platform_drvdata *arche_pdata)
 
dev_info(arche_pdata->dev, "Switching to FW flashing state\n");
 
-   svc_reset_onoff(arche_pdata->svc_reset_gpio,
-   arche_pdata->is_reset_act_hi);
+   svc_reset_onoff(arche_pdata->svc_reset, arche_pdata->is_reset_act_hi);
 
-   gpio_set_value(arche_pdata->svc_sysboot_gpio, 1);
+   gpiod_set_value(arche_pdata->svc_sysboot, 1);
 
usleep_range(100, 200);
 
@@ -273,8 +268,7 @@ arche_platform_fw_flashing_seq(struct 
arche_platform_drvdata *arche_pdata)
return ret;
}
 
-   svc_reset_onoff(arche_pdata->svc_reset_gpio,
-   !arche_pdata->is_reset_act_hi);
+   svc_reset_onoff(arche_pdata->svc_reset, !arche_pdata->is_reset_act_hi);
 
arche_platform_set_state(arche_pdata, ARCHE_PLATFORM_STATE_FW_FLASHING);
 
@@ -305,8 +299,7 @@ arche_platform_poweroff_seq(struct arche_platform_drvdata 
*arche_pdata)
clk_disable_unprepare(arche_pdata->svc_ref_clk);
 
/* As part of exit, put APB back in reset state */
-   svc_reset_onoff(arche_pdata->svc_reset_gpio,
-   arche_pdata->is_reset_act_hi);
+   svc_reset_ono

[PATCH v4 3/4] staging: greybus: arche-apb-ctrl.c: Switch to the gpio descriptor interface

2018-12-22 Thread Nishad Kamdar
Use the gpiod interface instead of the deprecated old non-descriptor
interface.

Signed-off-by: Nishad Kamdar 
---
Changes in v4:
 - Use gpiod_set_raw_value() for deassert_reset() and
   assert_reset() as gpiod_set_value() will change the
   sematics of these calls by taking any gpio flags
   into account.
 - Remove some unnecesssary line breaks.
 - Restore 'spi_en' gpio check in fw_flashing_seq()
   as it is currently optional.
Changes in v3:
 - Add this patch in a patchset.
Changes in v2:
 - Resolved compilation errors.
---
 drivers/staging/greybus/arche-apb-ctrl.c | 154 ++-
 1 file changed, 63 insertions(+), 91 deletions(-)

diff --git a/drivers/staging/greybus/arche-apb-ctrl.c 
b/drivers/staging/greybus/arche-apb-ctrl.c
index be5ffed90bcf..57eecd0dd0a6 100644
--- a/drivers/staging/greybus/arche-apb-ctrl.c
+++ b/drivers/staging/greybus/arche-apb-ctrl.c
@@ -8,9 +8,8 @@
 
 #include 
 #include 
-#include 
+#include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -24,12 +23,12 @@ static void apb_bootret_deassert(struct device *dev);
 
 struct arche_apb_ctrl_drvdata {
/* Control GPIO signals to and from AP <=> AP Bridges */
-   int resetn_gpio;
-   int boot_ret_gpio;
-   int pwroff_gpio;
-   int wake_in_gpio;
-   int wake_out_gpio;
-   int pwrdn_gpio;
+   struct gpio_desc *resetn;
+   struct gpio_desc *boot_ret;
+   struct gpio_desc *pwroff;
+   struct gpio_desc *wake_in;
+   struct gpio_desc *wake_out;
+   struct gpio_desc *pwrdn;
 
enum arche_platform_state state;
bool init_disabled;
@@ -37,28 +36,28 @@ struct arche_apb_ctrl_drvdata {
struct regulator *vcore;
struct regulator *vio;
 
-   int clk_en_gpio;
+   struct gpio_desc *clk_en;
struct clk *clk;
 
struct pinctrl *pinctrl;
struct pinctrl_state *pin_default;
 
/* V2: SPI Bus control  */
-   int spi_en_gpio;
+   struct gpio_desc *spi_en;
bool spi_en_polarity_high;
 };
 
 /*
  * Note that these low level api's are active high
  */
-static inline void deassert_reset(unsigned int gpio)
+static inline void deassert_reset(struct gpio_desc *gpio)
 {
-   gpio_set_value(gpio, 1);
+   gpiod_set_raw_value(gpio, 1);
 }
 
-static inline void assert_reset(unsigned int gpio)
+static inline void assert_reset(struct gpio_desc *gpio)
 {
-   gpio_set_value(gpio, 0);
+   gpiod_set_raw_value(gpio, 0);
 }
 
 /*
@@ -75,11 +74,10 @@ static int coldboot_seq(struct platform_device *pdev)
return 0;
 
/* Hold APB in reset state */
-   assert_reset(apb->resetn_gpio);
+   assert_reset(apb->resetn);
 
-   if (apb->state == ARCHE_PLATFORM_STATE_FW_FLASHING &&
-   gpio_is_valid(apb->spi_en_gpio))
-   devm_gpio_free(dev, apb->spi_en_gpio);
+   if (apb->state == ARCHE_PLATFORM_STATE_FW_FLASHING && apb->spi_en)
+   devm_gpiod_put(dev, apb->spi_en);
 
/* Enable power to APB */
if (!IS_ERR(apb->vcore)) {
@@ -101,13 +99,13 @@ static int coldboot_seq(struct platform_device *pdev)
apb_bootret_deassert(dev);
 
/* On DB3 clock was not mandatory */
-   if (gpio_is_valid(apb->clk_en_gpio))
-   gpio_set_value(apb->clk_en_gpio, 1);
+   if (apb->clk_en)
+   gpiod_set_value(apb->clk_en, 1);
 
usleep_range(100, 200);
 
/* deassert reset to APB : Active-low signal */
-   deassert_reset(apb->resetn_gpio);
+   deassert_reset(apb->resetn);
 
apb->state = ARCHE_PLATFORM_STATE_ACTIVE;
 
@@ -136,25 +134,25 @@ static int fw_flashing_seq(struct platform_device *pdev)
return ret;
}
 
-   if (gpio_is_valid(apb->spi_en_gpio)) {
+   if (apb->spi_en) {
unsigned long flags;
 
if (apb->spi_en_polarity_high)
-   flags = GPIOF_OUT_INIT_HIGH;
+   flags = GPIOD_OUT_HIGH;
else
-   flags = GPIOF_OUT_INIT_LOW;
+   flags = GPIOD_OUT_LOW;
 
-   ret = devm_gpio_request_one(dev, apb->spi_en_gpio,
-   flags, "apb_spi_en");
-   if (ret) {
-   dev_err(dev, "Failed requesting SPI bus en gpio %d\n",
-   apb->spi_en_gpio);
+   apb->spi_en = devm_gpiod_get(dev, "gb,spi-en-gpio", flags);
+   if (IS_ERR(apb->spi_en)) {
+   ret = PTR_ERR(apb->spi_en);
+   dev_err(dev, "Failed requesting SPI bus en GPIO: %d\n",
+   ret);
return ret;
}
}
 
/* for flashing device should be in reset state */
-   assert_reset(apb->resetn_gpio);
+  

[PATCH v4 2/4] staging: greybus: gpio: Use gpiochip_get_data() in place of gpio_chip_to_gb_gpio_controller()

2018-12-22 Thread Nishad Kamdar
This patch drops gpio_chip_to_gb_gpio_controller(),
and uses gpiochip_get_data() to retrieve the container
of struct gpio_chip.

Signed-off-by: Nishad Kamdar 
---
Changes in v4:
 - Introduce this change as a new patch.
---
 drivers/staging/greybus/gpio.c | 28 +---
 1 file changed, 13 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/greybus/gpio.c b/drivers/staging/greybus/gpio.c
index 1af291aa1b6e..2dd04682cbc6 100644
--- a/drivers/staging/greybus/gpio.c
+++ b/drivers/staging/greybus/gpio.c
@@ -40,8 +40,6 @@ struct gb_gpio_controller {
struct gpio_chipchip;
struct mutexirq_lock;
 };
-#define gpio_chip_to_gb_gpio_controller(chip) \
-   container_of(chip, struct gb_gpio_controller, chip)
 #define irq_data_to_gpio_chip(d) (d->domain->host_data)
 
 static int gb_gpio_line_count_operation(struct gb_gpio_controller *ggc)
@@ -270,7 +268,7 @@ static void _gb_gpio_irq_set_type(struct gb_gpio_controller 
*ggc,
 static void gb_gpio_irq_mask(struct irq_data *d)
 {
struct gpio_chip *chip = irq_data_to_gpio_chip(d);
-   struct gb_gpio_controller *ggc = gpio_chip_to_gb_gpio_controller(chip);
+   struct gb_gpio_controller *ggc = gpiochip_get_data(chip);
struct gb_gpio_line *line = >lines[d->hwirq];
 
line->masked = true;
@@ -280,7 +278,7 @@ static void gb_gpio_irq_mask(struct irq_data *d)
 static void gb_gpio_irq_unmask(struct irq_data *d)
 {
struct gpio_chip *chip = irq_data_to_gpio_chip(d);
-   struct gb_gpio_controller *ggc = gpio_chip_to_gb_gpio_controller(chip);
+   struct gb_gpio_controller *ggc = gpiochip_get_data(chip);
struct gb_gpio_line *line = >lines[d->hwirq];
 
line->masked = false;
@@ -290,7 +288,7 @@ static void gb_gpio_irq_unmask(struct irq_data *d)
 static int gb_gpio_irq_set_type(struct irq_data *d, unsigned int type)
 {
struct gpio_chip *chip = irq_data_to_gpio_chip(d);
-   struct gb_gpio_controller *ggc = gpio_chip_to_gb_gpio_controller(chip);
+   struct gb_gpio_controller *ggc = gpiochip_get_data(chip);
struct gb_gpio_line *line = >lines[d->hwirq];
struct device *dev = >gbphy_dev->dev;
u8 irq_type;
@@ -328,7 +326,7 @@ static int gb_gpio_irq_set_type(struct irq_data *d, 
unsigned int type)
 static void gb_gpio_irq_bus_lock(struct irq_data *d)
 {
struct gpio_chip *chip = irq_data_to_gpio_chip(d);
-   struct gb_gpio_controller *ggc = gpio_chip_to_gb_gpio_controller(chip);
+   struct gb_gpio_controller *ggc = gpiochip_get_data(chip);
 
mutex_lock(>irq_lock);
 }
@@ -336,7 +334,7 @@ static void gb_gpio_irq_bus_lock(struct irq_data *d)
 static void gb_gpio_irq_bus_sync_unlock(struct irq_data *d)
 {
struct gpio_chip *chip = irq_data_to_gpio_chip(d);
-   struct gb_gpio_controller *ggc = gpio_chip_to_gb_gpio_controller(chip);
+   struct gb_gpio_controller *ggc = gpiochip_get_data(chip);
struct gb_gpio_line *line = >lines[d->hwirq];
 
if (line->irq_type_pending) {
@@ -405,21 +403,21 @@ static int gb_gpio_request_handler(struct gb_operation 
*op)
 
 static int gb_gpio_request(struct gpio_chip *chip, unsigned int offset)
 {
-   struct gb_gpio_controller *ggc = gpio_chip_to_gb_gpio_controller(chip);
+   struct gb_gpio_controller *ggc = gpiochip_get_data(chip);
 
return gb_gpio_activate_operation(ggc, (u8)offset);
 }
 
 static void gb_gpio_free(struct gpio_chip *chip, unsigned int offset)
 {
-   struct gb_gpio_controller *ggc = gpio_chip_to_gb_gpio_controller(chip);
+   struct gb_gpio_controller *ggc = gpiochip_get_data(chip);
 
gb_gpio_deactivate_operation(ggc, (u8)offset);
 }
 
 static int gb_gpio_get_direction(struct gpio_chip *chip, unsigned int offset)
 {
-   struct gb_gpio_controller *ggc = gpio_chip_to_gb_gpio_controller(chip);
+   struct gb_gpio_controller *ggc = gpiochip_get_data(chip);
u8 which;
int ret;
 
@@ -433,7 +431,7 @@ static int gb_gpio_get_direction(struct gpio_chip *chip, 
unsigned int offset)
 
 static int gb_gpio_direction_input(struct gpio_chip *chip, unsigned int offset)
 {
-   struct gb_gpio_controller *ggc = gpio_chip_to_gb_gpio_controller(chip);
+   struct gb_gpio_controller *ggc = gpiochip_get_data(chip);
 
return gb_gpio_direction_in_operation(ggc, (u8)offset);
 }
@@ -441,14 +439,14 @@ static int gb_gpio_direction_input(struct gpio_chip 
*chip, unsigned int offset)
 static int gb_gpio_direction_output(struct gpio_chip *chip, unsigned int 
offset,
int value)
 {
-   struct gb_gpio_controller *ggc = gpio_chip_to_gb_gpio_controller(chip);
+   struct gb_gpio_controller *ggc = gpiochip_get_data(chip);
 
return gb_gpio_direction_out_operation(ggc, (u8)offset, !!value);
 }
 
 static int gb_gpio_get(struct gpio_chip *chip, unsigned int offset)
 {
-   struct gb_gpio_controller *ggc = gpio_

[PATCH v4 1/4] staging: greybus: gpio: switch GPIO portions to use GPIOLIB_IRQCHIP

2018-12-22 Thread Nishad Kamdar
Convert the GPIO driver to use the GPIO irqchip library
GPIOLIB_IRQCHIP instead of reimplementing the same.

Signed-off-by: Nishad Kamdar 
---
Changes in v4:
 - Remove changes related to conversion to gpiochip_get_data() to
   include it as a new patch.
 - Remove the 'struct irq_chip' field from 'struct gb_gpio_controller'
   as struct gpio_chip will have an irqchip whenever
   CONFIG_GPIOLIB_IRQCHIP is selected.
 - Update the TODO file as per the changes.
Changes in v3:
 - Combine patches as into a patch series.
Changes in v2:
 - Retained irq.h and irqdomain.h headers.
 - Dropped function gb_gpio_irqchip_add() and
   called gpiochip_irqchip_add() from probe().
 - Referred 
https://lkml.kernel.org/r/1476054589-28422-1-git-send-email-linus.wall...@linaro.org.
---
 drivers/staging/greybus/Kconfig |   1 +
 drivers/staging/greybus/TODO|   2 -
 drivers/staging/greybus/gpio.c  | 159 +++-
 3 files changed, 12 insertions(+), 150 deletions(-)

diff --git a/drivers/staging/greybus/Kconfig b/drivers/staging/greybus/Kconfig
index ab096bcef98c..b571e4e8060b 100644
--- a/drivers/staging/greybus/Kconfig
+++ b/drivers/staging/greybus/Kconfig
@@ -148,6 +148,7 @@ if GREYBUS_BRIDGED_PHY
 config GREYBUS_GPIO
tristate "Greybus GPIO Bridged PHY driver"
depends on GPIOLIB
+   select GPIOLIB_IRQCHIP
---help---
  Select this option if you have a device that follows the
  Greybus GPIO Bridged PHY Class specification.
diff --git a/drivers/staging/greybus/TODO b/drivers/staging/greybus/TODO
index 3b90a5711998..31f1f2cb401c 100644
--- a/drivers/staging/greybus/TODO
+++ b/drivers/staging/greybus/TODO
@@ -1,5 +1,3 @@
 * Convert all uses of the old GPIO API from  to the
   GPIO descriptor API in  and look up GPIO
   lines from device tree or ACPI.
-* Convert the GPIO driver to use the GPIO irqchip library
-  GPIOLIB_IRQCHIP instead of reimplementing the same.
diff --git a/drivers/staging/greybus/gpio.c b/drivers/staging/greybus/gpio.c
index e110681e6f86..1af291aa1b6e 100644
--- a/drivers/staging/greybus/gpio.c
+++ b/drivers/staging/greybus/gpio.c
@@ -9,9 +9,9 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
+#include 
 #include 
 
 #include "greybus.h"
@@ -38,12 +38,6 @@ struct gb_gpio_controller {
struct gb_gpio_line *lines;
 
struct gpio_chipchip;
-   struct irq_chip irqc;
-   struct irq_chip *irqchip;
-   struct irq_domain   *irqdomain;
-   unsigned intirq_base;
-   irq_flow_handler_t  irq_handler;
-   unsigned intirq_default_type;
struct mutexirq_lock;
 };
 #define gpio_chip_to_gb_gpio_controller(chip) \
@@ -391,7 +385,7 @@ static int gb_gpio_request_handler(struct gb_operation *op)
return -EINVAL;
}
 
-   irq = irq_find_mapping(ggc->irqdomain, event->which);
+   irq = irq_find_mapping(ggc->chip.irq.domain, event->which);
if (!irq) {
dev_err(dev, "failed to find IRQ\n");
return -EINVAL;
@@ -506,135 +500,6 @@ static int gb_gpio_controller_setup(struct 
gb_gpio_controller *ggc)
return ret;
 }
 
-/**
- * gb_gpio_irq_map() - maps an IRQ into a GB gpio irqchip
- * @d: the irqdomain used by this irqchip
- * @irq: the global irq number used by this GB gpio irqchip irq
- * @hwirq: the local IRQ/GPIO line offset on this GB gpio
- *
- * This function will set up the mapping for a certain IRQ line on a
- * GB gpio by assigning the GB gpio as chip data, and using the irqchip
- * stored inside the GB gpio.
- */
-static int gb_gpio_irq_map(struct irq_domain *domain, unsigned int irq,
-  irq_hw_number_t hwirq)
-{
-   struct gpio_chip *chip = domain->host_data;
-   struct gb_gpio_controller *ggc = gpio_chip_to_gb_gpio_controller(chip);
-
-   irq_set_chip_data(irq, ggc);
-   irq_set_chip_and_handler(irq, ggc->irqchip, ggc->irq_handler);
-   irq_set_noprobe(irq);
-   /*
-* No set-up of the hardware will happen if IRQ_TYPE_NONE
-* is passed as default type.
-*/
-   if (ggc->irq_default_type != IRQ_TYPE_NONE)
-   irq_set_irq_type(irq, ggc->irq_default_type);
-
-   return 0;
-}
-
-static void gb_gpio_irq_unmap(struct irq_domain *d, unsigned int irq)
-{
-   irq_set_chip_and_handler(irq, NULL, NULL);
-   irq_set_chip_data(irq, NULL);
-}
-
-static const struct irq_domain_ops gb_gpio_domain_ops = {
-   .map= gb_gpio_irq_map,
-   .unmap  = gb_gpio_irq_unmap,
-};
-
-/**
- * gb_gpio_irqchip_remove() - removes an irqchip added to a gb_gpio_controller
- * @ggc: the gb_gpio_controller to remove the irqchip from
- *
- * This is called only from gb_gpio_remove()
- */
-static void gb_gpio_irqchip_remove(struct gb_gpio_controller *ggc)
-{
-   unsigned int offset;
-
-   /* Remove all IRQ map

[PATCH v4 0/4] greybus: gpio: Switch to the gpio descriptor interface

2018-12-22 Thread Nishad Kamdar
This patch series converts uses of the old GPIO API to the GPIO
descriptor API. It also converts the GPIO driver to use the
GPIO irqchip library GPIOLIB_IRQCHIP instead of repimplementing
the same.

Changes in v4:
 - Changes mentioned in individual patches of the set.
Changes in v3:
 - Combines the latest versions of the three greybus patches together
   in a patch series.

Nishad Kamdar (4):
  staging: greybus: gpio: switch GPIO portions to use GPIOLIB_IRQCHIP
  staging: greybus: gpio: Use gpiochip_get_data() in place of
gpio_chip_to_gb_gpio_controller()
  staging: greybus: arche-apb-ctrl.c: Switch to the gpio descriptor
interface
  staging: greybus: arche-platform: Switch to the gpio descriptor
interface

 drivers/staging/greybus/Kconfig  |   1 +
 drivers/staging/greybus/TODO |   2 -
 drivers/staging/greybus/arche-apb-ctrl.c | 154 ---
 drivers/staging/greybus/arche-platform.c | 124 +--
 drivers/staging/greybus/gpio.c   | 187 +++
 5 files changed, 129 insertions(+), 339 deletions(-)

-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v3 3/3] staging: greybus: arche-platform: Switch to the gpio descriptor interface

2018-12-22 Thread Nishad Kamdar
On Tue, Dec 18, 2018 at 12:50:56PM +0100, Johan Hovold wrote:
> On Thu, Nov 22, 2018 at 10:39:24PM +0530, Nishad Kamdar wrote:
> > Use the gpiod interface instead of the deprecated
> > old non-descriptor interface.
> > 
> > Signed-off-by: Nishad Kamdar 
> > ---
> > Changes in v2:
> >  - Move comment to the same line as to what it applies to.
> > ---
> >  drivers/staging/greybus/arche-platform.c | 119 ---
> >  1 file changed, 41 insertions(+), 78 deletions(-)
> > 
> > diff --git a/drivers/staging/greybus/arche-platform.c 
> > b/drivers/staging/greybus/arche-platform.c
> > index 4c36e88766e7..a5cea79d8e32 100644
> > --- a/drivers/staging/greybus/arche-platform.c
> > +++ b/drivers/staging/greybus/arche-platform.c
> > @@ -8,10 +8,9 @@
> >  
> >  #include 
> >  #include 
> > -#include 
> > +#include 
> >  #include 
> >  #include 
> > -#include 
> >  #include 
> >  #include 
> >  #include 
> > @@ -45,14 +44,14 @@ enum svc_wakedetect_state {
> >  
> >  struct arche_platform_drvdata {
> > /* Control GPIO signals to and from AP <=> SVC */
> > -   int svc_reset_gpio;
> > +   struct gpio_desc *svc_reset;
> > +   struct gpio_desc *svc_sysboot;
> 
> Why move sysboot? The flag below is about reset (but should eventually
> go away).
> 
Ok, I'll restore its position.

> > bool is_reset_act_hi;
> > -   int svc_sysboot_gpio;
> > -   int wake_detect_gpio; /* bi-dir,maps to WAKE_MOD & WAKE_FRAME signals */
> > +   struct gpio_desc *wake_detect; /* bi-dir,maps to WAKE_MOD & WAKE_FRAME 
> > signals */
> >  
> > enum arche_platform_state state;
> >  
> > -   int svc_refclk_req;
> > +   struct gpio_desc *svc_refclk_req;
> > struct clk *svc_ref_clk;
> >  
> > struct pinctrl *pinctrl;
> > @@ -85,9 +84,9 @@ static void arche_platform_set_wake_detect_state(
> > arche_pdata->wake_detect_state = state;
> >  }
> >  
> > -static inline void svc_reset_onoff(unsigned int gpio, bool onoff)
> > +static inline void svc_reset_onoff(struct gpio_desc *gpio, bool onoff)
> >  {
> > -   gpio_set_value(gpio, onoff);
> > +   gpiod_set_value(gpio, onoff);
> >  }
> >  
> >  static int apb_cold_boot(struct device *dev, void *data)
> > @@ -116,7 +115,6 @@ static int apb_poweroff(struct device *dev, void *data)
> >  static void arche_platform_wd_irq_en(struct arche_platform_drvdata 
> > *arche_pdata)
> >  {
> > /* Enable interrupt here, to read event back from SVC */
> > -   gpio_direction_input(arche_pdata->wake_detect_gpio);
> > enable_irq(arche_pdata->wake_detect_irq);
> >  }
> >  
> > @@ -160,7 +158,7 @@ static irqreturn_t arche_platform_wd_irq(int irq, void 
> > *devid)
> >  
> > spin_lock_irqsave(_pdata->wake_lock, flags);
> >  
> > -   if (gpio_get_value(arche_pdata->wake_detect_gpio)) {
> > +   if (gpiod_get_value(arche_pdata->wake_detect)) {
> > /* wake/detect rising */
> >  
> > /*
> > @@ -224,10 +222,10 @@ arche_platform_coldboot_seq(struct 
> > arche_platform_drvdata *arche_pdata)
> >  
> > dev_info(arche_pdata->dev, "Booting from cold boot state\n");
> >  
> > -   svc_reset_onoff(arche_pdata->svc_reset_gpio,
> > +   svc_reset_onoff(arche_pdata->svc_reset,
> 
> No need to break line here.
> 
Ok.

> > arche_pdata->is_reset_act_hi);
> >  
> > -   gpio_set_value(arche_pdata->svc_sysboot_gpio, 0);
> > +   gpiod_set_value(arche_pdata->svc_sysboot, 0);
> > usleep_range(100, 200);
> >  
> > ret = clk_prepare_enable(arche_pdata->svc_ref_clk);
> > @@ -238,7 +236,7 @@ arche_platform_coldboot_seq(struct 
> > arche_platform_drvdata *arche_pdata)
> > }
> >  
> > /* bring SVC out of reset */
> > -   svc_reset_onoff(arche_pdata->svc_reset_gpio,
> > +   svc_reset_onoff(arche_pdata->svc_reset,
> 
> Same here. Please check throughout.
> 
Yes.

> > !arche_pdata->is_reset_act_hi);
> >  
> > arche_platform_set_state(arche_pdata, ARCHE_PLATFORM_STATE_ACTIVE);
> > @@ -259,10 +257,10 @@ arche_platform_fw_flashing_seq(struct 
> > arche_platform_drvdata *arche_pdata)
> >  
> > dev_info(arche_pdata->dev, "Switching to FW flashing state\n");
> >  
> > -   svc_reset_onoff(arche_pdata->svc_reset_gpio,
> > +   svc_reset_onoff(arche_pdata->svc_reset,
> &g

Re: [PATCH v3 2/3] staging: greybus: arche-apb-ctrl.c: Switch to the gpio descriptor interface

2018-12-22 Thread Nishad Kamdar
On Tue, Dec 18, 2018 at 12:35:40PM +0100, Johan Hovold wrote:
> On Thu, Nov 22, 2018 at 10:38:18PM +0530, Nishad Kamdar wrote:
> > Use the gpiod interface instead of the deprecated old non-descriptor
> > interface.
> > 
> > Signed-off-by: Nishad Kamdar 
> > ---
> > Changes in v2:
> >  - Resolved compilation errors.
> > ---
> >  drivers/staging/greybus/arche-apb-ctrl.c | 159 +--
> >  1 file changed, 65 insertions(+), 94 deletions(-)
> > 
> > diff --git a/drivers/staging/greybus/arche-apb-ctrl.c 
> > b/drivers/staging/greybus/arche-apb-ctrl.c
> > index be5ffed90bcf..e887f6aee20b 100644
> > --- a/drivers/staging/greybus/arche-apb-ctrl.c
> > +++ b/drivers/staging/greybus/arche-apb-ctrl.c
> > @@ -8,9 +8,8 @@
> >  
> >  #include 
> >  #include 
> > -#include 
> > +#include 
> >  #include 
> > -#include 
> >  #include 
> >  #include 
> >  #include 
> > @@ -24,12 +23,12 @@ static void apb_bootret_deassert(struct device *dev);
> >  
> >  struct arche_apb_ctrl_drvdata {
> > /* Control GPIO signals to and from AP <=> AP Bridges */
> > -   int resetn_gpio;
> > -   int boot_ret_gpio;
> > -   int pwroff_gpio;
> > -   int wake_in_gpio;
> > -   int wake_out_gpio;
> > -   int pwrdn_gpio;
> > +   struct gpio_desc *resetn;
> > +   struct gpio_desc *boot_ret;
> > +   struct gpio_desc *pwroff;
> > +   struct gpio_desc *wake_in;
> > +   struct gpio_desc *wake_out;
> > +   struct gpio_desc *pwrdn;
> >  
> > enum arche_platform_state state;
> > bool init_disabled;
> > @@ -37,28 +36,28 @@ struct arche_apb_ctrl_drvdata {
> > struct regulator *vcore;
> > struct regulator *vio;
> >  
> > -   int clk_en_gpio;
> > +   struct gpio_desc *clk_en;
> > struct clk *clk;
> >  
> > struct pinctrl *pinctrl;
> > struct pinctrl_state *pin_default;
> >  
> > /* V2: SPI Bus control  */
> > -   int spi_en_gpio;
> > +   struct gpio_desc *spi_en;
> > bool spi_en_polarity_high;
> >  };
> >  
> >  /*
> >   * Note that these low level api's are active high
> >   */
> > -static inline void deassert_reset(unsigned int gpio)
> > +static inline void deassert_reset(struct gpio_desc *gpio)
> >  {
> > -   gpio_set_value(gpio, 1);
> > +   gpiod_set_value(gpio, 1);
> >  }
> >  
> > -static inline void assert_reset(unsigned int gpio)
> > +static inline void assert_reset(struct gpio_desc *gpio)
> >  {
> > -   gpio_set_value(gpio, 0);
> > +   gpiod_set_value(gpio, 0);
> >  }
> 
> As the comment above deassert_reset() suggests, this change will
> actually change the semantics of these calls by taking any gpio flags
> into account (e.g. ACTIVE_LOW which will invert the signals).
> 
> Perhaps you should just use gpiod_set_raw_value() for now, and this can
> be addressed later. Alternatively, drop the comment and invert the
> polarity here and any users will need to update their device trees.
> 
> Either way, mention this in the commit message.
> 
Ok, I'll use the gpiod_set_raw_value().

> >  /*
> > @@ -75,11 +74,11 @@ static int coldboot_seq(struct platform_device *pdev)
> > return 0;
> >  
> > /* Hold APB in reset state */
> > -   assert_reset(apb->resetn_gpio);
> > +   assert_reset(apb->resetn);
> >  
> > if (apb->state == ARCHE_PLATFORM_STATE_FW_FLASHING &&
> > -   gpio_is_valid(apb->spi_en_gpio))
> > -   devm_gpio_free(dev, apb->spi_en_gpio);
> > +   apb->spi_en)
> 
> No need to break the line any more.
> 
Ok.

> > +   devm_gpiod_put(dev, apb->spi_en);
> >  
> > /* Enable power to APB */
> > if (!IS_ERR(apb->vcore)) {
> > @@ -101,13 +100,13 @@ static int coldboot_seq(struct platform_device *pdev)
> > apb_bootret_deassert(dev);
> >  
> > /* On DB3 clock was not mandatory */
> > -   if (gpio_is_valid(apb->clk_en_gpio))
> > -   gpio_set_value(apb->clk_en_gpio, 1);
> > +   if (apb->clk_en)
> > +   gpiod_set_value(apb->clk_en, 1);
> >  
> > usleep_range(100, 200);
> >  
> > /* deassert reset to APB : Active-low signal */
> > -   deassert_reset(apb->resetn_gpio);
> > +   deassert_reset(apb->resetn);
> >  
> > apb->state = ARCHE_PLATFORM_STATE_ACTIVE;
> >  
> > @@ -119,6 +118,7 @@ static int fw_flashing_seq(struct platform_device *pdev)
> >

Re: [PATCH v3 1/3] staging: greybus: gpio: switch GPIO portions to use GPIOLIB_IRQCHIP

2018-12-22 Thread Nishad Kamdar
On Tue, Dec 18, 2018 at 12:10:34PM +0100, Johan Hovold wrote:
> On Thu, Nov 22, 2018 at 10:37:16PM +0530, Nishad Kamdar wrote:
> > Convert the GPIO driver to use the GPIO irqchip library
> > GPIOLIB_IRQCHIP instead of reimplementing the same.
> > 
> > Signed-off-by: Nishad Kamdar 
> > ---
> > Changes in v2:
> >  - Retained irq.h and irqdomain.h headers.
> >  - Dropped function gb_gpio_irqchip_add() and
> >called gpiochip_irqchip_add() from probe().
> >  - Referred 
> > https://lkml.kernel.org/r/1476054589-28422-1-git-send-email-linus.wall...@linaro.org.
> 
> Thanks for the update, and sorry about the late review. This looks
> mostly good now, except for a couple minor things pointed out below.
> 
> You also included the conversion to gpiochip_get_data() (as Linus also
> did in his patch) although that's really a separate change and should go
> in its own patch. Please break that bit out in a follow-up patch.
> 
> Also note that someone did a bunch random white space changes to this
> file in the staging tree, so it will not apply cleanly any more.
> 
> > ---
> >  drivers/staging/greybus/Kconfig |   1 +
> >  drivers/staging/greybus/gpio.c  | 184 
> >  2 files changed, 24 insertions(+), 161 deletions(-)
> > 
> > diff --git a/drivers/staging/greybus/Kconfig 
> > b/drivers/staging/greybus/Kconfig
> > index ab096bcef98c..b571e4e8060b 100644
> > --- a/drivers/staging/greybus/Kconfig
> > +++ b/drivers/staging/greybus/Kconfig
> > @@ -148,6 +148,7 @@ if GREYBUS_BRIDGED_PHY
> >  config GREYBUS_GPIO
> > tristate "Greybus GPIO Bridged PHY driver"
> > depends on GPIOLIB
> > +   select GPIOLIB_IRQCHIP
> > ---help---
> >   Select this option if you have a device that follows the
> >   Greybus GPIO Bridged PHY Class specification.
> > diff --git a/drivers/staging/greybus/gpio.c b/drivers/staging/greybus/gpio.c
> > index b1d4698019a1..2ec54744171d 100644
> > --- a/drivers/staging/greybus/gpio.c
> > +++ b/drivers/staging/greybus/gpio.c
> > @@ -9,9 +9,9 @@
> >  #include 
> >  #include 
> >  #include 
> > -#include 
> >  #include 
> >  #include 
> > +#include 
> >  #include 
> >  
> >  #include "greybus.h"
> > @@ -39,15 +39,8 @@ struct gb_gpio_controller {
> >  
> > struct gpio_chipchip;
> > struct irq_chip irqc;
> 
> Turns out struct gpio_chip will have an irqchip whenever
> CONFIG_GPIOLIB_IRQCHIP is selected so you can drop this one too.
> 
Ok, I'll do that.
> > -   struct irq_chip *irqchip;
> > -   struct irq_domain   *irqdomain;
> > -   unsigned intirq_base;
> > -   irq_flow_handler_t  irq_handler;
> > -   unsigned intirq_default_type;
> > struct mutexirq_lock;
> >  };
> > -#define gpio_chip_to_gb_gpio_controller(chip) \
> > -   container_of(chip, struct gb_gpio_controller, chip)
> >  #define irq_data_to_gpio_chip(d) (d->domain->host_data)
> >  
> >  static int gb_gpio_line_count_operation(struct gb_gpio_controller *ggc)
> > @@ -276,7 +269,7 @@ static void _gb_gpio_irq_set_type(struct 
> > gb_gpio_controller *ggc,
> >  static void gb_gpio_irq_mask(struct irq_data *d)
> >  {
> > struct gpio_chip *chip = irq_data_to_gpio_chip(d);
> > -   struct gb_gpio_controller *ggc = gpio_chip_to_gb_gpio_controller(chip);
> > +   struct gb_gpio_controller *ggc = gpiochip_get_data(chip);
> 
> So please split these changes into a separate patch as they are not
> related to the irqchip changes.
> 
> Oh, and don't forget to update the TODO file now that the conversion is
> done. :)
> 
Sure, I'll do that.

Thanks for the review.
regards,
Nishad

> Thanks,
> Johan
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2] staging: mt7621-mmc: Fix incompletely removed #if 0 block in sd.c

2018-12-06 Thread Nishad Kamdar
Commit 2a54e3259e2a ("staging: mt7621-mmc: Remove #if 0 blocks in sd.c")
does not completely remove an #if 0 block in sd.c. This causes the function
msdc_select_clksrc() which was eariler not compiled, to be compiled.
That causes an error - MSDC_CLKSRC_REG is not defined.

This patch completely removes the #if 0 block

Reported-by: NeilBrown 
Fixes: 2a54e3259e2a ("staging: mt7621-mmc: Remove #if 0 blocks in sd.c")
Signed-off-by: Nishad Kamdar 
---
Changes in v2:
 - Modify commit message
 - Include Fixes: and Reported-by: tags
---
 drivers/staging/mt7621-mmc/sd.c | 20 
 1 file changed, 20 deletions(-)

diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c
index 7b66f9b0a094..3d918e481bd8 100644
--- a/drivers/staging/mt7621-mmc/sd.c
+++ b/drivers/staging/mt7621-mmc/sd.c
@@ -216,26 +216,6 @@ static void msdc_tasklet_card(struct work_struct *work)
spin_unlock(>lock);
 }
 
-static void msdc_select_clksrc(struct msdc_host *host, unsigned char clksrc)
-{
-   u32 val;
-
-   BUG_ON(clksrc > 3);
-
-   val = readl(host->base + MSDC_CLKSRC_REG);
-   if (readl(host->base + MSDC_ECO_VER) >= 4) {
-   val &= ~(0x3  << clk_src_bit[host->id]);
-   val |= clksrc << clk_src_bit[host->id];
-   } else {
-   val &= ~0x3; val |= clksrc;
-   }
-   writel(val, host->base + MSDC_CLKSRC_REG);
-
-   host->hclk = hclks[clksrc];
-   host->hw->clk_src = clksrc;
-}
-#endif /* end of --- */
-
 static void msdc_set_mclk(struct msdc_host *host, int ddr, unsigned int hz)
 {
//struct msdc_hw *hw = host->hw;
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: mt7621-mmc: Remove missed lines of the #if 0 block in sd.c

2018-12-06 Thread Nishad Kamdar
On Thu, Dec 06, 2018 at 08:08:24AM +1100, NeilBrown wrote:
> On Wed, Dec 05 2018, Nishad Kamdar wrote:
> 
> > The below patch
> > https://lore.kernel.org/patchwork/patch/995533/
> > does not completely remove an #if 0 block in sd.c.
> 
> Standard practice is to identify patches by their commit id.
> In this case you could
>   git log --oneline  drivers/staging/mt7621-mmc/sd.c
> 
> choose the right patch, and copy/paste with a bit of editing, so:
> 
>   Commit 2a54e3259e2a ("staging: mt7621-mmc: Remove #if 0 blocks in
>   sd.c") does not completely 
> 
> I have
> 
>   [alias]
>   cm = !git --no-pager show -s --format=cm
>   fx = !git --no-pager show -s --format=fixes
>   [pretty]
>   fixes = Fixes: %h (\"%s\")
>   cm = Commit %h (\"%s\")
> 
> in my $HOME/.gitconfig so I can get the text with, e.g.,
> 
>   $ git cm 2a54e3259e2a
>   Commit 2a54e3259e2a ("staging: mt7621-mmc: Remove #if 0 blocks in sd.c")
> 
> Then as that commit introduced a problem, it is best-practice to also do
> 
>   $ git fx 2a54e3259e2a
>   Fixes: 2a54e3259e2a ("staging: mt7621-mmc: Remove #if 0 blocks in sd.c")
> 
> and add the "Fixes" near the Signed-off-by line.
> 
> Thanks,
> NeilBrown
> 
> 
Ok. I'll do that and resubmit.

Thanks for the review and guidance.

Regards,
Nishad

> > This causes the function msdc_select_clksrc()
> > which was earler not compiled, to be compiled.
> > That causes an error - MSDC_CLKSRC_REG is not
> > defined.
> >
> > This patch completely removes the #if 0 block
> >
> > Signed-off-by: Nishad Kamdar 
> > ---
> >  drivers/staging/mt7621-mmc/sd.c | 20 
> >  1 file changed, 20 deletions(-)
> >
> > diff --git a/drivers/staging/mt7621-mmc/sd.c 
> > b/drivers/staging/mt7621-mmc/sd.c
> > index 7b66f9b0a094..3d918e481bd8 100644
> > --- a/drivers/staging/mt7621-mmc/sd.c
> > +++ b/drivers/staging/mt7621-mmc/sd.c
> > @@ -216,26 +216,6 @@ static void msdc_tasklet_card(struct work_struct *work)
> > spin_unlock(>lock);
> >  }
> >  
> > -static void msdc_select_clksrc(struct msdc_host *host, unsigned char 
> > clksrc)
> > -{
> > -   u32 val;
> > -
> > -   BUG_ON(clksrc > 3);
> > -
> > -   val = readl(host->base + MSDC_CLKSRC_REG);
> > -   if (readl(host->base + MSDC_ECO_VER) >= 4) {
> > -   val &= ~(0x3  << clk_src_bit[host->id]);
> > -   val |= clksrc << clk_src_bit[host->id];
> > -   } else {
> > -   val &= ~0x3; val |= clksrc;
> > -   }
> > -   writel(val, host->base + MSDC_CLKSRC_REG);
> > -
> > -   host->hclk = hclks[clksrc];
> > -   host->hw->clk_src = clksrc;
> > -}
> > -#endif /* end of --- */
> > -
> >  static void msdc_set_mclk(struct msdc_host *host, int ddr, unsigned int hz)
> >  {
> > //struct msdc_hw *hw = host->hw;
> > -- 
> > 2.17.1


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v6 1/3] staging: mt7621-mmc: Remove #if 0 blocks in sd.c

2018-12-05 Thread Nishad Kamdar
On Sun, Nov 18, 2018 at 08:33:03AM +1100, NeilBrown wrote:
> On Thu, Oct 04 2018, Nishad Kamdar wrote:
> 
> > This patch removes #if 0 code blocks and usages of
> > functions defined in the #if 0 blocks in sd.c.
> >
> > Signed-off-by: Nishad Kamdar 
> 
> Hi Nishad,
>  thanks for this patch (and others) and apologies for not
>  reviewing/testing it earlier.
>  Unfortunately there is a problem - see below.
>  
> >  
> > -#if 0 /* --- by chhung */
> > -/* For E2 only */
> > -static u8 clk_src_bit[4] = {
> > -   0, 3, 5, 7
> > -};
> > -
> >  static void msdc_select_clksrc(struct msdc_host *host, unsigned char 
> > clksrc)
> >  {
> > u32 val;
> 
> Above you removed the first few lines of a "#if 0" block, but not all of
> it.  Previously the function msdc_select_clksrc() was not compiled at
> all.  Now it is, and that causes an error - MSDC_CLKSRC_REG is not
> defined.
> 
> Would you be able to send a follow-patch patch which removes this
> function and the "#endif /* end of --- */" at the end?
> 
> Thanks,
> NeilBrown

Sure, I'll send the updated patch.

Thanks for the review.

Regards,
Nishad
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: mt7621-mmc: Remove missed lines of the #if 0 block in sd.c

2018-12-05 Thread Nishad Kamdar
The below patch
https://lore.kernel.org/patchwork/patch/995533/
does not completely remove an #if 0 block in sd.c.
This causes the function msdc_select_clksrc()
which was earler not compiled, to be compiled.
That causes an error - MSDC_CLKSRC_REG is not
defined.

This patch completely removes the #if 0 block

Signed-off-by: Nishad Kamdar 
---
 drivers/staging/mt7621-mmc/sd.c | 20 
 1 file changed, 20 deletions(-)

diff --git a/drivers/staging/mt7621-mmc/sd.c b/drivers/staging/mt7621-mmc/sd.c
index 7b66f9b0a094..3d918e481bd8 100644
--- a/drivers/staging/mt7621-mmc/sd.c
+++ b/drivers/staging/mt7621-mmc/sd.c
@@ -216,26 +216,6 @@ static void msdc_tasklet_card(struct work_struct *work)
spin_unlock(>lock);
 }
 
-static void msdc_select_clksrc(struct msdc_host *host, unsigned char clksrc)
-{
-   u32 val;
-
-   BUG_ON(clksrc > 3);
-
-   val = readl(host->base + MSDC_CLKSRC_REG);
-   if (readl(host->base + MSDC_ECO_VER) >= 4) {
-   val &= ~(0x3  << clk_src_bit[host->id]);
-   val |= clksrc << clk_src_bit[host->id];
-   } else {
-   val &= ~0x3; val |= clksrc;
-   }
-   writel(val, host->base + MSDC_CLKSRC_REG);
-
-   host->hclk = hclks[clksrc];
-   host->hw->clk_src = clksrc;
-}
-#endif /* end of --- */
-
 static void msdc_set_mclk(struct msdc_host *host, int ddr, unsigned int hz)
 {
//struct msdc_hw *hw = host->hw;
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2] Staging: fbtft: Switch to the gpio descriptor interface

2018-12-04 Thread Nishad Kamdar
This switches the fbtft driver to use GPIO descriptors
rather than numerical gpios:

Utilize the GPIO library's intrinsic handling of OF GPIOs
and polarity. If the line is flagged active low, gpiolib
will deal with this.

Remove gpios from platform device structure. Neither assign
statically numbers to gpios in platform device nor allow
gpios to be parsed as module parameters.

Signed-off-by: Nishad Kamdar 
Changes in v2:
 - Merge all patches in a single patch. This is because the
   first patch changed par->gpio from an int to a pointer
   so all the checks have to be updated in the same patch.
   Otherwie it breaks 'git bisect'.
---
 drivers/staging/fbtft/fb_agm1264k-fl.c |  52 ++--
 drivers/staging/fbtft/fb_bd663474.c|   6 +-
 drivers/staging/fbtft/fb_ili9163.c |   6 +-
 drivers/staging/fbtft/fb_ili9320.c |   2 +-
 drivers/staging/fbtft/fb_ili9325.c |   6 +-
 drivers/staging/fbtft/fb_ili9340.c |   2 +-
 drivers/staging/fbtft/fb_pcd8544.c |   4 +-
 drivers/staging/fbtft/fb_ra8875.c  |   4 +-
 drivers/staging/fbtft/fb_s6d1121.c |   6 +-
 drivers/staging/fbtft/fb_sh1106.c  |   2 +-
 drivers/staging/fbtft/fb_ssd1289.c |   6 +-
 drivers/staging/fbtft/fb_ssd1305.c |   4 +-
 drivers/staging/fbtft/fb_ssd1306.c |   4 +-
 drivers/staging/fbtft/fb_ssd1325.c |   6 +-
 drivers/staging/fbtft/fb_ssd1331.c |  10 +-
 drivers/staging/fbtft/fb_ssd1351.c |   2 +-
 drivers/staging/fbtft/fb_tls8204.c |   6 +-
 drivers/staging/fbtft/fb_uc1611.c  |   4 +-
 drivers/staging/fbtft/fb_uc1701.c  |   6 +-
 drivers/staging/fbtft/fb_upd161704.c   |   6 +-
 drivers/staging/fbtft/fb_watterott.c   |   4 +-
 drivers/staging/fbtft/fbtft-bus.c  |   6 +-
 drivers/staging/fbtft/fbtft-core.c | 173 +++--
 drivers/staging/fbtft/fbtft-io.c   |  26 +-
 drivers/staging/fbtft/fbtft.h  |  21 +-
 drivers/staging/fbtft/fbtft_device.c   | 344 +
 drivers/staging/fbtft/flexfb.c |  12 +-
 27 files changed, 143 insertions(+), 587 deletions(-)

diff --git a/drivers/staging/fbtft/fb_agm1264k-fl.c 
b/drivers/staging/fbtft/fb_agm1264k-fl.c
index f6f30f5bf15a..8f27bd8da17d 100644
--- a/drivers/staging/fbtft/fb_agm1264k-fl.c
+++ b/drivers/staging/fbtft/fb_agm1264k-fl.c
@@ -8,7 +8,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
@@ -79,14 +79,14 @@ static int init_display(struct fbtft_par *par)
 
 static void reset(struct fbtft_par *par)
 {
-   if (par->gpio.reset == -1)
+   if (!par->gpio.reset)
return;
 
dev_dbg(par->info->device, "%s()\n", __func__);
 
-   gpio_set_value(par->gpio.reset, 0);
+   gpiod_set_value(par->gpio.reset, 0);
udelay(20);
-   gpio_set_value(par->gpio.reset, 1);
+   gpiod_set_value(par->gpio.reset, 1);
mdelay(120);
 }
 
@@ -98,30 +98,30 @@ static int verify_gpios(struct fbtft_par *par)
dev_dbg(par->info->device,
"%s()\n", __func__);
 
-   if (par->EPIN < 0) {
+   if (!par->EPIN) {
dev_err(par->info->device,
"Missing info about 'wr' (aka E) gpio. Aborting.\n");
return -EINVAL;
}
for (i = 0; i < 8; ++i) {
-   if (par->gpio.db[i] < 0) {
+   if (!par->gpio.db[i]) {
dev_err(par->info->device,
"Missing info about 'db[%i]' gpio. Aborting.\n",
i);
return -EINVAL;
}
}
-   if (par->CS0 < 0) {
+   if (!par->CS0) {
dev_err(par->info->device,
"Missing info about 'cs0' gpio. Aborting.\n");
return -EINVAL;
}
-   if (par->CS1 < 0) {
+   if (!par->CS1) {
dev_err(par->info->device,
"Missing info about 'cs1' gpio. Aborting.\n");
return -EINVAL;
}
-   if (par->RW < 0) {
+   if (!par->RW) {
dev_err(par->info->device,
"Missing info about 'rw' gpio. Aborting.\n");
return -EINVAL;
@@ -139,22 +139,22 @@ request_gpios_match(struct fbtft_par *par, const struct 
fbtft_gpio *gpio)
if (strcasecmp(gpio->name, "wr") == 0) {
/* left ks0108 E pin */
par->EPIN = gpio->gpio;
-   return GPIOF_OUT_INIT_LOW;
+   return GPIOD_OUT_LOW;
} else if (strcasecmp(gpio->name, "cs0") == 0) {
/* left ks0108 controller pin */
par->CS0 = gpio->gpio;
-   return GPIOF_OUT_INIT_HIGH;
+   return GPIOD_OUT_HIGH;
} else if (strcasecmp(gpio->name, "cs1

Re: [PATCH 04/26] Staging: fbtft: flexfb: Switch to the gpio descriptor interface

2018-12-04 Thread Nishad Kamdar
On Mon, Nov 26, 2018 at 01:13:08PM +0300, Dan Carpenter wrote:
> On Sun, Nov 25, 2018 at 04:56:29PM +0530, Nishad Kamdar wrote:
> > This switches the flexfb.c to use GPIO descriptors
> > rather than numerical gpios.
> > 
> > Signed-off-by: Nishad Kamdar 
> > ---
> >  drivers/staging/fbtft/flexfb.c | 12 ++--
> >  1 file changed, 6 insertions(+), 6 deletions(-)
> > 
> > diff --git a/drivers/staging/fbtft/flexfb.c b/drivers/staging/fbtft/flexfb.c
> > index 2af474469e7d..c5fa59105a43 100644
> > --- a/drivers/staging/fbtft/flexfb.c
> > +++ b/drivers/staging/fbtft/flexfb.c
> > @@ -9,7 +9,7 @@
> >  #include 
> >  #include 
> >  #include 
> > -#include 
> > +#include 
> >  #include 
> >  #include 
> >  
> > @@ -521,7 +521,7 @@ static int flexfb_verify_gpios_dc(struct fbtft_par *par)
> >  {
> > fbtft_par_dbg(DEBUG_VERIFY_GPIOS, par, "%s()\n", __func__);
> >  
> > -   if (par->gpio.dc < 0) {
> > +   if (!par->gpio.dc) {
> > dev_err(par->info->device,
> > "Missing info about 'dc' gpio. Aborting.\n");
> > return -EINVAL;
> 
> We changed par->gpio.c from an int to a pointer in patch 1 so we have
> to update all the checks as well in the same patch.  Otherwise it breaks
> `git bisect`.
> 
> (I don't know this code well.  But it just feels like it has to be
> breaking git bisect just from from glancing at the patches.  Perhaps I
> have misunderstood).
> 
> regards,
> dan carpenter
> 
Ok. I'll merge them into one patch.

Thanks for the review and the pointer.

Regards,
Nishad
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 26/26] Staging: fbtft: fb_ra8875: Switch to the gpio descriptor interface

2018-11-25 Thread Nishad Kamdar
This switches the fb_ra8875.c to use GPIO descriptors
rather than numerical gpios.

Signed-off-by: Nishad Kamdar 
---
 drivers/staging/fbtft/fb_ra8875.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/fbtft/fb_ra8875.c 
b/drivers/staging/fbtft/fb_ra8875.c
index 5d3b76ca74d8..70b37fc7fb66 100644
--- a/drivers/staging/fbtft/fb_ra8875.c
+++ b/drivers/staging/fbtft/fb_ra8875.c
@@ -9,7 +9,7 @@
 #include 
 #include 
 
-#include 
+#include 
 #include "fbtft.h"
 
 #define DRVNAME "fb_ra8875"
@@ -39,7 +39,7 @@ static int write_spi(struct fbtft_par *par, void *buf, size_t 
len)
 
 static int init_display(struct fbtft_par *par)
 {
-   gpio_set_value(par->gpio.dc, 1);
+   gpiod_set_value(par->gpio.dc, 1);
 
fbtft_par_dbg(DEBUG_INIT_DISPLAY, par,
  "%s()\n", __func__);
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 25/26] Staging: fbtft: fb_watterott: Switch to the gpio descriptor interface

2018-11-25 Thread Nishad Kamdar
This switches the fb_watterott.c to use GPIO descriptors
rather than numerical gpios.

Signed-off-by: Nishad Kamdar 
---
 drivers/staging/fbtft/fb_watterott.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/fbtft/fb_watterott.c 
b/drivers/staging/fbtft/fb_watterott.c
index e77178157f1b..0a5206d28da4 100644
--- a/drivers/staging/fbtft/fb_watterott.c
+++ b/drivers/staging/fbtft/fb_watterott.c
@@ -8,7 +8,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 #include "fbtft.h"
@@ -213,7 +213,7 @@ static int set_var(struct fbtft_par *par)
 
 static int verify_gpios(struct fbtft_par *par)
 {
-   if (par->gpio.reset < 0) {
+   if (!par->gpio.reset) {
dev_err(par->info->device, "Missing 'reset' gpio. Aborting.\n");
return -EINVAL;
}
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 24/26] Staging: fbtft: fb_tls8204: Switch to the gpio descriptor interface

2018-11-25 Thread Nishad Kamdar
This switches the fb_tls8204.c to use GPIO descriptors
rather than numerical gpios.

Signed-off-by: Nishad Kamdar 
---
 drivers/staging/fbtft/fb_tls8204.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/fbtft/fb_tls8204.c 
b/drivers/staging/fbtft/fb_tls8204.c
index 277b6ed9c725..bec6dd0ffb01 100644
--- a/drivers/staging/fbtft/fb_tls8204.c
+++ b/drivers/staging/fbtft/fb_tls8204.c
@@ -12,7 +12,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
@@ -94,7 +94,7 @@ static int write_vmem(struct fbtft_par *par, size_t offset, 
size_t len)
/* The display is 102x68 but the LCD is 84x48.
 * Set the write pointer at the start of each row.
 */
-   gpio_set_value(par->gpio.dc, 0);
+   gpiod_set_value(par->gpio.dc, 0);
write_reg(par, 0x80 | 0);
write_reg(par, 0x40 | y);
 
@@ -109,7 +109,7 @@ static int write_vmem(struct fbtft_par *par, size_t offset, 
size_t len)
*buf++ = ch;
}
/* Write the row */
-   gpio_set_value(par->gpio.dc, 1);
+   gpiod_set_value(par->gpio.dc, 1);
ret = par->fbtftops.write(par, par->txbuf.buf, WIDTH);
if (ret < 0) {
dev_err(par->info->device,
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 23/26] Staging: fbtft: fb_ssd1305: Switch to the gpio descriptor interface

2018-11-25 Thread Nishad Kamdar
This switches the fb_ssd1305.c to use GPIO descriptors
rather than numerical gpios.

Signed-off-by: Nishad Kamdar 
---
 drivers/staging/fbtft/fb_ssd1305.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/fbtft/fb_ssd1305.c 
b/drivers/staging/fbtft/fb_ssd1305.c
index 3515888d94c9..020fe48fed0b 100644
--- a/drivers/staging/fbtft/fb_ssd1305.c
+++ b/drivers/staging/fbtft/fb_ssd1305.c
@@ -8,7 +8,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 #include "fbtft.h"
@@ -168,7 +168,7 @@ static int write_vmem(struct fbtft_par *par, size_t offset, 
size_t len)
}
 
/* Write data */
-   gpio_set_value(par->gpio.dc, 1);
+   gpiod_set_value(par->gpio.dc, 1);
ret = par->fbtftops.write(par, par->txbuf.buf,
  par->info->var.xres * par->info->var.yres /
  8);
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 22/26] Staging: fbtft: fb_pcd8544: Switch to the gpio descriptor interface

2018-11-25 Thread Nishad Kamdar
This switches the fb_pcd8544.c to use GPIO descriptors
rather than numerical gpios.

Signed-off-by: Nishad Kamdar 
---
 drivers/staging/fbtft/fb_pcd8544.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/fbtft/fb_pcd8544.c 
b/drivers/staging/fbtft/fb_pcd8544.c
index 32172f8f79f0..ad49973ad594 100644
--- a/drivers/staging/fbtft/fb_pcd8544.c
+++ b/drivers/staging/fbtft/fb_pcd8544.c
@@ -11,7 +11,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
@@ -119,7 +119,7 @@ static int write_vmem(struct fbtft_par *par, size_t offset, 
size_t len)
}
 
/* Write data */
-   gpio_set_value(par->gpio.dc, 1);
+   gpiod_set_value(par->gpio.dc, 1);
ret = par->fbtftops.write(par, par->txbuf.buf, 6 * 84);
if (ret < 0)
dev_err(par->info->device, "write failed and returned: %d\n",
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 21/26] Staging: fbtft: fb_agm1264k-fl: Switch to the gpio descriptor interface

2018-11-25 Thread Nishad Kamdar
This switches the fb_agm1264k-fl.c to use GPIO descriptors
rather than numerical gpios.

Signed-off-by: Nishad Kamdar 
---
 drivers/staging/fbtft/fb_agm1264k-fl.c | 52 +-
 1 file changed, 26 insertions(+), 26 deletions(-)

diff --git a/drivers/staging/fbtft/fb_agm1264k-fl.c 
b/drivers/staging/fbtft/fb_agm1264k-fl.c
index f6f30f5bf15a..8f27bd8da17d 100644
--- a/drivers/staging/fbtft/fb_agm1264k-fl.c
+++ b/drivers/staging/fbtft/fb_agm1264k-fl.c
@@ -8,7 +8,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
@@ -79,14 +79,14 @@ static int init_display(struct fbtft_par *par)
 
 static void reset(struct fbtft_par *par)
 {
-   if (par->gpio.reset == -1)
+   if (!par->gpio.reset)
return;
 
dev_dbg(par->info->device, "%s()\n", __func__);
 
-   gpio_set_value(par->gpio.reset, 0);
+   gpiod_set_value(par->gpio.reset, 0);
udelay(20);
-   gpio_set_value(par->gpio.reset, 1);
+   gpiod_set_value(par->gpio.reset, 1);
mdelay(120);
 }
 
@@ -98,30 +98,30 @@ static int verify_gpios(struct fbtft_par *par)
dev_dbg(par->info->device,
"%s()\n", __func__);
 
-   if (par->EPIN < 0) {
+   if (!par->EPIN) {
dev_err(par->info->device,
"Missing info about 'wr' (aka E) gpio. Aborting.\n");
return -EINVAL;
}
for (i = 0; i < 8; ++i) {
-   if (par->gpio.db[i] < 0) {
+   if (!par->gpio.db[i]) {
dev_err(par->info->device,
"Missing info about 'db[%i]' gpio. Aborting.\n",
i);
return -EINVAL;
}
}
-   if (par->CS0 < 0) {
+   if (!par->CS0) {
dev_err(par->info->device,
"Missing info about 'cs0' gpio. Aborting.\n");
return -EINVAL;
}
-   if (par->CS1 < 0) {
+   if (!par->CS1) {
dev_err(par->info->device,
"Missing info about 'cs1' gpio. Aborting.\n");
return -EINVAL;
}
-   if (par->RW < 0) {
+   if (!par->RW) {
dev_err(par->info->device,
"Missing info about 'rw' gpio. Aborting.\n");
return -EINVAL;
@@ -139,22 +139,22 @@ request_gpios_match(struct fbtft_par *par, const struct 
fbtft_gpio *gpio)
if (strcasecmp(gpio->name, "wr") == 0) {
/* left ks0108 E pin */
par->EPIN = gpio->gpio;
-   return GPIOF_OUT_INIT_LOW;
+   return GPIOD_OUT_LOW;
} else if (strcasecmp(gpio->name, "cs0") == 0) {
/* left ks0108 controller pin */
par->CS0 = gpio->gpio;
-   return GPIOF_OUT_INIT_HIGH;
+   return GPIOD_OUT_HIGH;
} else if (strcasecmp(gpio->name, "cs1") == 0) {
/* right ks0108 controller pin */
par->CS1 = gpio->gpio;
-   return GPIOF_OUT_INIT_HIGH;
+   return GPIOD_OUT_HIGH;
}
 
/* if write (rw = 0) e(1->0) perform write */
/* if read (rw = 1) e(0->1) set data on D0-7*/
else if (strcasecmp(gpio->name, "rw") == 0) {
par->RW = gpio->gpio;
-   return GPIOF_OUT_INIT_LOW;
+   return GPIOD_OUT_LOW;
}
 
return FBTFT_GPIO_NO_MATCH;
@@ -194,15 +194,15 @@ static void write_reg8_bus8(struct fbtft_par *par, int 
len, ...)
/* select chip */
if (*buf) {
/* cs1 */
-   gpio_set_value(par->CS0, 1);
-   gpio_set_value(par->CS1, 0);
+   gpiod_set_value(par->CS0, 1);
+   gpiod_set_value(par->CS1, 0);
} else {
/* cs0 */
-   gpio_set_value(par->CS0, 0);
-   gpio_set_value(par->CS1, 1);
+   gpiod_set_value(par->CS0, 0);
+   gpiod_set_value(par->CS1, 1);
}
 
-   gpio_set_value(par->RS, 0); /* RS->0 (command mode) */
+   gpiod_set_value(par->RS, 0); /* RS->0 (command mode) */
len--;
 
if (len) {
@@ -364,7 +364,7 @@ static int write_vmem(struct fbtft_par *par, size_t offset, 
size_t len)
write_reg(par, 0x00, (0x17 << 3) | (u8)y);
 
/* write bitmap */
-   gpio_set_value(par->RS, 1); /* RS->1 (data mode) */
+   gpiod_set_value(par->RS, 1); /* RS->1 (data mode) */
ret = par->fbtftops.write(par, buf, len);
if (re

[PATCH 20/26] Staging: fbtft: fb_ili9163: Switch to the gpio descriptor interface

2018-11-25 Thread Nishad Kamdar
This switches the fb_ili9163.c to use GPIO descriptors
rather than numerical gpios.

Signed-off-by: Nishad Kamdar 
---
 drivers/staging/fbtft/fb_ili9163.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/fbtft/fb_ili9163.c 
b/drivers/staging/fbtft/fb_ili9163.c
index 86e140244aab..d609a2b67db9 100644
--- a/drivers/staging/fbtft/fb_ili9163.c
+++ b/drivers/staging/fbtft/fb_ili9163.c
@@ -11,7 +11,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
@@ -77,8 +77,8 @@ static int init_display(struct fbtft_par *par)
 {
par->fbtftops.reset(par);
 
-   if (par->gpio.cs != -1)
-   gpio_set_value(par->gpio.cs, 0);  /* Activate chip */
+   if (!par->gpio.cs)
+   gpiod_set_value(par->gpio.cs, 0);  /* Activate chip */
 
write_reg(par, MIPI_DCS_SOFT_RESET); /* software reset */
mdelay(500);
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 19/26] Staging: fbtft: fb_ssd1331: Switch to the gpio descriptor interface

2018-11-25 Thread Nishad Kamdar
This switches the fb_ssd1331.c to use GPIO descriptors
rather than numerical gpios.

Signed-off-by: Nishad Kamdar 
---
 drivers/staging/fbtft/fb_ssd1331.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/fbtft/fb_ssd1331.c 
b/drivers/staging/fbtft/fb_ssd1331.c
index 0b614c84822e..9f54fe28d511 100644
--- a/drivers/staging/fbtft/fb_ssd1331.c
+++ b/drivers/staging/fbtft/fb_ssd1331.c
@@ -2,7 +2,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
@@ -80,8 +80,8 @@ static void write_reg8_bus8(struct fbtft_par *par, int len, 
...)
va_start(args, len);
 
*buf = (u8)va_arg(args, unsigned int);
-   if (par->gpio.dc != -1)
-   gpio_set_value(par->gpio.dc, 0);
+   if (!par->gpio.dc)
+   gpiod_set_value(par->gpio.dc, 0);
ret = par->fbtftops.write(par, par->buf, sizeof(u8));
if (ret < 0) {
va_end(args);
@@ -103,8 +103,8 @@ static void write_reg8_bus8(struct fbtft_par *par, int len, 
...)
return;
}
}
-   if (par->gpio.dc != -1)
-   gpio_set_value(par->gpio.dc, 1);
+   if (!par->gpio.dc)
+   gpiod_set_value(par->gpio.dc, 1);
va_end(args);
 }
 
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 18/26] Staging: fbtft: fb_bd663474: Switch to the gpio descriptor interface

2018-11-25 Thread Nishad Kamdar
This switches the fb_bd663474.c to use GPIO descriptors
rather than numerical gpios.

Signed-off-by: Nishad Kamdar 
---
 drivers/staging/fbtft/fb_bd663474.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/fbtft/fb_bd663474.c 
b/drivers/staging/fbtft/fb_bd663474.c
index a58c514f4721..b6c6d66e4eb1 100644
--- a/drivers/staging/fbtft/fb_bd663474.c
+++ b/drivers/staging/fbtft/fb_bd663474.c
@@ -12,7 +12,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 #include "fbtft.h"
@@ -24,8 +24,8 @@
 
 static int init_display(struct fbtft_par *par)
 {
-   if (par->gpio.cs != -1)
-   gpio_set_value(par->gpio.cs, 0);  /* Activate chip */
+   if (!par->gpio.cs)
+   gpiod_set_value(par->gpio.cs, 0);  /* Activate chip */
 
par->fbtftops.reset(par);
 
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 17/26] Staging: fbtft: fb_ssd1306: Switch to the gpio descriptor interface

2018-11-25 Thread Nishad Kamdar
This switches the fb_ssd1306.c to use GPIO descriptors
rather than numerical gpios.

Signed-off-by: Nishad Kamdar 
---
 drivers/staging/fbtft/fb_ssd1306.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/fbtft/fb_ssd1306.c 
b/drivers/staging/fbtft/fb_ssd1306.c
index 50172ddd94ae..d7c5e2e0eee9 100644
--- a/drivers/staging/fbtft/fb_ssd1306.c
+++ b/drivers/staging/fbtft/fb_ssd1306.c
@@ -8,7 +8,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 #include "fbtft.h"
@@ -190,7 +190,7 @@ static int write_vmem(struct fbtft_par *par, size_t offset, 
size_t len)
}
 
/* Write data */
-   gpio_set_value(par->gpio.dc, 1);
+   gpiod_set_value(par->gpio.dc, 1);
ret = par->fbtftops.write(par, par->txbuf.buf, xres * yres / 8);
if (ret < 0)
dev_err(par->info->device, "write failed and returned: %d\n",
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 16/26] Staging: fbtft: fb_uc1701: Switch to the gpio descriptor interface

2018-11-25 Thread Nishad Kamdar
This switches the fb_uc1701.c to use GPIO descriptors
rather than numerical gpios.

Signed-off-by: Nishad Kamdar 
---
 drivers/staging/fbtft/fb_uc1701.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/fbtft/fb_uc1701.c 
b/drivers/staging/fbtft/fb_uc1701.c
index 0a3531d6eb39..e4ccc73868a7 100644
--- a/drivers/staging/fbtft/fb_uc1701.c
+++ b/drivers/staging/fbtft/fb_uc1701.c
@@ -11,7 +11,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
@@ -136,9 +136,9 @@ static int write_vmem(struct fbtft_par *par, size_t offset, 
size_t len)
write_reg(par, LCD_PAGE_ADDRESS | (u8)y);
write_reg(par, 0x00);
write_reg(par, LCD_COL_ADDRESS);
-   gpio_set_value(par->gpio.dc, 1);
+   gpiod_set_value(par->gpio.dc, 1);
ret = par->fbtftops.write(par, par->txbuf.buf, WIDTH);
-   gpio_set_value(par->gpio.dc, 0);
+   gpiod_set_value(par->gpio.dc, 0);
}
 
if (ret < 0)
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 15/26] Staging: fbtft: fb_ssd1351: Switch to the gpio descriptor interface

2018-11-25 Thread Nishad Kamdar
This switches the fb_ssd1351.c to use GPIO descriptors
rather than numerical gpios.

Signed-off-by: Nishad Kamdar 
---
 drivers/staging/fbtft/fb_ssd1351.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/fbtft/fb_ssd1351.c 
b/drivers/staging/fbtft/fb_ssd1351.c
index 3da091b4d297..a8980d9f7557 100644
--- a/drivers/staging/fbtft/fb_ssd1351.c
+++ b/drivers/staging/fbtft/fb_ssd1351.c
@@ -2,7 +2,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 14/26] Staging: fbtft: fb_ssd1289: Switch to the gpio descriptor interface

2018-11-25 Thread Nishad Kamdar
This switches the fb_ssd1289.c to use GPIO descriptors
rather than numerical gpios.

Signed-off-by: Nishad Kamdar 
---
 drivers/staging/fbtft/fb_ssd1289.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/fbtft/fb_ssd1289.c 
b/drivers/staging/fbtft/fb_ssd1289.c
index c9b18b3ba4ab..bbf75f795234 100644
--- a/drivers/staging/fbtft/fb_ssd1289.c
+++ b/drivers/staging/fbtft/fb_ssd1289.c
@@ -10,7 +10,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 #include "fbtft.h"
 
@@ -28,8 +28,8 @@ static int init_display(struct fbtft_par *par)
 {
par->fbtftops.reset(par);
 
-   if (par->gpio.cs != -1)
-   gpio_set_value(par->gpio.cs, 0);  /* Activate chip */
+   if (!par->gpio.cs)
+   gpiod_set_value(par->gpio.cs, 0);  /* Activate chip */
 
write_reg(par, 0x00, 0x0001);
write_reg(par, 0x03, 0xA8A4);
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 13/26] Staging: fbtft: fb_ili9325: Switch to the gpio descriptor interface

2018-11-25 Thread Nishad Kamdar
This switches the fb_ili9325.c to use GPIO descriptors
rather than numerical gpios.

Signed-off-by: Nishad Kamdar 
---
 drivers/staging/fbtft/fb_ili9325.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/fbtft/fb_ili9325.c 
b/drivers/staging/fbtft/fb_ili9325.c
index 2cf75f2e03e2..b090e7ab6fdd 100644
--- a/drivers/staging/fbtft/fb_ili9325.c
+++ b/drivers/staging/fbtft/fb_ili9325.c
@@ -10,7 +10,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 #include "fbtft.h"
@@ -85,8 +85,8 @@ static int init_display(struct fbtft_par *par)
 {
par->fbtftops.reset(par);
 
-   if (par->gpio.cs != -1)
-   gpio_set_value(par->gpio.cs, 0);  /* Activate chip */
+   if (!par->gpio.cs)
+   gpiod_set_value(par->gpio.cs, 0);  /* Activate chip */
 
bt &= 0x07;
vc &= 0x07;
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 12/26] Staging: fbtft: fb_ssd1325: Switch to the gpio descriptor interface

2018-11-25 Thread Nishad Kamdar
This switches the fb_ssd1325.c to use GPIO descriptors
rather than numerical gpios.

Signed-off-by: Nishad Kamdar 
---
 drivers/staging/fbtft/fb_ssd1325.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/fbtft/fb_ssd1325.c 
b/drivers/staging/fbtft/fb_ssd1325.c
index f974f7fc4d79..8a3140d41d8b 100644
--- a/drivers/staging/fbtft/fb_ssd1325.c
+++ b/drivers/staging/fbtft/fb_ssd1325.c
@@ -6,7 +6,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 #include "fbtft.h"
@@ -35,7 +35,7 @@ static int init_display(struct fbtft_par *par)
 {
par->fbtftops.reset(par);
 
-   gpio_set_value(par->gpio.cs, 0);
+   gpiod_set_value(par->gpio.cs, 0);
 
write_reg(par, 0xb3);
write_reg(par, 0xf0);
@@ -155,7 +155,7 @@ static int write_vmem(struct fbtft_par *par, size_t offset, 
size_t len)
}
}
 
-   gpio_set_value(par->gpio.dc, 1);
+   gpiod_set_value(par->gpio.dc, 1);
 
/* Write data */
ret = par->fbtftops.write(par, par->txbuf.buf,
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 11/26] Staging: fbtft: fb_ili9340: Switch to the gpio descriptor interface

2018-11-25 Thread Nishad Kamdar
This switches the fb_ili9340.c to use GPIO descriptors
rather than numerical gpios.

Signed-off-by: Nishad Kamdar 
---
 drivers/staging/fbtft/fb_ili9340.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/fbtft/fb_ili9340.c 
b/drivers/staging/fbtft/fb_ili9340.c
index 430f21e50f4d..415183c7054a 100644
--- a/drivers/staging/fbtft/fb_ili9340.c
+++ b/drivers/staging/fbtft/fb_ili9340.c
@@ -8,7 +8,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 10/26] Staging: fbtft: fb_ili9320: Switch to the gpio descriptor interface

2018-11-25 Thread Nishad Kamdar
This switches the fb_ili9320.c to use GPIO descriptors
rather than numerical gpios.

Signed-off-by: Nishad Kamdar 
---
 drivers/staging/fbtft/fb_ili9320.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/fbtft/fb_ili9320.c 
b/drivers/staging/fbtft/fb_ili9320.c
index 740c0acbecd8..ea6e001288ce 100644
--- a/drivers/staging/fbtft/fb_ili9320.c
+++ b/drivers/staging/fbtft/fb_ili9320.c
@@ -8,7 +8,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 09/26] Staging: fbtft: fb_s6d1211: Switch to the gpio descriptor interface

2018-11-25 Thread Nishad Kamdar
This switches the fb_s6d1211.c to use GPIO descriptors
rather than numerical gpios.

Signed-off-by: Nishad Kamdar 
---
 drivers/staging/fbtft/fb_s6d1121.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/fbtft/fb_s6d1121.c 
b/drivers/staging/fbtft/fb_s6d1121.c
index aa716f33420a..b3d0701880fe 100644
--- a/drivers/staging/fbtft/fb_s6d1121.c
+++ b/drivers/staging/fbtft/fb_s6d1121.c
@@ -12,7 +12,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 #include "fbtft.h"
@@ -29,8 +29,8 @@ static int init_display(struct fbtft_par *par)
 {
par->fbtftops.reset(par);
 
-   if (par->gpio.cs != -1)
-   gpio_set_value(par->gpio.cs, 0);  /* Activate chip */
+   if (!par->gpio.cs)
+   gpiod_set_value(par->gpio.cs, 0);  /* Activate chip */
 
/* Initialization sequence from Lib_UTFT */
 
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 08/26] Staging: fbtft: fb_uc1611: Switch to the gpio descriptor interface

2018-11-25 Thread Nishad Kamdar
This switches the fb_uc1611.c to use GPIO descriptors
rather than numerical gpios.

Signed-off-by: Nishad Kamdar 
---
 drivers/staging/fbtft/fb_uc1611.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/fbtft/fb_uc1611.c 
b/drivers/staging/fbtft/fb_uc1611.c
index dfaf8bc70f73..65681d0fe200 100644
--- a/drivers/staging/fbtft/fb_uc1611.c
+++ b/drivers/staging/fbtft/fb_uc1611.c
@@ -10,7 +10,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
@@ -251,7 +251,7 @@ static int write_vmem(struct fbtft_par *par, size_t offset, 
size_t len)
}
break;
}
-   gpio_set_value(par->gpio.dc, 1);
+   gpiod_set_value(par->gpio.dc, 1);
 
/* Write data */
ret = par->fbtftops.write(par, par->txbuf.buf, len / 2);
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 07/26] Staging: fbtft: fb_sh1106: Switch to the gpio descriptor interface

2018-11-25 Thread Nishad Kamdar
This switches the fb_sh1106.c to use GPIO descriptors
rather than numerical gpios.

Signed-off-by: Nishad Kamdar 
---
 drivers/staging/fbtft/fb_sh1106.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/fbtft/fb_sh1106.c 
b/drivers/staging/fbtft/fb_sh1106.c
index 00096f8d249a..6f7249493ea3 100644
--- a/drivers/staging/fbtft/fb_sh1106.c
+++ b/drivers/staging/fbtft/fb_sh1106.c
@@ -9,7 +9,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 #include "fbtft.h"
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 06/26] Staging: fbtft: fb_upd161704: Switch to the gpio descriptor interface

2018-11-25 Thread Nishad Kamdar
This switches the fb_upd161704.c to use GPIO descriptors
rather than numerical gpios.

Signed-off-by: Nishad Kamdar 
---
 drivers/staging/fbtft/fb_upd161704.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/fbtft/fb_upd161704.c 
b/drivers/staging/fbtft/fb_upd161704.c
index acc425fdf34e..564a38e34440 100644
--- a/drivers/staging/fbtft/fb_upd161704.c
+++ b/drivers/staging/fbtft/fb_upd161704.c
@@ -12,7 +12,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 
 #include "fbtft.h"
@@ -26,8 +26,8 @@ static int init_display(struct fbtft_par *par)
 {
par->fbtftops.reset(par);
 
-   if (par->gpio.cs != -1)
-   gpio_set_value(par->gpio.cs, 0);  /* Activate chip */
+   if (!par->gpio.cs)
+   gpiod_set_value(par->gpio.cs, 0);  /* Activate chip */
 
/* Initialization sequence from Lib_UTFT */
 
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 05/26] Staging: fbtft: fbtft-device: Switch to the gpio descriptor interface

2018-11-25 Thread Nishad Kamdar
This switches the fbtft-device.c to use GPIO descriptors
rather than numerical gpios: Remove gpios from platform
device structure. Neither assign statically numbers to gpios
in platform device nor allow gpios to be parsed as module
parameters.

Signed-off-by: Nishad Kamdar 
---
 drivers/staging/fbtft/fbtft-core.c   |  87 ---
 drivers/staging/fbtft/fbtft.h|   1 -
 drivers/staging/fbtft/fbtft_device.c | 344 +--
 3 files changed, 8 insertions(+), 424 deletions(-)

diff --git a/drivers/staging/fbtft/fbtft-core.c 
b/drivers/staging/fbtft/fbtft-core.c
index 75ee16074126..904ba7470abf 100644
--- a/drivers/staging/fbtft/fbtft-core.c
+++ b/drivers/staging/fbtft/fbtft-core.c
@@ -70,92 +70,6 @@ void fbtft_dbg_hex(const struct device *dev, int groupsize,
 }
 EXPORT_SYMBOL(fbtft_dbg_hex);
 
-static unsigned long fbtft_request_gpios_match(struct fbtft_par *par,
-  struct fbtft_gpio *gpio)
-{
-   int ret;
-   unsigned int val;
-
-   fbtft_par_dbg(DEBUG_REQUEST_GPIOS_MATCH, par, "%s('%s')\n",
- __func__, gpio->name);
-
-   if (strcasecmp(gpio->name, "reset") == 0) {
-   par->gpio.reset = gpio->gpio;
-   return GPIOD_OUT_HIGH;
-   } else if (strcasecmp(gpio->name, "dc") == 0) {
-   par->gpio.dc = gpio->gpio;
-   return GPIOD_OUT_LOW;
-   } else if (strcasecmp(gpio->name, "cs") == 0) {
-   par->gpio.cs = gpio->gpio;
-   return GPIOD_OUT_HIGH;
-   } else if (strcasecmp(gpio->name, "wr") == 0) {
-   par->gpio.wr = gpio->gpio;
-   return GPIOD_OUT_HIGH;
-   } else if (strcasecmp(gpio->name, "rd") == 0) {
-   par->gpio.rd = gpio->gpio;
-   return GPIOD_OUT_HIGH;
-   } else if (strcasecmp(gpio->name, "latch") == 0) {
-   par->gpio.latch = gpio->gpio;
-   return GPIOD_OUT_LOW;
-   } else if (gpio->name[0] == 'd' && gpio->name[1] == 'b') {
-   ret = kstrtouint(>name[2], 10, );
-   if (ret == 0 && val < 16) {
-   par->gpio.db[val] = gpio->gpio;
-   return GPIOD_OUT_LOW;
-   }
-   } else if (strcasecmp(gpio->name, "led") == 0) {
-   par->gpio.led[0] = gpio->gpio;
-   return GPIOD_OUT_LOW;
-   } else if (strcasecmp(gpio->name, "led_") == 0) {
-   par->gpio.led[0] = gpio->gpio;
-   return GPIOD_OUT_HIGH;
-   }
-
-   return FBTFT_GPIO_NO_MATCH;
-}
-
-static int fbtft_request_gpios(struct fbtft_par *par)
-{
-   struct fbtft_platform_data *pdata = par->pdata;
-   struct device *dev = par->info->device;
-   struct fbtft_gpio *gpio;
-   unsigned long flags;
-   int ret;
-
-   if (!(pdata && pdata->gpios))
-   return 0;
-
-   gpio = pdata->gpios;
-   while (gpio->name[0]) {
-   flags = FBTFT_GPIO_NO_MATCH;
-   /* if driver provides match function, try it first,
-* if no match use our own
-*/
-   if (par->fbtftops.request_gpios_match)
-   flags = par->fbtftops.request_gpios_match(par, gpio);
-   if (flags == FBTFT_GPIO_NO_MATCH)
-   flags = fbtft_request_gpios_match(par, gpio);
-   if (flags != FBTFT_GPIO_NO_MATCH) {
-   gpio->gpio = devm_gpiod_get(dev,
-   dev->driver->name, flags);
-   if (IS_ERR(gpio->gpio)) {
-   ret = PTR_ERR(gpio->gpio);
-   dev_err(dev,
-   "%s: Failed to request %s GPIO:%d\n",
-   __func__, gpio->name, ret);
-   return ret;
-
-   }
-   fbtft_par_dbg(DEBUG_REQUEST_GPIOS, par,
- "%s: '%s' GPIO\n",
- __func__, gpio->name);
-   }
-   gpio++;
-   }
-
-   return 0;
-}
-
 #ifdef CONFIG_OF
 static int fbtft_request_one_gpio(struct fbtft_par *par,
  const char *name, int index,
@@ -836,7 +750,6 @@ struct fb_info *fbtft_framebuffer_alloc(struct 
fbtft_display *display,
par->fbtftops.reset = fbtft_reset;
par->fbtftops.mkdirty = fbtft_mkdirty;
par->fbtftops.update_display = fbtft_update_display;
-   par->fbtftops.request_gpios = fbtft_request_gpios;
if (display->backlight)
par->fbtftops.r

[PATCH 04/26] Staging: fbtft: flexfb: Switch to the gpio descriptor interface

2018-11-25 Thread Nishad Kamdar
This switches the flexfb.c to use GPIO descriptors
rather than numerical gpios.

Signed-off-by: Nishad Kamdar 
---
 drivers/staging/fbtft/flexfb.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/fbtft/flexfb.c b/drivers/staging/fbtft/flexfb.c
index 2af474469e7d..c5fa59105a43 100644
--- a/drivers/staging/fbtft/flexfb.c
+++ b/drivers/staging/fbtft/flexfb.c
@@ -9,7 +9,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
@@ -521,7 +521,7 @@ static int flexfb_verify_gpios_dc(struct fbtft_par *par)
 {
fbtft_par_dbg(DEBUG_VERIFY_GPIOS, par, "%s()\n", __func__);
 
-   if (par->gpio.dc < 0) {
+   if (!par->gpio.dc) {
dev_err(par->info->device,
"Missing info about 'dc' gpio. Aborting.\n");
return -EINVAL;
@@ -537,22 +537,22 @@ static int flexfb_verify_gpios_db(struct fbtft_par *par)
 
fbtft_par_dbg(DEBUG_VERIFY_GPIOS, par, "%s()\n", __func__);
 
-   if (par->gpio.dc < 0) {
+   if (!par->gpio.dc) {
dev_err(par->info->device, "Missing info about 'dc' gpio. 
Aborting.\n");
return -EINVAL;
}
-   if (par->gpio.wr < 0) {
+   if (!par->gpio.wr) {
dev_err(par->info->device, "Missing info about 'wr' gpio. 
Aborting.\n");
return -EINVAL;
}
-   if (latched && (par->gpio.latch < 0)) {
+   if (latched && !par->gpio.latch) {
dev_err(par->info->device, "Missing info about 'latch' gpio. 
Aborting.\n");
return -EINVAL;
}
if (latched)
num_db = buswidth / 2;
for (i = 0; i < num_db; i++) {
-   if (par->gpio.db[i] < 0) {
+   if (!par->gpio.db[i]) {
dev_err(par->info->device,
"Missing info about 'db%02d' gpio. Aborting.\n",
i);
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 03/26] Staging: fbtft: fbtft-io: Switch to the gpio descriptor interface

2018-11-25 Thread Nishad Kamdar
This switches the fbtft-io to use GPIO descriptors
rather than numerical gpios.

Signed-off-by: Nishad Kamdar 
---
 drivers/staging/fbtft/fbtft-io.c | 26 +-
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/fbtft/fbtft-io.c b/drivers/staging/fbtft/fbtft-io.c
index b5051d3d46a6..38cdad6203ea 100644
--- a/drivers/staging/fbtft/fbtft-io.c
+++ b/drivers/staging/fbtft/fbtft-io.c
@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 #include 
 #include 
-#include 
+#include 
 #include 
 #include "fbtft.h"
 
@@ -142,30 +142,30 @@ int fbtft_write_gpio8_wr(struct fbtft_par *par, void 
*buf, size_t len)
data = *(u8 *)buf;
 
/* Start writing by pulling down /WR */
-   gpio_set_value(par->gpio.wr, 0);
+   gpiod_set_value(par->gpio.wr, 0);
 
/* Set data */
 #ifndef DO_NOT_OPTIMIZE_FBTFT_WRITE_GPIO
if (data == prev_data) {
-   gpio_set_value(par->gpio.wr, 0); /* used as delay */
+   gpiod_set_value(par->gpio.wr, 0); /* used as delay */
} else {
for (i = 0; i < 8; i++) {
if ((data & 1) != (prev_data & 1))
-   gpio_set_value(par->gpio.db[i],
-  data & 1);
+   gpiod_set_value(par->gpio.db[i],
+   data & 1);
data >>= 1;
prev_data >>= 1;
}
}
 #else
for (i = 0; i < 8; i++) {
-   gpio_set_value(par->gpio.db[i], data & 1);
+   gpiod_set_value(par->gpio.db[i], data & 1);
data >>= 1;
}
 #endif
 
/* Pullup /WR */
-   gpio_set_value(par->gpio.wr, 1);
+   gpiod_set_value(par->gpio.wr, 1);
 
 #ifndef DO_NOT_OPTIMIZE_FBTFT_WRITE_GPIO
prev_data = *(u8 *)buf;
@@ -192,30 +192,30 @@ int fbtft_write_gpio16_wr(struct fbtft_par *par, void 
*buf, size_t len)
data = *(u16 *)buf;
 
/* Start writing by pulling down /WR */
-   gpio_set_value(par->gpio.wr, 0);
+   gpiod_set_value(par->gpio.wr, 0);
 
/* Set data */
 #ifndef DO_NOT_OPTIMIZE_FBTFT_WRITE_GPIO
if (data == prev_data) {
-   gpio_set_value(par->gpio.wr, 0); /* used as delay */
+   gpiod_set_value(par->gpio.wr, 0); /* used as delay */
} else {
for (i = 0; i < 16; i++) {
if ((data & 1) != (prev_data & 1))
-   gpio_set_value(par->gpio.db[i],
-  data & 1);
+   gpiod_set_value(par->gpio.db[i],
+   data & 1);
data >>= 1;
prev_data >>= 1;
}
}
 #else
for (i = 0; i < 16; i++) {
-   gpio_set_value(par->gpio.db[i], data & 1);
+   gpiod_set_value(par->gpio.db[i], data & 1);
data >>= 1;
}
 #endif
 
/* Pullup /WR */
-   gpio_set_value(par->gpio.wr, 1);
+   gpiod_set_value(par->gpio.wr, 1);
 
 #ifndef DO_NOT_OPTIMIZE_FBTFT_WRITE_GPIO
prev_data = *(u16 *)buf;
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 02/26] Staging: fbtft: fbtft-bus: Switch to the gpio descriptor interface

2018-11-25 Thread Nishad Kamdar
This switches the fbtft-bus to use GPIO descriptors
rather than numerical gpios.

Signed-off-by: Nishad Kamdar 
---
 drivers/staging/fbtft/fbtft-bus.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/fbtft/fbtft-bus.c 
b/drivers/staging/fbtft/fbtft-bus.c
index 8ce1ff9b6c2a..2ea814d0dca5 100644
--- a/drivers/staging/fbtft/fbtft-bus.c
+++ b/drivers/staging/fbtft/fbtft-bus.c
@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 #include 
 #include 
-#include 
+#include 
 #include 
 #include "fbtft.h"
 
@@ -135,8 +135,8 @@ int fbtft_write_vmem16_bus8(struct fbtft_par *par, size_t 
offset, size_t len)
remain = len / 2;
vmem16 = (u16 *)(par->info->screen_buffer + offset);
 
-   if (par->gpio.dc != -1)
-   gpio_set_value(par->gpio.dc, 1);
+   if (!par->gpio.dc)
+   gpiod_set_value(par->gpio.dc, 1);
 
/* non buffered write */
if (!par->txbuf.buf)
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 01/26] Staging: fbtft: fbtft-core: Switch to the gpio descriptor interface

2018-11-25 Thread Nishad Kamdar
This switches the fbtft-core to use GPIO descriptors
rather than numerical gpios: Utilize the GPIO library's
intrinsic handling of OF GPIOs and polarity.
If the line is flagged active low, gpiolib will deal with
this.

Signed-off-by: Nishad Kamdar 
---
 drivers/staging/fbtft/fbtft-core.c | 127 -
 drivers/staging/fbtft/fbtft.h  |  22 ++---
 2 files changed, 61 insertions(+), 88 deletions(-)

diff --git a/drivers/staging/fbtft/fbtft-core.c 
b/drivers/staging/fbtft/fbtft-core.c
index a2df02d97a8e..75ee16074126 100644
--- a/drivers/staging/fbtft/fbtft-core.c
+++ b/drivers/staging/fbtft/fbtft-core.c
@@ -16,7 +16,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -24,7 +24,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #include "fbtft.h"
@@ -38,8 +37,8 @@ int fbtft_write_buf_dc(struct fbtft_par *par, void *buf, 
size_t len, int dc)
 {
int ret;
 
-   if (gpio_is_valid(par->gpio.dc))
-   gpio_set_value(par->gpio.dc, dc);
+   if (par->gpio.dc)
+   gpiod_set_value(par->gpio.dc, dc);
 
ret = par->fbtftops.write(par, buf, len);
if (ret < 0)
@@ -72,7 +71,7 @@ void fbtft_dbg_hex(const struct device *dev, int groupsize,
 EXPORT_SYMBOL(fbtft_dbg_hex);
 
 static unsigned long fbtft_request_gpios_match(struct fbtft_par *par,
-  const struct fbtft_gpio *gpio)
+  struct fbtft_gpio *gpio)
 {
int ret;
unsigned int val;
@@ -82,34 +81,34 @@ static unsigned long fbtft_request_gpios_match(struct 
fbtft_par *par,
 
if (strcasecmp(gpio->name, "reset") == 0) {
par->gpio.reset = gpio->gpio;
-   return GPIOF_OUT_INIT_HIGH;
+   return GPIOD_OUT_HIGH;
} else if (strcasecmp(gpio->name, "dc") == 0) {
par->gpio.dc = gpio->gpio;
-   return GPIOF_OUT_INIT_LOW;
+   return GPIOD_OUT_LOW;
} else if (strcasecmp(gpio->name, "cs") == 0) {
par->gpio.cs = gpio->gpio;
-   return GPIOF_OUT_INIT_HIGH;
+   return GPIOD_OUT_HIGH;
} else if (strcasecmp(gpio->name, "wr") == 0) {
par->gpio.wr = gpio->gpio;
-   return GPIOF_OUT_INIT_HIGH;
+   return GPIOD_OUT_HIGH;
} else if (strcasecmp(gpio->name, "rd") == 0) {
par->gpio.rd = gpio->gpio;
-   return GPIOF_OUT_INIT_HIGH;
+   return GPIOD_OUT_HIGH;
} else if (strcasecmp(gpio->name, "latch") == 0) {
par->gpio.latch = gpio->gpio;
-   return GPIOF_OUT_INIT_LOW;
+   return GPIOD_OUT_LOW;
} else if (gpio->name[0] == 'd' && gpio->name[1] == 'b') {
ret = kstrtouint(>name[2], 10, );
if (ret == 0 && val < 16) {
par->gpio.db[val] = gpio->gpio;
-   return GPIOF_OUT_INIT_LOW;
+   return GPIOD_OUT_LOW;
}
} else if (strcasecmp(gpio->name, "led") == 0) {
par->gpio.led[0] = gpio->gpio;
-   return GPIOF_OUT_INIT_LOW;
+   return GPIOD_OUT_LOW;
} else if (strcasecmp(gpio->name, "led_") == 0) {
par->gpio.led[0] = gpio->gpio;
-   return GPIOF_OUT_INIT_HIGH;
+   return GPIOD_OUT_HIGH;
}
 
return FBTFT_GPIO_NO_MATCH;
@@ -118,7 +117,8 @@ static unsigned long fbtft_request_gpios_match(struct 
fbtft_par *par,
 static int fbtft_request_gpios(struct fbtft_par *par)
 {
struct fbtft_platform_data *pdata = par->pdata;
-   const struct fbtft_gpio *gpio;
+   struct device *dev = par->info->device;
+   struct fbtft_gpio *gpio;
unsigned long flags;
int ret;
 
@@ -136,19 +136,19 @@ static int fbtft_request_gpios(struct fbtft_par *par)
if (flags == FBTFT_GPIO_NO_MATCH)
flags = fbtft_request_gpios_match(par, gpio);
if (flags != FBTFT_GPIO_NO_MATCH) {
-   ret = devm_gpio_request_one(par->info->device,
- gpio->gpio, flags,
- par->info->device->driver->name);
-   if (ret < 0) {
-   dev_err(par->info->device,
-   "%s: gpio_request_one('%s'=%d) failed 
with %d\n",
-   __func__, gpio->name,
-   gpio->gpio, ret);
+   gpio->gpio = devm_gpiod_get(dev,
+   

[PATCH 00/26] Staging: fbtft: Switch to the gpio descriptor interface

2018-11-25 Thread Nishad Kamdar
This switches the fbtft driver to use GPIO descriptors
rather than numerical gpios.

Nishad Kamdar (26):
  Staging: fbtft: fbtft-core: Switch to the gpio descriptor interface
  Staging: fbtft: fbtft-bus: Switch to the gpio descriptor interface
  Staging: fbtft: fbtft-io: Switch to the gpio descriptor interface
  Staging: fbtft: flexfb: Switch to the gpio descriptor interface
  Staging: fbtft: fbtft-device: Switch to the gpio descriptor interface
  Staging: fbtft: fb_upd161704: Switch to the gpio descriptor interface
  Staging: fbtft: fb_sh1106: Switch to the gpio descriptor interface
  Staging: fbtft: fb_uc1611: Switch to the gpio descriptor interface
  Staging: fbtft: fb_s6d1211: Switch to the gpio descriptor interface
  Staging: fbtft: fb_ili9320: Switch to the gpio descriptor interface
  Staging: fbtft: fb_ili9340: Switch to the gpio descriptor interface
  Staging: fbtft: fb_ssd1325: Switch to the gpio descriptor interface
  Staging: fbtft: fb_ili9325: Switch to the gpio descriptor interface
  Staging: fbtft: fb_ssd1289: Switch to the gpio descriptor interface
  Staging: fbtft: fb_ssd1351: Switch to the gpio descriptor interface
  Staging: fbtft: fb_uc1701: Switch to the gpio descriptor interface
  Staging: fbtft: fb_ssd1306: Switch to the gpio descriptor interface
  Staging: fbtft: fb_bd663474: Switch to the gpio descriptor interface
  Staging: fbtft: fb_ssd1331: Switch to the gpio descriptor interface
  Staging: fbtft: fb_ili9163: Switch to the gpio descriptor interface
  Staging: fbtft: fb_agm1264k-fl: Switch to the gpio descriptor
interface
  Staging: fbtft: fb_pcd8544: Switch to the gpio descriptor interface
  Staging: fbtft: fb_ssd1305: Switch to the gpio descriptor interface
  Staging: fbtft: fb_tls8204: Switch to the gpio descriptor interface
  Staging: fbtft: fb_watterott: Switch to the gpio descriptor interface
  Staging: fbtft: fb_ra8875: Switch to the gpio descriptor interface

 drivers/staging/fbtft/fb_agm1264k-fl.c |  52 ++--
 drivers/staging/fbtft/fb_bd663474.c|   6 +-
 drivers/staging/fbtft/fb_ili9163.c |   6 +-
 drivers/staging/fbtft/fb_ili9320.c |   2 +-
 drivers/staging/fbtft/fb_ili9325.c |   6 +-
 drivers/staging/fbtft/fb_ili9340.c |   2 +-
 drivers/staging/fbtft/fb_pcd8544.c |   4 +-
 drivers/staging/fbtft/fb_ra8875.c  |   4 +-
 drivers/staging/fbtft/fb_s6d1121.c |   6 +-
 drivers/staging/fbtft/fb_sh1106.c  |   2 +-
 drivers/staging/fbtft/fb_ssd1289.c |   6 +-
 drivers/staging/fbtft/fb_ssd1305.c |   4 +-
 drivers/staging/fbtft/fb_ssd1306.c |   4 +-
 drivers/staging/fbtft/fb_ssd1325.c |   6 +-
 drivers/staging/fbtft/fb_ssd1331.c |  10 +-
 drivers/staging/fbtft/fb_ssd1351.c |   2 +-
 drivers/staging/fbtft/fb_tls8204.c |   6 +-
 drivers/staging/fbtft/fb_uc1611.c  |   4 +-
 drivers/staging/fbtft/fb_uc1701.c  |   6 +-
 drivers/staging/fbtft/fb_upd161704.c   |   6 +-
 drivers/staging/fbtft/fb_watterott.c   |   4 +-
 drivers/staging/fbtft/fbtft-bus.c  |   6 +-
 drivers/staging/fbtft/fbtft-core.c | 170 ++--
 drivers/staging/fbtft/fbtft-io.c   |  26 +-
 drivers/staging/fbtft/fbtft.h  |  21 +-
 drivers/staging/fbtft/fbtft_device.c   | 344 +
 drivers/staging/fbtft/flexfb.c |  12 +-
 27 files changed, 142 insertions(+), 585 deletions(-)

-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 3/3] staging: greybus: arche-platform: Switch to the gpio descriptor interface

2018-11-22 Thread Nishad Kamdar
Use the gpiod interface instead of the deprecated
old non-descriptor interface.

Signed-off-by: Nishad Kamdar 
---
Changes in v2:
 - Move comment to the same line as to what it applies to.
---
 drivers/staging/greybus/arche-platform.c | 119 ---
 1 file changed, 41 insertions(+), 78 deletions(-)

diff --git a/drivers/staging/greybus/arche-platform.c 
b/drivers/staging/greybus/arche-platform.c
index 4c36e88766e7..a5cea79d8e32 100644
--- a/drivers/staging/greybus/arche-platform.c
+++ b/drivers/staging/greybus/arche-platform.c
@@ -8,10 +8,9 @@
 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -45,14 +44,14 @@ enum svc_wakedetect_state {
 
 struct arche_platform_drvdata {
/* Control GPIO signals to and from AP <=> SVC */
-   int svc_reset_gpio;
+   struct gpio_desc *svc_reset;
+   struct gpio_desc *svc_sysboot;
bool is_reset_act_hi;
-   int svc_sysboot_gpio;
-   int wake_detect_gpio; /* bi-dir,maps to WAKE_MOD & WAKE_FRAME signals */
+   struct gpio_desc *wake_detect; /* bi-dir,maps to WAKE_MOD & WAKE_FRAME 
signals */
 
enum arche_platform_state state;
 
-   int svc_refclk_req;
+   struct gpio_desc *svc_refclk_req;
struct clk *svc_ref_clk;
 
struct pinctrl *pinctrl;
@@ -85,9 +84,9 @@ static void arche_platform_set_wake_detect_state(
arche_pdata->wake_detect_state = state;
 }
 
-static inline void svc_reset_onoff(unsigned int gpio, bool onoff)
+static inline void svc_reset_onoff(struct gpio_desc *gpio, bool onoff)
 {
-   gpio_set_value(gpio, onoff);
+   gpiod_set_value(gpio, onoff);
 }
 
 static int apb_cold_boot(struct device *dev, void *data)
@@ -116,7 +115,6 @@ static int apb_poweroff(struct device *dev, void *data)
 static void arche_platform_wd_irq_en(struct arche_platform_drvdata 
*arche_pdata)
 {
/* Enable interrupt here, to read event back from SVC */
-   gpio_direction_input(arche_pdata->wake_detect_gpio);
enable_irq(arche_pdata->wake_detect_irq);
 }
 
@@ -160,7 +158,7 @@ static irqreturn_t arche_platform_wd_irq(int irq, void 
*devid)
 
spin_lock_irqsave(_pdata->wake_lock, flags);
 
-   if (gpio_get_value(arche_pdata->wake_detect_gpio)) {
+   if (gpiod_get_value(arche_pdata->wake_detect)) {
/* wake/detect rising */
 
/*
@@ -224,10 +222,10 @@ arche_platform_coldboot_seq(struct arche_platform_drvdata 
*arche_pdata)
 
dev_info(arche_pdata->dev, "Booting from cold boot state\n");
 
-   svc_reset_onoff(arche_pdata->svc_reset_gpio,
+   svc_reset_onoff(arche_pdata->svc_reset,
arche_pdata->is_reset_act_hi);
 
-   gpio_set_value(arche_pdata->svc_sysboot_gpio, 0);
+   gpiod_set_value(arche_pdata->svc_sysboot, 0);
usleep_range(100, 200);
 
ret = clk_prepare_enable(arche_pdata->svc_ref_clk);
@@ -238,7 +236,7 @@ arche_platform_coldboot_seq(struct arche_platform_drvdata 
*arche_pdata)
}
 
/* bring SVC out of reset */
-   svc_reset_onoff(arche_pdata->svc_reset_gpio,
+   svc_reset_onoff(arche_pdata->svc_reset,
!arche_pdata->is_reset_act_hi);
 
arche_platform_set_state(arche_pdata, ARCHE_PLATFORM_STATE_ACTIVE);
@@ -259,10 +257,10 @@ arche_platform_fw_flashing_seq(struct 
arche_platform_drvdata *arche_pdata)
 
dev_info(arche_pdata->dev, "Switching to FW flashing state\n");
 
-   svc_reset_onoff(arche_pdata->svc_reset_gpio,
+   svc_reset_onoff(arche_pdata->svc_reset,
arche_pdata->is_reset_act_hi);
 
-   gpio_set_value(arche_pdata->svc_sysboot_gpio, 1);
+   gpiod_set_value(arche_pdata->svc_sysboot, 1);
 
usleep_range(100, 200);
 
@@ -273,7 +271,7 @@ arche_platform_fw_flashing_seq(struct 
arche_platform_drvdata *arche_pdata)
return ret;
}
 
-   svc_reset_onoff(arche_pdata->svc_reset_gpio,
+   svc_reset_onoff(arche_pdata->svc_reset,
!arche_pdata->is_reset_act_hi);
 
arche_platform_set_state(arche_pdata, ARCHE_PLATFORM_STATE_FW_FLASHING);
@@ -305,7 +303,7 @@ arche_platform_poweroff_seq(struct arche_platform_drvdata 
*arche_pdata)
clk_disable_unprepare(arche_pdata->svc_ref_clk);
 
/* As part of exit, put APB back in reset state */
-   svc_reset_onoff(arche_pdata->svc_reset_gpio,
+   svc_reset_onoff(arche_pdata->svc_reset,
arche_pdata->is_reset_act_hi);
 
arche_platform_set_state(arche_pdata, ARCHE_PLATFORM_STATE_OFF);
@@ -435,6 +433,7 @@ static int arche_platform_probe(struct platform_device 
*pdev)
struct device *dev = >dev;
struct device_node *np = dev->of_node;
int ret;
+   unsigned int flags;
 
arche_pdata = devm_kzalloc(>dev, 

[PATCH v3 2/3] staging: greybus: arche-apb-ctrl.c: Switch to the gpio descriptor interface

2018-11-22 Thread Nishad Kamdar
Use the gpiod interface instead of the deprecated old non-descriptor
interface.

Signed-off-by: Nishad Kamdar 
---
Changes in v2:
 - Resolved compilation errors.
---
 drivers/staging/greybus/arche-apb-ctrl.c | 159 +--
 1 file changed, 65 insertions(+), 94 deletions(-)

diff --git a/drivers/staging/greybus/arche-apb-ctrl.c 
b/drivers/staging/greybus/arche-apb-ctrl.c
index be5ffed90bcf..e887f6aee20b 100644
--- a/drivers/staging/greybus/arche-apb-ctrl.c
+++ b/drivers/staging/greybus/arche-apb-ctrl.c
@@ -8,9 +8,8 @@
 
 #include 
 #include 
-#include 
+#include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -24,12 +23,12 @@ static void apb_bootret_deassert(struct device *dev);
 
 struct arche_apb_ctrl_drvdata {
/* Control GPIO signals to and from AP <=> AP Bridges */
-   int resetn_gpio;
-   int boot_ret_gpio;
-   int pwroff_gpio;
-   int wake_in_gpio;
-   int wake_out_gpio;
-   int pwrdn_gpio;
+   struct gpio_desc *resetn;
+   struct gpio_desc *boot_ret;
+   struct gpio_desc *pwroff;
+   struct gpio_desc *wake_in;
+   struct gpio_desc *wake_out;
+   struct gpio_desc *pwrdn;
 
enum arche_platform_state state;
bool init_disabled;
@@ -37,28 +36,28 @@ struct arche_apb_ctrl_drvdata {
struct regulator *vcore;
struct regulator *vio;
 
-   int clk_en_gpio;
+   struct gpio_desc *clk_en;
struct clk *clk;
 
struct pinctrl *pinctrl;
struct pinctrl_state *pin_default;
 
/* V2: SPI Bus control  */
-   int spi_en_gpio;
+   struct gpio_desc *spi_en;
bool spi_en_polarity_high;
 };
 
 /*
  * Note that these low level api's are active high
  */
-static inline void deassert_reset(unsigned int gpio)
+static inline void deassert_reset(struct gpio_desc *gpio)
 {
-   gpio_set_value(gpio, 1);
+   gpiod_set_value(gpio, 1);
 }
 
-static inline void assert_reset(unsigned int gpio)
+static inline void assert_reset(struct gpio_desc *gpio)
 {
-   gpio_set_value(gpio, 0);
+   gpiod_set_value(gpio, 0);
 }
 
 /*
@@ -75,11 +74,11 @@ static int coldboot_seq(struct platform_device *pdev)
return 0;
 
/* Hold APB in reset state */
-   assert_reset(apb->resetn_gpio);
+   assert_reset(apb->resetn);
 
if (apb->state == ARCHE_PLATFORM_STATE_FW_FLASHING &&
-   gpio_is_valid(apb->spi_en_gpio))
-   devm_gpio_free(dev, apb->spi_en_gpio);
+   apb->spi_en)
+   devm_gpiod_put(dev, apb->spi_en);
 
/* Enable power to APB */
if (!IS_ERR(apb->vcore)) {
@@ -101,13 +100,13 @@ static int coldboot_seq(struct platform_device *pdev)
apb_bootret_deassert(dev);
 
/* On DB3 clock was not mandatory */
-   if (gpio_is_valid(apb->clk_en_gpio))
-   gpio_set_value(apb->clk_en_gpio, 1);
+   if (apb->clk_en)
+   gpiod_set_value(apb->clk_en, 1);
 
usleep_range(100, 200);
 
/* deassert reset to APB : Active-low signal */
-   deassert_reset(apb->resetn_gpio);
+   deassert_reset(apb->resetn);
 
apb->state = ARCHE_PLATFORM_STATE_ACTIVE;
 
@@ -119,6 +118,7 @@ static int fw_flashing_seq(struct platform_device *pdev)
struct device *dev = >dev;
struct arche_apb_ctrl_drvdata *apb = platform_get_drvdata(pdev);
int ret;
+   unsigned long flags;
 
if (apb->init_disabled ||
apb->state == ARCHE_PLATFORM_STATE_FW_FLASHING)
@@ -136,25 +136,20 @@ static int fw_flashing_seq(struct platform_device *pdev)
return ret;
}
 
-   if (gpio_is_valid(apb->spi_en_gpio)) {
-   unsigned long flags;
+   if (apb->spi_en_polarity_high)
+   flags = GPIOD_OUT_HIGH;
+   else
+   flags = GPIOD_OUT_LOW;
 
-   if (apb->spi_en_polarity_high)
-   flags = GPIOF_OUT_INIT_HIGH;
-   else
-   flags = GPIOF_OUT_INIT_LOW;
-
-   ret = devm_gpio_request_one(dev, apb->spi_en_gpio,
-   flags, "apb_spi_en");
-   if (ret) {
-   dev_err(dev, "Failed requesting SPI bus en gpio %d\n",
-   apb->spi_en_gpio);
-   return ret;
-   }
+   apb->spi_en = devm_gpiod_get(dev, "gb,spi-en-gpio", flags);
+   if (IS_ERR(apb->spi_en)) {
+   ret = PTR_ERR(apb->spi_en);
+   dev_err(dev, "Failed requesting SPI bus en GPIO: %d\n", ret);
+   return ret;
}
 
/* for flashing device should be in reset state */
-   assert_reset(apb->resetn_gpio);
+   assert_reset(apb->resetn);
apb->state = ARCHE_PLATFORM_STATE_FW_FLASHING;
 
 

[PATCH v3 1/3] staging: greybus: gpio: switch GPIO portions to use GPIOLIB_IRQCHIP

2018-11-22 Thread Nishad Kamdar
Convert the GPIO driver to use the GPIO irqchip library
GPIOLIB_IRQCHIP instead of reimplementing the same.

Signed-off-by: Nishad Kamdar 
---
Changes in v2:
 - Retained irq.h and irqdomain.h headers.
 - Dropped function gb_gpio_irqchip_add() and
   called gpiochip_irqchip_add() from probe().
 - Referred 
https://lkml.kernel.org/r/1476054589-28422-1-git-send-email-linus.wall...@linaro.org.
---
 drivers/staging/greybus/Kconfig |   1 +
 drivers/staging/greybus/gpio.c  | 184 
 2 files changed, 24 insertions(+), 161 deletions(-)

diff --git a/drivers/staging/greybus/Kconfig b/drivers/staging/greybus/Kconfig
index ab096bcef98c..b571e4e8060b 100644
--- a/drivers/staging/greybus/Kconfig
+++ b/drivers/staging/greybus/Kconfig
@@ -148,6 +148,7 @@ if GREYBUS_BRIDGED_PHY
 config GREYBUS_GPIO
tristate "Greybus GPIO Bridged PHY driver"
depends on GPIOLIB
+   select GPIOLIB_IRQCHIP
---help---
  Select this option if you have a device that follows the
  Greybus GPIO Bridged PHY Class specification.
diff --git a/drivers/staging/greybus/gpio.c b/drivers/staging/greybus/gpio.c
index b1d4698019a1..2ec54744171d 100644
--- a/drivers/staging/greybus/gpio.c
+++ b/drivers/staging/greybus/gpio.c
@@ -9,9 +9,9 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
+#include 
 #include 
 
 #include "greybus.h"
@@ -39,15 +39,8 @@ struct gb_gpio_controller {
 
struct gpio_chipchip;
struct irq_chip irqc;
-   struct irq_chip *irqchip;
-   struct irq_domain   *irqdomain;
-   unsigned intirq_base;
-   irq_flow_handler_t  irq_handler;
-   unsigned intirq_default_type;
struct mutexirq_lock;
 };
-#define gpio_chip_to_gb_gpio_controller(chip) \
-   container_of(chip, struct gb_gpio_controller, chip)
 #define irq_data_to_gpio_chip(d) (d->domain->host_data)
 
 static int gb_gpio_line_count_operation(struct gb_gpio_controller *ggc)
@@ -276,7 +269,7 @@ static void _gb_gpio_irq_set_type(struct gb_gpio_controller 
*ggc,
 static void gb_gpio_irq_mask(struct irq_data *d)
 {
struct gpio_chip *chip = irq_data_to_gpio_chip(d);
-   struct gb_gpio_controller *ggc = gpio_chip_to_gb_gpio_controller(chip);
+   struct gb_gpio_controller *ggc = gpiochip_get_data(chip);
struct gb_gpio_line *line = >lines[d->hwirq];
 
line->masked = true;
@@ -286,7 +279,7 @@ static void gb_gpio_irq_mask(struct irq_data *d)
 static void gb_gpio_irq_unmask(struct irq_data *d)
 {
struct gpio_chip *chip = irq_data_to_gpio_chip(d);
-   struct gb_gpio_controller *ggc = gpio_chip_to_gb_gpio_controller(chip);
+   struct gb_gpio_controller *ggc = gpiochip_get_data(chip);
struct gb_gpio_line *line = >lines[d->hwirq];
 
line->masked = false;
@@ -296,7 +289,7 @@ static void gb_gpio_irq_unmask(struct irq_data *d)
 static int gb_gpio_irq_set_type(struct irq_data *d, unsigned int type)
 {
struct gpio_chip *chip = irq_data_to_gpio_chip(d);
-   struct gb_gpio_controller *ggc = gpio_chip_to_gb_gpio_controller(chip);
+   struct gb_gpio_controller *ggc = gpiochip_get_data(chip);
struct gb_gpio_line *line = >lines[d->hwirq];
struct device *dev = >gbphy_dev->dev;
u8 irq_type;
@@ -334,7 +327,7 @@ static int gb_gpio_irq_set_type(struct irq_data *d, 
unsigned int type)
 static void gb_gpio_irq_bus_lock(struct irq_data *d)
 {
struct gpio_chip *chip = irq_data_to_gpio_chip(d);
-   struct gb_gpio_controller *ggc = gpio_chip_to_gb_gpio_controller(chip);
+   struct gb_gpio_controller *ggc = gpiochip_get_data(chip);
 
mutex_lock(>irq_lock);
 }
@@ -342,7 +335,7 @@ static void gb_gpio_irq_bus_lock(struct irq_data *d)
 static void gb_gpio_irq_bus_sync_unlock(struct irq_data *d)
 {
struct gpio_chip *chip = irq_data_to_gpio_chip(d);
-   struct gb_gpio_controller *ggc = gpio_chip_to_gb_gpio_controller(chip);
+   struct gb_gpio_controller *ggc = gpiochip_get_data(chip);
struct gb_gpio_line *line = >lines[d->hwirq];
 
if (line->irq_type_pending) {
@@ -391,7 +384,7 @@ static int gb_gpio_request_handler(struct gb_operation *op)
return -EINVAL;
}
 
-   irq = irq_find_mapping(ggc->irqdomain, event->which);
+   irq = irq_find_mapping(ggc->chip.irq.domain, event->which);
if (!irq) {
dev_err(dev, "failed to find IRQ\n");
return -EINVAL;
@@ -411,21 +404,21 @@ static int gb_gpio_request_handler(struct gb_operation 
*op)
 
 static int gb_gpio_request(struct gpio_chip *chip, unsigned int offset)
 {
-   struct gb_gpio_controller *ggc = gpio_chip_to_gb_gpio_controller(chip);
+   struct gb_gpio_controller *ggc = gpiochip_get_data(chip);
 
return gb_gpio_activate_operation(ggc, (u8)offset);
 }

[PATCH v3 0/3] greybus: gpio: Switch to the gpio descriptor interface

2018-11-22 Thread Nishad Kamdar
This patch series converts uses of the old GPIO API to the GPIO
descriptor API. It also converts the GPIO driver to use the
GPIO irqchip library GPIOLIB_IRQCHIP instead of repimplementing
the same.

Changes in v3:
 - Combines the latest versions of the three greybus patches together
   in a patch series.

Nishad Kamdar (3):
  staging: greybus: gpio: switch GPIO portions to use GPIOLIB_IRQCHIP
  staging: greybus: arche-apb-ctrl.c: Switch to the gpio descriptor
interface
  staging: greybus: arche-platform: Switch to the gpio descriptor
interface

 drivers/staging/greybus/Kconfig  |   1 +
 drivers/staging/greybus/arche-apb-ctrl.c | 159 
 drivers/staging/greybus/arche-platform.c | 119 +--
 drivers/staging/greybus/gpio.c   | 184 +++
 4 files changed, 130 insertions(+), 333 deletions(-)

-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: greybus: arche-platform: Switch to the gpio descriptor interface

2018-11-22 Thread Nishad Kamdar
On Tue, Nov 20, 2018 at 10:49:54AM +0100, Greg Kroah-Hartman wrote:
> On Sat, Nov 17, 2018 at 04:40:27PM +0100, Johan Hovold wrote:
> > On Sat, Nov 17, 2018 at 12:41:11PM +0530, Nishad Kamdar wrote:
> > > On Fri, Nov 16, 2018 at 05:06:22PM +0100, Johan Hovold wrote:
> > > > On Fri, Nov 16, 2018 at 08:47:44PM +0530, Nishad Kamdar wrote:
> > > > > Use the gpiod interface instead of the deprecated
> > > > > old non-descriptor interface.
> > > > > 
> > > > > Signed-off-by: Nishad Kamdar 
> > > > > ---
> > > > 
> > > > Always include a change log here after the cut-off line so we know what
> > > > changed since previous versions.
> > > > 
> > > > Also include the patch revision in the Subject (e.g. "[PATCH v3]
> > > > staging: greybus: ...").
> > > > 
> > > 
> > > Ok, but this is the first patch version that I submitted
> > > for greybus: arche-platform.
> > 
> > Ah, sorry. I thought this was an update of the arche-apb-ctrl patch.
> 
> Me too.
> 
> I am totally confused as to what is, and is not, the latest versions of
> all of these patches :(
> 
> Nishad, can you resend all of your pending greybus patches, as a patch
> series, as "v3" so that I know which to properly review?  I've dropped
> all of your others from my review queue now.
> 
> thanks,
> 
> greg k-h

Ok, I'll do that.

Thanks for the review.

Regards,
Nishad
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2] staging: greybus: arche-platform: Switch to the gpio descriptor interface

2018-11-16 Thread Nishad Kamdar
Use the gpiod interface instead of the deprecated
old non-descriptor interface.

Signed-off-by: Nishad Kamdar 
---
Changes in v2:
 - Move comment to the same line as to what it applies to.
---
 drivers/staging/greybus/arche-platform.c | 119 ---
 1 file changed, 41 insertions(+), 78 deletions(-)

diff --git a/drivers/staging/greybus/arche-platform.c 
b/drivers/staging/greybus/arche-platform.c
index 4c36e88766e7..a5cea79d8e32 100644
--- a/drivers/staging/greybus/arche-platform.c
+++ b/drivers/staging/greybus/arche-platform.c
@@ -8,10 +8,9 @@
 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -45,14 +44,14 @@ enum svc_wakedetect_state {
 
 struct arche_platform_drvdata {
/* Control GPIO signals to and from AP <=> SVC */
-   int svc_reset_gpio;
+   struct gpio_desc *svc_reset;
+   struct gpio_desc *svc_sysboot;
bool is_reset_act_hi;
-   int svc_sysboot_gpio;
-   int wake_detect_gpio; /* bi-dir,maps to WAKE_MOD & WAKE_FRAME signals */
+   struct gpio_desc *wake_detect; /* bi-dir,maps to WAKE_MOD & WAKE_FRAME 
signals */
 
enum arche_platform_state state;
 
-   int svc_refclk_req;
+   struct gpio_desc *svc_refclk_req;
struct clk *svc_ref_clk;
 
struct pinctrl *pinctrl;
@@ -85,9 +84,9 @@ static void arche_platform_set_wake_detect_state(
arche_pdata->wake_detect_state = state;
 }
 
-static inline void svc_reset_onoff(unsigned int gpio, bool onoff)
+static inline void svc_reset_onoff(struct gpio_desc *gpio, bool onoff)
 {
-   gpio_set_value(gpio, onoff);
+   gpiod_set_value(gpio, onoff);
 }
 
 static int apb_cold_boot(struct device *dev, void *data)
@@ -116,7 +115,6 @@ static int apb_poweroff(struct device *dev, void *data)
 static void arche_platform_wd_irq_en(struct arche_platform_drvdata 
*arche_pdata)
 {
/* Enable interrupt here, to read event back from SVC */
-   gpio_direction_input(arche_pdata->wake_detect_gpio);
enable_irq(arche_pdata->wake_detect_irq);
 }
 
@@ -160,7 +158,7 @@ static irqreturn_t arche_platform_wd_irq(int irq, void 
*devid)
 
spin_lock_irqsave(_pdata->wake_lock, flags);
 
-   if (gpio_get_value(arche_pdata->wake_detect_gpio)) {
+   if (gpiod_get_value(arche_pdata->wake_detect)) {
/* wake/detect rising */
 
/*
@@ -224,10 +222,10 @@ arche_platform_coldboot_seq(struct arche_platform_drvdata 
*arche_pdata)
 
dev_info(arche_pdata->dev, "Booting from cold boot state\n");
 
-   svc_reset_onoff(arche_pdata->svc_reset_gpio,
+   svc_reset_onoff(arche_pdata->svc_reset,
arche_pdata->is_reset_act_hi);
 
-   gpio_set_value(arche_pdata->svc_sysboot_gpio, 0);
+   gpiod_set_value(arche_pdata->svc_sysboot, 0);
usleep_range(100, 200);
 
ret = clk_prepare_enable(arche_pdata->svc_ref_clk);
@@ -238,7 +236,7 @@ arche_platform_coldboot_seq(struct arche_platform_drvdata 
*arche_pdata)
}
 
/* bring SVC out of reset */
-   svc_reset_onoff(arche_pdata->svc_reset_gpio,
+   svc_reset_onoff(arche_pdata->svc_reset,
!arche_pdata->is_reset_act_hi);
 
arche_platform_set_state(arche_pdata, ARCHE_PLATFORM_STATE_ACTIVE);
@@ -259,10 +257,10 @@ arche_platform_fw_flashing_seq(struct 
arche_platform_drvdata *arche_pdata)
 
dev_info(arche_pdata->dev, "Switching to FW flashing state\n");
 
-   svc_reset_onoff(arche_pdata->svc_reset_gpio,
+   svc_reset_onoff(arche_pdata->svc_reset,
arche_pdata->is_reset_act_hi);
 
-   gpio_set_value(arche_pdata->svc_sysboot_gpio, 1);
+   gpiod_set_value(arche_pdata->svc_sysboot, 1);
 
usleep_range(100, 200);
 
@@ -273,7 +271,7 @@ arche_platform_fw_flashing_seq(struct 
arche_platform_drvdata *arche_pdata)
return ret;
}
 
-   svc_reset_onoff(arche_pdata->svc_reset_gpio,
+   svc_reset_onoff(arche_pdata->svc_reset,
!arche_pdata->is_reset_act_hi);
 
arche_platform_set_state(arche_pdata, ARCHE_PLATFORM_STATE_FW_FLASHING);
@@ -305,7 +303,7 @@ arche_platform_poweroff_seq(struct arche_platform_drvdata 
*arche_pdata)
clk_disable_unprepare(arche_pdata->svc_ref_clk);
 
/* As part of exit, put APB back in reset state */
-   svc_reset_onoff(arche_pdata->svc_reset_gpio,
+   svc_reset_onoff(arche_pdata->svc_reset,
arche_pdata->is_reset_act_hi);
 
arche_platform_set_state(arche_pdata, ARCHE_PLATFORM_STATE_OFF);
@@ -435,6 +433,7 @@ static int arche_platform_probe(struct platform_device 
*pdev)
struct device *dev = >dev;
struct device_node *np = dev->of_node;
int ret;
+   unsigned int flags;
 
arche_pdata = devm_kzalloc(>dev, 

Re: [PATCH] staging: greybus: arche-platform: Switch to the gpio descriptor interface

2018-11-16 Thread Nishad Kamdar
On Fri, Nov 16, 2018 at 05:06:22PM +0100, Johan Hovold wrote:
> On Fri, Nov 16, 2018 at 08:47:44PM +0530, Nishad Kamdar wrote:
> > Use the gpiod interface instead of the deprecated
> > old non-descriptor interface.
> > 
> > Signed-off-by: Nishad Kamdar 
> > ---
> 
> Always include a change log here after the cut-off line so we know what
> changed since previous versions.
> 
> Also include the patch revision in the Subject (e.g. "[PATCH v3]
> staging: greybus: ...").
> 

Ok, but this is the first patch version that I submitted
for greybus: arche-platform.

> >  drivers/staging/greybus/arche-platform.c | 120 ---
> >  1 file changed, 42 insertions(+), 78 deletions(-)
> > 
> > diff --git a/drivers/staging/greybus/arche-platform.c 
> > b/drivers/staging/greybus/arche-platform.c
> > index 4c36e88766e7..a826a1835628 100644
> > --- a/drivers/staging/greybus/arche-platform.c
> > +++ b/drivers/staging/greybus/arche-platform.c
> > @@ -8,10 +8,9 @@
> >  
> >  #include 
> >  #include 
> > -#include 
> > +#include 
> >  #include 
> >  #include 
> > -#include 
> >  #include 
> >  #include 
> >  #include 
> > @@ -45,14 +44,15 @@ enum svc_wakedetect_state {
> >  
> >  struct arche_platform_drvdata {
> > /* Control GPIO signals to and from AP <=> SVC */
> > -   int svc_reset_gpio;
> > +   struct gpio_desc *svc_reset;
> > +   struct gpio_desc *svc_sysboot;
> > bool is_reset_act_hi;
> > -   int svc_sysboot_gpio;
> > -   int wake_detect_gpio; /* bi-dir,maps to WAKE_MOD & WAKE_FRAME signals */
> > +   struct gpio_desc *wake_detect;
> > +   /* bi-dir,maps to WAKE_MOD & WAKE_FRAME signals */
> 
> I'm not commenting on the rest, but comments never go underneath what
> they apply to.
> 
> Just keep the current comment here, even if it's placement is a bit odd
> and makes the line be longer than 80 cols.
> 
> Johan

Ok, I'll keep that in mind.

Thanks for the review.

thanks and regards,
Nishad
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: greybus: arche-platform: Switch to the gpio descriptor interface

2018-11-16 Thread Nishad Kamdar
Use the gpiod interface instead of the deprecated
old non-descriptor interface.

Signed-off-by: Nishad Kamdar 
---
 drivers/staging/greybus/arche-platform.c | 120 ---
 1 file changed, 42 insertions(+), 78 deletions(-)

diff --git a/drivers/staging/greybus/arche-platform.c 
b/drivers/staging/greybus/arche-platform.c
index 4c36e88766e7..a826a1835628 100644
--- a/drivers/staging/greybus/arche-platform.c
+++ b/drivers/staging/greybus/arche-platform.c
@@ -8,10 +8,9 @@
 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -45,14 +44,15 @@ enum svc_wakedetect_state {
 
 struct arche_platform_drvdata {
/* Control GPIO signals to and from AP <=> SVC */
-   int svc_reset_gpio;
+   struct gpio_desc *svc_reset;
+   struct gpio_desc *svc_sysboot;
bool is_reset_act_hi;
-   int svc_sysboot_gpio;
-   int wake_detect_gpio; /* bi-dir,maps to WAKE_MOD & WAKE_FRAME signals */
+   struct gpio_desc *wake_detect;
+   /* bi-dir,maps to WAKE_MOD & WAKE_FRAME signals */
 
enum arche_platform_state state;
 
-   int svc_refclk_req;
+   struct gpio_desc *svc_refclk_req;
struct clk *svc_ref_clk;
 
struct pinctrl *pinctrl;
@@ -85,9 +85,9 @@ static void arche_platform_set_wake_detect_state(
arche_pdata->wake_detect_state = state;
 }
 
-static inline void svc_reset_onoff(unsigned int gpio, bool onoff)
+static inline void svc_reset_onoff(struct gpio_desc *gpio, bool onoff)
 {
-   gpio_set_value(gpio, onoff);
+   gpiod_set_value(gpio, onoff);
 }
 
 static int apb_cold_boot(struct device *dev, void *data)
@@ -116,7 +116,6 @@ static int apb_poweroff(struct device *dev, void *data)
 static void arche_platform_wd_irq_en(struct arche_platform_drvdata 
*arche_pdata)
 {
/* Enable interrupt here, to read event back from SVC */
-   gpio_direction_input(arche_pdata->wake_detect_gpio);
enable_irq(arche_pdata->wake_detect_irq);
 }
 
@@ -160,7 +159,7 @@ static irqreturn_t arche_platform_wd_irq(int irq, void 
*devid)
 
spin_lock_irqsave(_pdata->wake_lock, flags);
 
-   if (gpio_get_value(arche_pdata->wake_detect_gpio)) {
+   if (gpiod_get_value(arche_pdata->wake_detect)) {
/* wake/detect rising */
 
/*
@@ -224,10 +223,10 @@ arche_platform_coldboot_seq(struct arche_platform_drvdata 
*arche_pdata)
 
dev_info(arche_pdata->dev, "Booting from cold boot state\n");
 
-   svc_reset_onoff(arche_pdata->svc_reset_gpio,
+   svc_reset_onoff(arche_pdata->svc_reset,
arche_pdata->is_reset_act_hi);
 
-   gpio_set_value(arche_pdata->svc_sysboot_gpio, 0);
+   gpiod_set_value(arche_pdata->svc_sysboot, 0);
usleep_range(100, 200);
 
ret = clk_prepare_enable(arche_pdata->svc_ref_clk);
@@ -238,7 +237,7 @@ arche_platform_coldboot_seq(struct arche_platform_drvdata 
*arche_pdata)
}
 
/* bring SVC out of reset */
-   svc_reset_onoff(arche_pdata->svc_reset_gpio,
+   svc_reset_onoff(arche_pdata->svc_reset,
!arche_pdata->is_reset_act_hi);
 
arche_platform_set_state(arche_pdata, ARCHE_PLATFORM_STATE_ACTIVE);
@@ -259,10 +258,10 @@ arche_platform_fw_flashing_seq(struct 
arche_platform_drvdata *arche_pdata)
 
dev_info(arche_pdata->dev, "Switching to FW flashing state\n");
 
-   svc_reset_onoff(arche_pdata->svc_reset_gpio,
+   svc_reset_onoff(arche_pdata->svc_reset,
arche_pdata->is_reset_act_hi);
 
-   gpio_set_value(arche_pdata->svc_sysboot_gpio, 1);
+   gpiod_set_value(arche_pdata->svc_sysboot, 1);
 
usleep_range(100, 200);
 
@@ -273,7 +272,7 @@ arche_platform_fw_flashing_seq(struct 
arche_platform_drvdata *arche_pdata)
return ret;
}
 
-   svc_reset_onoff(arche_pdata->svc_reset_gpio,
+   svc_reset_onoff(arche_pdata->svc_reset,
!arche_pdata->is_reset_act_hi);
 
arche_platform_set_state(arche_pdata, ARCHE_PLATFORM_STATE_FW_FLASHING);
@@ -305,7 +304,7 @@ arche_platform_poweroff_seq(struct arche_platform_drvdata 
*arche_pdata)
clk_disable_unprepare(arche_pdata->svc_ref_clk);
 
/* As part of exit, put APB back in reset state */
-   svc_reset_onoff(arche_pdata->svc_reset_gpio,
+   svc_reset_onoff(arche_pdata->svc_reset,
arche_pdata->is_reset_act_hi);
 
arche_platform_set_state(arche_pdata, ARCHE_PLATFORM_STATE_OFF);
@@ -435,6 +434,7 @@ static int arche_platform_probe(struct platform_device 
*pdev)
struct device *dev = >dev;
struct device_node *np = dev->of_node;
int ret;
+   unsigned int flags;
 
arche_pdata = devm_kzalloc(>dev, sizeof(*arche_pdata),
  

Re: [PATCH v4 4/4] staging: iio: ad7816: Add device tree table.

2018-11-15 Thread Nishad Kamdar
On Thu, Nov 15, 2018 at 08:16:03AM +, Ardelean, Alexandru wrote:
> On Wed, 2018-11-14 at 23:16 +0530, Nishad Kamdar wrote:
> > Add device tree table for matching vendor ID.
> > 
> 
> This could have been just one patch.
> Something like 
>[PATCH v4] staging: iio: ad7816: Add device tree table.
> 
> It's no longer a series, because the other patches were applied already.
> 
> I don't think you need to re-spin this [it's up to Jonathan though].
> 
> It's just something to keep in mind for later when re-spinning patches or
> series of patches.
> 
> Alex
>

Ok. I'll keep that in mind.

Thanks for the review.

Regards,
Nishad

> > Signed-off-by: Nishad Kamdar 
> > ---
> >  drivers/staging/iio/adc/ad7816.c | 9 +
> >  1 file changed, 9 insertions(+)
> > 
> > diff --git a/drivers/staging/iio/adc/ad7816.c
> > b/drivers/staging/iio/adc/ad7816.c
> > index a2fead85cd46..925f7086bc07 100644
> > --- a/drivers/staging/iio/adc/ad7816.c
> > +++ b/drivers/staging/iio/adc/ad7816.c
> > @@ -422,6 +422,14 @@ static int ad7816_probe(struct spi_device *spi_dev)
> > return 0;
> >  }
> >  
> > +static const struct of_device_id ad7816_of_match[] = {
> > +   { .compatible = "adi,ad7816", },
> > +   { .compatible = "adi,ad7817", },
> > +   { .compatible = "adi,ad7818", },
> > +   { }
> > +};
> > +MODULE_DEVICE_TABLE(of, ad7816_of_match);
> > +
> >  static const struct spi_device_id ad7816_id[] = {
> > { "ad7816", ID_AD7816 },
> > { "ad7817", ID_AD7817 },
> > @@ -434,6 +442,7 @@ MODULE_DEVICE_TABLE(spi, ad7816_id);
> >  static struct spi_driver ad7816_driver = {
> > .driver = {
> > .name = "ad7816",
> > +   .of_match_table = of_match_ptr(ad7816_of_match),
> > },
> > .probe = ad7816_probe,
> > .id_table = ad7816_id,
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v4 4/4] staging: iio: ad7816: Add device tree table.

2018-11-14 Thread Nishad Kamdar
Add device tree table for matching vendor ID.

Signed-off-by: Nishad Kamdar 
---
 drivers/staging/iio/adc/ad7816.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/drivers/staging/iio/adc/ad7816.c b/drivers/staging/iio/adc/ad7816.c
index a2fead85cd46..925f7086bc07 100644
--- a/drivers/staging/iio/adc/ad7816.c
+++ b/drivers/staging/iio/adc/ad7816.c
@@ -422,6 +422,14 @@ static int ad7816_probe(struct spi_device *spi_dev)
return 0;
 }
 
+static const struct of_device_id ad7816_of_match[] = {
+   { .compatible = "adi,ad7816", },
+   { .compatible = "adi,ad7817", },
+   { .compatible = "adi,ad7818", },
+   { }
+};
+MODULE_DEVICE_TABLE(of, ad7816_of_match);
+
 static const struct spi_device_id ad7816_id[] = {
{ "ad7816", ID_AD7816 },
{ "ad7817", ID_AD7817 },
@@ -434,6 +442,7 @@ MODULE_DEVICE_TABLE(spi, ad7816_id);
 static struct spi_driver ad7816_driver = {
.driver = {
.name = "ad7816",
+   .of_match_table = of_match_ptr(ad7816_of_match),
},
.probe = ad7816_probe,
.id_table = ad7816_id,
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v4 0/4] staging: iio: ad7816: Switch to the gpio descriptor interface

2018-11-14 Thread Nishad Kamdar
Changes in v4:
 - Add all parts to the dt bindings as they
   are functionally different.
Changes in v3:
 - Drop busy pin in case of AD7818.
 - Set RD/WR pin and CONVST pin as outputs.
 - Add device tree table.

Nishad Kamdar (4):
  staging: iio: ad7816: Switch to the gpio descriptor interface
  staging: iio: ad7816: Do not use busy_pin in case of AD7818
  staging: iio: ad7816: Set RD/WR pin and CONVST pin as outputs.
  staging: iio: ad7816: Add device tree table.

 drivers/staging/iio/adc/ad7816.c | 113 +--
 1 file changed, 62 insertions(+), 51 deletions(-)

-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v3 1/4] staging: iio: ad7816: Switch to the gpio descriptor interface

2018-11-14 Thread Nishad Kamdar
On Sun, Nov 11, 2018 at 12:31:54PM +, Jonathan Cameron wrote:
> On Sun, 11 Nov 2018 12:24:05 +
> Jonathan Cameron  wrote:
> 
> > On Fri, 9 Nov 2018 13:05:17 +0530
> > Nishad Kamdar  wrote:
> > 
> > > Use the gpiod interface for rdwr_pin, convert_pin and busy_pin
> > > instead of the deprecated old non-descriptor interface.
> > > 
> > > Signed-off-by: Nishad Kamdar   
> > Applied to the togreg branch of iio.git and pushed out as testing
> > for the autobuilders to play with it.
> Actually no it isn't, because I applied the previous version back in
> October.  Please avoid resending patches that have already been applied.
> It gets very confusing!
> 
> Jonathan
>

Sorry about that. I'll keep that in mind.

Thanks for the review.

regards,
Nishad

> 
> > 
> > Thanks,
> > 
> > Jonathan
> > 
> > > ---
> > >  drivers/staging/iio/adc/ad7816.c | 80 ++--
> > >  1 file changed, 34 insertions(+), 46 deletions(-)
> > > 
> > > diff --git a/drivers/staging/iio/adc/ad7816.c 
> > > b/drivers/staging/iio/adc/ad7816.c
> > > index bf76a8620bdb..12c4e0ab4713 100644
> > > --- a/drivers/staging/iio/adc/ad7816.c
> > > +++ b/drivers/staging/iio/adc/ad7816.c
> > > @@ -7,7 +7,7 @@
> > >   */
> > >  
> > >  #include 
> > > -#include 
> > > +#include 
> > >  #include 
> > >  #include 
> > >  #include 
> > > @@ -44,9 +44,9 @@
> > >  
> > >  struct ad7816_chip_info {
> > >   struct spi_device *spi_dev;
> > > - u16 rdwr_pin;
> > > - u16 convert_pin;
> > > - u16 busy_pin;
> > > + struct gpio_desc *rdwr_pin;
> > > + struct gpio_desc *convert_pin;
> > > + struct gpio_desc *busy_pin;
> > >   u8  oti_data[AD7816_CS_MAX + 1];
> > >   u8  channel_id; /* 0 always be temperature */
> > >   u8  mode;
> > > @@ -61,28 +61,28 @@ static int ad7816_spi_read(struct ad7816_chip_info 
> > > *chip, u16 *data)
> > >   int ret = 0;
> > >   __be16 buf;
> > >  
> > > - gpio_set_value(chip->rdwr_pin, 1);
> > > - gpio_set_value(chip->rdwr_pin, 0);
> > > + gpiod_set_value(chip->rdwr_pin, 1);
> > > + gpiod_set_value(chip->rdwr_pin, 0);
> > >   ret = spi_write(spi_dev, >channel_id, sizeof(chip->channel_id));
> > >   if (ret < 0) {
> > >   dev_err(_dev->dev, "SPI channel setting error\n");
> > >   return ret;
> > >   }
> > > - gpio_set_value(chip->rdwr_pin, 1);
> > > + gpiod_set_value(chip->rdwr_pin, 1);
> > >  
> > >   if (chip->mode == AD7816_PD) { /* operating mode 2 */
> > > - gpio_set_value(chip->convert_pin, 1);
> > > - gpio_set_value(chip->convert_pin, 0);
> > > + gpiod_set_value(chip->convert_pin, 1);
> > > + gpiod_set_value(chip->convert_pin, 0);
> > >   } else { /* operating mode 1 */
> > > - gpio_set_value(chip->convert_pin, 0);
> > > - gpio_set_value(chip->convert_pin, 1);
> > > + gpiod_set_value(chip->convert_pin, 0);
> > > + gpiod_set_value(chip->convert_pin, 1);
> > >   }
> > >  
> > > - while (gpio_get_value(chip->busy_pin))
> > > + while (gpiod_get_value(chip->busy_pin))
> > >   cpu_relax();
> > >  
> > > - gpio_set_value(chip->rdwr_pin, 0);
> > > - gpio_set_value(chip->rdwr_pin, 1);
> > > + gpiod_set_value(chip->rdwr_pin, 0);
> > > + gpiod_set_value(chip->rdwr_pin, 1);
> > >   ret = spi_read(spi_dev, , sizeof(*data));
> > >   if (ret < 0) {
> > >   dev_err(_dev->dev, "SPI data read error\n");
> > > @@ -99,8 +99,8 @@ static int ad7816_spi_write(struct ad7816_chip_info 
> > > *chip, u8 data)
> > >   struct spi_device *spi_dev = chip->spi_dev;
> > >   int ret = 0;
> > >  
> > > - gpio_set_value(chip->rdwr_pin, 1);
> > > - gpio_set_value(chip->rdwr_pin, 0);
> > > + gpiod_set_value(chip->rdwr_pin, 1);
> > > + gpiod_set_value(chip->rdwr_pin, 0);
> > >   ret = spi_write(spi_dev, , sizeof(data));
> > >   if (ret < 0)
> > >   dev_err(_dev->dev, "SPI oti data write error\n");
> > > @@ -129,10 +129,10 @@ static ssize_t ad7816_store_mode(struct device *dev,
> > >   struct ad7816_chip_info *chip = iio_priv(in

Re: [PATCH v3 4/4] staging: iio: ad7816: Add device tree table.

2018-11-14 Thread Nishad Kamdar
On Sun, Nov 11, 2018 at 12:38:02PM +, Jonathan Cameron wrote:
> On Fri, 9 Nov 2018 08:11:57 +
> "Ardelean, Alexandru"  wrote:
> 
> > On Fri, 2018-11-09 at 13:08 +0530, Nishad Kamdar wrote:
> > > Add device tree table for matching vendor ID.  
> > 
> > One comment inline for this.
> > 
> > Thanks
> > Alex
> > 
> > > 
> > > Signed-off-by: Nishad Kamdar 
> > > ---
> > >  drivers/staging/iio/adc/ad7816.c | 7 +++
> > >  1 file changed, 7 insertions(+)
> > > 
> > > diff --git a/drivers/staging/iio/adc/ad7816.c
> > > b/drivers/staging/iio/adc/ad7816.c
> > > index a2fead85cd46..b8a9149fbac1 100644
> > > --- a/drivers/staging/iio/adc/ad7816.c
> > > +++ b/drivers/staging/iio/adc/ad7816.c
> > > @@ -422,6 +422,12 @@ static int ad7816_probe(struct spi_device *spi_dev)
> > >   return 0;
> > >  }
> > >  
> > > +static const struct of_device_id ad7816_of_match[] = {
> > > + { .compatible = "adi,ad7816", },  
> > 
> > I think you also need to add:
> > +   { .compatible = "adi,ad7817", },
> > +   { .compatible = "adi,ad7818", },
> > 
> 
> Yes, please add all parts to the dt binding.
> Particularly as they are functionally different in this case!
> 
> Please send a v4 for just this patch as the rest have now been
> applied.
> 
> Thanks,
> 
> 
> Jonathan
> 
> > > + { }
> > > +};
> > > +MODULE_DEVICE_TABLE(of, ad7816_of_match);
> > > +
> > >  static const struct spi_device_id ad7816_id[] = {
> > >   { "ad7816", ID_AD7816 },
> > >   { "ad7817", ID_AD7817 },
> > > @@ -434,6 +440,7 @@ MODULE_DEVICE_TABLE(spi, ad7816_id);
> > >  static struct spi_driver ad7816_driver = {
> > >   .driver = {
> > >   .name = "ad7816",
> > > + .of_match_table = of_match_ptr(ad7816_of_match),
> > >   },
> > >   .probe = ad7816_probe,
> > >   .id_table = ad7816_id,  
>

Ok. I'll do that.

Thanks for the reivew.

regards,
Nishad
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v3 4/4] staging: iio: ad7816: Add device tree table.

2018-11-14 Thread Nishad Kamdar
On Fri, Nov 09, 2018 at 08:11:57AM +, Ardelean, Alexandru wrote:
> On Fri, 2018-11-09 at 13:08 +0530, Nishad Kamdar wrote:
> > Add device tree table for matching vendor ID.
> 
> One comment inline for this.
> 
> Thanks
> Alex
> 
> > 
> > Signed-off-by: Nishad Kamdar 
> > ---
> >  drivers/staging/iio/adc/ad7816.c | 7 +++
> >  1 file changed, 7 insertions(+)
> > 
> > diff --git a/drivers/staging/iio/adc/ad7816.c
> > b/drivers/staging/iio/adc/ad7816.c
> > index a2fead85cd46..b8a9149fbac1 100644
> > --- a/drivers/staging/iio/adc/ad7816.c
> > +++ b/drivers/staging/iio/adc/ad7816.c
> > @@ -422,6 +422,12 @@ static int ad7816_probe(struct spi_device *spi_dev)
> > return 0;
> >  }
> >  
> > +static const struct of_device_id ad7816_of_match[] = {
> > +   { .compatible = "adi,ad7816", },
> 
> I think you also need to add:
> + { .compatible = "adi,ad7817", },
> + { .compatible = "adi,ad7818", },
> 
> > +   { }
> > +};
> > +MODULE_DEVICE_TABLE(of, ad7816_of_match);
> > +
> >  static const struct spi_device_id ad7816_id[] = {
> > { "ad7816", ID_AD7816 },
> > { "ad7817", ID_AD7817 },
> > @@ -434,6 +440,7 @@ MODULE_DEVICE_TABLE(spi, ad7816_id);
> >  static struct spi_driver ad7816_driver = {
> > .driver = {
> > .name = "ad7816",
> > +   .of_match_table = of_match_ptr(ad7816_of_match),
> > },
> > .probe = ad7816_probe,
> > .id_table = ad7816_id,

Ok. I'll do that.

Thanks for the review.

regards,
Nishad
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2] staging: greybus: gpio: switch GPIO portions to use GPIOLIB_IRQCHIP

2018-11-14 Thread Nishad Kamdar
Convert the GPIO driver to use the GPIO irqchip library
GPIOLIB_IRQCHIP instead of reimplementing the same.

Signed-off-by: Nishad Kamdar 
---
Changes in v2:
 - Retained irq.h and irqdomain.h headers.
 - Dropped function gb_gpio_irqchip_add() and
   called gpiochip_irqchip_add() from probe().
 - Referred 
https://lkml.kernel.org/r/1476054589-28422-1-git-send-email-linus.wall...@linaro.org.
---
 drivers/staging/greybus/Kconfig |   1 +
 drivers/staging/greybus/gpio.c  | 184 
 2 files changed, 24 insertions(+), 161 deletions(-)

diff --git a/drivers/staging/greybus/Kconfig b/drivers/staging/greybus/Kconfig
index ab096bcef98c..b571e4e8060b 100644
--- a/drivers/staging/greybus/Kconfig
+++ b/drivers/staging/greybus/Kconfig
@@ -148,6 +148,7 @@ if GREYBUS_BRIDGED_PHY
 config GREYBUS_GPIO
tristate "Greybus GPIO Bridged PHY driver"
depends on GPIOLIB
+   select GPIOLIB_IRQCHIP
---help---
  Select this option if you have a device that follows the
  Greybus GPIO Bridged PHY Class specification.
diff --git a/drivers/staging/greybus/gpio.c b/drivers/staging/greybus/gpio.c
index b1d4698019a1..2ec54744171d 100644
--- a/drivers/staging/greybus/gpio.c
+++ b/drivers/staging/greybus/gpio.c
@@ -9,9 +9,9 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
+#include 
 #include 
 
 #include "greybus.h"
@@ -39,15 +39,8 @@ struct gb_gpio_controller {
 
struct gpio_chipchip;
struct irq_chip irqc;
-   struct irq_chip *irqchip;
-   struct irq_domain   *irqdomain;
-   unsigned intirq_base;
-   irq_flow_handler_t  irq_handler;
-   unsigned intirq_default_type;
struct mutexirq_lock;
 };
-#define gpio_chip_to_gb_gpio_controller(chip) \
-   container_of(chip, struct gb_gpio_controller, chip)
 #define irq_data_to_gpio_chip(d) (d->domain->host_data)
 
 static int gb_gpio_line_count_operation(struct gb_gpio_controller *ggc)
@@ -276,7 +269,7 @@ static void _gb_gpio_irq_set_type(struct gb_gpio_controller 
*ggc,
 static void gb_gpio_irq_mask(struct irq_data *d)
 {
struct gpio_chip *chip = irq_data_to_gpio_chip(d);
-   struct gb_gpio_controller *ggc = gpio_chip_to_gb_gpio_controller(chip);
+   struct gb_gpio_controller *ggc = gpiochip_get_data(chip);
struct gb_gpio_line *line = >lines[d->hwirq];
 
line->masked = true;
@@ -286,7 +279,7 @@ static void gb_gpio_irq_mask(struct irq_data *d)
 static void gb_gpio_irq_unmask(struct irq_data *d)
 {
struct gpio_chip *chip = irq_data_to_gpio_chip(d);
-   struct gb_gpio_controller *ggc = gpio_chip_to_gb_gpio_controller(chip);
+   struct gb_gpio_controller *ggc = gpiochip_get_data(chip);
struct gb_gpio_line *line = >lines[d->hwirq];
 
line->masked = false;
@@ -296,7 +289,7 @@ static void gb_gpio_irq_unmask(struct irq_data *d)
 static int gb_gpio_irq_set_type(struct irq_data *d, unsigned int type)
 {
struct gpio_chip *chip = irq_data_to_gpio_chip(d);
-   struct gb_gpio_controller *ggc = gpio_chip_to_gb_gpio_controller(chip);
+   struct gb_gpio_controller *ggc = gpiochip_get_data(chip);
struct gb_gpio_line *line = >lines[d->hwirq];
struct device *dev = >gbphy_dev->dev;
u8 irq_type;
@@ -334,7 +327,7 @@ static int gb_gpio_irq_set_type(struct irq_data *d, 
unsigned int type)
 static void gb_gpio_irq_bus_lock(struct irq_data *d)
 {
struct gpio_chip *chip = irq_data_to_gpio_chip(d);
-   struct gb_gpio_controller *ggc = gpio_chip_to_gb_gpio_controller(chip);
+   struct gb_gpio_controller *ggc = gpiochip_get_data(chip);
 
mutex_lock(>irq_lock);
 }
@@ -342,7 +335,7 @@ static void gb_gpio_irq_bus_lock(struct irq_data *d)
 static void gb_gpio_irq_bus_sync_unlock(struct irq_data *d)
 {
struct gpio_chip *chip = irq_data_to_gpio_chip(d);
-   struct gb_gpio_controller *ggc = gpio_chip_to_gb_gpio_controller(chip);
+   struct gb_gpio_controller *ggc = gpiochip_get_data(chip);
struct gb_gpio_line *line = >lines[d->hwirq];
 
if (line->irq_type_pending) {
@@ -391,7 +384,7 @@ static int gb_gpio_request_handler(struct gb_operation *op)
return -EINVAL;
}
 
-   irq = irq_find_mapping(ggc->irqdomain, event->which);
+   irq = irq_find_mapping(ggc->chip.irq.domain, event->which);
if (!irq) {
dev_err(dev, "failed to find IRQ\n");
return -EINVAL;
@@ -411,21 +404,21 @@ static int gb_gpio_request_handler(struct gb_operation 
*op)
 
 static int gb_gpio_request(struct gpio_chip *chip, unsigned int offset)
 {
-   struct gb_gpio_controller *ggc = gpio_chip_to_gb_gpio_controller(chip);
+   struct gb_gpio_controller *ggc = gpiochip_get_data(chip);
 
return gb_gpio_activate_operation(ggc, (u8)offset);
 }

Re: [PATCH] greybus: gpio: switch GPIO portions to use GPIOLIB_IRQCHIP

2018-11-13 Thread Nishad Kamdar
On Mon, Nov 12, 2018 at 04:15:09PM +0100, Johan Hovold wrote:
> On Fri, Nov 09, 2018 at 01:17:41PM +0530, Nishad Kamdar wrote:
> > Convert the GPIO driver to use the GPIO irqchip library
> > GPIOLIB_IRQCHIP instead of reimplementing the same.
> 
> Thanks for picking this up. Linus W took a stab at it a couple of years
> ago, but it was never completed. You may want to take a look at that
> thread:
> 
>   
> https://lkml.kernel.org/r/1476054589-28422-1-git-send-email-linus.wall...@linaro.org

Thanks for the reference.

> 
> > Signed-off-by: Nishad Kamdar 
> > ---
> >  drivers/staging/greybus/Kconfig |   1 +
> >  drivers/staging/greybus/gpio.c  | 123 ++--
> >  2 files changed, 21 insertions(+), 103 deletions(-)
> > 
> > diff --git a/drivers/staging/greybus/Kconfig 
> > b/drivers/staging/greybus/Kconfig
> > index ab096bcef98c..b571e4e8060b 100644
> > --- a/drivers/staging/greybus/Kconfig
> > +++ b/drivers/staging/greybus/Kconfig
> > @@ -148,6 +148,7 @@ if GREYBUS_BRIDGED_PHY
> >  config GREYBUS_GPIO
> > tristate "Greybus GPIO Bridged PHY driver"
> > depends on GPIOLIB
> > +   select GPIOLIB_IRQCHIP
> > ---help---
> >   Select this option if you have a device that follows the
> >   Greybus GPIO Bridged PHY Class specification.
> > diff --git a/drivers/staging/greybus/gpio.c b/drivers/staging/greybus/gpio.c
> > index b1d4698019a1..32c228bad33a 100644
> > --- a/drivers/staging/greybus/gpio.c
> > +++ b/drivers/staging/greybus/gpio.c
> > @@ -9,9 +9,7 @@
> >  #include 
> >  #include 
> >  #include 
> > -#include 
> > -#include 
> 
> I think you should keep irq.h even if the gpio header currently provides
> it.
> 
> > -#include 
> 
> Similarly for this one, if you still rely on it.
>

Ok i'll do that.

> > +#include 
> >  #include 
> >  
> >  #include "greybus.h"
> > @@ -40,8 +38,6 @@ struct gb_gpio_controller {
> > struct gpio_chipchip;
> > struct irq_chip irqc;
> > struct irq_chip *irqchip;
> 
> This should not be needed any more either.
>

Just to confirm, by thism you mean only 
struct irq_chip *irqchip; right?

> > -   struct irq_domain   *irqdomain;
> > -   unsigned intirq_base;
> > irq_flow_handler_t  irq_handler;
> > unsigned intirq_default_type;
> 
> Neither should these two.
> 

Ok.

> > struct mutexirq_lock;
> > @@ -365,6 +361,7 @@ static int gb_gpio_request_handler(struct gb_operation 
> > *op)
> >  {
> > struct gb_connection *connection = op->connection;
> > struct gb_gpio_controller *ggc = gb_connection_get_data(connection);
> > +   struct gpio_chip *gc = >chip;
> 
> Please name the pointer 'chip' as in the rest of the driver to avoid
> confusion with 'ggc'. But looks like you don't need it at all.
>

Yes.

> > struct device *dev = >gbphy_dev->dev;
> > struct gb_message *request;
> > struct gb_gpio_irq_event_request *event;
> > @@ -391,7 +388,7 @@ static int gb_gpio_request_handler(struct gb_operation 
> > *op)
> > return -EINVAL;
> > }
> >  
> > -   irq = irq_find_mapping(ggc->irqdomain, event->which);
> > +   irq = irq_find_mapping(gc->irq.domain, event->which);
> > if (!irq) {
> > dev_err(dev, "failed to find IRQ\n");
> > return -EINVAL;
> > @@ -506,68 +503,6 @@ static int gb_gpio_controller_setup(struct 
> > gb_gpio_controller *ggc)
> > return ret;
> >  }
> 
> > -/**
> > - * gb_gpio_irqchip_remove() - removes an irqchip added to a 
> > gb_gpio_controller
> > - * @ggc: the gb_gpio_controller to remove the irqchip from
> > - *
> > - * This is called only from gb_gpio_remove()
> > - */
> > -static void gb_gpio_irqchip_remove(struct gb_gpio_controller *ggc)
> > -{
> > -   unsigned int offset;
> > -
> > -   /* Remove all IRQ mappings and delete the domain */
> > -   if (ggc->irqdomain) {
> > -   for (offset = 0; offset < (ggc->line_max + 1); offset++)
> > -   irq_dispose_mapping(irq_find_mapping(ggc->irqdomain,
> > -offset));
> > -   irq_domain_remove(ggc->irqdomain);
> > -   }
> > -
> > -   if (ggc->irqchip)
> > -   ggc->irqchip = NULL;
> > -}
> > -
> >  /**
> >   * gb_gpio_irqchip_add() - a

[PATCH v2] staging: greybus: arche-apb-ctrl.c: Switch to the gpio descriptor interface

2018-11-12 Thread Nishad Kamdar
Use the gpiod interface instead of the deprecated old non-descriptor
interface.

Signed-off-by: Nishad Kamdar 
---
Changes in v2:
 - Resolved compilation errors.
---
 drivers/staging/greybus/arche-apb-ctrl.c | 159 +--
 1 file changed, 65 insertions(+), 94 deletions(-)

diff --git a/drivers/staging/greybus/arche-apb-ctrl.c 
b/drivers/staging/greybus/arche-apb-ctrl.c
index be5ffed90bcf..e887f6aee20b 100644
--- a/drivers/staging/greybus/arche-apb-ctrl.c
+++ b/drivers/staging/greybus/arche-apb-ctrl.c
@@ -8,9 +8,8 @@
 
 #include 
 #include 
-#include 
+#include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -24,12 +23,12 @@ static void apb_bootret_deassert(struct device *dev);
 
 struct arche_apb_ctrl_drvdata {
/* Control GPIO signals to and from AP <=> AP Bridges */
-   int resetn_gpio;
-   int boot_ret_gpio;
-   int pwroff_gpio;
-   int wake_in_gpio;
-   int wake_out_gpio;
-   int pwrdn_gpio;
+   struct gpio_desc *resetn;
+   struct gpio_desc *boot_ret;
+   struct gpio_desc *pwroff;
+   struct gpio_desc *wake_in;
+   struct gpio_desc *wake_out;
+   struct gpio_desc *pwrdn;
 
enum arche_platform_state state;
bool init_disabled;
@@ -37,28 +36,28 @@ struct arche_apb_ctrl_drvdata {
struct regulator *vcore;
struct regulator *vio;
 
-   int clk_en_gpio;
+   struct gpio_desc *clk_en;
struct clk *clk;
 
struct pinctrl *pinctrl;
struct pinctrl_state *pin_default;
 
/* V2: SPI Bus control  */
-   int spi_en_gpio;
+   struct gpio_desc *spi_en;
bool spi_en_polarity_high;
 };
 
 /*
  * Note that these low level api's are active high
  */
-static inline void deassert_reset(unsigned int gpio)
+static inline void deassert_reset(struct gpio_desc *gpio)
 {
-   gpio_set_value(gpio, 1);
+   gpiod_set_value(gpio, 1);
 }
 
-static inline void assert_reset(unsigned int gpio)
+static inline void assert_reset(struct gpio_desc *gpio)
 {
-   gpio_set_value(gpio, 0);
+   gpiod_set_value(gpio, 0);
 }
 
 /*
@@ -75,11 +74,11 @@ static int coldboot_seq(struct platform_device *pdev)
return 0;
 
/* Hold APB in reset state */
-   assert_reset(apb->resetn_gpio);
+   assert_reset(apb->resetn);
 
if (apb->state == ARCHE_PLATFORM_STATE_FW_FLASHING &&
-   gpio_is_valid(apb->spi_en_gpio))
-   devm_gpio_free(dev, apb->spi_en_gpio);
+   apb->spi_en)
+   devm_gpiod_put(dev, apb->spi_en);
 
/* Enable power to APB */
if (!IS_ERR(apb->vcore)) {
@@ -101,13 +100,13 @@ static int coldboot_seq(struct platform_device *pdev)
apb_bootret_deassert(dev);
 
/* On DB3 clock was not mandatory */
-   if (gpio_is_valid(apb->clk_en_gpio))
-   gpio_set_value(apb->clk_en_gpio, 1);
+   if (apb->clk_en)
+   gpiod_set_value(apb->clk_en, 1);
 
usleep_range(100, 200);
 
/* deassert reset to APB : Active-low signal */
-   deassert_reset(apb->resetn_gpio);
+   deassert_reset(apb->resetn);
 
apb->state = ARCHE_PLATFORM_STATE_ACTIVE;
 
@@ -119,6 +118,7 @@ static int fw_flashing_seq(struct platform_device *pdev)
struct device *dev = >dev;
struct arche_apb_ctrl_drvdata *apb = platform_get_drvdata(pdev);
int ret;
+   unsigned long flags;
 
if (apb->init_disabled ||
apb->state == ARCHE_PLATFORM_STATE_FW_FLASHING)
@@ -136,25 +136,20 @@ static int fw_flashing_seq(struct platform_device *pdev)
return ret;
}
 
-   if (gpio_is_valid(apb->spi_en_gpio)) {
-   unsigned long flags;
+   if (apb->spi_en_polarity_high)
+   flags = GPIOD_OUT_HIGH;
+   else
+   flags = GPIOD_OUT_LOW;
 
-   if (apb->spi_en_polarity_high)
-   flags = GPIOF_OUT_INIT_HIGH;
-   else
-   flags = GPIOF_OUT_INIT_LOW;
-
-   ret = devm_gpio_request_one(dev, apb->spi_en_gpio,
-   flags, "apb_spi_en");
-   if (ret) {
-   dev_err(dev, "Failed requesting SPI bus en gpio %d\n",
-   apb->spi_en_gpio);
-   return ret;
-   }
+   apb->spi_en = devm_gpiod_get(dev, "gb,spi-en-gpio", flags);
+   if (IS_ERR(apb->spi_en)) {
+   ret = PTR_ERR(apb->spi_en);
+   dev_err(dev, "Failed requesting SPI bus en GPIO: %d\n", ret);
+   return ret;
}
 
/* for flashing device should be in reset state */
-   assert_reset(apb->resetn_gpio);
+   assert_reset(apb->resetn);
apb->state = ARCHE_PLATFORM_STATE_FW_FLASHING;
 
 

Re: [PATCH] staging: greybus: arche-apb-ctrl.c: Switch to the gpio descriptor interface

2018-11-12 Thread Nishad Kamdar
On Mon, Nov 12, 2018 at 04:17:39PM +0100, Johan Hovold wrote:
> On Sun, Nov 11, 2018 at 11:14:14AM +0530, Nishad Kamdar wrote:
> > Use the gpiod interface instead of the deprecated old non-descriptor
> > interface.
> > 
> > Signed-off-by: Nishad Kamdar 
> > ---
> >  drivers/staging/greybus/arche-apb-ctrl.c | 158 ++-
> >  1 file changed, 65 insertions(+), 93 deletions(-)
> 
> > -   apb->pwrdn_gpio = of_get_named_gpio(np, "pwr-down-gpios", 0);
> > -   if (apb->pwrdn_gpio < 0)
> > -   dev_warn(dev, "failed to get power down gpio\n");
> > +   apb->pwrdn = devm_gpiod_get(dev, "gb,pwr-down-gpios", GPIOD_OUT_LOW);
> > +   if (IF_ERR(apb->pwrdn)) {
> 
> Looks like you didn't even compile test this one. :(
> 
> > +   ret = PTR_ERR(apb->pwrdn);
> > +   dev_warn(dev, "Failed requesting power down GPIO: %d\n", ret);
> > +   return ret;
> > +   }
> 
> Johan

Sorry about that, I'll check and resend.

Thanks for the review.

Regards,
Nishad
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: greybus: arche-apb-ctrl.c: Switch to the gpio descriptor interface

2018-11-12 Thread Nishad Kamdar
On Sun, Nov 11, 2018 at 11:36:51AM -0800, Greg Kroah-Hartman wrote:
> On Sun, Nov 11, 2018 at 11:14:14AM +0530, Nishad Kamdar wrote:
> > Use the gpiod interface instead of the deprecated old non-descriptor
> > interface.
> > 
> > Signed-off-by: Nishad Kamdar 
> > ---
> >  drivers/staging/greybus/arche-apb-ctrl.c | 158 ++-
> >  1 file changed, 65 insertions(+), 93 deletions(-)
> 
> This patch does not apply to my tree at all :(
> 
> Please rebase and resend, thanks.
> 
> greg k-h

Sorry about that. I'll check and resend.

Thanks for the review.

Regards,
Nishad
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: greybus: arche-apb-ctrl.c: Switch to the gpio descriptor interface

2018-11-10 Thread Nishad Kamdar
Use the gpiod interface instead of the deprecated old non-descriptor
interface.

Signed-off-by: Nishad Kamdar 
---
 drivers/staging/greybus/arche-apb-ctrl.c | 158 ++-
 1 file changed, 65 insertions(+), 93 deletions(-)

diff --git a/drivers/staging/greybus/arche-apb-ctrl.c 
b/drivers/staging/greybus/arche-apb-ctrl.c
index cc8d6fc831b4..fd19e2394c9c 100644
--- a/drivers/staging/greybus/arche-apb-ctrl.c
+++ b/drivers/staging/greybus/arche-apb-ctrl.c
@@ -8,9 +8,8 @@
 
 #include 
 #include 
-#include 
+#include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -20,17 +19,16 @@
 #include 
 #include "arche_platform.h"
 
-
 static void apb_bootret_deassert(struct device *dev);
 
 struct arche_apb_ctrl_drvdata {
/* Control GPIO signals to and from AP <=> AP Bridges */
-   int resetn_gpio;
-   int boot_ret_gpio;
-   int pwroff_gpio;
-   int wake_in_gpio;
-   int wake_out_gpio;
-   int pwrdn_gpio;
+   struct gpio_desc *resetn;
+   struct gpio_desc *boot_ret;
+   struct gpio_desc *pwroff;
+   struct gpio_desc *wake_in;
+   struct gpio_desc *wake_out;
+   struct gpio_desc *pwrdn;
 
enum arche_platform_state state;
bool init_disabled;
@@ -38,28 +36,28 @@ struct arche_apb_ctrl_drvdata {
struct regulator *vcore;
struct regulator *vio;
 
-   int clk_en_gpio;
+   struct gpio_desc *clk_en;
struct clk *clk;
 
struct pinctrl *pinctrl;
struct pinctrl_state *pin_default;
 
/* V2: SPI Bus control  */
-   int spi_en_gpio;
+   struct gpio_desc *spi_en;
bool spi_en_polarity_high;
 };
 
 /*
  * Note that these low level api's are active high
  */
-static inline void deassert_reset(unsigned int gpio)
+static inline void deassert_reset(struct gpio_desc *gpio)
 {
-   gpio_set_value(gpio, 1);
+   gpiod_set_value(gpio, 1);
 }
 
-static inline void assert_reset(unsigned int gpio)
+static inline void assert_reset(struct gpio_desc *gpio)
 {
-   gpio_set_value(gpio, 0);
+   gpiod_set_value(gpio, 0);
 }
 
 /*
@@ -76,11 +74,11 @@ static int coldboot_seq(struct platform_device *pdev)
return 0;
 
/* Hold APB in reset state */
-   assert_reset(apb->resetn_gpio);
+   assert_reset(apb->resetn);
 
if (apb->state == ARCHE_PLATFORM_STATE_FW_FLASHING &&
-   gpio_is_valid(apb->spi_en_gpio))
-   devm_gpio_free(dev, apb->spi_en_gpio);
+   apb->spi_en)
+   devm_gpiod_put(dev, apb->spi_en);
 
/* Enable power to APB */
if (!IS_ERR(apb->vcore)) {
@@ -102,13 +100,13 @@ static int coldboot_seq(struct platform_device *pdev)
apb_bootret_deassert(dev);
 
/* On DB3 clock was not mandatory */
-   if (gpio_is_valid(apb->clk_en_gpio))
-   gpio_set_value(apb->clk_en_gpio, 1);
+   if (apb->clk_en)
+   gpiod_set_value(apb->clk_en, 1);
 
usleep_range(100, 200);
 
/* deassert reset to APB : Active-low signal */
-   deassert_reset(apb->resetn_gpio);
+   deassert_reset(apb->resetn);
 
apb->state = ARCHE_PLATFORM_STATE_ACTIVE;
 
@@ -120,6 +118,7 @@ static int fw_flashing_seq(struct platform_device *pdev)
struct device *dev = >dev;
struct arche_apb_ctrl_drvdata *apb = platform_get_drvdata(pdev);
int ret;
+   unsigned long flags;
 
if (apb->init_disabled ||
apb->state == ARCHE_PLATFORM_STATE_FW_FLASHING)
@@ -137,25 +136,20 @@ static int fw_flashing_seq(struct platform_device *pdev)
return ret;
}
 
-   if (gpio_is_valid(apb->spi_en_gpio)) {
-   unsigned long flags;
-
-   if (apb->spi_en_polarity_high)
-   flags = GPIOF_OUT_INIT_HIGH;
-   else
-   flags = GPIOF_OUT_INIT_LOW;
+   if (apb->spi_en_polarity_high)
+   flags = GPIOD_OUT_HIGH;
+   else
+   flags = GPIOD_OUT_LOW;
 
-   ret = devm_gpio_request_one(dev, apb->spi_en_gpio,
-   flags, "apb_spi_en");
-   if (ret) {
-   dev_err(dev, "Failed requesting SPI bus en gpio %d\n",
-   apb->spi_en_gpio);
-   return ret;
-   }
+   apb->spi_en = devm_gpiod_get(dev, "gb,apb_spi_en", flags);
+   if (IS_ERR(apb->spi_en)) {
+   ret = PTR_ERR(apb->spi_en);
+   dev_err(dev, "Failed requesting SPI bus en GPIO: %d\n", ret);
+   return ret;
}
 
/* for flashing device should be in reset state */
-   assert_reset(apb->resetn_gpio);
+   assert_reset(apb->resetn);
apb->state = ARCHE_PLATFORM_STATE_FW_FLASHING;
 
return 0;
@@ -178,8 +17

[PATCH] greybus: gpio: switch GPIO portions to use GPIOLIB_IRQCHIP

2018-11-08 Thread Nishad Kamdar
Convert the GPIO driver to use the GPIO irqchip library
GPIOLIB_IRQCHIP instead of reimplementing the same.

Signed-off-by: Nishad Kamdar 
---
 drivers/staging/greybus/Kconfig |   1 +
 drivers/staging/greybus/gpio.c  | 123 ++--
 2 files changed, 21 insertions(+), 103 deletions(-)

diff --git a/drivers/staging/greybus/Kconfig b/drivers/staging/greybus/Kconfig
index ab096bcef98c..b571e4e8060b 100644
--- a/drivers/staging/greybus/Kconfig
+++ b/drivers/staging/greybus/Kconfig
@@ -148,6 +148,7 @@ if GREYBUS_BRIDGED_PHY
 config GREYBUS_GPIO
tristate "Greybus GPIO Bridged PHY driver"
depends on GPIOLIB
+   select GPIOLIB_IRQCHIP
---help---
  Select this option if you have a device that follows the
  Greybus GPIO Bridged PHY Class specification.
diff --git a/drivers/staging/greybus/gpio.c b/drivers/staging/greybus/gpio.c
index b1d4698019a1..32c228bad33a 100644
--- a/drivers/staging/greybus/gpio.c
+++ b/drivers/staging/greybus/gpio.c
@@ -9,9 +9,7 @@
 #include 
 #include 
 #include 
-#include 
-#include 
-#include 
+#include 
 #include 
 
 #include "greybus.h"
@@ -40,8 +38,6 @@ struct gb_gpio_controller {
struct gpio_chipchip;
struct irq_chip irqc;
struct irq_chip *irqchip;
-   struct irq_domain   *irqdomain;
-   unsigned intirq_base;
irq_flow_handler_t  irq_handler;
unsigned intirq_default_type;
struct mutexirq_lock;
@@ -365,6 +361,7 @@ static int gb_gpio_request_handler(struct gb_operation *op)
 {
struct gb_connection *connection = op->connection;
struct gb_gpio_controller *ggc = gb_connection_get_data(connection);
+   struct gpio_chip *gc = >chip;
struct device *dev = >gbphy_dev->dev;
struct gb_message *request;
struct gb_gpio_irq_event_request *event;
@@ -391,7 +388,7 @@ static int gb_gpio_request_handler(struct gb_operation *op)
return -EINVAL;
}
 
-   irq = irq_find_mapping(ggc->irqdomain, event->which);
+   irq = irq_find_mapping(gc->irq.domain, event->which);
if (!irq) {
dev_err(dev, "failed to find IRQ\n");
return -EINVAL;
@@ -506,68 +503,6 @@ static int gb_gpio_controller_setup(struct 
gb_gpio_controller *ggc)
return ret;
 }
 
-/**
- * gb_gpio_irq_map() - maps an IRQ into a GB gpio irqchip
- * @d: the irqdomain used by this irqchip
- * @irq: the global irq number used by this GB gpio irqchip irq
- * @hwirq: the local IRQ/GPIO line offset on this GB gpio
- *
- * This function will set up the mapping for a certain IRQ line on a
- * GB gpio by assigning the GB gpio as chip data, and using the irqchip
- * stored inside the GB gpio.
- */
-static int gb_gpio_irq_map(struct irq_domain *domain, unsigned int irq,
-  irq_hw_number_t hwirq)
-{
-   struct gpio_chip *chip = domain->host_data;
-   struct gb_gpio_controller *ggc = gpio_chip_to_gb_gpio_controller(chip);
-
-   irq_set_chip_data(irq, ggc);
-   irq_set_chip_and_handler(irq, ggc->irqchip, ggc->irq_handler);
-   irq_set_noprobe(irq);
-   /*
-* No set-up of the hardware will happen if IRQ_TYPE_NONE
-* is passed as default type.
-*/
-   if (ggc->irq_default_type != IRQ_TYPE_NONE)
-   irq_set_irq_type(irq, ggc->irq_default_type);
-
-   return 0;
-}
-
-static void gb_gpio_irq_unmap(struct irq_domain *d, unsigned int irq)
-{
-   irq_set_chip_and_handler(irq, NULL, NULL);
-   irq_set_chip_data(irq, NULL);
-}
-
-static const struct irq_domain_ops gb_gpio_domain_ops = {
-   .map= gb_gpio_irq_map,
-   .unmap  = gb_gpio_irq_unmap,
-};
-
-/**
- * gb_gpio_irqchip_remove() - removes an irqchip added to a gb_gpio_controller
- * @ggc: the gb_gpio_controller to remove the irqchip from
- *
- * This is called only from gb_gpio_remove()
- */
-static void gb_gpio_irqchip_remove(struct gb_gpio_controller *ggc)
-{
-   unsigned int offset;
-
-   /* Remove all IRQ mappings and delete the domain */
-   if (ggc->irqdomain) {
-   for (offset = 0; offset < (ggc->line_max + 1); offset++)
-   irq_dispose_mapping(irq_find_mapping(ggc->irqdomain,
-offset));
-   irq_domain_remove(ggc->irqdomain);
-   }
-
-   if (ggc->irqchip)
-   ggc->irqchip = NULL;
-}
-
 /**
  * gb_gpio_irqchip_add() - adds an irqchip to a gpio chip
  * @chip: the gpio chip to add the irqchip to
@@ -595,8 +530,7 @@ static int gb_gpio_irqchip_add(struct gpio_chip *chip,
 unsigned int type)
 {
struct gb_gpio_controller *ggc;
-   unsigned int offset;
-   unsigned int irq_base;
+   unsigned int err;
 
if (!chip || !irqchip)
 

[PATCH v3 4/4] staging: iio: ad7816: Add device tree table.

2018-11-08 Thread Nishad Kamdar
Add device tree table for matching vendor ID.

Signed-off-by: Nishad Kamdar 
---
 drivers/staging/iio/adc/ad7816.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/staging/iio/adc/ad7816.c b/drivers/staging/iio/adc/ad7816.c
index a2fead85cd46..b8a9149fbac1 100644
--- a/drivers/staging/iio/adc/ad7816.c
+++ b/drivers/staging/iio/adc/ad7816.c
@@ -422,6 +422,12 @@ static int ad7816_probe(struct spi_device *spi_dev)
return 0;
 }
 
+static const struct of_device_id ad7816_of_match[] = {
+   { .compatible = "adi,ad7816", },
+   { }
+};
+MODULE_DEVICE_TABLE(of, ad7816_of_match);
+
 static const struct spi_device_id ad7816_id[] = {
{ "ad7816", ID_AD7816 },
{ "ad7817", ID_AD7817 },
@@ -434,6 +440,7 @@ MODULE_DEVICE_TABLE(spi, ad7816_id);
 static struct spi_driver ad7816_driver = {
.driver = {
.name = "ad7816",
+   .of_match_table = of_match_ptr(ad7816_of_match),
},
.probe = ad7816_probe,
.id_table = ad7816_id,
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 3/4] staging: iio: ad7816: Set RD/WR pin and CONVST pin as outputs.

2018-11-08 Thread Nishad Kamdar
The RD/WR pin and CONVST pin are logical inputs to the AD78xx
chip as per the datasheet. Hence convert them to outputs.

Signed-off-by: Nishad Kamdar 
---
 drivers/staging/iio/adc/ad7816.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/iio/adc/ad7816.c b/drivers/staging/iio/adc/ad7816.c
index 3cda5cd09365..a2fead85cd46 100644
--- a/drivers/staging/iio/adc/ad7816.c
+++ b/drivers/staging/iio/adc/ad7816.c
@@ -369,14 +369,15 @@ static int ad7816_probe(struct spi_device *spi_dev)
chip->oti_data[i] = 203;
 
chip->id = spi_get_device_id(spi_dev)->driver_data;
-   chip->rdwr_pin = devm_gpiod_get(_dev->dev, "rdwr", GPIOD_IN);
+   chip->rdwr_pin = devm_gpiod_get(_dev->dev, "rdwr", GPIOD_OUT_HIGH);
if (IS_ERR(chip->rdwr_pin)) {
ret = PTR_ERR(chip->rdwr_pin);
dev_err(_dev->dev, "Failed to request rdwr GPIO: %d\n",
ret);
return ret;
}
-   chip->convert_pin = devm_gpiod_get(_dev->dev, "convert", GPIOD_IN);
+   chip->convert_pin = devm_gpiod_get(_dev->dev, "convert",
+  GPIOD_OUT_HIGH);
if (IS_ERR(chip->convert_pin)) {
ret = PTR_ERR(chip->convert_pin);
dev_err(_dev->dev, "Failed to request convert GPIO: %d\n",
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


  1   2   >