[PATCH] staging: qlge/qlge_ethtool.c: strlcpy -> strscpy

2021-01-28 Thread Kumar Kartikeya Dwivedi
Fixes checkpatch warnings for usage of strlcpy.

Signed-off-by: Kumar Kartikeya Dwivedi 
---
 drivers/staging/qlge/qlge_ethtool.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/qlge/qlge_ethtool.c 
b/drivers/staging/qlge/qlge_ethtool.c
index a28f0254c..635d3338f 100644
--- a/drivers/staging/qlge/qlge_ethtool.c
+++ b/drivers/staging/qlge/qlge_ethtool.c
@@ -417,15 +417,15 @@ static void ql_get_drvinfo(struct net_device *ndev,
 {
struct ql_adapter *qdev = netdev_priv(ndev);
 
-   strlcpy(drvinfo->driver, qlge_driver_name, sizeof(drvinfo->driver));
-   strlcpy(drvinfo->version, qlge_driver_version,
+   strscpy(drvinfo->driver, qlge_driver_name, sizeof(drvinfo->driver));
+   strscpy(drvinfo->version, qlge_driver_version,
sizeof(drvinfo->version));
snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version),
 "v%d.%d.%d",
 (qdev->fw_rev_id & 0x00ff) >> 16,
 (qdev->fw_rev_id & 0xff00) >> 8,
 (qdev->fw_rev_id & 0x00ff));
-   strlcpy(drvinfo->bus_info, pci_name(qdev->pdev),
+   strscpy(drvinfo->bus_info, pci_name(qdev->pdev),
sizeof(drvinfo->bus_info));
 }
 
-- 
2.29.2

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


Re: [PATCH v12] staging: fbtft: add tearing signal detect

2021-01-28 Thread carlis
On Thu, 28 Jan 2021 16:33:02 +0200
Andy Shevchenko  wrote:

> On Thu, Jan 28, 2021 at 2:58 PM Carlis  wrote:
> 
> Thanks for your contribution, my comments below.
> 
> > From: zhangxuezhi   
> 
> You probably have to configure your Git to use the same account for
> author and committer.

hi,you mean like below:
Carlis 
?
> 
> > For st7789v ic,when we need continuous full screen refresh, it is
> > best to  
> 
> 'ic,when' -> 'IC, when'
> 
> > wait for the TE signal arrive to avoid screen tearing  
> 
> Decode TE for people who are not familiar with the abbreviation.
> 
> Missed period at the end of sentence.
> 
> ...
> 
> >  #include 
> >  #include 
> >  #include 
> > +#include 
> > +#include 
> >  #include 
> > +#include 
> > +  
> 
> Good, but I would rather squeeze it above to be more or less ordered,
> like just after delay.h inclusion.
> 
> >  #include   
> 
> ...
> 
> > +#define SPI_PANEL_TE_TIMEOUT   400 /* msecs */  
> 
> Useless comment. Instead use _MS suffix in the name of constant.
> Besides that please add a comment explaining why this value has been
> chosen.
> 
> ...
> 
> > +static struct completion spi_panel_te;  
> 
> As Greg said.
> 
> ...
> 
> >  static int init_display(struct fbtft_par *par)
> >  {
> > +   int rc;
> > +   struct device *dev = par->info->device;  
> 
> Keep reversed xmas tree order:
> 
>struct device *dev = par->info->device;
>int rc;
> 
> ...
> 
> > +   par->gpio.te = devm_gpiod_get_index_optional(dev, "te", 0,
> > GPIOD_IN);  
> 
> No need to have it requested for all time since you use it as an IRQ
> later on. The IRQ chip will call the GPIO library framework to lock a
> pin as IRQ anyway.
> 
> > +   if (IS_ERR(par->gpio.te))
> > +   return dev_err_probe(par->info->device,
> > PTR_ERR(par->gpio.te),
> > +"Failed to request te
> > gpio\n");  
> 
> > +   if (par->gpio.te) {  
> 
> Instead you should probably do the following:
> 
> int irq;
> 
> irq = gpiod_to_irq(...);
> if (irq > 0)
> 
> > +   init_completion(_panel_te);
> > +   rc = devm_request_irq(dev,  
> 
> > + gpiod_to_irq(par->gpio.te),  
> 
> ...and here simply use irq.
> 
> > +spi_panel_te_handler,
> > IRQF_TRIGGER_RISING,
> > +"TE_GPIO", par);  
> 
> > +   if (IS_ERR(rc))  
> 
> This is wrong. rc is integer no IS_ERR() is required. Ditto for
> PTR_ERR(). Have you even looked for these macros implementations?
> 
> > +   return dev_err_probe(par->info->device,
> > PTR_ERR(rc),  
> 
> Use your temporary variable and move...
> 
> > +"TE request_irq
> > failed.\n");  
> 
> ...this on the previous line.
> 
> > +   disable_irq_nosync(gpiod_to_irq(par->gpio.te));  
> 
> Why do you call gpio_to_irq() twice?
> 
> 
> > +   } else {
> > +   dev_info(par->info->device, "%s:%d, TE gpio not
> > specified\n",
> > +__func__, __LINE__);  
> 
> Remove this noise (besides the fact that we don't use __file__ and
> __LINE__ in messages like this.
> 
> > +   }  
> 
> Taking all together you probably need to create a helper and use it
> inside init_display(), like
> 
> static int init_tearing_effect_line(struct fbtft_par *par)
> {
>   struct device *dev = par->info->device;
>   struct gpio_desc *te;
>   int irq, rc;
> 
>   te = gpiod_get_optional(dev, "te", GPIOD_IN);
>   if (IS_ERR(te))
>return dev_err_probe(dev, PTR_ERR(te), "Failed to request
> te GPIO\n");
> 
>   irq = gpiod_to_irq(te); // this value you have to save in the
> driver's (per device) data structure.
> 
>   /* GPIO is locked as an IRQ, we may drop the reference */
>   gpiod_put(te);


 
> 
>   init_completion(_panel_te); // should be in the (per device)
> data structure
>   rc = devm_request_irq(dev, irq,  spi_panel_te_handler,
> IRQF_TRIGGER_RISING, "TE_GPIO", par);
>   if (rc)
> return dev_err_probe(dev, rc, "TE IRQ request
> failed.\n"); disable_irq_nosync(irq);
>   return irq;
> }
>

hi, i have modified it according to your suggestion like below:

static irqreturn_t panel_te_handler(int irq, void *data)
{
struct fbtft_par *par = (struct fbtft_par *)data;

complete(>panel_te);
return IRQ_HANDLED;
}

/**
 * init_tearing_effect_line() - init tearing effect line
 *
 * @par: FBTFT parameter object
 *
 * Return: 0 on success, < 0 if error occurred.
 */
static int init_tearing_effect_line(struct fbtft_par *par)
{
struct device *dev = par->info->device;
struct gpio_desc *te;
int rc;

te = gpiod_get_optional(dev, "te", GPIOD_IN);
if (IS_ERR(te))
return dev_err_probe(dev, PTR_ERR(te), "Failed to
request te GPIO\n");

if (te) {
par->irq_te = gpiod_to_irq(te);

Re: [PATCH] staging: net: wimax: i2400m: fw: remove redundant initialization of variable result

2021-01-28 Thread Joe Perches
On Thu, 2021-01-28 at 17:37 +, Colin King wrote:
> From: Colin Ian King 
> 
> The variable result is being initialized with a value that is never
> read and it is being updated later with a new value.  The initialization
> is redundant and can be removed.

Isn't WIMAX dead?  Shouldn't it be marked ORPHAN in MAINTAINERS?
---
diff --git a/MAINTAINERS b/MAINTAINERS
index caac09a3c5c9..922afd393cb6 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -19201,6 +19201,10 @@ S: Supported
 W: https://wireless.wiki.kernel.org/en/users/Drivers/wil6210
 F: drivers/net/wireless/ath/wil6210/
 
+WIMAX
+S: Orphan
+F: drivers/staging/wimax/
+
 WINBOND CIR DRIVER
 M: David Härdeman 
 S: Maintained


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


Re: [GIT PULL] Staging/IIO driver fixes for 5.11-rc5

2021-01-28 Thread Jonathan Cameron
On Mon, 25 Jan 2021 15:08:17 +0100
Greg KH  wrote:

> On Sun, Jan 24, 2021 at 11:31:59AM -0800, Linus Torvalds wrote:
> > On Sun, Jan 24, 2021 at 4:58 AM Greg KH  wrote: 
> >  
> > >
> > > David Lechner (1):
> > >   counter:ti-eqep: remove floor  
> > 
> > I'm not sure why that ti-eqep counter driver seems to be in your
> > "iio/staging" pile rather than "char/misc", but whatever..  
> 
> Jonathan said why that was needed, I think it was due to fixes in the
> counter core code, but he can verify this better than I can...

Hi Linus / Greg,

Bit of history involved here...

The counter drivers started out as just another sensor type
under IIO, but ended up pushing the boundaries of the ABI a lot -
ultimately making it clear that they really didn't fit in IIO.
William came up with a better abstraction / framework that
became drivers/counter/, but currently the patch flow for
drivers/counter/ is sufficiently low that I handle their
patches along side IIO rather than via a separate tree.

There is also a cross dependency because of legacy IIO ABI
though we are aiming to drop that either this cycle or next.

Hope that clears it up.  If either of you would prefer
it a different way in future let me know.

This particular fix was local to the driver - it was pretending
it supported something that hardware couldn't actually do.

Thanks,

Jonathan

> 
> thanks,
> 
> greg k-h

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


[PATCH] staging: net: wimax: i2400m: fw: remove redundant initialization of variable result

2021-01-28 Thread Colin King
From: Colin Ian King 

The variable result is being initialized with a value that is never
read and it is being updated later with a new value.  The initialization
is redundant and can be removed.

Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King 
---
 drivers/staging/wimax/i2400m/fw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wimax/i2400m/fw.c 
b/drivers/staging/wimax/i2400m/fw.c
index edb5eba0898b..b2fd4bd2c5f9 100644
--- a/drivers/staging/wimax/i2400m/fw.c
+++ b/drivers/staging/wimax/i2400m/fw.c
@@ -583,7 +583,7 @@ ssize_t i2400m_bm_cmd(struct i2400m *i2400m,
  struct i2400m_bootrom_header *ack, size_t ack_size,
  int flags)
 {
-   ssize_t result = -ENOMEM, rx_bytes;
+   ssize_t result, rx_bytes;
struct device *dev = i2400m_dev(i2400m);
int opcode = cmd == NULL ? -1 : i2400m_brh_get_opcode(cmd);
 
-- 
2.29.2

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


BUSINESS OFFER

2021-01-28 Thread Mohamad Al Numan
Compliment of the day.

Hope my email will reach you in time. My name is Mohamad Al Numan from Kuwait 
City. I am a businessman who has my business in Kuwait. I am here to ask for 
your help so that I can invest in your country with your help.

The reason I contacted you is because I intend to invest in a business with you 
in your country, sorry to bother you with my business offer, but you must 
consider if we can work together to guarantee good investments in your country. 
I am interested in real estate investments, Health and education, industries, 
import and export, logistics, construction, technology, health and Agriculture. 
I would like you to name one particular investment that we should focus on.

I will appreciate your response. Let me know your ideas and knowledge regarding 
this investment or any other profitable investment you can suggest. We have 
some capital to invest which I made from oil and gas. I am willing to cooperate 
with you to establish this business in your country. In my next letter, I will 
explain all the details of the project and its interest.

I will tell you more about myself when I receive your answer. You can also tell 
me a little more about yourself.

Please email me back so that we can discuss further.

Best Regards,
Mohamad Al Numan
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v12] staging: fbtft: add tearing signal detect

2021-01-28 Thread Dan Carpenter
On Thu, Jan 28, 2021 at 04:33:02PM +0200, Andy Shevchenko wrote:
> > +   init_completion(_panel_te);
> > +   rc = devm_request_irq(dev,
> 
> > + gpiod_to_irq(par->gpio.te),
> 
> ...and here simply use irq.
> 
> > +spi_panel_te_handler, 
> > IRQF_TRIGGER_RISING,
> > +"TE_GPIO", par);
> 
> > +   if (IS_ERR(rc))
> 
> This is wrong. rc is integer no IS_ERR() is required. Ditto for
> PTR_ERR(). Have you even looked for these macros implementations?
> 

Yeah...  It leads to a compile warning:

warning: passing argument 1 of ‘IS_ERR’ makes pointer from integer 
without a cast [-Wint-conversion]

regards,
dan carpenter

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


Re: [PATCH v10] staging: fbtft: add tearing signal detect

2021-01-28 Thread Dan Carpenter
On Thu, Jan 28, 2021 at 12:32:22AM +0200, Kari Argillander wrote:
> On Wed, Jan 27, 2021 at 09:42:52PM +0800, Carlis wrote:
> > @@ -82,6 +111,33 @@ enum st7789v_command {
> >   */
> >  static int init_display(struct fbtft_par *par)
> >  {
> > +   int rc;
> > +   struct device *dev = par->info->device;
> > +
> > +   par->gpio.te = devm_gpiod_get_index_optional(dev, "te", 0, GPIOD_IN);
> > +   if (IS_ERR(par->gpio.te)) {
> > +   rc = PTR_ERR(par->gpio.te);
> > +   dev_err(par->info->device, "Failed to request te gpio: %d\n", 
> > rc);
> > +   return rc;
> > +   }
> 
> You request with optinal and you still want to error out? We could just
> continue and not care about that error. User will be happier if device
> still works somehow.
> 

Carlis tried that approach in previous versions.  See the discussion
about -EPROBEi_DEFER.

That's not the right way to think about it anyway.  It's optional but
the user *chose* to enable it so if an error occurs then it's still an
error and should be treated like an error.  The user should fix the
error or disable the feature if they want to continue.

There are lots of places in the kernel where the error handling could
be written to try continue but in a crippled state.  It's not the right
approach.  Over engineering like that just leads to bugs.

regards,
dan carpenter

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


Re: [PATCH v12] staging: fbtft: add tearing signal detect

2021-01-28 Thread Andy Shevchenko
On Thu, Jan 28, 2021 at 4:33 PM Andy Shevchenko
 wrote:
> On Thu, Jan 28, 2021 at 2:58 PM Carlis  wrote:

...

> Taking all together you probably need to create a helper and use it
> inside init_display(), like
>
> static int init_tearing_effect_line(struct fbtft_par *par)
> {
>   struct device *dev = par->info->device;
>   struct gpio_desc *te;
>   int irq, rc;
>
>   te = gpiod_get_optional(dev, "te", GPIOD_IN);
>   if (IS_ERR(te))
>return dev_err_probe(dev, PTR_ERR(te), "Failed to request
> te GPIO\n");

Sorry, here I missed the following:

  /* Absence of TE IRQ is not critical */
  if (!te)
return 0;

>   irq = gpiod_to_irq(te); // this value you have to save in the
> driver's (per device) data structure.
>
>   /* GPIO is locked as an IRQ, we may drop the reference */
>   gpiod_put(te);

...and here:

  if (irq < 0)
return irq;

>   init_completion(_panel_te); // should be in the (per device)
> data structure
>   rc = devm_request_irq(dev, irq,  spi_panel_te_handler,
> IRQF_TRIGGER_RISING, "TE_GPIO", par);
>   if (rc)
> return dev_err_probe(dev, rc, "TE IRQ request failed.\n");
>   disable_irq_nosync(irq);
>   return irq;
> }

-- 
With Best Regards,
Andy Shevchenko
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v12] staging: fbtft: add tearing signal detect

2021-01-28 Thread Andy Shevchenko
On Thu, Jan 28, 2021 at 2:58 PM Carlis  wrote:

Thanks for your contribution, my comments below.

> From: zhangxuezhi 

You probably have to configure your Git to use the same account for
author and committer.

> For st7789v ic,when we need continuous full screen refresh, it is best to

'ic,when' -> 'IC, when'

> wait for the TE signal arrive to avoid screen tearing

Decode TE for people who are not familiar with the abbreviation.

Missed period at the end of sentence.

...

>  #include 
>  #include 
>  #include 
> +#include 
> +#include 
>  #include 
> +#include 
> +

Good, but I would rather squeeze it above to be more or less ordered,
like just after delay.h inclusion.

>  #include 

...

> +#define SPI_PANEL_TE_TIMEOUT   400 /* msecs */

Useless comment. Instead use _MS suffix in the name of constant.
Besides that please add a comment explaining why this value has been
chosen.

...

> +static struct completion spi_panel_te;

As Greg said.

...

>  static int init_display(struct fbtft_par *par)
>  {
> +   int rc;
> +   struct device *dev = par->info->device;

Keep reversed xmas tree order:

   struct device *dev = par->info->device;
   int rc;

...

> +   par->gpio.te = devm_gpiod_get_index_optional(dev, "te", 0, GPIOD_IN);

No need to have it requested for all time since you use it as an IRQ
later on. The IRQ chip will call the GPIO library framework to lock a
pin as IRQ anyway.

> +   if (IS_ERR(par->gpio.te))
> +   return dev_err_probe(par->info->device, PTR_ERR(par->gpio.te),
> +"Failed to request te gpio\n");

> +   if (par->gpio.te) {

Instead you should probably do the following:

int irq;

irq = gpiod_to_irq(...);
if (irq > 0)

> +   init_completion(_panel_te);
> +   rc = devm_request_irq(dev,

> + gpiod_to_irq(par->gpio.te),

...and here simply use irq.

> +spi_panel_te_handler, 
> IRQF_TRIGGER_RISING,
> +"TE_GPIO", par);

> +   if (IS_ERR(rc))

This is wrong. rc is integer no IS_ERR() is required. Ditto for
PTR_ERR(). Have you even looked for these macros implementations?

> +   return dev_err_probe(par->info->device, PTR_ERR(rc),

Use your temporary variable and move...

> +"TE request_irq failed.\n");

...this on the previous line.

> +   disable_irq_nosync(gpiod_to_irq(par->gpio.te));

Why do you call gpio_to_irq() twice?


> +   } else {
> +   dev_info(par->info->device, "%s:%d, TE gpio not specified\n",
> +__func__, __LINE__);

Remove this noise (besides the fact that we don't use __file__ and
__LINE__ in messages like this.

> +   }

Taking all together you probably need to create a helper and use it
inside init_display(), like

static int init_tearing_effect_line(struct fbtft_par *par)
{
  struct device *dev = par->info->device;
  struct gpio_desc *te;
  int irq, rc;

  te = gpiod_get_optional(dev, "te", GPIOD_IN);
  if (IS_ERR(te))
   return dev_err_probe(dev, PTR_ERR(te), "Failed to request
te GPIO\n");

  irq = gpiod_to_irq(te); // this value you have to save in the
driver's (per device) data structure.

  /* GPIO is locked as an IRQ, we may drop the reference */
  gpiod_put(te);

  init_completion(_panel_te); // should be in the (per device)
data structure
  rc = devm_request_irq(dev, irq,  spi_panel_te_handler,
IRQF_TRIGGER_RISING, "TE_GPIO", par);
  if (rc)
return dev_err_probe(dev, rc, "TE IRQ request failed.\n");
  disable_irq_nosync(irq);
  return irq;
}

Note, when you define proper fields for IRQ line and completion in the
data structure the above can be amended accordingly.

...

> +   /* tearing effect line on */
> +   if (par->gpio.te)
> +   write_reg(par, 0x35, 0x00);

0x35 is defined. use it and drop useless comments.

...

>  /**
> + * st7789v_write_vmem16_bus8() -  write data to display

> + *

Redundant blank line.

> + * @par: FBTFT parameter object
> + * @offset: offset from screen_buffer
> + * @len: the length of data to be written
> + *
> + * 16 bit pixel over 8-bit databus
> + *
> + * Return: 0 on success, < 0 if error occurred.

", or a negative error code otherwise"

> + */

> +
Redundant blank line

> +static int st7789v_write_vmem16_bus8(struct fbtft_par *par, size_t offset, 
> size_t len)
> +{
> +   u16 *vmem16;
> +   __be16 *txbuf16 = par->txbuf.buf;
> +   size_t remain;
> +   size_t to_copy;
> +   size_t tx_array_size;
> +   int i;
> +   int ret = 0;
> +   size_t startbyte_size = 0;

Reversed xmas tree order.

> +   fbtft_par_dbg(DEBUG_WRITE_VMEM, par, "st7789v ---%s(offset=%zu, 
> len=%zu)\n",
> + __func__, offset, len);
> +
> +   remain = len / 2;
> +   vmem16 = (u16 *)(par->info->screen_buffer + offset);

> + 

Re: [PATCH v12] staging: fbtft: add tearing signal detect

2021-01-28 Thread Greg KH
On Thu, Jan 28, 2021 at 08:53:55PM +0800, Carlis wrote:
> From: zhangxuezhi 
> 
> For st7789v ic,when we need continuous full screen refresh, it is best to
> wait for the TE signal arrive to avoid screen tearing
> 
> Signed-off-by: zhangxuezhi 
> ---
> v12: change dev_err to dev_err_probe and add space in comments start, and
>  delete te_mutex, change te wait logic
> v11: remove devm_gpio_put and change a dev_err to dev_info
> v10: additional notes
> v9: change pr_* to dev_*
> v8: delete a log line
> v7: return error value when request fail
> v6: add te gpio request fail deal logic
> v5: fix log print
> v4: modify some code style and change te irq set function name
> v3: modify author and signed-off-by name
> v2: add release te gpio after irq request fail
> ---
>  drivers/staging/fbtft/fb_st7789v.c | 116 
> +
>  drivers/staging/fbtft/fbtft.h  |   1 +
>  2 files changed, 117 insertions(+)
> 
> diff --git a/drivers/staging/fbtft/fb_st7789v.c 
> b/drivers/staging/fbtft/fb_st7789v.c
> index 3a280cc..f08e9da 100644
> --- a/drivers/staging/fbtft/fb_st7789v.c
> +++ b/drivers/staging/fbtft/fb_st7789v.c
> @@ -9,7 +9,11 @@
>  #include 
>  #include 
>  #include 
> +#include 
> +#include 
>  #include 
> +#include 
> +
>  #include 
>  
>  #include "fbtft.h"
> @@ -66,6 +70,15 @@ enum st7789v_command {
>  #define MADCTL_MX BIT(6) /* bitmask for column address order */
>  #define MADCTL_MY BIT(7) /* bitmask for page address order */
>  
> +#define SPI_PANEL_TE_TIMEOUT 400 /* msecs */
> +static struct completion spi_panel_te;

Doesn't this structure have to be per-device?  How can it be global for
all devices in the system controlled by this driver?

thanks,

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


[PATCH v12] staging: fbtft: add tearing signal detect

2021-01-28 Thread Carlis
From: zhangxuezhi 

For st7789v ic,when we need continuous full screen refresh, it is best to
wait for the TE signal arrive to avoid screen tearing

Signed-off-by: zhangxuezhi 
---
v12: change dev_err to dev_err_probe and add space in comments start, and
 delete te_mutex, change te wait logic
v11: remove devm_gpio_put and change a dev_err to dev_info
v10: additional notes
v9: change pr_* to dev_*
v8: delete a log line
v7: return error value when request fail
v6: add te gpio request fail deal logic
v5: fix log print
v4: modify some code style and change te irq set function name
v3: modify author and signed-off-by name
v2: add release te gpio after irq request fail
---
 drivers/staging/fbtft/fb_st7789v.c | 116 +
 drivers/staging/fbtft/fbtft.h  |   1 +
 2 files changed, 117 insertions(+)

diff --git a/drivers/staging/fbtft/fb_st7789v.c 
b/drivers/staging/fbtft/fb_st7789v.c
index 3a280cc..f08e9da 100644
--- a/drivers/staging/fbtft/fb_st7789v.c
+++ b/drivers/staging/fbtft/fb_st7789v.c
@@ -9,7 +9,11 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
+#include 
+
 #include 
 
 #include "fbtft.h"
@@ -66,6 +70,15 @@ enum st7789v_command {
 #define MADCTL_MX BIT(6) /* bitmask for column address order */
 #define MADCTL_MY BIT(7) /* bitmask for page address order */
 
+#define SPI_PANEL_TE_TIMEOUT   400 /* msecs */
+static struct completion spi_panel_te;
+
+static irqreturn_t spi_panel_te_handler(int irq, void *data)
+{
+   complete(_panel_te);
+   return IRQ_HANDLED;
+}
+
 /**
  * init_display() - initialize the display controller
  *
@@ -82,6 +95,29 @@ enum st7789v_command {
  */
 static int init_display(struct fbtft_par *par)
 {
+   int rc;
+   struct device *dev = par->info->device;
+
+   par->gpio.te = devm_gpiod_get_index_optional(dev, "te", 0, GPIOD_IN);
+   if (IS_ERR(par->gpio.te))
+   return dev_err_probe(par->info->device, PTR_ERR(par->gpio.te),
+"Failed to request te gpio\n");
+
+   if (par->gpio.te) {
+   init_completion(_panel_te);
+   rc = devm_request_irq(dev,
+ gpiod_to_irq(par->gpio.te),
+spi_panel_te_handler, IRQF_TRIGGER_RISING,
+"TE_GPIO", par);
+   if (IS_ERR(rc))
+   return dev_err_probe(par->info->device, PTR_ERR(rc),
+"TE request_irq failed.\n");
+
+   disable_irq_nosync(gpiod_to_irq(par->gpio.te));
+   } else {
+   dev_info(par->info->device, "%s:%d, TE gpio not specified\n",
+__func__, __LINE__);
+   }
/* turn off sleep mode */
write_reg(par, MIPI_DCS_EXIT_SLEEP_MODE);
mdelay(120);
@@ -137,6 +173,10 @@ static int init_display(struct fbtft_par *par)
 */
write_reg(par, PWCTRL1, 0xA4, 0xA1);
 
+   /* tearing effect line on */
+   if (par->gpio.te)
+   write_reg(par, 0x35, 0x00);
+
write_reg(par, MIPI_DCS_SET_DISPLAY_ON);
 
if (HSD20_IPS)
@@ -146,6 +186,81 @@ static int init_display(struct fbtft_par *par)
 }
 
 /**
+ * st7789v_write_vmem16_bus8() -  write data to display
+ *
+ * @par: FBTFT parameter object
+ * @offset: offset from screen_buffer
+ * @len: the length of data to be written
+ *
+ * 16 bit pixel over 8-bit databus
+ *
+ * Return: 0 on success, < 0 if error occurred.
+ */
+
+static int st7789v_write_vmem16_bus8(struct fbtft_par *par, size_t offset, 
size_t len)
+{
+   u16 *vmem16;
+   __be16 *txbuf16 = par->txbuf.buf;
+   size_t remain;
+   size_t to_copy;
+   size_t tx_array_size;
+   int i;
+   int ret = 0;
+   size_t startbyte_size = 0;
+
+   fbtft_par_dbg(DEBUG_WRITE_VMEM, par, "st7789v ---%s(offset=%zu, 
len=%zu)\n",
+ __func__, offset, len);
+
+   remain = len / 2;
+   vmem16 = (u16 *)(par->info->screen_buffer + offset);
+
+   if (par->gpio.dc)
+   gpiod_set_value(par->gpio.dc, 1);
+
+   if (par->gpio.te) {
+   enable_irq(gpiod_to_irq(par->gpio.te));
+   reinit_completion(_panel_te);
+   ret = wait_for_completion_timeout(_panel_te,
+ 
msecs_to_jiffies(SPI_PANEL_TE_TIMEOUT));
+   if (ret == 0)
+   dev_err(par->info->device, "wait panel TE time out\n");
+
+   disable_irq(gpiod_to_irq(par->gpio.te));
+   }
+   /* non buffered write */
+   if (!par->txbuf.buf)
+   return par->fbtftops.write(par, vmem16, len);
+
+   /* buffered write */
+   tx_array_size = par->txbuf.len / 2;
+
+   if (par->startbyte) {
+   txbuf16 = par->txbuf.buf + 1;
+   tx_array_size -= 2;
+   *(u8 *)(par->txbuf.buf) = par->startbyte | 0x2;
+   

[driver-core:driver-core-testing] BUILD SUCCESS 4731210c09f5977300f439b6c56ba220c65b2348

2021-01-28 Thread kernel test robot
tree/branch: 
https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git 
driver-core-testing
branch HEAD: 4731210c09f5977300f439b6c56ba220c65b2348  gpiolib: Bind 
gpio_device to a driver to enable fw_devlink=on by default

elapsed time: 732m

configs tested: 115
configs skipped: 2

The following configs have been built successfully.
More configs may be tested in the coming days.

gcc tested configs:
arm defconfig
arm64allyesconfig
arm64   defconfig
arm  allyesconfig
arm  allmodconfig
mips rt305x_defconfig
sh   se7724_defconfig
arm   u8500_defconfig
h8300h8300h-sim_defconfig
mips  loongson3_defconfig
powerpc stx_gp3_defconfig
arm eseries_pxa_defconfig
xtensaxip_kc705_defconfig
mipsgpr_defconfig
arm  pxa910_defconfig
m68kmvme16x_defconfig
sparcalldefconfig
armvexpress_defconfig
mips  rb532_defconfig
um i386_defconfig
mipsmaltaup_xpa_defconfig
mips   bmips_be_defconfig
powerpc mpc83xx_defconfig
shmigor_defconfig
powerpc ppa8548_defconfig
xtensa   allyesconfig
mips  pic32mzda_defconfig
powerpc pseries_defconfig
arm  ep93xx_defconfig
openriscor1ksim_defconfig
sh apsh4a3a_defconfig
arm   aspeed_g5_defconfig
armmvebu_v5_defconfig
m68k   m5275evb_defconfig
powerpc  ppc44x_defconfig
powerpc  tqm8xx_defconfig
arm  moxart_defconfig
mips bigsur_defconfig
arcnsim_700_defconfig
ia64 bigsur_defconfig
powerpc canyonlands_defconfig
powerpc  mpc885_ads_defconfig
nios2 3c120_defconfig
powerpc xes_mpc85xx_defconfig
powerpc mpc8313_rdb_defconfig
archsdk_defconfig
mipsbcm63xx_defconfig
powerpcsam440ep_defconfig
arm   tegra_defconfig
mips  ath79_defconfig
sh  r7780mp_defconfig
mips   capcella_defconfig
mips   lemote2f_defconfig
mips decstation_r4k_defconfig
ia64 allmodconfig
ia64defconfig
ia64 allyesconfig
m68k allmodconfig
m68kdefconfig
m68k allyesconfig
nios2   defconfig
arc  allyesconfig
nds32 allnoconfig
c6x  allyesconfig
nds32   defconfig
nios2allyesconfig
cskydefconfig
alpha   defconfig
alphaallyesconfig
h8300allyesconfig
arc defconfig
sh   allmodconfig
parisc  defconfig
s390 allyesconfig
parisc   allyesconfig
s390defconfig
sparcallyesconfig
sparc   defconfig
i386   tinyconfig
i386 allyesconfig
i386defconfig
mips allyesconfig
mips allmodconfig
powerpc  allyesconfig
powerpc  allmodconfig
powerpc   allnoconfig
i386 randconfig-a003-20210128
i386 randconfig-a006-20210128
x86_64   randconfig-a012-20210128
x86_64   randconfig-a015-20210128
x86_64   randconfig-a016-20210128
x86_64   randconfig-a011-20210128
x86_64   randconfig-a013-20210128
x86_64   randconfig-a014-20210128
i386 randconfig-a015-20210128
riscvnommu_k210_defconfig
riscvallyesconfig
riscvnommu_virt_defconfig
riscv allnoconfig
riscv

[PATCH] drm/bridge: anx7625: enable DSI EOTP

2021-01-28 Thread Xin Ji
Enable DSI EOTP feature for fixing some panel screen constance
shift issue.
Removing MIPI flag MIPI_DSI_MODE_EOT_PACKET to enable DSI EOTP.

Signed-off-by: Xin Ji 
---
 drivers/gpu/drm/bridge/analogix/anx7625.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c 
b/drivers/gpu/drm/bridge/analogix/anx7625.c
index 65cc059..e31eeb1b 100644
--- a/drivers/gpu/drm/bridge/analogix/anx7625.c
+++ b/drivers/gpu/drm/bridge/analogix/anx7625.c
@@ -1334,7 +1334,6 @@ static int anx7625_attach_dsi(struct anx7625_data *ctx)
dsi->format = MIPI_DSI_FMT_RGB888;
dsi->mode_flags = MIPI_DSI_MODE_VIDEO   |
MIPI_DSI_MODE_VIDEO_SYNC_PULSE  |
-   MIPI_DSI_MODE_EOT_PACKET|
MIPI_DSI_MODE_VIDEO_HSE;
 
if (mipi_dsi_attach(dsi) < 0) {
-- 
2.7.4

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


Re: [PATCH v10] staging: fbtft: add tearing signal detect

2021-01-28 Thread carlis
On Thu, 28 Jan 2021 12:15:28 +0100
Geert Uytterhoeven  wrote:

> Hi Carlis,
> 
> On Thu, Jan 28, 2021 at 12:03 PM carlis 
> wrote:
> > On Thu, 28 Jan 2021 10:42:54 +0100
> > Geert Uytterhoeven  wrote:  
> > > On Thu, Jan 28, 2021 at 7:53 AM Kari Argillander
> > >  wrote:  
> > > > On Thu, Jan 28, 2021 at 09:42:58AM +0800, carlis wrote:  
> > > > > On Thu, 28 Jan 2021 00:32:22 +0200
> > > > > Kari Argillander  wrote:  
> > > > > > >  #include "fbtft.h"
> > > > > > >
> > > > > > >  #define DRVNAME "fb_st7789v"
> > > > > > > @@ -66,6 +69,32 @@ enum st7789v_command {
> > > > > > >  #define MADCTL_MX BIT(6) /* bitmask for column address
> > > > > > > order */ #define MADCTL_MY BIT(7) /* bitmask for page
> > > > > > > address order */
> > > > > > >
> > > > > > > +#define SPI_PANEL_TE_TIMEOUT 400 /* msecs */
> > > > > > > +static struct mutex te_mutex;/* mutex for set te gpio irq
> > > > > > > status */  
> > > > > >
> > > > > > Space after ;  
> > > > > hi, i have fix it in the patch v11  
> > > > > >  
> > > >
> > > > Yeah sorry. I accidentally review wrong patch. But mostly stuff
> > > > are still relevant.
> > > >  
> > > > > > > @@ -82,6 +111,33 @@ enum st7789v_command {
> > > > > > >   */
> > > > > > >  static int init_display(struct fbtft_par *par)
> > > > > > >  {
> > > > > > > + int rc;
> > > > > > > + struct device *dev = par->info->device;
> > > > > > > +
> > > > > > > + par->gpio.te = devm_gpiod_get_index_optional(dev, "te",
> > > > > > > 0, GPIOD_IN);
> > > > > > > + if (IS_ERR(par->gpio.te)) {
> > > > > > > + rc = PTR_ERR(par->gpio.te);
> > > > > > > + dev_err(par->info->device, "Failed to request te
> > > > > > > gpio: %d\n", rc);
> > > > > > > + return rc;
> > > > > > > + }  
> > > > > >
> > > > > > You request with optinal and you still want to error out? We
> > > > > > could just continue and not care about that error. User
> > > > > > will be happier if device still works somehow.  
> > >
> > > devm_gpiod_get_index_optional() returns NULL, not an error, if the
> > > GPIO is not found.  So if IS_ERR() is the right check.
> > >
> > > And checks for -EPROBE_DEFER can be handled automatically
> > > by using dev_err_probe() instead of dev_err().
> > >  
> > hi, i fix it like below!?
> > par->gpio.te = devm_gpiod_get_index_optional(dev, "te", 0,
> > GPIOD_IN); if (IS_ERR(par->gpio.te)) {
> > rc = PTR_ERR(par->gpio.te);
> > dev_err_probe(par->info->device, rc, "Failed to
> > request te gpio\n"); return rc;
> > }
> > if (par->gpio.te) {
> > init_completion(_panel_te);
> > rc = devm_request_irq(dev,
> >   gpiod_to_irq(par->gpio.te),
> >  spi_panel_te_handler,
> > IRQF_TRIGGER_RISING, "TE_GPIO", par);
> > if (rc) {
> > dev_err(par->info->device, "TE request_irq
> > failed.\n"); return rc;  
> 
> dev_err_probe()
> 
> > }
> >
> > disable_irq_nosync(gpiod_to_irq(par->gpio.te));
> > } else {
> > dev_info(par->info->device, "%s:%d, TE gpio not
> > specified\n", __func__, __LINE__);
> > }  
> 
> Gr{oetje,eeting}s,
> 
> Geert
> 

hi,i will fix it like below:


par->gpio.te = devm_gpiod_get_index_optional(dev, "te", 0,
GPIOD_IN); if (IS_ERR(par->gpio.te))
return dev_err_probe(par->info->device,
PTR_ERR(par->gpio.te), "Failed to request te gpio\n");

if (par->gpio.te) {
init_completion(_panel_te);
rc = devm_request_irq(dev,
  gpiod_to_irq(par->gpio.te),
 spi_panel_te_handler,
IRQF_TRIGGER_RISING, "TE_GPIO", par);
if (IS_ERR(rc))
return dev_err_probe(par->info->device,
PTR_ERR(rc), "TE request_irq failed.\n");

disable_irq_nosync(gpiod_to_irq(par->gpio.te));
} else {
dev_info(par->info->device, "%s:%d, TE gpio not
specified\n", __func__, __LINE__);
}


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


Re: [PATCH v10] staging: fbtft: add tearing signal detect

2021-01-28 Thread Geert Uytterhoeven
Hi Carlis,

On Thu, Jan 28, 2021 at 12:03 PM carlis  wrote:
> On Thu, 28 Jan 2021 10:42:54 +0100
> Geert Uytterhoeven  wrote:
> > On Thu, Jan 28, 2021 at 7:53 AM Kari Argillander
> >  wrote:
> > > On Thu, Jan 28, 2021 at 09:42:58AM +0800, carlis wrote:
> > > > On Thu, 28 Jan 2021 00:32:22 +0200
> > > > Kari Argillander  wrote:
> > > > > >  #include "fbtft.h"
> > > > > >
> > > > > >  #define DRVNAME "fb_st7789v"
> > > > > > @@ -66,6 +69,32 @@ enum st7789v_command {
> > > > > >  #define MADCTL_MX BIT(6) /* bitmask for column address order
> > > > > > */ #define MADCTL_MY BIT(7) /* bitmask for page address order
> > > > > > */
> > > > > >
> > > > > > +#define SPI_PANEL_TE_TIMEOUT 400 /* msecs */
> > > > > > +static struct mutex te_mutex;/* mutex for set te gpio irq
> > > > > > status */
> > > > >
> > > > > Space after ;
> > > > hi, i have fix it in the patch v11
> > > > >
> > >
> > > Yeah sorry. I accidentally review wrong patch. But mostly stuff are
> > > still relevant.
> > >
> > > > > > @@ -82,6 +111,33 @@ enum st7789v_command {
> > > > > >   */
> > > > > >  static int init_display(struct fbtft_par *par)
> > > > > >  {
> > > > > > + int rc;
> > > > > > + struct device *dev = par->info->device;
> > > > > > +
> > > > > > + par->gpio.te = devm_gpiod_get_index_optional(dev, "te", 0,
> > > > > > GPIOD_IN);
> > > > > > + if (IS_ERR(par->gpio.te)) {
> > > > > > + rc = PTR_ERR(par->gpio.te);
> > > > > > + dev_err(par->info->device, "Failed to request te
> > > > > > gpio: %d\n", rc);
> > > > > > + return rc;
> > > > > > + }
> > > > >
> > > > > You request with optinal and you still want to error out? We
> > > > > could just continue and not care about that error. User will be
> > > > > happier if device still works somehow.
> >
> > devm_gpiod_get_index_optional() returns NULL, not an error, if the
> > GPIO is not found.  So if IS_ERR() is the right check.
> >
> > And checks for -EPROBE_DEFER can be handled automatically
> > by using dev_err_probe() instead of dev_err().
> >
> hi, i fix it like below!?
> par->gpio.te = devm_gpiod_get_index_optional(dev, "te", 0,
> GPIOD_IN); if (IS_ERR(par->gpio.te)) {
> rc = PTR_ERR(par->gpio.te);
> dev_err_probe(par->info->device, rc, "Failed to request
> te gpio\n"); return rc;
> }
> if (par->gpio.te) {
> init_completion(_panel_te);
> rc = devm_request_irq(dev,
>   gpiod_to_irq(par->gpio.te),
>  spi_panel_te_handler,
> IRQF_TRIGGER_RISING, "TE_GPIO", par);
> if (rc) {
> dev_err(par->info->device, "TE request_irq
> failed.\n"); return rc;

dev_err_probe()

> }
>
> disable_irq_nosync(gpiod_to_irq(par->gpio.te));
> } else {
> dev_info(par->info->device, "%s:%d, TE gpio not
> specified\n", __func__, __LINE__);
> }

Gr{oetje,eeting}s,

Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v10] staging: fbtft: add tearing signal detect

2021-01-28 Thread carlis
On Thu, 28 Jan 2021 10:42:54 +0100
Geert Uytterhoeven  wrote:

> Hi Kari,
> 
> On Thu, Jan 28, 2021 at 7:53 AM Kari Argillander
>  wrote:
> > On Thu, Jan 28, 2021 at 09:42:58AM +0800, carlis wrote:  
> > > On Thu, 28 Jan 2021 00:32:22 +0200
> > > Kari Argillander  wrote:  
> > > > >  #include "fbtft.h"
> > > > >
> > > > >  #define DRVNAME "fb_st7789v"
> > > > > @@ -66,6 +69,32 @@ enum st7789v_command {
> > > > >  #define MADCTL_MX BIT(6) /* bitmask for column address order
> > > > > */ #define MADCTL_MY BIT(7) /* bitmask for page address order
> > > > > */
> > > > >
> > > > > +#define SPI_PANEL_TE_TIMEOUT 400 /* msecs */
> > > > > +static struct mutex te_mutex;/* mutex for set te gpio irq
> > > > > status */  
> > > >
> > > > Space after ;  
> > > hi, i have fix it in the patch v11  
> > > >  
> >
> > Yeah sorry. I accidentally review wrong patch. But mostly stuff are
> > still relevant.
> >  
> > > > > @@ -82,6 +111,33 @@ enum st7789v_command {
> > > > >   */
> > > > >  static int init_display(struct fbtft_par *par)
> > > > >  {
> > > > > + int rc;
> > > > > + struct device *dev = par->info->device;
> > > > > +
> > > > > + par->gpio.te = devm_gpiod_get_index_optional(dev, "te", 0,
> > > > > GPIOD_IN);
> > > > > + if (IS_ERR(par->gpio.te)) {
> > > > > + rc = PTR_ERR(par->gpio.te);
> > > > > + dev_err(par->info->device, "Failed to request te
> > > > > gpio: %d\n", rc);
> > > > > + return rc;
> > > > > + }  
> > > >
> > > > You request with optinal and you still want to error out? We
> > > > could just continue and not care about that error. User will be
> > > > happier if device still works somehow.  
> 
> devm_gpiod_get_index_optional() returns NULL, not an error, if the
> GPIO is not found.  So if IS_ERR() is the right check.
> 
> And checks for -EPROBE_DEFER can be handled automatically
> by using dev_err_probe() instead of dev_err().
> 
hi, i fix it like below!?
par->gpio.te = devm_gpiod_get_index_optional(dev, "te", 0,
GPIOD_IN); if (IS_ERR(par->gpio.te)) {
rc = PTR_ERR(par->gpio.te);
dev_err_probe(par->info->device, rc, "Failed to request
te gpio\n"); return rc;
}
if (par->gpio.te) {
init_completion(_panel_te);
rc = devm_request_irq(dev,
  gpiod_to_irq(par->gpio.te),
 spi_panel_te_handler,
IRQF_TRIGGER_RISING, "TE_GPIO", par);
if (rc) {
dev_err(par->info->device, "TE request_irq
failed.\n"); return rc;
}

disable_irq_nosync(gpiod_to_irq(par->gpio.te));
} else {
dev_info(par->info->device, "%s:%d, TE gpio not
specified\n", __func__, __LINE__);
}


> > > You mean i just delete this dev_err print ?!
> > > like this:
> > >   par->gpio.te = devm_gpiod_get_index_optional(dev, "te",
> > > 0,GPIOD_IN);
> > > if (IS_ERR(par->gpio.te))
> > >   return PTR_ERR(par->gpio.te);  
> >
> > Not exactly. I'm suggesting something like this.
> >
> > if (IS_ERR(par->gpio.te) == -EPROBE_DEFER) {
> > return -EPROBE_DEFER;
> >
> > if (IS_ERR(par->gpio.te))
> > par-gpio.te = NULL;
> >
> > This like beginning of your patch series but the difference is that
> > if EPROBE_DEFER then we will try again later. Any other error and
> > we will just ignore TE gpio. But this is up to you what you want to
> > do. To me this just seems place where this kind of logic can work.  
> 
> Gr{oetje,eeting}s,
> 
> Geert
> 

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


Re: [PATCH v10] staging: fbtft: add tearing signal detect

2021-01-28 Thread Kari Argillander
On Thu, Jan 28, 2021 at 10:42:54AM +0100, Geert Uytterhoeven wrote:
> Hi Kari,
> 
> On Thu, Jan 28, 2021 at 7:53 AM Kari Argillander
>  wrote:
> > On Thu, Jan 28, 2021 at 09:42:58AM +0800, carlis wrote:
> > > On Thu, 28 Jan 2021 00:32:22 +0200
> > > Kari Argillander  wrote:
> > > > > @@ -82,6 +111,33 @@ enum st7789v_command {
> > > > >   */
> > > > >  static int init_display(struct fbtft_par *par)
> > > > >  {
> > > > > + int rc;
> > > > > + struct device *dev = par->info->device;
> > > > > +
> > > > > + par->gpio.te = devm_gpiod_get_index_optional(dev, "te", 0,
> > > > > GPIOD_IN);
> > > > > + if (IS_ERR(par->gpio.te)) {
> > > > > + rc = PTR_ERR(par->gpio.te);
> > > > > + dev_err(par->info->device, "Failed to request te
> > > > > gpio: %d\n", rc);
> > > > > + return rc;
> > > > > + }
> > > >
> > > > You request with optinal and you still want to error out? We could
> > > > just continue and not care about that error. User will be happier if
> > > > device still works somehow.
> 
> devm_gpiod_get_index_optional() returns NULL, not an error, if the
> GPIO is not found.  So if IS_ERR() is the right check.
> 
> And checks for -EPROBE_DEFER can be handled automatically
> by using dev_err_probe() instead of dev_err().

Yeah. Thanks for pointing that clearly.

> > > You mean i just delete this dev_err print ?!
> > > like this:
> > >   par->gpio.te = devm_gpiod_get_index_optional(dev, "te",
> > > 0,GPIOD_IN);
> > > if (IS_ERR(par->gpio.te))
> > >   return PTR_ERR(par->gpio.te);
> >
> > Not exactly. I'm suggesting something like this.
> >
> > if (IS_ERR(par->gpio.te) == -EPROBE_DEFER) {
> > return -EPROBE_DEFER;
> >
> > if (IS_ERR(par->gpio.te))
> > par-gpio.te = NULL;
> >
> > This like beginning of your patch series but the difference is that if
> > EPROBE_DEFER then we will try again later. Any other error and we will
> > just ignore TE gpio. But this is up to you what you want to do. To me
> > this just seems place where this kind of logic can work.

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


Re: [PATCH v10] staging: fbtft: add tearing signal detect

2021-01-28 Thread Geert Uytterhoeven
Hi Kari,

On Thu, Jan 28, 2021 at 7:53 AM Kari Argillander
 wrote:
> On Thu, Jan 28, 2021 at 09:42:58AM +0800, carlis wrote:
> > On Thu, 28 Jan 2021 00:32:22 +0200
> > Kari Argillander  wrote:
> > > >  #include "fbtft.h"
> > > >
> > > >  #define DRVNAME "fb_st7789v"
> > > > @@ -66,6 +69,32 @@ enum st7789v_command {
> > > >  #define MADCTL_MX BIT(6) /* bitmask for column address order */
> > > >  #define MADCTL_MY BIT(7) /* bitmask for page address order */
> > > >
> > > > +#define SPI_PANEL_TE_TIMEOUT 400 /* msecs */
> > > > +static struct mutex te_mutex;/* mutex for set te gpio irq status
> > > > */
> > >
> > > Space after ;
> > hi, i have fix it in the patch v11
> > >
>
> Yeah sorry. I accidentally review wrong patch. But mostly stuff are
> still relevant.
>
> > > > @@ -82,6 +111,33 @@ enum st7789v_command {
> > > >   */
> > > >  static int init_display(struct fbtft_par *par)
> > > >  {
> > > > + int rc;
> > > > + struct device *dev = par->info->device;
> > > > +
> > > > + par->gpio.te = devm_gpiod_get_index_optional(dev, "te", 0,
> > > > GPIOD_IN);
> > > > + if (IS_ERR(par->gpio.te)) {
> > > > + rc = PTR_ERR(par->gpio.te);
> > > > + dev_err(par->info->device, "Failed to request te
> > > > gpio: %d\n", rc);
> > > > + return rc;
> > > > + }
> > >
> > > You request with optinal and you still want to error out? We could
> > > just continue and not care about that error. User will be happier if
> > > device still works somehow.

devm_gpiod_get_index_optional() returns NULL, not an error, if the
GPIO is not found.  So if IS_ERR() is the right check.

And checks for -EPROBE_DEFER can be handled automatically
by using dev_err_probe() instead of dev_err().

> > You mean i just delete this dev_err print ?!
> > like this:
> >   par->gpio.te = devm_gpiod_get_index_optional(dev, "te",
> > 0,GPIOD_IN);
> > if (IS_ERR(par->gpio.te))
> >   return PTR_ERR(par->gpio.te);
>
> Not exactly. I'm suggesting something like this.
>
> if (IS_ERR(par->gpio.te) == -EPROBE_DEFER) {
> return -EPROBE_DEFER;
>
> if (IS_ERR(par->gpio.te))
> par-gpio.te = NULL;
>
> This like beginning of your patch series but the difference is that if
> EPROBE_DEFER then we will try again later. Any other error and we will
> just ignore TE gpio. But this is up to you what you want to do. To me
> this just seems place where this kind of logic can work.

Gr{oetje,eeting}s,

Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v10] staging: fbtft: add tearing signal detect

2021-01-28 Thread carlis
On Thu, 28 Jan 2021 08:52:33 +0200
Kari Argillander  wrote:

> On Thu, Jan 28, 2021 at 09:42:58AM +0800, carlis wrote:
> > On Thu, 28 Jan 2021 00:32:22 +0200
> > Kari Argillander  wrote:  
> > > >  #include "fbtft.h"
> > > >  
> > > >  #define DRVNAME "fb_st7789v"
> > > > @@ -66,6 +69,32 @@ enum st7789v_command {
> > > >  #define MADCTL_MX BIT(6) /* bitmask for column address order */
> > > >  #define MADCTL_MY BIT(7) /* bitmask for page address order */
> > > >  
> > > > +#define SPI_PANEL_TE_TIMEOUT   400 /* msecs */
> > > > +static struct mutex te_mutex;/* mutex for set te gpio irq
> > > > status */
> > > 
> > > Space after ;  
> > hi, i have fix it in the patch v11  
> > >   
> 
> Yeah sorry. I accidentally review wrong patch. But mostly stuff are
> still relevant.
> 
> > > > @@ -82,6 +111,33 @@ enum st7789v_command {
> > > >   */
> > > >  static int init_display(struct fbtft_par *par)
> > > >  {
> > > > +   int rc;
> > > > +   struct device *dev = par->info->device;
> > > > +
> > > > +   par->gpio.te = devm_gpiod_get_index_optional(dev,
> > > > "te", 0, GPIOD_IN);
> > > > +   if (IS_ERR(par->gpio.te)) {
> > > > +   rc = PTR_ERR(par->gpio.te);
> > > > +   dev_err(par->info->device, "Failed to request
> > > > te gpio: %d\n", rc);
> > > > +   return rc;
> > > > +   }
> > > 
> > > You request with optinal and you still want to error out? We could
> > > just continue and not care about that error. User will be happier
> > > if device still works somehow.  
> > You mean i just delete this dev_err print ?!
> > like this:
> > par->gpio.te = devm_gpiod_get_index_optional(dev, "te",
> > 0,GPIOD_IN); 
> > if (IS_ERR(par->gpio.te))
> > return PTR_ERR(par->gpio.te);  
> 
> Not exactly. I'm suggesting something like this.
> 
> if (IS_ERR(par->gpio.te) == -EPROBE_DEFER) {
>   return -EPROBE_DEFER;
> 
> if (IS_ERR(par->gpio.te))
>   par-gpio.te = NULL;
> 
> This like beginning of your patch series but the difference is that if
> EPROBE_DEFER then we will try again later. Any other error and we will
> just ignore TE gpio. But this is up to you what you want to do. To me
> this just seems place where this kind of logic can work.
> 
> > > > +   if (par->gpio.te) {
> > > > +   set_spi_panel_te_irq_status(par, true);
> > > > +   reinit_completion(_panel_te);
> > > > +   ret =
> > > > wait_for_completion_timeout(_panel_te,
> > > > +
> > > > msecs_to_jiffies(SPI_PANEL_TE_TIMEOUT));
> > > > +   if (ret == 0)
> > > 
> > > !ret
> > >   
> > > > +   dev_err(par->info->device,
> > > > "wait panel TE time out\n");
> > > > +   }
> > > > +   ret = par->fbtftops.write(par, par->txbuf.buf,
> > > > +startbyte_size +
> > > > to_copy
> > > > * 2);
> > > > +   if (par->gpio.te)
> > > > +   set_spi_panel_te_irq_status(par,
> > > > false);
> > > > +   if (ret < 0)
> > > > +   return ret;
> > > > +   remain -= to_copy;
> > > > +   }
> > > > +
> > > > +   return ret;
> > > 
> > > Do we want to return something over 0? If not then this can be
> > > return 0. And then you do not need to even init ret value at the
> > > beginning.
> > > 
> > > Also wait little bit like Greg sayd before sending new version.
> > > Someone might nack about what I say or say something more.
> > >   
> > hi, i copy fbtft_write_vmem16_bus8 from file fbtft_bus.c and modify
> > it ,just add te wait logic, i will take more time to check this
> > original function.  
> 
> It might be ok or not. You should still check.

hi, i will check more carefully, now i have a new problem, Is there a
way to clear the interrupt pending state before opening it again?



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


Re: [PATCH v6 5/7] mfd: hi6421-spmi-pmic: move driver from staging

2021-01-28 Thread Lee Jones
On Wed, 27 Jan 2021, Mauro Carvalho Chehab wrote:

> This driver is ready for mainstream. So, move it out of staging.
> 
> Signed-off-by: Mauro Carvalho Chehab 
> ---
>  .../mfd}/hisilicon,hi6421-spmi-pmic.yaml|  0
>  MAINTAINERS |  7 +++
>  drivers/mfd/Kconfig | 15 +++
>  drivers/mfd/Makefile|  1 +
>  .../hikey9xx => mfd}/hi6421-spmi-pmic.c |  0
>  drivers/staging/hikey9xx/Kconfig| 17 -
>  drivers/staging/hikey9xx/Makefile   |  1 -
>  7 files changed, 23 insertions(+), 18 deletions(-)
>  rename {drivers/staging/hikey9xx => 
> Documentation/devicetree/bindings/mfd}/hisilicon,hi6421-spmi-pmic.yaml (100%)
>  rename drivers/{staging/hikey9xx => mfd}/hi6421-spmi-pmic.c (100%)

I've already reviewed this:

  https://lore.kernel.org/driverdev-devel/20210127110537.GI4903@dell/

-- 
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel