Call for testers acpi_dell
Daniel Walter
d.walter at 0x90.at
Fri Feb 12 21:38:50 UTC 2010
On Fri, 12 Feb 2010, Jung-uk Kim wrote:
> On Friday 12 February 2010 03:12 pm, Daniel Walter wrote:
>> On Fri, 12 Feb 2010, Jung-uk Kim wrote:
>>> On Friday 12 February 2010 02:37 pm, Daniel Walter wrote:
>>>> On Fri, 12 Feb 2010, Jung-uk Kim wrote:
>>>>> On Friday 12 February 2010 01:33 pm, Daniel Walter wrote:
>>>>>> On Fri, 12 Feb 2010, Jung-uk Kim wrote:
>>>>>>> On Friday 12 February 2010 12:48 pm, Daniel Walter wrote:
>>>>>>>> Hi all,
>>>>>>>>
>>>>>>>> I've written a small kernel driver to support Dell Mini 1011
>>>>>>>> (aka Dell Mini 10v) Brightness Controll Buttons. Since I do
>>>>>>>> not have any other Dell Notebooks, I'd like you to test this
>>>>>>>> module on other Dell Notebooks as well.
>>>>>>>>
>>>>>>>> This driver is in an early stage, but future releases will
>>>>>>>> also support the rfkill switch and CRT switch.
>>>>>>>>
>>>>>>>> Currently following features are implemented:
>>>>>>>> * Increase / Decrease Brightness
>>>>>>>> * Change brightness if AC is connected / disconnected
>>>>>>>>
>>>>>>>> TODO:
>>>>>>>> * Add CRT Support
>>>>>>>> * Add Sysctl to define brightness levels for eco and ac
>>>>>>>> powerprofile * Add Support for RF-Kill Switch
>>>>>>>>
>>>>>>>> Any suggestions are welcome
>>>>>>>
>>>>>>> I just quickly glanced at it but I failed see anything quite
>>>>>>> specific to Dell laptops except for "TODO: Add support for
>>>>>>> RF-Kill Switch". acpi_video(4) should be able to do what you
>>>>>>> want. Am I missing something here?
>>>>>>>
>>>>>>> Jung-uk Kim
>>>>>>
>>>>>> hi,
>>>>>>
>>>>>> Yes it is possible to control the brightness using
>>>>>> acpi_video(4) via sysctl but there is no support for the
>>>>>> FN-Buttons. This module adds the support for those buttons.
>>>>>
>>>>> I see. However, my point is the probe function does not seem
>>>>> specific to Dell laptops. In fact, you are just checking _BCL
>>>>> transition, i.e., effectively it just makes a generic
>>>>> acpi_video notify handler for brightness change.
>>>>>
>>>>> Jung-uk Kim
>>>>
>>>> Oh, I've completly overlooked this one. Sorry for that, I should
>>>> replace the probing with a Dell specific probing instead. Do you
>>>> have any suggestions to this one ?
>>>
>>> It totally depends on DSDT of your laptop model and you will have
>>> to maintain the list of these ACPI handles, unfortunately.
>>> Please see acpi_asus.c for example.
>>>
>>> If you are interested in generic acpi_video(4) enhancement, you
>>> just need to extend acpi_video.c to get these notifications,
>>> i.e., 0x86 and 0x87. FYI, acpi_video can only handle 0x80 and
>>> 0x81 events ATM. Please read ACPI specification Appendix B. Video
>>> Extensions, especially B.6 and B.7 are what you are looking for.
>>>
>>> Jung-uk Kim
>>
>> Hi I'll take a look at my DSDT again ...
>>
>> I've also will take a look at Appendix B of the current ACPI spec
>> to see if 0x86 and 0x87 are OEM or part of the standard. If they
>> are not completly out of spec I'll patch acpi_video(4) and send it
>> again to the list.
>
> 0x86/0x87 is part of the spec. and it should be handled by acpi_video
> IMHO.
>
> Jung-uk Kim
hi,
as you suggested I've written a patch for acpi_video(4) to support the 0x86 and 0x87 notifications. the support for 0x85, 0x88, 0x89 (also specified in ACPI Standard Appendix B7) is not yet implemented.
Could anyone with a ACPI sending 0x86 and 0x87 test the patch ?
thanks for the help and pointing my in the right direction.
regards
Daniel
-------------- next part --------------
--- /usr/src/sys/dev/acpica/acpi_video.c 2009-10-25 02:10:29.000000000 +0100
+++ acpi_video.c 2010-02-12 22:37:22.000000000 +0100
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: acpi_vid.c,v 1.4 2003/10/13 10:07:36 taku Exp $
+ * $Id: acpi_video.c 3 2010-02-12 16:24:20Z sahne $
*/
#include <sys/cdefs.h>
@@ -87,6 +87,7 @@
static int acpi_video_vo_bright_sysctl(SYSCTL_HANDLER_ARGS);
static int acpi_video_vo_presets_sysctl(SYSCTL_HANDLER_ARGS);
static int acpi_video_vo_levels_sysctl(SYSCTL_HANDLER_ARGS);
+static void acpi_video_vo_notify_handler(ACPI_HANDLE, UINT32, void *);
/* operations */
static void vid_set_switch_policy(ACPI_HANDLE, UINT32);
@@ -99,8 +100,10 @@
static void vo_set_device_state(ACPI_HANDLE, UINT32);
/* events */
-#define VID_NOTIFY_SWITCHED 0x80
-#define VID_NOTIFY_REPROBE 0x81
+#define VID_NOTIFY_SWITCHED 0x80
+#define VID_NOTIFY_REPROBE 0x81
+#define VID_NOTIFY_BRIGHTNESS_UP 0x86
+#define VID_NOTIFY_BRIGHTNESS_DOWN 0x87
/* _DOS (Enable/Disable Output Switching) argument bits */
#define DOS_SWITCH_MASK 3
@@ -566,6 +569,8 @@
/* XXX - see above. */
vo->vo_economy = vo->vo_levels[BCL_ECONOMY];
}
+ AcpiInstallNotifyHandler(vo->handle,ACPI_DEVICE_NOTIFY,
+ acpi_video_vo_notify_handler, vo);
}
static void
@@ -574,6 +579,9 @@
struct acpi_video_output_queue *voqh;
ACPI_SERIAL_ASSERT(video);
+ AcpiRemoveNotifyHandler(vo->handle, ACPI_DEVICE_NOTIFY,
+ acpi_video_vo_notify_handler);
+
if (vo->vo_sysctl_tree != NULL) {
vo->vo_sysctl_tree = NULL;
sysctl_ctx_free(&vo->vo_sysctl_ctx);
@@ -939,3 +947,56 @@
printf("can't evaluate %s._DSS - %s\n",
acpi_name(handle), AcpiFormatException(status));
}
+
+static void
+acpi_video_vo_notify_handler(ACPI_HANDLE handle, UINT32 notify, void *context)
+{
+ struct acpi_video_output *vo;
+ int brightness;
+ int i = 0;
+ vo = context;
+ switch(notify) {
+ case VID_NOTIFY_BRIGHTNESS_UP:
+ ACPI_SERIAL_BEGIN(video);
+ if (vo->vo_levels != NULL) {
+ brightness = vo->vo_brightness;
+ if (brightness == -1) {
+ brightness = vo->vo_fullpower;
+ }
+
+ if (brightness != vo->vo_fullpower) {
+ for (i = 2; i < vo->vo_numlevels; i++)
+ if (vo->vo_levels[i] == brightness)
+ break;
+ }
+ if (i != vo->vo_numlevels - 1) {
+ brightness = vo->vo_levels[i+1];
+ vo_set_brightness(vo->handle, brightness);
+ vo->vo_brightness = brightness;
+ }
+ }
+ ACPI_SERIAL_END(video);
+ break;
+ case VID_NOTIFY_BRIGHTNESS_DOWN:
+ ACPI_SERIAL_BEGIN(video);
+ if (vo->vo_levels != NULL) {
+ brightness = vo->vo_brightness;
+ if (brightness == -1) {
+ brightness = vo->vo_fullpower;
+ }
+
+ for (i = 2; i < vo->vo_numlevels; i++)
+ if (vo->vo_levels[i] == brightness)
+ break;
+ if (i > 2) {
+ brightness = vo->vo_levels[i-1];
+ vo_set_brightness(vo->handle, brightness);
+ vo->vo_brightness = brightness;
+ }
+ }
+ ACPI_SERIAL_END(video);
+ break;
+ default:
+ break;
+ }
+}
More information about the freebsd-acpi
mailing list