Re: [PATCH v2 2/3] media: imx7-media-csi: add i.MX6UL support

2019-06-11 Thread Sébastien Szymanski
Hi Rui,

thanks for the review!

On 6/10/19 12:28 PM, Rui Miguel Silva wrote:
> Hi Sebastien,
> Thanks for the patch.
> 
> On Thu 06 Jun 2019 at 16:38, Sébastien Szymanski wrote:
>> i.MX7 and i.MX6UL/L have the same CSI controller. So add i.MX6UL/L support
>> to imx7-media-csi driver.
>>
>> Signed-off-by: Sébastien Szymanski 
>> ---
>>
>> Changes for v2:
>>  - rebase on top of linuxtv/master
>>  - mention i.MX6UL/L in header and Kconfig help text
>>  - rename csi_type to csi_soc_id
>>
>>  drivers/staging/media/imx/Kconfig  |  4 +-
>>  drivers/staging/media/imx/imx7-media-csi.c | 62 --
>>  2 files changed, 49 insertions(+), 17 deletions(-)
>>
>> diff --git a/drivers/staging/media/imx/Kconfig 
>> b/drivers/staging/media/imx/Kconfig
>> index ad3d7df6bb3c..8b6dc42c39e0 100644
>> --- a/drivers/staging/media/imx/Kconfig
>> +++ b/drivers/staging/media/imx/Kconfig
>> @@ -22,11 +22,11 @@ config VIDEO_IMX_CSI
>>A video4linux camera sensor interface driver for i.MX5/6.
>>
>>  config VIDEO_IMX7_CSI
>> -tristate "i.MX7 Camera Sensor Interface driver"
>> +tristate "i.MX6UL/L / i.MX7 Camera Sensor Interface driver"
>>  depends on VIDEO_IMX_MEDIA && VIDEO_DEV && I2C
>>  default y
>>  help
>>Enable support for video4linux camera sensor interface driver for
>> -  i.MX7.
>> +  i.MX6UL/L or i.MX7.
>>  endmenu
>>  endif
>> diff --git a/drivers/staging/media/imx/imx7-media-csi.c 
>> b/drivers/staging/media/imx/imx7-media-csi.c
>> index 9101566f3f67..902bdce594cf 100644
>> --- a/drivers/staging/media/imx/imx7-media-csi.c
>> +++ b/drivers/staging/media/imx/imx7-media-csi.c
>> @@ -1,6 +1,6 @@
>>  // SPDX-License-Identifier: GPL-2.0
>>  /*
>> - * V4L2 Capture CSI Subdev for Freescale i.MX7 SOC
>> + * V4L2 Capture CSI Subdev for Freescale i.MX6UL/L / i.MX7 SOC
>>   *
>>   * Copyright (c) 2019 Linaro Ltd
>>   *
>> @@ -152,6 +152,11 @@
>>  #define CSI_CSICR18 0x48
>>  #define CSI_CSICR19 0x4c
>>
>> +enum csi_soc_id {
>> +IMX7,
>> +IMX6UL
>> +};
>> +
>>  struct imx7_csi {
>>  struct device *dev;
>>  struct v4l2_subdev sd;
>> @@ -191,6 +196,7 @@ struct imx7_csi {
>>  bool is_init;
>>  bool is_streaming;
>>  bool is_csi2;
>> +enum csi_soc_id soc_id;
>>
>>  struct completion last_eof_completion;
>>  };
>> @@ -548,6 +554,14 @@ static int imx7_csi_pad_link_validate(struct 
>> v4l2_subdev *sd,
>>  if (ret)
>>  return ret;
>>
>> +if (csi->soc_id == IMX6UL) {
>> +mutex_lock(&csi->lock);
>> +csi->is_csi2 = false;
>> +mutex_unlock(&csi->lock);
>> +
>> +return 0;
>> +}
>> +
>>  ret = imx7_csi_get_upstream_endpoint(csi, &upstream_ep, true);
>>  if (ret) {
>>  v4l2_err(&csi->sd, "failed to find upstream endpoint\n");
>> @@ -757,6 +771,7 @@ static int imx7_csi_configure(struct imx7_csi *csi)
>>  struct v4l2_pix_format *out_pix = &vdev->fmt.fmt.pix;
>>  __u32 in_code = csi->format_mbus[IMX7_CSI_PAD_SINK].code;
>>  u32 cr1, cr18;
>> +int width = out_pix->width;
>>
>>  if (out_pix->field == V4L2_FIELD_INTERLACED) {
>>  imx7_csi_deinterlace_enable(csi, true);
>> @@ -766,15 +781,27 @@ static int imx7_csi_configure(struct imx7_csi *csi)
>>  imx7_csi_buf_stride_set(csi, 0);
>>  }
>>
>> -imx7_csi_set_imagpara(csi, out_pix->width, out_pix->height);
>> +cr18 = imx7_csi_reg_read(csi, CSI_CSICR18);
>> +
>> +if (!csi->is_csi2) {
>> +if (out_pix->pixelformat == V4L2_PIX_FMT_UYVY ||
>> +out_pix->pixelformat == V4L2_PIX_FMT_YUYV)
>> +width *= 2;
>> +
>> +imx7_csi_set_imagpara(csi, width, out_pix->height);
>> +
>> +cr18 |= (BIT_BASEADDR_SWITCH_EN | BIT_BASEADDR_SWITCH_SEL |
>> +BIT_BASEADDR_CHG_ERR_EN);
>> +imx7_csi_reg_write(csi, cr18, CSI_CSICR18);
>>
>> -if (!csi->is_csi2)
>>  return 0;
>> +}
>> +
>> +imx7_csi_set_imagpara(csi, width, out_pix->height);
>>
>>  cr1 = imx7_csi_reg_read(csi, CSI_CSICR1);
>>  cr1 &= ~BIT_GCLK_MODE;
>>
>> -cr18 = imx7_csi_reg_read(csi, CSI_CSICR18);
>>  cr18 &= BIT_MIPI_DATA_FORMAT_MASK;
>>  cr18 |= BIT_DATA_FROM_MIPI;
>>
>> @@ -809,11 +836,9 @@ static void imx7_csi_enable(struct imx7_csi *csi)
>>  {
>>  imx7_csi_sw_reset(csi);
>>
>> -if (csi->is_csi2) {
>> -imx7_csi_dmareq_rff_enable(csi);
>> -imx7_csi_hw_enable_irq(csi);
>> -imx7_csi_hw_enable(csi);
>> -}
>> +imx7_csi_dmareq_rff_enable(csi);
>> +imx7_csi_hw_enable_irq(csi);
>> +imx7_csi_hw_enable(csi);
>>  }
>>
>>  static void imx7_csi_disable(struct imx7_csi *csi)
>> @@ -1166,19 +1191,32 @@ static int imx7_csi_parse_endpoint(struct device 
>> *dev,
>>  return fwnode_device_is_available(asd->match.fwnode) ? 0 : -EINVAL;
>>  }
>>
>> +static const struct of_device_id imx7_csi_of_match[] = {
>> +{ .compa

Re: [GIT PULL net-next, resend] isdn: deprecate non-mISDN drivers

2019-06-11 Thread Christoph Kling
Hi Arnd,

I'm a long time ISDN user and I cannot fully agree to the assessment of current 
ISDN usage. It is of course true that ISDN is no longer a main protocol for 
telephone connections and therefore the number of users has dropped. But still 
there are people with public ISDN telephone links, e.g. in Germany. Not 
everything has been converted into voice over ip. 

More importantly however, there are still many *private* ISDN networks. The 
simple reason is that beyond the public networks, there are still a lot of 
people who have ISDN telephone installations in their buildings. 

Those installations date from the time when many public telephone connections 
used ISDN. Those private ISDN telephone installations have a *very* long 
lifetime (> 20 years), as many people, especially individuals shy at the cost 
and effort to get a new internal telephone installation. A reliable indicator 
for that is that one of the most widespread wifi router products in Germany and 
beyond, AVM Fritz!Box still supports ISDN even in its most recent version 
(7590). 

Speaking for myself, I still use the capi based b1pci driver for active AVM 
cards in several installations.

Please do not base your assessment of ISDN usage on the size and number of 
public ISDN networks and please do not remove capi and isdn4linux support from 
the kernel.

Thank you for commitment to the kernel development!

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


Re: [PATCH v2 2/3] media: imx7-media-csi: add i.MX6UL support

2019-06-11 Thread Rui Miguel Silva
Hi Sebastien,
On Tue 11 Jun 2019 at 09:16, Sébastien Szymanski wrote:
> Hi Rui,
>
> thanks for the review!
>
> On 6/10/19 12:28 PM, Rui Miguel Silva wrote:
>> Hi Sebastien,
>> Thanks for the patch.
>>
>> On Thu 06 Jun 2019 at 16:38, Sébastien Szymanski wrote:
>>> i.MX7 and i.MX6UL/L have the same CSI controller. So add i.MX6UL/L support
>>> to imx7-media-csi driver.
>>>
>>> Signed-off-by: Sébastien Szymanski 
>>> ---
>>>
>>> Changes for v2:
>>>  - rebase on top of linuxtv/master
>>>  - mention i.MX6UL/L in header and Kconfig help text
>>>  - rename csi_type to csi_soc_id
>>>
>>>  drivers/staging/media/imx/Kconfig  |  4 +-
>>>  drivers/staging/media/imx/imx7-media-csi.c | 62 --
>>>  2 files changed, 49 insertions(+), 17 deletions(-)
>>>
>>> diff --git a/drivers/staging/media/imx/Kconfig 
>>> b/drivers/staging/media/imx/Kconfig
>>> index ad3d7df6bb3c..8b6dc42c39e0 100644
>>> --- a/drivers/staging/media/imx/Kconfig
>>> +++ b/drivers/staging/media/imx/Kconfig
>>> @@ -22,11 +22,11 @@ config VIDEO_IMX_CSI
>>>   A video4linux camera sensor interface driver for i.MX5/6.
>>>
>>>  config VIDEO_IMX7_CSI
>>> -   tristate "i.MX7 Camera Sensor Interface driver"
>>> +   tristate "i.MX6UL/L / i.MX7 Camera Sensor Interface driver"
>>> depends on VIDEO_IMX_MEDIA && VIDEO_DEV && I2C
>>> default y
>>> help
>>>   Enable support for video4linux camera sensor interface driver for
>>> - i.MX7.
>>> + i.MX6UL/L or i.MX7.
>>>  endmenu
>>>  endif
>>> diff --git a/drivers/staging/media/imx/imx7-media-csi.c 
>>> b/drivers/staging/media/imx/imx7-media-csi.c
>>> index 9101566f3f67..902bdce594cf 100644
>>> --- a/drivers/staging/media/imx/imx7-media-csi.c
>>> +++ b/drivers/staging/media/imx/imx7-media-csi.c
>>> @@ -1,6 +1,6 @@
>>>  // SPDX-License-Identifier: GPL-2.0
>>>  /*
>>> - * V4L2 Capture CSI Subdev for Freescale i.MX7 SOC
>>> + * V4L2 Capture CSI Subdev for Freescale i.MX6UL/L / i.MX7 SOC
>>>   *
>>>   * Copyright (c) 2019 Linaro Ltd
>>>   *
>>> @@ -152,6 +152,11 @@
>>>  #define CSI_CSICR180x48
>>>  #define CSI_CSICR190x4c
>>>
>>> +enum csi_soc_id {
>>> +   IMX7,
>>> +   IMX6UL
>>> +};
>>> +
>>>  struct imx7_csi {
>>> struct device *dev;
>>> struct v4l2_subdev sd;
>>> @@ -191,6 +196,7 @@ struct imx7_csi {
>>> bool is_init;
>>> bool is_streaming;
>>> bool is_csi2;
>>> +   enum csi_soc_id soc_id;
>>>
>>> struct completion last_eof_completion;
>>>  };
>>> @@ -548,6 +554,14 @@ static int imx7_csi_pad_link_validate(struct 
>>> v4l2_subdev *sd,
>>> if (ret)
>>> return ret;
>>>
>>> +   if (csi->soc_id == IMX6UL) {
>>> +   mutex_lock(&csi->lock);
>>> +   csi->is_csi2 = false;
>>> +   mutex_unlock(&csi->lock);
>>> +
>>> +   return 0;
>>> +   }
>>> +
>>> ret = imx7_csi_get_upstream_endpoint(csi, &upstream_ep, true);
>>> if (ret) {
>>> v4l2_err(&csi->sd, "failed to find upstream endpoint\n");
>>> @@ -757,6 +771,7 @@ static int imx7_csi_configure(struct imx7_csi *csi)
>>> struct v4l2_pix_format *out_pix = &vdev->fmt.fmt.pix;
>>> __u32 in_code = csi->format_mbus[IMX7_CSI_PAD_SINK].code;
>>> u32 cr1, cr18;
>>> +   int width = out_pix->width;
>>>
>>> if (out_pix->field == V4L2_FIELD_INTERLACED) {
>>> imx7_csi_deinterlace_enable(csi, true);
>>> @@ -766,15 +781,27 @@ static int imx7_csi_configure(struct imx7_csi *csi)
>>> imx7_csi_buf_stride_set(csi, 0);
>>> }
>>>
>>> -   imx7_csi_set_imagpara(csi, out_pix->width, out_pix->height);
>>> +   cr18 = imx7_csi_reg_read(csi, CSI_CSICR18);
>>> +
>>> +   if (!csi->is_csi2) {
>>> +   if (out_pix->pixelformat == V4L2_PIX_FMT_UYVY ||
>>> +   out_pix->pixelformat == V4L2_PIX_FMT_YUYV)
>>> +   width *= 2;
>>> +
>>> +   imx7_csi_set_imagpara(csi, width, out_pix->height);
>>> +
>>> +   cr18 |= (BIT_BASEADDR_SWITCH_EN | BIT_BASEADDR_SWITCH_SEL |
>>> +   BIT_BASEADDR_CHG_ERR_EN);
>>> +   imx7_csi_reg_write(csi, cr18, CSI_CSICR18);
>>>
>>> -   if (!csi->is_csi2)
>>> return 0;
>>> +   }
>>> +
>>> +   imx7_csi_set_imagpara(csi, width, out_pix->height);
>>>
>>> cr1 = imx7_csi_reg_read(csi, CSI_CSICR1);
>>> cr1 &= ~BIT_GCLK_MODE;
>>>
>>> -   cr18 = imx7_csi_reg_read(csi, CSI_CSICR18);
>>> cr18 &= BIT_MIPI_DATA_FORMAT_MASK;
>>> cr18 |= BIT_DATA_FROM_MIPI;
>>>
>>> @@ -809,11 +836,9 @@ static void imx7_csi_enable(struct imx7_csi *csi)
>>>  {
>>> imx7_csi_sw_reset(csi);
>>>
>>> -   if (csi->is_csi2) {
>>> -   imx7_csi_dmareq_rff_enable(csi);
>>> -   imx7_csi_hw_enable_irq(csi);
>>> -   imx7_csi_hw_enable(csi);
>>> -   }
>>> +   imx7_csi_dmareq_rff_enable(csi);
>>> +   imx7_csi_hw_enable_irq(csi);
>>> +   imx7_csi_hw_enable(csi);
>>>  }
>>>
>>>  static void imx7_csi_disable(struct imx7_csi *csi)
>>> @@ -1166,19 +1191,32 @@ static int imx7_csi_parse_endpoint(struct device 
>>>

Re: [PATCH v2 2/3] media: imx7-media-csi: add i.MX6UL support

2019-06-11 Thread Sébastien Szymanski
On 6/11/19 11:40 AM, Rui Miguel Silva wrote:
> Hi Sebastien,
> On Tue 11 Jun 2019 at 09:16, Sébastien Szymanski wrote:
>> Hi Rui,
>>
>> thanks for the review!
>>
>> On 6/10/19 12:28 PM, Rui Miguel Silva wrote:
>>> Hi Sebastien,
>>> Thanks for the patch.
>>>
>>> On Thu 06 Jun 2019 at 16:38, Sébastien Szymanski wrote:
 i.MX7 and i.MX6UL/L have the same CSI controller. So add i.MX6UL/L support
 to imx7-media-csi driver.

 Signed-off-by: Sébastien Szymanski 
 ---

 Changes for v2:
  - rebase on top of linuxtv/master
  - mention i.MX6UL/L in header and Kconfig help text
  - rename csi_type to csi_soc_id

  drivers/staging/media/imx/Kconfig  |  4 +-
  drivers/staging/media/imx/imx7-media-csi.c | 62 --
  2 files changed, 49 insertions(+), 17 deletions(-)

 diff --git a/drivers/staging/media/imx/Kconfig 
 b/drivers/staging/media/imx/Kconfig
 index ad3d7df6bb3c..8b6dc42c39e0 100644
 --- a/drivers/staging/media/imx/Kconfig
 +++ b/drivers/staging/media/imx/Kconfig
 @@ -22,11 +22,11 @@ config VIDEO_IMX_CSI
  A video4linux camera sensor interface driver for i.MX5/6.

  config VIDEO_IMX7_CSI
 -  tristate "i.MX7 Camera Sensor Interface driver"
 +  tristate "i.MX6UL/L / i.MX7 Camera Sensor Interface driver"
depends on VIDEO_IMX_MEDIA && VIDEO_DEV && I2C
default y
help
  Enable support for video4linux camera sensor interface driver for
 -i.MX7.
 +i.MX6UL/L or i.MX7.
  endmenu
  endif
 diff --git a/drivers/staging/media/imx/imx7-media-csi.c 
 b/drivers/staging/media/imx/imx7-media-csi.c
 index 9101566f3f67..902bdce594cf 100644
 --- a/drivers/staging/media/imx/imx7-media-csi.c
 +++ b/drivers/staging/media/imx/imx7-media-csi.c
 @@ -1,6 +1,6 @@
  // SPDX-License-Identifier: GPL-2.0
  /*
 - * V4L2 Capture CSI Subdev for Freescale i.MX7 SOC
 + * V4L2 Capture CSI Subdev for Freescale i.MX6UL/L / i.MX7 SOC
   *
   * Copyright (c) 2019 Linaro Ltd
   *
 @@ -152,6 +152,11 @@
  #define CSI_CSICR18   0x48
  #define CSI_CSICR19   0x4c

 +enum csi_soc_id {
 +  IMX7,
 +  IMX6UL
 +};
 +
  struct imx7_csi {
struct device *dev;
struct v4l2_subdev sd;
 @@ -191,6 +196,7 @@ struct imx7_csi {
bool is_init;
bool is_streaming;
bool is_csi2;
 +  enum csi_soc_id soc_id;

struct completion last_eof_completion;
  };
 @@ -548,6 +554,14 @@ static int imx7_csi_pad_link_validate(struct 
 v4l2_subdev *sd,
if (ret)
return ret;

 +  if (csi->soc_id == IMX6UL) {
 +  mutex_lock(&csi->lock);
 +  csi->is_csi2 = false;
 +  mutex_unlock(&csi->lock);
 +
 +  return 0;
 +  }
 +
ret = imx7_csi_get_upstream_endpoint(csi, &upstream_ep, true);
if (ret) {
v4l2_err(&csi->sd, "failed to find upstream endpoint\n");
 @@ -757,6 +771,7 @@ static int imx7_csi_configure(struct imx7_csi *csi)
struct v4l2_pix_format *out_pix = &vdev->fmt.fmt.pix;
__u32 in_code = csi->format_mbus[IMX7_CSI_PAD_SINK].code;
u32 cr1, cr18;
 +  int width = out_pix->width;

if (out_pix->field == V4L2_FIELD_INTERLACED) {
imx7_csi_deinterlace_enable(csi, true);
 @@ -766,15 +781,27 @@ static int imx7_csi_configure(struct imx7_csi *csi)
imx7_csi_buf_stride_set(csi, 0);
}

 -  imx7_csi_set_imagpara(csi, out_pix->width, out_pix->height);
 +  cr18 = imx7_csi_reg_read(csi, CSI_CSICR18);
 +
 +  if (!csi->is_csi2) {
 +  if (out_pix->pixelformat == V4L2_PIX_FMT_UYVY ||
 +  out_pix->pixelformat == V4L2_PIX_FMT_YUYV)
 +  width *= 2;
 +
 +  imx7_csi_set_imagpara(csi, width, out_pix->height);
 +
 +  cr18 |= (BIT_BASEADDR_SWITCH_EN | BIT_BASEADDR_SWITCH_SEL |
 +  BIT_BASEADDR_CHG_ERR_EN);
 +  imx7_csi_reg_write(csi, cr18, CSI_CSICR18);

 -  if (!csi->is_csi2)
return 0;
 +  }
 +
 +  imx7_csi_set_imagpara(csi, width, out_pix->height);

cr1 = imx7_csi_reg_read(csi, CSI_CSICR1);
cr1 &= ~BIT_GCLK_MODE;

 -  cr18 = imx7_csi_reg_read(csi, CSI_CSICR18);
cr18 &= BIT_MIPI_DATA_FORMAT_MASK;
cr18 |= BIT_DATA_FROM_MIPI;

 @@ -809,11 +836,9 @@ static void imx7_csi_enable(struct imx7_csi *csi)
  {
imx7_csi_sw_reset(csi);

 -  if (csi->is_csi2) {
 -  imx7_csi_dmareq_rff_enable(csi);
 -  imx7_csi_hw_enable_irq(csi);
 -  imx7_csi_hw_enable(csi);
 -  }
 +  imx7_csi_dmareq_rff_enable(csi);
 +  imx7_csi_hw_enable_irq(csi);
 +  imx7_csi_hw_enable(csi);
  }

  stat

Re: [PATCH v2 2/3] media: imx7-media-csi: add i.MX6UL support

2019-06-11 Thread Rui Miguel Silva
Hi Sebastien,
On Tue 11 Jun 2019 at 11:03, Sébastien Szymanski wrote:
> On 6/11/19 11:40 AM, Rui Miguel Silva wrote:
>> Hi Sebastien,
>> On Tue 11 Jun 2019 at 09:16, Sébastien Szymanski wrote:
>>> Hi Rui,
>>>
>>> thanks for the review!
>>>
>>> On 6/10/19 12:28 PM, Rui Miguel Silva wrote:
 Hi Sebastien,
 Thanks for the patch.

 On Thu 06 Jun 2019 at 16:38, Sébastien Szymanski wrote:
> i.MX7 and i.MX6UL/L have the same CSI controller. So add i.MX6UL/L support
> to imx7-media-csi driver.
>
> Signed-off-by: Sébastien Szymanski 
> ---
>
> Changes for v2:
>  - rebase on top of linuxtv/master
>  - mention i.MX6UL/L in header and Kconfig help text
>  - rename csi_type to csi_soc_id
>
>  drivers/staging/media/imx/Kconfig  |  4 +-
>  drivers/staging/media/imx/imx7-media-csi.c | 62 --
>  2 files changed, 49 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/staging/media/imx/Kconfig 
> b/drivers/staging/media/imx/Kconfig
> index ad3d7df6bb3c..8b6dc42c39e0 100644
> --- a/drivers/staging/media/imx/Kconfig
> +++ b/drivers/staging/media/imx/Kconfig
> @@ -22,11 +22,11 @@ config VIDEO_IMX_CSI
> A video4linux camera sensor interface driver for i.MX5/6.
>
>  config VIDEO_IMX7_CSI
> - tristate "i.MX7 Camera Sensor Interface driver"
> + tristate "i.MX6UL/L / i.MX7 Camera Sensor Interface driver"
>   depends on VIDEO_IMX_MEDIA && VIDEO_DEV && I2C
>   default y
>   help
> Enable support for video4linux camera sensor interface driver for
> -   i.MX7.
> +   i.MX6UL/L or i.MX7.
>  endmenu
>  endif
> diff --git a/drivers/staging/media/imx/imx7-media-csi.c 
> b/drivers/staging/media/imx/imx7-media-csi.c
> index 9101566f3f67..902bdce594cf 100644
> --- a/drivers/staging/media/imx/imx7-media-csi.c
> +++ b/drivers/staging/media/imx/imx7-media-csi.c
> @@ -1,6 +1,6 @@
>  // SPDX-License-Identifier: GPL-2.0
>  /*
> - * V4L2 Capture CSI Subdev for Freescale i.MX7 SOC
> + * V4L2 Capture CSI Subdev for Freescale i.MX6UL/L / i.MX7 SOC
>   *
>   * Copyright (c) 2019 Linaro Ltd
>   *
> @@ -152,6 +152,11 @@
>  #define CSI_CSICR18  0x48
>  #define CSI_CSICR19  0x4c
>
> +enum csi_soc_id {
> + IMX7,
> + IMX6UL
> +};
> +
>  struct imx7_csi {
>   struct device *dev;
>   struct v4l2_subdev sd;
> @@ -191,6 +196,7 @@ struct imx7_csi {
>   bool is_init;
>   bool is_streaming;
>   bool is_csi2;
> + enum csi_soc_id soc_id;
>
>   struct completion last_eof_completion;
>  };
> @@ -548,6 +554,14 @@ static int imx7_csi_pad_link_validate(struct 
> v4l2_subdev *sd,
>   if (ret)
>   return ret;
>
> + if (csi->soc_id == IMX6UL) {
> + mutex_lock(&csi->lock);
> + csi->is_csi2 = false;
> + mutex_unlock(&csi->lock);
> +
> + return 0;
> + }
> +
>   ret = imx7_csi_get_upstream_endpoint(csi, &upstream_ep, true);
>   if (ret) {
>   v4l2_err(&csi->sd, "failed to find upstream endpoint\n");
> @@ -757,6 +771,7 @@ static int imx7_csi_configure(struct imx7_csi *csi)
>   struct v4l2_pix_format *out_pix = &vdev->fmt.fmt.pix;
>   __u32 in_code = csi->format_mbus[IMX7_CSI_PAD_SINK].code;
>   u32 cr1, cr18;
> + int width = out_pix->width;
>
>   if (out_pix->field == V4L2_FIELD_INTERLACED) {
>   imx7_csi_deinterlace_enable(csi, true);
> @@ -766,15 +781,27 @@ static int imx7_csi_configure(struct imx7_csi *csi)
>   imx7_csi_buf_stride_set(csi, 0);
>   }
>
> - imx7_csi_set_imagpara(csi, out_pix->width, out_pix->height);
> + cr18 = imx7_csi_reg_read(csi, CSI_CSICR18);
> +
> + if (!csi->is_csi2) {
> + if (out_pix->pixelformat == V4L2_PIX_FMT_UYVY ||
> + out_pix->pixelformat == V4L2_PIX_FMT_YUYV)
> + width *= 2;
> +
> + imx7_csi_set_imagpara(csi, width, out_pix->height);
> +
> + cr18 |= (BIT_BASEADDR_SWITCH_EN | BIT_BASEADDR_SWITCH_SEL |
> + BIT_BASEADDR_CHG_ERR_EN);
> + imx7_csi_reg_write(csi, cr18, CSI_CSICR18);
>
> - if (!csi->is_csi2)
>   return 0;
> + }
> +
> + imx7_csi_set_imagpara(csi, width, out_pix->height);
>
>   cr1 = imx7_csi_reg_read(csi, CSI_CSICR1);
>   cr1 &= ~BIT_GCLK_MODE;
>
> - cr18 = imx7_csi_reg_read(csi, CSI_CSICR18);
>   cr18 &= BIT_MIPI_DATA_FORMAT_MASK;
>   cr18 |= BIT_DATA_FROM_MIPI;
>
> @@ -809,11 +836,9 @@ static void imx7_csi_enable(struct imx7_csi *csi)
>  {
>   imx7_csi_sw_reset(csi);
>
> - if (csi->is_csi2) {
> - imx7_csi_dmareq_rff_enable(csi);
> - imx7_csi_hw_enable_irq(csi);
> - imx7_csi_hw_enable(

[PATCH -next] Staging: kpc2000: kpc_dma: Make some symbols static

2019-06-11 Thread YueHaibing
Fix sparse warnings:

drivers/staging/kpc2000/kpc_dma/kpc_dma_driver.c:46:6: warning: symbol 
'kpc_dma_del_device' was not declared. Should it be static?
drivers/staging/kpc2000/kpc_dma/kpc_dma_driver.c:84:1: warning: symbol 
'dev_attr_engine_regs' was not declared. Should it be static?
drivers/staging/kpc2000/kpc_dma/kpc_dma_driver.c:91:14: warning: symbol 
'kpc_dma_class' was not declared. Should it be static?
drivers/staging/kpc2000/kpc_dma/kpc_dma_driver.c:199:24: warning: symbol 
'kpc_dma_plat_driver_i' was not declared. Should it be static?

Reported-by: Hulk Robot 
Signed-off-by: YueHaibing 
---
 drivers/staging/kpc2000/kpc_dma/kpc_dma_driver.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/kpc2000/kpc_dma/kpc_dma_driver.c 
b/drivers/staging/kpc2000/kpc_dma/kpc_dma_driver.c
index 9acf1ea..ca76073 100644
--- a/drivers/staging/kpc2000/kpc_dma/kpc_dma_driver.c
+++ b/drivers/staging/kpc2000/kpc_dma/kpc_dma_driver.c
@@ -43,7 +43,7 @@ static void kpc_dma_add_device(struct kpc_dma_device *ldev)
mutex_unlock(&kpc_dma_mtx);
 }
 
-void kpc_dma_del_device(struct kpc_dma_device *ldev)
+static void kpc_dma_del_device(struct kpc_dma_device *ldev)
 {
mutex_lock(&kpc_dma_mtx);
list_del(&ldev->list);
@@ -81,14 +81,14 @@ static ssize_t  show_engine_regs(struct device *dev, struct 
device_attribute *at
ldev->desc_completed
);
 }
-DEVICE_ATTR(engine_regs, 0444, show_engine_regs, NULL);
+static DEVICE_ATTR(engine_regs, 0444, show_engine_regs, NULL);
 
 static const struct attribute *ndd_attr_list[] = {
&dev_attr_engine_regs.attr,
NULL,
 };
 
-struct class *kpc_dma_class;
+static struct class *kpc_dma_class;
 
 /**  Platform Driver Functions  **/
 static
@@ -196,7 +196,7 @@ int  kpc_dma_remove(struct platform_device *pldev)
 }
 
 /**  Driver Functions  **/
-struct platform_driver kpc_dma_plat_driver_i = {
+static struct platform_driver kpc_dma_plat_driver_i = {
.probe= kpc_dma_probe,
.remove   = kpc_dma_remove,
.driver = {
-- 
2.7.4


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


RE: [PATCH v2] staging: kpc2000: kpc_i2c: remove the macros inb_p and outb_p

2019-06-11 Thread Matt Sickler
>-Original Message-
>From: devel  On Behalf Of
>Geordan Neukum
>
>This inb() call looks like a bug. We perform a 64-bit operation when
>talking to this hardware register everywhere else in this driver. Anyone
>have more insight into the hardware with which this driver interacts
>such that they could shed some light on the subject?

That would be me.  I looked at the VHDL for the hardware.  The registers seem to
be aligned to 8 bytes but only use the LS byte of each.  So it probably doesn't
matter whether the memory transactions are 64-bit or 8-bit.
I know the hardware doesn't support byte-enables either, which is probably why
the registers were padded this way.   Probably also why the inb_p and outb_p
macros were redefined.

>Probably a separate issue, but I did notice it as a result of this patch.
>
>Thanks,
>Geordan

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


[PATCH] media: imx7-media-csi: get csi upstream endpoint

2019-06-11 Thread Rui Miguel Silva
When the upstream endpoint is neither a mux nor a CSI2 module, just get
the source pad directly upstream from the CSI.

Fixes: 05f634040c0d ("media: staging/imx7: add imx7 CSI subdev driver")
Reported-by: Sebastien Szymanski 
Signed-off-by: Rui Miguel Silva 
---
 drivers/staging/media/imx/imx7-media-csi.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/drivers/staging/media/imx/imx7-media-csi.c 
b/drivers/staging/media/imx/imx7-media-csi.c
index 9101566f3f67..8979ee0c8202 100644
--- a/drivers/staging/media/imx/imx7-media-csi.c
+++ b/drivers/staging/media/imx/imx7-media-csi.c
@@ -442,6 +442,14 @@ static int imx7_csi_get_upstream_endpoint(struct imx7_csi 
*csi,
 
src = &csi->src_sd->entity;
 
+   /*
+* if the source in neither a mux or csi2 get the one directly upstream
+* from this csi
+*/
+   if (src->function != MEDIA_ENT_F_VID_IF_BRIDGE &&
+   src->function != MEDIA_ENT_F_VID_MUX)
+   src = &csi->sd.entity;
+
 skip_video_mux:
/* get source pad of entity directly upstream from src */
pad = imx_media_pipeline_pad(src, 0, 0, true);
-- 
2.22.0

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


[PATCH 1/3] staging: rtl8723bs: hal: sdio_ops: fix Comparison to NULL

2019-06-11 Thread Hariprasad Kelam
this patch fixes below warning reported by checkpatch

CHECK: Comparison to NULL could be written "c2h_evt"

Signed-off-by: Hariprasad Kelam 
---
 drivers/staging/rtl8723bs/hal/sdio_ops.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8723bs/hal/sdio_ops.c 
b/drivers/staging/rtl8723bs/hal/sdio_ops.c
index ac79de8..baeffbb 100644
--- a/drivers/staging/rtl8723bs/hal/sdio_ops.c
+++ b/drivers/staging/rtl8723bs/hal/sdio_ops.c
@@ -1058,7 +1058,7 @@ void sd_int_dpc(struct adapter *adapter)
 
DBG_8192C("%s: C2H Command\n", __func__);
c2h_evt = rtw_zmalloc(16);
-   if (c2h_evt != NULL) {
+   if (c2h_evt) {
if (rtw_hal_c2h_evt_read(adapter, (u8 *)c2h_evt) == 
_SUCCESS) {
if (c2h_id_filter_ccx_8723b((u8 *)c2h_evt)) {
/* Handle CCX report here */
-- 
2.7.4

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


[PATCH 2/3] staging: rtl8723bs: hal: sdio_ops: fix spaces preferred around unary operator

2019-06-11 Thread Hariprasad Kelam
CHECK: spaces preferred around that '+' (ctx:VxV)
CHECK: spaces preferred around that '+' (ctx:VxV)
CHECK: spaces preferred around that '+' (ctx:VxV)
CHECK: spaces preferred around that '+' (ctx:VxV)

Signed-off-by: Hariprasad Kelam 
---
 drivers/staging/rtl8723bs/hal/sdio_ops.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/sdio_ops.c 
b/drivers/staging/rtl8723bs/hal/sdio_ops.c
index baeffbb..ebd2ab8 100644
--- a/drivers/staging/rtl8723bs/hal/sdio_ops.c
+++ b/drivers/staging/rtl8723bs/hal/sdio_ops.c
@@ -214,7 +214,7 @@ static u32 sdio_read32(struct intf_hdl *intfhdl, u32 addr)
 
ftaddr &= ~(u16)0x3;
sd_read(intfhdl, ftaddr, 8, tmpbuf);
-   memcpy(&le_tmp, tmpbuf+shift, 4);
+   memcpy(&le_tmp, tmpbuf + shift, 4);
val = le32_to_cpu(le_tmp);
 
kfree(tmpbuf);
@@ -261,7 +261,7 @@ static s32 sdio_readN(struct intf_hdl *intfhdl, u32 addr, 
u32 cnt, u8 *buf)
 
err = sd_read(intfhdl, ftaddr, n, tmpbuf);
if (!err)
-   memcpy(buf, tmpbuf+shift, cnt);
+   memcpy(buf, tmpbuf + shift, cnt);
kfree(tmpbuf);
}
return err;
@@ -366,7 +366,7 @@ static s32 sdio_writeN(struct intf_hdl *intfhdl, u32 addr, 
u32 cnt, u8 *buf)
kfree(tmpbuf);
return err;
}
-   memcpy(tmpbuf+shift, buf, cnt);
+   memcpy(tmpbuf + shift, buf, cnt);
err = sd_write(intfhdl, ftaddr, n, tmpbuf);
kfree(tmpbuf);
}
@@ -727,8 +727,8 @@ static s32 ReadInterrupt8723BSdio(struct adapter *adapter, 
u32 *phisr)
hisr = 0;
while (hisr_len != 0) {
hisr_len--;
-   val8 = SdioLocalCmd52Read1Byte(adapter, SDIO_REG_HISR+hisr_len);
-   hisr |= (val8 << (8*hisr_len));
+   val8 = SdioLocalCmd52Read1Byte(adapter, SDIO_REG_HISR + 
hisr_len);
+   hisr |= (val8 << (8 * hisr_len));
}
 
*phisr = hisr;
@@ -952,7 +952,7 @@ static struct recv_buf *sd_recv_rxfifo(struct adapter 
*adapter, u32 size)
recvbuf->pskb->dev = adapter->pnetdev;
 
tmpaddr = (SIZE_PTR)recvbuf->pskb->data;
-   alignment = tmpaddr & (RECVBUFF_ALIGN_SZ-1);
+   alignment = tmpaddr & (RECVBUFF_ALIGN_SZ - 1);
skb_reserve(recvbuf->pskb, (RECVBUFF_ALIGN_SZ - 
alignment));
}
 
-- 
2.7.4

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


[PATCH 3/3] staging: rtl8723bs: hal: sdio_ops: fix braces {} are not necessary for single statement blocks

2019-06-11 Thread Hariprasad Kelam
This patch fixes below issue reported by checkpatch

WARNING: braces {} are not necessary for single statement blocks

Signed-off-by: Hariprasad Kelam 
---
 drivers/staging/rtl8723bs/hal/sdio_ops.c | 16 ++--
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/sdio_ops.c 
b/drivers/staging/rtl8723bs/hal/sdio_ops.c
index ebd2ab8..22bbcb7 100644
--- a/drivers/staging/rtl8723bs/hal/sdio_ops.c
+++ b/drivers/staging/rtl8723bs/hal/sdio_ops.c
@@ -1045,13 +1045,11 @@ void sd_int_dpc(struct adapter *adapter)
}
}
 
-   if (hal->sdio_hisr & SDIO_HISR_TXBCNOK) {
+   if (hal->sdio_hisr & SDIO_HISR_TXBCNOK)
DBG_8192C("%s: SDIO_HISR_TXBCNOK\n", __func__);
-   }
 
-   if (hal->sdio_hisr & SDIO_HISR_TXBCNERR) {
+   if (hal->sdio_hisr & SDIO_HISR_TXBCNERR)
DBG_8192C("%s: SDIO_HISR_TXBCNERR\n", __func__);
-   }
 #ifndef CONFIG_C2H_PACKET_EN
if (hal->sdio_hisr & SDIO_HISR_C2HCMD) {
struct c2h_evt_hdr_88xx *c2h_evt;
@@ -1077,13 +1075,12 @@ void sd_int_dpc(struct adapter *adapter)
}
 #endif
 
-   if (hal->sdio_hisr & SDIO_HISR_RXFOVW) {
+   if (hal->sdio_hisr & SDIO_HISR_RXFOVW)
DBG_8192C("%s: Rx Overflow\n", __func__);
-   }
 
-   if (hal->sdio_hisr & SDIO_HISR_RXERR) {
+   if (hal->sdio_hisr & SDIO_HISR_RXERR)
DBG_8192C("%s: Rx Error\n", __func__);
-   }
+
 
if (hal->sdio_hisr & SDIO_HISR_RX_REQUEST) {
struct recv_buf *recvbuf;
@@ -1143,9 +1140,8 @@ void sd_int_hdl(struct adapter *adapter)
 
/*  clear HISR */
v32 = hal->sdio_hisr & MASK_SDIO_HISR_CLEAR;
-   if (v32) {
+   if (v32)
SdioLocalCmd52Write4Byte(adapter, SDIO_REG_HISR, v32);
-   }
 
sd_int_dpc(adapter);
} else {
-- 
2.7.4

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


[PATCH] staging: rtl8723bs: hal: Change return type to void from u8

2019-06-11 Thread Hariprasad Kelam
The function HalQueryTxOQTBufferStatus8723BSdio always returns true and
caller functions are not bother about return status.

Change return type to void.

Signed-off-by: Hariprasad Kelam 
---
 drivers/staging/rtl8723bs/hal/sdio_ops.c | 3 +--
 drivers/staging/rtl8723bs/include/sdio_ops.h | 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/sdio_ops.c 
b/drivers/staging/rtl8723bs/hal/sdio_ops.c
index ac79de8..feb95ed 100644
--- a/drivers/staging/rtl8723bs/hal/sdio_ops.c
+++ b/drivers/staging/rtl8723bs/hal/sdio_ops.c
@@ -1194,12 +1194,11 @@ u8 HalQueryTxBufferStatus8723BSdio(struct adapter 
*adapter)
 /* Description: */
 /* Query SDIO Local register to get the current number of TX OQT 
Free Space. */
 /*  */
-u8 HalQueryTxOQTBufferStatus8723BSdio(struct adapter *adapter)
+void HalQueryTxOQTBufferStatus8723BSdio(struct adapter *adapter)
 {
struct hal_com_data *haldata = GET_HAL_DATA(adapter);
 
haldata->SdioTxOQTFreeSpace = SdioLocalCmd52Read1Byte(adapter, 
SDIO_REG_OQT_FREE_PG);
-   return true;
 }
 
 #if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN)
diff --git a/drivers/staging/rtl8723bs/include/sdio_ops.h 
b/drivers/staging/rtl8723bs/include/sdio_ops.h
index 0f117ff..6b0446b 100644
--- a/drivers/staging/rtl8723bs/include/sdio_ops.h
+++ b/drivers/staging/rtl8723bs/include/sdio_ops.h
@@ -33,7 +33,7 @@ extern void InitSysInterrupt8723BSdio(struct adapter 
*padapter);
 extern void EnableInterrupt8723BSdio(struct adapter *padapter);
 extern void DisableInterrupt8723BSdio(struct adapter *padapter);
 extern u8 HalQueryTxBufferStatus8723BSdio(struct adapter *padapter);
-extern u8 HalQueryTxOQTBufferStatus8723BSdio(struct adapter *padapter);
+extern void HalQueryTxOQTBufferStatus8723BSdio(struct adapter *padapter);
 #if defined(CONFIG_WOWLAN) || defined(CONFIG_AP_WOWLAN)
 extern void ClearInterrupt8723BSdio(struct adapter *padapter);
 #endif /* CONFIG_WOWLAN */
-- 
2.7.4

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


[PATCH 6/6] staging: kpc2000: updated TODO in light of DMA AIO fixes.

2019-06-11 Thread Jeremy Sowden
The DMA AIO file-ops now work, so remove that item from the to-do list.

Cc: Matt Sickler 
Signed-off-by: Jeremy Sowden 
---
 drivers/staging/kpc2000/TODO | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/kpc2000/TODO b/drivers/staging/kpc2000/TODO
index 47530e23e940..414870debd85 100644
--- a/drivers/staging/kpc2000/TODO
+++ b/drivers/staging/kpc2000/TODO
@@ -1,5 +1,3 @@
 - the kpc_spi driver doesn't seem to let multiple transactions (to different 
instances of the core) happen in parallel...
 - The kpc_i2c driver is a hot mess, it should probably be cleaned up a ton.  
It functions against current hardware though.
-- would be nice if the AIO fileops in kpc_dma could be made to work
-- probably want to add a CONFIG_ option to control compilation of the AIO 
functions
-- if the AIO fileops in kpc_dma start working, next would be making iov_count 
> 1 work too
+- Now that the AIO fileops in kpc_dma work, we want to make iov_count > 1 work 
too
-- 
2.20.1

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


[PATCH 3/6] staging: kpc2000_dma: formatting fixes for AIO functions.

2019-06-11 Thread Jeremy Sowden
Fixed some lines which were more than 80-characters long.

Cc: Matt Sickler 
Signed-off-by: Jeremy Sowden 
---
 drivers/staging/kpc2000/kpc_dma/fileops.c | 21 -
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/kpc2000/kpc_dma/fileops.c 
b/drivers/staging/kpc2000/kpc_dma/fileops.c
index b77fa5c34dc2..d74300f14dff 100644
--- a/drivers/staging/kpc2000/kpc_dma/fileops.c
+++ b/drivers/staging/kpc2000/kpc_dma/fileops.c
@@ -309,17 +309,18 @@ int  kpc_dma_close(struct inode *inode, struct file *filp)
 }
 
 #ifdef CONFIG_KPC2000_DMA_AIO
-static
-int  kpc_dma_aio_cancel(struct kiocb *kcb)
+static int kpc_dma_aio_cancel(struct kiocb *kcb)
 {
struct dev_private_data *priv = kcb->ki_filp->private_data;
 
-   dev_dbg(&priv->ldev->pldev->dev, "%s(kcb = [%p]) priv = [%p], ldev = 
[%p]\n", __func__, kcb, priv, priv->ldev);
+   dev_dbg(&priv->ldev->pldev->dev,
+   "%s(kcb = [%p]) priv = [%p], ldev = [%p]\n",
+   __func__, kcb, priv, priv->ldev);
return 0;
 }
 
-static
-ssize_t   kpc_dma_aio_read(struct kiocb *kcb, const struct iovec *iov, 
unsigned long iov_count, loff_t pos)
+static ssize_t kpc_dma_aio_read(struct kiocb *kcb, const struct iovec *iov,
+   unsigned long iov_count, loff_t pos)
 {
struct dev_private_data *priv = kcb->ki_filp->private_data;
 
@@ -327,7 +328,8 @@ ssize_t   kpc_dma_aio_read(struct kiocb *kcb, const struct 
iovec *iov, unsigned
return -EMEDIUMTYPE;
 
if (iov_count != 1) {
-   dev_err(&priv->ldev->pldev->dev, "%s() called with iov_count > 
1!\n", __func__);
+   dev_err(&priv->ldev->pldev->dev,
+   "%s() called with iov_count > 1!\n", __func__);
return -EFAULT;
}
 
@@ -336,8 +338,8 @@ ssize_t   kpc_dma_aio_read(struct kiocb *kcb, const struct 
iovec *iov, unsigned
return kpc_dma_transfer(priv, kcb, (unsigned long)iov->iov_base, 
iov->iov_len);
 }
 
-static
-ssize_t  kpc_dma_aio_write(struct kiocb *kcb, const struct iovec *iov, 
unsigned long iov_count, loff_t pos)
+static ssize_t kpc_dma_aio_write(struct kiocb *kcb, const struct iovec *iov,
+unsigned long iov_count, loff_t pos)
 {
struct dev_private_data *priv = kcb->ki_filp->private_data;
 
@@ -345,7 +347,8 @@ ssize_t  kpc_dma_aio_write(struct kiocb *kcb, const struct 
iovec *iov, unsigned
return -EMEDIUMTYPE;
 
if (iov_count != 1) {
-   dev_err(&priv->ldev->pldev->dev, "%s() called with iov_count > 
1!\n", __func__);
+   dev_err(&priv->ldev->pldev->dev,
+   "%s() called with iov_count > 1!\n", __func__);
return -EFAULT;
}
 
-- 
2.20.1

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


[PATCH 0/6] staging: kpc2000_dma: fixes for AIO file-ops.

2019-06-11 Thread Jeremy Sowden
I've had a go at getting the DMA AIO working.  It compiles, but I don't
have access to the hardware, so I have done no more testing than that.

The fifth patch removes the cancel call-back because it is empty and so
doesn't serve any purpose (AFAICS).  However, it doesn't appear to be
too tricky to implement something that would abort the transfer in the
same manner that kpc_dma_close() if this would be useful.

Jeremy Sowden (6):
  staging: kpc2000_dma: added Kconfig to enable asynchronous I/O.
  staging: kpc2000_dma: removed casts of void pointers.
  staging: kpc2000_dma: formatting fixes for AIO functions.
  staging: kpc2000_dma: replaced aio_(read|write) file-ops with
(read|write)_iter ones.
  staging: kpc2000_dma: removed aio cancel call-back.
  staging: kpc2000: updated TODO in light of DMA AIO fixes.

 drivers/staging/kpc2000/Kconfig   |  8 +++
 drivers/staging/kpc2000/TODO  |  4 +-
 drivers/staging/kpc2000/kpc_dma/fileops.c | 69 ---
 3 files changed, 44 insertions(+), 37 deletions(-)

-- 
2.20.1

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


[PATCH 5/6] staging: kpc2000_dma: removed aio cancel call-back.

2019-06-11 Thread Jeremy Sowden
The AIO cancel call-back doesn't do anything.  Removed it.

Cc: Matt Sickler 
Signed-off-by: Jeremy Sowden 
---
 drivers/staging/kpc2000/kpc_dma/fileops.c | 14 --
 1 file changed, 14 deletions(-)

diff --git a/drivers/staging/kpc2000/kpc_dma/fileops.c 
b/drivers/staging/kpc2000/kpc_dma/fileops.c
index 1e8f8c41f82a..a738e553ddc4 100644
--- a/drivers/staging/kpc2000/kpc_dma/fileops.c
+++ b/drivers/staging/kpc2000/kpc_dma/fileops.c
@@ -310,16 +310,6 @@ int  kpc_dma_close(struct inode *inode, struct file *filp)
 }
 
 #ifdef CONFIG_KPC2000_DMA_AIO
-static int kpc_dma_aio_cancel(struct kiocb *kcb)
-{
-   struct dev_private_data *priv = kcb->ki_filp->private_data;
-
-   dev_dbg(&priv->ldev->pldev->dev,
-   "%s(kcb = [%p]) priv = [%p], ldev = [%p]\n",
-   __func__, kcb, priv, priv->ldev);
-   return 0;
-}
-
 static ssize_t kpc_dma_read_iter(struct kiocb *kcb, struct iov_iter *to)
 {
struct dev_private_data *priv = kcb->ki_filp->private_data;
@@ -339,8 +329,6 @@ static ssize_t kpc_dma_read_iter(struct kiocb *kcb, struct 
iov_iter *to)
 
iov = iov_iter_iovec(to);
 
-   if (!is_sync_kiocb(kcb))
-   kiocb_set_cancel_fn(kcb, kpc_dma_aio_cancel);
return kpc_dma_transfer(priv, kcb, (unsigned long)iov.iov_base,
iov.iov_len);
 }
@@ -364,8 +352,6 @@ static ssize_t kpc_dma_write_iter(struct kiocb *kcb, struct 
iov_iter *from)
 
iov = iov_iter_iovec(from);
 
-   if (!is_sync_kiocb(kcb))
-   kiocb_set_cancel_fn(kcb, kpc_dma_aio_cancel);
return kpc_dma_transfer(priv, kcb, (unsigned long)iov.iov_base,
iov.iov_len);
 }
-- 
2.20.1

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


[PATCH 2/6] staging: kpc2000_dma: removed casts of void pointers.

2019-06-11 Thread Jeremy Sowden
The AIO call-backs assigned void pointers to local variables and used
superfluous casts in the process.  Removed the casts.

Cc: Matt Sickler 
Signed-off-by: Jeremy Sowden 
---
 drivers/staging/kpc2000/kpc_dma/fileops.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/kpc2000/kpc_dma/fileops.c 
b/drivers/staging/kpc2000/kpc_dma/fileops.c
index ee382dee01ca..b77fa5c34dc2 100644
--- a/drivers/staging/kpc2000/kpc_dma/fileops.c
+++ b/drivers/staging/kpc2000/kpc_dma/fileops.c
@@ -312,7 +312,7 @@ int  kpc_dma_close(struct inode *inode, struct file *filp)
 static
 int  kpc_dma_aio_cancel(struct kiocb *kcb)
 {
-   struct dev_private_data *priv = (struct dev_private_data 
*)kcb->ki_filp->private_data;
+   struct dev_private_data *priv = kcb->ki_filp->private_data;
 
dev_dbg(&priv->ldev->pldev->dev, "%s(kcb = [%p]) priv = [%p], ldev = 
[%p]\n", __func__, kcb, priv, priv->ldev);
return 0;
@@ -321,7 +321,7 @@ int  kpc_dma_aio_cancel(struct kiocb *kcb)
 static
 ssize_t   kpc_dma_aio_read(struct kiocb *kcb, const struct iovec *iov, 
unsigned long iov_count, loff_t pos)
 {
-   struct dev_private_data *priv = (struct dev_private_data 
*)kcb->ki_filp->private_data;
+   struct dev_private_data *priv = kcb->ki_filp->private_data;
 
if (priv->ldev->dir != DMA_FROM_DEVICE)
return -EMEDIUMTYPE;
@@ -339,7 +339,7 @@ ssize_t   kpc_dma_aio_read(struct kiocb *kcb, const struct 
iovec *iov, unsigned
 static
 ssize_t  kpc_dma_aio_write(struct kiocb *kcb, const struct iovec *iov, 
unsigned long iov_count, loff_t pos)
 {
-   struct dev_private_data *priv = (struct dev_private_data 
*)kcb->ki_filp->private_data;
+   struct dev_private_data *priv = kcb->ki_filp->private_data;
 
if (priv->ldev->dir != DMA_TO_DEVICE)
return -EMEDIUMTYPE;
-- 
2.20.1

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


[PATCH 4/6] staging: kpc2000_dma: replaced aio_(read|write) file-ops with (read|write)_iter ones.

2019-06-11 Thread Jeremy Sowden
The AIO API was implemented in terms of obsolete file-ops.  Replaced the
->aio_read and ->aio_write call-backs with ->read_iter and ->write_iter
ones.  Replaced the call to aio_complete with a call to the ki_complete
call-back of the kiocb object.

Cc: Matt Sickler 
Signed-off-by: Jeremy Sowden 
---
 drivers/staging/kpc2000/kpc_dma/fileops.c | 40 +++
 1 file changed, 26 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/kpc2000/kpc_dma/fileops.c 
b/drivers/staging/kpc2000/kpc_dma/fileops.c
index d74300f14dff..1e8f8c41f82a 100644
--- a/drivers/staging/kpc2000/kpc_dma/fileops.c
+++ b/drivers/staging/kpc2000/kpc_dma/fileops.c
@@ -10,6 +10,7 @@
 #include 
 #include   /* copy_*_user */
 #include   /* aio stuff */
+#include 
 #include 
 #include 
 #include "kpc_dma_driver.h"
@@ -243,7 +244,7 @@ void  transfer_complete_cb(struct aio_cb_data *acd, size_t 
xfr_count, u32 flags)
}
} else {
 #ifdef CONFIG_KPC2000_DMA_AIO
-   aio_complete(acd->kcb, acd->len, acd->flags);
+   acd->kcb->ki_complete(acd->kcb, acd->len, acd->flags);
 #endif
kfree(acd);
}
@@ -319,42 +320,54 @@ static int kpc_dma_aio_cancel(struct kiocb *kcb)
return 0;
 }
 
-static ssize_t kpc_dma_aio_read(struct kiocb *kcb, const struct iovec *iov,
-   unsigned long iov_count, loff_t pos)
+static ssize_t kpc_dma_read_iter(struct kiocb *kcb, struct iov_iter *to)
 {
struct dev_private_data *priv = kcb->ki_filp->private_data;
+   struct iovec iov;
 
if (priv->ldev->dir != DMA_FROM_DEVICE)
return -EMEDIUMTYPE;
 
-   if (iov_count != 1) {
+   if (!iter_is_iovec(to))
+   return -EINVAL;
+
+   if (iov_iter_count(to) != 1) {
dev_err(&priv->ldev->pldev->dev,
"%s() called with iov_count > 1!\n", __func__);
return -EFAULT;
}
 
+   iov = iov_iter_iovec(to);
+
if (!is_sync_kiocb(kcb))
kiocb_set_cancel_fn(kcb, kpc_dma_aio_cancel);
-   return kpc_dma_transfer(priv, kcb, (unsigned long)iov->iov_base, 
iov->iov_len);
+   return kpc_dma_transfer(priv, kcb, (unsigned long)iov.iov_base,
+   iov.iov_len);
 }
 
-static ssize_t kpc_dma_aio_write(struct kiocb *kcb, const struct iovec *iov,
-unsigned long iov_count, loff_t pos)
+static ssize_t kpc_dma_write_iter(struct kiocb *kcb, struct iov_iter *from)
 {
struct dev_private_data *priv = kcb->ki_filp->private_data;
+   struct iovec iov;
 
if (priv->ldev->dir != DMA_TO_DEVICE)
return -EMEDIUMTYPE;
 
-   if (iov_count != 1) {
+   if (!iter_is_iovec(from))
+   return -EINVAL;
+
+   if (iov_iter_count(from) != 1) {
dev_err(&priv->ldev->pldev->dev,
"%s() called with iov_count > 1!\n", __func__);
return -EFAULT;
}
 
+   iov = iov_iter_iovec(from);
+
if (!is_sync_kiocb(kcb))
kiocb_set_cancel_fn(kcb, kpc_dma_aio_cancel);
-   return kpc_dma_transfer(priv, kcb, (unsigned long)iov->iov_base, 
iov->iov_len);
+   return kpc_dma_transfer(priv, kcb, (unsigned long)iov.iov_base,
+   iov.iov_len);
 }
 #endif
 
@@ -399,16 +412,15 @@ long  kpc_dma_ioctl(struct file *filp, unsigned int 
ioctl_num, unsigned long ioc
return -ENOTTY;
 }
 
-const struct file_operations  kpc_dma_fops = {
-   .owner  = THIS_MODULE,
+const struct file_operations kpc_dma_fops = {
+   .owner  = THIS_MODULE,
.open   = kpc_dma_open,
.release= kpc_dma_close,
.read   = kpc_dma_read,
.write  = kpc_dma_write,
 #ifdef CONFIG_KPC2000_DMA_AIO
-   .aio_read   = kpc_dma_aio_read,
-   .aio_write  = kpc_dma_aio_write,
+   .read_iter  = kpc_dma_read_iter,
+   .write_iter = kpc_dma_write_iter,
 #endif
.unlocked_ioctl = kpc_dma_ioctl,
 };
-
-- 
2.20.1

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


[PATCH 1/6] staging: kpc2000_dma: added Kconfig to enable asynchronous I/O.

2019-06-11 Thread Jeremy Sowden
The DMA driver has call-backs for doing asynchronous I/O which are
protected by a CONFIG_ macro which is not defined.  Added a Kconfig
stanza to define it.

Cc: Matt Sickler 
Signed-off-by: Jeremy Sowden 
---
 drivers/staging/kpc2000/Kconfig   | 8 
 drivers/staging/kpc2000/kpc_dma/fileops.c | 6 +++---
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/kpc2000/Kconfig b/drivers/staging/kpc2000/Kconfig
index 897965359fcb..694cef28c1b3 100644
--- a/drivers/staging/kpc2000/Kconfig
+++ b/drivers/staging/kpc2000/Kconfig
@@ -57,3 +57,11 @@ config KPC2000_DMA
 
  If unsure, say N.
 
+config KPC2000_DMA_AIO
+   bool "Daktronics KPC DMA controller (asynchronous IO)"
+   depends on KPC2000_DMA && AIO
+   help
+  Say Y here if you wish to support asynchronous IO with the Daktronics
+  DMA controller.
+
+ If unsure, say N.
diff --git a/drivers/staging/kpc2000/kpc_dma/fileops.c 
b/drivers/staging/kpc2000/kpc_dma/fileops.c
index f80b01715d93..ee382dee01ca 100644
--- a/drivers/staging/kpc2000/kpc_dma/fileops.c
+++ b/drivers/staging/kpc2000/kpc_dma/fileops.c
@@ -242,7 +242,7 @@ void  transfer_complete_cb(struct aio_cb_data *acd, size_t 
xfr_count, u32 flags)
kfree(acd);
}
} else {
-#ifdef CONFIG_KPC_DMA_AIO
+#ifdef CONFIG_KPC2000_DMA_AIO
aio_complete(acd->kcb, acd->len, acd->flags);
 #endif
kfree(acd);
@@ -308,7 +308,7 @@ int  kpc_dma_close(struct inode *inode, struct file *filp)
return 0;
 }
 
-#ifdef CONFIG_KPC_DMA_AIO
+#ifdef CONFIG_KPC2000_DMA_AIO
 static
 int  kpc_dma_aio_cancel(struct kiocb *kcb)
 {
@@ -402,7 +402,7 @@ const struct file_operations  kpc_dma_fops = {
.release= kpc_dma_close,
.read   = kpc_dma_read,
.write  = kpc_dma_write,
-#ifdef CONFIG_KPC_DMA_AIO
+#ifdef CONFIG_KPC2000_DMA_AIO
.aio_read   = kpc_dma_aio_read,
.aio_write  = kpc_dma_aio_write,
 #endif
-- 
2.20.1

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


[PATCH] x86/hyperv: Disable preemption while setting reenlightenment vector

2019-06-11 Thread Dmitry Safonov
KVM support may be compiled as dynamic module, which triggers the
following splat on modprobe:

 KVM: vmx: using Hyper-V Enlightened VMCS
 BUG: using smp_processor_id() in preemptible [] code: modprobe/466 
caller is debug_smp_processor_id+0x17/0x19
 CPU: 0 PID: 466 Comm: modprobe Kdump: loaded Not tainted 4.19.43 #1
 Hardware name: Microsoft Corporation Virtual Machine/Virtual Machine, BIOS 
090007  06/02/2017
 Call Trace:
  dump_stack+0x61/0x7e
  check_preemption_disabled+0xd4/0xe6
  debug_smp_processor_id+0x17/0x19
  set_hv_tscchange_cb+0x1b/0x89
  kvm_arch_init+0x14a/0x163 [kvm]
  kvm_init+0x30/0x259 [kvm]
  vmx_init+0xed/0x3db [kvm_intel]
  do_one_initcall+0x89/0x1bc
  do_init_module+0x5f/0x207
  load_module+0x1b34/0x209b
  __ia32_sys_init_module+0x17/0x19
  do_fast_syscall_32+0x121/0x1fa
  entry_SYSENTER_compat+0x7f/0x91

The easiest solution seems to be disabling preemption while setting up
reenlightment MSRs. While at it, fix hv_cpu_*() callbacks.

Fixes: 93286261de1b4 ("x86/hyperv: Reenlightenment notifications
support")

Cc: Andy Lutomirski 
Cc: Borislav Petkov 
Cc: Cathy Avery 
Cc: Haiyang Zhang 
Cc: "H. Peter Anvin" 
Cc: Ingo Molnar 
Cc: "K. Y. Srinivasan" 
Cc: "Michael Kelley (EOSG)" 
Cc: Mohammed Gamal 
Cc: Paolo Bonzini 
Cc: Radim Krčmář 
Cc: Roman Kagan 
Cc: Sasha Levin 
Cc: Stephen Hemminger 
Cc: Thomas Gleixner 
Cc: Vitaly Kuznetsov 

Cc: de...@linuxdriverproject.org
Cc: k...@vger.kernel.org
Cc: linux-hyp...@vger.kernel.org
Cc: x...@kernel.org
Reported-by: Prasanna Panchamukhi 
Signed-off-by: Dmitry Safonov 
---
 arch/x86/hyperv/hv_init.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c
index 1608050e9df9..0bdd79ecbff8 100644
--- a/arch/x86/hyperv/hv_init.c
+++ b/arch/x86/hyperv/hv_init.c
@@ -91,7 +91,7 @@ EXPORT_SYMBOL_GPL(hv_max_vp_index);
 static int hv_cpu_init(unsigned int cpu)
 {
u64 msr_vp_index;
-   struct hv_vp_assist_page **hvp = &hv_vp_assist_page[smp_processor_id()];
+   struct hv_vp_assist_page **hvp = &hv_vp_assist_page[cpu];
void **input_arg;
struct page *pg;
 
@@ -103,7 +103,7 @@ static int hv_cpu_init(unsigned int cpu)
 
hv_get_vp_index(msr_vp_index);
 
-   hv_vp_index[smp_processor_id()] = msr_vp_index;
+   hv_vp_index[cpu] = msr_vp_index;
 
if (msr_vp_index > hv_max_vp_index)
hv_max_vp_index = msr_vp_index;
@@ -182,7 +182,6 @@ void set_hv_tscchange_cb(void (*cb)(void))
struct hv_reenlightenment_control re_ctrl = {
.vector = HYPERV_REENLIGHTENMENT_VECTOR,
.enabled = 1,
-   .target_vp = hv_vp_index[smp_processor_id()]
};
struct hv_tsc_emulation_control emu_ctrl = {.enabled = 1};
 
@@ -196,7 +195,11 @@ void set_hv_tscchange_cb(void (*cb)(void))
/* Make sure callback is registered before we write to MSRs */
wmb();
 
+   preempt_disable();
+   re_ctrl.target_vp = hv_vp_index[smp_processor_id()];
wrmsrl(HV_X64_MSR_REENLIGHTENMENT_CONTROL, *((u64 *)&re_ctrl));
+   preempt_enable();
+
wrmsrl(HV_X64_MSR_TSC_EMULATION_CONTROL, *((u64 *)&emu_ctrl));
 }
 EXPORT_SYMBOL_GPL(set_hv_tscchange_cb);
-- 
2.22.0

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


RE: [PATCH 4/6] staging: kpc2000_dma: replaced aio_(read|write) file-ops with (read|write)_iter ones.

2019-06-11 Thread Matt Sickler
>-Original Message-
>From: Jeremy Sowden 
>

>The AIO API was implemented in terms of obsolete file-ops.  Replaced the
>->aio_read and ->aio_write call-backs with ->read_iter and ->write_iter
>ones.  Replaced the call to aio_complete with a call to the ki_complete
>call-back of the kiocb object.
>
>Cc: Matt Sickler 
>Signed-off-by: Jeremy Sowden 
>---
> drivers/staging/kpc2000/kpc_dma/fileops.c | 40 +++
> 1 file changed, 26 insertions(+), 14 deletions(-)
>
>diff --git a/drivers/staging/kpc2000/kpc_dma/fileops.c
>b/drivers/staging/kpc2000/kpc_dma/fileops.c
>index d74300f14dff..1e8f8c41f82a 100644
>--- a/drivers/staging/kpc2000/kpc_dma/fileops.c
>+++ b/drivers/staging/kpc2000/kpc_dma/fileops.c
>@@ -10,6 +10,7 @@
> #include 
> #include   /* copy_*_user */
> #include   /* aio stuff */
>+#include 
> #include 
> #include 
> #include "kpc_dma_driver.h"
>@@ -243,7 +244,7 @@ void  transfer_complete_cb(struct aio_cb_data *acd,
>size_t xfr_count, u32 flags)
>}
>} else {
> #ifdef CONFIG_KPC2000_DMA_AIO
>-   aio_complete(acd->kcb, acd->len, acd->flags);
>+   acd->kcb->ki_complete(acd->kcb, acd->len, acd->flags);
> #endif
>kfree(acd);
>}
>@@ -319,42 +320,54 @@ static int kpc_dma_aio_cancel(struct kiocb *kcb)
>return 0;
> }

This part was wrapped in the ifdef because aio_complete was removed some time
after 3.16 and I didn't bother with figuring out the replacement for it since
I figured the AIO functionality would be removed entirely.


As for the read_iter/write_iter, my understanding is that's for allowing
scatter-gather type buffers from userspace.  If so, that functionality could
be removed entirely.  Our use cases have zero need for it, which is why it's
not implemented right now.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH 0/6] staging: kpc2000_dma: fixes for AIO file-ops.

2019-06-11 Thread Matt Sickler
>-Original Message-
>From: Jeremy Sowden 
>I've had a go at getting the DMA AIO working.  It compiles, but I don't
>have access to the hardware, so I have done no more testing than that.

Honestly, it'd probably be better to just remove the AIO support entirely.  The
one use case we had that could possibly have benefitted from AIO has been
switched away from DMA entirely.  We switched because the DMA buffer was a
couple hundred bytes and the overhead of setting up the DMA was killing
throughput.  AIO *might* have been able to help there, but the userspace side
of AIO is a PITA to work with.  IMO, if "AIO" for the kpc_dma driver were to
make a come back, I think it would be better to use something like io_uring
The other things that use DMA wouldn't benefit from AIO as they have to setup
other parts of the hardware that can't coordinate with the DMA controllers
(or at least not without a lot of work).

TL;DR: it's probably better to just kill the AIO parts of the driver than to 
try to make them work.

>The fifth patch removes the cancel call-back because it is empty and so
>doesn't serve any purpose (AFAICS).  However, it doesn't appear to be
>too tricky to implement something that would abort the transfer in the
>same manner that kpc_dma_close() if this would be useful.

It's empty because I didn't have time to figure out how to cancel the DMA
operation on the hardware side.  Doing the same "reset the whole engine"
type of cancel could work, but I'm not sure how well that would mesh with
aio_cancel (the latter would kill *all* in-flight operations, the former
is only killing the one).  As I said above, it's probably better to just
remove all the AIO pieces.

>Jeremy Sowden (6):
>  staging: kpc2000_dma: added Kconfig to enable asynchronous I/O.
>  staging: kpc2000_dma: removed casts of void pointers.
>  staging: kpc2000_dma: formatting fixes for AIO functions.
>  staging: kpc2000_dma: replaced aio_(read|write) file-ops with
>(read|write)_iter ones.
>  staging: kpc2000_dma: removed aio cancel call-back.
>  staging: kpc2000: updated TODO in light of DMA AIO fixes.
>
> drivers/staging/kpc2000/Kconfig   |  8 +++
> drivers/staging/kpc2000/TODO  |  4 +-
> drivers/staging/kpc2000/kpc_dma/fileops.c | 69 ---
> 3 files changed, 44 insertions(+), 37 deletions(-)
>
>--
>2.20.1

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


[PATCH 2/2] staging: rtl8723bs: hal: sdio_halinit: fix spaces preferred around that unary operator

2019-06-11 Thread Hariprasad Kelam
CHECK: spaces preferred around that '+' (ctx:VxV)
CHECK: spaces preferred around that '<<' (ctx:VxV)
CHECK: spaces preferred around that '|' (ctx:VxV)

Signed-off-by: Hariprasad Kelam 
---
 drivers/staging/rtl8723bs/hal/sdio_halinit.c | 92 ++--
 1 file changed, 46 insertions(+), 46 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/sdio_halinit.c 
b/drivers/staging/rtl8723bs/hal/sdio_halinit.c
index 70f9e1d..8f1c8f0 100644
--- a/drivers/staging/rtl8723bs/hal/sdio_halinit.c
+++ b/drivers/staging/rtl8723bs/hal/sdio_halinit.c
@@ -112,17 +112,17 @@ u8 _InitPowerOn_8723BS(struct adapter *padapter)
/*  all of these MUST be configured before power on */
 #ifdef CONFIG_EXT_CLK
/*  Use external crystal(XTAL) */
-   value8 = rtw_read8(padapter, REG_PAD_CTRL1_8723B+2);
+   value8 = rtw_read8(padapter, REG_PAD_CTRL1_8723B + 2);
value8 |=  BIT(7);
-   rtw_write8(padapter, REG_PAD_CTRL1_8723B+2, value8);
+   rtw_write8(padapter, REG_PAD_CTRL1_8723B + 2, value8);

/*  CLK_REQ High active or Low Active */
/*  Request GPIO polarity: */
/*  0: low active */
/*  1: high active */
-   value8 = rtw_read8(padapter, REG_MULTI_FUNC_CTRL+1);
+   value8 = rtw_read8(padapter, REG_MULTI_FUNC_CTRL + 1);
value8 |= BIT(5);
-   rtw_write8(padapter, REG_MULTI_FUNC_CTRL+1, value8);
+   rtw_write8(padapter, REG_MULTI_FUNC_CTRL + 1, value8);
 #endif /*  CONFIG_EXT_CLK */

/*  only cmd52 can be used before power on(card enable) */
@@ -137,12 +137,12 @@ u8 _InitPowerOn_8723BS(struct adapter *padapter)
}

/*  Radio-Off Pin Trigger */
-   value8 = rtw_read8(padapter, REG_GPIO_INTM+1);
+   value8 = rtw_read8(padapter, REG_GPIO_INTM + 1);
value8 |= BIT(1); /*  Enable falling edge triggering interrupt */
-   rtw_write8(padapter, REG_GPIO_INTM+1, value8);
-   value8 = rtw_read8(padapter, REG_GPIO_IO_SEL_2+1);
+   rtw_write8(padapter, REG_GPIO_INTM + 1, value8);
+   value8 = rtw_read8(padapter, REG_GPIO_IO_SEL_2 + 1);
value8 |= BIT(1);
-   rtw_write8(padapter, REG_GPIO_IO_SEL_2+1, value8);
+   rtw_write8(padapter, REG_GPIO_IO_SEL_2 + 1, value8);

/*  Enable power down and GPIO interrupt */
value16 = rtw_read16(padapter, REG_APS_FSMCO);
@@ -203,13 +203,13 @@ static void _init_available_page_threshold(struct adapter 
*padapter, u8 numHQ, u
u16 HQ_threshold, NQ_threshold, LQ_threshold;

HQ_threshold = (numPubQ + numHQ + 1) >> 1;
-   HQ_threshold |= (HQ_threshold<<8);
+   HQ_threshold |= (HQ_threshold << 8);

NQ_threshold = (numPubQ + numNQ + 1) >> 1;
-   NQ_threshold |= (NQ_threshold<<8);
+   NQ_threshold |= (NQ_threshold << 8);

LQ_threshold = (numPubQ + numLQ + 1) >> 1;
-   LQ_threshold |= (LQ_threshold<<8);
+   LQ_threshold |= (LQ_threshold << 8);

rtw_write16(padapter, 0x218, HQ_threshold);
rtw_write16(padapter, 0x21A, NQ_threshold);
@@ -271,7 +271,7 @@ static void _InitTxBufferBoundary(struct adapter *padapter)
rtw_write8(padapter, REG_TXPKTBUF_MGQ_BDNY_8723B, txpktbuf_bndy);
rtw_write8(padapter, REG_TXPKTBUF_WMAC_LBK_BF_HD_8723B, txpktbuf_bndy);
rtw_write8(padapter, REG_TRXFF_BNDY, txpktbuf_bndy);
-   rtw_write8(padapter, REG_TDECTRL+1, txpktbuf_bndy);
+   rtw_write8(padapter, REG_TDECTRL + 1, txpktbuf_bndy);
 }

 static void _InitNormalChipRegPriority(
@@ -569,7 +569,7 @@ static void HalRxAggr8723BSdio(struct adapter *padapter)
valueDMAPageCount = 0x06;
}

-   rtw_write8(padapter, REG_RXDMA_AGG_PG_TH+1, valueDMATimeout);
+   rtw_write8(padapter, REG_RXDMA_AGG_PG_TH + 1, valueDMATimeout);
rtw_write8(padapter, REG_RXDMA_AGG_PG_TH, valueDMAPageCount);
 }

@@ -588,8 +588,8 @@ static void sdio_AggSettingRxUpdate(struct adapter 
*padapter)
rtw_write8(padapter, REG_TRXDMA_CTRL, valueDMA);

valueRxAggCtrl |= RXDMA_AGG_MODE_EN;
-   valueRxAggCtrl |= ((aggBurstNum<<2) & 0x0C);
-   valueRxAggCtrl |= ((aggBurstSize<<4) & 0x30);
+   valueRxAggCtrl |= ((aggBurstNum << 2) & 0x0C);
+   valueRxAggCtrl |= ((aggBurstSize << 4) & 0x30);
rtw_write8(padapter, REG_RXDMA_MODE_CTRL_8723B, valueRxAggCtrl);/* 
RxAggLowThresh = 4*1K */
 }

@@ -754,11 +754,11 @@ static u32 rtl8723bs_hal_init(struct adapter *padapter)
rtw_hal_get_hwreg(padapter, HW_VAR_CPWM, &cpwm_orig);

/* ser rpwm */
-   val8 = rtw_read8(padapter, SDIO_LOCAL_BASE|SDIO_REG_HRPWM1);
+   val8 = rtw_read8(padapter, SDIO_LOCAL_BASE | SDIO_REG_HRPWM1);
val8 &= 0x80;
val8 += 0x80;
val8 |= BIT(6);
-   rtw_write8(padapter, SDIO_LOCAL_BASE|SDIO_REG_HRPWM1, val8);
+   rtw_write8(padapter, SDIO_LOCAL_BASE | SDIO_REG_HRPWM1, val8);
DBG_871X("%s: write rpwm =%02x\n", __func__, val8);

[PATCH 1/2] staging: rtl8723bs: hal: sdio_halinit: fix comparison to true/false is error prone

2019-06-11 Thread Hariprasad Kelam
CHECK: Using comparison to false is error prone
CHECK: Using comparison to true is error prone

Signed-off-by: Hariprasad Kelam 
---
 drivers/staging/rtl8723bs/hal/sdio_halinit.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/sdio_halinit.c 
b/drivers/staging/rtl8723bs/hal/sdio_halinit.c
index 3c65a9c..70f9e1d 100644
--- a/drivers/staging/rtl8723bs/hal/sdio_halinit.c
+++ b/drivers/staging/rtl8723bs/hal/sdio_halinit.c
@@ -26,7 +26,7 @@ static u8 CardEnable(struct adapter *padapter)


rtw_hal_get_hwreg(padapter, HW_VAR_APFM_ON_MAC, &bMacPwrCtrlOn);
-   if (bMacPwrCtrlOn == false) {
+   if (!bMacPwrCtrlOn) {
/*  RSV_CTRL 0x1C[7:0] = 0x00 */
/*  unlock ISO/CLK/Power control register */
rtw_write8(padapter, REG_RSV_CTRL, 0x0);
@@ -127,7 +127,7 @@ u8 _InitPowerOn_8723BS(struct adapter *padapter)

/*  only cmd52 can be used before power on(card enable) */
ret = CardEnable(padapter);
-   if (ret == false) {
+   if (!ret) {
RT_TRACE(
_module_hci_hal_init_c_,
_drv_emerg_,
@@ -838,7 +838,7 @@ static u32 rtl8723bs_hal_init(struct adapter *padapter)

 /* SIC_Init(padapter); */

-   if (pwrctrlpriv->reg_rfoff == true)
+   if (pwrctrlpriv->reg_rfoff)
pwrctrlpriv->rf_pwrstate = rf_off;

/*  2010/08/09 MH We need to check if we need to turnon or off RF after 
detecting */
@@ -1081,7 +1081,7 @@ static void CardDisableRTL8723BSdio(struct adapter 
*padapter)
ret = false;
rtw_hal_set_hwreg(padapter, HW_VAR_APFM_ON_MAC, &bMacPwrCtrlOn);
ret = HalPwrSeqCmdParsing(padapter, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, 
PWR_INTF_SDIO_MSK, rtl8723B_card_disable_flow);
-   if (ret == false) {
+   if (!ret) {
DBG_8192C(KERN_ERR "%s: run CARD DISABLE flow fail!\n", 
__func__);
}
 }
@@ -1091,9 +1091,9 @@ static u32 rtl8723bs_hal_deinit(struct adapter *padapter)
struct dvobj_priv *psdpriv = padapter->dvobj;
struct debug_priv *pdbgpriv = &psdpriv->drv_dbg;

-   if (padapter->hw_init_completed == true) {
+   if (padapter->hw_init_completed) {
if (adapter_to_pwrctl(padapter)->bips_processing == true) {
-   if (padapter->netif_up == true) {
+   if (padapter->netif_up) {
int cnt = 0;
u8 val8 = 0;

@@ -1387,7 +1387,7 @@ static s32 _ReadAdapterInfo8723BS(struct adapter 
*padapter)
RT_TRACE(_module_hci_hal_init_c_, _drv_info_, 
("+_ReadAdapterInfo8723BS\n"));

/*  before access eFuse, make sure card enable has been called */
-   if (padapter->hw_init_completed == false)
+   if (!padapter->hw_init_completed)
_InitPowerOn_8723BS(padapter);


@@ -1404,7 +1404,7 @@ static s32 _ReadAdapterInfo8723BS(struct adapter 
*padapter)
_ReadPROMContent(padapter);
_InitOtherVariable(padapter);

-   if (padapter->hw_init_completed == false) {
+   if (!padapter->hw_init_completed) {
rtw_write8(padapter, 0x67, 0x00); /*  for BT, Switch Ant 
control to BT */
CardDisableRTL8723BSdio(padapter);/* for the power consumption 
issue,  wifi ko module is loaded during booting, but wifi GUI is off */
}
--
2.7.4

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


[PATCH] staging: rtl8188eu: Change type of rtw_get_sec_ie()

2019-06-11 Thread Nishka Dasgupta
Change return type of function rtw_get_sec_ie from int to void and
remove its return statement as the return value is never stored, checked
or otherwise used.

Signed-off-by: Nishka Dasgupta 
---
 drivers/staging/rtl8188eu/core/rtw_ieee80211.c | 4 +---
 drivers/staging/rtl8188eu/include/ieee80211.h  | 4 ++--
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_ieee80211.c 
b/drivers/staging/rtl8188eu/core/rtw_ieee80211.c
index 797ffa6e64d5..28b3cdd10397 100644
--- a/drivers/staging/rtl8188eu/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8188eu/core/rtw_ieee80211.c
@@ -482,7 +482,7 @@ int rtw_parse_wpa2_ie(u8 *rsn_ie, int rsn_ie_len, int 
*group_cipher, int *pairwi
return ret;
 }
 
-int rtw_get_sec_ie(u8 *in_ie, uint in_len, u8 *rsn_ie, u16 *rsn_len, u8 
*wpa_ie, u16 *wpa_len)
+void rtw_get_sec_ie(u8 *in_ie, uint in_len, u8 *rsn_ie, u16 *rsn_len, u8 
*wpa_ie, u16 *wpa_len)
 {
u8 authmode, sec_idx, i;
u8 wpa_oui[4] = {0x0, 0x50, 0xf2, 0x01};
@@ -539,8 +539,6 @@ int rtw_get_sec_ie(u8 *in_ie, uint in_len, u8 *rsn_ie, u16 
*rsn_len, u8 *wpa_ie,
}
}
}
-
-   return *rsn_len + *wpa_len;
 }
 
 u8 rtw_is_wps_ie(u8 *ie_ptr, uint *wps_ielen)
diff --git a/drivers/staging/rtl8188eu/include/ieee80211.h 
b/drivers/staging/rtl8188eu/include/ieee80211.h
index 42ee4ebe90eb..d569fe5ed8e6 100644
--- a/drivers/staging/rtl8188eu/include/ieee80211.h
+++ b/drivers/staging/rtl8188eu/include/ieee80211.h
@@ -743,8 +743,8 @@ int rtw_parse_wpa_ie(u8 *wpa_ie, int wpa_ie_len, int 
*group_cipher,
 int rtw_parse_wpa2_ie(u8 *wpa_ie, int wpa_ie_len, int *group_cipher,
  int *pairwise_cipher, int *is_8021x);
 
-int rtw_get_sec_ie(u8 *in_ie, uint in_len, u8 *rsn_ie, u16 *rsn_len,
-  u8 *wpa_ie, u16 *wpa_len);
+void rtw_get_sec_ie(u8 *in_ie, uint in_len, u8 *rsn_ie, u16 *rsn_len,
+   u8 *wpa_ie, u16 *wpa_len);
 
 u8 rtw_is_wps_ie(u8 *ie_ptr, uint *wps_ielen);
 u8 *rtw_get_wps_ie(u8 *in_ie, uint in_len, u8 *wps_ie, uint *wps_ielen);
-- 
2.19.1

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