Welcome to Soft32 Linux Forums!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Backlight device class redesign

 
   Soft32 Home -> Linux -> Kernel RSS
Next:  Problem? intel_iommu=off; perf top shows acpi_os_..  
Author Message
Rafał Miłecki

External


Since: Aug 26, 2009
Posts: 15



(Msg. 1) Posted: Sat Nov 28, 2009 1:40 am
Post subject: Backlight device class redesign
Archived from groups: linux>kernel (more info?)

As discussed in http://marc.info/?t=124947671300008&r=1&w=2 we need to
redesign our backlight device class. If you wish you can read whole
thread and even http://bugs.freedesktop.org/show_bug.cgi?id=20963 but
I'll try to summarize everything anyway.

1) One display can be controlled (I mean backlight) in more than one
way. For example: ACPI, something platform-specific and GPU encoder.
2) Exporting many ways of controlling one display at the same time
drives us to inconsistencies.
3) We have to decide some priority like: ACPI > platform > GPU
4) We have to keep list of all registered controllers for one display.
We can not just unregister lower prioritised as we will hit problem
after (for example) unloading acpi module.
5) We should not export more than one way and let userspace decide.

Currently we keep all registered controllers in /sys/class/backlgiht/
without any grouping per display or per anything. We can not use
grouping per GPU (as somewhere proposed) because one GPU can control
(for example) two PANELS and TV - 3 displays needing backlight
management. The most obvious and stable solution seems to be grouping
per display.

So staying with idea of grouping per display I tried to imagine the
most crazy notebook with external displays configuration we should
handle. Let's consider following displays in notebook (yes, two
panel-notebook!):
1) PANEL#A controlled by ACPI + platform-specific + GPU
2) PANEL#B controlled by ACPI + platform-specific
3) TV connected by S-VIDEO controlled by GPU
4) LCD#A connected by USB controlled by LCD-specific driver
5) LCD#B connected by USB controlled by LCD-specific driver (same
model as LCD#A, driven by the same driver)

Let's do reverse order:
a) For two USB-LCDs driver should generate two other names. Depends on
properties received from LCD that could be serial number or usb port
number. So we would get /sys/class/lcd-vendor-0000:00:1d.2 and
/sys/class/lcd-vendor-0000:00:a3.5
b) For TV gpu kernel module would use name with GPU card number and
output name. Let's say /sys/class/card0-svideo
c) The most complicated case is for PANELs. We have to pick up same
names in: ACPI, platform-specific and GPU driver. For most cases,
which means notebooks with one panel, we could just use "panel".
However I do not want to redesign this after year when we get more
notebooks with two PANELs. So do you have any idea about this? How we
could generate correct names in 3 almost unrelated modules (ACPI,
platform, GPU driver)? We should end with something like
/sys/class/internal-panel-1 and /sys/class/internal-panel-2 but that
won't be so easy. Any ideas?

Please use "Reply to all", as I do cross-ML-post and I am not
subscribed to LKML.

--
Rafał
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo DeleteThis @vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
Henrique de Moraes Holsch

External


Since: Nov 06, 2006
Posts: 136



(Msg. 2) Posted: Sat Nov 28, 2009 11:20 am
Post subject: Re: Backlight device class redesign [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Sat, 28 Nov 2009, Rafa?? Mi??ecki wrote:
> > Meanwhile, I'd like a LOT to know how I could parent the backlight device I
> > export in a platform driver to the correct PCI or ACPI device for the main
> > GPU...
>
> Is actually "parent" used for something? I can see it used in many
> modules, but not sure where we use that pointer (if we do).

For one, you get symlinks in sysfs, which would let userspace know what
backlight is related to what PCI/video/whatever device.

--
"One disk to rule them all, One disk to find them. One disk to bring
them all and in the darkness grind them. In the Land of Redmond
where the shadows lie." -- The Silicon Valley Tarot
Henrique Holschuh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo.DeleteThis@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
Rafał Miłecki

External


Since: Aug 26, 2009
Posts: 15



(Msg. 3) Posted: Sat Nov 28, 2009 11:40 am
Post subject: Re: Backlight device class redesign [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

W dniu 28 listopada 2009 01:30 użytkownik Rafał Miłecki
<zajec5.RemoveThis@gmail.com> napisał:
> Currently we keep all registered controllers in /sys/class/backlgiht/
> without any grouping per display or per anything. We can not use
> grouping per GPU (as somewhere proposed) because one GPU can control
> (for example) two PANELS and TV - 3 displays needing backlight
> management. The most obvious and stable solution seems to be grouping
> per display.

Just in case I was not clear enough. We should make ACPI, platform and
GPU drivers register same panel backlight control under same name like
"panel-0". Backlight class device would create
/sys/class/backlight/panel-0 only. When touching files in this
backlight/panel-0/, blacklight class would call functions from the
most proper (ACPI > platform > GPU) driver.

I thought if we could use card number for anything. I recalled that
notebooks with hybrid gpu, where system should switch between weaker
and more powerful GPU watching load. In case of that notebooks PANEL
can be controlled by both: card0 and card1.

So finally I think we should just register panel0 by default
everywhere. And in future we could add some quirks in drivers (ACPI,
platform, GPU) that would register panel1, panel2... for such devices.

Any comments? Should I work on something like specified above?

--
Rafał
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo.RemoveThis@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
Rafał Miłecki

External


Since: Aug 26, 2009
Posts: 15



(Msg. 4) Posted: Sat Nov 28, 2009 2:00 pm
Post subject: Re: Backlight device class redesign [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

2009/11/28 Henrique de Moraes Holschuh <hmh.TakeThisOut@hmh.eng.br>:
> Backlight maintainer added to CC.

Thanks, I should have done that.

> On Sat, 28 Nov 2009, Rafa?? Mi??ecki wrote:
>> W dniu 28 listopada 2009 01:30 u??ytkownik Rafa?? Mi??ecki
>> <zajec5.TakeThisOut@gmail.com> napisa??:
>> > Currently we keep all registered controllers in /sys/class/backlgiht/
>> > without any grouping per display or per anything. We can not use
>> > grouping per GPU (as somewhere proposed) because one GPU can control
>> > (for example) two PANELS and TV - 3 displays needing backlight
>> > management. The most obvious and stable solution seems to be grouping
>> > per display.
>>
>> Just in case I was not clear enough. We should make ACPI, platform and
>> GPU drivers register same panel backlight control under same name like
>> "panel-0". Backlight class device would create
>> /sys/class/backlight/panel-0 only. When touching files in this
>> backlight/panel-0/, blacklight class would call functions from the
>> most proper (ACPI > platform > GPU) driver.
>>
>
> I once suggested some sort of multiplexer backlight device that would do
> exactly that.  Various drivers (platform, ACPI, display) would register
> backends and specify some sort of dynamic preference so that the kernel
> would have a good bet on the default one, and userspace could switch the
> active backend later if it wanted.
>
> In this case, we'd have to specify properties or some other way to group the
> backends properly and to easily let userspace find the backlight device it
> needs to drive a specific device.

I described my idea of solution at end (cat/echo method).


>> I thought if we could use card number for anything. I recalled that
>> notebooks with hybrid gpu, where system should switch between weaker
>> and more powerful GPU watching load. In case of that notebooks PANEL
>> can be controlled by both: card0 and card1.
>
> That would require backends to be able to runtime register and unregister
> themselves with the main backlight device, and that they hook somehow on the
> hotplug stuff, to know when to bind/unbind along with the GPU.

Don't see anything problematic here. First of course we would have to
support GPU switching, but backlight should not be any issue. When
switching from ATI do Intel just unregister backlight device in ATI
and register backlight device in Intel. Both drivers should register
under the same name like "panel0" or sth.


>> So finally I think we should just register panel0 by default
>> everywhere. And in future we could add some quirks in drivers (ACPI,
>> platform, GPU) that would register panel1, panel2... for such devices.
>
> If you're going to design something, do it properly from day one.  Address
> all the main issues: multiple backends for each device, auto-selection of
> the default backend based on data reported by the backend drivers (e.g. a
> platform driver usually knows very well if it should be preferred over ACPI
> and GPU or not...), *and* multiple devices with hotplug.
>
> These are not, after all, overengineering for the future.  It is a problem
> we have _now_ with real world devices that are shipping.

I wasn't clear, sorry. I want to address all current and future
combinations. I tried to make that clear in my mails. I just mean we
should modify all panel backlight devices to register for "panel0"
display as we currently don't know/support notebooks with two PANELs.
In future if someone put hands on notebook with two PANELs he can
modify module to register both backlight devices: panel0 and panel1
(2, 3, ...).

I didn't know we should prefer platform over ACPI. But maybe you're
right, really, don't know. Eventually we can even add enum { LOWEST,
GPU, PLATFORM_LOW, ACPI, PLATFORM_HIGH } or sth.


> There are other ways to solve this issue, of course, and they're easier:
> publish MORE information on sysfs to properly bind backlight devices to the
> real device they control, as well as more data to help userspace decide
> which one it should use.   It is a cop-out, as we are only solving half the
> problem space in-kernel.  But it works, and it is not a hack, so it is also
> a viable solution.
>
> I prefer the full kernel solution where we export just one backlight
> interface, but when I propesed it, the others made it clear they'd prefer
> the less complex "userspace chooses which backlight backend to drive"
> currently employed.

I think we can stay with proposed kernel solution with eventual
choosing backlight controller for display (overwriting kernel's
choice). For example
$ cat /sys/class/backlight/panel0/method
acpi
platform
$ echo "platform" > /sys/class/backlight/panel0/method


> Meanwhile, I'd like a LOT to know how I could parent the backlight device I
> export in a platform driver to the correct PCI or ACPI device for the main
> GPU...

Is actually "parent" used for something? I can see it used in many
modules, but not sure where we use that pointer (if we do).

--
Rafał
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo.TakeThisOut@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
Rafał Miłecki

External


Since: Aug 26, 2009
Posts: 15



(Msg. 5) Posted: Sun Nov 29, 2009 5:20 pm
Post subject: Re: Backlight device class redesign [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

W dniu 29 listopada 2009 21:09 użytkownik Rafał Miłecki
<zajec5.RemoveThis@gmail.com> napisał:
> So I think we have to register every device and just keep symlink
> /sys/class/backlight/display_name pointing best device. We could
> register devices in
> 1) /sys/class/backlight/.devicename (hidden)
> 2) some /sys/class/internal-usage/devicename
>
> Do you agree on this?

Please, see attached patch. TODO:
1) Add METHOD (enum { ACPI, GPU, PLATFORM} ) as
backlight_device_register parameter
2) Add display name as backlight_device_register parameter
3) Use given METHODs in backlight_best_device
4) Fix symlinks to be created in /sys/class/backlight/ instead of
/sys/dev/char/ (how?!)

What about proposed solution?

--
Rafał
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo.RemoveThis@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
Henrique de Moraes Holsch

External


Since: Nov 06, 2006
Posts: 136



(Msg. 6) Posted: Sun Nov 29, 2009 7:20 pm
Post subject: Re: Backlight device class redesign [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Please don't attach patches that are to be reviewed, especially if your MUA
is not going to mark them "text/plain". Send them in the main body of the
email.

--
"One disk to rule them all, One disk to find them. One disk to bring
them all and in the darkness grind them. In the Land of Redmond
where the shadows lie." -- The Silicon Valley Tarot
Henrique Holschuh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo.RemoveThis@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
Zhang Rui

External


Since: Feb 26, 2007
Posts: 31



(Msg. 7) Posted: Thu Dec 03, 2009 4:46 am
Post subject: Re: Backlight device class redesign [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Mon, 2009-11-30 at 04:09 +0800, Rafał Miłecki wrote:
> W dniu 28 listopada 2009 01:30 użytkownik Rafał Miłecki
> <zajec5.RemoveThis@gmail.com> napisał:
> > As discussed in http://marc.info/?t=124947671300008&r=1&w=2 we need to
> > redesign our backlight device class.
>
> I was trying to make it work this way:
> 1. Everytime register request comes, look for backlight_display with given name.
> 1. A. If needed, create new backlight_display
> 2. Add new device to devices list of backlight_display
> 3. Find best device on devices list of backlight_display
> 4. Register if under /sys/class/backlight/name_of_display
>
> This didn't work because of registering only the best device. Look at
> this code in drivers/acpi/video.c:
>

> device->backlight = backlight_device_register(name,
> NULL, device, &acpi_backlight_ops);
> (...)
> result = sysfs_create_link(&device->backlight->dev.kobj,
> &device->dev->dev.kobj, "device");
>
IMO, we should create one device for one display.
For example, device /sys/class/backlight/panel0 is created the first
time a backlight_ops for this display is registered.
And create the symbol link from the backlight class device to "physical
device" (device that invokes backlight_device_register) in the backlight
class device driver, if we really need it.
Remove and recreate a link pointing to the new physical device when the
backlight mode is changed.

thanks,
rui

> It expects device to be registered (have dev.kobj) after calling
> backlight_device_register.
>
> So in summary we just can not do lazy registration. Every device
> passed to backlight_device_register has to be registered in that
> function or never.
>
> So I think we have to register every device and just keep symlink
> /sys/class/backlight/display_name pointing best device. We could
> register devices in
> 1) /sys/class/backlight/.devicename (hidden)
> 2) some /sys/class/internal-usage/devicename
>
> Do you agree on this?
>


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo.RemoveThis@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
Henrique de Moraes Holsch

External


Since: Nov 06, 2006
Posts: 136



(Msg. 8) Posted: Thu Dec 03, 2009 4:46 am
Post subject: Re: Backlight device class redesign [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Thu, 03 Dec 2009, Zhang Rui wrote:
> For example, device /sys/class/backlight/panel0 is created the first
> time a backlight_ops for this display is registered.
> And create the symbol link from the backlight class device to "physical
> device" (device that invokes backlight_device_register) in the backlight
> class device driver, if we really need it.
> Remove and recreate a link pointing to the new physical device when the
> backlight mode is changed.

FWIW, I agree the above solution is simple enough and quite good enough.

I just have absolutely _NO_ idea whatsoever how a platform driver can ask
the PCI or APCI layer "where is the video device driving the LVDS panel so
that I can bind to it"...

--
"One disk to rule them all, One disk to find them. One disk to bring
them all and in the darkness grind them. In the Land of Redmond
where the shadows lie." -- The Silicon Valley Tarot
Henrique Holschuh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo RemoveThis @vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
Matthew Garrett

External


Since: Dec 21, 2006
Posts: 207



(Msg. 9) Posted: Thu Dec 03, 2009 9:20 am
Post subject: Re: Backlight device class redesign [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Thu, Dec 03, 2009 at 04:01:14PM +0800, Zhang Rui wrote:

> IMO, we should create one device for one display.
> For example, device /sys/class/backlight/panel0 is created the first
> time a backlight_ops for this display is registered.

For anything other than the simple case (one display per machine), how
do you know whether the firmware, platform and gpu are referring to the
same display device?

--
Matthew Garrett | mjg59.DeleteThis@srcf.ucam.org
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo.DeleteThis@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
Zhang Rui

External


Since: Feb 26, 2007
Posts: 31



(Msg. 10) Posted: Thu Dec 03, 2009 9:20 pm
Post subject: Re: Backlight device class redesign [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Thu, 2009-12-03 at 18:52 +0800, Henrique de Moraes Holschuh wrote:
> On Thu, 03 Dec 2009, Zhang Rui wrote:
> > For example, device /sys/class/backlight/panel0 is created the first
> > time a backlight_ops for this display is registered.
> > And create the symbol link from the backlight class device to "physical
> > device" (device that invokes backlight_device_register) in the backlight
> > class device driver, if we really need it.
> > Remove and recreate a link pointing to the new physical device when the
> > backlight mode is changed.
>
> FWIW, I agree the above solution is simple enough and quite good enough.
>
> I just have absolutely _NO_ idea whatsoever how a platform driver can ask
> the PCI or APCI layer "where is the video device driving the LVDS panel so
> that I can bind to it"...
>
well. this is the question I want to ask. Smile

IMO, if we want to create one device for one display, we must have a
unique ID for each display and the ID must be generic enough so that
both ACPI & platform & graphics driver can understand it.

ACPI&platform drivers have no idea about the display info it's bind to.
But they're always used to control the integrated panel, no?
we can use something like DEFAULT_ACPI_DISPLAY/DEFAULT_PLATFORM_DISPLAY
which stands for the integrated LVDS panel, which can also be understood
by the graphics driver.

ACPI video driver -->ACPI_DISPLAY-->|
|
platform driver->PLATFORM_DISPLAY-->|--->/sys/class/backlight/panel0
|
|-->integrated panel----->|
|
graphics |-->TV------------------->|--->/sys/class/backlight/tv0
|
|-->external LCD--------->|--->...

I'm not a graphics guy so I don't if there are any other ways to control
the TV/external LCD device, if yes, they can use something else as the
unique ID, say EDID, right?

thanks,
rui

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo.DeleteThis@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
Display posts from previous:   
Related Topics:
[PATCH] ib_core: Add missing device link to class device - Add the missing device link from /sys/class/infiniband/* to the actual device. Signed-off-by: Joachim Fenkes..

GPIO device class driver - I am currently developing support for an ep9xx based SBC and want to export it's GPIO through sysfs in a simple and..

[PATCH] class device cleanup for fbdev - Let me know if this is the right approach. This patch uses the class field in struct device. diff --git..

[PATCH] backlight: Convert from struct class_device to str.. - Convert the backlight and LCD classes from struct class_device to struct device since class_device is scheduled for..

[PATCH] backlight: do not power off backlight when unregis.. - ACPI drivers like ibm-acpi are moving to the backlight sysfs infrastructure. During ibm-acpi testing, I have noticed..

[PATCH] backlight: do not power off backlight when unregis.. - ACPI drivers like ibm-acpi are moving to the backlight sysfs infrastructure. During ibm-acpi testing, I have noticed..
       Soft32 Home -> Linux -> Kernel All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Categories:
 Windows
  Linux
 Mac
 PDA


[ Contact us | Terms of Service/Privacy Policy ]