drm: exynos: few patches to enhance bridge chip support
Subsystems (8)
cover drm: exynos: few patches to enhance bridge chip support
This series is based on exynos-drm-next-todo branch of Inki Dae's tree at:git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos.git
This set of drm patches are needed to support bridge chips and eDP/LVDS panels with exynos_dp.
For testing, I have used exynos5250-snow board along with a few local arch side patches.
This patchset tries to create a simple exynos_dp panel framework to control power up/down sequence of the eDP/eDP-LVDS panel, and the same is used to control the panel power sequence for the LVDS panel on snow.
Andrew Bresticker (1):
[PATCH 1/7] drm/exynos: dp: support hotplug detection via GPIO
Ajay Kumar (5):
[PATCH 2/7] drm/panel: add pre_enable routine to drm panel [PATCH 3/7] drm/panel: Add driver for exynos_dp based panels [PATCH 4/7] drm/exynos: add exynos_dp_panel driver registration to drm driver [PATCH 5/7] drm/exynos: dp: modify driver to support drm_panel [PATCH 7/7] drm/bridge: ptn3460: add drm_panel controls
Rahul Sharma (1):
[PATCH 6/7] drm/bridge: ptn3460: enable polling based detection
.../devicetree/bindings/panel/exynos-dp-panel.txt | 32 ++++ .../devicetree/bindings/video/exynos_dp.txt | 4 + drivers/gpu/drm/bridge/Kconfig | 1 + drivers/gpu/drm/bridge/ptn3460.c | 18 +- drivers/gpu/drm/exynos/Kconfig | 1 + drivers/gpu/drm/exynos/exynos_dp_core.c | 66 ++++++- drivers/gpu/drm/exynos/exynos_dp_core.h | 2 + drivers/gpu/drm/exynos/exynos_dp_reg.c | 26 ++- drivers/gpu/drm/exynos/exynos_drm_drv.c | 11 ++ drivers/gpu/drm/exynos/exynos_drm_drv.h | 1 + drivers/gpu/drm/panel/Kconfig | 9 + drivers/gpu/drm/panel/Makefile | 1 + drivers/gpu/drm/panel/panel-exynos-dp.c | 213 +++++++++++++++++++++ include/drm/bridge/ptn3460.h | 6 +- include/drm/drm_panel.h | 9 + 15 files changed, 387 insertions(+), 13 deletions(-) create mode 100644 Documentation/devicetree/bindings/panel/exynos-dp-panel.txt create mode 100644 drivers/gpu/drm/panel/panel-exynos-dp.c
Signature · 1 line
1.8.1.2
PATCH 1/7 drm/exynos: dp: support hotplug detection via GPIO
From: Andrew Bresticker <[email protected]>
Certain bridge chips use a GPIO to indicate the cable status instead of the I_DP_HPD pin. This adds an optional device-tree property, "samsung,hpd-gpio", to the exynos-dp controller which indicates that the specified GPIO should be used for hotplug detection.
The GPIO is then set up as an edge-triggered interrupt where the rising edge indicates hotplug-in and the falling edge indicates hotplug-out.
--- .../devicetree/bindings/video/exynos_dp.txt | 4 +++ drivers/gpu/drm/exynos/exynos_dp_core.c | 32 ++++++++++++++++++++-- drivers/gpu/drm/exynos/exynos_dp_core.h | 1 + drivers/gpu/drm/exynos/exynos_dp_reg.c | 26 ++++++++++++++++-- 4 files changed, 57 insertions(+), 6 deletions(-)
Documentation/devicetree/bindings/video/exynos_dp.txt +4 -0
@@ -62,6 +62,10 @@ Optional properties for dp-controller: -hsync-active-high: HSYNC polarity configuration. High if defined, Low if not defined + -samsung,hpd-gpio: + Hotplug detect GPIO. + Indicates which GPIO should be used for hotplug + detection Example:
drivers/gpu/drm/exynos/exynos_dp_core.c +29 -3
@@ -18,6 +18,8 @@#include <linux/interrupt.h> #include <linux/delay.h> #include <linux/of.h> +#include <linux/of_gpio.h> +#include <linux/gpio.h> #include <linux/component.h> #include <linux/phy/phy.h> #include <video/of_display_timing.h>
@@ -1226,6 +1228,7 @@ static int exynos_dp_bind(struct device *dev, struct device *master, void *data)struct drm_device *drm_dev = data;struct resource *res;struct exynos_dp_device *dp; +unsigned int irq_flags;int ret =0 ;
@@ -1265,7 +1268,30 @@ static int exynos_dp_bind(struct device *dev, struct device *master, void *data)if (IS_ERR (dp->reg_base))return PTR_ERR (dp->reg_base); - dp->irq =platform_get_irq (pdev,0 ); + dp->hpd_gpio =of_get_named_gpio (dev->of_node,"samsung,hpd-gpio" ,0 ); + +if (gpio_is_valid (dp->hpd_gpio)) { +/* +* Set up the hotplug GPIO from the device tree as an interrupt. +* Simply specifying a different interrupt in the device tree +* doesn't work since we handle hotplug rather differently when +* using a GPIO. We also need the actual GPIO specifier so +* that we can get the current state of the GPIO. +*/ + ret =devm_gpio_request_one (&pdev->dev, dp->hpd_gpio,GPIOF_IN , +"hpd_gpio" ); +if (ret) { +dev_err (&pdev->dev,"failed to get hpd gpio\n" ); +return ret; + } + dp->irq =gpio_to_irq (dp->hpd_gpio); + irq_flags =IRQF_TRIGGER_RISING |IRQF_TRIGGER_FALLING ; + }else { + dp->hpd_gpio = -ENODEV ; + dp->irq =platform_get_irq (pdev,0 ); + irq_flags =0 ; + } +if (dp->irq == -ENXIO ) {dev_err (&pdev->dev,"failed to get irq\n" );return -ENODEV ;
@@ -1277,8 +1303,8 @@ static int exynos_dp_bind(struct device *dev, struct device *master, void *data)exynos_dp_init_dp (dp); - ret =devm_request_irq (&pdev->dev, dp->irq, exynos_dp_irq_handler,0 , -"exynos-dp" , dp); + ret =devm_request_irq (&pdev->dev, dp->irq, exynos_dp_irq_handler, + irq_flags,"exynos-dp" , dp);if (ret) {dev_err (&pdev->dev,"failed to request irq\n" );return ret;
drivers/gpu/drm/exynos/exynos_dp_core.h +1 -0
@@ -159,6 +159,7 @@ struct exynos_dp_device {struct work_struct hotplug_work;struct phy *phy;int dpms_mode; +int hpd_gpio;struct exynos_drm_panel_info panel; };
drivers/gpu/drm/exynos/exynos_dp_reg.c +23 -3
@@ -13,6 +13,7 @@#include <linux/device.h> #include <linux/io.h> #include <linux/delay.h> +#include <linux/gpio.h> #include "exynos_dp_core.h" #include "exynos_dp_reg.h"
@@ -326,6 +327,9 @@ void exynos_dp_clear_hotplug_interrupts(struct exynos_dp_device *dp) {u32 reg; +if (gpio_is_valid (dp->hpd_gpio)) +return ; + reg =HOTPLUG_CHG |HPD_LOST |PLUG ;writel (reg, dp->reg_base +EXYNOS_DP_COMMON_INT_STA_4 );
@@ -337,6 +341,9 @@ void exynos_dp_init_hpd(struct exynos_dp_device *dp) {u32 reg; +if (gpio_is_valid (dp->hpd_gpio)) +return ; +exynos_dp_clear_hotplug_interrupts (dp); reg =readl (dp->reg_base +EXYNOS_DP_SYS_CTL_3 );
@@ -348,6 +355,14 @@ enum dp_irq_type exynos_dp_get_irq_type(struct exynos_dp_device *dp) {u32 reg; +if (gpio_is_valid (dp->hpd_gpio)) { + reg =gpio_get_value (dp->hpd_gpio); +if (reg) +return DP_IRQ_TYPE_HP_CABLE_IN ; +else +return DP_IRQ_TYPE_HP_CABLE_OUT ; + } +/* Parse hotplug interrupt status register */ reg =readl (dp->reg_base +EXYNOS_DP_COMMON_INT_STA_4 );
@@ -402,9 +417,14 @@ int exynos_dp_get_plug_in_status(struct exynos_dp_device *dp) {u32 reg; - reg =readl (dp->reg_base +EXYNOS_DP_SYS_CTL_3 ); -if (reg &HPD_STATUS ) -return 0 ; +if (gpio_is_valid (dp->hpd_gpio)) { +if (gpio_get_value (dp->hpd_gpio)) +return 0 ; + }else { + reg =readl (dp->reg_base +EXYNOS_DP_SYS_CTL_3 ); +if (reg &HPD_STATUS ) +return 0 ; + }return -EINVAL ; }
Signature · 1 line
1.8.1.2
Re: [PATCH 1/7] drm/exynos: dp: support hotplug detection via GPIO
Quoted 20 lines · Ajay Kumar
From: Andrew Bresticker <[email protected]>
Certain bridge chips use a GPIO to indicate the cable status instead of the
I_DP_HPDpin. This adds an optional device-tree property, "samsung,hpd-gpio", to the exynos-dp controller which indicates that the specified GPIO should be used for hotplug detection.
The GPIO is then set up as an edge-triggered interrupt where the rising edge indicates hotplug-in and the falling edge indicates hotplug-out.Signed-off-by Andrew Bresticker <[email protected]>Signed-off-by Rahul Sharma <[email protected]>Signed-off-by Ajay Kumar <[email protected]>--- .../devicetree/bindings/video/exynos_dp.txt | 4 +++ drivers/gpu/drm/exynos/exynos_dp_core.c | 32 ++++++++++++++++++++-- drivers/gpu/drm/exynos/exynos_dp_core.h | 1 + drivers/gpu/drm/exynos/exynos_dp_reg.c | 26 ++++++++++++++++-- 4 files changed, 57 insertions(+), 6 deletions(-)
[.....]
Quoted 32 lines
drivers/gpu/drm/exynos/exynos_dp_reg.c +7
-0@@ -13,6 +13,7 @@#include <linux/device.h> #include <linux/io.h> #include <linux/delay.h> +#include <linux/gpio.h> #include "exynos_dp_core.h" #include "exynos_dp_reg.h" @@ -326,6 +327,9 @@ void exynos_dp_clear_hotplug_interrupts(struct exynos_dp_device *dp) {u32 reg; +if (gpio_is_valid (dp->hpd_gpio)) +return ; + reg =HOTPLUG_CHG |HPD_LOST |PLUG ;writel (reg, dp->reg_base +EXYNOS_DP_COMMON_INT_STA_4 );@@ -337,6 +341,9 @@ void exynos_dp_init_hpd(struct exynos_dp_device *dp) {u32 reg; +if (gpio_is_valid (dp->hpd_gpio)) +return ; +exynos_dp_clear_hotplug_interrupts (dp); reg =readl (dp->reg_base +EXYNOS_DP_SYS_CTL_3 );@@ -348,6 +355,14 @@ enum dp_irq_type exynos_dp_get_irq_type(struct exynos_dp_device *dp) {
drivers/gpu/drm/exynos/exynos_dp_reg.c enum dp_irq_type exynos_dp_get_irq_type(struct exynos_dp_device *dp) · line 365
Quoted 10 lines
drivers/gpu/drm/exynos/exynos_dp_reg.c +8
-0u32 reg; +if (gpio_is_valid (dp->hpd_gpio)) { + reg =gpio_get_value (dp->hpd_gpio); +if (reg) +return DP_IRQ_TYPE_HP_CABLE_IN ; +else +return DP_IRQ_TYPE_HP_CABLE_OUT ; + } +
Please keep the style. It enhances the readability.
if (gpio_is_valid(dp->hpd_gpio)) {
...
} else {
...
}Then, it can be as bellows.
+ if (gpio_is_valid(dp->hpd_gpio)) {
+ reg = gpio_get_value(dp->hpd_gpio);
+ if (reg)
+ return DP_IRQ_TYPE_HP_CABLE_IN;
+ else
+ return DP_IRQ_TYPE_HP_CABLE_OUT;
+ } else {
+ /* Parse hotplug interrupt status register */
+ reg = readl(dp->reg_base + EXYNOS_DP_COMMON_INT_STA_4);
+
+ if (reg & PLUG)
+ return DP_IRQ_TYPE_HP_CABLE_IN;
+
+ if (reg & HPD_LOST)
+ return DP_IRQ_TYPE_HP_CABLE_OUT;
+
+ if (reg & HOTPLUG_CHG)
+ return DP_IRQ_TYPE_HP_CHANGE;
+ }
return DP_IRQ_TYPE_UNKNOWN; }
Best regards,
Jingoo Han
Quoted 23 lines
drivers/gpu/drm/exynos/exynos_dp_reg.c +8
-4/* Parse hotplug interrupt status register */ reg =readl (dp->reg_base +EXYNOS_DP_COMMON_INT_STA_4 );@@ -402,9 +417,14 @@ int exynos_dp_get_plug_in_status(struct exynos_dp_device *dp) {u32 reg; - reg =readl (dp->reg_base +EXYNOS_DP_SYS_CTL_3 ); -if (reg &HPD_STATUS ) -return 0 ; +if (gpio_is_valid (dp->hpd_gpio)) { +if (gpio_get_value (dp->hpd_gpio)) +return 0 ; + }else { + reg =readl (dp->reg_base +EXYNOS_DP_SYS_CTL_3 ); +if (reg &HPD_STATUS ) +return 0 ; + }return -EINVAL ; } --1.8.1.2
Re: [PATCH 1/7] drm/exynos: dp: support hotplug detection via GPIO
Hi Jingoo,
Quoted 109 lines · Jingoo Han
Quoted 9 lines · Ajay Kumar
From: Andrew Bresticker <[email protected]>
Certain bridge chips use a GPIO to indicate the cable status instead of the
I_DP_HPDpin. This adds an optional device-tree property, "samsung,hpd-gpio", to the exynos-dp controller which indicates that the specified GPIO should be used for hotplug detection. The GPIO is then set up as an edge-triggered interrupt where the rising edge indicates hotplug-in and the falling edge indicateshotplug-out.
Quoted 7 lines
Signed-off-by Andrew Bresticker <[email protected]>Signed-off-by Rahul Sharma <[email protected]>Signed-off-by Ajay Kumar <[email protected]>--- .../devicetree/bindings/video/exynos_dp.txt | 4 +++ drivers/gpu/drm/exynos/exynos_dp_core.c | 32++++++++++++++++++++--
Quoted 2 lines
drivers/gpu/drm/exynos/exynos_dp_core.h | 1 + drivers/gpu/drm/exynos/exynos_dp_reg.c | 26++++++++++++++++--
Quoted 2 lines
4 files changed, 57 insertions(+), 6 deletions(-)[.....]
drivers/gpu/drm/exynos/exynos_dp_reg.c void exynos_dp_clear_hotplug_interrupts(struct
Quoted 11 lines
drivers/gpu/drm/exynos/exynos_dp_reg.c +1
-0@@ -13,6 +13,7 @@#include <linux/device.h> #include <linux/io.h> #include <linux/delay.h> +#include <linux/gpio.h> #include "exynos_dp_core.h" #include "exynos_dp_reg.h" @@ -326,6 +327,9 @@ void exynos_dp_clear_hotplug_interrupts(struct
exynos_dp_device*dp)drivers/gpu/drm/exynos/exynos_dp_reg.c enum dp_irq_type exynos_dp_get_irq_type(struct
Quoted 20 lines
drivers/gpu/drm/exynos/exynos_dp_reg.c +6
-0{u32 reg; +if (gpio_is_valid (dp->hpd_gpio)) +return ; + reg =HOTPLUG_CHG |HPD_LOST |PLUG ;writel (reg, dp->reg_base +EXYNOS_DP_COMMON_INT_STA_4 );@@ -337,6 +341,9 @@ void exynos_dp_init_hpd(struct exynos_dp_device *dp) {u32 reg; +if (gpio_is_valid (dp->hpd_gpio)) +return ; +exynos_dp_clear_hotplug_interrupts (dp); reg =readl (dp->reg_base +EXYNOS_DP_SYS_CTL_3 );@@ -348,6 +355,14 @@ enum dp_irq_type exynos_dp_get_irq_type(struct
exynos_dp_device*dp)drivers/gpu/drm/exynos/exynos_dp_reg.c enum dp_irq_type exynos_dp_get_irq_type(struct exynos_dp_device *dp) · line 365
Quoted 11 lines
drivers/gpu/drm/exynos/exynos_dp_reg.c +8
-0{u32 reg; +if (gpio_is_valid (dp->hpd_gpio)) { + reg =gpio_get_value (dp->hpd_gpio); +if (reg) +return DP_IRQ_TYPE_HP_CABLE_IN ; +else +return DP_IRQ_TYPE_HP_CABLE_OUT ; + } +Please keep the style. It enhances the readability.
if (gpio_is_valid(dp->hpd_gpio)) { ... } else { ... }Ok.
Then, it can be as bellows.
(quoted diff) +19
-0+ if (gpio_is_valid(dp->hpd_gpio)) { + reg = gpio_get_value(dp->hpd_gpio); + if (reg) + return DP_IRQ_TYPE_HP_CABLE_IN; + else + return DP_IRQ_TYPE_HP_CABLE_OUT; + } else { + /* Parse hotplug interrupt status register */ + reg = readl(dp->reg_base + EXYNOS_DP_COMMON_INT_STA_4); + + if (reg & PLUG) + return DP_IRQ_TYPE_HP_CABLE_IN; + + if (reg & HPD_LOST) + return DP_IRQ_TYPE_HP_CABLE_OUT; + + if (reg & HOTPLUG_CHG) + return DP_IRQ_TYPE_HP_CHANGE; + }Will change this.
return DP_IRQ_TYPE_UNKNOWN; }
Quoted 29 lines
Best regards,
Jingoo Handrivers/gpu/drm/exynos/exynos_dp_reg.c int exynos_dp_get_plug_in_status(struct
Quoted 4 lines
drivers/gpu/drm/exynos/exynos_dp_reg.c +0
-0/* Parse hotplug interrupt status register */ reg =readl (dp->reg_base +EXYNOS_DP_COMMON_INT_STA_4 );@@ -402,9 +417,14 @@ int exynos_dp_get_plug_in_status(struct
exynos_dp_device*dp)Quoted 19 lines
drivers/gpu/drm/exynos/exynos_dp_reg.c +8
-4{u32 reg; - reg =readl (dp->reg_base +EXYNOS_DP_SYS_CTL_3 ); -if (reg &HPD_STATUS ) -return 0 ; +if (gpio_is_valid (dp->hpd_gpio)) { +if (gpio_get_value (dp->hpd_gpio)) +return 0 ; + }else { + reg =readl (dp->reg_base +EXYNOS_DP_SYS_CTL_3 ); +if (reg &HPD_STATUS ) +return 0 ; + }return -EINVAL ; } --1.8.1.2
Thanks and Regrads,
Ajay Kumar
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 2/7 drm/panel: add pre_enable routine to drm panel
In reply to Ajay KumarMost of the panels need an init sequence as mentioned below:
-- poweron LCD unit/LCD_EN
-- start video data
-- poweron LED unit/BL_EN
With existing callbacks for drm panel, we cannot accomodate such panels, since only one callback, i.e "panel_enable" is supported.
This patch adds a "pre_enable" callback which can be called before the actual video data is on, and then call the "enable" callback after the video data is available.
--- include/drm/drm_panel.h | 9 +++++++++ 1 file changed, 9 insertions(+)
include/drm/drm_panel.h +9 -0
@@ -32,6 +32,7 @@ struct drm_panel;struct drm_panel_funcs {int (*disable)(struct drm_panel *panel); +int (*pre_enable)(struct drm_panel *panel);int (*enable)(struct drm_panel *panel);int (*get_modes)(struct drm_panel *panel); };
@@ -54,6 +55,14 @@ static inline int drm_panel_disable(struct drm_panel *panel)return panel ? -ENOSYS : -EINVAL ; } +static inline int drm_panel_pre_enable (struct drm_panel *panel) +{ +if (panel && panel->funcs && panel->funcs->pre_enable) +return panel->funcs->pre_enable (panel); + +return panel ? -ENOSYS : -EINVAL ; +} +static inline int drm_panel_enable (struct drm_panel *panel) {if (panel && panel->funcs && panel->funcs->enable)
Signature · 1 line
1.8.1.2
PATCH 3/7 drm/panel: Add driver for exynos_dp based panels
In reply to Ajay KumarThis patch adds a simple driver to handle all the LCD and LED powerup/down routines needed to support eDP/eDP-LVDS panels supported on exynos boards.
Most of the eDP/LVDS panels need this sequence for powerup:
-- LCD unit powerup/LCD_EN
-- video data on
-- LED unit powerup/BL_EN
The LCD and LED units are usually powered up via regulators, and almost on all boards, we will have a BL_EN pin to enable/ disable the backlight. Sometimes, we can have LCD_EN switches as well. The routines in this driver can be used to control panel power sequence on such boards.
--- .../devicetree/bindings/panel/exynos-dp-panel.txt | 32 ++++ drivers/gpu/drm/panel/Kconfig | 9 + drivers/gpu/drm/panel/Makefile | 1 + drivers/gpu/drm/panel/panel-exynos-dp.c | 213 +++++++++++++++++++++ 4 files changed, 255 insertions(+) create mode 100644 Documentation/devicetree/bindings/panel/exynos-dp-panel.txt create mode 100644 drivers/gpu/drm/panel/panel-exynos-dp.c
Documentation/devicetree/bindings/panel/exynos-dp-panel.txt new file +32 -0
@@ -0,0 +1,32 @@ +exynos_DP_panel/DP_to_LVDS_panel +================================== + +Required properties: + - compatible: "samsung,exynos-dp-panel" + +Optional properties: + -samsung,lcd-en-gpio: + eDP panel LCD poweron GPIO. + Indicates which GPIO needs to be powered up as output + to powerup/enable the switch to the LCD panel. + -samsung,led-en-gpio: + eDP panel LED enable GPIO. + Indicates which GPIO needs to be powered up as output + to enable the backlight. + -samsung,power-up-delay: + eDP panel powerup delay value in ms. + Delay in ms needed for the eDP panel to properly + powerup after giving powerup signals to the panel. + -samsung,power-down-delay: + eDP panel powerdown delay value in ms. + Delay in ms needed for the eDP panel to properly + powerdown after giving powerdown signals to the panel. + +Example: + + dp-panel { + compatible = "samsung,exynos-dp-panel"; + samsung,led-en-gpio = <&gpx3 0 1>; + samsung,power-up-delay = <40>; + samsung,power-down-delay = <50>; + };
drivers/gpu/drm/panel/Kconfig +9 -0
@@ -30,4 +30,13 @@ config DRM_PANEL_S6E8AA0 select DRM_MIPI_DSI select VIDEOMODE_HELPERS +config DRM_PANEL_EXYNOS_DP + tristate "support for DP panels" + depends on OF && DRM_PANEL && DRM_EXYNOS_DP + help + DRM panel driver for DP panels and LVDS connected via DP bridges + that need at most a regulator for LCD unit, a regulator for LED unit + and/or enable GPIOs for LCD or LED units. Delay values can also be + specified to support powerup and powerdown process. + endmenu
drivers/gpu/drm/panel/Makefile +1 -0
@@ -1,3 +1,4 @@ obj-$(CONFIG_DRM_PANEL_SIMPLE) += panel-simple.o obj-$(CONFIG_DRM_PANEL_LD9040) += panel-ld9040.o obj-$(CONFIG_DRM_PANEL_S6E8AA0) += panel-s6e8aa0.o +obj-$(CONFIG_DRM_PANEL_EXYNOS_DP) += panel-exynos-dp.o
drivers/gpu/drm/panel/panel-exynos-dp.c new file +213 -0
213 lines not on this page · raw message
Signature · 1 line
1.8.1.2
Re: [PATCH 3/7] drm/panel: Add driver for exynos_dp based panels
Quoted 33 lines · Ajay Kumar
This patch adds a simple driver to handle all the LCD and LED powerup/down routines needed to support eDP/eDP-LVDS panels supported on exynos boards.
Most of the eDP/LVDS panels need this sequence for powerup:
-- LCD unit powerup/LCD_EN
-- video data on
-- LED unit powerup/BL_ENThe LCD and LED units are usually powered up via regulators, and almost on all boards, we will have a
BL_ENpin to enable/ disable the backlight. Sometimes, we can haveLCD_ENswitches as well. The routines in this driver can be used to control panel power sequence on such boards.Signed-off-by Ajay Kumar <[email protected]>--- .../devicetree/bindings/panel/exynos-dp-panel.txt | 32 ++++ drivers/gpu/drm/panel/Kconfig | 9 + drivers/gpu/drm/panel/Makefile | 1 + drivers/gpu/drm/panel/panel-exynos-dp.c | 213 +++++++++++++++++++++ 4 files changed, 255 insertions(+) create mode 100644 Documentation/devicetree/bindings/panel/exynos-dp-panel.txt create mode 100644 drivers/gpu/drm/panel/panel-exynos-dp.cDocumentation/devicetree/bindings/panel/exynos-dp-panel.txt new file +0
-0
Documentation/devicetree/bindings/panel/exynos-dp-panel.txt line 1
Quoted 1 line
Documentation/devicetree/bindings/panel/exynos-dp-panel.txt new file +1
-0@@ -0,0 +1,32 @@ +exynos_DP_panel/DP_to_LVDS_panel
Please remove unnecessary under lines as below.
Exynos DP panel/DP to LVDS panel
Quoted 82 lines
Documentation/devicetree/bindings/panel/exynos-dp-panel.txt new file +31
-0+================================== + +Required properties: + - compatible: "samsung,exynos-dp-panel" + +Optional properties: + -samsung,lcd-en-gpio: + eDP panel LCD poweron GPIO. + Indicates which GPIO needs to be powered up as output + to powerup/enable the switch to the LCD panel. + -samsung,led-en-gpio: + eDP panel LED enable GPIO. + Indicates which GPIO needs to be powered up as output + to enable the backlight. + -samsung,power-up-delay: + eDP panel powerup delay value in ms. + Delay in ms needed for the eDP panel to properly + powerup after giving powerup signals to the panel. + -samsung,power-down-delay: + eDP panel powerdown delay value in ms. + Delay in ms needed for the eDP panel to properly + powerdown after giving powerdown signals to the panel. + +Example: + + dp-panel { + compatible = "samsung,exynos-dp-panel"; + samsung,led-en-gpio = <&gpx3 0 1>; + samsung,power-up-delay = <40>; + samsung,power-down-delay = <50>; + };drivers/gpu/drm/panel/Kconfig +9
-0@@ -30,4 +30,13 @@ config DRM_PANEL_S6E8AA0 select DRM_MIPI_DSI select VIDEOMODE_HELPERS +config DRM_PANEL_EXYNOS_DP + tristate "support for DP panels" + depends on OF && DRM_PANEL && DRM_EXYNOS_DP + help + DRM panel driver for DP panels and LVDS connected via DP bridges + that need at most a regulator for LCD unit, a regulator for LED unit + and/or enable GPIOs for LCD or LED units. Delay values can also be + specified to support powerup and powerdown process. + endmenudrivers/gpu/drm/panel/Makefile +1
-0@@ -1,3 +1,4 @@ obj-$(CONFIG_DRM_PANEL_SIMPLE) += panel-simple.o obj-$(CONFIG_DRM_PANEL_LD9040) += panel-ld9040.o obj-$(CONFIG_DRM_PANEL_S6E8AA0) += panel-s6e8aa0.o +obj-$(CONFIG_DRM_PANEL_EXYNOS_DP) += panel-exynos-dp.odrivers/gpu/drm/panel/panel-exynos-dp.c new file +18
-0@@ -0,0 +1,213 @@ +/* +* Exynos DP panel driver +* +* Copyright (c) 2014 Samsung Electronics Co., Ltd +* +* Ajay Kumar <[email protected]> +* +* 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/component.h> +#include <linux/gpio.h> +#include <linux/module.h> +#include <linux/of_gpio.h> +#include <linux/of_platform.h> +#include <linux/platform_device.h>
drivers/gpu/drm/panel/panel-exynos-dp.c line 28
Quoted 10 lines
drivers/gpu/drm/panel/panel-exynos-dp.c new file +10
-0+#include <linux/regulator/consumer.h> + +#include <drm/drmP.h> +#include <drm/drm_crtc.h> +#include <drm/drm_panel.h> + +struct panel_exynos_dp { +struct drm_panel base; +struct regulator *bck_fet; +struct regulator *lcd_fet;
'bck' means 'backlight'? Then, just use 'backlight_fet'. Also, I cannot understand the meaning of 'fet'. What's the meaning of the 'fet'?
Quoted 35 lines
drivers/gpu/drm/panel/panel-exynos-dp.c new file +35
-0+int led_en_gpio; +int lcd_en_gpio; +int power_up_delay; +int power_down_delay; +bool enabled; +}; + +static inline struct panel_exynos_dp *to_panel (struct drm_panel *panel) +{ + return container_of(panel, struct panel_exynos_dp, base); +} + +static int panel_exynos_dp_disable (struct drm_panel *panel) +{ +struct panel_exynos_dp *dp_panel =to_panel (panel); +bool enable_delay = false; + +if (!dp_panel->enabled) +return 0 ; + +if (gpio_is_valid (dp_panel->led_en_gpio)) +gpio_set_value (dp_panel->led_en_gpio,0 ); + +if (!IS_ERR_OR_NULL (dp_panel->bck_fet)) +regulator_disable (dp_panel->bck_fet); + +if (gpio_is_valid (dp_panel->lcd_en_gpio)) { +gpio_set_value (dp_panel->lcd_en_gpio,0 ); + enable_delay = true; + } + +if (!IS_ERR_OR_NULL (dp_panel->lcd_fet)) { +regulator_disable (dp_panel->lcd_fet); + enable_delay = true; + }
drivers/gpu/drm/panel/panel-exynos-dp.c line 73
Quoted 10 lines
drivers/gpu/drm/panel/panel-exynos-dp.c new file +10
-0+ +if (enable_delay) +msleep (dp_panel->power_down_delay); + + dp_panel->enabled = false; + +return 0 ; +} + +static int panel_exynos_dp_pre_enable (struct drm_panel *panel)
panel_exynos_dp_pre_enable() always returns '0'. These are two ways. Either one will be better.
1. Make return values meaningful. In other words, add the case returning error values.
2. Change the return type to 'void'
Best regards,
Jingoo Han
Quoted 142 lines
drivers/gpu/drm/panel/panel-exynos-dp.c new file +140
-1+{ +struct panel_exynos_dp *dp_panel =to_panel (panel); +bool enable_delay = false; + +if (dp_panel->enabled) +return 0 ; + +if (!IS_ERR_OR_NULL (dp_panel->lcd_fet)) { +if (regulator_enable (dp_panel->lcd_fet)) +DRM_ERROR ("Failed to enable LCD fet\n" ); + enable_delay = true; + } + +if (gpio_is_valid (dp_panel->lcd_en_gpio)) { +gpio_set_value (dp_panel->lcd_en_gpio,1 ); + enable_delay = true; + } + +if (enable_delay) +msleep (dp_panel->power_up_delay); + +return 0 ; +} + +static int panel_exynos_dp_enable (struct drm_panel *panel) +{ +struct panel_exynos_dp *dp_panel =to_panel (panel); + +if (dp_panel->enabled) +return 0 ; + +if (!IS_ERR_OR_NULL (dp_panel->bck_fet)) +if (regulator_enable (dp_panel->bck_fet)) +DRM_ERROR ("Failed to enable LED fet\n" ); + +if (gpio_is_valid (dp_panel->led_en_gpio)) +gpio_set_value (dp_panel->led_en_gpio,1 ); + + dp_panel->enabled = true; + +return 0 ; +} + +static const struct drm_panel_funcs panel_exynos_dp_funcs = { + .disable = panel_exynos_dp_disable, + .pre_enable = panel_exynos_dp_pre_enable, + .enable = panel_exynos_dp_enable, +}; + +static int panel_exynos_dp_probe (struct platform_device *pdev) +{ +struct panel_exynos_dp *dp_panel; +struct device *dev = &pdev->dev; +int ret; + + dp_panel =devm_kzalloc (dev,sizeof (*dp_panel),GFP_KERNEL ); +if (!dp_panel) +return -ENOMEM ; + + dp_panel->enabled = false; + + dp_panel->lcd_en_gpio =of_get_named_gpio (dev->of_node, +"samsung,lcd-en-gpio" ,0 ); + dp_panel->led_en_gpio =of_get_named_gpio (dev->of_node, +"samsung,led-en-gpio" ,0 ); + +of_property_read_u32 (dev->of_node,"samsung,power-up-delay" , + &dp_panel->power_up_delay); +of_property_read_u32 (dev->of_node,"samsung,power-down-delay" , + &dp_panel->power_down_delay); + + dp_panel->lcd_fet =devm_regulator_get (dev,"lcd_vdd" ); +if (IS_ERR (dp_panel->lcd_fet)) +return PTR_ERR (dp_panel->lcd_fet); + + dp_panel->bck_fet =devm_regulator_get (dev,"vcd_led" ); +if (IS_ERR (dp_panel->bck_fet)) +return PTR_ERR (dp_panel->bck_fet); + +if (gpio_is_valid (dp_panel->lcd_en_gpio)) { + ret =devm_gpio_request_one (dev, dp_panel->lcd_en_gpio, +GPIOF_OUT_INIT_LOW ,"lcd_en_gpio" ); +if (ret) { +DRM_ERROR ("failed to get lcd-en gpio [%d]\n" , ret); +return ret; + } + }else { + dp_panel->lcd_en_gpio = -ENODEV ; + } + +if (gpio_is_valid (dp_panel->led_en_gpio)) { + ret =devm_gpio_request_one (dev, dp_panel->led_en_gpio, +GPIOF_OUT_INIT_LOW ,"led_en_gpio" ); +if (ret) { +DRM_ERROR ("failed to get led-en gpio [%d]\n" , ret); +return ret; + } + }else { + dp_panel->led_en_gpio = -ENODEV ; + } + +drm_panel_init (&dp_panel->base); + dp_panel->base.dev = dev; + dp_panel->base.funcs = &panel_exynos_dp_funcs; + + ret =drm_panel_add (&dp_panel->base); +if (ret <0 ) +return ret; + +dev_set_drvdata (dev, dp_panel); + +return 0 ; +} + +static int panel_exynos_dp_remove (struct platform_device *pdev) +{ +struct panel_exynos_dp *dp_panel =dev_get_drvdata (&pdev->dev); + +drm_panel_detach (&dp_panel->base); +drm_panel_remove (&dp_panel->base); + +panel_exynos_dp_disable (&dp_panel->base); + +return 0 ; +} + +static const struct of_device_id exynos_dp_panel_dt_match[] = { + { .compatible ="samsung,exynos-dp-panel" }, + {}, +}; + +struct platform_driver exynos_dp_panel_driver = { + .driver = { + .name ="exynos-dp-panel" , + .owner =THIS_MODULE , + .of_match_table = exynos_dp_panel_dt_match, + }, + .probe = panel_exynos_dp_probe, + .remove = panel_exynos_dp_remove, +}; --1.8.1.2
Re: [PATCH 3/7] drm/panel: Add driver for exynos_dp based panels
Hi Jingoo,
Quoted 138 lines · Jingoo Han
Quoted 16 lines · Ajay Kumar
This patch adds a simple driver to handle all the LCD and LED powerup/down routines needed to support eDP/eDP-LVDS panels supported on exynos boards.
Most of the eDP/LVDS panels need this sequence for powerup:
-- LCD unit powerup/LCD_EN
-- video data on
-- LED unit powerup/BL_ENThe LCD and LED units are usually powered up via regulators, and almost on all boards, we will have a
BL_ENpin to enable/ disable the backlight. Sometimes, we can haveLCD_ENswitches as well. The routines in this driver can be used to control panel power sequence on such boards.Quoted 6 lines
Signed-off-by Ajay Kumar <[email protected]>--- .../devicetree/bindings/panel/exynos-dp-panel.txt | 32 ++++ drivers/gpu/drm/panel/Kconfig | 9 + drivers/gpu/drm/panel/Makefile | 1 + drivers/gpu/drm/panel/panel-exynos-dp.c | 213+++++++++++++++++++++
Quoted 2 lines
4 files changed, 255 insertions(+) create mode 100644
Documentation/devicetree/bindings/panel/exynos-dp-panel.txtDocumentation/devicetree/bindings/panel/exynos-dp-panel.txt line 1
Quoted 10 lines
create mode 100644 drivers/gpu/drm/panel/panel-exynos-dp.cDocumentation/devicetree/bindings/panel/exynos-dp-panel.txt new file +1
-0@@ -0,0 +1,32 @@ +exynos_DP_panel/DP_to_LVDS_panelPlease remove unnecessary under lines as below.
Ok.
Exynos DP panel/DP to LVDS panel
Documentation/devicetree/bindings/panel/exynos-dp-panel.txt
Quoted 9 lines
Documentation/devicetree/bindings/panel/exynos-dp-panel.txt new file +9
-0+================================== + +Required properties: + - compatible: "samsung,exynos-dp-panel" + +Optional properties: + -samsung,lcd-en-gpio: + eDP panel LCD poweron GPIO. + Indicates which GPIO needs to be powered up asoutput
Documentation/devicetree/bindings/panel/exynos-dp-panel.txt
Quoted 4 lines
Documentation/devicetree/bindings/panel/exynos-dp-panel.txt new file +4
-0+ to powerup/enable the switch to the LCD panel. + -samsung,led-en-gpio: + eDP panel LED enable GPIO. + Indicates which GPIO needs to be powered up asoutput
Documentation/devicetree/bindings/panel/exynos-dp-panel.txt
Quoted 9 lines
Documentation/devicetree/bindings/panel/exynos-dp-panel.txt new file +9
-0+ to enable the backlight. + -samsung,power-up-delay: + eDP panel powerup delay value in ms. + Delay in ms needed for the eDP panel to properly + powerup after giving powerup signals to the panel. + -samsung,power-down-delay: + eDP panel powerdown delay value in ms. + Delay in ms needed for the eDP panel to properly + powerdown after giving powerdown signals to thepanel.
Review
Quoted 10 lines
Documentation/devicetree/bindings/panel/exynos-dp-panel.txt new file +9
-0+ +Example: + + dp-panel { + compatible = "samsung,exynos-dp-panel"; + samsung,led-en-gpio = <&gpx3 0 1>; + samsung,power-up-delay = <40>; + samsung,power-down-delay = <50>; + };(quoted diff) +0
-0b/drivers/gpu/drm/panel/Kconfig
drivers/gpu/drm/panel/Kconfig config DRM_PANEL_S6E8AA0 · line 38
Quoted 13 lines
index 4ec874d..ea9d5ac 100644
drivers/gpu/drm/panel/Kconfig +6
-0@@ -30,4 +30,13 @@ config DRM_PANEL_S6E8AA0 select DRM_MIPI_DSI select VIDEOMODE_HELPERS +config DRM_PANEL_EXYNOS_DP + tristate "support for DP panels" + depends on OF && DRM_PANEL && DRM_EXYNOS_DP + help + DRM panel driver for DP panels and LVDS connected via DP bridges + that need at most a regulator for LCD unit, a regulator for LEDunit
drivers/gpu/drm/panel/Kconfig config DRM_PANEL_S6E8AA0 · line 39
Quoted 1 line
drivers/gpu/drm/panel/Kconfig +1
-0+ and/or enable GPIOs for LCD or LED units. Delay values can alsobe
Review
Quoted 4 lines
drivers/gpu/drm/panel/Kconfig +2
-0+ specified to support powerup and powerdown process. + endmenu(quoted diff) +0
-0b/drivers/gpu/drm/panel/Makefile
Review
Quoted 9 lines
index 8b92921..30311a4 100644
drivers/gpu/drm/panel/Makefile +1
-0@@ -1,3 +1,4 @@ obj-$(CONFIG_DRM_PANEL_SIMPLE) += panel-simple.o obj-$(CONFIG_DRM_PANEL_LD9040) += panel-ld9040.o obj-$(CONFIG_DRM_PANEL_S6E8AA0) += panel-s6e8aa0.o +obj-$(CONFIG_DRM_PANEL_EXYNOS_DP) += panel-exynos-dp.o(quoted diff) +0
-0
b/drivers/gpu/drm/panel/panel-exynos-dp.cQuoted 27 lines
new file mode 100644
index 0000000..e85a7b2drivers/gpu/drm/panel/panel-exynos-dp.c new file +22
-0@@ -0,0 +1,213 @@ +/* +* Exynos DP panel driver +* +* Copyright (c) 2014 Samsung Electronics Co., Ltd +* +* Ajay Kumar <[email protected]> +* +* 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/component.h> +#include <linux/gpio.h> +#include <linux/module.h> +#include <linux/of_gpio.h> +#include <linux/of_platform.h> +#include <linux/platform_device.h> +#include <linux/regulator/consumer.h> + +#include <drm/drmP.h> +#include <drm/drm_crtc.h>
Quoted 9 lines
drivers/gpu/drm/panel/panel-exynos-dp.c line 28
Quoted 6 lines
drivers/gpu/drm/panel/panel-exynos-dp.c new file +6
-0+#include <drm/drm_panel.h> + +struct panel_exynos_dp { +struct drm_panel base; +struct regulator *bck_fet; +struct regulator *lcd_fet;'bck' means 'backlight'? Then, just use '
backlight_fet'.
backlight_fet is more meaningful. Will change it.
Also, I cannot understand the meaning of 'fet'.
Quoted 3 lines
What's the meaning of the 'fet'?
FET is an output from the regulator. On exynos5250-snow board,
FET1 controls power to the backlight unit. See more here: https://lkml.org/lkml/2014/4/15/618
Quoted 191 lines
+ int
led_en_gpio;Quoted 34 lines
drivers/gpu/drm/panel/panel-exynos-dp.c new file +34
-0+int lcd_en_gpio; +int power_up_delay; +int power_down_delay; +bool enabled; +}; + +static inline struct panel_exynos_dp *to_panel (struct drm_panel *panel) +{ + return container_of(panel, struct panel_exynos_dp, base); +} + +static int panel_exynos_dp_disable (struct drm_panel *panel) +{ +struct panel_exynos_dp *dp_panel =to_panel (panel); +bool enable_delay = false; + +if (!dp_panel->enabled) +return 0 ; + +if (gpio_is_valid (dp_panel->led_en_gpio)) +gpio_set_value (dp_panel->led_en_gpio,0 ); + +if (!IS_ERR_OR_NULL (dp_panel->bck_fet)) +regulator_disable (dp_panel->bck_fet); + +if (gpio_is_valid (dp_panel->lcd_en_gpio)) { +gpio_set_value (dp_panel->lcd_en_gpio,0 ); + enable_delay = true; + } + +if (!IS_ERR_OR_NULL (dp_panel->lcd_fet)) { +regulator_disable (dp_panel->lcd_fet); + enable_delay = true; + }drivers/gpu/drm/panel/panel-exynos-dp.c line 73
Quoted 10 lines
drivers/gpu/drm/panel/panel-exynos-dp.c new file +10
-0+ +if (enable_delay) +msleep (dp_panel->power_down_delay); + + dp_panel->enabled = false; + +return 0 ; +} + +static int panel_exynos_dp_pre_enable (struct drm_panel *panel)
panel_exynos_dp_pre_enable()always returns '0'. These are two ways. Either one will be better.
1. Make return values meaningful. In other words, add the case returning error values.2. Change the return type to 'void'
Ok. Will add a check for all failure cases.
Quoted 60 lines
drivers/gpu/drm/panel/panel-exynos-dp.c new file +60
-0+{ +struct panel_exynos_dp *dp_panel =to_panel (panel); +bool enable_delay = false; + +if (dp_panel->enabled) +return 0 ; + +if (!IS_ERR_OR_NULL (dp_panel->lcd_fet)) { +if (regulator_enable (dp_panel->lcd_fet)) +DRM_ERROR ("Failed to enable LCD fet\n" ); + enable_delay = true; + } + +if (gpio_is_valid (dp_panel->lcd_en_gpio)) { +gpio_set_value (dp_panel->lcd_en_gpio,1 ); + enable_delay = true; + } + +if (enable_delay) +msleep (dp_panel->power_up_delay); + +return 0 ; +} + +static int panel_exynos_dp_enable (struct drm_panel *panel) +{ +struct panel_exynos_dp *dp_panel =to_panel (panel); + +if (dp_panel->enabled) +return 0 ; + +if (!IS_ERR_OR_NULL (dp_panel->bck_fet)) +if (regulator_enable (dp_panel->bck_fet)) +DRM_ERROR ("Failed to enable LED fet\n" ); + +if (gpio_is_valid (dp_panel->led_en_gpio)) +gpio_set_value (dp_panel->led_en_gpio,1 ); + + dp_panel->enabled = true; + +return 0 ; +} + +static const struct drm_panel_funcs panel_exynos_dp_funcs = { + .disable = panel_exynos_dp_disable, + .pre_enable = panel_exynos_dp_pre_enable, + .enable = panel_exynos_dp_enable, +}; + +static int panel_exynos_dp_probe (struct platform_device *pdev) +{ +struct panel_exynos_dp *dp_panel; +struct device *dev = &pdev->dev; +int ret; + + dp_panel =devm_kzalloc (dev,sizeof (*dp_panel),GFP_KERNEL ); +if (!dp_panel) +return -ENOMEM ; + + dp_panel->enabled = false;drivers/gpu/drm/panel/panel-exynos-dp.c line 144
Quoted 10 lines
drivers/gpu/drm/panel/panel-exynos-dp.c new file +10
-0+ + dp_panel->lcd_en_gpio =of_get_named_gpio (dev->of_node, +"samsung,lcd-en-gpio" ,0 ); + dp_panel->led_en_gpio =of_get_named_gpio (dev->of_node, +"samsung,led-en-gpio" ,0 ); + +of_property_read_u32 (dev->of_node,"samsung,power-up-delay" , + &dp_panel->power_up_delay); + of_property_read_u32(dev->of_node, "samsung,power-down-delay", +
&dp_panel->power_down_delay);Quoted 64 lines
drivers/gpu/drm/panel/panel-exynos-dp.c new file +64
-0+ + dp_panel->lcd_fet =devm_regulator_get (dev,"lcd_vdd" ); +if (IS_ERR (dp_panel->lcd_fet)) +return PTR_ERR (dp_panel->lcd_fet); + + dp_panel->bck_fet =devm_regulator_get (dev,"vcd_led" ); +if (IS_ERR (dp_panel->bck_fet)) +return PTR_ERR (dp_panel->bck_fet); + +if (gpio_is_valid (dp_panel->lcd_en_gpio)) { + ret =devm_gpio_request_one (dev, dp_panel->lcd_en_gpio, +GPIOF_OUT_INIT_LOW ,"lcd_en_gpio" ); +if (ret) { +DRM_ERROR ("failed to get lcd-en gpio [%d]\n" , ret); +return ret; + } + }else { + dp_panel->lcd_en_gpio = -ENODEV ; + } + +if (gpio_is_valid (dp_panel->led_en_gpio)) { + ret =devm_gpio_request_one (dev, dp_panel->led_en_gpio, +GPIOF_OUT_INIT_LOW ,"led_en_gpio" ); +if (ret) { +DRM_ERROR ("failed to get led-en gpio [%d]\n" , ret); +return ret; + } + }else { + dp_panel->led_en_gpio = -ENODEV ; + } + +drm_panel_init (&dp_panel->base); + dp_panel->base.dev = dev; + dp_panel->base.funcs = &panel_exynos_dp_funcs; + + ret =drm_panel_add (&dp_panel->base); +if (ret <0 ) +return ret; + +dev_set_drvdata (dev, dp_panel); + +return 0 ; +} + +static int panel_exynos_dp_remove (struct platform_device *pdev) +{ +struct panel_exynos_dp *dp_panel =dev_get_drvdata (&pdev->dev); + +drm_panel_detach (&dp_panel->base); +drm_panel_remove (&dp_panel->base); + +panel_exynos_dp_disable (&dp_panel->base); + +return 0 ; +} + +static const struct of_device_id exynos_dp_panel_dt_match[] = { + { .compatible ="samsung,exynos-dp-panel" }, + {}, +}; + +struct platform_driver exynos_dp_panel_driver = { + .driver = { + .name ="exynos-dp-panel" ,
Quoted 10 lines
Quoted 8 lines
drivers/gpu/drm/panel/panel-exynos-dp.c new file +6
-1+ .owner = THIS_MODULE, + .of_match_table = exynos_dp_panel_dt_match, + }, + .probe = panel_exynos_dp_probe, + .remove = panel_exynos_dp_remove, +}; --1.8.1.2
Thanks and regards,
Ajay Kumar
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 3/7] drm/panel: Add driver for exynos_dp based panels
Quoted 2 lines · Ajay kumar
Quoted 1 line · Jingoo Han
On Wednesday, April 16, 2014 11:33 PM, Ajay Kumar wrote:
[.....]
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
drivers/gpu/drm/panel/panel-exynos-dp.c new file +4
-0+struct panel_exynos_dp { +struct drm_panel base; +struct regulator *bck_fet; +struct regulator *lcd_fet;
Quoted 8 lines
Quoted 1 line
'bck' means 'backlight'? Then, just use '
backlight_fet'.
backlight_fetis more meaningful. Will change it.Quoted 2 lines
Also, I cannot understand the meaning of 'fet'.
What's the meaning of the 'fet'?FET is an output from the regulator. On exynos5250-snow board, FET1 controls power to the backlight unit.
See more here: https://lkml.org/lkml/2014/4/15/618
OK, I see.
PS: Please change your mail from 'html' mode to 'text' mode.
Best regards,
Jingoo Han
PATCH 4/7 drm/exynos: add exynos_dp_panel driver registration to drm driver
In reply to Ajay KumarRegister exynos_dp_panel before the list of exynos crtcs and connectors are probed.
This is needed because exynos_dp_panel should be registered to the drm_panel list via panel-exynos-dp probe, i.e much before exynos_dp_bind calls of_drm_find_panel().
--- drivers/gpu/drm/exynos/exynos_drm_drv.c | 11 +++++++++++ drivers/gpu/drm/exynos/exynos_drm_drv.h | 1 + 2 files changed, 12 insertions(+)
drivers/gpu/drm/exynos/exynos_drm_drv.c +11 -0
@@ -560,12 +560,23 @@ static int exynos_drm_platform_probe(struct platform_device *pdev) goto err_unregister_ipp;#endif +#ifdef CONFIG_DRM_PANEL_EXYNOS_DP + ret =platform_driver_register (&exynos_dp_panel_driver); +if (ret <0 ) + goto err_unregister_dp_panel; +#endif + ret =component_master_add (&pdev->dev, &exynos_drm_ops);if (ret <0 )DRM_DEBUG_KMS ("re-tried by last sub driver probed later.\n" );return 0 ; +#ifdef CONFIG_DRM_PANEL_EXYNOS_DP +platform_driver_unregister (&exynos_dp_panel_driver); +err_unregister_dp_panel: +#endif +#ifdef CONFIG_DRM_EXYNOS_IPP exynos_platform_device_ipp_unregister (); err_unregister_ipp:
drivers/gpu/drm/exynos/exynos_drm_drv.h +1 -0
@@ -368,4 +368,5 @@ extern struct platform_driver fimc_driver;extern struct platform_driver rotator_driver;extern struct platform_driver gsc_driver;extern struct platform_driver ipp_driver; +extern struct platform_driver exynos_dp_panel_driver;#endif
Signature · 1 line
1.8.1.2
Re: [PATCH 4/7] drm/exynos: add exynos_dp_panel driver registration to drm driver
Quoted 28 lines · Ajay Kumar
Register
exynos_dp_panelbefore the list of exynos crtcs and connectors are probed.This is needed because
exynos_dp_panelshould be registered to thedrm_panellist via panel-exynos-dp probe, i.e much beforeexynos_dp_bindcallsof_drm_find_panel().Signed-off-by Ajay Kumar <[email protected]>--- drivers/gpu/drm/exynos/exynos_drm_drv.c | 11 +++++++++++ drivers/gpu/drm/exynos/exynos_drm_drv.h | 1 + 2 files changed, 12 insertions(+)drivers/gpu/drm/exynos/exynos_drm_drv.c +6
-0@@ -560,12 +560,23 @@ static int exynos_drm_platform_probe(struct platform_device *pdev) goto err_unregister_ipp;#endif +#ifdef CONFIG_DRM_PANEL_EXYNOS_DP + ret =platform_driver_register (&exynos_dp_panel_driver); +if (ret <0 ) + goto err_unregister_dp_panel; +#endif +
drivers/gpu/drm/exynos/exynos_drm_drv.c static int exynos_drm_platform_probe(struct platform_device *pdev) · line 578
Quoted 10 lines
drivers/gpu/drm/exynos/exynos_drm_drv.c +4
-0ret =component_master_add (&pdev->dev, &exynos_drm_ops);if (ret <0 )DRM_DEBUG_KMS ("re-tried by last sub driver probed later.\n" );return 0 ; +#ifdef CONFIG_DRM_PANEL_EXYNOS_DP +platform_driver_unregister (&exynos_dp_panel_driver); +err_unregister_dp_panel: +#endif
Please add platform_driver_unregister() to exynos_drm_platform_remove(), as well as exynos_drm_platform_probe().
Best regards,
Jingoo Han
Quoted 16 lines
drivers/gpu/drm/exynos/exynos_drm_drv.c +1
-0+#ifdef CONFIG_DRM_EXYNOS_IPP exynos_platform_device_ipp_unregister (); err_unregister_ipp:drivers/gpu/drm/exynos/exynos_drm_drv.h +1
-1@@ -368,4 +368,5 @@ extern struct platform_driver fimc_driver;extern struct platform_driver rotator_driver;extern struct platform_driver gsc_driver;extern struct platform_driver ipp_driver; +extern struct platform_driver exynos_dp_panel_driver;#endif --1.8.1.2
Re: [PATCH 4/7] drm/exynos: add exynos_dp_panel driver registration to drm driver
Hi Jingoo,
Quoted 36 lines · Jingoo Han
Quoted 8 lines · Ajay Kumar
Register
exynos_dp_panelbefore the list of exynos crtcs and connectors are probed.This is needed because
exynos_dp_panelshould be registered to thedrm_panellist via panel-exynos-dp probe, i.e much beforeexynos_dp_bindcallsof_drm_find_panel().Review
Quoted 7 lines
Signed-off-by Ajay Kumar <[email protected]>--- drivers/gpu/drm/exynos/exynos_drm_drv.c | 11 +++++++++++ drivers/gpu/drm/exynos/exynos_drm_drv.h | 1 + 2 files changed, 12 insertions(+)(quoted diff) +0
-0
b/drivers/gpu/drm/exynos/exynos_drm_drv.cdrivers/gpu/drm/exynos/exynos_drm_drv.c static int exynos_drm_platform_probe(struct
Quoted 4 lines
index 1d1c604..47266e7 100644
drivers/gpu/drm/exynos/exynos_drm_drv.c +0
-0@@ -560,12 +560,23 @@ static int exynos_drm_platform_probe(struct
platform_device*pdev)drivers/gpu/drm/exynos/exynos_drm_drv.c static int exynos_drm_platform_probe(struct platform_device *pdev)
Quoted 12 lines
drivers/gpu/drm/exynos/exynos_drm_drv.c +6
-0goto err_unregister_ipp;#endif +#ifdef CONFIG_DRM_PANEL_EXYNOS_DP + ret =platform_driver_register (&exynos_dp_panel_driver); +if (ret <0 ) + goto err_unregister_dp_panel; +#endif + ret =component_master_add (&pdev->dev, &exynos_drm_ops);if (ret <0 ) DRM_DEBUG_KMS("re-tried by last sub driver probedlater.\n");
Quoted 1 line
Quoted 9 lines
drivers/gpu/drm/exynos/exynos_drm_drv.c static int exynos_drm_platform_probe(struct platform_device *pdev) · line 578
Quoted 6 lines
return 0;drivers/gpu/drm/exynos/exynos_drm_drv.c +4
-0+#ifdef CONFIG_DRM_PANEL_EXYNOS_DP +platform_driver_unregister (&exynos_dp_panel_driver); +err_unregister_dp_panel: +#endif Please add
platform_driver_unregister()toexynos_drm_platform_remove(),
Right, I have missed adding it in exynos_drm_platform_remove().
as well as exynos_drm_platform_probe().
Quoted 13 lines
I have already added for this case!
Best regards,
Jingoo HanReview
Quoted 5 lines
drivers/gpu/drm/exynos/exynos_drm_drv.c +1
-0+#ifdef CONFIG_DRM_EXYNOS_IPP exynos_platform_device_ipp_unregister (); err_unregister_ipp:(quoted diff) +0
-0
b/drivers/gpu/drm/exynos/exynos_drm_drv.h
Quoted 13 lines
Quoted 11 lines
index 257ce09..f606290 100644
drivers/gpu/drm/exynos/exynos_drm_drv.h +1
-1@@ -368,4 +368,5 @@ extern struct platform_driver fimc_driver;extern struct platform_driver rotator_driver;extern struct platform_driver gsc_driver;extern struct platform_driver ipp_driver; +extern struct platform_driver exynos_dp_panel_driver;#endif --1.8.1.2
Thanks and Regards,
Ajay Kumar
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 4/7] drm/exynos: add exynos_dp_panel driver registration to drm driver
Quoted 2 lines · Ajay Kumar
Quoted 1 line · Jingoo Han
On Wednesday, April 16, 2014 11:33 PM, Ajay Kumar wrote:
[.....]
Quoted 8 lines
Quoted 5 lines
drivers/gpu/drm/exynos/exynos_drm_drv.c static int exynos_drm_platform_probe(struct platform_device *pdev) · line 578
Quoted 4 lines
drivers/gpu/drm/exynos/exynos_drm_drv.c +4
-0+#ifdef CONFIG_DRM_PANEL_EXYNOS_DP +platform_driver_unregister (&exynos_dp_panel_driver); +err_unregister_dp_panel: +#endif Please add
platform_driver_unregister()toexynos_drm_platform_remove(),Right, I have missed adding it in
exynos_drm_platform_remove().Quoted 1 line
as well as
exynos_drm_platform_probe().I have already added for this case!
What I wanted to say is that
"Please add platform_driver_unregister() to exynos_drm_platform_remove(), as you added it to exynos_drm_platform_probe()."
Best regards,
Jingoo Han
PATCH 5/7 drm/exynos: dp: modify driver to support drm_panel
In reply to Ajay KumarThis patch attaches the dp connector to exynos_dp_panel, and adds calls to drm_panel functions to control panel power sequence.
--- drivers/gpu/drm/exynos/Kconfig | 1 + drivers/gpu/drm/exynos/exynos_dp_core.c | 19 +++++++++++++++++++ drivers/gpu/drm/exynos/exynos_dp_core.h | 1 + 3 files changed, 21 insertions(+)
drivers/gpu/drm/exynos/Kconfig +1 -0
@@ -52,6 +52,7 @@ config DRM_EXYNOS_DP bool "EXYNOS DRM DP driver support" depends on DRM_EXYNOS && ARCH_EXYNOS default DRM_EXYNOS + select DRM_PANEL help This enables support for DP device.
drivers/gpu/drm/exynos/exynos_dp_core.c +19 -0
@@ -28,6 +28,7 @@#include <drm/drmP.h> #include <drm/drm_crtc.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_panel.h> #include <drm/bridge/ptn3460.h> #include "exynos_drm_drv.h"
@@ -1028,6 +1029,9 @@ static int exynos_dp_create_connector(struct exynos_drm_display *display,drm_sysfs_connector_add (connector);drm_mode_connector_attach_encoder (connector, encoder); +if (dp->drm_panel) +drm_panel_attach (dp->drm_panel, &dp->connector); +return 0 ; }
@@ -1062,10 +1066,12 @@ static void exynos_dp_poweron(struct exynos_dp_device *dp)if (dp->dpms_mode ==DRM_MODE_DPMS_ON )return ; +drm_panel_pre_enable (dp->drm_panel);clk_prepare_enable (dp->clock);exynos_dp_phy_init (dp);exynos_dp_init_dp (dp);enable_irq (dp->irq); +drm_panel_enable (dp->drm_panel); }static void exynos_dp_poweroff (struct exynos_dp_device *dp)
@@ -1073,6 +1079,7 @@ static void exynos_dp_poweroff(struct exynos_dp_device *dp)if (dp->dpms_mode !=DRM_MODE_DPMS_ON )return ; +drm_panel_disable (dp->drm_panel);disable_irq (dp->irq);flush_work (&dp->hotplug_work);exynos_dp_phy_exit (dp);
@@ -1225,6 +1232,7 @@ static int exynos_dp_dt_parse_panel(struct exynos_dp_device *dp)static int exynos_dp_bind (struct device *dev,struct device *master,void *data) {struct platform_device *pdev =to_platform_device (dev); +struct device_node *panel_node;struct drm_device *drm_dev = data;struct resource *res;struct exynos_dp_device *dp;
@@ -1299,6 +1307,17 @@ static int exynos_dp_bind(struct device *dev, struct device *master, void *data)INIT_WORK (&dp->hotplug_work, exynos_dp_hotplug); + panel_node =of_find_compatible_node (NULL ,NULL , +"samsung,exynos-dp-panel" ); +if (panel_node) { + dp->drm_panel =of_drm_find_panel (panel_node); +if (!dp->drm_panel) { +of_node_put (panel_node); +return -ENODEV ; + } +of_node_put (panel_node); + } +exynos_dp_phy_init (dp);exynos_dp_init_dp (dp);
drivers/gpu/drm/exynos/exynos_dp_core.h +1 -0
@@ -148,6 +148,7 @@ struct exynos_dp_device {struct drm_device *drm_dev;struct drm_connector connector;struct drm_encoder *encoder; +struct drm_panel *drm_panel;struct clk *clock;unsigned int irq;void __iomem *reg_base;
Signature · 1 line
1.8.1.2
RE: [PATCH 5/7] drm/exynos: dp: modify driver to support drm_panel
Quoted 78 lines · Ajay Kumar
This patch attaches the dp connector to
exynos_dp_panel, and adds calls todrm_panelfunctions to control panel power sequence.Signed-off-by Ajay Kumar <[email protected]>--- drivers/gpu/drm/exynos/Kconfig | 1 + drivers/gpu/drm/exynos/exynos_dp_core.c | 19 +++++++++++++++++++ drivers/gpu/drm/exynos/exynos_dp_core.h | 1 + 3 files changed, 21 insertions(+)drivers/gpu/drm/exynos/Kconfig +1
-0@@ -52,6 +52,7 @@ config DRM_EXYNOS_DP bool "EXYNOS DRM DP driver support" depends on DRM_EXYNOS && ARCH_EXYNOS default DRM_EXYNOS + select DRM_PANEL help This enables support for DP device.drivers/gpu/drm/exynos/exynos_dp_core.c +8
-0@@ -28,6 +28,7 @@#include <drm/drmP.h> #include <drm/drm_crtc.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_panel.h> #include <drm/bridge/ptn3460.h> #include "exynos_drm_drv.h" @@ -1028,6 +1029,9 @@ static int exynos_dp_create_connector(struct exynos_drm_display *display,drm_sysfs_connector_add (connector);drm_mode_connector_attach_encoder (connector, encoder); +if (dp->drm_panel) +drm_panel_attach (dp->drm_panel, &dp->connector); +return 0 ; }@@ -1062,10 +1066,12 @@ static void exynos_dp_poweron(struct exynos_dp_device *dp)if (dp->dpms_mode ==DRM_MODE_DPMS_ON )return ; +drm_panel_pre_enable (dp->drm_panel);clk_prepare_enable (dp->clock);exynos_dp_phy_init (dp);exynos_dp_init_dp (dp);enable_irq (dp->irq); +drm_panel_enable (dp->drm_panel); }static void exynos_dp_poweroff (struct exynos_dp_device *dp)@@ -1073,6 +1079,7 @@ static void exynos_dp_poweroff(struct exynos_dp_device *dp)if (dp->dpms_mode !=DRM_MODE_DPMS_ON )return ; +drm_panel_disable (dp->drm_panel);disable_irq (dp->irq);flush_work (&dp->hotplug_work);exynos_dp_phy_exit (dp);@@ -1225,6 +1232,7 @@ static int exynos_dp_dt_parse_panel(struct exynos_dp_device *dp)static int exynos_dp_bind (struct device *dev,struct device *master,void *data) {struct platform_device *pdev =to_platform_device (dev); +struct device_node *panel_node;struct drm_device *drm_dev = data;struct resource *res;struct exynos_dp_device *dp;@@ -1299,6 +1307,17 @@ static int exynos_dp_bind(struct device *dev, struct device *master, void *data)INIT_WORK (&dp->hotplug_work, exynos_dp_hotplug);
drivers/gpu/drm/exynos/exynos_dp_core.c static int exynos_dp_bind(struct device *dev, struct device *master, void *data) · line 1319
Quoted 10 lines
drivers/gpu/drm/exynos/exynos_dp_core.c +10
-0+ panel_node =of_find_compatible_node (NULL ,NULL , +"samsung,exynos-dp-panel" ); +if (panel_node) { + dp->drm_panel =of_drm_find_panel (panel_node); +if (!dp->drm_panel) { +of_node_put (panel_node); +return -ENODEV ; + } +of_node_put (panel_node); + }
The following is simpler.
+ if (panel_node) {
+ dp->drm_panel = of_drm_find_panel(panel_node);
+ of_node_put(panel_node);
+ if (!dp->drm_panel)
+ return -ENODEV;
+ }
Best regards,
Jingoo Han
Quoted 18 lines
drivers/gpu/drm/exynos/exynos_dp_core.c +1
-0+exynos_dp_phy_init (dp);exynos_dp_init_dp (dp);drivers/gpu/drm/exynos/exynos_dp_core.h +1
-1@@ -148,6 +148,7 @@ struct exynos_dp_device {struct drm_device *drm_dev;struct drm_connector connector;struct drm_encoder *encoder; +struct drm_panel *drm_panel;struct clk *clock;unsigned int irq;void __iomem *reg_base; --1.8.1.2
Re: [PATCH 5/7] drm/exynos: dp: modify driver to support drm_panel
Hi Jingoo,
Quoted 101 lines · Jingoo Han
Quoted 4 lines · Ajay Kumar
This patch attaches the dp connector to
exynos_dp_panel, and adds calls todrm_panelfunctions to control panel power sequence.Review
Quoted 8 lines
Signed-off-by Ajay Kumar <[email protected]>--- drivers/gpu/drm/exynos/Kconfig | 1 + drivers/gpu/drm/exynos/exynos_dp_core.c | 19 +++++++++++++++++++ drivers/gpu/drm/exynos/exynos_dp_core.h | 1 + 3 files changed, 21 insertions(+)(quoted diff) +0
-0b/drivers/gpu/drm/exynos/Kconfig
Review
Quoted 12 lines
index 5bf5bca..56af433 100644
drivers/gpu/drm/exynos/Kconfig +1
-0@@ -52,6 +52,7 @@ config DRM_EXYNOS_DP bool "EXYNOS DRM DP driver support" depends on DRM_EXYNOS && ARCH_EXYNOS default DRM_EXYNOS + select DRM_PANEL help This enables support for DP device.(quoted diff) +0
-0
b/drivers/gpu/drm/exynos/exynos_dp_core.cdrivers/gpu/drm/exynos/exynos_dp_core.c static int exynos_dp_create_connector(struct
Quoted 12 lines
index 18fd9c5..6beeab6 100644
drivers/gpu/drm/exynos/exynos_dp_core.c +1
-0@@ -28,6 +28,7 @@#include <drm/drmP.h> #include <drm/drm_crtc.h> #include <drm/drm_crtc_helper.h> +#include <drm/drm_panel.h> #include <drm/bridge/ptn3460.h> #include "exynos_drm_drv.h" @@ -1028,6 +1029,9 @@ static int exynos_dp_create_connector(struct
exynos_drm_display*display,drivers/gpu/drm/exynos/exynos_dp_core.c static void exynos_dp_poweron(struct
Quoted 10 lines
drivers/gpu/drm/exynos/exynos_dp_core.c +3
-0drm_sysfs_connector_add (connector);drm_mode_connector_attach_encoder (connector, encoder); +if (dp->drm_panel) +drm_panel_attach (dp->drm_panel, &dp->connector); +return 0 ; }@@ -1062,10 +1066,12 @@ static void exynos_dp_poweron(struct
exynos_dp_device*dp)drivers/gpu/drm/exynos/exynos_dp_core.c static void exynos_dp_poweroff(struct
Quoted 13 lines
drivers/gpu/drm/exynos/exynos_dp_core.c +2
-0if (dp->dpms_mode ==DRM_MODE_DPMS_ON )return ; +drm_panel_pre_enable (dp->drm_panel);clk_prepare_enable (dp->clock);exynos_dp_phy_init (dp);exynos_dp_init_dp (dp);enable_irq (dp->irq); +drm_panel_enable (dp->drm_panel); }static void exynos_dp_poweroff (struct exynos_dp_device *dp)@@ -1073,6 +1079,7 @@ static void exynos_dp_poweroff(struct
exynos_dp_device*dp)drivers/gpu/drm/exynos/exynos_dp_core.c static int exynos_dp_dt_parse_panel(struct
Quoted 8 lines
drivers/gpu/drm/exynos/exynos_dp_core.c +1
-0if (dp->dpms_mode !=DRM_MODE_DPMS_ON )return ; +drm_panel_disable (dp->drm_panel);disable_irq (dp->irq);flush_work (&dp->hotplug_work);exynos_dp_phy_exit (dp);@@ -1225,6 +1232,7 @@ static int exynos_dp_dt_parse_panel(struct
exynos_dp_device*dp)drivers/gpu/drm/exynos/exynos_dp_core.c static int exynos_dp_dt_parse_panel(struct · line 1232
Quoted 1 line
drivers/gpu/drm/exynos/exynos_dp_core.c +0
-0static int exynos_dp_bind(struct device *dev, struct device *master,void *data)
drivers/gpu/drm/exynos/exynos_dp_core.c static int exynos_dp_bind(struct device *dev,
Quoted 7 lines
drivers/gpu/drm/exynos/exynos_dp_core.c +1
-0{struct platform_device *pdev =to_platform_device (dev); +struct device_node *panel_node;struct drm_device *drm_dev = data;struct resource *res;struct exynos_dp_device *dp;@@ -1299,6 +1307,17 @@ static int exynos_dp_bind(struct device *dev,struct device *master, void *data)
drivers/gpu/drm/exynos/exynos_dp_core.c static int exynos_dp_bind(struct device *dev, struct device *master, void *data) · line 1319
Quoted 13 lines
drivers/gpu/drm/exynos/exynos_dp_core.c +10
-0INIT_WORK (&dp->hotplug_work, exynos_dp_hotplug); + panel_node =of_find_compatible_node (NULL ,NULL , +"samsung,exynos-dp-panel" ); +if (panel_node) { + dp->drm_panel =of_drm_find_panel (panel_node); +if (!dp->drm_panel) { +of_node_put (panel_node); +return -ENODEV ; + } +of_node_put (panel_node); + }The following is simpler.
drivers/gpu/drm/exynos/exynos_dp_core.c static int exynos_dp_bind(struct device *dev, struct device *master, void *data) · line 1317
Quoted 6 lines
drivers/gpu/drm/exynos/exynos_dp_core.c +6
-0+if (panel_node) { + dp->drm_panel =of_drm_find_panel (panel_node); +of_node_put (panel_node); +if (!dp->drm_panel) +return -ENODEV ; + }
Right, will change it.
Quoted 9 lines
Best regards,
Jingoo HanReview
Quoted 5 lines
drivers/gpu/drm/exynos/exynos_dp_core.c +1
-0+exynos_dp_phy_init (dp);exynos_dp_init_dp (dp);(quoted diff) +0
-0
b/drivers/gpu/drm/exynos/exynos_dp_core.h
Quoted 15 lines
Quoted 12 lines
index 56fa43e..9dc7991 100644
drivers/gpu/drm/exynos/exynos_dp_core.h +1
-1@@ -148,6 +148,7 @@ struct exynos_dp_device {struct drm_device *drm_dev;struct drm_connector connector;struct drm_encoder *encoder; +struct drm_panel *drm_panel;struct clk *clock;unsigned int irq;void __iomem *reg_base; --Quoted 1 line
1.8.1.2
Thanks and regards,
Ajay Kumar
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 6/7 drm/bridge: ptn3460: enable polling based detection
In reply to Ajay KumarFrom: Rahul Sharma <[email protected]>
Add DRM_CONNECTOR_POLL_HPD to the set of connector flags while registering drm_connector for ptn3460.
--- drivers/gpu/drm/bridge/ptn3460.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/bridge/ptn3460.c +1 -0
@@ -326,6 +326,7 @@ int ptn3460_init(struct drm_device *dev, struct drm_encoder *encoder, bridge->driver_private = ptn_bridge; encoder->bridge = bridge; + ptn_bridge->connector.polled =DRM_CONNECTOR_POLL_HPD ; ret =drm_connector_init (dev, &ptn_bridge->connector, &ptn3460_connector_funcs,DRM_MODE_CONNECTOR_LVDS );
Signature · 1 line
1.8.1.2
PATCH 7/7 drm/bridge: ptn3460: add drm_panel controls
In reply to Ajay Kumarattach ptn3460 connector to drm_panel and support drm_panel routines, if a valid drm_panel object is passed to ptn3460_init.
--- drivers/gpu/drm/bridge/Kconfig | 1 + drivers/gpu/drm/bridge/ptn3460.c | 17 ++++++++++++++++- drivers/gpu/drm/exynos/exynos_dp_core.c | 15 +++++++++++---- include/drm/bridge/ptn3460.h | 6 ++++-- 4 files changed, 32 insertions(+), 7 deletions(-)
drivers/gpu/drm/bridge/Kconfig +1 -0
@@ -2,4 +2,5 @@ config DRM_PTN3460 tristate "PTN3460 DP/LVDS bridge" depends on DRM select DRM_KMS_HELPER + select DRM_PANEL ---help---
drivers/gpu/drm/bridge/ptn3460.c +16 -1
@@ -24,6 +24,7 @@#include "drm_edid.h" #include "drm_crtc.h" #include "drm_crtc_helper.h" +#include <drm/drm_panel.h> #include "bridge/ptn3460.h"
@@ -38,6 +39,7 @@ struct ptn3460_bridge {struct i2c_client *client;struct drm_encoder *encoder;struct drm_bridge *bridge; +struct drm_panel *panel;struct edid *edid;int gpio_pd_n;int gpio_rst_n;
@@ -126,6 +128,8 @@ static void ptn3460_pre_enable(struct drm_bridge *bridge)gpio_set_value (ptn_bridge->gpio_rst_n,1 ); } +drm_panel_pre_enable (ptn_bridge->panel); +/* * There's a bug in the PTN chip where it falsely asserts hotplug before * it is fully functional. We're forced to wait for the maximum start up
@@ -142,6 +146,9 @@ static void ptn3460_pre_enable(struct drm_bridge *bridge)static void ptn3460_enable (struct drm_bridge *bridge) { +struct ptn3460_bridge *ptn_bridge = bridge->driver_private; + +drm_panel_enable (ptn_bridge->panel); }static void ptn3460_disable (struct drm_bridge *bridge)
@@ -153,6 +160,8 @@ static void ptn3460_disable(struct drm_bridge *bridge) ptn_bridge->enabled = false; +drm_panel_disable (ptn_bridge->panel); +if (gpio_is_valid (ptn_bridge->gpio_rst_n))gpio_set_value (ptn_bridge->gpio_rst_n,1 );
@@ -265,7 +274,8 @@ struct drm_connector_funcs ptn3460_connector_funcs = { };int ptn3460_init (struct drm_device *dev,struct drm_encoder *encoder, -struct i2c_client *client,struct device_node *node) +struct i2c_client *client,struct device_node *node, +struct drm_panel *panel) {int ret;struct drm_bridge *bridge;
@@ -324,6 +334,11 @@ int ptn3460_init(struct drm_device *dev, struct drm_encoder *encoder, goto err; } +if (panel) { + ptn_bridge->panel = panel; +drm_panel_attach (ptn_bridge->panel, &ptn_bridge->connector); + } + bridge->driver_private = ptn_bridge; encoder->bridge = bridge; ptn_bridge->connector.polled =DRM_CONNECTOR_POLL_HPD ;
drivers/gpu/drm/exynos/exynos_dp_core.c +11 -4
@@ -989,13 +989,14 @@ static bool find_bridge(const char *compat, struct bridge_init *bridge)/* returns the number of bridges attached */ static int exynos_drm_attach_lcd_bridge (struct drm_device *dev, -struct drm_encoder *encoder) +struct drm_encoder *encoder,struct drm_panel *panel) {struct bridge_init bridge;int ret;if (find_bridge ("nxp,ptn3460" , &bridge)) { - ret =ptn3460_init (dev, encoder, bridge.client, bridge.node); + ret =ptn3460_init (dev, encoder, bridge.client, bridge.node, + panel);if (!ret)return 1 ; }
@@ -1012,9 +1013,15 @@ static int exynos_dp_create_connector(struct exynos_drm_display *display, dp->encoder = encoder;/* Pre-empt DP connector creation if there's a bridge */ - ret =exynos_drm_attach_lcd_bridge (dp->drm_dev, encoder); -if (ret) + ret =exynos_drm_attach_lcd_bridge (dp->drm_dev, encoder, dp->drm_panel); +if (ret) { +/* Also set "dp->drm_panel = NULL" so that we don't end up +* controlling panel power both in exynos_dp and bridge +* DPMS routines. +*/ + dp->drm_panel =NULL ;return 0 ; + } connector->polled =DRM_CONNECTOR_POLL_HPD ;
include/drm/bridge/ptn3460.h +4 -2
@@ -18,16 +18,18 @@ struct drm_device;struct drm_encoder ;struct i2c_client ;struct device_node ; +struct drm_panel ;#if defined(CONFIG_DRM_PTN3460 ) || defined(CONFIG_DRM_PTN3460_MODULE )int ptn3460_init (struct drm_device *dev,struct drm_encoder *encoder, -struct i2c_client *client,struct device_node *node); +struct i2c_client *client,struct device_node *node, +struct drm_panel *panel);#else static inline int ptn3460_init (struct drm_device *dev,struct drm_encoder *encoder,struct i2c_client *client, -struct device_node *node) +struct device_node *node,struct drm_panel *panel) {return 0 ; }
Signature · 1 line
1.8.1.2
Re: [PATCH 7/7] drm/bridge: ptn3460: add drm_panel controls
Quoted 27 lines · Ajay Kumar
attach ptn3460 connector to
drm_paneland supportdrm_panelroutines, if a validdrm_panelobject is passed toptn3460_init.Signed-off-by Ajay Kumar <[email protected]>--- drivers/gpu/drm/bridge/Kconfig | 1 + drivers/gpu/drm/bridge/ptn3460.c | 17 ++++++++++++++++- drivers/gpu/drm/exynos/exynos_dp_core.c | 15 +++++++++++---- include/drm/bridge/ptn3460.h | 6 ++++-- 4 files changed, 32 insertions(+), 7 deletions(-)drivers/gpu/drm/bridge/Kconfig +1
-0@@ -2,4 +2,5 @@ config DRM_PTN3460 tristate "PTN3460 DP/LVDS bridge" depends on DRM select DRM_KMS_HELPER + select DRM_PANEL ---help---drivers/gpu/drm/bridge/ptn3460.c +0
-0
drivers/gpu/drm/bridge/ptn3460.c line 27
Quoted 4 lines
drivers/gpu/drm/bridge/ptn3460.c +1
-0@@ -24,6 +24,7 @@#include "drm_edid.h" #include "drm_crtc.h" #include "drm_crtc_helper.h" +#include <drm/drm_panel.h>
Move '<drm/drm_panel.h>' as below.
#include <linux/gpio.h>
#include <linux/delay.h>
+#include <drm/drm_panel.h>
#include "drmP.h"
Quoted 69 lines
drivers/gpu/drm/bridge/ptn3460.c +15
-1#include "bridge/ptn3460.h" @@ -38,6 +39,7 @@ struct ptn3460_bridge {struct i2c_client *client;struct drm_encoder *encoder;struct drm_bridge *bridge; +struct drm_panel *panel;struct edid *edid;int gpio_pd_n;int gpio_rst_n;@@ -126,6 +128,8 @@ static void ptn3460_pre_enable(struct drm_bridge *bridge)gpio_set_value (ptn_bridge->gpio_rst_n,1 ); } +drm_panel_pre_enable (ptn_bridge->panel); +/* * There's a bug in the PTN chip where it falsely asserts hotplug before * it is fully functional. We're forced to wait for the maximum start up @@ -142,6 +146,9 @@ static void ptn3460_pre_enable(struct drm_bridge *bridge)static void ptn3460_enable (struct drm_bridge *bridge) { +struct ptn3460_bridge *ptn_bridge = bridge->driver_private; + +drm_panel_enable (ptn_bridge->panel); }static void ptn3460_disable (struct drm_bridge *bridge)@@ -153,6 +160,8 @@ static void ptn3460_disable(struct drm_bridge *bridge) ptn_bridge->enabled = false; +drm_panel_disable (ptn_bridge->panel); +if (gpio_is_valid (ptn_bridge->gpio_rst_n))gpio_set_value (ptn_bridge->gpio_rst_n,1 );@@ -265,7 +274,8 @@ struct drm_connector_funcs ptn3460_connector_funcs = { };int ptn3460_init (struct drm_device *dev,struct drm_encoder *encoder, -struct i2c_client *client,struct device_node *node) +struct i2c_client *client,struct device_node *node, +struct drm_panel *panel) {int ret;struct drm_bridge *bridge;@@ -324,6 +334,11 @@ int ptn3460_init(struct drm_device *dev, struct drm_encoder *encoder, goto err; } +if (panel) { + ptn_bridge->panel = panel; +drm_panel_attach (ptn_bridge->panel, &ptn_bridge->connector); + } + bridge->driver_private = ptn_bridge; encoder->bridge = bridge; ptn_bridge->connector.polled =DRM_CONNECTOR_POLL_HPD ;drivers/gpu/drm/exynos/exynos_dp_core.c +0
-0@@ -989,13 +989,14 @@ static bool find_bridge(const char *compat, struct bridge_init *bridge)/* returns the number of bridges attached */ static int exynos_drm_attach_lcd_bridge(struct drm_device *dev,
drivers/gpu/drm/exynos/exynos_dp_core.c static bool find_bridge(const char *compat, struct bridge_init *bridge) · line 999
Quoted 10 lines
drivers/gpu/drm/exynos/exynos_dp_core.c +3
-2- struct drm_encoder *encoder) + struct drm_encoder *encoder, struct drm_panel *panel) { struct bridge_init bridge;int ret;if (find_bridge ("nxp,ptn3460" , &bridge)) { - ret =ptn3460_init (dev, encoder, bridge.client, bridge.node); + ret =ptn3460_init (dev, encoder, bridge.client, bridge.node, + panel);
'panel' is too far. Please fix it as below.
if (find_bridge("nxp,ptn3460", &bridge)) {
ret = ptn3460_init(dev, encoder, bridge.client, bridge.node,
panel);Quoted 5 lines
drivers/gpu/drm/exynos/exynos_dp_core.c +0
-0if (!ret)return 1 ; }@@ -1012,9 +1013,15 @@ static int exynos_dp_create_connector(struct exynos_drm_display *display, dp->encoder = encoder;
drivers/gpu/drm/exynos/exynos_dp_core.c static int exynos_dp_create_connector(struct exynos_drm_display *display, · line 1021
Quoted 10 lines
drivers/gpu/drm/exynos/exynos_dp_core.c +6
-2/* Pre-empt DP connector creation if there's a bridge */ - ret =exynos_drm_attach_lcd_bridge (dp->drm_dev, encoder); -if (ret) + ret =exynos_drm_attach_lcd_bridge (dp->drm_dev, encoder, dp->drm_panel); +if (ret) { +/* Also set "dp->drm_panel = NULL" so that we don't end up +* controlling panel power both in exynos_dp and bridge +* DPMS routines. +*/
Please fix it as below.
+ /*
+ * Also set "dp->drm_panel = NULL" so that we don't end up
+ * controlling panel power both in exynos_dp and bridge
+ * DPMS routines.
+ */
Best regards,
Jingoo Han
Quoted 33 lines
drivers/gpu/drm/exynos/exynos_dp_core.c +2
-0+ dp->drm_panel =NULL ;return 0 ; + } connector->polled =DRM_CONNECTOR_POLL_HPD ;include/drm/bridge/ptn3460.h +4
-3@@ -18,16 +18,18 @@ struct drm_device;struct drm_encoder ;struct i2c_client ;struct device_node ; +struct drm_panel ;#if defined(CONFIG_DRM_PTN3460 ) || defined(CONFIG_DRM_PTN3460_MODULE )int ptn3460_init (struct drm_device *dev,struct drm_encoder *encoder, -struct i2c_client *client,struct device_node *node); +struct i2c_client *client,struct device_node *node, +struct drm_panel *panel);#else static inline int ptn3460_init (struct drm_device *dev,struct drm_encoder *encoder,struct i2c_client *client, -struct device_node *node) +struct device_node *node,struct drm_panel *panel) {return 0 ; } --1.8.1.2
Re: [PATCH 7/7] drm/bridge: ptn3460: add drm_panel controls
Hi Jingoo,
Quoted 203 lines · Jingoo Han
Quoted 5 lines · Ajay Kumar
attach ptn3460 connector to
drm_paneland supportdrm_panelroutines, if a validdrm_panelobject is passed toptn3460_init.Signed-off-by Ajay Kumar <[email protected]>Review
Quoted 8 lines
--- drivers/gpu/drm/bridge/Kconfig | 1 + drivers/gpu/drm/bridge/ptn3460.c | 17 ++++++++++++++++- drivers/gpu/drm/exynos/exynos_dp_core.c | 15 +++++++++++---- include/drm/bridge/ptn3460.h | 6 ++++-- 4 files changed, 32 insertions(+), 7 deletions(-)(quoted diff) +0
-0b/drivers/gpu/drm/bridge/Kconfig
Review
Quoted 10 lines
index 884923f..3bc6845 100644
drivers/gpu/drm/bridge/Kconfig +1
-0@@ -2,4 +2,5 @@ config DRM_PTN3460 tristate "PTN3460 DP/LVDS bridge" depends on DRM select DRM_KMS_HELPER + select DRM_PANEL ---help---(quoted diff) +0
-0
b/drivers/gpu/drm/bridge/ptn3460.cdrivers/gpu/drm/bridge/ptn3460.c line 27
Quoted 8 lines
index f1d2afc..736c7a8 100644
drivers/gpu/drm/bridge/ptn3460.c +1
-0@@ -24,6 +24,7 @@#include "drm_edid.h" #include "drm_crtc.h" #include "drm_crtc_helper.h" +#include <drm/drm_panel.h> Move '<
drm/drm_panel.h>' as below.#include <
linux/gpio.h>
#include <linux/delay.h>
+#include <drm/drm_panel.h>#include "
drmP.h"drivers/gpu/drm/bridge/ptn3460.c static void ptn3460_pre_enable(struct drm_bridge
Quoted 12 lines
drivers/gpu/drm/bridge/ptn3460.c +1
-0#include "bridge/ptn3460.h" @@ -38,6 +39,7 @@ struct ptn3460_bridge {struct i2c_client *client;struct drm_encoder *encoder;struct drm_bridge *bridge; +struct drm_panel *panel;struct edid *edid;int gpio_pd_n;int gpio_rst_n;@@ -126,6 +128,8 @@ static void ptn3460_pre_enable(struct drm_bridge*bridge)
drivers/gpu/drm/bridge/ptn3460.c static void ptn3460_pre_enable(struct drm_bridge *bridge)
Quoted 7 lines
drivers/gpu/drm/bridge/ptn3460.c +2
-0gpio_set_value (ptn_bridge->gpio_rst_n,1 ); } +drm_panel_pre_enable (ptn_bridge->panel); +/* * There's a bug in the PTN chip where it falsely asserts hotplug before
drivers/gpu/drm/bridge/ptn3460.c static void ptn3460_pre_enable(struct drm_bridge · line 135
Quoted 1 line
drivers/gpu/drm/bridge/ptn3460.c +0
-0* it is fully functional. We're forced to wait for the maximum start up
drivers/gpu/drm/bridge/ptn3460.c static void ptn3460_pre_enable(struct drm_bridge
Quoted 1 line
drivers/gpu/drm/bridge/ptn3460.c +0
-0@@ -142,6 +146,9 @@ static void ptn3460_pre_enable(struct drm_bridge*bridge)
drivers/gpu/drm/bridge/ptn3460.c static void ptn3460_disable(struct drm_bridge
Quoted 10 lines
drivers/gpu/drm/bridge/ptn3460.c +3
-0static void ptn3460_enable (struct drm_bridge *bridge) { +struct ptn3460_bridge *ptn_bridge = bridge->driver_private; + +drm_panel_enable (ptn_bridge->panel); }static void ptn3460_disable (struct drm_bridge *bridge)@@ -153,6 +160,8 @@ static void ptn3460_disable(struct drm_bridge*bridge)
drivers/gpu/drm/bridge/ptn3460.c struct drm_connector_funcs ptn3460_connector_funcs =
Quoted 9 lines
drivers/gpu/drm/bridge/ptn3460.c +2
-0ptn_bridge->enabled = false; +drm_panel_disable (ptn_bridge->panel); +if (gpio_is_valid (ptn_bridge->gpio_rst_n))gpio_set_value (ptn_bridge->gpio_rst_n,1 );@@ -265,7 +274,8 @@ struct drm_connector_funcs ptn3460_connector_funcs ={
drivers/gpu/drm/bridge/ptn3460.c int ptn3460_init(struct drm_device *dev, struct
Quoted 10 lines
drivers/gpu/drm/bridge/ptn3460.c +2
-1};int ptn3460_init (struct drm_device *dev,struct drm_encoder *encoder, -struct i2c_client *client,struct device_node *node) +struct i2c_client *client,struct device_node *node, +struct drm_panel *panel) {int ret;struct drm_bridge *bridge;@@ -324,6 +334,11 @@ int ptn3460_init(struct drm_device *dev, struct
drm_encoder*encoder,drivers/gpu/drm/bridge/ptn3460.c int ptn3460_init(struct drm_device *dev, struct drm_encoder *encoder,
Quoted 6 lines
drivers/gpu/drm/bridge/ptn3460.c +3
-0goto err; } +if (panel) { + ptn_bridge->panel = panel; + drm_panel_attach(ptn_bridge->panel,
&ptn_bridge->connector);Review
Quoted 6 lines
drivers/gpu/drm/bridge/ptn3460.c +2
-0+ } + bridge->driver_private = ptn_bridge; encoder->bridge = bridge; ptn_bridge->connector.polled =DRM_CONNECTOR_POLL_HPD ;(quoted diff) +0
-0
b/drivers/gpu/drm/exynos/exynos_dp_core.cdrivers/gpu/drm/exynos/exynos_dp_core.c static bool find_bridge(const char *compat, struct
Quoted 4 lines
index 6beeab6..7f550b6 100644
drivers/gpu/drm/exynos/exynos_dp_core.c +0
-0@@ -989,13 +989,14 @@ static bool find_bridge(const char *compat, struct
bridge_init*bridge)drivers/gpu/drm/exynos/exynos_dp_core.c static bool find_bridge(const char *compat, struct bridge_init *bridge)
Quoted 11 lines
drivers/gpu/drm/exynos/exynos_dp_core.c +1
-2/* returns the number of bridges attached */ static int exynos_drm_attach_lcd_bridge (struct drm_device *dev, -struct drm_encoder *encoder) +struct drm_encoder *encoder,struct drm_panel *panel) {struct bridge_init bridge;int ret;if (find_bridge ("nxp,ptn3460" , &bridge)) { - ret = ptn3460_init(dev, encoder, bridge.client,bridge.node);
drivers/gpu/drm/exynos/exynos_dp_core.c static bool find_bridge(const char *compat, struct · line 997
Quoted 1 line
drivers/gpu/drm/exynos/exynos_dp_core.c +1
-0+ ret = ptn3460_init(dev, encoder, bridge.client,bridge.node,
drivers/gpu/drm/exynos/exynos_dp_core.c static bool find_bridge(const char *compat, struct · line 998
Quoted 1 line
drivers/gpu/drm/exynos/exynos_dp_core.c +1
-0+panel);
'panel' is too far. Please fix it as below.
if (
find_bridge("nxp,ptn3460", &bridge)) {
ret = ptn3460_init(dev, encoder, bridge.client,
bridge.node,panel);Ok.
drivers/gpu/drm/exynos/exynos_dp_core.c static int exynos_dp_create_connector(struct
Quoted 4 lines
drivers/gpu/drm/exynos/exynos_dp_core.c +0
-0if (!ret)return 1 ; }@@ -1012,9 +1013,15 @@ static int exynos_dp_create_connector(struct
exynos_drm_display*display,drivers/gpu/drm/exynos/exynos_dp_core.c static int exynos_dp_create_connector(struct exynos_drm_display *display,
Quoted 6 lines
drivers/gpu/drm/exynos/exynos_dp_core.c +1
-2dp->encoder = encoder;/* Pre-empt DP connector creation if there's a bridge */ - ret =exynos_drm_attach_lcd_bridge (dp->drm_dev, encoder); -if (ret) + ret = exynos_drm_attach_lcd_bridge(dp->drm_dev, encoder,
dp->drm_panel);drivers/gpu/drm/exynos/exynos_dp_core.c static int exynos_dp_create_connector(struct exynos_drm_display *display, · line 1021
Quoted 5 lines
drivers/gpu/drm/exynos/exynos_dp_core.c +5
-0+if (ret) { +/* Also set "dp->drm_panel = NULL" so that we don't end up +* controlling panel power both in exynos_dp and bridge +* DPMS routines. +*/ Please fix it as below.
+ /*
+ * Also set "dp->drm_panel = NULL" so that we don't end up + * controlling panel power both in exynos_dp and bridge + * DPMS routines. + */Right. I used wrong style for commenting!
Best regards,
Jingoo HanQuoted 24 lines
drivers/gpu/drm/exynos/exynos_dp_core.c +2
-0+ dp->drm_panel =NULL ;return 0 ; + } connector->polled =DRM_CONNECTOR_POLL_HPD ;include/drm/bridge/ptn3460.h +3
-1@@ -18,16 +18,18 @@ struct drm_device;struct drm_encoder ;struct i2c_client ;struct device_node ; +struct drm_panel ;#if defined(CONFIG_DRM_PTN3460 ) || defined(CONFIG_DRM_PTN3460_MODULE )int ptn3460_init (struct drm_device *dev,struct drm_encoder *encoder, -struct i2c_client *client,struct device_node *node); +struct i2c_client *client,struct device_node *node, +struct drm_panel *panel);#else
Quoted 11 lines
Quoted 9 lines
include/drm/bridge/ptn3460.h +1
-2static inline int ptn3460_init (struct drm_device *dev,struct drm_encoder *encoder,struct i2c_client *client, -struct device_node *node) +struct device_node *node,struct drm_panel *panel) {return 0 ; } --1.8.1.2
Thanks and regards,
Ajay Kumar
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel