Devicetree
 help / color / mirror / Atom feed
* Re: [PATCH v10 00/27] ARM: davinci: convert to common clock framework​
From: Sekhar Nori @ 2018-05-11 15:26 UTC (permalink / raw)
  To: David Lechner, linux-clk, devicetree, linux-arm-kernel
  Cc: Michael Turquette, Stephen Boyd, Rob Herring, Mark Rutland,
	Kevin Hilman, Bartosz Golaszewski, Adam Ford, linux-kernel
In-Reply-To: <20180509172606.29387-1-david@lechnology.com>

Hi David,

On Wednesday 09 May 2018 10:55 PM, David Lechner wrote:
> This series converts mach-davinci to use the common clock framework.
> 
> The series works like this, the first 3 patches fix some issues with the clock
> drivers that have already been accepted into the mainline kernel.

I have not yet looked at the patches, but I got a bunch of W=1 warnings 
and some sparse warnings when building your branch. Please take a look 
at these. Unfortunately the output is mixed between sparse and compiler.
The "expression using sizeof(void)" can be ignored as its a known issue
with sparse, I believe.

Thanks,
Sekhar

drivers/clk/davinci/pll-da830.c:39:5: warning: symbol 'da830_pll_init' was not declared. Should it be static?
drivers/clk/davinci/pll.c:142:16: warning: expression using sizeof(void)
drivers/clk/davinci/pll.c:142:16: warning: expression using sizeof(void)
drivers/clk/davinci/pll-da850.c:87:5: warning: symbol 'da850_pll0_init' was not declared. Should it be static?
drivers/clk/davinci/pll-da830.c:39:5: warning: no previous prototype for ‘da830_pll_init’ [-Wmissing-prototypes]
 int da830_pll_init(struct device *dev, void __iomem *base, struct regmap *cfgchip)
     ^~~~~~~~~~~~~~
drivers/clk/davinci/pll-da850.c:87:5: warning: no previous prototype for ‘da850_pll0_init’ [-Wmissing-prototypes]
 int da850_pll0_init(struct device *dev, void __iomem *base, struct regmap *cfgchip)
     ^~~~~~~~~~~~~~~
drivers/clk/davinci/pll-dm355.c:30:5: warning: symbol 'dm355_pll1_init' was not declared. Should it be static?
drivers/clk/davinci/pll-dm365.c:59:5: warning: symbol 'dm365_pll1_init' was not declared. Should it be static?
drivers/clk/davinci/pll-dm365.c:122:5: warning: symbol 'dm365_pll2_init' was not declared. Should it be static?
drivers/clk/davinci/da8xx-cfgchip.c:581: warning: Function parameter or member 'dev' not described in 'da8xx_cfgchip_register_usb1_clk48'
drivers/clk/davinci/pll-dm646x.c:32:5: warning: symbol 'dm646x_pll1_init' was not declared. Should it be static?
drivers/clk/davinci/pll-dm644x.c:30:5: warning: symbol 'dm644x_pll1_init' was not declared. Should it be static?
drivers/clk/davinci/pll-dm365.c:59:5: warning: no previous prototype for ‘dm365_pll1_init’ [-Wmissing-prototypes]
 int dm365_pll1_init(struct device *dev, void __iomem *base, struct regmap *cfgchip)
     ^~~~~~~~~~~~~~~
drivers/clk/davinci/pll-dm365.c:122:5: warning: no previous prototype for ‘dm365_pll2_init’ [-Wmissing-prototypes]
 int dm365_pll2_init(struct device *dev, void __iomem *base, struct regmap *cfgchip)
     ^~~~~~~~~~~~~~~
drivers/clk/davinci/pll-dm355.c:30:5: warning: no previous prototype for ‘dm355_pll1_init’ [-Wmissing-prototypes]
 int dm355_pll1_init(struct device *dev, void __iomem *base, struct regmap *cfgchip)
     ^~~~~~~~~~~~~~~
drivers/clk/davinci/psc.c:310:5: warning: symbol 'davinci_clk_reset_assert' was not declared. Should it be static?
drivers/clk/davinci/psc.c:316:5: warning: symbol 'davinci_clk_reset_deassert' was not declared. Should it be static?
drivers/clk/davinci/psc-dm644x.c:66:5: warning: symbol 'dm644x_psc_init' was not declared. Should it be static?
drivers/clk/davinci/psc-dm355.c:71:5: warning: symbol 'dm355_psc_init' was not declared. Should it be static?
drivers/clk/davinci/pll-dm646x.c:32:5: warning: no previous prototype for ‘dm646x_pll1_init’ [-Wmissing-prototypes]
 int dm646x_pll1_init(struct device *dev, void __iomem *base, struct regmap *cfgchip)
     ^~~~~~~~~~~~~~~~
drivers/clk/davinci/psc-dm365.c:76:5: warning: symbol 'dm365_psc_init' was not declared. Should it be static?
drivers/clk/davinci/psc-dm646x.c:61:5: warning: symbol 'dm646x_psc_init' was not declared. Should it be static?
drivers/clk/davinci/pll-dm644x.c:30:5: warning: no previous prototype for ‘dm644x_pll1_init’ [-Wmissing-prototypes]
 int dm644x_pll1_init(struct device *dev, void __iomem *base, struct regmap *cfgchip)
     ^~~~~~~~~~~~~~~~
drivers/clk/davinci/psc-dm355.c:71:5: warning: no previous prototype for ‘dm355_psc_init’ [-Wmissing-prototypes]
 int dm355_psc_init(struct device *dev, void __iomem *base)
     ^~~~~~~~~~~~~~
In file included from drivers/clk/davinci/psc-dm355.c:15:0:
drivers/clk/davinci/psc-dm355.c:26:14: warning: ‘mcbsp0_clkdev’ defined but not used [-Wunused-const-variable=]
 LPSC_CLKDEV1(mcbsp0_clkdev,  NULL,  "davinci-mcbsp.0");
              ^
