Subject: [PATCH] [acpi video] Add helper to set POST info - Update set_int() to - use passed method name - use acpi_evaluate_integer(), so we can save the return value - Add video_bus_set_post() that calls set_int() for _SPD with the POST options that were passed in. Signed-off-by: Patrick Mochel --- drivers/acpi/drivers/video/bus-device.c | 48 ++++++++++++++++++++++++++----- drivers/acpi/drivers/video/video.h | 1 + 2 files changed, 42 insertions(+), 7 deletions(-) applies-to: a9cf40164ed8d50babfda2e90a9a990dcf38de7f 2657d9ee299924d5d7551a0ea054ce60d66d0c1b diff --git a/drivers/acpi/drivers/video/bus-device.c b/drivers/acpi/drivers/video/bus-device.c index 724ad07..1f1245d 100644 --- a/drivers/acpi/drivers/video/bus-device.c +++ b/drivers/acpi/drivers/video/bus-device.c @@ -43,6 +43,9 @@ static int get_int(struct acpi_dev * ad, static int set_int(struct acpi_dev * ad, char * obj, u32 value) { acpi_status status; + unsigned long acpi_ret; + int ret; + union acpi_object arg = { .type = ACPI_TYPE_INTEGER, .integer = { @@ -54,9 +57,13 @@ static int set_int(struct acpi_dev * ad, .pointer = &arg, }; - status = acpi_evaluate_object(ad->acpi_device->handle, - "_DOS", &arg_list, NULL); - return ACPI_SUCCESS(status) ? 0 : -ENODEV; + status = acpi_evaluate_integer(ad->acpi_device->handle, + obj, &arg_list, &acpi_ret); + if (ACPI_SUCCESS(status)) + ret = acpi_ret ? -EINVAL : 0; + else + ret = -ENODEV; + return ret; } @@ -149,6 +156,37 @@ void video_bus_check(struct acpi_video_b /** + * video_bus_set_post - Set the POST info for the video bus + * @vb: The ACPI video bus + * @post: The value to write + * + */ + +int video_bus_set_post(struct acpi_video_bus * vb, u32 post) +{ + int ret = 0; + + /* + * Just in case the OEM forgot the motherboard, we always want to + * make sure that it's set.. + */ + post |= 1; + + if (post > ACPI_VIDEO_BUS_POST_AGP) + return -EINVAL; + + if (vb->v_can_post) { + if (vb->v_post_options & post) { + ret = set_int(vb->v_ad, "_SPD", post); + if (!ret) + vb->v_post_options = post; + } + } + return ret; +} + + +/** * get_post_options - Query the POST info on the bus * @vb: The ACPI video bus * @@ -279,14 +317,10 @@ static int run_dos(struct acpi_video_bus int video_bus_enable(struct acpi_video_bus * vb) { - int ret; - return run_dos(vb, VIDEO_DOS_BIOS_AUTO, VIDEO_DOS_LCD_AUTO); } int video_bus_disable(struct acpi_video_bus * vb) { - int ret; - return run_dos(vb, VIDEO_DOS_BIOS_NO_AUTO, VIDEO_DOS_LCD_NO_AUTO); } diff --git a/drivers/acpi/drivers/video/video.h b/drivers/acpi/drivers/video/video.h index 9db2b55..0a2e430 100644 --- a/drivers/acpi/drivers/video/video.h +++ b/drivers/acpi/drivers/video/video.h @@ -43,3 +43,4 @@ extern int video_bus_test(struct acpi_de extern int video_bus_init(struct acpi_video_bus * vb); extern int video_bus_enable(struct acpi_video_bus * vb); extern int video_bus_disable(struct acpi_video_bus * vb); +extern int video_bus_set_post(struct acpi_video_bus * vb, u32 post); --- 0.99.9.GIT