Commit 2071db4848ea809887e97248dd3dec02a2e3dd6b

Authored by Linus Walleij
Committed by Samuel Ortiz
1 parent 6048a3dd23

mfd: Use AB3100 MFD core IRQ for interrupt randomness

This reintroduces the entropy sampling of the AB3100 IRQ as the
IRQF_SAMPLE_RANDOM is going out according to the feature removal
schedule. I'm trying to do this the right way then, so CC:ing some
random people for a quick review. We add entropy for interrupt
events in the AB3100 which are truly random in nature, like
external cables being connected, voltages on batteries dropping
below certain ranges, ADC triggers or overheating.

Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
Cc: Robin Getz <rgetz@blackfin.uclinux.org>
Acked-by: Matt Mackall <mpm@selenic.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>

Showing 2 changed files with 11 additions and 10 deletions Side-by-side Diff

... ... @@ -329,8 +329,8 @@
329 329 the PCF50633 chip.
330 330  
331 331 config AB3100_CORE
332   - tristate "ST-Ericsson AB3100 Mixed Signal Circuit core functions"
333   - depends on I2C
  332 + bool "ST-Ericsson AB3100 Mixed Signal Circuit core functions"
  333 + depends on I2C=y
334 334 default y if ARCH_U300
335 335 help
336 336 Select this to enable the AB3100 Mixed Signal IC core
drivers/mfd/ab3100-core.c
1 1 /*
2   - * Copyright (C) 2007-2009 ST-Ericsson
  2 + * Copyright (C) 2007-2010 ST-Ericsson
3 3 * License terms: GNU General Public License (GPL) version 2
4 4 * Low-level core for exclusive access to the AB3100 IC on the I2C bus
5 5 * and some basic chip-configuration.
... ... @@ -14,6 +14,7 @@
14 14 #include <linux/platform_device.h>
15 15 #include <linux/device.h>
16 16 #include <linux/interrupt.h>
  17 +#include <linux/random.h>
17 18 #include <linux/debugfs.h>
18 19 #include <linux/seq_file.h>
19 20 #include <linux/uaccess.h>
... ... @@ -376,6 +377,8 @@
376 377 u32 fatevent;
377 378 int err;
378 379  
  380 + add_interrupt_randomness(irq);
  381 +
379 382 err = ab3100_get_register_page_interruptible(ab3100, AB3100_EVENTA1,
380 383 event_regs, 3);
381 384 if (err)
... ... @@ -720,10 +723,7 @@
720 723 .id = -1, \
721 724 }
722 725  
723   -/*
724   - * This lists all the subdevices and corresponding register
725   - * ranges.
726   - */
  726 +/* This lists all the subdevices */
727 727 AB3100_DEVICE(dac, "ab3100-dac");
728 728 AB3100_DEVICE(leds, "ab3100-leds");
729 729 AB3100_DEVICE(power, "ab3100-power");
730 730  
... ... @@ -889,10 +889,11 @@
889 889 if (err)
890 890 goto exit_no_setup;
891 891  
892   - /* This real unpredictable IRQ is of course sampled for entropy */
893 892 err = request_threaded_irq(client->irq, NULL, ab3100_irq_handler,
894   - IRQF_ONESHOT,
895   - "ab3100-core", ab3100);
  893 + IRQF_ONESHOT, "ab3100-core", ab3100);
  894 + /* This real unpredictable IRQ is of course sampled for entropy */
  895 + rand_initialize_irq(client->irq);
  896 +
896 897 if (err)
897 898 goto exit_no_irq;
898 899