mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-23 15:32:33 +00:00
f5919b65d4
Patch generation process: - rebase rpi/rpi-4.14.y on v4.14.89 from linux-stable - git format-patch v4.14.89 Patches skipped during rebase: - lan78xx: Read MAC address from DT if present - lan78xx: Enable LEDs and auto-negotiation - Revert "softirq: Let ksoftirqd do its job" - sc16is7xx: Fix for multi-channel stall - lan78xx: Ignore DT MAC address if already valid - lan78xx: Simple patch to prevent some crashes - tcp_write_queue_purge clears all the SKBs in the write queue - Revert "lan78xx: Simple patch to prevent some crashes" - lan78xx: Connect phy early - Arm: mm: ftrace: Only set text back to ro after kernel has been marked ro - Revert "Revert "softirq: Let ksoftirqd do its job"" - ASoC: cs4265: SOC_SINGLE register value error fix - Revert "ASoC: cs4265: SOC_SINGLE register value error fix" - Revert "net: pskb_trim_rcsum() and CHECKSUM_COMPLETE are friends" - Revert "Revert "net: pskb_trim_rcsum() and CHECKSUM_COMPLETE are friends"" Patches dropped after rebase: - net: Add non-mainline source for rtl8192cu wlan - net: Fix rtl8192cu build errors on other platforms - brcm: adds support for BCM43341 wifi - brcmfmac: Mute expected startup 'errors' - ARM64: Fix build break for RTL8187/RTL8192CU wifi - ARM64: Enable RTL8187/RTL8192CU wifi in build config - This is the driver for Sony CXD2880 DVB-T2/T tuner + demodulator - brcmfmac: add CLM download support - brcmfmac: request_firmware_direct is quieter - Sets the BCDC priority to constant 0 - brcmfmac: Disable ARP offloading when promiscuous - brcmfmac: Avoid possible out-of-bounds read - brcmfmac: Delete redundant length check - net: rtl8192cu: Normalize indentation - net: rtl8192cu: Fix implicit fallthrough warnings - Revert "Sets the BCDC priority to constant 0" - media: cxd2880: Bump to match 4.18.y version - media: cxd2880-spi: Bump to match 4.18.y version - Revert "mm: alloc_contig: re-allow CMA to compact FS pages" - Revert "Revert "mm: alloc_contig: re-allow CMA to compact FS pages"" - cxd2880: CXD2880_SPI_DRV should select DVB_CXD2880 with MEDIA_SUBDRV_AUTOSELECT - 950-0421-HID-hid-bigbenff-driver-for-BigBen-Interactive-PS3OF.patch - 950-0453-Add-hid-bigbenff-to-list-of-have_special_driver-for-.patch Make I2C built-in instead of modular as in upstream defconfig; also the easiest way to get MFD_ARIZONA enabled, which is required by kmod-sound-soc-rpi-cirrus. Add missing compatible strings from 4.9/960-add-rasbperrypi-compatible.patch, using upstream names for compute modules. Add extra patch to enable the LEDs on lan78xx. Compile-tested: bcm2708, bcm2709, bcm2710 (with CONFIG_ALL_KMODS=y) Runtime-tested: bcm2708, bcm2710 Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
165 lines
4.8 KiB
Diff
165 lines
4.8 KiB
Diff
From 574dfed6fa4e845eab5632d5f956e7ec879d6416 Mon Sep 17 00:00:00 2001
|
|
From: P33M <P33M@github.com>
|
|
Date: Wed, 21 Oct 2015 14:55:21 +0100
|
|
Subject: [PATCH 089/454] rpi_display: add backlight driver and overlay
|
|
|
|
Add a mailbox-driven backlight controller for the Raspberry Pi DSI
|
|
touchscreen display. Requires updated GPU firmware to recognise the
|
|
mailbox request.
|
|
|
|
Signed-off-by: Gordon Hollingworth <gordon@raspberrypi.org>
|
|
---
|
|
drivers/video/backlight/Kconfig | 6 ++
|
|
drivers/video/backlight/Makefile | 1 +
|
|
drivers/video/backlight/rpi_backlight.c | 119 ++++++++++++++++++++++++
|
|
3 files changed, 126 insertions(+)
|
|
create mode 100644 drivers/video/backlight/rpi_backlight.c
|
|
|
|
--- a/drivers/video/backlight/Kconfig
|
|
+++ b/drivers/video/backlight/Kconfig
|
|
@@ -265,6 +265,12 @@ config BACKLIGHT_PWM
|
|
If you have a LCD backlight adjustable by PWM, say Y to enable
|
|
this driver.
|
|
|
|
+config BACKLIGHT_RPI
|
|
+ tristate "Raspberry Pi display firmware driven backlight"
|
|
+ help
|
|
+ If you have the Raspberry Pi DSI touchscreen display, say Y to
|
|
+ enable the mailbox-controlled backlight driver.
|
|
+
|
|
config BACKLIGHT_DA903X
|
|
tristate "Backlight Driver for DA9030/DA9034 using WLED"
|
|
depends on PMIC_DA903X
|
|
--- a/drivers/video/backlight/Makefile
|
|
+++ b/drivers/video/backlight/Makefile
|
|
@@ -51,6 +51,7 @@ obj-$(CONFIG_BACKLIGHT_PANDORA) += pand
|
|
obj-$(CONFIG_BACKLIGHT_PCF50633) += pcf50633-backlight.o
|
|
obj-$(CONFIG_BACKLIGHT_PM8941_WLED) += pm8941-wled.o
|
|
obj-$(CONFIG_BACKLIGHT_PWM) += pwm_bl.o
|
|
+obj-$(CONFIG_BACKLIGHT_RPI) += rpi_backlight.o
|
|
obj-$(CONFIG_BACKLIGHT_SAHARA) += kb3886_bl.o
|
|
obj-$(CONFIG_BACKLIGHT_SKY81452) += sky81452-backlight.o
|
|
obj-$(CONFIG_BACKLIGHT_TOSA) += tosa_bl.o
|
|
--- /dev/null
|
|
+++ b/drivers/video/backlight/rpi_backlight.c
|
|
@@ -0,0 +1,119 @@
|
|
+/*
|
|
+ * rpi_bl.c - Backlight controller through VPU
|
|
+ *
|
|
+ * 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/backlight.h>
|
|
+#include <linux/err.h>
|
|
+#include <linux/fb.h>
|
|
+#include <linux/gpio.h>
|
|
+#include <linux/init.h>
|
|
+#include <linux/kernel.h>
|
|
+#include <linux/module.h>
|
|
+#include <linux/of.h>
|
|
+#include <linux/of_gpio.h>
|
|
+#include <linux/platform_device.h>
|
|
+#include <linux/slab.h>
|
|
+#include <soc/bcm2835/raspberrypi-firmware.h>
|
|
+
|
|
+struct rpi_backlight {
|
|
+ struct device *dev;
|
|
+ struct device *fbdev;
|
|
+ struct rpi_firmware *fw;
|
|
+};
|
|
+
|
|
+static int rpi_backlight_update_status(struct backlight_device *bl)
|
|
+{
|
|
+ struct rpi_backlight *gbl = bl_get_data(bl);
|
|
+ int brightness = bl->props.brightness;
|
|
+ int ret;
|
|
+
|
|
+ if (bl->props.power != FB_BLANK_UNBLANK ||
|
|
+ bl->props.fb_blank != FB_BLANK_UNBLANK ||
|
|
+ bl->props.state & (BL_CORE_SUSPENDED | BL_CORE_FBBLANK))
|
|
+ brightness = 0;
|
|
+
|
|
+ ret = rpi_firmware_property(gbl->fw,
|
|
+ RPI_FIRMWARE_FRAMEBUFFER_SET_BACKLIGHT,
|
|
+ &brightness, sizeof(brightness));
|
|
+ if (ret) {
|
|
+ dev_err(gbl->dev, "Failed to set brightness\n");
|
|
+ return ret;
|
|
+ }
|
|
+
|
|
+ if (brightness < 0) {
|
|
+ dev_err(gbl->dev, "Backlight change failed\n");
|
|
+ return -EAGAIN;
|
|
+ }
|
|
+
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+static const struct backlight_ops rpi_backlight_ops = {
|
|
+ .options = BL_CORE_SUSPENDRESUME,
|
|
+ .update_status = rpi_backlight_update_status,
|
|
+};
|
|
+
|
|
+static int rpi_backlight_probe(struct platform_device *pdev)
|
|
+{
|
|
+ struct backlight_properties props;
|
|
+ struct backlight_device *bl;
|
|
+ struct rpi_backlight *gbl;
|
|
+ struct device_node *fw_node;
|
|
+
|
|
+ gbl = devm_kzalloc(&pdev->dev, sizeof(*gbl), GFP_KERNEL);
|
|
+ if (gbl == NULL)
|
|
+ return -ENOMEM;
|
|
+
|
|
+ gbl->dev = &pdev->dev;
|
|
+
|
|
+ fw_node = of_parse_phandle(pdev->dev.of_node, "firmware", 0);
|
|
+ if (!fw_node) {
|
|
+ dev_err(&pdev->dev, "Missing firmware node\n");
|
|
+ return -ENOENT;
|
|
+ }
|
|
+
|
|
+ gbl->fw = rpi_firmware_get(fw_node);
|
|
+ if (!gbl->fw)
|
|
+ return -EPROBE_DEFER;
|
|
+
|
|
+ memset(&props, 0, sizeof(props));
|
|
+ props.type = BACKLIGHT_RAW;
|
|
+ props.max_brightness = 255;
|
|
+ bl = devm_backlight_device_register(&pdev->dev, dev_name(&pdev->dev),
|
|
+ &pdev->dev, gbl, &rpi_backlight_ops,
|
|
+ &props);
|
|
+ if (IS_ERR(bl)) {
|
|
+ dev_err(&pdev->dev, "failed to register backlight\n");
|
|
+ return PTR_ERR(bl);
|
|
+ }
|
|
+
|
|
+ bl->props.brightness = 255;
|
|
+ backlight_update_status(bl);
|
|
+
|
|
+ platform_set_drvdata(pdev, bl);
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+static const struct of_device_id rpi_backlight_of_match[] = {
|
|
+ { .compatible = "raspberrypi,rpi-backlight" },
|
|
+ { /* sentinel */ }
|
|
+};
|
|
+MODULE_DEVICE_TABLE(of, rpi_backlight_of_match);
|
|
+
|
|
+static struct platform_driver rpi_backlight_driver = {
|
|
+ .driver = {
|
|
+ .name = "rpi-backlight",
|
|
+ .of_match_table = of_match_ptr(rpi_backlight_of_match),
|
|
+ },
|
|
+ .probe = rpi_backlight_probe,
|
|
+};
|
|
+
|
|
+module_platform_driver(rpi_backlight_driver);
|
|
+
|
|
+MODULE_AUTHOR("Gordon Hollingworth <gordon@raspberrypi.org>");
|
|
+MODULE_DESCRIPTION("Raspberry Pi mailbox based Backlight Driver");
|
|
+MODULE_LICENSE("GPL");
|