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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2019-07-10 at 17:27 +0800, Phil Reid wrote:
> On 10/07/2019 17:05, Nicolas Saenz Julienne wrote:
> > 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?
> > 
> 
> Yes I can submit a patch tomorrow.
> 
> I just wasn't sure if it was working for anyone.

Please CC me and I'll give it a test :).

> 
> 
> 
> > > 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;
> > > 
> > > 
> > > 
> 
> 

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux