How can I know/list available options for kernel modules?

Solution 1:

modinfo does it:

modinfo i915 | grep '^parm:'

For open source modules the most reliable way is to look at the source. You don't need to be a kernel developer.

See source for i915.

Solution 2:

You can find all the applicable i915 kernel params applicable for your card using a command such as

sudo grep -H '' /sys/module/i915/parameters/*

or

sudo grep . /sys/module/i915/parameters/*

(thanks @arrange)

In my case I can potentially use:

/sys/module/i915/parameters/fbpercrtc:0
/sys/module/i915/parameters/i915_enable_rc6:1
/sys/module/i915/parameters/lvds_downclock:1
/sys/module/i915/parameters/lvds_use_ssc:1
/sys/module/i915/parameters/modeset:-1
/sys/module/i915/parameters/powersave:1
/sys/module/i915/parameters/reset:Y
/sys/module/i915/parameters/semaphores:0

If no parameters are identified then either that is a true statement - or the kernel is loading a different kernel module than you were expecting:

 sudo lshw -c display

  *-display               
       description: VGA compatible controller
       product: Core Processor Integrated Graphics Controller
       vendor: Intel Corporation
       physical id: 2
       bus info: pci@0000:00:02.0
       version: 18
       width: 64 bits
       clock: 33MHz
       capabilities: msi pm vga_controller bus_master cap_list rom
       configuration: driver=i915 latency=0
       resources: irq:41 memory:90000000-903fffff memory:80000000-8fffffff ioport:3050(size=8)

In the above trace you can see in the configuration line "driver=i915" that the kernel sees the video card and has loaded the i915 module.

source

Solution 3:

Perhaps this is an newer modinfo options, but modinfo support listing only the parameters:

$ modinfo -p i915

or

$ modinfo --parameters i915

Note: the $ sign is just the prompt display. It shows that the command can be run as a non-root user and without sudo.

It is possible to also check the current parameters of an already loaded modules using systool:

systool is part of the sysfsutils package. Install it with this command

sudo apt-get install sysfsutils

Then use it this way

$ systool -v -m i915

In the output of this command check the "Parameters:" section.