Skip to contentSkip to conversation

ACPI video: guess flags for devices with non-standard addressing

PATCH RESEND In review Daniel Drake 2 participants 2 messages Jun 17, 2007 – Sep 25, 2007 ACPI

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 ACPI video: guess flags for devices with non-standard addressing

Dell laptops seem to address video devices without the device_id_scheme bit, which means that Linux doesn't know the device types of the video devices.

This patch makes the ACPI video driver guess the device type based on the device name for devices which do not have the device_id_scheme set. This fixes the flags field for all 4 of my video devices on this laptop (Inspiron 640m).

drivers/acpi/video.c +39 -19
Index: linux/drivers/acpi/video.c
===================================================================
@@ -1343,26 +1343,46 @@ acpi_video_bus_get_one_device(struct acp
 
 		attribute = acpi_video_get_device_attr(video, device_id);
 
-		if((attribute != NULL) && attribute->device_id_scheme) {
-			switch (attribute->display_type) {
-			case ACPI_VIDEO_DISPLAY_CRT:
-				data->flags.crt = 1;
-				break;
-			case ACPI_VIDEO_DISPLAY_TV:
-				data->flags.tvout = 1;
-				break;
-			case ACPI_VIDEO_DISPLAY_DVI:
-				data->flags.dvi = 1;
-				break;
-			case ACPI_VIDEO_DISPLAY_LCD:
-				data->flags.lcd = 1;
-				break;
-			default:
-				data->flags.unknown = 1;
-				break;
+		if (attribute) {
+			if (!attribute->device_id_scheme) {
+				char *name = acpi_device_bid(device);
+
+				/* Dell laptops seem to follow standard video
+				 * device addressing but do not set the
+				 * device_id_scheme bit.
+				 * Guess the flags based on the device names.
+				 */
+				if (strcmp(name, "CRT") == 0)
+					data->flags.crt = 1;
+				else if (strcmp(name, "TV") == 0)
+					data->flags.tvout = 1;
+				else if (strcmp(name, "DVI") == 0)
+					data->flags.dvi = 1;
+				else if (strcmp(name, "LCD") == 0)
+					data->flags.lcd = 1;
+				else
+					data->flags.unknown = 1;
+			} else {
+				switch (attribute->display_type) {
+				case ACPI_VIDEO_DISPLAY_CRT:
+					data->flags.crt = 1;
+					break;
+				case ACPI_VIDEO_DISPLAY_TV:
+					data->flags.tvout = 1;
+					break;
+				case ACPI_VIDEO_DISPLAY_DVI:
+					data->flags.dvi = 1;
+					break;
+				case ACPI_VIDEO_DISPLAY_LCD:
+					data->flags.lcd = 1;
+					break;
+				default:
+					data->flags.unknown = 1;
+					break;
+				}
+				if(attribute->bios_can_detect)
+					data->flags.bios = 1;
 			}
-			if(attribute->bios_can_detect)
-				data->flags.bios = 1;
 		} else
 			data->flags.unknown = 1;
 
#1 lore raw
Quoted 52 lines · Daniel Drake

Dell laptops seem to address video devices without the device_id_scheme bit,
which means that Linux doesn't know the device types of the video devices.

This patch makes the ACPI video driver guess the device type based on the
device name for devices which do not have the device_id_scheme set. This
fixes the flags field for all 4 of my video devices on this laptop (Inspiron 640m).

Index: linux/drivers/acpi/video.c
===================================================================

drivers/acpi/video.c +5 -17
@@ -1343,26 +1343,46 @@ acpi_video_bus_get_one_device(struct acp
 
                attribute = acpi_video_get_device_attr(video,
 device_id);
 
-               if((attribute != NULL) && attribute->device_id_scheme)
 {
-                       switch (attribute->display_type) {
-                       case ACPI_VIDEO_DISPLAY_CRT:
-                               data->flags.crt = 1;
-                               break;
-                       case ACPI_VIDEO_DISPLAY_TV:
-                               data->flags.tvout = 1;
-                               break;
-                       case ACPI_VIDEO_DISPLAY_DVI:
-                               data->flags.dvi = 1;
-                               break;
-                       case ACPI_VIDEO_DISPLAY_LCD:
-                               data->flags.lcd = 1;
-                               break;
-                       default:
-                               data->flags.unknown = 1;
-                               break;
+               if (attribute) {
+                       if (!attribute->device_id_scheme) {
+                               char *name = acpi_device_bid(device);
+
+                               /* Dell laptops seem to follow

standard video
+ * device addressing but do not set
the

drivers/acpi/video.c +2 -0
+                                * device_id_scheme bit.
+                                * Guess the flags based on the device

names.

drivers/acpi/video.c acpi_video_bus_get_one_device(struct acp · line 1356

Quoted 3 lines
drivers/acpi/video.c +3 -0
+                                */
+                               if (strcmp(name, "CRT") == 0)
+                                       data->flags.crt = 1;

Thinkpad laptops don't set the device_id_scheme bit as well. And they use LCD0/CRT0/TV0/DVI0 as the device name. can we use strncmp(name, "CRT", 3) here?

drivers/acpi/video.c acpi_video_bus_get_one_device(struct acp · line 1362

Quoted 6 lines
drivers/acpi/video.c +6 -0
+                               else if (strcmp(name, "TV") == 0)
+                                       data->flags.tvout = 1;
+                               else if (strcmp(name, "DVI") == 0)
+                                       data->flags.dvi = 1;
+                               else if (strcmp(name, "LCD") == 0)
+                                       data->flags.lcd = 1;

ditto

Quoted 35 lines
drivers/acpi/video.c +22 -3
+                               else
+                                       data->flags.unknown = 1;
+                       } else {
+                               switch (attribute->display_type) {
+                               case ACPI_VIDEO_DISPLAY_CRT:
+                                       data->flags.crt = 1;
+                                       break;
+                               case ACPI_VIDEO_DISPLAY_TV:
+                                       data->flags.tvout = 1;
+                                       break;
+                               case ACPI_VIDEO_DISPLAY_DVI:
+                                       data->flags.dvi = 1;
+                                       break;
+                               case ACPI_VIDEO_DISPLAY_LCD:
+                                       data->flags.lcd = 1;
+                                       break;
+                               default:
+                                       data->flags.unknown = 1;
+                                       break;
+                               }
+                               if(attribute->bios_can_detect)
+                                       data->flags.bios = 1;
                        }
-                       if(attribute->bios_can_detect)
-                               data->flags.bios = 1;
                } else
                        data->flags.unknown = 1;
 
-

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