Linux-ACPI Archive on
 help / color / Atom feed
From: Hans de Goede <>
To: Jani Nikula <>,
	Linus Walleij <>
Cc: "Joonas Lahtinen" <>,
	"Rodrigo Vivi" <>,
	"Ville Syrjälä" <>,
	"Mika Westerberg" <>,
	"Andy Shevchenko" <>,
	"Bartosz Golaszewski" <>,
	intel-gfx <>,
	"open list:DRM PANEL DRIVERS" <>,
	"open list:GPIO SUBSYSTEM" <>,
	"ACPI Devel Maling List" <>
Subject: Re: [PATCH 2/2] drm/i915/vlv_dsi: Control panel and backlight enable GPIOs on BYT
Date: Mon, 2 Dec 2019 16:49:18 +0100
Message-ID: <> (raw)
In-Reply-To: <>


On 02-12-2019 12:53, Jani Nikula wrote:
> On Mon, 02 Dec 2019, Linus Walleij <> wrote:
>> Hi Hans,
>> thank you for your patch!
>> On Fri, Nov 29, 2019 at 7:58 PM Hans de Goede <> wrote:
>>> -       /* GPIO Desc for CRC based Panel control */
>>> +       /* GPIO Desc for panel and backlight control */
>>>          struct gpio_desc *gpio_panel;
>>> +       struct gpio_desc *gpio_backlight;
>> I think what happens here is that you reimplement
>> drivers/video/backlight/gpio_backlight.c
>> The existing power control GPIO also reimplements
>> drivers/regulator/fixed.c in a sense but I am under the
>> impression that x86 in general and ACPI in particular
>> has a problem with the regulator subsystem so I am
>> uncertain about that one.
>> When I look at the code I get more confused because
>> nominally panels should have their own drivers in
>> drivers/gpu/drm/panel/* especially DSI panels, and the
>> panels control their own GPIOs or regulators for power
>> and backlight.
>> I was under the impression that Heikki's and Dmitry's
>> recent additions to software nodes would make it
>> possible to actually spawn devices like the GPIO backlight
>> and/or fixed regulator and put references to them so
>> that the drivers can pick them up from the respective
>> frameworks and manage them?
>> Maybe I misunderstood things here though, I am a bit
>> under the impression that elder DRM drivers are
>> considered "elder gods" and do not need to use separate
>> panel drivers, backlight abstraction etc, and in that
>> case just go ahead, I guess.
>> But I suspect some separation
>> would help the day the i915 driver wants to reuse some
>> really complex DSI panel from drivers/gpu/drm/panel/*
>> though.
> Sadly I don't think that's going to happen, though.
> For i915 the panels are described by VBT, or Video BIOS Tables. We don't
> really know the make or model of the panels, we just get the timings and
> sequences etc. from there. There's no info to probe a separate panel
> driver. So we just have a "generic" DSI driver that's part of i915 which
> uses the data from the VBT to drive all the possible panels.
> We do use some of the drm DSI framework as a library to abstract things
> a bit better, but that's about it.
> The sequences should include details about GPIOs to toggle as well, so
> in that sense I feel like the gpio calls should be bolted there.

Hmm, yes that makes sense, the problem really is that the VBT sequences
for DSI panels on BYT are incomplete (*) and the MIPI_SEQ_POWER_ON / _OFF
and MIPI_SEQ_BACKLIGHT_ON / _OFF sequences do not containt the
"instructions" to toggle the panel-enable, resp. backlight enable
GPIOs as they do on CHT and newer devices.

So if we see all this of a shortcoming of the VBT tables, then it makes
sense to move all special handling for this to intel_dsi_vbt.c, so we
put the adding of the lookup table, the getting of the pins and the
controlling of the pins all in there.

Jani, is that what you have in mind ?

This would also solve the problem of Linus and Andy not liking the
polution of the pinctrl driver with the adding of the platform
specific lookups; and then we could only add the lookups when the
VBT says the SoC is used for backlight control, leaving things
as is (not even adding the lookups) when the PMIC is used for
backlight control.

There is only one problem, currently is is not possible to
unregister a mapping added with pinctrl_register_mappings
and the i915 driver is typically a module which can be unloaded
and I believe actually is unloaded as part of the i915 CI.

pinctrl_register_mappings copies the passed in mapping, but
it is a shallow copy, so it contains pointers to the modules
const segment and we do not want to re-add another copy of
the mapping when the module loads a second time.

Fixing this is easy though, there already is a pinctrl_unregister_map()
function, we just need to export it so that the i915 driver can
remove the mapping when it is unbound.

Linus would exporting this function be ok with you?

Linus, question what is the purpose of the "dupping" / shallow
copying of the argument passed to pinctrl_register_map ? Since
it is shallow the mem for any pointers contained within there need
to be kept around by the caller, so why not let the caller keep
the pinctrl_map struct itself around too?

If we are going to export pinctrl_unregister_map() we need to make it
do the right thing for dupped maps too, we can just store the dup flag
in struct pinctrl_maps. So this is easy, but I wonder if we cannot
get rid of the dupping all together ?



*) I suspect these are all version 2 VBT sequences (I guess I should check
this) and according to the comment in vlv_dsi.c which documents the sequences,
for v2 these sequences are not used, e.g. instead of executing the
MIPIPanelPowerOn sequence the "panel-on" step is described simply as "power on".
and the MIPIBacklightOn/Off sequences are described as being VBT v3+ only

  reply index

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-29 18:58 [PATCH 0/2] " Hans de Goede
2019-11-29 18:58 ` [PATCH 1/2] pinctrl: baytrail: Add GPIO lookup and pinctrl-map for i915 DSI panel ctrl Hans de Goede
2019-12-02 11:39   ` Linus Walleij
2019-12-02 13:09   ` Andy Shevchenko
2019-11-29 18:58 ` [PATCH 2/2] drm/i915/vlv_dsi: Control panel and backlight enable GPIOs on BYT Hans de Goede
2019-12-02 11:21   ` Linus Walleij
2019-12-02 11:53     ` Jani Nikula
2019-12-02 15:49       ` Hans de Goede [this message]
2019-12-11  0:24         ` Linus Walleij
2019-12-11 17:32           ` Hans de Goede
2019-11-29 20:07 ` [PATCH 0/2] " Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \ \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-ACPI Archive on

Archives are clonable:
	git clone --mirror linux-acpi/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-acpi linux-acpi/ \
	public-inbox-index linux-acpi

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone