Re: Check for ACPI backlight support otherwise use vendor ACPIdrivers - version 2

Zhang Rui
2008-08-01T01:30:35Z

On Thu, 2008-07-31 at 23:32 +0800, nokos@gmx.net wrote:
> Hi Thomas
>
> I didi some testing and found whats wrong with the backlight detection
> in video_detect.c you should change:
>
> --- video_detect.c 2008-07-31 17:20:59.540059897 +0200
> +++ video_detect.c 2008-07-31 17:22:15.752034851 +0200
> @@ -45,9 +45,9 @@
> ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found generic
> backlight "
> "support\n"));
> *cap |= ACPI_VIDEO_BACKLIGHT;
> - return 0;
> + return -ENODEV;
> }
> - return -ENODEV;
> + return 0;
> }
>
Yes, that's the problem.

In the original patch,
﻿acpi_walk_namespace(ACPI_TYPE_DEVICE, device->handle, ACPI_UINT32_MAX,
acpi_backlight_cap_match, &video_caps, NULL)
in ﻿acpi_is_video_device() returns if the first video device doesn't
support backlight control.

>
> otherwise it stops walking the subtree at the first device which does
> not contain backlight (in my case GFX0 has CRT_ as first child which
> does not support backlight). Its ok to stop scanning at the first
> positive match since cap then already has ACPI_VIDEO_BACKLIGHT.
> (ENODEV
> is probably not the best error code here ...)
>
> probably you might want to change in acpi_is_video_device:
>
> --- video_detect.c 2008-07-31 17:20:59.540059897 +0200
> +++ video_detect.c 2008-07-31 17:22:15.752034851 +0200
> @@ -93,8 +93,10 @@
> video_caps |= ACPI_VIDEO_IGD;
> }
>
> - acpi_walk_namespace(ACPI_TYPE_DEVICE, device->handle,
> ACPI_UINT32_MAX,
> + if (video_caps) {
> + acpi_walk_namespace(ACPI_TYPE_DEVICE, device->handle,
> ACPI_UINT32_MAX,
> acpi_backlight_cap_match, &video_caps,
> NULL);
> + }
>
> return video_caps;
> }
No.
For a video bus device, video_caps can never be 0 here.

> otherwise the whole ACPI namespace is scanned several times and this
> restricts the scanning only on those subtrees where the head might be
> a
> video device
>
>
> BTW. the DRDY detection (for IGD) works ... now I have to find the IGD
> patches ... couldn't find them on the list and the version of
> linux-next
> I tried didn't contain anything which looked like it.
You can get them here.
http://cgit.freedesktop.org/mesa/drm/diff/?id=dfd441cf964f20e4a761cb8490d7cd82cf32e7b9

don't know if this is the latest version, cc Matthew and Jessie.

thanks,
rui

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html