Re: toshiba_acpi.c: Full TOS1900 device support

From: Azael Avalos
Date: Wed Oct 27 2010 - 15:24:29 EST


On Tue, Oct 26, 2010 at 1:20 PM, Matthew Garrett <mjg59@xxxxxxxxxxxxx> wrote:
> On Tue, Oct 26, 2010 at 01:14:25PM -0600, Azael Avalos wrote:
>>
>> - Â Â hci_read1(HCI_LCD_BRIGHTNESS, &value, &hci_result);
>> - Â Â if (hci_result == HCI_SUCCESS) {
>> - Â Â Â Â Â Â return (value >> HCI_LCD_BRIGHTNESS_SHIFT);
>> - Â Â } else
>> - Â Â Â Â Â Â return -EFAULT;
>> + Â Â if (toshiba_acpi.spfc && toshiba_acpi.video_handle) {
>> + Â Â Â Â Â Â status = acpi_evaluate_integer(toshiba_acpi.video_handle,
>> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â"_BQC", NULL, &val);
>> + Â Â Â Â Â Â if (ACPI_SUCCESS(status))
>> + Â Â Â Â Â Â Â Â Â Â return val;
>
> This doesn't look right. Shouldn't _BQC indicate that it's an ACPI spec
> video device, and thus driven by the ACPI video driver?
>

Yes, actually the ACPI video driver does a better job of detecting the
video device,
so perhaps something like the following would be better IMHO for at least the
backlight:


if (toshiba_acpi.spfc || !acpi_video_backlight_support()) {
props.max_brightness = HCI_LCD_BRIGHTNESS_LEVELS - 1;
toshiba_backlight_device = backlight_device_register("toshiba",
&toshiba_acpi.p_dev->dev,
NULL,
&toshiba_backlight_data,
&props);
if (IS_ERR(toshiba_backlight_device)) {
ret = PTR_ERR(toshiba_backlight_device);

printk(KERN_ERR
"Could not register toshiba backlight device\n");
toshiba_backlight_device = NULL;
toshiba_acpi_exit();
return ret;
}
}


Is there an ACPI function that let's us query the display brightness?
Because TOS1900 devices lack the HCI method to query the LCD status,
and thus the proc interface will be useless, that is, if a userland (or any
other) application is using it.



>> +static void toshiba_input_event(struct input_handle *handle, unsigned int type,
>> + Â Â Â Â Â Â Â Â Â Â Â Â Âunsigned int code, int value)
>> Â{
>> - Â Â struct key_entry *key;
>> -
>> - Â Â for (key = toshiba_acpi_keymap; key->type != KE_END; key++)
>> - Â Â Â Â Â Â if (code == key->code)
>> - Â Â Â Â Â Â Â Â Â Â return key;
>> -
>> - Â Â return NULL;
>> + Â Â if (type == EV_MSC && code == MSC_SCAN && value == TOSHIBA_FN_SCAN)
>> + Â Â Â Â Â Â schedule_work(&((struct toshiba_acpi_dev *)handle->private)->hotkey_work);
>> Â}
>
> Ugh. Use i8042_install_filter instead, and just look at the raw i8042
> stream. That'll avoid the ugly strncmp for the device names in order to
> find the right device.
>

Can you point me to some documents (if any) or even pieces of code
that I can look at.

I've tried using the i8042_install_filter function, but I haven't had
any luck so far,
or perhaps I'm using it in wrong, due to my limited kernel knowledge.


Saludos
Azael


--
-- El mundo apesta y vosotros apestais tambien --
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/