android_kernel_xiaomi_sm8350/drivers
Lennart Poettering 4f5c791a85 DMI-based module autoloading
The patch below adds DMI/SMBIOS based module autoloading to the Linux
kernel. The idea is to load laptop drivers automatically (and other
drivers which cannot be autoloaded otherwise), based on the DMI system
identification information of the BIOS.

Right now most distros manually try to load all available laptop
drivers on bootup in the hope that at least one of them loads
successfully. This patch does away with all that, and uses udev to
automatically load matching drivers on the right machines.

Basically the patch just exports the DMI information that has been
parsed by the kernel anyway to userspace via a sysfs device
/sys/class/dmi/id and makes sure that proper modalias attributes are
available. Besides adding the "modalias" attribute it also adds
attributes for a few other DMI fields which might be useful for
writing udev rules.

This patch is not an attempt to export the entire DMI/SMBIOS data to
userspace. We already have "dmidecode" which parses the complete DMI
info from userspace. The purpose of this patch is machine model
identification and good udev integration.

To take advantage of DMI based module autoloading, a driver should
export one or more MODULE_ALIAS fields similar to these:

MODULE_ALIAS("dmi:*:svnMICRO-STARINT'LCO.,LTD:pnMS-1013:pvr0131*:cvnMICRO-STARINT'LCO.,LTD:ct10:*");
MODULE_ALIAS("dmi:*:svnMicro-StarInternational:pnMS-1058:pvr0581:rvnMSI:rnMS-1058:*:ct10:*");
MODULE_ALIAS("dmi:*:svnMicro-StarInternational:pnMS-1412:*:rvnMSI:rnMS-1412:*:cvnMICRO-STARINT'LCO.,LTD:ct10:*");
MODULE_ALIAS("dmi:*:svnNOTEBOOK:pnSAM2000:pvr0131*:cvnMICRO-STARINT'LCO.,LTD:ct10:*");

These lines are specific to my msi-laptop.c driver. They are basically
just a concatenation of a few carefully selected DMI fields with all
potentially bad characters stripped.

Besides laptop drivers, modules like "hdaps", the i2c modules
and the hwmon modules are good candidates for "dmi:" MODULE_ALIAS
lines.

Besides merely exporting the DMI data via sysfs the patch adds
support for a few more DMI fields. Especially the CHASSIS fields are
very useful to identify different laptop modules. The patch also adds
working MODULE_ALIAS lines to my msi-laptop.c driver.

I'd like to thank Kay Sievers for helping me to clean up this patch
for posting it on lkml.

Patch is against Linus' current GIT HEAD. Should probably apply to
older kernels as well without modification.


Signed-off-by: Lennart Poettering <mzxreary@0pointer.de>
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-07-11 16:09:00 -07:00
..
acorn [PATCH] fix request->cmd == INT cases 2007-07-10 08:03:34 +02:00
acpi ACPI: fix acpi_osi=!Linux 2007-07-02 21:06:48 -07:00
amba
ata [libata] sata_mv: print out additional chip info during probe 2007-07-09 12:29:31 -04:00
atm potential compiler error, irqfunc caller sites update 2007-07-06 10:23:43 -07:00
auxdisplay
base
block Merge branch 'splice-2.6.23' of git://git.kernel.dk/data/git/linux-2.6-block 2007-07-10 13:51:06 -07:00
bluetooth
cdrom Remove legacy CDROM drivers 2007-07-10 08:03:34 +02:00
char sx: switch subven and subid values 2007-07-10 17:51:13 -07:00
clocksource
connector
cpufreq
crypto
dio
dma IOATDMA: fix section mismatches 2007-06-28 11:34:53 -07:00
edac
eisa
fc4
firewire firewire: fw-sbp2: fix DMA mapping of management ORBs 2007-07-10 00:07:49 +02:00
firmware DMI-based module autoloading 2007-07-11 16:09:00 -07:00
hid Merge branches 'debug-module-param' and 'upstream' into for-linus 2007-07-09 14:23:37 +02:00
hwmon hwmon/coretemp: fix a broken error path 2007-06-24 08:59:10 -07:00
i2c
ide [PATCH] fix request->cmd == INT cases 2007-07-10 08:03:34 +02:00
ieee1394 ieee1394: remove old isochronous ABI 2007-07-10 00:07:41 +02:00
infiniband IPoIB/cm: Partial error clean up unmaps wrong address 2007-07-02 20:48:31 -07:00
input Input: tsdev - fix broken usec-to-millisecs conversion 2007-07-10 00:43:06 -04:00
isdn
kvm
leds
macintosh x86_64: Fix only make Macintosh drivers default on Macs 2007-06-22 18:41:18 -07:00
mca
md md: fix bug in error handling during raid1 repair 2007-06-16 13:16:15 -07:00
media V4L/DVB (5822): Fix the return value in ttpci_budget_init() 2007-07-03 15:11:21 -03:00
message
mfd SM501: Check SM501 ID register on initialisation 2007-06-24 08:59:11 -07:00
misc DMI-based module autoloading 2007-07-11 16:09:00 -07:00
mmc mmc: at91_mci: fix hanging and rework to match flowcharts 2007-07-09 21:29:07 +02:00
mtd [MIPS] remove LASAT Networks platforms support 2007-07-10 17:33:04 +01:00
net Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6 2007-07-10 14:56:22 -07:00
nubus
oprofile
parisc [PARISC] stop lcd driver from stripping initial whitespace 2007-06-21 17:46:19 -04:00
parport
pci
pcmcia
pnp PNP SMCf010 quirk: work around Toshiba Portege 4000 ACPI issues 2007-07-06 10:23:43 -07:00
power [BATTERY] One Laptop Per Child power/battery driver 2007-07-10 11:28:22 +01:00
ps3
rapidio
rtc
s390 [S390] vmlogrdr function annotation. 2007-07-10 11:24:54 +02:00
sbus
scsi scsi disk help file is not complete 2007-07-02 10:12:34 -04:00
serial PCMCIA-NETDEV : add new ID of lan&modem multifunction card 2007-07-08 22:16:39 -04:00
sh
sn
spi
tc [MIPS] DEC: Fix modpost warning. 2007-07-10 17:33:05 +01:00
telephony
usb potential compiler error, irqfunc caller sites update 2007-07-06 10:23:43 -07:00
video fix section mismatch in chipsfb 2007-06-28 11:34:54 -07:00
w1 [BATTERY] ds2760 W1 slave 2007-07-10 11:28:31 +01:00
zorro
Kconfig Merge git://git.infradead.org/~dwmw2/battery-2.6 2007-07-10 14:47:59 -07:00
Makefile [BATTERY] Universal power supply class (was: battery class) 2007-07-10 11:25:44 +01:00