All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
To: Phil Reid <preid@electromag.com.au>,
	Nishad Kamdar <nishadkamdar@gmail.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	thomas.petazzoni@free-electrons.com, devel@driverdev.osuosl.org,
	linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: Re: BUG: Staging: fbtft: Switch to the gpio descriptor interface
Date: Wed, 10 Jul 2019 09:05:27 +0000	[thread overview]
Message-ID: <907baecff15308988f44220fcb13b28cba742df2.camel@suse.de> (raw)
In-Reply-To: <3ca02376-631b-d159-7070-7c50403126de@electromag.com.au>

[-- Attachment #1: Type: text/plain, Size: 4103 bytes --]

On Wed, 2019-07-10 at 16:31 +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.

FYI We've seen the same issue this week in opensuse's bugzilla and was testing
something very similar to the patch below. Phil do you plan on submitting your
fix? 

Regards,
Nicolas

> 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
> 
> 
> 
> 
> 
> 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, &par->gpio.reset);
> +	ret = fbtft_request_one_gpio(par, "reset", 0, &par->gpio.reset);
>   	if (ret)
>   		return ret;
> -	ret = fbtft_request_one_gpio(par, "dc-gpios", 0, &par->gpio.dc);
> +	ret = fbtft_request_one_gpio(par, "dc", 0, &par->gpio.dc);
>   	if (ret)
>   		return ret;
> -	ret = fbtft_request_one_gpio(par, "rd-gpios", 0, &par->gpio.rd);
> +	ret = fbtft_request_one_gpio(par, "rd", 0, &par->gpio.rd);
>   	if (ret)
>   		return ret;
> -	ret = fbtft_request_one_gpio(par, "wr-gpios", 0, &par->gpio.wr);
> +	ret = fbtft_request_one_gpio(par, "wr", 0, &par->gpio.wr);
>   	if (ret)
>   		return ret;
> -	ret = fbtft_request_one_gpio(par, "cs-gpios", 0, &par->gpio.cs);
> +	ret = fbtft_request_one_gpio(par, "cs", 0, &par->gpio.cs);
>   	if (ret)
>   		return ret;
> -	ret = fbtft_request_one_gpio(par, "latch-gpios", 0, &par->gpio.latch);
> +	ret = fbtft_request_one_gpio(par, "latch", 0, &par->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,
>   					     &par->gpio.db[i]);
>   		if (ret)
>   			return ret;
> -		ret = fbtft_request_one_gpio(par, "led-gpios", i,
> +		ret = fbtft_request_one_gpio(par, "led", i,
>   					     &par->gpio.led[i]);
>   		if (ret)
>   			return ret;
> -		ret = fbtft_request_one_gpio(par, "aux-gpios", i,
> +		ret = fbtft_request_one_gpio(par, "aux", i,
>   					     &par->gpio.aux[i]);
>   		if (ret)
>   			return ret;
> 
> 
> 
> 
> _______________________________________________
> devel mailing list
> devel@linuxdriverproject.org
> http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
To: Phil Reid <preid@electromag.com.au>,
	Nishad Kamdar <nishadkamdar@gmail.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	thomas.petazzoni@free-electrons.com, devel@driverdev.osuosl.org,
	linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: Re: BUG: Staging: fbtft: Switch to the gpio descriptor interface
Date: Wed, 10 Jul 2019 11:05:27 +0200	[thread overview]
Message-ID: <907baecff15308988f44220fcb13b28cba742df2.camel@suse.de> (raw)
In-Reply-To: <3ca02376-631b-d159-7070-7c50403126de@electromag.com.au>


[-- Attachment #1.1: Type: text/plain, Size: 4103 bytes --]

On Wed, 2019-07-10 at 16:31 +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.

FYI We've seen the same issue this week in opensuse's bugzilla and was testing
something very similar to the patch below. Phil do you plan on submitting your
fix? 

Regards,
Nicolas

> 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
> 
> 
> 
> 
> 
> 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, &par->gpio.reset);
> +	ret = fbtft_request_one_gpio(par, "reset", 0, &par->gpio.reset);
>   	if (ret)
>   		return ret;
> -	ret = fbtft_request_one_gpio(par, "dc-gpios", 0, &par->gpio.dc);
> +	ret = fbtft_request_one_gpio(par, "dc", 0, &par->gpio.dc);
>   	if (ret)
>   		return ret;
> -	ret = fbtft_request_one_gpio(par, "rd-gpios", 0, &par->gpio.rd);
> +	ret = fbtft_request_one_gpio(par, "rd", 0, &par->gpio.rd);
>   	if (ret)
>   		return ret;
> -	ret = fbtft_request_one_gpio(par, "wr-gpios", 0, &par->gpio.wr);
> +	ret = fbtft_request_one_gpio(par, "wr", 0, &par->gpio.wr);
>   	if (ret)
>   		return ret;
> -	ret = fbtft_request_one_gpio(par, "cs-gpios", 0, &par->gpio.cs);
> +	ret = fbtft_request_one_gpio(par, "cs", 0, &par->gpio.cs);
>   	if (ret)
>   		return ret;
> -	ret = fbtft_request_one_gpio(par, "latch-gpios", 0, &par->gpio.latch);
> +	ret = fbtft_request_one_gpio(par, "latch", 0, &par->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,
>   					     &par->gpio.db[i]);
>   		if (ret)
>   			return ret;
> -		ret = fbtft_request_one_gpio(par, "led-gpios", i,
> +		ret = fbtft_request_one_gpio(par, "led", i,
>   					     &par->gpio.led[i]);
>   		if (ret)
>   			return ret;
> -		ret = fbtft_request_one_gpio(par, "aux-gpios", i,
> +		ret = fbtft_request_one_gpio(par, "aux", i,
>   					     &par->gpio.aux[i]);
>   		if (ret)
>   			return ret;
> 
> 
> 
> 
> _______________________________________________
> devel mailing list
> devel@linuxdriverproject.org
> http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 169 bytes --]

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

  reply	other threads:[~2019-07-10  9:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-10  8:31 BUG: Staging: fbtft: Switch to the gpio descriptor interface Phil Reid
2019-07-10  8:31 ` Phil Reid
2019-07-10  8:31 ` Phil Reid
2019-07-10  9:05 ` Nicolas Saenz Julienne [this message]
2019-07-10  9:05   ` Nicolas Saenz Julienne
2019-07-10  9:27   ` Phil Reid
2019-07-10  9:27     ` Phil Reid
2019-07-10  9:27     ` Phil Reid
2019-07-10  9:37     ` Nicolas Saenz Julienne
2019-07-10  9:37       ` Nicolas Saenz Julienne
2019-07-10 23:49 ` Nishad Kamdar
2019-07-10 23:50   ` Nishad Kamdar
2019-07-10 23:49   ` Nishad Kamdar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=907baecff15308988f44220fcb13b28cba742df2.camel@suse.de \
    --to=nsaenzjulienne@suse.de \
    --cc=devel@driverdev.osuosl.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=nishadkamdar@gmail.com \
    --cc=preid@electromag.com.au \
    --cc=thomas.petazzoni@free-electrons.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.