drivers/clk/davinci/psc.h:31:46: note: in definition of macro ‘LPSC_CLKDEV1’
 static const struct davinci_lpsc_clkdev_info n[] __initconst = { \
                                              ^
drivers/clk/davinci/psc-dm355.c:21:14: warning: ‘mcbsp1_clkdev’ defined but not used [-Wunused-const-variable=]
 LPSC_CLKDEV1(mcbsp1_clkdev,  NULL,  "davinci-mcbsp.1");
              ^
drivers/clk/davinci/psc.h:31:46: note: in definition of macro ‘LPSC_CLKDEV1’
 static const struct davinci_lpsc_clkdev_info n[] __initconst = { \
                                              ^
drivers/clk/davinci/psc-dm365.c:76:5: warning: no previous prototype for ‘dm365_psc_init’ [-Wmissing-prototypes]
 int dm365_psc_init(struct device *dev, void __iomem *base)
     ^~~~~~~~~~~~~~
drivers/clk/davinci/psc-dm646x.c:61:5: warning: no previous prototype for ‘dm646x_psc_init’ [-Wmissing-prototypes]
 int dm646x_psc_init(struct device *dev, void __iomem *base)
     ^~~~~~~~~~~~~~~
drivers/clk/davinci/psc-dm644x.c:66:5: warning: no previous prototype for ‘dm644x_psc_init’ [-Wmissing-prototypes]
 int dm644x_psc_init(struct device *dev, void __iomem *base)
     ^~~~~~~~~~~~~~~
drivers/clk/davinci/pll.c:496: warning: Function parameter or member 'dev' not described in 'davinci_pll_auxclk_register'
drivers/clk/davinci/psc.c:310:5: warning: no previous prototype for ‘davinci_clk_reset_assert’ [-Wmissing-prototypes]
 int davinci_clk_reset_assert(struct clk *clk)
     ^~~~~~~~~~~~~~~~~~~~~~~~
drivers/clk/davinci/psc.c:316:5: warning: no previous prototype for ‘davinci_clk_reset_deassert’ [-Wmissing-prototypes]
 int davinci_clk_reset_deassert(struct clk *clk)
     ^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/clk/davinci/pll.c:509: warning: Function parameter or member 'dev' not described in 'davinci_pll_sysclkbp_clk_register'
drivers/clk/davinci/pll.c:524: warning: Function parameter or member 'dev' not described in 'davinci_pll_obsclk_register'
drivers/clk/davinci/pll.c:605: warning: Function parameter or member 'dev' not described in 'davinci_pll_sysclk_register'

^ permalink raw reply

* Re: [PATCH] display: panel: Add KOE tx14d24vm1bpa display support (320x240)
From: Lukasz Majewski @ 2018-05-11 15:04 UTC (permalink / raw)
  To: Rob Herring, Thierry Reding
  Cc: Mark Rutland, David Airlie, dri-devel, devicetree,
	linux-kernel@vger.kernel.org
In-Reply-To: <CAL_JsqLHwOv5+yoJ8S+74TmA2nUxzohhAkksZtrBCK7CAnp46A@mail.gmail.com>

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

Hi Rob, Thierry

> On Fri, May 4, 2018 at 5:28 AM, Lukasz Majewski <lukma@denx.de> wrote:
> > Hi Rob,
> >  
> >> On Thu, Apr 12, 2018 at 04:37:15PM +0200, Lukasz Majewski wrote:  
> >> > This commit adds support for KOE's 5.7" display.
> >> >
> >> > Signed-off-by: Lukasz Majewski <lukma@denx.de>
> >> > ---
> >> >  .../bindings/display/panel/koe,tx14d24vm1bpa.txt   | 42
> >> > ++++++++++++++++++++++
> >> > drivers/gpu/drm/panel/panel-simple.c               | 26
> >> > ++++++++++++++ 2 files changed, 68 insertions(+) create mode
> >> > 100644
> >> > Documentation/devicetree/bindings/display/panel/koe,tx14d24vm1bpa.txt  
> >>
> >> Reviewed-by: Rob Herring <robh@kernel.org>
> >>  
> >
> > Gentle ping on this - as I don't know if this patch been applied.  
> 
> This should go thru DRM tree via Thierry.

Would it be possible to pull this patch along with:
[PATCH v3] display: panel: Add AUO g070vvn01 display support (800x480)

To your -next tree (as we are now with -rc4) ?

> 
> Rob


Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply

* Re: [PATCH v2 03/12] arm: dts: mt7623: fix invalid memory node being generated
From: Matthias Brugger @ 2018-05-11 15:03 UTC (permalink / raw)
  To: sean.wang, robh+dt, mark.rutland, devicetree, linux-mediatek
  Cc: linux-arm-kernel, linux-kernel, stable
In-Reply-To: <d887b72e1839c7e476179e384cfc712216096f20.1523434758.git.sean.wang@mediatek.com>



On 04/11/2018 10:53 AM, sean.wang@mediatek.com wrote:
> From: Sean Wang <sean.wang@mediatek.com>
> 
> Below two wrong nodes in existing DTS files would cause a fail boot since
> in fact the address 0 is not the correct place the memory device locates
> at.
> 
> memory {
>         device_type = "memory";
>         reg = <0x0 0x0 0x0 0x0>;
> };
> 
> memory@80000000 {
>         reg = <0x0 0x80000000 0x0 0x40000000>;
> };
> 
> In order to avoid having a memory node starting at address 0, we can't
> include file skeleton64.dtsi and instead need to explicitly manually
> define a few of properties the DTS relies on such as #address-cells
> and #size-cells in root node and device_type in the node memory@80000000.
> 
> Cc: stable@vger.kernel.org
> Fixes: 31ac0d69a1d4 ("ARM: dts: mediatek: add MT7623 basic support")
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
> Cc: Rob Herring <robh+dt@kernel.org>
> ---
>  arch/arm/boot/dts/mt7623.dtsi                 | 3 ++-
>  arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts | 1 +
>  arch/arm/boot/dts/mt7623n-rfb.dtsi            | 1 +
>  3 files changed, 4 insertions(+), 1 deletion(-)
> 

merged. We would need this at least for mt2701 as well, correct?
Would you mind to provide a patch.

Regards,
Matthias

> diff --git a/arch/arm/boot/dts/mt7623.dtsi b/arch/arm/boot/dts/mt7623.dtsi
> index fec4715..406a9f3 100644
> --- a/arch/arm/boot/dts/mt7623.dtsi
> +++ b/arch/arm/boot/dts/mt7623.dtsi
> @@ -15,11 +15,12 @@
>  #include <dt-bindings/phy/phy.h>
>  #include <dt-bindings/reset/mt2701-resets.h>
>  #include <dt-bindings/thermal/thermal.h>
> -#include "skeleton64.dtsi"
>  
>  / {
>  	compatible = "mediatek,mt7623";
>  	interrupt-parent = <&sysirq>;
> +	#address-cells = <2>;
> +	#size-cells = <2>;
>  
>  	cpu_opp_table: opp-table {
>  		compatible = "operating-points-v2";
> diff --git a/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts b/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts
> index bbf56f8..5938e4c 100644
> --- a/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts
> +++ b/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts
> @@ -109,6 +109,7 @@
>  	};
>  
>  	memory@80000000 {
> +		device_type = "memory";
>  		reg = <0 0x80000000 0 0x40000000>;
>  	};
>  };
> diff --git a/arch/arm/boot/dts/mt7623n-rfb.dtsi b/arch/arm/boot/dts/mt7623n-rfb.dtsi
> index a199ae7..343e8ef 100644
> --- a/arch/arm/boot/dts/mt7623n-rfb.dtsi
> +++ b/arch/arm/boot/dts/mt7623n-rfb.dtsi
> @@ -40,6 +40,7 @@
>  	};
>  
>  	memory@80000000 {
> +		device_type = "memory";
>  		reg = <0 0x80000000 0 0x40000000>;
>  	};
>  
> 

^ permalink raw reply

* Re: [PATCH v2] arm64: allwinner: a64: Add Amarula A64 Relic initial support
From: Maxime Ripard @ 2018-05-11 14:57 UTC (permalink / raw)
  To: Jagan Teki
  Cc: Chen-Yu Tsai, Icenowy Zheng, devicetree, linux-arm-kernel,
	linux-kernel, linux-sunxi, Michael Trimarchi
In-Reply-To: <CAMty3ZCM7Sxsp4MwDRYq9NSfWJfj6XKK6JN9DKyk91MNrLvPAg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

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

On Fri, May 11, 2018 at 11:37:04AM +0530, Jagan Teki wrote:
> On Fri, May 11, 2018 at 11:20 AM, Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org> wrote:
> > On Thu, May 10, 2018 at 10:43 PM, Jagan Teki <jagan-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/@public.gmane.org> wrote:
> >> Amarula A64 Relic is Allwinner A64 based IoT device, which support
> >> - Allwinner A64 Cortex-A53
> >> - Mali-400MP2 GPU
> >> - AXP803 PMIC
> >> - 1GB DDR3 RAM
> >> - 8GB eMMC
> >> - AP6330 Wifi/BLE
> >> - MIPI-DSI
> >> - CSI: OV5640 sensor
> >> - USB OTG
> >> - 12V DC power supply
> >>
> >> Signed-off-by: Jagan Teki <jagan-dyjBcgdgk7Pe9wHmmfpqLFaTQe2KTcn/@public.gmane.org>
> >> ---
> >> Changes for v2:
> >> - Rename dts name to sun50i-a64-relic.dts which is simple to use
> >
> > This is subjective. For other users this hardly qualifies to
> > identify the board. Please keep the vendor / brand name in
> > the file name.
> 
> Which I thought initially, but adding vendor makes long string which
> become lengthy for next boards to add it in future. So we make
> notation with <SOC_name>_<board_name> like sun50i-a64-teres-i.dts
> does.

In the case of Teres-I, this is an easily identifiable board, for
which a simple google search can give you very easily what board it is
and where you can get it. Yours fail for both, so I agree with Chen-Yu
here.

Maxime

-- 
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply

* Re: [PATCH v3 5/8] MIPS: jz4740: dts: Add bindings for the jz4740-wdt driver
From: James Hogan @ 2018-05-11 14:52 UTC (permalink / raw)
  To: Paul Cercueil
  Cc: Guenter Roeck, Rob Herring, Mark Rutland, Ralf Baechle,
	Wim Van Sebroeck, Mathieu Malaterre, linux-watchdog, devicetree,
	linux-kernel, linux-mips
In-Reply-To: <20180510184751.13416-5-paul@crapouillou.net>

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

On Thu, May 10, 2018 at 08:47:48PM +0200, Paul Cercueil wrote:
> Also remove the watchdog platform_device from platform.c, since it
> wasn't used anywhere anyway.

Nit: it'd be slightly nicer IMO if the patch body was a superset of the
subject line. It's fine to repeat what the subject says since thats
meant to summarise the body.

> -struct platform_device jz4740_wdt_device = {

There's an extern in arch/mips/include/asm/mach-jz4740/platform.h that
should perhaps be removed also?

Otherwise
Acked-by: James Hogan <jhogan@kernel.org>

I'm happy to apply for 4.18 with that change if you want it to go
through the MIPS tree.

Cheers
James

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply

* Re: [PATCH v4 3/3] ARM: dts: sun7i: Add support for the Ainol AW1 tablet
From: Maxime Ripard @ 2018-05-11 14:36 UTC (permalink / raw)
  To: Paul Kocialkowski
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw, Rob Herring, Mark Rutland,
	Chen-Yu Tsai, Thierry Reding, David Airlie
In-Reply-To: <20180507220413.21990-3-contact-W9ppeneeCTY@public.gmane.org>

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

On Tue, May 08, 2018 at 12:04:13AM +0200, Paul Kocialkowski wrote:
> +++ b/arch/arm/boot/dts/sun7i-a20-ainol-aw1.dts
> @@ -0,0 +1,297 @@
> +/*
> + * SPDX-License-Identifier: (GPL-2.0+ OR MIT)

This really should be the first line, and with a C++ style comment, as
in:

// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * Copyright (C) ...

See Documentation/process/license-rules.rst

> +	backlight: backlight {
> +		compatible = "pwm-backlight";
> +		pwms = <&pwm 0 50000 PWM_POLARITY_INVERTED>;
> +		brightness-levels = <  0   1   1   1   1   2   2   2
> +				       2   3   3   3   3   4   4   4
> +				       5   5   5   6   6   6   7   7
> +				       8   8   8   9   9   9  10  10
> +				      10  11  11  12  12  12  13  13
> +				      14  14  14  15  15  16  16  17
> +				      17  17  18  18  19  19  20  20
> +				      21  21  21  22  22  23  23  24
> +				      24  25  25  26  26  27  27  28
> +				      28  29  30  30  31  31  32  32
> +				      33  33  34  35  35  36  36  37
> +				      38  38  39  39  40  41  41  42
> +				      43  43  44  44  45  46  47  47
> +				      48  49  49  50  51  51  52  53
> +				      54  54  55  56  57  57  58  59
> +				      60  61  61  62  63  64  65  65
> +				      66  67  68  69  70  71  71  72
> +				      73  74  75  76  77  78  79  80
> +				      81  82  83  84  85  86  87  88
> +				      89  90  91  92  93  94  95  96
> +				      97  98  99 101 102 103 104 105
> +				     106 108 109 110 111 112 114 115
> +				     116 117 119 120 121 123 124 125
> +				     127 128 129 131 132 133 135 136
> +				     138 139 141 142 144 145 147 148
> +				     150 151 153 154 156 157 159 161
> +				     162 164 166 167 169 171 173 174
> +				     176 178 180 181 183 185 187 189
> +				     191 192 194 196 198 200 202 204
> +				     206 208 210 212 214 216 219 221
> +				     223 225 227 229 232 234 236 238
> +				     241 242 244 246 248 250 253 255>;

You kind of overdid it here :)

What I meant to say before was that if you have 10 elements (and you
really should have something in that magnitude) each step should
increase the perceived brightness by 10%.

In this particular case, I really think having something close to <0 4
8 16 32 64 128 255> would be enough.

And in general, that kind of odd looking table without any more
context is just screaming for a comment :)

Maxime

-- 
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply

* [PATCH v3] Input: add bu21029 touch driver
From: Mark Jonas @ 2018-05-11 14:22 UTC (permalink / raw)
  To: Dmitry Torokhov, Rob Herring, Mark Rutland
  Cc: linux-input, devicetree, linux-kernel, hs, Zhu Yi, Mark Jonas
In-Reply-To: <1521651874-15379-1-git-send-email-mark.jonas@de.bosch.com>

From: Zhu Yi <yi.zhu5@cn.bosch.com>

Add Rohm BU21029 resistive touch panel controller support with I2C
interface.

Signed-off-by: Zhu Yi <yi.zhu5@cn.bosch.com>
Signed-off-by: Mark Jonas <mark.jonas@de.bosch.com>
Reviewed-by: Heiko Schocher <hs@denx.de>
Reviewed-by: Rob Herring <robh@kernel.org>
---
Changes in v3:
 - reviewed by Rob Herring
---
Changes in v2:
 - make ABS_PRESSURE proportionally rising with finger pressure
 - fix race between interrupt and timer during shutdown
 - use infrastructure from include/linux/input/touchscreen.h
 - add SPDX tag for the driver
 - improve binding documentation
 - fix multi-line comments
---
 .../bindings/input/touchscreen/bu21029.txt         |  34 ++
 drivers/input/touchscreen/Kconfig                  |  12 +
 drivers/input/touchscreen/Makefile                 |   1 +
 drivers/input/touchscreen/bu21029_ts.c             | 485 +++++++++++++++++++++
 4 files changed, 532 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/touchscreen/bu21029.txt
 create mode 100644 drivers/input/touchscreen/bu21029_ts.c

diff --git a/Documentation/devicetree/bindings/input/touchscreen/bu21029.txt b/Documentation/devicetree/bindings/input/touchscreen/bu21029.txt
new file mode 100644
index 0000000..030a888
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/touchscreen/bu21029.txt
@@ -0,0 +1,34 @@
+* Rohm BU21029 Touch Screen Controller
+
+Required properties:
+ - compatible              : must be "rohm,bu21029"
+ - reg                     : i2c device address of the chip (0x40 or 0x41)
+ - interrupt-parent        : the phandle for the gpio controller
+ - interrupts              : (gpio) interrupt to which the chip is connected
+ - reset-gpios             : gpio pin to reset the chip (active low)
+ - rohm,x-plate-ohms       : x-plate resistance in Ohm
+
+Optional properties:
+ - touchscreen-size-x      : horizontal resolution of touchscreen (in pixels)
+ - touchscreen-size-y      : vertical resolution of touchscreen (in pixels)
+ - touchscreen-max-pressure: maximum pressure value
+
+Example:
+
+	&i2c1 {
+		/* ... */
+
+		bu21029: bu21029@40 {
+			compatible = "rohm,bu21029";
+			reg = <0x40>;
+			interrupt-parent = <&gpio1>;
+			interrupts = <4 IRQ_TYPE_EDGE_FALLING>;
+			reset-gpios = <&gpio6 16 GPIO_ACTIVE_LOW>;
+			rohm,x-plate-ohms = <600>;
+			touchscreen-size-x = <800>;
+			touchscreen-size-y = <480>;
+			touchscreen-max-pressure = <4095>;
+		};
+
+		/* ... */
+	};
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
index 4f15496..e09fe8f 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -151,6 +151,18 @@ config TOUCHSCREEN_BU21013
 	  To compile this driver as a module, choose M here: the
 	  module will be called bu21013_ts.
 
+config TOUCHSCREEN_BU21029
+	tristate "Rohm BU21029 based touch panel controllers"
+	depends on I2C
+	help
+	  Say Y here if you have a Rohm BU21029 touchscreen controller
+	  connected to your system.
+
+	  If unsure, say N.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called bu21029_ts.
+
 config TOUCHSCREEN_CHIPONE_ICN8318
 	tristate "chipone icn8318 touchscreen controller"
 	depends on GPIOLIB || COMPILE_TEST
diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile
index dddae79..f50624c 100644
--- a/drivers/input/touchscreen/Makefile
+++ b/drivers/input/touchscreen/Makefile
@@ -18,6 +18,7 @@ obj-$(CONFIG_TOUCHSCREEN_AR1021_I2C)	+= ar1021_i2c.o
 obj-$(CONFIG_TOUCHSCREEN_ATMEL_MXT)	+= atmel_mxt_ts.o
 obj-$(CONFIG_TOUCHSCREEN_AUO_PIXCIR)	+= auo-pixcir-ts.o
 obj-$(CONFIG_TOUCHSCREEN_BU21013)	+= bu21013_ts.o
+obj-$(CONFIG_TOUCHSCREEN_BU21029)	+= bu21029_ts.o
 obj-$(CONFIG_TOUCHSCREEN_CHIPONE_ICN8318)	+= chipone_icn8318.o
 obj-$(CONFIG_TOUCHSCREEN_CY8CTMG110)	+= cy8ctmg110_ts.o
 obj-$(CONFIG_TOUCHSCREEN_CYTTSP_CORE)	+= cyttsp_core.o
diff --git a/drivers/input/touchscreen/bu21029_ts.c b/drivers/input/touchscreen/bu21029_ts.c
new file mode 100644
index 0000000..8d0cbe51
--- /dev/null
+++ b/drivers/input/touchscreen/bu21029_ts.c
@@ -0,0 +1,485 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Rohm BU21029 touchscreen controller driver
+ *
+ * Copyright (C) 2015-2018 Bosch Sicherheitssysteme GmbH
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/delay.h>
+#include <linux/gpio/consumer.h>
+#include <linux/i2c.h>
+#include <linux/input.h>
+#include <linux/input/touchscreen.h>
+#include <linux/interrupt.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/timer.h>
+
+/*
+ * HW_ID1 Register (PAGE=0, ADDR=0x0E, Reset value=0x02, Read only)
+ * +--------+--------+--------+--------+--------+--------+--------+--------+
+ * |   D7   |   D6   |   D5   |   D4   |   D3   |   D2   |   D1   |   D0   |
+ * +--------+--------+--------+--------+--------+--------+--------+--------+
+ * |                                 HW_IDH                                |
+ * +--------+--------+--------+--------+--------+--------+--------+--------+
+ * HW_ID2 Register (PAGE=0, ADDR=0x0F, Reset value=0x29, Read only)
+ * +--------+--------+--------+--------+--------+--------+--------+--------+
+ * |   D7   |   D6   |   D5   |   D4   |   D3   |   D2   |   D1   |   D0   |
+ * +--------+--------+--------+--------+--------+--------+--------+--------+
+ * |                                 HW_IDL                                |
+ * +--------+--------+--------+--------+--------+--------+--------+--------+
+ * HW_IDH: high 8bits of IC's ID
+ * HW_IDL: low  8bits of IC's ID
+ */
+#define BU21029_HWID_REG (0x0E << 3)
+#define SUPPORTED_HWID    0x0229
+
+/*
+ * CFR0 Register (PAGE=0, ADDR=0x00, Reset value=0x20)
+ * +--------+--------+--------+--------+--------+--------+--------+--------+
+ * |   D7   |   D6   |   D5   |   D4   |   D3   |   D2   |   D1   |   D0   |
+ * +--------+--------+--------+--------+--------+--------+--------+--------+
+ * |   0    |   0    |  CALIB |  INTRM |   0    |   0    |   0    |   0    |
+ * +--------+--------+--------+--------+--------+--------+--------+--------+
+ * CALIB: 0 = not to use calibration result (*)
+ *        1 = use calibration result
+ * INTRM: 0 = INT output depend on "pen down" (*)
+ *        1 = INT output always "0"
+ */
+#define BU21029_CFR0_REG (0x00 << 3)
+#define CFR0_VALUE        0x00
+
+/*
+ * CFR1 Register (PAGE=0, ADDR=0x01, Reset value=0xA6)
+ * +--------+--------+--------+--------+--------+--------+--------+--------+
+ * |   D7   |   D6   |   D5   |   D4   |   D3   |   D2   |   D1   |   D0   |
+ * +--------+--------+--------+--------+--------+--------+--------+--------+
+ * |  MAV   |         AVE[2:0]         |   0    |         SMPL[2:0]        |
+ * +--------+--------+--------+--------+--------+--------+--------+--------+
+ * MAV:  0 = median average filter off
+ *       1 = median average filter on (*)
+ * AVE:  AVE+1 = number of average samples for MAV,
+ *               if AVE>SMPL, then AVE=SMPL (=3)
+ * SMPL: SMPL+1 = number of conversion samples for MAV (=7)
+ */
+#define BU21029_CFR1_REG (0x01 << 3)
+#define CFR1_VALUE        0xA6
+
+/*
+ * CFR2 Register (PAGE=0, ADDR=0x02, Reset value=0x04)
+ * +--------+--------+--------+--------+--------+--------+--------+--------+
+ * |   D7   |   D6   |   D5   |   D4   |   D3   |   D2   |   D1   |   D0   |
+ * +--------+--------+--------+--------+--------+--------+--------+--------+
+ * |          INTVL_TIME[3:0]          |          TIME_ST_ADC[3:0]         |
+ * +--------+--------+--------+--------+--------+--------+--------+--------+
+ * INTVL_TIME: waiting time between completion of conversion
+ *             and start of next conversion, only usable in
+ *             autoscan mode (=20.480ms)
+ * TIME_ST_ADC: waiting time between application of voltage
+ *              to panel and start of A/D conversion (=100us)
+ */
+#define BU21029_CFR2_REG (0x02 << 3)
+#define CFR2_VALUE        0xC9
+
+/*
+ * CFR3 Register (PAGE=0, ADDR=0x0B, Reset value=0x72)
+ * +--------+--------+--------+--------+--------+--------+--------+--------+
+ * |   D7   |   D6   |   D5   |   D4   |   D3   |   D2   |   D1   |   D0   |
+ * +--------+--------+--------+--------+--------+--------+--------+--------+
+ * |  RM8   | STRETCH|  PU90K |  DUAL  |           PIDAC_OFS[3:0]          |
+ * +--------+--------+--------+--------+--------+--------+--------+--------+
+ * RM8: 0 = coordinate resolution is 12bit (*)
+ *      1 = coordinate resolution is 8bit
+ * STRETCH: 0 = SCL_STRETCH function off
+ *          1 = SCL_STRETCH function on (*)
+ * PU90K: 0 = internal pull-up resistance for touch detection is ~50kohms (*)
+ *        1 = internal pull-up resistance for touch detection is ~90kohms
+ * DUAL: 0 = dual touch detection off (*)
+ *       1 = dual touch detection on
+ * PIDAC_OFS: dual touch detection circuit adjustment, it is not necessary
+ *            to change this from initial value
+ */
+#define BU21029_CFR3_REG (0x0B << 3)
+#define CFR3_VALUE        0x42
+
+/*
+ * LDO Register (PAGE=0, ADDR=0x0C, Reset value=0x00)
+ * +--------+--------+--------+--------+--------+--------+--------+--------+
+ * |   D7   |   D6   |   D5   |   D4   |   D3   |   D2   |   D1   |   D0   |
+ * +--------+--------+--------+--------+--------+--------+--------+--------+
+ * |   0    |         PVDD[2:0]        |   0    |         AVDD[2:0]        |
+ * +--------+--------+--------+--------+--------+--------+--------+--------+
+ * PVDD: output voltage of panel output regulator (=2.000V)
+ * AVDD: output voltage of analog circuit regulator (=2.000V)
+ */
+#define BU21029_LDO_REG  (0x0C << 3)
+#define LDO_VALUE         0x77
+
+/*
+ * Serial Interface Command Byte 1 (CID=1)
+ * +--------+--------+--------+--------+--------+--------+--------+--------+
+ * |   D7   |   D6   |   D5   |   D4   |   D3   |   D2   |   D1   |   D0   |
+ * +--------+--------+--------+--------+--------+--------+--------+--------+
+ * |   1    |                 CF                |  CMSK  |  PDM   |  STP   |
+ * +--------+--------+--------+--------+--------+--------+--------+--------+
+ * CF: conversion function, see table 3 in datasheet p6 (=0000, automatic scan)
+ * CMSK: 0 = executes convert function (*)
+ *       1 = reads the convert result
+ * PDM: 0 = power down after convert function stops (*)
+ *      1 = keep power on after convert function stops
+ * STP: 1 = abort current conversion and power down, set to "0" automatically
+ */
+#define BU21029_AUTOSCAN  0x80
+
+/*
+ * The timeout value needs to be larger than INTVL_TIME + tConv4 (sample and
+ * conversion time), where tConv4 is calculated by formula:
+ * tPON + tDLY1 + (tTIME_ST_ADC + (tADC * tSMPL) * 2 + tDLY2) * 3
+ * see figure 8 in datasheet p15 for details of each field.
+ */
+#define PEN_UP_TIMEOUT msecs_to_jiffies(50)
+
+#define STOP_DELAY_US  50L
+#define START_DELAY_MS 2L
+#define BUF_LEN        8L
+#define SCALE_12BIT    (1 << 12)
+#define MAX_12BIT      ((1 << 12) - 1)
+#define DRIVER_NAME    "bu21029"
+
+struct bu21029_ts_data {
+	struct i2c_client            *client;
+	struct input_dev             *in_dev;
+	struct timer_list             timer;
+	struct gpio_desc             *reset_gpios;
+	u32                           x_plate_ohms;
+	struct touchscreen_properties prop;
+};
+
+static int bu21029_touch_report(struct bu21029_ts_data *bu21029)
+{
+	struct i2c_client *i2c = bu21029->client;
+	u8 buf[BUF_LEN];
+	u16 x, y, z1, z2;
+	u32 rz;
+	s32 max_pressure = bu21029->in_dev->absinfo[ABS_PRESSURE].maximum;
+
+	/* read touch data and deassert INT (by restarting the autoscan mode) */
+	int error = i2c_smbus_read_i2c_block_data(i2c,
+						  BU21029_AUTOSCAN,
+						  BUF_LEN,
+						  buf);
+	if (error < 0)
+		return error;
+
+	/*
+	 * compose upper 8 and lower 4 bits into a 12bit value:
+	 * +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
+	 * |            ByteH              |            ByteL              |
+	 * +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
+	 * |b07|b06|b05|b04|b03|b02|b01|b00|b07|b06|b05|b04|b03|b02|b01|b00|
+	 * +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
+	 * |v11|v10|v09|v08|v07|v06|v05|v04|v03|v02|v01|v00| 0 | 0 | 0 | 0 |
+	 * +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
+	 */
+	x  = (buf[0] << 4) | (buf[1] >> 4);
+	y  = (buf[2] << 4) | (buf[3] >> 4);
+	z1 = (buf[4] << 4) | (buf[5] >> 4);
+	z2 = (buf[6] << 4) | (buf[7] >> 4);
+
+	if (z1 == 0 || z2 == 0)
+		return 0;
+
+	/*
+	 * calculate Rz (pressure resistance value) by equation:
+	 * Rz = Rx * (x/Q) * ((z2/z1) - 1), where
+	 * Rx is x-plate resistance,
+	 * Q  is the touch screen resolution (8bit = 256, 12bit = 4096)
+	 * x, z1, z2 are the measured positions.
+	 */
+	rz  = z2 - z1;
+	rz *= x;
+	rz *= bu21029->x_plate_ohms;
+	rz /= z1;
+	rz  = DIV_ROUND_CLOSEST(rz, SCALE_12BIT);
+	if (rz <= max_pressure) {
+		touchscreen_report_pos(bu21029->in_dev, &bu21029->prop,
+				       x, y, false);
+		input_report_abs(bu21029->in_dev, ABS_PRESSURE,
+				 max_pressure - rz);
+		input_report_key(bu21029->in_dev, BTN_TOUCH, 1);
+		input_sync(bu21029->in_dev);
+	}
+
+	return 0;
+}
+
+static void bu21029_touch_release(struct timer_list *t)
+{
+	struct bu21029_ts_data *bu21029 = from_timer(bu21029, t, timer);
+
+	input_report_abs(bu21029->in_dev, ABS_PRESSURE, 0);
+	input_report_key(bu21029->in_dev, BTN_TOUCH, 0);
+	input_sync(bu21029->in_dev);
+}
+
+static irqreturn_t bu21029_touch_soft_irq(int irq, void *data)
+{
+	struct bu21029_ts_data *bu21029 = data;
+	struct i2c_client *i2c = bu21029->client;
+
+	/*
+	 * report touch and deassert interrupt (will assert again after
+	 * INTVL_TIME + tConv4 for continuous touch)
+	 */
+	int error = bu21029_touch_report(bu21029);
+
+	if (error) {
+		dev_err(&i2c->dev, "failed to report (error: %d)\n", error);
+		return IRQ_NONE;
+	}
+
+	/* reset timer for pen up detection */
+	mod_timer(&bu21029->timer, jiffies + PEN_UP_TIMEOUT);
+
+	return IRQ_HANDLED;
+}
+
+static void bu21029_stop_chip(struct input_dev *dev)
+{
+	struct bu21029_ts_data *bu21029 = input_get_drvdata(dev);
+
+	disable_irq(bu21029->client->irq);
+	del_timer_sync(&bu21029->timer);
+
+	/* put chip into reset */
+	gpiod_set_value_cansleep(bu21029->reset_gpios, 1);
+	udelay(STOP_DELAY_US);
+}
+
+static int bu21029_start_chip(struct input_dev *dev)
+{
+	struct bu21029_ts_data *bu21029 = input_get_drvdata(dev);
+	struct i2c_client *i2c = bu21029->client;
+	struct {
+		u8 reg;
+		u8 value;
+	} init_table[] = {
+		{BU21029_CFR0_REG, CFR0_VALUE},
+		{BU21029_CFR1_REG, CFR1_VALUE},
+		{BU21029_CFR2_REG, CFR2_VALUE},
+		{BU21029_CFR3_REG, CFR3_VALUE},
+		{BU21029_LDO_REG,  LDO_VALUE}
+	};
+	int error, i;
+	u16 hwid;
+
+	/* take chip out of reset */
+	gpiod_set_value_cansleep(bu21029->reset_gpios, 0);
+	mdelay(START_DELAY_MS);
+
+	error = i2c_smbus_read_i2c_block_data(i2c,
+					      BU21029_HWID_REG,
+					      2,
+					      (u8 *)&hwid);
+	if (error < 0) {
+		dev_err(&i2c->dev, "failed to read HW ID\n");
+		goto out;
+	}
+
+	if (cpu_to_be16(hwid) != SUPPORTED_HWID) {
+		dev_err(&i2c->dev, "unsupported HW ID 0x%x\n", hwid);
+		error = -ENODEV;
+		goto out;
+	}
+
+	for (i = 0; i < ARRAY_SIZE(init_table); ++i) {
+		error = i2c_smbus_write_byte_data(i2c,
+						  init_table[i].reg,
+						  init_table[i].value);
+		if (error < 0) {
+			dev_err(&i2c->dev,
+				"failed to write 0x%x to register 0x%x\n",
+				init_table[i].value,
+				init_table[i].reg);
+			goto out;
+		}
+	}
+
+	error = i2c_smbus_write_byte(i2c, BU21029_AUTOSCAN);
+	if (error < 0) {
+		dev_err(&i2c->dev, "failed to start autoscan\n");
+		goto out;
+	}
+
+	enable_irq(bu21029->client->irq);
+	return 0;
+
+out:
+	bu21029_stop_chip(dev);
+	return error;
+}
+
+static int bu21029_parse_dt(struct bu21029_ts_data *bu21029)
+{
+	struct device *dev = &bu21029->client->dev;
+	struct device_node *np = dev->of_node;
+	u32 val32;
+	int error;
+
+	if (!np) {
+		dev_err(dev, "no device tree data\n");
+		return -EINVAL;
+	}
+
+	bu21029->reset_gpios = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH);
+	if (IS_ERR(bu21029->reset_gpios)) {
+		error = PTR_ERR(bu21029->reset_gpios);
+		if (error != -EPROBE_DEFER)
+			dev_err(dev, "invalid 'reset-gpios':%d\n", error);
+		return error;
+	}
+
+	if (of_property_read_u32(np, "rohm,x-plate-ohms", &val32)) {
+		dev_err(dev, "invalid 'x-plate-ohms' supplied\n");
+		return -EINVAL;
+	}
+	bu21029->x_plate_ohms = val32;
+
+	touchscreen_parse_properties(bu21029->in_dev, false, &bu21029->prop);
+
+	return 0;
+}
+
+static int bu21029_probe(struct i2c_client *client,
+			 const struct i2c_device_id *id)
+{
+	struct bu21029_ts_data *bu21029;
+	struct input_dev *in_dev;
+	int error;
+
+	if (!i2c_check_functionality(client->adapter,
+				     I2C_FUNC_SMBUS_WRITE_BYTE |
+				     I2C_FUNC_SMBUS_WRITE_BYTE_DATA |
+				     I2C_FUNC_SMBUS_READ_I2C_BLOCK)) {
+		dev_err(&client->dev,
+			"i2c functionality support is not sufficient\n");
+		return -EIO;
+	}
+
+	bu21029 = devm_kzalloc(&client->dev, sizeof(*bu21029), GFP_KERNEL);
+	if (!bu21029)
+		return -ENOMEM;
+
+	in_dev = devm_input_allocate_device(&client->dev);
+	if (!in_dev) {
+		dev_err(&client->dev, "unable to allocate input device\n");
+		return -ENOMEM;
+	}
+
+	bu21029->client = client;
+	bu21029->in_dev	= in_dev;
+	timer_setup(&bu21029->timer, bu21029_touch_release, 0);
+
+	in_dev->name       = DRIVER_NAME;
+	in_dev->id.bustype = BUS_I2C;
+	in_dev->open       = bu21029_start_chip;
+	in_dev->close      = bu21029_stop_chip;
+
+	input_set_capability(in_dev, EV_KEY, BTN_TOUCH);
+	input_set_abs_params(in_dev, ABS_X, 0, MAX_12BIT, 0, 0);
+	input_set_abs_params(in_dev, ABS_Y, 0, MAX_12BIT, 0, 0);
+	input_set_abs_params(in_dev, ABS_PRESSURE, 0, MAX_12BIT, 0, 0);
+
+	error = bu21029_parse_dt(bu21029);
+	if (error)
+		return error;
+
+	input_set_drvdata(in_dev, bu21029);
+
+	error = devm_request_threaded_irq(&client->dev,
+					  client->irq,
+					  NULL,
+					  bu21029_touch_soft_irq,
+					  IRQF_ONESHOT,
+					  DRIVER_NAME,
+					  bu21029);
+	if (error) {
+		dev_err(&client->dev, "unable to request touch irq\n");
+		return error;
+	}
+
+	bu21029_stop_chip(in_dev);
+
+	error = input_register_device(in_dev);
+	if (error) {
+		dev_err(&client->dev, "unable to register input device\n");
+		return error;
+	}
+
+	i2c_set_clientdata(client, bu21029);
+
+	return 0;
+}
+
+static int bu21029_remove(struct i2c_client *client)
+{
+	struct bu21029_ts_data *bu21029 = i2c_get_clientdata(client);
+
+	bu21029_stop_chip(bu21029->in_dev);
+
+	return 0;
+}
+
+#ifdef CONFIG_PM_SLEEP
+static int bu21029_suspend(struct device *dev)
+{
+	struct i2c_client *i2c = to_i2c_client(dev);
+	struct bu21029_ts_data *bu21029 = i2c_get_clientdata(i2c);
+
+	mutex_lock(&bu21029->in_dev->mutex);
+	if (bu21029->in_dev->users)
+		bu21029_stop_chip(bu21029->in_dev);
+	mutex_unlock(&bu21029->in_dev->mutex);
+
+	return 0;
+}
+
+static int bu21029_resume(struct device *dev)
+{
+	struct i2c_client *i2c = to_i2c_client(dev);
+	struct bu21029_ts_data *bu21029 = i2c_get_clientdata(i2c);
+
+	mutex_lock(&bu21029->in_dev->mutex);
+	if (bu21029->in_dev->users)
+		bu21029_start_chip(bu21029->in_dev);
+	mutex_unlock(&bu21029->in_dev->mutex);
+
+	return 0;
+}
+#endif
+static SIMPLE_DEV_PM_OPS(bu21029_pm_ops, bu21029_suspend, bu21029_resume);
+
+static const struct i2c_device_id bu21029_ids[] = {
+	{DRIVER_NAME, 0},
+	{}
+};
+MODULE_DEVICE_TABLE(i2c, bu21029_ids);
+
+static struct i2c_driver bu21029_driver = {
+	.driver = {
+		.name = DRIVER_NAME,
+		.pm   = &bu21029_pm_ops,
+	},
+	.id_table = bu21029_ids,
+	.probe    = bu21029_probe,
+	.remove   = bu21029_remove,
+};
+module_i2c_driver(bu21029_driver);
+
+MODULE_AUTHOR("Zhu Yi <yi.zhu5@cn.bosch.com>");
+MODULE_DESCRIPTION("Rohm BU21029 touchscreen controller driver");
+MODULE_LICENSE("GPL v2");
-- 
2.7.4

