* [PATCH v2 1/2] drm/panel: Add Sharp LS043T1LE01 panel binding documentation
@ 2015-10-30 22:34 Bjorn Andersson
2015-10-30 22:34 ` [PATCH v2 2/2] drm/panel: Add Sharp LS043T1LE01 MIPI DSI panel Bjorn Andersson
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Bjorn Andersson @ 2015-10-30 22:34 UTC (permalink / raw)
To: Thierry Reding, Rob Herring, Pawel Moll, Mark Rutland,
Ian Campbell, Kumar Gala
Cc: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-arm-msm-u79uwXL29TY76Z2rM5mHXA, Werner Johansson
From: Werner Johansson <werner.johansson-/MT0OVThwyLZJqsBc5GL+g@public.gmane.org>
Signed-off-by: Werner Johansson <werner.johansson-/MT0OVThwyLZJqsBc5GL+g@public.gmane.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson-/MT0OVThwyLZJqsBc5GL+g@public.gmane.org>
---
Change since v1:
- Dropped -vid suffix from compatible
.../bindings/display/panel/sharp,ls043t1le01.txt | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
create mode 100644 Documentation/devicetree/bindings/display/panel/sharp,ls043t1le01.txt
diff --git a/Documentation/devicetree/bindings/display/panel/sharp,ls043t1le01.txt b/Documentation/devicetree/bindings/display/panel/sharp,ls043t1le01.txt
new file mode 100644
index 000000000000..b3d4e073930a
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/panel/sharp,ls043t1le01.txt
@@ -0,0 +1,22 @@
+Sharp Microelectronics 4.3" qHD TFT LCD panel
+
+Required properties:
+- compatible: should be "sharp,ls043t1le01-qhd"
+- reg: DSI virtual channel of the peripheral
+- power-supply: phandle of the regulator that provides the supply voltage
+
+Optional properties:
+- backlight: phandle of the backlight device attached to the panel
+- reset-gpios: a GPIO spec for the reset pin
+
+Example:
+
+ mdss_dsi@fd922800 {
+ panel@0 {
+ compatible = "sharp,ls043t1le01-qhd";
+ reg = <0>;
+ avdd-supply = <&pm8941_l22>;
+ backlight = <&pm8941_wled>;
+ reset-gpios = <&pm8941_gpios 19 GPIO_ACTIVE_HIGH>;
+ };
+ };
--
2.4.2
--
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 [flat|nested] 6+ messages in thread
* [PATCH v2 2/2] drm/panel: Add Sharp LS043T1LE01 MIPI DSI panel
2015-10-30 22:34 [PATCH v2 1/2] drm/panel: Add Sharp LS043T1LE01 panel binding documentation Bjorn Andersson
@ 2015-10-30 22:34 ` Bjorn Andersson
2015-11-05 5:41 ` Archit Taneja
2015-11-23 11:42 ` Thierry Reding
2015-11-02 15:27 ` [PATCH v2 1/2] drm/panel: Add Sharp LS043T1LE01 panel binding documentation Rob Herring
2015-11-23 11:42 ` Thierry Reding
2 siblings, 2 replies; 6+ messages in thread
From: Bjorn Andersson @ 2015-10-30 22:34 UTC (permalink / raw)
To: Thierry Reding, David Airlie
Cc: linux-kernel, dri-devel, linux-arm-msm, Werner Johansson
From: Werner Johansson <werner.johansson@sonymobile.com>
This adds support for the Sharp panel found on the Qualcomm
Snapdragon 800 Dragonboard (APQ8074)
Signed-off-by: Werner Johansson <werner.johansson@sonymobile.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
---
Change since v1:
- Dropped -vid suffix from compatible
drivers/gpu/drm/panel/Kconfig | 9 +
drivers/gpu/drm/panel/Makefile | 1 +
drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c | 387 ++++++++++++++++++++++++
3 files changed, 397 insertions(+)
create mode 100644 drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c
diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
index 7d4704b1292b..da3b9c7889c4 100644
--- a/drivers/gpu/drm/panel/Kconfig
+++ b/drivers/gpu/drm/panel/Kconfig
@@ -51,4 +51,13 @@ config DRM_PANEL_SHARP_LQ101R1SX01
To compile this driver as a module, choose M here: the module
will be called panel-sharp-lq101r1sx01.
+config DRM_PANEL_SHARP_LS043T1LE01
+ tristate "Sharp LS043T1LE01 qHD video mode panel"
+ depends on OF
+ depends on DRM_MIPI_DSI
+ depends on BACKLIGHT_CLASS_DEVICE
+ help
+ Say Y here if you want to enable support for Sharp LS043T1LE01 qHD
+ (540x960) DSI panel as found on the Qualcomm APQ8074 Dragonboard
+
endmenu
diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
index d0f016dd7ddb..53de90aa49cd 100644
--- a/drivers/gpu/drm/panel/Makefile
+++ b/drivers/gpu/drm/panel/Makefile
@@ -3,3 +3,4 @@ obj-$(CONFIG_DRM_PANEL_LG_LG4573) += panel-lg-lg4573.o
obj-$(CONFIG_DRM_PANEL_SAMSUNG_LD9040) += panel-samsung-ld9040.o
obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E8AA0) += panel-samsung-s6e8aa0.o
obj-$(CONFIG_DRM_PANEL_SHARP_LQ101R1SX01) += panel-sharp-lq101r1sx01.o
+obj-$(CONFIG_DRM_PANEL_SHARP_LS043T1LE01) += panel-sharp-ls043t1le01.o
diff --git a/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c b/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c
new file mode 100644
index 000000000000..3aeb0bda4947
--- /dev/null
+++ b/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c
@@ -0,0 +1,387 @@
+/*
+ * Copyright (C) 2015 Red Hat
+ * Copyright (C) 2015 Sony Mobile Communications Inc.
+ * Author: Werner Johansson <werner.johansson@sonymobile.com>
+ *
+ * Based on AUO panel driver by Rob Clark <robdclark@gmail.com>
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <linux/backlight.h>
+#include <linux/gpio/consumer.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/regulator/consumer.h>
+
+#include <drm/drmP.h>
+#include <drm/drm_crtc.h>
+#include <drm/drm_mipi_dsi.h>
+#include <drm/drm_panel.h>
+
+#include <video/mipi_display.h>
+
+struct sharp_nt_panel {
+ struct drm_panel base;
+ struct mipi_dsi_device *dsi;
+
+ struct backlight_device *backlight;
+ struct regulator *supply;
+ struct gpio_desc *reset_gpio;
+
+ bool prepared;
+ bool enabled;
+
+ const struct drm_display_mode *mode;
+};
+
+static inline struct sharp_nt_panel *to_sharp_nt_panel(struct drm_panel *panel)
+{
+ return container_of(panel, struct sharp_nt_panel, base);
+}
+
+static int sharp_nt_panel_init(struct sharp_nt_panel *sharp_nt)
+{
+ struct mipi_dsi_device *dsi = sharp_nt->dsi;
+ int ret;
+
+ dsi->mode_flags |= MIPI_DSI_MODE_LPM;
+
+ ret = mipi_dsi_dcs_exit_sleep_mode(dsi);
+ if (ret < 0)
+ return ret;
+
+ msleep(120);
+
+ /* Novatek two-lane operation */
+ ret = mipi_dsi_dcs_write(dsi, 0xae, (u8[]){ 0x03 }, 1);
+ if (ret < 0)
+ return ret;
+
+ /* Set both MCU and RGB I/F to 24bpp */
+ ret = mipi_dsi_dcs_set_pixel_format(dsi, MIPI_DCS_PIXEL_FMT_24BIT |
+ (MIPI_DCS_PIXEL_FMT_24BIT << 4));
+ if (ret < 0)
+ return ret;
+
+ return 0;
+}
+
+static int sharp_nt_panel_on(struct sharp_nt_panel *sharp_nt)
+{
+ struct mipi_dsi_device *dsi = sharp_nt->dsi;
+ int ret;
+
+ dsi->mode_flags |= MIPI_DSI_MODE_LPM;
+
+ ret = mipi_dsi_dcs_set_display_on(dsi);
+ if (ret < 0)
+ return ret;
+
+ return 0;
+}
+
+static int sharp_nt_panel_off(struct sharp_nt_panel *sharp_nt)
+{
+ struct mipi_dsi_device *dsi = sharp_nt->dsi;
+ int ret;
+
+ dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
+
+ ret = mipi_dsi_dcs_set_display_off(dsi);
+ if (ret < 0)
+ return ret;
+
+ ret = mipi_dsi_dcs_enter_sleep_mode(dsi);
+ if (ret < 0)
+ return ret;
+
+ return 0;
+}
+
+
+static int sharp_nt_panel_disable(struct drm_panel *panel)
+{
+ struct sharp_nt_panel *sharp_nt = to_sharp_nt_panel(panel);
+
+ if (!sharp_nt->enabled)
+ return 0;
+
+ if (sharp_nt->backlight) {
+ sharp_nt->backlight->props.power = FB_BLANK_POWERDOWN;
+ backlight_update_status(sharp_nt->backlight);
+ }
+
+ sharp_nt->enabled = false;
+
+ return 0;
+}
+
+static int sharp_nt_panel_unprepare(struct drm_panel *panel)
+{
+ struct sharp_nt_panel *sharp_nt = to_sharp_nt_panel(panel);
+ int ret;
+
+ if (!sharp_nt->prepared)
+ return 0;
+
+ ret = sharp_nt_panel_off(sharp_nt);
+ if (ret < 0) {
+ dev_err(panel->dev, "failed to set panel off: %d\n", ret);
+ return ret;
+ }
+
+ regulator_disable(sharp_nt->supply);
+ if (sharp_nt->reset_gpio)
+ gpiod_set_value(sharp_nt->reset_gpio, 0);
+
+ sharp_nt->prepared = false;
+
+ return 0;
+}
+
+static int sharp_nt_panel_prepare(struct drm_panel *panel)
+{
+ struct sharp_nt_panel *sharp_nt = to_sharp_nt_panel(panel);
+ int ret;
+
+ if (sharp_nt->prepared)
+ return 0;
+
+ ret = regulator_enable(sharp_nt->supply);
+ if (ret < 0)
+ return ret;
+
+ msleep(20);
+
+ if (sharp_nt->reset_gpio) {
+ gpiod_set_value(sharp_nt->reset_gpio, 1);
+ msleep(1);
+ gpiod_set_value(sharp_nt->reset_gpio, 0);
+ msleep(1);
+ gpiod_set_value(sharp_nt->reset_gpio, 1);
+ msleep(10);
+ }
+
+ ret = sharp_nt_panel_init(sharp_nt);
+ if (ret < 0) {
+ dev_err(panel->dev, "failed to init panel: %d\n", ret);
+ goto poweroff;
+ }
+
+ ret = sharp_nt_panel_on(sharp_nt);
+ if (ret < 0) {
+ dev_err(panel->dev, "failed to set panel on: %d\n", ret);
+ goto poweroff;
+ }
+
+ sharp_nt->prepared = true;
+
+ return 0;
+
+poweroff:
+ regulator_disable(sharp_nt->supply);
+ if (sharp_nt->reset_gpio)
+ gpiod_set_value(sharp_nt->reset_gpio, 0);
+ return ret;
+}
+
+static int sharp_nt_panel_enable(struct drm_panel *panel)
+{
+ struct sharp_nt_panel *sharp_nt = to_sharp_nt_panel(panel);
+
+ if (sharp_nt->enabled)
+ return 0;
+
+ if (sharp_nt->backlight) {
+ sharp_nt->backlight->props.power = FB_BLANK_UNBLANK;
+ backlight_update_status(sharp_nt->backlight);
+ }
+
+ sharp_nt->enabled = true;
+
+ return 0;
+}
+
+static const struct drm_display_mode default_mode = {
+ .clock = 41118,
+ .hdisplay = 540,
+ .hsync_start = 540 + 48,
+ .hsync_end = 540 + 48 + 80,
+ .htotal = 540 + 48 + 80 + 32,
+ .vdisplay = 960,
+ .vsync_start = 960 + 3,
+ .vsync_end = 960 + 3 + 15,
+ .vtotal = 960 + 3 + 15 + 1,
+ .vrefresh = 60,
+};
+
+static int sharp_nt_panel_get_modes(struct drm_panel *panel)
+{
+ struct drm_display_mode *mode;
+
+ mode = drm_mode_duplicate(panel->drm, &default_mode);
+ if (!mode) {
+ dev_err(panel->drm->dev, "failed to add mode %ux%ux@%u\n",
+ default_mode.hdisplay, default_mode.vdisplay,
+ default_mode.vrefresh);
+ return -ENOMEM;
+ }
+
+ drm_mode_set_name(mode);
+
+ drm_mode_probed_add(panel->connector, mode);
+
+ panel->connector->display_info.width_mm = 54;
+ panel->connector->display_info.height_mm = 95;
+
+ return 1;
+}
+
+static const struct drm_panel_funcs sharp_nt_panel_funcs = {
+ .disable = sharp_nt_panel_disable,
+ .unprepare = sharp_nt_panel_unprepare,
+ .prepare = sharp_nt_panel_prepare,
+ .enable = sharp_nt_panel_enable,
+ .get_modes = sharp_nt_panel_get_modes,
+};
+
+static int sharp_nt_panel_add(struct sharp_nt_panel *sharp_nt)
+{
+ struct device *dev = &sharp_nt->dsi->dev;
+ struct device_node *np;
+ int ret;
+
+ sharp_nt->mode = &default_mode;
+
+ sharp_nt->supply = devm_regulator_get(dev, "avdd");
+ if (IS_ERR(sharp_nt->supply))
+ return PTR_ERR(sharp_nt->supply);
+
+ sharp_nt->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW);
+ if (IS_ERR(sharp_nt->reset_gpio)) {
+ dev_err(dev, "cannot get reset-gpios %ld\n",
+ PTR_ERR(sharp_nt->reset_gpio));
+ sharp_nt->reset_gpio = NULL;
+ } else {
+ gpiod_set_value(sharp_nt->reset_gpio, 0);
+ }
+
+ np = of_parse_phandle(dev->of_node, "backlight", 0);
+ if (np) {
+ sharp_nt->backlight = of_find_backlight_by_node(np);
+ of_node_put(np);
+
+ if (!sharp_nt->backlight)
+ return -EPROBE_DEFER;
+ }
+
+ drm_panel_init(&sharp_nt->base);
+ sharp_nt->base.funcs = &sharp_nt_panel_funcs;
+ sharp_nt->base.dev = &sharp_nt->dsi->dev;
+
+ ret = drm_panel_add(&sharp_nt->base);
+ if (ret < 0)
+ goto put_backlight;
+
+ return 0;
+
+put_backlight:
+ if (sharp_nt->backlight)
+ put_device(&sharp_nt->backlight->dev);
+
+ return ret;
+}
+
+static void sharp_nt_panel_del(struct sharp_nt_panel *sharp_nt)
+{
+ if (sharp_nt->base.dev)
+ drm_panel_remove(&sharp_nt->base);
+
+ if (sharp_nt->backlight)
+ put_device(&sharp_nt->backlight->dev);
+}
+
+static int sharp_nt_panel_probe(struct mipi_dsi_device *dsi)
+{
+ struct sharp_nt_panel *sharp_nt;
+ int ret;
+
+ dsi->lanes = 2;
+ dsi->format = MIPI_DSI_FMT_RGB888;
+ dsi->mode_flags = MIPI_DSI_MODE_VIDEO |
+ MIPI_DSI_MODE_VIDEO_HSE |
+ MIPI_DSI_CLOCK_NON_CONTINUOUS |
+ MIPI_DSI_MODE_EOT_PACKET;
+
+ sharp_nt = devm_kzalloc(&dsi->dev, sizeof(*sharp_nt), GFP_KERNEL);
+ if (!sharp_nt)
+ return -ENOMEM;
+
+ mipi_dsi_set_drvdata(dsi, sharp_nt);
+
+ sharp_nt->dsi = dsi;
+
+ ret = sharp_nt_panel_add(sharp_nt);
+ if (ret < 0)
+ return ret;
+
+ return mipi_dsi_attach(dsi);
+}
+
+static int sharp_nt_panel_remove(struct mipi_dsi_device *dsi)
+{
+ struct sharp_nt_panel *sharp_nt = mipi_dsi_get_drvdata(dsi);
+ int ret;
+
+ ret = sharp_nt_panel_disable(&sharp_nt->base);
+ if (ret < 0)
+ dev_err(&dsi->dev, "failed to disable panel: %d\n", ret);
+
+ ret = mipi_dsi_detach(dsi);
+ if (ret < 0)
+ dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", ret);
+
+ drm_panel_detach(&sharp_nt->base);
+ sharp_nt_panel_del(sharp_nt);
+
+ return 0;
+}
+
+static void sharp_nt_panel_shutdown(struct mipi_dsi_device *dsi)
+{
+ struct sharp_nt_panel *sharp_nt = mipi_dsi_get_drvdata(dsi);
+
+ sharp_nt_panel_disable(&sharp_nt->base);
+}
+
+static const struct of_device_id sharp_nt_of_match[] = {
+ { .compatible = "sharp,ls043t1le01-qhd", },
+ { }
+};
+MODULE_DEVICE_TABLE(of, sharp_nt_of_match);
+
+static struct mipi_dsi_driver sharp_nt_panel_driver = {
+ .driver = {
+ .name = "panel-sharp-ls043t1le01-qhd",
+ .of_match_table = sharp_nt_of_match,
+ },
+ .probe = sharp_nt_panel_probe,
+ .remove = sharp_nt_panel_remove,
+ .shutdown = sharp_nt_panel_shutdown,
+};
+module_mipi_dsi_driver(sharp_nt_panel_driver);
+
+MODULE_AUTHOR("Werner Johansson <werner.johansson@sonymobile.com>");
+MODULE_DESCRIPTION("Sharp LS043T1LE01 NT35565-based qHD (540x960) video mode panel driver");
+MODULE_LICENSE("GPL v2");
--
2.4.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/2] drm/panel: Add Sharp LS043T1LE01 panel binding documentation
2015-10-30 22:34 [PATCH v2 1/2] drm/panel: Add Sharp LS043T1LE01 panel binding documentation Bjorn Andersson
2015-10-30 22:34 ` [PATCH v2 2/2] drm/panel: Add Sharp LS043T1LE01 MIPI DSI panel Bjorn Andersson
@ 2015-11-02 15:27 ` Rob Herring
2015-11-23 11:42 ` Thierry Reding
2 siblings, 0 replies; 6+ messages in thread
From: Rob Herring @ 2015-11-02 15:27 UTC (permalink / raw)
To: Bjorn Andersson
Cc: Mark Rutland, devicetree@vger.kernel.org, Pawel Moll,
Ian Campbell, linux-arm-msm, linux-kernel@vger.kernel.org,
dri-devel, Kumar Gala
On Fri, Oct 30, 2015 at 5:34 PM, Bjorn Andersson
<bjorn.andersson@sonymobile.com> wrote:
> From: Werner Johansson <werner.johansson@sonymobile.com>
>
> Signed-off-by: Werner Johansson <werner.johansson@sonymobile.com>
> Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
Acked-by: Rob Herring <robh@kernel.org>
> ---
>
> Change since v1:
> - Dropped -vid suffix from compatible
>
> .../bindings/display/panel/sharp,ls043t1le01.txt | 22 ++++++++++++++++++++++
> 1 file changed, 22 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/display/panel/sharp,ls043t1le01.txt
>
> diff --git a/Documentation/devicetree/bindings/display/panel/sharp,ls043t1le01.txt b/Documentation/devicetree/bindings/display/panel/sharp,ls043t1le01.txt
> new file mode 100644
> index 000000000000..b3d4e073930a
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/display/panel/sharp,ls043t1le01.txt
> @@ -0,0 +1,22 @@
> +Sharp Microelectronics 4.3" qHD TFT LCD panel
> +
> +Required properties:
> +- compatible: should be "sharp,ls043t1le01-qhd"
> +- reg: DSI virtual channel of the peripheral
> +- power-supply: phandle of the regulator that provides the supply voltage
> +
> +Optional properties:
> +- backlight: phandle of the backlight device attached to the panel
> +- reset-gpios: a GPIO spec for the reset pin
> +
> +Example:
> +
> + mdss_dsi@fd922800 {
> + panel@0 {
> + compatible = "sharp,ls043t1le01-qhd";
> + reg = <0>;
> + avdd-supply = <&pm8941_l22>;
> + backlight = <&pm8941_wled>;
> + reset-gpios = <&pm8941_gpios 19 GPIO_ACTIVE_HIGH>;
> + };
> + };
> --
> 2.4.2
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 2/2] drm/panel: Add Sharp LS043T1LE01 MIPI DSI panel
2015-10-30 22:34 ` [PATCH v2 2/2] drm/panel: Add Sharp LS043T1LE01 MIPI DSI panel Bjorn Andersson
@ 2015-11-05 5:41 ` Archit Taneja
2015-11-23 11:42 ` Thierry Reding
1 sibling, 0 replies; 6+ messages in thread
From: Archit Taneja @ 2015-11-05 5:41 UTC (permalink / raw)
To: Bjorn Andersson, Thierry Reding, David Airlie
Cc: linux-arm-msm, linux-kernel, dri-devel
On 10/31/2015 04:04 AM, Bjorn Andersson wrote:
> From: Werner Johansson <werner.johansson@sonymobile.com>
>
> This adds support for the Sharp panel found on the Qualcomm
> Snapdragon 800 Dragonboard (APQ8074)
>
> Signed-off-by: Werner Johansson <werner.johansson@sonymobile.com>
> Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
Reviewed-by: Archit Taneja <architt@codeaurora.org>
> ---
>
> Change since v1:
> - Dropped -vid suffix from compatible
>
> drivers/gpu/drm/panel/Kconfig | 9 +
> drivers/gpu/drm/panel/Makefile | 1 +
> drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c | 387 ++++++++++++++++++++++++
> 3 files changed, 397 insertions(+)
> create mode 100644 drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c
>
> diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
> index 7d4704b1292b..da3b9c7889c4 100644
> --- a/drivers/gpu/drm/panel/Kconfig
> +++ b/drivers/gpu/drm/panel/Kconfig
> @@ -51,4 +51,13 @@ config DRM_PANEL_SHARP_LQ101R1SX01
> To compile this driver as a module, choose M here: the module
> will be called panel-sharp-lq101r1sx01.
>
> +config DRM_PANEL_SHARP_LS043T1LE01
> + tristate "Sharp LS043T1LE01 qHD video mode panel"
> + depends on OF
> + depends on DRM_MIPI_DSI
> + depends on BACKLIGHT_CLASS_DEVICE
> + help
> + Say Y here if you want to enable support for Sharp LS043T1LE01 qHD
> + (540x960) DSI panel as found on the Qualcomm APQ8074 Dragonboard
> +
> endmenu
> diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
> index d0f016dd7ddb..53de90aa49cd 100644
> --- a/drivers/gpu/drm/panel/Makefile
> +++ b/drivers/gpu/drm/panel/Makefile
> @@ -3,3 +3,4 @@ obj-$(CONFIG_DRM_PANEL_LG_LG4573) += panel-lg-lg4573.o
> obj-$(CONFIG_DRM_PANEL_SAMSUNG_LD9040) += panel-samsung-ld9040.o
> obj-$(CONFIG_DRM_PANEL_SAMSUNG_S6E8AA0) += panel-samsung-s6e8aa0.o
> obj-$(CONFIG_DRM_PANEL_SHARP_LQ101R1SX01) += panel-sharp-lq101r1sx01.o
> +obj-$(CONFIG_DRM_PANEL_SHARP_LS043T1LE01) += panel-sharp-ls043t1le01.o
> diff --git a/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c b/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c
> new file mode 100644
> index 000000000000..3aeb0bda4947
> --- /dev/null
> +++ b/drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c
> @@ -0,0 +1,387 @@
> +/*
> + * Copyright (C) 2015 Red Hat
> + * Copyright (C) 2015 Sony Mobile Communications Inc.
> + * Author: Werner Johansson <werner.johansson@sonymobile.com>
> + *
> + * Based on AUO panel driver by Rob Clark <robdclark@gmail.com>
> + *
> + * 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.
> + *
> + * This program is distributed in the hope that it will be useful, but WITHOUT
> + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
> + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
> + * more details.
> + *
> + * You should have received a copy of the GNU General Public License along with
> + * this program. If not, see <http://www.gnu.org/licenses/>.
> + */
> +
> +#include <linux/backlight.h>
> +#include <linux/gpio/consumer.h>
> +#include <linux/module.h>
> +#include <linux/of.h>
> +#include <linux/regulator/consumer.h>
> +
> +#include <drm/drmP.h>
> +#include <drm/drm_crtc.h>
> +#include <drm/drm_mipi_dsi.h>
> +#include <drm/drm_panel.h>
> +
> +#include <video/mipi_display.h>
> +
> +struct sharp_nt_panel {
> + struct drm_panel base;
> + struct mipi_dsi_device *dsi;
> +
> + struct backlight_device *backlight;
> + struct regulator *supply;
> + struct gpio_desc *reset_gpio;
> +
> + bool prepared;
> + bool enabled;
> +
> + const struct drm_display_mode *mode;
> +};
> +
> +static inline struct sharp_nt_panel *to_sharp_nt_panel(struct drm_panel *panel)
> +{
> + return container_of(panel, struct sharp_nt_panel, base);
> +}
> +
> +static int sharp_nt_panel_init(struct sharp_nt_panel *sharp_nt)
> +{
> + struct mipi_dsi_device *dsi = sharp_nt->dsi;
> + int ret;
> +
> + dsi->mode_flags |= MIPI_DSI_MODE_LPM;
> +
> + ret = mipi_dsi_dcs_exit_sleep_mode(dsi);
> + if (ret < 0)
> + return ret;
> +
> + msleep(120);
> +
> + /* Novatek two-lane operation */
> + ret = mipi_dsi_dcs_write(dsi, 0xae, (u8[]){ 0x03 }, 1);
> + if (ret < 0)
> + return ret;
> +
> + /* Set both MCU and RGB I/F to 24bpp */
> + ret = mipi_dsi_dcs_set_pixel_format(dsi, MIPI_DCS_PIXEL_FMT_24BIT |
> + (MIPI_DCS_PIXEL_FMT_24BIT << 4));
> + if (ret < 0)
> + return ret;
> +
> + return 0;
> +}
> +
> +static int sharp_nt_panel_on(struct sharp_nt_panel *sharp_nt)
> +{
> + struct mipi_dsi_device *dsi = sharp_nt->dsi;
> + int ret;
> +
> + dsi->mode_flags |= MIPI_DSI_MODE_LPM;
> +
> + ret = mipi_dsi_dcs_set_display_on(dsi);
> + if (ret < 0)
> + return ret;
> +
> + return 0;
> +}
> +
> +static int sharp_nt_panel_off(struct sharp_nt_panel *sharp_nt)
> +{
> + struct mipi_dsi_device *dsi = sharp_nt->dsi;
> + int ret;
> +
> + dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
> +
> + ret = mipi_dsi_dcs_set_display_off(dsi);
> + if (ret < 0)
> + return ret;
> +
> + ret = mipi_dsi_dcs_enter_sleep_mode(dsi);
> + if (ret < 0)
> + return ret;
> +
> + return 0;
> +}
> +
> +
> +static int sharp_nt_panel_disable(struct drm_panel *panel)
> +{
> + struct sharp_nt_panel *sharp_nt = to_sharp_nt_panel(panel);
> +
> + if (!sharp_nt->enabled)
> + return 0;
> +
> + if (sharp_nt->backlight) {
> + sharp_nt->backlight->props.power = FB_BLANK_POWERDOWN;
> + backlight_update_status(sharp_nt->backlight);
> + }
> +
> + sharp_nt->enabled = false;
> +
> + return 0;
> +}
> +
> +static int sharp_nt_panel_unprepare(struct drm_panel *panel)
> +{
> + struct sharp_nt_panel *sharp_nt = to_sharp_nt_panel(panel);
> + int ret;
> +
> + if (!sharp_nt->prepared)
> + return 0;
> +
> + ret = sharp_nt_panel_off(sharp_nt);
> + if (ret < 0) {
> + dev_err(panel->dev, "failed to set panel off: %d\n", ret);
> + return ret;
> + }
> +
> + regulator_disable(sharp_nt->supply);
> + if (sharp_nt->reset_gpio)
> + gpiod_set_value(sharp_nt->reset_gpio, 0);
> +
> + sharp_nt->prepared = false;
> +
> + return 0;
> +}
> +
> +static int sharp_nt_panel_prepare(struct drm_panel *panel)
> +{
> + struct sharp_nt_panel *sharp_nt = to_sharp_nt_panel(panel);
> + int ret;
> +
> + if (sharp_nt->prepared)
> + return 0;
> +
> + ret = regulator_enable(sharp_nt->supply);
> + if (ret < 0)
> + return ret;
> +
> + msleep(20);
> +
> + if (sharp_nt->reset_gpio) {
> + gpiod_set_value(sharp_nt->reset_gpio, 1);
> + msleep(1);
> + gpiod_set_value(sharp_nt->reset_gpio, 0);
> + msleep(1);
> + gpiod_set_value(sharp_nt->reset_gpio, 1);
> + msleep(10);
> + }
> +
> + ret = sharp_nt_panel_init(sharp_nt);
> + if (ret < 0) {
> + dev_err(panel->dev, "failed to init panel: %d\n", ret);
> + goto poweroff;
> + }
> +
> + ret = sharp_nt_panel_on(sharp_nt);
> + if (ret < 0) {
> + dev_err(panel->dev, "failed to set panel on: %d\n", ret);
> + goto poweroff;
> + }
> +
> + sharp_nt->prepared = true;
> +
> + return 0;
> +
> +poweroff:
> + regulator_disable(sharp_nt->supply);
> + if (sharp_nt->reset_gpio)
> + gpiod_set_value(sharp_nt->reset_gpio, 0);
> + return ret;
> +}
> +
> +static int sharp_nt_panel_enable(struct drm_panel *panel)
> +{
> + struct sharp_nt_panel *sharp_nt = to_sharp_nt_panel(panel);
> +
> + if (sharp_nt->enabled)
> + return 0;
> +
> + if (sharp_nt->backlight) {
> + sharp_nt->backlight->props.power = FB_BLANK_UNBLANK;
> + backlight_update_status(sharp_nt->backlight);
> + }
> +
> + sharp_nt->enabled = true;
> +
> + return 0;
> +}
> +
> +static const struct drm_display_mode default_mode = {
> + .clock = 41118,
> + .hdisplay = 540,
> + .hsync_start = 540 + 48,
> + .hsync_end = 540 + 48 + 80,
> + .htotal = 540 + 48 + 80 + 32,
> + .vdisplay = 960,
> + .vsync_start = 960 + 3,
> + .vsync_end = 960 + 3 + 15,
> + .vtotal = 960 + 3 + 15 + 1,
> + .vrefresh = 60,
> +};
> +
> +static int sharp_nt_panel_get_modes(struct drm_panel *panel)
> +{
> + struct drm_display_mode *mode;
> +
> + mode = drm_mode_duplicate(panel->drm, &default_mode);
> + if (!mode) {
> + dev_err(panel->drm->dev, "failed to add mode %ux%ux@%u\n",
> + default_mode.hdisplay, default_mode.vdisplay,
> + default_mode.vrefresh);
> + return -ENOMEM;
> + }
> +
> + drm_mode_set_name(mode);
> +
> + drm_mode_probed_add(panel->connector, mode);
> +
> + panel->connector->display_info.width_mm = 54;
> + panel->connector->display_info.height_mm = 95;
> +
> + return 1;
> +}
> +
> +static const struct drm_panel_funcs sharp_nt_panel_funcs = {
> + .disable = sharp_nt_panel_disable,
> + .unprepare = sharp_nt_panel_unprepare,
> + .prepare = sharp_nt_panel_prepare,
> + .enable = sharp_nt_panel_enable,
> + .get_modes = sharp_nt_panel_get_modes,
> +};
> +
> +static int sharp_nt_panel_add(struct sharp_nt_panel *sharp_nt)
> +{
> + struct device *dev = &sharp_nt->dsi->dev;
> + struct device_node *np;
> + int ret;
> +
> + sharp_nt->mode = &default_mode;
> +
> + sharp_nt->supply = devm_regulator_get(dev, "avdd");
> + if (IS_ERR(sharp_nt->supply))
> + return PTR_ERR(sharp_nt->supply);
> +
> + sharp_nt->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW);
> + if (IS_ERR(sharp_nt->reset_gpio)) {
> + dev_err(dev, "cannot get reset-gpios %ld\n",
> + PTR_ERR(sharp_nt->reset_gpio));
> + sharp_nt->reset_gpio = NULL;
> + } else {
> + gpiod_set_value(sharp_nt->reset_gpio, 0);
> + }
> +
> + np = of_parse_phandle(dev->of_node, "backlight", 0);
> + if (np) {
> + sharp_nt->backlight = of_find_backlight_by_node(np);
> + of_node_put(np);
> +
> + if (!sharp_nt->backlight)
> + return -EPROBE_DEFER;
> + }
> +
> + drm_panel_init(&sharp_nt->base);
> + sharp_nt->base.funcs = &sharp_nt_panel_funcs;
> + sharp_nt->base.dev = &sharp_nt->dsi->dev;
> +
> + ret = drm_panel_add(&sharp_nt->base);
> + if (ret < 0)
> + goto put_backlight;
> +
> + return 0;
> +
> +put_backlight:
> + if (sharp_nt->backlight)
> + put_device(&sharp_nt->backlight->dev);
> +
> + return ret;
> +}
> +
> +static void sharp_nt_panel_del(struct sharp_nt_panel *sharp_nt)
> +{
> + if (sharp_nt->base.dev)
> + drm_panel_remove(&sharp_nt->base);
> +
> + if (sharp_nt->backlight)
> + put_device(&sharp_nt->backlight->dev);
> +}
> +
> +static int sharp_nt_panel_probe(struct mipi_dsi_device *dsi)
> +{
> + struct sharp_nt_panel *sharp_nt;
> + int ret;
> +
> + dsi->lanes = 2;
> + dsi->format = MIPI_DSI_FMT_RGB888;
> + dsi->mode_flags = MIPI_DSI_MODE_VIDEO |
> + MIPI_DSI_MODE_VIDEO_HSE |
> + MIPI_DSI_CLOCK_NON_CONTINUOUS |
> + MIPI_DSI_MODE_EOT_PACKET;
> +
> + sharp_nt = devm_kzalloc(&dsi->dev, sizeof(*sharp_nt), GFP_KERNEL);
> + if (!sharp_nt)
> + return -ENOMEM;
> +
> + mipi_dsi_set_drvdata(dsi, sharp_nt);
> +
> + sharp_nt->dsi = dsi;
> +
> + ret = sharp_nt_panel_add(sharp_nt);
> + if (ret < 0)
> + return ret;
> +
> + return mipi_dsi_attach(dsi);
> +}
> +
> +static int sharp_nt_panel_remove(struct mipi_dsi_device *dsi)
> +{
> + struct sharp_nt_panel *sharp_nt = mipi_dsi_get_drvdata(dsi);
> + int ret;
> +
> + ret = sharp_nt_panel_disable(&sharp_nt->base);
> + if (ret < 0)
> + dev_err(&dsi->dev, "failed to disable panel: %d\n", ret);
> +
> + ret = mipi_dsi_detach(dsi);
> + if (ret < 0)
> + dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", ret);
> +
> + drm_panel_detach(&sharp_nt->base);
> + sharp_nt_panel_del(sharp_nt);
> +
> + return 0;
> +}
> +
> +static void sharp_nt_panel_shutdown(struct mipi_dsi_device *dsi)
> +{
> + struct sharp_nt_panel *sharp_nt = mipi_dsi_get_drvdata(dsi);
> +
> + sharp_nt_panel_disable(&sharp_nt->base);
> +}
> +
> +static const struct of_device_id sharp_nt_of_match[] = {
> + { .compatible = "sharp,ls043t1le01-qhd", },
> + { }
> +};
> +MODULE_DEVICE_TABLE(of, sharp_nt_of_match);
> +
> +static struct mipi_dsi_driver sharp_nt_panel_driver = {
> + .driver = {
> + .name = "panel-sharp-ls043t1le01-qhd",
> + .of_match_table = sharp_nt_of_match,
> + },
> + .probe = sharp_nt_panel_probe,
> + .remove = sharp_nt_panel_remove,
> + .shutdown = sharp_nt_panel_shutdown,
> +};
> +module_mipi_dsi_driver(sharp_nt_panel_driver);
> +
> +MODULE_AUTHOR("Werner Johansson <werner.johansson@sonymobile.com>");
> +MODULE_DESCRIPTION("Sharp LS043T1LE01 NT35565-based qHD (540x960) video mode panel driver");
> +MODULE_LICENSE("GPL v2");
>
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora
Forum, hosted by The Linux Foundation
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/2] drm/panel: Add Sharp LS043T1LE01 panel binding documentation
2015-10-30 22:34 [PATCH v2 1/2] drm/panel: Add Sharp LS043T1LE01 panel binding documentation Bjorn Andersson
2015-10-30 22:34 ` [PATCH v2 2/2] drm/panel: Add Sharp LS043T1LE01 MIPI DSI panel Bjorn Andersson
2015-11-02 15:27 ` [PATCH v2 1/2] drm/panel: Add Sharp LS043T1LE01 panel binding documentation Rob Herring
@ 2015-11-23 11:42 ` Thierry Reding
2 siblings, 0 replies; 6+ messages in thread
From: Thierry Reding @ 2015-11-23 11:42 UTC (permalink / raw)
To: Bjorn Andersson
Cc: Mark Rutland, devicetree, Pawel Moll, Ian Campbell, linux-arm-msm,
linux-kernel, dri-devel, Rob Herring, Kumar Gala
[-- Attachment #1.1: Type: text/plain, Size: 586 bytes --]
On Fri, Oct 30, 2015 at 03:34:29PM -0700, Bjorn Andersson wrote:
> From: Werner Johansson <werner.johansson@sonymobile.com>
>
> Signed-off-by: Werner Johansson <werner.johansson@sonymobile.com>
> Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
> ---
>
> Change since v1:
> - Dropped -vid suffix from compatible
>
> .../bindings/display/panel/sharp,ls043t1le01.txt | 22 ++++++++++++++++++++++
> 1 file changed, 22 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/display/panel/sharp,ls043t1le01.txt
Applied, thanks.
Thierry
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
[-- Attachment #2: Type: text/plain, Size: 159 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 2/2] drm/panel: Add Sharp LS043T1LE01 MIPI DSI panel
2015-10-30 22:34 ` [PATCH v2 2/2] drm/panel: Add Sharp LS043T1LE01 MIPI DSI panel Bjorn Andersson
2015-11-05 5:41 ` Archit Taneja
@ 2015-11-23 11:42 ` Thierry Reding
1 sibling, 0 replies; 6+ messages in thread
From: Thierry Reding @ 2015-11-23 11:42 UTC (permalink / raw)
To: Bjorn Andersson
Cc: David Airlie, linux-kernel, dri-devel, linux-arm-msm,
Werner Johansson
[-- Attachment #1: Type: text/plain, Size: 476 bytes --]
On Fri, Oct 30, 2015 at 03:34:30PM -0700, Bjorn Andersson wrote:
> From: Werner Johansson <werner.johansson@sonymobile.com>
>
> This adds support for the Sharp panel found on the Qualcomm
> Snapdragon 800 Dragonboard (APQ8074)
>
> Signed-off-by: Werner Johansson <werner.johansson@sonymobile.com>
> Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
> ---
>
> Change since v1:
> - Dropped -vid suffix from compatible
Applied, thanks.
Thierry
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-11-23 11:42 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-30 22:34 [PATCH v2 1/2] drm/panel: Add Sharp LS043T1LE01 panel binding documentation Bjorn Andersson
2015-10-30 22:34 ` [PATCH v2 2/2] drm/panel: Add Sharp LS043T1LE01 MIPI DSI panel Bjorn Andersson
2015-11-05 5:41 ` Archit Taneja
2015-11-23 11:42 ` Thierry Reding
2015-11-02 15:27 ` [PATCH v2 1/2] drm/panel: Add Sharp LS043T1LE01 panel binding documentation Rob Herring
2015-11-23 11:42 ` Thierry Reding
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).