Merge branch 'akpm' (Andrew's patch-bomb)
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 23 Mar 2012 23:59:10 +0000 (16:59 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 23 Mar 2012 23:59:10 +0000 (16:59 -0700)
Merge second batch of patches from Andrew Morton:
 - various misc things
 - core kernel changes to prctl, exit, exec, init, etc.
 - kernel/watchdog.c updates
 - get_maintainer
 - MAINTAINERS
 - the backlight driver queue
 - core bitops code cleanups
 - the led driver queue
 - some core prio_tree work
 - checkpatch udpates
 - largeish crc32 update
 - a new poll() feature for the v4l guys
 - the rtc driver queue
 - fatfs
 - ptrace
 - signals
 - kmod/usermodehelper updates
 - coredump
 - procfs updates

* emailed from Andrew Morton <akpm@linux-foundation.org>: (141 commits)
  seq_file: add seq_set_overflow(), seq_overflow()
  proc-ns: use d_set_d_op() API to set dentry ops in proc_ns_instantiate().
  procfs: speed up /proc/pid/stat, statm
  procfs: add num_to_str() to speed up /proc/stat
  proc: speed up /proc/stat handling
  fs/proc/kcore.c: make get_sparsemem_vmemmap_info() static
  coredump: add VM_NODUMP, MADV_NODUMP, MADV_CLEAR_NODUMP
  coredump: remove VM_ALWAYSDUMP flag
  kmod: make __request_module() killable
  kmod: introduce call_modprobe() helper
  usermodehelper: ____call_usermodehelper() doesn't need do_exit()
  usermodehelper: kill umh_wait, renumber UMH_* constants
  usermodehelper: implement UMH_KILLABLE
  usermodehelper: introduce umh_complete(sub_info)
  usermodehelper: use UMH_WAIT_PROC consistently
  signal: zap_pid_ns_processes: s/SEND_SIG_NOINFO/SEND_SIG_FORCED/
  signal: oom_kill_task: use SEND_SIG_FORCED instead of force_sig()
  signal: cosmetic, s/from_ancestor_ns/force/ in prepare_signal() paths
  signal: give SEND_SIG_FORCED more power to beat SIGNAL_UNKILLABLE
  Hexagon: use set_current_blocked() and block_sigmask()
  ...

213 files changed:
Documentation/00-INDEX
Documentation/backlight/lp855x-driver.txt [new file with mode: 0644]
Documentation/crc32.txt [new file with mode: 0644]
Documentation/leds/leds-lp5521.txt
MAINTAINERS
arch/Kconfig
arch/alpha/include/asm/mman.h
arch/arm/include/asm/pgtable-nommu.h
arch/arm/kernel/process.c
arch/blackfin/Kconfig
arch/blackfin/include/asm/irq.h
arch/c6x/include/asm/pgtable.h
arch/hexagon/kernel/signal.c
arch/hexagon/kernel/vdso.c
arch/microblaze/include/asm/pgtable.h
arch/mips/include/asm/mman.h
arch/mips/kernel/vdso.c
arch/mn10300/Kconfig
arch/mn10300/include/asm/reset-regs.h
arch/openrisc/include/asm/pgtable.h
arch/parisc/include/asm/mman.h
arch/powerpc/kernel/vdso.c
arch/s390/kernel/vdso.c
arch/sh/kernel/vsyscall/vsyscall.c
arch/sparc/Kconfig
arch/sparc/include/asm/irq_64.h
arch/tile/mm/elf.c
arch/um/kernel/signal.c
arch/unicore32/kernel/process.c
arch/x86/kernel/cpu/perf_event.c
arch/x86/kernel/irqinit.c
arch/x86/um/mem_32.c
arch/x86/um/vdso/vma.c
arch/x86/vdso/vdso32-setup.c
arch/x86/vdso/vma.c
arch/xtensa/include/asm/mman.h
crypto/Kconfig
crypto/crc32c.c
drivers/base/regmap/regcache-lzo.c
drivers/block/drbd/drbd_nl.c
drivers/leds/Kconfig
drivers/leds/Makefile
drivers/leds/led-class.c
drivers/leds/led-core.c
drivers/leds/leds-gpio.c
drivers/leds/leds-lm3530.c
drivers/leds/leds-lp5521.c
drivers/leds/leds-lp5523.c
drivers/leds/leds-pca9633.c [new file with mode: 0644]
drivers/leds/leds-tca6507.c
drivers/mtd/chips/cfi_cmdset_0001.c
drivers/mtd/mtdchar.c
drivers/rtc/Kconfig
drivers/rtc/Makefile
drivers/rtc/rtc-at91sam9.c
drivers/rtc/rtc-bq32k.c
drivers/rtc/rtc-cmos.c
drivers/rtc/rtc-coh901331.c
drivers/rtc/rtc-da9052.c [new file with mode: 0644]
drivers/rtc/rtc-davinci.c
drivers/rtc/rtc-ds1305.c
drivers/rtc/rtc-ds1307.c
drivers/rtc/rtc-ds1374.c
drivers/rtc/rtc-ds1390.c
drivers/rtc/rtc-ds1511.c
drivers/rtc/rtc-ds1553.c
drivers/rtc/rtc-ds1672.c
drivers/rtc/rtc-ds3232.c
drivers/rtc/rtc-ds3234.c
drivers/rtc/rtc-em3027.c
drivers/rtc/rtc-fm3130.c
drivers/rtc/rtc-isl12022.c
drivers/rtc/rtc-isl1208.c
drivers/rtc/rtc-lpc32xx.c
drivers/rtc/rtc-ls1x.c [new file with mode: 0644]
drivers/rtc/rtc-m41t80.c
drivers/rtc/rtc-m41t93.c
drivers/rtc/rtc-m41t94.c
drivers/rtc/rtc-max6900.c
drivers/rtc/rtc-max6902.c
drivers/rtc/rtc-max8925.c
drivers/rtc/rtc-mpc5121.c
drivers/rtc/rtc-mrst.c
drivers/rtc/rtc-mv.c
drivers/rtc/rtc-nuc900.c
drivers/rtc/rtc-omap.c
drivers/rtc/rtc-pcf2123.c
drivers/rtc/rtc-pcf8563.c
drivers/rtc/rtc-pcf8583.c
drivers/rtc/rtc-pl030.c
drivers/rtc/rtc-pl031.c
drivers/rtc/rtc-pm8xxx.c
drivers/rtc/rtc-pxa.c
drivers/rtc/rtc-r9701.c
drivers/rtc/rtc-rs5c348.c
drivers/rtc/rtc-rs5c372.c
drivers/rtc/rtc-rv3029c2.c
drivers/rtc/rtc-rx8025.c
drivers/rtc/rtc-rx8581.c
drivers/rtc/rtc-s35390a.c
drivers/rtc/rtc-s3c.c
drivers/rtc/rtc-sa1100.c
drivers/rtc/rtc-sh.c
drivers/rtc/rtc-spear.c
drivers/rtc/rtc-stk17ta8.c
drivers/rtc/rtc-twl.c
drivers/rtc/rtc-tx4939.c
drivers/rtc/rtc-vr41xx.c
drivers/rtc/rtc-x1205.c
drivers/s390/char/sclp_cmd.c
drivers/staging/rtl8187se/r8180_core.c
drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
drivers/staging/telephony/ixj.c
drivers/uwb/allocator.c
drivers/video/backlight/88pm860x_bl.c
drivers/video/backlight/Kconfig
drivers/video/backlight/Makefile
drivers/video/backlight/aat2870_bl.c
drivers/video/backlight/adp5520_bl.c
drivers/video/backlight/adp8860_bl.c
drivers/video/backlight/adp8870_bl.c
drivers/video/backlight/ams369fg06.c
drivers/video/backlight/corgi_lcd.c
drivers/video/backlight/cr_bllcd.c
drivers/video/backlight/da903x_bl.c
drivers/video/backlight/l4f00242t03.c
drivers/video/backlight/ld9040.c
drivers/video/backlight/lms283gf05.c
drivers/video/backlight/lp855x_bl.c [new file with mode: 0644]
drivers/video/backlight/ltv350qv.c
drivers/video/backlight/max8925_bl.c
drivers/video/backlight/omap1_bl.c
drivers/video/backlight/ot200_bl.c [new file with mode: 0644]
drivers/video/backlight/pandora_bl.c [new file with mode: 0644]
drivers/video/backlight/pcf50633-backlight.c
drivers/video/backlight/platform_lcd.c
drivers/video/backlight/pwm_bl.c
drivers/video/backlight/s6e63m0.c
drivers/video/backlight/tdo24m.c
drivers/video/backlight/tosa_bl.c
drivers/video/backlight/tosa_lcd.c
drivers/video/backlight/vgg2432a4.c
drivers/video/backlight/wm831x_bl.c
drivers/video/uvesafb.c
fs/binfmt_elf.c
fs/binfmt_misc.c
fs/block_dev.c
fs/eventpoll.c
fs/fat/namei_vfat.c
fs/notify/notification.c
fs/pipe.c
fs/proc/array.c
fs/proc/kcore.c
fs/proc/namespaces.c
fs/proc/stat.c
fs/select.c
fs/seq_file.c
include/asm-generic/bug.h
include/asm-generic/mman-common.h
include/asm-generic/vmlinux.lds.h
include/drm/drm_mode.h
include/linux/bitops.h
include/linux/compiler-gcc.h
include/linux/crc32.h
include/linux/kernel.h
include/linux/kmod.h
include/linux/led-lm3530.h
include/linux/leds-lp5521.h
include/linux/lp855x.h [new file with mode: 0644]
include/linux/magic.h
include/linux/mm.h
include/linux/mmc/ioctl.h
include/linux/nmi.h
include/linux/pipe_fs_i.h
include/linux/poll.h
include/linux/prctl.h
include/linux/ptrace.h
include/linux/rcupdate.h
include/linux/sched.h
include/linux/seq_file.h
include/linux/tracehook.h
include/net/sock.h
include/scsi/scsi_netlink.h
include/sound/compress_params.h
include/xen/xenbus.h
init/calibrate.c
init/do_mounts.c
kernel/exit.c
kernel/fork.c
kernel/kmod.c
kernel/pid_namespace.c
kernel/ptrace.c
kernel/signal.c
kernel/sys.c
kernel/watchdog.c
lib/Kconfig
lib/Kconfig.debug
lib/crc32.c
lib/crc32defs.h
lib/gen_crc32table.c
lib/prio_tree.c
lib/string.c
lib/vsprintf.c
mm/hugetlb.c
mm/madvise.c
mm/memory.c
mm/oom_kill.c
net/unix/af_unix.c
scripts/checkpatch.pl
scripts/get_maintainer.pl
security/keys/request_key.c
security/tomoyo/load_policy.c
tools/perf/util/include/linux/bitops.h

index a1a643272883065a2a97a98adceded20912db381..2214f123a9766e772c877d216d66768b5703c581 100644 (file)
@@ -104,6 +104,8 @@ cpuidle/
        - info on CPU_IDLE, CPU idle state management subsystem.
 cputopology.txt
        - documentation on how CPU topology info is exported via sysfs.
+crc32.txt
+       - brief tutorial on CRC computation
 cris/
        - directory with info about Linux on CRIS architecture.
 crypto/
diff --git a/Documentation/backlight/lp855x-driver.txt b/Documentation/backlight/lp855x-driver.txt
new file mode 100644 (file)
index 0000000..f5e4caa
--- /dev/null
@@ -0,0 +1,78 @@
+Kernel driver lp855x
+====================
+
+Backlight driver for LP855x ICs
+
+Supported chips:
+       Texas Instruments LP8550, LP8551, LP8552, LP8553 and LP8556
+
+Author: Milo(Woogyom) Kim <milo.kim@ti.com>
+
+Description
+-----------
+
+* Brightness control
+
+Brightness can be controlled by the pwm input or the i2c command.
+The lp855x driver supports both cases.
+
+* Device attributes
+
+1) bl_ctl_mode
+Backlight control mode.
+Value : pwm based or register based
+
+2) chip_id
+The lp855x chip id.
+Value : lp8550/lp8551/lp8552/lp8553/lp8556
+
+Platform data for lp855x
+------------------------
+
+For supporting platform specific data, the lp855x platform data can be used.
+
+* name : Backlight driver name. If it is not defined, default name is set.
+* mode : Brightness control mode. PWM or register based.
+* device_control : Value of DEVICE CONTROL register.
+* initial_brightness : Initial value of backlight brightness.
+* pwm_data : Platform specific pwm generation functions.
+            Only valid when brightness is pwm input mode.
+            Functions should be implemented by PWM driver.
+            - pwm_set_intensity() : set duty of PWM
+            - pwm_get_intensity() : get current duty of PWM
+* load_new_rom_data :
+       0 : use default configuration data
+       1 : update values of eeprom or eprom registers on loading driver
+* size_program : Total size of lp855x_rom_data.
+* rom_data : List of new eeprom/eprom registers.
+
+example 1) lp8552 platform data : i2c register mode with new eeprom data
+
+#define EEPROM_A5_ADDR 0xA5
+#define EEPROM_A5_VAL  0x4f    /* EN_VSYNC=0 */
+
+static struct lp855x_rom_data lp8552_eeprom_arr[] = {
+       {EEPROM_A5_ADDR, EEPROM_A5_VAL},
+};
+
+static struct lp855x_platform_data lp8552_pdata = {
+       .name = "lcd-bl",
+       .mode = REGISTER_BASED,
+       .device_control = I2C_CONFIG(LP8552),
+       .initial_brightness = INITIAL_BRT,
+       .load_new_rom_data = 1,
+       .size_program = ARRAY_SIZE(lp8552_eeprom_arr),
+       .rom_data = lp8552_eeprom_arr,
+};
+
+example 2) lp8556 platform data : pwm input mode with default rom data
+
+static struct lp855x_platform_data lp8556_pdata = {
+       .mode = PWM_BASED,
+       .device_control = PWM_CONFIG(LP8556),
+       .initial_brightness = INITIAL_BRT,
+       .pwm_data = {
+                    .pwm_set_intensity = platform_pwm_set_intensity,
+                    .pwm_get_intensity = platform_pwm_get_intensity,
+                    },
+};
diff --git a/Documentation/crc32.txt b/Documentation/crc32.txt
new file mode 100644 (file)
index 0000000..a08a7dd
--- /dev/null
@@ -0,0 +1,182 @@
+A brief CRC tutorial.
+
+A CRC is a long-division remainder.  You add the CRC to the message,
+and the whole thing (message+CRC) is a multiple of the given
+CRC polynomial.  To check the CRC, you can either check that the
+CRC matches the recomputed value, *or* you can check that the
+remainder computed on the message+CRC is 0.  This latter approach
+is used by a lot of hardware implementations, and is why so many
+protocols put the end-of-frame flag after the CRC.
+
+It's actually the same long division you learned in school, except that
+- We're working in binary, so the digits are only 0 and 1, and
+- When dividing polynomials, there are no carries.  Rather than add and
+  subtract, we just xor.  Thus, we tend to get a bit sloppy about
+  the difference between adding and subtracting.
+
+Like all division, the remainder is always smaller than the divisor.
+To produce a 32-bit CRC, the divisor is actually a 33-bit CRC polynomial.
+Since it's 33 bits long, bit 32 is always going to be set, so usually the
+CRC is written in hex with the most significant bit omitted.  (If you're
+familiar with the IEEE 754 floating-point format, it's the same idea.)
+
+Note that a CRC is computed over a string of *bits*, so you have
+to decide on the endianness of the bits within each byte.  To get
+the best error-detecting properties, this should correspond to the
+order they're actually sent.  For example, standard RS-232 serial is
+little-endian; the most significant bit (sometimes used for parity)
+is sent last.  And when appending a CRC word to a message, you should
+do it in the right order, matching the endianness.
+
+Just like with ordinary division, you proceed one digit (bit) at a time.
+Each step of the division you take one more digit (bit) of the dividend
+and append it to the current remainder.  Then you figure out the
+appropriate multiple of the divisor to subtract to being the remainder
+back into range.  In binary, this is easy - it has to be either 0 or 1,
+and to make the XOR cancel, it's just a copy of bit 32 of the remainder.
+
+When computing a CRC, we don't care about the quotient, so we can
+throw the quotient bit away, but subtract the appropriate multiple of
+the polynomial from the remainder and we're back to where we started,
+ready to process the next bit.
+
+A big-endian CRC written this way would be coded like:
+for (i = 0; i < input_bits; i++) {
+       multiple = remainder & 0x80000000 ? CRCPOLY : 0;
+       remainder = (remainder << 1 | next_input_bit()) ^ multiple;
+}
+
+Notice how, to get at bit 32 of the shifted remainder, we look
+at bit 31 of the remainder *before* shifting it.
+
+But also notice how the next_input_bit() bits we're shifting into
+the remainder don't actually affect any decision-making until
+32 bits later.  Thus, the first 32 cycles of this are pretty boring.
+Also, to add the CRC to a message, we need a 32-bit-long hole for it at
+the end, so we have to add 32 extra cycles shifting in zeros at the
+end of every message,
+
+These details lead to a standard trick: rearrange merging in the
+next_input_bit() until the moment it's needed.  Then the first 32 cycles
+can be precomputed, and merging in the final 32 zero bits to make room
+for the CRC can be skipped entirely.  This changes the code to:
+
+for (i = 0; i < input_bits; i++) {
+       remainder ^= next_input_bit() << 31;
+       multiple = (remainder & 0x80000000) ? CRCPOLY : 0;
+       remainder = (remainder << 1) ^ multiple;
+}
+
+With this optimization, the little-endian code is particularly simple:
+for (i = 0; i < input_bits; i++) {
+       remainder ^= next_input_bit();
+       multiple = (remainder & 1) ? CRCPOLY : 0;
+       remainder = (remainder >> 1) ^ multiple;
+}
+
+The most significant coefficient of the remainder polynomial is stored
+in the least significant bit of the binary "remainder" variable.
+The other details of endianness have been hidden in CRCPOLY (which must
+be bit-reversed) and next_input_bit().
+
+As long as next_input_bit is returning the bits in a sensible order, we don't
+*have* to wait until the last possible moment to merge in additional bits.
+We can do it 8 bits at a time rather than 1 bit at a time:
+for (i = 0; i < input_bytes; i++) {
+       remainder ^= next_input_byte() << 24;
+       for (j = 0; j < 8; j++) {
+               multiple = (remainder & 0x80000000) ? CRCPOLY : 0;
+               remainder = (remainder << 1) ^ multiple;
+       }
+}
+
+Or in little-endian:
+for (i = 0; i < input_bytes; i++) {
+       remainder ^= next_input_byte();
+       for (j = 0; j < 8; j++) {
+               multiple = (remainder & 1) ? CRCPOLY : 0;
+               remainder = (remainder >> 1) ^ multiple;
+       }
+}
+
+If the input is a multiple of 32 bits, you can even XOR in a 32-bit
+word at a time and increase the inner loop count to 32.
+
+You can also mix and match the two loop styles, for example doing the
+bulk of a message byte-at-a-time and adding bit-at-a-time processing
+for any fractional bytes at the end.
+
+To reduce the number of conditional branches, software commonly uses
+the byte-at-a-time table method, popularized by Dilip V. Sarwate,
+"Computation of Cyclic Redundancy Checks via Table Look-Up", Comm. ACM
+v.31 no.8 (August 1998) p. 1008-1013.
+
+Here, rather than just shifting one bit of the remainder to decide
+in the correct multiple to subtract, we can shift a byte at a time.
+This produces a 40-bit (rather than a 33-bit) intermediate remainder,
+and the correct multiple of the polynomial to subtract is found using
+a 256-entry lookup table indexed by the high 8 bits.
+
+(The table entries are simply the CRC-32 of the given one-byte messages.)
+
+When space is more constrained, smaller tables can be used, e.g. two
+4-bit shifts followed by a lookup in a 16-entry table.
+
+It is not practical to process much more than 8 bits at a time using this
+technique, because tables larger than 256 entries use too much memory and,
+more importantly, too much of the L1 cache.
+
+To get higher software performance, a "slicing" technique can be used.
+See "High Octane CRC Generation with the Intel Slicing-by-8 Algorithm",
+ftp://download.intel.com/technology/comms/perfnet/download/slicing-by-8.pdf
+
+This does not change the number of table lookups, but does increase
+the parallelism.  With the classic Sarwate algorithm, each table lookup
+must be completed before the index of the next can be computed.
+
+A "slicing by 2" technique would shift the remainder 16 bits at a time,
+producing a 48-bit intermediate remainder.  Rather than doing a single
+lookup in a 65536-entry table, the two high bytes are looked up in
+two different 256-entry tables.  Each contains the remainder required
+to cancel out the corresponding byte.  The tables are different because the
+polynomials to cancel are different.  One has non-zero coefficients from
+x^32 to x^39, while the other goes from x^40 to x^47.
+
+Since modern processors can handle many parallel memory operations, this
+takes barely longer than a single table look-up and thus performs almost
+twice as fast as the basic Sarwate algorithm.
+
+This can be extended to "slicing by 4" using 4 256-entry tables.
+Each step, 32 bits of data is fetched, XORed with the CRC, and the result
+broken into bytes and looked up in the tables.  Because the 32-bit shift
+leaves the low-order bits of the intermediate remainder zero, the
+final CRC is simply the XOR of the 4 table look-ups.
+
+But this still enforces sequential execution: a second group of table
+look-ups cannot begin until the previous groups 4 table look-ups have all
+been completed.  Thus, the processor's load/store unit is sometimes idle.
+
+To make maximum use of the processor, "slicing by 8" performs 8 look-ups
+in parallel.  Each step, the 32-bit CRC is shifted 64 bits and XORed
+with 64 bits of input data.  What is important to note is that 4 of
+those 8 bytes are simply copies of the input data; they do not depend
+on the previous CRC at all.  Thus, those 4 table look-ups may commence
+immediately, without waiting for the previous loop iteration.
+
+By always having 4 loads in flight, a modern superscalar processor can
+be kept busy and make full use of its L1 cache.
+
+Two more details about CRC implementation in the real world:
+
+Normally, appending zero bits to a message which is already a multiple
+of a polynomial produces a larger multiple of that polynomial.  Thus,
+a basic CRC will not detect appended zero bits (or bytes).  To enable
+a CRC to detect this condition, it's common to invert the CRC before
+appending it.  This makes the remainder of the message+crc come out not
+as zero, but some fixed non-zero value.  (The CRC of the inversion
+pattern, 0xffffffff.)
+
+The same problem applies to zero bits prepended to the message, and a
+similar solution is used.  Instead of starting the CRC computation with
+a remainder of 0, an initial remainder of all ones is used.  As long as
+you start the same way on decoding, it doesn't make a difference.
index c4d8d151e0fea698138cf4575643871d31cf11d2..0e542ab3d4a0f0d21cf915672c0686bf105a2e23 100644 (file)
@@ -43,17 +43,23 @@ Format: 10x mA i.e 10 means 1.0 mA
 example platform data:
 
 Note: chan_nr can have values between 0 and 2.
+The name of each channel can be configurable.
+If the name field is not defined, the default name will be set to 'xxxx:channelN'
+(XXXX : pdata->label or i2c client name, N : channel number)
 
 static struct lp5521_led_config lp5521_led_config[] = {
         {
+               .name = "red",
                 .chan_nr        = 0,
                 .led_current    = 50,
                .max_current    = 130,
         }, {
+               .name = "green",
                 .chan_nr        = 1,
                 .led_current    = 0,
                .max_current    = 130,
         }, {
+               .name = "blue",
                 .chan_nr        = 2,
                 .led_current    = 0,
                .max_current    = 130,
@@ -86,3 +92,60 @@ static struct lp5521_platform_data lp5521_platform_data = {
 
 If the current is set to 0 in the platform data, that channel is
 disabled and it is not visible in the sysfs.
+
+The 'update_config' : CONFIG register (ADDR 08h)
+This value is platform-specific data.
+If update_config is not defined, the CONFIG register is set with
+'LP5521_PWRSAVE_EN | LP5521_CP_MODE_AUTO | LP5521_R_TO_BATT'.
+(Enable auto-powersave, set charge pump to auto, red to battery)
+
+example of update_config :
+
+#define LP5521_CONFIGS (LP5521_PWM_HF | LP5521_PWRSAVE_EN | \
+                       LP5521_CP_MODE_AUTO | LP5521_R_TO_BATT | \
+                       LP5521_CLK_INT)
+
+static struct lp5521_platform_data lp5521_pdata = {
+       .led_config = lp5521_led_config,
+       .num_channels = ARRAY_SIZE(lp5521_led_config),
+       .clock_mode = LP5521_CLOCK_INT,
+       .update_config = LP5521_CONFIGS,
+};
+
+LED patterns : LP5521 has autonomous operation without external control.
+Pattern data can be defined in the platform data.
+
+example of led pattern data :
+
+/* RGB(50,5,0) 500ms on, 500ms off, infinite loop */
+static u8 pattern_red[] = {
+               0x40, 0x32, 0x60, 0x00, 0x40, 0x00, 0x60, 0x00,
+               };
+
+static u8 pattern_green[] = {
+               0x40, 0x05, 0x60, 0x00, 0x40, 0x00, 0x60, 0x00,
+               };
+
+static struct lp5521_led_pattern board_led_patterns[] = {
+       {
+               .r = pattern_red,
+               .g = pattern_green,
+               .size_r = ARRAY_SIZE(pattern_red),
+               .size_g = ARRAY_SIZE(pattern_green),
+       },
+};
+
+static struct lp5521_platform_data lp5521_platform_data = {
+        .led_config     = lp5521_led_config,
+        .num_channels   = ARRAY_SIZE(lp5521_led_config),
+        .clock_mode     = LP5521_CLOCK_EXT,
+       .patterns = board_led_patterns,
+       .num_patterns = ARRAY_SIZE(board_led_patterns),
+};
+
+Then predefined led pattern(s) can be executed via the sysfs.
+To start the pattern #1,
+# echo 1 > /sys/bus/i2c/devices/xxxx/led_pattern
+(xxxx : i2c bus & slave address)
+To end the pattern,
+# echo 0 > /sys/bus/i2c/devices/xxxx/led_pattern
index ec9bcb17c57277e1734f8f8baff6014030ee2e03..f47091abb8f7eb4f7eaa84407f91b361126b054e 100644 (file)
@@ -163,7 +163,7 @@ M:  Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 L:     linux-serial@vger.kernel.org
 W:     http://serial.sourceforge.net
 S:     Maintained
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6.git
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git
 F:     drivers/tty/serial/8250*
 F:     include/linux/serial_8250.h
 
@@ -464,6 +464,7 @@ ALPHA PORT
 M:     Richard Henderson <rth@twiddle.net>
 M:     Ivan Kokshaysky <ink@jurassic.park.msu.ru>
 M:     Matt Turner <mattst88@gmail.com>
+S:     Odd Fixes
 L:     linux-alpha@vger.kernel.org
 F:     arch/alpha/
 
@@ -715,6 +716,7 @@ S:  Maintained
 ARM/CLKDEV SUPPORT
 M:     Russell King <linux@arm.linux.org.uk>
 L:     linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
+S:     Maintained
 F:     arch/arm/include/asm/clkdev.h
 F:     drivers/clk/clkdev.c
 
@@ -1502,7 +1504,7 @@ F:        drivers/i2c/busses/i2c-bfin-twi.c
 
 BLOCK LAYER
 M:     Jens Axboe <axboe@kernel.dk>
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-2.6-block.git
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git
 S:     Maintained
 F:     block/
 
@@ -1640,7 +1642,7 @@ BTTV VIDEO4LINUX DRIVER
 M:     Mauro Carvalho Chehab <mchehab@infradead.org>
 L:     linux-media@vger.kernel.org
 W:     http://linuxtv.org
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git
 S:     Maintained
 F:     Documentation/video4linux/bttv/
 F:     drivers/media/video/bt8xx/bttv*
@@ -1670,7 +1672,7 @@ F:        fs/cachefiles/
 CAFE CMOS INTEGRATED CAMERA CONTROLLER DRIVER
 M:     Jonathan Corbet <corbet@lwn.net>
 L:     linux-media@vger.kernel.org
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git
 S:     Maintained
 F:     Documentation/video4linux/cafe_ccic
 F:     drivers/media/video/marvell-ccic/
@@ -1841,6 +1843,7 @@ F:        include/linux/cleancache.h
 
 CLK API
 M:     Russell King <linux@arm.linux.org.uk>
+S:     Maintained
 F:     include/linux/clk.h
 
 CISCO FCOE HBA DRIVER
@@ -2036,7 +2039,7 @@ CX18 VIDEO4LINUX DRIVER
 M:     Andy Walls <awalls@md.metrocast.net>
 L:     ivtv-devel@ivtvdriver.org (moderated for non-subscribers)
 L:     linux-media@vger.kernel.org
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git
 W:     http://linuxtv.org
 W:     http://www.ivtvdriver.org/index.php/Cx18
 S:     Maintained
@@ -2350,7 +2353,7 @@ F:        Documentation/blockdev/drbd/
 
 DRIVER CORE, KOBJECTS, DEBUGFS AND SYSFS
 M:     Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6.git
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git
 S:     Supported
 F:     Documentation/kobject.txt
 F:     drivers/base/
@@ -2372,7 +2375,7 @@ INTEL DRM DRIVERS (excluding Poulsbo, Moorestown and derivative chipsets)
 M:     Keith Packard <keithp@keithp.com>
 L:     intel-gfx@lists.freedesktop.org (subscribers-only)
 L:     dri-devel@lists.freedesktop.org
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/keithp/linux-2.6.git
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/keithp/linux.git
 S:     Supported
 F:     drivers/gpu/drm/i915
 F:     include/drm/i915*
@@ -2966,8 +2969,8 @@ GFS2 FILE SYSTEM
 M:     Steven Whitehouse <swhiteho@redhat.com>
 L:     cluster-devel@redhat.com
 W:     http://sources.redhat.com/cluster/
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-2.6-fixes.git
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-2.6-nmw.git
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-3.0-fixes.git
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-3.0-nmw.git
 S:     Supported
 F:     Documentation/filesystems/gfs2*.txt
 F:     fs/gfs2/
@@ -3008,42 +3011,42 @@ F:      drivers/net/ethernet/aeroflex/
 GSPCA FINEPIX SUBDRIVER
 M:     Frank Zago <frank@zago.net>
 L:     linux-media@vger.kernel.org
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git
 S:     Maintained
 F:     drivers/media/video/gspca/finepix.c
 
 GSPCA GL860 SUBDRIVER
 M:     Olivier Lorin <o.lorin@laposte.net>
 L:     linux-media@vger.kernel.org
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git
 S:     Maintained
 F:     drivers/media/video/gspca/gl860/
 
 GSPCA M5602 SUBDRIVER
 M:     Erik Andren <erik.andren@gmail.com>
 L:     linux-media@vger.kernel.org
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git
 S:     Maintained
 F:     drivers/media/video/gspca/m5602/
 
 GSPCA PAC207 SONIXB SUBDRIVER
 M:     Hans de Goede <hdegoede@redhat.com>
 L:     linux-media@vger.kernel.org
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git
 S:     Maintained
 F:     drivers/media/video/gspca/pac207.c
 
 GSPCA SN9C20X SUBDRIVER
 M:     Brian Johnson <brijohn@gmail.com>
 L:     linux-media@vger.kernel.org
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git
 S:     Maintained
 F:     drivers/media/video/gspca/sn9c20x.c
 
 GSPCA T613 SUBDRIVER
 M:     Leandro Costantino <lcostantino@gmail.com>
 L:     linux-media@vger.kernel.org
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git
 S:     Maintained
 F:     drivers/media/video/gspca/t613.c
 
@@ -3051,7 +3054,7 @@ GSPCA USB WEBCAM DRIVER
 M:     Jean-Francois Moine <moinejf@free.fr>
 W:     http://moinejf.free.fr
 L:     linux-media@vger.kernel.org
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git
 S:     Maintained
 F:     drivers/media/video/gspca/
 
@@ -3337,7 +3340,7 @@ IDE SUBSYSTEM
 M:     "David S. Miller" <davem@davemloft.net>
 L:     linux-ide@vger.kernel.org
 Q:     http://patchwork.ozlabs.org/project/linux-ide/list/
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide-2.6.git
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide.git
 S:     Maintained
 F:     Documentation/ide/
 F:     drivers/ide/
@@ -3449,7 +3452,7 @@ F:        firmware/isci/
 INTEL IDLE DRIVER
 M:     Len Brown <lenb@kernel.org>
 L:     linux-pm@vger.kernel.org
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-idle-2.6.git
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux.git
 S:     Supported
 F:     drivers/idle/intel_idle.c
 
@@ -3756,7 +3759,7 @@ IVTV VIDEO4LINUX DRIVER
 M:     Andy Walls <awalls@md.metrocast.net>
 L:     ivtv-devel@ivtvdriver.org (moderated for non-subscribers)
 L:     linux-media@vger.kernel.org
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git
 W:     http://www.ivtvdriver.org
 S:     Maintained
 F:     Documentation/video4linux/*.ivtv
@@ -3852,8 +3855,8 @@ F:        fs/autofs4/
 
 KERNEL BUILD + files below scripts/ (unless maintained elsewhere)
 M:     Michal Marek <mmarek@suse.cz>
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6.git for-next
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6.git rc-fixes
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild.git for-next
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild.git rc-fixes
 L:     linux-kbuild@vger.kernel.org
 S:     Maintained
 F:     Documentation/kbuild/
@@ -4233,12 +4236,14 @@ F:      Documentation/hwmon/ltc4261
 F:     drivers/hwmon/ltc4261.c
 
 LTP (Linux Test Project)
-M:     Rishikesh K Rajak <risrajak@linux.vnet.ibm.com>
-M:     Garrett Cooper <yanegomi@gmail.com>
+M:     Shubham Goyal <shubham@linux.vnet.ibm.com>
 M:     Mike Frysinger <vapier@gentoo.org>
-M:     Subrata Modak <subrata@linux.vnet.ibm.com>
+M:     Cyril Hrubis <chrubis@suse.cz>
+M:     Caspar Zhang <caspar@casparzhang.com>
+M:     Wanlong Gao <gaowanlong@cn.fujitsu.com>
 L:     ltp-list@lists.sourceforge.net (subscribers-only)
 W:     http://ltp.sourceforge.net/
+T:     git git://github.com/linux-test-project/ltp.git
 T:     git git://ltp.git.sourceforge.net/gitroot/ltp/ltp-dev
 S:     Maintained
 
@@ -4276,7 +4281,7 @@ MAC80211
 M:     Johannes Berg <johannes@sipsolutions.net>
 L:     linux-wireless@vger.kernel.org
 W:     http://linuxwireless.org/
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-2.6.git
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless.git
 S:     Maintained
 F:     Documentation/networking/mac80211-injection.txt
 F:     include/net/mac80211.h
@@ -4287,7 +4292,7 @@ M:        Stefano Brivio <stefano.brivio@polimi.it>
 M:     Mattias Nissler <mattias.nissler@gmx.de>
 L:     linux-wireless@vger.kernel.org
 W:     http://linuxwireless.org/en/developers/Documentation/mac80211/RateControl/PID
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-2.6.git
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless.git
 S:     Maintained
 F:     net/mac80211/rc80211_pid*
 
@@ -4359,7 +4364,7 @@ P:        LinuxTV.org Project
 L:     linux-media@vger.kernel.org
 W:     http://linuxtv.org
 Q:     http://patchwork.kernel.org/project/linux-media/list/
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git
 S:     Maintained
 F:     Documentation/dvb/
 F:     Documentation/video4linux/
@@ -4416,6 +4421,13 @@ T:       git git://git.monstr.eu/linux-2.6-microblaze.git
 S:     Supported
 F:     arch/microblaze/
 
+MICROCHANNEL ARCHITECTURE (MCA)
+M:     James Bottomley <James.Bottomley@HansenPartnership.com>
+S:     Maintained
+F:     Documentation/mca.txt
+F:     drivers/mca/
+F:     include/linux/mca*
+
 MICROTEK X6 SCANNER
 M:     Oliver Neukum <oliver@neukum.name>
 S:     Maintained
@@ -4431,14 +4443,6 @@ S:       Supported
 F:     Documentation/mips/
 F:     arch/mips/
 
-MISCELLANEOUS MCA-SUPPORT
-M:     James Bottomley <James.Bottomley@HansenPartnership.com>
-S:     Maintained
-F:     Documentation/ia64/mca.txt
-F:     Documentation/mca.txt
-F:     drivers/mca/
-F:     include/linux/mca*
-
 MODULE SUPPORT
 M:     Rusty Russell <rusty@rustcorp.com.au>
 S:     Maintained
@@ -4646,7 +4650,7 @@ M:        James Morris <jmorris@namei.org>
 M:     Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
 M:     Patrick McHardy <kaber@trash.net>
 L:     netdev@vger.kernel.org
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.git
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git
 S:     Maintained
 F:     net/ipv4/
 F:     net/ipv6/
@@ -4662,7 +4666,7 @@ NETWORKING [WIRELESS]
 M:     "John W. Linville" <linville@tuxdriver.com>
 L:     linux-wireless@vger.kernel.org
 Q:     http://patchwork.kernel.org/project/linux-wireless/list/
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-2.6.git
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless.git
 S:     Maintained
 F:     net/mac80211/
 F:     net/rfkill/
@@ -4675,8 +4679,8 @@ F:        drivers/net/wireless/
 NETWORKING DRIVERS
 L:     netdev@vger.kernel.org
 W:     http://www.linuxfoundation.org/en/Net
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.git
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6.git
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git
 S:     Odd Fixes
 F:     drivers/net/
 F:     include/linux/if_*
@@ -4892,7 +4896,7 @@ F:        drivers/char/pcmcia/cm4040_cs.*
 OMNIVISION OV7670 SENSOR DRIVER
 M:     Jonathan Corbet <corbet@lwn.net>
 L:     linux-media@vger.kernel.org
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git
 S:     Maintained
 F:     drivers/media/video/ov7670.c
 
@@ -5067,7 +5071,7 @@ M:        Helge Deller <deller@gmx.de>
 L:     linux-parisc@vger.kernel.org
 W:     http://www.parisc-linux.org/
 Q:     http://patchwork.kernel.org/project/linux-parisc/list/
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/kyle/parisc-2.6.git
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/jejb/parisc-2.6.git
 S:     Maintained
 F:     arch/parisc/
 F:     drivers/parisc/
@@ -5123,7 +5127,7 @@ PCI SUBSYSTEM
 M:     Bjorn Helgaas <bhelgaas@google.com>
 L:     linux-pci@vger.kernel.org
 Q:     http://patchwork.kernel.org/project/linux-pci/list/
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6.git
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci.git
 S:     Supported
 F:     Documentation/PCI/
 F:     drivers/pci/
@@ -5408,7 +5412,7 @@ M:        Mike Isely <isely@pobox.com>
 L:     pvrusb2@isely.net       (subscribers-only)
 L:     linux-media@vger.kernel.org
 W:     http://www.isely.net/pvrusb2/
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git
 S:     Maintained
 F:     Documentation/video4linux/README.pvrusb2
 F:     drivers/media/video/pvrusb2/
@@ -5574,7 +5578,7 @@ RCUTORTURE MODULE
 M:     Josh Triplett <josh@freedesktop.org>
 M:     "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
 S:     Supported
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-2.6-rcu.git
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git
 F:     Documentation/RCU/torture.txt
 F:     kernel/rcutorture.c
 
@@ -5599,7 +5603,7 @@ M:        Dipankar Sarma <dipankar@in.ibm.com>
 M:     "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
 W:     http://www.rdrop.com/users/paulmck/rclock/
 S:     Supported
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-2.6-rcu.git
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git
 F:     Documentation/RCU/
 F:     include/linux/rcu*
 F:     include/linux/srcu*
@@ -5753,7 +5757,7 @@ F:        drivers/mmc/host/s3cmci.*
 SAA7146 VIDEO4LINUX-2 DRIVER
 M:     Michael Hunold <michael@mihu.de>
 L:     linux-media@vger.kernel.org
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git
 W:     http://www.mihu.de/linux/saa7146
 S:     Maintained
 F:     drivers/media/common/saa7146*
@@ -6176,7 +6180,7 @@ F:        arch/ia64/sn/
 SOC-CAMERA V4L2 SUBSYSTEM
 M:     Guennadi Liakhovetski <g.liakhovetski@gmx.de>
 L:     linux-media@vger.kernel.org
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git
 S:     Maintained
 F:     include/media/v4l2*
 F:     drivers/media/video/v4l2*
@@ -6248,8 +6252,8 @@ SPARC + UltraSPARC (sparc/sparc64)
 M:     "David S. Miller" <davem@davemloft.net>
 L:     sparclinux@vger.kernel.org
 Q:     http://patchwork.ozlabs.org/project/sparclinux/list/
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6.git
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-next-2.6.git
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc.git
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-next.git
 S:     Maintained
 F:     arch/sparc/
 F:     drivers/sbus/
@@ -6257,8 +6261,8 @@ F:        drivers/sbus/
 SPARC SERIAL DRIVERS
 M:     "David S. Miller" <davem@davemloft.net>
 L:     sparclinux@vger.kernel.org
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6.git
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-next-2.6.git
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc.git
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-next.git
 S:     Maintained
 F:     include/linux/sunserialcore.h
 F:     drivers/tty/serial/suncore.c
@@ -6563,7 +6567,7 @@ L:        linux-scsi@vger.kernel.org
 L:     target-devel@vger.kernel.org
 L:     http://groups.google.com/group/linux-iscsi-target-dev
 W:     http://www.linux-iscsi.org
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/nab/lio-core-2.6.git master
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/nab/lio-core.git master
 S:     Supported
 F:     drivers/target/
 F:     include/target/
@@ -6754,7 +6758,7 @@ K:        ^Subject:.*(?i)trivial
 TTY LAYER
 M:     Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 S:     Supported
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6.git
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git
 F:     drivers/tty/
 F:     drivers/tty/serial/serial_core.c
 F:     include/linux/serial_core.h
@@ -6922,7 +6926,7 @@ USB ET61X[12]51 DRIVER
 M:     Luca Risolia <luca.risolia@studio.unibo.it>
 L:     linux-usb@vger.kernel.org
 L:     linux-media@vger.kernel.org
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git
 W:     http://www.linux-projects.org
 S:     Maintained
 F:     drivers/media/video/et61x251/
@@ -7078,7 +7082,7 @@ USB SN9C1xx DRIVER
 M:     Luca Risolia <luca.risolia@studio.unibo.it>
 L:     linux-usb@vger.kernel.org
 L:     linux-media@vger.kernel.org
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git
 W:     http://www.linux-projects.org
 S:     Maintained
 F:     Documentation/video4linux/sn9c102.txt
@@ -7088,7 +7092,7 @@ USB SUBSYSTEM
 M:     Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 L:     linux-usb@vger.kernel.org
 W:     http://www.linux-usb.org
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6.git
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
 S:     Supported
 F:     Documentation/usb/
 F:     drivers/net/usb/
@@ -7114,7 +7118,7 @@ USB VIDEO CLASS
 M:     Laurent Pinchart <laurent.pinchart@ideasonboard.com>
 L:     linux-uvc-devel@lists.berlios.de (subscribers-only)
 L:     linux-media@vger.kernel.org
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git
 W:     http://www.ideasonboard.org/uvc/
 S:     Maintained
 F:     drivers/media/video/uvc/
@@ -7123,7 +7127,7 @@ USB W996[87]CF DRIVER
 M:     Luca Risolia <luca.risolia@studio.unibo.it>
 L:     linux-usb@vger.kernel.org
 L:     linux-media@vger.kernel.org
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git
 W:     http://www.linux-projects.org
 S:     Maintained
 F:     Documentation/video4linux/w9968cf.txt
@@ -7152,7 +7156,7 @@ USB ZR364XX DRIVER
 M:     Antoine Jacquet <royale@zerezo.com>
 L:     linux-usb@vger.kernel.org
 L:     linux-media@vger.kernel.org
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6.git
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media.git
 W:     http://royale.zerezo.com/zr364xx/
 S:     Maintained
 F:     Documentation/video4linux/zr364xx.txt
@@ -7302,7 +7306,7 @@ M:        Liam Girdwood <lrg@ti.com>
 M:     Mark Brown <broonie@opensource.wolfsonmicro.com>
 W:     http://opensource.wolfsonmicro.com/node/15
 W:     http://www.slimlogic.co.uk/?p=48
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/lrg/voltage-2.6.git
+T:     git git://git.kernel.org/pub/scm/linux/kernel/git/lrg/regulator.git
 S:     Supported
 F:     drivers/regulator/
 F:     include/linux/regulator/
index 5b448a74d0f756a41eb275639efef22186f55d66..a6f14f622d1388bee0a6663679762f155991dadc 100644 (file)
@@ -120,6 +120,9 @@ config HAVE_KRETPROBES
 
 config HAVE_OPTPROBES
        bool
+
+config HAVE_NMI_WATCHDOG
+       bool
 #
 # An arch should select this if it provides all these things:
 #
index 72db984f8781391e1b1775f6c50a5699651e41db..cbeb3616a28edf22de663c7fc84c4fc11e13cf05 100644 (file)
 #define MADV_HUGEPAGE  14              /* Worth backing with hugepages */
 #define MADV_NOHUGEPAGE        15              /* Not worth backing with hugepages */
 
+#define MADV_DONTDUMP   16             /* Explicity exclude from the core dump,
+                                          overrides the coredump filter bits */
+#define MADV_DODUMP    17              /* Clear the MADV_NODUMP flag */
+
 /* compatibility flags */
 #define MAP_FILE       0
 
index ffc0e85775b4cff15586897cac32758dc0dda687..7ec60d6075bf47f94fbec24b3f5dd64014fd643b 100644 (file)
@@ -79,7 +79,6 @@ extern unsigned int kobjsize(const void *objp);
  * No page table caches to initialise.
  */
 #define pgtable_cache_init()   do { } while (0)
-#define io_remap_page_range    remap_page_range
 #define io_remap_pfn_range     remap_pfn_range
 
 
index c2ae3cd331feea2e9ea37439cdde6dd458711db1..219e4efee1a6b64d17855ada4ce30db9c35175cd 100644 (file)
@@ -533,8 +533,7 @@ int vectors_user_mapping(void)
        struct mm_struct *mm = current->mm;
        return install_special_mapping(mm, 0xffff0000, PAGE_SIZE,
                                       VM_READ | VM_EXEC |
-                                      VM_MAYREAD | VM_MAYEXEC |
-                                      VM_ALWAYSDUMP | VM_RESERVED,
+                                      VM_MAYREAD | VM_MAYEXEC | VM_RESERVED,
                                       NULL);
 }
 
index abe5a9e85148333ec09b1592b27aeb0e35e225fe..c1269a1085e16fa12b7e5377500b7ef4da829a47 100644 (file)
@@ -36,6 +36,7 @@ config BLACKFIN
        select GENERIC_ATOMIC64
        select GENERIC_IRQ_PROBE
        select IRQ_PER_CPU if SMP
+       select HAVE_NMI_WATCHDOG if NMI_WATCHDOG
 
 config GENERIC_CSUM
        def_bool y
index 12f4060a31b034e9cd7190b075da6f58d6d4abaa..89de539ed0100624ead2e5ea6d7f9790eed11cf2 100644 (file)
@@ -38,8 +38,4 @@
 
 #include <asm-generic/irq.h>
 
-#ifdef CONFIG_NMI_WATCHDOG
-# define ARCH_HAS_NMI_WATCHDOG
-#endif
-
 #endif                         /* _BFIN_IRQ_H_ */
index 68c8af4f1f971ad9039ffd4ef659bebe0bf56273..38a4312eb2cb32482ff82b172e2a37136597bff2 100644 (file)
@@ -73,9 +73,6 @@ extern unsigned long empty_zero_page;
 #define pgtable_cache_init()   do { } while (0)
 #define io_remap_pfn_range      remap_pfn_range
 
-#define io_remap_page_range(vma, vaddr, paddr, size, prot)             \
-               remap_pfn_range(vma, vaddr, (paddr) >> PAGE_SHIFT, size, prot)
-
 #include <asm-generic/pgtable.h>
 
 #endif /* _ASM_C6X_PGTABLE_H */
index b45be3181193d2bfac1516ed7b58d9ec1bb26641..ecbab34576061a4036e9659340b55e64b8d2e5cc 100644 (file)
@@ -192,12 +192,7 @@ static int handle_signal(int sig, siginfo_t *info, struct k_sigaction *ka,
        if (rc)
                return rc;
 
-       spin_lock_irq(&current->sighand->siglock);
-       sigorsets(&current->blocked, &current->blocked, &ka->sa.sa_mask);
-       if (!(ka->sa.sa_flags & SA_NODEFER))
-               sigaddset(&current->blocked, sig);
-       recalc_sigpending();
-       spin_unlock_irq(&current->sighand->siglock);
+       block_sigmask(ka, sig);
 
        return 0;
 }
@@ -305,10 +300,7 @@ asmlinkage int sys_rt_sigreturn(void)
                goto badframe;
 
        sigdelsetmask(&blocked, ~_BLOCKABLE);
-       spin_lock_irq(&current->sighand->siglock);
-       current->blocked = blocked;
-       recalc_sigpending();
-       spin_unlock_irq(&current->sighand->siglock);
+       set_current_blocked(&blocked);
 
        if (restore_sigcontext(regs, &frame->uc.uc_mcontext))
                goto badframe;
index 16277c33308af1cd6a735735bd24932bd76dff9e..f212a453b527d09accbd09c16dbfa5ae506745e1 100644 (file)
@@ -78,8 +78,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
        /* MAYWRITE to allow gdb to COW and set breakpoints. */
        ret = install_special_mapping(mm, vdso_base, PAGE_SIZE,
                                      VM_READ|VM_EXEC|
-                                     VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC|
-                                     VM_ALWAYSDUMP,
+                                     VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC,
                                      &vdso_page);
 
        if (ret)
index b2af42311a1267057d97c6fa4be27647c61a3fb9..44dc67aa02773d577ab606d04109763956512432 100644 (file)
@@ -543,8 +543,6 @@ extern unsigned long iopa(unsigned long addr);
 /* Needs to be defined here and not in linux/mm.h, as it is arch dependent */
 #define kern_addr_valid(addr)  (1)
 
-#define io_remap_page_range remap_page_range
-
 /*
  * No page table caches to initialise
  */
index 785b4ea4ec3f5b3e39bbbc88dd7d3191e76abee2..46d3da0d4b92fb7af7c90c4912398b54e8907e69 100644 (file)
 #define MADV_HUGEPAGE  14              /* Worth backing with hugepages */
 #define MADV_NOHUGEPAGE        15              /* Not worth backing with hugepages */
 
+#define MADV_DONTDUMP   16             /* Explicity exclude from the core dump,
+                                          overrides the coredump filter bits */
+#define MADV_DODUMP    17              /* Clear the MADV_NODUMP flag */
+
 /* compatibility flags */
 #define MAP_FILE       0
 
index e5cdfd603f8fb6dabbdf22051b043604c8ad6496..0f1af58b036a155dab46b898c2d7df04fc2ef245 100644 (file)
@@ -88,8 +88,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
 
        ret = install_special_mapping(mm, addr, PAGE_SIZE,
                                      VM_READ|VM_EXEC|
-                                     VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC|
-                                     VM_ALWAYSDUMP,
+                                     VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC,
                                      &vdso_page);
 
        if (ret)
index 8f1c40d5817ebb80e9bc818deed5c0b0d80f3ac7..3aa3de017159165c322d7e1e05542228ff06b462 100644 (file)
@@ -5,6 +5,7 @@ config MN10300
        select GENERIC_IRQ_SHOW
        select HAVE_ARCH_TRACEHOOK
        select HAVE_ARCH_KGDB
+       select HAVE_NMI_WATCHDOG if MN10300_WD_TIMER
 
 config AM33_2
        def_bool n
index 10c7502a113fbce1cfeb07b56eec061caa1523c8..8ca2a42d365b43a160e4d1bb8eafee2a44dfbe17 100644 (file)
 
 #ifdef __KERNEL__
 
-#ifdef CONFIG_MN10300_WD_TIMER
-#define ARCH_HAS_NMI_WATCHDOG          /* See include/linux/nmi.h */
-#endif
-
 /*
  * watchdog timer registers
  */
index 043505d7f684c9ce292da8e1d8e67920f33e53f8..14c900cfd30a2f90e26e8a6ff5bf08097eacd5b1 100644 (file)
@@ -455,7 +455,6 @@ static inline void update_mmu_cache(struct vm_area_struct *vma,
  * No page table caches to initialise
  */
 #define pgtable_cache_init()           do { } while (0)
-#define io_remap_page_range            remap_page_range
 
 typedef pte_t *pte_addr_t;
 
index f5b7bf5fba6837fb053a05f5394684b9421fe537..12219ebce8695d24bd651dad6a42cedee9e390ec 100644 (file)
 #define MADV_HUGEPAGE  67              /* Worth backing with hugepages */
 #define MADV_NOHUGEPAGE        68              /* Not worth backing with hugepages */
 
+#define MADV_DONTDUMP   69             /* Explicity exclude from the core dump,
+                                          overrides the coredump filter bits */
+#define MADV_DODUMP    70              /* Clear the MADV_NODUMP flag */
+
 /* compatibility flags */
 #define MAP_FILE       0
 #define MAP_VARIABLE   0
index 7d14bb697d407fc93fa6fd8d2411f61c08adbcf2..d36ee1055f88cf3b06e4c4ee2d683f8bd2f9c918 100644 (file)
@@ -263,17 +263,11 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
         * the "data" page of the vDSO or you'll stop getting kernel updates
         * and your nice userland gettimeofday will be totally dead.
         * It's fine to use that for setting breakpoints in the vDSO code
-        * pages though
-        *
-        * Make sure the vDSO gets into every core dump.
-        * Dumping its contents makes post-mortem fully interpretable later
-        * without matching up the same kernel and hardware config to see
-        * what PC values meant.
+        * pages though.
         */
        rc = install_special_mapping(mm, vdso_base, vdso_pages << PAGE_SHIFT,
                                     VM_READ|VM_EXEC|
-                                    VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC|
-                                    VM_ALWAYSDUMP,
+                                    VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC,
                                     vdso_pagelist);
        if (rc) {
                current->mm->context.vdso_base = 0;
index e704a9965f902ce808648da176a99d60505ce927..9c80138206b079dc79e61b88d489c56148f47bad 100644 (file)
@@ -241,17 +241,11 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
         * on the "data" page of the vDSO or you'll stop getting kernel
         * updates and your nice userland gettimeofday will be totally dead.
         * It's fine to use that for setting breakpoints in the vDSO code
-        * pages though
-        *
-        * Make sure the vDSO gets into every core dump.
-        * Dumping its contents makes post-mortem fully interpretable later
-        * without matching up the same kernel and hardware config to see
-        * what PC values meant.
+        * pages though.
         */
        rc = install_special_mapping(mm, vdso_base, vdso_pages << PAGE_SHIFT,
                                     VM_READ|VM_EXEC|
-                                    VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC|
-                                    VM_ALWAYSDUMP,
+                                    VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC,
                                     vdso_pagelist);
        if (rc)
                current->mm->context.vdso_base = 0;
index 1d6d51a1ce7955bb055cc2169b3e22d7c997d3b2..5ca579720a0992322099732c16faa79a1d1b9b75 100644 (file)
@@ -73,8 +73,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
 
        ret = install_special_mapping(mm, addr, PAGE_SIZE,
                                      VM_READ | VM_EXEC |
-                                     VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC |
-                                     VM_ALWAYSDUMP,
+                                     VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC,
                                      syscall_pages);
        if (unlikely(ret))
                goto up_fail;
index ca5580e4d813711f272c57ddb6b5f43428ed99f9..1666de84d477e6e72c00689f1011247501e42db1 100644 (file)
@@ -29,6 +29,7 @@ config SPARC
        select GENERIC_IRQ_SHOW
        select USE_GENERIC_SMP_HELPERS if SMP
        select GENERIC_PCI_IOMAP
+       select HAVE_NMI_WATCHDOG if SPARC64
 
 config SPARC32
        def_bool !64BIT
index 16dcae6d56e7a777b1c833bb8f6f16d57279271a..abf6afe82ca89d1728c422e4d220acdf90c596ee 100644 (file)
@@ -95,7 +95,6 @@ void arch_trigger_all_cpu_backtrace(void);
 extern void *hardirq_stack[NR_CPUS];
 extern void *softirq_stack[NR_CPUS];
 #define __ARCH_HAS_DO_SOFTIRQ
-#define ARCH_HAS_NMI_WATCHDOG
 
 #define NO_IRQ         0xffffffff
 
index 55e58e93bfc58025d4de4815794c2affd9638f9a..1a00fb64fc88316df271121ae6ced4bc96817e2e 100644 (file)
@@ -117,17 +117,11 @@ int arch_setup_additional_pages(struct linux_binprm *bprm,
 
        /*
         * MAYWRITE to allow gdb to COW and set breakpoints
-        *
-        * Make sure the vDSO gets into every core dump.  Dumping its
-        * contents makes post-mortem fully interpretable later
-        * without matching up the same kernel and hardware config to
-        * see what PC values meant.
         */
        vdso_base = VDSO_BASE;
        retval = install_special_mapping(mm, vdso_base, PAGE_SIZE,
                                         VM_READ|VM_EXEC|
-                                        VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC|
-                                        VM_ALWAYSDUMP,
+                                        VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC,
                                         vdso_pages);
 
 #ifndef __tilegx__
index e8b889d3bce760aaf7cc1b8a5bd0297bab66a74d..fb12f4c5e649f60e8ddd847f88fc7c72b5639d24 100644 (file)
@@ -65,21 +65,10 @@ static int handle_signal(struct pt_regs *regs, unsigned long signr,
 #endif
                err = setup_signal_stack_si(sp, signr, ka, regs, info, oldset);
 
-       if (err) {
-               spin_lock_irq(&current->sighand->siglock);
-               current->blocked = *oldset;
-               recalc_sigpending();
-               spin_unlock_irq(&current->sighand->siglock);
+       if (err)
                force_sigsegv(signr, current);
-       } else {
-               spin_lock_irq(&current->sighand->siglock);
-               sigorsets(&current->blocked, &current->blocked,
-                         &ka->sa.sa_mask);
-               if (!(ka->sa.sa_flags & SA_NODEFER))
-                       sigaddset(&current->blocked, signr);
-               recalc_sigpending();
-               spin_unlock_irq(&current->sighand->siglock);
-       }
+       else
+               block_sigmask(ka, signr);
 
        return err;
 }
@@ -162,12 +151,11 @@ int do_signal(void)
  */
 long sys_sigsuspend(int history0, int history1, old_sigset_t mask)
 {
+       sigset_t blocked;
+
        mask &= _BLOCKABLE;
-       spin_lock_irq(&current->sighand->siglock);
-       current->saved_sigmask = current->blocked;
-       siginitset(&current->blocked, mask);
-       recalc_sigpending();
-       spin_unlock_irq(&current->sighand->siglock);
+       siginitset(&blocked, mask);
+       set_current_blocked(&blocked);
 
        current->state = TASK_INTERRUPTIBLE;
        schedule();
index 52edc2b628732552c1e8cc6578acb5fe2a8a0427..432b4291f37b63a8ccab05b81c52a409ecdef9e7 100644 (file)
@@ -381,7 +381,7 @@ int vectors_user_mapping(void)
        return install_special_mapping(mm, 0xffff0000, PAGE_SIZE,
                                       VM_READ | VM_EXEC |
                                       VM_MAYREAD | VM_MAYEXEC |
-                                      VM_ALWAYSDUMP | VM_RESERVED,
+                                      VM_RESERVED,
                                       NULL);
 }
 
index 0a18d16cb58df51f63a0c478db466752e595722c..fa2900c0e3984debf8370b3fc72cdf8a295d34b9 100644 (file)
@@ -643,14 +643,14 @@ static bool __perf_sched_find_counter(struct perf_sched *sched)
        /* Prefer fixed purpose counters */
        if (x86_pmu.num_counters_fixed) {
                idx = X86_PMC_IDX_FIXED;
-               for_each_set_bit_cont(idx, c->idxmsk, X86_PMC_IDX_MAX) {
+               for_each_set_bit_from(idx, c->idxmsk, X86_PMC_IDX_MAX) {
                        if (!__test_and_set_bit(idx, sched->state.used))
                                goto done;
                }
        }
        /* Grab the first unused counter starting with idx */
        idx = sched->state.counter;
-       for_each_set_bit_cont(idx, c->idxmsk, X86_PMC_IDX_FIXED) {
+       for_each_set_bit_from(idx, c->idxmsk, X86_PMC_IDX_FIXED) {
                if (!__test_and_set_bit(idx, sched->state.used))
                        goto done;
        }
index 313fb5cddbcec35a38e2f7509e449f1ace4f38bc..43e2b1cff0a7f5963fa585818a883d5ffec28e2b 100644 (file)
@@ -306,10 +306,10 @@ void __init native_init_IRQ(void)
         * us. (some of these will be overridden and become
         * 'special' SMP interrupts)
         */
-       for (i = FIRST_EXTERNAL_VECTOR; i < NR_VECTORS; i++) {
+       i = FIRST_EXTERNAL_VECTOR;
+       for_each_clear_bit_from(i, used_vectors, NR_VECTORS) {
                /* IA32_SYSCALL_VECTOR could be used in trap_init already. */
-               if (!test_bit(i, used_vectors))
-                       set_intr_gate(i, interrupt[i-FIRST_EXTERNAL_VECTOR]);
+               set_intr_gate(i, interrupt[i - FIRST_EXTERNAL_VECTOR]);
        }
 
        if (!acpi_ioapic && !of_ioapic)
index 639900a6fde9942a534739c2de8f5451e3082bff..f40281e5d6a27430e5aa018dba8861bcf4a208b6 100644 (file)
@@ -23,14 +23,6 @@ static int __init gate_vma_init(void)
        gate_vma.vm_flags = VM_READ | VM_MAYREAD | VM_EXEC | VM_MAYEXEC;
        gate_vma.vm_page_prot = __P101;
 
-       /*
-        * Make sure the vDSO gets into every core dump.
-        * Dumping its contents makes post-mortem fully interpretable later
-        * without matching up the same kernel and hardware config to see
-        * what PC values meant.
-        */
-       gate_vma.vm_flags |= VM_ALWAYSDUMP;
-
        return 0;
 }
 __initcall(gate_vma_init);
index 91f4ec9a0a56eb2997e51ee339877656be7d6174..af91901babb8455f9ed4a8e10b8f6f8f856d8bec 100644 (file)
@@ -64,8 +64,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
 
        err = install_special_mapping(mm, um_vdso_addr, PAGE_SIZE,
                VM_READ|VM_EXEC|
-               VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC|
-               VM_ALWAYSDUMP,
+               VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC,
                vdsop);
 
        up_write(&mm->mmap_sem);
index 468d591dde3159eaeeab46d09c04805354b95882..a944020fa8593f634b3c81ad28d26c6c1de1241b 100644 (file)
@@ -250,13 +250,7 @@ static int __init gate_vma_init(void)
        gate_vma.vm_end = FIXADDR_USER_END;
        gate_vma.vm_flags = VM_READ | VM_MAYREAD | VM_EXEC | VM_MAYEXEC;
        gate_vma.vm_page_prot = __P101;
-       /*
-        * Make sure the vDSO gets into every core dump.
-        * Dumping its contents makes post-mortem fully interpretable later
-        * without matching up the same kernel and hardware config to see
-        * what PC values meant.
-        */
-       gate_vma.vm_flags |= VM_ALWAYSDUMP;
+
        return 0;
 }
 
@@ -343,17 +337,10 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
        if (compat_uses_vma || !compat) {
                /*
                 * MAYWRITE to allow gdb to COW and set breakpoints
-                *
-                * Make sure the vDSO gets into every core dump.
-                * Dumping its contents makes post-mortem fully
-                * interpretable later without matching up the same
-                * kernel and hardware config to see what PC values
-                * meant.
                 */
                ret = install_special_mapping(mm, addr, PAGE_SIZE,
                                              VM_READ|VM_EXEC|
-                                             VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC|
-                                             VM_ALWAYSDUMP,
+                                             VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC,
                                              vdso32_pages);
 
                if (ret)
index 153407c35b75bda37e2b5d2675d3abb6280cc9cd..17e18279649f7029d7c2b10881ad155e6a022e00 100644 (file)
@@ -124,8 +124,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
 
        ret = install_special_mapping(mm, addr, vdso_size,
                                      VM_READ|VM_EXEC|
-                                     VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC|
-                                     VM_ALWAYSDUMP,
+                                     VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC,
                                      vdso_pages);
        if (ret) {
                current->mm->context.vdso = NULL;
index 30789010733d6dc045b352b63ea3363879c0503e..25bc6c1309c331a7c9328a7097018873832ac13d 100644 (file)
 #define MADV_HUGEPAGE  14              /* Worth backing with hugepages */
 #define MADV_NOHUGEPAGE        15              /* Not worth backing with hugepages */
 
+#define MADV_DONTDUMP   16             /* Explicity exclude from the core dump,
+                                          overrides the coredump filter bits */
+#define MADV_DODUMP    17              /* Clear the MADV_NODUMP flag */
+
 /* compatibility flags */
 #define MAP_FILE       0
 
index 6318edd6a4575e0d7feb24ca33675b4e3e4f5312..21ff9d015432e2e50737db0278ed7bea41ff601c 100644 (file)
@@ -308,6 +308,7 @@ comment "Digest"
 config CRYPTO_CRC32C
        tristate "CRC32c CRC algorithm"
        select CRYPTO_HASH
+       select CRC32
        help
          Castagnoli, et al Cyclic Redundancy-Check Algorithm.  Used
          by iSCSI for header and data digests and by others.
index 3f9ad28010522c6409c0a213f2d3d1546b540aa2..06f7018c9d952f632a3541ea236ee0721b8ebdb1 100644 (file)
@@ -40,6 +40,7 @@
 #include <linux/module.h>
 #include <linux/string.h>
 #include <linux/kernel.h>
+#include <linux/crc32.h>
 
 #define CHKSUM_BLOCK_SIZE      1
 #define CHKSUM_DIGEST_SIZE     4
@@ -52,95 +53,6 @@ struct chksum_desc_ctx {
        u32 crc;
 };
 
-/*
- * This is the CRC-32C table
- * Generated with:
- * width = 32 bits
- * poly = 0x1EDC6F41
- * reflect input bytes = true
- * reflect output bytes = true
- */
-
-static const u32 crc32c_table[256] = {
-       0x00000000L, 0xF26B8303L, 0xE13B70F7L, 0x1350F3F4L,
-       0xC79A971FL, 0x35F1141CL, 0x26A1E7E8L, 0xD4CA64EBL,
-       0x8AD958CFL, 0x78B2DBCCL, 0x6BE22838L, 0x9989AB3BL,
-       0x4D43CFD0L, 0xBF284CD3L, 0xAC78BF27L, 0x5E133C24L,
-       0x105EC76FL, 0xE235446CL, 0xF165B798L, 0x030E349BL,
-       0xD7C45070L, 0x25AFD373L, 0x36FF2087L, 0xC494A384L,
-       0x9A879FA0L, 0x68EC1CA3L, 0x7BBCEF57L, 0x89D76C54L,
-       0x5D1D08BFL, 0xAF768BBCL, 0xBC267848L, 0x4E4DFB4BL,
-       0x20BD8EDEL, 0xD2D60DDDL, 0xC186FE29L, 0x33ED7D2AL,
-       0xE72719C1L, 0x154C9AC2L, 0x061C6936L, 0xF477EA35L,
-       0xAA64D611L, 0x580F5512L, 0x4B5FA6E6L, 0xB93425E5L,
-       0x6DFE410EL, 0x9F95C20DL, 0x8CC531F9L, 0x7EAEB2FAL,
-       0x30E349B1L, 0xC288CAB2L, 0xD1D83946L, 0x23B3BA45L,
-       0xF779DEAEL, 0x05125DADL, 0x1642AE59L, 0xE4292D5AL,
-       0xBA3A117EL, 0x4851927DL, 0x5B016189L, 0xA96AE28AL,
-       0x7DA08661L, 0x8FCB0562L, 0x9C9BF696L, 0x6EF07595L,
-       0x417B1DBCL, 0xB3109EBFL, 0xA0406D4BL, 0x522BEE48L,
-       0x86E18AA3L, 0x748A09A0L, 0x67DAFA54L, 0x95B17957L,
-       0xCBA24573L, 0x39C9C670L, 0x2A993584L, 0xD8F2B687L,
-       0x0C38D26CL, 0xFE53516FL, 0xED03A29BL, 0x1F682198L,
-       0x5125DAD3L, 0xA34E59D0L, 0xB01EAA24L, 0x42752927L,
-       0x96BF4DCCL, 0x64D4CECFL, 0x77843D3BL, 0x85EFBE38L,
-       0xDBFC821CL, 0x2997011FL, 0x3AC7F2EBL, 0xC8AC71E8L,
-       0x1C661503L, 0xEE0D9600L, 0xFD5D65F4L, 0x0F36E6F7L,
-       0x61C69362L, 0x93AD1061L, 0x80FDE395L, 0x72966096L,
-       0xA65C047DL, 0x5437877EL, 0x4767748AL, 0xB50CF789L,
-       0xEB1FCBADL, 0x197448AEL, 0x0A24BB5AL, 0xF84F3859L,
-       0x2C855CB2L, 0xDEEEDFB1L, 0xCDBE2C45L, 0x3FD5AF46L,
-       0x7198540DL, 0x83F3D70EL, 0x90A324FAL, 0x62C8A7F9L,
-       0xB602C312L, 0x44694011L, 0x5739B3E5L, 0xA55230E6L,
-       0xFB410CC2L, 0x092A8FC1L, 0x1A7A7C35L, 0xE811FF36L,
-       0x3CDB9BDDL, 0xCEB018DEL, 0xDDE0EB2AL, 0x2F8B6829L,
-       0x82F63B78L, 0x709DB87BL, 0x63CD4B8FL, 0x91A6C88CL,
-       0x456CAC67L, 0xB7072F64L, 0xA457DC90L, 0x563C5F93L,
-       0x082F63B7L, 0xFA44E0B4L, 0xE9141340L, 0x1B7F9043L,
-       0xCFB5F4A8L, 0x3DDE77ABL, 0x2E8E845FL, 0xDCE5075CL,
-       0x92A8FC17L, 0x60C37F14L, 0x73938CE0L, 0x81F80FE3L,
-       0x55326B08L, 0xA759E80BL, 0xB4091BFFL, 0x466298FCL,
-       0x1871A4D8L, 0xEA1A27DBL, 0xF94AD42FL, 0x0B21572CL,
-       0xDFEB33C7L, 0x2D80B0C4L, 0x3ED04330L, 0xCCBBC033L,
-       0xA24BB5A6L, 0x502036A5L, 0x4370C551L, 0xB11B4652L,
-       0x65D122B9L, 0x97BAA1BAL, 0x84EA524EL, 0x7681D14DL,
-       0x2892ED69L, 0xDAF96E6AL, 0xC9A99D9EL, 0x3BC21E9DL,
-       0xEF087A76L, 0x1D63F975L, 0x0E330A81L, 0xFC588982L,
-       0xB21572C9L, 0x407EF1CAL, 0x532E023EL, 0xA145813DL,
-       0x758FE5D6L, 0x87E466D5L, 0x94B49521L, 0x66DF1622L,
-       0x38CC2A06L, 0xCAA7A905L, 0xD9F75AF1L, 0x2B9CD9F2L,
-       0xFF56BD19L, 0x0D3D3E1AL, 0x1E6DCDEEL, 0xEC064EEDL,
-       0xC38D26C4L, 0x31E6A5C7L, 0x22B65633L, 0xD0DDD530L,
-       0x0417B1DBL, 0xF67C32D8L, 0xE52CC12CL, 0x1747422FL,
-       0x49547E0BL, 0xBB3FFD08L, 0xA86F0EFCL, 0x5A048DFFL,
-       0x8ECEE914L, 0x7CA56A17L, 0x6FF599E3L, 0x9D9E1AE0L,
-       0xD3D3E1ABL, 0x21B862A8L, 0x32E8915CL, 0xC083125FL,
-       0x144976B4L, 0xE622F5B7L, 0xF5720643L, 0x07198540L,
-       0x590AB964L, 0xAB613A67L, 0xB831C993L, 0x4A5A4A90L,
-       0x9E902E7BL, 0x6CFBAD78L, 0x7FAB5E8CL, 0x8DC0DD8FL,
-       0xE330A81AL, 0x115B2B19L, 0x020BD8EDL, 0xF0605BEEL,
-       0x24AA3F05L, 0xD6C1BC06L, 0xC5914FF2L, 0x37FACCF1L,
-       0x69E9F0D5L, 0x9B8273D6L, 0x88D28022L, 0x7AB90321L,
-       0xAE7367CAL, 0x5C18E4C9L, 0x4F48173DL, 0xBD23943EL,
-       0xF36E6F75L, 0x0105EC76L, 0x12551F82L, 0xE03E9C81L,
-       0x34F4F86AL, 0xC69F7B69L, 0xD5CF889DL, 0x27A40B9EL,
-       0x79B737BAL, 0x8BDCB4B9L, 0x988C474DL, 0x6AE7C44EL,
-       0xBE2DA0A5L, 0x4C4623A6L, 0x5F16D052L, 0xAD7D5351L
-};
-
-/*
- * Steps through buffer one byte at at time, calculates reflected
- * crc using table.
- */
-
-static u32 crc32c(u32 crc, const u8 *data, unsigned int length)
-{
-       while (length--)
-               crc = crc32c_table[(crc ^ *data++) & 0xFFL] ^ (crc >> 8);
-
-       return crc;
-}
-
 /*
  * Steps through buffer one byte at at time, calculates reflected
  * crc using table.
@@ -179,7 +91,7 @@ static int chksum_update(struct shash_desc *desc, const u8 *data,
 {
        struct chksum_desc_ctx *ctx = shash_desc_ctx(desc);
 
-       ctx->crc = crc32c(ctx->crc, data, length);
+       ctx->crc = __crc32c_le(ctx->crc, data, length);
        return 0;
 }
 
@@ -193,7 +105,7 @@ static int chksum_final(struct shash_desc *desc, u8 *out)
 
 static int __chksum_finup(u32 *crcp, const u8 *data, unsigned int len, u8 *out)
 {
-       *(__le32 *)out = ~cpu_to_le32(crc32c(*crcp, data, len));
+       *(__le32 *)out = ~cpu_to_le32(__crc32c_le(*crcp, data, len));
        return 0;
 }
 
index 8d0061569326b9a79024a03a4ec1023c18ab0bde..77dc53272289ddadf058903288d7dd0bbd46900e 100644 (file)
@@ -341,7 +341,7 @@ static int regcache_lzo_sync(struct regmap *map, unsigned int min,
 
        lzo_blocks = map->cache;
        i = min;
-       for_each_set_bit_cont(i, lzo_blocks[0]->sync_bmp,
+       for_each_set_bit_from(i, lzo_blocks[0]->sync_bmp,
                              lzo_blocks[0]->sync_bmp_nbits) {
                if (i > max)
                        continue;
index e09f9cebbb20fead584577dfaafee48c612a276d..abfaacaaf3469f75008a308cb33477ae5fcb4dce 100644 (file)
@@ -179,7 +179,7 @@ int drbd_khelper(struct drbd_conf *mdev, char *cmd)
        dev_info(DEV, "helper command: %s %s %s\n", usermode_helper, cmd, mb);
 
        drbd_bcast_ev_helper(mdev, cmd);
-       ret = call_usermodehelper(usermode_helper, argv, envp, 1);
+       ret = call_usermodehelper(usermode_helper, argv, envp, UMH_WAIT_PROC);
        if (ret)
                dev_warn(DEV, "helper command: %s %s %s exit code %u (0x%x)\n",
                                usermode_helper, cmd, mb,
index 8c7a75d53101318ffb4dc0f66adcf5da5f7912f2..589ba02d65a243ade195f0fe8cb1d3032fbf7e6b 100644 (file)
@@ -17,7 +17,7 @@ menuconfig NEW_LEDS
 if NEW_LEDS
 
 config LEDS_CLASS
-       bool "LED Class Support"
+       tristate "LED Class Support"
        help
          This option enables the led sysfs class in /sys/class/leds.  You'll
          need this to do anything useful with LEDs.  If unsure, say N.
@@ -234,6 +234,14 @@ config LEDS_PCA955X
          LED driver chips accessed via the I2C bus.  Supported
          devices include PCA9550, PCA9551, PCA9552, and PCA9553.
 
+config LEDS_PCA9633
+       tristate "LED support for PCA9633 I2C chip"
+       depends on LEDS_CLASS
+       depends on I2C
+       help
+         This option enables support for LEDs connected to the PCA9633
+         LED driver chip accessed via the I2C bus.
+
 config LEDS_WM831X_STATUS
        tristate "LED support for status LEDs on WM831x PMICs"
        depends on LEDS_CLASS
index 6bcf4f6955158c4f9abd48949264080035e93126..fa0f428b32fe488f753e490d15ca08939fcb000c 100644 (file)
@@ -30,6 +30,7 @@ obj-$(CONFIG_LEDS_HP6XX)              += leds-hp6xx.o
 obj-$(CONFIG_LEDS_OT200)               += leds-ot200.o
 obj-$(CONFIG_LEDS_FSG)                 += leds-fsg.o
 obj-$(CONFIG_LEDS_PCA955X)             += leds-pca955x.o
+obj-$(CONFIG_LEDS_PCA9633)             += leds-pca9633.o
 obj-$(CONFIG_LEDS_DA903X)              += leds-da903x.o
 obj-$(CONFIG_LEDS_WM831X_STATUS)       += leds-wm831x-status.o
 obj-$(CONFIG_LEDS_WM8350)              += leds-wm8350.o
index 0c8739c448b1ebfe20edfa0868696b3b8e9d50e5..5bff8439dc68a7e8c6424f0cbed3746cd9820efb 100644 (file)
@@ -110,50 +110,6 @@ static void led_timer_function(unsigned long data)
        mod_timer(&led_cdev->blink_timer, jiffies + msecs_to_jiffies(delay));
 }
 
-static void led_stop_software_blink(struct led_classdev *led_cdev)
-{
-       /* deactivate previous settings */
-       del_timer_sync(&led_cdev->blink_timer);
-       led_cdev->blink_delay_on = 0;
-       led_cdev->blink_delay_off = 0;
-}
-
-static void led_set_software_blink(struct led_classdev *led_cdev,
-                                  unsigned long delay_on,
-                                  unsigned long delay_off)
-{
-       int current_brightness;
-
-       current_brightness = led_get_brightness(led_cdev);
-       if (current_brightness)
-               led_cdev->blink_brightness = current_brightness;
-       if (!led_cdev->blink_brightness)
-               led_cdev->blink_brightness = led_cdev->max_brightness;
-
-       if (led_get_trigger_data(led_cdev) &&
-           delay_on == led_cdev->blink_delay_on &&
-           delay_off == led_cdev->blink_delay_off)
-               return;
-
-       led_stop_software_blink(led_cdev);
-
-       led_cdev->blink_delay_on = delay_on;
-       led_cdev->blink_delay_off = delay_off;
-
-       /* never on - don't blink */
-       if (!delay_on)
-               return;
-
-       /* never off - just set to brightness */
-       if (!delay_off) {
-               led_set_brightness(led_cdev, led_cdev->blink_brightness);
-               return;
-       }
-
-       mod_timer(&led_cdev->blink_timer, jiffies + 1);
-}
-
-
 /**
  * led_classdev_suspend - suspend an led_classdev.
  * @led_cdev: the led_classdev to suspend.
@@ -262,32 +218,6 @@ void led_classdev_unregister(struct led_classdev *led_cdev)
 }
 EXPORT_SYMBOL_GPL(led_classdev_unregister);
 
-void led_blink_set(struct led_classdev *led_cdev,
-                  unsigned long *delay_on,
-                  unsigned long *delay_off)
-{
-       del_timer_sync(&led_cdev->blink_timer);
-
-       if (led_cdev->blink_set &&
-           !led_cdev->blink_set(led_cdev, delay_on, delay_off))
-               return;
-
-       /* blink with 1 Hz as default if nothing specified */
-       if (!*delay_on && !*delay_off)
-               *delay_on = *delay_off = 500;
-
-       led_set_software_blink(led_cdev, *delay_on, *delay_off);
-}
-EXPORT_SYMBOL(led_blink_set);
-
-void led_brightness_set(struct led_classdev *led_cdev,
-                       enum led_brightness brightness)
-{
-       led_stop_software_blink(led_cdev);
-       led_cdev->brightness_set(led_cdev, brightness);
-}
-EXPORT_SYMBOL(led_brightness_set);
-
 static int __init leds_init(void)
 {
        leds_class = class_create(THIS_MODULE, "leds");
index 016d19f5486f2bd7cf9ea93df863f7d5c8a8cd1a..d6860043f6f99f1fc0e4f819681d8fed9089c542 100644 (file)
@@ -23,3 +23,73 @@ EXPORT_SYMBOL_GPL(leds_list_lock);
 
 LIST_HEAD(leds_list);
 EXPORT_SYMBOL_GPL(leds_list);
+
+static void led_stop_software_blink(struct led_classdev *led_cdev)
+{
+       /* deactivate previous settings */
+       del_timer_sync(&led_cdev->blink_timer);
+       led_cdev->blink_delay_on = 0;
+       led_cdev->blink_delay_off = 0;
+}
+
+static void led_set_software_blink(struct led_classdev *led_cdev,
+                                  unsigned long delay_on,
+                                  unsigned long delay_off)
+{
+       int current_brightness;
+
+       current_brightness = led_get_brightness(led_cdev);
+       if (current_brightness)
+               led_cdev->blink_brightness = current_brightness;
+       if (!led_cdev->blink_brightness)
+               led_cdev->blink_brightness = led_cdev->max_brightness;
+
+       if (led_get_trigger_data(led_cdev) &&
+           delay_on == led_cdev->blink_delay_on &&
+           delay_off == led_cdev->blink_delay_off)
+               return;
+
+       led_stop_software_blink(led_cdev);
+
+       led_cdev->blink_delay_on = delay_on;
+       led_cdev->blink_delay_off = delay_off;
+
+       /* never on - don't blink */
+       if (!delay_on)
+               return;
+
+       /* never off - just set to brightness */
+       if (!delay_off) {
+               led_set_brightness(led_cdev, led_cdev->blink_brightness);
+               return;
+       }
+
+       mod_timer(&led_cdev->blink_timer, jiffies + 1);
+}
+
+
+void led_blink_set(struct led_classdev *led_cdev,
+                  unsigned long *delay_on,
+                  unsigned long *delay_off)
+{
+       del_timer_sync(&led_cdev->blink_timer);
+
+       if (led_cdev->blink_set &&
+           !led_cdev->blink_set(led_cdev, delay_on, delay_off))
+               return;
+
+       /* blink with 1 Hz as default if nothing specified */
+       if (!*delay_on && !*delay_off)
+               *delay_on = *delay_off = 500;
+
+       led_set_software_blink(led_cdev, *delay_on, *delay_off);
+}
+EXPORT_SYMBOL(led_blink_set);
+
+void led_brightness_set(struct led_classdev *led_cdev,
+                       enum led_brightness brightness)
+{
+       led_stop_software_blink(led_cdev);
+       led_cdev->brightness_set(led_cdev, brightness);
+}
+EXPORT_SYMBOL(led_brightness_set);
index 7df74cb97e702e693935ab798598b9967b0d0ae7..f4c470a3bc8dc3fa234114f691ad98656a3bef14 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
+#include <linux/gpio.h>
 #include <linux/leds.h>
 #include <linux/of_platform.h>
 #include <linux/of_gpio.h>
@@ -20,8 +21,6 @@
 #include <linux/workqueue.h>
 #include <linux/module.h>
 
-#include <asm/gpio.h>
-
 struct gpio_led_data {
        struct led_classdev cdev;
        unsigned gpio;
index e59c166a0ce2261dd2515930ff297c1b57b5d25a..968fd5fef4fc5e2871dc7b5539f80b6b5328ea1b 100644 (file)
@@ -26,7 +26,6 @@
 #define LM3530_GEN_CONFIG              0x10
 #define LM3530_ALS_CONFIG              0x20
 #define LM3530_BRT_RAMP_RATE           0x30
-#define LM3530_ALS_ZONE_REG            0x40
 #define LM3530_ALS_IMP_SELECT          0x41
 #define LM3530_BRT_CTRL_REG            0xA0
 #define LM3530_ALS_ZB0_REG             0x60
@@ -38,7 +37,7 @@
 #define LM3530_ALS_Z2T_REG             0x72
 #define LM3530_ALS_Z3T_REG             0x73
 #define LM3530_ALS_Z4T_REG             0x74
-#define LM3530_REG_MAX                 15
+#define LM3530_REG_MAX                 14
 
 /* General Control Register */
 #define LM3530_EN_I2C_SHIFT            (0)
@@ -80,6 +79,9 @@
 #define LM3530_DEF_ZT_3                        (0x33)
 #define LM3530_DEF_ZT_4                        (0x19)
 
+/* 7 bits are used for the brightness : LM3530_BRT_CTRL_REG */
+#define MAX_BRIGHTNESS                 (127)
+
 struct lm3530_mode_map {
        const char *mode;
        enum lm3530_mode mode_val;
@@ -115,7 +117,6 @@ static const u8 lm3530_reg[LM3530_REG_MAX] = {
        LM3530_GEN_CONFIG,
        LM3530_ALS_CONFIG,
        LM3530_BRT_RAMP_RATE,
-       LM3530_ALS_ZONE_REG,
        LM3530_ALS_IMP_SELECT,
        LM3530_BRT_CTRL_REG,
        LM3530_ALS_ZB0_REG,
@@ -152,27 +153,35 @@ static int lm3530_init_registers(struct lm3530_data *drvdata)
        u8 reg_val[LM3530_REG_MAX];
        u8 zones[LM3530_ALS_ZB_MAX];
        u32 als_vmin, als_vmax, als_vstep;
-       struct lm3530_platform_data *pltfm = drvdata->pdata;
+       struct lm3530_platform_data *pdata = drvdata->pdata;
        struct i2c_client *client = drvdata->client;
+       struct lm3530_pwm_data *pwm = &pdata->pwm_data;
 
-       gen_config = (pltfm->brt_ramp_law << LM3530_RAMP_LAW_SHIFT) |
-                       ((pltfm->max_current & 7) << LM3530_MAX_CURR_SHIFT);
+       gen_config = (pdata->brt_ramp_law << LM3530_RAMP_LAW_SHIFT) |
+                       ((pdata->max_current & 7) << LM3530_MAX_CURR_SHIFT);
 
-       if (drvdata->mode == LM3530_BL_MODE_MANUAL ||
-           drvdata->mode == LM3530_BL_MODE_ALS)
-               gen_config |= (LM3530_ENABLE_I2C);
+       switch (drvdata->mode) {
+       case LM3530_BL_MODE_MANUAL:
+       case LM3530_BL_MODE_ALS:
+               gen_config |= LM3530_ENABLE_I2C;
+               break;
+       case LM3530_BL_MODE_PWM:
+               gen_config |= LM3530_ENABLE_PWM | LM3530_ENABLE_PWM_SIMPLE |
+                             (pdata->pwm_pol_hi << LM3530_PWM_POL_SHIFT);
+               break;
+       }
 
        if (drvdata->mode == LM3530_BL_MODE_ALS) {
-               if (pltfm->als_vmax == 0) {
-                       pltfm->als_vmin = 0;
-                       pltfm->als_vmax = LM3530_ALS_WINDOW_mV;
+               if (pdata->als_vmax == 0) {
+                       pdata->als_vmin = 0;
+                       pdata->als_vmax = LM3530_ALS_WINDOW_mV;
                }
 
-               als_vmin = pltfm->als_vmin;
-               als_vmax = pltfm->als_vmax;
+               als_vmin = pdata->als_vmin;
+               als_vmax = pdata->als_vmax;
 
                if ((als_vmax - als_vmin) > LM3530_ALS_WINDOW_mV)
-                       pltfm->als_vmax = als_vmax =
+                       pdata->als_vmax = als_vmax =
                                als_vmin + LM3530_ALS_WINDOW_mV;
 
                /* n zone boundary makes n+1 zones */
@@ -184,44 +193,41 @@ static int lm3530_init_registers(struct lm3530_data *drvdata)
                                        / 1000;
 
                als_config =
-                       (pltfm->als_avrg_time << LM3530_ALS_AVG_TIME_SHIFT) |
+                       (pdata->als_avrg_time << LM3530_ALS_AVG_TIME_SHIFT) |
                        (LM3530_ENABLE_ALS) |
-                       (pltfm->als_input_mode << LM3530_ALS_SEL_SHIFT);
+                       (pdata->als_input_mode << LM3530_ALS_SEL_SHIFT);
 
                als_imp_sel =
-                       (pltfm->als1_resistor_sel << LM3530_ALS1_IMP_SHIFT) |
-                       (pltfm->als2_resistor_sel << LM3530_ALS2_IMP_SHIFT);
+                       (pdata->als1_resistor_sel << LM3530_ALS1_IMP_SHIFT) |
+                       (pdata->als2_resistor_sel << LM3530_ALS2_IMP_SHIFT);
 
        }
 
-       if (drvdata->mode == LM3530_BL_MODE_PWM)
-               gen_config |= (LM3530_ENABLE_PWM) |
-                               (pltfm->pwm_pol_hi << LM3530_PWM_POL_SHIFT) |
-                               (LM3530_ENABLE_PWM_SIMPLE);
-
-       brt_ramp = (pltfm->brt_ramp_fall << LM3530_BRT_RAMP_FALL_SHIFT) |
-                       (pltfm->brt_ramp_rise << LM3530_BRT_RAMP_RISE_SHIFT);
+       brt_ramp = (pdata->brt_ramp_fall << LM3530_BRT_RAMP_FALL_SHIFT) |
+                       (pdata->brt_ramp_rise << LM3530_BRT_RAMP_RISE_SHIFT);
 
        if (drvdata->brightness)
                brightness = drvdata->brightness;
        else
-               brightness = drvdata->brightness = pltfm->brt_val;
+               brightness = drvdata->brightness = pdata->brt_val;
+
+       if (brightness > drvdata->led_dev.max_brightness)
+               brightness = drvdata->led_dev.max_brightness;
 
        reg_val[0] = gen_config;        /* LM3530_GEN_CONFIG */
        reg_val[1] = als_config;        /* LM3530_ALS_CONFIG */
        reg_val[2] = brt_ramp;          /* LM3530_BRT_RAMP_RATE */
-       reg_val[3] = 0x00;              /* LM3530_ALS_ZONE_REG */
-       reg_val[4] = als_imp_sel;       /* LM3530_ALS_IMP_SELECT */
-       reg_val[5] = brightness;        /* LM3530_BRT_CTRL_REG */
-       reg_val[6] = zones[0];          /* LM3530_ALS_ZB0_REG */
-       reg_val[7] = zones[1];          /* LM3530_ALS_ZB1_REG */
-       reg_val[8] = zones[2];          /* LM3530_ALS_ZB2_REG */
-       reg_val[9] = zones[3];          /* LM3530_ALS_ZB3_REG */
-       reg_val[10] = LM3530_DEF_ZT_0;  /* LM3530_ALS_Z0T_REG */
-       reg_val[11] = LM3530_DEF_ZT_1;  /* LM3530_ALS_Z1T_REG */
-       reg_val[12] = LM3530_DEF_ZT_2;  /* LM3530_ALS_Z2T_REG */
-       reg_val[13] = LM3530_DEF_ZT_3;  /* LM3530_ALS_Z3T_REG */
-       reg_val[14] = LM3530_DEF_ZT_4;  /* LM3530_ALS_Z4T_REG */
+       reg_val[3] = als_imp_sel;       /* LM3530_ALS_IMP_SELECT */
+       reg_val[4] = brightness;        /* LM3530_BRT_CTRL_REG */
+       reg_val[5] = zones[0];          /* LM3530_ALS_ZB0_REG */
+       reg_val[6] = zones[1];          /* LM3530_ALS_ZB1_REG */
+       reg_val[7] = zones[2];          /* LM3530_ALS_ZB2_REG */
+       reg_val[8] = zones[3];          /* LM3530_ALS_ZB3_REG */
+       reg_val[9] = LM3530_DEF_ZT_0;   /* LM3530_ALS_Z0T_REG */
+       reg_val[10] = LM3530_DEF_ZT_1;  /* LM3530_ALS_Z1T_REG */
+       reg_val[11] = LM3530_DEF_ZT_2;  /* LM3530_ALS_Z2T_REG */
+       reg_val[12] = LM3530_DEF_ZT_3;  /* LM3530_ALS_Z3T_REG */
+       reg_val[13] = LM3530_DEF_ZT_4;  /* LM3530_ALS_Z4T_REG */
 
        if (!drvdata->enable) {
                ret = regulator_enable(drvdata->regulator);
@@ -234,6 +240,15 @@ static int lm3530_init_registers(struct lm3530_data *drvdata)
        }
 
        for (i = 0; i < LM3530_REG_MAX; i++) {
+               /* do not update brightness register when pwm mode */
+               if (lm3530_reg[i] == LM3530_BRT_CTRL_REG &&
+                   drvdata->mode == LM3530_BL_MODE_PWM) {
+                       if (pwm->pwm_set_intensity)
+                               pwm->pwm_set_intensity(reg_val[i],
+                                       drvdata->led_dev.max_brightness);
+                       continue;
+               }
+
                ret = i2c_smbus_write_byte_data(client,
                                lm3530_reg[i], reg_val[i]);
                if (ret)
@@ -249,6 +264,9 @@ static void lm3530_brightness_set(struct led_classdev *led_cdev,
        int err;
        struct lm3530_data *drvdata =
            container_of(led_cdev, struct lm3530_data, led_dev);
+       struct lm3530_platform_data *pdata = drvdata->pdata;
+       struct lm3530_pwm_data *pwm = &pdata->pwm_data;
+       u8 max_brightness = led_cdev->max_brightness;
 
        switch (drvdata->mode) {
        case LM3530_BL_MODE_MANUAL:
@@ -264,12 +282,12 @@ static void lm3530_brightness_set(struct led_classdev *led_cdev,
 
                /* set the brightness in brightness control register*/
                err = i2c_smbus_write_byte_data(drvdata->client,
-                               LM3530_BRT_CTRL_REG, brt_val / 2);
+                               LM3530_BRT_CTRL_REG, brt_val);
                if (err)
                        dev_err(&drvdata->client->dev,
                                "Unable to set brightness: %d\n", err);
                else
-                       drvdata->brightness = brt_val / 2;
+                       drvdata->brightness = brt_val;
 
                if (brt_val == 0) {
                        err = regulator_disable(drvdata->regulator);
@@ -282,6 +300,8 @@ static void lm3530_brightness_set(struct led_classdev *led_cdev,
        case LM3530_BL_MODE_ALS:
                break;
        case LM3530_BL_MODE_PWM:
+               if (pwm->pwm_set_intensity)
+                       pwm->pwm_set_intensity(brt_val, max_brightness);
                break;
        default:
                break;
@@ -291,11 +311,11 @@ static void lm3530_brightness_set(struct led_classdev *led_cdev,
 static ssize_t lm3530_mode_get(struct device *dev,
                struct device_attribute *attr, char *buf)
 {
-       struct i2c_client *client = container_of(
-                                       dev->parent, struct i2c_client, dev);
-       struct lm3530_data *drvdata = i2c_get_clientdata(client);
+       struct led_classdev *led_cdev = dev_get_drvdata(dev);
+       struct lm3530_data *drvdata;
        int i, len = 0;
 
+       drvdata = container_of(led_cdev, struct lm3530_data, led_dev);
        for (i = 0; i < ARRAY_SIZE(mode_map); i++)
                if (drvdata->mode == mode_map[i].mode_val)
                        len += sprintf(buf + len, "[%s] ", mode_map[i].mode);
@@ -310,26 +330,26 @@ static ssize_t lm3530_mode_get(struct device *dev,
 static ssize_t lm3530_mode_set(struct device *dev, struct device_attribute
                                   *attr, const char *buf, size_t size)
 {
-       int err;
-       struct i2c_client *client = container_of(
-                                       dev->parent, struct i2c_client, dev);
-       struct lm3530_data *drvdata = i2c_get_clientdata(client);
-       int mode;
+       struct led_classdev *led_cdev = dev_get_drvdata(dev);
+       struct lm3530_data *drvdata;
+       struct lm3530_pwm_data *pwm;
+       u8 max_brightness;
+       int mode, err;
 
+       drvdata = container_of(led_cdev, struct lm3530_data, led_dev);
+       pwm = &drvdata->pdata->pwm_data;
+       max_brightness = led_cdev->max_brightness;
        mode = lm3530_get_mode_from_str(buf);
        if (mode < 0) {
                dev_err(dev, "Invalid mode\n");
                return -EINVAL;
        }
 
-       if (mode == LM3530_BL_MODE_MANUAL)
-               drvdata->mode = LM3530_BL_MODE_MANUAL;
-       else if (mode == LM3530_BL_MODE_ALS)
-               drvdata->mode = LM3530_BL_MODE_ALS;
-       else if (mode == LM3530_BL_MODE_PWM) {
-               dev_err(dev, "PWM mode not supported\n");
-               return -EINVAL;
-       }
+       drvdata->mode = mode;
+
+       /* set pwm to low if unnecessary */
+       if (mode != LM3530_BL_MODE_PWM && pwm->pwm_set_intensity)
+               pwm->pwm_set_intensity(0, max_brightness);
 
        err = lm3530_init_registers(drvdata);
        if (err) {
@@ -380,6 +400,7 @@ static int __devinit lm3530_probe(struct i2c_client *client,
        drvdata->enable = false;
        drvdata->led_dev.name = LM3530_LED_DEV;
        drvdata->led_dev.brightness_set = lm3530_brightness_set;
+       drvdata->led_dev.max_brightness = MAX_BRIGHTNESS;
 
        i2c_set_clientdata(client, drvdata);
 
index d62a7982a5e66ad25812e87c86773985c3ffc802..410a723b86910ac8876e696bc4d6b0b85237e998 100644 (file)
 #define LP5521_MASTER_ENABLE           0x40    /* Chip master enable */
 #define LP5521_LOGARITHMIC_PWM         0x80    /* Logarithmic PWM adjustment */
 #define LP5521_EXEC_RUN                        0x2A
-
-/* Bits in CONFIG register */
-#define LP5521_PWM_HF                  0x40    /* PWM: 0 = 256Hz, 1 = 558Hz */
-#define LP5521_PWRSAVE_EN              0x20    /* 1 = Power save mode */
-#define LP5521_CP_MODE_OFF             0       /* Charge pump (CP) off */
-#define LP5521_CP_MODE_BYPASS          8       /* CP forced to bypass mode */
-#define LP5521_CP_MODE_1X5             0x10    /* CP forced to 1.5x mode */
-#define LP5521_CP_MODE_AUTO            0x18    /* Automatic mode selection */
-#define LP5521_R_TO_BATT               4       /* R out: 0 = CP, 1 = Vbat */
-#define LP5521_CLK_SRC_EXT             0       /* Ext-clk source (CLK_32K) */
-#define LP5521_CLK_INT                 1       /* Internal clock */
-#define LP5521_CLK_AUTO                        2       /* Automatic clock selection */
+#define LP5521_ENABLE_DEFAULT  \
+       (LP5521_MASTER_ENABLE | LP5521_LOGARITHMIC_PWM)
+#define LP5521_ENABLE_RUN_PROGRAM      \
+       (LP5521_ENABLE_DEFAULT | LP5521_EXEC_RUN)
 
 /* Status */
 #define LP5521_EXT_CLK_USED            0x08
 /* default R channel current register value */
 #define LP5521_REG_R_CURR_DEFAULT      0xAF
 
+/* Pattern Mode */
+#define PATTERN_OFF    0
+
 struct lp5521_engine {
        int             id;
        u8              mode;
@@ -241,15 +236,16 @@ static int lp5521_configure(struct i2c_client *client)
 {
        struct lp5521_chip *chip = i2c_get_clientdata(client);
        int ret;
+       u8 cfg;
 
        lp5521_init_engine(chip);
 
        /* Set all PWMs to direct control mode */
-       ret = lp5521_write(client, LP5521_REG_OP_MODE, 0x3F);
+       ret = lp5521_write(client, LP5521_REG_OP_MODE, LP5521_CMD_DIRECT);
 
-       /* Enable auto-powersave, set charge pump to auto, red to battery */
-       ret |= lp5521_write(client, LP5521_REG_CONFIG,
-               LP5521_PWRSAVE_EN | LP5521_CP_MODE_AUTO | LP5521_R_TO_BATT);
+       cfg = chip->pdata->update_config ?
+               : (LP5521_PWRSAVE_EN | LP5521_CP_MODE_AUTO | LP5521_R_TO_BATT);
+       ret |= lp5521_write(client, LP5521_REG_CONFIG, cfg);
 
        /* Initialize all channels PWM to zero -> leds off */
        ret |= lp5521_write(client, LP5521_REG_R_PWM, 0);
@@ -258,8 +254,7 @@ static int lp5521_configure(struct i2c_client *client)
 
        /* Set engines are set to run state when OP_MODE enables engines */
        ret |= lp5521_write(client, LP5521_REG_ENABLE,
-                       LP5521_MASTER_ENABLE | LP5521_LOGARITHMIC_PWM |
-                       LP5521_EXEC_RUN);
+                       LP5521_ENABLE_RUN_PROGRAM);
        /* enable takes 500us. 1 - 2 ms leaves some margin */
        usleep_range(1000, 2000);
 
@@ -310,8 +305,7 @@ static int lp5521_detect(struct i2c_client *client)
        int ret;
        u8 buf;
 
-       ret = lp5521_write(client, LP5521_REG_ENABLE,
-                       LP5521_MASTER_ENABLE | LP5521_LOGARITHMIC_PWM);
+       ret = lp5521_write(client, LP5521_REG_ENABLE, LP5521_ENABLE_DEFAULT);
        if (ret)
                return ret;
        /* enable takes 500us. 1 - 2 ms leaves some margin */
@@ -319,7 +313,7 @@ static int lp5521_detect(struct i2c_client *client)
        ret = lp5521_read(client, LP5521_REG_ENABLE, &buf);
        if (ret)
                return ret;
-       if (buf != (LP5521_MASTER_ENABLE | LP5521_LOGARITHMIC_PWM))
+       if (buf != LP5521_ENABLE_DEFAULT)
                return -ENODEV;
 
        return 0;
@@ -504,7 +498,7 @@ static ssize_t store_current(struct device *dev,
        ssize_t ret;
        unsigned long curr;
 
-       if (strict_strtoul(buf, 0, &curr))
+       if (kstrtoul(buf, 0, &curr))
                return -EINVAL;
 
        if (curr > led->max_current)
@@ -536,6 +530,97 @@ static ssize_t lp5521_selftest(struct device *dev,
        return sprintf(buf, "%s\n", ret ? "FAIL" : "OK");
 }
 
+static void lp5521_clear_program_memory(struct i2c_client *cl)
+{
+       int i;
+       u8 rgb_mem[] = {
+               LP5521_REG_R_PROG_MEM,
+               LP5521_REG_G_PROG_MEM,
+               LP5521_REG_B_PROG_MEM,
+       };
+
+       for (i = 0; i < ARRAY_SIZE(rgb_mem); i++) {
+               lp5521_write(cl, rgb_mem[i], 0);
+               lp5521_write(cl, rgb_mem[i] + 1, 0);
+       }
+}
+
+static void lp5521_write_program_memory(struct i2c_client *cl,
+                               u8 base, u8 *rgb, int size)
+{
+       int i;
+
+       if (!rgb || size <= 0)
+               return;
+
+       for (i = 0; i < size; i++)
+               lp5521_write(cl, base + i, *(rgb + i));
+
+       lp5521_write(cl, base + i, 0);
+       lp5521_write(cl, base + i + 1, 0);
+}
+
+static inline struct lp5521_led_pattern *lp5521_get_pattern
+                                       (struct lp5521_chip *chip, u8 offset)
+{
+       struct lp5521_led_pattern *ptn;
+       ptn = chip->pdata->patterns + (offset - 1);
+       return ptn;
+}
+
+static void lp5521_run_led_pattern(int mode, struct lp5521_chip *chip)
+{
+       struct lp5521_led_pattern *ptn;
+       struct i2c_client *cl = chip->client;
+       int num_patterns = chip->pdata->num_patterns;
+
+       if (mode > num_patterns || !(chip->pdata->patterns))
+               return;
+
+       if (mode == PATTERN_OFF) {
+               lp5521_write(cl, LP5521_REG_ENABLE, LP5521_ENABLE_DEFAULT);
+               usleep_range(1000, 2000);
+               lp5521_write(cl, LP5521_REG_OP_MODE, LP5521_CMD_DIRECT);
+       } else {
+               ptn = lp5521_get_pattern(chip, mode);
+               if (!ptn)
+                       return;
+
+               lp5521_write(cl, LP5521_REG_OP_MODE, LP5521_CMD_LOAD);
+               usleep_range(1000, 2000);
+
+               lp5521_clear_program_memory(cl);
+
+               lp5521_write_program_memory(cl, LP5521_REG_R_PROG_MEM,
+                                       ptn->r, ptn->size_r);
+               lp5521_write_program_memory(cl, LP5521_REG_G_PROG_MEM,
+                                       ptn->g, ptn->size_g);
+               lp5521_write_program_memory(cl, LP5521_REG_B_PROG_MEM,
+                                       ptn->b, ptn->size_b);
+
+               lp5521_write(cl, LP5521_REG_OP_MODE, LP5521_CMD_RUN);
+               usleep_range(1000, 2000);
+               lp5521_write(cl, LP5521_REG_ENABLE, LP5521_ENABLE_RUN_PROGRAM);
+       }
+}
+
+static ssize_t store_led_pattern(struct device *dev,
+                               struct device_attribute *attr,
+                               const char *buf, size_t len)
+{
+       struct lp5521_chip *chip = i2c_get_clientdata(to_i2c_client(dev));
+       unsigned long val;
+       int ret;
+
+       ret = strict_strtoul(buf, 16, &val);
+       if (ret)
+               return ret;
+
+       lp5521_run_led_pattern(val, chip);
+
+       return len;
+}
+
 /* led class device attributes */
 static DEVICE_ATTR(led_current, S_IRUGO | S_IWUSR, show_current, store_current);
 static DEVICE_ATTR(max_current, S_IRUGO , show_max_current, NULL);
@@ -561,6 +646,7 @@ static DEVICE_ATTR(engine1_load, S_IWUSR, NULL, store_engine1_load);
 static DEVICE_ATTR(engine2_load, S_IWUSR, NULL, store_engine2_load);
 static DEVICE_ATTR(engine3_load, S_IWUSR, NULL, store_engine3_load);
 static DEVICE_ATTR(selftest, S_IRUGO, lp5521_selftest, NULL);
+static DEVICE_ATTR(led_pattern, S_IWUSR, NULL, store_led_pattern);
 
 static struct attribute *lp5521_attributes[] = {
        &dev_attr_engine1_mode.attr,
@@ -570,6 +656,7 @@ static struct attribute *lp5521_attributes[] = {
        &dev_attr_engine1_load.attr,
        &dev_attr_engine2_load.attr,
        &dev_attr_engine3_load.attr,
+       &dev_attr_led_pattern.attr,
        NULL
 };
 
@@ -620,10 +707,15 @@ static int __devinit lp5521_init_led(struct lp5521_led *led,
                return -EINVAL;
        }
 
-       snprintf(name, sizeof(name), "%s:channel%d",
-                       pdata->label ?: client->name, chan);
        led->cdev.brightness_set = lp5521_set_brightness;
-       led->cdev.name = name;
+       if (pdata->led_config[chan].name) {
+               led->cdev.name = pdata->led_config[chan].name;
+       } else {
+               snprintf(name, sizeof(name), "%s:channel%d",
+                       pdata->label ?: client->name, chan);
+               led->cdev.name = name;
+       }
+
        res = led_classdev_register(dev, &led->cdev);
        if (res < 0) {
                dev_err(dev, "couldn't register led on channel %d\n", chan);
@@ -692,9 +784,9 @@ static int __devinit lp5521_probe(struct i2c_client *client,
         * otherwise further access to the R G B channels in the
         * LP5521_REG_ENABLE register will not have any effect - strange!
         */
-       lp5521_read(client, LP5521_REG_R_CURRENT, &buf);
+       ret = lp5521_read(client, LP5521_REG_R_CURRENT, &buf);
        if (buf != LP5521_REG_R_CURR_DEFAULT) {
-               dev_err(&client->dev, "error in reseting chip\n");
+               dev_err(&client->dev, "error in resetting chip\n");
                goto fail2;
        }
        usleep_range(10000, 20000);
@@ -767,6 +859,7 @@ static int __devexit lp5521_remove(struct i2c_client *client)
        struct lp5521_chip *chip = i2c_get_clientdata(client);
        int i;
 
+       lp5521_run_led_pattern(PATTERN_OFF, chip);
        lp5521_unregister_sysfs(client);
 
        for (i = 0; i < chip->num_leds; i++) {
index 73e791ae725993e1833f40cc8b0b059a0a55b53e..857a3e15f2dde8eb8ebc3b90bf30a0c4388b8311 100644 (file)
@@ -152,7 +152,7 @@ static inline struct lp5523_chip *led_to_lp5523(struct lp5523_led *led)
 
 static int lp5523_set_mode(struct lp5523_engine *engine, u8 mode);
 static int lp5523_set_engine_mode(struct lp5523_engine *engine, u8 mode);
-static int lp5523_load_program(struct lp5523_engine *engine, u8 *pattern);
+static int lp5523_load_program(struct lp5523_engine *engine, const u8 *pattern);
 
 static void lp5523_led_brightness_work(struct work_struct *work);
 
@@ -196,7 +196,7 @@ static int lp5523_configure(struct i2c_client *client)
        u8 status;
 
        /* one pattern per engine setting led mux start and stop addresses */
-       u8 pattern[][LP5523_PROGRAM_LENGTH] =  {
+       static const u8 pattern[][LP5523_PROGRAM_LENGTH] =  {
                { 0x9c, 0x30, 0x9c, 0xb0, 0x9d, 0x80, 0xd8, 0x00, 0},
                { 0x9c, 0x40, 0x9c, 0xc0, 0x9d, 0x80, 0xd8, 0x00, 0},
                { 0x9c, 0x50, 0x9c, 0xd0, 0x9d, 0x80, 0xd8, 0x00, 0},
@@ -301,7 +301,7 @@ static int lp5523_load_mux(struct lp5523_engine *engine, u16 mux)
        return ret;
 }
 
-static int lp5523_load_program(struct lp5523_engine *engine, u8 *pattern)
+static int lp5523_load_program(struct lp5523_engine *engine, const u8 *pattern)
 {
        struct lp5523_chip *chip = engine_to_lp5523(engine);
        struct i2c_client *client = chip->client;
diff --git a/drivers/leds/leds-pca9633.c b/drivers/leds/leds-pca9633.c
new file mode 100644 (file)
index 0000000..d8926fd
--- /dev/null
@@ -0,0 +1,193 @@
+/*
+ * Copyright 2011 bct electronic GmbH
+ *
+ * Author: Peter Meerwald <p.meerwald@bct-electronic.com>
+ *
+ * Based on leds-pca955x.c
+ *
+ * This file is subject to the terms and conditions of version 2 of
+ * the GNU General Public License.  See the file COPYING in the main
+ * directory of this archive for more details.
+ *
+ * LED driver for the PCA9633 I2C LED driver (7-bit slave address 0x62)
+ *
+ */
+
+#include <linux/module.h>
+#include <linux/delay.h>
+#include <linux/string.h>
+#include <linux/ctype.h>
+#include <linux/leds.h>
+#include <linux/err.h>
+#include <linux/i2c.h>
+#include <linux/workqueue.h>
+#include <linux/slab.h>
+
+/* LED select registers determine the source that drives LED outputs */
+#define PCA9633_LED_OFF                0x0     /* LED driver off */
+#define PCA9633_LED_ON         0x1     /* LED driver on */
+#define PCA9633_LED_PWM                0x2     /* Controlled through PWM */
+#define PCA9633_LED_GRP_PWM    0x3     /* Controlled through PWM/GRPPWM */
+
+#define PCA9633_MODE1          0x00
+#define PCA9633_MODE2          0x01
+#define PCA9633_PWM_BASE       0x02
+#define PCA9633_LEDOUT         0x08
+
+static const struct i2c_device_id pca9633_id[] = {
+       { "pca9633", 0 },
+       { }
+};
+MODULE_DEVICE_TABLE(i2c, pca9633_id);
+
+struct pca9633_led {
+       struct i2c_client *client;
+       struct work_struct work;
+       enum led_brightness brightness;
+       struct led_classdev led_cdev;
+       int led_num; /* 0 .. 3 potentially */
+       char name[32];
+};
+
+static void pca9633_led_work(struct work_struct *work)
+{
+       struct pca9633_led *pca9633 = container_of(work,
+               struct pca9633_led, work);
+       u8 ledout = i2c_smbus_read_byte_data(pca9633->client, PCA9633_LEDOUT);
+       int shift = 2 * pca9633->led_num;
+       u8 mask = 0x3 << shift;
+
+       switch (pca9633->brightness) {
+       case LED_FULL:
+               i2c_smbus_write_byte_data(pca9633->client, PCA9633_LEDOUT,
+                       (ledout & ~mask) | (PCA9633_LED_ON << shift));
+               break;
+       case LED_OFF:
+               i2c_smbus_write_byte_data(pca9633->client, PCA9633_LEDOUT,
+                       ledout & ~mask);
+               break;
+       default:
+               i2c_smbus_write_byte_data(pca9633->client,
+                       PCA9633_PWM_BASE + pca9633->led_num,
+                       pca9633->brightness);
+               i2c_smbus_write_byte_data(pca9633->client, PCA9633_LEDOUT,
+                       (ledout & ~mask) | (PCA9633_LED_PWM << shift));
+               break;
+       }
+}
+
+static void pca9633_led_set(struct led_classdev *led_cdev,
+       enum led_brightness value)
+{
+       struct pca9633_led *pca9633;
+
+       pca9633 = container_of(led_cdev, struct pca9633_led, led_cdev);
+
+       pca9633->brightness = value;
+
+       /*
+        * Must use workqueue for the actual I/O since I2C operations
+        * can sleep.
+        */
+       schedule_work(&pca9633->work);
+}
+
+static int __devinit pca9633_probe(struct i2c_client *client,
+                                       const struct i2c_device_id *id)
+{
+       struct pca9633_led *pca9633;
+       struct led_platform_data *pdata;
+       int i, err;
+
+       pdata = client->dev.platform_data;
+
+       if (pdata) {
+               if (pdata->num_leds <= 0 || pdata->num_leds > 4) {
+                       dev_err(&client->dev, "board info must claim at most 4 LEDs");
+                       return -EINVAL;
+               }
+       }
+
+       pca9633 = kcalloc(4, sizeof(*pca9633), GFP_KERNEL);
+       if (!pca9633)
+               return -ENOMEM;
+
+       i2c_set_clientdata(client, pca9633);
+
+       for (i = 0; i < 4; i++) {
+               pca9633[i].client = client;
+               pca9633[i].led_num = i;
+
+               /* Platform data can specify LED names and default triggers */
+               if (pdata && i < pdata->num_leds) {
+                       if (pdata->leds[i].name)
+                               snprintf(pca9633[i].name,
+                                        sizeof(pca9633[i].name), "pca9633:%s",
+                                        pdata->leds[i].name);
+                       if (pdata->leds[i].default_trigger)
+                               pca9633[i].led_cdev.default_trigger =
+                                       pdata->leds[i].default_trigger;
+               } else {
+                       snprintf(pca9633[i].name, sizeof(pca9633[i].name),
+                                "pca9633:%d", i);
+               }
+
+               pca9633[i].led_cdev.name = pca9633[i].name;
+               pca9633[i].led_cdev.brightness_set = pca9633_led_set;
+
+               INIT_WORK(&pca9633[i].work, pca9633_led_work);
+
+               err = led_classdev_register(&client->dev, &pca9633[i].led_cdev);
+               if (err < 0)
+                       goto exit;
+       }
+
+       /* Disable LED all-call address and set normal mode */
+       i2c_smbus_write_byte_data(client, PCA9633_MODE1, 0x00);
+
+       /* Turn off LEDs */
+       i2c_smbus_write_byte_data(client, PCA9633_LEDOUT, 0x00);
+
+       return 0;
+
+exit:
+       while (i--) {
+               led_classdev_unregister(&pca9633[i].led_cdev);
+               cancel_work_sync(&pca9633[i].work);
+       }
+
+       kfree(pca9633);
+
+       return err;
+}
+
+static int __devexit pca9633_remove(struct i2c_client *client)
+{
+       struct pca9633_led *pca9633 = i2c_get_clientdata(client);
+       int i;
+
+       for (i = 0; i < 4; i++) {
+               led_classdev_unregister(&pca9633[i].led_cdev);
+               cancel_work_sync(&pca9633[i].work);
+       }
+
+       kfree(pca9633);
+
+       return 0;
+}
+
+static struct i2c_driver pca9633_driver = {
+       .driver = {
+               .name   = "leds-pca9633",
+               .owner  = THIS_MODULE,
+       },
+       .probe  = pca9633_probe,
+       .remove = __devexit_p(pca9633_remove),
+       .id_table = pca9633_id,
+};
+
+module_i2c_driver(pca9633_driver);
+
+MODULE_AUTHOR("Peter Meerwald <p.meerwald@bct-electronic.com>");
+MODULE_DESCRIPTION("PCA9633 LED driver");
+MODULE_LICENSE("GPL v2");
index 133f89fb7071c6b522e2897ac3e3eefaae59daa7..6c1c14f3163505530cf253d1884e2eb7d0bc8099 100644 (file)
@@ -687,10 +687,9 @@ static int __devinit tca6507_probe(struct i2c_client *client,
                        NUM_LEDS);
                return -ENODEV;
        }
-       err = -ENOMEM;
        tca = kzalloc(sizeof(*tca), GFP_KERNEL);
        if (!tca)
-               goto exit;
+               return -ENOMEM;
 
        tca->client = client;
        INIT_WORK(&tca->work, tca6507_work);
@@ -724,11 +723,10 @@ static int __devinit tca6507_probe(struct i2c_client *client,
 
        return 0;
 exit:
-       while (i--)
+       while (i--) {
                if (tca->leds[i].led_cdev.name)
                        led_classdev_unregister(&tca->leds[i].led_cdev);
-       cancel_work_sync(&tca->work);
-       i2c_set_clientdata(client, NULL);
+       }
        kfree(tca);
        return err;
 }
@@ -745,7 +743,6 @@ static int __devexit tca6507_remove(struct i2c_client *client)
        }
        tca6507_remove_gpio(tca);
        cancel_work_sync(&tca->work);
-       i2c_set_clientdata(client, NULL);
        kfree(tca);
 
        return 0;
index e1e122f2f92912bcc71d2418ffea1f3e77aeb3fa..9bcd1f415f43f137631793e8371ffb6899b5d92c 100644 (file)
@@ -2526,12 +2526,10 @@ static void cfi_intelext_restore_locks(struct mtd_info *mtd)
                if (!region->lockmap)
                        continue;
 
-               for (block = 0; block < region->numblocks; block++) {
+               for_each_clear_bit(block, region->lockmap, region->numblocks) {
                        len = region->erasesize;
                        adr = region->offset + block * len;
-
-                       if (!test_bit(block, region->lockmap))
-                               cfi_intelext_unlock(mtd, adr, len);
+                       cfi_intelext_unlock(mtd, adr, len);
                }
        }
 }
index 50c6a1e7f675cea884a5a0bbb71fb061bfdfe932..c57ae92ebda4d8654bc6bc8328ac004e60754fa1 100644 (file)
 #include <linux/compat.h>
 #include <linux/mount.h>
 #include <linux/blkpg.h>
+#include <linux/magic.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
 #include <linux/mtd/map.h>
 
 #include <asm/uaccess.h>
 
-#define MTD_INODE_FS_MAGIC 0x11307854
 static DEFINE_MUTEX(mtd_mutex);
 static struct vfsmount *mtd_inode_mnt __read_mostly;
 
index 3a125b835546e692e3a9c70cd25434fd54398f90..4f9fb25f945b71d98108c9c9b89030d4f844ab10 100644 (file)
@@ -554,6 +554,13 @@ config RTC_DRV_DS1742
          This driver can also be built as a module. If so, the module
          will be called rtc-ds1742.
 
+config RTC_DRV_DA9052
+       tristate "Dialog DA9052/DA9053 RTC"
+       depends on PMIC_DA9052
+       help
+         Say y here to support the RTC driver for Dialog Semiconductor
+         DA9052-BC and DA9053-AA/Bx PMICs.
+
 config RTC_DRV_EFI
        tristate "EFI RTC"
        depends on IA64
@@ -1070,4 +1077,14 @@ config RTC_DRV_PUV3
          This drive can also be built as a module. If so, the module
          will be called rtc-puv3.
 
+config RTC_DRV_LOONGSON1
+       tristate "loongson1 RTC support"
+       depends on MACH_LOONGSON1
+       help
+         This is a driver for the loongson1 on-chip Counter0 (Time-Of-Year
+         counter) to be used as a RTC.
+
+         This driver can also be built as a module. If so, the module
+         will be called rtc-ls1x.
+
 endif # RTC_CLASS
index 6e6982335c10d9a209c3da9441e2b822ebae1380..727ae7786e6c3806face77564b82e76c52a5b01f 100644 (file)
@@ -27,6 +27,7 @@ obj-$(CONFIG_RTC_DRV_BQ32K)   += rtc-bq32k.o
 obj-$(CONFIG_RTC_DRV_BQ4802)   += rtc-bq4802.o
 obj-$(CONFIG_RTC_DRV_CMOS)     += rtc-cmos.o
 obj-$(CONFIG_RTC_DRV_COH901331)        += rtc-coh901331.o
+obj-$(CONFIG_RTC_DRV_DA9052)   += rtc-da9052.o
 obj-$(CONFIG_RTC_DRV_DAVINCI)  += rtc-davinci.o
 obj-$(CONFIG_RTC_DRV_DM355EVM) += rtc-dm355evm.o
 obj-$(CONFIG_RTC_DRV_VRTC)     += rtc-mrst.o
@@ -53,6 +54,7 @@ obj-$(CONFIG_RTC_DRV_ISL1208) += rtc-isl1208.o
 obj-$(CONFIG_RTC_DRV_ISL12022) += rtc-isl12022.o
 obj-$(CONFIG_RTC_DRV_JZ4740)   += rtc-jz4740.o
 obj-$(CONFIG_RTC_DRV_LPC32XX)  += rtc-lpc32xx.o
+obj-$(CONFIG_RTC_DRV_LOONGSON1)        += rtc-ls1x.o
 obj-$(CONFIG_RTC_DRV_M41T80)   += rtc-m41t80.o
 obj-$(CONFIG_RTC_DRV_M41T93)   += rtc-m41t93.o
 obj-$(CONFIG_RTC_DRV_M41T94)   += rtc-m41t94.o
index ee3c122c05991e55394f7fca1e677caf4d5a3a0c..274a0aafe42bde9207547d2f67d894afdbe4d48a 100644 (file)
@@ -335,7 +335,7 @@ static int __init at91_rtc_probe(struct platform_device *pdev)
 
        /* register irq handler after we know what name we'll use */
        ret = request_irq(AT91_ID_SYS, at91_rtc_interrupt,
-                               IRQF_DISABLED | IRQF_SHARED,
+                               IRQF_SHARED,
                                dev_name(&rtc->rtcdev->dev), rtc);
        if (ret) {
                dev_dbg(&pdev->dev, "can't share IRQ %d?\n", AT91_ID_SYS);
index 408cc8f735be226dd8ceebde037dc0a910804ec0..f090159dce4a77005d8fc6a314b7de106877c6cb 100644 (file)
@@ -187,17 +187,7 @@ static struct i2c_driver bq32k_driver = {
        .id_table       = bq32k_id,
 };
 
-static __init int bq32k_init(void)
-{
-       return i2c_add_driver(&bq32k_driver);
-}
-module_init(bq32k_init);
-
-static __exit void bq32k_exit(void)
-{
-       i2c_del_driver(&bq32k_driver);
-}
-module_exit(bq32k_exit);
+module_i2c_driver(bq32k_driver);
 
 MODULE_AUTHOR("Semihalf, Piotr Ziecik <kosmo@semihalf.com>");
 MODULE_DESCRIPTION("TI BQ32000 I2C RTC driver");
index d7782aa099439575a1a4f1887190b70a1b5e6370..7d5f56edb8efc30e8beb70cbad177a0cca32dc35 100644 (file)
@@ -714,7 +714,7 @@ cmos_do_probe(struct device *dev, struct resource *ports, int rtc_irq)
                        rtc_cmos_int_handler = cmos_interrupt;
 
                retval = request_irq(rtc_irq, rtc_cmos_int_handler,
-                               IRQF_DISABLED, dev_name(&cmos_rtc.rtc->dev),
+                               0, dev_name(&cmos_rtc.rtc->dev),
                                cmos_rtc.rtc);
                if (retval < 0) {
                        dev_dbg(dev, "IRQ %d is already in use\n", rtc_irq);
index 80f9c88214c5e61987001d10479094cb8787f2a6..a5b8a0c4ea842078a31bcfcf5be54c60240ec50e 100644 (file)
@@ -199,7 +199,7 @@ static int __init coh901331_probe(struct platform_device *pdev)
        }
 
        rtap->irq = platform_get_irq(pdev, 0);
-       if (request_irq(rtap->irq, coh901331_interrupt, IRQF_DISABLED,
+       if (request_irq(rtap->irq, coh901331_interrupt, 0,
                        "RTC COH 901 331 Alarm", rtap)) {
                ret = -EIO;
                goto out_no_irq;
diff --git a/drivers/rtc/rtc-da9052.c b/drivers/rtc/rtc-da9052.c
new file mode 100644 (file)
index 0000000..da6ab52
--- /dev/null
@@ -0,0 +1,293 @@
+/*
+ * Real time clock driver for DA9052
+ *
+ * Copyright(c) 2012 Dialog Semiconductor Ltd.
+ *
+ * Author: Dajun Dajun Chen <dajun.chen@diasemi.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ */
+
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/rtc.h>
+
+#include <linux/mfd/da9052/da9052.h>
+#include <linux/mfd/da9052/reg.h>
+
+#define rtc_err(da9052, fmt, ...) \
+               dev_err(da9052->dev, "%s: " fmt, __func__, ##__VA_ARGS__)
+
+struct da9052_rtc {
+       struct rtc_device *rtc;
+       struct da9052 *da9052;
+       int irq;
+};
+
+static int da9052_rtc_enable_alarm(struct da9052 *da9052, bool enable)
+{
+       int ret;
+       if (enable) {
+               ret = da9052_reg_update(da9052, DA9052_ALARM_Y_REG,
+                                       DA9052_ALARM_Y_ALARM_ON,
+                                       DA9052_ALARM_Y_ALARM_ON);
+               if (ret != 0)
+                       rtc_err(da9052, "Failed to enable ALM: %d\n", ret);
+       } else {
+               ret = da9052_reg_update(da9052, DA9052_ALARM_Y_REG,
+                                       DA9052_ALARM_Y_ALARM_ON, 0);
+               if (ret != 0)
+                       rtc_err(da9052, "Write error: %d\n", ret);
+       }
+       return ret;
+}
+
+static irqreturn_t da9052_rtc_irq(int irq, void *data)
+{
+       struct da9052_rtc *rtc = data;
+       int ret;
+
+       ret = da9052_reg_read(rtc->da9052, DA9052_ALARM_MI_REG);
+       if (ret < 0) {
+               rtc_err(rtc->da9052, "Read error: %d\n", ret);
+               return IRQ_NONE;
+       }
+
+       if (ret & DA9052_ALARMMI_ALARMTYPE) {
+               da9052_rtc_enable_alarm(rtc->da9052, 0);
+               rtc_update_irq(rtc->rtc, 1, RTC_IRQF | RTC_AF);
+       } else
+               rtc_update_irq(rtc->rtc, 1, RTC_IRQF | RTC_PF);
+
+       return IRQ_HANDLED;
+}
+
+static int da9052_read_alarm(struct da9052 *da9052, struct rtc_time *rtc_tm)
+{
+       int ret;
+       uint8_t v[5];
+
+       ret = da9052_group_read(da9052, DA9052_ALARM_MI_REG, 5, v);
+       if (ret != 0) {
+               rtc_err(da9052, "Failed to group read ALM: %d\n", ret);
+               return ret;
+       }
+
+       rtc_tm->tm_year = (v[4] & DA9052_RTC_YEAR) + 100;
+       rtc_tm->tm_mon  = (v[3] & DA9052_RTC_MONTH) - 1;
+       rtc_tm->tm_mday = v[2] & DA9052_RTC_DAY;
+       rtc_tm->tm_hour = v[1] & DA9052_RTC_HOUR;
+       rtc_tm->tm_min  = v[0] & DA9052_RTC_MIN;
+
+       ret = rtc_valid_tm(rtc_tm);
+       if (ret != 0)
+               return ret;
+       return ret;
+}
+
+static int da9052_set_alarm(struct da9052 *da9052, struct rtc_time *rtc_tm)
+{
+       int ret;
+       uint8_t v[3];
+
+       rtc_tm->tm_year -= 100;
+       rtc_tm->tm_mon += 1;
+
+       ret = da9052_reg_update(da9052, DA9052_ALARM_MI_REG,
+                               DA9052_RTC_MIN, rtc_tm->tm_min);
+       if (ret != 0) {
+               rtc_err(da9052, "Failed to write ALRM MIN: %d\n", ret);
+               return ret;
+       }
+
+       v[0] = rtc_tm->tm_hour;
+       v[1] = rtc_tm->tm_mday;
+       v[2] = rtc_tm->tm_mon;
+
+       ret = da9052_group_write(da9052, DA9052_ALARM_H_REG, 3, v);
+       if (ret < 0)
+               return ret;
+
+       ret = da9052_reg_update(da9052, DA9052_ALARM_Y_REG,
+                               DA9052_RTC_YEAR, rtc_tm->tm_year);
+       if (ret != 0)
+               rtc_err(da9052, "Failed to write ALRM YEAR: %d\n", ret);
+
+       return ret;
+}
+
+static int da9052_rtc_get_alarm_status(struct da9052 *da9052)
+{
+       int ret;
+
+       ret = da9052_reg_read(da9052, DA9052_ALARM_Y_REG);
+       if (ret < 0) {
+               rtc_err(da9052, "Failed to read ALM: %d\n", ret);
+               return ret;
+       }
+       ret &= DA9052_ALARM_Y_ALARM_ON;
+       return (ret > 0) ? 1 : 0;
+}
+
+static int da9052_rtc_read_time(struct device *dev, struct rtc_time *rtc_tm)
+{
+       struct da9052_rtc *rtc = dev_get_drvdata(dev);
+       uint8_t v[6];
+       int ret;
+
+       ret = da9052_group_read(rtc->da9052, DA9052_COUNT_S_REG, 6, v);
+       if (ret < 0) {
+               rtc_err(rtc->da9052, "Failed to read RTC time : %d\n", ret);
+               return ret;
+       }
+
+       rtc_tm->tm_year = (v[5] & DA9052_RTC_YEAR) + 100;
+       rtc_tm->tm_mon  = (v[4] & DA9052_RTC_MONTH) - 1;
+       rtc_tm->tm_mday = v[3] & DA9052_RTC_DAY;
+       rtc_tm->tm_hour = v[2] & DA9052_RTC_HOUR;
+       rtc_tm->tm_min  = v[1] & DA9052_RTC_MIN;
+       rtc_tm->tm_sec  = v[0] & DA9052_RTC_SEC;
+
+       ret = rtc_valid_tm(rtc_tm);
+       if (ret != 0) {
+               rtc_err(rtc->da9052, "rtc_valid_tm failed: %d\n", ret);
+               return ret;
+       }
+
+       return 0;
+}
+
+static int da9052_rtc_set_time(struct device *dev, struct rtc_time *tm)
+{
+       struct da9052_rtc *rtc;
+       uint8_t v[6];
+
+       rtc = dev_get_drvdata(dev);
+
+       v[0] = tm->tm_sec;
+       v[1] = tm->tm_min;
+       v[2] = tm->tm_hour;
+       v[3] = tm->tm_mday;
+       v[4] = tm->tm_mon + 1;
+       v[5] = tm->tm_year - 100;
+
+       return da9052_group_write(rtc->da9052, DA9052_COUNT_S_REG, 6, v);
+}
+
+static int da9052_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
+{
+       int ret;
+       struct rtc_time *tm = &alrm->time;
+       struct da9052_rtc *rtc = dev_get_drvdata(dev);
+
+       ret = da9052_read_alarm(rtc->da9052, tm);
+
+       if (ret)
+               return ret;
+
+       alrm->enabled = da9052_rtc_get_alarm_status(rtc->da9052);
+
+       return 0;
+}
+
+static int da9052_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
+{
+       int ret;
+       struct rtc_time *tm = &alrm->time;
+       struct da9052_rtc *rtc = dev_get_drvdata(dev);
+
+       ret = da9052_rtc_enable_alarm(rtc->da9052, 0);
+       if (ret < 0)
+               return ret;
+
+       ret = da9052_set_alarm(rtc->da9052, tm);
+       if (ret)
+               return ret;
+
+       ret = da9052_rtc_enable_alarm(rtc->da9052, 1);
+
+       return ret;
+}
+
+static int da9052_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled)
+{
+       struct da9052_rtc *rtc = dev_get_drvdata(dev);
+
+       return da9052_rtc_enable_alarm(rtc->da9052, enabled);
+}
+
+static const struct rtc_class_ops da9052_rtc_ops = {
+       .read_time      = da9052_rtc_read_time,
+       .set_time       = da9052_rtc_set_time,
+       .read_alarm     = da9052_rtc_read_alarm,
+       .set_alarm      = da9052_rtc_set_alarm,
+       .alarm_irq_enable = da9052_rtc_alarm_irq_enable,
+};
+
+static int __devinit da9052_rtc_probe(struct platform_device *pdev)
+{
+       struct da9052_rtc *rtc;
+       int ret;
+
+       rtc = devm_kzalloc(&pdev->dev, sizeof(struct da9052_rtc), GFP_KERNEL);
+       if (!rtc)
+               return -ENOMEM;
+
+       rtc->da9052 = dev_get_drvdata(pdev->dev.parent);
+       platform_set_drvdata(pdev, rtc);
+       rtc->irq = platform_get_irq_byname(pdev, "ALM");
+       ret = request_threaded_irq(rtc->irq, NULL, da9052_rtc_irq,
+                                  IRQF_TRIGGER_LOW | IRQF_ONESHOT,
+                                  "ALM", rtc);
+       if (ret != 0) {
+               rtc_err(rtc->da9052, "irq registration failed: %d\n", ret);
+               goto err_mem;
+       }
+
+       rtc->rtc = rtc_device_register(pdev->name, &pdev->dev,
+                                      &da9052_rtc_ops, THIS_MODULE);
+       if (IS_ERR(rtc->rtc)) {
+               ret = PTR_ERR(rtc->rtc);
+               goto err_free_irq;
+       }
+
+       return 0;
+
+err_free_irq:
+       free_irq(rtc->irq, rtc);
+err_mem:
+       devm_kfree(&pdev->dev, rtc);
+       return ret;
+}
+
+static int __devexit da9052_rtc_remove(struct platform_device *pdev)
+{
+       struct da9052_rtc *rtc = pdev->dev.platform_data;
+
+       rtc_device_unregister(rtc->rtc);
+       free_irq(rtc->irq, rtc);
+       platform_set_drvdata(pdev, NULL);
+       devm_kfree(&pdev->dev, rtc);
+
+       return 0;
+}
+
+static struct platform_driver da9052_rtc_driver = {
+       .probe  = da9052_rtc_probe,
+       .remove = __devexit_p(da9052_rtc_remove),
+       .driver = {
+               .name   = "da9052-rtc",
+               .owner  = THIS_MODULE,
+       },
+};
+
+module_platform_driver(da9052_rtc_driver);
+
+MODULE_AUTHOR("David Dajun Chen <dchen@diasemi.com>");
+MODULE_DESCRIPTION("RTC driver for Dialog DA9052 PMIC");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:da9052-rtc");
index 755e1fe914af46911bedf6897cb553240a0e0e3d..14c2109dbaa3dbed844144864fa7b7a3d4190ec8 100644 (file)
@@ -542,7 +542,7 @@ static int __init davinci_rtc_probe(struct platform_device *pdev)
        rtcss_write(davinci_rtc, 0, PRTCSS_RTC_CCTRL);
 
        ret = request_irq(davinci_rtc->irq, davinci_rtc_interrupt,
-                         IRQF_DISABLED, "davinci_rtc", davinci_rtc);
+                         0, "davinci_rtc", davinci_rtc);
        if (ret < 0) {
                dev_err(dev, "unable to register davinci RTC interrupt\n");
                goto fail4;
index 3a33b1fdbe0f84e54539a5c5383c26c6bcc9c04a..686a865913e19c9f1bbc896074aa253e6da5b3f0 100644 (file)
@@ -814,17 +814,7 @@ static struct spi_driver ds1305_driver = {
        /* REVISIT add suspend/resume */
 };
 
-static int __init ds1305_init(void)
-{
-       return spi_register_driver(&ds1305_driver);
-}
-module_init(ds1305_init);
-
-static void __exit ds1305_exit(void)
-{
-       spi_unregister_driver(&ds1305_driver);
-}
-module_exit(ds1305_exit);
+module_spi_driver(ds1305_driver);
 
 MODULE_DESCRIPTION("RTC driver for DS1305 and DS1306 chips");
 MODULE_LICENSE("GPL");
index 62b0763b7b9acc50cb76a38ed7cdb9bda32615e7..cd188ab72f79c7bba15f5c59d055705d2a68e140 100644 (file)
@@ -20,7 +20,8 @@
 
 
 
-/* We can't determine type by probing, but if we expect pre-Linux code
+/*
+ * We can't determine type by probing, but if we expect pre-Linux code
  * to have set the chip up as a clock (turning on the oscillator and
  * setting the date and time), Linux can ignore the non-clock features.
  * That's a natural job for a factory or repair bench.
@@ -36,7 +37,8 @@ enum ds_type {
        m41t00,
        mcp7941x,
        rx_8025,
-       // rs5c372 too?  different address...
+       last_ds_type /* always last */
+       /* rs5c372 too?  different address... */
 };
 
 
@@ -58,7 +60,8 @@ enum ds_type {
 #      define DS1337_BIT_CENTURY       0x80    /* in REG_MONTH */
 #define DS1307_REG_YEAR                0x06    /* 00-99 */
 
-/* Other registers (control, status, alarms, trickle charge, NVRAM, etc)
+/*
+ * Other registers (control, status, alarms, trickle charge, NVRAM, etc)
  * start at 7, and they differ a LOT. Only control and status matter for
  * basic RTC date and time functionality; be careful using them.
  */
@@ -102,6 +105,8 @@ enum ds_type {
 struct ds1307 {
        u8                      offset; /* register's offset */
        u8                      regs[11];
+       u16                     nvram_offset;
+       struct bin_attribute    *nvram;
        enum ds_type            type;
        unsigned long           flags;
 #define HAS_NVRAM      0               /* bit 0 == sysfs file active */
@@ -116,34 +121,35 @@ struct ds1307 {
 };
 
 struct chip_desc {
-       unsigned                nvram56:1;
        unsigned                alarm:1;
+       u16                     nvram_offset;
+       u16                     nvram_size;
 };
 
-static const struct chip_desc chips[] = {
-[ds_1307] = {
-       .nvram56        = 1,
-},
-[ds_1337] = {
-       .alarm          = 1,
-},
-[ds_1338] = {
-       .nvram56        = 1,
-},
-[ds_1339] = {
-       .alarm          = 1,
-},
-[ds_1340] = {
-},
-[ds_3231] = {
-       .alarm          = 1,
-},
-[m41t00] = {
-},
-[mcp7941x] = {
-},
-[rx_8025] = {
-}, };
+static const struct chip_desc chips[last_ds_type] = {
+       [ds_1307] = {
+               .nvram_offset   = 8,
+               .nvram_size     = 56,
+       },
+       [ds_1337] = {
+               .alarm          = 1,
+       },
+       [ds_1338] = {
+               .nvram_offset   = 8,
+               .nvram_size     = 56,
+       },
+       [ds_1339] = {
+               .alarm          = 1,
+       },
+       [ds_3231] = {
+               .alarm          = 1,
+       },
+       [mcp7941x] = {
+               /* this is battery backed SRAM */
+               .nvram_offset   = 0x20,
+               .nvram_size     = 0x40,
+       },
+};
 
 static const struct i2c_device_id ds1307_id[] = {
        { "ds1307", ds_1307 },
@@ -372,6 +378,11 @@ static int ds1307_set_time(struct device *dev, struct rtc_time *t)
                                | DS1340_BIT_CENTURY;
                break;
        case mcp7941x:
+               /*
+                * these bits were cleared when preparing the date/time
+                * values and need to be set again before writing the
+                * buffer out to the device.
+                */
                buf[DS1307_REG_SECS] |= MCP7941X_BIT_ST;
                buf[DS1307_REG_WDAY] |= MCP7941X_BIT_VBATEN;
                break;
@@ -417,7 +428,8 @@ static int ds1337_read_alarm(struct device *dev, struct rtc_wkalrm *t)
                        ds1307->regs[6], ds1307->regs[7],
                        ds1307->regs[8]);
 
-       /* report alarm time (ALARM1); assume 24 hour and day-of-month modes,
+       /*
+        * report alarm time (ALARM1); assume 24 hour and day-of-month modes,
         * and that all four fields are checked matches
         */
        t->time.tm_sec = bcd2bin(ds1307->regs[0] & 0x7f);
@@ -445,7 +457,7 @@ static int ds1337_read_alarm(struct device *dev, struct rtc_wkalrm *t)
 
 static int ds1337_set_alarm(struct device *dev, struct rtc_wkalrm *t)
 {
-       struct i2c_client       *client = to_i2c_client(dev);
+       struct i2c_client       *client = to_i2c_client(dev);
        struct ds1307           *ds1307 = i2c_get_clientdata(client);
        unsigned char           *buf = ds1307->regs;
        u8                      control, status;
@@ -541,8 +553,6 @@ static const struct rtc_class_ops ds13xx_rtc_ops = {
 
 /*----------------------------------------------------------------------*/
 
-#define NVRAM_SIZE     56
-
 static ssize_t
 ds1307_nvram_read(struct file *filp, struct kobject *kobj,
                struct bin_attribute *attr,
@@ -555,14 +565,15 @@ ds1307_nvram_read(struct file *filp, struct kobject *kobj,
        client = kobj_to_i2c_client(kobj);
        ds1307 = i2c_get_clientdata(client);
 
-       if (unlikely(off >= NVRAM_SIZE))
+       if (unlikely(off >= ds1307->nvram->size))
                return 0;
-       if ((off + count) > NVRAM_SIZE)
-               count = NVRAM_SIZE - off;
+       if ((off + count) > ds1307->nvram->size)
+               count = ds1307->nvram->size - off;
        if (unlikely(!count))
                return count;
 
-       result = ds1307->read_block_data(client, 8 + off, count, buf);
+       result = ds1307->read_block_data(client, ds1307->nvram_offset + off,
+                                                               count, buf);
        if (result < 0)
                dev_err(&client->dev, "%s error %d\n", "nvram read", result);
        return result;
@@ -580,14 +591,15 @@ ds1307_nvram_write(struct file *filp, struct kobject *kobj,
        client = kobj_to_i2c_client(kobj);
        ds1307 = i2c_get_clientdata(client);
 
-       if (unlikely(off >= NVRAM_SIZE))
+       if (unlikely(off >= ds1307->nvram->size))
                return -EFBIG;
-       if ((off + count) > NVRAM_SIZE)
-               count = NVRAM_SIZE - off;
+       if ((off + count) > ds1307->nvram->size)
+               count = ds1307->nvram->size - off;
        if (unlikely(!count))
                return count;
 
-       result = ds1307->write_block_data(client, 8 + off, count, buf);
+       result = ds1307->write_block_data(client, ds1307->nvram_offset + off,
+                                                               count, buf);
        if (result < 0) {
                dev_err(&client->dev, "%s error %d\n", "nvram write", result);
                return result;
@@ -595,21 +607,8 @@ ds1307_nvram_write(struct file *filp, struct kobject *kobj,
        return count;
 }
 
-static struct bin_attribute nvram = {
-       .attr = {
-               .name   = "nvram",
-               .mode   = S_IRUGO | S_IWUSR,
-       },
-
-       .read   = ds1307_nvram_read,
-       .write  = ds1307_nvram_write,
-       .size   = NVRAM_SIZE,
-};
-
 /*----------------------------------------------------------------------*/
 
-static struct i2c_driver ds1307_driver;
-
 static int __devinit ds1307_probe(struct i2c_client *client,
                                  const struct i2c_device_id *id)
 {
@@ -630,7 +629,8 @@ static int __devinit ds1307_probe(struct i2c_client *client,
            && !i2c_check_functionality(adapter, I2C_FUNC_SMBUS_I2C_BLOCK))
                return -EIO;
 
-       if (!(ds1307 = kzalloc(sizeof(struct ds1307), GFP_KERNEL)))
+       ds1307 = kzalloc(sizeof(struct ds1307), GFP_KERNEL);
+       if (!ds1307)
                return -ENOMEM;
 
        i2c_set_clientdata(client, ds1307);
@@ -652,11 +652,6 @@ static int __devinit ds1307_probe(struct i2c_client *client,
        case ds_1337:
        case ds_1339:
        case ds_3231:
-               /* has IRQ? */
-               if (ds1307->client->irq > 0 && chip->alarm) {
-                       INIT_WORK(&ds1307->work, ds1307_work);
-                       want_irq = true;
-               }
                /* get registers that the "rtc" read below won't read... */
                tmp = ds1307->read_block_data(ds1307->client,
                                DS1337_REG_CONTROL, 2, buf);
@@ -670,14 +665,19 @@ static int __devinit ds1307_probe(struct i2c_client *client,
                if (ds1307->regs[0] & DS1337_BIT_nEOSC)
                        ds1307->regs[0] &= ~DS1337_BIT_nEOSC;
 
-               /* Using IRQ?  Disable the square wave and both alarms.
+               /*
+                * Using IRQ?  Disable the square wave and both alarms.
                 * For some variants, be sure alarms can trigger when we're
                 * running on Vbackup (BBSQI/BBSQW)
                 */
-               if (want_irq) {
+               if (ds1307->client->irq > 0 && chip->alarm) {
+                       INIT_WORK(&ds1307->work, ds1307_work);
+
                        ds1307->regs[0] |= DS1337_BIT_INTCN
                                        | bbsqi_bitpos[ds1307->type];
                        ds1307->regs[0] &= ~(DS1337_BIT_A2IE | DS1337_BIT_A1IE);
+
+                       want_irq = true;
                }
 
                i2c_smbus_write_byte_data(client, DS1337_REG_CONTROL,
@@ -772,7 +772,8 @@ read_rtc:
                goto exit_free;
        }
 
-       /* minimal sanity checking; some chips (like DS1340) don't
+       /*
+        * minimal sanity checking; some chips (like DS1340) don't
         * specify the extra bits as must-be-zero, but there are
         * still a few values that are clearly out-of-range.
         */
@@ -836,11 +837,7 @@ read_rtc:
                }
 
                break;
-       case rx_8025:
-       case ds_1337:
-       case ds_1339:
-       case ds_1388:
-       case ds_3231:
+       default:
                break;
        }
 
@@ -848,7 +845,8 @@ read_rtc:
        switch (ds1307->type) {
        case ds_1340:
        case m41t00:
-               /* NOTE: ignores century bits; fix before deploying
+               /*
+                * NOTE: ignores century bits; fix before deploying
                 * systems that will run through year 2100.
                 */
                break;
@@ -858,7 +856,8 @@ read_rtc:
                if (!(tmp & DS1307_BIT_12HR))
                        break;
 
-               /* Be sure we're in 24 hour mode.  Multi-master systems
+               /*
+                * Be sure we're in 24 hour mode.  Multi-master systems
                 * take note...
                 */
                tmp = bcd2bin(tmp & 0x1f);
@@ -894,16 +893,31 @@ read_rtc:
                dev_dbg(&client->dev, "got IRQ %d\n", client->irq);
        }
 
-       if (chip->nvram56) {
-               err = sysfs_create_bin_file(&client->dev.kobj, &nvram);
-               if (err == 0) {
-                       set_bit(HAS_NVRAM, &ds1307->flags);
-                       dev_info(&client->dev, "56 bytes nvram\n");
+       if (chip->nvram_size) {
+               ds1307->nvram = kzalloc(sizeof(struct bin_attribute),
+                                                       GFP_KERNEL);
+               if (!ds1307->nvram) {
+                       err = -ENOMEM;
+                       goto exit_nvram;
+               }
+               ds1307->nvram->attr.name = "nvram";
+               ds1307->nvram->attr.mode = S_IRUGO | S_IWUSR;
+               ds1307->nvram->read = ds1307_nvram_read,
+               ds1307->nvram->write = ds1307_nvram_write,
+               ds1307->nvram->size = chip->nvram_size;
+               ds1307->nvram_offset = chip->nvram_offset;
+               err = sysfs_create_bin_file(&client->dev.kobj, ds1307->nvram);
+               if (err) {
+                       kfree(ds1307->nvram);
+                       goto exit_nvram;
                }
+               set_bit(HAS_NVRAM, &ds1307->flags);
+               dev_info(&client->dev, "%zu bytes nvram\n", ds1307->nvram->size);
        }
 
        return 0;
 
+exit_nvram:
 exit_irq:
        rtc_device_unregister(ds1307->rtc);
 exit_free:
@@ -913,15 +927,17 @@ exit_free:
 
 static int __devexit ds1307_remove(struct i2c_client *client)
 {
-       struct ds1307           *ds1307 = i2c_get_clientdata(client);
+       struct ds1307 *ds1307 = i2c_get_clientdata(client);
 
        if (test_and_clear_bit(HAS_ALARM, &ds1307->flags)) {
                free_irq(client->irq, client);
                cancel_work_sync(&ds1307->work);
        }
 
-       if (test_and_clear_bit(HAS_NVRAM, &ds1307->flags))
-               sysfs_remove_bin_file(&client->dev.kobj, &nvram);
+       if (test_and_clear_bit(HAS_NVRAM, &ds1307->flags)) {
+               sysfs_remove_bin_file(&client->dev.kobj, ds1307->nvram);
+               kfree(ds1307->nvram);
+       }
 
        rtc_device_unregister(ds1307->rtc);
        kfree(ds1307);
@@ -938,17 +954,7 @@ static struct i2c_driver ds1307_driver = {
        .id_table       = ds1307_id,
 };
 
-static int __init ds1307_init(void)
-{
-       return i2c_add_driver(&ds1307_driver);
-}
-module_init(ds1307_init);
-
-static void __exit ds1307_exit(void)
-{
-       i2c_del_driver(&ds1307_driver);
-}
-module_exit(ds1307_exit);
+module_i2c_driver(ds1307_driver);
 
 MODULE_DESCRIPTION("RTC driver for DS1307 and similar chips");
 MODULE_LICENSE("GPL");
index e6e71deb188f7cc91a6512584724df883f307a27..966316088b7f8979e9b7e2cd3eff7f52c703c080 100644 (file)
@@ -446,18 +446,7 @@ static struct i2c_driver ds1374_driver = {
        .id_table = ds1374_id,
 };
 
-static int __init ds1374_init(void)
-{
-       return i2c_add_driver(&ds1374_driver);
-}
-
-static void __exit ds1374_exit(void)
-{
-       i2c_del_driver(&ds1374_driver);
-}
-
-module_init(ds1374_init);
-module_exit(ds1374_exit);
+module_i2c_driver(ds1374_driver);
 
 MODULE_AUTHOR("Scott Wood <scottwood@freescale.com>");
 MODULE_DESCRIPTION("Maxim/Dallas DS1374 RTC Driver");
index b038d2cfef267163699fb502a4c3d2d533a58e75..b0a99e1b25be96684d821351312da7aa0e025c8b 100644 (file)
@@ -175,17 +175,7 @@ static struct spi_driver ds1390_driver = {
        .remove = __devexit_p(ds1390_remove),
 };
 
-static __init int ds1390_init(void)
-{
-       return spi_register_driver(&ds1390_driver);
-}
-module_init(ds1390_init);
-
-static __exit void ds1390_exit(void)
-{
-       spi_unregister_driver(&ds1390_driver);
-}
-module_exit(ds1390_exit);
+module_spi_driver(ds1390_driver);
 
 MODULE_DESCRIPTION("Dallas/Maxim DS1390/93/94 SPI RTC driver");
 MODULE_AUTHOR("Mark Jackson <mpfj@mimc.co.uk>");
index 761f36bc83a95e6bbbfa7dfc7f87aad55057858e..1f675f5294f5844c6ef04ee33bc594c754a821c8 100644 (file)
@@ -532,7 +532,7 @@ ds1511_rtc_probe(struct platform_device *pdev)
        if (pdata->irq > 0) {
                rtc_read(RTC_CMD1);
                if (devm_request_irq(&pdev->dev, pdata->irq, ds1511_interrupt,
-                       IRQF_DISABLED | IRQF_SHARED, pdev->name, pdev) < 0) {
+                       IRQF_SHARED, pdev->name, pdev) < 0) {
 
                        dev_warn(&pdev->dev, "interrupt not available.\n");
                        pdata->irq = 0;
index 6f0a1b530f2e8bdf8fea8ef2de1f3965114d74ed..6ccedbbf923c5ce0cb183504bf64968f06869609 100644 (file)
@@ -320,7 +320,7 @@ static int __devinit ds1553_rtc_probe(struct platform_device *pdev)
                writeb(0, ioaddr + RTC_INTERRUPTS);
                if (devm_request_irq(&pdev->dev, pdata->irq,
                                ds1553_rtc_interrupt,
-                               IRQF_DISABLED, pdev->name, pdev) < 0) {
+                               0, pdev->name, pdev) < 0) {
                        dev_warn(&pdev->dev, "interrupt not available.\n");
                        pdata->irq = 0;
                }
index a319402a54479bd633a0bfdbb4710996316b1839..7fa67d0df172ca37494ad11b41a5475a72c87d0a 100644 (file)
@@ -202,20 +202,9 @@ static struct i2c_driver ds1672_driver = {
        .id_table = ds1672_id,
 };
 
-static int __init ds1672_init(void)
-{
-       return i2c_add_driver(&ds1672_driver);
-}
-
-static void __exit ds1672_exit(void)
-{
-       i2c_del_driver(&ds1672_driver);
-}
+module_i2c_driver(ds1672_driver);
 
 MODULE_AUTHOR("Alessandro Zummo <a.zummo@towertech.it>");
 MODULE_DESCRIPTION("Dallas/Maxim DS1672 timekeeper driver");
 MODULE_LICENSE("GPL");
 MODULE_VERSION(DRV_VERSION);
-
-module_init(ds1672_init);
-module_exit(ds1672_exit);
index 27b7bf672ac624249b2a64abda0464af5d74f2cc..e1945095814e9acd9d920f0d7fd31f242de58f97 100644 (file)
@@ -473,18 +473,7 @@ static struct i2c_driver ds3232_driver = {
        .id_table = ds3232_id,
 };
 
-static int __init ds3232_init(void)
-{
-       return i2c_add_driver(&ds3232_driver);
-}
-
-static void __exit ds3232_exit(void)
-{
-       i2c_del_driver(&ds3232_driver);
-}
-
-module_init(ds3232_init);
-module_exit(ds3232_exit);
+module_i2c_driver(ds3232_driver);
 
 MODULE_AUTHOR("Srikanth Srinivasan <srikanth.srinivasan@freescale.com>");
 MODULE_DESCRIPTION("Maxim/Dallas DS3232 RTC Driver");
index bbd26228f5326f337e86af8c624736d5c9c82ede..fda707926f022b26646342369db135d04e32e9ec 100644 (file)
@@ -173,17 +173,7 @@ static struct spi_driver ds3234_driver = {
        .remove = __devexit_p(ds3234_remove),
 };
 
-static __init int ds3234_init(void)
-{
-       return spi_register_driver(&ds3234_driver);
-}
-module_init(ds3234_init);
-
-static __exit void ds3234_exit(void)
-{
-       spi_unregister_driver(&ds3234_driver);
-}
-module_exit(ds3234_exit);
+module_spi_driver(ds3234_driver);
 
 MODULE_DESCRIPTION("DS3234 SPI RTC driver");
 MODULE_AUTHOR("Dennis Aberilla <denzzzhome@yahoo.com>");
index 8414dea5fb1410da0e39d5b446223e8c60927c85..0104ea7ebe503e03899468c8482d834a5eabb277 100644 (file)
@@ -144,19 +144,8 @@ static struct i2c_driver em3027_driver = {
        .id_table = em3027_id,
 };
 
-static int __init em3027_init(void)
-{
-       return i2c_add_driver(&em3027_driver);
-}
-
-static void __exit em3027_exit(void)
-{
-       i2c_del_driver(&em3027_driver);
-}
+module_i2c_driver(em3027_driver);
 
 MODULE_AUTHOR("Mike Rapoport <mike@compulab.co.il>");
 MODULE_DESCRIPTION("EM Microelectronic EM3027 RTC driver");
 MODULE_LICENSE("GPL");
-
-module_init(em3027_init);
-module_exit(em3027_exit);
index 4cf2e70c5078a415313799cfec0de806c2766e42..86b6ecce99f00c58b26d08987778fb63eb149755 100644 (file)
@@ -565,17 +565,7 @@ static struct i2c_driver fm3130_driver = {
        .id_table       = fm3130_id,
 };
 
-static int __init fm3130_init(void)
-{
-       return i2c_add_driver(&fm3130_driver);
-}
-module_init(fm3130_init);
-
-static void __exit fm3130_exit(void)
-{
-       i2c_del_driver(&fm3130_driver);
-}
-module_exit(fm3130_exit);
+module_i2c_driver(fm3130_driver);
 
 MODULE_DESCRIPTION("RTC driver for FM3130");
 MODULE_AUTHOR("Sergey Lapin <slapin@ossfans.org>");
index 6186833973eef194598f3786ff3d2151edb8e4ff..1850104705c0872d37930582a233b513b72e751f 100644 (file)
@@ -309,18 +309,7 @@ static struct i2c_driver isl12022_driver = {
        .id_table       = isl12022_id,
 };
 
-static int __init isl12022_init(void)
-{
-       return i2c_add_driver(&isl12022_driver);
-}
-
-static void __exit isl12022_exit(void)
-{
-       i2c_del_driver(&isl12022_driver);
-}
-
-module_init(isl12022_init);
-module_exit(isl12022_exit);
+module_i2c_driver(isl12022_driver);
 
 MODULE_AUTHOR("roman.fietze@telemotive.de");
 MODULE_DESCRIPTION("ISL 12022 RTC driver");
index da8beb8cae51931162aebe3802cddc45067e8f96..dd2aeee6c66a05a7df3644f612d9033e9add496b 100644 (file)
@@ -710,22 +710,9 @@ static struct i2c_driver isl1208_driver = {
        .id_table = isl1208_id,
 };
 
-static int __init
-isl1208_init(void)
-{
-       return i2c_add_driver(&isl1208_driver);
-}
-
-static void __exit
-isl1208_exit(void)
-{
-       i2c_del_driver(&isl1208_driver);
-}
+module_i2c_driver(isl1208_driver);
 
 MODULE_AUTHOR("Herbert Valerio Riedel <hvr@gnu.org>");
 MODULE_DESCRIPTION("Intersil ISL1208 RTC driver");
 MODULE_LICENSE("GPL");
 MODULE_VERSION(DRV_VERSION);
-
-module_init(isl1208_init);
-module_exit(isl1208_exit);
index ecc1713b2b4f827f144e025d21ce8657d8a732d1..63c72189c64b38d76d7d1e31721f359f724d983d 100644 (file)
@@ -287,7 +287,7 @@ static int __devinit lpc32xx_rtc_probe(struct platform_device *pdev)
        if (rtc->irq >= 0) {
                if (devm_request_irq(&pdev->dev, rtc->irq,
                                     lpc32xx_rtc_alarm_interrupt,
-                                    IRQF_DISABLED, pdev->name, rtc) < 0) {
+                                    0, pdev->name, rtc) < 0) {
                        dev_warn(&pdev->dev, "Can't request interrupt.\n");
                        rtc->irq = -1;
                } else {
diff --git a/drivers/rtc/rtc-ls1x.c b/drivers/rtc/rtc-ls1x.c
new file mode 100644 (file)
index 0000000..07e81c5
--- /dev/null
@@ -0,0 +1,210 @@
+/*
+ * Copyright (c) 2011 Zhao Zhang <zhzhl555@gmail.com>
+ *
+ * Derived from driver/rtc/rtc-au1xxx.c
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/rtc.h>
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/delay.h>
+#include <linux/types.h>
+#include <linux/io.h>
+#include <asm/mach-loongson1/loongson1.h>
+
+#define LS1X_RTC_REG_OFFSET    (LS1X_RTC_BASE + 0x20)
+#define LS1X_RTC_REGS(x) \
+               ((void __iomem *)KSEG1ADDR(LS1X_RTC_REG_OFFSET + (x)))
+
+/*RTC programmable counters 0 and 1*/
+#define SYS_COUNTER_CNTRL              (LS1X_RTC_REGS(0x20))
+#define SYS_CNTRL_ERS                  (1 << 23)
+#define SYS_CNTRL_RTS                  (1 << 20)
+#define SYS_CNTRL_RM2                  (1 << 19)
+#define SYS_CNTRL_RM1                  (1 << 18)
+#define SYS_CNTRL_RM0                  (1 << 17)
+#define SYS_CNTRL_RS                   (1 << 16)
+#define SYS_CNTRL_BP                   (1 << 14)
+#define SYS_CNTRL_REN                  (1 << 13)
+#define SYS_CNTRL_BRT                  (1 << 12)
+#define SYS_CNTRL_TEN                  (1 << 11)
+#define SYS_CNTRL_BTT                  (1 << 10)
+#define SYS_CNTRL_E0                   (1 << 8)
+#define SYS_CNTRL_ETS                  (1 << 7)
+#define SYS_CNTRL_32S                  (1 << 5)
+#define SYS_CNTRL_TTS                  (1 << 4)
+#define SYS_CNTRL_TM2                  (1 << 3)
+#define SYS_CNTRL_TM1                  (1 << 2)
+#define SYS_CNTRL_TM0                  (1 << 1)
+#define SYS_CNTRL_TS                   (1 << 0)
+
+/* Programmable Counter 0 Registers */
+#define SYS_TOYTRIM            (LS1X_RTC_REGS(0))
+#define SYS_TOYWRITE0          (LS1X_RTC_REGS(4))
+#define SYS_TOYWRITE1          (LS1X_RTC_REGS(8))
+#define SYS_TOYREAD0           (LS1X_RTC_REGS(0xC))
+#define SYS_TOYREAD1           (LS1X_RTC_REGS(0x10))
+#define SYS_TOYMATCH0          (LS1X_RTC_REGS(0x14))
+#define SYS_TOYMATCH1          (LS1X_RTC_REGS(0x18))
+#define SYS_TOYMATCH2          (LS1X_RTC_REGS(0x1C))
+
+/* Programmable Counter 1 Registers */
+#define SYS_RTCTRIM            (LS1X_RTC_REGS(0x40))
+#define SYS_RTCWRITE0          (LS1X_RTC_REGS(0x44))
+#define SYS_RTCREAD0           (LS1X_RTC_REGS(0x48))
+#define SYS_RTCMATCH0          (LS1X_RTC_REGS(0x4C))
+#define SYS_RTCMATCH1          (LS1X_RTC_REGS(0x50))
+#define SYS_RTCMATCH2          (LS1X_RTC_REGS(0x54))
+
+#define LS1X_SEC_OFFSET                (4)
+#define LS1X_MIN_OFFSET                (10)
+#define LS1X_HOUR_OFFSET       (16)
+#define LS1X_DAY_OFFSET                (21)
+#define LS1X_MONTH_OFFSET      (26)
+
+
+#define LS1X_SEC_MASK          (0x3f)
+#define LS1X_MIN_MASK          (0x3f)
+#define LS1X_HOUR_MASK         (0x1f)
+#define LS1X_DAY_MASK          (0x1f)
+#define LS1X_MONTH_MASK                (0x3f)
+#define LS1X_YEAR_MASK         (0xffffffff)
+
+#define ls1x_get_sec(t)                (((t) >> LS1X_SEC_OFFSET) & LS1X_SEC_MASK)
+#define ls1x_get_min(t)                (((t) >> LS1X_MIN_OFFSET) & LS1X_MIN_MASK)
+#define ls1x_get_hour(t)       (((t) >> LS1X_HOUR_OFFSET) & LS1X_HOUR_MASK)
+#define ls1x_get_day(t)                (((t) >> LS1X_DAY_OFFSET) & LS1X_DAY_MASK)
+#define ls1x_get_month(t)      (((t) >> LS1X_MONTH_OFFSET) & LS1X_MONTH_MASK)
+
+#define RTC_CNTR_OK (SYS_CNTRL_E0 | SYS_CNTRL_32S)
+
+static int ls1x_rtc_read_time(struct device *dev, struct rtc_time *rtm)
+{
+       unsigned long v, t;
+
+       v = readl(SYS_TOYREAD0);
+       t = readl(SYS_TOYREAD1);
+
+       memset(rtm, 0, sizeof(struct rtc_time));
+       t  = mktime((t & LS1X_YEAR_MASK), ls1x_get_month(v),
+                       ls1x_get_day(v), ls1x_get_hour(v),
+                       ls1x_get_min(v), ls1x_get_sec(v));
+       rtc_time_to_tm(t, rtm);
+
+       return rtc_valid_tm(rtm);
+}
+
+static int ls1x_rtc_set_time(struct device *dev, struct  rtc_time *rtm)
+{
+       unsigned long v, t, c;
+       int ret = -ETIMEDOUT;
+
+       v = ((rtm->tm_mon + 1)  << LS1X_MONTH_OFFSET)
+               | (rtm->tm_mday << LS1X_DAY_OFFSET)
+               | (rtm->tm_hour << LS1X_HOUR_OFFSET)
+               | (rtm->tm_min  << LS1X_MIN_OFFSET)
+               | (rtm->tm_sec  << LS1X_SEC_OFFSET);
+
+       writel(v, SYS_TOYWRITE0);
+       c = 0x10000;
+       /* add timeout check counter, for more safe */
+       while ((readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_TS) && --c)
+               usleep_range(1000, 3000);
+
+       if (!c) {
+               dev_err(dev, "set time timeout!\n");
+               goto err;
+       }
+
+       t = rtm->tm_year + 1900;
+       writel(t, SYS_TOYWRITE1);
+       c = 0x10000;
+       while ((readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_TS) && --c)
+               usleep_range(1000, 3000);
+
+       if (!c) {
+               dev_err(dev, "set time timeout!\n");
+               goto err;
+       }
+       return 0;
+err:
+       return ret;
+}
+
+static struct rtc_class_ops  ls1x_rtc_ops = {
+       .read_time      = ls1x_rtc_read_time,
+       .set_time       = ls1x_rtc_set_time,
+};
+
+static int __devinit ls1x_rtc_probe(struct platform_device *pdev)
+{
+       struct rtc_device *rtcdev;
+       unsigned long v;
+       int ret;
+
+       v = readl(SYS_COUNTER_CNTRL);
+       if (!(v & RTC_CNTR_OK)) {
+               dev_err(&pdev->dev, "rtc counters not working\n");
+               ret = -ENODEV;
+               goto err;
+       }
+       ret = -ETIMEDOUT;
+       /* set to 1 HZ if needed */
+       if (readl(SYS_TOYTRIM) != 32767) {
+               v = 0x100000;
+               while ((readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_TTS) && --v)
+                       usleep_range(1000, 3000);
+
+               if (!v) {
+                       dev_err(&pdev->dev, "time out\n");
+                       goto err;
+               }
+               writel(32767, SYS_TOYTRIM);
+       }
+       /* this loop coundn't be endless */
+       while (readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_TTS)
+               usleep_range(1000, 3000);
+
+       rtcdev = rtc_device_register("ls1x-rtc", &pdev->dev,
+                                       &ls1x_rtc_ops , THIS_MODULE);
+       if (IS_ERR(rtcdev)) {
+               ret = PTR_ERR(rtcdev);
+               goto err;
+       }
+
+       platform_set_drvdata(pdev, rtcdev);
+       return 0;
+err:
+       return ret;
+}
+
+static int __devexit ls1x_rtc_remove(struct platform_device *pdev)
+{
+       struct rtc_device *rtcdev = platform_get_drvdata(pdev);
+
+       rtc_device_unregister(rtcdev);
+       platform_set_drvdata(pdev, NULL);
+
+       return 0;
+}
+
+static struct platform_driver  ls1x_rtc_driver = {
+       .driver         = {
+               .name   = "ls1x-rtc",
+               .owner  = THIS_MODULE,
+       },
+       .remove         = __devexit_p(ls1x_rtc_remove),
+       .probe          = ls1x_rtc_probe,
+};
+
+module_platform_driver(ls1x_rtc_driver);
+
+MODULE_AUTHOR("zhao zhang <zhzhl555@gmail.com>");
+MODULE_LICENSE("GPL");
index 64aedd8cc095810e4134ceb727538a24b2af6232..4e0f84af99a720b336aa1a08b48d25259e9e5fb8 100644 (file)
@@ -900,20 +900,9 @@ static struct i2c_driver m41t80_driver = {
        .id_table = m41t80_id,
 };
 
-static int __init m41t80_rtc_init(void)
-{
-       return i2c_add_driver(&m41t80_driver);
-}
-
-static void __exit m41t80_rtc_exit(void)
-{
-       i2c_del_driver(&m41t80_driver);
-}
+module_i2c_driver(m41t80_driver);
 
 MODULE_AUTHOR("Alexander Bigga <ab@mycable.de>");
 MODULE_DESCRIPTION("ST Microelectronics M41T80 series RTC I2C Client Driver");
 MODULE_LICENSE("GPL");
 MODULE_VERSION(DRV_VERSION);
-
-module_init(m41t80_rtc_init);
-module_exit(m41t80_rtc_exit);
index ef71132ff205fc1ef0faec00ba55cdea383622fa..10f1c29436ec59946123e5f2830f83e44a6c2ebc 100644 (file)
@@ -206,17 +206,7 @@ static struct spi_driver m41t93_driver = {
        .remove = __devexit_p(m41t93_remove),
 };
 
-static __init int m41t93_init(void)
-{
-       return spi_register_driver(&m41t93_driver);
-}
-module_init(m41t93_init);
-
-static __exit void m41t93_exit(void)
-{
-       spi_unregister_driver(&m41t93_driver);
-}
-module_exit(m41t93_exit);
+module_spi_driver(m41t93_driver);
 
 MODULE_AUTHOR("Nikolaus Voss <n.voss@weinmann.de>");
 MODULE_DESCRIPTION("Driver for ST M41T93 SPI RTC");
index 2a4721f617975bbb21db850418c5a41976fe5d89..6e78193e026b8b2c38599d62cde552a2ba7864b4 100644 (file)
@@ -153,19 +153,7 @@ static struct spi_driver m41t94_driver = {
        .remove = __devexit_p(m41t94_remove),
 };
 
-static __init int m41t94_init(void)
-{
-       return spi_register_driver(&m41t94_driver);
-}
-
-module_init(m41t94_init);
-
-static __exit void m41t94_exit(void)
-{
-       spi_unregister_driver(&m41t94_driver);
-}
-
-module_exit(m41t94_exit);
+module_spi_driver(m41t94_driver);
 
 MODULE_AUTHOR("Kim B. Heino <Kim.Heino@bluegiga.com>");
 MODULE_DESCRIPTION("Driver for ST M41T94 SPI RTC");
index 486142c2637a05da66da8e1542c9545cb50c4d41..a00e33204b910224e9e1badccbae3eb3da9e7bbd 100644 (file)
@@ -261,20 +261,9 @@ static struct i2c_driver max6900_driver = {
        .id_table = max6900_id,
 };
 
-static int __init max6900_init(void)
-{
-       return i2c_add_driver(&max6900_driver);
-}
-
-static void __exit max6900_exit(void)
-{
-       i2c_del_driver(&max6900_driver);
-}
+module_i2c_driver(max6900_driver);
 
 MODULE_DESCRIPTION("Maxim MAX6900 RTC driver");
 MODULE_AUTHOR("Dale Farnsworth <dale@farnsworth.org>");
 MODULE_LICENSE("GPL");
 MODULE_VERSION(DRV_VERSION);
-
-module_init(max6900_init);
-module_exit(max6900_exit);
index 1f6b3cc58e8a3644e1412f77808464412540c37a..36c74d22e8b50a490082745b435aa284e37a4eb7 100644 (file)
@@ -160,17 +160,7 @@ static struct spi_driver max6902_driver = {
        .remove = __devexit_p(max6902_remove),
 };
 
-static __init int max6902_init(void)
-{
-       return spi_register_driver(&max6902_driver);
-}
-module_init(max6902_init);
-
-static __exit void max6902_exit(void)
-{
-       spi_unregister_driver(&max6902_driver);
-}
-module_exit(max6902_exit);
+module_spi_driver(max6902_driver);
 
 MODULE_DESCRIPTION ("max6902 spi RTC driver");
 MODULE_AUTHOR ("Raphael Assenat");
index 2d71943bc436ad9719d364d99361dd62f92268eb..1459055a83aaad94a522f093b045bad2a9812b6b 100644 (file)
@@ -193,10 +193,17 @@ static int max8925_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
        ret = max8925_reg_read(info->rtc, MAX8925_RTC_IRQ_MASK);
        if (ret < 0)
                goto out;
-       if ((ret & ALARM0_IRQ) == 0)
-               alrm->enabled = 1;
-       else
+       if (ret & ALARM0_IRQ) {
                alrm->enabled = 0;
+       } else {
+               ret = max8925_reg_read(info->rtc, MAX8925_ALARM0_CNTL);
+               if (ret < 0)
+                       goto out;
+               if (!ret)
+                       alrm->enabled = 0;
+               else
+                       alrm->enabled = 1;
+       }
        ret = max8925_reg_read(info->rtc, MAX8925_RTC_STATUS);
        if (ret < 0)
                goto out;
@@ -204,6 +211,7 @@ static int max8925_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
                alrm->pending = 1;
        else
                alrm->pending = 0;
+       return 0;
 out:
        return ret;
 }
@@ -220,8 +228,11 @@ static int max8925_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
        ret = max8925_bulk_write(info->rtc, MAX8925_ALARM0_SEC, TIME_NUM, buf);
        if (ret < 0)
                goto out;
-       /* only enable alarm on year/month/day/hour/min/sec */
-       ret = max8925_reg_write(info->rtc, MAX8925_ALARM0_CNTL, 0x77);
+       if (alrm->enabled)
+               /* only enable alarm on year/month/day/hour/min/sec */
+               ret = max8925_reg_write(info->rtc, MAX8925_ALARM0_CNTL, 0x77);
+       else
+               ret = max8925_reg_write(info->rtc, MAX8925_ALARM0_CNTL, 0x0);
        if (ret < 0)
                goto out;
 out:
index 9d3caccfc250ff6c5dd8a89b5ee296457ec31bcb..e954a759ba85e379fb2fd087ded474ac03ef43ee 100644 (file)
@@ -327,7 +327,7 @@ static int __devinit mpc5121_rtc_probe(struct platform_device *op)
        dev_set_drvdata(&op->dev, rtc);
 
        rtc->irq = irq_of_parse_and_map(op->dev.of_node, 1);
-       err = request_irq(rtc->irq, mpc5121_rtc_handler, IRQF_DISABLED,
+       err = request_irq(rtc->irq, mpc5121_rtc_handler, 0,
                                                "mpc5121-rtc", &op->dev);
        if (err) {
                dev_err(&op->dev, "%s: could not request irq: %i\n",
@@ -337,7 +337,7 @@ static int __devinit mpc5121_rtc_probe(struct platform_device *op)
 
        rtc->irq_periodic = irq_of_parse_and_map(op->dev.of_node, 0);
        err = request_irq(rtc->irq_periodic, mpc5121_rtc_handler_upd,
-                               IRQF_DISABLED, "mpc5121-rtc_upd", &op->dev);
+                               0, "mpc5121-rtc_upd", &op->dev);
        if (err) {
                dev_err(&op->dev, "%s: could not request irq: %i\n",
                                                __func__, rtc->irq_periodic);
index 6cd6c7235344916c1c51eac091f2cd80194c5426..f51719bf4a758dd1576df26227f60c30c3bd6eb9 100644 (file)
@@ -366,7 +366,7 @@ vrtc_mrst_do_probe(struct device *dev, struct resource *iomem, int rtc_irq)
 
        if (rtc_irq) {
                retval = request_irq(rtc_irq, mrst_rtc_irq,
-                               IRQF_DISABLED, dev_name(&mrst_rtc.rtc->dev),
+                               0, dev_name(&mrst_rtc.rtc->dev),
                                mrst_rtc.rtc);
                if (retval < 0) {
                        dev_dbg(dev, "IRQ %d is already in use, err %d\n",
index 768e2edb96780d2c232c3308cc015e57c16d0d8e..1300962486d11b8cf3596de0b84600f366140c30 100644 (file)
@@ -273,7 +273,7 @@ static int __devinit mv_rtc_probe(struct platform_device *pdev)
        if (pdata->irq >= 0) {
                writel(0, pdata->ioaddr + RTC_ALARM_INTERRUPT_MASK_REG_OFFS);
                if (devm_request_irq(&pdev->dev, pdata->irq, mv_rtc_interrupt,
-                                    IRQF_DISABLED | IRQF_SHARED,
+                                    IRQF_SHARED,
                                     pdev->name, pdata) < 0) {
                        dev_warn(&pdev->dev, "interrupt not available.\n");
                        pdata->irq = -1;
index 781068d62f23256b9429899661dc023bb68e555c..b79010987d1e6383d52b6cbd2792deadcda9c555 100644 (file)
@@ -269,7 +269,7 @@ static int __devinit nuc900_rtc_probe(struct platform_device *pdev)
 
        nuc900_rtc->irq_num = platform_get_irq(pdev, 0);
        if (request_irq(nuc900_rtc->irq_num, nuc900_rtc_interrupt,
-                               IRQF_DISABLED, "nuc900rtc", nuc900_rtc)) {
+                               0, "nuc900rtc", nuc900_rtc)) {
                dev_err(&pdev->dev, "NUC900 RTC request irq failed\n");
                err = -EBUSY;
                goto fail4;
index 7789002bdd5c1af65f7c6bff95649e9e72d89db1..0b614e32653d81a0f397ca1dfe9a7f1f370add69 100644 (file)
@@ -348,14 +348,14 @@ static int __init omap_rtc_probe(struct platform_device *pdev)
                rtc_write(OMAP_RTC_STATUS_ALARM, OMAP_RTC_STATUS_REG);
 
        /* handle periodic and alarm irqs */
-       if (request_irq(omap_rtc_timer, rtc_irq, IRQF_DISABLED,
+       if (request_irq(omap_rtc_timer, rtc_irq, 0,
                        dev_name(&rtc->dev), rtc)) {
                pr_debug("%s: RTC timer interrupt IRQ%d already claimed\n",
                        pdev->name, omap_rtc_timer);
                goto fail1;
        }
        if ((omap_rtc_timer != omap_rtc_alarm) &&
-               (request_irq(omap_rtc_alarm, rtc_irq, IRQF_DISABLED,
+               (request_irq(omap_rtc_alarm, rtc_irq, 0,
                        dev_name(&rtc->dev), rtc))) {
                pr_debug("%s: RTC alarm interrupt IRQ%d already claimed\n",
                        pdev->name, omap_rtc_alarm);
index b46c4004d8fe4e5728221857806c7878d14ba63c..836118795c0bdb4f0ad5874a3b3dc50dee5ffd69 100644 (file)
@@ -346,20 +346,9 @@ static struct spi_driver pcf2123_driver = {
        .remove = __devexit_p(pcf2123_remove),
 };
 
-static int __init pcf2123_init(void)
-{
-       return spi_register_driver(&pcf2123_driver);
-}
-
-static void __exit pcf2123_exit(void)
-{
-       spi_unregister_driver(&pcf2123_driver);
-}
+module_spi_driver(pcf2123_driver);
 
 MODULE_AUTHOR("Chris Verges <chrisv@cyberswitching.com>");
 MODULE_DESCRIPTION("NXP PCF2123 RTC driver");
 MODULE_LICENSE("GPL");
 MODULE_VERSION(DRV_VERSION);
-
-module_init(pcf2123_init);
-module_exit(pcf2123_exit);
index 606fdfab34e2735f148910fd6578b47d896959a4..bc0677de1996d93a13e0bf37c080bbd30a49e403 100644 (file)
@@ -252,20 +252,9 @@ static struct i2c_driver pcf8563_driver = {
        .id_table       = pcf8563_id,
 };
 
-static int __init pcf8563_init(void)
-{
-       return i2c_add_driver(&pcf8563_driver);
-}
-
-static void __exit pcf8563_exit(void)
-{
-       i2c_del_driver(&pcf8563_driver);
-}
+module_i2c_driver(pcf8563_driver);
 
 MODULE_AUTHOR("Alessandro Zummo <a.zummo@towertech.it>");
 MODULE_DESCRIPTION("Philips PCF8563/Epson RTC8564 RTC driver");
 MODULE_LICENSE("GPL");
 MODULE_VERSION(DRV_VERSION);
-
-module_init(pcf8563_init);
-module_exit(pcf8563_exit);
index 2d201afead3bce2f9230ec3d629a0bb77245ccf8..019ff357116856ecf14ebbdbfb8af4834b7a5d0c 100644 (file)
@@ -320,18 +320,7 @@ static struct i2c_driver pcf8583_driver = {
        .id_table       = pcf8583_id,
 };
 
-static __init int pcf8583_init(void)
-{
-       return i2c_add_driver(&pcf8583_driver);
-}
-
-static __exit void pcf8583_exit(void)
-{
-       i2c_del_driver(&pcf8583_driver);
-}
-
-module_init(pcf8583_init);
-module_exit(pcf8583_exit);
+module_i2c_driver(pcf8583_driver);
 
 MODULE_AUTHOR("Russell King");
 MODULE_DESCRIPTION("PCF8583 I2C RTC driver");
index 02111fee077e423140966159787ee8cef7660706..a4a1e534ed42e2197be6e2b9ee2482be6c849445 100644 (file)
@@ -123,7 +123,7 @@ static int pl030_probe(struct amba_device *dev, const struct amba_id *id)
 
        amba_set_drvdata(dev, rtc);
 
-       ret = request_irq(dev->irq[0], pl030_interrupt, IRQF_DISABLED,
+       ret = request_irq(dev->irq[0], pl030_interrupt, 0,
                          "rtc-pl030", rtc);
        if (ret)
                goto err_irq;
index a952c8de1dd73776b979784752f8587a6d2b4744..3a470e291282862f5273d8e9eb23d6104eed7a4b 100644 (file)
@@ -352,7 +352,7 @@ static int pl031_probe(struct amba_device *adev, const struct amba_id *id)
        }
 
        if (request_irq(adev->irq[0], pl031_interrupt,
-                       IRQF_DISABLED, "rtc-pl031", ldata)) {
+                       0, "rtc-pl031", ldata)) {
                ret = -EIO;
                goto out_no_irq;
        }
index 9f1d6bcbdf6cf0ffc9403be3ea380e9f58d14774..d00bd24342a311555cb35f444296cddfb27bf408 100644 (file)
@@ -520,7 +520,7 @@ static int pm8xxx_rtc_suspend(struct device *dev)
 }
 #endif
 
-SIMPLE_DEV_PM_OPS(pm8xxx_rtc_pm_ops, pm8xxx_rtc_suspend, pm8xxx_rtc_resume);
+static SIMPLE_DEV_PM_OPS(pm8xxx_rtc_pm_ops, pm8xxx_rtc_suspend, pm8xxx_rtc_resume);
 
 static struct platform_driver pm8xxx_rtc_driver = {
        .probe          = pm8xxx_rtc_probe,
index fc9f4991574be31d2f1f576416889336acc03e0e..0075c8fd93d81399f2ad59ab6cd86e0560c228a8 100644 (file)
@@ -174,14 +174,14 @@ static int pxa_rtc_open(struct device *dev)
        struct pxa_rtc *pxa_rtc = dev_get_drvdata(dev);
        int ret;
 
-       ret = request_irq(pxa_rtc->irq_1Hz, pxa_rtc_irq, IRQF_DISABLED,
+       ret = request_irq(pxa_rtc->irq_1Hz, pxa_rtc_irq, 0,
                          "rtc 1Hz", dev);
        if (ret < 0) {
                dev_err(dev, "can't get irq %i, err %d\n", pxa_rtc->irq_1Hz,
                        ret);
                goto err_irq_1Hz;
        }
-       ret = request_irq(pxa_rtc->irq_Alrm, pxa_rtc_irq, IRQF_DISABLED,
+       ret = request_irq(pxa_rtc->irq_Alrm, pxa_rtc_irq, 0,
                          "rtc Alrm", dev);
        if (ret < 0) {
                dev_err(dev, "can't get irq %i, err %d\n", pxa_rtc->irq_Alrm,
index 2853c2a6f10f4a055d2aadb8d3fac0380bff7f97..7f8e6c247935d36ba3b79ffcc835374cadbaa60d 100644 (file)
@@ -159,17 +159,7 @@ static struct spi_driver r9701_driver = {
        .remove = __devexit_p(r9701_remove),
 };
 
-static __init int r9701_init(void)
-{
-       return spi_register_driver(&r9701_driver);
-}
-module_init(r9701_init);
-
-static __exit void r9701_exit(void)
-{
-       spi_unregister_driver(&r9701_driver);
-}
-module_exit(r9701_exit);
+module_spi_driver(r9701_driver);
 
 MODULE_DESCRIPTION("r9701 spi RTC driver");
 MODULE_AUTHOR("Magnus Damm <damm@opensource.se>");
index ce2ca8523ddd5d01146c1b17c64069e76dbc0229..77074ccd285071f345118079a4f7c3120e6b86a3 100644 (file)
@@ -235,18 +235,7 @@ static struct spi_driver rs5c348_driver = {
        .remove = __devexit_p(rs5c348_remove),
 };
 
-static __init int rs5c348_init(void)
-{
-       return spi_register_driver(&rs5c348_driver);
-}
-
-static __exit void rs5c348_exit(void)
-{
-       spi_unregister_driver(&rs5c348_driver);
-}
-
-module_init(rs5c348_init);
-module_exit(rs5c348_exit);
+module_spi_driver(rs5c348_driver);
 
 MODULE_AUTHOR("Atsushi Nemoto <anemo@mba.ocn.ne.jp>");
 MODULE_DESCRIPTION("Ricoh RS5C348 RTC driver");
index d29f5432c6e87d017411e50b3c1c2219cf9e1f08..fb4842c3544e40f9acedc852b58a912b02d8888f 100644 (file)
@@ -689,18 +689,7 @@ static struct i2c_driver rs5c372_driver = {
        .id_table       = rs5c372_id,
 };
 
-static __init int rs5c372_init(void)
-{
-       return i2c_add_driver(&rs5c372_driver);
-}
-
-static __exit void rs5c372_exit(void)
-{
-       i2c_del_driver(&rs5c372_driver);
-}
-
-module_init(rs5c372_init);
-module_exit(rs5c372_exit);
+module_i2c_driver(rs5c372_driver);
 
 MODULE_AUTHOR(
                "Pavel Mironchik <pmironchik@optifacio.net>, "
index ea09ff211dc6bd30a8502cdb89372ed974bc7f01..0fbe57b2f6d21313b162c5c13f3aadfe1c6a8068 100644 (file)
@@ -436,18 +436,7 @@ static struct i2c_driver rv3029c2_driver = {
        .id_table = rv3029c2_id,
 };
 
-static int __init rv3029c2_init(void)
-{
-       return i2c_add_driver(&rv3029c2_driver);
-}
-
-static void __exit rv3029c2_exit(void)
-{
-       i2c_del_driver(&rv3029c2_driver);
-}
-
-module_init(rv3029c2_init);
-module_exit(rv3029c2_exit);
+module_i2c_driver(rv3029c2_driver);
 
 MODULE_AUTHOR("Gregory Hermant <gregory.hermant@calao-systems.com>");
 MODULE_DESCRIPTION("Micro Crystal RV3029C2 RTC driver");
index fde172fb2abe68565b3a5ed4c326ad91381a59ce..0de902dc1cd5c9cdd5bc40b4f0cb09e8ada1ff14 100644 (file)
@@ -644,19 +644,8 @@ static struct i2c_driver rx8025_driver = {
        .id_table       = rx8025_id,
 };
 
-static int __init rx8025_init(void)
-{
-       return i2c_add_driver(&rx8025_driver);
-}
-
-static void __exit rx8025_exit(void)
-{
-       i2c_del_driver(&rx8025_driver);
-}
+module_i2c_driver(rx8025_driver);
 
 MODULE_AUTHOR("Wolfgang Grandegger <wg@grandegger.com>");
 MODULE_DESCRIPTION("RX-8025 SA/NB RTC driver");
 MODULE_LICENSE("GPL");
-
-module_init(rx8025_init);
-module_exit(rx8025_exit);
index 600b890a3c150f926be508633c49436cfae1b113..d84825124a7ae19428233b8871827c5d2f3052db 100644 (file)
@@ -276,20 +276,9 @@ static struct i2c_driver rx8581_driver = {
        .id_table       = rx8581_id,
 };
 
-static int __init rx8581_init(void)
-{
-       return i2c_add_driver(&rx8581_driver);
-}
-
-static void __exit rx8581_exit(void)
-{
-       i2c_del_driver(&rx8581_driver);
-}
+module_i2c_driver(rx8581_driver);
 
 MODULE_AUTHOR("Martyn Welch <martyn.welch@ge.com>");
 MODULE_DESCRIPTION("Epson RX-8581 RTC driver");
 MODULE_LICENSE("GPL");
 MODULE_VERSION(DRV_VERSION);
-
-module_init(rx8581_init);
-module_exit(rx8581_exit);
index f789e002c9b013664a2588ea342b25a52acf8a1c..c9562ceedef39a68d0991fca892a4e337596bcda 100644 (file)
@@ -304,19 +304,8 @@ static struct i2c_driver s35390a_driver = {
        .id_table       = s35390a_id,
 };
 
-static int __init s35390a_rtc_init(void)
-{
-       return i2c_add_driver(&s35390a_driver);
-}
-
-static void __exit s35390a_rtc_exit(void)
-{
-       i2c_del_driver(&s35390a_driver);
-}
+module_i2c_driver(s35390a_driver);
 
 MODULE_AUTHOR("Byron Bradley <byron.bbradley@gmail.com>");
 MODULE_DESCRIPTION("S35390A RTC driver");
 MODULE_LICENSE("GPL");
-
-module_init(s35390a_rtc_init);
-module_exit(s35390a_rtc_exit);
index aef40bd2957be7ccb2fd5adfebb6c6e13c3b6683..c543f6f1eec2f8d75500d8c77317ed2fcd3136f7 100644 (file)
@@ -543,14 +543,14 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev)
        s3c_rtc_setfreq(&pdev->dev, 1);
 
        ret = request_irq(s3c_rtc_alarmno, s3c_rtc_alarmirq,
-                         IRQF_DISABLED,  "s3c2410-rtc alarm", rtc);
+                         0,  "s3c2410-rtc alarm", rtc);
        if (ret) {
                dev_err(&pdev->dev, "IRQ%d error %d\n", s3c_rtc_alarmno, ret);
                goto err_alarm_irq;
        }
 
        ret = request_irq(s3c_rtc_tickno, s3c_rtc_tickirq,
-                         IRQF_DISABLED,  "s3c2410-rtc tick", rtc);
+                         0,  "s3c2410-rtc tick", rtc);
        if (ret) {
                dev_err(&pdev->dev, "IRQ%d error %d\n", s3c_rtc_tickno, ret);
                free_irq(s3c_rtc_alarmno, rtc);
index cb9a585312cc765c3e08a6d60720c3f669c8ba7b..fb758db9d0f475f75e68fa191b6c1682bb0e00ee 100644 (file)
@@ -160,14 +160,13 @@ static int sa1100_rtc_open(struct device *dev)
        struct platform_device *plat_dev = to_platform_device(dev);
        struct rtc_device *rtc = platform_get_drvdata(plat_dev);
 
-       ret = request_irq(IRQ_RTC1Hz, sa1100_rtc_interrupt, IRQF_DISABLED,
-               "rtc 1Hz", dev);
+       ret = request_irq(IRQ_RTC1Hz, sa1100_rtc_interrupt, 0, "rtc 1Hz", dev);
        if (ret) {
                dev_err(dev, "IRQ %d already in use.\n", IRQ_RTC1Hz);
                goto fail_ui;
        }
-       ret = request_irq(IRQ_RTCAlrm, sa1100_rtc_interrupt, IRQF_DISABLED,
-               "rtc Alrm", dev);
+       ret = request_irq(IRQ_RTCAlrm, sa1100_rtc_interrupt, 0,
+                         "rtc Alrm", dev);
        if (ret) {
                dev_err(dev, "IRQ %d already in use.\n", IRQ_RTCAlrm);
                goto fail_ai;
index 6ac55fd48413f8c91ec20653738f5b454cf38281..e55a7635ae5f6d651f5b272d25b4619e66060c88 100644 (file)
@@ -666,7 +666,7 @@ static int __init sh_rtc_probe(struct platform_device *pdev)
        if (rtc->carry_irq <= 0) {
                /* register shared periodic/carry/alarm irq */
                ret = request_irq(rtc->periodic_irq, sh_rtc_shared,
-                                 IRQF_DISABLED, "sh-rtc", rtc);
+                                 0, "sh-rtc", rtc);
                if (unlikely(ret)) {
                        dev_err(&pdev->dev,
                                "request IRQ failed with %d, IRQ %d\n", ret,
@@ -676,7 +676,7 @@ static int __init sh_rtc_probe(struct platform_device *pdev)
        } else {
                /* register periodic/carry/alarm irqs */
                ret = request_irq(rtc->periodic_irq, sh_rtc_periodic,
-                                 IRQF_DISABLED, "sh-rtc period", rtc);
+                                 0, "sh-rtc period", rtc);
                if (unlikely(ret)) {
                        dev_err(&pdev->dev,
                                "request period IRQ failed with %d, IRQ %d\n",
@@ -685,7 +685,7 @@ static int __init sh_rtc_probe(struct platform_device *pdev)
                }
 
                ret = request_irq(rtc->carry_irq, sh_rtc_interrupt,
-                                 IRQF_DISABLED, "sh-rtc carry", rtc);
+                                 0, "sh-rtc carry", rtc);
                if (unlikely(ret)) {
                        dev_err(&pdev->dev,
                                "request carry IRQ failed with %d, IRQ %d\n",
@@ -695,7 +695,7 @@ static int __init sh_rtc_probe(struct platform_device *pdev)
                }
 
                ret = request_irq(rtc->alarm_irq, sh_rtc_alarm,
-                                 IRQF_DISABLED, "sh-rtc alarm", rtc);
+                                 0, "sh-rtc alarm", rtc);
                if (unlikely(ret)) {
                        dev_err(&pdev->dev,
                                "request alarm IRQ failed with %d, IRQ %d\n",
index 19a28a671a8e74f8abbd5ed149f4aebc4769b75d..e38da0dc41872070e4d0abe40da9280b6ddf747a 100644 (file)
 #define STATUS_FAIL            (LOST_WR_TIME | LOST_WR_DATE)
 
 struct spear_rtc_config {
+       struct rtc_device *rtc;
        struct clk *clk;
        spinlock_t lock;
        void __iomem *ioaddr;
+       unsigned int irq_wake;
 };
 
 static inline void spear_rtc_clear_interrupt(struct spear_rtc_config *config)
@@ -149,8 +151,7 @@ static void rtc_wait_not_busy(struct spear_rtc_config *config)
 
 static irqreturn_t spear_rtc_irq(int irq, void *dev_id)
 {
-       struct rtc_device *rtc = (struct rtc_device *)dev_id;
-       struct spear_rtc_config *config = dev_get_drvdata(&rtc->dev);
+       struct spear_rtc_config *config = dev_id;
        unsigned long flags, events = 0;
        unsigned int irq_data;
 
@@ -161,7 +162,7 @@ static irqreturn_t spear_rtc_irq(int irq, void *dev_id)
        if ((irq_data & RTC_INT_MASK)) {
                spear_rtc_clear_interrupt(config);
                events = RTC_IRQF | RTC_AF;
-               rtc_update_irq(rtc, 1, events);
+               rtc_update_irq(config->rtc, 1, events);
                return IRQ_HANDLED;
        } else
                return IRQ_NONE;
@@ -203,9 +204,7 @@ static void bcd2tm(struct rtc_time *tm)
  */
 static int spear_rtc_read_time(struct device *dev, struct rtc_time *tm)
 {
-       struct platform_device *pdev = to_platform_device(dev);
-       struct rtc_device *rtc = platform_get_drvdata(pdev);
-       struct spear_rtc_config *config = dev_get_drvdata(&rtc->dev);
+       struct spear_rtc_config *config = dev_get_drvdata(dev);
        unsigned int time, date;
 
        /* we don't report wday/yday/isdst ... */
@@ -234,9 +233,7 @@ static int spear_rtc_read_time(struct device *dev, struct rtc_time *tm)
  */
 static int spear_rtc_set_time(struct device *dev, struct rtc_time *tm)
 {
-       struct platform_device *pdev = to_platform_device(dev);
-       struct rtc_device *rtc = platform_get_drvdata(pdev);
-       struct spear_rtc_config *config = dev_get_drvdata(&rtc->dev);
+       struct spear_rtc_config *config = dev_get_drvdata(dev);
        unsigned int time, date, err = 0;
 
        if (tm2bcd(tm) < 0)
@@ -266,9 +263,7 @@ static int spear_rtc_set_time(struct device *dev, struct rtc_time *tm)
  */
 static int spear_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm)
 {
-       struct platform_device *pdev = to_platform_device(dev);
-       struct rtc_device *rtc = platform_get_drvdata(pdev);
-       struct spear_rtc_config *config = dev_get_drvdata(&rtc->dev);
+       struct spear_rtc_config *config = dev_get_drvdata(dev);
        unsigned int time, date;
 
        rtc_wait_not_busy(config);
@@ -298,9 +293,7 @@ static int spear_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alm)
  */
 static int spear_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
 {
-       struct platform_device *pdev = to_platform_device(dev);
-       struct rtc_device *rtc = platform_get_drvdata(pdev);
-       struct spear_rtc_config *config = dev_get_drvdata(&rtc->dev);
+       struct spear_rtc_config *config = dev_get_drvdata(dev);
        unsigned int time, date, err = 0;
 
        if (tm2bcd(&alm->time) < 0)
@@ -326,17 +319,42 @@ static int spear_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alm)
 
        return 0;
 }
+
+static int spear_alarm_irq_enable(struct device *dev, unsigned int enabled)
+{
+       struct spear_rtc_config *config = dev_get_drvdata(dev);
+       int ret = 0;
+
+       spear_rtc_clear_interrupt(config);
+
+       switch (enabled) {
+       case 0:
+               /* alarm off */
+               spear_rtc_disable_interrupt(config);
+               break;
+       case 1:
+               /* alarm on */
+               spear_rtc_enable_interrupt(config);
+               break;
+       default:
+               ret = -EINVAL;
+               break;
+       }
+
+       return ret;
+}
+
 static struct rtc_class_ops spear_rtc_ops = {
        .read_time = spear_rtc_read_time,
        .set_time = spear_rtc_set_time,
        .read_alarm = spear_rtc_read_alarm,
        .set_alarm = spear_rtc_set_alarm,
+       .alarm_irq_enable = spear_alarm_irq_enable,
 };
 
 static int __devinit spear_rtc_probe(struct platform_device *pdev)
 {
        struct resource *res;
-       struct rtc_device *rtc;
        struct spear_rtc_config *config;
        unsigned int status = 0;
        int irq;
@@ -376,19 +394,17 @@ static int __devinit spear_rtc_probe(struct platform_device *pdev)
        }
 
        spin_lock_init(&config->lock);
+       platform_set_drvdata(pdev, config);
 
-       rtc = rtc_device_register(pdev->name, &pdev->dev, &spear_rtc_ops,
-                       THIS_MODULE);
-       if (IS_ERR(rtc)) {
+       config->rtc = rtc_device_register(pdev->name, &pdev->dev,
+                       &spear_rtc_ops, THIS_MODULE);
+       if (IS_ERR(config->rtc)) {
                dev_err(&pdev->dev, "can't register RTC device, err %ld\n",
-                               PTR_ERR(rtc));
-               status = PTR_ERR(rtc);
+                               PTR_ERR(config->rtc));
+               status = PTR_ERR(config->rtc);
                goto err_iounmap;
        }
 
-       platform_set_drvdata(pdev, rtc);
-       dev_set_drvdata(&rtc->dev, config);
-
        /* alarm irqs */
        irq = platform_get_irq(pdev, 0);
        if (irq < 0) {
@@ -397,7 +413,7 @@ static int __devinit spear_rtc_probe(struct platform_device *pdev)
                goto err_clear_platdata;
        }
 
-       status = request_irq(irq, spear_rtc_irq, 0, pdev->name, rtc);
+       status = request_irq(irq, spear_rtc_irq, 0, pdev->name, config);
        if (status) {
                dev_err(&pdev->dev, "Alarm interrupt IRQ%d already \
                                claimed\n", irq);
@@ -411,8 +427,7 @@ static int __devinit spear_rtc_probe(struct platform_device *pdev)
 
 err_clear_platdata:
        platform_set_drvdata(pdev, NULL);
-       dev_set_drvdata(&rtc->dev, NULL);
-       rtc_device_unregister(rtc);
+       rtc_device_unregister(config->rtc);
 err_iounmap:
        iounmap(config->ioaddr);
 err_disable_clock:
@@ -429,8 +444,7 @@ err_release_region:
 
 static int __devexit spear_rtc_remove(struct platform_device *pdev)
 {
-       struct rtc_device *rtc = platform_get_drvdata(pdev);
-       struct spear_rtc_config *config = dev_get_drvdata(&rtc->dev);
+       struct spear_rtc_config *config = platform_get_drvdata(pdev);
        int irq;
        struct resource *res;
 
@@ -448,8 +462,7 @@ static int __devexit spear_rtc_remove(struct platform_device *pdev)
        if (res)
                release_mem_region(res->start, resource_size(res));
        platform_set_drvdata(pdev, NULL);
-       dev_set_drvdata(&rtc->dev, NULL);
-       rtc_device_unregister(rtc);
+       rtc_device_unregister(config->rtc);
 
        return 0;
 }
@@ -458,14 +471,14 @@ static int __devexit spear_rtc_remove(struct platform_device *pdev)
 
 static int spear_rtc_suspend(struct platform_device *pdev, pm_message_t state)
 {
-       struct rtc_device *rtc = platform_get_drvdata(pdev);
-       struct spear_rtc_config *config = dev_get_drvdata(&rtc->dev);
+       struct spear_rtc_config *config = platform_get_drvdata(pdev);
        int irq;
 
        irq = platform_get_irq(pdev, 0);
-       if (device_may_wakeup(&pdev->dev))
-               enable_irq_wake(irq);
-       else {
+       if (device_may_wakeup(&pdev->dev)) {
+               if (!enable_irq_wake(irq))
+                       config->irq_wake = 1;
+       } else {
                spear_rtc_disable_interrupt(config);
                clk_disable(config->clk);
        }
@@ -475,15 +488,17 @@ static int spear_rtc_suspend(struct platform_device *pdev, pm_message_t state)
 
 static int spear_rtc_resume(struct platform_device *pdev)
 {
-       struct rtc_device *rtc = platform_get_drvdata(pdev);
-       struct spear_rtc_config *config = dev_get_drvdata(&rtc->dev);
+       struct spear_rtc_config *config = platform_get_drvdata(pdev);
        int irq;
 
        irq = platform_get_irq(pdev, 0);
 
-       if (device_may_wakeup(&pdev->dev))
-               disable_irq_wake(irq);
-       else {
+       if (device_may_wakeup(&pdev->dev)) {
+               if (config->irq_wake) {
+                       disable_irq_wake(irq);
+                       config->irq_wake = 0;
+               }
+       } else {
                clk_enable(config->clk);
                spear_rtc_enable_interrupt(config);
        }
@@ -498,8 +513,7 @@ static int spear_rtc_resume(struct platform_device *pdev)
 
 static void spear_rtc_shutdown(struct platform_device *pdev)
 {
-       struct rtc_device *rtc = platform_get_drvdata(pdev);
-       struct spear_rtc_config *config = dev_get_drvdata(&rtc->dev);
+       struct spear_rtc_config *config = platform_get_drvdata(pdev);
 
        spear_rtc_disable_interrupt(config);
        clk_disable(config->clk);
index 7621116bd20d25680a266914c66ab7527bb27da1..279f5cfa691a7ff30ec4642c8599ffdbb063d684 100644 (file)
@@ -329,7 +329,7 @@ static int __devinit stk17ta8_rtc_probe(struct platform_device *pdev)
                writeb(0, ioaddr + RTC_INTERRUPTS);
                if (devm_request_irq(&pdev->dev, pdata->irq,
                                stk17ta8_rtc_interrupt,
-                               IRQF_DISABLED | IRQF_SHARED,
+                               IRQF_SHARED,
                                pdev->name, pdev) < 0) {
                        dev_warn(&pdev->dev, "interrupt not available.\n");
                        pdata->irq = 0;
index d43b4f6eb4e420c79327566e3444351cf86c8185..4c2c6df2a9efc38efe61ab559df44d17898ab2ec 100644 (file)
@@ -176,6 +176,10 @@ static int set_rtc_irq_bit(unsigned char bit)
        unsigned char val;
        int ret;
 
+       /* if the bit is set, return from here */
+       if (rtc_irq_bits & bit)
+               return 0;
+
        val = rtc_irq_bits | bit;
        val &= ~BIT_RTC_INTERRUPTS_REG_EVERY_M;
        ret = twl_rtc_write_u8(val, REG_RTC_INTERRUPTS_REG);
@@ -193,6 +197,10 @@ static int mask_rtc_irq_bit(unsigned char bit)
        unsigned char val;
        int ret;
 
+       /* if the bit is clear, return from here */
+       if (!(rtc_irq_bits & bit))
+               return 0;
+
        val = rtc_irq_bits & ~bit;
        ret = twl_rtc_write_u8(val, REG_RTC_INTERRUPTS_REG);
        if (ret == 0)
@@ -357,7 +365,7 @@ out:
 
 static irqreturn_t twl_rtc_interrupt(int irq, void *rtc)
 {
-       unsigned long events = 0;
+       unsigned long events;
        int ret = IRQ_NONE;
        int res;
        u8 rd_reg;
@@ -372,11 +380,11 @@ static irqreturn_t twl_rtc_interrupt(int irq, void *rtc)
         * by reading RTS_INTERRUPTS_REGISTER[IT_TIMER,IT_ALARM]
         */
        if (rd_reg & BIT_RTC_STATUS_REG_ALARM_M)
-               events |= RTC_IRQF | RTC_AF;
+               events = RTC_IRQF | RTC_AF;
        else
-               events |= RTC_IRQF | RTC_UF;
+               events = RTC_IRQF | RTC_PF;
 
-       res = twl_rtc_write_u8(rd_reg | BIT_RTC_STATUS_REG_ALARM_M,
+       res = twl_rtc_write_u8(BIT_RTC_STATUS_REG_ALARM_M,
                                   REG_RTC_STATUS_REG);
        if (res)
                goto out;
@@ -449,19 +457,11 @@ static int __devinit twl_rtc_probe(struct platform_device *pdev)
                        REG_INT_MSK_STS_A);
        }
 
-       /* Check RTC module status, Enable if it is off */
-       ret = twl_rtc_read_u8(&rd_reg, REG_RTC_CTRL_REG);
+       dev_info(&pdev->dev, "Enabling TWL-RTC\n");
+       ret = twl_rtc_write_u8(BIT_RTC_CTRL_REG_STOP_RTC_M, REG_RTC_CTRL_REG);
        if (ret < 0)
                goto out1;
 
-       if (!(rd_reg & BIT_RTC_CTRL_REG_STOP_RTC_M)) {
-               dev_info(&pdev->dev, "Enabling TWL-RTC.\n");
-               rd_reg = BIT_RTC_CTRL_REG_STOP_RTC_M;
-               ret = twl_rtc_write_u8(rd_reg, REG_RTC_CTRL_REG);
-               if (ret < 0)
-                       goto out1;
-       }
-
        /* init cached IRQ enable bits */
        ret = twl_rtc_read_u8(&rtc_irq_bits, REG_RTC_INTERRUPTS_REG);
        if (ret < 0)
index aac0ffed4345d5cabb1f26d2e7e3bd4927aecc4e..a12bfac49d36a84188d79754fc9e0523cea0692f 100644 (file)
@@ -266,7 +266,7 @@ static int __init tx4939_rtc_probe(struct platform_device *pdev)
        spin_lock_init(&pdata->lock);
        tx4939_rtc_cmd(pdata->rtcreg, TX4939_RTCCTL_COMMAND_NOP);
        if (devm_request_irq(&pdev->dev, irq, tx4939_rtc_interrupt,
-                            IRQF_DISABLED, pdev->name, &pdev->dev) < 0)
+                            0, pdev->name, &pdev->dev) < 0)
                return -EBUSY;
        rtc = rtc_device_register(pdev->name, &pdev->dev,
                                  &tx4939_rtc_ops, THIS_MODULE);
index fcbfdda2993bea5e8dd2f2ca4a1dd74e3e5ff121..5f60a7c6a15575d832b66c03a8c3ee72297514e1 100644 (file)
@@ -333,7 +333,7 @@ static int __devinit rtc_probe(struct platform_device *pdev)
                goto err_device_unregister;
        }
 
-       retval = request_irq(aie_irq, elapsedtime_interrupt, IRQF_DISABLED,
+       retval = request_irq(aie_irq, elapsedtime_interrupt, 0,
                             "elapsed_time", pdev);
        if (retval < 0)
                goto err_device_unregister;
@@ -342,7 +342,7 @@ static int __devinit rtc_probe(struct platform_device *pdev)
        if (pie_irq <= 0)
                goto err_free_irq;
 
-       retval = request_irq(pie_irq, rtclong1_interrupt, IRQF_DISABLED,
+       retval = request_irq(pie_irq, rtclong1_interrupt, 0,
                             "rtclong1", pdev);
        if (retval < 0)
                goto err_free_irq;
index 8c051d3179db01c4e6a03ec6e80cb6f5107b1fe5..403b3d41d101cc97e4cad649f8b4f44955122c92 100644 (file)
@@ -623,15 +623,7 @@ static struct i2c_driver x1205_driver = {
        .id_table       = x1205_id,
 };
 
-static int __init x1205_init(void)
-{
-       return i2c_add_driver(&x1205_driver);
-}
-
-static void __exit x1205_exit(void)
-{
-       i2c_del_driver(&x1205_driver);
-}
+module_i2c_driver(x1205_driver);
 
 MODULE_AUTHOR(
        "Karen Spearel <kas111 at gmail dot com>, "
@@ -639,6 +631,3 @@ MODULE_AUTHOR(
 MODULE_DESCRIPTION("Xicor/Intersil X1205 RTC driver");
 MODULE_LICENSE("GPL");
 MODULE_VERSION(DRV_VERSION);
-
-module_init(x1205_init);
-module_exit(x1205_exit);
index 0b54a91f8dcd2aa23d23634910fb92a683cea949..168525a9c2928b4c6a591ea9b89dc2fbaac978ac 100644 (file)
@@ -441,9 +441,8 @@ static int sclp_mem_notifier(struct notifier_block *nb,
        start = arg->start_pfn << PAGE_SHIFT;
        size = arg->nr_pages << PAGE_SHIFT;
        mutex_lock(&sclp_mem_mutex);
-       for (id = 0; id <= sclp_max_storage_id; id++)
-               if (!test_bit(id, sclp_storage_ids))
-                       sclp_attach_storage(id);
+       for_each_clear_bit(id, sclp_storage_ids, sclp_max_storage_id + 1)
+               sclp_attach_storage(id);
        switch (action) {
        case MEM_ONLINE:
        case MEM_GOING_OFFLINE:
index e4ade550cfe5f850fa088687bdf61ce8c7935f54..4fe52f6b0034b67bdcac812b0a42f3f2b5a8fde1 100644 (file)
@@ -4159,7 +4159,7 @@ void GPIOChangeRFWorkItemCallBack(struct work_struct *work)
                argv[0] = RadioPowerPath;
                argv[2] = NULL;
 
-               call_usermodehelper(RadioPowerPath, argv, envp, 1);
+               call_usermodehelper(RadioPowerPath, argv, envp, UMH_WAIT_PROC);
        }
 }
 
index a7fa9aad6f2d0a4bfd790187bec6e445482d29eb..f026b7171f62558a4f1e413dce540e52e463c2b6 100644 (file)
@@ -208,7 +208,7 @@ static void dm_check_ac_dc_power(struct net_device *dev)
 
        if (priv->rtllib->state != RTLLIB_LINKED)
                return;
-       call_usermodehelper(ac_dc_check_script_path, argv, envp, 1);
+       call_usermodehelper(ac_dc_check_script_path, argv, envp, UMH_WAIT_PROC);
 
        return;
 };
@@ -2296,7 +2296,7 @@ void dm_CheckRfCtrlGPIO(void *data)
 
                argv[0] = RadioPowerPath;
                argv[2] = NULL;
-               call_usermodehelper(RadioPowerPath, argv, envp, 1);
+               call_usermodehelper(RadioPowerPath, argv, envp, UMH_WAIT_PROC);
        }
 }
 
index d5f923bcdffeb907191297082b61cd5551226c39..f96027921f60e503310e0878e89670067dac041d 100644 (file)
@@ -5927,7 +5927,8 @@ static void add_caps(IXJ *j)
        j->caplist[j->caps].cap = PHONE_VENDOR_QUICKNET;
        strcpy(j->caplist[j->caps].desc, "Quicknet Technologies, Inc. (www.quicknet.net)");
        j->caplist[j->caps].captype = vendor;
-       j->caplist[j->caps].handle = j->caps++;
+       j->caplist[j->caps].handle = j->caps;
+       j->caps++;
        j->caplist[j->caps].captype = device;
        switch (j->cardtype) {
        case QTI_PHONEJACK:
@@ -5947,11 +5948,13 @@ static void add_caps(IXJ *j)
                break;
        }
        j->caplist[j->caps].cap = j->cardtype;
-       j->caplist[j->caps].handle = j->caps++;
+       j->caplist[j->caps].handle = j->caps;
+       j->caps++;
        strcpy(j->caplist[j->caps].desc, "POTS");
        j->caplist[j->caps].captype = port;
        j->caplist[j->caps].cap = pots;
-       j->caplist[j->caps].handle = j->caps++;
+       j->caplist[j->caps].handle = j->caps;
+       j->caps++;
 
        /* add devices that can do speaker/mic */
        switch (j->cardtype) {
@@ -5962,7 +5965,8 @@ static void add_caps(IXJ *j)
                strcpy(j->caplist[j->caps].desc, "SPEAKER");
                j->caplist[j->caps].captype = port;
                j->caplist[j->caps].cap = speaker;
-               j->caplist[j->caps].handle = j->caps++;
+               j->caplist[j->caps].handle = j->caps;
+               j->caps++;
         default:
                break;
        }
@@ -5973,7 +5977,8 @@ static void add_caps(IXJ *j)
                strcpy(j->caplist[j->caps].desc, "HANDSET");
                j->caplist[j->caps].captype = port;
                j->caplist[j->caps].cap = handset;
-               j->caplist[j->caps].handle = j->caps++;
+               j->caplist[j->caps].handle = j->caps;
+               j->caps++;
                break;
         default:
                break;
@@ -5985,7 +5990,8 @@ static void add_caps(IXJ *j)
                strcpy(j->caplist[j->caps].desc, "PSTN");
                j->caplist[j->caps].captype = port;
                j->caplist[j->caps].cap = pstn;
-               j->caplist[j->caps].handle = j->caps++;
+               j->caplist[j->caps].handle = j->caps;
+               j->caps++;
                break;
         default:
                break;
@@ -5995,50 +6001,59 @@ static void add_caps(IXJ *j)
        strcpy(j->caplist[j->caps].desc, "ULAW");
        j->caplist[j->caps].captype = codec;
        j->caplist[j->caps].cap = ULAW;
-       j->caplist[j->caps].handle = j->caps++;
+       j->caplist[j->caps].handle = j->caps;
+       j->caps++;
 
        strcpy(j->caplist[j->caps].desc, "LINEAR 16 bit");
        j->caplist[j->caps].captype = codec;
        j->caplist[j->caps].cap = LINEAR16;
-       j->caplist[j->caps].handle = j->caps++;
+       j->caplist[j->caps].handle = j->caps;
+       j->caps++;
 
        strcpy(j->caplist[j->caps].desc, "LINEAR 8 bit");
        j->caplist[j->caps].captype = codec;
        j->caplist[j->caps].cap = LINEAR8;
-       j->caplist[j->caps].handle = j->caps++;
+       j->caplist[j->caps].handle = j->caps;
+       j->caps++;
 
        strcpy(j->caplist[j->caps].desc, "Windows Sound System");
        j->caplist[j->caps].captype = codec;
        j->caplist[j->caps].cap = WSS;
-       j->caplist[j->caps].handle = j->caps++;
+       j->caplist[j->caps].handle = j->caps;
+       j->caps++;
 
        /* software ALAW codec, made from ULAW */
        strcpy(j->caplist[j->caps].desc, "ALAW");
        j->caplist[j->caps].captype = codec;
        j->caplist[j->caps].cap = ALAW;
-       j->caplist[j->caps].handle = j->caps++;
+       j->caplist[j->caps].handle = j->caps;
+       j->caps++;
 
        /* version 12 of the 8020 does the following codecs in a broken way */
        if (j->dsp.low != 0x20 || j->ver.low != 0x12) {
                strcpy(j->caplist[j->caps].desc, "G.723.1 6.3kbps");
                j->caplist[j->caps].captype = codec;
                j->caplist[j->caps].cap = G723_63;
-               j->caplist[j->caps].handle = j->caps++;
+               j->caplist[j->caps].handle = j->caps;
+               j->caps++;
 
                strcpy(j->caplist[j->caps].desc, "G.723.1 5.3kbps");
                j->caplist[j->caps].captype = codec;
                j->caplist[j->caps].cap = G723_53;
-               j->caplist[j->caps].handle = j->caps++;
+               j->caplist[j->caps].handle = j->caps;
+               j->caps++;
 
                strcpy(j->caplist[j->caps].desc, "TrueSpeech 4.8kbps");
                j->caplist[j->caps].captype = codec;
                j->caplist[j->caps].cap = TS48;
-               j->caplist[j->caps].handle = j->caps++;
+               j->caplist[j->caps].handle = j->caps;
+               j->caps++;
 
                strcpy(j->caplist[j->caps].desc, "TrueSpeech 4.1kbps");
                j->caplist[j->caps].captype = codec;
                j->caplist[j->caps].cap = TS41;
-               j->caplist[j->caps].handle = j->caps++;
+               j->caplist[j->caps].handle = j->caps;
+               j->caps++;
        }
 
        /* 8020 chips can do TS8.5 native, and 8021/8022 can load it */
@@ -6046,7 +6061,8 @@ static void add_caps(IXJ *j)
                strcpy(j->caplist[j->caps].desc, "TrueSpeech 8.5kbps");
                j->caplist[j->caps].captype = codec;
                j->caplist[j->caps].cap = TS85;
-               j->caplist[j->caps].handle = j->caps++;
+               j->caplist[j->caps].handle = j->caps;
+               j->caps++;
        }
 
        /* 8021 chips can do G728 */
@@ -6054,7 +6070,8 @@ static void add_caps(IXJ *j)
                strcpy(j->caplist[j->caps].desc, "G.728 16kbps");
                j->caplist[j->caps].captype = codec;
                j->caplist[j->caps].cap = G728;
-               j->caplist[j->caps].handle = j->caps++;
+               j->caplist[j->caps].handle = j->caps;
+               j->caps++;
        }
 
        /* 8021/8022 chips can do G729 if loaded */
@@ -6062,13 +6079,15 @@ static void add_caps(IXJ *j)
                strcpy(j->caplist[j->caps].desc, "G.729A 8kbps");
                j->caplist[j->caps].captype = codec;
                j->caplist[j->caps].cap = G729;
-               j->caplist[j->caps].handle = j->caps++;
+               j->caplist[j->caps].handle = j->caps;
+               j->caps++;
        }
        if (j->dsp.low != 0x20 && j->flags.g729_loaded) {
                strcpy(j->caplist[j->caps].desc, "G.729B 8kbps");
                j->caplist[j->caps].captype = codec;
                j->caplist[j->caps].cap = G729B;
-               j->caplist[j->caps].handle = j->caps++;
+               j->caplist[j->caps].handle = j->caps;
+               j->caps++;
        }
 }
 
index e45e673b8770e78a44b9ba0c0ace5f70122606e8..6e3e713f0ef713133b83ee948cc77e0b2dfcc76b 100644 (file)
@@ -334,10 +334,8 @@ int uwb_rsv_find_best_allocation(struct uwb_rsv *rsv, struct uwb_mas_bm *availab
 
 
        /* fill the not available vector from the available bm */
-       for (bit_index = 0; bit_index < UWB_NUM_MAS; bit_index++) {
-               if (!test_bit(bit_index, available->bm))
-                       ai->bm[bit_index] = UWB_RSV_MAS_NOT_AVAIL;
-       }
+       for_each_clear_bit(bit_index, available->bm, UWB_NUM_MAS)
+               ai->bm[bit_index] = UWB_RSV_MAS_NOT_AVAIL;
 
        if (ai->max_interval == 1) {
                get_row_descriptors(ai);
index a1376dc73d71cd79492c388afc340d7fba229545..915943af3f21eed5f78d5fada3c3d42d20e74b6b 100644 (file)
@@ -187,7 +187,8 @@ static int pm860x_backlight_probe(struct platform_device *pdev)
                return -EINVAL;
        }
 
-       data = kzalloc(sizeof(struct pm860x_backlight_data), GFP_KERNEL);
+       data = devm_kzalloc(&pdev->dev, sizeof(struct pm860x_backlight_data),
+                           GFP_KERNEL);
        if (data == NULL)
                return -ENOMEM;
        strncpy(name, res->name, MFD_NAME_SIZE);
@@ -200,7 +201,6 @@ static int pm860x_backlight_probe(struct platform_device *pdev)
        data->port = pdata->flags;
        if (data->port < 0) {
                dev_err(&pdev->dev, "wrong platform data is assigned");
-               kfree(data);
                return -EINVAL;
        }
 
@@ -211,7 +211,6 @@ static int pm860x_backlight_probe(struct platform_device *pdev)
                                        &pm860x_backlight_ops, &props);
        if (IS_ERR(bl)) {
                dev_err(&pdev->dev, "failed to register backlight\n");
-               kfree(data);
                return PTR_ERR(bl);
        }
        bl->props.brightness = MAX_BRIGHTNESS;
@@ -247,17 +246,14 @@ static int pm860x_backlight_probe(struct platform_device *pdev)
        return 0;
 out:
        backlight_device_unregister(bl);
-       kfree(data);
        return ret;
 }
 
 static int pm860x_backlight_remove(struct platform_device *pdev)
 {
        struct backlight_device *bl = platform_get_drvdata(pdev);
-       struct pm860x_backlight_data *data = bl_get_data(bl);
 
        backlight_device_unregister(bl);
-       kfree(data);
        return 0;
 }
 
index 681b36929fe406642756ca6bcd8614422a16aa0c..7ed9991fa74785cb8d232954c10d0925caed59ab 100644 (file)
@@ -334,6 +334,27 @@ config BACKLIGHT_AAT2870
          If you have a AnalogicTech AAT2870 say Y to enable the
          backlight driver.
 
+config BACKLIGHT_LP855X
+       tristate "Backlight driver for TI LP855X"
+       depends on BACKLIGHT_CLASS_DEVICE && I2C
+       help
+         This supports TI LP8550, LP8551, LP8552, LP8553 and LP8556
+         backlight driver.
+
+config BACKLIGHT_OT200
+       tristate "Backlight driver for ot200 visualisation device"
+       depends on BACKLIGHT_CLASS_DEVICE && CS5535_MFGPT && GPIO_CS5535
+       help
+         To compile this driver as a module, choose M here: the module will be
+         called ot200_bl.
+
+config BACKLIGHT_PANDORA
+       tristate "Backlight driver for Pandora console"
+       depends on TWL4030_CORE
+       help
+         If you have a Pandora console, say Y to enable the
+         backlight driver.
+
 endif # BACKLIGHT_CLASS_DEVICE
 
 endif # BACKLIGHT_LCD_SUPPORT
index af5cf654ec7c5c4dba3a632f0d4fc2867a681112..8071eb656147796dfc410ee92a5bc84f7429aa4a 100644 (file)
@@ -22,7 +22,9 @@ obj-$(CONFIG_BACKLIGHT_GENERIC)       += generic_bl.o
 obj-$(CONFIG_BACKLIGHT_HP700)  += jornada720_bl.o
 obj-$(CONFIG_BACKLIGHT_HP680)  += hp680_bl.o
 obj-$(CONFIG_BACKLIGHT_LOCOMO) += locomolcd.o
+obj-$(CONFIG_BACKLIGHT_LP855X) += lp855x_bl.o
 obj-$(CONFIG_BACKLIGHT_OMAP1)  += omap1_bl.o
+obj-$(CONFIG_BACKLIGHT_PANDORA)        += pandora_bl.o
 obj-$(CONFIG_BACKLIGHT_PROGEAR) += progear_bl.o
 obj-$(CONFIG_BACKLIGHT_CARILLO_RANCH) += cr_bllcd.o
 obj-$(CONFIG_BACKLIGHT_PWM)    += pwm_bl.o
@@ -38,4 +40,4 @@ obj-$(CONFIG_BACKLIGHT_ADP8870)       += adp8870_bl.o
 obj-$(CONFIG_BACKLIGHT_88PM860X) += 88pm860x_bl.o
 obj-$(CONFIG_BACKLIGHT_PCF50633)       += pcf50633-backlight.o
 obj-$(CONFIG_BACKLIGHT_AAT2870) += aat2870_bl.o
-
+obj-$(CONFIG_BACKLIGHT_OT200) += ot200_bl.o
index 331f1ef1dad5c87984c813d465c06b84733896a8..7ff752288b92ea4fb7ff3bc87c60506054e57ed2 100644 (file)
@@ -145,7 +145,9 @@ static int aat2870_bl_probe(struct platform_device *pdev)
                goto out;
        }
 
-       aat2870_bl = kzalloc(sizeof(struct aat2870_bl_driver_data), GFP_KERNEL);
+       aat2870_bl = devm_kzalloc(&pdev->dev,
+                                 sizeof(struct aat2870_bl_driver_data),
+                                 GFP_KERNEL);
        if (!aat2870_bl) {
                dev_err(&pdev->dev,
                        "Failed to allocate memory for aat2870 backlight\n");
@@ -162,7 +164,7 @@ static int aat2870_bl_probe(struct platform_device *pdev)
                dev_err(&pdev->dev,
                        "Failed allocate memory for backlight device\n");
                ret = PTR_ERR(bd);
-               goto out_kfree;
+               goto out;
        }
 
        aat2870_bl->pdev = pdev;
@@ -199,8 +201,6 @@ static int aat2870_bl_probe(struct platform_device *pdev)
 
 out_bl_dev_unregister:
        backlight_device_unregister(bd);
-out_kfree:
-       kfree(aat2870_bl);
 out:
        return ret;
 }
@@ -215,7 +215,6 @@ static int aat2870_bl_remove(struct platform_device *pdev)
        backlight_update_status(bd);
 
        backlight_device_unregister(bd);
-       kfree(aat2870_bl);
 
        return 0;
 }
index 2e630bf1164cab84c771da9accb52109b6b69ff7..4911ea7989c82553dd90558a8afc4637da8c539b 100644 (file)
@@ -289,7 +289,7 @@ static int __devinit adp5520_bl_probe(struct platform_device *pdev)
        struct adp5520_bl *data;
        int ret = 0;
 
-       data = kzalloc(sizeof(*data), GFP_KERNEL);
+       data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
        if (data == NULL)
                return -ENOMEM;
 
@@ -298,7 +298,6 @@ static int __devinit adp5520_bl_probe(struct platform_device *pdev)
 
        if (data->pdata  == NULL) {
                dev_err(&pdev->dev, "missing platform data\n");
-               kfree(data);
                return -ENODEV;
        }
 
@@ -314,7 +313,6 @@ static int __devinit adp5520_bl_probe(struct platform_device *pdev)
                                       &adp5520_bl_ops, &props);
        if (IS_ERR(bl)) {
                dev_err(&pdev->dev, "failed to register backlight\n");
-               kfree(data);
                return PTR_ERR(bl);
        }
 
@@ -326,7 +324,6 @@ static int __devinit adp5520_bl_probe(struct platform_device *pdev)
        if (ret) {
                dev_err(&pdev->dev, "failed to register sysfs\n");
                backlight_device_unregister(bl);
-               kfree(data);
        }
 
        platform_set_drvdata(pdev, bl);
@@ -348,7 +345,6 @@ static int __devexit adp5520_bl_remove(struct platform_device *pdev)
                                &adp5520_bl_attr_group);
 
        backlight_device_unregister(bl);
-       kfree(data);
 
        return 0;
 }
index 378276c9d3cfdaa2926740da3aa6faba5213a3ae..550dbf0bb896f9b64083b6673a8da0359ef53912 100644 (file)
@@ -819,17 +819,7 @@ static struct i2c_driver adp8860_driver = {
        .id_table = adp8860_id,
 };
 
-static int __init adp8860_init(void)
-{
-       return i2c_add_driver(&adp8860_driver);
-}
-module_init(adp8860_init);
-
-static void __exit adp8860_exit(void)
-{
-       i2c_del_driver(&adp8860_driver);
-}
-module_exit(adp8860_exit);
+module_i2c_driver(adp8860_driver);
 
 MODULE_LICENSE("GPL v2");
 MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>");
index 6735059376d63840d95067ee4564500cd70fe390..9be58c6f18f10d10c0f0ecff370c3d8e3cf0f3e3 100644 (file)
@@ -991,17 +991,7 @@ static struct i2c_driver adp8870_driver = {
        .id_table = adp8870_id,
 };
 
-static int __init adp8870_init(void)
-{
-       return i2c_add_driver(&adp8870_driver);
-}
-module_init(adp8870_init);
-
-static void __exit adp8870_exit(void)
-{
-       i2c_del_driver(&adp8870_driver);
-}
-module_exit(adp8870_exit);
+module_i2c_driver(adp8870_driver);
 
 MODULE_LICENSE("GPL v2");
 MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>");
index 7838a23fbdd124fb8c2b639092708a35892f8bb9..7bdadc790117c977e5b23727eb70dac4fac51309 100644 (file)
@@ -629,18 +629,7 @@ static struct spi_driver ams369fg06_driver = {
        .resume         = ams369fg06_resume,
 };
 
-static int __init ams369fg06_init(void)
-{
-       return spi_register_driver(&ams369fg06_driver);
-}
-
-static void __exit ams369fg06_exit(void)
-{
-       spi_unregister_driver(&ams369fg06_driver);
-}
-
-module_init(ams369fg06_init);
-module_exit(ams369fg06_exit);
+module_spi_driver(ams369fg06_driver);
 
 MODULE_AUTHOR("Jingoo Han <jg1.han@samsung.com>");
 MODULE_DESCRIPTION("ams369fg06 LCD Driver");
index c6533bad26f86cb647792198cf4de02446cd64a8..6dab13fe562ee8ed2a43fd42370b68eb81d76a15 100644 (file)
@@ -629,17 +629,7 @@ static struct spi_driver corgi_lcd_driver = {
        .resume         = corgi_lcd_resume,
 };
 
-static int __init corgi_lcd_init(void)
-{
-       return spi_register_driver(&corgi_lcd_driver);
-}
-module_init(corgi_lcd_init);
-
-static void __exit corgi_lcd_exit(void)
-{
-       spi_unregister_driver(&corgi_lcd_driver);
-}
-module_exit(corgi_lcd_exit);
+module_spi_driver(corgi_lcd_driver);
 
 MODULE_DESCRIPTION("LCD and backlight driver for SHARP C7x0/Cxx00");
 MODULE_AUTHOR("Eric Miao <eric.miao@marvell.com>");
index 6c8c54041fae84f7bb33faf084e3ec9ff932f081..22489eb5f3e0beb525c3965df1d1186c1ee914ca 100644 (file)
@@ -212,7 +212,7 @@ static int cr_backlight_probe(struct platform_device *pdev)
                              &gpio_bar);
        gpio_bar &= ~0x3F;
 
-       crp = kzalloc(sizeof(*crp), GFP_KERNEL);
+       crp = devm_kzalloc(&pdev->dev, sizeof(*crp), GFP_KERNEL);
        if (!crp) {
                lcd_device_unregister(ldp);
                backlight_device_unregister(bdp);
@@ -243,7 +243,6 @@ static int cr_backlight_remove(struct platform_device *pdev)
        backlight_device_unregister(crp->cr_backlight_device);
        lcd_device_unregister(crp->cr_lcd_device);
        pci_dev_put(lpc_dev);
-       kfree(crp);
 
        return 0;
 }
index abb4a06268f1831e57815475338447fb83822543..30e19681a30b452a9c06181b83d2f448c10c4db1 100644 (file)
@@ -110,7 +110,7 @@ static int da903x_backlight_probe(struct platform_device *pdev)
        struct backlight_properties props;
        int max_brightness;
 
-       data = kzalloc(sizeof(*data), GFP_KERNEL);
+       data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
        if (data == NULL)
                return -ENOMEM;
 
@@ -124,7 +124,6 @@ static int da903x_backlight_probe(struct platform_device *pdev)
        default:
                dev_err(&pdev->dev, "invalid backlight device ID(%d)\n",
                                pdev->id);
-               kfree(data);
                return -EINVAL;
        }
 
@@ -143,7 +142,6 @@ static int da903x_backlight_probe(struct platform_device *pdev)
                                       &da903x_backlight_ops, &props);
        if (IS_ERR(bl)) {
                dev_err(&pdev->dev, "failed to register backlight\n");
-               kfree(data);
                return PTR_ERR(bl);
        }
 
@@ -157,10 +155,8 @@ static int da903x_backlight_probe(struct platform_device *pdev)
 static int da903x_backlight_remove(struct platform_device *pdev)
 {
        struct backlight_device *bl = platform_get_drvdata(pdev);
-       struct da903x_backlight_data *data = bl_get_data(bl);
 
        backlight_device_unregister(bl);
-       kfree(data);
        return 0;
 }
 
index 27d1d7a29c77ef501c29a043b309ce7f4bb290db..6022b67285ecd63e9bb799e082bb00a4e445ff52 100644 (file)
@@ -274,18 +274,7 @@ static struct spi_driver l4f00242t03_driver = {
        .shutdown       = l4f00242t03_shutdown,
 };
 
-static __init int l4f00242t03_init(void)
-{
-       return spi_register_driver(&l4f00242t03_driver);
-}
-
-static __exit void l4f00242t03_exit(void)
-{
-       spi_unregister_driver(&l4f00242t03_driver);
-}
-
-module_init(l4f00242t03_init);
-module_exit(l4f00242t03_exit);
+module_spi_driver(l4f00242t03_driver);
 
 MODULE_AUTHOR("Alberto Panizzo <maramaopercheseimorto@gmail.com>");
 MODULE_DESCRIPTION("EPSON L4F00242T03 LCD");
index 78dafc0c8fc5a1ec4830d04660d5914441e4fe09..efd352be21ae44a553cf8735392261d90552ff19 100644 (file)
@@ -856,18 +856,7 @@ static struct spi_driver ld9040_driver = {
        .resume         = ld9040_resume,
 };
 
-static int __init ld9040_init(void)
-{
-       return spi_register_driver(&ld9040_driver);
-}
-
-static void __exit ld9040_exit(void)
-{
-       spi_unregister_driver(&ld9040_driver);
-}
-
-module_init(ld9040_init);
-module_exit(ld9040_exit);
+module_spi_driver(ld9040_driver);
 
 MODULE_AUTHOR("Donghwa Lee <dh09.lee@samsung.com>");
 MODULE_DESCRIPTION("ld9040 LCD Driver");
index 4ec78cfe26eaf160f8c5746e019da9cd68327127..4161f9e3982a2a544120142f100e45afa34b5d2c 100644 (file)
@@ -226,18 +226,7 @@ static struct spi_driver lms283gf05_driver = {
        .remove         = __devexit_p(lms283gf05_remove),
 };
 
-static __init int lms283gf05_init(void)
-{
-       return spi_register_driver(&lms283gf05_driver);
-}
-
-static __exit void lms283gf05_exit(void)
-{
-       spi_unregister_driver(&lms283gf05_driver);
-}
-
-module_init(lms283gf05_init);
-module_exit(lms283gf05_exit);
+module_spi_driver(lms283gf05_driver);
 
 MODULE_AUTHOR("Marek Vasut <marek.vasut@gmail.com>");
 MODULE_DESCRIPTION("LCD283GF05 LCD");
diff --git a/drivers/video/backlight/lp855x_bl.c b/drivers/video/backlight/lp855x_bl.c
new file mode 100644 (file)
index 0000000..72a0e0c
--- /dev/null
@@ -0,0 +1,331 @@
+/*
+ * TI LP855x Backlight Driver
+ *
+ *                     Copyright (C) 2011 Texas Instruments
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+
+#include <linux/module.h>
+#include <linux/slab.h>
+#include <linux/i2c.h>
+#include <linux/backlight.h>
+#include <linux/err.h>
+#include <linux/lp855x.h>
+
+/* Registers */
+#define BRIGHTNESS_CTRL                (0x00)
+#define DEVICE_CTRL            (0x01)
+
+#define BUF_SIZE               20
+#define DEFAULT_BL_NAME                "lcd-backlight"
+#define MAX_BRIGHTNESS         255
+
+struct lp855x {
+       const char *chipname;
+       enum lp855x_chip_id chip_id;
+       struct i2c_client *client;
+       struct backlight_device *bl;
+       struct device *dev;
+       struct mutex xfer_lock;
+       struct lp855x_platform_data *pdata;
+};
+
+static int lp855x_read_byte(struct lp855x *lp, u8 reg, u8 *data)
+{
+       int ret;
+
+       mutex_lock(&lp->xfer_lock);
+       ret = i2c_smbus_read_byte_data(lp->client, reg);
+       if (ret < 0) {
+               mutex_unlock(&lp->xfer_lock);
+               dev_err(lp->dev, "failed to read 0x%.2x\n", reg);
+               return ret;
+       }
+       mutex_unlock(&lp->xfer_lock);
+
+       *data = (u8)ret;
+       return 0;
+}
+
+static int lp855x_write_byte(struct lp855x *lp, u8 reg, u8 data)
+{
+       int ret;
+
+       mutex_lock(&lp->xfer_lock);
+       ret = i2c_smbus_write_byte_data(lp->client, reg, data);
+       mutex_unlock(&lp->xfer_lock);
+
+       return ret;
+}
+
+static bool lp855x_is_valid_rom_area(struct lp855x *lp, u8 addr)
+{
+       u8 start, end;
+
+       switch (lp->chip_id) {
+       case LP8550:
+       case LP8551:
+       case LP8552:
+       case LP8553:
+               start = EEPROM_START;
+               end = EEPROM_END;
+               break;
+       case LP8556:
+               start = EPROM_START;
+               end = EPROM_END;
+               break;
+       default:
+               return false;
+       }
+
+       return (addr >= start && addr <= end);
+}
+
+static int lp855x_init_registers(struct lp855x *lp)
+{
+       u8 val, addr;
+       int i, ret;
+       struct lp855x_platform_data *pd = lp->pdata;
+
+       val = pd->initial_brightness;
+       ret = lp855x_write_byte(lp, BRIGHTNESS_CTRL, val);
+       if (ret)
+               return ret;
+
+       val = pd->device_control;
+       ret = lp855x_write_byte(lp, DEVICE_CTRL, val);
+       if (ret)
+               return ret;
+
+       if (pd->load_new_rom_data && pd->size_program) {
+               for (i = 0; i < pd->size_program; i++) {
+                       addr = pd->rom_data[i].addr;
+                       val = pd->rom_data[i].val;
+                       if (!lp855x_is_valid_rom_area(lp, addr))
+                               continue;
+
+                       ret = lp855x_write_byte(lp, addr, val);
+                       if (ret)
+                               return ret;
+               }
+       }
+
+       return ret;
+}
+
+static int lp855x_bl_update_status(struct backlight_device *bl)
+{
+       struct lp855x *lp = bl_get_data(bl);
+       enum lp855x_brightness_ctrl_mode mode = lp->pdata->mode;
+
+       if (bl->props.state & BL_CORE_SUSPENDED)
+               bl->props.brightness = 0;
+
+       if (mode == PWM_BASED) {
+               struct lp855x_pwm_data *pd = &lp->pdata->pwm_data;
+               int br = bl->props.brightness;
+               int max_br = bl->props.max_brightness;
+
+               if (pd->pwm_set_intensity)
+                       pd->pwm_set_intensity(br, max_br);
+
+       } else if (mode == REGISTER_BASED) {
+               u8 val = bl->props.brightness;
+               lp855x_write_byte(lp, BRIGHTNESS_CTRL, val);
+       }
+
+       return 0;
+}
+
+static int lp855x_bl_get_brightness(struct backlight_device *bl)
+{
+       struct lp855x *lp = bl_get_data(bl);
+       enum lp855x_brightness_ctrl_mode mode = lp->pdata->mode;
+
+       if (mode == PWM_BASED) {
+               struct lp855x_pwm_data *pd = &lp->pdata->pwm_data;
+               int max_br = bl->props.max_brightness;
+
+               if (pd->pwm_get_intensity)
+                       bl->props.brightness = pd->pwm_get_intensity(max_br);
+
+       } else if (mode == REGISTER_BASED) {
+               u8 val = 0;
+
+               lp855x_read_byte(lp, BRIGHTNESS_CTRL, &val);
+               bl->props.brightness = val;
+       }
+
+       return bl->props.brightness;
+}
+
+static const struct backlight_ops lp855x_bl_ops = {
+       .options = BL_CORE_SUSPENDRESUME,
+       .update_status = lp855x_bl_update_status,
+       .get_brightness = lp855x_bl_get_brightness,
+};
+
+static int lp855x_backlight_register(struct lp855x *lp)
+{
+       struct backlight_device *bl;
+       struct backlight_properties props;
+       struct lp855x_platform_data *pdata = lp->pdata;
+       char *name = pdata->name ? : DEFAULT_BL_NAME;
+
+       props.type = BACKLIGHT_PLATFORM;
+       props.max_brightness = MAX_BRIGHTNESS;
+
+       if (pdata->initial_brightness > props.max_brightness)
+               pdata->initial_brightness = props.max_brightness;
+
+       props.brightness = pdata->initial_brightness;
+
+       bl = backlight_device_register(name, lp->dev, lp,
+                                      &lp855x_bl_ops, &props);
+       if (IS_ERR(bl))
+               return PTR_ERR(bl);
+
+       lp->bl = bl;
+
+       return 0;
+}
+
+static void lp855x_backlight_unregister(struct lp855x *lp)
+{
+       if (lp->bl)
+               backlight_device_unregister(lp->bl);
+}
+
+static ssize_t lp855x_get_chip_id(struct device *dev,
+                               struct device_attribute *attr, char *buf)
+{
+       struct lp855x *lp = dev_get_drvdata(dev);
+       return scnprintf(buf, BUF_SIZE, "%s\n", lp->chipname);
+}
+
+static ssize_t lp855x_get_bl_ctl_mode(struct device *dev,
+                                    struct device_attribute *attr, char *buf)
+{
+       struct lp855x *lp = dev_get_drvdata(dev);
+       enum lp855x_brightness_ctrl_mode mode = lp->pdata->mode;
+       char *strmode = NULL;
+
+       if (mode == PWM_BASED)
+               strmode = "pwm based";
+       else if (mode == REGISTER_BASED)
+               strmode = "register based";
+
+       return scnprintf(buf, BUF_SIZE, "%s\n", strmode);
+}
+
+static DEVICE_ATTR(chip_id, S_IRUGO, lp855x_get_chip_id, NULL);
+static DEVICE_ATTR(bl_ctl_mode, S_IRUGO, lp855x_get_bl_ctl_mode, NULL);
+
+static struct attribute *lp855x_attributes[] = {
+       &dev_attr_chip_id.attr,
+       &dev_attr_bl_ctl_mode.attr,
+       NULL,
+};
+
+static const struct attribute_group lp855x_attr_group = {
+       .attrs = lp855x_attributes,
+};
+
+static int lp855x_probe(struct i2c_client *cl, const struct i2c_device_id *id)
+{
+       struct lp855x *lp;
+       struct lp855x_platform_data *pdata = cl->dev.platform_data;
+       enum lp855x_brightness_ctrl_mode mode;
+       int ret;
+
+       if (!pdata) {
+               dev_err(&cl->dev, "no platform data supplied\n");
+               return -EINVAL;
+       }
+
+       if (!i2c_check_functionality(cl->adapter, I2C_FUNC_SMBUS_I2C_BLOCK))
+               return -EIO;
+
+       lp = devm_kzalloc(&cl->dev, sizeof(struct lp855x), GFP_KERNEL);
+       if (!lp)
+               return -ENOMEM;
+
+       mode = pdata->mode;
+       lp->client = cl;
+       lp->dev = &cl->dev;
+       lp->pdata = pdata;
+       lp->chipname = id->name;
+       lp->chip_id = id->driver_data;
+       i2c_set_clientdata(cl, lp);
+
+       mutex_init(&lp->xfer_lock);
+
+       ret = lp855x_init_registers(lp);
+       if (ret) {
+               dev_err(lp->dev, "i2c communication err: %d", ret);
+               if (mode == REGISTER_BASED)
+                       goto err_dev;
+       }
+
+       ret = lp855x_backlight_register(lp);
+       if (ret) {
+               dev_err(lp->dev,
+                       "failed to register backlight. err: %d\n", ret);
+               goto err_dev;
+       }
+
+       ret = sysfs_create_group(&lp->dev->kobj, &lp855x_attr_group);
+       if (ret) {
+               dev_err(lp->dev, "failed to register sysfs. err: %d\n", ret);
+               goto err_sysfs;
+       }
+
+       backlight_update_status(lp->bl);
+       return 0;
+
+err_sysfs:
+       lp855x_backlight_unregister(lp);
+err_dev:
+       return ret;
+}
+
+static int __devexit lp855x_remove(struct i2c_client *cl)
+{
+       struct lp855x *lp = i2c_get_clientdata(cl);
+
+       lp->bl->props.brightness = 0;
+       backlight_update_status(lp->bl);
+       sysfs_remove_group(&lp->dev->kobj, &lp855x_attr_group);
+       lp855x_backlight_unregister(lp);
+
+       return 0;
+}
+
+static const struct i2c_device_id lp855x_ids[] = {
+       {"lp8550", LP8550},
+       {"lp8551", LP8551},
+       {"lp8552", LP8552},
+       {"lp8553", LP8553},
+       {"lp8556", LP8556},
+       { }
+};
+MODULE_DEVICE_TABLE(i2c, lp855x_ids);
+
+static struct i2c_driver lp855x_driver = {
+       .driver = {
+                  .name = "lp855x",
+                  },
+       .probe = lp855x_probe,
+       .remove = __devexit_p(lp855x_remove),
+       .id_table = lp855x_ids,
+};
+
+module_i2c_driver(lp855x_driver);
+
+MODULE_DESCRIPTION("Texas Instruments LP855x Backlight driver");
+MODULE_AUTHOR("Milo Kim <milo.kim@ti.com>");
+MODULE_LICENSE("GPL");
index cca43c06d3c851bf351c6db31971c3c9aae46f80..333949ff3265200f716112be2afaa79e5c480e43 100644 (file)
@@ -321,17 +321,7 @@ static struct spi_driver ltv350qv_driver = {
        .resume         = ltv350qv_resume,
 };
 
-static int __init ltv350qv_init(void)
-{
-       return spi_register_driver(&ltv350qv_driver);
-}
-
-static void __exit ltv350qv_exit(void)
-{
-       spi_unregister_driver(&ltv350qv_driver);
-}
-module_init(ltv350qv_init);
-module_exit(ltv350qv_exit);
+module_spi_driver(ltv350qv_driver);
 
 MODULE_AUTHOR("Haavard Skinnemoen (Atmel)");
 MODULE_DESCRIPTION("Samsung LTV350QV LCD Driver");
index c915e3b5388698b2c8c8007167ed531ad5e38580..e833ac72e063b80f26f08e613014f750891377d4 100644 (file)
@@ -129,7 +129,8 @@ static int __devinit max8925_backlight_probe(struct platform_device *pdev)
                return -EINVAL;
        }
 
-       data = kzalloc(sizeof(struct max8925_backlight_data), GFP_KERNEL);
+       data = devm_kzalloc(&pdev->dev, sizeof(struct max8925_backlight_data),
+                           GFP_KERNEL);
        if (data == NULL)
                return -ENOMEM;
        strncpy(name, res->name, MAX8925_NAME_SIZE);
@@ -143,7 +144,6 @@ static int __devinit max8925_backlight_probe(struct platform_device *pdev)
                                        &max8925_backlight_ops, &props);
        if (IS_ERR(bl)) {
                dev_err(&pdev->dev, "failed to register backlight\n");
-               kfree(data);
                return PTR_ERR(bl);
        }
        bl->props.brightness = MAX_BRIGHTNESS;
@@ -165,17 +165,14 @@ static int __devinit max8925_backlight_probe(struct platform_device *pdev)
        return 0;
 out:
        backlight_device_unregister(bl);
-       kfree(data);
        return ret;
 }
 
 static int __devexit max8925_backlight_remove(struct platform_device *pdev)
 {
        struct backlight_device *bl = platform_get_drvdata(pdev);
-       struct max8925_backlight_data *data = bl_get_data(bl);
 
        backlight_device_unregister(bl);
-       kfree(data);
        return 0;
 }
 
index d8cde277ec83a691c658b9e0afef6c3aef63ffb4..0175bfb08a1ca13ef14412cd1e49d1bb033430d3 100644 (file)
@@ -141,7 +141,8 @@ static int omapbl_probe(struct platform_device *pdev)
        if (!pdata)
&