Commit 31453a97 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge branch 'akpm-incoming-1'

* akpm-incoming-1: (176 commits)
  scripts/checkpatch.pl: add check for declaration of pci_device_id
  scripts/checkpatch.pl: add warnings for static char that could be static const char
  checkpatch: version 0.31
  checkpatch: statement/block context analyser should look at sanitised lines
  checkpatch: handle EXPORT_SYMBOL for DEVICE_ATTR and similar
  checkpatch: clean up structure definition macro handline
  checkpatch: update copyright dates
  checkpatch: Add additional attribute #defines
  checkpatch: check for incorrect permissions
  checkpatch: ensure kconfig help checks only apply when we are adding help
  checkpatch: simplify and consolidate "missing space after" checks
  checkpatch: add check for space after struct, union, and enum
  checkpatch: returning errno typically should be negative
  checkpatch: handle casts better fixing false categorisation of : as binary
  checkpatch: ensure we do not collapse bracketed sections into constants
  checkpatch: suggest cleanpatch and cleanfile when appropriate
  checkpatch: types may sit on a line on their own
  checkpatch: fix regressions in "fix handling of leading spaces"
  div64_u64(): improve precision on 32bit platforms
  lib/parser: cleanup match_number()
  ...
parents f9ba5375 93ed0e2d
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -375,12 +375,12 @@ KernelPageSize: 4 kB
MMUPageSize:           4 kB

The first of these lines shows the same information as is displayed for the
mapping in /proc/PID/maps.  The remaining lines show  the size of the mapping,
the amount of the mapping that is currently resident in RAM, the "proportional
set size” (divide each shared page by the number of processes sharing it), the
number of clean and dirty shared pages in the mapping, and the number of clean
and dirty private pages in the mapping.  The "Referenced" indicates the amount
of memory currently marked as referenced or accessed.
mapping in /proc/PID/maps.  The remaining lines show the size of the mapping
(size), the amount of the mapping that is currently resident in RAM (RSS), the
process' proportional share of this mapping (PSS), the number of clean and
dirty shared pages in the mapping, and the number of clean and dirty private
pages in the mapping.  The "Referenced" indicates the amount of memory
currently marked as referenced or accessed.

This file is only present if the CONFIG_MMU kernel configuration option is
enabled.
+111 −0
Original line number Diff line number Diff line
Kernel driver apds990x
======================

Supported chips:
Avago APDS990X

Data sheet:
Not freely available

Author:
Samu Onkalo <samu.p.onkalo@nokia.com>

Description
-----------

APDS990x is a combined ambient light and proximity sensor. ALS and proximity
functionality are highly connected. ALS measurement path must be running
while the proximity functionality is enabled.

ALS produces raw measurement values for two channels: Clear channel
(infrared + visible light) and IR only. However, threshold comparisons happen
using clear channel only. Lux value and the threshold level on the HW
might vary quite much depending the spectrum of the light source.

Driver makes necessary conversions to both directions so that user handles
only lux values. Lux value is calculated using information from the both
channels. HW threshold level is calculated from the given lux value to match
with current type of the lightning. Sometimes inaccuracy of the estimations
lead to false interrupt, but that doesn't harm.

ALS contains 4 different gain steps. Driver automatically
selects suitable gain step. After each measurement, reliability of the results
is estimated and new measurement is trigged if necessary.

Platform data can provide tuned values to the conversion formulas if
values are known. Otherwise plain sensor default values are used.

Proximity side is little bit simpler. There is no need for complex conversions.
It produces directly usable values.

Driver controls chip operational state using pm_runtime framework.
Voltage regulators are controlled based on chip operational state.

SYSFS
-----


chip_id
	RO - shows detected chip type and version

power_state
	RW - enable / disable chip. Uses counting logic
	     1 enables the chip
	     0 disables the chip
lux0_input
	RO - measured lux value
	     sysfs_notify called when threshold interrupt occurs

lux0_sensor_range
	RO - lux0_input max value. Actually never reaches since sensor tends
	     to saturate much before that. Real max value varies depending
	     on the light spectrum etc.

lux0_rate
	RW - measurement rate in Hz

lux0_rate_avail
	RO - supported measurement rates

lux0_calibscale
	RW - calibration value. Set to neutral value by default.
	     Output results are multiplied with calibscale / calibscale_default
	     value.

lux0_calibscale_default
	RO - neutral calibration value

lux0_thresh_above_value
	RW - HI level threshold value. All results above the value
	     trigs an interrupt. 65535 (i.e. sensor_range) disables the above
	     interrupt.

lux0_thresh_below_value
	RW - LO level threshold value. All results below the value
	     trigs an interrupt. 0 disables the below interrupt.

prox0_raw
	RO - measured proximity value
	     sysfs_notify called when threshold interrupt occurs

prox0_sensor_range
	RO - prox0_raw max value (1023)

prox0_raw_en
	RW - enable / disable proximity - uses counting logic
	     1 enables the proximity
	     0 disables the proximity

prox0_reporting_mode
	RW - trigger / periodic. In "trigger" mode the driver tells two possible
	     values: 0 or prox0_sensor_range value. 0 means no proximity,
	     1023 means proximity. This causes minimal number of interrupts.
	     In "periodic" mode the driver reports all values above
	     prox0_thresh_above. This causes more interrupts, but it can give
	     _rough_ estimate about the distance.

prox0_reporting_mode_avail
	RO - accepted values to prox0_reporting_mode (trigger, periodic)

prox0_thresh_above_value
	RW - threshold level which trigs proximity events.
+116 −0
Original line number Diff line number Diff line
Kernel driver bh1770glc
=======================

Supported chips:
ROHM BH1770GLC
OSRAM SFH7770

Data sheet:
Not freely available

Author:
Samu Onkalo <samu.p.onkalo@nokia.com>

Description
-----------
BH1770GLC and SFH7770 are combined ambient light and proximity sensors.
ALS and proximity parts operates on their own, but they shares common I2C
interface and interrupt logic. In principle they can run on their own,
but ALS side results are used to estimate reliability of the proximity sensor.

ALS produces 16 bit lux values. The chip contains interrupt logic to produce
low and high threshold interrupts.

Proximity part contains IR-led driver up to 3 IR leds. The chip measures
amount of reflected IR light and produces proximity result. Resolution is
8 bit. Driver supports only one channel. Driver uses ALS results to estimate
reliability of the proximity results. Thus ALS is always running while
proximity detection is needed.

Driver uses threshold interrupts to avoid need for polling the values.
Proximity low interrupt doesn't exists in the chip. This is simulated
by using a delayed work. As long as there is proximity threshold above
interrupts the delayed work is pushed forward. So, when proximity level goes
below the threshold value, there is no interrupt and the delayed work will
finally run. This is handled as no proximity indication.

Chip state is controlled via runtime pm framework when enabled in config.

Calibscale factor is used to hide differences between the chips. By default
value set to neutral state meaning factor of 1.00. To get proper values,
calibrated source of light is needed as a reference. Calibscale factor is set
so that measurement produces about the expected lux value.

SYSFS
-----

chip_id
	RO - shows detected chip type and version

power_state
	RW - enable / disable chip. Uses counting logic
	     1 enables the chip
	     0 disables the chip

lux0_input
	RO - measured lux value
	     sysfs_notify called when threshold interrupt occurs

lux0_sensor_range
	RO - lux0_input max value

lux0_rate
	RW - measurement rate in Hz

lux0_rate_avail
	RO - supported measurement rates

lux0_thresh_above_value
	RW - HI level threshold value. All results above the value
	     trigs an interrupt. 65535 (i.e. sensor_range) disables the above
	     interrupt.

lux0_thresh_below_value
	RW - LO level threshold value. All results below the value
	     trigs an interrupt. 0 disables the below interrupt.

lux0_calibscale
	RW - calibration value. Set to neutral value by default.
	     Output results are multiplied with calibscale / calibscale_default
	     value.

lux0_calibscale_default
	RO - neutral calibration value

prox0_raw
	RO - measured proximity value
	     sysfs_notify called when threshold interrupt occurs

prox0_sensor_range
	RO - prox0_raw max value

prox0_raw_en
	RW - enable / disable proximity - uses counting logic
	     1 enables the proximity
	     0 disables the proximity

prox0_thresh_above_count
	RW - number of proximity interrupts needed before triggering the event

prox0_rate_above
	RW - Measurement rate (in Hz) when the level is above threshold
	     i.e. when proximity on has been reported.

prox0_rate_below
	RW - Measurement rate (in Hz) when the level is below threshold
	     i.e. when proximity off has been reported.

prox0_rate_avail
	RO - Supported proximity measurement rates in Hz

prox0_thresh_above0_value
	RW - threshold level which trigs proximity events.
	     Filtered by persistence filter (prox0_thresh_above_count)

prox0_thresh_above1_value
	RW - threshold level which trigs event immediately
+27 −0
Original line number Diff line number Diff line
@@ -97,6 +97,33 @@ hpet_open_close(int argc, const char **argv)
void
hpet_info(int argc, const char **argv)
{
	struct hpet_info	info;
	int			fd;

	if (argc != 1) {
		fprintf(stderr, "hpet_info: device-name\n");
		return;
	}

	fd = open(argv[0], O_RDONLY);
	if (fd < 0) {
		fprintf(stderr, "hpet_info: open of %s failed\n", argv[0]);
		return;
	}

	if (ioctl(fd, HPET_INFO, &info) < 0) {
		fprintf(stderr, "hpet_info: failed to get info\n");
		goto out;
	}

	fprintf(stderr, "hpet_info: hi_irqfreq 0x%lx hi_flags 0x%lx ",
		info.hi_ireqfreq, info.hi_flags);
	fprintf(stderr, "hi_hpet %d hi_timer %d\n",
		info.hi_hpet, info.hi_timer);

out:
	close(fd);
	return;
}

void
+29 −10
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ use constant HIGH_KSWAPD_LATENCY => 20;
use constant HIGH_KSWAPD_REWAKEUP		=> 21;
use constant HIGH_NR_SCANNED			=> 22;
use constant HIGH_NR_TAKEN			=> 23;
use constant HIGH_NR_RECLAIM			=> 24;
use constant HIGH_NR_RECLAIMED			=> 24;
use constant HIGH_NR_CONTIG_DIRTY		=> 25;

my %perprocesspid;
@@ -58,11 +58,13 @@ my $opt_read_procstat;
my $total_wakeup_kswapd;
my ($total_direct_reclaim, $total_direct_nr_scanned);
my ($total_direct_latency, $total_kswapd_latency);
my ($total_direct_nr_reclaimed);
my ($total_direct_writepage_file_sync, $total_direct_writepage_file_async);
my ($total_direct_writepage_anon_sync, $total_direct_writepage_anon_async);
my ($total_kswapd_nr_scanned, $total_kswapd_wake);
my ($total_kswapd_writepage_file_sync, $total_kswapd_writepage_file_async);
my ($total_kswapd_writepage_anon_sync, $total_kswapd_writepage_anon_async);
my ($total_kswapd_nr_reclaimed);

# Catch sigint and exit on request
my $sigint_report = 0;
@@ -104,7 +106,7 @@ my $regex_kswapd_wake_default = 'nid=([0-9]*) order=([0-9]*)';
my $regex_kswapd_sleep_default = 'nid=([0-9]*)';
my $regex_wakeup_kswapd_default = 'nid=([0-9]*) zid=([0-9]*) order=([0-9]*)';
my $regex_lru_isolate_default = 'isolate_mode=([0-9]*) order=([0-9]*) nr_requested=([0-9]*) nr_scanned=([0-9]*) nr_taken=([0-9]*) contig_taken=([0-9]*) contig_dirty=([0-9]*) contig_failed=([0-9]*)';
my $regex_lru_shrink_inactive_default = 'lru=([A-Z_]*) nr_scanned=([0-9]*) nr_reclaimed=([0-9]*) priority=([0-9]*)';
my $regex_lru_shrink_inactive_default = 'nid=([0-9]*) zid=([0-9]*) nr_scanned=([0-9]*) nr_reclaimed=([0-9]*) priority=([0-9]*) flags=([A-Z_|]*)';
my $regex_lru_shrink_active_default = 'lru=([A-Z_]*) nr_scanned=([0-9]*) nr_rotated=([0-9]*) priority=([0-9]*)';
my $regex_writepage_default = 'page=([0-9a-f]*) pfn=([0-9]*) flags=([A-Z_|]*)';

@@ -203,8 +205,8 @@ $regex_lru_shrink_inactive = generate_traceevent_regex(
			"vmscan/mm_vmscan_lru_shrink_inactive",
			$regex_lru_shrink_inactive_default,
			"nid", "zid",
			"lru",
			"nr_scanned", "nr_reclaimed", "priority");
			"nr_scanned", "nr_reclaimed", "priority",
			"flags");
$regex_lru_shrink_active = generate_traceevent_regex(
			"vmscan/mm_vmscan_lru_shrink_active",
			$regex_lru_shrink_active_default,
@@ -375,6 +377,16 @@ EVENT_PROCESS:
			my $nr_contig_dirty = $7;
			$perprocesspid{$process_pid}->{HIGH_NR_SCANNED} += $nr_scanned;
			$perprocesspid{$process_pid}->{HIGH_NR_CONTIG_DIRTY} += $nr_contig_dirty;
		} elsif ($tracepoint eq "mm_vmscan_lru_shrink_inactive") {
			$details = $5;
			if ($details !~ /$regex_lru_shrink_inactive/o) {
				print "WARNING: Failed to parse mm_vmscan_lru_shrink_inactive as expected\n";
				print "         $details\n";
				print "         $regex_lru_shrink_inactive/o\n";
				next;
			}
			my $nr_reclaimed = $4;
			$perprocesspid{$process_pid}->{HIGH_NR_RECLAIMED} += $nr_reclaimed;
		} elsif ($tracepoint eq "mm_vmscan_writepage") {
			$details = $5;
			if ($details !~ /$regex_writepage/o) {
@@ -464,8 +476,8 @@ sub dump_stats {

	# Print out process activity
	printf("\n");
	printf("%-" . $max_strlen . "s %8s %10s   %8s   %8s %8s %8s %8s\n", "Process", "Direct",  "Wokeup", "Pages",   "Pages",   "Pages",     "Time");
	printf("%-" . $max_strlen . "s %8s %10s   %8s   %8s %8s %8s %8s\n", "details", "Rclms",   "Kswapd", "Scanned", "Sync-IO", "ASync-IO",  "Stalled");
	printf("%-" . $max_strlen . "s %8s %10s   %8s %8s  %8s %8s %8s %8s\n", "Process", "Direct",  "Wokeup", "Pages",   "Pages",   "Pages",   "Pages",     "Time");
	printf("%-" . $max_strlen . "s %8s %10s   %8s %8s  %8s %8s %8s %8s\n", "details", "Rclms",   "Kswapd", "Scanned", "Rclmed",  "Sync-IO", "ASync-IO",  "Stalled");
	foreach $process_pid (keys %stats) {

		if (!$stats{$process_pid}->{MM_VMSCAN_DIRECT_RECLAIM_BEGIN}) {
@@ -475,6 +487,7 @@ sub dump_stats {
		$total_direct_reclaim += $stats{$process_pid}->{MM_VMSCAN_DIRECT_RECLAIM_BEGIN};
		$total_wakeup_kswapd += $stats{$process_pid}->{MM_VMSCAN_WAKEUP_KSWAPD};
		$total_direct_nr_scanned += $stats{$process_pid}->{HIGH_NR_SCANNED};
		$total_direct_nr_reclaimed += $stats{$process_pid}->{HIGH_NR_RECLAIMED};
		$total_direct_writepage_file_sync += $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_FILE_SYNC};
		$total_direct_writepage_anon_sync += $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_ANON_SYNC};
		$total_direct_writepage_file_async += $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_FILE_ASYNC};
@@ -489,11 +502,12 @@ sub dump_stats {
			$index++;
		}

		printf("%-" . $max_strlen . "s %8d %10d   %8u   %8u %8u %8.3f",
		printf("%-" . $max_strlen . "s %8d %10d   %8u %8u  %8u %8u %8.3f",
			$process_pid,
			$stats{$process_pid}->{MM_VMSCAN_DIRECT_RECLAIM_BEGIN},
			$stats{$process_pid}->{MM_VMSCAN_WAKEUP_KSWAPD},
			$stats{$process_pid}->{HIGH_NR_SCANNED},
			$stats{$process_pid}->{HIGH_NR_RECLAIMED},
			$stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_FILE_SYNC} + $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_ANON_SYNC},
			$stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_FILE_ASYNC} + $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_ANON_ASYNC},
			$this_reclaim_delay / 1000);
@@ -529,8 +543,8 @@ sub dump_stats {

	# Print out kswapd activity
	printf("\n");
	printf("%-" . $max_strlen . "s %8s %10s   %8s   %8s %8s %8s\n", "Kswapd",   "Kswapd",  "Order",     "Pages",   "Pages",  "Pages");
	printf("%-" . $max_strlen . "s %8s %10s   %8s   %8s %8s %8s\n", "Instance", "Wakeups", "Re-wakeup", "Scanned", "Sync-IO", "ASync-IO");
	printf("%-" . $max_strlen . "s %8s %10s   %8s   %8s %8s %8s\n", "Kswapd",   "Kswapd",  "Order",     "Pages",   "Pages",   "Pages",  "Pages");
	printf("%-" . $max_strlen . "s %8s %10s   %8s   %8s %8s %8s\n", "Instance", "Wakeups", "Re-wakeup", "Scanned", "Rclmed",  "Sync-IO", "ASync-IO");
	foreach $process_pid (keys %stats) {

		if (!$stats{$process_pid}->{MM_VMSCAN_KSWAPD_WAKE}) {
@@ -539,16 +553,18 @@ sub dump_stats {

		$total_kswapd_wake += $stats{$process_pid}->{MM_VMSCAN_KSWAPD_WAKE};
		$total_kswapd_nr_scanned += $stats{$process_pid}->{HIGH_NR_SCANNED};
		$total_kswapd_nr_reclaimed += $stats{$process_pid}->{HIGH_NR_RECLAIMED};
		$total_kswapd_writepage_file_sync += $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_FILE_SYNC};
		$total_kswapd_writepage_anon_sync += $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_ANON_SYNC};
		$total_kswapd_writepage_file_async += $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_FILE_ASYNC};
		$total_kswapd_writepage_anon_async += $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_ANON_ASYNC};

		printf("%-" . $max_strlen . "s %8d %10d   %8u   %8i %8u",
		printf("%-" . $max_strlen . "s %8d %10d   %8u %8u  %8i %8u",
			$process_pid,
			$stats{$process_pid}->{MM_VMSCAN_KSWAPD_WAKE},
			$stats{$process_pid}->{HIGH_KSWAPD_REWAKEUP},
			$stats{$process_pid}->{HIGH_NR_SCANNED},
			$stats{$process_pid}->{HIGH_NR_RECLAIMED},
			$stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_FILE_SYNC} + $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_ANON_SYNC},
			$stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_FILE_ASYNC} + $stats{$process_pid}->{MM_VMSCAN_WRITEPAGE_ANON_ASYNC});

@@ -579,6 +595,7 @@ sub dump_stats {
	print "\nSummary\n";
	print "Direct reclaims:     			$total_direct_reclaim\n";
	print "Direct reclaim pages scanned:		$total_direct_nr_scanned\n";
	print "Direct reclaim pages reclaimed:		$total_direct_nr_reclaimed\n";
	print "Direct reclaim write file sync I/O:	$total_direct_writepage_file_sync\n";
	print "Direct reclaim write anon sync I/O:	$total_direct_writepage_anon_sync\n";
	print "Direct reclaim write file async I/O:	$total_direct_writepage_file_async\n";
@@ -588,6 +605,7 @@ sub dump_stats {
	print "\n";
	print "Kswapd wakeups:				$total_kswapd_wake\n";
	print "Kswapd pages scanned:			$total_kswapd_nr_scanned\n";
	print "Kswapd pages reclaimed:			$total_kswapd_nr_reclaimed\n";
	print "Kswapd reclaim write file sync I/O:	$total_kswapd_writepage_file_sync\n";
	print "Kswapd reclaim write anon sync I/O:	$total_kswapd_writepage_anon_sync\n";
	print "Kswapd reclaim write file async I/O:	$total_kswapd_writepage_file_async\n";
@@ -612,6 +630,7 @@ sub aggregate_perprocesspid() {
		$perprocess{$process}->{MM_VMSCAN_WAKEUP_KSWAPD} += $perprocesspid{$process_pid}->{MM_VMSCAN_WAKEUP_KSWAPD};
		$perprocess{$process}->{HIGH_KSWAPD_REWAKEUP} += $perprocesspid{$process_pid}->{HIGH_KSWAPD_REWAKEUP};
		$perprocess{$process}->{HIGH_NR_SCANNED} += $perprocesspid{$process_pid}->{HIGH_NR_SCANNED};
		$perprocess{$process}->{HIGH_NR_RECLAIMED} += $perprocesspid{$process_pid}->{HIGH_NR_RECLAIMED};
		$perprocess{$process}->{MM_VMSCAN_WRITEPAGE_FILE_SYNC} += $perprocesspid{$process_pid}->{MM_VMSCAN_WRITEPAGE_FILE_SYNC};
		$perprocess{$process}->{MM_VMSCAN_WRITEPAGE_ANON_SYNC} += $perprocesspid{$process_pid}->{MM_VMSCAN_WRITEPAGE_ANON_SYNC};
		$perprocess{$process}->{MM_VMSCAN_WRITEPAGE_FILE_ASYNC} += $perprocesspid{$process_pid}->{MM_VMSCAN_WRITEPAGE_FILE_ASYNC};
Loading