[staging:staging-testing] BUILD SUCCESS 3fce0276f98a5e4263735f86c5c35361fafa7a59

2020-03-19 Thread kbuild test robot
tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 
 staging-testing
branch HEAD: 3fce0276f98a5e4263735f86c5c35361fafa7a59  staging: rtl8723bs: 
os_dep: Correct typo in comments

elapsed time: 733m

configs tested: 152
configs skipped: 0

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

arm  allmodconfig
arm   allnoconfig
arm  allyesconfig
arm64allmodconfig
arm64 allnoconfig
arm64allyesconfig
arm at91_dt_defconfig
arm   efm32_defconfig
arm  exynos_defconfig
armmulti_v5_defconfig
armmulti_v7_defconfig
armshmobile_defconfig
arm   sunxi_defconfig
arm64   defconfig
sparcallyesconfig
h8300   h8s-sim_defconfig
i386  allnoconfig
i386 allyesconfig
i386 alldefconfig
i386defconfig
ia64 alldefconfig
ia64 allmodconfig
ia64  allnoconfig
ia64 allyesconfig
ia64defconfig
nios2 3c120_defconfig
nios2 10m50_defconfig
c6xevmc6678_defconfig
xtensa  iss_defconfig
c6x  allyesconfig
xtensa   common_defconfig
openrisc simple_smp_defconfig
openriscor1ksim_defconfig
alpha   defconfig
cskydefconfig
nds32 allnoconfig
nds32   defconfig
m68k   m5475evb_defconfig
m68k   sun3_defconfig
m68k  multi_defconfig
h8300 edosk2674_defconfig
h8300h8300h-sim_defconfig
m68k allmodconfig
arc  allyesconfig
arc defconfig
microblaze  mmu_defconfig
microblazenommu_defconfig
powerpc   allnoconfig
powerpc defconfig
powerpc   ppc64_defconfig
powerpc  rhel-kconfig
mips   32r2_defconfig
mips 64r6el_defconfig
mips allmodconfig
mips  allnoconfig
mips allyesconfig
mips  fuloong2e_defconfig
mips  malta_kvm_defconfig
pariscallnoconfig
parisc   allyesconfig
pariscgeneric-32bit_defconfig
pariscgeneric-64bit_defconfig
x86_64   randconfig-a001-20200319
x86_64   randconfig-a002-20200319
x86_64   randconfig-a003-20200319
i386 randconfig-a001-20200319
i386 randconfig-a002-20200319
i386 randconfig-a003-20200319
alpharandconfig-a001-20200319
m68k randconfig-a001-20200319
mips randconfig-a001-20200319
nds32randconfig-a001-20200319
parisc   randconfig-a001-20200319
riscvrandconfig-a001-20200319
c6x  randconfig-a001-20200319
h8300randconfig-a001-20200319
microblaze   randconfig-a001-20200319
nios2randconfig-a001-20200319
sparc64  randconfig-a001-20200319
xtensa   randconfig-a001-20200319
csky randconfig-a001-20200319
openrisc randconfig-a001-20200319
sh   randconfig-a001-20200319
s390 randconfig-a001-20200319
x86_64   randconfig-b001-20200319
x86_64   randconfig-b002-20200319
x86_64   randconfig-b003-20200319
i386 randconfig-b001-20200319
i386 randconfig-b002-20200319
i386 randconfig-b003-20200319
x86_64   randconfig-d001-20200319
x86_64   randconfig-d002-20200319
x86_64   randconfig-d003-20200319
i386 randconfig-d001-20200319
i386 randconfig-d002-20200319
i386 randconfig-d003-20200319
x86_64   randconfig-e001-20200319
x86_64   randconfig-e002-20200319
x86_64   randconfig-e003-20200319
i386 randconfig-e001-20200319
i386

Re: [PATCH v2 03/10] media: adv748x: reduce amount of code for bitwise modifications of device registers

2020-03-19 Thread Laurent Pinchart
Hi Alex,

Thank you for the patch.

On Thu, Mar 19, 2020 at 06:41:53PM +0100, Alex Riesen wrote:
> The regmap provides a convenient utility for this.
> 
> Signed-off-by: Alexander Riesen 
> ---
>  drivers/media/i2c/adv748x/adv748x-core.c |  6 ++
>  drivers/media/i2c/adv748x/adv748x.h  | 15 ---
>  2 files changed, 18 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/media/i2c/adv748x/adv748x-core.c 
> b/drivers/media/i2c/adv748x/adv748x-core.c
> index 345f009de121..36164a254d7b 100644
> --- a/drivers/media/i2c/adv748x/adv748x-core.c
> +++ b/drivers/media/i2c/adv748x/adv748x-core.c
> @@ -133,6 +133,12 @@ static int adv748x_write_check(struct adv748x_state 
> *state, u8 page, u8 reg,
>   return *error;
>  }
>  
> +int adv748x_update_bits(struct adv748x_state *state, u8 page, u8 reg, u8 
> mask,
> + u8 value)
> +{
> + return regmap_update_bits(state->regmap[page], reg, mask, value);
> +}
> +
>  /* adv748x_write_block(): Write raw data with a maximum of 
> I2C_SMBUS_BLOCK_MAX
>   * size to one or more registers.
>   *
> diff --git a/drivers/media/i2c/adv748x/adv748x.h 
> b/drivers/media/i2c/adv748x/adv748x.h
> index 09aab4138c3f..c5245464fffc 100644
> --- a/drivers/media/i2c/adv748x/adv748x.h
> +++ b/drivers/media/i2c/adv748x/adv748x.h
> @@ -393,25 +393,34 @@ int adv748x_write(struct adv748x_state *state, u8 page, 
> u8 reg, u8 value);
>  int adv748x_write_block(struct adv748x_state *state, int client_page,
>   unsigned int init_reg, const void *val,
>   size_t val_len);
> +int adv748x_update_bits(struct adv748x_state *state, u8 page, u8 reg,
> + u8 mask, u8 value);
>  
>  #define io_read(s, r) adv748x_read(s, ADV748X_PAGE_IO, r)
>  #define io_write(s, r, v) adv748x_write(s, ADV748X_PAGE_IO, r, v)
> -#define io_clrset(s, r, m, v) io_write(s, r, (io_read(s, r) & ~(m)) | (v))
> +#define io_clrset(s, r, m, v) adv748x_update_bits(s, ADV748X_PAGE_IO, r, m, 
> v)
> +#define io_update(s, r, m, v) adv748x_update_bits(s, ADV748X_PAGE_IO, r, m, 
> v)

Those two are identical. Do we need both ? I would standardize on either
*_update or *_clrset for all the functions here. Apart from that,

Reviewed-by: Laurent Pinchart 

>  
>  #define hdmi_read(s, r) adv748x_read(s, ADV748X_PAGE_HDMI, r)
>  #define hdmi_read16(s, r, m) (((hdmi_read(s, r) << 8) | hdmi_read(s, (r)+1)) 
> & (m))
>  #define hdmi_write(s, r, v) adv748x_write(s, ADV748X_PAGE_HDMI, r, v)
> +#define hdmi_update(s, r, m, v) \
> + adv748x_update_bits(s, ADV748X_PAGE_HDMI, r, m, v)
> +
> +#define dpll_read(s, r) adv748x_read(s, ADV748X_PAGE_DPLL, r)
> +#define dpll_update(s, r, m, v) \
> + adv748x_update_bits(s, ADV748X_PAGE_DPLL, r, m, v)
>  
>  #define repeater_read(s, r) adv748x_read(s, ADV748X_PAGE_REPEATER, r)
>  #define repeater_write(s, r, v) adv748x_write(s, ADV748X_PAGE_REPEATER, r, v)
>  
>  #define sdp_read(s, r) adv748x_read(s, ADV748X_PAGE_SDP, r)
>  #define sdp_write(s, r, v) adv748x_write(s, ADV748X_PAGE_SDP, r, v)
> -#define sdp_clrset(s, r, m, v) sdp_write(s, r, (sdp_read(s, r) & ~(m)) | (v))
> +#define sdp_clrset(s, r, m, v) adv748x_update_bits(s, ADV748X_PAGE_SDP, r, 
> m, v)
>  
>  #define cp_read(s, r) adv748x_read(s, ADV748X_PAGE_CP, r)
>  #define cp_write(s, r, v) adv748x_write(s, ADV748X_PAGE_CP, r, v)
> -#define cp_clrset(s, r, m, v) cp_write(s, r, (cp_read(s, r) & ~(m)) | (v))
> +#define cp_clrset(s, r, m, v) adv748x_update_bits(s, ADV748X_PAGE_CP, r, m, 
> v)
>  
>  #define tx_read(t, r) adv748x_read(t->state, t->page, r)
>  #define tx_write(t, r, v) adv748x_write(t->state, t->page, r, v)

-- 
Regards,

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


Re: [PATCH v2 01/10] media: adv748x: fix end-of-line terminators in diagnostic statements

2020-03-19 Thread Laurent Pinchart
Hi Alex,

Thank you for the patch.

On Thu, Mar 19, 2020 at 06:41:43PM +0100, Alex Riesen wrote:
> Signed-off-by: Alexander Riesen 

Reviewed-by: Laurent Pinchart 

> ---
>  drivers/media/i2c/adv748x/adv748x-core.c | 24 
>  drivers/media/i2c/adv748x/adv748x-csi2.c |  2 +-
>  2 files changed, 13 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/media/i2c/adv748x/adv748x-core.c 
> b/drivers/media/i2c/adv748x/adv748x-core.c
> index 23e02ff27b17..c3fb113cef62 100644
> --- a/drivers/media/i2c/adv748x/adv748x-core.c
> +++ b/drivers/media/i2c/adv748x/adv748x-core.c
> @@ -623,11 +623,11 @@ static int adv748x_parse_dt(struct adv748x_state *state)
>  
>   for_each_endpoint_of_node(state->dev->of_node, ep_np) {
>   of_graph_parse_endpoint(ep_np, );
> - adv_info(state, "Endpoint %pOF on port %d", ep.local_node,
> + adv_info(state, "Endpoint %pOF on port %d\n", ep.local_node,
>ep.port);
>  
>   if (ep.port >= ADV748X_PORT_MAX) {
> - adv_err(state, "Invalid endpoint %pOF on port %d",
> + adv_err(state, "Invalid endpoint %pOF on port %d\n",
>   ep.local_node, ep.port);
>  
>   continue;
> @@ -635,7 +635,7 @@ static int adv748x_parse_dt(struct adv748x_state *state)
>  
>   if (state->endpoints[ep.port]) {
>   adv_err(state,
> - "Multiple port endpoints are not supported");
> + "Multiple port endpoints are not supported\n");
>   continue;
>   }
>  
> @@ -702,62 +702,62 @@ static int adv748x_probe(struct i2c_client *client)
>   /* Discover and process ports declared by the Device tree endpoints */
>   ret = adv748x_parse_dt(state);
>   if (ret) {
> - adv_err(state, "Failed to parse device tree");
> + adv_err(state, "Failed to parse device tree\n");
>   goto err_free_mutex;
>   }
>  
>   /* Configure IO Regmap region */
>   ret = adv748x_configure_regmap(state, ADV748X_PAGE_IO);
>   if (ret) {
> - adv_err(state, "Error configuring IO regmap region");
> + adv_err(state, "Error configuring IO regmap region\n");
>   goto err_cleanup_dt;
>   }
>  
>   ret = adv748x_identify_chip(state);
>   if (ret) {
> - adv_err(state, "Failed to identify chip");
> + adv_err(state, "Failed to identify chip\n");
>   goto err_cleanup_dt;
>   }
>  
>   /* Configure remaining pages as I2C clients with regmap access */
>   ret = adv748x_initialise_clients(state);
>   if (ret) {
> - adv_err(state, "Failed to setup client regmap pages");
> + adv_err(state, "Failed to setup client regmap pages\n");
>   goto err_cleanup_clients;
>   }
>  
>   /* SW reset ADV748X to its default values */
>   ret = adv748x_reset(state);
>   if (ret) {
> - adv_err(state, "Failed to reset hardware");
> + adv_err(state, "Failed to reset hardware\n");
>   goto err_cleanup_clients;
>   }
>  
>   /* Initialise HDMI */
>   ret = adv748x_hdmi_init(>hdmi);
>   if (ret) {
> - adv_err(state, "Failed to probe HDMI");
> + adv_err(state, "Failed to probe HDMI\n");
>   goto err_cleanup_clients;
>   }
>  
>   /* Initialise AFE */
>   ret = adv748x_afe_init(>afe);
>   if (ret) {
> - adv_err(state, "Failed to probe AFE");
> + adv_err(state, "Failed to probe AFE\n");
>   goto err_cleanup_hdmi;
>   }
>  
>   /* Initialise TXA */
>   ret = adv748x_csi2_init(state, >txa);
>   if (ret) {
> - adv_err(state, "Failed to probe TXA");
> + adv_err(state, "Failed to probe TXA\n");
>   goto err_cleanup_afe;
>   }
>  
>   /* Initialise TXB */
>   ret = adv748x_csi2_init(state, >txb);
>   if (ret) {
> - adv_err(state, "Failed to probe TXB");
> + adv_err(state, "Failed to probe TXB\n");
>   goto err_cleanup_txa;
>   }
>  
> diff --git a/drivers/media/i2c/adv748x/adv748x-csi2.c 
> b/drivers/media/i2c/adv748x/adv748x-csi2.c
> index 2091cda50935..c43ce5d78723 100644
> --- a/drivers/media/i2c/adv748x/adv748x-csi2.c
> +++ b/drivers/media/i2c/adv748x/adv748x-csi2.c
> @@ -72,7 +72,7 @@ static int adv748x_csi2_registered(struct v4l2_subdev *sd)
>   struct adv748x_state *state = tx->state;
>   int ret;
>  
> - adv_dbg(state, "Registered %s (%s)", is_txa(tx) ? "TXA":"TXB",
> + adv_dbg(state, "Registered %s (%s)\n", is_txa(tx) ? "TXA":"TXB",
>   sd->name);
>  
>   /*

-- 
Regards,

Laurent Pinchart
___
devel mailing list
de...@linuxdriverproject.org

Re: [PATCH v2 07/10] dt-bindings: adv748x: add information about serial audio interface (I2S/TDM)

2020-03-19 Thread Laurent Pinchart
Hi Alex,

Thank you for the patch.

On Thu, Mar 19, 2020 at 06:42:36PM +0100, Alex Riesen wrote:
> As the driver has some support for the audio interface of the device,
> the bindings file should mention it.

While at it, how about converting the bindings to YAML ? :-) It can of
course be done on top.

> Reviewed-by: Rob Herring 
> Signed-off-by: Alexander Riesen 
> ---
>  .../devicetree/bindings/media/i2c/adv748x.txt| 16 +++-
>  1 file changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/media/i2c/adv748x.txt 
> b/Documentation/devicetree/bindings/media/i2c/adv748x.txt
> index 4f91686e54a6..7d6db052c294 100644
> --- a/Documentation/devicetree/bindings/media/i2c/adv748x.txt
> +++ b/Documentation/devicetree/bindings/media/i2c/adv748x.txt
> @@ -2,7 +2,9 @@
>  
>  The ADV7481 and ADV7482 are multi format video decoders with an integrated
>  HDMI receiver. They can output CSI-2 on two independent outputs TXA and TXB
> -from three input sources HDMI, analog and TTL.
> +from three input sources HDMI, analog and TTL. There is also support for an
> +I2S compatible interface connected to the audio processor of the HDMI 
> decoder.

s/I2S compatible/I2S-compatible/ ?

> +The interface has TDM capability (8 slots, 32 bits, left or right justified).
>  
>  Required Properties:
>  
> @@ -16,6 +18,8 @@ Required Properties:
>  slave device on the I2C bus. The main address is mandatory, others are
>  optional and remain at default values if not specified.
>  
> +  - #clock-cells: must be <0> if the I2S port is used

Wouldn't it be simpler to set it to 0 unconditionally ?

Reviewed-by: Laurent Pinchart 

> +
>  Optional Properties:
>  
>- interrupt-names: Should specify the interrupts as "intrq1", "intrq2" 
> and/or
> @@ -47,6 +51,7 @@ are numbered as follows.
> TTL   sink9
> TXA   source  10
> TXB   source  11
> +   I2S   source  12
>  
>  The digital output port nodes, when present, shall contain at least one
>  endpoint. Each of those endpoints shall contain the data-lanes property as
> @@ -72,6 +77,7 @@ Example:
>  
>   #address-cells = <1>;
>   #size-cells = <0>;
> + #clock-cells = <0>;
>  
>   interrupt-parent = <>;
>   interrupt-names = "intrq1", "intrq2";
> @@ -113,4 +119,12 @@ Example:
>   remote-endpoint = <_in>;
>   };
>   };
> +
> + port@c {
> + reg = <12>;
> +
> + adv7482_i2s: endpoint {
> + remote-endpoint = <_in>;
> + };
> + };
>   };

-- 
Regards,

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


Re: [PATCH v2 02/10] media: adv748x: include everything adv748x.h needs into the file

2020-03-19 Thread Laurent Pinchart
Hi Alexander,

Thank you for the patch.

On Thu, Mar 19, 2020 at 06:41:48PM +0100, Alex Riesen wrote:
> To follow the established practice of not depending on others to
> pull everything in.
> 
> Signed-off-by: Alexander Riesen 

Good idea. While at it, could you include "adv748x.h" as the very first
header in at least one of the C files ? That will help ensuring the
header stays self-contained in the future.

> ---
>  drivers/media/i2c/adv748x/adv748x-afe.c  | 2 --
>  drivers/media/i2c/adv748x/adv748x-core.c | 2 --
>  drivers/media/i2c/adv748x/adv748x-csi2.c | 2 --
>  drivers/media/i2c/adv748x/adv748x-hdmi.c | 2 --
>  drivers/media/i2c/adv748x/adv748x.h  | 2 ++
>  5 files changed, 2 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/media/i2c/adv748x/adv748x-afe.c 
> b/drivers/media/i2c/adv748x/adv748x-afe.c
> index dbbb1e4d6363..ab0479641c10 100644
> --- a/drivers/media/i2c/adv748x/adv748x-afe.c
> +++ b/drivers/media/i2c/adv748x/adv748x-afe.c
> @@ -11,8 +11,6 @@
>  #include 
>  #include 
>  
> -#include 
> -#include 
>  #include 
>  #include 
>  
> diff --git a/drivers/media/i2c/adv748x/adv748x-core.c 
> b/drivers/media/i2c/adv748x/adv748x-core.c
> index c3fb113cef62..345f009de121 100644
> --- a/drivers/media/i2c/adv748x/adv748x-core.c
> +++ b/drivers/media/i2c/adv748x/adv748x-core.c
> @@ -20,8 +20,6 @@
>  #include 
>  #include 
>  
> -#include 
> -#include 
>  #include 
>  #include 
>  #include 
> diff --git a/drivers/media/i2c/adv748x/adv748x-csi2.c 
> b/drivers/media/i2c/adv748x/adv748x-csi2.c
> index c43ce5d78723..78d391009b5a 100644
> --- a/drivers/media/i2c/adv748x/adv748x-csi2.c
> +++ b/drivers/media/i2c/adv748x/adv748x-csi2.c
> @@ -8,8 +8,6 @@
>  #include 
>  #include 
>  
> -#include 
> -#include 
>  #include 
>  
>  #include "adv748x.h"
> diff --git a/drivers/media/i2c/adv748x/adv748x-hdmi.c 
> b/drivers/media/i2c/adv748x/adv748x-hdmi.c
> index c557f8fdf11a..0dffcdf79ff2 100644
> --- a/drivers/media/i2c/adv748x/adv748x-hdmi.c
> +++ b/drivers/media/i2c/adv748x/adv748x-hdmi.c
> @@ -8,8 +8,6 @@
>  #include 
>  #include 
>  
> -#include 
> -#include 
>  #include 
>  #include 
>  
> diff --git a/drivers/media/i2c/adv748x/adv748x.h 
> b/drivers/media/i2c/adv748x/adv748x.h
> index fccb388ce179..09aab4138c3f 100644
> --- a/drivers/media/i2c/adv748x/adv748x.h
> +++ b/drivers/media/i2c/adv748x/adv748x.h
> @@ -19,6 +19,8 @@
>   */
>  
>  #include 
> +#include 
> +#include 
>  
>  #ifndef _ADV748X_H_
>  #define _ADV748X_H_

-- 
Regards,

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


[PATCH v2 09/10] media: adv748x: add support for log_status ioctl

2020-03-19 Thread Alex Riesen
The logged information provides insights about cable connection and the
state of the HDMI decoder. It is very useful when debugging hardware
problems in environments without easy access to the connectors.

This change adds a device-specific wrapper for register block read,
because some of the devices I2C-accessible registers (for instance,
cs_data for stereo channel information or tmds_params for TMDS channel
information) located in adjacent cells. According to manufacturers
information, these registers can be read using block transactions.

Signed-off-by: Alexander Riesen 
---
 drivers/media/i2c/adv748x/adv748x-core.c |  15 ++
 drivers/media/i2c/adv748x/adv748x-hdmi.c | 179 +++
 drivers/media/i2c/adv748x/adv748x.h  |   2 +
 3 files changed, 196 insertions(+)

diff --git a/drivers/media/i2c/adv748x/adv748x-core.c 
b/drivers/media/i2c/adv748x/adv748x-core.c
index 2c0bd58038e6..fbc502ad12b5 100644
--- a/drivers/media/i2c/adv748x/adv748x-core.c
+++ b/drivers/media/i2c/adv748x/adv748x-core.c
@@ -95,6 +95,21 @@ static const struct adv748x_register_map 
adv748x_default_addresses[] = {
[ADV748X_PAGE_TXA] = { "txa", 0x4a },
 };
 
+int adv748x_read_block(struct adv748x_state *state, u8 client_page, u8 reg,
+  void *val, size_t reg_count)
+{
+   struct i2c_client *client = state->i2c_clients[client_page];
+   int err;
+
+   err = regmap_bulk_read(state->regmap[client_page], reg, val, reg_count);
+   if (err) {
+   adv_err(state, "error reading %02x, %02x-%02lx: %d\n",
+   client->addr, reg, reg + reg_count - 1, err);
+   return err;
+   }
+   return 0;
+}
+
 static int adv748x_read_check(struct adv748x_state *state,
  int client_page, u8 reg)
 {
diff --git a/drivers/media/i2c/adv748x/adv748x-hdmi.c 
b/drivers/media/i2c/adv748x/adv748x-hdmi.c
index 0dffcdf79ff2..7655d817ceb6 100644
--- a/drivers/media/i2c/adv748x/adv748x-hdmi.c
+++ b/drivers/media/i2c/adv748x/adv748x-hdmi.c
@@ -5,6 +5,7 @@
  * Copyright (C) 2017 Renesas Electronics Corp.
  */
 
+#include 
 #include 
 #include 
 
@@ -601,11 +602,189 @@ static const struct v4l2_subdev_pad_ops 
adv748x_pad_ops_hdmi = {
.enum_dv_timings = adv748x_hdmi_enum_dv_timings,
 };
 
+struct tmds_params {
+   u32 cts, n;
+   u16 tmdsfreq, tmdsfreq_frac;
+};
+
+static inline const char *cs_data_smpl_freq_str(u8 cs_data_3)
+{
+   switch (cs_data_3 & 0xf) {
+   case 0:
+   return "44.1";
+   case 2:
+   return "48";
+   case 3:
+   return "32";
+   case 8:
+   return "88.2";
+   case 10:
+   return "96";
+   case 12:
+   return "176";
+   case 14:
+   return "192";
+   }
+   return "reserved";
+}
+
+static inline const char *cs_data_clk_lvl_str(u8 cs_data_3)
+{
+   switch (cs_data_3 & 0x30) {
+   case 0:
+   return "Level II";
+   case 1:
+   return "Level I";
+   case 2:
+   return "Level III, variable pitch shifted";
+   }
+   return "reserved";
+}
+
+static inline const char *i2s_out_mode_str(u8 i2s_mode)
+{
+   switch (i2s_mode & ADV748X_HDMI_I2SOUTMODE_MASK) {
+   case 0 << ADV748X_HDMI_I2SOUTMODE_SHIFT:
+   return "I2S";
+   case 1 << ADV748X_HDMI_I2SOUTMODE_SHIFT:
+   return "right";
+   case 2 << ADV748X_HDMI_I2SOUTMODE_SHIFT:
+   return "left";
+   case 3 << ADV748X_HDMI_I2SOUTMODE_SHIFT:
+   return "spdif";
+   }
+   return "";
+}
+
+static int adv748x_hdmi_log_status(struct v4l2_subdev *sd)
+{
+   struct adv748x_hdmi *hdmi = adv748x_sd_to_hdmi(sd);
+   struct adv748x_state *state = adv748x_hdmi_to_state(hdmi);
+   u8 rv, i2s_tdm_mode_enable;
+   u8 cts_n[5];
+   u8 cs_data[0x3a - 0x36 + 1];
+   u8 tmdsfreq[2]; /* both tmdsfreq and tmdsfreq_frac */
+   struct tmds_params tmds_params;
+
+   /* Audio control and configuration */
+   rv = io_read(state, 0x71);
+   pr_info("cable_det_a_raw %s\n",
+   rv & BIT(6) ? "detected" : "no cable");
+   pr_info("tmds_clk_a_raw  %s\n",
+   rv & BIT(3) ? "detected" : "no TMDS clock");
+   pr_info("tmdspll_lck_a_raw   %s\n",
+   rv & BIT(7) ? "locked to incoming clock" : "not locked");
+   pr_info("hdmi_encrpt_a_raw   %s\n",
+   rv & BIT(5) ? "current frame encrypted" : "not encrypted");
+   rv = hdmi_read(state, 0x04);
+   pr_info("audio_pll_locked0x%02lx\n", rv & BIT(0));
+   pr_info("tmds_pll_locked 0x%02lx\n", rv & BIT(1));
+   rv = io_read(state, 0x6c);
+   pr_info("gamut_mdata_raw %s\n",
+   rv & BIT(0) ? "received" : "-");
+   pr_info("audio_c_pckt_raw%s\n",
+   rv & BIT(1) ? "ACR received" : "-");
+   

[PATCH v2 10/10] media: adv748x: allow the HDMI sub-device to accept EDID

2020-03-19 Thread Alex Riesen
This makes it possible to load a EDID reported by the device
with v4l2-ctl utility:

  vdev=/dev/$(grep -l '^adv748x.*hdmi$' /sys/class/video4linux/v4l-subdev*/name 
|cut -d/ -f5-5)
  v4l2-ctl -d $vdev --set-edid=pad=0,file=/etc/adv7482.edid

Signed-off-by: Alexander Riesen 
---
 drivers/media/i2c/adv748x/adv748x-hdmi.c | 27 
 1 file changed, 27 insertions(+)

diff --git a/drivers/media/i2c/adv748x/adv748x-hdmi.c 
b/drivers/media/i2c/adv748x/adv748x-hdmi.c
index 7655d817ceb6..88e309de3d56 100644
--- a/drivers/media/i2c/adv748x/adv748x-hdmi.c
+++ b/drivers/media/i2c/adv748x/adv748x-hdmi.c
@@ -775,7 +775,34 @@ static int adv748x_hdmi_log_status(struct v4l2_subdev *sd)
return 0;
 }
 
+static long adv748x_hdmi_querycap(struct adv748x_hdmi *hdmi,
+ struct v4l2_capability *cap)
+{
+   struct adv748x_state *state = adv748x_hdmi_to_state(hdmi);
+
+   cap->version = LINUX_VERSION_CODE;
+   strlcpy(cap->driver, state->dev->driver->name, sizeof(cap->driver));
+   strlcpy(cap->card, "hdmi", sizeof(cap->card));
+   snprintf(cap->bus_info, sizeof(cap->bus_info), "i2c:%d-%04x",
+i2c_adapter_id(state->client->adapter),
+state->client->addr);
+   cap->device_caps = V4L2_CAP_AUDIO | V4L2_CAP_VIDEO_CAPTURE;
+   cap->capabilities = V4L2_CAP_DEVICE_CAPS;
+   return 0;
+}
+
+static long adv748x_hdmi_ioctl(struct v4l2_subdev *sd,
+  unsigned int cmd, void *arg)
+{
+   struct adv748x_hdmi *hdmi = adv748x_sd_to_hdmi(sd);
+
+   if (cmd == VIDIOC_QUERYCAP)
+   return adv748x_hdmi_querycap(hdmi, arg);
+   return -ENOTTY;
+}
+
 static const struct v4l2_subdev_core_ops adv748x_core_ops_hdmi = {
+   .ioctl = adv748x_hdmi_ioctl,
.log_status = adv748x_hdmi_log_status,
 };
 
-- 
2.25.1.25.g9ecbe7eb18

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


[PATCH v2 07/10] dt-bindings: adv748x: add information about serial audio interface (I2S/TDM)

2020-03-19 Thread Alex Riesen
As the driver has some support for the audio interface of the device,
the bindings file should mention it.

Reviewed-by: Rob Herring 
Signed-off-by: Alexander Riesen 
---
 .../devicetree/bindings/media/i2c/adv748x.txt| 16 +++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/media/i2c/adv748x.txt 
b/Documentation/devicetree/bindings/media/i2c/adv748x.txt
index 4f91686e54a6..7d6db052c294 100644
--- a/Documentation/devicetree/bindings/media/i2c/adv748x.txt
+++ b/Documentation/devicetree/bindings/media/i2c/adv748x.txt
@@ -2,7 +2,9 @@
 
 The ADV7481 and ADV7482 are multi format video decoders with an integrated
 HDMI receiver. They can output CSI-2 on two independent outputs TXA and TXB
-from three input sources HDMI, analog and TTL.
+from three input sources HDMI, analog and TTL. There is also support for an
+I2S compatible interface connected to the audio processor of the HDMI decoder.
+The interface has TDM capability (8 slots, 32 bits, left or right justified).
 
 Required Properties:
 
@@ -16,6 +18,8 @@ Required Properties:
 slave device on the I2C bus. The main address is mandatory, others are
 optional and remain at default values if not specified.
 
+  - #clock-cells: must be <0> if the I2S port is used
+
 Optional Properties:
 
   - interrupt-names: Should specify the interrupts as "intrq1", "intrq2" and/or
@@ -47,6 +51,7 @@ are numbered as follows.
  TTL   sink9
  TXA   source  10
  TXB   source  11
+ I2S   source  12
 
 The digital output port nodes, when present, shall contain at least one
 endpoint. Each of those endpoints shall contain the data-lanes property as
@@ -72,6 +77,7 @@ Example:
 
#address-cells = <1>;
#size-cells = <0>;
+   #clock-cells = <0>;
 
interrupt-parent = <>;
interrupt-names = "intrq1", "intrq2";
@@ -113,4 +119,12 @@ Example:
remote-endpoint = <_in>;
};
};
+
+   port@c {
+   reg = <12>;
+
+   adv7482_i2s: endpoint {
+   remote-endpoint = <_in>;
+   };
+   };
};
-- 
2.25.1.25.g9ecbe7eb18


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