^ permalink raw reply related

* Re: [PATCH v11 1/3] PCI: mobiveil: Add Mobiveil PCIe Host Bridge IP driver DT bindings
From: Lorenzo Pieralisi @ 2018-05-11 14:19 UTC (permalink / raw)
  To: Subrahmanya Lingappa
  Cc: linux-pci, bhelgaas, marc.zyngier, mingkai.hu, peter.newton,
	minghuan.lian, rajesh.raina, rajan.kapoor, prabhjot.singh,
	devicetree
In-Reply-To: <1525926893-29135-1-git-send-email-l.subrahmanya@mobiveil.co.in>

On Thu, May 10, 2018 at 12:34:53AM -0400, Subrahmanya Lingappa wrote:
> This patch adds the DT bindings for Mobiveil PCIe Host Bridge
> IP driver and updates the vendor prefixes file.
> 
> Signed-off-by: Subrahmanya Lingappa <l.subrahmanya@mobiveil.co.in>
> Acked-by: Rob Herring <robh@kernel.org>
> Cc: Bjorn Helgaas <bhelgaas@google.com>
> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> Cc: linux-pci@vger.kernel.org
> Cc: devicetree@vger.kernel.org
> ---
>  .../devicetree/bindings/pci/mobiveil-pcie.txt      | 73 ++++++++++++++++++++++
>  .../devicetree/bindings/vendor-prefixes.txt        |  1 +
>  MAINTAINERS                                        |  7 +++
>  3 files changed, 81 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/pci/mobiveil-pcie.txt

I have applied the series to pci/mobiveil for v4.18.

Thanks,
Lorenzo

> diff --git a/Documentation/devicetree/bindings/pci/mobiveil-pcie.txt b/Documentation/devicetree/bindings/pci/mobiveil-pcie.txt
> new file mode 100644
> index 0000000..65038aa
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/pci/mobiveil-pcie.txt
> @@ -0,0 +1,73 @@
> +* Mobiveil AXI PCIe Root Port Bridge DT description
> +
> +Mobiveil's GPEX 4.0 is a PCIe Gen4 root port bridge IP. This configurable IP
> +has up to 8 outbound and inbound windows for the address translation.
> +
> +Required properties:
> +- #address-cells: Address representation for root ports, set to <3>
> +- #size-cells: Size representation for root ports, set to <2>
> +- #interrupt-cells: specifies the number of cells needed to encode an
> +	interrupt source. The value must be 1.
> +- compatible: Should contain "mbvl,gpex40-pcie"
> +- reg: Should contain PCIe registers location and length
> +	"config_axi_slave": PCIe controller registers
> +	"csr_axi_slave"	  : Bridge config registers
> +	"gpio_slave"	  : GPIO registers to control slot power
> +	"apb_csr"	  : MSI registers
> +
> +- device_type: must be "pci"
> +- apio-wins : number of requested apio outbound windows
> +		default 2 outbound windows are configured -
> +		1. Config window
> +		2. Memory window
> +- ppio-wins : number of requested ppio inbound windows
> +		default 1 inbound memory window is configured.
> +- bus-range: PCI bus numbers covered
> +- interrupt-controller: identifies the node as an interrupt controller
> +- #interrupt-cells: specifies the number of cells needed to encode an
> +	interrupt source. The value must be 1.
> +- interrupt-parent : phandle to the interrupt controller that
> +		it is attached to, it should be set to gic to point to
> +		ARM's Generic Interrupt Controller node in system DT.
> +- interrupts: The interrupt line of the PCIe controller
> +		last cell of this field is set to 4 to
> +		denote it as IRQ_TYPE_LEVEL_HIGH type interrupt.
> +- interrupt-map-mask,
> +	interrupt-map: standard PCI properties to define the mapping of the
> +	PCI interface to interrupt numbers.
> +- ranges: ranges for the PCI memory regions (I/O space region is not
> +	supported by hardware)
> +	Please refer to the standard PCI bus binding document for a more
> +	detailed explanation
> +
> +
> +Example:
> +++++++++
> +	pcie0: pcie@a0000000 {
> +		#address-cells = <3>;
> +		#size-cells = <2>;
> +		compatible = "mbvl,gpex40-pcie";
> +		reg =	<0xa0000000 0x00001000>,
> +			<0xb0000000 0x00010000>,
> +			<0xff000000 0x00200000>,
> +			<0xb0010000 0x00001000>;
> +		reg-names =	"config_axi_slave",
> +				"csr_axi_slave",
> +				"gpio_slave",
> +				"apb_csr";
> +		device_type = "pci";
> +		apio-wins = <2>;
> +		ppio-wins = <1>;
> +		bus-range = <0x00000000 0x000000ff>;
> +		interrupt-controller;
> +		interrupt-parent = <&gic>;
> +		#interrupt-cells = <1>;
> +		interrupts = < 0 89 4 >;
> +		interrupt-map-mask = <0 0 0 7>;
> +		interrupt-map = <0 0 0 0 &pci_express 0>,
> +				<0 0 0 1 &pci_express 1>,
> +				<0 0 0 2 &pci_express 2>,
> +				<0 0 0 3 &pci_express 3>;
> +		ranges = < 0x83000000 0 0x00000000 0xa8000000 0 0x8000000>;
> +
> +	};
> diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt b/Documentation/devicetree/bindings/vendor-prefixes.txt
> index 0994bdd..8263cc7 100644
> --- a/Documentation/devicetree/bindings/vendor-prefixes.txt
> +++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
> @@ -197,6 +197,7 @@ lwn	Liebherr-Werk Nenzing GmbH
>  macnica	Macnica Americas
>  marvell	Marvell Technology Group Ltd.
>  maxim	Maxim Integrated Products
> +mbvl	Mobiveil Inc.
>  mcube	mCube
>  meas	Measurement Specialties
>  mediatek	MediaTek Inc.
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 44512c3..b295080 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -9162,6 +9162,13 @@ Q:	http://patchwork.linuxtv.org/project/linux-media/list/
>  S:	Maintained
>  F:	drivers/media/dvb-frontends/mn88473*
>  
> +PCI DRIVER FOR MOBIVEIL PCIE IP
> +M:	Subrahmanya Lingappa <l.subrahmanya@mobiveil.co.in>
> +L:	linux-pci@vger.kernel.org
> +S:	Supported
> +F:	Documentation/devicetree/bindings/pci/mobiveil-pcie.txt
> +F:	drivers/pci/host/pcie-mobiveil.c
> +
>  MODULE SUPPORT
>  M:	Jessica Yu <jeyu@kernel.org>
>  M:	Rusty Russell <rusty@rustcorp.com.au>
> -- 
> 1.8.3.1
> 

^ permalink raw reply

* Re: [PATCH v3 2/2] arm64: dts: hi3660: Add pcie msi interrupt attribute
From: Wei Xu @ 2018-05-11 14:09 UTC (permalink / raw)
  To: Yao Chen, songxiaowei, wangbinghui, lorenzo.pieralisi, bhelgaas,
	robh+dt, mark.rutland, catalin.marinas, will.deacon, linux-pci,
	linux-kernel, linux-arm-kernel, devicetree
  Cc: dimitrysh, guodong.xu, suzhuangluan, kongfei, xuwei5
In-Reply-To: <1526030149-23985-3-git-send-email-chenyao11@huawei.com>

Hi Yao,

On 2018/5/11 10:15, Yao Chen wrote:
> Add pcie msi interrupt attribute for hi3660 SOC.
> 
> Signed-off-by: Yao Chen <chenyao11@huawei.com>

Applied patch 2 into the hisilicon dt tree.
Thanks!

BR,
Wei

> ---
>  arch/arm64/boot/dts/hisilicon/hi3660.dtsi | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/hisilicon/hi3660.dtsi b/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
> index ec3eb8e..2cef8f4 100644
> --- a/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
> +++ b/arch/arm64/boot/dts/hisilicon/hi3660.dtsi
> @@ -872,6 +872,8 @@
>  				  0x0 0x02000000>;
>  			num-lanes = <1>;
>  			#interrupt-cells = <1>;
> +			interrupts = <0 283 4>;
> +			interrupt-names = "msi";
>  			interrupt-map-mask = <0xf800 0 0 7>;
>  			interrupt-map = <0x0 0 0 1
>  					 &gic GIC_SPI 282 IRQ_TYPE_LEVEL_HIGH>,
> 

^ permalink raw reply

* Re: [PATCH 5/5] hisi: Consolidate the Kconfigs for the CLOCK_STUB and the MAILBOX
From: Wei Xu @ 2018-05-11 14:05 UTC (permalink / raw)
  To: Leo Yan, Jassi Brar
  Cc: Arnd Bergmann, Stephen Boyd, Kaihua Zhong, Tao Wang,
	Daniel Lezcano, ", linux-arm-kernel", linux-mediatek,
	srv_heupstream, Devicetree List, Linux Kernel Mailing List,
	Guodong Xu, Haojian Zhuang, xuwei5
In-Reply-To: <20180509040255.GF23540@leoy-ThinkPad-X240s>

Hi Leo,

On 2018/5/9 5:02, Leo Yan wrote:
> On Wed, May 09, 2018 at 09:19:13AM +0530, Jassi Brar wrote:
>> On Wed, Apr 4, 2018 at 8:44 AM, Leo Yan <leo.yan@linaro.org> wrote:
>>> From: Daniel Lezcano <daniel.lezcano@linaro.org>
>>>
>>> The current defconfig is inconsistent as it selects the mailbox and
>>> the clock for the hi6220 and the hi3660 without having their Kconfigs
>>> making sure the dependencies are correct. It ends up when selecting
>>> different versions for the kernel (for example when git bisecting)
>>> those options disappear and they don't get back, leading to unexpected
>>> behaviors. In our case, the cpufreq driver does no longer work because
>>> the clock fails to initialize due to the clock stub and the mailbox
>>> missing.
>>>
>>> In order to have the dependencies correctly set when defaulting, let's
>>> do the same as commit 3a49afb84ca074e ("clk: enable hi655x common clk
>>> automatically") where we select automatically the driver when the
>>> parent driver is selected. With sensible defaults in place, we can leave
>>> other choices for EXPERT.
>>>
>> Acked-by: Jassi Brar <jaswinder.singh@linaro.org>
> 
> Thanks Jassi & Stephen.
> 
> Wei, could you pick this patch?

Thanks!
Series applied into the hisilicon tree.

BR,
Wei

> 
> Thanks,
> Leo Yan
> 
> .
> 

^ permalink raw reply

* Re: [PATCH 0/3] HiSilicon LPC defconfig and DT patches
From: Wei Xu @ 2018-05-11 14:00 UTC (permalink / raw)
  To: John Garry; +Cc: linux-arm-kernel, linuxarm, linux-kernel, devicetree, xuwei5
In-Reply-To: <1525101342-27120-1-git-send-email-john.garry@huawei.com>

Hi John,

On 2018/4/30 16:15, John Garry wrote:
> This series introduces 3 patches, to enable the
> HISILICON_LPC config in the arm64 defconfig
> and also add the relevant LPC DT entries.
> 
> For hip06 UART support, we depend on this patch:
> https://lkml.org/lkml/2018/4/27/258
> 
> John Garry (3):
>   arm64: defconfig: Enable HISILICON_LPC
>   arm64: dts: hisi: Enable Hisi LPC node for hip06
>   arm64: dts: hisi: Enable Hisi LPC node for hip07
> 
>  arch/arm64/boot/dts/hisilicon/hip06-d03.dts |  8 ++++++++
>  arch/arm64/boot/dts/hisilicon/hip06.dtsi    | 21 +++++++++++++++++++++
>  arch/arm64/boot/dts/hisilicon/hip07-d05.dts |  4 ++++
>  arch/arm64/boot/dts/hisilicon/hip07.dtsi    | 14 ++++++++++++++
>  arch/arm64/configs/defconfig                |  1 +
>  5 files changed, 48 insertions(+)
> 

Series applied into the hisilicon tree.
Thanks!

BR,
Wei

^ permalink raw reply

* Re: [PATCH 1/3] arm64: dts: hi3798cv200: enable PCIe support for poplar board
From: Wei Xu @ 2018-05-11 13:58 UTC (permalink / raw)
  To: Shawn Guo
  Cc: Jianguo Sun, Jiancheng Xue, xuwei5, linux-arm-kernel, devicetree
In-Reply-To: <1526004220-17030-1-git-send-email-shawn.guo@linaro.org>

Hi Shawn,

On 2018/5/11 3:03, Shawn Guo wrote:
> It adds combophy devices under peripheral controller and enables PCIe
> support for Hi3798CV200 Poplar board.
> 
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>

Series applied into the hisilicon dt tree.
Thanks!

BR,
Wei

> ---
>  .../boot/dts/hisilicon/hi3798cv200-poplar.dts      | 15 ++++++
>  arch/arm64/boot/dts/hisilicon/hi3798cv200.dtsi     | 63 ++++++++++++++++++++++
>  2 files changed, 78 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/hisilicon/hi3798cv200-poplar.dts b/arch/arm64/boot/dts/hisilicon/hi3798cv200-poplar.dts
> index 4d5d644abb12..c4382e1f3c92 100644
> --- a/arch/arm64/boot/dts/hisilicon/hi3798cv200-poplar.dts
> +++ b/arch/arm64/boot/dts/hisilicon/hi3798cv200-poplar.dts
> @@ -61,6 +61,15 @@
>  			default-state = "off";
>  		};
>  	};
> +
> +	reg_pcie: regulator-pcie {
> +		compatible = "regulator-fixed";
> +		regulator-name = "3V3_PCIE0";
> +		regulator-min-microvolt = <3300000>;
> +		regulator-max-microvolt = <3300000>;
> +		gpio = <&gpio6 7 0>;
> +		enable-active-high;
> +	};
>  };
>  
>  &gmac1 {
> @@ -146,6 +155,12 @@
>  	status = "okay";
>  };
>  
> +&pcie {
> +	reset-gpios = <&gpio4 4 GPIO_ACTIVE_HIGH>;
> +	vpcie-supply = <&reg_pcie>;
> +	status = "okay";
> +};
> +
>  &sd0 {
>  	bus-width = <4>;
>  	cap-sd-highspeed;
> diff --git a/arch/arm64/boot/dts/hisilicon/hi3798cv200.dtsi b/arch/arm64/boot/dts/hisilicon/hi3798cv200.dtsi
> index 962bd79139e4..5b73403551e6 100644
> --- a/arch/arm64/boot/dts/hisilicon/hi3798cv200.dtsi
> +++ b/arch/arm64/boot/dts/hisilicon/hi3798cv200.dtsi
> @@ -8,7 +8,9 @@
>   */
>  
>  #include <dt-bindings/clock/histb-clock.h>
> +#include <dt-bindings/gpio/gpio.h>
>  #include <dt-bindings/interrupt-controller/arm-gic.h>
> +#include <dt-bindings/phy/phy.h>
>  #include <dt-bindings/reset/ti-syscon.h>
>  
>  / {
> @@ -106,6 +108,37 @@
>  			#reset-cells = <2>;
>  		};
>  
> +		perictrl: peripheral-controller@8a20000 {
> +			compatible = "hisilicon,hi3798cv200-perictrl", "syscon",
> +				     "simple-mfd";
> +			reg = <0x8a20000 0x1000>;
> +			#address-cells = <1>;
> +			#size-cells = <1>;
> +			ranges = <0x0 0x8a20000 0x1000>;
> +
> +			combphy0: phy@850 {
> +				compatible = "hisilicon,hi3798cv200-combphy";
> +				reg = <0x850 0x8>;
> +				#phy-cells = <1>;
> +				clocks = <&crg HISTB_COMBPHY0_CLK>;
> +				resets = <&crg 0x188 4>;
> +				assigned-clocks = <&crg HISTB_COMBPHY0_CLK>;
> +				assigned-clock-rates = <100000000>;
> +				hisilicon,fixed-mode = <PHY_TYPE_USB3>;
> +			};
> +
> +			combphy1: phy@858 {
> +				compatible = "hisilicon,hi3798cv200-combphy";
> +				reg = <0x858 0x8>;
> +				#phy-cells = <1>;
> +				clocks = <&crg HISTB_COMBPHY1_CLK>;
> +				resets = <&crg 0x188 12>;
> +				assigned-clocks = <&crg HISTB_COMBPHY1_CLK>;
> +				assigned-clock-rates = <100000000>;
> +				hisilicon,mode-select-bits = <0x0008 11 (0x3 << 11)>;
> +			};
> +		};
> +
>  		uart0: serial@8b00000 {
>  			compatible = "arm,pl011", "arm,primecell";
>  			reg = <0x8b00000 0x1000>;
> @@ -419,5 +452,35 @@
>  			clocks = <&sysctrl HISTB_IR_CLK>;
>  			status = "disabled";
>  		};
> +
> +		pcie: pcie@9860000 {
> +			compatible = "hisilicon,hi3798cv200-pcie";
> +			reg = <0x9860000 0x1000>,
> +			      <0x0 0x2000>,
> +			      <0x2000000 0x01000000>;
> +			reg-names = "control", "rc-dbi", "config";
> +			#address-cells = <3>;
> +			#size-cells = <2>;
> +			device_type = "pci";
> +			bus-range = <0 15>;
> +			num-lanes = <1>;
> +			ranges = <0x81000000 0x0 0x00000000 0x4f00000 0x0 0x100000
> +				  0x82000000 0x0 0x3000000 0x3000000 0x0 0x01f00000>;
> +			interrupts = <GIC_SPI 128 IRQ_TYPE_LEVEL_HIGH>;
> +			interrupt-names = "msi";
> +			#interrupt-cells = <1>;
> +			interrupt-map-mask = <0 0 0 0>;
> +			interrupt-map = <0 0 0 0 &gic 0 131 IRQ_TYPE_LEVEL_HIGH>;
> +			clocks = <&crg HISTB_PCIE_AUX_CLK>,
> +				 <&crg HISTB_PCIE_PIPE_CLK>,
> +				 <&crg HISTB_PCIE_SYS_CLK>,
> +				 <&crg HISTB_PCIE_BUS_CLK>;
> +			clock-names = "aux", "pipe", "sys", "bus";
> +			resets = <&crg 0x18c 6>, <&crg 0x18c 5>, <&crg 0x18c 4>;
> +			reset-names = "soft", "sys", "bus";
> +			phys = <&combphy1 PHY_TYPE_PCIE>;
> +			phy-names = "phy";
> +			status = "disabled";
> +		};
>  	};
>  };
> 

^ permalink raw reply

* Re: [PATCH 2/3] arm64: dts: renesas: r8a77995: Add VIN4
From: Simon Horman @ 2018-05-11 13:45 UTC (permalink / raw)
  To: Niklas Söderlund
  Cc: Jacopo Mondi, laurent.pinchart, geert, magnus.damm, robh+dt,
	linux-renesas-soc, devicetree, linux-arm-kernel, linux-kernel
In-Reply-To: <20180511112523.GK18974@bigcity.dyn.berto.se>

On Fri, May 11, 2018 at 01:25:23PM +0200, Niklas Söderlund wrote:
> Hi Jacopo,
> 
> Thanks for your work.
> 
> On 2018-05-11 12:00:01 +0200, Jacopo Mondi wrote:
> > Describe VIN4 interface for R-Car D3 R8A77995 SoC.
> > 
> > Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
> 
> Acked-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> 
> > ---
> >  arch/arm64/boot/dts/renesas/r8a77995.dtsi | 11 +++++++++++
> >  1 file changed, 11 insertions(+)
> > 
> > diff --git a/arch/arm64/boot/dts/renesas/r8a77995.dtsi b/arch/arm64/boot/dts/renesas/r8a77995.dtsi
> > index 82aed7e..bdf7017 100644
> > --- a/arch/arm64/boot/dts/renesas/r8a77995.dtsi
> > +++ b/arch/arm64/boot/dts/renesas/r8a77995.dtsi
> > @@ -783,6 +783,17 @@
> >  				};
> >  			};
> >  		};
> > +
> > +		vin4: video@e6ef4000 {
> > +			compatible = "renesas,vin-r8a77995";
> > +			reg = <0 0xe6ef4000 0 0x1000>;
> > +			interrupts = <GIC_SPI 174 IRQ_TYPE_LEVEL_HIGH>;
> > +			clocks = <&cpg CPG_MOD 807>;
> > +			power-domains = <&sysc R8A77995_PD_ALWAYS_ON>;
> > +			resets = <&cpg 807>;
> > +			renesas,id = <4>;
> > +			status = "disabled";
> > +		};
> >  	};

Thanks, I have moved the new node to preserve sorting of nodes by bus
address and applied the result. It is as follows:

From: Jacopo Mondi <jacopo+renesas@jmondi.org>
Subject: [PATCH] arm64: dts: renesas: r8a77995: Add VIN4

Describe VIN4 interface for R-Car D3 R8A77995 SoC.

Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Acked-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
[simon: sorted node by bus address]
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
 arch/arm64/boot/dts/renesas/r8a77995.dtsi | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r8a77995.dtsi b/arch/arm64/boot/dts/renesas/r8a77995.dtsi
index ba98865b0c9b..2506f46293e8 100644
--- a/arch/arm64/boot/dts/renesas/r8a77995.dtsi
+++ b/arch/arm64/boot/dts/renesas/r8a77995.dtsi
@@ -610,6 +610,17 @@
 			status = "disabled";
 		};
 
+		vin4: video@e6ef4000 {
+			compatible = "renesas,vin-r8a77995";
+			reg = <0 0xe6ef4000 0 0x1000>;
+			interrupts = <GIC_SPI 174 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&cpg CPG_MOD 807>;
+			power-domains = <&sysc R8A77995_PD_ALWAYS_ON>;
+			resets = <&cpg 807>;
+			renesas,id = <4>;
+			status = "disabled";
+		};
+
 		ohci0: usb@ee080000 {
 			compatible = "generic-ohci";
 			reg = <0 0xee080000 0 0x100>;
-- 
2.11.0

^ permalink raw reply related

* Re: [RFC PATCH 1/3] arcnet: com20020: Add memory map of com20020
From: Rob Herring @ 2018-05-11 13:35 UTC (permalink / raw)
  To: Andrea Greco
  Cc: Michael Grzeschik, Andrea Greco, Mark Rutland, netdev, devicetree,
	linux-kernel@vger.kernel.org
In-Reply-To: <CAPoXtQK2s-G3sPHOQQcEQe+O9LGBWBv3Jrsy_NTVNo_nAtd1bg@mail.gmail.com>

On Fri, May 11, 2018 at 5:50 AM, Andrea Greco
<andrea.greco.gapmilano@gmail.com> wrote:
> On 05/08/2018 06:16 PM, Rob Herring wrote:
>> On Sat, May 05, 2018 at 11:34:45PM +0200, Andrea Greco wrote:
>>> From: Andrea Greco <a.greco@4sigma.it>
>>>
>>> Add support for com20022I/com20020, memory mapped chip version.
>>> Support bus: Intel 80xx and Motorola 68xx.
>>> Bus size: Only 8 bit bus size is supported.
>>> Added related device tree bindings
>>>
>>> Signed-off-by: Andrea Greco <a.greco@4sigma.it>
>>> ---
>>>   .../devicetree/bindings/net/smsc-com20020.txt      |  23 +++
>>
>> Please split bindings to separate patch.
>
> Ok
>>
>>>   drivers/net/arcnet/Kconfig                         |  12 +-
>>>   drivers/net/arcnet/Makefile                        |   1 +
>>>   drivers/net/arcnet/arcdevice.h                     |  27 ++-
>>>   drivers/net/arcnet/com20020-membus.c               | 191 +++++++++++++++++++++
>>>   drivers/net/arcnet/com20020.c                      |   9 +-
>>>   6 files changed, 253 insertions(+), 10 deletions(-)
>>>   create mode 100644 Documentation/devicetree/bindings/net/smsc-com20020.txt
>>>   create mode 100644 drivers/net/arcnet/com20020-membus.c
>>>
>>> diff --git a/Documentation/devicetree/bindings/net/smsc-com20020.txt b/Documentation/devicetree/bindings/net/smsc-com20020.txt
>>> new file mode 100644
>>> index 000000000000..39c5b19c55af
>>> --- /dev/null
>>> +++ b/Documentation/devicetree/bindings/net/smsc-com20020.txt
>>> @@ -0,0 +1,23 @@
>>> +SMSC com20020, com20022I
>>
>> What does this device do?
>>
>
> Changed in:
> SMSC com20020 Arcnet network controller
>
>>> +
>>> +timeout: Arcnet timeout, checkout datashet
>>> +clockp: Clock Prescaler, checkout datashet
>>
>> s/datashet/datasheet/
>>
>>> +clockm: Clock multiplier, checkout datasheet
>>
>> Would these 3 properties be common for arcnet devices? If not, then they
>> should have a vendor prefix.
>>
>
> Timeout is arcnet propelty:
> Other is smsc params, then become:
> - timeout: Arcnet timeout

Needs unit suffix as defined in property-units.txt.

> - smsc-clockp: Clock Prescaler
> - smsc-clockm: Clock multiplier
> - smsc-backplane: Controller use backplane mode inside of transceiver

Vendor properties are <vendor>,<prop-name>.

>
> I forget backplane propelty, but is required
>
>>> +
>>> +phy-reset-gpios: Chip reset ppin
>>
>> Use 'reset-gpios' as that is standard.
>>
>>> +phy-irq-gpios: Chip irq pin
>>
>> Use 'interrupts'. Interrupt capable gpio controllers are also interrupt
>> controllers.
>>
>
> Ok, change to standard
>
>>> +
>>> +com20020_A@0 {
>>
>> Node names should be generic based on the class of device. I don't think
>> we have one defined, but how about 'arcnet'.
>>
>> Unit addresses must have a corresponding reg property. How is this
>> device accessed?
>>
>
> Then: arcnet@28000000
>
>>> +    compatible = "smsc,com20020";
>>
>> Not documented.
>>
> I miss something? Where add this doc?
> Is not this file?

Yes, this file up above with all the other properties. The example is
just an example, not a binding definition.

Rob

^ permalink raw reply

* Re: [PATCH 1/3] dt-bindings: media: rcar-vin: Add R8A77995 support
From: Simon Horman @ 2018-05-11 13:35 UTC (permalink / raw)
  To: Jacopo Mondi
  Cc: niklas.soderlund, laurent.pinchart, geert, magnus.damm, robh+dt,
	linux-renesas-soc, devicetree, linux-arm-kernel, linux-kernel
In-Reply-To: <1526032802-14376-2-git-send-email-jacopo+renesas@jmondi.org>

On Fri, May 11, 2018 at 12:00:00PM +0200, Jacopo Mondi wrote:
> Add compatible string for R-Car D3 R8A7795 to list of SoCs supported by
> rcar-vin driver.
> 
> Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>

Reviewed-by: Simon Horman <horms+renesas@verge.net.au>

^ permalink raw reply

* Re: [PATCH v2 1/2] ARM: dts: vexpress: use standard gpio bindings for sys_{led,mci,flash}
From: Sudeep Holla @ 2018-05-11 13:16 UTC (permalink / raw)
  To: Rob Herring
  Cc: devicetree, Liviu Dudau,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
	Sudeep Holla
In-Reply-To: <CAL_JsqKsGV8rrox2hSioASD+96ws9JLTo_DLw9nKwAgr5uZ_3g@mail.gmail.com>



On 11/05/18 13:10, Rob Herring wrote:
> On Fri, May 11, 2018 at 5:23 AM, Sudeep Holla <sudeep.holla@arm.com> wrote:
>> Commit 2cff6dba57b7 ("ARM: dts: vexpress: fix node name unit-address presence warnings")
>> removed the unit address as there was no associated reg property in
>> these sysreg nodes.
>>
>> Also the latest DTC throws warnings for character '_' in the node names.
>>
>> Warning (node_name_chars_strict): /sysreg@10000/sys_led: Character '_' not recommended in node name
>> Warning (node_name_chars_strict): /sysreg@10000/sys_mci: Character '_' not recommended in node name
>> Warning (node_name_chars_strict): /sysreg@10000/sys_flash: Character '_' not recommended in node name
>>
>> The correct way to fix this as well as the original unit-address presence
>> warnings is to use the standard gpio controller binding and specify the
>> reg properties as per the hardware as it was before.
>>
>> However note that Vexpress sysreg MFD driver will still continue to use
>> the hardcoded values for compatibility reasons.
>>
>> Cc: Liviu Dudau <liviu.dudau@arm.com>
>> Suggested-by: Rob Herring <robh@kernel.org>
>> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
>> ---
>>  arch/arm/boot/dts/vexpress-v2m-rs1.dtsi | 11 ++++++++---
>>  arch/arm/boot/dts/vexpress-v2m.dtsi     | 11 ++++++++---
>>  2 files changed, 16 insertions(+), 6 deletions(-)
>>
>> diff --git a/arch/arm/boot/dts/vexpress-v2m-rs1.dtsi b/arch/arm/boot/dts/vexpress-v2m-rs1.dtsi
>> index 7b8ff5b3b912..a8586a0b957d 100644
>> --- a/arch/arm/boot/dts/vexpress-v2m-rs1.dtsi
>> +++ b/arch/arm/boot/dts/vexpress-v2m-rs1.dtsi
>> @@ -76,21 +76,26 @@
>>                                 v2m_sysreg: sysreg@10000 {
>>                                         compatible = "arm,vexpress-sysreg";
>>                                         reg = <0x010000 0x1000>;
>> +                                       #address-cells = <1>;
>> +                                       #size-cells = <1>;
> 
> You need a ranges here and below to translate from 0-0x10000 range.
> 
> With that,
> 
> Reviewed-by: Rob Herring <robh@kernel.org>
> 

Thanks, I have appended it with below change

Regards,
Sudeep

--

diff --git c/arch/arm/boot/dts/vexpress-v2m-rs1.dtsi
w/arch/arm/boot/dts/vexpress-v2m-rs1.dtsi
index a8586a0b957d..4488c8fe213a 100644
--- c/arch/arm/boot/dts/vexpress-v2m-rs1.dtsi
+++ w/arch/arm/boot/dts/vexpress-v2m-rs1.dtsi
@@ -78,6 +78,7 @@
                                        reg = <0x010000 0x1000>;
                                        #address-cells = <1>;
                                        #size-cells = <1>;
+                                       ranges = <0 0x10000 0x1000>;
                                        v2m_led_gpios: gpio@8 {
                                                compatible =
"arm,vexpress-sysreg,sys_led";
diff --git c/arch/arm/boot/dts/vexpress-v2m.dtsi
w/arch/arm/boot/dts/vexpress-v2m.dtsi
index 37ecccebd937..4db42f6326a3 100644
--- c/arch/arm/boot/dts/vexpress-v2m.dtsi
+++ w/arch/arm/boot/dts/vexpress-v2m.dtsi
@@ -78,6 +78,7 @@
                                        reg = <0x00000 0x1000>;
                                        #address-cells = <1>;
                                        #size-cells = <1>;
+                                       ranges = <0 0 0x1000>;
                                        v2m_led_gpios: gpio@8 {
                                                compatible =
"arm,vexpress-sysreg,sys_led";

^ permalink raw reply related

* Re: [PATCH] arm64: dts: stratix10: Add QSPI support for Stratix10
From: Rob Herring @ 2018-05-11 12:31 UTC (permalink / raw)
  To: thor.thayer
  Cc: Dinh Nguyen, Mark Rutland, Catalin Marinas, Will Deacon,
	devicetree,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE,
	linux-kernel@vger.kernel.org
In-Reply-To: <1525985204-11525-1-git-send-email-thor.thayer@linux.intel.com>

On Thu, May 10, 2018 at 3:46 PM,  <thor.thayer@linux.intel.com> wrote:
> From: Thor Thayer <thor.thayer@linux.intel.com>
>
> Add qspi_clock
>    The qspi_clk frequency is updated by U-Boot before starting Linux.
> Add QSPI interface node.
> Add QSPI flash memory child node.
>    Setup the QSPI memory in 2 partitions.
>
> Signed-off-by: Thor Thayer <thor.thayer@linux.intel.com>
> ---
>  arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi  | 22 +++++++++++++++
>  .../boot/dts/altera/socfpga_stratix10_socdk.dts    | 31 ++++++++++++++++++++++
>  2 files changed, 53 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi b/arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi
> index e6b059378dc0..ed47dfce3ba6 100644
> --- a/arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi
> +++ b/arch/arm64/boot/dts/altera/socfpga_stratix10.dtsi
> @@ -119,6 +119,12 @@
>                                 #clock-cells = <0>;
>                                 compatible = "fixed-clock";
>                         };
> +
> +                       qspi_clk: qspi_clk {

s/_/-/

> +                               #clock-cells = <0>;
> +                               compatible = "fixed-clock";
> +                               clock-frequency = <200000000>;
> +                       };
>                 };
>
>                 gmac0: ethernet@ff800000 {
> @@ -466,5 +472,21 @@
>                                 interrupts = <16 4>, <48 4>;
>                         };
>                 };
> +
> +               qspi: spi@ff8d2000 {
> +                       compatible = "cdns,qspi-nor";
> +                       #address-cells = <1>;
> +                       #size-cells = <0>;
> +                       reg = <0xff8d2000 0x100>,
> +                             <0xff900000 0x100000>;
> +                       interrupts = <0 3 4>;
> +                       cdns,fifo-depth = <128>;
> +                       cdns,fifo-width = <4>;
> +                       cdns,trigger-address = <0x00000000>;
> +                       clocks = <&qspi_clk>;
> +                       bus-num = <1>;
> +
> +                       status = "disabled";
> +               };
>         };
>  };
> diff --git a/arch/arm64/boot/dts/altera/socfpga_stratix10_socdk.dts b/arch/arm64/boot/dts/altera/socfpga_stratix10_socdk.dts
> index f9b1ef12db48..60251462067a 100644
> --- a/arch/arm64/boot/dts/altera/socfpga_stratix10_socdk.dts
> +++ b/arch/arm64/boot/dts/altera/socfpga_stratix10_socdk.dts
> @@ -147,3 +147,34 @@
>                 reg = <0x68>;
>         };
>  };
> +
> +&qspi {
> +       flash0: n25q00@0 {

flash@0

> +               #address-cells = <1>;
> +               #size-cells = <1>;
> +               compatible = "n25q00aa";
> +               reg = <0>;
> +               spi-max-frequency = <50000000>;
> +
> +               m25p,fast-read;
> +               cdns,page-size = <256>;
> +               cdns,block-size = <16>;
> +               cdns,read-delay = <1>;
> +               cdns,tshsl-ns = <50>;
> +               cdns,tsd2d-ns = <50>;
> +               cdns,tchsh-ns = <4>;
> +               cdns,tslch-ns = <4>;
> +
> +               partition@qspi-boot {

use a 'partitions' node to contain all the partitions.

> +                       label = "Boot and fpga data";
> +                       /* 64MB for boot and FPGA data */
> +                       reg = <0x0 0x4000000>;
> +               };
> +
> +               partition@qspi-rootfs {
> +                       label = "Root Filesystem - JFFS2";
> +                       /* 64MB for Linux jffs2 */
> +                       reg = <0x4000000 0x4000000>;
> +               };
> +       };
> +};
> --
> 2.7.4
>

^ permalink raw reply

* Re: [PATCH v1 3/5] arm64: dts: rockchip: Add gpio-syscon10 to rk3328
From: Rob Herring @ 2018-05-11 12:24 UTC (permalink / raw)
  To: Levin Du
  Cc: Robin Murphy, open list:ARM/Rockchip SoC..., Mark Rutland,
	devicetree, Wayne Chou, Heiko Stuebner, Arnd Bergmann,
	Catalin Marinas, Will Deacon, linux-kernel@vger.kernel.org,
	Sugar Zhang, Finley Xiao, David Wu, William Wu, Rocky Hao,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE
In-Reply-To: <3fdfcc9b-90b5-191c-37e0-c99389a4e872@t-chip.com.cn>

On Thu, May 10, 2018 at 10:45 PM, Levin Du <djw@t-chip.com.cn> wrote:
> On 2018-05-10 8:50 PM, Robin Murphy wrote:
>>
>> On 10/05/18 10:16, djw@t-chip.com.cn wrote:
>>>
>>> From: Levin Du <djw@t-chip.com.cn>
>>>
>>> Adding a new gpio controller named "gpio-syscon10" to rk3328, providing
>>> access to the pins defined in the syscon GRF_SOC_CON10.
>>
>>
>> This is the GPIO_MUTE pin, right? The public TRM is rather vague, but
>> cross-referencing against the datasheet and schematics implies that it's the
>> "gpiomut_*" part of the GRF bit names which is most significant.
>>
>> It might be worth using a more descriptive name here, since "syscon10" is
>> pretty much meaningless at the board level.
>>
>> Robin.
>>
> Previously I though other bits might be able to reference from syscon10,
> other than GPIO_MUTE alone.
> If it is renamed to gpio-mute, then the GPIO_MUTE pin is accessed as
> `<&gpio-mute 1>`. Yet other
> bits in syscon10 can also be referenced, say, `<&gpio-mute 10>`, which is
> not good.
>
> I'd like to add a `gpio,syscon-bit` property to gpio-syscon, which overrides
> the properties
> of bit_count,  data_bit_offset and dir_bit_offset in the driver. For

No. Once you are describing individual register bits, it is too low
level for DT.

> example:
>
>                 gpio_mute: gpio-mute {
>                         compatible = "rockchip,gpio-syscon";
>                         gpio-controller;
>                         #gpio-cells = <2>;
>                         gpio,syscon-dev = <0 0x0428 0>;
>                         gpio,syscon-bit = <1 1 0>;
>                 };
>
> That way, the mute pin is strictly specified as <&gpio_mute 0>, and
> <&gpio_mute 1> will be invalid.
> I think that is neat, and consistent with the gpio_mute name.
>
> Thanks
> Levin
>
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe devicetree" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH v1 3/5] arm64: dts: rockchip: Add gpio-syscon10 to rk3328
From: Rob Herring @ 2018-05-11 12:22 UTC (permalink / raw)
  To: djw
  Cc: open list:ARM/Rockchip SoC..., Wayne Chou, Heiko Stuebner,
	devicetree, David Wu, Arnd Bergmann, Finley Xiao, William Wu,
	Sugar Zhang, linux-kernel@vger.kernel.org, Robin Murphy,
	Rocky Hao, Will Deacon, Mark Rutland, Catalin Marinas,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE
In-Reply-To: <1525943800-14095-4-git-send-email-djw@t-chip.com.cn>

