* Re: [PATCH 1/2] dt-bindings: media: rcar_vin: add device tree support for r8a774[35]
From: Geert Uytterhoeven @ 2017-11-16 13:53 UTC (permalink / raw)
To: Fabrizio Castro
Cc: Mauro Carvalho Chehab, Mark Rutland, Rob Herring,
Niklas Söderlund, Linux Media Mailing List, Linux-Renesas,
devicetree@vger.kernel.org, Simon Horman, Chris Paterson,
Biju Das
In-Reply-To: <TY1PR06MB089529F042099069AD960093C02E0@TY1PR06MB0895.apcprd06.prod.outlook.com>
Hi Fabrizio,
On Thu, Nov 16, 2017 at 2:45 PM, Fabrizio Castro
<fabrizio.castro@bp.renesas.com> wrote:
>> Subject: Re: [PATCH 1/2] dt-bindings: media: rcar_vin: add device tree support for r8a774[35]
>>
>> On Thu, Nov 16, 2017 at 1:11 PM, Fabrizio Castro
>> <fabrizio.castro@bp.renesas.com> wrote:
>> > --- a/Documentation/devicetree/bindings/media/rcar_vin.txt
>> > +++ b/Documentation/devicetree/bindings/media/rcar_vin.txt
>> > @@ -14,7 +14,10 @@ channel which can be either RGB, YUYV or BT656.
>> > - "renesas,vin-r8a7790" for the R8A7790 device
>> > - "renesas,vin-r8a7779" for the R8A7779 device
>> > - "renesas,vin-r8a7778" for the R8A7778 device
>> > - - "renesas,rcar-gen2-vin" for a generic R-Car Gen2 compatible device.
>> > + - "renesas,vin-r8a7745" for the R8A7745 device
>> > + - "renesas,vin-r8a7743" for the R8A7743 device
>>
>> Please keep the list sorted by SoC part number.
>
> It is sorted, just in descending order. Do you want me to re-order the full list in ascending order?
That may be a good idea, given the current order is non-standard and
counter-intuitive.
Thanks!
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply
* [PATCH 2/2] ARM: dts: genmai: Correct primary compatible value for eeprom
From: Geert Uytterhoeven @ 2017-11-16 13:51 UTC (permalink / raw)
To: Simon Horman, Magnus Damm
Cc: linux-renesas-soc, devicetree, Geert Uytterhoeven
In-Reply-To: <1510840296-12767-1-git-send-email-geert+renesas@glider.be>
The Renesas part number of the two-wire serial interface EEPROM is not
24C128, but R1EX24128ASA00A.
Hence change its primary compatible value to "renesas,r1ex24128".
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
arch/arm/boot/dts/r7s72100-genmai.dts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/boot/dts/r7s72100-genmai.dts b/arch/arm/boot/dts/r7s72100-genmai.dts
index cd4d5ff7749eaf53..5af2a0116ff2689a 100644
--- a/arch/arm/boot/dts/r7s72100-genmai.dts
+++ b/arch/arm/boot/dts/r7s72100-genmai.dts
@@ -123,7 +123,7 @@
pinctrl-0 = <&i2c2_pins>;
eeprom@50 {
- compatible = "renesas,24c128", "atmel,24c128";
+ compatible = "renesas,r1ex24128", "atmel,24c128";
reg = <0x50>;
pagesize = <64>;
};
--
2.7.4
^ permalink raw reply related
* [PATCH 1/2] ARM: dts: koelsch: Correct primary compatible value for eeprom
From: Geert Uytterhoeven @ 2017-11-16 13:51 UTC (permalink / raw)
To: Simon Horman, Magnus Damm
Cc: linux-renesas-soc-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, Geert Uytterhoeven
In-Reply-To: <1510840296-12767-1-git-send-email-geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>
The Renesas part number of the two-wire serial interface EEPROM is not
24C02, but R1EX24002ATAS0G.
Hence change its primary compatible value to "renesas,r1ex24002", like
on Gose.
Signed-off-by: Geert Uytterhoeven <geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>
---
arch/arm/boot/dts/r8a7791-koelsch.dts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/boot/dts/r8a7791-koelsch.dts b/arch/arm/boot/dts/r8a7791-koelsch.dts
index 4126de4179224261..fac9cdea49650591 100644
--- a/arch/arm/boot/dts/r8a7791-koelsch.dts
+++ b/arch/arm/boot/dts/r8a7791-koelsch.dts
@@ -708,7 +708,7 @@
};
eeprom@50 {
- compatible = "renesas,24c02", "atmel,24c02";
+ compatible = "renesas,r1ex24002", "atmel,24c02";
reg = <0x50>;
pagesize = <16>;
};
--
2.7.4
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* [PATCH 0/2] ARM: dts: renesas: Correct primary compatible value for eeprom
From: Geert Uytterhoeven @ 2017-11-16 13:51 UTC (permalink / raw)
To: Simon Horman, Magnus Damm
Cc: linux-renesas-soc-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA, Geert Uytterhoeven
Hi Simon, Magnus,
The Renesas part numbers of the two-wire serial interface EEPROMs do not
follow the 24Cxx pattern, but the R1EX24xxx pattern.
Hence change the primary compatible values to the appropriate variant of
"renesas,r1ex24xxx", like is already done on Gose.
Note that the second patch depends on (trivial) "[PATCH] dt-bindings:
i2c: eeprom: Add Renesas R1EX24128" to please checkpatch.
Thanks!
Geert Uytterhoeven (2):
ARM: dts: koelsch: Correct primary compatible value for eeprom
ARM: dts: genmai: Correct primary compatible value for eeprom
arch/arm/boot/dts/r7s72100-genmai.dts | 2 +-
arch/arm/boot/dts/r8a7791-koelsch.dts | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
--
2.7.4
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* [PATCH] dt-bindings: i2c: eeprom: Add Renesas R1EX24128
From: Geert Uytterhoeven @ 2017-11-16 13:46 UTC (permalink / raw)
To: Rob Herring, Mark Rutland, Wolfram Sang, Bartosz Golaszewski
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-i2c-u79uwXL29TY76Z2rM5mHXA,
linux-renesas-soc-u79uwXL29TY76Z2rM5mHXA, Geert Uytterhoeven
Document the compatible value for the Renesas R1EX24128ASAS0A two-wire
serial interface EEPROM, so it can be used in DTS files without causing
checkpatch warnings.
Signed-off-by: Geert Uytterhoeven <geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>
---
Documentation/devicetree/bindings/eeprom/eeprom.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/eeprom/eeprom.txt b/Documentation/devicetree/bindings/eeprom/eeprom.txt
index 27f2bc15298a46fc..dab813cfdaa76b96 100644
--- a/Documentation/devicetree/bindings/eeprom/eeprom.txt
+++ b/Documentation/devicetree/bindings/eeprom/eeprom.txt
@@ -14,7 +14,7 @@ Required properties:
"ramtron,24c64"
- "renesas,r1ex24002"
+ "renesas,r1ex24002", "renesas,r1ex24128"
The following manufacturers values have been deprecated:
"at", "at24"
--
2.7.4
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* RE: [PATCH 1/2] dt-bindings: media: rcar_vin: add device tree support for r8a774[35]
From: Fabrizio Castro @ 2017-11-16 13:45 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Mauro Carvalho Chehab, Mark Rutland, Rob Herring,
Niklas Söderlund, Linux Media Mailing List, Linux-Renesas,
devicetree@vger.kernel.org, Simon Horman, Chris Paterson,
Biju Das
In-Reply-To: <CAMuHMdW+krUp5ELO4NFxGi8NZ5-H4vrtm-=OXyvZKMCk2f-WcQ@mail.gmail.com>
Hello Geert,
thank you for your comment!
> Subject: Re: [PATCH 1/2] dt-bindings: media: rcar_vin: add device tree support for r8a774[35]
>
> On Thu, Nov 16, 2017 at 1:11 PM, Fabrizio Castro
> <fabrizio.castro@bp.renesas.com> wrote:
> > --- a/Documentation/devicetree/bindings/media/rcar_vin.txt
> > +++ b/Documentation/devicetree/bindings/media/rcar_vin.txt
> > @@ -14,7 +14,10 @@ channel which can be either RGB, YUYV or BT656.
> > - "renesas,vin-r8a7790" for the R8A7790 device
> > - "renesas,vin-r8a7779" for the R8A7779 device
> > - "renesas,vin-r8a7778" for the R8A7778 device
> > - - "renesas,rcar-gen2-vin" for a generic R-Car Gen2 compatible device.
> > + - "renesas,vin-r8a7745" for the R8A7745 device
> > + - "renesas,vin-r8a7743" for the R8A7743 device
>
> Please keep the list sorted by SoC part number.
>
It is sorted, just in descending order. Do you want me to re-order the full list in ascending order?
Thanks,
Fab
Renesas Electronics Europe Ltd, Dukes Meadow, Millboard Road, Bourne End, Buckinghamshire, SL8 5FH, UK. Registered in England & Wales under Registered No. 04586709.
^ permalink raw reply
* Re: [PATCH v2 1/4] omapdrm: fix compatible string for td028ttec1
From: H. Nikolaus Schaller @ 2017-11-16 13:43 UTC (permalink / raw)
To: Tomi Valkeinen
Cc: Thierry Reding, David Airlie, Rob Herring, Mark Rutland,
Benoît Cousson, Tony Lindgren, Russell King,
Bartlomiej Zolnierkiewicz, Laurent Pinchart, Julia Lawall,
Sean Paul, dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-omap-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-fbdev-u79uwXL29TY76Z2rM5mHXA,
letux-kernel-S0jZdbWzriLCfDggNXIi3w,
kernel-Jl6IXVxNIMRxAtABVqVhTwC/G2K4zDHf
In-Reply-To: <4753a425-d050-7f2d-35ae-b387accfd99e-l0cyMroinI0@public.gmane.org>
> Am 16.11.2017 um 13:32 schrieb Tomi Valkeinen <tomi.valkeinen-l0cyMroinI0@public.gmane.org>:
>
> On 16/11/17 10:50, H. Nikolaus Schaller wrote:
>> The vendor name was "toppoly" but other panels and the vendor list
>> have defined it as "tpo". So let's fix it in driver and bindings.
>>
>> Signed-off-by: H. Nikolaus Schaller <hns-xXXSsgcRVICgSpxsJD1C4w@public.gmane.org>
>> ---
>
>
>> -MODULE_ALIAS("spi:toppoly,td028ttec1");
>> +MODULE_ALIAS("spi:tpo,td028ttec1");
>
> Doesn't this mean that the module won't load if you have old bindings?
Hm.
Well, I think it can load but doesn't automatically from DT strings which might
be unexpected.
> Can't we have two module aliases?
I think we can. Just a random example:
https://elixir.free-electrons.com/linux/latest/source/drivers/w1/slaves/w1_therm.c#L754
So we should keep both.
Should I submit a new version?
BR,
Nikolaus
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH v2 6/8] dt-bindings: power: Add Actions Semi S700 SPS
From: Andreas Färber @ 2017-11-16 13:42 UTC (permalink / raw)
To: Rob Herring
Cc: linux-arm-kernel, Thomas Liau, Jeff Chen,
张东风, 刘炜,
张天益, 梅利, support, linux-kernel,
Mark Rutland, devicetree
In-Reply-To: <20171116043529.hrrgiga4hpdsy2tc@rob-hp-laptop>
Am 16.11.2017 um 05:35 schrieb Rob Herring:
> On Tue, Nov 14, 2017 at 12:34:25AM +0100, Andreas Färber wrote:
>> Define power domains for Actions Semi S700 SoC Smart Power System (SPS).
>>
>> Signed-off-by: Andreas Färber <afaerber@suse.de>
>> ---
>> v2: New
>>
>> .../devicetree/bindings/power/actions,owl-sps.txt | 2 ++
>> include/dt-bindings/power/owl-s700-powergate.h | 20 ++++++++++++++++++++
>> 2 files changed, 22 insertions(+)
>> create mode 100644 include/dt-bindings/power/owl-s700-powergate.h
>>
>> diff --git a/Documentation/devicetree/bindings/power/actions,owl-sps.txt b/Documentation/devicetree/bindings/power/actions,owl-sps.txt
>> index 007b9a7ae723..78edd63641e8 100644
>> --- a/Documentation/devicetree/bindings/power/actions,owl-sps.txt
>> +++ b/Documentation/devicetree/bindings/power/actions,owl-sps.txt
>> @@ -2,10 +2,12 @@ Actions Semi Owl Smart Power System (SPS)
>>
>> Required properties:
>> - compatible : "actions,s500-sps" for S500
>> + "actions,s700-sps" for S700
>> - reg : Offset and length of the register set for the device.
>> - #power-domain-cells : Must be 1.
>> See macros in:
>> include/dt-bindings/power/owl-s500-powergate.h for S500
>> + include/dt-bindings/power/owl-s700-powergate.h for S700
>>
>>
>> Example:
>> diff --git a/include/dt-bindings/power/owl-s700-powergate.h b/include/dt-bindings/power/owl-s700-powergate.h
>> new file mode 100644
>> index 000000000000..4ded16bc074f
>> --- /dev/null
>> +++ b/include/dt-bindings/power/owl-s700-powergate.h
>> @@ -0,0 +1,20 @@
>> +/*
>> + * Actions Semi S700 SPS
>> + *
>> + * Copyright (c) 2017 Andreas Färber
>> + *
>> + * SPDX-License-Identifier: (GPL-2.0+ OR MIT)
>
> The decree now for SPDX tags is make this the first line using "//".
Thanks for noticing. Fixed:
diff --git a/include/dt-bindings/power/owl-s700-powergate.h
b/include/dt-bindings/power/owl-s700-powergate.h
index 4ded16bc074f..4cf1aefbf09c 100644
--- a/include/dt-bindings/power/owl-s700-powergate.h
+++ b/include/dt-bindings/power/owl-s700-powergate.h
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
* Actions Semi S700 SPS
*
* Copyright (c) 2017 Andreas Färber
- *
- * SPDX-License-Identifier: (GPL-2.0+ OR MIT)
*/
#ifndef DT_BINDINGS_POWER_OWL_S700_POWERGATE_H
#define DT_BINDINGS_POWER_OWL_S700_POWERGATE_H
>
> Otherwise,
>
> Acked-by: Rob Herring <robh@kernel.org>
Thanks, queued in v4.16/dt64:
https://git.kernel.org/pub/scm/linux/kernel/git/afaerber/linux-actions.git/log/?h=v4.16/dt64
Regards,
Andreas
--
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
^ permalink raw reply related
* Re: [PATCH v7 02/13] dt-bindings: Add SLIMbus bindings
From: Srinivas Kandagatla @ 2017-11-16 13:40 UTC (permalink / raw)
To: Vinod Koul
Cc: gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r,
broonie-DgEjT+Ai2ygdnm+yROfE0A, alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
sdharia-sgV2jX0FEOL9JmXXK+q4OQ, bp-l3A5Bk7waGM,
poeschel-Xtl8qvBWbHwb1SvskN2V4Q, treding-DDmLM1+adcrQT0dZR+AlfA,
andreas.noever-Re5JQEeQqe8AvxtiuMwx3w,
alan-VuQAYsv1563Yd54FQh9/CA,
mathieu.poirier-QSEj5FYQhm4dnm+yROfE0A, daniel-/w4YWyX8dFk,
jkosina-AlSwsSmVLrQ, sharon.dvir1-MQgwKvJRKlGYZoqfULhbRA,
joe-6d6DIl74uiNBDgjK7y7TUQ, davem-fT/PcQaiUtIeIZ0/mPfg9Q,
james.hogan-1AXoQHu6uovQT0dZR+AlfA,
michael.opdenacker-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8,
robh+dt-DgEjT+Ai2ygdnm+yROfE0A, pawel.moll-5wv7dgnIgG8,
mark.rutland-5wv7dgnIgG8, devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-arm-msm-u79uwXL29TY76Z2rM5mHXA, arnd-r2nGTMty4D4
In-Reply-To: <20171116130914.GU3187@localhost>
Thanks for the review comments.
On 16/11/17 13:09, Vinod Koul wrote:
> On Wed, Nov 15, 2017 at 02:10:32PM +0000, srinivas.kandagatla-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org wrote:
>> From: Sagar Dharia <sdharia-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
>
>> +
>> +Child nodes:
>> +Every SLIMbus controller node can contain zero or more child nodes
>> +representing slave devices on the bus. Every SLIMbus slave device is
>> +uniquely determined by the enumeration address containing 4 fields:
>> +Manufacturer ID, Product code, Device index, and Instance value for
>> +the device.
>> +If child node is not present and it is instantiated after device
>> +discovery (slave device reporting itself present).
>
> So you allow the devices to work even if the respective firmware description
> is absent?
Yes, As SLIMbus itself itself is discoverable bus.
>
>> +
>> +In some cases it may be necessary to describe non-probeable device
>> +details such as non-standard ways of powering up a device. In
>> +such cases, child nodes for those devices will be present as
>> +slaves of the slimbus-controller, as detailed below.
>> +
>> +Required property for SLIMbus child node if it is present:
>> +- reg - Should be ('Device index', 'Instance ID') from SLIMbus
>> + Enumeration Address.
>> + Device Index Uniquely identifies multiple Devices within
>> + a single Component.
>> + Instance ID Is for the cases where multiple Devices of the
>> + same type or Class are attached to the bus.
>> +
>> +- compatible -"slimMID,PID". The textual representation of Manufacturer ID,
>> + Product Code, shall be in lower case hexadecimal with leading
>> + zeroes suppressed
>> +
>> + codec: wcd9310@1,0{
>> + compatible = "slim217,60";
>> + reg = <1 0>;
>> + };
>> + };
>
> Pardon my ignorance as I am not very familiar with DT nodes, but where are
> the Manufacturer ID, Product code, Device index, and Instance values here?
Manfacturer ID and Product code is part of compatible string
Device index and Instance value are part of reg.
>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH v7 03/13] slimbus: Add SLIMbus bus type
From: Srinivas Kandagatla @ 2017-11-16 13:40 UTC (permalink / raw)
To: Vinod Koul
Cc: mark.rutland, alsa-devel, michael.opdenacker, poeschel,
andreas.noever, arnd, treding, devicetree, james.hogan,
pawel.moll, linux-arm-msm, sharon.dvir1, robh+dt, sdharia, alan,
bp, mathieu.poirier, jkosina, linux-kernel, broonie, daniel,
gregkh, joe, davem
In-Reply-To: <20171116131814.GV3187@localhost>
Thanks for the review.
On 16/11/17 13:18, Vinod Koul wrote:
> On Wed, Nov 15, 2017 at 02:10:33PM +0000, srinivas.kandagatla@linaro.org wrote:
>
>> +menuconfig SLIMBUS
>> + tristate "Slimbus support"
>> + help
>> + Slimbus is standard interface between System-on-Chip and audio codec,
>> + and other peripheral components in typical embedded systems.
>> +
>> + If unsure, choose N.
>> +
>> +if SLIMBUS
>> +
>> +# SlIMbus controllers
>
> Slimbus perhaps?
>
slimbus is specified as "SLIMbus" in the mipi specs, so I should
probably stay with it and make it consistent across the patchset.
>> +static int slim_device_match(struct device *dev, struct device_driver *drv)
>> +{
>> + struct slim_device *sbdev = to_slim_device(dev);
>> + struct slim_driver *sbdrv = to_slim_driver(drv);
>> +
>> + return slim_match(sbdrv->id_table, sbdev) != NULL;
>
> return !!slim_match() ?
>
>> +static int slim_device_probe(struct device *dev)
>> +{
>> + struct slim_device *sbdev;
>> + struct slim_driver *sbdrv;
>> + int ret = 0;
>> +
>> + sbdev = to_slim_device(dev);
>> + sbdrv = to_slim_driver(dev->driver);
>> +
>> + if (sbdrv->probe)
>> + ret = sbdrv->probe(sbdev);
>
> shouldn't probe be mandatory :)
Yep it is .. I will fix that..
>
>> diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
>> index 1c2e8d6b7274..7d6238863fc1 100644
>> --- a/include/linux/mod_devicetable.h
>> +++ b/include/linux/mod_devicetable.h
>> @@ -452,6 +452,19 @@ struct spi_device_id {
>> kernel_ulong_t driver_data; /* Data private to the driver */
>> };
>>
>> +/* SLIMbus */
>> +
>> +#define SLIMBUS_NAME_SIZE 32
>> +#define SLIMBUS_MODULE_PREFIX "slim:"
>> +
>> +struct slim_device_id {
>> + __u16 manf_id, prod_code;
>> + __u8 dev_index, instance;
>> +
>> + /* Data private to the driver */
>> + kernel_ulong_t driver_data;
>
> As Takashi pointed out in SDW patches, this needs to be aligned.
>
Okay, I will make sure that driver_data is aligned.
>> +};
>> +
>
> I was hoping to see changes to devicetable-offsets.c and file2alias.c as
> well as that is required for module autoloading. I think that is required?
>
>> +/**
>> + * struct slim_device - Slim device handle.
>> + * @dev: Driver model representation of the device.
>> + * @name: Name of driver to use with this device.
>> + * @e_addr: Enumeration address of this device.
>> + * @driver: Device's driver. Pointer to access routines.
>> + * @laddr: 1-byte Logical address of this device.
>> + *
>> + * This is the client/device handle returned when a slimbus
>> + * device is registered with a controller.
>> + * Pointer to this structure is used by client-driver as a handle.
>> + */
>> +struct slim_device {
>> + struct device dev;
>> + struct slim_eaddr e_addr;
>> + struct list_head node;
>
> aligned with others please
>
Thanks for spotting, this looks like a leftover, There is no use of node
in this structure so I will remove it in next version.
>> +/**
>> + * struct slim_driver - Slimbus 'generic device' (slave) device driver
>> + * (similar to 'spi_device' on SPI)
>> + * @probe: Binds this driver to a slimbus device.
>> + * @remove: Unbinds this driver from the slimbus device.
>> + * @shutdown: Standard shutdown callback used during powerdown/halt.
>> + * @device_status: This callback is called when
>> + * -The device reports present and gets a laddr assigned
>> + * -The device reports absent, or the bus goes down.
>
> space after - pls
Yep.. will do that.
>
^ permalink raw reply
* RE: [PATCH 1/2] dt-bindings: media: rcar_vin: add device tree support for r8a774[35]
From: Fabrizio Castro @ 2017-11-16 13:39 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Mauro Carvalho Chehab, Mark Rutland, Rob Herring,
Niklas Söderlund, Linux Media Mailing List, Linux-Renesas,
devicetree@vger.kernel.org, Simon Horman, Chris Paterson,
Biju Das
In-Reply-To: <CAMuHMdXVb9xE5toLGHnaFX9y+-qVzz2_NzK6qEebaDiXxAec7w@mail.gmail.com>
Hello Geert,
thank you for your comment!
> > Add compatible strings for r8a7743 and r8a7745. No driver change
> > change is needed as "renesas,rcar-gen2-vin" will activate the right
>
> double "change"
oooops, do you think a v2 is in order?
Thanks,
Fab
Renesas Electronics Europe Ltd, Dukes Meadow, Millboard Road, Bourne End, Buckinghamshire, SL8 5FH, UK. Registered in England & Wales under Registered No. 04586709.
^ permalink raw reply
* [PATCH] ARM: dts: r8a779x: Add '#reset-cells' in cpg-mssr
From: Geert Uytterhoeven @ 2017-11-16 13:35 UTC (permalink / raw)
To: Simon Horman, Magnus Damm
Cc: Arnd Bergmann, linux-renesas-soc, devicetree, linux-arm-kernel,
Geert Uytterhoeven
From: Arnd Bergmann <arnd@arndb.de>
With the latest dtc, we get many warnings about the missing
'#reset-cells' property in these controllers, e.g.:
arch/arm/boot/dts/r8a7790-lager.dtb: Warning (resets_property): Missing property '#reset-cells' in node /clock-controller@e6150000 or bad phandle (referred from /can@e6e80000:resets[0])
arch/arm/boot/dts/r8a7792-blanche.dtb: Warning (resets_property): Missing property '#reset-cells' in node /soc/clock-controller@e6150000 or bad phandle (referred from /soc/dma-controller@e6700000:resets[0])
arch/arm/boot/dts/r8a7792-wheat.dtb: Warning (resets_property): Missing property '#reset-cells' in node /soc/clock-controller@e6150000 or bad phandle (referred from /soc/ethernet@e6800000:resets[0])
arch/arm/boot/dts/r8a7793-gose.dtb: Warning (resets_property): Missing property '#reset-cells' in node /clock-controller@e6150000 or bad phandle (referred from /gpio@e6050000:resets[0])
arch/arm/boot/dts/r8a7794-alt.dtb: Warning (resets_property): Missing property '#reset-cells' in node /clock-controller@e6150000 or bad phandle (referred from /i2c@e6500000:resets[0])
arch/arm/boot/dts/r8a7794-silk.dtb: Warning (resets_property): Missing property '#reset-cells' in node /clock-controller@e6150000 or bad phandle (referred from /interrupt-controller@e61c0000:resets[0])
This adds it for the three r8a779x chips that were lacking it. The
binding mandates this as <1>, so this is the value I use.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
[geert: Add fix for r8a7793.dtsi]
Fixes: 34fbd2b12761d111 ("ARM: dts: r8a7790: Add reset control properties")
Fixes: 6e11a322f1d7505d ("ARM: dts: r8a7792: Add reset control properties")
Fixes: 84fb19e1d201ba86 ("ARM: dts: r8a7793: Add reset control properties")
Fixes: 615beb759ca494a4 ("ARM: dts: r8a7794: Add reset control properties")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
arch/arm/boot/dts/r8a7790.dtsi | 1 +
arch/arm/boot/dts/r8a7792.dtsi | 1 +
arch/arm/boot/dts/r8a7793.dtsi | 1 +
arch/arm/boot/dts/r8a7794.dtsi | 1 +
4 files changed, 4 insertions(+)
diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi
index e2c530c330a8eb7e..450bfc0e9796a557 100644
--- a/arch/arm/boot/dts/r8a7790.dtsi
+++ b/arch/arm/boot/dts/r8a7790.dtsi
@@ -1202,6 +1202,7 @@
clock-names = "extal", "usb_extal";
#clock-cells = <2>;
#power-domain-cells = <0>;
+ #reset-cells = <1>;
};
prr: chipid@ff000044 {
diff --git a/arch/arm/boot/dts/r8a7792.dtsi b/arch/arm/boot/dts/r8a7792.dtsi
index 7b394273031e9a90..ac05fdb91798b88d 100644
--- a/arch/arm/boot/dts/r8a7792.dtsi
+++ b/arch/arm/boot/dts/r8a7792.dtsi
@@ -830,6 +830,7 @@
clock-names = "extal";
#clock-cells = <2>;
#power-domain-cells = <0>;
+ #reset-cells = <1>;
};
};
diff --git a/arch/arm/boot/dts/r8a7793.dtsi b/arch/arm/boot/dts/r8a7793.dtsi
index a83c2e9c5723fe2c..61dd291d907da2f5 100644
--- a/arch/arm/boot/dts/r8a7793.dtsi
+++ b/arch/arm/boot/dts/r8a7793.dtsi
@@ -1088,6 +1088,7 @@
clock-names = "extal", "usb_extal";
#clock-cells = <2>;
#power-domain-cells = <0>;
+ #reset-cells = <1>;
};
rst: reset-controller@e6160000 {
diff --git a/arch/arm/boot/dts/r8a7794.dtsi b/arch/arm/boot/dts/r8a7794.dtsi
index 96e405e70d9aeea5..106b4e1649ff695b 100644
--- a/arch/arm/boot/dts/r8a7794.dtsi
+++ b/arch/arm/boot/dts/r8a7794.dtsi
@@ -1106,6 +1106,7 @@
clock-names = "extal", "usb_extal";
#clock-cells = <2>;
#power-domain-cells = <0>;
+ #reset-cells = <1>;
};
rst: reset-controller@e6160000 {
--
2.7.4
^ permalink raw reply related
* [PATCH v2] arm64: dts: renesas: salvator-common: Add BD9571 PMIC
From: Geert Uytterhoeven @ 2017-11-16 13:34 UTC (permalink / raw)
To: Simon Horman, Magnus Damm
Cc: linux-renesas-soc, devicetree, linux-arm-kernel,
Geert Uytterhoeven
Add a device node for the ROHM BD9571MWV PMIC.
This was based on the example in the DT binding documentation, but using
IRQ0 instead of a GPIO interrupt, as that matches the schematics, and
because INTC-EX is a simpler block.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
v2:
- Clarify the choice for INTC-EX.
---
arch/arm64/boot/dts/renesas/salvator-common.dtsi | 29 ++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/arch/arm64/boot/dts/renesas/salvator-common.dtsi b/arch/arm64/boot/dts/renesas/salvator-common.dtsi
index 24a32c63ce7c1821..b9505a65a793708e 100644
--- a/arch/arm64/boot/dts/renesas/salvator-common.dtsi
+++ b/arch/arm64/boot/dts/renesas/salvator-common.dtsi
@@ -355,6 +355,30 @@
&i2c_dvfs {
status = "okay";
+
+ pmic: pmic@30 {
+ pinctrl-0 = <&irq0_pins>;
+ pinctrl-names = "default";
+
+ compatible = "rohm,bd9571mwv";
+ reg = <0x30>;
+ interrupt-parent = <&intc_ex>;
+ interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
+ interrupt-controller;
+ #interrupt-cells = <2>;
+ gpio-controller;
+ #gpio-cells = <2>;
+
+ regulators {
+ dvfs: dvfs {
+ regulator-name = "dvfs";
+ regulator-min-microvolt = <750000>;
+ regulator-max-microvolt = <1030000>;
+ regulator-boot-on;
+ regulator-always-on;
+ };
+ };
+ };
};
&ohci0 {
@@ -410,6 +434,11 @@
function = "i2c2";
};
+ irq0_pins: irq0 {
+ groups = "intc_ex_irq0";
+ function = "intc_ex";
+ };
+
pwm1_pins: pwm1 {
groups = "pwm1_a";
function = "pwm1";
--
2.7.4
^ permalink raw reply related
* Re: [PATCH 1/2] dt-bindings: media: rcar_vin: add device tree support for r8a774[35]
From: Geert Uytterhoeven @ 2017-11-16 13:20 UTC (permalink / raw)
To: Fabrizio Castro
Cc: Mauro Carvalho Chehab, Mark Rutland, Rob Herring,
Niklas Söderlund, Linux Media Mailing List, Linux-Renesas,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Simon Horman,
Chris Paterson, Biju Das
In-Reply-To: <1510834290-25434-2-git-send-email-fabrizio.castro-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org>
On Thu, Nov 16, 2017 at 1:11 PM, Fabrizio Castro
<fabrizio.castro-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org> wrote:
> --- a/Documentation/devicetree/bindings/media/rcar_vin.txt
> +++ b/Documentation/devicetree/bindings/media/rcar_vin.txt
> @@ -14,7 +14,10 @@ channel which can be either RGB, YUYV or BT656.
> - "renesas,vin-r8a7790" for the R8A7790 device
> - "renesas,vin-r8a7779" for the R8A7779 device
> - "renesas,vin-r8a7778" for the R8A7778 device
> - - "renesas,rcar-gen2-vin" for a generic R-Car Gen2 compatible device.
> + - "renesas,vin-r8a7745" for the R8A7745 device
> + - "renesas,vin-r8a7743" for the R8A7743 device
Please keep the list sorted by SoC part number.
> + - "renesas,rcar-gen2-vin" for a generic R-Car Gen2 or RZ/G1 compatible
> + device.
> - "renesas,rcar-gen3-vin" for a generic R-Car Gen3 compatible device.
>
> When compatible with the generic version nodes must list the
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH 1/2] dt-bindings: media: rcar_vin: add device tree support for r8a774[35]
From: Geert Uytterhoeven @ 2017-11-16 13:19 UTC (permalink / raw)
To: Fabrizio Castro
Cc: Mauro Carvalho Chehab, Mark Rutland, Rob Herring,
Niklas Söderlund, Linux Media Mailing List, Linux-Renesas,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Simon Horman,
Chris Paterson, Biju Das
In-Reply-To: <1510834290-25434-2-git-send-email-fabrizio.castro-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org>
On Thu, Nov 16, 2017 at 1:11 PM, Fabrizio Castro
<fabrizio.castro-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org> wrote:
> Add compatible strings for r8a7743 and r8a7745. No driver change
> change is needed as "renesas,rcar-gen2-vin" will activate the right
double "change"
> code. However, it is good practice to document compatible strings
> for the specific SoC as this allows SoC specific changes to the
> driver if needed, in addition to document SoC support and therefore
> allow checkpatch.pl to validate compatible string values.
>
> Signed-off-by: Fabrizio Castro <fabrizio.castro-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org>
> Reviewed-by: Biju Das <biju.das-kTT6dE0pTRh9uiUsa/gSgQ@public.gmane.org>
Reviewed-by: Geert Uytterhoeven <geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH v7 03/13] slimbus: Add SLIMbus bus type
From: Vinod Koul @ 2017-11-16 13:18 UTC (permalink / raw)
To: srinivas.kandagatla
Cc: mark.rutland, alsa-devel, michael.opdenacker, poeschel,
andreas.noever, arnd, treding, devicetree, james.hogan,
pawel.moll, linux-arm-msm, sharon.dvir1, robh+dt, sdharia, alan,
bp, mathieu.poirier, jkosina, linux-kernel, broonie, daniel,
gregkh, joe, davem
In-Reply-To: <20171115141043.29202-4-srinivas.kandagatla@linaro.org>
On Wed, Nov 15, 2017 at 02:10:33PM +0000, srinivas.kandagatla@linaro.org wrote:
> +menuconfig SLIMBUS
> + tristate "Slimbus support"
> + help
> + Slimbus is standard interface between System-on-Chip and audio codec,
> + and other peripheral components in typical embedded systems.
> +
> + If unsure, choose N.
> +
> +if SLIMBUS
> +
> +# SlIMbus controllers
Slimbus perhaps?
> +static int slim_device_match(struct device *dev, struct device_driver *drv)
> +{
> + struct slim_device *sbdev = to_slim_device(dev);
> + struct slim_driver *sbdrv = to_slim_driver(drv);
> +
> + return slim_match(sbdrv->id_table, sbdev) != NULL;
return !!slim_match() ?
> +static int slim_device_probe(struct device *dev)
> +{
> + struct slim_device *sbdev;
> + struct slim_driver *sbdrv;
> + int ret = 0;
> +
> + sbdev = to_slim_device(dev);
> + sbdrv = to_slim_driver(dev->driver);
> +
> + if (sbdrv->probe)
> + ret = sbdrv->probe(sbdev);
shouldn't probe be mandatory :)
> diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
> index 1c2e8d6b7274..7d6238863fc1 100644
> --- a/include/linux/mod_devicetable.h
> +++ b/include/linux/mod_devicetable.h
> @@ -452,6 +452,19 @@ struct spi_device_id {
> kernel_ulong_t driver_data; /* Data private to the driver */
> };
>
> +/* SLIMbus */
> +
> +#define SLIMBUS_NAME_SIZE 32
> +#define SLIMBUS_MODULE_PREFIX "slim:"
> +
> +struct slim_device_id {
> + __u16 manf_id, prod_code;
> + __u8 dev_index, instance;
> +
> + /* Data private to the driver */
> + kernel_ulong_t driver_data;
As Takashi pointed out in SDW patches, this needs to be aligned.
> +};
> +
I was hoping to see changes to devicetable-offsets.c and file2alias.c as
well as that is required for module autoloading. I think that is required?
> +/**
> + * struct slim_device - Slim device handle.
> + * @dev: Driver model representation of the device.
> + * @name: Name of driver to use with this device.
> + * @e_addr: Enumeration address of this device.
> + * @driver: Device's driver. Pointer to access routines.
> + * @laddr: 1-byte Logical address of this device.
> + *
> + * This is the client/device handle returned when a slimbus
> + * device is registered with a controller.
> + * Pointer to this structure is used by client-driver as a handle.
> + */
> +struct slim_device {
> + struct device dev;
> + struct slim_eaddr e_addr;
> + struct list_head node;
aligned with others please
> +/**
> + * struct slim_driver - Slimbus 'generic device' (slave) device driver
> + * (similar to 'spi_device' on SPI)
> + * @probe: Binds this driver to a slimbus device.
> + * @remove: Unbinds this driver from the slimbus device.
> + * @shutdown: Standard shutdown callback used during powerdown/halt.
> + * @device_status: This callback is called when
> + * -The device reports present and gets a laddr assigned
> + * -The device reports absent, or the bus goes down.
space after - pls
--
~Vinod
^ permalink raw reply
* Re: [linux-sunxi] Cedrus driver
From: Stefan Monnier @ 2017-11-16 13:11 UTC (permalink / raw)
To: devicetree-u79uwXL29TY76Z2rM5mHXA
Cc: linux-sunxi-/JYPxA39Uh5TLH3MbocFFw,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-media-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <20171116110204.poakahqjz4sj7pmu@flea>
>> Where can I find a list of TODOs to get it ready to be merged?
> Assuming that the request API is in, we'd need to:
> - Finish the MPEG4 support
> - Work on more useful codecs (H264 comes to my mind)
> - Implement the DRM planes support for the custom frame format
> - Implement the DRM planes support for scaling
> - Test it on more SoCs
Are all these really needed before it can be merged?
Stefan
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH v7 02/13] dt-bindings: Add SLIMbus bindings
From: Vinod Koul @ 2017-11-16 13:09 UTC (permalink / raw)
To: srinivas.kandagatla
Cc: gregkh, broonie, alsa-devel, sdharia, bp, poeschel, treding,
andreas.noever, alan, mathieu.poirier, daniel, jkosina,
sharon.dvir1, joe, davem, james.hogan, michael.opdenacker,
robh+dt, pawel.moll, mark.rutland, devicetree, linux-kernel,
linux-arm-msm, arnd
In-Reply-To: <20171115141043.29202-3-srinivas.kandagatla@linaro.org>
On Wed, Nov 15, 2017 at 02:10:32PM +0000, srinivas.kandagatla@linaro.org wrote:
> From: Sagar Dharia <sdharia@codeaurora.org>
>
> SLIMbus (Serial Low Power Interchip Media Bus) is a specification
> developed by MIPI (Mobile Industry Processor Interface) alliance.
> SLIMbus is a 2-wire implementation, which is used to communicate with
> peripheral components like audio-codec.
>
> This patch adds device tree bindings for the slimbus.
>
> Signed-off-by: Sagar Dharia <sdharia@codeaurora.org>
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> ---
> Documentation/devicetree/bindings/slimbus/bus.txt | 50 +++++++++++++++++++++++
> 1 file changed, 50 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/slimbus/bus.txt
>
> diff --git a/Documentation/devicetree/bindings/slimbus/bus.txt b/Documentation/devicetree/bindings/slimbus/bus.txt
> new file mode 100644
> index 000000000000..413b5076858e
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/slimbus/bus.txt
> @@ -0,0 +1,50 @@
> +SLIM(Serial Low Power Interchip Media Bus) bus
> +
> +SLIMbus is a 2-wire bus, and is used to communicate with peripheral
> +components like audio-codec.
> +
> +Required property for SLIMbus controller node:
> +- compatible - name of SLIMbus controller
> +
> +Child nodes:
> +Every SLIMbus controller node can contain zero or more child nodes
> +representing slave devices on the bus. Every SLIMbus slave device is
> +uniquely determined by the enumeration address containing 4 fields:
> +Manufacturer ID, Product code, Device index, and Instance value for
> +the device.
> +If child node is not present and it is instantiated after device
> +discovery (slave device reporting itself present).
So you allow the devices to work even if the respective firmware description
is absent?
> +
> +In some cases it may be necessary to describe non-probeable device
> +details such as non-standard ways of powering up a device. In
> +such cases, child nodes for those devices will be present as
> +slaves of the slimbus-controller, as detailed below.
> +
> +Required property for SLIMbus child node if it is present:
> +- reg - Should be ('Device index', 'Instance ID') from SLIMbus
> + Enumeration Address.
> + Device Index Uniquely identifies multiple Devices within
> + a single Component.
> + Instance ID Is for the cases where multiple Devices of the
> + same type or Class are attached to the bus.
> +
> +- compatible -"slimMID,PID". The textual representation of Manufacturer ID,
> + Product Code, shall be in lower case hexadecimal with leading
> + zeroes suppressed
> +
> +SLIMbus example for Qualcomm's slimbus manager component:
> +
> + slim@28080000 {
> + compatible = "qcom,apq8064-slim", "qcom,slim";
> + reg = <0x28080000 0x2000>,
> + interrupts = <0 33 0>;
> + clocks = <&lcc SLIMBUS_SRC>, <&lcc AUDIO_SLIMBUS_CLK>;
> + clock-names = "iface", "core";
> + #address-cells = <2>;
> + #size-cell = <0>;
> +
> + codec: wcd9310@1,0{
> + compatible = "slim217,60";
> + reg = <1 0>;
> + };
> + };
Pardon my ignorance as I am not very familiar with DT nodes, but where are
the Manufacturer ID, Product code, Device index, and Instance values here?
--
~Vinod
^ permalink raw reply
* Re: [PATCH 2/2] leds: lm3692x: Introduce LM3692x dual string driver
From: Dan Murphy @ 2017-11-16 12:46 UTC (permalink / raw)
To: Andrew F. Davis, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
mark.rutland-5wv7dgnIgG8, rpurdie-Fm38FmjxZ/leoWH0uzbU5w,
jacek.anaszewski-Re5JQEeQqe8AvxtiuMwx3w, pavel-+ZI9xUNit7I
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-leds-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <3e209041-561c-84a0-d0dd-253cf37f060a-l0cyMroinI0@public.gmane.org>
Andrew
Thanks
On 11/15/2017 09:48 PM, Andrew F. Davis wrote:
> On 11/13/2017 02:50 PM, Dan Murphy wrote:
>> Introducing the LM3692x Dual-String white LED driver.
>>
>> Data sheet is located
>> http://www.ti.com/lit/ds/snvsa29/snvsa29.pdf
>>
>> Signed-off-by: Dan Murphy <dmurphy-l0cyMroinI0@public.gmane.org>
>> ---
>
> Looks like v3 is posted but I can't find it in my mailbox :/ but the
> comments below should still be valid.
v3 did post and some of the changes you pointed out were made
>
>> drivers/leds/leds-lm3692x.c | 380 ++++++++++++++++++++++++++++++++++++++++++++
>> 1 file changed, 380 insertions(+)
>> create mode 100644 drivers/leds/leds-lm3692x.c
>>
>> diff --git a/drivers/leds/leds-lm3692x.c b/drivers/leds/leds-lm3692x.c
>> new file mode 100644
>> index 000000000000..beb753abc7b0
>> --- /dev/null
>> +++ b/drivers/leds/leds-lm3692x.c
>> @@ -0,0 +1,380 @@
>> +/*
>> + * TI lm3692x LED Driver
>> + *
>> + * Copyright (C) 2017 Texas Instruments
>> + *
>> + * Author: Dan Murphy <dmurphy-l0cyMroinI0@public.gmane.org>
>> + *
>> + * 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/i2c.h>
>> +#include <linux/init.h>
>> +#include <linux/leds.h>
>> +#include <linux/regmap.h>
>> +#include <linux/regulator/consumer.h>
>> +#include <linux/module.h>
>> +#include <linux/mutex.h>
>> +#include <linux/of.h>
>> +#include <linux/of_gpio.h>
>> +#include <linux/gpio/consumer.h>
>> +#include <linux/slab.h>
>> +
>> +#define LM3692X_LED_NAME "lm3692x_led"
>> +
>> +#define LM3692X_REV 0x0
>> +#define LM3692X_RESET 0x1
>> +#define LM3692X_EN 0x10
>> +#define LM3692X_BRT_CTRL 0x11
>> +#define LM3692X_PWM_CTRL 0x12
>> +#define LM3692X_BOOST_CTRL 0x13
>> +#define LM3692X_AUTO_FREQ_HI 0x15
>> +#define LM3692X_AUTO_FREQ_LO 0x16
>> +#define LM3692X_BL_ADJ_THRESH 0x17
>> +#define LM3692X_BRT_LSB 0x18
>> +#define LM3692X_BRT_MSB 0x19
>> +#define LM3692X_FAULT_CTRL 0x1e
>> +#define LM3692X_FAULT_FLAGS 0x1f
>> +
>> +#define LM3692X_SW_RESET BIT(0)
>> +#define LM3692X_DEVICE_EN BIT(0)
>> +#define LM3692X_LED1_EN BIT(1)
>> +#define LM3692X_LED2_EN BIT(2)
>> +
>> +/* Brightness Control Bits */
>> +#define LM3692X_BL_ADJ_POL BIT(0)
>> +#define LM3692X_RAMP_RATE_125us 0x00
>> +#define LM3692X_RAMP_RATE_250us BIT(1)
>> +#define LM3692X_RAMP_RATE_500us BIT(2)
>> +#define LM3692X_RAMP_RATE_1ms (BIT(1) | BIT(2))
>> +#define LM3692X_RAMP_RATE_2ms BIT(3)
>> +#define LM3692X_RAMP_RATE_4ms (BIT(3) | BIT(1))
>> +#define LM3692X_RAMP_RATE_8ms (BIT(2) | BIT(3))
>> +#define LM3692X_RAMP_RATE_16ms (BIT(1) | BIT(2) | BIT(3))
>
> The above look like you are just counting in binary, I'd just list the
> numbers then shift them by one.
This is just another way to do it.
Its just a matter of preference.
>
>> +#define LM3692X_RAMP_EN BIT(4)
>> +#define LM3692X_BRHT_MODE_REG 0x00
>> +#define LM3692X_BRHT_MODE_PWM BIT(5)
>> +#define LM3692X_BRHT_MODE_MULTI_RAMP BIT(6)
>> +#define LM3692X_BRHT_MODE_RAMP_MULTI (BIT(5) | BIT(6))
>> +#define LM3692X_MAP_MODE_EXP BIT(7)
>> +
>> +/* PWM Register Bits */
>> +#define LM3692X_PWM_FILTER_100 BIT(0)
>> +#define LM3692X_PWM_FILTER_150 BIT(1)
>> +#define LM3692X_PWM_FILTER_200 (BIT(0) | BIT(1))
>> +#define LM3692X_PWM_HYSTER_1LSB BIT(2)
>> +#define LM3692X_PWM_HYSTER_2LSB BIT(3)
>> +#define LM3692X_PWM_HYSTER_3LSB (BIT(3) | BIT(2))
>> +#define LM3692X_PWM_HYSTER_4LSB BIT(4)
>> +#define LM3692X_PWM_HYSTER_5LSB (BIT(4) | BIT(2))
>> +#define LM3692X_PWM_HYSTER_6LSB (BIT(4) | BIT(3))
>
> Same here, looks like a couple below too.
Same as above
>
>> +#define LM3692X_PWM_POLARITY BIT(5)
>> +#define LM3692X_PWM_SAMP_4MHZ BIT(6)
>> +#define LM3692X_PWM_SAMP_24MHZ BIT(7)
>> +
>> +/* Boost Control Bits */
>> +#define LM3692X_OCP_PROT_1A BIT(0)
>> +#define LM3692X_OCP_PROT_1_25A BIT(1)
>> +#define LM3692X_OCP_PROT_1_5A (BIT(0) | BIT(1))
>> +#define LM3692X_OVP_21V BIT(2)
>> +#define LM3692X_OVP_25V BIT(3)
>> +#define LM3692X_OVP_29V (BIT(2) | BIT(3))
>> +#define LM3692X_MIN_IND_22UH BIT(4)
>> +#define LM3692X_BOOST_SW_1MHZ BIT(5)
>> +#define LM3692X_BOOST_SW_NO_SHIFT BIT(6)
>> +
>> +/* Fault Control Bits */
>> +#define LM3692X_FAULT_CTRL_OVP BIT(0)
>> +#define LM3692X_FAULT_CTRL_OCP BIT(1)
>> +#define LM3692X_FAULT_CTRL_TSD BIT(2)
>> +#define LM3692X_FAULT_CTRL_OPEN BIT(3)
>> +
>> +/* Fault Flag Bits */
>> +#define LM3692X_FAULT_FLAG_OVP BIT(0)
>> +#define LM3692X_FAULT_FLAG_OCP BIT(1)
>> +#define LM3692X_FAULT_FLAG_TSD BIT(2)
>> +#define LM3692X_FAULT_FLAG_SHRT BIT(3)
>> +#define LM3692X_FAULT_FLAG_OPEN BIT(4)
>> +
>> +/**
>> + * struct lm3692x_led -
>> + * @lock - Lock for reading/writing the device
>> + * @client - Pointer to the I2C client
>> + * @led_dev - led class device pointer
>> + * @regmap - Devices register map
>> + * @enable_gpio - VDDIO/EN gpio to enable communication interface
>> + * @regulator - LED supply regulator pointer
>> + * @label - LED label
>> + **/
>> +struct lm3692x_led {
>> + struct mutex lock;
>> + struct i2c_client *client;
>> + struct led_classdev led_dev;
>> + struct regmap *regmap;
>> + struct gpio_desc *enable_gpio;
>> + struct regulator *regulator;
>> + const char *label;
>> +};
>> +
>> +static const struct reg_default lm3692x_reg_defs[] = {
>> + {LM3692X_EN, 0xf},
>> + {LM3692X_BRT_CTRL, 0x61},
>> + {LM3692X_PWM_CTRL, 0x73},
>> + {LM3692X_BOOST_CTRL, 0x6f},
>> + {LM3692X_AUTO_FREQ_HI, 0x0},
>> + {LM3692X_AUTO_FREQ_LO, 0x0},
>> + {LM3692X_BL_ADJ_THRESH, 0x0},
>> + {LM3692X_BRT_LSB, 0x7},
>> + {LM3692X_BRT_MSB, 0xff},
>> + {LM3692X_FAULT_CTRL, 0x7},
>> +};
>> +
>> +static const struct regmap_config lm3692x_regmap_config = {
>> + .reg_bits = 8,
>> + .val_bits = 8,
>> +
>> + .max_register = LM3692X_FAULT_FLAGS,
>> + .reg_defaults = lm3692x_reg_defs,
>> + .num_reg_defaults = ARRAY_SIZE(lm3692x_reg_defs),
>> + .cache_type = REGCACHE_RBTREE,
>> +};
>> +
>> +static int lm3692x_fault_check(struct lm3692x_led *led)
>> +{
>> + int ret, fault;
>> + unsigned int read_buf;
>> +
>> + ret = regmap_read(led->regmap, LM3692X_FAULT_FLAGS, &read_buf);
>> + if (ret)
>> + goto out;
>> +
>> + fault = read_buf;
>> +
>> + if (fault)
>> + dev_err(&led->client->dev, "Detected a fault 0x%X\n",
>> + fault);
>> +out:
>> + return ret;
>> +}
>> +
>> +static int lm3692x_brightness_set(struct led_classdev *led_cdev,
>> + enum led_brightness brt_val)
>> +{
>> + struct lm3692x_led *led =
>> + container_of(led_cdev, struct lm3692x_led, led_dev);
>> + int led_brightness = (brt_val << 4) + 7;
>
> Magic numbers?
>
> BRIGHTNESS_SHIFT/MASK maybe?
>
> And below we undo the operation anyway before we write it to the
> register. Why not just drop that and to the shift/mask when you write it.
>
v3 has this changed anyway to something newer.
<snip>
--
------------------
Dan Murphy
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH v2 1/4] omapdrm: fix compatible string for td028ttec1
From: Tomi Valkeinen @ 2017-11-16 12:32 UTC (permalink / raw)
To: H. Nikolaus Schaller
Cc: Mark Rutland, devicetree, Julia Lawall, letux-kernel,
Bartlomiej Zolnierkiewicz, David Airlie, dri-devel, Russell King,
Rob Herring, linux-kernel, Tony Lindgren, linux-fbdev,
Thierry Reding, Laurent Pinchart, Benoît Cousson, kernel,
linux-omap, linux-arm-kernel
In-Reply-To: <474bfc72b67e1d0e2a223084a69f04d2baa1dda8.1510822218.git.hns@goldelico.com>
On 16/11/17 10:50, H. Nikolaus Schaller wrote:
> The vendor name was "toppoly" but other panels and the vendor list
> have defined it as "tpo". So let's fix it in driver and bindings.
>
> Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
> ---
> -MODULE_ALIAS("spi:toppoly,td028ttec1");
> +MODULE_ALIAS("spi:tpo,td028ttec1");
Doesn't this mean that the module won't load if you have old bindings?
Can't we have two module aliases?
Tomi
--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply
* Re: [PATCH 3/3] arm64: dts: renesas: eagle: add EtherAVB pins
From: Sergei Shtylyov @ 2017-11-16 12:28 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Simon Horman, Rob Herring, Catalin Marinas, Will Deacon,
Linux-Renesas, devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Magnus Damm, Mark Rutland,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
In-Reply-To: <a65b8740-b133-eb92-5494-fb532554127b-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
On 11/15/2017 11:21 PM, Sergei Shtylyov wrote:
>>>>> Add the (previously omitted) EtherAVB pin data to the Eagle board's
>>>>> device tree.
>>
>>>>> --- renesas.orig/arch/arm64/boot/dts/renesas/r8a77970-eagle.dts
>>>>> +++ renesas/arch/arm64/boot/dts/renesas/r8a77970-eagle.dts
>>>>> @@ -34,6 +34,9 @@
>>>
>>> [...]
>>>>>
>>>>> @@ -53,6 +56,11 @@
>>>>> };
>>>>>
>>>>> &pfc {
>>>>> + avb_pins: avb {
>>>>> + groups = "avb0_mdio", "avb0_mii";
>>>>
>>>>
>>>> Oh no, its'called "avb0_mdio" here, but "avb(0)_mdc" on all other
>>>> R-Car Gen3 SoCs?
>>>
>>>
>>> Can you remember the reason? I don;t want to follow the bad example. :-)
>>
>> Sorry, I don't know.
>
> Hm, you seem to have participated in the related discussions for H2/M3-W...
H3, of course...
> The reason was that omlu AVB_MDC signal was multiplexed, AVB_MDIO signal (and
s/omlu/only/.
> AVB MII signals) was mapped to a dedicated pin without any multiplexing, so
> the "avb_mdc" group initially contained only AVB_MDC.
>
>> Gr{oetje,eeting}s,
MBR, Sergei
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH v7 03/13] slimbus: Add SLIMbus bus type
From: Mark Brown @ 2017-11-16 12:25 UTC (permalink / raw)
To: srinivas.kandagatla
Cc: mark.rutland, alsa-devel, michael.opdenacker, poeschel,
andreas.noever, arnd, vinod.koul, bp, devicetree, james.hogan,
pawel.moll, linux-arm-msm, sharon.dvir1, robh+dt, sdharia, alan,
treding, mathieu.poirier, gregkh, linux-kernel, daniel, jkosina,
joe, davem
In-Reply-To: <20171115141043.29202-4-srinivas.kandagatla@linaro.org>
[-- Attachment #1.1: Type: text/plain, Size: 434 bytes --]
On Wed, Nov 15, 2017 at 02:10:33PM +0000, srinivas.kandagatla@linaro.org wrote:
> From: Sagar Dharia <sdharia@codeaurora.org>
>
> SLIMbus (Serial Low Power Interchip Media Bus) is a specification
> developed by MIPI (Mobile Industry Processor Interface) alliance.
> SLIMbus is a 2-wire implementation, which is used to communicate with
> peripheral components like audio-codec.
Reviewed-by: Mark Brown <broonie@kernel.org>
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply
* [PATCH V1 4/4] qcom: spmi-wled: Add auto-calibration logic support
From: Kiran Gunda @ 2017-11-16 12:18 UTC (permalink / raw)
To: bjorn.andersson-QSEj5FYQhm4dnm+yROfE0A,
linux-arm-msm-u79uwXL29TY76Z2rM5mHXA, Lee Jones, Daniel Thompson,
Jingoo Han, Richard Purdie, Jacek Anaszewski, Pavel Machek,
Rob Herring, Mark Rutland, Bartlomiej Zolnierkiewicz,
linux-leds-u79uwXL29TY76Z2rM5mHXA,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-fbdev-u79uwXL29TY76Z2rM5mHXA
Cc: linux-arm-msm-owner-u79uwXL29TY76Z2rM5mHXA, Kiran Gunda
In-Reply-To: <1510834717-21765-1-git-send-email-kgunda-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
The auto-calibration algorithm checks if the current WLED sink
configuration is valid. It tries enabling every sink and checks
if the OVP fault is observed. Based on this information it
detects and enables the valid sink configuration. Auto calibration
will be triggered when the OVP fault interrupts are seen frequently
thereby it tries to fix the sink configuration.
Signed-off-by: Kiran Gunda <kgunda-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
---
.../bindings/leds/backlight/qcom-spmi-wled.txt | 5 +
drivers/video/backlight/qcom-spmi-wled.c | 304 ++++++++++++++++++++-
2 files changed, 306 insertions(+), 3 deletions(-)
diff --git a/Documentation/devicetree/bindings/leds/backlight/qcom-spmi-wled.txt b/Documentation/devicetree/bindings/leds/backlight/qcom-spmi-wled.txt
index d39ee93..f06c0cd 100644
--- a/Documentation/devicetree/bindings/leds/backlight/qcom-spmi-wled.txt
+++ b/Documentation/devicetree/bindings/leds/backlight/qcom-spmi-wled.txt
@@ -94,6 +94,11 @@ The PMIC is connected to the host processor via SPMI bus.
Definition: Interrupt names associated with the interrupts.
Currently supported interrupts are "sc-irq" and "ovp-irq".
+- qcom,auto-calibration
+ Usage: optional
+ Value type: <bool>
+ Definition: Enables auto-calibration of the WLED sink configuration.
+
Example:
qcom-wled@d800 {
diff --git a/drivers/video/backlight/qcom-spmi-wled.c b/drivers/video/backlight/qcom-spmi-wled.c
index 8b2a77a..aee5c56 100644
--- a/drivers/video/backlight/qcom-spmi-wled.c
+++ b/drivers/video/backlight/qcom-spmi-wled.c
@@ -38,11 +38,14 @@
#define QCOM_WLED_CTRL_SC_FAULT_BIT BIT(2)
#define QCOM_WLED_CTRL_INT_RT_STS 0x10
+#define QCOM_WLED_CTRL_OVP_FLT_RT_STS_BIT BIT(1)
#define QCOM_WLED_CTRL_MOD_ENABLE 0x46
#define QCOM_WLED_CTRL_MOD_EN_MASK BIT(7)
#define QCOM_WLED_CTRL_MODULE_EN_SHIFT 7
+#define QCOM_WLED_CTRL_FDBK_OP 0x48
+
#define QCOM_WLED_CTRL_SWITCH_FREQ 0x4c
#define QCOM_WLED_CTRL_SWITCH_FREQ_MASK GENMASK(3, 0)
@@ -99,6 +102,7 @@ struct qcom_wled_config {
int ovp_irq;
bool en_cabc;
bool ext_pfet_sc_pro_en;
+ bool auto_calib_enabled;
};
struct qcom_wled {
@@ -108,18 +112,25 @@ struct qcom_wled {
struct mutex lock;
struct qcom_wled_config cfg;
ktime_t last_sc_event_time;
+ ktime_t start_ovp_fault_time;
u16 sink_addr;
u16 ctrl_addr;
+ u16 auto_calibration_ovp_count;
u32 brightness;
u32 sc_count;
bool prev_state;
bool ovp_irq_disabled;
+ bool auto_calib_done;
+ bool force_mod_disable;
};
static int qcom_wled_module_enable(struct qcom_wled *wled, int val)
{
int rc;
+ if (wled->force_mod_disable)
+ return 0;
+
rc = regmap_update_bits(wled->regmap, wled->ctrl_addr +
QCOM_WLED_CTRL_MOD_ENABLE, QCOM_WLED_CTRL_MOD_EN_MASK,
val << QCOM_WLED_CTRL_MODULE_EN_SHIFT);
@@ -187,12 +198,10 @@ static int qcom_wled_set_brightness(struct qcom_wled *wled, u16 brightness)
v[1] = (brightness >> 8) & 0xf;
for (i = 0; (string_cfg >> i) != 0; i++) {
- if (string_cfg & BIT(i)) {
rc = regmap_bulk_write(wled->regmap, wled->sink_addr +
QCOM_WLED_SINK_BRIGHT_LSB_REG(i), v, 2);
if (rc < 0)
return rc;
- }
}
return 0;
@@ -294,6 +303,262 @@ static irqreturn_t qcom_wled_sc_irq_handler(int irq, void *_wled)
return IRQ_HANDLED;
}
+#define AUTO_CALIB_BRIGHTNESS 200
+static int qcom_wled_auto_calibrate(struct qcom_wled *wled)
+{
+ int rc = 0, i;
+ u32 sink_config = 0, int_sts;
+ u8 reg = 0, sink_test = 0, sink_valid = 0;
+ u8 string_cfg = wled->cfg.string_cfg;
+
+ /* read configured sink configuration */
+ rc = regmap_read(wled->regmap, wled->sink_addr +
+ QCOM_WLED_SINK_CURR_SINK_EN, &sink_config);
+ if (rc < 0) {
+ pr_err("Failed to read SINK configuration rc=%d\n", rc);
+ goto failed_calib;
+ }
+
+ /* disable the module before starting calibration */
+ rc = regmap_update_bits(wled->regmap,
+ wled->ctrl_addr + QCOM_WLED_CTRL_MOD_ENABLE,
+ QCOM_WLED_CTRL_MOD_EN_MASK, 0);
+ if (rc < 0) {
+ pr_err("Failed to disable WLED module rc=%d\n", rc);
+ goto failed_calib;
+ }
+
+ /* set low brightness across all sinks */
+ rc = qcom_wled_set_brightness(wled, AUTO_CALIB_BRIGHTNESS);
+ if (rc < 0) {
+ pr_err("Failed to set brightness for calibration rc=%d\n", rc);
+ goto failed_calib;
+ }
+
+ if (wled->cfg.en_cabc) {
+ for (i = 0; (string_cfg >> i) != 0; i++) {
+ reg = 0;
+ rc = regmap_update_bits(wled->regmap, wled->sink_addr +
+ QCOM_WLED_SINK_CABC_REG(i),
+ QCOM_WLED_SINK_CABC_MASK, reg);
+ if (rc < 0)
+ goto failed_calib;
+ }
+ }
+
+ /* disable all sinks */
+ rc = regmap_write(wled->regmap,
+ wled->sink_addr + QCOM_WLED_SINK_CURR_SINK_EN, 0);
+ if (rc < 0) {
+ pr_err("Failed to disable all sinks rc=%d\n", rc);
+ goto failed_calib;
+ }
+
+ /* iterate through the strings one by one */
+ for (i = 0; (string_cfg >> i) != 0; i++) {
+ sink_test = 1 << (QCOM_WLED_SINK_CURR_SINK_SHFT + i);
+
+ /* Enable feedback control */
+ rc = regmap_write(wled->regmap, wled->ctrl_addr +
+ QCOM_WLED_CTRL_FDBK_OP, i + 1);
+ if (rc < 0) {
+ pr_err("Failed to enable feedback for SINK %d rc = %d\n",
+ i + 1, rc);
+ goto failed_calib;
+ }
+
+ /* enable the sink */
+ rc = regmap_write(wled->regmap, wled->sink_addr +
+ QCOM_WLED_SINK_CURR_SINK_EN, sink_test);
+ if (rc < 0) {
+ pr_err("Failed to configure SINK %d rc=%d\n",
+ i + 1, rc);
+ goto failed_calib;
+ }
+
+ /* Enable the module */
+ rc = regmap_update_bits(wled->regmap, wled->ctrl_addr +
+ QCOM_WLED_CTRL_MOD_ENABLE,
+ QCOM_WLED_CTRL_MOD_EN_MASK,
+ QCOM_WLED_CTRL_MOD_EN_MASK);
+ if (rc < 0) {
+ pr_err("Failed to enable WLED module rc=%d\n", rc);
+ goto failed_calib;
+ }
+
+ usleep_range(QCOM_WLED_SOFT_START_DLY_US,
+ QCOM_WLED_SOFT_START_DLY_US + 1000);
+
+ rc = regmap_read(wled->regmap, wled->ctrl_addr +
+ QCOM_WLED_CTRL_INT_RT_STS, &int_sts);
+ if (rc < 0) {
+ pr_err("Error in reading WLED_INT_RT_STS rc=%d\n", rc);
+ goto failed_calib;
+ }
+
+ if (int_sts & QCOM_WLED_CTRL_OVP_FAULT_BIT)
+ pr_debug("WLED OVP fault detected with SINK %d\n",
+ i + 1);
+ else
+ sink_valid |= sink_test;
+
+ /* Disable the module */
+ rc = regmap_update_bits(wled->regmap,
+ wled->ctrl_addr + QCOM_WLED_CTRL_MOD_ENABLE,
+ QCOM_WLED_CTRL_MOD_EN_MASK, 0);
+ if (rc < 0) {
+ pr_err("Failed to disable WLED module rc=%d\n", rc);
+ goto failed_calib;
+ }
+ }
+
+ if (sink_valid == sink_config) {
+ pr_debug("WLED auto-calibration complete, default sink-config=%x OK!\n",
+ sink_config);
+ } else {
+ pr_warn("Invalid WLED default sink config=%x changing it to=%x\n",
+ sink_config, sink_valid);
+ sink_config = sink_valid;
+ }
+
+ if (!sink_config) {
+ pr_warn("No valid WLED sinks found\n");
+ wled->force_mod_disable = true;
+ goto failed_calib;
+ }
+
+ /* write the new sink configuration */
+ rc = regmap_write(wled->regmap,
+ wled->sink_addr + QCOM_WLED_SINK_CURR_SINK_EN,
+ sink_config);
+ if (rc < 0) {
+ pr_err("Failed to reconfigure the default sink rc=%d\n", rc);
+ goto failed_calib;
+ }
+
+ /* MODULATOR_EN setting for valid sinks */
+ for (i = 0; (string_cfg >> i) != 0; i++) {
+ if (wled->cfg.en_cabc) {
+ reg = QCOM_WLED_SINK_CABC_EN;
+ rc = regmap_update_bits(wled->regmap, wled->sink_addr +
+ QCOM_WLED_SINK_CABC_REG(i),
+ QCOM_WLED_SINK_CABC_MASK, reg);
+ if (rc < 0)
+ goto failed_calib;
+ }
+
+ if (sink_config & (1 << (QCOM_WLED_SINK_CURR_SINK_SHFT + i)))
+ reg = QCOM_WLED_SINK_REG_STR_MOD_EN;
+ else
+ reg = 0x0; /* disable modulator_en for unused sink */
+
+ rc = regmap_write(wled->regmap, wled->sink_addr +
+ QCOM_WLED_SINK_MOD_EN_REG(i), reg);
+ if (rc < 0) {
+ pr_err("Failed to configure MODULATOR_EN rc=%d\n", rc);
+ goto failed_calib;
+ }
+ }
+
+ /* restore the feedback setting */
+ rc = regmap_write(wled->regmap,
+ wled->ctrl_addr + QCOM_WLED_CTRL_FDBK_OP, 0);
+ if (rc < 0) {
+ pr_err("Failed to restore feedback setting rc=%d\n", rc);
+ goto failed_calib;
+ }
+
+ /* restore brightness */
+ rc = qcom_wled_set_brightness(wled, wled->brightness);
+ if (rc < 0) {
+ pr_err("Failed to set brightness after calibration rc=%d\n",
+ rc);
+ goto failed_calib;
+ }
+
+ rc = regmap_update_bits(wled->regmap,
+ wled->ctrl_addr + QCOM_WLED_CTRL_MOD_ENABLE,
+ QCOM_WLED_CTRL_MOD_EN_MASK,
+ QCOM_WLED_CTRL_MOD_EN_MASK);
+ if (rc < 0) {
+ pr_err("Failed to enable WLED module rc=%d\n", rc);
+ goto failed_calib;
+ }
+
+ /* delay for WLED soft-start */
+ usleep_range(QCOM_WLED_SOFT_START_DLY_US,
+ QCOM_WLED_SOFT_START_DLY_US + 1000);
+
+failed_calib:
+ return rc;
+}
+
+#define WLED_AUTO_CAL_OVP_COUNT 5
+#define WLED_AUTO_CAL_CNT_DLY_US 1000000 /* 1 second */
+static bool qcom_wled_auto_cal_required(struct qcom_wled *wled)
+{
+ s64 elapsed_time_us;
+
+ /*
+ * Check if the OVP fault was an occasional one
+ * or if its firing continuously, the latter qualifies
+ * for an auto-calibration check.
+ */
+ if (!wled->auto_calibration_ovp_count) {
+ wled->start_ovp_fault_time = ktime_get();
+ wled->auto_calibration_ovp_count++;
+ } else {
+ elapsed_time_us = ktime_us_delta(ktime_get(),
+ wled->start_ovp_fault_time);
+ if (elapsed_time_us > WLED_AUTO_CAL_CNT_DLY_US)
+ wled->auto_calibration_ovp_count = 0;
+ else
+ wled->auto_calibration_ovp_count++;
+
+ if (wled->auto_calibration_ovp_count >=
+ WLED_AUTO_CAL_OVP_COUNT) {
+ wled->auto_calibration_ovp_count = 0;
+ return true;
+ }
+ }
+
+ return false;
+}
+
+static int qcom_wled_auto_calibrate_at_init(struct qcom_wled *wled)
+{
+ int rc;
+ u32 fault_status = 0, rt_status = 0;
+
+ if (!wled->cfg.auto_calib_enabled)
+ return 0;
+
+ rc = regmap_read(wled->regmap,
+ wled->ctrl_addr + QCOM_WLED_CTRL_INT_RT_STS,
+ &rt_status);
+ if (rc < 0)
+ pr_err("Failed to read RT status rc=%d\n", rc);
+
+ rc = regmap_read(wled->regmap,
+ wled->ctrl_addr + QCOM_WLED_CTRL_FAULT_STATUS,
+ &fault_status);
+ if (rc < 0)
+ pr_err("Failed to read fault status rc=%d\n", rc);
+
+ if ((rt_status & QCOM_WLED_CTRL_OVP_FLT_RT_STS_BIT) ||
+ (fault_status & QCOM_WLED_CTRL_OVP_FAULT_BIT)) {
+ mutex_lock(&wled->lock);
+ rc = qcom_wled_auto_calibrate(wled);
+ if (rc < 0)
+ pr_err("Failed auto-calibration rc=%d\n", rc);
+ else
+ wled->auto_calib_done = true;
+ mutex_unlock(&wled->lock);
+ }
+
+ return rc;
+}
+
static irqreturn_t qcom_wled_ovp_irq_handler(int irq, void *_wled)
{
struct qcom_wled *wled = _wled;
@@ -319,6 +584,33 @@ static irqreturn_t qcom_wled_ovp_irq_handler(int irq, void *_wled)
pr_err("WLED OVP fault detected, int_sts=%x fault_sts= %x\n",
int_sts, fault_sts);
+ if (fault_sts & QCOM_WLED_CTRL_OVP_FAULT_BIT) {
+ if (wled->cfg.auto_calib_enabled && !wled->auto_calib_done) {
+ if (qcom_wled_auto_cal_required(wled)) {
+ mutex_lock(&wled->lock);
+ if (wled->cfg.ovp_irq > 0 &&
+ !wled->ovp_irq_disabled) {
+ disable_irq_nosync(wled->cfg.ovp_irq);
+ wled->ovp_irq_disabled = true;
+ }
+
+ rc = qcom_wled_auto_calibrate(wled);
+ if (rc < 0)
+ pr_err("Failed auto-calibration rc=%d\n",
+ rc);
+ else
+ wled->auto_calib_done = true;
+
+ if (wled->cfg.ovp_irq > 0 &&
+ wled->ovp_irq_disabled) {
+ enable_irq(wled->cfg.ovp_irq);
+ wled->ovp_irq_disabled = false;
+ }
+ mutex_unlock(&wled->lock);
+ }
+ }
+ }
+
return IRQ_HANDLED;
}
@@ -394,6 +686,10 @@ static int qcom_wled_setup(struct qcom_wled *wled)
return rc;
}
+ rc = qcom_wled_auto_calibrate_at_init(wled);
+ if (rc < 0)
+ pr_err("Failed to auto-calibrate at init rc=%d\n", rc);
+
if (sc_irq >= 0) {
rc = devm_request_threaded_irq(&wled->pdev->dev, sc_irq,
NULL, qcom_wled_sc_irq_handler, IRQF_ONESHOT,
@@ -432,7 +728,7 @@ static int qcom_wled_setup(struct qcom_wled *wled)
NULL, qcom_wled_ovp_irq_handler, IRQF_ONESHOT,
"qcom_wled_ovp_irq", wled);
if (rc < 0) {
- dev_err(&wled->pdev->dev, "Unable to request ovp(%d) IRQ(err:%d)\n",
+ pr_err("Unable to request ovp(%d) IRQ(err:%d)\n",
ovp_irq, rc);
return rc;
}
@@ -457,6 +753,7 @@ static int qcom_wled_setup(struct qcom_wled *wled)
.string_cfg = 0xf,
.en_cabc = 0,
.ext_pfet_sc_pro_en = 1,
+ .auto_calib_enabled = 1,
};
struct qcom_wled_var_cfg {
@@ -563,6 +860,7 @@ static int qcom_wled_configure(struct qcom_wled *wled, struct device *dev)
} bool_opts[] = {
{ "qcom,en-cabc", &cfg->en_cabc, },
{ "qcom,ext-pfet-sc-pro", &cfg->ext_pfet_sc_pro_en, },
+ { "qcom,auto-calibration", &cfg->auto_calib_enabled, },
};
prop_addr = of_get_address(dev->of_node, 0, NULL, NULL);
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* [PATCH V1 3/4] qcom: spmi-wled: Add support for OVP interrupt handling
From: Kiran Gunda @ 2017-11-16 12:18 UTC (permalink / raw)
To: bjorn.andersson, linux-arm-msm, Lee Jones, Daniel Thompson,
Jingoo Han, Richard Purdie, Jacek Anaszewski, Pavel Machek,
Rob Herring, Mark Rutland, Bartlomiej Zolnierkiewicz, linux-leds,
devicetree, linux-kernel, linux-fbdev
Cc: linux-arm-msm-owner, Kiran Gunda
In-Reply-To: <1510834717-21765-1-git-send-email-kgunda@codeaurora.org>
WLED peripheral has over voltage protection(OVP) circuitry and the OVP
fault is notified through an interrupt. Though this fault condition rising
is due to an incorrect hardware configuration is mitigated in the hardware,
it still needs to be detected and handled. Add support for it.
When WLED module is enabled, keep OVP fault interrupt disabled for 10 ms to
account for soft start delay.
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
---
.../bindings/leds/backlight/qcom-spmi-wled.txt | 7 +-
drivers/video/backlight/qcom-spmi-wled.c | 83 ++++++++++++++++++++++
2 files changed, 87 insertions(+), 3 deletions(-)
diff --git a/Documentation/devicetree/bindings/leds/backlight/qcom-spmi-wled.txt b/Documentation/devicetree/bindings/leds/backlight/qcom-spmi-wled.txt
index 768608c..d39ee93 100644
--- a/Documentation/devicetree/bindings/leds/backlight/qcom-spmi-wled.txt
+++ b/Documentation/devicetree/bindings/leds/backlight/qcom-spmi-wled.txt
@@ -92,7 +92,7 @@ The PMIC is connected to the host processor via SPMI bus.
Usage: optional
Value type: <string>
Definition: Interrupt names associated with the interrupts.
- Must be "sc-irq".
+ Currently supported interrupts are "sc-irq" and "ovp-irq".
Example:
@@ -102,8 +102,9 @@ qcom-wled@d800 {
reg-names = "qcom-wled-ctrl-base", "qcom-wled-sink-base";
label = "backlight";
- interrupts = <0x3 0xd8 0x2 IRQ_TYPE_EDGE_RISING>;
- interrupt-names = "sc-irq";
+ interrupts = <0x3 0xd8 0x2 IRQ_TYPE_EDGE_RISING>,
+ <0x3 0xd8 0x1 IRQ_TYPE_EDGE_RISING>;
+ interrupt-names = "sc-irq", "ovp-irq";
qcom,fs-current-limit = <25000>;
qcom,current-boost-limit = <970>;
qcom,switching-freq = <800>;
diff --git a/drivers/video/backlight/qcom-spmi-wled.c b/drivers/video/backlight/qcom-spmi-wled.c
index 7dbaaa7..8b2a77a 100644
--- a/drivers/video/backlight/qcom-spmi-wled.c
+++ b/drivers/video/backlight/qcom-spmi-wled.c
@@ -29,9 +29,15 @@
#define QCOM_WLED_SC_DLY_MS 20
#define QCOM_WLED_SC_CNT_MAX 5
#define QCOM_WLED_SC_RESET_CNT_DLY_US 1000000
+#define QCOM_WLED_SOFT_START_DLY_US 10000
/* WLED control registers */
#define QCOM_WLED_CTRL_FAULT_STATUS 0x08
+#define QCOM_WLED_CTRL_ILIM_FAULT_BIT BIT(0)
+#define QCOM_WLED_CTRL_OVP_FAULT_BIT BIT(1)
+#define QCOM_WLED_CTRL_SC_FAULT_BIT BIT(2)
+
+#define QCOM_WLED_CTRL_INT_RT_STS 0x10
#define QCOM_WLED_CTRL_MOD_ENABLE 0x46
#define QCOM_WLED_CTRL_MOD_EN_MASK BIT(7)
@@ -90,6 +96,7 @@ struct qcom_wled_config {
u32 fs_current;
u32 string_cfg;
int sc_irq;
+ int ovp_irq;
bool en_cabc;
bool ext_pfet_sc_pro_en;
};
@@ -106,6 +113,7 @@ struct qcom_wled {
u32 brightness;
u32 sc_count;
bool prev_state;
+ bool ovp_irq_disabled;
};
static int qcom_wled_module_enable(struct qcom_wled *wled, int val)
@@ -115,6 +123,28 @@ static int qcom_wled_module_enable(struct qcom_wled *wled, int val)
rc = regmap_update_bits(wled->regmap, wled->ctrl_addr +
QCOM_WLED_CTRL_MOD_ENABLE, QCOM_WLED_CTRL_MOD_EN_MASK,
val << QCOM_WLED_CTRL_MODULE_EN_SHIFT);
+ if (rc < 0)
+ return rc;
+ /*
+ * Wait for at least 10ms before enabling OVP fault interrupt after
+ * enabling the module so that soft start is completed. Keep the OVP
+ * interrupt disabled when the module is disabled.
+ */
+ if (val) {
+ usleep_range(QCOM_WLED_SOFT_START_DLY_US,
+ QCOM_WLED_SOFT_START_DLY_US + 1000);
+
+ if (wled->cfg.ovp_irq > 0 && wled->ovp_irq_disabled) {
+ enable_irq(wled->cfg.ovp_irq);
+ wled->ovp_irq_disabled = false;
+ }
+ } else {
+ if (wled->cfg.ovp_irq > 0 && !wled->ovp_irq_disabled) {
+ disable_irq(wled->cfg.ovp_irq);
+ wled->ovp_irq_disabled = true;
+ }
+ }
+
return rc;
}
@@ -264,12 +294,42 @@ static irqreturn_t qcom_wled_sc_irq_handler(int irq, void *_wled)
return IRQ_HANDLED;
}
+static irqreturn_t qcom_wled_ovp_irq_handler(int irq, void *_wled)
+{
+ struct qcom_wled *wled = _wled;
+ int rc;
+ u32 int_sts, fault_sts;
+
+ rc = regmap_read(wled->regmap,
+ wled->ctrl_addr + QCOM_WLED_CTRL_INT_RT_STS, &int_sts);
+ if (rc < 0) {
+ pr_err("Error in reading WLED_INT_RT_STS rc=%d\n", rc);
+ return IRQ_HANDLED;
+ }
+
+ rc = regmap_read(wled->regmap, wled->ctrl_addr +
+ QCOM_WLED_CTRL_FAULT_STATUS, &fault_sts);
+ if (rc < 0) {
+ pr_err("Error in reading WLED_FAULT_STATUS rc=%d\n", rc);
+ return IRQ_HANDLED;
+ }
+
+ if (fault_sts &
+ (QCOM_WLED_CTRL_OVP_FAULT_BIT | QCOM_WLED_CTRL_ILIM_FAULT_BIT))
+ pr_err("WLED OVP fault detected, int_sts=%x fault_sts= %x\n",
+ int_sts, fault_sts);
+
+ return IRQ_HANDLED;
+}
+
static int qcom_wled_setup(struct qcom_wled *wled)
{
int rc, temp, i;
u8 sink_en = 0;
+ u32 val;
u8 string_cfg = wled->cfg.string_cfg;
int sc_irq = wled->cfg.sc_irq;
+ int ovp_irq = wled->cfg.ovp_irq;
rc = regmap_update_bits(wled->regmap,
wled->ctrl_addr + QCOM_WLED_CTRL_OVP,
@@ -367,6 +427,25 @@ static int qcom_wled_setup(struct qcom_wled *wled)
}
}
+ if (ovp_irq >= 0) {
+ rc = devm_request_threaded_irq(&wled->pdev->dev, ovp_irq,
+ NULL, qcom_wled_ovp_irq_handler, IRQF_ONESHOT,
+ "qcom_wled_ovp_irq", wled);
+ if (rc < 0) {
+ dev_err(&wled->pdev->dev, "Unable to request ovp(%d) IRQ(err:%d)\n",
+ ovp_irq, rc);
+ return rc;
+ }
+
+ rc = regmap_read(wled->regmap, wled->ctrl_addr +
+ QCOM_WLED_CTRL_MOD_ENABLE, &val);
+ /* disable the OVP irq only if the module is not enabled */
+ if (!rc && !(val & QCOM_WLED_CTRL_MOD_EN_MASK)) {
+ disable_irq(ovp_irq);
+ wled->ovp_irq_disabled = true;
+ }
+ }
+
return 0;
}
@@ -539,6 +618,10 @@ static int qcom_wled_configure(struct qcom_wled *wled, struct device *dev)
if (wled->cfg.sc_irq < 0)
dev_dbg(&wled->pdev->dev, "sc irq is not used\n");
+ wled->cfg.ovp_irq = platform_get_irq_byname(wled->pdev, "ovp-irq");
+ if (wled->cfg.ovp_irq < 0)
+ dev_dbg(&wled->pdev->dev, "ovp irq is not used\n");
+
return 0;
}
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
^ permalink raw reply related
* [PATCH V1 2/4] qcom: spmi-wled: Add support for short circuit handling
From: Kiran Gunda @ 2017-11-16 12:18 UTC (permalink / raw)
To: bjorn.andersson, linux-arm-msm, Lee Jones, Daniel Thompson,
Jingoo Han, Richard Purdie, Jacek Anaszewski, Pavel Machek,
Rob Herring, Mark Rutland, Bartlomiej Zolnierkiewicz, linux-leds,
devicetree, linux-kernel, linux-fbdev
Cc: linux-arm-msm-owner, Kiran Gunda
In-Reply-To: <1510834717-21765-1-git-send-email-kgunda@codeaurora.org>
Handle the short circuit(SC) interrupt and check if the SC interrupt
is valid. Re-enable the module to check if it goes away. Disable the
module altogether if the SC event persists.
Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
---
.../bindings/leds/backlight/qcom-spmi-wled.txt | 22 ++++
drivers/video/backlight/qcom-spmi-wled.c | 126 ++++++++++++++++++++-
2 files changed, 142 insertions(+), 6 deletions(-)
diff --git a/Documentation/devicetree/bindings/leds/backlight/qcom-spmi-wled.txt b/Documentation/devicetree/bindings/leds/backlight/qcom-spmi-wled.txt
index f1ea25b..768608c 100644
--- a/Documentation/devicetree/bindings/leds/backlight/qcom-spmi-wled.txt
+++ b/Documentation/devicetree/bindings/leds/backlight/qcom-spmi-wled.txt
@@ -74,6 +74,26 @@ The PMIC is connected to the host processor via SPMI bus.
Definition: Specify if cabc (content adaptive backlight control) is
needed.
+- qcom,ext-pfet-sc-pro-en
+ Usage: optional
+ Value type: <bool>
+ Definition: Specify if external PFET control for short circuit
+ protection is needed.
+
+- interrupts
+ Usage: optional
+ Value type: <prop encoded array>
+ Definition: Interrupts associated with WLED. Interrupts can be
+ specified as per the encoding listed under
+ Documentation/devicetree/bindings/spmi/
+ qcom,spmi-pmic-arb.txt.
+
+- interrupt-names
+ Usage: optional
+ Value type: <string>
+ Definition: Interrupt names associated with the interrupts.
+ Must be "sc-irq".
+
Example:
qcom-wled@d800 {
@@ -82,6 +102,8 @@ qcom-wled@d800 {
reg-names = "qcom-wled-ctrl-base", "qcom-wled-sink-base";
label = "backlight";
+ interrupts = <0x3 0xd8 0x2 IRQ_TYPE_EDGE_RISING>;
+ interrupt-names = "sc-irq";
qcom,fs-current-limit = <25000>;
qcom,current-boost-limit = <970>;
qcom,switching-freq = <800>;
diff --git a/drivers/video/backlight/qcom-spmi-wled.c b/drivers/video/backlight/qcom-spmi-wled.c
index 14c3adc..7dbaaa7 100644
--- a/drivers/video/backlight/qcom-spmi-wled.c
+++ b/drivers/video/backlight/qcom-spmi-wled.c
@@ -11,6 +11,9 @@
* GNU General Public License for more details.
*/
+#include <linux/delay.h>
+#include <linux/interrupt.h>
+#include <linux/ktime.h>
#include <linux/kernel.h>
#include <linux/backlight.h>
#include <linux/module.h>
@@ -23,7 +26,13 @@
#define QCOM_WLED_DEFAULT_BRIGHTNESS 2048
#define QCOM_WLED_MAX_BRIGHTNESS 4095
+#define QCOM_WLED_SC_DLY_MS 20
+#define QCOM_WLED_SC_CNT_MAX 5
+#define QCOM_WLED_SC_RESET_CNT_DLY_US 1000000
+
/* WLED control registers */
+#define QCOM_WLED_CTRL_FAULT_STATUS 0x08
+
#define QCOM_WLED_CTRL_MOD_ENABLE 0x46
#define QCOM_WLED_CTRL_MOD_EN_MASK BIT(7)
#define QCOM_WLED_CTRL_MODULE_EN_SHIFT 7
@@ -37,6 +46,15 @@
#define QCOM_WLED_CTRL_ILIM 0x4e
#define QCOM_WLED_CTRL_ILIM_MASK GENMASK(2, 0)
+#define QCOM_WLED_CTRL_SHORT_PROTECT 0x5e
+#define QCOM_WLED_CTRL_SHORT_EN_MASK BIT(7)
+
+#define QCOM_WLED_CTRL_SEC_ACCESS 0xd0
+#define QCOM_WLED_CTRL_SEC_UNLOCK 0xa5
+
+#define QCOM_WLED_CTRL_TEST1 0xe2
+#define QCOM_WLED_EXT_FET_DTEST2 0x09
+
/* WLED sink registers */
#define QCOM_WLED_SINK_CURR_SINK_EN 0x46
#define QCOM_WLED_SINK_CURR_SINK_MASK GENMASK(7, 4)
@@ -71,19 +89,23 @@ struct qcom_wled_config {
u32 switch_freq;
u32 fs_current;
u32 string_cfg;
+ int sc_irq;
bool en_cabc;
+ bool ext_pfet_sc_pro_en;
};
struct qcom_wled {
const char *name;
struct platform_device *pdev;
struct regmap *regmap;
+ struct mutex lock;
+ struct qcom_wled_config cfg;
+ ktime_t last_sc_event_time;
u16 sink_addr;
u16 ctrl_addr;
u32 brightness;
+ u32 sc_count;
bool prev_state;
-
- struct qcom_wled_config cfg;
};
static int qcom_wled_module_enable(struct qcom_wled *wled, int val)
@@ -157,25 +179,26 @@ static int qcom_wled_update_status(struct backlight_device *bl)
bl->props.state & BL_CORE_FBBLANK)
brightness = 0;
+ mutex_lock(&wled->lock);
if (brightness) {
rc = qcom_wled_set_brightness(wled, brightness);
if (rc < 0) {
pr_err("wled failed to set brightness rc:%d\n", rc);
- return rc;
+ goto unlock_mutex;
}
if (!!brightness != wled->prev_state) {
rc = qcom_wled_module_enable(wled, !!brightness);
if (rc < 0) {
pr_err("wled enable failed rc:%d\n", rc);
- return rc;
+ goto unlock_mutex;
}
}
} else {
rc = qcom_wled_module_enable(wled, brightness);
if (rc < 0) {
pr_err("wled disable failed rc:%d\n", rc);
- return rc;
+ goto unlock_mutex;
}
}
@@ -184,19 +207,69 @@ static int qcom_wled_update_status(struct backlight_device *bl)
rc = qcom_wled_sync_toggle(wled);
if (rc < 0) {
pr_err("wled sync failed rc:%d\n", rc);
- return rc;
+ goto unlock_mutex;
}
wled->brightness = brightness;
+unlock_mutex:
+ mutex_unlock(&wled->lock);
return rc;
}
+static irqreturn_t qcom_wled_sc_irq_handler(int irq, void *_wled)
+{
+ struct qcom_wled *wled = _wled;
+ int rc;
+ u32 val;
+ s64 elapsed_time;
+
+ rc = regmap_read(wled->regmap,
+ wled->ctrl_addr + QCOM_WLED_CTRL_FAULT_STATUS, &val);
+ if (rc < 0) {
+ pr_err("Error in reading WLED_FAULT_STATUS rc=%d\n", rc);
+ return IRQ_HANDLED;
+ }
+
+ wled->sc_count++;
+ pr_err("WLED short circuit detected %d times fault_status=%x\n",
+ wled->sc_count, val);
+ mutex_lock(&wled->lock);
+ rc = qcom_wled_module_enable(wled, false);
+ if (rc < 0) {
+ pr_err("wled disable failed rc:%d\n", rc);
+ goto unlock_mutex;
+ }
+
+ elapsed_time = ktime_us_delta(ktime_get(),
+ wled->last_sc_event_time);
+ if (elapsed_time > QCOM_WLED_SC_RESET_CNT_DLY_US) {
+ wled->sc_count = 0;
+ } else if (wled->sc_count > QCOM_WLED_SC_CNT_MAX) {
+ pr_err("SC trigged %d times, disabling WLED forever!\n",
+ wled->sc_count);
+ goto unlock_mutex;
+ }
+
+ wled->last_sc_event_time = ktime_get();
+
+ msleep(QCOM_WLED_SC_DLY_MS);
+ rc = qcom_wled_module_enable(wled, true);
+ if (rc < 0)
+ pr_err("wled enable failed rc:%d\n", rc);
+
+unlock_mutex:
+ mutex_unlock(&wled->lock);
+
+ return IRQ_HANDLED;
+}
+
static int qcom_wled_setup(struct qcom_wled *wled)
{
int rc, temp, i;
u8 sink_en = 0;
u8 string_cfg = wled->cfg.string_cfg;
+ int sc_irq = wled->cfg.sc_irq;
rc = regmap_update_bits(wled->regmap,
wled->ctrl_addr + QCOM_WLED_CTRL_OVP,
@@ -261,6 +334,39 @@ static int qcom_wled_setup(struct qcom_wled *wled)
return rc;
}
+ if (sc_irq >= 0) {
+ rc = devm_request_threaded_irq(&wled->pdev->dev, sc_irq,
+ NULL, qcom_wled_sc_irq_handler, IRQF_ONESHOT,
+ "qcom_wled_sc_irq", wled);
+ if (rc < 0) {
+ pr_err("Unable to request sc(%d) IRQ(err:%d)\n",
+ sc_irq, rc);
+ return rc;
+ }
+
+ rc = regmap_update_bits(wled->regmap,
+ wled->ctrl_addr + QCOM_WLED_CTRL_SHORT_PROTECT,
+ QCOM_WLED_CTRL_SHORT_EN_MASK,
+ QCOM_WLED_CTRL_SHORT_EN_MASK);
+ if (rc < 0)
+ return rc;
+
+ if (wled->cfg.ext_pfet_sc_pro_en) {
+ /* unlock the secure access regisetr */
+ rc = regmap_write(wled->regmap, wled->ctrl_addr +
+ QCOM_WLED_CTRL_SEC_ACCESS,
+ QCOM_WLED_CTRL_SEC_UNLOCK);
+ if (rc < 0)
+ return rc;
+
+ rc = regmap_write(wled->regmap,
+ wled->ctrl_addr + QCOM_WLED_CTRL_TEST1,
+ QCOM_WLED_EXT_FET_DTEST2);
+ if (rc < 0)
+ return rc;
+ }
+ }
+
return 0;
}
@@ -271,6 +377,7 @@ static int qcom_wled_setup(struct qcom_wled *wled)
.switch_freq = 11,
.string_cfg = 0xf,
.en_cabc = 0,
+ .ext_pfet_sc_pro_en = 1,
};
struct qcom_wled_var_cfg {
@@ -376,6 +483,7 @@ static int qcom_wled_configure(struct qcom_wled *wled, struct device *dev)
bool *val_ptr;
} bool_opts[] = {
{ "qcom,en-cabc", &cfg->en_cabc, },
+ { "qcom,ext-pfet-sc-pro", &cfg->ext_pfet_sc_pro_en, },
};
prop_addr = of_get_address(dev->of_node, 0, NULL, NULL);
@@ -427,6 +535,10 @@ static int qcom_wled_configure(struct qcom_wled *wled, struct device *dev)
*bool_opts[i].val_ptr = true;
}
+ wled->cfg.sc_irq = platform_get_irq_byname(wled->pdev, "sc-irq");
+ if (wled->cfg.sc_irq < 0)
+ dev_dbg(&wled->pdev->dev, "sc irq is not used\n");
+
return 0;
}
@@ -469,6 +581,8 @@ static int qcom_wled_probe(struct platform_device *pdev)
return rc;
}
+ mutex_init(&wled->lock);
+
val = QCOM_WLED_DEFAULT_BRIGHTNESS;
of_property_read_u32(pdev->dev.of_node, "default-brightness", &val);
wled->brightness = val;
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox