@@ -612,7 +612,7 @@ acpi_video_device_lcd_get_level_current(struct acpi_video_device *device,
612
612
613
613
static int
614
614
acpi_video_device_EDID (struct acpi_video_device * device ,
615
- union acpi_object * * edid , ssize_t length )
615
+ union acpi_object * * edid , int length )
616
616
{
617
617
int status ;
618
618
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER , NULL };
@@ -625,13 +625,11 @@ acpi_video_device_EDID(struct acpi_video_device *device,
625
625
626
626
if (!device )
627
627
return - ENODEV ;
628
- if (length == 128 )
629
- arg0 .integer .value = 1 ;
630
- else if (length == 256 )
631
- arg0 .integer .value = 2 ;
632
- else
628
+ if (!length || (length % 128 ))
633
629
return - EINVAL ;
634
630
631
+ arg0 .integer .value = length / 128 ;
632
+
635
633
status = acpi_evaluate_object (device -> dev -> handle , "_DDC" , & args , & buffer );
636
634
if (ACPI_FAILURE (status ))
637
635
return - ENODEV ;
@@ -641,7 +639,8 @@ acpi_video_device_EDID(struct acpi_video_device *device,
641
639
if (obj && obj -> type == ACPI_TYPE_BUFFER )
642
640
* edid = obj ;
643
641
else {
644
- acpi_handle_info (device -> dev -> handle , "Invalid _DDC data\n" );
642
+ acpi_handle_debug (device -> dev -> handle ,
643
+ "Invalid _DDC data for length %d\n" , length );
645
644
status = - EFAULT ;
646
645
kfree (obj );
647
646
}
@@ -1447,7 +1446,6 @@ int acpi_video_get_edid(struct acpi_device *device, int type, int device_id,
1447
1446
1448
1447
for (i = 0 ; i < video -> attached_count ; i ++ ) {
1449
1448
video_device = video -> attached_array [i ].bind_info ;
1450
- length = 256 ;
1451
1449
1452
1450
if (!video_device )
1453
1451
continue ;
@@ -1478,18 +1476,14 @@ int acpi_video_get_edid(struct acpi_device *device, int type, int device_id,
1478
1476
continue ;
1479
1477
}
1480
1478
1481
- status = acpi_video_device_EDID (video_device , & buffer , length );
1482
-
1483
- if (ACPI_FAILURE (status ) || !buffer ||
1484
- buffer -> type != ACPI_TYPE_BUFFER ) {
1485
- length = 128 ;
1479
+ for (length = 512 ; length > 0 ; length -= 128 ) {
1486
1480
status = acpi_video_device_EDID (video_device , & buffer ,
1487
1481
length );
1488
- if (ACPI_FAILURE (status ) || !buffer ||
1489
- buffer -> type != ACPI_TYPE_BUFFER ) {
1490
- continue ;
1491
- }
1482
+ if (ACPI_SUCCESS (status ))
1483
+ break ;
1492
1484
}
1485
+ if (!length )
1486
+ continue ;
1493
1487
1494
1488
* edid = buffer -> buffer .pointer ;
1495
1489
return length ;
0 commit comments