[PATCH v2 06/10] media: adv748x: only activate DAI if it is described in device tree

2020-03-19 Thread Alex Riesen
To avoid setting it up even if the hardware is not actually connected
to anything physically.

Besides, the bindings explicitly notes that port definitions are
"optional if they are not connected to anything at the hardware level".

Signed-off-by: Alexander Riesen 
---
 drivers/media/i2c/adv748x/adv748x-dai.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/media/i2c/adv748x/adv748x-dai.c 
b/drivers/media/i2c/adv748x/adv748x-dai.c
index 4775a0c7ed7f..ce3ae7de765c 100644
--- a/drivers/media/i2c/adv748x/adv748x-dai.c
+++ b/drivers/media/i2c/adv748x/adv748x-dai.c
@@ -204,6 +204,11 @@ int adv748x_dai_init(struct adv748x_dai *dai)
int ret;
struct adv748x_state *state = adv748x_dai_to_state(dai);
 
+   if (!state->endpoints[ADV748X_PORT_I2S]) {
+   adv_info(state, "no I2S port, DAI disabled\n");
+   ret = 0;
+   goto fail;
+   }
dai->mclk = clk_register_fixed_rate(state->dev,
"adv748x-hdmi-i2s-mclk",
NULL /* parent_name */,
-- 
2.25.1.25.g9ecbe7eb18


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


[PATCH v2 05/10] media: adv748x: add support for HDMI audio

2020-03-19 Thread Alex Riesen
This adds an implemention of SoC DAI driver which provides access to the
I2S port of the device.

Signed-off-by: Alexander Riesen 
---
 drivers/media/i2c/adv748x/Makefile   |   3 +-
 drivers/media/i2c/adv748x/adv748x-core.c |   9 +-
 drivers/media/i2c/adv748x/adv748x-dai.c  | 256 +++
 drivers/media/i2c/adv748x/adv748x.h  |  16 +-
 4 files changed, 281 insertions(+), 3 deletions(-)
 create mode 100644 drivers/media/i2c/adv748x/adv748x-dai.c

diff --git a/drivers/media/i2c/adv748x/Makefile 
b/drivers/media/i2c/adv748x/Makefile
index 93844f14cb10..6e7a302ef199 100644
--- a/drivers/media/i2c/adv748x/Makefile
+++ b/drivers/media/i2c/adv748x/Makefile
@@ -3,6 +3,7 @@ adv748x-objs:= \
adv748x-afe.o \
adv748x-core.o \
adv748x-csi2.o \
-   adv748x-hdmi.o
+   adv748x-hdmi.o \
+   adv748x-dai.o
 
 obj-$(CONFIG_VIDEO_ADV748X)+= adv748x.o
diff --git a/drivers/media/i2c/adv748x/adv748x-core.c 
b/drivers/media/i2c/adv748x/adv748x-core.c
index 36164a254d7b..2c0bd58038e6 100644
--- a/drivers/media/i2c/adv748x/adv748x-core.c
+++ b/drivers/media/i2c/adv748x/adv748x-core.c
@@ -765,8 +765,14 @@ static int adv748x_probe(struct i2c_client *client)
goto err_cleanup_txa;
}
 
+   ret = adv748x_dai_init(>dai);
+   if (ret) {
+   adv_err(state, "Failed to probe DAI\n");
+   goto err_cleanup_txb;
+   }
return 0;
-
+err_cleanup_txb:
+   adv748x_csi2_cleanup(>txb);
 err_cleanup_txa:
adv748x_csi2_cleanup(>txa);
 err_cleanup_afe:
@@ -787,6 +793,7 @@ static int adv748x_remove(struct i2c_client *client)
 {
struct adv748x_state *state = i2c_get_clientdata(client);
 
+   adv748x_dai_cleanup(>dai);
adv748x_afe_cleanup(>afe);
adv748x_hdmi_cleanup(>hdmi);
 
diff --git a/drivers/media/i2c/adv748x/adv748x-dai.c 
b/drivers/media/i2c/adv748x/adv748x-dai.c
new file mode 100644
index ..4775a0c7ed7f
--- /dev/null
+++ b/drivers/media/i2c/adv748x/adv748x-dai.c
@@ -0,0 +1,256 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Driver for Analog Devices ADV748X HDMI receiver with AFE
+ * The implementation of DAI.
+ */
+
+#include 
+#include 
+#include 
+
+#include "adv748x.h"
+
+#define state_of(soc_dai) \
+   adv748x_dai_to_state(container_of((soc_dai)->driver, \
+ struct adv748x_dai, \
+ drv))
+
+static const char ADV748X_DAI_NAME[] = "adv748x-i2s";
+
+static int set_audio_pads_state(struct adv748x_state *state, int on)
+{
+   return io_update(state, ADV748X_IO_PAD_CONTROLS,
+ADV748X_IO_PAD_CONTROLS_TRI_AUD |
+ADV748X_IO_PAD_CONTROLS_PDN_AUD,
+on ? 0 : 0xff);
+}
+
+static int set_dpll_mclk_fs(struct adv748x_state *state, int fs)
+{
+   return dpll_update(state, ADV748X_DPLL_MCLK_FS,
+  ADV748X_DPLL_MCLK_FS_N_MASK, (fs / 128) - 1);
+}
+
+static int set_i2s_format(struct adv748x_state *state, uint outmode,
+ uint bitwidth)
+{
+   return hdmi_update(state, ADV748X_HDMI_I2S,
+  ADV748X_HDMI_I2SBITWIDTH_MASK |
+  ADV748X_HDMI_I2SOUTMODE_MASK,
+  (outmode << ADV748X_HDMI_I2SOUTMODE_SHIFT) |
+  bitwidth);
+}
+
+static int set_i2s_tdm_mode(struct adv748x_state *state, int is_tdm)
+{
+   int ret;
+
+   ret = hdmi_update(state, ADV748X_HDMI_AUDIO_MUTE_SPEED,
+ ADV748X_MAN_AUDIO_DL_BYPASS |
+ ADV748X_AUDIO_DELAY_LINE_BYPASS,
+ is_tdm ? 0xff : 0);
+   if (ret < 0)
+   return ret;
+   ret = hdmi_update(state, ADV748X_HDMI_REG_6D,
+ ADV748X_I2S_TDM_MODE_ENABLE,
+ is_tdm ? 0xff : 0);
+   return ret;
+}
+
+static int set_audio_mute(struct adv748x_state *state, int enable)
+{
+   return hdmi_update(state, ADV748X_HDMI_MUTE_CTRL,
+  ADV748X_HDMI_MUTE_CTRL_MUTE_AUDIO,
+  enable ? 0xff : 0);
+}
+
+static int adv748x_dai_set_sysclk(struct snd_soc_dai *dai,
+ int clk_id, unsigned int freq, int dir)
+{
+   struct adv748x_state *state = state_of(dai);
+
+   /* currently supporting only one fixed rate clock */
+   if (clk_id != 0 || freq != clk_get_rate(state->dai.mclk)) {
+   dev_err(dai->dev, "invalid clock (%d) or frequency (%u, dir 
%d)\n",
+   clk_id, freq, dir);
+   return -EINVAL;
+   }
+   state->dai.freq = freq;
+   return 0;
+}
+
+static int adv748x_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
+{
+   struct adv748x_state *state = state_of(dai);
+   int ret = 0;
+
+   if ((fmt & SND_SOC_DAIFMT_MASTER_MASK) != 

[PATCH v2 04/10] media: adv748x: add definitions for audio output related registers

2020-03-19 Thread Alex Riesen
Signed-off-by: Alexander Riesen 
---
 drivers/media/i2c/adv748x/adv748x.h | 32 +
 1 file changed, 32 insertions(+)

diff --git a/drivers/media/i2c/adv748x/adv748x.h 
b/drivers/media/i2c/adv748x/adv748x.h
index c5245464fffc..7bc1bb0b3756 100644
--- a/drivers/media/i2c/adv748x/adv748x.h
+++ b/drivers/media/i2c/adv748x/adv748x.h
@@ -226,6 +226,11 @@ struct adv748x_state {
 
 #define ADV748X_IO_VID_STD 0x05
 
+#define ADV748X_IO_PAD_CONTROLS0x0e
+#define ADV748X_IO_PAD_CONTROLS_TRI_AUDBIT(5)
+#define ADV748X_IO_PAD_CONTROLS_PDN_AUDBIT(1)
+#define ADV748X_IO_PAD_CONTROLS1   0x1d
+
 #define ADV748X_IO_10  0x10/* io_reg_10 */
 #define ADV748X_IO_10_CSI4_EN  BIT(7)
 #define ADV748X_IO_10_CSI1_EN  BIT(6)
@@ -248,7 +253,21 @@ struct adv748x_state {
 #define ADV748X_IO_REG_FF  0xff
 #define ADV748X_IO_REG_FF_MAIN_RESET   0xff
 
+/* DPLL Map */
+#define ADV748X_DPLL_MCLK_FS   0xb5
+#define ADV748X_DPLL_MCLK_FS_N_MASKGENMASK(2, 0)
+
 /* HDMI RX Map */
+#define ADV748X_HDMI_I2S   0x03/* I2S mode and width */
+#define ADV748X_HDMI_I2SBITWIDTH_MASK  GENMASK(4, 0)
+#define ADV748X_HDMI_I2SOUTMODE_SHIFT  5
+#define ADV748X_HDMI_I2SOUTMODE_MASK   \
+   GENMASK(6, ADV748X_HDMI_I2SOUTMODE_SHIFT)
+#define ADV748X_I2SOUTMODE_I2S 0
+#define ADV748X_I2SOUTMODE_RIGHT_J 1
+#define ADV748X_I2SOUTMODE_LEFT_J 2
+#define ADV748X_I2SOUTMODE_SPDIF 3
+
 #define ADV748X_HDMI_LW1   0x07/* line width_1 */
 #define ADV748X_HDMI_LW1_VERT_FILTER   BIT(7)
 #define ADV748X_HDMI_LW1_DE_REGEN  BIT(5)
@@ -260,6 +279,16 @@ struct adv748x_state {
 #define ADV748X_HDMI_F1H1  0x0b/* field1 height_1 */
 #define ADV748X_HDMI_F1H1_INTERLACED   BIT(5)
 
+#define ADV748X_HDMI_MUTE_CTRL 0x1a
+#define ADV748X_HDMI_MUTE_CTRL_MUTE_AUDIO BIT(4)
+#define ADV748X_HDMI_MUTE_CTRL_WAIT_UNMUTE_MASKGENMASK(3, 1)
+#define ADV748X_HDMI_MUTE_CTRL_NOT_AUTO_UNMUTE BIT(0)
+
+#define ADV748X_HDMI_AUDIO_MUTE_SPEED  0x0f
+#define ADV748X_HDMI_AUDIO_MUTE_SPEED_MASK GENMASK(4, 0)
+#define ADV748X_MAN_AUDIO_DL_BYPASS BIT(7)
+#define ADV748X_AUDIO_DELAY_LINE_BYPASS BIT(6)
+
 #define ADV748X_HDMI_HFRONT_PORCH  0x20/* hsync_front_porch_1 */
 #define ADV748X_HDMI_HFRONT_PORCH_MASK 0x1fff
 
@@ -281,6 +310,9 @@ struct adv748x_state {
 #define ADV748X_HDMI_TMDS_10x51/* hdmi_reg_51 */
 #define ADV748X_HDMI_TMDS_20x52/* hdmi_reg_52 */
 
+#define ADV748X_HDMI_REG_6D0x6d/* hdmi_reg_6d */
+#define ADV748X_I2S_TDM_MODE_ENABLE BIT(7)
+
 /* HDMI RX Repeater Map */
 #define ADV748X_REPEATER_EDID_SZ   0x70/* primary_edid_size */
 #define ADV748X_REPEATER_EDID_SZ_SHIFT 4
-- 
2.25.1.25.g9ecbe7eb18


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


[PATCH v2 00/10] media: adv748x: add support for HDMI audio

2020-03-19 Thread Alex Riesen
This adds minimal support for accessing the HDMI audio provided through the
I2S port available on ADV7481 and ADV7482 decoder devices by ADI.
The port carries audio signal from the decoded HDMI stream.

Currently, the driver only supports I2S in TDM, 8 channels a 24bit at 48kHz.
Furthermore, only left-justified, 8 slots, 32bit/slot TDM, at 256fs has been
ever tried.

An ADV7482 on the Renesas Salvator-X ES1.1 (R8A77950 SoC) was used during
development of this code.

Changes since v1:
  - Add ssi4_ctrl pin group to the sound pins. The pins are responsible for
SCK4 (sample clock) WS4 and (word boundary input), and are required for
SSI audio input over I2S.
Reported-by: Geert Uytterhoeven 

  - Removed the audio clock C from the list of clocks of adv748x,
it is exactly the other way around.
Reported-by: Geert Uytterhoeven 

  - Add an instance of (currently) fixed rate I2S master clock (MCLK),
connected to the audio_clk_c line of the R-Car SoC.
Explicitly declare the device a clock producer and add it to the
list of clocks used by the audio system of the Salvator-X board.
Suggested-by: Geert Uytterhoeven 

  - The implementation of DAI driver has been moved in a separate file
and modified to activate audio decoding and I2S streaming using
snd_soc_dai_... interfaces. This allows the driver to be used with
just ALSA interfaces.

  - The ioctls for selecting audio output and muting have been removed,
as not applicable.
Suggested-by: Hans Verkuil 
I have left implementation of the QUERYCAP in, as it seems to be required
by v4l-ctl to support loading of EDID for this node. And setting the EDID
is one feature I desperately need: there are devices which plainly refuse
to talk to the sink if it does not provide EDID they like.

  - A device tree configuration without audio port will disable the audio code
altogether, supporting integrations where the port is not connected.

  - The patches have been re-arranged, starting with the generic changes and
changes not related to audio directly. Those will be probably sent as a
separate series later.

  - The whole series has been rebased on top of v5.6-rc6

Alex Riesen (10):
  media: adv748x: fix end-of-line terminators in diagnostic statements
  media: adv748x: include everything adv748x.h needs into the file
  media: adv748x: reduce amount of code for bitwise modifications of
device registers
  media: adv748x: add definitions for audio output related registers
  media: adv748x: add support for HDMI audio
  media: adv748x: only activate DAI if it is described in device tree
  dt-bindings: adv748x: add information about serial audio interface
(I2S/TDM)
  arm64: dts: renesas: salvator: add a connection from adv748x codec
(HDMI input) to the R-Car SoC
  media: adv748x: add support for log_status ioctl
  media: adv748x: allow the HDMI sub-device to accept EDID

 .../devicetree/bindings/media/i2c/adv748x.txt |  16 +-
 .../boot/dts/renesas/r8a77950-salvator-x.dts  |   3 +-
 .../boot/dts/renesas/salvator-common.dtsi |  47 +++-
 drivers/media/i2c/adv748x/Makefile|   3 +-
 drivers/media/i2c/adv748x/adv748x-afe.c   |   2 -
 drivers/media/i2c/adv748x/adv748x-core.c  |  56 +++-
 drivers/media/i2c/adv748x/adv748x-csi2.c  |   4 +-
 drivers/media/i2c/adv748x/adv748x-dai.c   | 261 ++
 drivers/media/i2c/adv748x/adv748x-hdmi.c  | 208 +-
 drivers/media/i2c/adv748x/adv748x.h   |  67 -
 10 files changed, 633 insertions(+), 34 deletions(-)
 create mode 100644 drivers/media/i2c/adv748x/adv748x-dai.c

-- 
2.25.1.25.g9ecbe7eb18

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


[PATCH v2 01/10] media: adv748x: fix end-of-line terminators in diagnostic statements

2020-03-19 Thread Alex Riesen
Signed-off-by: Alexander Riesen 
---
 drivers/media/i2c/adv748x/adv748x-core.c | 24 
 drivers/media/i2c/adv748x/adv748x-csi2.c |  2 +-
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/media/i2c/adv748x/adv748x-core.c 
b/drivers/media/i2c/adv748x/adv748x-core.c
index 23e02ff27b17..c3fb113cef62 100644
--- a/drivers/media/i2c/adv748x/adv748x-core.c
+++ b/drivers/media/i2c/adv748x/adv748x-core.c
@@ -623,11 +623,11 @@ static int adv748x_parse_dt(struct adv748x_state *state)
 
for_each_endpoint_of_node(state->dev->of_node, ep_np) {
of_graph_parse_endpoint(ep_np, );
-   adv_info(state, "Endpoint %pOF on port %d", ep.local_node,
+   adv_info(state, "Endpoint %pOF on port %d\n", ep.local_node,
 ep.port);
 
if (ep.port >= ADV748X_PORT_MAX) {
-   adv_err(state, "Invalid endpoint %pOF on port %d",
+   adv_err(state, "Invalid endpoint %pOF on port %d\n",
ep.local_node, ep.port);
 
continue;
@@ -635,7 +635,7 @@ static int adv748x_parse_dt(struct adv748x_state *state)
 
if (state->endpoints[ep.port]) {
adv_err(state,
-   "Multiple port endpoints are not supported");
+   "Multiple port endpoints are not supported\n");
continue;
}
 
@@ -702,62 +702,62 @@ static int adv748x_probe(struct i2c_client *client)
/* Discover and process ports declared by the Device tree endpoints */
ret = adv748x_parse_dt(state);
if (ret) {
-   adv_err(state, "Failed to parse device tree");
+   adv_err(state, "Failed to parse device tree\n");
goto err_free_mutex;
}
 
/* Configure IO Regmap region */
ret = adv748x_configure_regmap(state, ADV748X_PAGE_IO);
if (ret) {
-   adv_err(state, "Error configuring IO regmap region");
+   adv_err(state, "Error configuring IO regmap region\n");
goto err_cleanup_dt;
}
 
ret = adv748x_identify_chip(state);
if (ret) {
-   adv_err(state, "Failed to identify chip");
+   adv_err(state, "Failed to identify chip\n");
goto err_cleanup_dt;
}
 
/* Configure remaining pages as I2C clients with regmap access */
ret = adv748x_initialise_clients(state);
if (ret) {
-   adv_err(state, "Failed to setup client regmap pages");
+   adv_err(state, "Failed to setup client regmap pages\n");
goto err_cleanup_clients;
}
 
/* SW reset ADV748X to its default values */
ret = adv748x_reset(state);
if (ret) {
-   adv_err(state, "Failed to reset hardware");
+   adv_err(state, "Failed to reset hardware\n");
goto err_cleanup_clients;
}
 
/* Initialise HDMI */
ret = adv748x_hdmi_init(>hdmi);
if (ret) {
-   adv_err(state, "Failed to probe HDMI");
+   adv_err(state, "Failed to probe HDMI\n");
goto err_cleanup_clients;
}
 
/* Initialise AFE */
ret = adv748x_afe_init(>afe);
if (ret) {
-   adv_err(state, "Failed to probe AFE");
+   adv_err(state, "Failed to probe AFE\n");
goto err_cleanup_hdmi;
}
 
/* Initialise TXA */
ret = adv748x_csi2_init(state, >txa);
if (ret) {
-   adv_err(state, "Failed to probe TXA");
+   adv_err(state, "Failed to probe TXA\n");
goto err_cleanup_afe;
}
 
/* Initialise TXB */
ret = adv748x_csi2_init(state, >txb);
if (ret) {
-   adv_err(state, "Failed to probe TXB");
+   adv_err(state, "Failed to probe TXB\n");
goto err_cleanup_txa;
}
 
diff --git a/drivers/media/i2c/adv748x/adv748x-csi2.c 
b/drivers/media/i2c/adv748x/adv748x-csi2.c
index 2091cda50935..c43ce5d78723 100644
--- a/drivers/media/i2c/adv748x/adv748x-csi2.c
+++ b/drivers/media/i2c/adv748x/adv748x-csi2.c
@@ -72,7 +72,7 @@ static int adv748x_csi2_registered(struct v4l2_subdev *sd)
struct adv748x_state *state = tx->state;
int ret;
 
-   adv_dbg(state, "Registered %s (%s)", is_txa(tx) ? "TXA":"TXB",
+   adv_dbg(state, "Registered %s (%s)\n", is_txa(tx) ? "TXA":"TXB",
sd->name);
 
/*
-- 
2.25.1.25.g9ecbe7eb18


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


[PATCH v2 02/10] media: adv748x: include everything adv748x.h needs into the file

2020-03-19 Thread Alex Riesen
To follow the established practice of not depending on others to
pull everything in.

Signed-off-by: Alexander Riesen 
---
 drivers/media/i2c/adv748x/adv748x-afe.c  | 2 --
 drivers/media/i2c/adv748x/adv748x-core.c | 2 --
 drivers/media/i2c/adv748x/adv748x-csi2.c | 2 --
 drivers/media/i2c/adv748x/adv748x-hdmi.c | 2 --
 drivers/media/i2c/adv748x/adv748x.h  | 2 ++
 5 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/media/i2c/adv748x/adv748x-afe.c 
b/drivers/media/i2c/adv748x/adv748x-afe.c
index dbbb1e4d6363..ab0479641c10 100644
--- a/drivers/media/i2c/adv748x/adv748x-afe.c
+++ b/drivers/media/i2c/adv748x/adv748x-afe.c
@@ -11,8 +11,6 @@
 #include 
 #include 
 
-#include 
-#include 
 #include 
 #include 
 
diff --git a/drivers/media/i2c/adv748x/adv748x-core.c 
b/drivers/media/i2c/adv748x/adv748x-core.c
index c3fb113cef62..345f009de121 100644
--- a/drivers/media/i2c/adv748x/adv748x-core.c
+++ b/drivers/media/i2c/adv748x/adv748x-core.c
@@ -20,8 +20,6 @@
 #include 
 #include 
 
-#include 
-#include 
 #include 
 #include 
 #include 
diff --git a/drivers/media/i2c/adv748x/adv748x-csi2.c 
b/drivers/media/i2c/adv748x/adv748x-csi2.c
index c43ce5d78723..78d391009b5a 100644
--- a/drivers/media/i2c/adv748x/adv748x-csi2.c
+++ b/drivers/media/i2c/adv748x/adv748x-csi2.c
@@ -8,8 +8,6 @@
 #include 
 #include 
 
-#include 
-#include 
 #include 
 
 #include "adv748x.h"
diff --git a/drivers/media/i2c/adv748x/adv748x-hdmi.c 
b/drivers/media/i2c/adv748x/adv748x-hdmi.c
index c557f8fdf11a..0dffcdf79ff2 100644
--- a/drivers/media/i2c/adv748x/adv748x-hdmi.c
+++ b/drivers/media/i2c/adv748x/adv748x-hdmi.c
@@ -8,8 +8,6 @@
 #include 
 #include 
 
-#include 
-#include 
 #include 
 #include 
 
diff --git a/drivers/media/i2c/adv748x/adv748x.h 
b/drivers/media/i2c/adv748x/adv748x.h
index fccb388ce179..09aab4138c3f 100644
--- a/drivers/media/i2c/adv748x/adv748x.h
+++ b/drivers/media/i2c/adv748x/adv748x.h
@@ -19,6 +19,8 @@
  */
 
 #include 
+#include 
+#include 
 
 #ifndef _ADV748X_H_
 #define _ADV748X_H_
-- 
2.25.1.25.g9ecbe7eb18


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


[PATCH v2 03/10] media: adv748x: reduce amount of code for bitwise modifications of device registers

2020-03-19 Thread Alex Riesen
The regmap provides a convenient utility for this.

Signed-off-by: Alexander Riesen 
---
 drivers/media/i2c/adv748x/adv748x-core.c |  6 ++
 drivers/media/i2c/adv748x/adv748x.h  | 15 ---
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/drivers/media/i2c/adv748x/adv748x-core.c 
b/drivers/media/i2c/adv748x/adv748x-core.c
index 345f009de121..36164a254d7b 100644
--- a/drivers/media/i2c/adv748x/adv748x-core.c
+++ b/drivers/media/i2c/adv748x/adv748x-core.c
@@ -133,6 +133,12 @@ static int adv748x_write_check(struct adv748x_state 
*state, u8 page, u8 reg,
return *error;
 }
 
+int adv748x_update_bits(struct adv748x_state *state, u8 page, u8 reg, u8 mask,
+   u8 value)
+{
+   return regmap_update_bits(state->regmap[page], reg, mask, value);
+}
+
 /* adv748x_write_block(): Write raw data with a maximum of I2C_SMBUS_BLOCK_MAX
  * size to one or more registers.
  *
diff --git a/drivers/media/i2c/adv748x/adv748x.h 
b/drivers/media/i2c/adv748x/adv748x.h
index 09aab4138c3f..c5245464fffc 100644
--- a/drivers/media/i2c/adv748x/adv748x.h
+++ b/drivers/media/i2c/adv748x/adv748x.h
@@ -393,25 +393,34 @@ int adv748x_write(struct adv748x_state *state, u8 page, 
u8 reg, u8 value);
 int adv748x_write_block(struct adv748x_state *state, int client_page,
unsigned int init_reg, const void *val,
size_t val_len);
+int adv748x_update_bits(struct adv748x_state *state, u8 page, u8 reg,
+   u8 mask, u8 value);
 
 #define io_read(s, r) adv748x_read(s, ADV748X_PAGE_IO, r)
 #define io_write(s, r, v) adv748x_write(s, ADV748X_PAGE_IO, r, v)
-#define io_clrset(s, r, m, v) io_write(s, r, (io_read(s, r) & ~(m)) | (v))
+#define io_clrset(s, r, m, v) adv748x_update_bits(s, ADV748X_PAGE_IO, r, m, v)
+#define io_update(s, r, m, v) adv748x_update_bits(s, ADV748X_PAGE_IO, r, m, v)
 
 #define hdmi_read(s, r) adv748x_read(s, ADV748X_PAGE_HDMI, r)
 #define hdmi_read16(s, r, m) (((hdmi_read(s, r) << 8) | hdmi_read(s, (r)+1)) & 
(m))
 #define hdmi_write(s, r, v) adv748x_write(s, ADV748X_PAGE_HDMI, r, v)
+#define hdmi_update(s, r, m, v) \
+   adv748x_update_bits(s, ADV748X_PAGE_HDMI, r, m, v)
+
+#define dpll_read(s, r) adv748x_read(s, ADV748X_PAGE_DPLL, r)
+#define dpll_update(s, r, m, v) \
+   adv748x_update_bits(s, ADV748X_PAGE_DPLL, r, m, v)
 
 #define repeater_read(s, r) adv748x_read(s, ADV748X_PAGE_REPEATER, r)
 #define repeater_write(s, r, v) adv748x_write(s, ADV748X_PAGE_REPEATER, r, v)
 
 #define sdp_read(s, r) adv748x_read(s, ADV748X_PAGE_SDP, r)
 #define sdp_write(s, r, v) adv748x_write(s, ADV748X_PAGE_SDP, r, v)
-#define sdp_clrset(s, r, m, v) sdp_write(s, r, (sdp_read(s, r) & ~(m)) | (v))
+#define sdp_clrset(s, r, m, v) adv748x_update_bits(s, ADV748X_PAGE_SDP, r, m, 
v)
 
 #define cp_read(s, r) adv748x_read(s, ADV748X_PAGE_CP, r)
 #define cp_write(s, r, v) adv748x_write(s, ADV748X_PAGE_CP, r, v)
-#define cp_clrset(s, r, m, v) cp_write(s, r, (cp_read(s, r) & ~(m)) | (v))
+#define cp_clrset(s, r, m, v) adv748x_update_bits(s, ADV748X_PAGE_CP, r, m, v)
 
 #define tx_read(t, r) adv748x_read(t->state, t->page, r)
 #define tx_write(t, r, v) adv748x_write(t->state, t->page, r, v)
-- 
2.25.1.25.g9ecbe7eb18


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


[driver-core:driver-core-testing] BUILD SUCCESS 99917e37b9e78b96af304ddeb4f9b82a5948bbd9

2020-03-19 Thread kbuild test robot
tree/branch: 
https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git  
driver-core-testing
branch HEAD: 99917e37b9e78b96af304ddeb4f9b82a5948bbd9  Revert "drivers: base: 
power: wakeup.c: Use built-in RCU list checking"

elapsed time: 483m

configs tested: 139
configs skipped: 0

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

arm  allmodconfig
arm   allnoconfig
arm  allyesconfig
arm64allmodconfig
arm64 allnoconfig
arm64allyesconfig
arm   efm32_defconfig
arm at91_dt_defconfig
armshmobile_defconfig
arm64   defconfig
arm  exynos_defconfig
armmulti_v5_defconfig
arm   sunxi_defconfig
armmulti_v7_defconfig
nds32   defconfig
h8300 edosk2674_defconfig
s390  debug_defconfig
s390defconfig
ia64 allyesconfig
microblaze  mmu_defconfig
openriscor1ksim_defconfig
ia64defconfig
powerpc defconfig
i386 allyesconfig
riscvnommu_virt_defconfig
c6xevmc6678_defconfig
c6x  allyesconfig
i386  allnoconfig
i386 alldefconfig
i386defconfig
ia64 alldefconfig
ia64 allmodconfig
ia64  allnoconfig
xtensa  iss_defconfig
xtensa   common_defconfig
nios2 3c120_defconfig
nios2 10m50_defconfig
openrisc simple_smp_defconfig
nds32 allnoconfig
cskydefconfig
alpha   defconfig
h8300h8300h-sim_defconfig
h8300   h8s-sim_defconfig
m68k allmodconfig
m68k   m5475evb_defconfig
m68k  multi_defconfig
m68k   sun3_defconfig
arc  allyesconfig
arc defconfig
microblazenommu_defconfig
powerpc   allnoconfig
powerpc   ppc64_defconfig
powerpc  rhel-kconfig
mips   32r2_defconfig
mips 64r6el_defconfig
mips allmodconfig
mips  allnoconfig
mips allyesconfig
mips  fuloong2e_defconfig
mips  malta_kvm_defconfig
pariscallnoconfig
pariscgeneric-64bit_defconfig
pariscgeneric-32bit_defconfig
parisc   allyesconfig
i386 randconfig-a003-20200319
i386 randconfig-a001-20200319
x86_64   randconfig-a001-20200319
x86_64   randconfig-a002-20200319
i386 randconfig-a002-20200319
x86_64   randconfig-a003-20200319
riscvrandconfig-a001-20200319
m68k randconfig-a001-20200319
nds32randconfig-a001-20200319
alpharandconfig-a001-20200319
parisc   randconfig-a001-20200319
mips randconfig-a001-20200319
h8300randconfig-a001-20200319
sparc64  randconfig-a001-20200319
c6x  randconfig-a001-20200319
nios2randconfig-a001-20200319
microblaze   randconfig-a001-20200319
csky randconfig-a001-20200319
openrisc randconfig-a001-20200319
s390 randconfig-a001-20200319
sh   randconfig-a001-20200319
xtensa   randconfig-a001-20200319
x86_64   randconfig-b001-20200319
x86_64   randconfig-b002-20200319
x86_64   randconfig-b003-20200319
i386 randconfig-b001-20200319
i386 randconfig-b002-20200319
i386 randconfig-b003-20200319
x86_64   randconfig-c001-20200319
i386 randconfig-c001-20200319
x86_64   randconfig-c002-20200319
x86_64   randconfig-d001-20200319
i386 randconfig-d001-20200319
x86_64   randconfig-f001-20200319
x86_64   randconfig-f002-20200319
x86_64   randconfig-f00

Re: [PATCH RESEND] staging: vc04_services: Use scnprintf() for avoiding potential buffer overflow

2020-03-19 Thread Greg Kroah-Hartman
On Thu, Mar 19, 2020 at 05:13:00PM +0100, Takashi Iwai wrote:
> Since snprintf() returns the would-be-output size instead of the
> actual output size, the succeeding calls may go beyond the given
> buffer limit.  Fix it by replacing with scnprintf().
> 
> Reviewed-by: Nicolas Saenz Julienne 
> Cc: Greg Kroah-Hartman 
> Cc: bcm-kernel-feedback-l...@broadcom.com
> Cc: linux-rpi-ker...@lists.infradead.org
> Cc: de...@driverdev.osuosl.org
> Signed-off-by: Takashi Iwai 
> ---
> 
> Greg, could you apply it if it's OK?

Will do so, thanks!

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


[PATCH] staging: mt7621-pci: don't return if get gpio fails

2020-03-19 Thread Sergio Paracuellos
In some platforms gpio's are not used for reset but
for other purposes. Because of that when we try to
get them are valid gpio's but are already assigned
to do other function. To avoid those kind of problems
in those platforms just notice the fail in the kernel
but continue doing normal boot.

Signed-off-by: Sergio Paracuellos 
---
 drivers/staging/mt7621-pci/pci-mt7621.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c 
b/drivers/staging/mt7621-pci/pci-mt7621.c
index 2a01645162a5..d6fc8a08c9bd 100644
--- a/drivers/staging/mt7621-pci/pci-mt7621.c
+++ b/drivers/staging/mt7621-pci/pci-mt7621.c
@@ -363,10 +363,8 @@ static int mt7621_pcie_parse_port(struct mt7621_pcie *pcie,
 
port->gpio_rst = devm_gpiod_get_index_optional(dev, "reset", slot,
   GPIOD_OUT_LOW);
-   if (IS_ERR(port->gpio_rst)) {
-   dev_err(dev, "Failed to get GPIO for PCIe%d\n", slot);
-   return PTR_ERR(port->gpio_rst);
-   }
+   if (IS_ERR(port->gpio_rst))
+   dev_notice(dev, "Failed to get GPIO for PCIe%d\n", slot);
 
port->slot = slot;
port->pcie = pcie;
-- 
2.25.1

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


[PATCH RESEND] staging: vc04_services: Use scnprintf() for avoiding potential buffer overflow

2020-03-19 Thread Takashi Iwai
Since snprintf() returns the would-be-output size instead of the
actual output size, the succeeding calls may go beyond the given
buffer limit.  Fix it by replacing with scnprintf().

Reviewed-by: Nicolas Saenz Julienne 
Cc: Greg Kroah-Hartman 
Cc: bcm-kernel-feedback-l...@broadcom.com
Cc: linux-rpi-ker...@lists.infradead.org
Cc: de...@driverdev.osuosl.org
Signed-off-by: Takashi Iwai 
---

Greg, could you apply it if it's OK?
I forgot Cc to you and staging ML in the previous thread.

 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index b377f18aed45..a1ea9777a444 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -2161,17 +2161,17 @@ int vchiq_dump_platform_service_state(void 
*dump_context,
char buf[80];
int len;
 
-   len = snprintf(buf, sizeof(buf), "  instance %pK", service->instance);
+   len = scnprintf(buf, sizeof(buf), "  instance %pK", service->instance);
 
if ((service->base.callback == service_callback) &&
user_service->is_vchi) {
-   len += snprintf(buf + len, sizeof(buf) - len,
+   len += scnprintf(buf + len, sizeof(buf) - len,
", %d/%d messages",
user_service->msg_insert - user_service->msg_remove,
MSG_QUEUE_SIZE);
 
if (user_service->dequeue_pending)
-   len += snprintf(buf + len, sizeof(buf) - len,
+   len += scnprintf(buf + len, sizeof(buf) - len,
" (dequeue pending)");
}
 
-- 
2.16.4

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


Re: [kbuild-all] Re: [staging:staging-testing 222/222] drivers/ide/ide-gd.c:362:10: sparse: warning: Initializer entry defined twice

2020-03-19 Thread Philip Li
On Wed, Mar 18, 2020 at 07:53:07AM +0100, Greg Kroah-Hartman wrote:
> On Wed, Mar 18, 2020 at 02:42:31PM +0800, Philip Li wrote:
> > On Wed, Mar 18, 2020 at 07:17:40AM +0100, Greg Kroah-Hartman wrote:
> > > On Wed, Mar 18, 2020 at 02:12:43PM +0800, Philip Li wrote:
> > > > On Wed, Mar 18, 2020 at 07:08:31AM +0100, Greg Kroah-Hartman wrote:
> > > > > On Wed, Mar 18, 2020 at 07:24:29AM +0800, kbuild test robot wrote:
> > > > > > tree:   
> > > > > > https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 
> > > > > > staging-testing
> > > > > > head:   ba839b32d6f76a68919ed838e9375c47ca05a91a
> > > > > > commit: ba839b32d6f76a68919ed838e9375c47ca05a91a [222/222] staging: 
> > > > > > media: hantro: remove parentheses
> > > > > > reproduce:
> > > > > > # apt-get install sparse
> > > > > > # sparse version: 
> > > > > > git checkout ba839b32d6f76a68919ed838e9375c47ca05a91a
> > > > > > make ARCH=x86_64 allmodconfig
> > > > > > make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
> > > > > > 
> > > > > > If you fix the issue, kindly add following tag
> > > > > > Reported-by: kbuild test robot 
> > > > > > 
> > > > > > All warnings (new ones prefixed by >>):
> > > > > > 
> > > > > > >> drivers/ide/ide-gd.c:362:10: sparse: warning: Initializer entry 
> > > > > > >> defined twice
> > > > > >drivers/ide/ide-gd.c:364:10: sparse:   also defined here
> > > > > > --
> > > > > > >> drivers/scsi/sr.c:689:10: sparse: warning: Initializer entry 
> > > > > > >> defined twice
> > > > > >drivers/scsi/sr.c:691:10: sparse:   also defined here
> > > > > > --
> > > > > > >> drivers/block/paride/pcd.c:277:10: sparse: warning: Initializer 
> > > > > > >> entry defined twice
> > > > > >drivers/block/paride/pcd.c:279:10: sparse:   also defined here
> > > > > > --
> > > > > > >> sound/soc/codecs/rt1015.c:844:24: sparse: warning: symbol 
> > > > > > >> 'rt1015_aif_dai_ops' was not declared. Should it be static?
> > > > > > >> sound/soc/codecs/rt1015.c:849:27: sparse: warning: symbol 
> > > > > > >> 'rt1015_dai' was not declared. Should it be static?
> > > > > > --
> > > > > > >> net/netfilter/nft_set_pipapo.c:739:6: sparse: warning: symbol 
> > > > > > >> 'nft_pipapo_get' was not declared. Should it be static?
> > > > > > 
> > > > > > vim +362 drivers/ide/ide-gd.c
> > > > > > 
> > > > > > c103d6ee69f93e Arnd Bergmann 2019-03-15  357  
> > > > > > 83d5cde47dedf0 Alexey Dobriyan   2009-09-21  358  static 
> > > > > > const struct block_device_operations ide_gd_ops = {
> > > > > > 5fef0e5c028394 Bartlomiej Zolnierkiewicz 2008-10-17  359.owner  
> > > > > > = THIS_MODULE,
> > > > > > 6e9624b8caec29 Arnd Bergmann 2010-08-07  360.open   
> > > > > > = ide_gd_unlocked_open,
> > > > > > b2f21e057dfbaa Al Viro   2008-10-16  361
> > > > > > .release= ide_gd_release,
> > > > > > 8a6cfeb6deca3a Arnd Bergmann 2010-07-08 @362.ioctl  
> > > > > > = ide_gd_ioctl,
> > > > > > c103d6ee69f93e Arnd Bergmann 2019-03-15  363  #ifdef 
> > > > > > CONFIG_COMPAT
> > > > > > c103d6ee69f93e Arnd Bergmann 2019-03-15  364.ioctl  
> > > > > > = ide_gd_compat_ioctl,
> > > > > > c103d6ee69f93e Arnd Bergmann 2019-03-15  365  #endif
> > > > > > 5fef0e5c028394 Bartlomiej Zolnierkiewicz 2008-10-17  366.getgeo 
> > > > > > = ide_gd_getgeo,
> > > > > > 5b03a1b140e13a Tejun Heo 2011-03-09  367
> > > > > > .check_events   = ide_gd_check_events,
> > > > > > c3e33e043f5e9c Tejun Heo 2010-05-15  368
> > > > > > .unlock_native_capacity = ide_gd_unlock_native_capacity,
> > > > > > 5fef0e5c028394 Bartlomiej Zolnierkiewicz 2008-10-17  369
> > > > > > .revalidate_disk= ide_gd_revalidate_disk
> > > > > > 5fef0e5c028394 Bartlomiej Zolnierkiewicz 2008-10-17  370  };
> > > > > > 5fef0e5c028394 Bartlomiej Zolnierkiewicz 2008-10-17  371  
> > > > > > 
> > > > > > :: The code at line 362 was first introduced by commit
> > > > > > :: 8a6cfeb6deca3a8fefd639d898b0d163c0b5d368 block: push down 
> > > > > > BKL into .locked_ioctl
> > > > > 
> > > > > Why is 0-day starting to spit out sparse warnings for things that have
> > > > > nothing to do with the specific patch, or tree?
> > > > thanks for the input, Greg, we will check this to avoid
> > > > false positive.
> > > 
> > > This was not the only false-positive report I got this morning, so
> > > something went wrong on your end that started spitting out new ones :(
> > sorry for the noise, we will go through the reports sent to you in recent
> > days to check. If it is handy for you to fwd me the "wrong" mail, it
> > can also help me address the problem.
> 
> Subject: [staging:staging-testing 222/222] 
> drivers/mtd/nand/raw/nand_legacy.c:42:17: sparse: warning: cast from 
> restricted __le16
> 

Re: [PATCH] staging: exfat: Fix checkpatch.pl camelcase issues

2020-03-19 Thread Greg KH
On Thu, Mar 19, 2020 at 10:31:05AM -0400, Aravind Ceyardass wrote:
> 
> 
> On 3/19/20 10:12 AM, Greg KH wrote:
> > On Thu, Mar 19, 2020 at 10:06:47AM -0400, Aravind Ceyardass wrote:
> >> Fix ffsCamelCase function names and mixed case enums
> >>
> >> Signed-off-by: Aravind Ceyardass 
> >> ---
> >>  drivers/staging/exfat/TODO  |   1 -
> >>  drivers/staging/exfat/exfat.h   |  12 +-
> >>  drivers/staging/exfat/exfat_super.c | 222 ++--
> >>  3 files changed, 117 insertions(+), 118 deletions(-)
> > 
> > These files are not in linux-next, or in my tree, anymore.
> > 
> > Please always work against the latest development tree so you do not
> > waste duplicated effort.
> > 
> > thanks,
> > 
> > greg k-h
> > 
> 
> As a very beginner, I used the 
> staging(git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git) 
> tree based on what I read on kernelnewbies.org
> 
> What tree or branch should I use instead?

That's the correct tree, but you probably forgot to use the staging-next
branch, right?

hope this helps,

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


[driver-core:debugfs_remove_return_value] BUILD REGRESSION c5b434b51b2daaacdd0c69736631eaead95d9111

2020-03-19 Thread kbuild test robot
tree/branch: 
https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git  
debugfs_remove_return_value
branch HEAD: c5b434b51b2daaacdd0c69736631eaead95d9111  debugfs: remove return 
value of debugfs_create_u32()

Regressions in current branch:

arch/powerpc/kernel/traps.c:2293:4: error: void value not ignored as it ought 
to be

Error ids grouped by kconfigs:

recent_errors
`-- powerpc-allyesconfig
`-- 
arch-powerpc-kernel-traps.c:error:void-value-not-ignored-as-it-ought-to-be

elapsed time: 483m

configs tested: 146
configs skipped: 0

arm  allmodconfig
arm   allnoconfig
arm  allyesconfig
arm64allmodconfig
arm64 allnoconfig
arm64allyesconfig
arm at91_dt_defconfig
arm   efm32_defconfig
arm  exynos_defconfig
armmulti_v5_defconfig
armmulti_v7_defconfig
armshmobile_defconfig
arm   sunxi_defconfig
arm64   defconfig
sparcallyesconfig
nds32   defconfig
h8300 edosk2674_defconfig
mips  malta_kvm_defconfig
arc  allyesconfig
ia64 allyesconfig
s390defconfig
microblaze  mmu_defconfig
openriscor1ksim_defconfig
ia64defconfig
powerpc defconfig
m68k   sun3_defconfig
i386 allyesconfig
riscvnommu_virt_defconfig
shallnoconfig
c6xevmc6678_defconfig
c6x  allyesconfig
i386  allnoconfig
i386 alldefconfig
i386defconfig
ia64 alldefconfig
ia64 allmodconfig
ia64  allnoconfig
nios2 3c120_defconfig
nios2 10m50_defconfig
xtensa  iss_defconfig
xtensa   common_defconfig
openrisc simple_smp_defconfig
nds32 allnoconfig
cskydefconfig
alpha   defconfig
h8300h8300h-sim_defconfig
h8300   h8s-sim_defconfig
m68k allmodconfig
m68k   m5475evb_defconfig
m68k  multi_defconfig
arc defconfig
powerpc   ppc64_defconfig
powerpc  rhel-kconfig
microblazenommu_defconfig
powerpc   allnoconfig
mips   32r2_defconfig
mips 64r6el_defconfig
mips allmodconfig
mips  allnoconfig
mips allyesconfig
mips  fuloong2e_defconfig
pariscallnoconfig
parisc   allyesconfig
pariscgeneric-32bit_defconfig
pariscgeneric-64bit_defconfig
i386 randconfig-a003-20200319
i386 randconfig-a001-20200319
x86_64   randconfig-a001-20200319
x86_64   randconfig-a002-20200319
i386 randconfig-a002-20200319
x86_64   randconfig-a003-20200319
riscvrandconfig-a001-20200319
m68k randconfig-a001-20200319
nds32randconfig-a001-20200319
alpharandconfig-a001-20200319
parisc   randconfig-a001-20200319
mips randconfig-a001-20200319
c6x  randconfig-a001-20200319
h8300randconfig-a001-20200319
microblaze   randconfig-a001-20200319
nios2randconfig-a001-20200319
sparc64  randconfig-a001-20200319
csky randconfig-a001-20200319
openrisc randconfig-a001-20200319
s390 randconfig-a001-20200319
sh   randconfig-a001-20200319
xtensa   randconfig-a001-20200319
x86_64   randconfig-b001-20200319
x86_64   randconfig-b002-20200319
x86_64   randconfig-b003-20200319
i386 randconfig-b001-20200319
i386 randconfig-b002-20200319
i386 randconfig-b003-20200319
x86_64   randconfig-c001-20200319
i386 randconfig-c001-20200319
x86_64   randconfig-c002-20200319
i386

[driver-core:debugfs_cleanup] BUILD SUCCESS 75ae458d1cd8fe76666aa83dd7bf4f656424272a

2020-03-19 Thread kbuild test robot
tree/branch: 
https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git  
debugfs_cleanup
branch HEAD: 75ae458d1cd8fe7aa83dd7bf4f656424272a  powerpc: powernv: no 
need to check return value of debugfs_create functions

elapsed time: 484m

configs tested: 146
configs skipped: 0

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

arm  allmodconfig
arm   allnoconfig
arm  allyesconfig
arm64allmodconfig
arm64 allnoconfig
arm64allyesconfig
arm at91_dt_defconfig
arm   efm32_defconfig
arm  exynos_defconfig
armmulti_v5_defconfig
armmulti_v7_defconfig
armshmobile_defconfig
arm   sunxi_defconfig
arm64   defconfig
sparcallyesconfig
nds32   defconfig
mips  malta_kvm_defconfig
microblaze  mmu_defconfig
m68k   sun3_defconfig
shallnoconfig
c6xevmc6678_defconfig
i386  allnoconfig
i386 allyesconfig
i386 alldefconfig
i386defconfig
ia64 allmodconfig
ia64defconfig
ia64  allnoconfig
ia64 allyesconfig
ia64 alldefconfig
nios2 3c120_defconfig
nios2 10m50_defconfig
xtensa  iss_defconfig
c6x  allyesconfig
xtensa   common_defconfig
openrisc simple_smp_defconfig
openriscor1ksim_defconfig
nds32 allnoconfig
cskydefconfig
alpha   defconfig
h8300   h8s-sim_defconfig
h8300 edosk2674_defconfig
m68k   m5475evb_defconfig
m68k allmodconfig
h8300h8300h-sim_defconfig
m68k  multi_defconfig
arc  allyesconfig
arc defconfig
microblazenommu_defconfig
powerpc   allnoconfig
powerpc defconfig
powerpc   ppc64_defconfig
powerpc  rhel-kconfig
mips  fuloong2e_defconfig
mips allyesconfig
mips 64r6el_defconfig
mips  allnoconfig
mips   32r2_defconfig
mips allmodconfig
pariscallnoconfig
parisc   allyesconfig
pariscgeneric-32bit_defconfig
pariscgeneric-64bit_defconfig
i386 randconfig-a003-20200319
i386 randconfig-a001-20200319
x86_64   randconfig-a001-20200319
x86_64   randconfig-a002-20200319
i386 randconfig-a002-20200319
x86_64   randconfig-a003-20200319
riscvrandconfig-a001-20200319
m68k randconfig-a001-20200319
nds32randconfig-a001-20200319
alpharandconfig-a001-20200319
parisc   randconfig-a001-20200319
mips randconfig-a001-20200319
c6x  randconfig-a001-20200319
h8300randconfig-a001-20200319
microblaze   randconfig-a001-20200319
nios2randconfig-a001-20200319
sparc64  randconfig-a001-20200319
csky randconfig-a001-20200319
openrisc randconfig-a001-20200319
s390 randconfig-a001-20200319
sh   randconfig-a001-20200319
xtensa   randconfig-a001-20200319
x86_64   randconfig-b001-20200319
x86_64   randconfig-b002-20200319
i386 randconfig-b001-20200319
x86_64   randconfig-b003-20200319
i386 randconfig-b002-20200319
i386 randconfig-b003-20200319
x86_64   randconfig-c001-20200319
i386 randconfig-c001-20200319
x86_64   randconfig-c002-20200319
i386 randconfig-c003-20200319
x86_64   randconfig-c003-20200319
i386 randconfig-c002-20200319
x86_64   randconfig-d001-20200319
i386 randconfig-d001-20200319
i386 randconfig-d003-20200319

Re: [PATCH] staging: exfat: Fix checkpatch.pl camelcase issues

2020-03-19 Thread Aravind Ceyardass



On 3/19/20 10:12 AM, Greg KH wrote:
> On Thu, Mar 19, 2020 at 10:06:47AM -0400, Aravind Ceyardass wrote:
>> Fix ffsCamelCase function names and mixed case enums
>>
>> Signed-off-by: Aravind Ceyardass 
>> ---
>>  drivers/staging/exfat/TODO  |   1 -
>>  drivers/staging/exfat/exfat.h   |  12 +-
>>  drivers/staging/exfat/exfat_super.c | 222 ++--
>>  3 files changed, 117 insertions(+), 118 deletions(-)
> 
> These files are not in linux-next, or in my tree, anymore.
> 
> Please always work against the latest development tree so you do not
> waste duplicated effort.
> 
> thanks,
> 
> greg k-h
> 

As a very beginner, I used the 
staging(git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git) tree 
based on what I read on kernelnewbies.org

What tree or branch should I use instead?

Thanks

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


Re: [PATCH v4 0/6] staging: mt7621-pci: re-do reset boot process

2020-03-19 Thread Greg Ungerer

Hi Sergio,

On 19/3/20 11:43 pm, Sergio Paracuellos wrote:

On Thu, Mar 19, 2020 at 1:42 PM Greg Ungerer  wrote:

On 14/3/20 6:09 am, Sergio Paracuellos wrote:

Some time ago Greg Ungerer reported some random hangs using
the staging mt7621-pci driver:

See:
* 
http://driverdev.linuxdriverproject.org/pipermail/driverdev-devel/2019-June/134947.html

Try to fix that is the main motivation of this patch series.

Also in openwrt there is a driver for mt7621-pci which seems was rewritten
from scratch (for kernel 4.14) by Ryder Lee and Weijie Gao from mediatek.
There the approach for reset assert-deassert process is to set as 'gpio'
the function for all the 'pcie' group for the pinctrl driver and use those
gpio's as a reset for the end points. The driver I am talking about is still
using legacy pci and legacy gpio kernel interfaces. IMHO, the correct thing
to do is make this staging driver properly clean and functional and put it
in its correct place in the mainline.

See:
* https://gist.github.com/dengqf6/7a9e9b4032d99f1a91dd9256c8a65c36

Because of all of this this patch series tries to avoid random hangs of boot
trying to use the 'reset-gpios' approach.

Changes are being tested by openwrt people and seems to work.

Hope this helps.

Changes in v4:
* Make use of 'devm_gpiod_get_index_optional' instead of 'devm_gpiod_get_index'.
* Use 'dev_err' instead of 'dev_notice' and return ERR_PTR if
'devm_gpiod_get_index_optional' fails.
* Rename pers dealy macro to PERST_DELAY_MS.
* Add new patch 6 which removes function 'mt7621_reset_port' not needed anymore.


Testing this v4 series always fails during boot with:

...
NET: Registered protocol family 17
NET: Registered protocol family 15
8021q: 802.1Q VLAN Support v1.8
Loading compiled-in X.509 certificates
AppArmor: AppArmor sha1 policy hashing enabled

rt2880-pinmux pinctrl: pcie is already enabled
mt7621-pci 1e14.pcie: Error applying setting, reverse things back
mt7621-pci 1e14.pcie: Failed to get GPIO for PCIe1
mt7621-pci 1e14.pcie: Parsing DT failed
mt7621-pci: probe of 1e14.pcie failed with error -16


Looks like the gpio is valid but has been assigned to anything else.
It looks like a device-tree issue for me.
Does your hardware follows the indications of the mediatek application note?


Yes, as per table 2-2. GPIO pins 7 and 8 are used for other purposes
on my hardware - and my devicetree has those assigned for those
other purposes. They are not available for, or used for, PCI reset.

Regards
Greg




https://github.com/openwrt/openwrt/files/4317436/an-mt7621-pcie-application-note-v0.1.pdf

To be able to test this you can just change the device tree and set
reset gpios to only perst-reset pin

reset-gpios = < 19 GPIO_ACTIVE_LOW>;

or avoid the "return PTR_ERR(port->gpio_rst);" after the call to
'devm_gpiod_get_index_optional'.

Or just make an exception if the pin is busy, which seems to be the
problem here:



UBI error: cannot open mtd 3, error -19
hctosys: unable to open rtc device (rtc0)
cfg80211: Loading compiled-in X.509 certificates for regulatory database
cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
...

It never hangs, always boots up all the way. But always the same failure
with PCIe.


This series has been applied to the staging tree and are properly
running for me in gnubee pc1.

You should test using all confirmed changes in staging-next branch and
this patch which fix a wrong register usage issue:

http://driverdev.linuxdriverproject.org/pipermail/driverdev-devel/2020-March/142472.html




Regards
Greg




Changes in v3:
* Avoid to fail if gpio descriptor fails on get.
* re-do PATCH 1 commit message.
* Take into account gpio low polarity on request and assert and deassert.
* Review error path of driver to properly release gpio's resources.

Changes in v2:
* restore configuration for pers mode to GPIO.
* Avoid to read FTS_NUM register in reset state.
* Release gpio's patch added

Best regards,
  Sergio Paracuellos


Sergio Paracuellos (6):
staging: mt7621-pci: use gpios for properly reset
staging: mt7621-pci: change value for 'PERST_DELAY_MS'
staging: mt7621-dts: make use of 'reset-gpios' property for pci
staging: mt7621-pci: bindings: update doc accordly to last changes
staging: mt7621-pci: release gpios after pci initialization
staging: mt7621-pci: delete no more needed 'mt7621_reset_port'

   drivers/staging/mt7621-dts/mt7621.dtsi|  11 +-
   .../mt7621-pci/mediatek,mt7621-pci.txt|   7 +-
   drivers/staging/mt7621-pci/pci-mt7621.c   | 122 ++
   3 files changed, 82 insertions(+), 58 deletions(-)


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


Re: [PATCH] staging: exfat: Fix checkpatch.pl camelcase issues

2020-03-19 Thread Matthew Wilcox
On Thu, Mar 19, 2020 at 10:06:47AM -0400, Aravind Ceyardass wrote:
> Fix ffsCamelCase function names and mixed case enums

This driver is now gone from staging in -next; please review the code
in fs/exfat instead.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2] staging: rtl8192u: Corrects 'Avoid CamelCase' for variables

2020-03-19 Thread Greg KH
On Wed, Mar 18, 2020 at 09:12:05PM +, Camylla Goncalves Cantanheide wrote:
> The variables of function setKey triggered a 'Avoid CamelCase'
> warning from checkpatch.pl. This patch renames these
> variables to correct this warning.
> 
> Signed-off-by: Camylla Goncalves Cantanheide 
> ---
>  drivers/staging/rtl8192u/r8192U_core.c | 52 +-
>  1 file changed, 26 insertions(+), 26 deletions(-)

This does not apply to my tree at all :(


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


Re: [PATCH] staging: exfat: Fix checkpatch.pl camelcase issues

2020-03-19 Thread Greg KH
On Thu, Mar 19, 2020 at 10:06:47AM -0400, Aravind Ceyardass wrote:
> Fix ffsCamelCase function names and mixed case enums
> 
> Signed-off-by: Aravind Ceyardass 
> ---
>  drivers/staging/exfat/TODO  |   1 -
>  drivers/staging/exfat/exfat.h   |  12 +-
>  drivers/staging/exfat/exfat_super.c | 222 ++--
>  3 files changed, 117 insertions(+), 118 deletions(-)

These files are not in linux-next, or in my tree, anymore.

Please always work against the latest development tree so you do not
waste duplicated effort.

thanks,

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


[PATCH] staging: exfat: Fix checkpatch.pl camelcase issues

2020-03-19 Thread Aravind Ceyardass
Fix ffsCamelCase function names and mixed case enums

Signed-off-by: Aravind Ceyardass 
---
 drivers/staging/exfat/TODO  |   1 -
 drivers/staging/exfat/exfat.h   |  12 +-
 drivers/staging/exfat/exfat_super.c | 222 ++--
 3 files changed, 117 insertions(+), 118 deletions(-)

diff --git a/drivers/staging/exfat/TODO b/drivers/staging/exfat/TODO
index a283ce534cf4..51019e4431d8 100644
--- a/drivers/staging/exfat/TODO
+++ b/drivers/staging/exfat/TODO
@@ -4,7 +4,6 @@ require more work than the average checkpatch cleanup...
 Note that some of these entries may not be bugs - they're things
 that need to be looked at, and *possibly* fixed.
 
-Clean up the ffsCamelCase function names.
 
 Fix (thing)->flags to not use magic numbers - multiple offenders
 
diff --git a/drivers/staging/exfat/exfat.h b/drivers/staging/exfat/exfat.h
index 4a0a481fe010..92aac0d86249 100644
--- a/drivers/staging/exfat/exfat.h
+++ b/drivers/staging/exfat/exfat.h
@@ -227,11 +227,11 @@ struct date_time_t {
 };
 
 struct vol_info_t {
-   u32  FatType;
-   u32  ClusterSize;
-   u32  NumClusters;
-   u32  FreeClusters;
-   u32  UsedClusters;
+   u32  fat_type;
+   u32  cluster_size;
+   u32  num_clusters;
+   u32  free_clusters;
+   u32  used_clusters;
 };
 
 /* directory structure */
@@ -257,7 +257,7 @@ struct file_id_t {
 struct dir_entry_t {
char name[MAX_NAME_LENGTH * MAX_CHARSET_SIZE];
u32 attr;
-   u64 Size;
+   u64 size;
u32 num_subdirs;
struct date_time_t create_timestamp;
struct date_time_t modify_timestamp;
diff --git a/drivers/staging/exfat/exfat_super.c 
b/drivers/staging/exfat/exfat_super.c
index c7bc07e91c45..46e791ac9135 100644
--- a/drivers/staging/exfat/exfat_super.c
+++ b/drivers/staging/exfat/exfat_super.c
@@ -343,7 +343,7 @@ static inline void exfat_save_attr(struct inode *inode, u32 
attr)
EXFAT_I(inode)->fid.attr = attr & (ATTR_RWMASK | ATTR_READONLY);
 }
 
-static int ffsMountVol(struct super_block *sb)
+static int ffs_mount_vol(struct super_block *sb)
 {
int i, ret;
struct pbr_sector_t *p_pbr;
@@ -439,7 +439,7 @@ static int ffsMountVol(struct super_block *sb)
return ret;
 }
 
-static int ffsUmountVol(struct super_block *sb)
+static int ffs_umount_vol(struct super_block *sb)
 {
struct fs_info_t *p_fs = &(EXFAT_SB(sb)->fs_info);
int err = 0;
@@ -479,7 +479,7 @@ static int ffsUmountVol(struct super_block *sb)
return err;
 }
 
-static int ffsGetVolInfo(struct super_block *sb, struct vol_info_t *info)
+static int ffs_get_vol_info(struct super_block *sb, struct vol_info_t *info)
 {
int err = 0;
struct fs_info_t *p_fs = &(EXFAT_SB(sb)->fs_info);
@@ -494,11 +494,11 @@ static int ffsGetVolInfo(struct super_block *sb, struct 
vol_info_t *info)
if (p_fs->used_clusters == UINT_MAX)
p_fs->used_clusters = exfat_count_used_clusters(sb);
 
-   info->FatType = EXFAT;
-   info->ClusterSize = p_fs->cluster_size;
-   info->NumClusters = p_fs->num_clusters - 2; /* clu 0 & 1 */
-   info->UsedClusters = p_fs->used_clusters;
-   info->FreeClusters = info->NumClusters - info->UsedClusters;
+   info->fat_type = EXFAT;
+   info->cluster_size = p_fs->cluster_size;
+   info->num_clusters = p_fs->num_clusters - 2; /* clu 0 & 1 */
+   info->used_clusters = p_fs->used_clusters;
+   info->free_clusters = info->num_clusters - info->used_clusters;
 
if (p_fs->dev_ejected)
err = -EIO;
@@ -509,7 +509,7 @@ static int ffsGetVolInfo(struct super_block *sb, struct 
vol_info_t *info)
return err;
 }
 
-static int ffsSyncVol(struct super_block *sb, bool do_sync)
+static int ffs_sync_vol(struct super_block *sb, bool do_sync)
 {
int err = 0;
struct fs_info_t *p_fs = &(EXFAT_SB(sb)->fs_info);
@@ -534,7 +534,7 @@ static int ffsSyncVol(struct super_block *sb, bool do_sync)
 /*  File Operation Functions*/
 /*--*/
 
-static int ffsLookupFile(struct inode *inode, char *path, struct file_id_t 
*fid)
+static int ffs_lookup_file(struct inode *inode, char *path, struct file_id_t 
*fid)
 {
int ret, dentry, num_entries;
struct chain_t dir;
@@ -619,7 +619,7 @@ static int ffsLookupFile(struct inode *inode, char *path, 
struct file_id_t *fid)
return ret;
 }
 
-static int ffsCreateFile(struct inode *inode, char *path, u8 mode,
+static int ffs_create_file(struct inode *inode, char *path, u8 mode,
 struct file_id_t *fid)
 {
struct chain_t dir;
@@ -660,7 +660,7 @@ static int ffsCreateFile(struct inode *inode, char *path, 
u8 mode,
return ret;
 }
 
-static int ffsTruncateFile(struct inode *inode, u64 old_size, u64 new_size)
+static int ffs_truncate_file(struct inode 

Re: [PATCH v4 0/6] staging: mt7621-pci: re-do reset boot process

2020-03-19 Thread Sergio Paracuellos
Sorry the mail was sent while I was still writing :)

On Thu, Mar 19, 2020 at 2:43 PM Sergio Paracuellos
 wrote:
>
> Hi Greg,
>
> On Thu, Mar 19, 2020 at 1:42 PM Greg Ungerer  wrote:
> >
> > Hi Sergio,
> >
> > On 14/3/20 6:09 am, Sergio Paracuellos wrote:
> > > Some time ago Greg Ungerer reported some random hangs using
> > > the staging mt7621-pci driver:
> > >
> > > See:
> > > * 
> > > http://driverdev.linuxdriverproject.org/pipermail/driverdev-devel/2019-June/134947.html
> > >
> > > Try to fix that is the main motivation of this patch series.
> > >
> > > Also in openwrt there is a driver for mt7621-pci which seems was rewritten
> > > from scratch (for kernel 4.14) by Ryder Lee and Weijie Gao from mediatek.
> > > There the approach for reset assert-deassert process is to set as 'gpio'
> > > the function for all the 'pcie' group for the pinctrl driver and use those
> > > gpio's as a reset for the end points. The driver I am talking about is 
> > > still
> > > using legacy pci and legacy gpio kernel interfaces. IMHO, the correct 
> > > thing
> > > to do is make this staging driver properly clean and functional and put it
> > > in its correct place in the mainline.
> > >
> > > See:
> > > * https://gist.github.com/dengqf6/7a9e9b4032d99f1a91dd9256c8a65c36
> > >
> > > Because of all of this this patch series tries to avoid random hangs of 
> > > boot
> > > trying to use the 'reset-gpios' approach.
> > >
> > > Changes are being tested by openwrt people and seems to work.
> > >
> > > Hope this helps.
> > >
> > > Changes in v4:
> > > * Make use of 'devm_gpiod_get_index_optional' instead of 
> > > 'devm_gpiod_get_index'.
> > > * Use 'dev_err' instead of 'dev_notice' and return ERR_PTR if
> > > 'devm_gpiod_get_index_optional' fails.
> > > * Rename pers dealy macro to PERST_DELAY_MS.
> > > * Add new patch 6 which removes function 'mt7621_reset_port' not needed 
> > > anymore.
> >
> > Testing this v4 series always fails during boot with:
> >
> > ...
> > NET: Registered protocol family 17
> > NET: Registered protocol family 15
> > 8021q: 802.1Q VLAN Support v1.8
> > Loading compiled-in X.509 certificates
> > AppArmor: AppArmor sha1 policy hashing enabled
> >
> > rt2880-pinmux pinctrl: pcie is already enabled
> > mt7621-pci 1e14.pcie: Error applying setting, reverse things back
> > mt7621-pci 1e14.pcie: Failed to get GPIO for PCIe1
> > mt7621-pci 1e14.pcie: Parsing DT failed
> > mt7621-pci: probe of 1e14.pcie failed with error -16
>
> Looks like the gpio is valid but has been assigned to anything else.
> It looks like a device-tree issue for me.
> Does your hardware follows the indications of the mediatek application note?
>
> https://github.com/openwrt/openwrt/files/4317436/an-mt7621-pcie-application-note-v0.1.pdf
>
> To be able to test this you can just change the device tree and set
> reset gpios to only perst-reset pin
>
> reset-gpios = < 19 GPIO_ACTIVE_LOW>;
>
> or avoid the "return PTR_ERR(port->gpio_rst);" after the call to
> 'devm_gpiod_get_index_optional'.
>
> Or just make an exception if the pin is busy, which seems to be the
> problem here:

diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c
b/drivers/staging/mt7621-pci/pci-mt7621.c
index 13b272597442..767b10fce18f 100644
--- a/drivers/staging/mt7621-pci/pci-mt7621.c
+++ b/drivers/staging/mt7621-pci/pci-mt7621.c
@@ -369,7 +369,8 @@ static int mt7621_pcie_parse_port(struct mt7621_pcie *pcie,
   GPIOD_OUT_LOW);
if (IS_ERR(port->gpio_rst)) {
dev_err(dev, "Failed to get GPIO for PCIe%d\n", slot);
-   return PTR_ERR(port->gpio_rst);
+   if (PTR_ERR(port->gpio_rst) != -EBUSY)
+   return PTR_ERR(port->gpio_rst);
}

port->slot = slot;

>
> >
> > UBI error: cannot open mtd 3, error -19
> > hctosys: unable to open rtc device (rtc0)
> > cfg80211: Loading compiled-in X.509 certificates for regulatory database
> > cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
> > ...
> >
> > It never hangs, always boots up all the way. But always the same failure
> > with PCIe.

If it hangs it should hang on the pci initilization process...

>
> This series has been applied to the staging tree and are properly
> running for me in gnubee pc1.
>
> You should test using all confirmed changes in staging-next branch and
> this patch which fix a wrong register usage issue:
>
> http://driverdev.linuxdriverproject.org/pipermail/driverdev-devel/2020-March/142472.html
>
>
> >
> > Regards
> > Greg

Hope this helps.

Best regards,
Sergio Paracuellos
> >
> >
> >
> > > Changes in v3:
> > > * Avoid to fail if gpio descriptor fails on get.
> > > * re-do PATCH 1 commit message.
> > > * Take into account gpio low polarity on request and assert and deassert.
> > > * Review error path of driver to properly release gpio's resources.
> > >
> > > Changes in v2:
> > > * restore configuration for pers mode to GPIO.
> > > * Avoid to read 

Re: [PATCH v4 0/6] staging: mt7621-pci: re-do reset boot process

2020-03-19 Thread Sergio Paracuellos
Hi Greg,

On Thu, Mar 19, 2020 at 1:42 PM Greg Ungerer  wrote:
>
> Hi Sergio,
>
> On 14/3/20 6:09 am, Sergio Paracuellos wrote:
> > Some time ago Greg Ungerer reported some random hangs using
> > the staging mt7621-pci driver:
> >
> > See:
> > * 
> > http://driverdev.linuxdriverproject.org/pipermail/driverdev-devel/2019-June/134947.html
> >
> > Try to fix that is the main motivation of this patch series.
> >
> > Also in openwrt there is a driver for mt7621-pci which seems was rewritten
> > from scratch (for kernel 4.14) by Ryder Lee and Weijie Gao from mediatek.
> > There the approach for reset assert-deassert process is to set as 'gpio'
> > the function for all the 'pcie' group for the pinctrl driver and use those
> > gpio's as a reset for the end points. The driver I am talking about is still
> > using legacy pci and legacy gpio kernel interfaces. IMHO, the correct thing
> > to do is make this staging driver properly clean and functional and put it
> > in its correct place in the mainline.
> >
> > See:
> > * https://gist.github.com/dengqf6/7a9e9b4032d99f1a91dd9256c8a65c36
> >
> > Because of all of this this patch series tries to avoid random hangs of boot
> > trying to use the 'reset-gpios' approach.
> >
> > Changes are being tested by openwrt people and seems to work.
> >
> > Hope this helps.
> >
> > Changes in v4:
> > * Make use of 'devm_gpiod_get_index_optional' instead of 
> > 'devm_gpiod_get_index'.
> > * Use 'dev_err' instead of 'dev_notice' and return ERR_PTR if
> > 'devm_gpiod_get_index_optional' fails.
> > * Rename pers dealy macro to PERST_DELAY_MS.
> > * Add new patch 6 which removes function 'mt7621_reset_port' not needed 
> > anymore.
>
> Testing this v4 series always fails during boot with:
>
> ...
> NET: Registered protocol family 17
> NET: Registered protocol family 15
> 8021q: 802.1Q VLAN Support v1.8
> Loading compiled-in X.509 certificates
> AppArmor: AppArmor sha1 policy hashing enabled
>
> rt2880-pinmux pinctrl: pcie is already enabled
> mt7621-pci 1e14.pcie: Error applying setting, reverse things back
> mt7621-pci 1e14.pcie: Failed to get GPIO for PCIe1
> mt7621-pci 1e14.pcie: Parsing DT failed
> mt7621-pci: probe of 1e14.pcie failed with error -16

Looks like the gpio is valid but has been assigned to anything else.
It looks like a device-tree issue for me.
Does your hardware follows the indications of the mediatek application note?

https://github.com/openwrt/openwrt/files/4317436/an-mt7621-pcie-application-note-v0.1.pdf

To be able to test this you can just change the device tree and set
reset gpios to only perst-reset pin

reset-gpios = < 19 GPIO_ACTIVE_LOW>;

or avoid the "return PTR_ERR(port->gpio_rst);" after the call to
'devm_gpiod_get_index_optional'.

Or just make an exception if the pin is busy, which seems to be the
problem here:

>
> UBI error: cannot open mtd 3, error -19
> hctosys: unable to open rtc device (rtc0)
> cfg80211: Loading compiled-in X.509 certificates for regulatory database
> cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
> ...
>
> It never hangs, always boots up all the way. But always the same failure
> with PCIe.

This series has been applied to the staging tree and are properly
running for me in gnubee pc1.

You should test using all confirmed changes in staging-next branch and
this patch which fix a wrong register usage issue:

http://driverdev.linuxdriverproject.org/pipermail/driverdev-devel/2020-March/142472.html


>
> Regards
> Greg
>
>
>
> > Changes in v3:
> > * Avoid to fail if gpio descriptor fails on get.
> > * re-do PATCH 1 commit message.
> > * Take into account gpio low polarity on request and assert and deassert.
> > * Review error path of driver to properly release gpio's resources.
> >
> > Changes in v2:
> > * restore configuration for pers mode to GPIO.
> > * Avoid to read FTS_NUM register in reset state.
> > * Release gpio's patch added
> >
> > Best regards,
> >  Sergio Paracuellos
> >
> >
> > Sergio Paracuellos (6):
> >staging: mt7621-pci: use gpios for properly reset
> >staging: mt7621-pci: change value for 'PERST_DELAY_MS'
> >staging: mt7621-dts: make use of 'reset-gpios' property for pci
> >staging: mt7621-pci: bindings: update doc accordly to last changes
> >staging: mt7621-pci: release gpios after pci initialization
> >staging: mt7621-pci: delete no more needed 'mt7621_reset_port'
> >
> >   drivers/staging/mt7621-dts/mt7621.dtsi|  11 +-
> >   .../mt7621-pci/mediatek,mt7621-pci.txt|   7 +-
> >   drivers/staging/mt7621-pci/pci-mt7621.c   | 122 ++
> >   3 files changed, 82 insertions(+), 58 deletions(-)
> >
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v4 0/6] staging: mt7621-pci: re-do reset boot process

2020-03-19 Thread Greg Ungerer

Hi Sergio,

On 14/3/20 6:09 am, Sergio Paracuellos wrote:

Some time ago Greg Ungerer reported some random hangs using
the staging mt7621-pci driver:

See:
* 
http://driverdev.linuxdriverproject.org/pipermail/driverdev-devel/2019-June/134947.html

Try to fix that is the main motivation of this patch series.

Also in openwrt there is a driver for mt7621-pci which seems was rewritten
from scratch (for kernel 4.14) by Ryder Lee and Weijie Gao from mediatek.
There the approach for reset assert-deassert process is to set as 'gpio'
the function for all the 'pcie' group for the pinctrl driver and use those
gpio's as a reset for the end points. The driver I am talking about is still
using legacy pci and legacy gpio kernel interfaces. IMHO, the correct thing
to do is make this staging driver properly clean and functional and put it
in its correct place in the mainline.

See:
* https://gist.github.com/dengqf6/7a9e9b4032d99f1a91dd9256c8a65c36

Because of all of this this patch series tries to avoid random hangs of boot
trying to use the 'reset-gpios' approach.

Changes are being tested by openwrt people and seems to work.

Hope this helps.

Changes in v4:
* Make use of 'devm_gpiod_get_index_optional' instead of 'devm_gpiod_get_index'.
* Use 'dev_err' instead of 'dev_notice' and return ERR_PTR if
'devm_gpiod_get_index_optional' fails.
* Rename pers dealy macro to PERST_DELAY_MS.
* Add new patch 6 which removes function 'mt7621_reset_port' not needed anymore.


Testing this v4 series always fails during boot with:

...
NET: Registered protocol family 17
NET: Registered protocol family 15
8021q: 802.1Q VLAN Support v1.8
Loading compiled-in X.509 certificates
AppArmor: AppArmor sha1 policy hashing enabled

rt2880-pinmux pinctrl: pcie is already enabled
mt7621-pci 1e14.pcie: Error applying setting, reverse things back
mt7621-pci 1e14.pcie: Failed to get GPIO for PCIe1
mt7621-pci 1e14.pcie: Parsing DT failed
mt7621-pci: probe of 1e14.pcie failed with error -16

UBI error: cannot open mtd 3, error -19
hctosys: unable to open rtc device (rtc0)
cfg80211: Loading compiled-in X.509 certificates for regulatory database
cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
...

It never hangs, always boots up all the way. But always the same failure
with PCIe.

Regards
Greg




Changes in v3:
* Avoid to fail if gpio descriptor fails on get.
* re-do PATCH 1 commit message.
* Take into account gpio low polarity on request and assert and deassert.
* Review error path of driver to properly release gpio's resources.

Changes in v2:
* restore configuration for pers mode to GPIO.
* Avoid to read FTS_NUM register in reset state.
* Release gpio's patch added

Best regards,
 Sergio Paracuellos


Sergio Paracuellos (6):
   staging: mt7621-pci: use gpios for properly reset
   staging: mt7621-pci: change value for 'PERST_DELAY_MS'
   staging: mt7621-dts: make use of 'reset-gpios' property for pci
   staging: mt7621-pci: bindings: update doc accordly to last changes
   staging: mt7621-pci: release gpios after pci initialization
   staging: mt7621-pci: delete no more needed 'mt7621_reset_port'

  drivers/staging/mt7621-dts/mt7621.dtsi|  11 +-
  .../mt7621-pci/mediatek,mt7621-pci.txt|   7 +-
  drivers/staging/mt7621-pci/pci-mt7621.c   | 122 ++
  3 files changed, 82 insertions(+), 58 deletions(-)


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


[PATCH] staging: mt7621-pci: fix register to set up virtual bridges

2020-03-19 Thread Sergio Paracuellos
Instead of being using PCI Configuration and Status Register to
set up virtual bridges we are using CONFIG_ADDR Register which is
wrong. Hence, set the correct value.

Fixes: 9a5e71a68d20 ("staging: mt7621-pci: simplify 
'mt7621_pcie_init_virtual_bridges' function")
Signed-off-by: Sergio Paracuellos 
---
 drivers/staging/mt7621-pci/pci-mt7621.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c 
b/drivers/staging/mt7621-pci/pci-mt7621.c
index 7ef2099b01c5..2a01645162a5 100644
--- a/drivers/staging/mt7621-pci/pci-mt7621.c
+++ b/drivers/staging/mt7621-pci/pci-mt7621.c
@@ -603,7 +603,7 @@ static int mt7621_pcie_init_virtual_bridges(struct 
mt7621_pcie *pcie)
if ((pcie_link_status & BIT(i)) == 0)
p2p_br_devnum[i] = n++;
 
-   pcie_rmw(pcie, RALINK_PCI_CONFIG_ADDR,
+   pcie_rmw(pcie, RALINK_PCI_PCICFG_ADDR,
 PCIE_P2P_BR_DEVNUM_MASK_FULL,
 (p2p_br_devnum[0] << PCIE_P2P_BR_DEVNUM0_SHIFT) |
 (p2p_br_devnum[1] << PCIE_P2P_BR_DEVNUM1_SHIFT) |
-- 
2.25.1

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