1 --- a/hw/xfree86/common/xf86AutoConfig.c
2 +++ b/hw/xfree86/common/xf86AutoConfig.c
4 #include "xf86sbusBus.h"
7 +#if defined(__arm__) && defined(__linux__)
8 +#include "loaderProcs.h"
9 +#include <sys/types.h> /* For opendir in test_sysfs_device */
10 +#include <dirent.h> /* For opendir in test_sysfs_device */
14 #include <sys/visual_io.h>
16 @@ -200,6 +206,27 @@ xf86AutoConfig(void)
17 return ret == CONFIG_OK;
20 +#if defined(__arm__) && defined(__linux__)
22 +test_sysfs_device(char *device_name, char *driver_name)
24 + DIR *dir = opendir("/sys/devices/platform");
25 + struct dirent *current_dir;
26 + int len = strlen(device_name);
28 + while (current_dir = readdir(dir)) {
29 + if (strlen(current_dir->d_name) >= len &&
30 + strncmp(device_name, current_dir->d_name, len) == 0)
39 +#endif /* defined(__arm__) && defined(__linux__) */
42 listPossibleVideoDrivers(char *matches[], int nmatches)
44 @@ -279,6 +306,21 @@ listPossibleVideoDrivers(char *matches[]
45 i = xf86PciMatchDriver(matches, nmatches);
48 +#if defined(__linux__) && defined(__arm__)
49 + if (i < (nmatches - 1)) {
50 + if (test_sysfs_device("mxc_gpu", "imx"))
51 + matches[i++] = xnfstrdup("imx");
52 + else if (test_sysfs_device("dovefb", "dovefb"))
53 + matches[i++] = xnfstrdup("dovefb");
54 + else if (test_sysfs_device("omapdrm", "omap"))
55 + matches[i++] = xnfstrdup("omap");
56 + else if (test_sysfs_device("omapfb", "omapfb"))
57 + matches[i++] = xnfstrdup("omapfb");
58 + else if (test_sysfs_device("omap", "pvr"))
59 + matches[i++] = xnfstrdup("pvr");
61 +#endif /* defined(__linux__) && defined(__arm__) */
63 #if defined(__linux__)
64 matches[i++] = xnfstrdup("modesetting");
66 --- a/hw/xfree86/common/xf86platformBus.c
67 +++ b/hw/xfree86/common/xf86platformBus.c
68 @@ -372,6 +372,14 @@ xf86platformProbeDev(DriverPtr drvp)
69 if (xf86IsPrimaryPlatform(&xf86_platform_devices[j]))
73 + /* there's no way to handle real platform devices at this point,
74 + * as there's no valid busID to be used, so try to move forward
75 + * in case there's only one platform device, and see if the
76 + * driver's probe succeeds or not at least once */
77 + if ((xf86_num_platform_devices == 1) && (!foundScreen))