On Thu, May 10, 2018 at 4:16 AM,  <djw@t-chip.com.cn> wrote:
> From: Levin Du <djw@t-chip.com.cn>
>
> Adding a new gpio controller named "gpio-syscon10" to rk3328, providing
> access to the pins defined in the syscon GRF_SOC_CON10.
>
> Boards using these special pins to control regulators or LEDs, can now
> utilize existing drivers like gpio-regulator and leds-gpio.
>
> Signed-off-by: Levin Du <djw@t-chip.com.cn>
>
> ---
>
> Changes in v1:
> - Split from V0 and add to rk3328.dtsi for general use.
>
>  arch/arm64/boot/dts/rockchip/rk3328.dtsi | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/rockchip/rk3328.dtsi b/arch/arm64/boot/dts/rockchip/rk3328.dtsi
> index b8e9da1..73a822d 100644
> --- a/arch/arm64/boot/dts/rockchip/rk3328.dtsi
> +++ b/arch/arm64/boot/dts/rockchip/rk3328.dtsi
> @@ -309,6 +309,12 @@
>                         mode-loader = <BOOT_BL_DOWNLOAD>;
>                 };
>
> +               gpio_syscon10: gpio-syscon10 {

GPIO controller nodes should be named just 'gpio'.

> +                       compatible = "rockchip,gpio-syscon";
> +                       gpio-controller;
> +                       #gpio-cells = <2>;
> +                       gpio,syscon-dev = <0 0x0428 0>;

This property is not documented and takes a phandle.

> +               };
>         };
>
>         uart0: serial@ff110000 {
> --
> 2.7.4
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe devicetree" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH v5 1/2] dt: bindings: lm3601x: Introduce the lm3601x driver
From: Dan Murphy @ 2018-05-11 12:12 UTC (permalink / raw)
  To: Jacek Anaszewski, Pavel Machek
  Cc: robh+dt, mark.rutland, afd, devicetree, linux-kernel, linux-leds
In-Reply-To: <fd68c674-f842-5877-698a-3a74922cb384@gmail.com>

Jacek

Thanks for the review

On 05/10/2018 03:17 PM, Jacek Anaszewski wrote:
> Hi Dan,
> 
> On 05/10/2018 09:10 PM, Dan Murphy wrote:
>> On 05/10/2018 02:06 PM, Dan Murphy wrote:
>>> Pavel
>>>
>>> On 05/10/2018 01:54 PM, Pavel Machek wrote:
>>>> Hi!
>>>>
>>>>> Introduce the device tree bindings for the lm3601x
>>>>> family of LED torch, flash and IR drivers.
>>>>>
>>>>> Signed-off-by: Dan Murphy <dmurphy@ti.com>
>>>>
>>>> Better, thanks.
>>>>> +++ b/Documentation/devicetree/bindings/leds/leds-lm3601x.txt
>>>>> @@ -0,0 +1,50 @@
>>>>> +* Texas Instruments - lm3601x Single-LED Flash Driver
>>>>
>>>> Ok, so is it single-LED driver, or can it driver ir & white LEDs at
>>>> the same time?
>>>
>>> It is a single LED driver.  It can drive a Torch white LED or IR LED indefinitely or if the driver
>>> is programmed to strobe mode the driver will drive the configured LED for the flash timeout specified.
>>>
>>> Basically a flash and a flash light. IR or White LED.
>>>
>>>
>>>>
>>>>> +Example:
>>>>> +led-controller@64 {
>>>>> +    compatible = "ti,lm36010";
>>>>> +    #address-cells = <1>;
>>>>> +    #size-cells = <0>;
>>>>> +    reg = <0x64>;
>>>>> +
>>>>> +    led@0 {
>>>>> +        reg = <0>;
>>>>> +        label = "white:torch";
>>>>> +        led-max-microamp = <10000>;
>>>>> +    };
>>>>> +
>>>>> +    led@1 {
>>>>> +        reg = <1>;
>>>>> +        label = "white:flash";
>>>>> +        flash-max-microamp = <10000>;
>>>>> +        flash-max-timeout-us = <800>;
>>>>> +    };
>>>>
>>>> Is this realistic config? I'd expect flash to use more power than
>>>> torch, and would expect longer timeout than 0.8msec.
>>>
>>> Timeout in the spreadsheet is ms I will update this example and code
>>> Current in the spreadsheet is mA I will update this example and code
>>>
>>>>
>>>> Also.. if this is physically one white LED, it should not be
>>>> spread over reg = <0> and reg = <1>...
>>>
>>> If the torch LED and strobe LED are the same LED how do I expose them both to the user.
>>> It is up to consumer to configure the required interfaces they want to expose to the filesystem.
> 
> LED flash class interface is prepared for it.
> led_clasdev_flash_register() internally calls led_classdev_register(),
> so there is brightness file available for torch related operations.

Yes the flash class may handle this and expose the brightness node but the HW has two different registers to set the
corresponding brightness so one set brightness node does not work.
There is no way to differentiate between the strobe brightness (register 4) and the torch brightness (register 3).

When the enable register is written the driver will read the corresponding register and set
the current for the LED.

This is why I separated out the strobe from the torch into 2 different LED nodes.

I cannot seem to find the data sheet on line for the max77693 so I cannot verify that the device only has
a single brightness register for both torch and strobe.


> 
>>> Maybe they don't want the strobe feature and just want LED on/off and switch between IR and White.
>>>
>>> The IR is driven via a different output pin.
>>
>> Correction.  There is only one LED drive pin.  The mode selected determines how the device will drive the
>> LED.  So you may have one device to drive a Torch and another device to drive the LED.
> 
> But only one type of LED can be soldered on the board at a time, right?
> If yes, then this is clearly a DT related configuration, and only
> one child DT node should be defined for given board.

But see above.  There is not a clean way to expose the torch/ir and strobe separately.

Dan


> 
>> Strobe is available in either case but not always required if strobe is not desired by the customer hence
>> why I have a separate DT node for it.
>>
>> Dan
>>
>>>
>>> Dan
>>>
>>>>
>>>> Best regards,
>>>>                                     Pavel
>>>>
>>>
>>>
>>
>>
> 


-- 
------------------
Dan Murphy

^ permalink raw reply

* Re: [PATCH v2 1/2] ARM: dts: vexpress: use standard gpio bindings for sys_{led, mci, flash}
From: Rob Herring @ 2018-05-11 12:10 UTC (permalink / raw)
  To: Sudeep Holla
  Cc: devicetree, Liviu Dudau,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE
In-Reply-To: <1526034208-9690-1-git-send-email-sudeep.holla@arm.com>

On Fri, May 11, 2018 at 5:23 AM, Sudeep Holla <sudeep.holla@arm.com> wrote:
> Commit 2cff6dba57b7 ("ARM: dts: vexpress: fix node name unit-address presence warnings")
> removed the unit address as there was no associated reg property in
> these sysreg nodes.
>
> Also the latest DTC throws warnings for character '_' in the node names.
>
> Warning (node_name_chars_strict): /sysreg@10000/sys_led: Character '_' not recommended in node name
> Warning (node_name_chars_strict): /sysreg@10000/sys_mci: Character '_' not recommended in node name
> Warning (node_name_chars_strict): /sysreg@10000/sys_flash: Character '_' not recommended in node name
>
> The correct way to fix this as well as the original unit-address presence
> warnings is to use the standard gpio controller binding and specify the
> reg properties as per the hardware as it was before.
>
> However note that Vexpress sysreg MFD driver will still continue to use
> the hardcoded values for compatibility reasons.
>
> Cc: Liviu Dudau <liviu.dudau@arm.com>
> Suggested-by: Rob Herring <robh@kernel.org>
> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
> ---
>  arch/arm/boot/dts/vexpress-v2m-rs1.dtsi | 11 ++++++++---
>  arch/arm/boot/dts/vexpress-v2m.dtsi     | 11 ++++++++---
>  2 files changed, 16 insertions(+), 6 deletions(-)
>
> diff --git a/arch/arm/boot/dts/vexpress-v2m-rs1.dtsi b/arch/arm/boot/dts/vexpress-v2m-rs1.dtsi
> index 7b8ff5b3b912..a8586a0b957d 100644
> --- a/arch/arm/boot/dts/vexpress-v2m-rs1.dtsi
> +++ b/arch/arm/boot/dts/vexpress-v2m-rs1.dtsi
> @@ -76,21 +76,26 @@
>                                 v2m_sysreg: sysreg@10000 {
>                                         compatible = "arm,vexpress-sysreg";
>                                         reg = <0x010000 0x1000>;
> +                                       #address-cells = <1>;
> +                                       #size-cells = <1>;

You need a ranges here and below to translate from 0-0x10000 range.

With that,

Reviewed-by: Rob Herring <robh@kernel.org>

>
> -                                       v2m_led_gpios: sys_led {
> +                                       v2m_led_gpios: gpio@8 {
>                                                 compatible = "arm,vexpress-sysreg,sys_led";
> +                                               reg = <0x008 4>;
>                                                 gpio-controller;
>                                                 #gpio-cells = <2>;
>                                         };
>
> -                                       v2m_mmc_gpios: sys_mci {
> +                                       v2m_mmc_gpios: gpio@48 {
>                                                 compatible = "arm,vexpress-sysreg,sys_mci";
> +                                               reg = <0x048 4>;
>                                                 gpio-controller;
>                                                 #gpio-cells = <2>;
>                                         };
>
> -                                       v2m_flash_gpios: sys_flash {
> +                                       v2m_flash_gpios: gpio@4c {
>                                                 compatible = "arm,vexpress-sysreg,sys_flash";
> +                                               reg = <0x04c 4>;
>                                                 gpio-controller;
>                                                 #gpio-cells = <2>;
>                                         };
> diff --git a/arch/arm/boot/dts/vexpress-v2m.dtsi b/arch/arm/boot/dts/vexpress-v2m.dtsi
> index 9cd5e146abd5..37ecccebd937 100644
> --- a/arch/arm/boot/dts/vexpress-v2m.dtsi
> +++ b/arch/arm/boot/dts/vexpress-v2m.dtsi
> @@ -76,21 +76,26 @@
>                                 v2m_sysreg: sysreg@0 {
>                                         compatible = "arm,vexpress-sysreg";
>                                         reg = <0x00000 0x1000>;
> +                                       #address-cells = <1>;
> +                                       #size-cells = <1>;
>
> -                                       v2m_led_gpios: sys_led {
> +                                       v2m_led_gpios: gpio@8 {
>                                                 compatible = "arm,vexpress-sysreg,sys_led";
> +                                               reg = <0x008 4>;
>                                                 gpio-controller;
>                                                 #gpio-cells = <2>;
>                                         };
>
> -                                       v2m_mmc_gpios: sys_mci {
> +                                       v2m_mmc_gpios: gpio@48 {
>                                                 compatible = "arm,vexpress-sysreg,sys_mci";
> +                                               reg = <0x048 4>;
>                                                 gpio-controller;
>                                                 #gpio-cells = <2>;
>                                         };
>
> -                                       v2m_flash_gpios: sys_flash {
> +                                       v2m_flash_gpios: gpio@4c {
>                                                 compatible = "arm,vexpress-sysreg,sys_flash";
> +                                               reg = <0x04c 4>;
>                                                 gpio-controller;
>                                                 #gpio-cells = <2>;
>                                         };
> --
> 2.7.4
>

^ permalink raw reply

* Re: [PATCH v5 2/2] leds: lm3601x: Introduce the lm3601x LED driver
From: Dan Murphy @ 2018-05-11 11:56 UTC (permalink / raw)
  To: Jacek Anaszewski, robh+dt, mark.rutland, pavel, afd
  Cc: devicetree, linux-kernel, linux-leds
In-Reply-To: <41267191-1308-6b9b-78fa-2893a525b49a@gmail.com>

Jacek

Thanks for the review

On 05/10/2018 03:48 PM, Jacek Anaszewski wrote:
> Hi Dan,
> 
> Thank you for the patch.
> 
> On 05/10/2018 07:47 PM, Dan Murphy wrote:
>> Introduce the family of LED devices that can
>> drive a torch, strobe or IR LED.
>>
>> The LED driver can be configured with a strobe
>> timer to execute a strobe flash.  The IR LED
>> brightness is controlled via the torch brightness
>> register.
>>
>> The data sheet for each the LM36010 and LM36011
>> LED drivers can be found here:
>> http://www.ti.com/product/LM36010
>> http://www.ti.com/product/LM36011
>>
>> Signed-off-by: Dan Murphy <dmurphy@ti.com>
>> ---
>>
>> v5 - Fixed magic numbers, change reg cache type, added of_put_node to release
>> the dt node ref, and I did not change the remove function to leave the LED in its
>> state on driver removal - https://patchwork.kernel.org/patch/10391741/
>>
>> v4 - Fixed Cocci issue using ARRAY_SIZE - https://patchwork.kernel.org/patch/10389259/
>> v3 - removed wildcard dt compatible, fixed copyright, fixed struct doc, removed
>> RO registers from default, added regmap volatile for FLAGS_REG, updated regmap cache type,
>> fixed unlock and extra semi colon in strobe_set, removed unnecessary out label
>> in led register and fixed checking of the ret in brightness_set - https://patchwork.kernel.org/patch/10386243/
>> v2 - Fixed kbuild issue and removed unused cdev_strobe - https://patchwork.kernel.org/patch/10384585/
>>
>>
>>   drivers/leds/Kconfig        |   9 +
>>   drivers/leds/Makefile       |   1 +
>>   drivers/leds/leds-lm3601x.c | 622 ++++++++++++++++++++++++++++++++++++
>>   3 files changed, 632 insertions(+)
>>   create mode 100644 drivers/leds/leds-lm3601x.c
>>
>> diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
>> index 2c896c0e69e1..50ae536f343f 100644
>> --- a/drivers/leds/Kconfig
>> +++ b/drivers/leds/Kconfig
>> @@ -145,6 +145,15 @@ config LEDS_LM3692X
>>         This option enables support for the TI LM3692x family
>>         of white LED string drivers used for backlighting.
>>   +config LEDS_LM3601X
>> +    tristate "LED support for LM3601x Chips"
>> +    depends on LEDS_CLASS && I2C && OF
>> +    depends on LEDS_CLASS_FLASH
>> +    select REGMAP_I2C
>> +    help
>> +      This option enables support for the TI LM3601x family
>> +      of flash, torch and indicator classes.
>> +
>>   config LEDS_LOCOMO
>>       tristate "LED Support for Locomo device"
>>       depends on LEDS_CLASS
>> diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile
>> index 91eca81cae82..b79807fe1b67 100644
>> --- a/drivers/leds/Makefile
>> +++ b/drivers/leds/Makefile
>> @@ -76,6 +76,7 @@ obj-$(CONFIG_LEDS_MLXREG)        += leds-mlxreg.o
>>   obj-$(CONFIG_LEDS_NIC78BX)        += leds-nic78bx.o
>>   obj-$(CONFIG_LEDS_MT6323)        += leds-mt6323.o
>>   obj-$(CONFIG_LEDS_LM3692X)        += leds-lm3692x.o
>> +obj-$(CONFIG_LEDS_LM3601X)        += leds-lm3601x.o
>>     # LED SPI Drivers
>>   obj-$(CONFIG_LEDS_DAC124S085)        += leds-dac124s085.o
>> diff --git a/drivers/leds/leds-lm3601x.c b/drivers/leds/leds-lm3601x.c
>> new file mode 100644
>> index 000000000000..3c00886fbc7a
>> --- /dev/null
>> +++ b/drivers/leds/leds-lm3601x.c
>> @@ -0,0 +1,622 @@
>> +// SPDX-License-Identifier: GPL-2.0
>> +/*
>> + * Flash and torch driver for Texas Instruments LM3601X LED
>> + * Flash driver chip family
>> + * Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/
>> + */
> 
> Please use uniform "//" comment style here.

Is this a LEDs only requirement because I checked a few other files and this is
how the license and header is presented.

Unless I missed some new change to source code headers.  And the documentation
does not dictate any change to this.

> 
>> +#include <linux/delay.h>
>> +#include <linux/i2c.h>
>> +#include <linux/leds.h>
>> +#include <linux/led-class-flash.h>
>> +#include <linux/module.h>
>> +#include <linux/regmap.h>
>> +#include <linux/slab.h>
>> +#include <uapi/linux/uleds.h>
>> +
>> +#define LM3601X_LED_TORCH    0x0
>> +#define LM3601X_LED_STROBE    0x1
>> +#define LM3601X_LED_IR        0x2
>> +
>> +/* Registers */
>> +#define LM3601X_ENABLE_REG    0x01
>> +#define LM3601X_CFG_REG        0x02
>> +#define LM3601X_LED_FLASH_REG    0x03
>> +#define LM3601X_LED_TORCH_REG    0x04
>> +#define LM3601X_FLAGS_REG    0x05
>> +#define LM3601X_DEV_ID_REG    0x06
>> +
>> +#define LM3601X_SW_RESET    BIT(7)
>> +
>> +/* Enable Mode bits */
>> +#define LM3601X_MODE_STANDBY    0x00
>> +#define LM3601X_MODE_IR_DRV    BIT(0)
>> +#define LM3601X_MODE_TORCH    BIT(1)
>> +#define LM3601X_MODE_STROBE    (BIT(0) | BIT(1))
>> +#define LM3601X_STRB_EN        BIT(2)
>> +#define LM3601X_STRB_LVL_TRIG    ~BIT(3)
>> +#define LM3601X_STRB_EDGE_TRIG    BIT(3)
>> +#define LM3601X_IVFM_EN        BIT(4)
>> +
>> +#define LM36010_BOOST_LIMIT_19    ~BIT(5)
>> +#define LM36010_BOOST_LIMIT_28    BIT(5)
>> +#define LM36010_BOOST_FREQ_2MHZ    ~BIT(6)
>> +#define LM36010_BOOST_FREQ_4MHZ    BIT(6)
>> +#define LM36010_BOOST_MODE_NORM    ~BIT(7)
>> +#define LM36010_BOOST_MODE_PASS    BIT(7)
>> +
>> +/* Flag Mask */
>> +#define LM3601X_FLASH_TIME_OUT    BIT(0)
>> +#define LM3601X_UVLO_FAULT    BIT(1)
>> +#define LM3601X_THERM_SHUTDOWN    BIT(2)
>> +#define LM3601X_THERM_CURR    BIT(3)
>> +#define LM36010_CURR_LIMIT    BIT(4)
>> +#define LM3601X_SHORT_FAULT    BIT(5)
>> +#define LM3601X_IVFM_TRIP    BIT(6)
>> +#define LM36010_OVP_FAULT    BIT(7)
>> +
>> +#define LM3601X_MIN_TORCH_I_UA    2400
>> +#define LM3601X_MIN_STROBE_I_MA    11
>> +
>> +#define LM3601X_TIMEOUT_MASK    0x1e
>> +#define LM3601X_ENABLE_MASK    0x03
>> +
>> +enum lm3601x_type {
>> +    CHIP_LM36010 = 0,
>> +    CHIP_LM36011,
>> +};
>> +
>> +/**
>> + * struct lm3601x_max_timeouts -
>> + * @timeout: timeout value in ms
>> + * @regval: the value of the register to write
>> + */
>> +struct lm3601x_max_timeouts {
>> +    int timeout;
>> +    int reg_val;
>> +};
>> +
>> +/**
>> + * struct lm3601x_led -
>> + * @lock: Lock for reading/writing the device
>> + * @regmap: Devices register map
>> + * @client: Pointer to the I2C client
>> + * @cdev_torch: led class device pointer for the torch
>> + * @cdev_ir: led class device pointer for infrared
>> + * @fled_cdev: flash led class device pointer
>> + * @strobe_node: DT device node for the strobe
>> + * @torch: LED label for the torch
>> + * @strobe: LED label for the strobe
>> + * @ir: LED label for the infrared
>> + * @last_flag: last known flags register value
>> + * @strobe_timeout: the timeout for the strobe
>> + * @torch_current_max: maximum current for the torch
>> + * @strobe_current_max: maximum current for the strobe
>> + * @max_strobe_timeout: maximum timeout for the strobe
>> + */
>> +struct lm3601x_led {
>> +    struct mutex lock;
>> +    struct regmap *regmap;
>> +    struct i2c_client *client;
>> +
>> +    struct led_classdev cdev_torch;
>> +    struct led_classdev cdev_ir;
>> +
>> +    struct led_classdev_flash fled_cdev;
>> +
>> +    struct device_node *strobe_node;
>> +    struct device_node *torch_node;
>> +    struct device_node *ir_node;
>> +
>> +    char torch[LED_MAX_NAME_SIZE];
>> +    char strobe[LED_MAX_NAME_SIZE];
>> +    char ir[LED_MAX_NAME_SIZE];
>> +
>> +    unsigned int last_flag;
>> +    unsigned int strobe_timeout;
>> +
>> +    u32 torch_current_max;
>> +    u32 strobe_current_max;
>> +    u32 max_strobe_timeout;
>> +};
>> +
>> +static const struct lm3601x_max_timeouts strobe_timeouts[] = {
>> +    { 40, 0x00 },
>> +    { 80, 0x01 },
>> +    { 120, 0x02 },
>> +    { 160, 0x03 },
>> +    { 200, 0x04 },
>> +    { 240, 0x05 },
>> +    { 280, 0x06 },
>> +    { 320, 0x07 },
>> +    { 360, 0x08 },
>> +    { 400, 0x09 },
>> +    { 600, 0x0a },
>> +    { 800, 0x0b },
>> +    { 1000, 0x0c },
>> +    { 1200, 0x0d },
>> +    { 1400, 0x0e },
>> +    { 1600, 0x0f },
>> +};
>> +
>> +static const struct reg_default lm3601x_regmap_defs[] = {
>> +    { LM3601X_ENABLE_REG, 0x20 },
>> +    { LM3601X_CFG_REG, 0x15 },
>> +    { LM3601X_LED_FLASH_REG, 0x00 },
>> +    { LM3601X_LED_TORCH_REG, 0x00 },
>> +};
>> +
>> +static bool lm3601x_volatile_reg(struct device *dev, unsigned int reg)
>> +{
>> +    switch (reg) {
>> +    case LM3601X_FLAGS_REG:
>> +        return true;
>> +    default:
>> +        return false;
>> +    }
>> +}
>> +
>> +static const struct regmap_config lm3601x_regmap = {
>> +    .reg_bits = 8,
>> +    .val_bits = 8,
>> +
>> +    .max_register = LM3601X_DEV_ID_REG,
>> +    .reg_defaults = lm3601x_regmap_defs,
>> +    .num_reg_defaults = ARRAY_SIZE(lm3601x_regmap_defs),
>> +    .cache_type = REGCACHE_RBTREE,
>> +    .volatile_reg = lm3601x_volatile_reg,
>> +};
>> +
>> +static struct lm3601x_led *fled_cdev_to_led(
>> +                struct led_classdev_flash *fled_cdev)
>> +{
>> +    return container_of(fled_cdev, struct lm3601x_led, fled_cdev);
>> +}
>> +
>> +static int lm3601x_read_faults(struct lm3601x_led *led)
>> +{
>> +    int flags_val;
>> +    int ret;
>> +
>> +    ret = regmap_read(led->regmap, LM3601X_FLAGS_REG, &flags_val);
>> +    if (ret < 0)
>> +        return -EIO;
>> +
>> +    led->last_flag = flags_val;
>> +
>> +    return led->last_flag;
>> +}
>> +
>> +static int lm3601x_torch_brightness_set(struct led_classdev *cdev,
>> +                    enum led_brightness brightness)
>> +{
>> +    struct lm3601x_led *led =
>> +        container_of(cdev, struct lm3601x_led, cdev_torch);
>> +    int ret;
>> +    u8 brightness_val;
>> +
>> +    mutex_lock(&led->lock);
>> +
>> +    ret = lm3601x_read_faults(led);
>> +    if (ret < 0)
>> +        goto out;
>> +
>> +    if (brightness == LED_OFF) {
>> +        ret = regmap_update_bits(led->regmap, LM3601X_ENABLE_REG,
>> +                    LM3601X_MODE_TORCH, LED_OFF);
>> +        goto out;
>> +    }
>> +
>> +    if (brightness == LED_ON)
>> +        brightness_val = LED_ON;
>> +    else
>> +        brightness_val = (brightness/2);
>> +
>> +    ret = regmap_write(led->regmap, LM3601X_LED_TORCH_REG, brightness_val);
>> +    if (ret < 0)
>> +        goto out;
>> +
>> +    ret = regmap_update_bits(led->regmap, LM3601X_ENABLE_REG,
>> +                    LM3601X_MODE_TORCH,
>> +                    LM3601X_MODE_TORCH);
>> +
>> +out:
>> +    mutex_unlock(&led->lock);
>> +    return ret;
>> +}
>> +
>> +static int lm3601x_strobe_set(struct led_classdev_flash *fled_cdev,
>> +                bool state)
>> +{
>> +    struct lm3601x_led *led = fled_cdev_to_led(fled_cdev);
>> +    int ret;
>> +    int current_timeout;
>> +    int reg_count;
>> +    int i;
>> +    int timeout_reg_val = 0;
>> +
>> +    mutex_lock(&led->lock);
>> +
>> +    ret = regmap_read(led->regmap, LM3601X_CFG_REG, &current_timeout);
>> +    if (ret < 0)
>> +        goto out;
>> +
>> +    reg_count = ARRAY_SIZE(strobe_timeouts);
>> +    for (i = 0; i < reg_count; i++) {
>> +        if (led->strobe_timeout > strobe_timeouts[i].timeout)
>> +            continue;
>> +
>> +        if (led->strobe_timeout <= strobe_timeouts[i].timeout) {
>> +            timeout_reg_val = (strobe_timeouts[i].reg_val << 1);
>> +            break;
>> +        }
>> +
>> +        ret = -EINVAL;
>> +        goto out;
>> +    }
>> +
>> +    if (led->strobe_timeout != current_timeout)
>> +        ret = regmap_update_bits(led->regmap, LM3601X_CFG_REG,
>> +                    LM3601X_TIMEOUT_MASK, timeout_reg_val);
>> +
>> +    if (state)
>> +        ret = regmap_update_bits(led->regmap, LM3601X_ENABLE_REG,
>> +                    LM3601X_MODE_STROBE,
>> +                    LM3601X_MODE_STROBE);
>> +    else
>> +        ret = regmap_update_bits(led->regmap, LM3601X_ENABLE_REG,
>> +                    LM3601X_MODE_STROBE, LED_OFF);
>> +
>> +    ret = lm3601x_read_faults(led);
>> +out:
>> +    mutex_unlock(&led->lock);
>> +    return ret;
>> +}
>> +
>> +static int lm3601x_strobe_brightness_set(struct led_classdev *cdev,
>> +                     enum led_brightness brightness)
>> +{
>> +    struct led_classdev_flash *fled_cdev = lcdev_to_flcdev(cdev);
>> +    struct lm3601x_led *led = fled_cdev_to_led(fled_cdev);
>> +    int ret;
>> +    u8 brightness_val;
>> +
>> +    mutex_lock(&led->lock);
>> +    ret = lm3601x_read_faults(led);
>> +    if (ret < 0)
>> +        goto out;
>> +
>> +    if (brightness == LED_OFF) {
>> +        ret = regmap_update_bits(led->regmap, LM3601X_ENABLE_REG,
>> +                    LM3601X_MODE_STROBE, LED_OFF);
>> +        goto out;
>> +    }
>> +
>> +    if (brightness == LED_ON)
>> +        brightness_val = LED_ON;
>> +    else
>> +        brightness_val = (brightness/2);
>> +
>> +    ret = regmap_write(led->regmap, LM3601X_LED_FLASH_REG, brightness_val);
>> +
>> +out:
>> +    mutex_unlock(&led->lock);
>> +    return ret;
>> +}
>> +
>> +static int lm3601x_strobe_timeout_set(struct led_classdev_flash *fled_cdev,
>> +                u32 timeout)
>> +{
>> +    struct lm3601x_led *led = fled_cdev_to_led(fled_cdev);
>> +    int ret = 0;
>> +
>> +    mutex_lock(&led->lock);
>> +
>> +    if (timeout > led->max_strobe_timeout)
>> +        ret = -EINVAL;
> 
> LED flash core takes care of clamping timeout setting
> according to the defined constraints.

OK

> 
>> +    else
>> +        led->strobe_timeout = timeout;
>> +
>> +    mutex_unlock(&led->lock);
>> +
>> +    return ret;
>> +}
>> +
>> +static int lm3601x_strobe_get(struct led_classdev_flash *fled_cdev,
>> +                bool *state)
>> +{
>> +    struct lm3601x_led *led = fled_cdev_to_led(fled_cdev);
>> +    int ret;
>> +    int strobe_state;
>> +
>> +    mutex_lock(&led->lock);
>> +
>> +    ret = regmap_read(led->regmap, LM3601X_ENABLE_REG, &strobe_state);
>> +    if (ret < 0)
>> +        goto out;
>> +
>> +    *state = strobe_state & LM3601X_MODE_STROBE;
>> +
>> +out:
>> +    mutex_unlock(&led->lock);
>> +    return ret;
>> +}
>> +
>> +static int lm3601x_ir_brightness_set(struct led_classdev *cdev,
>> +                     enum led_brightness brightness)
>> +{
>> +    struct lm3601x_led *led =
>> +        container_of(cdev, struct lm3601x_led, cdev_ir);
>> +    int ret;
>> +    u8 brightness_val;
>> +
>> +    mutex_lock(&led->lock);
>> +    ret = lm3601x_read_faults(led);
>> +    if (ret < 0)
>> +        goto out;
>> +
>> +    if (brightness == LED_OFF) {
>> +        ret = regmap_update_bits(led->regmap, LM3601X_ENABLE_REG,
>> +                    LM3601X_LED_IR,
>> +                    LED_OFF);
>> +        goto out;
>> +    }
>> +
>> +    if (brightness == LED_ON)
>> +        brightness_val = LED_ON;
>> +    else
>> +        brightness_val = (brightness/2);
>> +
>> +    ret = regmap_write(led->regmap, LM3601X_LED_FLASH_REG, brightness_val);
>> +    if (ret < 0)
>> +        goto out;
>> +
>> +    ret = regmap_update_bits(led->regmap, LM3601X_ENABLE_REG,
>> +                    LM3601X_MODE_IR_DRV,
>> +                    LM3601X_MODE_IR_DRV);
>> +
>> +out:
>> +    mutex_unlock(&led->lock);
>> +    return ret;
>> +}
>> +
>> +static int lm3601x_strobe_fault_get(struct led_classdev_flash *fled_cdev,
>> +                u32 *fault)
> 
> Does the device report only strobe related faults?

No.  It has under/over voltage and thermal.

> 
>> +{
>> +    struct lm3601x_led *led = fled_cdev_to_led(fled_cdev);
>> +
>> +    lm3601x_read_faults(led);
>> +
>> +    *fault = led->last_flag;
> 
> You should translate device specific faults to LED_FAULT* flags.
> Please compare e.g. drivers/leds/leds-max77693.c or
> driver/leds/leds-as3645a.c.

Hmm.  This code is in the max77693.c.  I think the translation should be in the
read_faults function in this file and not here.

I will add that translation above

> 
>> +
>> +    return 0;
>> +}
>> +
>> +static const struct led_flash_ops strobe_ops = {
>> +    .strobe_set        = lm3601x_strobe_set,
>> +    .strobe_get        = lm3601x_strobe_get,
>> +    .timeout_set        = lm3601x_strobe_timeout_set,
>> +    .fault_get        = lm3601x_strobe_fault_get,
>> +};
>> +
>> +static int lm3601x_register_leds(struct lm3601x_led *led)
>> +{
>> +    struct led_classdev_flash *fled_cdev;
>> +    struct led_classdev *led_cdev;
>> +    int err = -ENODEV;
>> +
>> +    if (led->torch_node) {
>> +        led->cdev_torch.name = led->torch;
>> +        led->cdev_torch.max_brightness = LED_FULL;
>> +        led->cdev_torch.brightness_set_blocking = lm3601x_torch_brightness_set;
>> +        err = devm_led_classdev_register(&led->client->dev,
>> +                &led->cdev_torch);
>> +        if (err < 0)
>> +            return err;
>> +    }
>> +
>> +    if (led->strobe_node) {
>> +        fled_cdev = &led->fled_cdev;
>> +        fled_cdev->ops = &strobe_ops;
>> +
>> +        led_cdev = &fled_cdev->led_cdev;
>> +        led_cdev->name = led->strobe;
>> +        led_cdev->max_brightness = LED_FULL;
>> +        led_cdev->brightness_set_blocking = lm3601x_strobe_brightness_set;
>> +        led_cdev->flags |= LED_DEV_CAP_FLASH;
>> +
>> +        err = led_classdev_flash_register(&led->client->dev,
>> +                fled_cdev);
>> +        if (err < 0)
>> +            return err;
>> +    }
>> +
>> +    if (led->ir_node) {
>> +        led->cdev_ir.name = led->ir;
>> +        led->cdev_ir.max_brightness = LED_FULL;
>> +        led->cdev_ir.brightness_set_blocking =
>> +                        lm3601x_ir_brightness_set;
>> +
>> +        err = devm_led_classdev_register(&led->client->dev,
>> +                &led->cdev_ir);
>> +    }
>> +
>> +    return err;
>> +}
>> +
>> +static void lm3601x_init_flash_timeout(struct lm3601x_led *led)
>> +{
>> +    struct led_flash_setting *setting;
>> +
>> +    setting = &led->fled_cdev.timeout;
>> +    setting->min = strobe_timeouts[0].timeout;
>> +    setting->max = led->max_strobe_timeout;
>> +    setting->step = 40;
>> +    setting->val = led->max_strobe_timeout;
>> +}
>> +
>> +static int lm3601x_parse_node(struct lm3601x_led *led,
>> +                  struct device_node *node)
>> +{
>> +    struct device_node *child_node;
>> +    const char *name;
>> +    int ret = -ENODEV;
>> +
>> +    for_each_available_child_of_node(node, child_node) {
>> +        u32 id = 0;
>> +
>> +        of_property_read_u32(child_node, "reg", &id);
>> +
>> +        switch (id) {
>> +        case LM3601X_LED_TORCH:
>> +            led->torch_node = of_node_get(child_node);
>> +            break;
>> +        case LM3601X_LED_STROBE:
>> +            led->strobe_node = of_node_get(child_node);
>> +            break;
>> +        case LM3601X_LED_IR:
>> +            led->ir_node = of_node_get(child_node);
>> +            break;
>> +        default:
>> +            dev_warn(&led->client->dev,
>> +                 "unknown LED %u encountered, ignoring\n", id);
>> +            break;
>> +        }
>> +    }
>> +
>> +    if (led->torch_node) {
>> +        ret = of_property_read_string(led->torch_node, "label", &name);
>> +        if (!ret)
>> +            snprintf(led->torch, sizeof(led->torch),
>> +                "%s:%s", led->torch_node->name, name);
>> +        else
>> +            snprintf(led->torch, sizeof(led->torch),
>> +                "%s:torch", led->torch_node->name);
>> +        ret = of_property_read_u32(led->torch_node, "led-max-microamp",
>> +                    &led->torch_current_max);
>> +        if (ret < 0) {
>> +            led->torch_current_max = LM3601X_MIN_TORCH_I_UA;
>> +            dev_warn(&led->client->dev,
>> +                "led-max-microamp DT property missing\n");
>> +        }
>> +
>> +        of_node_put(led->torch_node);
>> +    }
>> +
>> +    if (led->strobe_node) {
>> +        ret = of_property_read_string(led->strobe_node, "label", &name);
>> +        if (!ret)
>> +            snprintf(led->strobe, sizeof(led->strobe),
>> +                "%s:%s", led->strobe_node->name, name);
>> +        else
>> +            snprintf(led->strobe, sizeof(led->strobe),
>> +                "%s::strobe", led->strobe_node->name);
>> +
>> +        ret = of_property_read_u32(led->strobe_node,
>> +                    "flash-max-microamp",
>> +                    &led->strobe_current_max);
>> +        if (ret < 0) {
>> +            led->strobe_current_max = LM3601X_MIN_STROBE_I_MA;
>> +            dev_warn(&led->client->dev,
>> +                 "flash-max-microamp DT property missing\n");
>> +        }
>> +
>> +        ret = of_property_read_u32(led->strobe_node,
>> +                    "flash-max-timeout-us",
>> +                    &led->max_strobe_timeout);
>> +        if (ret < 0) {
>> +            led->max_strobe_timeout = strobe_timeouts[0].reg_val;
>> +            dev_warn(&led->client->dev,
>> +                 "flash-max-timeout-us DT property missing\n");
>> +        }
> 
> Common LED bindings state that flash-max-microamp and
> flash-max-timeout-us properties are mandatory.

OK.

> 
>> +
>> +        lm3601x_init_flash_timeout(led);
>> +
>> +        of_node_put(led->strobe_node);
>> +    }
>> +
>> +    if (led->ir_node) {
>> +        ret = of_property_read_string(led->ir_node, "label", &name);
>> +        if (!ret)
>> +            snprintf(led->ir, sizeof(led->ir),
>> +                "%s:%s", led->ir_node->name, name);
>> +        else
>> +            snprintf(led->ir, sizeof(led->ir),
>> +                "%s::infrared", led->ir_node->name);
>> +
>> +        of_node_put(led->ir_node);
>> +    }
>> +
>> +    return ret;
>> +}
>> +
>> +static int lm3601x_probe(struct i2c_client *client,
>> +            const struct i2c_device_id *id)
>> +{
>> +    struct lm3601x_led *led;
>> +    int err;
>> +
>> +    led = devm_kzalloc(&client->dev,
>> +                sizeof(struct lm3601x_led), GFP_KERNEL);
>> +    if (!led)
>> +        return -ENOMEM;
>> +
>> +    err = lm3601x_parse_node(led, client->dev.of_node);
>> +    if (err < 0)
>> +        return -ENODEV;
>> +
>> +    led->client = client;
>> +    led->regmap = devm_regmap_init_i2c(client, &lm3601x_regmap);
>> +    if (IS_ERR(led->regmap)) {
>> +        err = PTR_ERR(led->regmap);
>> +        dev_err(&client->dev,
>> +            "Failed to allocate register map: %d\n", err);
>> +        return err;
>> +    }
>> +
>> +    mutex_init(&led->lock);
>> +    i2c_set_clientdata(client, led);
>> +    err = lm3601x_register_leds(led);
>> +
>> +    return err;
>> +}
>> +
>> +static int lm3601x_remove(struct i2c_client *client)
>> +{
>> +    struct lm3601x_led *led = i2c_get_clientdata(client);
>> +
>> +    regmap_update_bits(led->regmap, LM3601X_ENABLE_REG,
>> +               LM3601X_ENABLE_MASK,
>> +               LM3601X_MODE_STANDBY);
>> +
>> +    return 0;
>> +}
>> +
>> +static const struct i2c_device_id lm3601x_id[] = {
>> +    { "LM36010", CHIP_LM36010 },
>> +    { "LM36011", CHIP_LM36011 },
>> +    { },
>> +};
>> +MODULE_DEVICE_TABLE(i2c, lm3601x_id);
>> +
>> +static const struct of_device_id of_lm3601x_leds_match[] = {
>> +    { .compatible = "ti,lm36010", },
>> +    { .compatible = "ti,lm36011", },
>> +    {},
>> +};
>> +MODULE_DEVICE_TABLE(of, of_lm3601x_leds_match);
>> +
>> +static struct i2c_driver lm3601x_i2c_driver = {
>> +    .driver = {
>> +        .name = "lm3601x",
>> +        .of_match_table = of_lm3601x_leds_match,
>> +    },
>> +    .probe = lm3601x_probe,
>> +    .remove = lm3601x_remove,
>> +    .id_table = lm3601x_id,
>> +};
>> +module_i2c_driver(lm3601x_i2c_driver);
>> +
>> +MODULE_DESCRIPTION("Texas Instruments Flash Lighting driver for LM3601X");
>> +MODULE_AUTHOR("Dan Murphy <dmurphy@ti.com>");
>> +MODULE_LICENSE("GPL v2");
>>
> 


-- 
------------------
Dan Murphy

^ permalink raw reply

* Re: [PATCH 2/3] arm64: dts: renesas: r8a77995: Add VIN4
From: Niklas Söderlund @ 2018-05-11 11:25 UTC (permalink / raw)
  To: Jacopo Mondi
  Cc: laurent.pinchart, horms, geert, magnus.damm, robh+dt,
	linux-renesas-soc, devicetree, linux-arm-kernel, linux-kernel
In-Reply-To: <1526032802-14376-3-git-send-email-jacopo+renesas@jmondi.org>

Hi Jacopo,

Thanks for your work.

On 2018-05-11 12:00:01 +0200, Jacopo Mondi wrote:
> Describe VIN4 interface for R-Car D3 R8A77995 SoC.
> 
> Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>

Acked-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

> ---
>  arch/arm64/boot/dts/renesas/r8a77995.dtsi | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/renesas/r8a77995.dtsi b/arch/arm64/boot/dts/renesas/r8a77995.dtsi
> index 82aed7e..bdf7017 100644
> --- a/arch/arm64/boot/dts/renesas/r8a77995.dtsi
> +++ b/arch/arm64/boot/dts/renesas/r8a77995.dtsi
> @@ -783,6 +783,17 @@
>  				};
>  			};
>  		};
> +
> +		vin4: video@e6ef4000 {
> +			compatible = "renesas,vin-r8a77995";
> +			reg = <0 0xe6ef4000 0 0x1000>;
> +			interrupts = <GIC_SPI 174 IRQ_TYPE_LEVEL_HIGH>;
> +			clocks = <&cpg CPG_MOD 807>;
> +			power-domains = <&sysc R8A77995_PD_ALWAYS_ON>;
> +			resets = <&cpg 807>;
> +			renesas,id = <4>;
> +			status = "disabled";
> +		};
>  	};
>  
>  	timer {
> -- 
> 2.7.4
> 

-- 
Regards,
Niklas Söderlund

^ permalink raw reply

* Re: [PATCH 1/3] dt-bindings: media: rcar-vin: Add R8A77995 support
From: Niklas Söderlund @ 2018-05-11 11:22 UTC (permalink / raw)
  To: Jacopo Mondi
  Cc: laurent.pinchart, horms, geert, magnus.damm, robh+dt,
	linux-renesas-soc, devicetree, linux-arm-kernel, linux-kernel
In-Reply-To: <1526032802-14376-2-git-send-email-jacopo+renesas@jmondi.org>

Hi Jacopo,

Thanks for your work.

On 2018-05-11 12:00:00 +0200, Jacopo Mondi wrote:
> Add compatible string for R-Car D3 R8A7795 to list of SoCs supported by
> rcar-vin driver.
> 
> Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>

Acked-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

> ---
>  Documentation/devicetree/bindings/media/rcar_vin.txt | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/Documentation/devicetree/bindings/media/rcar_vin.txt b/Documentation/devicetree/bindings/media/rcar_vin.txt
> index a19517e1..5c6f2a7 100644
> --- a/Documentation/devicetree/bindings/media/rcar_vin.txt
> +++ b/Documentation/devicetree/bindings/media/rcar_vin.txt
> @@ -22,6 +22,7 @@ on Gen3 platforms to a CSI-2 receiver.
>     - "renesas,vin-r8a7795" for the R8A7795 device
>     - "renesas,vin-r8a7796" for the R8A7796 device
>     - "renesas,vin-r8a77970" for the R8A77970 device
> +   - "renesas,vin-r8a77995" for the R8A77995 device
>     - "renesas,rcar-gen2-vin" for a generic R-Car Gen2 or RZ/G1 compatible
>       device.
>  
> -- 
> 2.7.4
> 

-- 
Regards,
Niklas Söderlund

^ permalink raw reply

* Re: [PATCH 2/2] arm64: dts: Add Mediatek SoC MT8183 and evaluation board dts and Makefile
From: Matthias Brugger @ 2018-05-11 11:19 UTC (permalink / raw)
  To: Erin Lo
  Cc: Mark Rutland, devicetree, srv_heupstream, Ben Ho, Rob Herring,
	linux-mediatek, linux-serial, linux-arm-kernel
In-Reply-To: <1526035267.13828.13.camel@mtksdaap41>



On 05/11/2018 12:41 PM, Erin Lo wrote:
> On Fri, 2018-05-11 at 10:36 +0200, Matthias Brugger wrote:
>>
>> On 05/11/2018 08:11 AM, Erin Lo wrote:
[...]
>>
>> I wonder if there aren't any other devices which can be supported out of the box.
>> I understand that for now we are missing the clock driver and the pinctrl
>> driver. Are you planning to submit them in the near future?
>>
>> I'm asking because I don't want to bloat the dts with boards that only can boot
>> to an initramfs with a serial console. Especially if there is no HW + datasheet
>> available for anyone in the community who wants to work on this.
>>
>> Regards,
>> Matthias
>>
>> Regards,
>> Matthias
> 
> 
> We have implement clock and pinctrl driver these days, and plan to
> submit them maybe next month.
> After that we will submit other drivers of MT8183 continuously.
> 

I'm happy to hear this. So in this case I'm fine with merging these once you
figured out the dt-bindings.

Thanks a lot,
Matthias

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox