All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] backlight: Add RAVE SP backlight driver
@ 2018-03-07  2:40 Andrey Smirnov
  2018-03-07  2:40 ` [PATCH 2/2] dt-bindings: backlight: Add binding for " Andrey Smirnov
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Andrey Smirnov @ 2018-03-07  2:40 UTC (permalink / raw)
  To: Lee Jones
  Cc: Andrey Smirnov, Daniel Thompson, Jingoo Han, linux-kernel,
	Chris Healy, Lucas Stach, Aleksander Morgado

This driver provides access to RAVE SP backlight control
functionality.

Cc: Lee Jones <lee.jones@linaro.org>
Cc: Daniel Thompson <daniel.thompson@linaro.org>
Cc: Jingoo Han <jingoohan1@gmail.com>
Cc: linux-kernel@vger.kernel.org
Cc: Chris Healy <cphealy@gmail.com>
Cc: Lucas Stach <l.stach@pengutronix.de>
Cc: Aleksander Morgado <aleksander@aleksander.es>
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
 drivers/video/backlight/Kconfig             |  6 +++
 drivers/video/backlight/Makefile            |  1 +
 drivers/video/backlight/rave-sp-backlight.c | 82 +++++++++++++++++++++++++++++
 include/linux/mfd/rave-sp.h                 |  1 +
 4 files changed, 90 insertions(+)
 create mode 100644 drivers/video/backlight/rave-sp-backlight.c

diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index 4e1d2ad50ba1..5d2d0d7e8100 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -467,6 +467,12 @@ config BACKLIGHT_ARCXCNN
 	  If you have an ARCxCnnnn family backlight say Y to enable
 	  the backlight driver.
 
+config BACKLIGHT_RAVE_SP
+	tristate "RAVE SP Backlight driver"
+	depends on RAVE_SP_CORE
+	help
+	  Support for backlight control on RAVE SP device.
+
 endif # BACKLIGHT_CLASS_DEVICE
 
 endif # BACKLIGHT_LCD_SUPPORT
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index 5e28f01c8391..19da71d518bf 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -57,3 +57,4 @@ obj-$(CONFIG_BACKLIGHT_TOSA)		+= tosa_bl.o
 obj-$(CONFIG_BACKLIGHT_TPS65217)	+= tps65217_bl.o
 obj-$(CONFIG_BACKLIGHT_WM831X)		+= wm831x_bl.o
 obj-$(CONFIG_BACKLIGHT_ARCXCNN) 	+= arcxcnn_bl.o
+obj-$(CONFIG_BACKLIGHT_RAVE_SP)		+= rave-sp-backlight.o
diff --git a/drivers/video/backlight/rave-sp-backlight.c b/drivers/video/backlight/rave-sp-backlight.c
new file mode 100644
index 000000000000..62836ba561db
--- /dev/null
+++ b/drivers/video/backlight/rave-sp-backlight.c
@@ -0,0 +1,82 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+/*
+ * LCD Backlight driver for RAVE SP
+ *
+ * Copyright (C) 2018 Zodiac Inflight Innovations
+ *
+ */
+
+#include <linux/backlight.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/mfd/rave-sp.h>
+#include <linux/platform_device.h>
+
+#define	RAVE_SP_BACKLIGHT_LCD_EN	BIT(7)
+
+static int rave_sp_backlight_update_status(struct backlight_device *bd)
+{
+	const struct backlight_properties *p = &bd->props;
+	const u8 intensity =
+		(p->power == FB_BLANK_UNBLANK) ? p->brightness : 0;
+	struct rave_sp *sp = dev_get_drvdata(&bd->dev);
+	u8 cmd[] = {
+		[0] = RAVE_SP_CMD_SET_BACKLIGHT,
+		[1] = 0,
+		[2] = intensity ? RAVE_SP_BACKLIGHT_LCD_EN | intensity : 0,
+		[3] = 0,
+		[4] = 0,
+	};
+
+	return rave_sp_exec(sp, cmd, sizeof(cmd), NULL, 0);
+}
+
+static const struct backlight_ops rave_sp_backlight_ops = {
+	.options	= BL_CORE_SUSPENDRESUME,
+	.update_status	= rave_sp_backlight_update_status,
+};
+
+static struct backlight_properties rave_sp_backlight_props = {
+	.type		= BACKLIGHT_FIRMWARE,
+	.max_brightness = 100,
+	.brightness	= 50,
+};
+
+static int rave_sp_backlight_probe(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	struct backlight_device *bd;
+
+	bd = devm_backlight_device_register(dev, pdev->name, dev->parent,
+					    dev_get_drvdata(dev->parent),
+					    &rave_sp_backlight_ops,
+					    &rave_sp_backlight_props);
+	if (IS_ERR(bd))
+		return PTR_ERR(bd);
+
+	backlight_update_status(bd);
+
+	return 0;
+}
+
+static const struct of_device_id rave_sp_backlight_of_match[] = {
+	{ .compatible = "zii,rave-sp-backlight" },
+	{}
+};
+
+static struct platform_driver rave_sp_backlight_driver = {
+	.probe = rave_sp_backlight_probe,
+	.driver	= {
+		.name = KBUILD_MODNAME,
+		.of_match_table = rave_sp_backlight_of_match,
+	},
+};
+module_platform_driver(rave_sp_backlight_driver);
+
+MODULE_DEVICE_TABLE(of, rave_sp_backlight_of_match);
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Andrey Vostrikov <andrey.vostrikov@cogentembedded.com>");
+MODULE_AUTHOR("Nikita Yushchenko <nikita.yoush@cogentembedded.com>");
+MODULE_AUTHOR("Andrey Smirnov <andrew.smirnov@gmail.com>");
+MODULE_DESCRIPTION("RAVE SP Backlight driver");
diff --git a/include/linux/mfd/rave-sp.h b/include/linux/mfd/rave-sp.h
index 796fb9794c9e..fe0ce7bc59cf 100644
--- a/include/linux/mfd/rave-sp.h
+++ b/include/linux/mfd/rave-sp.h
@@ -21,6 +21,7 @@ enum rave_sp_command {
 	RAVE_SP_CMD_STATUS			= 0xA0,
 	RAVE_SP_CMD_SW_WDT			= 0xA1,
 	RAVE_SP_CMD_PET_WDT			= 0xA2,
+	RAVE_SP_CMD_SET_BACKLIGHT		= 0xA6,
 	RAVE_SP_CMD_RESET			= 0xA7,
 	RAVE_SP_CMD_RESET_REASON		= 0xA8,
 
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/2] dt-bindings: backlight: Add binding for RAVE SP backlight driver
  2018-03-07  2:40 [PATCH 1/2] backlight: Add RAVE SP backlight driver Andrey Smirnov
@ 2018-03-07  2:40 ` Andrey Smirnov
  2018-03-08  2:10   ` Rob Herring
  2018-03-08 16:59   ` Daniel Thompson
  2018-03-07 16:53 ` [PATCH 1/2] backlight: Add " Lee Jones
  2018-03-08 16:58 ` Daniel Thompson
  2 siblings, 2 replies; 8+ messages in thread
From: Andrey Smirnov @ 2018-03-07  2:40 UTC (permalink / raw)
  To: Lee Jones
  Cc: Andrey Smirnov, Daniel Thompson, Jingoo Han, linux-kernel,
	Chris Healy, Lucas Stach, Aleksander Morgado, Rob Herring,
	Mark Rutland, devicetree

Add Device Tree bindings for RAVE SP backlihgt drvier - an MFD cell of
parent RAVE SP driver (documented in
Documentation/devicetree/bindings/mfd/zii,rave-sp.txt).

Cc: Lee Jones <lee.jones@linaro.org>
Cc: Daniel Thompson <daniel.thompson@linaro.org>
Cc: Jingoo Han <jingoohan1@gmail.com>
Cc: linux-kernel@vger.kernel.org
Cc: Chris Healy <cphealy@gmail.com>
Cc: Lucas Stach <l.stach@pengutronix.de>
Cc: Aleksander Morgado <aleksander@aleksander.es>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: devicetree@vger.kernel.org
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
 .../leds/backlight/zii,rave-sp-backlight.txt       | 23 ++++++++++++++++++++++
 1 file changed, 23 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/leds/backlight/zii,rave-sp-backlight.txt

diff --git a/Documentation/devicetree/bindings/leds/backlight/zii,rave-sp-backlight.txt b/Documentation/devicetree/bindings/leds/backlight/zii,rave-sp-backlight.txt
new file mode 100644
index 000000000000..2eba8322fc28
--- /dev/null
+++ b/Documentation/devicetree/bindings/leds/backlight/zii,rave-sp-backlight.txt
@@ -0,0 +1,23 @@
+Zodiac Inflight Innovations RAVE Supervisory Processor Backlight Bindings
+
+RAVE SP backlight device is a "MFD cell" device corresponding to
+backlight functionality of RAVE Supervisory Processor. It is expected
+that its Device Tree node is specified as a child of the node
+corresponding to the parent RAVE SP device (as documented in
+Documentation/devicetree/bindings/mfd/zii,rave-sp.txt)
+
+Required properties:
+
+- compatible: Should be "zii,rave-sp-backlight"
+
+Example:
+
+	rave-sp {
+		compatible = "zii,rave-sp-rdu1";
+		current-speed = <38400>;
+
+		pwrbutton {
+			compatible = "zii,rave-sp-backlight";
+		};
+	}
+
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] backlight: Add RAVE SP backlight driver
  2018-03-07  2:40 [PATCH 1/2] backlight: Add RAVE SP backlight driver Andrey Smirnov
  2018-03-07  2:40 ` [PATCH 2/2] dt-bindings: backlight: Add binding for " Andrey Smirnov
@ 2018-03-07 16:53 ` Lee Jones
  2018-03-08 16:58 ` Daniel Thompson
  2 siblings, 0 replies; 8+ messages in thread
From: Lee Jones @ 2018-03-07 16:53 UTC (permalink / raw)
  To: Andrey Smirnov
  Cc: Daniel Thompson, Jingoo Han, linux-kernel, Chris Healy,
	Lucas Stach, Aleksander Morgado

On Tue, 06 Mar 2018, Andrey Smirnov wrote:

> This driver provides access to RAVE SP backlight control
> functionality.
> 
> Cc: Lee Jones <lee.jones@linaro.org>
> Cc: Daniel Thompson <daniel.thompson@linaro.org>
> Cc: Jingoo Han <jingoohan1@gmail.com>
> Cc: linux-kernel@vger.kernel.org
> Cc: Chris Healy <cphealy@gmail.com>
> Cc: Lucas Stach <l.stach@pengutronix.de>
> Cc: Aleksander Morgado <aleksander@aleksander.es>
> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> ---
>  drivers/video/backlight/Kconfig             |  6 +++
>  drivers/video/backlight/Makefile            |  1 +
>  drivers/video/backlight/rave-sp-backlight.c | 82 +++++++++++++++++++++++++++++

>  include/linux/mfd/rave-sp.h                 |  1 +

For my own reference:
  Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>

-- 
Lee Jones
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] dt-bindings: backlight: Add binding for RAVE SP backlight driver
  2018-03-07  2:40 ` [PATCH 2/2] dt-bindings: backlight: Add binding for " Andrey Smirnov
@ 2018-03-08  2:10   ` Rob Herring
  2018-03-08 16:59   ` Daniel Thompson
  1 sibling, 0 replies; 8+ messages in thread
From: Rob Herring @ 2018-03-08  2:10 UTC (permalink / raw)
  To: Andrey Smirnov
  Cc: Lee Jones, Daniel Thompson, Jingoo Han, linux-kernel,
	Chris Healy, Lucas Stach, Aleksander Morgado, Mark Rutland,
	devicetree

On Tue, Mar 06, 2018 at 06:40:11PM -0800, Andrey Smirnov wrote:
> Add Device Tree bindings for RAVE SP backlihgt drvier - an MFD cell of
> parent RAVE SP driver (documented in
> Documentation/devicetree/bindings/mfd/zii,rave-sp.txt).
> 
> Cc: Lee Jones <lee.jones@linaro.org>
> Cc: Daniel Thompson <daniel.thompson@linaro.org>
> Cc: Jingoo Han <jingoohan1@gmail.com>
> Cc: linux-kernel@vger.kernel.org
> Cc: Chris Healy <cphealy@gmail.com>
> Cc: Lucas Stach <l.stach@pengutronix.de>
> Cc: Aleksander Morgado <aleksander@aleksander.es>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: devicetree@vger.kernel.org
> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> ---
>  .../leds/backlight/zii,rave-sp-backlight.txt       | 23 ++++++++++++++++++++++
>  1 file changed, 23 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/leds/backlight/zii,rave-sp-backlight.txt
> 
> diff --git a/Documentation/devicetree/bindings/leds/backlight/zii,rave-sp-backlight.txt b/Documentation/devicetree/bindings/leds/backlight/zii,rave-sp-backlight.txt
> new file mode 100644
> index 000000000000..2eba8322fc28
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/leds/backlight/zii,rave-sp-backlight.txt
> @@ -0,0 +1,23 @@
> +Zodiac Inflight Innovations RAVE Supervisory Processor Backlight Bindings
> +
> +RAVE SP backlight device is a "MFD cell" device corresponding to
> +backlight functionality of RAVE Supervisory Processor. It is expected
> +that its Device Tree node is specified as a child of the node
> +corresponding to the parent RAVE SP device (as documented in
> +Documentation/devicetree/bindings/mfd/zii,rave-sp.txt)
> +
> +Required properties:
> +
> +- compatible: Should be "zii,rave-sp-backlight"
> +
> +Example:
> +
> +	rave-sp {
> +		compatible = "zii,rave-sp-rdu1";
> +		current-speed = <38400>;
> +
> +		pwrbutton {

backlight {

> +			compatible = "zii,rave-sp-backlight";
> +		};
> +	}
> +
> -- 
> 2.14.3
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] backlight: Add RAVE SP backlight driver
  2018-03-07  2:40 [PATCH 1/2] backlight: Add RAVE SP backlight driver Andrey Smirnov
  2018-03-07  2:40 ` [PATCH 2/2] dt-bindings: backlight: Add binding for " Andrey Smirnov
  2018-03-07 16:53 ` [PATCH 1/2] backlight: Add " Lee Jones
@ 2018-03-08 16:58 ` Daniel Thompson
  2018-03-08 17:29   ` Andrey Smirnov
  2 siblings, 1 reply; 8+ messages in thread
From: Daniel Thompson @ 2018-03-08 16:58 UTC (permalink / raw)
  To: Andrey Smirnov, Lee Jones
  Cc: Jingoo Han, linux-kernel, Chris Healy, Lucas Stach, Aleksander Morgado

On 07/03/18 02:40, Andrey Smirnov wrote:
> This driver provides access to RAVE SP backlight control
> functionality.
> 
> Cc: Lee Jones <lee.jones@linaro.org>
> Cc: Daniel Thompson <daniel.thompson@linaro.org>
> Cc: Jingoo Han <jingoohan1@gmail.com>
> Cc: linux-kernel@vger.kernel.org
> Cc: Chris Healy <cphealy@gmail.com>
> Cc: Lucas Stach <l.stach@pengutronix.de>
> Cc: Aleksander Morgado <aleksander@aleksander.es>
> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> ---
>   drivers/video/backlight/Kconfig             |  6 +++
>   drivers/video/backlight/Makefile            |  1 +
>   drivers/video/backlight/rave-sp-backlight.c | 82 +++++++++++++++++++++++++++++
>   include/linux/mfd/rave-sp.h                 |  1 +
>   4 files changed, 90 insertions(+)
>   create mode 100644 drivers/video/backlight/rave-sp-backlight.c
> 
> diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
> index 4e1d2ad50ba1..5d2d0d7e8100 100644
> --- a/drivers/video/backlight/Kconfig
> +++ b/drivers/video/backlight/Kconfig
> @@ -467,6 +467,12 @@ config BACKLIGHT_ARCXCNN
>   	  If you have an ARCxCnnnn family backlight say Y to enable
>   	  the backlight driver.
>   
> +config BACKLIGHT_RAVE_SP
> +	tristate "RAVE SP Backlight driver"
> +	depends on RAVE_SP_CORE
> +	help
> +	  Support for backlight control on RAVE SP device.
> +
>   endif # BACKLIGHT_CLASS_DEVICE
>   
>   endif # BACKLIGHT_LCD_SUPPORT
> diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
> index 5e28f01c8391..19da71d518bf 100644
> --- a/drivers/video/backlight/Makefile
> +++ b/drivers/video/backlight/Makefile
> @@ -57,3 +57,4 @@ obj-$(CONFIG_BACKLIGHT_TOSA)		+= tosa_bl.o
>   obj-$(CONFIG_BACKLIGHT_TPS65217)	+= tps65217_bl.o
>   obj-$(CONFIG_BACKLIGHT_WM831X)		+= wm831x_bl.o
>   obj-$(CONFIG_BACKLIGHT_ARCXCNN) 	+= arcxcnn_bl.o
> +obj-$(CONFIG_BACKLIGHT_RAVE_SP)		+= rave-sp-backlight.o
> diff --git a/drivers/video/backlight/rave-sp-backlight.c b/drivers/video/backlight/rave-sp-backlight.c
> new file mode 100644
> index 000000000000..62836ba561db
> --- /dev/null
> +++ b/drivers/video/backlight/rave-sp-backlight.c
> @@ -0,0 +1,82 @@
> +// SPDX-License-Identifier: GPL-2.0+
> +
> +/*
> + * LCD Backlight driver for RAVE SP
> + *
> + * Copyright (C) 2018 Zodiac Inflight Innovations
> + *
> + */
> +
> +#include <linux/backlight.h>
> +#include <linux/kernel.h>
> +#include <linux/module.h>
> +#include <linux/mfd/rave-sp.h>
> +#include <linux/platform_device.h>
> +
> +#define	RAVE_SP_BACKLIGHT_LCD_EN	BIT(7)
> +
> +static int rave_sp_backlight_update_status(struct backlight_device *bd)
> +{
> +	const struct backlight_properties *p = &bd->props;
> +	const u8 intensity =
> +		(p->power == FB_BLANK_UNBLANK) ? p->brightness : 0;
> +	struct rave_sp *sp = dev_get_drvdata(&bd->dev);
> +	u8 cmd[] = {
> +		[0] = RAVE_SP_CMD_SET_BACKLIGHT,
> +		[1] = 0,
> +		[2] = intensity ? RAVE_SP_BACKLIGHT_LCD_EN | intensity : 0,
> +		[3] = 0,
> +		[4] = 0,
> +	};
> +
> +	return rave_sp_exec(sp, cmd, sizeof(cmd), NULL, 0);
> +}
> +
> +static const struct backlight_ops rave_sp_backlight_ops = {
> +	.options	= BL_CORE_SUSPENDRESUME,
> +	.update_status	= rave_sp_backlight_update_status,
> +};
> +
> +static struct backlight_properties rave_sp_backlight_props = {
> +	.type		= BACKLIGHT_FIRMWARE,

I would have thought BACKLIGHT_PLATFORM would be more suitable here. 
BACKLIGHT_FIRMWARE is used for things like the ACPI backlight driver.

Why did you select this one?


Daniel.


> +	.max_brightness = 100,
> +	.brightness	= 50,
> +};
> +
> +static int rave_sp_backlight_probe(struct platform_device *pdev)
> +{
> +	struct device *dev = &pdev->dev;
> +	struct backlight_device *bd;
> +
> +	bd = devm_backlight_device_register(dev, pdev->name, dev->parent,
> +					    dev_get_drvdata(dev->parent),
> +					    &rave_sp_backlight_ops,
> +					    &rave_sp_backlight_props);
> +	if (IS_ERR(bd))
> +		return PTR_ERR(bd);
> +
> +	backlight_update_status(bd);
> +
> +	return 0;
> +}
> +
> +static const struct of_device_id rave_sp_backlight_of_match[] = {
> +	{ .compatible = "zii,rave-sp-backlight" },
> +	{}
> +};
> +
> +static struct platform_driver rave_sp_backlight_driver = {
> +	.probe = rave_sp_backlight_probe,
> +	.driver	= {
> +		.name = KBUILD_MODNAME,
> +		.of_match_table = rave_sp_backlight_of_match,
> +	},
> +};
> +module_platform_driver(rave_sp_backlight_driver);
> +
> +MODULE_DEVICE_TABLE(of, rave_sp_backlight_of_match);
> +MODULE_LICENSE("GPL");
> +MODULE_AUTHOR("Andrey Vostrikov <andrey.vostrikov@cogentembedded.com>");
> +MODULE_AUTHOR("Nikita Yushchenko <nikita.yoush@cogentembedded.com>");
> +MODULE_AUTHOR("Andrey Smirnov <andrew.smirnov@gmail.com>");
> +MODULE_DESCRIPTION("RAVE SP Backlight driver");
> diff --git a/include/linux/mfd/rave-sp.h b/include/linux/mfd/rave-sp.h
> index 796fb9794c9e..fe0ce7bc59cf 100644
> --- a/include/linux/mfd/rave-sp.h
> +++ b/include/linux/mfd/rave-sp.h
> @@ -21,6 +21,7 @@ enum rave_sp_command {
>   	RAVE_SP_CMD_STATUS			= 0xA0,
>   	RAVE_SP_CMD_SW_WDT			= 0xA1,
>   	RAVE_SP_CMD_PET_WDT			= 0xA2,
> +	RAVE_SP_CMD_SET_BACKLIGHT		= 0xA6,
>   	RAVE_SP_CMD_RESET			= 0xA7,
>   	RAVE_SP_CMD_RESET_REASON		= 0xA8,
>   
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] dt-bindings: backlight: Add binding for RAVE SP backlight driver
  2018-03-07  2:40 ` [PATCH 2/2] dt-bindings: backlight: Add binding for " Andrey Smirnov
  2018-03-08  2:10   ` Rob Herring
@ 2018-03-08 16:59   ` Daniel Thompson
  1 sibling, 0 replies; 8+ messages in thread
From: Daniel Thompson @ 2018-03-08 16:59 UTC (permalink / raw)
  To: Andrey Smirnov, Lee Jones
  Cc: Jingoo Han, linux-kernel, Chris Healy, Lucas Stach,
	Aleksander Morgado, Rob Herring, Mark Rutland, devicetree

On 07/03/18 02:40, Andrey Smirnov wrote:
> Add Device Tree bindings for RAVE SP backlihgt drvier - an MFD cell of
> parent RAVE SP driver (documented in
> Documentation/devicetree/bindings/mfd/zii,rave-sp.txt).
> 
> Cc: Lee Jones <lee.jones@linaro.org>
> Cc: Daniel Thompson <daniel.thompson@linaro.org>
> Cc: Jingoo Han <jingoohan1@gmail.com>
> Cc: linux-kernel@vger.kernel.org
> Cc: Chris Healy <cphealy@gmail.com>
> Cc: Lucas Stach <l.stach@pengutronix.de>
> Cc: Aleksander Morgado <aleksander@aleksander.es>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: devicetree@vger.kernel.org
> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>

Acked-by: Daniel Thompson <daniel.thompson@linaro.org>

> ---
>   .../leds/backlight/zii,rave-sp-backlight.txt       | 23 ++++++++++++++++++++++
>   1 file changed, 23 insertions(+)
>   create mode 100644 Documentation/devicetree/bindings/leds/backlight/zii,rave-sp-backlight.txt
> 
> diff --git a/Documentation/devicetree/bindings/leds/backlight/zii,rave-sp-backlight.txt b/Documentation/devicetree/bindings/leds/backlight/zii,rave-sp-backlight.txt
> new file mode 100644
> index 000000000000..2eba8322fc28
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/leds/backlight/zii,rave-sp-backlight.txt
> @@ -0,0 +1,23 @@
> +Zodiac Inflight Innovations RAVE Supervisory Processor Backlight Bindings
> +
> +RAVE SP backlight device is a "MFD cell" device corresponding to
> +backlight functionality of RAVE Supervisory Processor. It is expected
> +that its Device Tree node is specified as a child of the node
> +corresponding to the parent RAVE SP device (as documented in
> +Documentation/devicetree/bindings/mfd/zii,rave-sp.txt)
> +
> +Required properties:
> +
> +- compatible: Should be "zii,rave-sp-backlight"
> +
> +Example:
> +
> +	rave-sp {
> +		compatible = "zii,rave-sp-rdu1";
> +		current-speed = <38400>;
> +
> +		pwrbutton {
> +			compatible = "zii,rave-sp-backlight";
> +		};
> +	}
> +
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] backlight: Add RAVE SP backlight driver
  2018-03-08 16:58 ` Daniel Thompson
@ 2018-03-08 17:29   ` Andrey Smirnov
  2018-03-08 17:51     ` Daniel Thompson
  0 siblings, 1 reply; 8+ messages in thread
From: Andrey Smirnov @ 2018-03-08 17:29 UTC (permalink / raw)
  To: Daniel Thompson
  Cc: Lee Jones, Jingoo Han, linux-kernel, Chris Healy, Lucas Stach,
	Aleksander Morgado

On Thu, Mar 8, 2018 at 8:58 AM, Daniel Thompson
<daniel.thompson@linaro.org> wrote:
> On 07/03/18 02:40, Andrey Smirnov wrote:
>>
>> This driver provides access to RAVE SP backlight control
>> functionality.
>>
>> Cc: Lee Jones <lee.jones@linaro.org>
>> Cc: Daniel Thompson <daniel.thompson@linaro.org>
>> Cc: Jingoo Han <jingoohan1@gmail.com>
>> Cc: linux-kernel@vger.kernel.org
>> Cc: Chris Healy <cphealy@gmail.com>
>> Cc: Lucas Stach <l.stach@pengutronix.de>
>> Cc: Aleksander Morgado <aleksander@aleksander.es>
>> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
>> ---
>>   drivers/video/backlight/Kconfig             |  6 +++
>>   drivers/video/backlight/Makefile            |  1 +
>>   drivers/video/backlight/rave-sp-backlight.c | 82
>> +++++++++++++++++++++++++++++
>>   include/linux/mfd/rave-sp.h                 |  1 +
>>   4 files changed, 90 insertions(+)
>>   create mode 100644 drivers/video/backlight/rave-sp-backlight.c
>>
>> diff --git a/drivers/video/backlight/Kconfig
>> b/drivers/video/backlight/Kconfig
>> index 4e1d2ad50ba1..5d2d0d7e8100 100644
>> --- a/drivers/video/backlight/Kconfig
>> +++ b/drivers/video/backlight/Kconfig
>> @@ -467,6 +467,12 @@ config BACKLIGHT_ARCXCNN
>>           If you have an ARCxCnnnn family backlight say Y to enable
>>           the backlight driver.
>>   +config BACKLIGHT_RAVE_SP
>> +       tristate "RAVE SP Backlight driver"
>> +       depends on RAVE_SP_CORE
>> +       help
>> +         Support for backlight control on RAVE SP device.
>> +
>>   endif # BACKLIGHT_CLASS_DEVICE
>>     endif # BACKLIGHT_LCD_SUPPORT
>> diff --git a/drivers/video/backlight/Makefile
>> b/drivers/video/backlight/Makefile
>> index 5e28f01c8391..19da71d518bf 100644
>> --- a/drivers/video/backlight/Makefile
>> +++ b/drivers/video/backlight/Makefile
>> @@ -57,3 +57,4 @@ obj-$(CONFIG_BACKLIGHT_TOSA)          += tosa_bl.o
>>   obj-$(CONFIG_BACKLIGHT_TPS65217)      += tps65217_bl.o
>>   obj-$(CONFIG_BACKLIGHT_WM831X)                += wm831x_bl.o
>>   obj-$(CONFIG_BACKLIGHT_ARCXCNN)       += arcxcnn_bl.o
>> +obj-$(CONFIG_BACKLIGHT_RAVE_SP)                += rave-sp-backlight.o
>> diff --git a/drivers/video/backlight/rave-sp-backlight.c
>> b/drivers/video/backlight/rave-sp-backlight.c
>> new file mode 100644
>> index 000000000000..62836ba561db
>> --- /dev/null
>> +++ b/drivers/video/backlight/rave-sp-backlight.c
>> @@ -0,0 +1,82 @@
>> +// SPDX-License-Identifier: GPL-2.0+
>> +
>> +/*
>> + * LCD Backlight driver for RAVE SP
>> + *
>> + * Copyright (C) 2018 Zodiac Inflight Innovations
>> + *
>> + */
>> +
>> +#include <linux/backlight.h>
>> +#include <linux/kernel.h>
>> +#include <linux/module.h>
>> +#include <linux/mfd/rave-sp.h>
>> +#include <linux/platform_device.h>
>> +
>> +#define        RAVE_SP_BACKLIGHT_LCD_EN        BIT(7)
>> +
>> +static int rave_sp_backlight_update_status(struct backlight_device *bd)
>> +{
>> +       const struct backlight_properties *p = &bd->props;
>> +       const u8 intensity =
>> +               (p->power == FB_BLANK_UNBLANK) ? p->brightness : 0;
>> +       struct rave_sp *sp = dev_get_drvdata(&bd->dev);
>> +       u8 cmd[] = {
>> +               [0] = RAVE_SP_CMD_SET_BACKLIGHT,
>> +               [1] = 0,
>> +               [2] = intensity ? RAVE_SP_BACKLIGHT_LCD_EN | intensity :
>> 0,
>> +               [3] = 0,
>> +               [4] = 0,
>> +       };
>> +
>> +       return rave_sp_exec(sp, cmd, sizeof(cmd), NULL, 0);
>> +}
>> +
>> +static const struct backlight_ops rave_sp_backlight_ops = {
>> +       .options        = BL_CORE_SUSPENDRESUME,
>> +       .update_status  = rave_sp_backlight_update_status,
>> +};
>> +
>> +static struct backlight_properties rave_sp_backlight_props = {
>> +       .type           = BACKLIGHT_FIRMWARE,
>
>
> I would have thought BACKLIGHT_PLATFORM would be more suitable here.
> BACKLIGHT_FIRMWARE is used for things like the ACPI backlight driver.
>
> Why did you select this one?
>

Good point and I don't think I have any justification to choose
FIRMWARE over PLATFORM, will fix in v2.

Thanks,
Andrey Smirnov

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] backlight: Add RAVE SP backlight driver
  2018-03-08 17:29   ` Andrey Smirnov
@ 2018-03-08 17:51     ` Daniel Thompson
  0 siblings, 0 replies; 8+ messages in thread
From: Daniel Thompson @ 2018-03-08 17:51 UTC (permalink / raw)
  To: Andrey Smirnov
  Cc: Lee Jones, Jingoo Han, linux-kernel, Chris Healy, Lucas Stach,
	Aleksander Morgado

On 08/03/18 17:29, Andrey Smirnov wrote:
> On Thu, Mar 8, 2018 at 8:58 AM, Daniel Thompson
> <daniel.thompson@linaro.org> wrote:
>> On 07/03/18 02:40, Andrey Smirnov wrote:
>>>
>>> This driver provides access to RAVE SP backlight control
>>> functionality.
>>>
>>> Cc: Lee Jones <lee.jones@linaro.org>
>>> Cc: Daniel Thompson <daniel.thompson@linaro.org>
>>> Cc: Jingoo Han <jingoohan1@gmail.com>
>>> Cc: linux-kernel@vger.kernel.org
>>> Cc: Chris Healy <cphealy@gmail.com>
>>> Cc: Lucas Stach <l.stach@pengutronix.de>
>>> Cc: Aleksander Morgado <aleksander@aleksander.es>
>>> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
>>> ---
>>>    drivers/video/backlight/Kconfig             |  6 +++
>>>    drivers/video/backlight/Makefile            |  1 +
>>>    drivers/video/backlight/rave-sp-backlight.c | 82
>>> +++++++++++++++++++++++++++++
>>>    include/linux/mfd/rave-sp.h                 |  1 +
>>>    4 files changed, 90 insertions(+)
>>>    create mode 100644 drivers/video/backlight/rave-sp-backlight.c
>>>
>>> diff --git a/drivers/video/backlight/Kconfig
>>> b/drivers/video/backlight/Kconfig
>>> index 4e1d2ad50ba1..5d2d0d7e8100 100644
>>> --- a/drivers/video/backlight/Kconfig
>>> +++ b/drivers/video/backlight/Kconfig
>>> @@ -467,6 +467,12 @@ config BACKLIGHT_ARCXCNN
>>>            If you have an ARCxCnnnn family backlight say Y to enable
>>>            the backlight driver.
>>>    +config BACKLIGHT_RAVE_SP
>>> +       tristate "RAVE SP Backlight driver"
>>> +       depends on RAVE_SP_CORE
>>> +       help
>>> +         Support for backlight control on RAVE SP device.
>>> +
>>>    endif # BACKLIGHT_CLASS_DEVICE
>>>      endif # BACKLIGHT_LCD_SUPPORT
>>> diff --git a/drivers/video/backlight/Makefile
>>> b/drivers/video/backlight/Makefile
>>> index 5e28f01c8391..19da71d518bf 100644
>>> --- a/drivers/video/backlight/Makefile
>>> +++ b/drivers/video/backlight/Makefile
>>> @@ -57,3 +57,4 @@ obj-$(CONFIG_BACKLIGHT_TOSA)          += tosa_bl.o
>>>    obj-$(CONFIG_BACKLIGHT_TPS65217)      += tps65217_bl.o
>>>    obj-$(CONFIG_BACKLIGHT_WM831X)                += wm831x_bl.o
>>>    obj-$(CONFIG_BACKLIGHT_ARCXCNN)       += arcxcnn_bl.o
>>> +obj-$(CONFIG_BACKLIGHT_RAVE_SP)                += rave-sp-backlight.o
>>> diff --git a/drivers/video/backlight/rave-sp-backlight.c
>>> b/drivers/video/backlight/rave-sp-backlight.c
>>> new file mode 100644
>>> index 000000000000..62836ba561db
>>> --- /dev/null
>>> +++ b/drivers/video/backlight/rave-sp-backlight.c
>>> @@ -0,0 +1,82 @@
>>> +// SPDX-License-Identifier: GPL-2.0+
>>> +
>>> +/*
>>> + * LCD Backlight driver for RAVE SP
>>> + *
>>> + * Copyright (C) 2018 Zodiac Inflight Innovations
>>> + *
>>> + */
>>> +
>>> +#include <linux/backlight.h>
>>> +#include <linux/kernel.h>
>>> +#include <linux/module.h>
>>> +#include <linux/mfd/rave-sp.h>
>>> +#include <linux/platform_device.h>
>>> +
>>> +#define        RAVE_SP_BACKLIGHT_LCD_EN        BIT(7)
>>> +
>>> +static int rave_sp_backlight_update_status(struct backlight_device *bd)
>>> +{
>>> +       const struct backlight_properties *p = &bd->props;
>>> +       const u8 intensity =
>>> +               (p->power == FB_BLANK_UNBLANK) ? p->brightness : 0;
>>> +       struct rave_sp *sp = dev_get_drvdata(&bd->dev);
>>> +       u8 cmd[] = {
>>> +               [0] = RAVE_SP_CMD_SET_BACKLIGHT,
>>> +               [1] = 0,
>>> +               [2] = intensity ? RAVE_SP_BACKLIGHT_LCD_EN | intensity :
>>> 0,
>>> +               [3] = 0,
>>> +               [4] = 0,
>>> +       };
>>> +
>>> +       return rave_sp_exec(sp, cmd, sizeof(cmd), NULL, 0);
>>> +}
>>> +
>>> +static const struct backlight_ops rave_sp_backlight_ops = {
>>> +       .options        = BL_CORE_SUSPENDRESUME,
>>> +       .update_status  = rave_sp_backlight_update_status,
>>> +};
>>> +
>>> +static struct backlight_properties rave_sp_backlight_props = {
>>> +       .type           = BACKLIGHT_FIRMWARE,
>>
>>
>> I would have thought BACKLIGHT_PLATFORM would be more suitable here.
>> BACKLIGHT_FIRMWARE is used for things like the ACPI backlight driver.
>>
>> Why did you select this one?
>>
> 
> Good point and I don't think I have any justification to choose
> FIRMWARE over PLATFORM, will fix in v2.

Thanks. With that fixed:

Acked-by: Daniel Thompson <daniel.thompson@linaro.org>


Daniel.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-03-08 17:51 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-07  2:40 [PATCH 1/2] backlight: Add RAVE SP backlight driver Andrey Smirnov
2018-03-07  2:40 ` [PATCH 2/2] dt-bindings: backlight: Add binding for " Andrey Smirnov
2018-03-08  2:10   ` Rob Herring
2018-03-08 16:59   ` Daniel Thompson
2018-03-07 16:53 ` [PATCH 1/2] backlight: Add " Lee Jones
2018-03-08 16:58 ` Daniel Thompson
2018-03-08 17:29   ` Andrey Smirnov
2018-03-08 17:51     ` Daniel Thompson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.