2021-05-30 15:59:54

by Rajeev Nandan

[permalink] [raw]
Subject: [v5 2/5] drm/panel-simple: Support DP AUX backlight

If there is no backlight specified in the device tree and the panel
has access to the DP AUX channel then create a DP AUX backlight if
supported by the panel.

Signed-off-by: Rajeev Nandan <[email protected]>
---

This patch depends on [1] (drm/panel: panel-simple: Stash DP AUX bus;
allow using it for DDC) and the previous patch (2/5) of this series.

Changes in v4:
- New

Changes in v5:
- Address review comments and move backlight functions to drm_panel.c (Douglas)
- Create and register DP AUX backlight if there is no backlight specified in the
device tree and panel has the DP AUX channel. (Douglas)
- The new drm_panel_dp_aux_backlight() will do the drm_edp_backlight_supported() check.

[1] https://lore.kernel.org/dri-devel/20210524165920.v8.7.I18e60221f6d048d14d6c50a770b15f356fa75092@changeid/

drivers/gpu/drm/panel/panel-simple.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
index b09be6e..047fad5 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -800,6 +800,12 @@ static int panel_simple_probe(struct device *dev, const struct panel_desc *desc,
if (err)
goto disable_pm_runtime;

+ if (!panel->base.backlight && panel->aux) {
+ err = drm_panel_dp_aux_backlight(&panel->base, panel->aux);
+ if (err)
+ goto disable_pm_runtime;
+ }
+
drm_panel_add(&panel->base);

return 0;
--
2.7.4


2021-05-30 19:28:13

by kernel test robot

[permalink] [raw]
Subject: Re: [v5 2/5] drm/panel-simple: Support DP AUX backlight

Hi Rajeev,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on drm-intel/for-linux-next]
[also build test ERROR on drm-tip/drm-tip drm-exynos/exynos-drm-next tegra-drm/drm/tegra/for-next linus/master v5.13-rc3 next-20210528]
[cannot apply to drm/drm-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Rajeev-Nandan/drm-Support-basic-DPCD-backlight-in-panel-simple-and-add-a-new-panel-ATNA33XC20/20210530-235810
base: git://anongit.freedesktop.org/drm-intel for-linux-next
config: x86_64-randconfig-a006-20210530 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project bc6799f2f79f0ae87e9f1ebf9d25ba799fbd25a9)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://github.com/0day-ci/linux/commit/fedf88beabe2c179d593bbb61ff5df62ac909fa1
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Rajeev-Nandan/drm-Support-basic-DPCD-backlight-in-panel-simple-and-add-a-new-panel-ATNA33XC20/20210530-235810
git checkout fedf88beabe2c179d593bbb61ff5df62ac909fa1
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

All errors (new ones prefixed by >>):

>> drivers/gpu/drm/panel/panel-simple.c:796:39: error: no member named 'aux' in 'struct panel_simple'
if (!panel->base.backlight && panel->aux) {
~~~~~ ^
include/linux/compiler.h:56:47: note: expanded from macro 'if'
#define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
^~~~
include/linux/compiler.h:58:52: note: expanded from macro '__trace_if_var'
#define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
^~~~
>> drivers/gpu/drm/panel/panel-simple.c:796:39: error: no member named 'aux' in 'struct panel_simple'
if (!panel->base.backlight && panel->aux) {
~~~~~ ^
include/linux/compiler.h:56:47: note: expanded from macro 'if'
#define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
^~~~
include/linux/compiler.h:58:61: note: expanded from macro '__trace_if_var'
#define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
^~~~
>> drivers/gpu/drm/panel/panel-simple.c:796:39: error: no member named 'aux' in 'struct panel_simple'
if (!panel->base.backlight && panel->aux) {
~~~~~ ^
include/linux/compiler.h:56:47: note: expanded from macro 'if'
#define if(cond, ...) if ( __trace_if_var( !!(cond , ## __VA_ARGS__) ) )
^~~~
include/linux/compiler.h:58:86: note: expanded from macro '__trace_if_var'
#define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
^~~~
include/linux/compiler.h:69:3: note: expanded from macro '__trace_if_value'
(cond) ? \
^~~~
drivers/gpu/drm/panel/panel-simple.c:797:57: error: no member named 'aux' in 'struct panel_simple'
err = drm_panel_dp_aux_backlight(&panel->base, panel->aux);
~~~~~ ^
4 errors generated.


vim +796 drivers/gpu/drm/panel/panel-simple.c

659
660 static int panel_simple_probe(struct device *dev, const struct panel_desc *desc)
661 {
662 struct panel_simple *panel;
663 struct display_timing dt;
664 struct device_node *ddc;
665 int connector_type;
666 u32 bus_flags;
667 int err;
668
669 panel = devm_kzalloc(dev, sizeof(*panel), GFP_KERNEL);
670 if (!panel)
671 return -ENOMEM;
672
673 panel->enabled = false;
674 panel->prepared_time = 0;
675 panel->desc = desc;
676
677 panel->no_hpd = of_property_read_bool(dev->of_node, "no-hpd");
678 if (!panel->no_hpd) {
679 err = panel_simple_get_hpd_gpio(dev, panel);
680 if (err)
681 return err;
682 }
683
684 panel->supply = devm_regulator_get(dev, "power");
685 if (IS_ERR(panel->supply))
686 return PTR_ERR(panel->supply);
687
688 panel->enable_gpio = devm_gpiod_get_optional(dev, "enable",
689 GPIOD_OUT_LOW);
690 if (IS_ERR(panel->enable_gpio)) {
691 err = PTR_ERR(panel->enable_gpio);
692 if (err != -EPROBE_DEFER)
693 dev_err(dev, "failed to request GPIO: %d\n", err);
694 return err;
695 }
696
697 err = of_drm_get_panel_orientation(dev->of_node, &panel->orientation);
698 if (err) {
699 dev_err(dev, "%pOF: failed to get orientation %d\n", dev->of_node, err);
700 return err;
701 }
702
703 ddc = of_parse_phandle(dev->of_node, "ddc-i2c-bus", 0);
704 if (ddc) {
705 panel->ddc = of_find_i2c_adapter_by_node(ddc);
706 of_node_put(ddc);
707
708 if (!panel->ddc)
709 return -EPROBE_DEFER;
710 }
711
712 if (desc == &panel_dpi) {
713 /* Handle the generic panel-dpi binding */
714 err = panel_dpi_probe(dev, panel);
715 if (err)
716 goto free_ddc;
717 } else {
718 if (!of_get_display_timing(dev->of_node, "panel-timing", &dt))
719 panel_simple_parse_panel_timing_node(dev, panel, &dt);
720 }
721
722 connector_type = desc->connector_type;
723 /* Catch common mistakes for panels. */
724 switch (connector_type) {
725 case 0:
726 dev_warn(dev, "Specify missing connector_type\n");
727 connector_type = DRM_MODE_CONNECTOR_DPI;
728 break;
729 case DRM_MODE_CONNECTOR_LVDS:
730 WARN_ON(desc->bus_flags &
731 ~(DRM_BUS_FLAG_DE_LOW |
732 DRM_BUS_FLAG_DE_HIGH |
733 DRM_BUS_FLAG_DATA_MSB_TO_LSB |
734 DRM_BUS_FLAG_DATA_LSB_TO_MSB));
735 WARN_ON(desc->bus_format != MEDIA_BUS_FMT_RGB666_1X7X3_SPWG &&
736 desc->bus_format != MEDIA_BUS_FMT_RGB888_1X7X4_SPWG &&
737 desc->bus_format != MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA);
738 WARN_ON(desc->bus_format == MEDIA_BUS_FMT_RGB666_1X7X3_SPWG &&
739 desc->bpc != 6);
740 WARN_ON((desc->bus_format == MEDIA_BUS_FMT_RGB888_1X7X4_SPWG ||
741 desc->bus_format == MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA) &&
742 desc->bpc != 8);
743 break;
744 case DRM_MODE_CONNECTOR_eDP:
745 if (desc->bus_format == 0)
746 dev_warn(dev, "Specify missing bus_format\n");
747 if (desc->bpc != 6 && desc->bpc != 8)
748 dev_warn(dev, "Expected bpc in {6,8} but got: %u\n", desc->bpc);
749 break;
750 case DRM_MODE_CONNECTOR_DSI:
751 if (desc->bpc != 6 && desc->bpc != 8)
752 dev_warn(dev, "Expected bpc in {6,8} but got: %u\n", desc->bpc);
753 break;
754 case DRM_MODE_CONNECTOR_DPI:
755 bus_flags = DRM_BUS_FLAG_DE_LOW |
756 DRM_BUS_FLAG_DE_HIGH |
757 DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE |
758 DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE |
759 DRM_BUS_FLAG_DATA_MSB_TO_LSB |
760 DRM_BUS_FLAG_DATA_LSB_TO_MSB |
761 DRM_BUS_FLAG_SYNC_SAMPLE_POSEDGE |
762 DRM_BUS_FLAG_SYNC_SAMPLE_NEGEDGE;
763 if (desc->bus_flags & ~bus_flags)
764 dev_warn(dev, "Unexpected bus_flags(%d)\n", desc->bus_flags & ~bus_flags);
765 if (!(desc->bus_flags & bus_flags))
766 dev_warn(dev, "Specify missing bus_flags\n");
767 if (desc->bus_format == 0)
768 dev_warn(dev, "Specify missing bus_format\n");
769 if (desc->bpc != 6 && desc->bpc != 8)
770 dev_warn(dev, "Expected bpc in {6,8} but got: %u\n", desc->bpc);
771 break;
772 default:
773 dev_warn(dev, "Specify a valid connector_type: %d\n", desc->connector_type);
774 connector_type = DRM_MODE_CONNECTOR_DPI;
775 break;
776 }
777
778 dev_set_drvdata(dev, panel);
779
780 /*
781 * We use runtime PM for prepare / unprepare since those power the panel
782 * on and off and those can be very slow operations. This is important
783 * to optimize powering the panel on briefly to read the EDID before
784 * fully enabling the panel.
785 */
786 pm_runtime_enable(dev);
787 pm_runtime_set_autosuspend_delay(dev, 1000);
788 pm_runtime_use_autosuspend(dev);
789
790 drm_panel_init(&panel->base, dev, &panel_simple_funcs, connector_type);
791
792 err = drm_panel_of_backlight(&panel->base);
793 if (err)
794 goto disable_pm_runtime;
795
> 796 if (!panel->base.backlight && panel->aux) {
797 err = drm_panel_dp_aux_backlight(&panel->base, panel->aux);
798 if (err)
799 goto disable_pm_runtime;
800 }
801
802 drm_panel_add(&panel->base);
803
804 return 0;
805
806 disable_pm_runtime:
807 pm_runtime_disable(dev);
808 free_ddc:
809 if (panel->ddc)
810 put_device(&panel->ddc->dev);
811
812 return err;
813 }
814

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]


Attachments:
(No filename) (9.95 kB)
.config.gz (40.61 kB)
Download all attachments

2021-06-03 00:10:51

by Doug Anderson

[permalink] [raw]
Subject: Re: [v5 2/5] drm/panel-simple: Support DP AUX backlight

Hi,

On Sun, May 30, 2021 at 8:57 AM Rajeev Nandan <[email protected]> wrote:
>
> If there is no backlight specified in the device tree and the panel
> has access to the DP AUX channel then create a DP AUX backlight if
> supported by the panel.
>
> Signed-off-by: Rajeev Nandan <[email protected]>
> ---
>
> This patch depends on [1] (drm/panel: panel-simple: Stash DP AUX bus;
> allow using it for DDC) and the previous patch (2/5) of this series.
>
> Changes in v4:
> - New
>
> Changes in v5:
> - Address review comments and move backlight functions to drm_panel.c (Douglas)
> - Create and register DP AUX backlight if there is no backlight specified in the
> device tree and panel has the DP AUX channel. (Douglas)
> - The new drm_panel_dp_aux_backlight() will do the drm_edp_backlight_supported() check.
>
> [1] https://lore.kernel.org/dri-devel/20210524165920.v8.7.I18e60221f6d048d14d6c50a770b15f356fa75092@changeid/
>
> drivers/gpu/drm/panel/panel-simple.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
> index b09be6e..047fad5 100644
> --- a/drivers/gpu/drm/panel/panel-simple.c
> +++ b/drivers/gpu/drm/panel/panel-simple.c
> @@ -800,6 +800,12 @@ static int panel_simple_probe(struct device *dev, const struct panel_desc *desc,
> if (err)
> goto disable_pm_runtime;
>
> + if (!panel->base.backlight && panel->aux) {
> + err = drm_panel_dp_aux_backlight(&panel->base, panel->aux);
> + if (err)
> + goto disable_pm_runtime;
> + }

It's so nice now!

Reviewed-by: Douglas Anderson <[email protected]>