1 diff --git a/hw/xfree86/common/xf86AutoConfig.c b/hw/xfree86/common/xf86AutoConfig.c
2 index 55412b4..d4a95d2 100644
3 --- a/hw/xfree86/common/xf86AutoConfig.c
4 +++ b/hw/xfree86/common/xf86AutoConfig.c
6 #include "xf86sbusBus.h"
9 +#if defined(__arm__) && defined(__linux__)
10 +#include "loaderProcs.h"
11 +#include <sys/types.h> /* For opendir in test_sysfs_device */
12 +#include <dirent.h> /* For opendir in test_sysfs_device */
16 #include <sys/visual_io.h>
18 @@ -200,6 +206,27 @@ xf86AutoConfig(void)
19 return ret == CONFIG_OK;
22 +#if defined(__arm__) && defined(__linux__)
24 +test_sysfs_device(char *device_name, char *driver_name)
26 + DIR *dir = opendir("/sys/devices/platform");
27 + struct dirent *current_dir;
28 + int len = strlen(device_name);
30 + while (current_dir = readdir(dir)) {
31 + if (strlen(current_dir->d_name) >= len &&
32 + strncmp(device_name, current_dir->d_name, len) == 0)
41 +#endif /* defined(__arm__) && defined(__linux__) */
44 listPossibleVideoDrivers(char *matches[], int nmatches)
46 @@ -287,6 +314,21 @@ listPossibleVideoDrivers(char *matches[], int nmatches)
50 +#if defined(__linux__) && defined(__arm__)
51 + if (i < (nmatches - 1)) {
52 + if (test_sysfs_device("mxc_gpu", "imx"))
53 + matches[i++] = xnfstrdup("imx");
54 + else if (test_sysfs_device("dovefb", "dovefb"))
55 + matches[i++] = xnfstrdup("dovefb");
56 + else if (test_sysfs_device("omapdrm", "omap"))
57 + matches[i++] = xnfstrdup("omap");
58 + else if (test_sysfs_device("omapfb", "omapfb"))
59 + matches[i++] = xnfstrdup("omapfb");
60 + else if (test_sysfs_device("omap", "pvr"))
61 + matches[i++] = xnfstrdup("pvr");
63 +#endif /* defined(__linux__) && defined(__arm__) */
65 #if defined(__linux__)
66 matches[i++] = xnfstrdup("modesetting");
68 diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c
69 index 24b9473..0061c25 100644
70 --- a/hw/xfree86/common/xf86platformBus.c
71 +++ b/hw/xfree86/common/xf86platformBus.c
72 @@ -362,6 +362,14 @@ xf86platformProbeDev(DriverPtr drvp)
73 if (xf86IsPrimaryPlatform(&xf86_platform_devices[j]))
77 + /* there's no way to handle real platform devices at this point,
78 + * as there's no valid busID to be used, so try to move forward
79 + * in case there's only one platform device, and see if the
80 + * driver's probe succeeds or not at least once */
81 + if ((xf86_num_platform_devices == 1) && (!foundScreen))