diff --git a/[refs] b/[refs]
index fc839fbc9291..061b03ddb9c8 100644
--- a/[refs]
+++ b/[refs]
@@ -1,2 +1,2 @@
---
-refs/heads/master: 01b09b6c605ed119fba75b82582f017e44dd4a55
+refs/heads/master: f7108f91cdcaca07c6a99777b2724093294f36ee
diff --git a/trunk/Documentation/DocBook/videobook.tmpl b/trunk/Documentation/DocBook/videobook.tmpl
index 0bc25949b668..89817795e668 100644
--- a/trunk/Documentation/DocBook/videobook.tmpl
+++ b/trunk/Documentation/DocBook/videobook.tmpl
@@ -1648,7 +1648,7 @@ static struct video_buffer capture_fb;
Public Functions Provided
-!Edrivers/media/video/v4l2-dev.c
+!Edrivers/media/video/videodev.c
diff --git a/trunk/Documentation/hwmon/dme1737 b/trunk/Documentation/hwmon/dme1737
index 001d2e70bc11..b1fe00999439 100644
--- a/trunk/Documentation/hwmon/dme1737
+++ b/trunk/Documentation/hwmon/dme1737
@@ -10,10 +10,6 @@ Supported chips:
Prefix: 'sch311x'
Addresses scanned: none, address read from Super-I/O config space
Datasheet: http://www.nuhorizons.com/FeaturedProducts/Volume1/SMSC/311x.pdf
- * SMSC SCH5027
- Prefix: 'sch5027'
- Addresses scanned: I2C 0x2c, 0x2d, 0x2e
- Datasheet: Provided by SMSC upon request and under NDA
Authors:
Juerg Haefliger
@@ -31,31 +27,33 @@ Module Parameters
following boards:
- VIA EPIA SN18000
+Note that there is no need to use this parameter if the driver loads without
+complaining. The driver will say so if it is necessary.
+
Description
-----------
This driver implements support for the hardware monitoring capabilities of the
-SMSC DME1737 and Asus A8000 (which are the same), SMSC SCH5027, and SMSC
-SCH311x Super-I/O chips. These chips feature monitoring of 3 temp sensors
-temp[1-3] (2 remote diodes and 1 internal), 7 voltages in[0-6] (6 external and
-1 internal) and up to 6 fan speeds fan[1-6]. Additionally, the chips implement
-up to 5 PWM outputs pwm[1-3,5-6] for controlling fan speeds both manually and
+SMSC DME1737 and Asus A8000 (which are the same) and SMSC SCH311x Super-I/O
+chips. These chips feature monitoring of 3 temp sensors temp[1-3] (2 remote
+diodes and 1 internal), 7 voltages in[0-6] (6 external and 1 internal) and up
+to 6 fan speeds fan[1-6]. Additionally, the chips implement up to 5 PWM
+outputs pwm[1-3,5-6] for controlling fan speeds both manually and
automatically.
-For the DME1737, A8000 and SCH5027, fan[1-2] and pwm[1-2] are always present.
-Fan[3-6] and pwm[3,5-6] are optional features and their availability depends on
-the configuration of the chip. The driver will detect which features are
-present during initialization and create the sysfs attributes accordingly.
+For the DME1737 and A8000, fan[1-2] and pwm[1-2] are always present. Fan[3-6]
+and pwm[3,5-6] are optional features and their availability depends on the
+configuration of the chip. The driver will detect which features are present
+during initialization and create the sysfs attributes accordingly.
For the SCH311x, fan[1-3] and pwm[1-3] are always present and fan[4-6] and
pwm[5-6] don't exist.
-The hardware monitoring features of the DME1737, A8000, and SCH5027 are only
-accessible via SMBus, while the SCH311x only provides access via the ISA bus.
-The driver will therefore register itself as an I2C client driver if it detects
-a DME1737, A8000, or SCH5027 and as a platform driver if it detects a SCH311x
-chip.
+The hardware monitoring features of the DME1737 and A8000 are only accessible
+via SMBus, while the SCH311x only provides access via the ISA bus. The driver
+will therefore register itself as an I2C client driver if it detects a DME1737
+or A8000 and as a platform driver if it detects a SCH311x chip.
Voltage Monitoring
@@ -66,7 +64,6 @@ scaling resistors. The values returned by the driver therefore reflect true
millivolts and don't need scaling. The voltage inputs are mapped as follows
(the last column indicates the input ranges):
-DME1737, A8000:
in0: +5VTR (+5V standby) 0V - 6.64V
in1: Vccp (processor core) 0V - 3V
in2: VCC (internal +3.3V) 0V - 4.38V
@@ -75,24 +72,6 @@ DME1737, A8000:
in5: VTR (+3.3V standby) 0V - 4.38V
in6: Vbat (+3.0V) 0V - 4.38V
-SCH311x:
- in0: +2.5V 0V - 6.64V
- in1: Vccp (processor core) 0V - 2V
- in2: VCC (internal +3.3V) 0V - 4.38V
- in3: +5V 0V - 6.64V
- in4: +12V 0V - 16V
- in5: VTR (+3.3V standby) 0V - 4.38V
- in6: Vbat (+3.0V) 0V - 4.38V
-
-SCH5027:
- in0: +5VTR (+5V standby) 0V - 6.64V
- in1: Vccp (processor core) 0V - 3V
- in2: VCC (internal +3.3V) 0V - 4.38V
- in3: V2_IN 0V - 1.5V
- in4: V1_IN 0V - 1.5V
- in5: VTR (+3.3V standby) 0V - 4.38V
- in6: Vbat (+3.0V) 0V - 4.38V
-
Each voltage input has associated min and max limits which trigger an alarm
when crossed.
diff --git a/trunk/Documentation/hwmon/it87 b/trunk/Documentation/hwmon/it87
index 3496b7020e7c..f4ce1fdbeff6 100644
--- a/trunk/Documentation/hwmon/it87
+++ b/trunk/Documentation/hwmon/it87
@@ -6,14 +6,12 @@ Supported chips:
Prefix: 'it87'
Addresses scanned: from Super I/O config space (8 I/O ports)
Datasheet: Publicly available at the ITE website
- http://www.ite.com.tw/product_info/file/pc/IT8705F_V.0.4.1.pdf
+ http://www.ite.com.tw/
* IT8712F
Prefix: 'it8712'
Addresses scanned: from Super I/O config space (8 I/O ports)
Datasheet: Publicly available at the ITE website
- http://www.ite.com.tw/product_info/file/pc/IT8712F_V0.9.1.pdf
- http://www.ite.com.tw/product_info/file/pc/Errata%20V0.1%20for%20IT8712F%20V0.9.1.pdf
- http://www.ite.com.tw/product_info/file/pc/IT8712F_V0.9.3.pdf
+ http://www.ite.com.tw/
* IT8716F/IT8726F
Prefix: 'it8716'
Addresses scanned: from Super I/O config space (8 I/O ports)
@@ -92,13 +90,14 @@ upper VID bits share their pins with voltage inputs (in5 and in6) so you
can't have both on a given board.
The IT8716F, IT8718F and later IT8712F revisions have support for
-2 additional fans. The additional fans are supported by the driver.
+2 additional fans. They are supported by the driver for the IT8716F and
+IT8718F but not for the IT8712F
The IT8716F and IT8718F, and late IT8712F and IT8705F also have optional
16-bit tachometer counters for fans 1 to 3. This is better (no more fan
clock divider mess) but not compatible with the older chips and
-revisions. The 16-bit tachometer mode is enabled by the driver when one
-of the above chips is detected.
+revisions. For now, the driver only uses the 16-bit mode on the
+IT8716F and IT8718F.
The IT8726F is just bit enhanced IT8716F with additional hardware
for AMD power sequencing. Therefore the chip will appear as IT8716F
diff --git a/trunk/Documentation/hwmon/w83627hf b/trunk/Documentation/hwmon/w83627hf
index 6ee36dbafd64..880a59f53da9 100644
--- a/trunk/Documentation/hwmon/w83627hf
+++ b/trunk/Documentation/hwmon/w83627hf
@@ -40,6 +40,10 @@ Module Parameters
(default is 1)
Use 'init=0' to bypass initializing the chip.
Try this if your computer crashes when you load the module.
+* reset: int
+ (default is 0)
+ The driver used to reset the chip on load, but does no more. Use
+ 'reset=1' to restore the old behavior. Report if you need to do this.
Description
-----------
diff --git a/trunk/Documentation/hwmon/w83791d b/trunk/Documentation/hwmon/w83791d
index a67d3b7a7098..f153b2f6d62c 100644
--- a/trunk/Documentation/hwmon/w83791d
+++ b/trunk/Documentation/hwmon/w83791d
@@ -22,7 +22,6 @@ Credits:
Additional contributors:
Sven Anders
- Marc Hulsman
Module Parameters
-----------------
@@ -68,8 +67,9 @@ on until the temperature falls below the Hysteresis value.
Fan rotation speeds are reported in RPM (rotations per minute). An alarm is
triggered if the rotation speed has dropped below a programmable limit. Fan
-readings can be divided by a programmable divider (1, 2, 4, 8, 16,
-32, 64 or 128 for all fans) to give the readings more range or accuracy.
+readings can be divided by a programmable divider (1, 2, 4, 8 for fan 1/2/3
+and 1, 2, 4, 8, 16, 32, 64 or 128 for fan 4/5) to give the readings more
+range or accuracy.
Voltage sensors (also known as IN sensors) report their values in millivolts.
An alarm is triggered if the voltage has crossed a programmable minimum
diff --git a/trunk/Documentation/video4linux/gspca.txt b/trunk/Documentation/video4linux/gspca.txt
index 78a863ab8a5a..bcaf4ab383be 100644
--- a/trunk/Documentation/video4linux/gspca.txt
+++ b/trunk/Documentation/video4linux/gspca.txt
@@ -226,7 +226,6 @@ sonixj 0c45:6130 Sonix Pccam
sonixj 0c45:6138 Sn9c120 Mo4000
sonixj 0c45:613b Surfer SN-206
sonixj 0c45:613c Sonix Pccam168
-sonixj 0c45:6143 Sonix Pccam168
sunplus 0d64:0303 Sunplus FashionCam DXG
etoms 102c:6151 Qcam Sangha CIF
etoms 102c:6251 Qcam xxxxxx VGA
diff --git a/trunk/Makefile b/trunk/Makefile
index f3e206509ee1..ea413fa03e4e 100644
--- a/trunk/Makefile
+++ b/trunk/Makefile
@@ -929,10 +929,10 @@ ifneq ($(KBUILD_SRC),)
echo " in the '$(srctree)' directory.";\
/bin/false; \
fi;
- $(Q)if [ ! -d include2 ]; then \
- mkdir -p include2; \
+ $(Q)if [ ! -d include2 ]; then mkdir -p include2; fi;
+ $(Q)if [ -e $(srctree)/include/asm-$(SRCARCH)/errno.h ]; then \
ln -fsn $(srctree)/include/asm-$(SRCARCH) include2/asm; \
- fi
+ fi
endif
# prepare2 creates a makefile if using a separate output directory
@@ -1492,7 +1492,7 @@ quiet_cmd_cscope-file = FILELST cscope.files
cmd_cscope-file = (echo \-k; echo \-q; $(all-sources)) > cscope.files
quiet_cmd_cscope = MAKE cscope.out
- cmd_cscope = cscope -b -f cscope.out
+ cmd_cscope = cscope -b
cscope: FORCE
$(call cmd,cscope-file)
diff --git a/trunk/arch/ia64/Kconfig b/trunk/arch/ia64/Kconfig
index 48e496fe1e75..451f2ffb137b 100644
--- a/trunk/arch/ia64/Kconfig
+++ b/trunk/arch/ia64/Kconfig
@@ -171,8 +171,8 @@ config IA64_SGI_SN2
to select this option. If in doubt, select ia64 generic support
instead.
-config IA64_SGI_UV
- bool "SGI-UV"
+config IA64_SGI_UV`
+ bool "SGI-UV`"
select NUMA
select ACPI_NUMA
select SWIOTLB
@@ -321,10 +321,10 @@ config SMP
If you don't know what to do here, say N.
config NR_CPUS
- int "Maximum number of CPUs (2-4096)"
- range 2 4096
+ int "Maximum number of CPUs (2-1024)"
+ range 2 1024
depends on SMP
- default "4096"
+ default "1024"
help
You should set this to the number of CPUs in your system, but
keep in mind that a kernel compiled for, e.g., 2 CPUs will boot but
diff --git a/trunk/arch/ia64/configs/generic_defconfig b/trunk/arch/ia64/configs/generic_defconfig
index 9f483976228f..0210545e7f61 100644
--- a/trunk/arch/ia64/configs/generic_defconfig
+++ b/trunk/arch/ia64/configs/generic_defconfig
@@ -1,16 +1,20 @@
#
# Automatically generated make config: don't edit
-# Linux kernel version: 2.6.27-rc1
-# Mon Aug 4 15:38:01 2008
+# Linux kernel version: 2.6.22
+# Thu Jul 19 13:55:32 2007
#
CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
#
-# General setup
+# Code maturity level options
#
CONFIG_EXPERIMENTAL=y
CONFIG_LOCK_KERNEL=y
CONFIG_INIT_ENV_ARG_LIMIT=32
+
+#
+# General setup
+#
CONFIG_LOCALVERSION=""
CONFIG_LOCALVERSION_AUTO=y
CONFIG_SWAP=y
@@ -19,34 +23,20 @@ CONFIG_SYSVIPC_SYSCTL=y
CONFIG_POSIX_MQUEUE=y
# CONFIG_BSD_PROCESS_ACCT is not set
# CONFIG_TASKSTATS is not set
+# CONFIG_USER_NS is not set
# CONFIG_AUDIT is not set
CONFIG_IKCONFIG=y
CONFIG_IKCONFIG_PROC=y
CONFIG_LOG_BUF_SHIFT=20
-CONFIG_CGROUPS=y
-# CONFIG_CGROUP_DEBUG is not set
-# CONFIG_CGROUP_NS is not set
-# CONFIG_CGROUP_DEVICE is not set
-CONFIG_CPUSETS=y
-# CONFIG_GROUP_SCHED is not set
-# CONFIG_CGROUP_CPUACCT is not set
-# CONFIG_RESOURCE_COUNTERS is not set
+# CONFIG_CPUSETS is not set
CONFIG_SYSFS_DEPRECATED=y
-CONFIG_SYSFS_DEPRECATED_V2=y
-CONFIG_PROC_PID_CPUSET=y
# CONFIG_RELAY is not set
-CONFIG_NAMESPACES=y
-# CONFIG_UTS_NS is not set
-# CONFIG_IPC_NS is not set
-# CONFIG_USER_NS is not set
-# CONFIG_PID_NS is not set
CONFIG_BLK_DEV_INITRD=y
CONFIG_INITRAMFS_SOURCE=""
CONFIG_CC_OPTIMIZE_FOR_SIZE=y
CONFIG_SYSCTL=y
# CONFIG_EMBEDDED is not set
CONFIG_SYSCTL_SYSCALL=y
-CONFIG_SYSCTL_SYSCALL_CHECK=y
CONFIG_KALLSYMS=y
CONFIG_KALLSYMS_ALL=y
# CONFIG_KALLSYMS_EXTRA_PASS is not set
@@ -54,7 +44,6 @@ CONFIG_HOTPLUG=y
CONFIG_PRINTK=y
CONFIG_BUG=y
CONFIG_ELF_CORE=y
-CONFIG_COMPAT_BRK=y
CONFIG_BASE_FULL=y
CONFIG_FUTEX=y
CONFIG_ANON_INODES=y
@@ -64,30 +53,12 @@ CONFIG_TIMERFD=y
CONFIG_EVENTFD=y
CONFIG_SHMEM=y
CONFIG_VM_EVENT_COUNTERS=y
-CONFIG_SLUB_DEBUG=y
-# CONFIG_SLAB is not set
CONFIG_SLUB=y
# CONFIG_SLOB is not set
-# CONFIG_PROFILING is not set
-# CONFIG_MARKERS is not set
-CONFIG_HAVE_OPROFILE=y
-# CONFIG_KPROBES is not set
-# CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is not set
-# CONFIG_HAVE_IOREMAP_PROT is not set
-CONFIG_HAVE_KPROBES=y
-CONFIG_HAVE_KRETPROBES=y
-# CONFIG_HAVE_ARCH_TRACEHOOK is not set
-CONFIG_HAVE_DMA_ATTRS=y
-CONFIG_USE_GENERIC_SMP_HELPERS=y
-# CONFIG_HAVE_CLK is not set
-CONFIG_PROC_PAGE_MONITOR=y
-# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
-CONFIG_SLABINFO=y
CONFIG_RT_MUTEXES=y
# CONFIG_TINY_SHMEM is not set
CONFIG_BASE_SMALL=0
CONFIG_MODULES=y
-# CONFIG_MODULE_FORCE_LOAD is not set
CONFIG_MODULE_UNLOAD=y
# CONFIG_MODULE_FORCE_UNLOAD is not set
CONFIG_MODVERSIONS=y
@@ -97,8 +68,6 @@ CONFIG_STOP_MACHINE=y
CONFIG_BLOCK=y
# CONFIG_BLK_DEV_IO_TRACE is not set
# CONFIG_BLK_DEV_BSG is not set
-# CONFIG_BLK_DEV_INTEGRITY is not set
-CONFIG_BLOCK_COMPAT=y
#
# IO Schedulers
@@ -112,7 +81,6 @@ CONFIG_DEFAULT_AS=y
# CONFIG_DEFAULT_CFQ is not set
# CONFIG_DEFAULT_NOOP is not set
CONFIG_DEFAULT_IOSCHED="anticipatory"
-CONFIG_CLASSIC_RCU=y
#
# Processor type and features
@@ -123,28 +91,22 @@ CONFIG_ZONE_DMA=y
CONFIG_QUICKLIST=y
CONFIG_MMU=y
CONFIG_SWIOTLB=y
-CONFIG_IOMMU_HELPER=y
CONFIG_RWSEM_XCHGADD_ALGORITHM=y
# CONFIG_ARCH_HAS_ILOG2_U32 is not set
# CONFIG_ARCH_HAS_ILOG2_U64 is not set
-CONFIG_HUGETLB_PAGE_SIZE_VARIABLE=y
CONFIG_GENERIC_FIND_NEXT_BIT=y
CONFIG_GENERIC_CALIBRATE_DELAY=y
CONFIG_GENERIC_TIME=y
-CONFIG_GENERIC_TIME_VSYSCALL=y
-CONFIG_HAVE_SETUP_PER_CPU_AREA=y
CONFIG_DMI=y
CONFIG_EFI=y
CONFIG_GENERIC_IOMAP=y
CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
-CONFIG_IA64_UNCACHED_ALLOCATOR=y
CONFIG_AUDIT_ARCH=y
CONFIG_IA64_GENERIC=y
# CONFIG_IA64_DIG is not set
# CONFIG_IA64_HP_ZX1 is not set
# CONFIG_IA64_HP_ZX1_SWIOTLB is not set
# CONFIG_IA64_SGI_SN2 is not set
-# CONFIG_IA64_SGI_UV is not set
# CONFIG_IA64_HP_SIM is not set
# CONFIG_ITANIUM is not set
CONFIG_MCKINLEY=y
@@ -154,26 +116,22 @@ CONFIG_MCKINLEY=y
CONFIG_IA64_PAGE_SIZE_64KB=y
CONFIG_PGTABLE_3=y
# CONFIG_PGTABLE_4 is not set
-CONFIG_HZ=250
# CONFIG_HZ_100 is not set
CONFIG_HZ_250=y
# CONFIG_HZ_300 is not set
# CONFIG_HZ_1000 is not set
-# CONFIG_SCHED_HRTICK is not set
+CONFIG_HZ=250
CONFIG_IA64_L1_CACHE_SHIFT=7
CONFIG_IA64_CYCLONE=y
CONFIG_IOSAPIC=y
+# CONFIG_IA64_SGI_SN_XP is not set
CONFIG_FORCE_MAX_ZONEORDER=17
-# CONFIG_VIRT_CPU_ACCOUNTING is not set
CONFIG_SMP=y
-CONFIG_NR_CPUS=4096
+CONFIG_NR_CPUS=512
CONFIG_HOTPLUG_CPU=y
CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
-CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
# CONFIG_SCHED_SMT is not set
# CONFIG_PERMIT_BSP_REMOVE is not set
-CONFIG_PREEMPT_NONE=y
-# CONFIG_PREEMPT_VOLUNTARY is not set
# CONFIG_PREEMPT is not set
CONFIG_SELECT_MEMORY_MODEL=y
# CONFIG_FLATMEM_MANUAL is not set
@@ -183,8 +141,6 @@ CONFIG_DISCONTIGMEM=y
CONFIG_FLAT_NODE_MEM_MAP=y
CONFIG_NEED_MULTIPLE_NODES=y
# CONFIG_SPARSEMEM_STATIC is not set
-CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
-CONFIG_PAGEFLAGS_EXTENDED=y
CONFIG_SPLIT_PTLOCK_CPUS=4
CONFIG_MIGRATION=y
CONFIG_RESOURCES_64BIT=y
@@ -192,7 +148,6 @@ CONFIG_ZONE_DMA_FLAG=1
CONFIG_BOUNCE=y
CONFIG_NR_QUICK=1
CONFIG_VIRT_TO_BUS=y
-CONFIG_MMU_NOTIFIER=y
CONFIG_ARCH_SELECT_MEMORY_MODEL=y
CONFIG_ARCH_DISCONTIGMEM_ENABLE=y
CONFIG_ARCH_FLATMEM_ENABLE=y
@@ -207,14 +162,12 @@ CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID=y
CONFIG_HAVE_ARCH_NODEDATA_EXTENSION=y
CONFIG_IA32_SUPPORT=y
CONFIG_COMPAT=y
-CONFIG_COMPAT_FOR_U64_ALIGNMENT=y
CONFIG_IA64_MCA_RECOVERY=y
CONFIG_PERFMON=y
CONFIG_IA64_PALINFO=y
# CONFIG_IA64_MC_ERR_INJECT is not set
CONFIG_SGI_SN=y
# CONFIG_IA64_ESI is not set
-# CONFIG_IA64_HP_AML_NFW is not set
#
# SN Devices
@@ -226,7 +179,6 @@ CONFIG_CRASH_DUMP=y
#
# Firmware Drivers
#
-# CONFIG_FIRMWARE_MEMMAP is not set
CONFIG_EFI_VARS=y
CONFIG_EFI_PCDP=y
CONFIG_DMIID=y
@@ -237,25 +189,24 @@ CONFIG_BINFMT_MISC=m
# Power management and ACPI
#
CONFIG_PM=y
+CONFIG_PM_LEGACY=y
# CONFIG_PM_DEBUG is not set
+
+#
+# ACPI (Advanced Configuration and Power Interface) Support
+#
CONFIG_ACPI=y
CONFIG_ACPI_PROCFS=y
-CONFIG_ACPI_PROCFS_POWER=y
-CONFIG_ACPI_SYSFS_POWER=y
-CONFIG_ACPI_PROC_EVENT=y
CONFIG_ACPI_BUTTON=m
CONFIG_ACPI_FAN=m
-CONFIG_ACPI_DOCK=y
-# CONFIG_ACPI_BAY is not set
+# CONFIG_ACPI_DOCK is not set
CONFIG_ACPI_PROCESSOR=m
CONFIG_ACPI_HOTPLUG_CPU=y
CONFIG_ACPI_THERMAL=m
CONFIG_ACPI_NUMA=y
-# CONFIG_ACPI_CUSTOM_DSDT is not set
CONFIG_ACPI_BLACKLIST_YEAR=0
# CONFIG_ACPI_DEBUG is not set
CONFIG_ACPI_EC=y
-# CONFIG_ACPI_PCI_SLOT is not set
CONFIG_ACPI_POWER=y
CONFIG_ACPI_SYSTEM=y
CONFIG_ACPI_CONTAINER=m
@@ -274,7 +225,6 @@ CONFIG_PCI_SYSCALL=y
# CONFIG_PCIEPORTBUS is not set
CONFIG_ARCH_SUPPORTS_MSI=y
# CONFIG_PCI_MSI is not set
-CONFIG_PCI_LEGACY=y
# CONFIG_PCI_DEBUG is not set
CONFIG_HOTPLUG_PCI=m
# CONFIG_HOTPLUG_PCI_FAKE is not set
@@ -283,7 +233,15 @@ CONFIG_HOTPLUG_PCI_ACPI=m
# CONFIG_HOTPLUG_PCI_CPCI is not set
# CONFIG_HOTPLUG_PCI_SHPC is not set
# CONFIG_HOTPLUG_PCI_SGI is not set
+
+#
+# PCCARD (PCMCIA/CardBus) support
+#
# CONFIG_PCCARD is not set
+
+#
+# Networking
+#
CONFIG_NET=y
#
@@ -296,7 +254,6 @@ CONFIG_XFRM=y
# CONFIG_XFRM_USER is not set
# CONFIG_XFRM_SUB_POLICY is not set
# CONFIG_XFRM_MIGRATE is not set
-# CONFIG_XFRM_STATISTICS is not set
# CONFIG_NET_KEY is not set
CONFIG_INET=y
CONFIG_IP_MULTICAST=y
@@ -316,7 +273,6 @@ CONFIG_SYN_COOKIES=y
CONFIG_INET_XFRM_MODE_TRANSPORT=y
CONFIG_INET_XFRM_MODE_TUNNEL=y
CONFIG_INET_XFRM_MODE_BEET=y
-CONFIG_INET_LRO=m
CONFIG_INET_DIAG=y
CONFIG_INET_TCP_DIAG=y
# CONFIG_TCP_CONG_ADVANCED is not set
@@ -324,6 +280,8 @@ CONFIG_TCP_CONG_CUBIC=y
CONFIG_DEFAULT_TCP_CONG="cubic"
# CONFIG_TCP_MD5SIG is not set
# CONFIG_IPV6 is not set
+# CONFIG_INET6_XFRM_TUNNEL is not set
+# CONFIG_INET6_TUNNEL is not set
# CONFIG_NETWORK_SECMARK is not set
# CONFIG_NETFILTER is not set
# CONFIG_IP_DCCP is not set
@@ -340,6 +298,10 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
# CONFIG_LAPB is not set
# CONFIG_ECONET is not set
# CONFIG_WAN_ROUTER is not set
+
+#
+# QoS and/or fair queueing
+#
# CONFIG_NET_SCHED is not set
#
@@ -347,7 +309,6 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
#
# CONFIG_NET_PKTGEN is not set
# CONFIG_HAMRADIO is not set
-# CONFIG_CAN is not set
# CONFIG_IRDA is not set
# CONFIG_BT is not set
# CONFIG_AF_RXRPC is not set
@@ -369,17 +330,13 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
#
# Generic Driver Options
#
-CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
CONFIG_STANDALONE=y
CONFIG_PREVENT_FIRMWARE_BUILD=y
-CONFIG_FW_LOADER=y
-CONFIG_FIRMWARE_IN_KERNEL=y
-CONFIG_EXTRA_FIRMWARE=""
+CONFIG_FW_LOADER=m
# CONFIG_DEBUG_DRIVER is not set
# CONFIG_DEBUG_DEVRES is not set
# CONFIG_SYS_HYPERVISOR is not set
-CONFIG_CONNECTOR=y
-CONFIG_PROC_EVENTS=y
+# CONFIG_CONNECTOR is not set
# CONFIG_MTD is not set
# CONFIG_PARPORT is not set
CONFIG_PNP=y
@@ -403,35 +360,25 @@ CONFIG_BLK_DEV_NBD=m
CONFIG_BLK_DEV_RAM=y
CONFIG_BLK_DEV_RAM_COUNT=16
CONFIG_BLK_DEV_RAM_SIZE=4096
-# CONFIG_BLK_DEV_XIP is not set
+CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
# CONFIG_CDROM_PKTCDVD is not set
# CONFIG_ATA_OVER_ETH is not set
-# CONFIG_BLK_DEV_HD is not set
CONFIG_MISC_DEVICES=y
# CONFIG_PHANTOM is not set
# CONFIG_EEPROM_93CX6 is not set
CONFIG_SGI_IOC4=y
# CONFIG_TIFM_CORE is not set
-# CONFIG_ENCLOSURE_SERVICES is not set
-CONFIG_SGI_XP=m
-# CONFIG_HP_ILO is not set
-CONFIG_SGI_GRU=m
-# CONFIG_SGI_GRU_DEBUG is not set
-CONFIG_HAVE_IDE=y
CONFIG_IDE=y
CONFIG_IDE_MAX_HWIFS=4
CONFIG_BLK_DEV_IDE=y
#
-# Please see Documentation/ide/ide.txt for help/info on IDE drives
+# Please see Documentation/ide.txt for help/info on IDE drives
#
-CONFIG_IDE_TIMINGS=y
-CONFIG_IDE_ATAPI=y
# CONFIG_BLK_DEV_IDE_SATA is not set
CONFIG_BLK_DEV_IDEDISK=y
# CONFIG_IDEDISK_MULTI_MODE is not set
CONFIG_BLK_DEV_IDECD=y
-CONFIG_BLK_DEV_IDECD_VERBOSE_ERRORS=y
# CONFIG_BLK_DEV_IDETAPE is not set
CONFIG_BLK_DEV_IDEFLOPPY=y
CONFIG_BLK_DEV_IDESCSI=m
@@ -443,26 +390,25 @@ CONFIG_IDE_PROC_FS=y
# IDE chipset support/bugfixes
#
# CONFIG_IDE_GENERIC is not set
-# CONFIG_BLK_DEV_PLATFORM is not set
# CONFIG_BLK_DEV_IDEPNP is not set
-CONFIG_BLK_DEV_IDEDMA_SFF=y
-
-#
-# PCI IDE chipsets support
-#
CONFIG_BLK_DEV_IDEPCI=y
+CONFIG_IDEPCI_SHARE_IRQ=y
CONFIG_IDEPCI_PCIBUS_ORDER=y
# CONFIG_BLK_DEV_OFFBOARD is not set
CONFIG_BLK_DEV_GENERIC=y
# CONFIG_BLK_DEV_OPTI621 is not set
CONFIG_BLK_DEV_IDEDMA_PCI=y
+# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
+# CONFIG_IDEDMA_ONLYDISK is not set
# CONFIG_BLK_DEV_AEC62XX is not set
# CONFIG_BLK_DEV_ALI15X3 is not set
# CONFIG_BLK_DEV_AMD74XX is not set
CONFIG_BLK_DEV_CMD64X=y
# CONFIG_BLK_DEV_TRIFLEX is not set
+# CONFIG_BLK_DEV_CY82C693 is not set
# CONFIG_BLK_DEV_CS5520 is not set
# CONFIG_BLK_DEV_CS5530 is not set
+# CONFIG_BLK_DEV_HPT34X is not set
# CONFIG_BLK_DEV_HPT366 is not set
# CONFIG_BLK_DEV_JMICRON is not set
# CONFIG_BLK_DEV_SC1200 is not set
@@ -479,7 +425,10 @@ CONFIG_BLK_DEV_SGIIOC4=y
# CONFIG_BLK_DEV_TRM290 is not set
# CONFIG_BLK_DEV_VIA82CXXX is not set
# CONFIG_BLK_DEV_TC86C001 is not set
+# CONFIG_IDE_ARM is not set
CONFIG_BLK_DEV_IDEDMA=y
+# CONFIG_IDEDMA_IVB is not set
+# CONFIG_BLK_DEV_HD is not set
#
# SCSI device support
@@ -519,8 +468,10 @@ CONFIG_SCSI_FC_ATTRS=y
# CONFIG_SCSI_ISCSI_ATTRS is not set
CONFIG_SCSI_SAS_ATTRS=y
# CONFIG_SCSI_SAS_LIBSAS is not set
-# CONFIG_SCSI_SRP_ATTRS is not set
-CONFIG_SCSI_LOWLEVEL=y
+
+#
+# SCSI low-level drivers
+#
# CONFIG_ISCSI_TCP is not set
# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
# CONFIG_SCSI_3W_9XXX is not set
@@ -530,8 +481,6 @@ CONFIG_SCSI_LOWLEVEL=y
# CONFIG_SCSI_AIC7XXX_OLD is not set
# CONFIG_SCSI_AIC79XX is not set
# CONFIG_SCSI_AIC94XX is not set
-# CONFIG_SCSI_DPT_I2O is not set
-# CONFIG_SCSI_ADVANSYS is not set
# CONFIG_SCSI_ARCMSR is not set
# CONFIG_MEGARAID_NEWGEN is not set
# CONFIG_MEGARAID_LEGACY is not set
@@ -542,14 +491,12 @@ CONFIG_SCSI_LOWLEVEL=y
# CONFIG_SCSI_IPS is not set
# CONFIG_SCSI_INITIO is not set
# CONFIG_SCSI_INIA100 is not set
-# CONFIG_SCSI_MVSAS is not set
# CONFIG_SCSI_STEX is not set
CONFIG_SCSI_SYM53C8XX_2=y
CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=1
CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
CONFIG_SCSI_SYM53C8XX_MMIO=y
-# CONFIG_SCSI_IPR is not set
CONFIG_SCSI_QLOGIC_1280=y
# CONFIG_SCSI_QLA_FC is not set
# CONFIG_SCSI_QLA_ISCSI is not set
@@ -558,68 +505,7 @@ CONFIG_SCSI_QLOGIC_1280=y
# CONFIG_SCSI_DC390T is not set
# CONFIG_SCSI_DEBUG is not set
# CONFIG_SCSI_SRP is not set
-# CONFIG_SCSI_DH is not set
-CONFIG_ATA=y
-CONFIG_ATA_NONSTANDARD=y
-CONFIG_ATA_ACPI=y
-CONFIG_SATA_PMP=y
-# CONFIG_SATA_AHCI is not set
-# CONFIG_SATA_SIL24 is not set
-CONFIG_ATA_SFF=y
-# CONFIG_SATA_SVW is not set
-CONFIG_ATA_PIIX=y
-# CONFIG_SATA_MV is not set
-# CONFIG_SATA_NV is not set
-# CONFIG_PDC_ADMA is not set
-# CONFIG_SATA_QSTOR is not set
-# CONFIG_SATA_PROMISE is not set
-# CONFIG_SATA_SX4 is not set
-# CONFIG_SATA_SIL is not set
-# CONFIG_SATA_SIS is not set
-# CONFIG_SATA_ULI is not set
-# CONFIG_SATA_VIA is not set
-# CONFIG_SATA_VITESSE is not set
-# CONFIG_SATA_INIC162X is not set
-# CONFIG_PATA_ACPI is not set
-# CONFIG_PATA_ALI is not set
-# CONFIG_PATA_AMD is not set
-# CONFIG_PATA_ARTOP is not set
-# CONFIG_PATA_ATIIXP is not set
-# CONFIG_PATA_CMD640_PCI is not set
-# CONFIG_PATA_CMD64X is not set
-# CONFIG_PATA_CS5520 is not set
-# CONFIG_PATA_CS5530 is not set
-# CONFIG_PATA_CYPRESS is not set
-# CONFIG_PATA_EFAR is not set
-# CONFIG_ATA_GENERIC is not set
-# CONFIG_PATA_HPT366 is not set
-# CONFIG_PATA_HPT37X is not set
-# CONFIG_PATA_HPT3X2N is not set
-# CONFIG_PATA_HPT3X3 is not set
-# CONFIG_PATA_IT821X is not set
-# CONFIG_PATA_IT8213 is not set
-# CONFIG_PATA_JMICRON is not set
-# CONFIG_PATA_TRIFLEX is not set
-# CONFIG_PATA_MARVELL is not set
-# CONFIG_PATA_MPIIX is not set
-# CONFIG_PATA_OLDPIIX is not set
-# CONFIG_PATA_NETCELL is not set
-# CONFIG_PATA_NINJA32 is not set
-# CONFIG_PATA_NS87410 is not set
-# CONFIG_PATA_NS87415 is not set
-# CONFIG_PATA_OPTI is not set
-# CONFIG_PATA_OPTIDMA is not set
-# CONFIG_PATA_PDC_OLD is not set
-# CONFIG_PATA_RADISYS is not set
-# CONFIG_PATA_RZ1000 is not set
-# CONFIG_PATA_SC1200 is not set
-# CONFIG_PATA_SERVERWORKS is not set
-# CONFIG_PATA_PDC2027X is not set
-# CONFIG_PATA_SIL680 is not set
-# CONFIG_PATA_SIS is not set
-# CONFIG_PATA_VIA is not set
-# CONFIG_PATA_WINBOND is not set
-# CONFIG_PATA_SCH is not set
+# CONFIG_ATA is not set
CONFIG_MD=y
CONFIG_BLK_DEV_MD=m
CONFIG_MD_LINEAR=m
@@ -636,52 +522,36 @@ CONFIG_DM_SNAPSHOT=m
CONFIG_DM_MIRROR=m
CONFIG_DM_ZERO=m
CONFIG_DM_MULTIPATH=m
+# CONFIG_DM_MULTIPATH_EMC is not set
+# CONFIG_DM_MULTIPATH_RDAC is not set
# CONFIG_DM_DELAY is not set
-# CONFIG_DM_UEVENT is not set
+
+#
+# Fusion MPT device support
+#
CONFIG_FUSION=y
CONFIG_FUSION_SPI=y
CONFIG_FUSION_FC=m
CONFIG_FUSION_SAS=y
CONFIG_FUSION_MAX_SGE=128
# CONFIG_FUSION_CTL is not set
-# CONFIG_FUSION_LOGGING is not set
#
# IEEE 1394 (FireWire) support
#
-
-#
-# Enable only one of the two stacks, unless you know what you are doing
-#
# CONFIG_FIREWIRE is not set
# CONFIG_IEEE1394 is not set
# CONFIG_I2O is not set
CONFIG_NETDEVICES=y
+# CONFIG_NETDEVICES_MULTIQUEUE is not set
CONFIG_DUMMY=m
# CONFIG_BONDING is not set
# CONFIG_MACVLAN is not set
# CONFIG_EQUALIZER is not set
# CONFIG_TUN is not set
-# CONFIG_VETH is not set
# CONFIG_NET_SB1000 is not set
# CONFIG_ARCNET is not set
-CONFIG_PHYLIB=y
-
-#
-# MII PHY device drivers
-#
-# CONFIG_MARVELL_PHY is not set
-# CONFIG_DAVICOM_PHY is not set
-# CONFIG_QSEMI_PHY is not set
-# CONFIG_LXT_PHY is not set
-# CONFIG_CICADA_PHY is not set
-# CONFIG_VITESSE_PHY is not set
-# CONFIG_SMSC_PHY is not set
-# CONFIG_BROADCOM_PHY is not set
-# CONFIG_ICPLUS_PHY is not set
-# CONFIG_REALTEK_PHY is not set
-# CONFIG_FIXED_PHY is not set
-# CONFIG_MDIO_BITBANG is not set
+# CONFIG_PHYLIB is not set
CONFIG_NET_ETHERNET=y
CONFIG_MII=m
# CONFIG_HAPPYMEAL is not set
@@ -699,16 +569,13 @@ CONFIG_TULIP=m
# CONFIG_DM9102 is not set
# CONFIG_ULI526X is not set
# CONFIG_HP100 is not set
-# CONFIG_IBM_NEW_EMAC_ZMII is not set
-# CONFIG_IBM_NEW_EMAC_RGMII is not set
-# CONFIG_IBM_NEW_EMAC_TAH is not set
-# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
CONFIG_NET_PCI=y
# CONFIG_PCNET32 is not set
# CONFIG_AMD8111_ETH is not set
# CONFIG_ADAPTEC_STARFIRE is not set
# CONFIG_B44 is not set
# CONFIG_FORCEDETH is not set
+# CONFIG_DGRS is not set
CONFIG_EEPRO100=m
CONFIG_E100=m
# CONFIG_FEALNX is not set
@@ -716,22 +583,17 @@ CONFIG_E100=m
# CONFIG_NE2K_PCI is not set
# CONFIG_8139CP is not set
# CONFIG_8139TOO is not set
-# CONFIG_R6040 is not set
# CONFIG_SIS900 is not set
# CONFIG_EPIC100 is not set
# CONFIG_SUNDANCE is not set
-# CONFIG_TLAN is not set
# CONFIG_VIA_RHINE is not set
# CONFIG_SC92031 is not set
CONFIG_NETDEV_1000=y
# CONFIG_ACENIC is not set
# CONFIG_DL2K is not set
CONFIG_E1000=y
+# CONFIG_E1000_NAPI is not set
# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
-# CONFIG_E1000E is not set
-# CONFIG_IP1000 is not set
-CONFIG_IGB=y
-# CONFIG_IGB_LRO is not set
# CONFIG_NS83820 is not set
# CONFIG_HAMACHI is not set
# CONFIG_YELLOWFIN is not set
@@ -744,20 +606,14 @@ CONFIG_TIGON3=y
# CONFIG_BNX2 is not set
# CONFIG_QLA3XXX is not set
# CONFIG_ATL1 is not set
-# CONFIG_ATL1E is not set
CONFIG_NETDEV_10000=y
# CONFIG_CHELSIO_T1 is not set
# CONFIG_CHELSIO_T3 is not set
-# CONFIG_IXGBE is not set
# CONFIG_IXGB is not set
# CONFIG_S2IO is not set
# CONFIG_MYRI10GE is not set
# CONFIG_NETXEN_NIC is not set
-# CONFIG_NIU is not set
# CONFIG_MLX4_CORE is not set
-# CONFIG_TEHUTI is not set
-# CONFIG_BNX2X is not set
-# CONFIG_SFC is not set
# CONFIG_TR is not set
#
@@ -765,7 +621,6 @@ CONFIG_NETDEV_10000=y
#
# CONFIG_WLAN_PRE80211 is not set
# CONFIG_WLAN_80211 is not set
-# CONFIG_IWLWIFI_LEDS is not set
#
# USB Network Adapters
@@ -774,6 +629,7 @@ CONFIG_NETDEV_10000=y
# CONFIG_USB_KAWETH is not set
# CONFIG_USB_PEGASUS is not set
# CONFIG_USB_RTL8150 is not set
+# CONFIG_USB_USBNET_MII is not set
# CONFIG_USB_USBNET is not set
# CONFIG_WAN is not set
# CONFIG_FDDI is not set
@@ -781,8 +637,8 @@ CONFIG_NETDEV_10000=y
# CONFIG_PPP is not set
# CONFIG_SLIP is not set
# CONFIG_NET_FC is not set
+# CONFIG_SHAPER is not set
CONFIG_NETCONSOLE=y
-# CONFIG_NETCONSOLE_DYNAMIC is not set
CONFIG_NETPOLL=y
# CONFIG_NETPOLL_TRAP is not set
CONFIG_NET_POLL_CONTROLLER=y
@@ -804,6 +660,7 @@ CONFIG_INPUT_MOUSEDEV_PSAUX=y
CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
# CONFIG_INPUT_JOYDEV is not set
+# CONFIG_INPUT_TSDEV is not set
# CONFIG_INPUT_EVDEV is not set
# CONFIG_INPUT_EVBUG is not set
@@ -852,11 +709,9 @@ CONFIG_GAMEPORT=m
# Character devices
#
CONFIG_VT=y
-CONFIG_CONSOLE_TRANSLATIONS=y
CONFIG_VT_CONSOLE=y
CONFIG_HW_CONSOLE=y
# CONFIG_VT_HW_CONSOLE_BINDING is not set
-CONFIG_DEVKMEM=y
CONFIG_SERIAL_NONSTANDARD=y
# CONFIG_COMPUTONE is not set
# CONFIG_ROCKETPORT is not set
@@ -864,16 +719,15 @@ CONFIG_SERIAL_NONSTANDARD=y
# CONFIG_DIGIEPCA is not set
# CONFIG_MOXA_INTELLIO is not set
# CONFIG_MOXA_SMARTIO is not set
+# CONFIG_MOXA_SMARTIO_NEW is not set
# CONFIG_ISI is not set
# CONFIG_SYNCLINKMP is not set
# CONFIG_SYNCLINK_GT is not set
# CONFIG_N_HDLC is not set
-# CONFIG_RISCOM8 is not set
# CONFIG_SPECIALIX is not set
# CONFIG_SX is not set
# CONFIG_RIO is not set
# CONFIG_STALDRV is not set
-# CONFIG_NOZOMI is not set
CONFIG_SGI_SNSC=y
CONFIG_SGI_TIOCX=y
CONFIG_SGI_MBCS=m
@@ -905,100 +759,76 @@ CONFIG_UNIX98_PTYS=y
CONFIG_LEGACY_PTYS=y
CONFIG_LEGACY_PTY_COUNT=256
# CONFIG_IPMI_HANDLER is not set
+# CONFIG_WATCHDOG is not set
# CONFIG_HW_RANDOM is not set
CONFIG_EFI_RTC=y
# CONFIG_R3964 is not set
# CONFIG_APPLICOM is not set
+CONFIG_AGP=m
+CONFIG_AGP_I460=m
+CONFIG_AGP_HP_ZX1=m
+CONFIG_AGP_SGI_TIOCA=m
+CONFIG_DRM=m
+CONFIG_DRM_TDFX=m
+CONFIG_DRM_R128=m
+CONFIG_DRM_RADEON=m
+CONFIG_DRM_MGA=m
+CONFIG_DRM_SIS=m
+# CONFIG_DRM_VIA is not set
+# CONFIG_DRM_SAVAGE is not set
CONFIG_RAW_DRIVER=m
CONFIG_MAX_RAW_DEVS=256
CONFIG_HPET=y
+# CONFIG_HPET_RTC_IRQ is not set
CONFIG_HPET_MMAP=y
# CONFIG_HANGCHECK_TIMER is not set
CONFIG_MMTIMER=y
# CONFIG_TCG_TPM is not set
CONFIG_DEVPORT=y
# CONFIG_I2C is not set
+
+#
+# SPI support
+#
# CONFIG_SPI is not set
+# CONFIG_SPI_MASTER is not set
# CONFIG_W1 is not set
-CONFIG_POWER_SUPPLY=y
-# CONFIG_POWER_SUPPLY_DEBUG is not set
-# CONFIG_PDA_POWER is not set
-# CONFIG_BATTERY_DS2760 is not set
+# CONFIG_POWER_SUPPLY is not set
CONFIG_HWMON=y
# CONFIG_HWMON_VID is not set
-# CONFIG_SENSORS_I5K_AMB is not set
+# CONFIG_SENSORS_ABITUGURU is not set
# CONFIG_SENSORS_F71805F is not set
-# CONFIG_SENSORS_F71882FG is not set
-# CONFIG_SENSORS_IT87 is not set
-# CONFIG_SENSORS_PC87360 is not set
# CONFIG_SENSORS_PC87427 is not set
-# CONFIG_SENSORS_SIS5595 is not set
# CONFIG_SENSORS_SMSC47M1 is not set
# CONFIG_SENSORS_SMSC47B397 is not set
-# CONFIG_SENSORS_VIA686A is not set
# CONFIG_SENSORS_VT1211 is not set
-# CONFIG_SENSORS_VT8231 is not set
# CONFIG_SENSORS_W83627HF is not set
-# CONFIG_SENSORS_W83627EHF is not set
# CONFIG_HWMON_DEBUG_CHIP is not set
-CONFIG_THERMAL=m
-# CONFIG_THERMAL_HWMON is not set
-# CONFIG_WATCHDOG is not set
-
-#
-# Sonics Silicon Backplane
-#
-CONFIG_SSB_POSSIBLE=y
-# CONFIG_SSB is not set
#
# Multifunction device drivers
#
-# CONFIG_MFD_CORE is not set
# CONFIG_MFD_SM501 is not set
-# CONFIG_HTC_PASIC3 is not set
#
# Multimedia devices
#
-
-#
-# Multimedia core support
-#
# CONFIG_VIDEO_DEV is not set
# CONFIG_DVB_CORE is not set
-# CONFIG_VIDEO_MEDIA is not set
-
-#
-# Multimedia drivers
-#
CONFIG_DAB=y
# CONFIG_USB_DABUSB is not set
#
# Graphics support
#
-CONFIG_AGP=m
-CONFIG_AGP_I460=m
-CONFIG_AGP_HP_ZX1=m
-CONFIG_AGP_SGI_TIOCA=m
-CONFIG_DRM=m
-CONFIG_DRM_TDFX=m
-CONFIG_DRM_R128=m
-CONFIG_DRM_RADEON=m
-CONFIG_DRM_MGA=m
-CONFIG_DRM_SIS=m
-# CONFIG_DRM_VIA is not set
-# CONFIG_DRM_SAVAGE is not set
-# CONFIG_VGASTATE is not set
-# CONFIG_VIDEO_OUTPUT_CONTROL is not set
-# CONFIG_FB is not set
# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
#
# Display device support
#
# CONFIG_DISPLAY_SUPPORT is not set
+# CONFIG_VGASTATE is not set
+# CONFIG_FB is not set
#
# Console display driver support
@@ -1006,7 +836,15 @@ CONFIG_DRM_SIS=m
CONFIG_VGA_CONSOLE=y
# CONFIG_VGACON_SOFT_SCROLLBACK is not set
CONFIG_DUMMY_CONSOLE=y
+
+#
+# Sound
+#
CONFIG_SOUND=m
+
+#
+# Advanced Linux Sound Architecture
+#
CONFIG_SND=m
CONFIG_SND_TIMER=m
CONFIG_SND_PCM=m
@@ -1024,18 +862,22 @@ CONFIG_SND_SUPPORT_OLD_API=y
CONFIG_SND_VERBOSE_PROCFS=y
CONFIG_SND_VERBOSE_PRINTK=y
# CONFIG_SND_DEBUG is not set
-CONFIG_SND_VMASTER=y
+
+#
+# Generic devices
+#
CONFIG_SND_MPU401_UART=m
CONFIG_SND_OPL3_LIB=m
CONFIG_SND_AC97_CODEC=m
-CONFIG_SND_DRIVERS=y
CONFIG_SND_DUMMY=m
CONFIG_SND_VIRMIDI=m
CONFIG_SND_MTPAV=m
CONFIG_SND_SERIAL_U16550=m
CONFIG_SND_MPU401=m
-# CONFIG_SND_AC97_POWER_SAVE is not set
-CONFIG_SND_PCI=y
+
+#
+# PCI devices
+#
# CONFIG_SND_AD1889 is not set
# CONFIG_SND_ALS300 is not set
# CONFIG_SND_ALI5451 is not set
@@ -1044,12 +886,10 @@ CONFIG_SND_PCI=y
# CONFIG_SND_AU8810 is not set
# CONFIG_SND_AU8820 is not set
# CONFIG_SND_AU8830 is not set
-# CONFIG_SND_AW2 is not set
# CONFIG_SND_AZT3328 is not set
# CONFIG_SND_BT87X is not set
# CONFIG_SND_CA0106 is not set
# CONFIG_SND_CMIPCI is not set
-# CONFIG_SND_OXYGEN is not set
CONFIG_SND_CS4281=m
CONFIG_SND_CS46XX=m
CONFIG_SND_CS46XX_NEW_DSP=y
@@ -1072,10 +912,10 @@ CONFIG_SND_EMU10K1=m
# CONFIG_SND_ES1938 is not set
# CONFIG_SND_ES1968 is not set
CONFIG_SND_FM801=m
+# CONFIG_SND_FM801_TEA575X_BOOL is not set
# CONFIG_SND_HDA_INTEL is not set
# CONFIG_SND_HDSP is not set
# CONFIG_SND_HDSPM is not set
-# CONFIG_SND_HIFIER is not set
# CONFIG_SND_ICE1712 is not set
# CONFIG_SND_ICE1724 is not set
# CONFIG_SND_INTEL8X0 is not set
@@ -1093,19 +933,29 @@ CONFIG_SND_FM801=m
# CONFIG_SND_TRIDENT is not set
# CONFIG_SND_VIA82XX is not set
# CONFIG_SND_VIA82XX_MODEM is not set
-# CONFIG_SND_VIRTUOSO is not set
# CONFIG_SND_VX222 is not set
# CONFIG_SND_YMFPCI is not set
-CONFIG_SND_USB=y
+# CONFIG_SND_AC97_POWER_SAVE is not set
+
+#
+# USB devices
+#
# CONFIG_SND_USB_AUDIO is not set
# CONFIG_SND_USB_CAIAQ is not set
+
+#
+# System on Chip audio support
+#
# CONFIG_SND_SOC is not set
+
+#
+# Open Sound System
+#
# CONFIG_SOUND_PRIME is not set
CONFIG_AC97_BUS=m
CONFIG_HID_SUPPORT=y
CONFIG_HID=y
# CONFIG_HID_DEBUG is not set
-# CONFIG_HIDRAW is not set
#
# USB Input Devices
@@ -1126,7 +976,6 @@ CONFIG_USB_ARCH_HAS_OHCI=y
CONFIG_USB_ARCH_HAS_EHCI=y
CONFIG_USB=m
# CONFIG_USB_DEBUG is not set
-# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
#
# Miscellaneous USB options
@@ -1135,17 +984,17 @@ CONFIG_USB_DEVICEFS=y
CONFIG_USB_DEVICE_CLASS=y
# CONFIG_USB_DYNAMIC_MINORS is not set
# CONFIG_USB_SUSPEND is not set
+# CONFIG_USB_PERSIST is not set
# CONFIG_USB_OTG is not set
#
# USB Host Controller Drivers
#
-# CONFIG_USB_C67X00_HCD is not set
CONFIG_USB_EHCI_HCD=m
+# CONFIG_USB_EHCI_SPLIT_ISO is not set
# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
# CONFIG_USB_EHCI_TT_NEWSCHED is not set
# CONFIG_USB_ISP116X_HCD is not set
-# CONFIG_USB_ISP1760_HCD is not set
CONFIG_USB_OHCI_HCD=m
# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
@@ -1159,7 +1008,6 @@ CONFIG_USB_UHCI_HCD=m
#
# CONFIG_USB_ACM is not set
# CONFIG_USB_PRINTER is not set
-# CONFIG_USB_WDM is not set
#
# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
@@ -1179,9 +1027,7 @@ CONFIG_USB_STORAGE=m
# CONFIG_USB_STORAGE_SDDR55 is not set
# CONFIG_USB_STORAGE_JUMPSHOT is not set
# CONFIG_USB_STORAGE_ALAUDA is not set
-# CONFIG_USB_STORAGE_ONETOUCH is not set
# CONFIG_USB_STORAGE_KARMA is not set
-# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
# CONFIG_USB_LIBUSUAL is not set
#
@@ -1194,6 +1040,10 @@ CONFIG_USB_MON=y
#
# USB port drivers
#
+
+#
+# USB Serial Converter support
+#
# CONFIG_USB_SERIAL is not set
#
@@ -1219,32 +1069,67 @@ CONFIG_USB_MON=y
# CONFIG_USB_TRANCEVIBRATOR is not set
# CONFIG_USB_IOWARRIOR is not set
# CONFIG_USB_TEST is not set
-# CONFIG_USB_ISIGHTFW is not set
+
+#
+# USB DSL modem support
+#
+
+#
+# USB Gadget Support
+#
# CONFIG_USB_GADGET is not set
# CONFIG_MMC is not set
-# CONFIG_MEMSTICK is not set
+
+#
+# LED devices
+#
# CONFIG_NEW_LEDS is not set
-# CONFIG_ACCESSIBILITY is not set
+
+#
+# LED drivers
+#
+
+#
+# LED Triggers
+#
CONFIG_INFINIBAND=m
# CONFIG_INFINIBAND_USER_MAD is not set
# CONFIG_INFINIBAND_USER_ACCESS is not set
CONFIG_INFINIBAND_ADDR_TRANS=y
CONFIG_INFINIBAND_MTHCA=m
CONFIG_INFINIBAND_MTHCA_DEBUG=y
-# CONFIG_INFINIBAND_IPATH is not set
# CONFIG_INFINIBAND_AMSO1100 is not set
# CONFIG_MLX4_INFINIBAND is not set
-# CONFIG_INFINIBAND_NES is not set
CONFIG_INFINIBAND_IPOIB=m
# CONFIG_INFINIBAND_IPOIB_CM is not set
CONFIG_INFINIBAND_IPOIB_DEBUG=y
# CONFIG_INFINIBAND_IPOIB_DEBUG_DATA is not set
# CONFIG_INFINIBAND_SRP is not set
# CONFIG_INFINIBAND_ISER is not set
+
+#
+# Real Time Clock
+#
# CONFIG_RTC_CLASS is not set
-# CONFIG_DMADEVICES is not set
+
+#
+# DMA Engine support
+#
+# CONFIG_DMA_ENGINE is not set
+
+#
+# DMA Clients
+#
+
+#
+# DMA Devices
+#
+
+#
+# Userspace I/O
+#
# CONFIG_UIO is not set
-CONFIG_MSPEC=m
+# CONFIG_MSPEC is not set
#
# File systems
@@ -1260,6 +1145,7 @@ CONFIG_EXT3_FS_POSIX_ACL=y
CONFIG_EXT3_FS_SECURITY=y
# CONFIG_EXT4DEV_FS is not set
CONFIG_JBD=y
+# CONFIG_JBD_DEBUG is not set
CONFIG_FS_MBCACHE=y
CONFIG_REISERFS_FS=y
# CONFIG_REISERFS_CHECK is not set
@@ -1271,15 +1157,17 @@ CONFIG_REISERFS_FS_SECURITY=y
CONFIG_FS_POSIX_ACL=y
CONFIG_XFS_FS=y
# CONFIG_XFS_QUOTA is not set
+# CONFIG_XFS_SECURITY is not set
# CONFIG_XFS_POSIX_ACL is not set
# CONFIG_XFS_RT is not set
-# CONFIG_XFS_DEBUG is not set
# CONFIG_GFS2_FS is not set
# CONFIG_OCFS2_FS is not set
-CONFIG_DNOTIFY=y
+# CONFIG_MINIX_FS is not set
+# CONFIG_ROMFS_FS is not set
CONFIG_INOTIFY=y
CONFIG_INOTIFY_USER=y
# CONFIG_QUOTA is not set
+CONFIG_DNOTIFY=y
CONFIG_AUTOFS_FS=y
CONFIG_AUTOFS4_FS=y
# CONFIG_FUSE_FS is not set
@@ -1317,6 +1205,7 @@ CONFIG_TMPFS=y
# CONFIG_TMPFS_POSIX_ACL is not set
CONFIG_HUGETLBFS=y
CONFIG_HUGETLB_PAGE=y
+CONFIG_RAMFS=y
# CONFIG_CONFIGFS_FS is not set
#
@@ -1331,30 +1220,32 @@ CONFIG_HUGETLB_PAGE=y
# CONFIG_EFS_FS is not set
# CONFIG_CRAMFS is not set
# CONFIG_VXFS_FS is not set
-# CONFIG_MINIX_FS is not set
-# CONFIG_OMFS_FS is not set
# CONFIG_HPFS_FS is not set
# CONFIG_QNX4FS_FS is not set
-# CONFIG_ROMFS_FS is not set
# CONFIG_SYSV_FS is not set
# CONFIG_UFS_FS is not set
-CONFIG_NETWORK_FILESYSTEMS=y
+
+#
+# Network File Systems
+#
CONFIG_NFS_FS=m
CONFIG_NFS_V3=y
# CONFIG_NFS_V3_ACL is not set
CONFIG_NFS_V4=y
+CONFIG_NFS_DIRECTIO=y
CONFIG_NFSD=m
CONFIG_NFSD_V3=y
# CONFIG_NFSD_V3_ACL is not set
CONFIG_NFSD_V4=y
+CONFIG_NFSD_TCP=y
CONFIG_LOCKD=m
CONFIG_LOCKD_V4=y
CONFIG_EXPORTFS=m
CONFIG_NFS_COMMON=y
CONFIG_SUNRPC=m
CONFIG_SUNRPC_GSS=m
-CONFIG_SUNRPC_XPRT_RDMA=m
-CONFIG_RPCSEC_GSS_KRB5=m
+# CONFIG_SUNRPC_BIND34 is not set
+CONFIG_RPCSEC_GSS_KRB5=y
# CONFIG_RPCSEC_GSS_SPKM3 is not set
CONFIG_SMB_FS=m
CONFIG_SMB_NLS_DEFAULT=y
@@ -1390,6 +1281,10 @@ CONFIG_SGI_PARTITION=y
# CONFIG_KARMA_PARTITION is not set
CONFIG_EFI_PARTITION=y
# CONFIG_SYSV68_PARTITION is not set
+
+#
+# Native Language Support
+#
CONFIG_NLS=y
CONFIG_NLS_DEFAULT="iso8859-1"
CONFIG_NLS_CODEPAGE_437=y
@@ -1430,24 +1325,22 @@ CONFIG_NLS_ISO8859_15=m
CONFIG_NLS_KOI8_R=m
CONFIG_NLS_KOI8_U=m
CONFIG_NLS_UTF8=m
+
+#
+# Distributed Lock Manager
+#
# CONFIG_DLM is not set
-CONFIG_HAVE_KVM=y
-CONFIG_VIRTUALIZATION=y
-# CONFIG_KVM is not set
#
# Library routines
#
CONFIG_BITREVERSE=y
-# CONFIG_GENERIC_FIND_FIRST_BIT is not set
# CONFIG_CRC_CCITT is not set
# CONFIG_CRC16 is not set
-CONFIG_CRC_T10DIF=y
-CONFIG_CRC_ITU_T=m
+# CONFIG_CRC_ITU_T is not set
CONFIG_CRC32=y
# CONFIG_CRC7 is not set
# CONFIG_LIBCRC32C is not set
-CONFIG_GENERIC_ALLOCATOR=y
CONFIG_PLIST=y
CONFIG_HAS_IOMEM=y
CONFIG_HAS_IOPORT=y
@@ -1464,13 +1357,17 @@ CONFIG_IRQ_PER_CPU=y
# CONFIG_HP_SIMSERIAL is not set
# CONFIG_HP_SIMSCSI is not set
+#
+# Instrumentation Support
+#
+# CONFIG_PROFILING is not set
+# CONFIG_KPROBES is not set
+
#
# Kernel hacking
#
# CONFIG_PRINTK_TIME is not set
-CONFIG_ENABLE_WARN_DEPRECATED=y
CONFIG_ENABLE_MUST_CHECK=y
-CONFIG_FRAME_WARN=2048
CONFIG_MAGIC_SYSRQ=y
# CONFIG_UNUSED_SYMBOLS is not set
# CONFIG_DEBUG_FS is not set
@@ -1478,14 +1375,10 @@ CONFIG_MAGIC_SYSRQ=y
CONFIG_DEBUG_KERNEL=y
# CONFIG_DEBUG_SHIRQ is not set
CONFIG_DETECT_SOFTLOCKUP=y
-# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
-CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
CONFIG_SCHED_DEBUG=y
# CONFIG_SCHEDSTATS is not set
# CONFIG_TIMER_STATS is not set
-# CONFIG_DEBUG_OBJECTS is not set
-# CONFIG_SLUB_DEBUG_ON is not set
-# CONFIG_SLUB_STATS is not set
+# CONFIG_DEBUG_SLAB is not set
# CONFIG_DEBUG_RT_MUTEXES is not set
# CONFIG_RT_MUTEX_TESTER is not set
# CONFIG_DEBUG_SPINLOCK is not set
@@ -1495,15 +1388,10 @@ CONFIG_DEBUG_MUTEXES=y
# CONFIG_DEBUG_KOBJECT is not set
# CONFIG_DEBUG_INFO is not set
# CONFIG_DEBUG_VM is not set
-# CONFIG_DEBUG_WRITECOUNT is not set
-CONFIG_DEBUG_MEMORY_INIT=y
# CONFIG_DEBUG_LIST is not set
-# CONFIG_DEBUG_SG is not set
-# CONFIG_BOOT_PRINTK_DELAY is not set
+CONFIG_FORCED_INLINING=y
# CONFIG_RCU_TORTURE_TEST is not set
-# CONFIG_BACKTRACE_SELF_TEST is not set
# CONFIG_FAULT_INJECTION is not set
-# CONFIG_SAMPLES is not set
CONFIG_IA64_GRANULE_16MB=y
# CONFIG_IA64_GRANULE_64MB is not set
# CONFIG_IA64_PRINT_HAZARDS is not set
@@ -1517,85 +1405,41 @@ CONFIG_SYSVIPC_COMPAT=y
#
# CONFIG_KEYS is not set
# CONFIG_SECURITY is not set
-# CONFIG_SECURITY_FILE_CAPABILITIES is not set
CONFIG_CRYPTO=y
-
-#
-# Crypto core or helper
-#
CONFIG_CRYPTO_ALGAPI=y
CONFIG_CRYPTO_BLKCIPHER=m
CONFIG_CRYPTO_MANAGER=m
-# CONFIG_CRYPTO_GF128MUL is not set
-# CONFIG_CRYPTO_NULL is not set
-# CONFIG_CRYPTO_CRYPTD is not set
-# CONFIG_CRYPTO_AUTHENC is not set
-# CONFIG_CRYPTO_TEST is not set
-
-#
-# Authenticated Encryption with Associated Data
-#
-# CONFIG_CRYPTO_CCM is not set
-# CONFIG_CRYPTO_GCM is not set
-# CONFIG_CRYPTO_SEQIV is not set
-
-#
-# Block modes
-#
-CONFIG_CRYPTO_CBC=m
-# CONFIG_CRYPTO_CTR is not set
-# CONFIG_CRYPTO_CTS is not set
-CONFIG_CRYPTO_ECB=m
-# CONFIG_CRYPTO_LRW is not set
-CONFIG_CRYPTO_PCBC=m
-# CONFIG_CRYPTO_XTS is not set
-
-#
-# Hash modes
-#
# CONFIG_CRYPTO_HMAC is not set
# CONFIG_CRYPTO_XCBC is not set
-
-#
-# Digest
-#
-# CONFIG_CRYPTO_CRC32C is not set
+# CONFIG_CRYPTO_NULL is not set
# CONFIG_CRYPTO_MD4 is not set
CONFIG_CRYPTO_MD5=y
-# CONFIG_CRYPTO_MICHAEL_MIC is not set
-# CONFIG_CRYPTO_RMD128 is not set
-# CONFIG_CRYPTO_RMD160 is not set
-# CONFIG_CRYPTO_RMD256 is not set
-# CONFIG_CRYPTO_RMD320 is not set
# CONFIG_CRYPTO_SHA1 is not set
# CONFIG_CRYPTO_SHA256 is not set
# CONFIG_CRYPTO_SHA512 is not set
-# CONFIG_CRYPTO_TGR192 is not set
# CONFIG_CRYPTO_WP512 is not set
-
-#
-# Ciphers
-#
-# CONFIG_CRYPTO_AES is not set
-# CONFIG_CRYPTO_ANUBIS is not set
-# CONFIG_CRYPTO_ARC4 is not set
-# CONFIG_CRYPTO_BLOWFISH is not set
-# CONFIG_CRYPTO_CAMELLIA is not set
-# CONFIG_CRYPTO_CAST5 is not set
-# CONFIG_CRYPTO_CAST6 is not set
+# CONFIG_CRYPTO_TGR192 is not set
+# CONFIG_CRYPTO_GF128MUL is not set
+CONFIG_CRYPTO_ECB=m
+CONFIG_CRYPTO_CBC=m
+CONFIG_CRYPTO_PCBC=m
+# CONFIG_CRYPTO_LRW is not set
+# CONFIG_CRYPTO_CRYPTD is not set
CONFIG_CRYPTO_DES=m
# CONFIG_CRYPTO_FCRYPT is not set
-# CONFIG_CRYPTO_KHAZAD is not set
-# CONFIG_CRYPTO_SALSA20 is not set
-# CONFIG_CRYPTO_SEED is not set
+# CONFIG_CRYPTO_BLOWFISH is not set
+# CONFIG_CRYPTO_TWOFISH is not set
# CONFIG_CRYPTO_SERPENT is not set
+# CONFIG_CRYPTO_AES is not set
+# CONFIG_CRYPTO_CAST5 is not set
+# CONFIG_CRYPTO_CAST6 is not set
# CONFIG_CRYPTO_TEA is not set
-# CONFIG_CRYPTO_TWOFISH is not set
-
-#
-# Compression
-#
+# CONFIG_CRYPTO_ARC4 is not set
+# CONFIG_CRYPTO_KHAZAD is not set
+# CONFIG_CRYPTO_ANUBIS is not set
# CONFIG_CRYPTO_DEFLATE is not set
-# CONFIG_CRYPTO_LZO is not set
+# CONFIG_CRYPTO_MICHAEL_MIC is not set
+# CONFIG_CRYPTO_CRC32C is not set
+# CONFIG_CRYPTO_CAMELLIA is not set
+# CONFIG_CRYPTO_TEST is not set
CONFIG_CRYPTO_HW=y
-# CONFIG_CRYPTO_DEV_HIFN_795X is not set
diff --git a/trunk/arch/ia64/kernel/.gitignore b/trunk/arch/ia64/kernel/.gitignore
index 21cb0da5ded8..98307759a3b8 100644
--- a/trunk/arch/ia64/kernel/.gitignore
+++ b/trunk/arch/ia64/kernel/.gitignore
@@ -1,2 +1 @@
gate.lds
-vmlinux.lds
diff --git a/trunk/arch/ia64/kernel/ivt.S b/trunk/arch/ia64/kernel/ivt.S
index 416a952b19bd..c39627df3cde 100644
--- a/trunk/arch/ia64/kernel/ivt.S
+++ b/trunk/arch/ia64/kernel/ivt.S
@@ -1243,11 +1243,11 @@ ENTRY(speculation_vector)
add r17=r17,r18 // now add the offset
;;
- MOV_TO_IIP(r17, r19)
+ MOV_FROM_IIP(r17)
dep r16=0,r16,41,2 // clear EI
;;
- MOV_TO_IPSR(p0, r16, r19)
+ MOV_FROM_IPSR(p0, r16)
;;
RFI
diff --git a/trunk/arch/powerpc/platforms/iseries/Kconfig b/trunk/arch/powerpc/platforms/iseries/Kconfig
index 45ffd8e542f4..ea3e541ac74f 100644
--- a/trunk/arch/powerpc/platforms/iseries/Kconfig
+++ b/trunk/arch/powerpc/platforms/iseries/Kconfig
@@ -7,6 +7,15 @@ config PPC_ISERIES
menu "iSeries device drivers"
depends on PPC_ISERIES
+config VIOCONS
+ bool "iSeries Virtual Console Support (Obsolete)"
+ depends on !HVC_ISERIES
+ default n
+ help
+ This is the old virtual console driver for legacy iSeries.
+ You should use the iSeries Hypervisor Virtual Console
+ support instead.
+
config VIODASD
tristate "iSeries Virtual I/O disk support"
help
@@ -29,5 +38,5 @@ endmenu
config VIOPATH
bool
- depends on VIODASD || VIOCD || VIOTAPE || ISERIES_VETH
+ depends on VIOCONS || VIODASD || VIOCD || VIOTAPE || ISERIES_VETH
default y
diff --git a/trunk/crypto/async_tx/async_xor.c b/trunk/crypto/async_tx/async_xor.c
index c029d3eb9ef0..65974c6d3d7a 100644
--- a/trunk/crypto/async_tx/async_xor.c
+++ b/trunk/crypto/async_tx/async_xor.c
@@ -263,12 +263,11 @@ async_xor_zero_sum(struct page *dest, struct page **src_list,
if (unlikely(!tx)) {
async_tx_quiesce(&depend_tx);
- while (!tx) {
+ while (!tx)
dma_async_issue_pending(chan);
tx = device->device_prep_dma_zero_sum(chan,
dma_src, src_cnt, len, result,
dma_prep_flags);
- }
}
async_tx_submit(chan, tx, flags, depend_tx, cb_fn, cb_param);
diff --git a/trunk/drivers/block/cciss.c b/trunk/drivers/block/cciss.c
index 0ce0c279aabf..aeaf465922e5 100644
--- a/trunk/drivers/block/cciss.c
+++ b/trunk/drivers/block/cciss.c
@@ -1134,7 +1134,7 @@ static int cciss_ioctl(struct inode *inode, struct file *filep,
if (ioc->Request.Type.Direction == XFER_WRITE) {
if (copy_from_user
(buff[sg_used], data_ptr, sz)) {
- status = -ENOMEM;
+ status = -EFAULT;
goto cleanup1;
}
} else {
diff --git a/trunk/drivers/char/Kconfig b/trunk/drivers/char/Kconfig
index caff85149b9d..d0ac944e1696 100644
--- a/trunk/drivers/char/Kconfig
+++ b/trunk/drivers/char/Kconfig
@@ -8,7 +8,7 @@ config VT
bool "Virtual terminal" if EMBEDDED
depends on !S390
select INPUT
- default y
+ default y if !VIOCONS
---help---
If you say Y here, you will get support for terminal devices with
display and keyboard devices. These are called "virtual" because you
diff --git a/trunk/drivers/char/Makefile b/trunk/drivers/char/Makefile
index 6850f6da7576..8a161c30e1dc 100644
--- a/trunk/drivers/char/Makefile
+++ b/trunk/drivers/char/Makefile
@@ -55,6 +55,7 @@ obj-$(CONFIG_RAW_DRIVER) += raw.o
obj-$(CONFIG_SGI_SNSC) += snsc.o snsc_event.o
obj-$(CONFIG_MSPEC) += mspec.o
obj-$(CONFIG_MMTIMER) += mmtimer.o
+obj-$(CONFIG_VIOCONS) += viocons.o
obj-$(CONFIG_VIOTAPE) += viotape.o
obj-$(CONFIG_HVCS) += hvcs.o
obj-$(CONFIG_IBM_BSR) += bsr.o
diff --git a/trunk/drivers/char/amiserial.c b/trunk/drivers/char/amiserial.c
index 6e763e3f5a81..3530ff417a51 100644
--- a/trunk/drivers/char/amiserial.c
+++ b/trunk/drivers/char/amiserial.c
@@ -1254,7 +1254,7 @@ static int rs_break(struct tty_struct *tty, int break_state)
unsigned long flags;
if (serial_paranoia_check(info, tty->name, "rs_break"))
- return -EINVAL;
+ return;
local_irq_save(flags);
if (break_state == -1)
diff --git a/trunk/drivers/char/viocons.c b/trunk/drivers/char/viocons.c
new file mode 100644
index 000000000000..65fb848e1cce
--- /dev/null
+++ b/trunk/drivers/char/viocons.c
@@ -0,0 +1,1171 @@
+/* -*- linux-c -*-
+ *
+ * drivers/char/viocons.c
+ *
+ * iSeries Virtual Terminal
+ *
+ * Authors: Dave Boutcher
+ * Ryan Arnold
+ * Colin Devilbiss
+ * Stephen Rothwell
+ *
+ * (C) Copyright 2000, 2001, 2002, 2003, 2004 IBM Corporation
+ *
+ * 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) anyu later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+#ifdef CONFIG_VT
+#error You must turn off CONFIG_VT to use CONFIG_VIOCONS
+#endif
+
+#define VIOTTY_MAGIC (0x0DCB)
+#define VTTY_PORTS 10
+
+#define VIOCONS_KERN_WARN KERN_WARNING "viocons: "
+#define VIOCONS_KERN_INFO KERN_INFO "viocons: "
+
+static DEFINE_SPINLOCK(consolelock);
+static DEFINE_SPINLOCK(consoleloglock);
+
+static int vio_sysrq_pressed;
+
+#define VIOCHAR_NUM_BUF 16
+
+/*
+ * Our port information. We store a pointer to one entry in the
+ * tty_driver_data
+ */
+static struct port_info {
+ int magic;
+ struct tty_struct *tty;
+ HvLpIndex lp;
+ u8 vcons;
+ u64 seq; /* sequence number of last HV send */
+ u64 ack; /* last ack from HV */
+/*
+ * When we get writes faster than we can send it to the partition,
+ * buffer the data here. Note that used is a bit map of used buffers.
+ * It had better have enough bits to hold VIOCHAR_NUM_BUF the bitops assume
+ * it is a multiple of unsigned long
+ */
+ unsigned long used;
+ u8 *buffer[VIOCHAR_NUM_BUF];
+ int bufferBytes[VIOCHAR_NUM_BUF];
+ int curbuf;
+ int bufferOverflow;
+ int overflowMessage;
+} port_info[VTTY_PORTS];
+
+#define viochar_is_console(pi) ((pi) == &port_info[0])
+#define viochar_port(pi) ((pi) - &port_info[0])
+
+static void initDataEvent(struct viocharlpevent *viochar, HvLpIndex lp);
+
+static struct tty_driver *viotty_driver;
+
+static void hvlog(char *fmt, ...)
+{
+ int i;
+ unsigned long flags;
+ va_list args;
+ static char buf[256];
+
+ spin_lock_irqsave(&consoleloglock, flags);
+ va_start(args, fmt);
+ i = vscnprintf(buf, sizeof(buf) - 1, fmt, args);
+ va_end(args);
+ buf[i++] = '\r';
+ HvCall_writeLogBuffer(buf, i);
+ spin_unlock_irqrestore(&consoleloglock, flags);
+}
+
+static void hvlogOutput(const char *buf, int count)
+{
+ unsigned long flags;
+ int begin;
+ int index;
+ static const char cr = '\r';
+
+ begin = 0;
+ spin_lock_irqsave(&consoleloglock, flags);
+ for (index = 0; index < count; index++) {
+ if (buf[index] == '\n') {
+ /*
+ * Start right after the last '\n' or at the zeroth
+ * array position and output the number of characters
+ * including the newline.
+ */
+ HvCall_writeLogBuffer(&buf[begin], index - begin + 1);
+ begin = index + 1;
+ HvCall_writeLogBuffer(&cr, 1);
+ }
+ }
+ if ((index - begin) > 0)
+ HvCall_writeLogBuffer(&buf[begin], index - begin);
+ spin_unlock_irqrestore(&consoleloglock, flags);
+}
+
+/*
+ * Make sure we're pointing to a valid port_info structure. Shamelessly
+ * plagerized from serial.c
+ */
+static inline int viotty_paranoia_check(struct port_info *pi,
+ char *name, const char *routine)
+{
+ static const char *bad_pi_addr = VIOCONS_KERN_WARN
+ "warning: bad address for port_info struct (%s) in %s\n";
+ static const char *badmagic = VIOCONS_KERN_WARN
+ "warning: bad magic number for port_info struct (%s) in %s\n";
+
+ if ((pi < &port_info[0]) || (viochar_port(pi) > VTTY_PORTS)) {
+ printk(bad_pi_addr, name, routine);
+ return 1;
+ }
+ if (pi->magic != VIOTTY_MAGIC) {
+ printk(badmagic, name, routine);
+ return 1;
+ }
+ return 0;
+}
+
+/*
+ * Add data to our pending-send buffers.
+ *
+ * NOTE: Don't use printk in here because it gets nastily recursive.
+ * hvlog can be used to log to the hypervisor buffer
+ */
+static int buffer_add(struct port_info *pi, const char *buf, size_t len)
+{
+ size_t bleft;
+ size_t curlen;
+ const char *curbuf;
+ int nextbuf;
+
+ curbuf = buf;
+ bleft = len;
+ while (bleft > 0) {
+ /*
+ * If there is no space left in the current buffer, we have
+ * filled everything up, so return. If we filled the previous
+ * buffer we would already have moved to the next one.
+ */
+ if (pi->bufferBytes[pi->curbuf] == VIOCHAR_MAX_DATA) {
+ hvlog ("\n\rviocons: No overflow buffer available for memcpy().\n");
+ pi->bufferOverflow++;
+ pi->overflowMessage = 1;
+ break;
+ }
+
+ /*
+ * Turn on the "used" bit for this buffer. If it's already on,
+ * that's fine.
+ */
+ set_bit(pi->curbuf, &pi->used);
+
+ /*
+ * See if this buffer has been allocated. If not, allocate it.
+ */
+ if (pi->buffer[pi->curbuf] == NULL) {
+ pi->buffer[pi->curbuf] =
+ kmalloc(VIOCHAR_MAX_DATA, GFP_ATOMIC);
+ if (pi->buffer[pi->curbuf] == NULL) {
+ hvlog("\n\rviocons: kmalloc failed allocating spaces for buffer %d.",
+ pi->curbuf);
+ break;
+ }
+ }
+
+ /* Figure out how much we can copy into this buffer. */
+ if (bleft < (VIOCHAR_MAX_DATA - pi->bufferBytes[pi->curbuf]))
+ curlen = bleft;
+ else
+ curlen = VIOCHAR_MAX_DATA - pi->bufferBytes[pi->curbuf];
+
+ /* Copy the data into the buffer. */
+ memcpy(pi->buffer[pi->curbuf] + pi->bufferBytes[pi->curbuf],
+ curbuf, curlen);
+
+ pi->bufferBytes[pi->curbuf] += curlen;
+ curbuf += curlen;
+ bleft -= curlen;
+
+ /*
+ * Now see if we've filled this buffer. If not then
+ * we'll try to use it again later. If we've filled it
+ * up then we'll advance the curbuf to the next in the
+ * circular queue.
+ */
+ if (pi->bufferBytes[pi->curbuf] == VIOCHAR_MAX_DATA) {
+ nextbuf = (pi->curbuf + 1) % VIOCHAR_NUM_BUF;
+ /*
+ * Move to the next buffer if it hasn't been used yet
+ */
+ if (test_bit(nextbuf, &pi->used) == 0)
+ pi->curbuf = nextbuf;
+ }
+ }
+ return len - bleft;
+}
+
+/*
+ * Send pending data
+ *
+ * NOTE: Don't use printk in here because it gets nastily recursive.
+ * hvlog can be used to log to the hypervisor buffer
+ */
+static void send_buffers(struct port_info *pi)
+{
+ HvLpEvent_Rc hvrc;
+ int nextbuf;
+ struct viocharlpevent *viochar;
+ unsigned long flags;
+
+ spin_lock_irqsave(&consolelock, flags);
+
+ viochar = (struct viocharlpevent *)
+ vio_get_event_buffer(viomajorsubtype_chario);
+
+ /* Make sure we got a buffer */
+ if (viochar == NULL) {
+ hvlog("\n\rviocons: Can't get viochar buffer in sendBuffers().");
+ spin_unlock_irqrestore(&consolelock, flags);
+ return;
+ }
+
+ if (pi->used == 0) {
+ hvlog("\n\rviocons: in sendbuffers(), but no buffers used.\n");
+ vio_free_event_buffer(viomajorsubtype_chario, viochar);
+ spin_unlock_irqrestore(&consolelock, flags);
+ return;
+ }
+
+ /*
+ * curbuf points to the buffer we're filling. We want to
+ * start sending AFTER this one.
+ */
+ nextbuf = (pi->curbuf + 1) % VIOCHAR_NUM_BUF;
+
+ /*
+ * Loop until we find a buffer with the used bit on
+ */
+ while (test_bit(nextbuf, &pi->used) == 0)
+ nextbuf = (nextbuf + 1) % VIOCHAR_NUM_BUF;
+
+ initDataEvent(viochar, pi->lp);
+
+ /*
+ * While we have buffers with data, and our send window
+ * is open, send them
+ */
+ while ((test_bit(nextbuf, &pi->used)) &&
+ ((pi->seq - pi->ack) < VIOCHAR_WINDOW)) {
+ viochar->len = pi->bufferBytes[nextbuf];
+ viochar->event.xCorrelationToken = pi->seq++;
+ viochar->event.xSizeMinus1 =
+ offsetof(struct viocharlpevent, data) + viochar->len;
+
+ memcpy(viochar->data, pi->buffer[nextbuf], viochar->len);
+
+ hvrc = HvCallEvent_signalLpEvent(&viochar->event);
+ if (hvrc) {
+ /*
+ * MUST unlock the spinlock before doing a printk
+ */
+ vio_free_event_buffer(viomajorsubtype_chario, viochar);
+ spin_unlock_irqrestore(&consolelock, flags);
+
+ printk(VIOCONS_KERN_WARN
+ "error sending event! return code %d\n",
+ (int)hvrc);
+ return;
+ }
+
+ /*
+ * clear the used bit, zero the number of bytes in
+ * this buffer, and move to the next buffer
+ */
+ clear_bit(nextbuf, &pi->used);
+ pi->bufferBytes[nextbuf] = 0;
+ nextbuf = (nextbuf + 1) % VIOCHAR_NUM_BUF;
+ }
+
+ /*
+ * If we have emptied all the buffers, start at 0 again.
+ * this will re-use any allocated buffers
+ */
+ if (pi->used == 0) {
+ pi->curbuf = 0;
+
+ if (pi->overflowMessage)
+ pi->overflowMessage = 0;
+
+ if (pi->tty) {
+ tty_wakeup(pi->tty);
+ }
+ }
+
+ vio_free_event_buffer(viomajorsubtype_chario, viochar);
+ spin_unlock_irqrestore(&consolelock, flags);
+}
+
+/*
+ * Our internal writer. Gets called both from the console device and
+ * the tty device. the tty pointer will be NULL if called from the console.
+ * Return total number of bytes "written".
+ *
+ * NOTE: Don't use printk in here because it gets nastily recursive. hvlog
+ * can be used to log to the hypervisor buffer
+ */
+static int internal_write(struct port_info *pi, const char *buf, size_t len)
+{
+ HvLpEvent_Rc hvrc;
+ size_t bleft;
+ size_t curlen;
+ const char *curbuf;
+ unsigned long flags;
+ struct viocharlpevent *viochar;
+
+ /*
+ * Write to the hvlog of inbound data are now done prior to
+ * calling internal_write() since internal_write() is only called in
+ * the event that an lp event path is active, which isn't the case for
+ * logging attempts prior to console initialization.
+ *
+ * If there is already data queued for this port, send it prior to
+ * attempting to send any new data.
+ */
+ if (pi->used)
+ send_buffers(pi);
+
+ spin_lock_irqsave(&consolelock, flags);
+
+ viochar = vio_get_event_buffer(viomajorsubtype_chario);
+ if (viochar == NULL) {
+ spin_unlock_irqrestore(&consolelock, flags);
+ hvlog("\n\rviocons: Can't get vio buffer in internal_write().");
+ return -EAGAIN;
+ }
+ initDataEvent(viochar, pi->lp);
+
+ curbuf = buf;
+ bleft = len;
+
+ while ((bleft > 0) && (pi->used == 0) &&
+ ((pi->seq - pi->ack) < VIOCHAR_WINDOW)) {
+ if (bleft > VIOCHAR_MAX_DATA)
+ curlen = VIOCHAR_MAX_DATA;
+ else
+ curlen = bleft;
+
+ viochar->event.xCorrelationToken = pi->seq++;
+ memcpy(viochar->data, curbuf, curlen);
+ viochar->len = curlen;
+ viochar->event.xSizeMinus1 =
+ offsetof(struct viocharlpevent, data) + curlen;
+
+ hvrc = HvCallEvent_signalLpEvent(&viochar->event);
+ if (hvrc) {
+ hvlog("viocons: error sending event! %d\n", (int)hvrc);
+ goto out;
+ }
+ curbuf += curlen;
+ bleft -= curlen;
+ }
+
+ /* If we didn't send it all, buffer as much of it as we can. */
+ if (bleft > 0)
+ bleft -= buffer_add(pi, curbuf, bleft);
+out:
+ vio_free_event_buffer(viomajorsubtype_chario, viochar);
+ spin_unlock_irqrestore(&consolelock, flags);
+ return len - bleft;
+}
+
+static struct port_info *get_port_data(struct tty_struct *tty)
+{
+ unsigned long flags;
+ struct port_info *pi;
+
+ spin_lock_irqsave(&consolelock, flags);
+ if (tty) {
+ pi = (struct port_info *)tty->driver_data;
+ if (!pi || viotty_paranoia_check(pi, tty->name,
+ "get_port_data")) {
+ pi = NULL;
+ }
+ } else
+ /*
+ * If this is the console device, use the lp from
+ * the first port entry
+ */
+ pi = &port_info[0];
+ spin_unlock_irqrestore(&consolelock, flags);
+ return pi;
+}
+
+/*
+ * Initialize the common fields in a charLpEvent
+ */
+static void initDataEvent(struct viocharlpevent *viochar, HvLpIndex lp)
+{
+ struct HvLpEvent *hev = &viochar->event;
+
+ memset(viochar, 0, sizeof(struct viocharlpevent));
+
+ hev->flags = HV_LP_EVENT_VALID | HV_LP_EVENT_DEFERRED_ACK |
+ HV_LP_EVENT_INT;
+ hev->xType = HvLpEvent_Type_VirtualIo;
+ hev->xSubtype = viomajorsubtype_chario | viochardata;
+ hev->xSourceLp = HvLpConfig_getLpIndex();
+ hev->xTargetLp = lp;
+ hev->xSizeMinus1 = sizeof(struct viocharlpevent);
+ hev->xSourceInstanceId = viopath_sourceinst(lp);
+ hev->xTargetInstanceId = viopath_targetinst(lp);
+}
+
+/*
+ * early console device write
+ */
+static void viocons_write_early(struct console *co, const char *s, unsigned count)
+{
+ hvlogOutput(s, count);
+}
+
+/*
+ * console device write
+ */
+static void viocons_write(struct console *co, const char *s, unsigned count)
+{
+ int index;
+ int begin;
+ struct port_info *pi;
+
+ static const char cr = '\r';
+
+ /*
+ * Check port data first because the target LP might be valid but
+ * simply not active, in which case we want to hvlog the output.
+ */
+ pi = get_port_data(NULL);
+ if (pi == NULL) {
+ hvlog("\n\rviocons_write: unable to get port data.");
+ return;
+ }
+
+ hvlogOutput(s, count);
+
+ if (!viopath_isactive(pi->lp))
+ return;
+
+ /*
+ * Any newline character found will cause a
+ * carriage return character to be emitted as well.
+ */
+ begin = 0;
+ for (index = 0; index < count; index++) {
+ if (s[index] == '\n') {
+ /*
+ * Newline found. Print everything up to and
+ * including the newline
+ */
+ internal_write(pi, &s[begin], index - begin + 1);
+ begin = index + 1;
+ /* Emit a carriage return as well */
+ internal_write(pi, &cr, 1);
+ }
+ }
+
+ /* If any characters left to write, write them now */
+ if ((index - begin) > 0)
+ internal_write(pi, &s[begin], index - begin);
+}
+
+/*
+ * Work out the device associate with this console
+ */
+static struct tty_driver *viocons_device(struct console *c, int *index)
+{
+ *index = c->index;
+ return viotty_driver;
+}
+
+/*
+ * console device I/O methods
+ */
+static struct console viocons_early = {
+ .name = "viocons",
+ .write = viocons_write_early,
+ .flags = CON_PRINTBUFFER,
+ .index = -1,
+};
+
+static struct console viocons = {
+ .name = "viocons",
+ .write = viocons_write,
+ .device = viocons_device,
+ .flags = CON_PRINTBUFFER,
+ .index = -1,
+};
+
+/*
+ * TTY Open method
+ */
+static int viotty_open(struct tty_struct *tty, struct file *filp)
+{
+ int port;
+ unsigned long flags;
+ struct port_info *pi;
+
+ port = tty->index;
+
+ if ((port < 0) || (port >= VTTY_PORTS))
+ return -ENODEV;
+
+ spin_lock_irqsave(&consolelock, flags);
+
+ pi = &port_info[port];
+ /* If some other TTY is already connected here, reject the open */
+ if ((pi->tty) && (pi->tty != tty)) {
+ spin_unlock_irqrestore(&consolelock, flags);
+ printk(VIOCONS_KERN_WARN
+ "attempt to open device twice from different ttys\n");
+ return -EBUSY;
+ }
+ tty->driver_data = pi;
+ pi->tty = tty;
+ spin_unlock_irqrestore(&consolelock, flags);
+
+ return 0;
+}
+
+/*
+ * TTY Close method
+ */
+static void viotty_close(struct tty_struct *tty, struct file *filp)
+{
+ unsigned long flags;
+ struct port_info *pi;
+
+ spin_lock_irqsave(&consolelock, flags);
+ pi = (struct port_info *)tty->driver_data;
+
+ if (!pi || viotty_paranoia_check(pi, tty->name, "viotty_close")) {
+ spin_unlock_irqrestore(&consolelock, flags);
+ return;
+ }
+ if (tty->count == 1)
+ pi->tty = NULL;
+ spin_unlock_irqrestore(&consolelock, flags);
+}
+
+/*
+ * TTY Write method
+ */
+static int viotty_write(struct tty_struct *tty, const unsigned char *buf,
+ int count)
+{
+ struct port_info *pi;
+
+ pi = get_port_data(tty);
+ if (pi == NULL) {
+ hvlog("\n\rviotty_write: no port data.");
+ return -ENODEV;
+ }
+
+ if (viochar_is_console(pi))
+ hvlogOutput(buf, count);
+
+ /*
+ * If the path to this LP is closed, don't bother doing anything more.
+ * just dump the data on the floor and return count. For some reason
+ * some user level programs will attempt to probe available tty's and
+ * they'll attempt a viotty_write on an invalid port which maps to an
+ * invalid target lp. If this is the case then ignore the
+ * viotty_write call and, since the viopath isn't active to this
+ * partition, return count.
+ */
+ if (!viopath_isactive(pi->lp))
+ return count;
+
+ return internal_write(pi, buf, count);
+}
+
+/*
+ * TTY put_char method
+ */
+static int viotty_put_char(struct tty_struct *tty, unsigned char ch)
+{
+ struct port_info *pi;
+
+ pi = get_port_data(tty);
+ if (pi == NULL)
+ return 0;
+
+ /* This will append '\r' as well if the char is '\n' */
+ if (viochar_is_console(pi))
+ hvlogOutput(&ch, 1);
+
+ if (viopath_isactive(pi->lp))
+ internal_write(pi, &ch, 1);
+ return 1;
+}
+
+/*
+ * TTY write_room method
+ */
+static int viotty_write_room(struct tty_struct *tty)
+{
+ int i;
+ int room = 0;
+ struct port_info *pi;
+ unsigned long flags;
+
+ spin_lock_irqsave(&consolelock, flags);
+ pi = (struct port_info *)tty->driver_data;
+ if (!pi || viotty_paranoia_check(pi, tty->name, "viotty_write_room")) {
+ spin_unlock_irqrestore(&consolelock, flags);
+ return 0;
+ }
+
+ /* If no buffers are used, return the max size. */
+ if (pi->used == 0) {
+ spin_unlock_irqrestore(&consolelock, flags);
+ return VIOCHAR_MAX_DATA * VIOCHAR_NUM_BUF;
+ }
+
+ /*
+ * We retain the spinlock because we want to get an accurate
+ * count and it can change on us between each operation if we
+ * don't hold the spinlock.
+ */
+ for (i = 0; ((i < VIOCHAR_NUM_BUF) && (room < VIOCHAR_MAX_DATA)); i++)
+ room += (VIOCHAR_MAX_DATA - pi->bufferBytes[i]);
+ spin_unlock_irqrestore(&consolelock, flags);
+
+ if (room > VIOCHAR_MAX_DATA)
+ room = VIOCHAR_MAX_DATA;
+ return room;
+}
+
+/*
+ * TTY chars_in_buffer method
+ */
+static int viotty_chars_in_buffer(struct tty_struct *tty)
+{
+ return 0;
+}
+
+static int viotty_ioctl(struct tty_struct *tty, struct file *file,
+ unsigned int cmd, unsigned long arg)
+{
+ switch (cmd) {
+ /*
+ * the ioctls below read/set the flags usually shown in the leds
+ * don't use them - they will go away without warning
+ */
+ case KDGETLED:
+ case KDGKBLED:
+ return put_user(0, (char *)arg);
+
+ case KDSKBLED:
+ return 0;
+ }
+ /* FIXME: WTF is this being called for ??? */
+ lock_kernel();
+ ret = n_tty_ioctl(tty, file, cmd, arg);
+ unlock_kernel();
+ return ret;
+}
+
+/*
+ * Handle an open charLpEvent. Could be either interrupt or ack
+ */
+static void vioHandleOpenEvent(struct HvLpEvent *event)
+{
+ unsigned long flags;
+ struct viocharlpevent *cevent = (struct viocharlpevent *)event;
+ u8 port = cevent->virtual_device;
+ struct port_info *pi;
+ int reject = 0;
+
+ if (hvlpevent_is_ack(event)) {
+ if (port >= VTTY_PORTS)
+ return;
+
+ spin_lock_irqsave(&consolelock, flags);
+ /* Got the lock, don't cause console output */
+
+ pi = &port_info[port];
+ if (event->xRc == HvLpEvent_Rc_Good) {
+ pi->seq = pi->ack = 0;
+ /*
+ * This line allows connections from the primary
+ * partition but once one is connected from the
+ * primary partition nothing short of a reboot
+ * of linux will allow access from the hosting
+ * partition again without a required iSeries fix.
+ */
+ pi->lp = event->xTargetLp;
+ }
+
+ spin_unlock_irqrestore(&consolelock, flags);
+ if (event->xRc != HvLpEvent_Rc_Good)
+ printk(VIOCONS_KERN_WARN
+ "handle_open_event: event->xRc == (%d).\n",
+ event->xRc);
+
+ if (event->xCorrelationToken != 0) {
+ atomic_t *aptr= (atomic_t *)event->xCorrelationToken;
+ atomic_set(aptr, 1);
+ } else
+ printk(VIOCONS_KERN_WARN
+ "weird...got open ack without atomic\n");
+ return;
+ }
+
+ /* This had better require an ack, otherwise complain */
+ if (!hvlpevent_need_ack(event)) {
+ printk(VIOCONS_KERN_WARN "viocharopen without ack bit!\n");
+ return;
+ }
+
+ spin_lock_irqsave(&consolelock, flags);
+ /* Got the lock, don't cause console output */
+
+ /* Make sure this is a good virtual tty */
+ if (port >= VTTY_PORTS) {
+ event->xRc = HvLpEvent_Rc_SubtypeError;
+ cevent->subtype_result_code = viorc_openRejected;
+ /*
+ * Flag state here since we can't printk while holding
+ * a spinlock.
+ */
+ reject = 1;
+ } else {
+ pi = &port_info[port];
+ if ((pi->lp != HvLpIndexInvalid) &&
+ (pi->lp != event->xSourceLp)) {
+ /*
+ * If this is tty is already connected to a different
+ * partition, fail.
+ */
+ event->xRc = HvLpEvent_Rc_SubtypeError;
+ cevent->subtype_result_code = viorc_openRejected;
+ reject = 2;
+ } else {
+ pi->lp = event->xSourceLp;
+ event->xRc = HvLpEvent_Rc_Good;
+ cevent->subtype_result_code = viorc_good;
+ pi->seq = pi->ack = 0;
+ reject = 0;
+ }
+ }
+
+ spin_unlock_irqrestore(&consolelock, flags);
+
+ if (reject == 1)
+ printk(VIOCONS_KERN_WARN "open rejected: bad virtual tty.\n");
+ else if (reject == 2)
+ printk(VIOCONS_KERN_WARN
+ "open rejected: console in exclusive use by another partition.\n");
+
+ /* Return the acknowledgement */
+ HvCallEvent_ackLpEvent(event);
+}
+
+/*
+ * Handle a close charLpEvent. This should ONLY be an Interrupt because the
+ * virtual console should never actually issue a close event to the hypervisor
+ * because the virtual console never goes away. A close event coming from the
+ * hypervisor simply means that there are no client consoles connected to the
+ * virtual console.
+ *
+ * Regardless of the number of connections masqueraded on the other side of
+ * the hypervisor ONLY ONE close event should be called to accompany the ONE
+ * open event that is called. The close event should ONLY be called when NO
+ * MORE connections (masqueraded or not) exist on the other side of the
+ * hypervisor.
+ */
+static void vioHandleCloseEvent(struct HvLpEvent *event)
+{
+ unsigned long flags;
+ struct viocharlpevent *cevent = (struct viocharlpevent *)event;
+ u8 port = cevent->virtual_device;
+
+ if (hvlpevent_is_int(event)) {
+ if (port >= VTTY_PORTS) {
+ printk(VIOCONS_KERN_WARN
+ "close message from invalid virtual device.\n");
+ return;
+ }
+
+ /* For closes, just mark the console partition invalid */
+ spin_lock_irqsave(&consolelock, flags);
+ /* Got the lock, don't cause console output */
+
+ if (port_info[port].lp == event->xSourceLp)
+ port_info[port].lp = HvLpIndexInvalid;
+
+ spin_unlock_irqrestore(&consolelock, flags);
+ printk(VIOCONS_KERN_INFO "close from %d\n", event->xSourceLp);
+ } else
+ printk(VIOCONS_KERN_WARN
+ "got unexpected close acknowlegement\n");
+}
+
+/*
+ * Handle a config charLpEvent. Could be either interrupt or ack
+ */
+static void vioHandleConfig(struct HvLpEvent *event)
+{
+ struct viocharlpevent *cevent = (struct viocharlpevent *)event;
+
+ HvCall_writeLogBuffer(cevent->data, cevent->len);
+
+ if (cevent->data[0] == 0x01)
+ printk(VIOCONS_KERN_INFO "window resized to %d: %d: %d: %d\n",
+ cevent->data[1], cevent->data[2],
+ cevent->data[3], cevent->data[4]);
+ else
+ printk(VIOCONS_KERN_WARN "unknown config event\n");
+}
+
+/*
+ * Handle a data charLpEvent.
+ */
+static void vioHandleData(struct HvLpEvent *event)
+{
+ struct tty_struct *tty;
+ unsigned long flags;
+ struct viocharlpevent *cevent = (struct viocharlpevent *)event;
+ struct port_info *pi;
+ int index;
+ int num_pushed;
+ u8 port = cevent->virtual_device;
+
+ if (port >= VTTY_PORTS) {
+ printk(VIOCONS_KERN_WARN "data on invalid virtual device %d\n",
+ port);
+ return;
+ }
+
+ /*
+ * Hold the spinlock so that we don't take an interrupt that
+ * changes tty between the time we fetch the port_info
+ * pointer and the time we paranoia check.
+ */
+ spin_lock_irqsave(&consolelock, flags);
+ pi = &port_info[port];
+
+ /*
+ * Change 05/01/2003 - Ryan Arnold: If a partition other than
+ * the current exclusive partition tries to send us data
+ * events then just drop them on the floor because we don't
+ * want his stinking data. He isn't authorized to receive
+ * data because he wasn't the first one to get the console,
+ * therefore he shouldn't be allowed to send data either.
+ * This will work without an iSeries fix.
+ */
+ if (pi->lp != event->xSourceLp) {
+ spin_unlock_irqrestore(&consolelock, flags);
+ return;
+ }
+
+ tty = pi->tty;
+ if (tty == NULL) {
+ spin_unlock_irqrestore(&consolelock, flags);
+ printk(VIOCONS_KERN_WARN "no tty for virtual device %d\n",
+ port);
+ return;
+ }
+
+ if (tty->magic != TTY_MAGIC) {
+ spin_unlock_irqrestore(&consolelock, flags);
+ printk(VIOCONS_KERN_WARN "tty bad magic\n");
+ return;
+ }
+
+ /*
+ * Just to be paranoid, make sure the tty points back to this port
+ */
+ pi = (struct port_info *)tty->driver_data;
+ if (!pi || viotty_paranoia_check(pi, tty->name, "vioHandleData")) {
+ spin_unlock_irqrestore(&consolelock, flags);
+ return;
+ }
+ spin_unlock_irqrestore(&consolelock, flags);
+
+ /*
+ * Change 07/21/2003 - Ryan Arnold: functionality added to
+ * support sysrq utilizing ^O as the sysrq key. The sysrq
+ * functionality will only work if built into the kernel and
+ * then only if sysrq is enabled through the proc filesystem.
+ */
+ num_pushed = 0;
+ for (index = 0; index < cevent->len; index++) {
+ /*
+ * Will be optimized away if !CONFIG_MAGIC_SYSRQ:
+ */
+ if (sysrq_on()) {
+ /* 0x0f is the ascii character for ^O */
+ if (cevent->data[index] == '\x0f') {
+ vio_sysrq_pressed = 1;
+ /*
+ * continue because we don't want to add
+ * the sysrq key into the data string.
+ */
+ continue;
+ } else if (vio_sysrq_pressed) {
+ handle_sysrq(cevent->data[index], tty);
+ vio_sysrq_pressed = 0;
+ /*
+ * continue because we don't want to add
+ * the sysrq sequence into the data string.
+ */
+ continue;
+ }
+ }
+ /*
+ * The sysrq sequence isn't included in this check if
+ * sysrq is enabled and compiled into the kernel because
+ * the sequence will never get inserted into the buffer.
+ * Don't attempt to copy more data into the buffer than we
+ * have room for because it would fail without indication.
+ */
+ if(tty_insert_flip_char(tty, cevent->data[index], TTY_NORMAL) == 0) {
+ printk(VIOCONS_KERN_WARN "input buffer overflow!\n");
+ break;
+ }
+ num_pushed++;
+ }
+
+ if (num_pushed)
+ tty_flip_buffer_push(tty);
+}
+
+/*
+ * Handle an ack charLpEvent.
+ */
+static void vioHandleAck(struct HvLpEvent *event)
+{
+ struct viocharlpevent *cevent = (struct viocharlpevent *)event;
+ unsigned long flags;
+ u8 port = cevent->virtual_device;
+
+ if (port >= VTTY_PORTS) {
+ printk(VIOCONS_KERN_WARN "data on invalid virtual device\n");
+ return;
+ }
+
+ spin_lock_irqsave(&consolelock, flags);
+ port_info[port].ack = event->xCorrelationToken;
+ spin_unlock_irqrestore(&consolelock, flags);
+
+ if (port_info[port].used)
+ send_buffers(&port_info[port]);
+}
+
+/*
+ * Handle charLpEvents and route to the appropriate routine
+ */
+static void vioHandleCharEvent(struct HvLpEvent *event)
+{
+ int charminor;
+
+ if (event == NULL)
+ return;
+
+ charminor = event->xSubtype & VIOMINOR_SUBTYPE_MASK;
+ switch (charminor) {
+ case viocharopen:
+ vioHandleOpenEvent(event);
+ break;
+ case viocharclose:
+ vioHandleCloseEvent(event);
+ break;
+ case viochardata:
+ vioHandleData(event);
+ break;
+ case viocharack:
+ vioHandleAck(event);
+ break;
+ case viocharconfig:
+ vioHandleConfig(event);
+ break;
+ default:
+ if (hvlpevent_is_int(event) && hvlpevent_need_ack(event)) {
+ event->xRc = HvLpEvent_Rc_InvalidSubtype;
+ HvCallEvent_ackLpEvent(event);
+ }
+ }
+}
+
+/*
+ * Send an open event
+ */
+static int send_open(HvLpIndex remoteLp, void *sem)
+{
+ return HvCallEvent_signalLpEventFast(remoteLp,
+ HvLpEvent_Type_VirtualIo,
+ viomajorsubtype_chario | viocharopen,
+ HvLpEvent_AckInd_DoAck, HvLpEvent_AckType_ImmediateAck,
+ viopath_sourceinst(remoteLp),
+ viopath_targetinst(remoteLp),
+ (u64)(unsigned long)sem, VIOVERSION << 16,
+ 0, 0, 0, 0);
+}
+
+static const struct tty_operations serial_ops = {
+ .open = viotty_open,
+ .close = viotty_close,
+ .write = viotty_write,
+ .put_char = viotty_put_char,
+ .write_room = viotty_write_room,
+ .chars_in_buffer = viotty_chars_in_buffer,
+ .ioctl = viotty_ioctl,
+};
+
+static int __init viocons_init2(void)
+{
+ atomic_t wait_flag;
+ int rc;
+
+ if (!firmware_has_feature(FW_FEATURE_ISERIES))
+ return -ENODEV;
+
+ /* +2 for fudge */
+ rc = viopath_open(HvLpConfig_getPrimaryLpIndex(),
+ viomajorsubtype_chario, VIOCHAR_WINDOW + 2);
+ if (rc)
+ printk(VIOCONS_KERN_WARN "error opening to primary %d\n", rc);
+
+ if (viopath_hostLp == HvLpIndexInvalid)
+ vio_set_hostlp();
+
+ /*
+ * And if the primary is not the same as the hosting LP, open to the
+ * hosting lp
+ */
+ if ((viopath_hostLp != HvLpIndexInvalid) &&
+ (viopath_hostLp != HvLpConfig_getPrimaryLpIndex())) {
+ printk(VIOCONS_KERN_INFO "open path to hosting (%d)\n",
+ viopath_hostLp);
+ rc = viopath_open(viopath_hostLp, viomajorsubtype_chario,
+ VIOCHAR_WINDOW + 2); /* +2 for fudge */
+ if (rc)
+ printk(VIOCONS_KERN_WARN
+ "error opening to partition %d: %d\n",
+ viopath_hostLp, rc);
+ }
+
+ if (vio_setHandler(viomajorsubtype_chario, vioHandleCharEvent) < 0)
+ printk(VIOCONS_KERN_WARN
+ "error seting handler for console events!\n");
+
+ /*
+ * First, try to open the console to the hosting lp.
+ * Wait on a semaphore for the response.
+ */
+ atomic_set(&wait_flag, 0);
+ if ((viopath_isactive(viopath_hostLp)) &&
+ (send_open(viopath_hostLp, (void *)&wait_flag) == 0)) {
+ printk(VIOCONS_KERN_INFO "hosting partition %d\n",
+ viopath_hostLp);
+ while (atomic_read(&wait_flag) == 0)
+ mb();
+ atomic_set(&wait_flag, 0);
+ }
+
+ /*
+ * If we don't have an active console, try the primary
+ */
+ if ((!viopath_isactive(port_info[0].lp)) &&
+ (viopath_isactive(HvLpConfig_getPrimaryLpIndex())) &&
+ (send_open(HvLpConfig_getPrimaryLpIndex(), (void *)&wait_flag)
+ == 0)) {
+ printk(VIOCONS_KERN_INFO "opening console to primary partition\n");
+ while (atomic_read(&wait_flag) == 0)
+ mb();
+ }
+
+ /* Initialize the tty_driver structure */
+ viotty_driver = alloc_tty_driver(VTTY_PORTS);
+ viotty_driver->owner = THIS_MODULE;
+ viotty_driver->driver_name = "vioconsole";
+ viotty_driver->name = "tty";
+ viotty_driver->name_base = 1;
+ viotty_driver->major = TTY_MAJOR;
+ viotty_driver->minor_start = 1;
+ viotty_driver->type = TTY_DRIVER_TYPE_CONSOLE;
+ viotty_driver->subtype = 1;
+ viotty_driver->init_termios = tty_std_termios;
+ viotty_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_RESET_TERMIOS;
+ tty_set_operations(viotty_driver, &serial_ops);
+
+ if (tty_register_driver(viotty_driver)) {
+ printk(VIOCONS_KERN_WARN "couldn't register console driver\n");
+ put_tty_driver(viotty_driver);
+ viotty_driver = NULL;
+ }
+
+ unregister_console(&viocons_early);
+ register_console(&viocons);
+
+ return 0;
+}
+
+static int __init viocons_init(void)
+{
+ int i;
+
+ if (!firmware_has_feature(FW_FEATURE_ISERIES))
+ return -ENODEV;
+
+ printk(VIOCONS_KERN_INFO "registering console\n");
+ for (i = 0; i < VTTY_PORTS; i++) {
+ port_info[i].lp = HvLpIndexInvalid;
+ port_info[i].magic = VIOTTY_MAGIC;
+ }
+ HvCall_setLogBufferFormatAndCodepage(HvCall_LogBuffer_ASCII, 437);
+ add_preferred_console("viocons", 0, NULL);
+ register_console(&viocons_early);
+ return 0;
+}
+
+console_initcall(viocons_init);
+module_init(viocons_init2);
diff --git a/trunk/drivers/firewire/fw-cdev.c b/trunk/drivers/firewire/fw-cdev.c
index 2e6d5848d217..bc81d6fcd2fd 100644
--- a/trunk/drivers/firewire/fw-cdev.c
+++ b/trunk/drivers/firewire/fw-cdev.c
@@ -369,33 +369,22 @@ complete_transaction(struct fw_card *card, int rcode,
struct response *response = data;
struct client *client = response->client;
unsigned long flags;
- struct fw_cdev_event_response *r = &response->response;
- if (length < r->length)
- r->length = length;
+ if (length < response->response.length)
+ response->response.length = length;
if (rcode == RCODE_COMPLETE)
- memcpy(r->data, payload, r->length);
+ memcpy(response->response.data, payload,
+ response->response.length);
spin_lock_irqsave(&client->lock, flags);
list_del(&response->resource.link);
spin_unlock_irqrestore(&client->lock, flags);
- r->type = FW_CDEV_EVENT_RESPONSE;
- r->rcode = rcode;
-
- /*
- * In the case that sizeof(*r) doesn't align with the position of the
- * data, and the read is short, preserve an extra copy of the data
- * to stay compatible with a pre-2.6.27 bug. Since the bug is harmless
- * for short reads and some apps depended on it, this is both safe
- * and prudent for compatibility.
- */
- if (r->length <= sizeof(*r) - offsetof(typeof(*r), data))
- queue_event(client, &response->event, r, sizeof(*r),
- r->data, r->length);
- else
- queue_event(client, &response->event, r, sizeof(*r) + r->length,
- NULL, 0);
+ response->response.type = FW_CDEV_EVENT_RESPONSE;
+ response->response.rcode = rcode;
+ queue_event(client, &response->event, &response->response,
+ sizeof(response->response) + response->response.length,
+ NULL, 0);
}
static int ioctl_send_request(struct client *client, void *buffer)
diff --git a/trunk/drivers/hwmon/Kconfig b/trunk/drivers/hwmon/Kconfig
index bf4ebfb86fa5..c882fd05cf29 100644
--- a/trunk/drivers/hwmon/Kconfig
+++ b/trunk/drivers/hwmon/Kconfig
@@ -57,16 +57,6 @@ config SENSORS_ABITUGURU3
This driver can also be built as a module. If so, the module
will be called abituguru3.
-config SENSORS_AD7414
- tristate "Analog Devices AD7414"
- depends on I2C && EXPERIMENTAL
- help
- If you say yes here you get support for the Analog Devices
- AD7414 temperature monitoring chip.
-
- This driver can also be built as a module. If so, the module
- will be called ad7414.
-
config SENSORS_AD7418
tristate "Analog Devices AD7416, AD7417 and AD7418"
depends on I2C && EXPERIMENTAL
@@ -134,7 +124,7 @@ config SENSORS_ADM1031
config SENSORS_ADM9240
tristate "Analog Devices ADM9240 and compatibles"
- depends on I2C
+ depends on I2C && EXPERIMENTAL
select HWMON_VID
help
If you say yes here you get support for Analog Devices ADM9240,
@@ -585,8 +575,8 @@ config SENSORS_DME1737
select HWMON_VID
help
If you say yes here you get support for the hardware monitoring
- and fan control features of the SMSC DME1737, SCH311x, SCH5027, and
- Asus A8000 Super-I/O chips.
+ and fan control features of the SMSC DME1737 (and compatibles
+ like the Asus A8000) and SCH311x Super-I/O chips.
This driver can also be built as a module. If so, the module
will be called dme1737.
diff --git a/trunk/drivers/hwmon/Makefile b/trunk/drivers/hwmon/Makefile
index 7943e5cefb06..d098677e08de 100644
--- a/trunk/drivers/hwmon/Makefile
+++ b/trunk/drivers/hwmon/Makefile
@@ -15,7 +15,6 @@ obj-$(CONFIG_SENSORS_W83791D) += w83791d.o
obj-$(CONFIG_SENSORS_ABITUGURU) += abituguru.o
obj-$(CONFIG_SENSORS_ABITUGURU3)+= abituguru3.o
-obj-$(CONFIG_SENSORS_AD7414) += ad7414.o
obj-$(CONFIG_SENSORS_AD7418) += ad7418.o
obj-$(CONFIG_SENSORS_ADM1021) += adm1021.o
obj-$(CONFIG_SENSORS_ADM1025) += adm1025.o
diff --git a/trunk/drivers/hwmon/ad7414.c b/trunk/drivers/hwmon/ad7414.c
deleted file mode 100644
index ce8d94fbfd7e..000000000000
--- a/trunk/drivers/hwmon/ad7414.c
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
- * An hwmon driver for the Analog Devices AD7414
- *
- * Copyright 2006 Stefan Roese , DENX Software Engineering
- *
- * Copyright (c) 2008 PIKA Technologies
- * Sean MacLennan
- *
- * Copyright (c) 2008 Spansion Inc.
- * Frank Edelhaeuser
- * (converted to "new style" I2C driver model, removed checkpatch.pl warnings)
- *
- * Based on ad7418.c
- * Copyright 2006 Tower Technologies, Alessandro Zummo
- *
- * 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
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-
-/* AD7414 registers */
-#define AD7414_REG_TEMP 0x00
-#define AD7414_REG_CONF 0x01
-#define AD7414_REG_T_HIGH 0x02
-#define AD7414_REG_T_LOW 0x03
-
-static u8 AD7414_REG_LIMIT[] = { AD7414_REG_T_HIGH, AD7414_REG_T_LOW };
-
-struct ad7414_data {
- struct device *hwmon_dev;
- struct mutex lock; /* atomic read data updates */
- char valid; /* !=0 if following fields are valid */
- unsigned long next_update; /* In jiffies */
- s16 temp_input; /* Register values */
- s8 temps[ARRAY_SIZE(AD7414_REG_LIMIT)];
-};
-
-/* REG: (0.25C/bit, two's complement) << 6 */
-static inline int ad7414_temp_from_reg(s16 reg)
-{
- /* use integer division instead of equivalent right shift to
- * guarantee arithmetic shift and preserve the sign
- */
- return ((int)reg / 64) * 250;
-}
-
-static inline int ad7414_read(struct i2c_client *client, u8 reg)
-{
- if (reg == AD7414_REG_TEMP) {
- int value = i2c_smbus_read_word_data(client, reg);
- return (value < 0) ? value : swab16(value);
- } else
- return i2c_smbus_read_byte_data(client, reg);
-}
-
-static inline int ad7414_write(struct i2c_client *client, u8 reg, u8 value)
-{
- return i2c_smbus_write_byte_data(client, reg, value);
-}
-
-struct ad7414_data *ad7414_update_device(struct device *dev)
-{
- struct i2c_client *client = to_i2c_client(dev);
- struct ad7414_data *data = i2c_get_clientdata(client);
-
- mutex_lock(&data->lock);
-
- if (time_after(jiffies, data->next_update) || !data->valid) {
- int value, i;
-
- dev_dbg(&client->dev, "starting ad7414 update\n");
-
- value = ad7414_read(client, AD7414_REG_TEMP);
- if (value < 0)
- dev_dbg(&client->dev, "AD7414_REG_TEMP err %d\n",
- value);
- else
- data->temp_input = value;
-
- for (i = 0; i < ARRAY_SIZE(AD7414_REG_LIMIT); ++i) {
- value = ad7414_read(client, AD7414_REG_LIMIT[i]);
- if (value < 0)
- dev_dbg(&client->dev, "AD7414 reg %d err %d\n",
- AD7414_REG_LIMIT[i], value);
- else
- data->temps[i] = value;
- }
-
- data->next_update = jiffies + HZ + HZ / 2;
- data->valid = 1;
- }
-
- mutex_unlock(&data->lock);
-
- return data;
-}
-
-static ssize_t show_temp_input(struct device *dev,
- struct device_attribute *attr, char *buf)
-{
- struct ad7414_data *data = ad7414_update_device(dev);
- return sprintf(buf, "%d\n", ad7414_temp_from_reg(data->temp_input));
-}
-static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_temp_input, NULL, 0);
-
-static ssize_t show_max_min(struct device *dev, struct device_attribute *attr,
- char *buf)
-{
- int index = to_sensor_dev_attr(attr)->index;
- struct ad7414_data *data = ad7414_update_device(dev);
- return sprintf(buf, "%d\n", data->temps[index] * 1000);
-}
-
-static ssize_t set_max_min(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t count)
-{
- struct i2c_client *client = to_i2c_client(dev);
- struct ad7414_data *data = i2c_get_clientdata(client);
- int index = to_sensor_dev_attr(attr)->index;
- u8 reg = AD7414_REG_LIMIT[index];
- long temp = simple_strtol(buf, NULL, 10);
-
- temp = SENSORS_LIMIT(temp, -40000, 85000);
- temp = (temp + (temp < 0 ? -500 : 500)) / 1000;
-
- mutex_lock(&data->lock);
- data->temps[index] = temp;
- ad7414_write(client, reg, temp);
- mutex_unlock(&data->lock);
- return count;
-}
-
-static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO,
- show_max_min, set_max_min, 0);
-static SENSOR_DEVICE_ATTR(temp1_min, S_IWUSR | S_IRUGO,
- show_max_min, set_max_min, 1);
-
-static ssize_t show_alarm(struct device *dev, struct device_attribute *attr,
- char *buf)
-{
- int bitnr = to_sensor_dev_attr(attr)->index;
- struct ad7414_data *data = ad7414_update_device(dev);
- int value = (data->temp_input >> bitnr) & 1;
- return sprintf(buf, "%d\n", value);
-}
-
-static SENSOR_DEVICE_ATTR(temp1_min_alarm, S_IRUGO, show_alarm, NULL, 3);
-static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, show_alarm, NULL, 4);
-
-static struct attribute *ad7414_attributes[] = {
- &sensor_dev_attr_temp1_input.dev_attr.attr,
- &sensor_dev_attr_temp1_max.dev_attr.attr,
- &sensor_dev_attr_temp1_min.dev_attr.attr,
- &sensor_dev_attr_temp1_max_alarm.dev_attr.attr,
- &sensor_dev_attr_temp1_min_alarm.dev_attr.attr,
- NULL
-};
-
-static const struct attribute_group ad7414_group = {
- .attrs = ad7414_attributes,
-};
-
-static int ad7414_probe(struct i2c_client *client,
- const struct i2c_device_id *dev_id)
-{
- struct ad7414_data *data;
- int conf;
- int err = 0;
-
- if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA |
- I2C_FUNC_SMBUS_READ_WORD_DATA))
- goto exit;
-
- data = kzalloc(sizeof(struct ad7414_data), GFP_KERNEL);
- if (!data) {
- err = -ENOMEM;
- goto exit;
- }
-
- i2c_set_clientdata(client, data);
- mutex_init(&data->lock);
-
- dev_info(&client->dev, "chip found\n");
-
- /* Make sure the chip is powered up. */
- conf = i2c_smbus_read_byte_data(client, AD7414_REG_CONF);
- if (conf < 0)
- dev_warn(&client->dev,
- "ad7414_probe unable to read config register.\n");
- else {
- conf &= ~(1 << 7);
- i2c_smbus_write_byte_data(client, AD7414_REG_CONF, conf);
- }
-
- /* Register sysfs hooks */
- err = sysfs_create_group(&client->dev.kobj, &ad7414_group);
- if (err)
- goto exit_free;
-
- data->hwmon_dev = hwmon_device_register(&client->dev);
- if (IS_ERR(data->hwmon_dev)) {
- err = PTR_ERR(data->hwmon_dev);
- goto exit_remove;
- }
-
- return 0;
-
-exit_remove:
- sysfs_remove_group(&client->dev.kobj, &ad7414_group);
-exit_free:
- kfree(data);
-exit:
- return err;
-}
-
-static int __devexit ad7414_remove(struct i2c_client *client)
-{
- struct ad7414_data *data = i2c_get_clientdata(client);
-
- hwmon_device_unregister(data->hwmon_dev);
- sysfs_remove_group(&client->dev.kobj, &ad7414_group);
- kfree(data);
- return 0;
-}
-
-static const struct i2c_device_id ad7414_id[] = {
- { "ad7414", 0 },
- {}
-};
-
-static struct i2c_driver ad7414_driver = {
- .driver = {
- .name = "ad7414",
- },
- .probe = ad7414_probe,
- .remove = __devexit_p(ad7414_remove),
- .id_table = ad7414_id,
-};
-
-static int __init ad7414_init(void)
-{
- return i2c_add_driver(&ad7414_driver);
-}
-module_init(ad7414_init);
-
-static void __exit ad7414_exit(void)
-{
- i2c_del_driver(&ad7414_driver);
-}
-module_exit(ad7414_exit);
-
-MODULE_AUTHOR("Stefan Roese , "
- "Frank Edelhaeuser ");
-
-MODULE_DESCRIPTION("AD7414 driver");
-MODULE_LICENSE("GPL");
diff --git a/trunk/drivers/hwmon/dme1737.c b/trunk/drivers/hwmon/dme1737.c
index cdb8311e4ef7..5e2cf0aef480 100644
--- a/trunk/drivers/hwmon/dme1737.c
+++ b/trunk/drivers/hwmon/dme1737.c
@@ -1,11 +1,11 @@
/*
- * dme1737.c - Driver for the SMSC DME1737, Asus A8000, SMSC SCH311x and
- * SCH5027 Super-I/O chips integrated hardware monitoring features.
- * Copyright (c) 2007, 2008 Juerg Haefliger
+ * dme1737.c - Driver for the SMSC DME1737, Asus A8000, and SMSC SCH311x
+ * Super-I/O chips integrated hardware monitoring features.
+ * Copyright (c) 2007 Juerg Haefliger
*
* This driver is an I2C/ISA hybrid, meaning that it uses the I2C bus to access
- * the chip registers if a DME1737, A8000, or SCH5027 is found and the ISA bus
- * if a SCH311x chip is found. Both types of chips have very similar hardware
+ * the chip registers if a DME1737 (or A8000) is found and the ISA bus if a
+ * SCH311x chip is found. Both types of chips have very similar hardware
* monitoring capabilities but differ in the way they can be accessed.
*
* This program is free software; you can redistribute it and/or modify
@@ -57,10 +57,7 @@ MODULE_PARM_DESC(probe_all_addr, "Include probing of non-standard LPC "
static const unsigned short normal_i2c[] = {0x2c, 0x2d, 0x2e, I2C_CLIENT_END};
/* Insmod parameters */
-I2C_CLIENT_INSMOD_2(dme1737, sch5027);
-
-/* ISA chip types */
-enum isa_chips { sch311x = sch5027 + 1 };
+I2C_CLIENT_INSMOD_1(dme1737);
/* ---------------------------------------------------------------------
* Registers
@@ -166,7 +163,6 @@ static const u8 DME1737_BIT_ALARM_FAN[] = {10, 11, 12, 13, 22, 23};
#define DME1737_VERSTEP 0x88
#define DME1737_VERSTEP_MASK 0xf8
#define SCH311X_DEVICE 0x8c
-#define SCH5027_VERSTEP 0x69
/* Length of ISA address segment */
#define DME1737_EXTENT 2
@@ -186,7 +182,6 @@ struct dme1737_data {
unsigned long last_update; /* in jiffies */
unsigned long last_vbat; /* in jiffies */
enum chips type;
- const int *in_nominal; /* pointer to IN_NOMINAL array */
u8 vid;
u8 pwm_rr_en;
@@ -225,23 +220,23 @@ static const int IN_NOMINAL_DME1737[] = {5000, 2250, 3300, 5000, 12000, 3300,
3300};
static const int IN_NOMINAL_SCH311x[] = {2500, 1500, 3300, 5000, 12000, 3300,
3300};
-static const int IN_NOMINAL_SCH5027[] = {5000, 2250, 3300, 1125, 1125, 3300,
- 3300};
-#define IN_NOMINAL(type) ((type) == sch311x ? IN_NOMINAL_SCH311x : \
- (type) == sch5027 ? IN_NOMINAL_SCH5027 : \
- IN_NOMINAL_DME1737)
+#define IN_NOMINAL(ix, type) (((type) == dme1737) ? \
+ IN_NOMINAL_DME1737[(ix)] : \
+ IN_NOMINAL_SCH311x[(ix)])
/* Voltage input
* Voltage inputs have 16 bits resolution, limit values have 8 bits
* resolution. */
-static inline int IN_FROM_REG(int reg, int nominal, int res)
+static inline int IN_FROM_REG(int reg, int ix, int res, int type)
{
- return (reg * nominal + (3 << (res - 3))) / (3 << (res - 2));
+ return (reg * IN_NOMINAL(ix, type) + (3 << (res - 3))) /
+ (3 << (res - 2));
}
-static inline int IN_TO_REG(int val, int nominal)
+static inline int IN_TO_REG(int val, int ix, int type)
{
- return SENSORS_LIMIT((val * 192 + nominal / 2) / nominal, 0, 255);
+ return SENSORS_LIMIT((val * 192 + IN_NOMINAL(ix, type) / 2) /
+ IN_NOMINAL(ix, type), 0, 255);
}
/* Temperature input
@@ -570,10 +565,7 @@ static struct dme1737_data *dme1737_update_device(struct device *dev)
/* Sample register contents every 1 sec */
if (time_after(jiffies, data->last_update + HZ) || !data->valid) {
- if (data->type != sch5027) {
- data->vid = dme1737_read(client, DME1737_REG_VID) &
- 0x3f;
- }
+ data->vid = dme1737_read(client, DME1737_REG_VID) & 0x3f;
/* In (voltage) registers */
for (ix = 0; ix < ARRAY_SIZE(data->in); ix++) {
@@ -601,10 +593,8 @@ static struct dme1737_data *dme1737_update_device(struct device *dev)
DME1737_REG_TEMP_MIN(ix));
data->temp_max[ix] = dme1737_read(client,
DME1737_REG_TEMP_MAX(ix));
- if (data->type != sch5027) {
- data->temp_offset[ix] = dme1737_read(client,
- DME1737_REG_TEMP_OFFSET(ix));
- }
+ data->temp_offset[ix] = dme1737_read(client,
+ DME1737_REG_TEMP_OFFSET(ix));
}
/* In and temp LSB registers
@@ -679,11 +669,9 @@ static struct dme1737_data *dme1737_update_device(struct device *dev)
data->zone_abs[ix] = dme1737_read(client,
DME1737_REG_ZONE_ABS(ix));
}
- if (data->type != sch5027) {
- for (ix = 0; ix < ARRAY_SIZE(data->zone_hyst); ix++) {
- data->zone_hyst[ix] = dme1737_read(client,
+ for (ix = 0; ix < ARRAY_SIZE(data->zone_hyst); ix++) {
+ data->zone_hyst[ix] = dme1737_read(client,
DME1737_REG_ZONE_HYST(ix));
- }
}
/* Alarm registers */
@@ -747,13 +735,13 @@ static ssize_t show_in(struct device *dev, struct device_attribute *attr,
switch (fn) {
case SYS_IN_INPUT:
- res = IN_FROM_REG(data->in[ix], data->in_nominal[ix], 16);
+ res = IN_FROM_REG(data->in[ix], ix, 16, data->type);
break;
case SYS_IN_MIN:
- res = IN_FROM_REG(data->in_min[ix], data->in_nominal[ix], 8);
+ res = IN_FROM_REG(data->in_min[ix], ix, 8, data->type);
break;
case SYS_IN_MAX:
- res = IN_FROM_REG(data->in_max[ix], data->in_nominal[ix], 8);
+ res = IN_FROM_REG(data->in_max[ix], ix, 8, data->type);
break;
case SYS_IN_ALARM:
res = (data->alarms >> DME1737_BIT_ALARM_IN[ix]) & 0x01;
@@ -780,12 +768,12 @@ static ssize_t set_in(struct device *dev, struct device_attribute *attr,
mutex_lock(&data->update_lock);
switch (fn) {
case SYS_IN_MIN:
- data->in_min[ix] = IN_TO_REG(val, data->in_nominal[ix]);
+ data->in_min[ix] = IN_TO_REG(val, ix, data->type);
dme1737_write(client, DME1737_REG_IN_MIN(ix),
data->in_min[ix]);
break;
case SYS_IN_MAX:
- data->in_max[ix] = IN_TO_REG(val, data->in_nominal[ix]);
+ data->in_max[ix] = IN_TO_REG(val, ix, data->type);
dme1737_write(client, DME1737_REG_IN_MAX(ix),
data->in_max[ix]);
break;
@@ -1178,7 +1166,7 @@ static ssize_t show_pwm(struct device *dev, struct device_attribute *attr,
return sprintf(buf, "%d\n", res);
}
-static struct attribute *dme1737_pwm_chmod_attr[];
+static struct attribute *dme1737_attr_pwm[];
static void dme1737_chmod_file(struct device*, struct attribute*, mode_t);
static ssize_t set_pwm(struct device *dev, struct device_attribute *attr,
@@ -1242,7 +1230,7 @@ static ssize_t set_pwm(struct device *dev, struct device_attribute *attr,
switch (val) {
case 0:
/* Change permissions of pwm[ix] to read-only */
- dme1737_chmod_file(dev, dme1737_pwm_chmod_attr[ix],
+ dme1737_chmod_file(dev, dme1737_attr_pwm[ix],
S_IRUGO);
/* Turn fan fully on */
data->pwm_config[ix] = PWM_EN_TO_REG(0,
@@ -1257,12 +1245,12 @@ static ssize_t set_pwm(struct device *dev, struct device_attribute *attr,
dme1737_write(client, DME1737_REG_PWM_CONFIG(ix),
data->pwm_config[ix]);
/* Change permissions of pwm[ix] to read-writeable */
- dme1737_chmod_file(dev, dme1737_pwm_chmod_attr[ix],
+ dme1737_chmod_file(dev, dme1737_attr_pwm[ix],
S_IRUGO | S_IWUSR);
break;
case 2:
/* Change permissions of pwm[ix] to read-only */
- dme1737_chmod_file(dev, dme1737_pwm_chmod_attr[ix],
+ dme1737_chmod_file(dev, dme1737_attr_pwm[ix],
S_IRUGO);
/* Turn on auto mode using the saved zone channel
* assignment */
@@ -1582,98 +1570,88 @@ static struct attribute *dme1737_attr[] ={
&sensor_dev_attr_temp1_max.dev_attr.attr,
&sensor_dev_attr_temp1_alarm.dev_attr.attr,
&sensor_dev_attr_temp1_fault.dev_attr.attr,
+ &sensor_dev_attr_temp1_offset.dev_attr.attr,
&sensor_dev_attr_temp2_input.dev_attr.attr,
&sensor_dev_attr_temp2_min.dev_attr.attr,
&sensor_dev_attr_temp2_max.dev_attr.attr,
&sensor_dev_attr_temp2_alarm.dev_attr.attr,
&sensor_dev_attr_temp2_fault.dev_attr.attr,
+ &sensor_dev_attr_temp2_offset.dev_attr.attr,
&sensor_dev_attr_temp3_input.dev_attr.attr,
&sensor_dev_attr_temp3_min.dev_attr.attr,
&sensor_dev_attr_temp3_max.dev_attr.attr,
&sensor_dev_attr_temp3_alarm.dev_attr.attr,
&sensor_dev_attr_temp3_fault.dev_attr.attr,
+ &sensor_dev_attr_temp3_offset.dev_attr.attr,
/* Zones */
+ &sensor_dev_attr_zone1_auto_point1_temp_hyst.dev_attr.attr,
&sensor_dev_attr_zone1_auto_point1_temp.dev_attr.attr,
&sensor_dev_attr_zone1_auto_point2_temp.dev_attr.attr,
&sensor_dev_attr_zone1_auto_point3_temp.dev_attr.attr,
&sensor_dev_attr_zone1_auto_channels_temp.dev_attr.attr,
+ &sensor_dev_attr_zone2_auto_point1_temp_hyst.dev_attr.attr,
&sensor_dev_attr_zone2_auto_point1_temp.dev_attr.attr,
&sensor_dev_attr_zone2_auto_point2_temp.dev_attr.attr,
&sensor_dev_attr_zone2_auto_point3_temp.dev_attr.attr,
&sensor_dev_attr_zone2_auto_channels_temp.dev_attr.attr,
+ &sensor_dev_attr_zone3_auto_point1_temp_hyst.dev_attr.attr,
&sensor_dev_attr_zone3_auto_point1_temp.dev_attr.attr,
&sensor_dev_attr_zone3_auto_point2_temp.dev_attr.attr,
&sensor_dev_attr_zone3_auto_point3_temp.dev_attr.attr,
&sensor_dev_attr_zone3_auto_channels_temp.dev_attr.attr,
- NULL
-};
-
-static const struct attribute_group dme1737_group = {
- .attrs = dme1737_attr,
-};
-
-/* The following struct holds misc attributes, which are not available in all
- * chips. Their creation depends on the chip type which is determined during
- * module load. */
-static struct attribute *dme1737_misc_attr[] = {
- /* Temperatures */
- &sensor_dev_attr_temp1_offset.dev_attr.attr,
- &sensor_dev_attr_temp2_offset.dev_attr.attr,
- &sensor_dev_attr_temp3_offset.dev_attr.attr,
- /* Zones */
- &sensor_dev_attr_zone1_auto_point1_temp_hyst.dev_attr.attr,
- &sensor_dev_attr_zone2_auto_point1_temp_hyst.dev_attr.attr,
- &sensor_dev_attr_zone3_auto_point1_temp_hyst.dev_attr.attr,
/* Misc */
&dev_attr_vrm.attr,
&dev_attr_cpu0_vid.attr,
NULL
};
-static const struct attribute_group dme1737_misc_group = {
- .attrs = dme1737_misc_attr,
+static const struct attribute_group dme1737_group = {
+ .attrs = dme1737_attr,
};
/* The following structs hold the PWM attributes, some of which are optional.
* Their creation depends on the chip configuration which is determined during
* module load. */
-static struct attribute *dme1737_pwm1_attr[] = {
+static struct attribute *dme1737_attr_pwm1[] = {
&sensor_dev_attr_pwm1.dev_attr.attr,
&sensor_dev_attr_pwm1_freq.dev_attr.attr,
&sensor_dev_attr_pwm1_enable.dev_attr.attr,
&sensor_dev_attr_pwm1_ramp_rate.dev_attr.attr,
&sensor_dev_attr_pwm1_auto_channels_zone.dev_attr.attr,
+ &sensor_dev_attr_pwm1_auto_pwm_min.dev_attr.attr,
&sensor_dev_attr_pwm1_auto_point1_pwm.dev_attr.attr,
&sensor_dev_attr_pwm1_auto_point2_pwm.dev_attr.attr,
NULL
};
-static struct attribute *dme1737_pwm2_attr[] = {
+static struct attribute *dme1737_attr_pwm2[] = {
&sensor_dev_attr_pwm2.dev_attr.attr,
&sensor_dev_attr_pwm2_freq.dev_attr.attr,
&sensor_dev_attr_pwm2_enable.dev_attr.attr,
&sensor_dev_attr_pwm2_ramp_rate.dev_attr.attr,
&sensor_dev_attr_pwm2_auto_channels_zone.dev_attr.attr,
+ &sensor_dev_attr_pwm2_auto_pwm_min.dev_attr.attr,
&sensor_dev_attr_pwm2_auto_point1_pwm.dev_attr.attr,
&sensor_dev_attr_pwm2_auto_point2_pwm.dev_attr.attr,
NULL
};
-static struct attribute *dme1737_pwm3_attr[] = {
+static struct attribute *dme1737_attr_pwm3[] = {
&sensor_dev_attr_pwm3.dev_attr.attr,
&sensor_dev_attr_pwm3_freq.dev_attr.attr,
&sensor_dev_attr_pwm3_enable.dev_attr.attr,
&sensor_dev_attr_pwm3_ramp_rate.dev_attr.attr,
&sensor_dev_attr_pwm3_auto_channels_zone.dev_attr.attr,
+ &sensor_dev_attr_pwm3_auto_pwm_min.dev_attr.attr,
&sensor_dev_attr_pwm3_auto_point1_pwm.dev_attr.attr,
&sensor_dev_attr_pwm3_auto_point2_pwm.dev_attr.attr,
NULL
};
-static struct attribute *dme1737_pwm5_attr[] = {
+static struct attribute *dme1737_attr_pwm5[] = {
&sensor_dev_attr_pwm5.dev_attr.attr,
&sensor_dev_attr_pwm5_freq.dev_attr.attr,
&sensor_dev_attr_pwm5_enable.dev_attr.attr,
NULL
};
-static struct attribute *dme1737_pwm6_attr[] = {
+static struct attribute *dme1737_attr_pwm6[] = {
&sensor_dev_attr_pwm6.dev_attr.attr,
&sensor_dev_attr_pwm6_freq.dev_attr.attr,
&sensor_dev_attr_pwm6_enable.dev_attr.attr,
@@ -1681,62 +1659,53 @@ static struct attribute *dme1737_pwm6_attr[] = {
};
static const struct attribute_group dme1737_pwm_group[] = {
- { .attrs = dme1737_pwm1_attr },
- { .attrs = dme1737_pwm2_attr },
- { .attrs = dme1737_pwm3_attr },
+ { .attrs = dme1737_attr_pwm1 },
+ { .attrs = dme1737_attr_pwm2 },
+ { .attrs = dme1737_attr_pwm3 },
{ .attrs = NULL },
- { .attrs = dme1737_pwm5_attr },
- { .attrs = dme1737_pwm6_attr },
-};
-
-/* The following struct holds misc PWM attributes, which are not available in
- * all chips. Their creation depends on the chip type which is determined
- * during module load. */
-static struct attribute *dme1737_pwm_misc_attr[] = {
- &sensor_dev_attr_pwm1_auto_pwm_min.dev_attr.attr,
- &sensor_dev_attr_pwm2_auto_pwm_min.dev_attr.attr,
- &sensor_dev_attr_pwm3_auto_pwm_min.dev_attr.attr,
+ { .attrs = dme1737_attr_pwm5 },
+ { .attrs = dme1737_attr_pwm6 },
};
/* The following structs hold the fan attributes, some of which are optional.
* Their creation depends on the chip configuration which is determined during
* module load. */
-static struct attribute *dme1737_fan1_attr[] = {
+static struct attribute *dme1737_attr_fan1[] = {
&sensor_dev_attr_fan1_input.dev_attr.attr,
&sensor_dev_attr_fan1_min.dev_attr.attr,
&sensor_dev_attr_fan1_alarm.dev_attr.attr,
&sensor_dev_attr_fan1_type.dev_attr.attr,
NULL
};
-static struct attribute *dme1737_fan2_attr[] = {
+static struct attribute *dme1737_attr_fan2[] = {
&sensor_dev_attr_fan2_input.dev_attr.attr,
&sensor_dev_attr_fan2_min.dev_attr.attr,
&sensor_dev_attr_fan2_alarm.dev_attr.attr,
&sensor_dev_attr_fan2_type.dev_attr.attr,
NULL
};
-static struct attribute *dme1737_fan3_attr[] = {
+static struct attribute *dme1737_attr_fan3[] = {
&sensor_dev_attr_fan3_input.dev_attr.attr,
&sensor_dev_attr_fan3_min.dev_attr.attr,
&sensor_dev_attr_fan3_alarm.dev_attr.attr,
&sensor_dev_attr_fan3_type.dev_attr.attr,
NULL
};
-static struct attribute *dme1737_fan4_attr[] = {
+static struct attribute *dme1737_attr_fan4[] = {
&sensor_dev_attr_fan4_input.dev_attr.attr,
&sensor_dev_attr_fan4_min.dev_attr.attr,
&sensor_dev_attr_fan4_alarm.dev_attr.attr,
&sensor_dev_attr_fan4_type.dev_attr.attr,
NULL
};
-static struct attribute *dme1737_fan5_attr[] = {
+static struct attribute *dme1737_attr_fan5[] = {
&sensor_dev_attr_fan5_input.dev_attr.attr,
&sensor_dev_attr_fan5_min.dev_attr.attr,
&sensor_dev_attr_fan5_alarm.dev_attr.attr,
&sensor_dev_attr_fan5_max.dev_attr.attr,
NULL
};
-static struct attribute *dme1737_fan6_attr[] = {
+static struct attribute *dme1737_attr_fan6[] = {
&sensor_dev_attr_fan6_input.dev_attr.attr,
&sensor_dev_attr_fan6_min.dev_attr.attr,
&sensor_dev_attr_fan6_alarm.dev_attr.attr,
@@ -1745,83 +1714,94 @@ static struct attribute *dme1737_fan6_attr[] = {
};
static const struct attribute_group dme1737_fan_group[] = {
- { .attrs = dme1737_fan1_attr },
- { .attrs = dme1737_fan2_attr },
- { .attrs = dme1737_fan3_attr },
- { .attrs = dme1737_fan4_attr },
- { .attrs = dme1737_fan5_attr },
- { .attrs = dme1737_fan6_attr },
+ { .attrs = dme1737_attr_fan1 },
+ { .attrs = dme1737_attr_fan2 },
+ { .attrs = dme1737_attr_fan3 },
+ { .attrs = dme1737_attr_fan4 },
+ { .attrs = dme1737_attr_fan5 },
+ { .attrs = dme1737_attr_fan6 },
};
-/* The permissions of the following zone attributes are changed to read-
+/* The permissions of all of the following attributes are changed to read-
* writeable if the chip is *not* locked. Otherwise they stay read-only. */
-static struct attribute *dme1737_zone_chmod_attr[] = {
+static struct attribute *dme1737_attr_lock[] = {
+ /* Temperatures */
+ &sensor_dev_attr_temp1_offset.dev_attr.attr,
+ &sensor_dev_attr_temp2_offset.dev_attr.attr,
+ &sensor_dev_attr_temp3_offset.dev_attr.attr,
+ /* Zones */
+ &sensor_dev_attr_zone1_auto_point1_temp_hyst.dev_attr.attr,
&sensor_dev_attr_zone1_auto_point1_temp.dev_attr.attr,
&sensor_dev_attr_zone1_auto_point2_temp.dev_attr.attr,
&sensor_dev_attr_zone1_auto_point3_temp.dev_attr.attr,
+ &sensor_dev_attr_zone2_auto_point1_temp_hyst.dev_attr.attr,
&sensor_dev_attr_zone2_auto_point1_temp.dev_attr.attr,
&sensor_dev_attr_zone2_auto_point2_temp.dev_attr.attr,
&sensor_dev_attr_zone2_auto_point3_temp.dev_attr.attr,
+ &sensor_dev_attr_zone3_auto_point1_temp_hyst.dev_attr.attr,
&sensor_dev_attr_zone3_auto_point1_temp.dev_attr.attr,
&sensor_dev_attr_zone3_auto_point2_temp.dev_attr.attr,
&sensor_dev_attr_zone3_auto_point3_temp.dev_attr.attr,
NULL
};
-static const struct attribute_group dme1737_zone_chmod_group = {
- .attrs = dme1737_zone_chmod_attr,
+static const struct attribute_group dme1737_lock_group = {
+ .attrs = dme1737_attr_lock,
};
/* The permissions of the following PWM attributes are changed to read-
* writeable if the chip is *not* locked and the respective PWM is available.
* Otherwise they stay read-only. */
-static struct attribute *dme1737_pwm1_chmod_attr[] = {
+static struct attribute *dme1737_attr_pwm1_lock[] = {
&sensor_dev_attr_pwm1_freq.dev_attr.attr,
&sensor_dev_attr_pwm1_enable.dev_attr.attr,
&sensor_dev_attr_pwm1_ramp_rate.dev_attr.attr,
&sensor_dev_attr_pwm1_auto_channels_zone.dev_attr.attr,
+ &sensor_dev_attr_pwm1_auto_pwm_min.dev_attr.attr,
&sensor_dev_attr_pwm1_auto_point1_pwm.dev_attr.attr,
NULL
};
-static struct attribute *dme1737_pwm2_chmod_attr[] = {
+static struct attribute *dme1737_attr_pwm2_lock[] = {
&sensor_dev_attr_pwm2_freq.dev_attr.attr,
&sensor_dev_attr_pwm2_enable.dev_attr.attr,
&sensor_dev_attr_pwm2_ramp_rate.dev_attr.attr,
&sensor_dev_attr_pwm2_auto_channels_zone.dev_attr.attr,
+ &sensor_dev_attr_pwm2_auto_pwm_min.dev_attr.attr,
&sensor_dev_attr_pwm2_auto_point1_pwm.dev_attr.attr,
NULL
};
-static struct attribute *dme1737_pwm3_chmod_attr[] = {
+static struct attribute *dme1737_attr_pwm3_lock[] = {
&sensor_dev_attr_pwm3_freq.dev_attr.attr,
&sensor_dev_attr_pwm3_enable.dev_attr.attr,
&sensor_dev_attr_pwm3_ramp_rate.dev_attr.attr,
&sensor_dev_attr_pwm3_auto_channels_zone.dev_attr.attr,
+ &sensor_dev_attr_pwm3_auto_pwm_min.dev_attr.attr,
&sensor_dev_attr_pwm3_auto_point1_pwm.dev_attr.attr,
NULL
};
-static struct attribute *dme1737_pwm5_chmod_attr[] = {
+static struct attribute *dme1737_attr_pwm5_lock[] = {
&sensor_dev_attr_pwm5.dev_attr.attr,
&sensor_dev_attr_pwm5_freq.dev_attr.attr,
NULL
};
-static struct attribute *dme1737_pwm6_chmod_attr[] = {
+static struct attribute *dme1737_attr_pwm6_lock[] = {
&sensor_dev_attr_pwm6.dev_attr.attr,
&sensor_dev_attr_pwm6_freq.dev_attr.attr,
NULL
};
-static const struct attribute_group dme1737_pwm_chmod_group[] = {
- { .attrs = dme1737_pwm1_chmod_attr },
- { .attrs = dme1737_pwm2_chmod_attr },
- { .attrs = dme1737_pwm3_chmod_attr },
+static const struct attribute_group dme1737_pwm_lock_group[] = {
+ { .attrs = dme1737_attr_pwm1_lock },
+ { .attrs = dme1737_attr_pwm2_lock },
+ { .attrs = dme1737_attr_pwm3_lock },
{ .attrs = NULL },
- { .attrs = dme1737_pwm5_chmod_attr },
- { .attrs = dme1737_pwm6_chmod_attr },
+ { .attrs = dme1737_attr_pwm5_lock },
+ { .attrs = dme1737_attr_pwm6_lock },
};
/* Pwm[1-3] are read-writeable if the associated pwm is in manual mode and the
* chip is not locked. Otherwise they are read-only. */
-static struct attribute *dme1737_pwm_chmod_attr[] = {
+static struct attribute *dme1737_attr_pwm[] = {
&sensor_dev_attr_pwm1.dev_attr.attr,
&sensor_dev_attr_pwm2.dev_attr.attr,
&sensor_dev_attr_pwm3.dev_attr.attr,
@@ -1895,17 +1875,9 @@ static void dme1737_remove_files(struct device *dev)
if (data->has_pwm & (1 << ix)) {
sysfs_remove_group(&dev->kobj,
&dme1737_pwm_group[ix]);
- if (data->type != sch5027 && ix < 3) {
- sysfs_remove_file(&dev->kobj,
- dme1737_pwm_misc_attr[ix]);
- }
}
}
- if (data->type != sch5027) {
- sysfs_remove_group(&dev->kobj, &dme1737_misc_group);
- }
-
sysfs_remove_group(&dev->kobj, &dme1737_group);
if (!data->client.driver) {
@@ -1929,13 +1901,6 @@ static int dme1737_create_files(struct device *dev)
goto exit_remove;
}
- /* Create misc sysfs attributes */
- if ((data->type != sch5027) &&
- (err = sysfs_create_group(&dev->kobj,
- &dme1737_misc_group))) {
- goto exit_remove;
- }
-
/* Create fan sysfs attributes */
for (ix = 0; ix < ARRAY_SIZE(dme1737_fan_group); ix++) {
if (data->has_fan & (1 << ix)) {
@@ -1953,11 +1918,6 @@ static int dme1737_create_files(struct device *dev)
&dme1737_pwm_group[ix]))) {
goto exit_remove;
}
- if (data->type != sch5027 && ix < 3 &&
- (err = sysfs_create_file(&dev->kobj,
- dme1737_pwm_misc_attr[ix]))) {
- goto exit_remove;
- }
}
}
@@ -1967,27 +1927,16 @@ static int dme1737_create_files(struct device *dev)
dev_info(dev, "Device is locked. Some attributes "
"will be read-only.\n");
} else {
- /* Change permissions of zone sysfs attributes */
- dme1737_chmod_group(dev, &dme1737_zone_chmod_group,
+ /* Change permissions of standard attributes */
+ dme1737_chmod_group(dev, &dme1737_lock_group,
S_IRUGO | S_IWUSR);
- /* Change permissions of misc sysfs attributes */
- if (data->type != sch5027) {
- dme1737_chmod_group(dev, &dme1737_misc_group,
- S_IRUGO | S_IWUSR);
- }
-
- /* Change permissions of PWM sysfs attributes */
- for (ix = 0; ix < ARRAY_SIZE(dme1737_pwm_chmod_group); ix++) {
+ /* Change permissions of PWM attributes */
+ for (ix = 0; ix < ARRAY_SIZE(dme1737_pwm_lock_group); ix++) {
if (data->has_pwm & (1 << ix)) {
dme1737_chmod_group(dev,
- &dme1737_pwm_chmod_group[ix],
- S_IRUGO | S_IWUSR);
- if (data->type != sch5027 && ix < 3) {
- dme1737_chmod_file(dev,
- dme1737_pwm_misc_attr[ix],
+ &dme1737_pwm_lock_group[ix],
S_IRUGO | S_IWUSR);
- }
}
}
@@ -1996,7 +1945,7 @@ static int dme1737_create_files(struct device *dev)
if ((data->has_pwm & (1 << ix)) &&
(PWM_EN_FROM_REG(data->pwm_config[ix]) == 1)) {
dme1737_chmod_file(dev,
- dme1737_pwm_chmod_attr[ix],
+ dme1737_attr_pwm[ix],
S_IRUGO | S_IWUSR);
}
}
@@ -2017,9 +1966,6 @@ static int dme1737_init_device(struct device *dev)
int ix;
u8 reg;
- /* Point to the right nominal voltages array */
- data->in_nominal = IN_NOMINAL(data->type);
-
data->config = dme1737_read(client, DME1737_REG_CONFIG);
/* Inform if part is not monitoring/started */
if (!(data->config & 0x01)) {
@@ -2130,9 +2076,7 @@ static int dme1737_init_device(struct device *dev)
data->pwm_acz[2] = 4; /* pwm3 -> zone3 */
/* Set VRM */
- if (data->type != sch5027) {
- data->vrm = vid_which_vrm();
- }
+ data->vrm = vid_which_vrm();
return 0;
}
@@ -2151,10 +2095,9 @@ static int dme1737_i2c_get_features(int sio_cip, struct dme1737_data *data)
dme1737_sio_enter(sio_cip);
/* Check device ID
- * The DME1737 can return either 0x78 or 0x77 as its device ID.
- * The SCH5027 returns 0x89 as its device ID. */
+ * The DME1737 can return either 0x78 or 0x77 as its device ID. */
reg = force_id ? force_id : dme1737_sio_inb(sio_cip, 0x20);
- if (!(reg == 0x77 || reg == 0x78 || reg == 0x89)) {
+ if (!(reg == 0x77 || reg == 0x78)) {
err = -ENODEV;
goto exit;
}
@@ -2223,24 +2166,15 @@ static int dme1737_i2c_detect(struct i2c_adapter *adapter, int address,
company = dme1737_read(client, DME1737_REG_COMPANY);
verstep = dme1737_read(client, DME1737_REG_VERSTEP);
- if (company == DME1737_COMPANY_SMSC &&
- (verstep & DME1737_VERSTEP_MASK) == DME1737_VERSTEP) {
- kind = dme1737;
- } else if (company == DME1737_COMPANY_SMSC &&
- verstep == SCH5027_VERSTEP) {
- kind = sch5027;
- } else {
+ if (!((company == DME1737_COMPANY_SMSC) &&
+ ((verstep & DME1737_VERSTEP_MASK) == DME1737_VERSTEP))) {
err = -ENODEV;
goto exit_kfree;
}
}
- if (kind == sch5027) {
- name = "sch5027";
- } else {
- kind = dme1737;
- name = "dme1737";
- }
+ kind = dme1737;
+ name = "dme1737";
data->type = kind;
/* Fill in the remaining client fields and put it into the global
@@ -2253,9 +2187,8 @@ static int dme1737_i2c_detect(struct i2c_adapter *adapter, int address,
goto exit_kfree;
}
- dev_info(dev, "Found a %s chip at 0x%02x (rev 0x%02x).\n",
- kind == sch5027 ? "SCH5027" : "DME1737", client->addr,
- verstep);
+ dev_info(dev, "Found a DME1737 chip at 0x%02x (rev 0x%02x).\n",
+ client->addr, verstep);
/* Initialize the DME1737 chip */
if ((err = dme1737_init_device(dev))) {
@@ -2427,18 +2360,15 @@ static int __devinit dme1737_isa_probe(struct platform_device *pdev)
client->addr = res->start;
platform_set_drvdata(pdev, data);
- /* Skip chip detection if module is loaded with force_id parameter */
- if (!force_id) {
- company = dme1737_read(client, DME1737_REG_COMPANY);
- device = dme1737_read(client, DME1737_REG_DEVICE);
+ company = dme1737_read(client, DME1737_REG_COMPANY);
+ device = dme1737_read(client, DME1737_REG_DEVICE);
- if (!((company == DME1737_COMPANY_SMSC) &&
- (device == SCH311X_DEVICE))) {
- err = -ENODEV;
- goto exit_kfree;
- }
+ if (!((company == DME1737_COMPANY_SMSC) &&
+ (device == SCH311X_DEVICE))) {
+ err = -ENODEV;
+ goto exit_kfree;
}
- data->type = sch311x;
+ data->type = -1;
/* Fill in the remaining client fields and initialize the mutex */
strlcpy(client->name, "sch311x", I2C_NAME_SIZE);
diff --git a/trunk/drivers/hwmon/f71882fg.c b/trunk/drivers/hwmon/f71882fg.c
index 67067e9a323e..cbeb4984b5c7 100644
--- a/trunk/drivers/hwmon/f71882fg.c
+++ b/trunk/drivers/hwmon/f71882fg.c
@@ -87,6 +87,8 @@ static inline void superio_enter(int base);
static inline void superio_select(int base, int ld);
static inline void superio_exit(int base);
+static inline u16 fan_from_reg ( u16 reg );
+
struct f71882fg_data {
unsigned short addr;
struct device *hwmon_dev;
@@ -114,6 +116,10 @@ struct f71882fg_data {
u8 temp_diode_open;
};
+static u8 f71882fg_read8(struct f71882fg_data *data, u8 reg);
+static u16 f71882fg_read16(struct f71882fg_data *data, u8 reg);
+static void f71882fg_write8(struct f71882fg_data *data, u8 reg, u8 val);
+
/* Sysfs in*/
static ssize_t show_in(struct device *dev, struct device_attribute *devattr,
char *buf);
diff --git a/trunk/drivers/hwmon/hwmon-vid.c b/trunk/drivers/hwmon/hwmon-vid.c
index 7b0a32c4dcfb..3330667280b9 100644
--- a/trunk/drivers/hwmon/hwmon-vid.c
+++ b/trunk/drivers/hwmon/hwmon-vid.c
@@ -1,74 +1,76 @@
/*
- * hwmon-vid.c - VID/VRM/VRD voltage conversions
- *
- * Copyright (c) 2004 Rudolf Marek
- *
- * Partly imported from i2c-vid.h of the lm_sensors project
- * Copyright (c) 2002 Mark D. Studebaker
- * With assistance from Trent Piepho
- *
- * 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.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
+ hwmon-vid.c - VID/VRM/VRD voltage conversions
+
+ Copyright (c) 2004 Rudolf Marek
+
+ Partly imported from i2c-vid.h of the lm_sensors project
+ Copyright (c) 2002 Mark D. Studebaker
+ With assistance from Trent Piepho
+
+ 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.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
#include
#include
#include
/*
- * Common code for decoding VID pins.
- *
- * References:
- *
- * For VRM 8.4 to 9.1, "VRM x.y DC-DC Converter Design Guidelines",
- * available at http://developer.intel.com/.
- *
- * For VRD 10.0 and up, "VRD x.y Design Guide",
- * available at http://developer.intel.com/.
- *
- * AMD NPT 0Fh (Athlon64 & Opteron), AMD Publication 32559,
- * http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/32559.pdf
- * Table 71. VID Code Voltages
- * AMD Opteron processors don't follow the Intel specifications.
- * I'm going to "make up" 2.4 as the spec number for the Opterons.
- * No good reason just a mnemonic for the 24x Opteron processor
- * series.
- *
- * The 17 specification is in fact Intel Mobile Voltage Positioning -
- * (IMVP-II). You can find more information in the datasheet of Max1718
- * http://www.maxim-ic.com/quick_view2.cfm/qv_pk/2452
- *
- * The 13 specification corresponds to the Intel Pentium M series. There
- * doesn't seem to be any named specification for these. The conversion
- * tables are detailed directly in the various Pentium M datasheets:
- * http://www.intel.com/design/intarch/pentiumm/docs_pentiumm.htm
- *
- * The 14 specification corresponds to Intel Core series. There
- * doesn't seem to be any named specification for these. The conversion
- * tables are detailed directly in the various Pentium Core datasheets:
- * http://www.intel.com/design/mobile/datashts/309221.htm
- *
- * The 110 (VRM 11) specification corresponds to Intel Conroe based series.
- * http://www.intel.com/design/processor/applnots/313214.htm
- */
-
-/*
- * vrm is the VRM/VRD document version multiplied by 10.
- * val is the 4-bit or more VID code.
- * Returned value is in mV to avoid floating point in the kernel.
- * Some VID have some bits in uV scale, this is rounded to mV.
- */
+ Common code for decoding VID pins.
+
+ References:
+
+ For VRM 8.4 to 9.1, "VRM x.y DC-DC Converter Design Guidelines",
+ available at http://developer.intel.com/.
+
+ For VRD 10.0 and up, "VRD x.y Design Guide",
+ available at http://developer.intel.com/.
+
+ AMD Opteron processors don't follow the Intel specifications.
+ I'm going to "make up" 2.4 as the spec number for the Opterons.
+ No good reason just a mnemonic for the 24x Opteron processor
+ series.
+
+ Opteron VID encoding is:
+ 00000 = 1.550 V
+ 00001 = 1.525 V
+ . . . .
+ 11110 = 0.800 V
+ 11111 = 0.000 V (off)
+
+ The 17 specification is in fact Intel Mobile Voltage Positioning -
+ (IMVP-II). You can find more information in the datasheet of Max1718
+ http://www.maxim-ic.com/quick_view2.cfm/qv_pk/2452
+
+ The 13 specification corresponds to the Intel Pentium M series. There
+ doesn't seem to be any named specification for these. The conversion
+ tables are detailed directly in the various Pentium M datasheets:
+ http://www.intel.com/design/intarch/pentiumm/docs_pentiumm.htm
+
+ The 14 specification corresponds to Intel Core series. There
+ doesn't seem to be any named specification for these. The conversion
+ tables are detailed directly in the various Pentium Core datasheets:
+ http://www.intel.com/design/mobile/datashts/309221.htm
+
+ The 110 (VRM 11) specification corresponds to Intel Conroe based series.
+ http://www.intel.com/design/processor/applnots/313214.htm
+*/
+
+/* vrm is the VRM/VRD document version multiplied by 10.
+ val is the 4-bit or more VID code.
+ Returned value is in mV to avoid floating point in the kernel.
+ Some VID have some bits in uV scale, this is rounded to mV */
int vid_from_reg(int val, u8 vrm)
{
int vid;
@@ -94,11 +96,9 @@ int vid_from_reg(int val, u8 vrm)
if (val < 0x02 || val > 0xb2)
return 0;
return((1600000 - (val - 2) * 6250 + 500) / 1000);
-
- case 24: /* AMD NPT 0Fh (Athlon64 & Opteron) */
- val &= 0x3f;
- return (val < 32) ? 1550 - 25 * val
- : 775 - (25 * (val - 31)) / 2;
+ case 24: /* Opteron processor */
+ val &= 0x1f;
+ return(val == 0x1f ? 0 : 1550 - val * 25);
case 91: /* VRM 9.1 */
case 90: /* VRM 9.0 */
@@ -141,9 +141,9 @@ int vid_from_reg(int val, u8 vrm)
/*
- * After this point is the code to automatically determine which
- * VRM/VRD specification should be used depending on the CPU.
- */
+ After this point is the code to automatically determine which
+ VRM/VRD specification should be used depending on the CPU.
+*/
struct vrm_model {
u8 vendor;
diff --git a/trunk/drivers/hwmon/it87.c b/trunk/drivers/hwmon/it87.c
index 30cdb0956779..e12c132ff83a 100644
--- a/trunk/drivers/hwmon/it87.c
+++ b/trunk/drivers/hwmon/it87.c
@@ -151,9 +151,9 @@ static int fix_pwm_polarity;
/* The IT8718F has the VID value in a different register, in Super-I/O
configuration space. */
#define IT87_REG_VID 0x0a
-/* The IT8705F and IT8712F earlier than revision 0x08 use register 0x0b
- for fan divisors. Later IT8712F revisions must use 16-bit tachometer
- mode. */
+/* Warning: register 0x0b is used for something completely different in
+ new chips/revisions. I suspect only 16-bit tachometer mode will work
+ for these. */
#define IT87_REG_FAN_DIV 0x0b
#define IT87_REG_FAN_16BIT 0x0c
@@ -234,7 +234,6 @@ static const unsigned int pwm_freq[8] = {
struct it87_sio_data {
enum chips type;
/* Values read from Super-I/O config space */
- u8 revision;
u8 vid_value;
};
@@ -243,7 +242,6 @@ struct it87_sio_data {
struct it87_data {
struct device *hwmon_dev;
enum chips type;
- u8 revision;
unsigned short addr;
const char *name;
@@ -270,16 +268,6 @@ struct it87_data {
u8 manual_pwm_ctl[3]; /* manual PWM value set by user */
};
-static inline int has_16bit_fans(const struct it87_data *data)
-{
- /* IT8705F Datasheet 0.4.1, 3h == Version G.
- IT8712F Datasheet 0.9.1, section 8.3.5 indicates 7h == Version I.
- These are the first revisions with 16bit tachometer support. */
- return (data->type == it87 && data->revision >= 0x03)
- || (data->type == it8712 && data->revision >= 0x07)
- || data->type == it8716
- || data->type == it8718;
-}
static int it87_probe(struct platform_device *pdev);
static int __devexit it87_remove(struct platform_device *pdev);
@@ -1003,9 +991,8 @@ static int __init it87_find(unsigned short *address,
}
err = 0;
- sio_data->revision = superio_inb(DEVREV) & 0x0f;
pr_info("it87: Found IT%04xF chip at 0x%x, revision %d\n",
- chip_type, *address, sio_data->revision);
+ chip_type, *address, superio_inb(DEVREV) & 0x0f);
/* Read GPIO config and VID value from LDN 7 (GPIO) */
if (chip_type != IT8705F_DEVID) {
@@ -1058,7 +1045,6 @@ static int __devinit it87_probe(struct platform_device *pdev)
data->addr = res->start;
data->type = sio_data->type;
- data->revision = sio_data->revision;
data->name = names[sio_data->type];
/* Now, we do the remaining detection. */
@@ -1083,7 +1069,7 @@ static int __devinit it87_probe(struct platform_device *pdev)
goto ERROR2;
/* Do not create fan files for disabled fans */
- if (has_16bit_fans(data)) {
+ if (data->type == it8716 || data->type == it8718) {
/* 16-bit tachometers */
if (data->has_fan & (1 << 0)) {
if ((err = device_create_file(dev,
@@ -1364,7 +1350,7 @@ static void __devinit it87_init_device(struct platform_device *pdev)
data->has_fan = (data->fan_main_ctrl >> 4) & 0x07;
/* Set tachometers to 16-bit mode if needed */
- if (has_16bit_fans(data)) {
+ if (data->type == it8716 || data->type == it8718) {
tmp = it87_read_value(data, IT87_REG_FAN_16BIT);
if (~tmp & 0x07 & data->has_fan) {
dev_dbg(&pdev->dev,
@@ -1372,13 +1358,10 @@ static void __devinit it87_init_device(struct platform_device *pdev)
it87_write_value(data, IT87_REG_FAN_16BIT,
tmp | 0x07);
}
- /* IT8705F only supports three fans. */
- if (data->type != it87) {
- if (tmp & (1 << 4))
- data->has_fan |= (1 << 3); /* fan4 enabled */
- if (tmp & (1 << 5))
- data->has_fan |= (1 << 4); /* fan5 enabled */
- }
+ if (tmp & (1 << 4))
+ data->has_fan |= (1 << 3); /* fan4 enabled */
+ if (tmp & (1 << 5))
+ data->has_fan |= (1 << 4); /* fan5 enabled */
}
/* Set current fan mode registers and the default settings for the
@@ -1443,7 +1426,7 @@ static struct it87_data *it87_update_device(struct device *dev)
data->fan[i] = it87_read_value(data,
IT87_REG_FAN[i]);
/* Add high byte if in 16-bit mode */
- if (has_16bit_fans(data)) {
+ if (data->type == it8716 || data->type == it8718) {
data->fan[i] |= it87_read_value(data,
IT87_REG_FANX[i]) << 8;
data->fan_min[i] |= it87_read_value(data,
@@ -1460,7 +1443,8 @@ static struct it87_data *it87_update_device(struct device *dev)
}
/* Newer chips don't have clock dividers */
- if ((data->has_fan & 0x07) && !has_16bit_fans(data)) {
+ if ((data->has_fan & 0x07) && data->type != it8716
+ && data->type != it8718) {
i = it87_read_value(data, IT87_REG_FAN_DIV);
data->fan_div[0] = i & 0x07;
data->fan_div[1] = (i >> 3) & 0x07;
@@ -1476,8 +1460,7 @@ static struct it87_data *it87_update_device(struct device *dev)
data->fan_ctl = it87_read_value(data, IT87_REG_FAN_CTL);
data->sensor = it87_read_value(data, IT87_REG_TEMP_ENABLE);
- /* The 8705 does not have VID capability.
- The 8718 does not use IT87_REG_VID for the same purpose. */
+ /* The 8705 does not have VID capability */
if (data->type == it8712 || data->type == it8716) {
data->vid = it87_read_value(data, IT87_REG_VID);
/* The older IT8712F revisions had only 5 VID pins,
diff --git a/trunk/drivers/hwmon/thmc50.c b/trunk/drivers/hwmon/thmc50.c
index 7d97431e132f..3b01001108c1 100644
--- a/trunk/drivers/hwmon/thmc50.c
+++ b/trunk/drivers/hwmon/thmc50.c
@@ -55,11 +55,8 @@ I2C_CLIENT_MODULE_PARM(adm1022_temp3, "List of adapter,address pairs "
static const u8 THMC50_REG_TEMP[] = { 0x27, 0x26, 0x20 };
static const u8 THMC50_REG_TEMP_MIN[] = { 0x3A, 0x38, 0x2C };
static const u8 THMC50_REG_TEMP_MAX[] = { 0x39, 0x37, 0x2B };
-static const u8 THMC50_REG_TEMP_CRITICAL[] = { 0x13, 0x14, 0x14 };
-static const u8 THMC50_REG_TEMP_DEFAULT[] = { 0x17, 0x18, 0x18 };
#define THMC50_REG_CONF_nFANOFF 0x20
-#define THMC50_REG_CONF_PROGRAMMED 0x08
/* Each client has this additional data */
struct thmc50_data {
@@ -75,7 +72,6 @@ struct thmc50_data {
s8 temp_input[3];
s8 temp_max[3];
s8 temp_min[3];
- s8 temp_critical[3];
u8 analog_out;
u8 alarms;
};
@@ -203,15 +199,6 @@ static ssize_t set_temp_max(struct device *dev, struct device_attribute *attr,
return count;
}
-static ssize_t show_temp_critical(struct device *dev,
- struct device_attribute *attr,
- char *buf)
-{
- int nr = to_sensor_dev_attr(attr)->index;
- struct thmc50_data *data = thmc50_update_device(dev);
- return sprintf(buf, "%d\n", data->temp_critical[nr] * 1000);
-}
-
static ssize_t show_alarm(struct device *dev, struct device_attribute *attr,
char *buf)
{
@@ -227,9 +214,7 @@ static SENSOR_DEVICE_ATTR(temp##offset##_input, S_IRUGO, show_temp, \
static SENSOR_DEVICE_ATTR(temp##offset##_min, S_IRUGO | S_IWUSR, \
show_temp_min, set_temp_min, offset - 1); \
static SENSOR_DEVICE_ATTR(temp##offset##_max, S_IRUGO | S_IWUSR, \
- show_temp_max, set_temp_max, offset - 1); \
-static SENSOR_DEVICE_ATTR(temp##offset##_crit, S_IRUGO, \
- show_temp_critical, NULL, offset - 1);
+ show_temp_max, set_temp_max, offset - 1);
temp_reg(1);
temp_reg(2);
@@ -249,12 +234,10 @@ static struct attribute *thmc50_attributes[] = {
&sensor_dev_attr_temp1_max.dev_attr.attr,
&sensor_dev_attr_temp1_min.dev_attr.attr,
&sensor_dev_attr_temp1_input.dev_attr.attr,
- &sensor_dev_attr_temp1_crit.dev_attr.attr,
&sensor_dev_attr_temp1_alarm.dev_attr.attr,
&sensor_dev_attr_temp2_max.dev_attr.attr,
&sensor_dev_attr_temp2_min.dev_attr.attr,
&sensor_dev_attr_temp2_input.dev_attr.attr,
- &sensor_dev_attr_temp2_crit.dev_attr.attr,
&sensor_dev_attr_temp2_alarm.dev_attr.attr,
&sensor_dev_attr_temp2_fault.dev_attr.attr,
&sensor_dev_attr_pwm1.dev_attr.attr,
@@ -271,7 +254,6 @@ static struct attribute *temp3_attributes[] = {
&sensor_dev_attr_temp3_max.dev_attr.attr,
&sensor_dev_attr_temp3_min.dev_attr.attr,
&sensor_dev_attr_temp3_input.dev_attr.attr,
- &sensor_dev_attr_temp3_crit.dev_attr.attr,
&sensor_dev_attr_temp3_alarm.dev_attr.attr,
&sensor_dev_attr_temp3_fault.dev_attr.attr,
NULL
@@ -447,10 +429,6 @@ static struct thmc50_data *thmc50_update_device(struct device *dev)
int temps = data->has_temp3 ? 3 : 2;
int i;
- int prog = i2c_smbus_read_byte_data(client, THMC50_REG_CONF);
-
- prog &= THMC50_REG_CONF_PROGRAMMED;
-
for (i = 0; i < temps; i++) {
data->temp_input[i] = i2c_smbus_read_byte_data(client,
THMC50_REG_TEMP[i]);
@@ -458,10 +436,6 @@ static struct thmc50_data *thmc50_update_device(struct device *dev)
THMC50_REG_TEMP_MAX[i]);
data->temp_min[i] = i2c_smbus_read_byte_data(client,
THMC50_REG_TEMP_MIN[i]);
- data->temp_critical[i] =
- i2c_smbus_read_byte_data(client,
- prog ? THMC50_REG_TEMP_CRITICAL[i]
- : THMC50_REG_TEMP_DEFAULT[i]);
}
data->analog_out =
i2c_smbus_read_byte_data(client, THMC50_REG_ANALOG_OUT);
diff --git a/trunk/drivers/hwmon/w83627hf.c b/trunk/drivers/hwmon/w83627hf.c
index b30e5796cb26..9564fb069957 100644
--- a/trunk/drivers/hwmon/w83627hf.c
+++ b/trunk/drivers/hwmon/w83627hf.c
@@ -67,6 +67,10 @@ module_param(force_i2c, byte, 0);
MODULE_PARM_DESC(force_i2c,
"Initialize the i2c address of the sensors");
+static int reset;
+module_param(reset, bool, 0);
+MODULE_PARM_DESC(reset, "Set to one to reset chip on load");
+
static int init = 1;
module_param(init, bool, 0);
MODULE_PARM_DESC(init, "Set to zero to bypass chip initialization");
@@ -205,13 +209,6 @@ static const u16 w83627hf_reg_temp_over[] = { 0x39, 0x155, 0x255 };
#define W83627HF_REG_PWM1 0x5A
#define W83627HF_REG_PWM2 0x5B
-static const u8 W83627THF_REG_PWM_ENABLE[] = {
- 0x04, /* FAN 1 mode */
- 0x04, /* FAN 2 mode */
- 0x12, /* FAN AUX mode */
-};
-static const u8 W83627THF_PWM_ENABLE_SHIFT[] = { 2, 4, 1 };
-
#define W83627THF_REG_PWM1 0x01 /* 697HF/637HF/687THF too */
#define W83627THF_REG_PWM2 0x03 /* 697HF/637HF/687THF too */
#define W83627THF_REG_PWM3 0x11 /* 637HF/687THF too */
@@ -369,9 +366,6 @@ struct w83627hf_data {
u32 alarms; /* Register encoding, combined */
u32 beep_mask; /* Register encoding, combined */
u8 pwm[3]; /* Register value */
- u8 pwm_enable[3]; /* 1 = manual
- 2 = thermal cruise (also called SmartFan I)
- 3 = fan speed cruise */
u8 pwm_freq[3]; /* Register value */
u16 sens[3]; /* 1 = pentium diode; 2 = 3904 diode;
4 = thermistor */
@@ -962,42 +956,6 @@ static SENSOR_DEVICE_ATTR(pwm1, S_IRUGO|S_IWUSR, show_pwm, store_pwm, 0);
static SENSOR_DEVICE_ATTR(pwm2, S_IRUGO|S_IWUSR, show_pwm, store_pwm, 1);
static SENSOR_DEVICE_ATTR(pwm3, S_IRUGO|S_IWUSR, show_pwm, store_pwm, 2);
-static ssize_t
-show_pwm_enable(struct device *dev, struct device_attribute *devattr, char *buf)
-{
- int nr = to_sensor_dev_attr(devattr)->index;
- struct w83627hf_data *data = w83627hf_update_device(dev);
- return sprintf(buf, "%d\n", data->pwm_enable[nr]);
-}
-
-static ssize_t
-store_pwm_enable(struct device *dev, struct device_attribute *devattr,
- const char *buf, size_t count)
-{
- int nr = to_sensor_dev_attr(devattr)->index;
- struct w83627hf_data *data = dev_get_drvdata(dev);
- unsigned long val = simple_strtoul(buf, NULL, 10);
- u8 reg;
-
- if (!val || (val > 3)) /* modes 1, 2 and 3 are supported */
- return -EINVAL;
- mutex_lock(&data->update_lock);
- data->pwm_enable[nr] = val;
- reg = w83627hf_read_value(data, W83627THF_REG_PWM_ENABLE[nr]);
- reg &= ~(0x03 << W83627THF_PWM_ENABLE_SHIFT[nr]);
- reg |= (val - 1) << W83627THF_PWM_ENABLE_SHIFT[nr];
- w83627hf_write_value(data, W83627THF_REG_PWM_ENABLE[nr], reg);
- mutex_unlock(&data->update_lock);
- return count;
-}
-
-static SENSOR_DEVICE_ATTR(pwm1_enable, S_IRUGO|S_IWUSR, show_pwm_enable,
- store_pwm_enable, 0);
-static SENSOR_DEVICE_ATTR(pwm2_enable, S_IRUGO|S_IWUSR, show_pwm_enable,
- store_pwm_enable, 1);
-static SENSOR_DEVICE_ATTR(pwm3_enable, S_IRUGO|S_IWUSR, show_pwm_enable,
- store_pwm_enable, 2);
-
static ssize_t
show_pwm_freq(struct device *dev, struct device_attribute *devattr, char *buf)
{
@@ -1265,11 +1223,6 @@ static struct attribute *w83627hf_attributes_opt[] = {
&sensor_dev_attr_pwm1_freq.dev_attr.attr,
&sensor_dev_attr_pwm2_freq.dev_attr.attr,
&sensor_dev_attr_pwm3_freq.dev_attr.attr,
-
- &sensor_dev_attr_pwm1_enable.dev_attr.attr,
- &sensor_dev_attr_pwm2_enable.dev_attr.attr,
- &sensor_dev_attr_pwm3_enable.dev_attr.attr,
-
NULL
};
@@ -1413,19 +1366,6 @@ static int __devinit w83627hf_probe(struct platform_device *pdev)
&sensor_dev_attr_pwm3_freq.dev_attr)))
goto ERROR4;
- if (data->type != w83627hf)
- if ((err = device_create_file(dev,
- &sensor_dev_attr_pwm1_enable.dev_attr))
- || (err = device_create_file(dev,
- &sensor_dev_attr_pwm2_enable.dev_attr)))
- goto ERROR4;
-
- if (data->type == w83627thf || data->type == w83637hf
- || data->type == w83687thf)
- if ((err = device_create_file(dev,
- &sensor_dev_attr_pwm3_enable.dev_attr)))
- goto ERROR4;
-
data->hwmon_dev = hwmon_device_register(dev);
if (IS_ERR(data->hwmon_dev)) {
err = PTR_ERR(data->hwmon_dev);
@@ -1596,6 +1536,29 @@ static void __devinit w83627hf_init_device(struct platform_device *pdev)
enum chips type = data->type;
u8 tmp;
+ if (reset) {
+ /* Resetting the chip has been the default for a long time,
+ but repeatedly caused problems (fans going to full
+ speed...) so it is now optional. It might even go away if
+ nobody reports it as being useful, as I see very little
+ reason why this would be needed at all. */
+ dev_info(&pdev->dev, "If reset=1 solved a problem you were "
+ "having, please report!\n");
+
+ /* save this register */
+ i = w83627hf_read_value(data, W83781D_REG_BEEP_CONFIG);
+ /* Reset all except Watchdog values and last conversion values
+ This sets fan-divs to 2, among others */
+ w83627hf_write_value(data, W83781D_REG_CONFIG, 0x80);
+ /* Restore the register and disable power-on abnormal beep.
+ This saves FAN 1/2/3 input/output values set by BIOS. */
+ w83627hf_write_value(data, W83781D_REG_BEEP_CONFIG, i | 0x80);
+ /* Disable master beep-enable (reset turns it on).
+ Individual beeps should be reset to off but for some reason
+ disabling this bit helps some people not get beeped */
+ w83627hf_write_value(data, W83781D_REG_BEEP_INTS2, 0);
+ }
+
/* Minimize conflicts with other winbond i2c-only clients... */
/* disable i2c subclients... how to disable main i2c client?? */
/* force i2c address to relatively uncommon address */
@@ -1692,7 +1655,6 @@ static struct w83627hf_data *w83627hf_update_device(struct device *dev)
{
struct w83627hf_data *data = dev_get_drvdata(dev);
int i, num_temps = (data->type == w83697hf) ? 2 : 3;
- int num_pwms = (data->type == w83697hf) ? 2 : 3;
mutex_lock(&data->update_lock);
@@ -1745,15 +1707,6 @@ static struct w83627hf_data *w83627hf_update_device(struct device *dev)
break;
}
}
- if (data->type != w83627hf) {
- for (i = 0; i < num_pwms; i++) {
- u8 tmp = w83627hf_read_value(data,
- W83627THF_REG_PWM_ENABLE[i]);
- data->pwm_enable[i] =
- ((tmp >> W83627THF_PWM_ENABLE_SHIFT[i])
- & 0x03) + 1;
- }
- }
for (i = 0; i < num_temps; i++) {
data->temp[i] = w83627hf_read_value(
data, w83627hf_reg_temp[i]);
diff --git a/trunk/drivers/hwmon/w83791d.c b/trunk/drivers/hwmon/w83791d.c
index daa7d121483b..e4e91c9d480a 100644
--- a/trunk/drivers/hwmon/w83791d.c
+++ b/trunk/drivers/hwmon/w83791d.c
@@ -233,9 +233,11 @@ static u8 fan_to_reg(long rpm, int div)
static u8 div_to_reg(int nr, long val)
{
int i;
+ int max;
- /* fan divisors max out at 128 */
- val = SENSORS_LIMIT(val, 1, 128) >> 1;
+ /* first three fan's divisor max out at 8, rest max out at 128 */
+ max = (nr < 3) ? 8 : 128;
+ val = SENSORS_LIMIT(val, 1, max) >> 1;
for (i = 0; i < 7; i++) {
if (val == 0)
break;
@@ -528,7 +530,6 @@ static ssize_t store_fan_div(struct device *dev, struct device_attribute *attr,
unsigned long min;
u8 tmp_fan_div;
u8 fan_div_reg;
- u8 vbat_reg;
int indx = 0;
u8 keep_mask = 0;
u8 new_shift = 0;
@@ -580,16 +581,6 @@ static ssize_t store_fan_div(struct device *dev, struct device_attribute *attr,
w83791d_write(client, W83791D_REG_FAN_DIV[indx],
fan_div_reg | tmp_fan_div);
- /* Bit 2 of fans 0-2 is stored in the vbat register (bits 5-7) */
- if (nr < 3) {
- keep_mask = ~(1 << (nr + 5));
- vbat_reg = w83791d_read(client, W83791D_REG_VBAT)
- & keep_mask;
- tmp_fan_div = (data->fan_div[nr] << (3 + nr)) & ~keep_mask;
- w83791d_write(client, W83791D_REG_VBAT,
- vbat_reg | tmp_fan_div);
- }
-
/* Restore fan_min */
data->fan_min[nr] = fan_to_reg(min, DIV_FROM_REG(data->fan_div[nr]));
w83791d_write(client, W83791D_REG_FAN_MIN[nr], data->fan_min[nr]);
@@ -1191,7 +1182,6 @@ static struct w83791d_data *w83791d_update_device(struct device *dev)
struct w83791d_data *data = i2c_get_clientdata(client);
int i, j;
u8 reg_array_tmp[3];
- u8 vbat_reg;
mutex_lock(&data->update_lock);
@@ -1229,12 +1219,6 @@ static struct w83791d_data *w83791d_update_device(struct device *dev)
data->fan_div[3] = reg_array_tmp[2] & 0x07;
data->fan_div[4] = (reg_array_tmp[2] >> 4) & 0x07;
- /* The fan divisor for fans 0-2 get bit 2 from
- bits 5-7 respectively of vbat register */
- vbat_reg = w83791d_read(client, W83791D_REG_VBAT);
- for (i = 0; i < 3; i++)
- data->fan_div[i] |= (vbat_reg >> (3 + i)) & 0x04;
-
/* Update the first temperature sensor */
for (i = 0; i < 3; i++) {
data->temp1[i] = w83791d_read(client,
diff --git a/trunk/drivers/media/dvb/dvb-usb/cxusb.c b/trunk/drivers/media/dvb/dvb-usb/cxusb.c
index aaa0b6f0b521..578afce6884c 100644
--- a/trunk/drivers/media/dvb/dvb-usb/cxusb.c
+++ b/trunk/drivers/media/dvb/dvb-usb/cxusb.c
@@ -565,8 +565,7 @@ static int cxusb_lgh064f_tuner_attach(struct dvb_usb_adapter *adap)
static int dvico_bluebird_xc2028_callback(void *ptr, int command, int arg)
{
- struct dvb_usb_adapter *adap = ptr;
- struct dvb_usb_device *d = adap->dev;
+ struct dvb_usb_device *d = ptr;
switch (command) {
case XC2028_TUNER_RESET:
@@ -594,9 +593,9 @@ static int cxusb_dvico_xc3028_tuner_attach(struct dvb_usb_adapter *adap)
.callback = dvico_bluebird_xc2028_callback,
};
static struct xc2028_ctrl ctl = {
- .fname = "xc3028-v27.fw",
+ .fname = "xc3028-dvico-au-01.fw",
.max_len = 64,
- .demod = XC3028_FE_ZARLINK456,
+ .scode_table = XC3028_FE_ZARLINK456,
};
fe = dvb_attach(xc2028_attach, adap->fe, &cfg);
diff --git a/trunk/drivers/media/dvb/frontends/Kconfig b/trunk/drivers/media/dvb/frontends/Kconfig
index 7dbb4a223c99..574dffe91b68 100644
--- a/trunk/drivers/media/dvb/frontends/Kconfig
+++ b/trunk/drivers/media/dvb/frontends/Kconfig
@@ -135,8 +135,9 @@ config DVB_CX22702
config DVB_DRX397XD
tristate "Micronas DRX3975D/DRX3977D based"
- depends on DVB_CORE && I2C
+ depends on DVB_CORE && I2C && HOTPLUG
default m if DVB_FE_CUSTOMISE
+ select FW_LOADER
help
A DVB-T tuner module. Say Y when you want to support this frontend.
diff --git a/trunk/drivers/media/video/Kconfig b/trunk/drivers/media/video/Kconfig
index ecbfa1b39b70..d4a6e56a7135 100644
--- a/trunk/drivers/media/video/Kconfig
+++ b/trunk/drivers/media/video/Kconfig
@@ -630,7 +630,7 @@ config VIDEO_ZORAN_ZR36060
depends on VIDEO_ZORAN
help
Say Y to support Zoran boards based on 36060 chips.
- This includes Iomega Buz, Pinnacle DC10, Linux media Labs 33
+ This includes Iomega Bus, Pinnacle DC10, Linux media Labs 33
and 33 R10 and AverMedia 6 boards.
config VIDEO_ZORAN_BUZ
diff --git a/trunk/drivers/media/video/arv.c b/trunk/drivers/media/video/arv.c
index 9e436ad3d34b..56ebfd5ef6fa 100644
--- a/trunk/drivers/media/video/arv.c
+++ b/trunk/drivers/media/video/arv.c
@@ -29,7 +29,6 @@
#include
#include
#include
-#include
#include
#include
@@ -756,6 +755,7 @@ static const struct file_operations ar_fops = {
static struct video_device ar_template = {
.name = "Colour AR VGA",
+ .type = VID_TYPE_CAPTURE,
.fops = &ar_fops,
.release = ar_release,
.minor = -1,
diff --git a/trunk/drivers/media/video/em28xx/em28xx-cards.c b/trunk/drivers/media/video/em28xx/em28xx-cards.c
index 452da70e719f..476ae44a62d2 100644
--- a/trunk/drivers/media/video/em28xx/em28xx-cards.c
+++ b/trunk/drivers/media/video/em28xx/em28xx-cards.c
@@ -1015,7 +1015,6 @@ struct em28xx_board em28xx_boards[] = {
.valid = EM28XX_BOARD_NOT_VALIDATED,
.vchannels = 3,
.tuner_type = TUNER_XC2028,
- .mts_firmware = 1,
.decoder = EM28XX_TVP5150,
.input = { {
.type = EM28XX_VMUX_TELEVISION,
diff --git a/trunk/drivers/media/video/gspca/conex.c b/trunk/drivers/media/video/gspca/conex.c
index cd3a3f5829b2..44b0bffeb20e 100644
--- a/trunk/drivers/media/video/gspca/conex.c
+++ b/trunk/drivers/media/video/gspca/conex.c
@@ -123,7 +123,7 @@ static void reg_r(struct gspca_dev *gspca_dev,
{
struct usb_device *dev = gspca_dev->dev;
-#ifdef GSPCA_DEBUG
+#ifdef CONFIG_VIDEO_ADV_DEBUG
if (len > sizeof gspca_dev->usb_buf) {
err("reg_r: buffer overflow");
return;
@@ -163,7 +163,7 @@ static void reg_w(struct gspca_dev *gspca_dev,
{
struct usb_device *dev = gspca_dev->dev;
-#ifdef GSPCA_DEBUG
+#ifdef CONFIG_VIDEO_ADV_DEBUG
if (len > sizeof gspca_dev->usb_buf) {
err("reg_w: buffer overflow");
return;
diff --git a/trunk/drivers/media/video/gspca/etoms.c b/trunk/drivers/media/video/gspca/etoms.c
index 1dbe92d01e6a..c8c2f02fcf00 100644
--- a/trunk/drivers/media/video/gspca/etoms.c
+++ b/trunk/drivers/media/video/gspca/etoms.c
@@ -233,7 +233,7 @@ static void reg_r(struct gspca_dev *gspca_dev,
{
struct usb_device *dev = gspca_dev->dev;
-#ifdef GSPCA_DEBUG
+#ifdef CONFIG_VIDEO_ADV_DEBUG
if (len > sizeof gspca_dev->usb_buf) {
err("reg_r: buffer overflow");
return;
@@ -271,7 +271,7 @@ static void reg_w(struct gspca_dev *gspca_dev,
{
struct usb_device *dev = gspca_dev->dev;
-#ifdef GSPCA_DEBUG
+#ifdef CONFIG_VIDEO_ADV_DEBUG
if (len > sizeof gspca_dev->usb_buf) {
err("reg_w: buffer overflow");
return;
@@ -461,52 +461,6 @@ static void Et_init2(struct gspca_dev *gspca_dev)
reg_w_val(gspca_dev, 0x80, 0x20); /* 0x20; */
}
-static void setbrightness(struct gspca_dev *gspca_dev)
-{
- struct sd *sd = (struct sd *) gspca_dev;
- int i;
- __u8 brightness = sd->brightness;
-
- for (i = 0; i < 4; i++)
- reg_w_val(gspca_dev, ET_O_RED + i, brightness);
-}
-
-static void getbrightness(struct gspca_dev *gspca_dev)
-{
- struct sd *sd = (struct sd *) gspca_dev;
- int i;
- int brightness = 0;
-
- for (i = 0; i < 4; i++) {
- reg_r(gspca_dev, ET_O_RED + i, 1);
- brightness += gspca_dev->usb_buf[0];
- }
- sd->brightness = brightness >> 3;
-}
-
-static void setcontrast(struct gspca_dev *gspca_dev)
-{
- struct sd *sd = (struct sd *) gspca_dev;
- __u8 RGBG[] = { 0x80, 0x80, 0x80, 0x80, 0x00, 0x00 };
- __u8 contrast = sd->contrast;
-
- memset(RGBG, contrast, sizeof(RGBG) - 2);
- reg_w(gspca_dev, ET_G_RED, RGBG, 6);
-}
-
-static void getcontrast(struct gspca_dev *gspca_dev)
-{
- struct sd *sd = (struct sd *) gspca_dev;
- int i;
- int contrast = 0;
-
- for (i = 0; i < 4; i++) {
- reg_r(gspca_dev, ET_G_RED + i, 1);
- contrast += gspca_dev->usb_buf[0];
- }
- sd->contrast = contrast >> 2;
-}
-
static void setcolors(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
@@ -538,16 +492,6 @@ static void getcolors(struct gspca_dev *gspca_dev)
}
}
-static void setautogain(struct gspca_dev *gspca_dev)
-{
- struct sd *sd = (struct sd *) gspca_dev;
-
- if (sd->autogain)
- sd->ag_cnt = AG_CNT_START;
- else
- sd->ag_cnt = -1;
-}
-
static void Et_init1(struct gspca_dev *gspca_dev)
{
__u8 value;
@@ -670,7 +614,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
sd->contrast = CONTRAST_DEF;
sd->colors = COLOR_DEF;
sd->autogain = AUTOGAIN_DEF;
- sd->ag_cnt = -1;
return 0;
}
@@ -698,8 +641,6 @@ static void sd_start(struct gspca_dev *gspca_dev)
else
Et_init2(gspca_dev);
- setautogain(gspca_dev);
-
reg_w_val(gspca_dev, ET_RESET_ALL, 0x08);
et_video(gspca_dev, 1); /* video on */
}
@@ -717,6 +658,52 @@ static void sd_close(struct gspca_dev *gspca_dev)
{
}
+static void setbrightness(struct gspca_dev *gspca_dev)
+{
+ struct sd *sd = (struct sd *) gspca_dev;
+ int i;
+ __u8 brightness = sd->brightness;
+
+ for (i = 0; i < 4; i++)
+ reg_w_val(gspca_dev, ET_O_RED + i, brightness);
+}
+
+static void getbrightness(struct gspca_dev *gspca_dev)
+{
+ struct sd *sd = (struct sd *) gspca_dev;
+ int i;
+ int brightness = 0;
+
+ for (i = 0; i < 4; i++) {
+ reg_r(gspca_dev, ET_O_RED + i, 1);
+ brightness += gspca_dev->usb_buf[0];
+ }
+ sd->brightness = brightness >> 3;
+}
+
+static void setcontrast(struct gspca_dev *gspca_dev)
+{
+ struct sd *sd = (struct sd *) gspca_dev;
+ __u8 RGBG[] = { 0x80, 0x80, 0x80, 0x80, 0x00, 0x00 };
+ __u8 contrast = sd->contrast;
+
+ memset(RGBG, contrast, sizeof(RGBG) - 2);
+ reg_w(gspca_dev, ET_G_RED, RGBG, 6);
+}
+
+static void getcontrast(struct gspca_dev *gspca_dev)
+{
+ struct sd *sd = (struct sd *) gspca_dev;
+ int i;
+ int contrast = 0;
+
+ for (i = 0; i < 4; i++) {
+ reg_r(gspca_dev, ET_G_RED + i, 1);
+ contrast += gspca_dev->usb_buf[0];
+ }
+ sd->contrast = contrast >> 2;
+}
+
static __u8 Et_getgainG(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
@@ -746,22 +733,15 @@ static void Et_setgainG(struct gspca_dev *gspca_dev, __u8 gain)
#define LIMIT(color) \
(unsigned char)((color > 0xff)?0xff:((color < 0)?0:color))
-static void do_autogain(struct gspca_dev *gspca_dev)
+static void setautogain(struct gspca_dev *gspca_dev)
{
- struct sd *sd = (struct sd *) gspca_dev;
- __u8 luma;
+ __u8 luma = 0;
__u8 luma_mean = 128;
__u8 luma_delta = 20;
__u8 spring = 4;
- int Gbright;
+ int Gbright = 0;
__u8 r, g, b;
- if (sd->ag_cnt < 0)
- return;
- if (--sd->ag_cnt >= 0)
- return;
- sd->ag_cnt = AG_CNT_START;
-
Gbright = Et_getgainG(gspca_dev);
reg_r(gspca_dev, ET_LUMA_CENTER, 4);
g = (gspca_dev->usb_buf[0] + gspca_dev->usb_buf[3]) >> 1;
@@ -788,6 +768,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
__u8 *data, /* isoc packet */
int len) /* iso packet length */
{
+ struct sd *sd;
int seqframe;
seqframe = data[0] & 0x3f;
@@ -802,6 +783,13 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
frame = gspca_frame_add(gspca_dev, LAST_PACKET, frame,
data, 0);
gspca_frame_add(gspca_dev, FIRST_PACKET, frame, data, len);
+ sd = (struct sd *) gspca_dev;
+ if (sd->ag_cnt >= 0) {
+ if (--sd->ag_cnt < 0) {
+ sd->ag_cnt = AG_CNT_START;
+ setautogain(gspca_dev);
+ }
+ }
return;
}
if (len) {
@@ -874,8 +862,10 @@ static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val)
struct sd *sd = (struct sd *) gspca_dev;
sd->autogain = val;
- if (gspca_dev->streaming)
- setautogain(gspca_dev);
+ if (val)
+ sd->ag_cnt = AG_CNT_START;
+ else
+ sd->ag_cnt = -1;
return 0;
}
@@ -899,7 +889,6 @@ static struct sd_desc sd_desc = {
.stop0 = sd_stop0,
.close = sd_close,
.pkt_scan = sd_pkt_scan,
- .dq_callback = do_autogain,
};
/* -- module initialisation -- */
diff --git a/trunk/drivers/media/video/gspca/gspca.c b/trunk/drivers/media/video/gspca/gspca.c
index 15d302b28b79..3a051c925ff6 100644
--- a/trunk/drivers/media/video/gspca/gspca.c
+++ b/trunk/drivers/media/video/gspca/gspca.c
@@ -47,7 +47,7 @@ MODULE_LICENSE("GPL");
static int video_nr = -1;
-#ifdef GSPCA_DEBUG
+#ifdef CONFIG_VIDEO_ADV_DEBUG
int gspca_debug = D_ERR | D_PROBE;
EXPORT_SYMBOL(gspca_debug);
@@ -677,7 +677,7 @@ static int try_fmt_vid_cap(struct gspca_dev *gspca_dev,
w = fmt->fmt.pix.width;
h = fmt->fmt.pix.height;
-#ifdef GSPCA_DEBUG
+#ifdef CONFIG_VIDEO_ADV_DEBUG
if (gspca_debug & D_CONF)
PDEBUG_MODE("try fmt cap", fmt->fmt.pix.pixelformat, w, h);
#endif
@@ -785,7 +785,7 @@ static int dev_open(struct inode *inode, struct file *file)
}
gspca_dev->users++;
file->private_data = gspca_dev;
-#ifdef GSPCA_DEBUG
+#ifdef CONFIG_VIDEO_ADV_DEBUG
/* activate the v4l2 debug */
if (gspca_debug & D_V4L2)
gspca_dev->vdev.debug |= 3;
@@ -904,7 +904,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv,
if (ctrl->id != ctrls->qctrl.id)
continue;
if (ctrl->value < ctrls->qctrl.minimum
- || ctrl->value > ctrls->qctrl.maximum)
+ && ctrl->value > ctrls->qctrl.maximum)
return -ERANGE;
PDEBUG(D_CONF, "set ctrl [%08x] = %d", ctrl->id, ctrl->value);
if (mutex_lock_interruptible(&gspca_dev->usb_lock))
@@ -1080,7 +1080,7 @@ static int vidioc_streamon(struct file *file, void *priv,
if (ret < 0)
goto out;
}
-#ifdef GSPCA_DEBUG
+#ifdef CONFIG_VIDEO_ADV_DEBUG
if (gspca_debug & D_STREAM) {
PDEBUG_MODE("stream on OK",
gspca_dev->pixfmt,
@@ -1913,7 +1913,7 @@ static void __exit gspca_exit(void)
module_init(gspca_init);
module_exit(gspca_exit);
-#ifdef GSPCA_DEBUG
+#ifdef CONFIG_VIDEO_ADV_DEBUG
module_param_named(debug, gspca_debug, int, 0644);
MODULE_PARM_DESC(debug,
"Debug (bit) 0x01:error 0x02:probe 0x04:config"
diff --git a/trunk/drivers/media/video/gspca/gspca.h b/trunk/drivers/media/video/gspca/gspca.h
index 67e448940eaa..3fd2c4eee204 100644
--- a/trunk/drivers/media/video/gspca/gspca.h
+++ b/trunk/drivers/media/video/gspca/gspca.h
@@ -9,10 +9,7 @@
#include
#include
-/* compilation option */
-#define GSPCA_DEBUG 1
-
-#ifdef GSPCA_DEBUG
+#ifdef CONFIG_VIDEO_ADV_DEBUG
/* GSPCA our debug messages */
extern int gspca_debug;
#define PDEBUG(level, fmt, args...) \
diff --git a/trunk/drivers/media/video/gspca/ov519.c b/trunk/drivers/media/video/gspca/ov519.c
index b4f00ec0885c..83139efc4629 100644
--- a/trunk/drivers/media/video/gspca/ov519.c
+++ b/trunk/drivers/media/video/gspca/ov519.c
@@ -40,15 +40,14 @@ struct sd {
struct gspca_dev gspca_dev; /* !! must be the first item */
/* Determined by sensor type */
- char sif;
+ short maxwidth;
+ short maxheight;
unsigned char primary_i2c_slave; /* I2C write id of sensor */
unsigned char brightness;
unsigned char contrast;
unsigned char colors;
- __u8 hflip;
- __u8 vflip;
char compress; /* Should the next frame be compressed? */
char compress_inited; /* Are compression params uploaded? */
@@ -78,12 +77,9 @@ static int sd_setcontrast(struct gspca_dev *gspca_dev, __s32 val);
static int sd_getcontrast(struct gspca_dev *gspca_dev, __s32 *val);
static int sd_setcolors(struct gspca_dev *gspca_dev, __s32 val);
static int sd_getcolors(struct gspca_dev *gspca_dev, __s32 *val);
-static int sd_sethflip(struct gspca_dev *gspca_dev, __s32 val);
-static int sd_gethflip(struct gspca_dev *gspca_dev, __s32 *val);
-static int sd_setvflip(struct gspca_dev *gspca_dev, __s32 val);
-static int sd_getvflip(struct gspca_dev *gspca_dev, __s32 *val);
static struct ctrl sd_ctrls[] = {
+#define SD_BRIGHTNESS 0
{
{
.id = V4L2_CID_BRIGHTNESS,
@@ -92,12 +88,12 @@ static struct ctrl sd_ctrls[] = {
.minimum = 0,
.maximum = 255,
.step = 1,
-#define BRIGHTNESS_DEF 127
- .default_value = BRIGHTNESS_DEF,
+ .default_value = 127,
},
.set = sd_setbrightness,
.get = sd_getbrightness,
},
+#define SD_CONTRAST 1
{
{
.id = V4L2_CID_CONTRAST,
@@ -106,61 +102,31 @@ static struct ctrl sd_ctrls[] = {
.minimum = 0,
.maximum = 255,
.step = 1,
-#define CONTRAST_DEF 127
- .default_value = CONTRAST_DEF,
+ .default_value = 127,
},
.set = sd_setcontrast,
.get = sd_getcontrast,
},
+#define SD_COLOR 2
{
{
.id = V4L2_CID_SATURATION,
.type = V4L2_CTRL_TYPE_INTEGER,
- .name = "Color",
+ .name = "Saturation",
.minimum = 0,
.maximum = 255,
.step = 1,
-#define COLOR_DEF 127
- .default_value = COLOR_DEF,
+ .default_value = 127,
},
.set = sd_setcolors,
.get = sd_getcolors,
},
-/* next controls work with ov7670 only */
- {
- {
- .id = V4L2_CID_HFLIP,
- .type = V4L2_CTRL_TYPE_BOOLEAN,
- .name = "Mirror",
- .minimum = 0,
- .maximum = 1,
- .step = 1,
-#define HFLIP_DEF 0
- .default_value = HFLIP_DEF,
- },
- .set = sd_sethflip,
- .get = sd_gethflip,
- },
- {
- {
- .id = V4L2_CID_VFLIP,
- .type = V4L2_CTRL_TYPE_BOOLEAN,
- .name = "Vflip",
- .minimum = 0,
- .maximum = 1,
- .step = 1,
-#define VFLIP_DEF 0
- .default_value = VFLIP_DEF,
- },
- .set = sd_setvflip,
- .get = sd_getvflip,
- },
};
static struct v4l2_pix_format vga_mode[] = {
{320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
.bytesperline = 320,
- .sizeimage = 320 * 240 * 3 / 8 + 590,
+ .sizeimage = 320 * 240 * 3 / 8 + 589,
.colorspace = V4L2_COLORSPACE_JPEG,
.priv = 1},
{640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
@@ -172,12 +138,12 @@ static struct v4l2_pix_format vga_mode[] = {
static struct v4l2_pix_format sif_mode[] = {
{176, 144, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
.bytesperline = 176,
- .sizeimage = 176 * 144 * 3 / 8 + 590,
+ .sizeimage = 176 * 144 * 3 / 8 + 589,
.colorspace = V4L2_COLORSPACE_JPEG,
.priv = 1},
{352, 288, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
.bytesperline = 352,
- .sizeimage = 352 * 288 * 3 / 8 + 590,
+ .sizeimage = 352 * 288 * 3 / 8 + 589,
.colorspace = V4L2_COLORSPACE_JPEG,
.priv = 0},
};
@@ -259,7 +225,6 @@ static struct v4l2_pix_format sif_mode[] = {
#define OV7670_REG_VSTART 0x19 /* Vert start high bits */
#define OV7670_REG_VSTOP 0x1a /* Vert stop high bits */
#define OV7670_REG_MVFP 0x1e /* Mirror / vflip */
-#define OV7670_MVFP_VFLIP 0x10 /* vertical flip */
#define OV7670_MVFP_MIRROR 0x20 /* Mirror image */
#define OV7670_REG_AEW 0x24 /* AGC upper limit */
#define OV7670_REG_AEB 0x25 /* AGC lower limit */
@@ -293,6 +258,16 @@ static struct v4l2_pix_format sif_mode[] = {
#define OV7670_REG_HAECC7 0xaa /* Hist AEC/AGC control 7 */
#define OV7670_REG_BD60MAX 0xab /* 60hz banding step limit */
+struct ovsensor_window {
+ short x;
+ short y;
+ short width;
+ short height;
+/* int format; */
+ short quarter; /* Scale width and height down 2x */
+ short clockdiv; /* Clock divisor setting */
+};
+
static unsigned char ov7670_abs_to_sm(unsigned char v)
{
if (v > 127)
@@ -524,6 +499,19 @@ static int init_ov_sensor(struct sd *sd)
return 0;
}
+/* Switch on standard JPEG compression. Returns 0 for success. */
+static int ov519_init_compression(struct sd *sd)
+{
+ if (!sd->compress_inited) {
+ if (reg_w_mask(sd, OV519_SYS_EN_CLK1, 1 << 2, 1 << 2) < 0) {
+ PDEBUG(D_ERR, "Error switching to compressed mode");
+ return -EIO;
+ }
+ sd->compress_inited = 1;
+ }
+ return 0;
+}
+
/* Set the read and write slave IDs. The "slave" argument is the write slave,
* and the read slave will be set to (slave + 1).
* This should not be called from outside the i2c I/O functions.
@@ -693,17 +681,21 @@ static int ov8xx0_configure(struct sd *sd)
return -1;
}
if ((rc & 3) == 1) {
+ PDEBUG(D_PROBE, "Sensor is an OV8610");
sd->sensor = SEN_OV8610;
} else {
PDEBUG(D_ERR, "Unknown image sensor version: %d", rc & 3);
return -1;
}
PDEBUG(D_PROBE, "Writing 8610 registers");
- if (write_i2c_regvals(sd, norm_8610, ARRAY_SIZE(norm_8610)))
+ if (write_i2c_regvals(sd,
+ norm_8610,
+ sizeof norm_8610 / sizeof norm_8610[0]))
return -1;
/* Set sensor-specific vars */
-/* sd->sif = 0; already done */
+ sd->maxwidth = 640;
+ sd->maxheight = 480;
return 0;
}
@@ -833,7 +825,7 @@ static int ov7xx0_configure(struct sd *sd)
{ OV7670_REG_COM7, OV7670_COM7_RESET },
{ OV7670_REG_TSLB, 0x04 }, /* OV */
{ OV7670_REG_COM7, OV7670_COM7_FMT_VGA }, /* VGA */
- { OV7670_REG_CLKRC, 0x01 },
+ { OV7670_REG_CLKRC, 0x1 },
/*
* Set the hardware window. These values from OV don't entirely
* make sense - hstop is less than hstart. But they work...
@@ -847,12 +839,16 @@ static int ov7xx0_configure(struct sd *sd)
{ 0x70, 0x3a }, { 0x71, 0x35 },
{ 0x72, 0x11 }, { 0x73, 0xf0 },
{ 0xa2, 0x02 },
-/* { OV7670_REG_COM10, 0x0 }, */
+/* jfm */
+/* { OV7670_REG_COM10, 0x0 }, */
/* Gamma curve values */
{ 0x7a, 0x20 },
+/* jfm:win 7b=1c */
{ 0x7b, 0x10 },
+/* jfm:win 7c=28 */
{ 0x7c, 0x1e },
+/* jfm:win 7d=3c */
{ 0x7d, 0x35 },
{ 0x7e, 0x5a }, { 0x7f, 0x69 },
{ 0x80, 0x76 }, { 0x81, 0x80 },
@@ -868,11 +864,13 @@ static int ov7xx0_configure(struct sd *sd)
| OV7670_COM8_BFILT },
{ OV7670_REG_GAIN, 0 }, { OV7670_REG_AECH, 0 },
{ OV7670_REG_COM4, 0x40 }, /* magic reserved bit */
+/* jfm:win 14=38 */
{ OV7670_REG_COM9, 0x18 }, /* 4x gain + magic rsvd bit */
{ OV7670_REG_BD50MAX, 0x05 }, { OV7670_REG_BD60MAX, 0x07 },
{ OV7670_REG_AEW, 0x95 }, { OV7670_REG_AEB, 0x33 },
{ OV7670_REG_VPT, 0xe3 }, { OV7670_REG_HAECC1, 0x78 },
{ OV7670_REG_HAECC2, 0x68 },
+/* jfm:win a1=0b */
{ 0xa1, 0x03 }, /* magic */
{ OV7670_REG_HAECC3, 0xd8 }, { OV7670_REG_HAECC4, 0xd8 },
{ OV7670_REG_HAECC5, 0xf0 }, { OV7670_REG_HAECC6, 0x90 },
@@ -886,6 +884,8 @@ static int ov7xx0_configure(struct sd *sd)
/* Almost all of these are magic "reserved" values. */
{ OV7670_REG_COM5, 0x61 }, { OV7670_REG_COM6, 0x4b },
{ 0x16, 0x02 },
+/* jfm */
+/* { OV7670_REG_MVFP, 0x07|OV7670_MVFP_MIRROR }, */
{ OV7670_REG_MVFP, 0x07 },
{ 0x21, 0x02 }, { 0x22, 0x91 },
{ 0x29, 0x07 }, { 0x33, 0x0b },
@@ -930,10 +930,7 @@ static int ov7xx0_configure(struct sd *sd)
{ OV7670_REG_EDGE, 0 },
{ 0x75, 0x05 }, { 0x76, 0xe1 },
{ 0x4c, 0 }, { 0x77, 0x01 },
- { OV7670_REG_COM13, OV7670_COM13_GAMMA
- | OV7670_COM13_UVSAT
- | 2}, /* was 3 */
- { 0x4b, 0x09 },
+ { OV7670_REG_COM13, 0xc3 }, { 0x4b, 0x09 },
{ 0xc9, 0x60 }, { OV7670_REG_COM16, 0x38 },
{ 0x56, 0x40 },
@@ -959,10 +956,30 @@ static int ov7xx0_configure(struct sd *sd)
{ 0x79, 0x03 }, { 0xc8, 0x40 },
{ 0x79, 0x05 }, { 0xc8, 0x30 },
{ 0x79, 0x26 },
- };
+
+ /* Format YUV422 */
+ { OV7670_REG_COM7, OV7670_COM7_YUV }, /* Selects YUV mode */
+ { OV7670_REG_RGB444, 0 }, /* No RGB444 please */
+ { OV7670_REG_COM1, 0 },
+ { OV7670_REG_COM15, OV7670_COM15_R00FF },
+ { OV7670_REG_COM9, 0x18 },
+ /* 4x gain ceiling; 0x8 is reserved bit */
+ { 0x4f, 0x80 }, /* "matrix coefficient 1" */
+ { 0x50, 0x80 }, /* "matrix coefficient 2" */
+ { 0x52, 0x22 }, /* "matrix coefficient 4" */
+ { 0x53, 0x5e }, /* "matrix coefficient 5" */
+ { 0x54, 0x80 }, /* "matrix coefficient 6" */
+ { OV7670_REG_COM13, OV7670_COM13_GAMMA|OV7670_COM13_UVSAT },
+};
PDEBUG(D_PROBE, "starting OV7xx0 configuration");
+/* jfm:already done? */
+ if (init_ov_sensor(sd) < 0)
+ PDEBUG(D_ERR, "Failed to read sensor ID");
+ else
+ PDEBUG(D_PROBE, "OV7xx0 initialized");
+
/* Detect sensor (sub)type */
rc = i2c_r(sd, OV7610_REG_COM_I);
@@ -1008,25 +1025,20 @@ static int ov7xx0_configure(struct sd *sd)
return low;
}
if (high == 0x76) {
- switch (low) {
- case 0x30:
+ if (low == 0x30) {
PDEBUG(D_PROBE, "Sensor is an OV7630/OV7635");
sd->sensor = SEN_OV7630;
- break;
- case 0x40:
+ } else if (low == 0x40) {
PDEBUG(D_PROBE, "Sensor is an OV7645");
sd->sensor = SEN_OV7640; /* FIXME */
- break;
- case 0x45:
+ } else if (low == 0x45) {
PDEBUG(D_PROBE, "Sensor is an OV7645B");
sd->sensor = SEN_OV7640; /* FIXME */
- break;
- case 0x48:
+ } else if (low == 0x48) {
PDEBUG(D_PROBE, "Sensor is an OV7648");
sd->sensor = SEN_OV7640; /* FIXME */
- break;
- default:
- PDEBUG(D_PROBE, "Unknown sensor: 0x76%x", low);
+ } else {
+ PDEBUG(D_PROBE, "Unknown sensor: 0x76%X", low);
return -1;
}
} else {
@@ -1038,34 +1050,34 @@ static int ov7xx0_configure(struct sd *sd)
return -1;
}
- switch (sd->sensor) {
- case SEN_OV7620:
+ if (sd->sensor == SEN_OV7620) {
PDEBUG(D_PROBE, "Writing 7620 registers");
- if (write_i2c_regvals(sd, norm_7620, ARRAY_SIZE(norm_7620)))
+ if (write_i2c_regvals(sd, norm_7620,
+ sizeof norm_7620 / sizeof norm_7620[0]))
return -1;
- break;
- case SEN_OV7630:
+ } else if (sd->sensor == SEN_OV7630) {
PDEBUG(D_ERR, "7630 is not supported by this driver version");
return -1;
- case SEN_OV7640:
+ } else if (sd->sensor == SEN_OV7640) {
PDEBUG(D_PROBE, "Writing 7640 registers");
- if (write_i2c_regvals(sd, norm_7640, ARRAY_SIZE(norm_7640)))
+ if (write_i2c_regvals(sd, norm_7640,
+ sizeof norm_7640 / sizeof norm_7640[0]))
return -1;
- break;
- case SEN_OV7670:
+ } else if (sd->sensor == SEN_OV7670) {
PDEBUG(D_PROBE, "Writing 7670 registers");
- if (write_i2c_regvals(sd, norm_7670, ARRAY_SIZE(norm_7670)))
+ if (write_i2c_regvals(sd, norm_7670,
+ sizeof norm_7670 / sizeof norm_7670[0]))
return -1;
- break;
- default:
+ } else {
PDEBUG(D_PROBE, "Writing 7610 registers");
- if (write_i2c_regvals(sd, norm_7610, ARRAY_SIZE(norm_7610)))
+ if (write_i2c_regvals(sd, norm_7610,
+ sizeof norm_7610 / sizeof norm_7610[0]))
return -1;
- break;
}
/* Set sensor-specific vars */
-/* sd->sif = 0; already done */
+ sd->maxwidth = 640;
+ sd->maxheight = 480;
return 0;
}
@@ -1219,45 +1231,43 @@ static int ov6xx0_configure(struct sd *sd)
/* Ugh. The first two bits are the version bits, but
* the entire register value must be used. I guess OVT
* underestimated how many variants they would make. */
- switch (rc) {
- case 0x00:
+ if (rc == 0x00) {
sd->sensor = SEN_OV6630;
PDEBUG(D_ERR,
"WARNING: Sensor is an OV66308. Your camera may have");
PDEBUG(D_ERR, "been misdetected in previous driver versions.");
- break;
- case 0x01:
+ } else if (rc == 0x01) {
sd->sensor = SEN_OV6620;
- break;
- case 0x02:
+ PDEBUG(D_PROBE, "Sensor is an OV6620");
+ } else if (rc == 0x02) {
sd->sensor = SEN_OV6630;
PDEBUG(D_PROBE, "Sensor is an OV66308AE");
- break;
- case 0x03:
+ } else if (rc == 0x03) {
sd->sensor = SEN_OV6630;
PDEBUG(D_PROBE, "Sensor is an OV66308AF");
- break;
- case 0x90:
+ } else if (rc == 0x90) {
sd->sensor = SEN_OV6630;
PDEBUG(D_ERR,
"WARNING: Sensor is an OV66307. Your camera may have");
PDEBUG(D_ERR, "been misdetected in previous driver versions.");
- break;
- default:
+ } else {
PDEBUG(D_ERR, "FATAL: Unknown sensor version: 0x%02x", rc);
return -1;
}
/* Set sensor-specific vars */
- sd->sif = 1;
+ sd->maxwidth = 352;
+ sd->maxheight = 288;
if (sd->sensor == SEN_OV6620) {
PDEBUG(D_PROBE, "Writing 6x20 registers");
- if (write_i2c_regvals(sd, norm_6x20, ARRAY_SIZE(norm_6x20)))
+ if (write_i2c_regvals(sd, norm_6x20,
+ sizeof norm_6x20 / sizeof norm_6x20[0]))
return -1;
} else {
PDEBUG(D_PROBE, "Writing 6x30 registers");
- if (write_i2c_regvals(sd, norm_6x30, ARRAY_SIZE(norm_6x30)))
+ if (write_i2c_regvals(sd, norm_6x30,
+ sizeof norm_6x30 / sizeof norm_6x30[0]))
return -1;
}
return 0;
@@ -1266,8 +1276,14 @@ static int ov6xx0_configure(struct sd *sd)
/* Turns on or off the LED. Only has an effect with OV511+/OV518(+)/OV519 */
static void ov51x_led_control(struct sd *sd, int on)
{
-/* PDEBUG(D_STREAM, "LED (%s)", on ? "on" : "off"); */
- reg_w_mask(sd, OV519_GPIO_DATA_OUT0, !on, 1); /* 0 / 1 */
+ PDEBUG(D_STREAM, "LED (%s)", on ? "on" : "off");
+
+/* if (sd->bridge == BRG_OV511PLUS) */
+/* reg_w(sd, R511_SYS_LED_CTL, on ? 1 : 0); */
+/* else if (sd->bridge == BRG_OV519) */
+ reg_w_mask(sd, OV519_GPIO_DATA_OUT0, !on, 1); /* 0 / 1 */
+/* else if (sd->bclass == BCL_OV518) */
+/* reg_w_mask(sd, R518_GPIO_OUT, on ? 0x02 : 0x00, 0x02); */
}
/* this function is called at probe time */
@@ -1277,8 +1293,11 @@ static int sd_config(struct gspca_dev *gspca_dev,
struct sd *sd = (struct sd *) gspca_dev;
struct cam *cam;
+/* (from ov519_configure) */
static const struct ov_regvals init_519[] = {
{ 0x5a, 0x6d }, /* EnableSystem */
+/* jfm trace usbsnoop3-1.txt */
+/* jfm 53 = fb */
{ 0x53, 0x9b },
{ 0x54, 0xff }, /* set bit2 to enable jpeg */
{ 0x5d, 0x03 },
@@ -1295,6 +1314,9 @@ static int sd_config(struct gspca_dev *gspca_dev,
if (write_regvals(sd, init_519, ARRAY_SIZE(init_519)))
goto error;
+/* jfm: not seen in windows trace */
+ if (ov519_init_compression(sd))
+ goto error;
ov51x_led_control(sd, 0); /* turn LED off */
/* Test for 76xx */
@@ -1343,18 +1365,16 @@ static int sd_config(struct gspca_dev *gspca_dev,
cam = &gspca_dev->cam;
cam->epaddr = OV511_ENDPOINT_ADDRESS;
- if (!sd->sif) {
+ if (sd->maxwidth == 640) {
cam->cam_mode = vga_mode;
- cam->nmodes = ARRAY_SIZE(vga_mode);
+ cam->nmodes = sizeof vga_mode / sizeof vga_mode[0];
} else {
cam->cam_mode = sif_mode;
- cam->nmodes = ARRAY_SIZE(sif_mode);
+ cam->nmodes = sizeof sif_mode / sizeof sif_mode[0];
}
- sd->brightness = BRIGHTNESS_DEF;
- sd->contrast = CONTRAST_DEF;
- sd->colors = COLOR_DEF;
- sd->hflip = HFLIP_DEF;
- sd->vflip = VFLIP_DEF;
+ sd->brightness = sd_ctrls[SD_BRIGHTNESS].qctrl.default_value;
+ sd->contrast = sd_ctrls[SD_CONTRAST].qctrl.default_value;
+ sd->colors = sd_ctrls[SD_COLOR].qctrl.default_value;
return 0;
error:
PDEBUG(D_ERR, "OV519 Config failed");
@@ -1374,7 +1394,8 @@ static int sd_open(struct gspca_dev *gspca_dev)
*
* Do not put any sensor-specific code in here (including I2C I/O functions)
*/
-static int ov519_mode_init_regs(struct sd *sd)
+static int ov519_mode_init_regs(struct sd *sd,
+ int width, int height)
{
static const struct ov_regvals mode_init_519_ov7670[] = {
{ 0x5d, 0x03 }, /* Turn off suspend mode */
@@ -1420,23 +1441,36 @@ static int ov519_mode_init_regs(struct sd *sd)
/* windows reads 0x55 at this point, why? */
};
+/* int hi_res; */
+
+ PDEBUG(D_CONF, "mode init %dx%d", width, height);
+
+/* if (width >= 800 && height >= 600)
+ hi_res = 1;
+ else
+ hi_res = 0; */
+
+/* if (ov51x_stop(sd) < 0)
+ return -EIO; */
+
/******** Set the mode ********/
if (sd->sensor != SEN_OV7670) {
if (write_regvals(sd, mode_init_519,
ARRAY_SIZE(mode_init_519)))
return -EIO;
- if (sd->sensor == SEN_OV7640) {
- /* Select 8-bit input mode */
- reg_w_mask(sd, OV519_CAM_DFR, 0x10, 0x10);
- }
} else {
if (write_regvals(sd, mode_init_519_ov7670,
ARRAY_SIZE(mode_init_519_ov7670)))
return -EIO;
}
- reg_w(sd, OV519_CAM_H_SIZE, sd->gspca_dev.width >> 4);
- reg_w(sd, OV519_CAM_V_SIZE, sd->gspca_dev.height >> 3);
+ if (sd->sensor == SEN_OV7640) {
+ /* Select 8-bit input mode */
+ reg_w_mask(sd, OV519_CAM_DFR, 0x10, 0x10);
+ }
+
+ reg_w(sd, OV519_CAM_H_SIZE, width >> 4);
+ reg_w(sd, OV519_CAM_V_SIZE, height >> 3);
reg_w(sd, OV519_CAM_X_OFFSETL, 0x00);
reg_w(sd, OV519_CAM_X_OFFSETH, 0x00);
reg_w(sd, OV519_CAM_Y_OFFSETL, 0x00);
@@ -1451,10 +1485,9 @@ static int ov519_mode_init_regs(struct sd *sd)
/* FIXME: These are only valid at the max resolution. */
sd->clockdiv = 0;
- switch (sd->sensor) {
- case SEN_OV7640:
+ if (sd->sensor == SEN_OV7640) {
switch (sd->frame_rate) {
-/*fixme: default was 30 fps */
+/*jfm: default was 30 fps */
case 30:
reg_w(sd, 0xa4, 0x0c);
reg_w(sd, 0x23, 0xff);
@@ -1484,8 +1517,7 @@ static int ov519_mode_init_regs(struct sd *sd)
sd->clockdiv = 1;
break;
}
- break;
- case SEN_OV8610:
+ } else if (sd->sensor == SEN_OV8610) {
switch (sd->frame_rate) {
default: /* 15 fps */
/* case 15: */
@@ -1501,37 +1533,41 @@ static int ov519_mode_init_regs(struct sd *sd)
reg_w(sd, 0x23, 0x1b);
break;
}
- break;
- case SEN_OV7670: /* guesses, based on 7640 */
+ sd->clockdiv = 0;
+ } else if (sd->sensor == SEN_OV7670) { /* guesses, based on 7640 */
PDEBUG(D_STREAM, "Setting framerate to %d fps",
(sd->frame_rate == 0) ? 15 : sd->frame_rate);
- reg_w(sd, 0xa4, 0x10);
switch (sd->frame_rate) {
case 30:
+ reg_w(sd, 0xa4, 0x10);
reg_w(sd, 0x23, 0xff);
break;
case 20:
+ reg_w(sd, 0xa4, 0x10);
reg_w(sd, 0x23, 0x1b);
break;
- default:
-/* case 15: */
+ default: /* 15 fps */
+/* case 15: */
+ reg_w(sd, 0xa4, 0x10);
reg_w(sd, 0x23, 0xff);
sd->clockdiv = 1;
break;
}
- break;
}
+/* if (ov51x_restart(sd) < 0)
+ return -EIO; */
+
+ /* Reset it just for good measure */
+/* if (ov51x_reset(sd, OV511_RESET_NOREGS) < 0)
+ return -EIO; */
return 0;
}
-static int mode_init_ov_sensor_regs(struct sd *sd)
+static int mode_init_ov_sensor_regs(struct sd *sd,
+ struct ovsensor_window *win)
{
- struct gspca_dev *gspca_dev;
- int qvga;
-
- gspca_dev = &sd->gspca_dev;
- qvga = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv;
+ int qvga = win->quarter;
/******** Mode (VGA/QVGA) and sensor specific regs ********/
switch (sd->sensor) {
@@ -1575,6 +1611,8 @@ static int mode_init_ov_sensor_regs(struct sd *sd)
OV7670_COM7_FMT_MASK);
break;
case SEN_OV6620:
+ i2c_w_mask(sd, 0x14, qvga ? 0x20 : 0x00, 0x20);
+ break;
case SEN_OV6630:
i2c_w_mask(sd, 0x14, qvga ? 0x20 : 0x00, 0x20);
break;
@@ -1583,21 +1621,24 @@ static int mode_init_ov_sensor_regs(struct sd *sd)
}
/******** Palette-specific regs ********/
- if (sd->sensor == SEN_OV7610 || sd->sensor == SEN_OV76BE) {
- /* not valid on the OV6620/OV7620/6630? */
- i2c_w_mask(sd, 0x0e, 0x00, 0x40);
- }
+/* Need to do work here for the OV7670 */
- /* The OV518 needs special treatment. Although both the OV518
- * and the OV6630 support a 16-bit video bus, only the 8 bit Y
- * bus is actually used. The UV bus is tied to ground.
- * Therefore, the OV6630 needs to be in 8-bit multiplexed
- * output mode */
+ if (sd->sensor == SEN_OV7610 || sd->sensor == SEN_OV76BE) {
+ /* not valid on the OV6620/OV7620/6630? */
+ i2c_w_mask(sd, 0x0e, 0x00, 0x40);
+ }
+
+ /* The OV518 needs special treatment. Although both the OV518
+ * and the OV6630 support a 16-bit video bus, only the 8 bit Y
+ * bus is actually used. The UV bus is tied to ground.
+ * Therefore, the OV6630 needs to be in 8-bit multiplexed
+ * output mode */
- /* OV7640 is 8-bit only */
+ /* OV7640 is 8-bit only */
- if (sd->sensor != SEN_OV6630 && sd->sensor != SEN_OV7640)
- i2c_w_mask(sd, 0x13, 0x00, 0x20);
+ if (sd->sensor != SEN_OV6630 && sd->sensor != SEN_OV7640)
+ i2c_w_mask(sd, 0x13, 0x00, 0x20);
+/* } */
/******** Clock programming ********/
/* The OV6620 needs special handling. This prevents the
@@ -1606,14 +1647,14 @@ static int mode_init_ov_sensor_regs(struct sd *sd)
/* Clock down */
i2c_w(sd, 0x2a, 0x04);
- i2c_w(sd, 0x11, sd->clockdiv);
+ i2c_w(sd, 0x11, win->clockdiv);
i2c_w(sd, 0x2a, 0x84);
/* This next setting is critical. It seems to improve
* the gain or the contrast. The "reserved" bits seem
* to have some effect in this case. */
i2c_w(sd, 0x2d, 0x85);
- } else if (sd->clockdiv >= 0) {
- i2c_w(sd, 0x11, sd->clockdiv);
+ } else if (win->clockdiv >= 0) {
+ i2c_w(sd, 0x11, win->clockdiv);
}
/******** Special Features ********/
@@ -1633,7 +1674,7 @@ static int mode_init_ov_sensor_regs(struct sd *sd)
/* is fully tested. */
/* 7620/6620/6630? don't have register 0x35, so play it safe */
if (sd->sensor == SEN_OV7610 || sd->sensor == SEN_OV76BE) {
- if (!qvga)
+ if (win->width == 640 /*&& win->height == 480*/)
i2c_w(sd, 0x35, 0x9e);
else
i2c_w(sd, 0x35, 0x1e);
@@ -1641,31 +1682,13 @@ static int mode_init_ov_sensor_regs(struct sd *sd)
return 0;
}
-static void sethvflip(struct sd *sd)
+static int set_ov_sensor_window(struct sd *sd,
+ struct ovsensor_window *win)
{
- if (sd->sensor != SEN_OV7670)
- return;
- if (sd->gspca_dev.streaming)
- ov51x_stop(sd);
- i2c_w_mask(sd, OV7670_REG_MVFP,
- OV7670_MVFP_MIRROR * sd->hflip
- | OV7670_MVFP_VFLIP * sd->vflip,
- OV7670_MVFP_MIRROR | OV7670_MVFP_VFLIP);
- if (sd->gspca_dev.streaming)
- ov51x_restart(sd);
-}
-
-static int set_ov_sensor_window(struct sd *sd)
-{
- struct gspca_dev *gspca_dev;
- int qvga;
int hwsbase, hwebase, vwsbase, vwebase, hwscale, vwscale;
int ret, hstart, hstop, vstop, vstart;
__u8 v;
- gspca_dev = &sd->gspca_dev;
- qvga = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv;
-
/* The different sensor ICs handle setting up of window differently.
* IF YOU SET IT WRONG, YOU WILL GET ALL ZERO ISOC DATA FROM OV51x!! */
switch (sd->sensor) {
@@ -1710,7 +1733,7 @@ static int set_ov_sensor_window(struct sd *sd)
switch (sd->sensor) {
case SEN_OV6620:
case SEN_OV6630:
- if (qvga) { /* QCIF */
+ if (win->quarter) { /* QCIF */
hwscale = 0;
vwscale = 0;
} else { /* CIF */
@@ -1720,7 +1743,7 @@ static int set_ov_sensor_window(struct sd *sd)
}
break;
case SEN_OV8610:
- if (qvga) { /* QSVGA */
+ if (win->quarter) { /* QSVGA */
hwscale = 1;
vwscale = 1;
} else { /* SVGA */
@@ -1729,7 +1752,7 @@ static int set_ov_sensor_window(struct sd *sd)
}
break;
default: /* SEN_OV7xx0 */
- if (qvga) { /* QVGA */
+ if (win->quarter) { /* QVGA */
hwscale = 1;
vwscale = 0;
} else { /* VGA */
@@ -1738,7 +1761,7 @@ static int set_ov_sensor_window(struct sd *sd)
}
}
- ret = mode_init_ov_sensor_regs(sd);
+ ret = mode_init_ov_sensor_regs(sd, win);
if (ret < 0)
return ret;
@@ -1759,7 +1782,7 @@ static int set_ov_sensor_window(struct sd *sd)
/* I can hard code this for OV7670s */
/* Yes, these numbers do look odd, but they're tested and work! */
if (sd->sensor == SEN_OV7670) {
- if (qvga) { /* QVGA from ov7670.c by
+ if (win->quarter) { /* QVGA from ov7670.c by
* Jonathan Corbet */
hstart = 164;
hstop = 20;
@@ -1773,45 +1796,75 @@ static int set_ov_sensor_window(struct sd *sd)
}
/* OV7670 hardware window registers are split across
* multiple locations */
- i2c_w(sd, OV7670_REG_HSTART, hstart >> 3);
- i2c_w(sd, OV7670_REG_HSTOP, hstop >> 3);
+ i2c_w(sd, OV7670_REG_HSTART, (hstart >> 3) & 0xff);
+ i2c_w(sd, OV7670_REG_HSTOP, (hstop >> 3) & 0xff);
v = i2c_r(sd, OV7670_REG_HREF);
v = (v & 0xc0) | ((hstop & 0x7) << 3) | (hstart & 0x07);
msleep(10); /* need to sleep between read and write to
* same reg! */
i2c_w(sd, OV7670_REG_HREF, v);
- i2c_w(sd, OV7670_REG_VSTART, vstart >> 2);
- i2c_w(sd, OV7670_REG_VSTOP, vstop >> 2);
+ i2c_w(sd, OV7670_REG_VSTART, (vstart >> 2) & 0xff);
+ i2c_w(sd, OV7670_REG_VSTOP, (vstop >> 2) & 0xff);
v = i2c_r(sd, OV7670_REG_VREF);
v = (v & 0xc0) | ((vstop & 0x3) << 2) | (vstart & 0x03);
msleep(10); /* need to sleep between read and write to
* same reg! */
i2c_w(sd, OV7670_REG_VREF, v);
- sethvflip(sd);
+
} else {
- i2c_w(sd, 0x17, hwsbase);
- i2c_w(sd, 0x18, hwebase + (sd->gspca_dev.width >> hwscale));
- i2c_w(sd, 0x19, vwsbase);
- i2c_w(sd, 0x1a, vwebase + (sd->gspca_dev.height >> vwscale));
+ i2c_w(sd, 0x17, hwsbase + (win->x >> hwscale));
+ i2c_w(sd, 0x18, hwebase + ((win->x + win->width) >> hwscale));
+ i2c_w(sd, 0x19, vwsbase + (win->y >> vwscale));
+ i2c_w(sd, 0x1a, vwebase + ((win->y + win->height) >> vwscale));
}
return 0;
}
+static int ov_sensor_mode_setup(struct sd *sd,
+ int width, int height)
+{
+ struct ovsensor_window win;
+
+/* win.format = mode; */
+
+ /* Unless subcapture is enabled,
+ * center the image window and downsample
+ * if possible to increase the field of view */
+ /* NOTE: OV518(+) and OV519 does downsampling on its own */
+ win.width = width;
+ win.height = height;
+ if (width == sd->maxwidth)
+ win.quarter = 0;
+ else
+ win.quarter = 1;
+
+ /* Center it */
+ win.x = (win.width - width) / 2;
+ win.y = (win.height - height) / 2;
+
+ /* Clock is determined by OV519 frame rate code */
+ win.clockdiv = sd->clockdiv;
+
+ PDEBUG(D_CONF, "Setting clock divider to %d", win.clockdiv);
+ return set_ov_sensor_window(sd, &win);
+}
+
/* -- start the camera -- */
static void sd_start(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
int ret;
- ret = ov519_mode_init_regs(sd);
+
+ ret = ov519_mode_init_regs(sd, gspca_dev->width, gspca_dev->height);
if (ret < 0)
goto out;
- ret = set_ov_sensor_window(sd);
+ ret = ov_sensor_mode_setup(sd, gspca_dev->width, gspca_dev->height);
if (ret < 0)
goto out;
- ret = ov51x_restart(sd);
+ ret = ov51x_restart((struct sd *) gspca_dev);
if (ret < 0)
goto out;
PDEBUG(D_STREAM, "camera started alt: 0x%02x", gspca_dev->alt);
@@ -1885,10 +1938,12 @@ static void setbrightness(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
int val;
+/* int was_streaming; */
val = sd->brightness;
PDEBUG(D_CONF, "brightness:%d", val);
-/* if (gspca_dev->streaming)
+/* was_streaming = gspca_dev->streaming;
+ * if (was_streaming)
* ov51x_stop(sd); */
switch (sd->sensor) {
case SEN_OV8610:
@@ -1906,12 +1961,12 @@ static void setbrightness(struct gspca_dev *gspca_dev)
i2c_w(sd, OV7610_REG_BRT, val);
break;
case SEN_OV7670:
-/*win trace
+/*jfm - from windblows
* i2c_w_mask(sd, OV7670_REG_COM8, 0, OV7670_COM8_AEC); */
i2c_w(sd, OV7670_REG_BRIGHT, ov7670_abs_to_sm(val));
break;
}
-/* if (gspca_dev->streaming)
+/* if (was_streaming)
* ov51x_restart(sd); */
}
@@ -1919,10 +1974,12 @@ static void setcontrast(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
int val;
+/* int was_streaming; */
val = sd->contrast;
PDEBUG(D_CONF, "contrast:%d", val);
-/* if (gspca_dev->streaming)
+/* was_streaming = gspca_dev->streaming;
+ if (was_streaming)
ov51x_stop(sd); */
switch (sd->sensor) {
case SEN_OV7610:
@@ -1959,7 +2016,7 @@ static void setcontrast(struct gspca_dev *gspca_dev)
i2c_w(sd, OV7670_REG_CONTRAS, val >> 1);
break;
}
-/* if (gspca_dev->streaming)
+/* if (was_streaming)
ov51x_restart(sd); */
}
@@ -1967,10 +2024,12 @@ static void setcolors(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
int val;
+/* int was_streaming; */
val = sd->colors;
PDEBUG(D_CONF, "saturation:%d", val);
-/* if (gspca_dev->streaming)
+/* was_streaming = gspca_dev->streaming;
+ if (was_streaming)
ov51x_stop(sd); */
switch (sd->sensor) {
case SEN_OV8610:
@@ -1996,7 +2055,7 @@ static void setcolors(struct gspca_dev *gspca_dev)
/* set REG_COM13 values for UV sat auto mode */
break;
}
-/* if (gspca_dev->streaming)
+/* if (was_streaming)
ov51x_restart(sd); */
}
@@ -2051,40 +2110,6 @@ static int sd_getcolors(struct gspca_dev *gspca_dev, __s32 *val)
return 0;
}
-static int sd_sethflip(struct gspca_dev *gspca_dev, __s32 val)
-{
- struct sd *sd = (struct sd *) gspca_dev;
-
- sd->hflip = val;
- sethvflip(sd);
- return 0;
-}
-
-static int sd_gethflip(struct gspca_dev *gspca_dev, __s32 *val)
-{
- struct sd *sd = (struct sd *) gspca_dev;
-
- *val = sd->hflip;
- return 0;
-}
-
-static int sd_setvflip(struct gspca_dev *gspca_dev, __s32 val)
-{
- struct sd *sd = (struct sd *) gspca_dev;
-
- sd->vflip = val;
- sethvflip(sd);
- return 0;
-}
-
-static int sd_getvflip(struct gspca_dev *gspca_dev, __s32 *val)
-{
- struct sd *sd = (struct sd *) gspca_dev;
-
- *val = sd->vflip;
- return 0;
-}
-
/* sub-driver description */
static const struct sd_desc sd_desc = {
.name = MODULE_NAME,
@@ -2153,3 +2178,4 @@ module_exit(sd_mod_exit);
module_param(frame_rate, int, 0644);
MODULE_PARM_DESC(frame_rate, "Frame rate (5, 10, 15, 20 or 30 fps)");
+
diff --git a/trunk/drivers/media/video/gspca/pac7311.c b/trunk/drivers/media/video/gspca/pac7311.c
index 815bea6edc44..ea3d7021f401 100644
--- a/trunk/drivers/media/video/gspca/pac7311.c
+++ b/trunk/drivers/media/video/gspca/pac7311.c
@@ -31,9 +31,7 @@ MODULE_LICENSE("GPL");
struct sd {
struct gspca_dev gspca_dev; /* !! must be the first item */
- int lum_sum;
- atomic_t avg_lum;
- atomic_t do_gain;
+ int avg_lum;
unsigned char brightness;
unsigned char contrast;
@@ -273,7 +271,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
sd->contrast = CONTRAST_DEF;
sd->colors = COLOR_DEF;
sd->autogain = AUTOGAIN_DEF;
- sd->ag_cnt = -1;
return 0;
}
@@ -314,18 +311,6 @@ static void setcolors(struct gspca_dev *gspca_dev)
PDEBUG(D_CONF|D_STREAM, "color: %i", sd->colors);
}
-static void setautogain(struct gspca_dev *gspca_dev)
-{
- struct sd *sd = (struct sd *) gspca_dev;
-
- if (sd->autogain) {
- sd->lum_sum = 0;
- sd->ag_cnt = AG_CNT_START;
- } else {
- sd->ag_cnt = -1;
- }
-}
-
/* this function is called at open time */
static int sd_open(struct gspca_dev *gspca_dev)
{
@@ -335,6 +320,8 @@ static int sd_open(struct gspca_dev *gspca_dev)
static void sd_start(struct gspca_dev *gspca_dev)
{
+ struct sd *sd = (struct sd *) gspca_dev;
+
reg_w(gspca_dev, 0xff, 0x01);
reg_w_buf(gspca_dev, 0x0002, "\x48\x0a\x40\x08\x00\x00\x08\x00", 8);
reg_w_buf(gspca_dev, 0x000a, "\x06\xff\x11\xff\x5a\x30\x90\x4c", 8);
@@ -407,7 +394,6 @@ static void sd_start(struct gspca_dev *gspca_dev)
setcontrast(gspca_dev);
setbrightness(gspca_dev);
setcolors(gspca_dev);
- setautogain(gspca_dev);
/* set correct resolution */
switch (gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv) {
@@ -445,6 +431,13 @@ static void sd_start(struct gspca_dev *gspca_dev)
reg_w(gspca_dev, 0xff, 0x01);
reg_w(gspca_dev, 0x78, 0x04);
reg_w(gspca_dev, 0x78, 0x05);
+
+ if (sd->autogain) {
+ sd->ag_cnt = AG_CNT_START;
+ sd->avg_lum = 0;
+ } else {
+ sd->ag_cnt = -1;
+ }
}
static void sd_stopN(struct gspca_dev *gspca_dev)
@@ -480,20 +473,13 @@ static void sd_close(struct gspca_dev *gspca_dev)
reg_w(gspca_dev, 0x78, 0x44); /* Bit_0=start stream, Bit_7=LED */
}
-static void do_autogain(struct gspca_dev *gspca_dev)
+static void setautogain(struct gspca_dev *gspca_dev, int luma)
{
- struct sd *sd = (struct sd *) gspca_dev;
- int luma;
int luma_mean = 128;
int luma_delta = 20;
__u8 spring = 5;
int Gbright;
- if (!atomic_read(&sd->do_gain))
- return;
- atomic_set(&sd->do_gain, 0);
-
- luma = atomic_read(&sd->avg_lum);
Gbright = reg_r(gspca_dev, 0x02);
PDEBUG(D_FRAM, "luma mean %d", luma);
if (luma < luma_mean - luma_delta ||
@@ -537,13 +523,12 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
/* start of frame */
if (sd->ag_cnt >= 0 && p > 28) {
- sd->lum_sum += data[p - 23];
+ sd->avg_lum += data[p - 23];
if (--sd->ag_cnt < 0) {
sd->ag_cnt = AG_CNT_START;
- atomic_set(&sd->avg_lum,
- sd->lum_sum / AG_CNT_START);
- sd->lum_sum = 0;
- atomic_set(&sd->do_gain, 1);
+ setautogain(gspca_dev,
+ sd->avg_lum / AG_CNT_START);
+ sd->avg_lum = 0;
}
}
@@ -692,8 +677,12 @@ static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val)
struct sd *sd = (struct sd *) gspca_dev;
sd->autogain = val;
- if (gspca_dev->streaming)
- setautogain(gspca_dev);
+ if (val) {
+ sd->ag_cnt = AG_CNT_START;
+ sd->avg_lum = 0;
+ } else {
+ sd->ag_cnt = -1;
+ }
return 0;
}
@@ -717,7 +706,6 @@ static struct sd_desc sd_desc = {
.stop0 = sd_stop0,
.close = sd_close,
.pkt_scan = sd_pkt_scan,
- .dq_callback = do_autogain,
};
/* -- module initialisation -- */
diff --git a/trunk/drivers/media/video/gspca/sonixb.c b/trunk/drivers/media/video/gspca/sonixb.c
index 11210c71f66c..e18748c5a14d 100644
--- a/trunk/drivers/media/video/gspca/sonixb.c
+++ b/trunk/drivers/media/video/gspca/sonixb.c
@@ -408,7 +408,7 @@ static void reg_w(struct gspca_dev *gspca_dev,
const __u8 *buffer,
int len)
{
-#ifdef GSPCA_DEBUG
+#ifdef CONFIG_VIDEO_ADV_DEBUG
if (len > sizeof gspca_dev->usb_buf) {
PDEBUG(D_ERR|D_PACK, "reg_w: buffer overflow");
return;
diff --git a/trunk/drivers/media/video/gspca/sonixj.c b/trunk/drivers/media/video/gspca/sonixj.c
index 245a30ec5fb1..33a3df1f6915 100644
--- a/trunk/drivers/media/video/gspca/sonixj.c
+++ b/trunk/drivers/media/video/gspca/sonixj.c
@@ -32,7 +32,7 @@ MODULE_LICENSE("GPL");
struct sd {
struct gspca_dev gspca_dev; /* !! must be the first item */
- atomic_t avg_lum;
+ int avg_lum;
unsigned int exposure;
unsigned short brightness;
@@ -148,58 +148,55 @@ static struct v4l2_pix_format vga_mode[] = {
/*Data from sn9c102p+hv71331r */
static const __u8 sn_hv7131[] = {
-/* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */
- 0x00, 0x03, 0x64, 0x00, 0x1a, 0x20, 0x20, 0x20,
-/* reg8 reg9 rega regb regc regd rege regf */
- 0xa1, 0x11, 0x02, 0x09, 0x00, 0x00, 0x00, 0x10,
-/* reg10 reg11 reg12 reg13 reg14 reg15 reg16 reg17 */
- 0x03, 0x00, 0x00, 0x01, 0x03, 0x28, 0x1e, 0x41,
-/* reg18 reg19 reg1a reg1b reg1c reg1d reg1e reg1f */
- 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+/* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 reg9 */
+ 0x00, 0x03, 0x64, 0x00, 0x1A, 0x20, 0x20, 0x20, 0xA1, 0x11,
+/* rega regb regc regd rege regf reg10 reg11 */
+ 0x02, 0x09, 0x00, 0x00, 0x00, 0x10, 0x03, 0x00, /* 00 */
+/* reg12 reg13 reg14 reg15 reg16 reg17 reg18 reg19 reg1a reg1b */
+ 0x00, 0x01, 0x03, 0x28, 0x1e, 0x41, 0x0a, 0x00, 0x00, 0x00,
+/* reg1c reg1d reg1e reg1f reg20 reg21 reg22 reg23 */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
static const __u8 sn_mi0360[] = {
-/* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */
- 0x00, 0x61, 0x44, 0x00, 0x1a, 0x20, 0x20, 0x20,
-/* reg8 reg9 rega regb regc regd rege regf */
- 0xb1, 0x5d, 0x07, 0x00, 0x00, 0x00, 0x00, 0x10,
-/* reg10 reg11 reg12 reg13 reg14 reg15 reg16 reg17 */
- 0x03, 0x00, 0x00, 0x02, 0x0a, 0x28, 0x1e, 0x61,
-/* reg18 reg19 reg1a reg1b reg1c reg1d reg1e reg1f */
- 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+/* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 reg9 */
+ 0x00, 0x61, 0x44, 0x00, 0x1a, 0x20, 0x20, 0x20, 0xb1, 0x5d,
+/* rega regb regc regd rege regf reg10 reg11 */
+ 0x07, 0x00, 0x00, 0x00, 0x00, 0x10, 0x03, 0x00,
+/* reg12 reg13 reg14 reg15 reg16 reg17 reg18 reg19 reg1a reg1b */
+ 0x00, 0x02, 0x0a, 0x28, 0x1e, 0x61, 0x06, 0x00, 0x00, 0x00,
+/* reg1c reg1d reg1e reg1f reg20 reg21 reg22 reg23 */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
static const __u8 sn_mo4000[] = {
-/* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */
- 0x12, 0x23, 0x60, 0x00, 0x1a, 0x00, 0x20, 0x18,
-/* reg8 reg9 rega regb regc regd rege regf */
- 0x81, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-/* reg10 reg11 reg12 reg13 reg14 reg15 reg16 reg17 */
- 0x03, 0x00, 0x0b, 0x0f, 0x14, 0x28, 0x1e, 0x40,
-/* reg18 reg19 reg1a reg1b reg1c reg1d reg1e reg1f */
- 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+/* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 */
+ 0x12, 0x23, 0x60, 0x00, 0x1A, 0x00, 0x20, 0x18, 0x81,
+/* reg9 rega regb regc regd rege regf reg10 reg11*/
+ 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00,
+/* reg12 reg13 reg14 reg15 reg16 reg17 reg18 reg19 reg1a*/
+ 0x0b, 0x0f, 0x14, 0x28, 0x1e, 0x40, 0x08, 0x00, 0x00,
+/* reg1b reg1c reg1d reg1e reg1f reg20 reg21 reg22 reg23*/
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x25, 0x39, 0x4b,
+ 0x5c, 0x6b, 0x79, 0x87, 0x95, 0xa2, 0xaf, 0xbb, 0xc7,
+ 0xd3, 0xdf, 0xea, 0xf5
};
static const __u8 sn_ov7648[] = {
-/* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */
- 0x00, 0x21, 0x62, 0x00, 0x1a, 0x20, 0x20, 0x20,
-/* reg8 reg9 rega regb regc regd rege regf */
- 0xa1, 0x6e, 0x18, 0x65, 0x00, 0x00, 0x00, 0x10,
-/* reg10 reg11 reg12 reg13 reg14 reg15 reg16 reg17 */
- 0x03, 0x00, 0x00, 0x06, 0x06, 0x28, 0x1e, 0x82,
-/* reg18 reg19 reg1a reg1b reg1c reg1d reg1e reg1f */
- 0x07, 0x00, 0x00, 0x00, 0x00, 0x00
+ 0x00, 0x21, 0x62, 0x00, 0x1a, 0x20, 0x20, 0x20, 0xA1, 0x6E, 0x18, 0x65,
+ 0x00, 0x00, 0x00, 0x10, 0x03, 0x00, 0x00, 0x06, 0x06, 0x28, 0x1E, 0x82,
+ 0x07, 0x00, 0x00, 0x00, 0x00, 0x00
};
static const __u8 sn_ov7660[] = {
-/* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */
- 0x00, 0x61, 0x40, 0x00, 0x1a, 0x20, 0x20, 0x20,
-/* reg8 reg9 rega regb regc regd rege regf */
- 0x81, 0x21, 0x07, 0x00, 0x00, 0x00, 0x00, 0x10,
-/* reg10 reg11 reg12 reg13 reg14 reg15 reg16 reg17 */
- 0x03, 0x00, 0x01, 0x01, 0x08, 0x28, 0x1e, 0x20,
-/* reg18 reg19 reg1a reg1b reg1c reg1d reg1e reg1f */
- 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+/* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 */
+ 0x00, 0x61, 0x40, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x81,
+/* reg9 rega regb regc regd rege regf reg10 reg11*/
+ 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00,
+/* reg12 reg13 reg14 reg15 reg16 reg17 reg18 reg19 reg1a*/
+ 0x01, 0x01, 0x14, 0x28, 0x1e, 0x00, 0x07, 0x00, 0x00,
+/* reg1b reg1c reg1d reg1e reg1f reg20 reg21 reg22 reg23*/
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
/* sequence specific to the sensors - !! index = SENSOR_xxx */
@@ -215,6 +212,10 @@ static const __u8 regsn20[] = {
0x00, 0x2d, 0x46, 0x5a, 0x6c, 0x7c, 0x8b, 0x99,
0xa6, 0xb2, 0xbf, 0xca, 0xd5, 0xe0, 0xeb, 0xf5, 0xff
};
+static const __u8 regsn20_sn9c120[] = {
+ 0x00, 0x25, 0x3c, 0x50, 0x62, 0x72, 0x81, 0x90,
+ 0x9e, 0xab, 0xb8, 0xc5, 0xd1, 0xdd, 0xe9, 0xf4, 0xff
+};
static const __u8 regsn20_sn9c325[] = {
0x0a, 0x3a, 0x56, 0x6c, 0x7e, 0x8d, 0x9a, 0xa4,
0xaf, 0xbb, 0xc5, 0xcd, 0xd5, 0xde, 0xe8, 0xed, 0xf5
@@ -226,6 +227,21 @@ static const __u8 reg84[] = {
/* 0x00, 0x00, 0x00, 0x00, 0x00 */
0xf7, 0x0f, 0x0a, 0x00, 0x00
};
+static const __u8 reg84_sn9c120_1[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x0c, 0x00, 0x00
+};
+static const __u8 reg84_sn9c120_2[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x0c, 0x02, 0x3b
+};
+static const __u8 reg84_sn9c120_3[] = {
+ 0x14, 0x00, 0x27, 0x00, 0x08, 0x00, 0xeb, 0x0f,
+ 0xd5, 0x0f, 0x42, 0x00, 0x41, 0x00, 0xca, 0x0f,
+ 0xf5, 0x0f, 0x0c, 0x02, 0x3b
+};
static const __u8 reg84_sn9c325[] = {
0x14, 0x00, 0x27, 0x00, 0x07, 0x00, 0xe4, 0x0f,
0xd3, 0x0f, 0x4b, 0x00, 0x48, 0x00, 0xc0, 0x0f,
@@ -344,15 +360,17 @@ static const __u8 ov7660_sensor_init[][8] = {
{0xa1, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10}, /* reset SCCB */
/* (delay 20ms) */
{0xa1, 0x21, 0x12, 0x05, 0x00, 0x00, 0x00, 0x10},
- /* Outformat = rawRGB */
+ /* Outformat ?? rawRGB */
{0xa1, 0x21, 0x13, 0xb8, 0x00, 0x00, 0x00, 0x10}, /* init COM8 */
- {0xd1, 0x21, 0x00, 0x01, 0x74, 0x74, 0x00, 0x10},
+ {0xd1, 0x21, 0x00, 0x01, 0x74, 0x92, 0x00, 0x10},
+/* {0xd1, 0x21, 0x00, 0x01, 0x74, 0x74, 0x00, 0x10}, */
/* GAIN BLUE RED VREF */
{0xd1, 0x21, 0x04, 0x00, 0x7d, 0x62, 0x00, 0x10},
/* COM 1 BAVE GEAVE AECHH */
{0xb1, 0x21, 0x08, 0x83, 0x01, 0x00, 0x00, 0x10}, /* RAVE COM2 */
{0xd1, 0x21, 0x0c, 0x00, 0x08, 0x04, 0x4f, 0x10}, /* COM 3 4 5 6 */
- {0xd1, 0x21, 0x10, 0x7f, 0x40, 0x05, 0xff, 0x10},
+ {0xd1, 0x21, 0x10, 0x7f, 0x40, 0x05, 0xf8, 0x10},
+/* {0xd1, 0x21, 0x10, 0x7f, 0x40, 0x05, 0xff, 0x10}, */
/* AECH CLKRC COM7 COM8 */
{0xc1, 0x21, 0x14, 0x2c, 0x00, 0x02, 0x00, 0x10}, /* COM9 COM10 */
{0xd1, 0x21, 0x17, 0x10, 0x60, 0x02, 0x7b, 0x10},
@@ -361,8 +379,8 @@ static const __u8 ov7660_sensor_init[][8] = {
{0xb1, 0x21, 0x1e, 0x01, 0x0e, 0x00, 0x00, 0x10}, /* MVFP LAEC */
{0xd1, 0x21, 0x20, 0x07, 0x07, 0x07, 0x07, 0x10},
/* BOS GBOS GROS ROS (BGGR offset) */
-/* {0xd1, 0x21, 0x24, 0x68, 0x58, 0xd4, 0x80, 0x10}, */
- {0xd1, 0x21, 0x24, 0x78, 0x68, 0xd4, 0x80, 0x10},
+ {0xd1, 0x21, 0x24, 0x68, 0x58, 0xd4, 0x80, 0x10},
+/* {0xd1, 0x21, 0x24, 0x78, 0x68, 0xd4, 0x80, 0x10}, */
/* AEW AEB VPT BBIAS */
{0xd1, 0x21, 0x28, 0x80, 0x30, 0x00, 0x00, 0x10},
/* GbBIAS RSVD EXHCH EXHCL */
@@ -389,9 +407,9 @@ static const __u8 ov7660_sensor_init[][8] = {
{0xd1, 0x21, 0x62, 0x00, 0x00, 0x50, 0x30, 0x10},
/* LCC1 LCC2 LCC3 LCC4 */
{0xa1, 0x21, 0x66, 0x00, 0x00, 0x00, 0x00, 0x10}, /* LCC5 */
- {0xd1, 0x21, 0x67, 0x80, 0x7a, 0x90, 0x80, 0x10}, /* MANU */
+ {0xd1, 0x21, 0x67, 0x80, 0x7a, 0x90, 0x80, 0x10},
{0xa1, 0x21, 0x6b, 0x0a, 0x00, 0x00, 0x00, 0x10},
- /* band gap reference [0:3] DBLV */
+ /* band gap reference [0..3] DBLV */
{0xd1, 0x21, 0x6c, 0x30, 0x48, 0x80, 0x74, 0x10}, /* gamma curve */
{0xd1, 0x21, 0x70, 0x64, 0x60, 0x5c, 0x58, 0x10}, /* gamma curve */
{0xd1, 0x21, 0x74, 0x54, 0x4c, 0x40, 0x38, 0x10}, /* gamma curve */
@@ -401,35 +419,37 @@ static const __u8 ov7660_sensor_init[][8] = {
{0xd1, 0x21, 0x84, 0x6e, 0x77, 0x87, 0x95, 0x10}, /* gamma curve */
{0xc1, 0x21, 0x88, 0xaf, 0xc7, 0xdf, 0x00, 0x10}, /* gamma curve */
{0xc1, 0x21, 0x8b, 0x99, 0x99, 0xcf, 0x00, 0x10}, /* reserved */
- {0xb1, 0x21, 0x92, 0x00, 0x00, 0x00, 0x00, 0x10}, /* DM_LNL/H */
+ {0xb1, 0x21, 0x92, 0x00, 0x00, 0x00, 0x00, 0x10},
/****** (some exchanges in the win trace) ******/
- {0xa1, 0x21, 0x1e, 0x01, 0x00, 0x00, 0x00, 0x10}, /* MVFP */
+ {0xa1, 0x21, 0x1e, 0x01, 0x00, 0x00, 0x00, 0x10},
/* bits[3..0]reserved */
{0xa1, 0x21, 0x1e, 0x01, 0x00, 0x00, 0x00, 0x10},
{0xa1, 0x21, 0x03, 0x00, 0x00, 0x00, 0x00, 0x10},
/* VREF vertical frame ctrl */
{0xa1, 0x21, 0x03, 0x00, 0x00, 0x00, 0x00, 0x10},
- {0xa1, 0x21, 0x10, 0x20, 0x00, 0x00, 0x00, 0x10}, /* AECH 0x20 */
- {0xa1, 0x21, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x10}, /* ADVFL */
- {0xa1, 0x21, 0x2e, 0x00, 0x00, 0x00, 0x00, 0x10}, /* ADVFH */
- {0xa1, 0x21, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x10}, /* GAIN */
-/* {0xb1, 0x21, 0x01, 0x78, 0x78, 0x00, 0x00, 0x10}, * BLUE */
+ {0xa1, 0x21, 0x10, 0x20, 0x00, 0x00, 0x00, 0x10}, /* 0x20 */
+ {0xa1, 0x21, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x10},
+ {0xa1, 0x21, 0x2e, 0x00, 0x00, 0x00, 0x00, 0x10},
+/* {0xa1, 0x21, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x10}, */
+ {0xa1, 0x21, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x10},
+ {0xb1, 0x21, 0x01, 0x78, 0x78, 0x00, 0x00, 0x10},
/****** (some exchanges in the win trace) ******/
{0xa1, 0x21, 0x93, 0x00, 0x00, 0x00, 0x00, 0x10},/* dummy line hight */
- {0xa1, 0x21, 0x92, 0x25, 0x00, 0x00, 0x00, 0x10}, /* dummy line low */
- {0xa1, 0x21, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x10}, /* EXHCH */
- {0xa1, 0x21, 0x2b, 0x00, 0x00, 0x00, 0x00, 0x10}, /* EXHCL */
-/* {0xa1, 0x21, 0x02, 0x90, 0x00, 0x00, 0x00, 0x10}, * RED */
+ {0xa1, 0x21, 0x92, 0x25, 0x00, 0x00, 0x00, 0x10},/* dummy line low */
+ {0xa1, 0x21, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x10},
+ {0xa1, 0x21, 0x2b, 0x00, 0x00, 0x00, 0x00, 0x10},
+ {0xa1, 0x21, 0x02, 0x90, 0x00, 0x00, 0x00, 0x10},
/****** (some exchanges in the win trace) ******/
-/******!! startsensor KO if changed !!****/
+/**********startsensor KO if changed !!****/
{0xa1, 0x21, 0x93, 0x01, 0x00, 0x00, 0x00, 0x10},
{0xa1, 0x21, 0x92, 0xff, 0x00, 0x00, 0x00, 0x10},
{0xa1, 0x21, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x10},
{0xa1, 0x21, 0x2b, 0xc3, 0x00, 0x00, 0x00, 0x10},
+/* here may start the isoc exchanges */
{}
};
-/* reg 0x04 reg 0x07 reg 0x10 */
-/* expo = (COM1 & 0x02) | ((AECHH & 0x2f) << 10) | (AECh << 2) */
+/* reg0x04 reg0x07 reg 0x10 */
+/* expo = (COM1 & 0x02) | (AECHH & 0x2f <<10) [ (AECh << 2) */
static const __u8 ov7648_sensor_init[][8] = {
{0xC1, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00},
@@ -660,12 +680,13 @@ static int configure_gpio(struct gspca_dev *gspca_dev,
const __u8 *reg9a;
static const __u8 reg9a_def[] =
{0x08, 0x40, 0x20, 0x10, 0x00, 0x04};
+ static const __u8 reg9a_sn9c120[] = /* from win trace */
+ {0x00, 0x40, 0x38, 0x30, 0x00, 0x20};
static const __u8 reg9a_sn9c325[] =
{0x0a, 0x40, 0x38, 0x30, 0x00, 0x20};
- static const __u8 regd4[] = {0x60, 0x00, 0x00};
reg_w1(gspca_dev, 0xf1, 0x00);
- reg_w1(gspca_dev, 0x01, 0x00); /*jfm was sn9c1xx[1] in v1*/
+ reg_w1(gspca_dev, 0x01, sn9c1xx[0]); /*fixme:jfm was [1] en v1*/
/* configure gpio */
reg_w(gspca_dev, 0x01, &sn9c1xx[1], 2);
@@ -675,17 +696,25 @@ static int configure_gpio(struct gspca_dev *gspca_dev,
case BRIDGE_SN9C325:
reg9a = reg9a_sn9c325;
break;
+ case BRIDGE_SN9C120:
+ reg9a = reg9a_sn9c120;
+ break;
default:
reg9a = reg9a_def;
break;
}
reg_w(gspca_dev, 0x9a, reg9a, 6);
- reg_w(gspca_dev, 0xd4, regd4, sizeof regd4); /*fixme:jfm was 60 only*/
+ reg_w1(gspca_dev, 0xd4, 0x60); /*fixme:jfm 60 00 00 (3) ? */
reg_w(gspca_dev, 0x03, &sn9c1xx[3], 0x0f);
switch (sd->bridge) {
+ case BRIDGE_SN9C120: /* from win trace */
+ reg_w1(gspca_dev, 0x01, 0x61);
+ reg_w1(gspca_dev, 0x17, 0x20);
+ reg_w1(gspca_dev, 0x01, 0x60);
+ break;
case BRIDGE_SN9C325:
reg_w1(gspca_dev, 0x01, 0x43);
reg_w1(gspca_dev, 0x17, 0xae);
@@ -781,8 +810,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
sd->contrast = CONTRAST_DEF;
sd->colors = COLOR_DEF;
sd->autogain = AUTOGAIN_DEF;
- sd->ag_cnt = -1;
-
return 0;
}
@@ -796,11 +823,10 @@ static int sd_open(struct gspca_dev *gspca_dev)
/* setup a selector by bridge */
reg_w1(gspca_dev, 0xf1, 0x01);
- reg_r(gspca_dev, 0x00, 1);
+ reg_r(gspca_dev, 0x00, 1); /* -> regF1 = 0x00 */
reg_w1(gspca_dev, 0xf1, gspca_dev->usb_buf[0]);
- reg_r(gspca_dev, 0x00, 1); /* get sonix chip id */
+ reg_r(gspca_dev, 0x00, 1);
regF1 = gspca_dev->usb_buf[0];
- PDEBUG(D_PROBE, "Sonix chip id: %02x", regF1);
switch (sd->bridge) {
case BRIDGE_SN9C102P:
if (regF1 != 0x11)
@@ -911,10 +937,15 @@ static void setbrightness(struct gspca_dev *gspca_dev)
sd->exposure = setexposure(gspca_dev, expo);
break;
case SENSOR_MI0360:
+ expo = sd->brightness >> 4;
+ sd->exposure = setexposure(gspca_dev, expo);
+ break;
case SENSOR_MO4000:
expo = sd->brightness >> 4;
sd->exposure = setexposure(gspca_dev, expo);
break;
+ case SENSOR_OV7660:
+ return; /*jfm??*/
}
k2 = sd->brightness >> 10;
@@ -927,6 +958,8 @@ static void setcontrast(struct gspca_dev *gspca_dev)
__u8 k2;
__u8 contrast[] = { 0x00, 0x00, 0x28, 0x00, 0x07, 0x00 };
+ if (sd->sensor == SENSOR_OV7660)
+ return; /*jfm??*/
k2 = sd->contrast;
contrast[2] = k2;
contrast[0] = (k2 + 1) >> 1;
@@ -948,32 +981,20 @@ static void setcolors(struct gspca_dev *gspca_dev)
reg_w1(gspca_dev, 0x05, data);
}
-static void setautogain(struct gspca_dev *gspca_dev)
-{
- struct sd *sd = (struct sd *) gspca_dev;
-
- switch (sd->sensor) {
- case SENSOR_HV7131R:
- case SENSOR_MO4000:
- case SENSOR_MI0360:
- if (sd->autogain)
- sd->ag_cnt = AG_CNT_START;
- else
- sd->ag_cnt = -1;
- break;
- }
-}
-
/* -- start the camera -- */
static void sd_start(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
int i;
- __u8 reg1, reg17, reg18;
+ __u8 data;
+ __u8 reg1;
+ __u8 reg17;
const __u8 *sn9c1xx;
int mode;
static const __u8 C0[] = { 0x2d, 0x2d, 0x3a, 0x05, 0x04, 0x3f };
static const __u8 CA[] = { 0x28, 0xd8, 0x14, 0xec };
+ static const __u8 CA_sn9c120[] =
+ { 0x14, 0xec, 0x0a, 0xf6 }; /* SN9C120 */
static const __u8 CE[] = { 0x32, 0xdd, 0x2d, 0xdd }; /* MI0360 */
static const __u8 CE_sn9c325[] =
{ 0x32, 0xdd, 0x32, 0xdd }; /* OV7648 - SN9C325 */
@@ -981,7 +1002,9 @@ static void sd_start(struct gspca_dev *gspca_dev)
sn9c1xx = sn_tb[(int) sd->sensor];
configure_gpio(gspca_dev, sn9c1xx);
-/* reg_w1(gspca_dev, 0x01, 0x44); jfm from win trace*/
+/*fixme:jfm this sequence should appear at end of sd_start */
+/* with
+ reg_w1(gspca_dev, 0x01, 0x44); */
reg_w1(gspca_dev, 0x15, sn9c1xx[0x15]);
reg_w1(gspca_dev, 0x16, sn9c1xx[0x16]);
reg_w1(gspca_dev, 0x12, sn9c1xx[0x12]);
@@ -993,16 +1016,20 @@ static void sd_start(struct gspca_dev *gspca_dev)
reg_w1(gspca_dev, 0xc7, 0x00);
reg_w1(gspca_dev, 0xc8, 0x50);
reg_w1(gspca_dev, 0xc9, 0x3c);
+/*fixme:jfm end of ending sequence */
reg_w1(gspca_dev, 0x18, sn9c1xx[0x18]);
switch (sd->bridge) {
case BRIDGE_SN9C325:
- reg17 = 0xae;
+ data = 0xae;
+ break;
+ case BRIDGE_SN9C120:
+ data = 0xa0;
break;
default:
- reg17 = 0x60;
+ data = 0x60;
break;
}
- reg_w1(gspca_dev, 0x17, reg17);
+ reg_w1(gspca_dev, 0x17, data);
reg_w1(gspca_dev, 0x05, sn9c1xx[5]);
reg_w1(gspca_dev, 0x07, sn9c1xx[7]);
reg_w1(gspca_dev, 0x06, sn9c1xx[6]);
@@ -1017,6 +1044,20 @@ static void sd_start(struct gspca_dev *gspca_dev)
reg_w1(gspca_dev, 0x9a, 0x0a);
reg_w1(gspca_dev, 0x99, 0x60);
break;
+ case BRIDGE_SN9C120:
+ reg_w(gspca_dev, 0x20, regsn20_sn9c120,
+ sizeof regsn20_sn9c120);
+ for (i = 0; i < 2; i++)
+ reg_w(gspca_dev, 0x84, reg84_sn9c120_1,
+ sizeof reg84_sn9c120_1);
+ for (i = 0; i < 6; i++)
+ reg_w(gspca_dev, 0x84, reg84_sn9c120_2,
+ sizeof reg84_sn9c120_2);
+ reg_w(gspca_dev, 0x84, reg84_sn9c120_3,
+ sizeof reg84_sn9c120_3);
+ reg_w1(gspca_dev, 0x9a, 0x05);
+ reg_w1(gspca_dev, 0x99, 0x5b);
+ break;
default:
reg_w(gspca_dev, 0x20, regsn20, sizeof regsn20);
for (i = 0; i < 8; i++)
@@ -1066,14 +1107,22 @@ static void sd_start(struct gspca_dev *gspca_dev)
/* reg1 = 0x44; */
/* reg1 = 0x46; (done) */
} else {
- reg17 = 0x22; /* 640 MCKSIZE */
- reg1 = 0x06;
+ reg17 = 0xa2; /* 640 */
+ reg1 = 0x40;
}
break;
}
reg_w(gspca_dev, 0xc0, C0, 6);
- reg_w(gspca_dev, 0xca, CA, 4);
switch (sd->bridge) {
+ case BRIDGE_SN9C120: /*jfm ?? */
+ reg_w(gspca_dev, 0xca, CA_sn9c120, 4);
+ break;
+ default:
+ reg_w(gspca_dev, 0xca, CA, 4);
+ break;
+ }
+ switch (sd->bridge) {
+ case BRIDGE_SN9C120: /*jfm ?? */
case BRIDGE_SN9C325:
reg_w(gspca_dev, 0xce, CE_sn9c325, 4);
break;
@@ -1084,19 +1133,19 @@ static void sd_start(struct gspca_dev *gspca_dev)
}
/* here change size mode 0 -> VGA; 1 -> CIF */
- reg18 = sn9c1xx[0x18] | (mode << 4);
- reg_w1(gspca_dev, 0x18, reg18 | 0x40);
+ data = 0x40 | sn9c1xx[0x18] | (mode << 4);
+ reg_w1(gspca_dev, 0x18, data);
reg_w(gspca_dev, 0x100, qtable4, 0x40);
reg_w(gspca_dev, 0x140, qtable4 + 0x40, 0x40);
- reg_w1(gspca_dev, 0x18, reg18);
+ data = sn9c1xx[0x18] | (mode << 4);
+ reg_w1(gspca_dev, 0x18, data);
reg_w1(gspca_dev, 0x17, reg17);
reg_w1(gspca_dev, 0x01, reg1);
setbrightness(gspca_dev);
setcontrast(gspca_dev);
- setautogain(gspca_dev);
}
static void sd_stopN(struct gspca_dev *gspca_dev)
@@ -1119,11 +1168,12 @@ static void sd_stopN(struct gspca_dev *gspca_dev)
i2c_w8(gspca_dev, stopmi0360);
data = 0x29;
break;
+ case SENSOR_MO4000:
+ break;
case SENSOR_OV7648:
data = 0x29;
break;
default:
-/* case SENSOR_MO4000: */
/* case SENSOR_OV7660: */
break;
}
@@ -1143,23 +1193,16 @@ static void sd_close(struct gspca_dev *gspca_dev)
{
}
-static void do_autogain(struct gspca_dev *gspca_dev)
+static void setautogain(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
+ /* Thanks S., without your advice, autobright should not work :) */
int delta;
- int expotimes;
+ int expotimes = 0;
__u8 luma_mean = 130;
__u8 luma_delta = 20;
- /* Thanks S., without your advice, autobright should not work :) */
- if (sd->ag_cnt < 0)
- return;
- if (--sd->ag_cnt >= 0)
- return;
- sd->ag_cnt = AG_CNT_START;
-
- delta = atomic_read(&sd->avg_lum);
- PDEBUG(D_FRAM, "mean lum %d", delta);
+ delta = sd->avg_lum;
if (delta < luma_mean - luma_delta ||
delta > luma_mean + luma_delta) {
switch (sd->sensor) {
@@ -1171,9 +1214,8 @@ static void do_autogain(struct gspca_dev *gspca_dev)
sd->exposure = setexposure(gspca_dev,
(unsigned int) (expotimes << 8));
break;
- default:
-/* case SENSOR_MO4000: */
-/* case SENSOR_MI0360: */
+ case SENSOR_MO4000:
+ case SENSOR_MI0360:
expotimes = sd->exposure;
expotimes += (luma_mean - delta) >> 6;
if (expotimes < 0)
@@ -1186,8 +1228,6 @@ static void do_autogain(struct gspca_dev *gspca_dev)
}
}
-/* scan the URB packets */
-/* This function is run at interrupt level. */
static void sd_pkt_scan(struct gspca_dev *gspca_dev,
struct gspca_frame *frame, /* target */
__u8 *data, /* isoc packet */
@@ -1204,6 +1244,9 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
frame, data, sof + 2);
if (sd->ag_cnt < 0)
return;
+ if (--sd->ag_cnt >= 0)
+ return;
+ sd->ag_cnt = AG_CNT_START;
/* w1 w2 w3 */
/* w4 w5 w6 */
/* w7 w8 */
@@ -1218,7 +1261,9 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
/* w5 */
avg_lum += ((data[sof + 31] << 8) | data[sof + 32]) >> 4;
avg_lum >>= 4;
- atomic_set(&sd->avg_lum, avg_lum);
+ sd->avg_lum = avg_lum;
+ PDEBUG(D_PACK, "mean lum %d", avg_lum);
+ setautogain(gspca_dev);
return;
}
if (gspca_dev->last_packet_type == LAST_PACKET) {
@@ -1255,7 +1300,6 @@ static unsigned int getexposure(struct gspca_dev *gspca_dev)
(hexpo << 10) | (mexpo << 2) | lexpo);
return (hexpo << 10) | (mexpo << 2) | lexpo;
default:
-/* case SENSOR_OV7648: * jfm: is it ok for 7648? */
/* case SENSOR_OV7660: */
/* read sensor exposure */
i2c_r5(gspca_dev, 0x04);
@@ -1274,12 +1318,14 @@ static void getbrightness(struct gspca_dev *gspca_dev)
/* hardcoded registers seem not readable */
switch (sd->sensor) {
case SENSOR_HV7131R:
+/* sd->brightness = 0x7fff; */
sd->brightness = getexposure(gspca_dev) >> 4;
break;
case SENSOR_MI0360:
sd->brightness = getexposure(gspca_dev) << 4;
break;
case SENSOR_MO4000:
+/* sd->brightness = 0x1fff; */
sd->brightness = getexposure(gspca_dev) << 4;
break;
}
@@ -1345,8 +1391,10 @@ static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val)
struct sd *sd = (struct sd *) gspca_dev;
sd->autogain = val;
- if (gspca_dev->streaming)
- setautogain(gspca_dev);
+ if (val)
+ sd->ag_cnt = AG_CNT_START;
+ else
+ sd->ag_cnt = -1;
return 0;
}
@@ -1370,7 +1418,6 @@ static const struct sd_desc sd_desc = {
.stop0 = sd_stop0,
.close = sd_close,
.pkt_scan = sd_pkt_scan,
- .dq_callback = do_autogain,
};
/* -- module initialisation -- */
diff --git a/trunk/drivers/media/video/gspca/spca505.c b/trunk/drivers/media/video/gspca/spca505.c
index eda29d609359..3c2be80cbd65 100644
--- a/trunk/drivers/media/video/gspca/spca505.c
+++ b/trunk/drivers/media/video/gspca/spca505.c
@@ -61,27 +61,27 @@ static struct ctrl sd_ctrls[] = {
static struct v4l2_pix_format vga_mode[] = {
{160, 120, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
- .bytesperline = 160,
+ .bytesperline = 160 * 3,
.sizeimage = 160 * 120 * 3 / 2,
.colorspace = V4L2_COLORSPACE_SRGB,
.priv = 5},
{176, 144, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
- .bytesperline = 176,
+ .bytesperline = 176 * 3,
.sizeimage = 176 * 144 * 3 / 2,
.colorspace = V4L2_COLORSPACE_SRGB,
.priv = 4},
{320, 240, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
- .bytesperline = 320,
+ .bytesperline = 320 * 3,
.sizeimage = 320 * 240 * 3 / 2,
.colorspace = V4L2_COLORSPACE_SRGB,
.priv = 2},
{352, 288, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
- .bytesperline = 352,
+ .bytesperline = 352 * 3,
.sizeimage = 352 * 288 * 3 / 2,
.colorspace = V4L2_COLORSPACE_SRGB,
.priv = 1},
{640, 480, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
- .bytesperline = 640,
+ .bytesperline = 640 * 3,
.sizeimage = 640 * 480 * 3 / 2,
.colorspace = V4L2_COLORSPACE_SRGB,
.priv = 0},
@@ -776,7 +776,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
default:
data += 1;
len -= 1;
- gspca_frame_add(gspca_dev, INTER_PACKET, frame,
+ gspca_frame_add(gspca_dev, FIRST_PACKET, frame,
data, len);
break;
}
diff --git a/trunk/drivers/media/video/gspca/spca506.c b/trunk/drivers/media/video/gspca/spca506.c
index f622fa75766d..6fe715c80ad2 100644
--- a/trunk/drivers/media/video/gspca/spca506.c
+++ b/trunk/drivers/media/video/gspca/spca506.c
@@ -112,27 +112,27 @@ static struct ctrl sd_ctrls[] = {
static struct v4l2_pix_format vga_mode[] = {
{160, 120, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
- .bytesperline = 160,
+ .bytesperline = 160 * 3,
.sizeimage = 160 * 120 * 3 / 2,
.colorspace = V4L2_COLORSPACE_SRGB,
.priv = 5},
{176, 144, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
- .bytesperline = 176,
+ .bytesperline = 176 * 3,
.sizeimage = 176 * 144 * 3 / 2,
.colorspace = V4L2_COLORSPACE_SRGB,
.priv = 4},
{320, 240, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
- .bytesperline = 320,
+ .bytesperline = 320 * 3,
.sizeimage = 320 * 240 * 3 / 2,
.colorspace = V4L2_COLORSPACE_SRGB,
.priv = 2},
{352, 288, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
- .bytesperline = 352,
+ .bytesperline = 352 * 3,
.sizeimage = 352 * 288 * 3 / 2,
.colorspace = V4L2_COLORSPACE_SRGB,
.priv = 1},
{640, 480, V4L2_PIX_FMT_SPCA505, V4L2_FIELD_NONE,
- .bytesperline = 640,
+ .bytesperline = 640 * 3,
.sizeimage = 640 * 480 * 3 / 2,
.colorspace = V4L2_COLORSPACE_SRGB,
.priv = 0},
@@ -588,7 +588,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
default:
data += 1;
len -= 1;
- gspca_frame_add(gspca_dev, INTER_PACKET, frame,
+ gspca_frame_add(gspca_dev, FIRST_PACKET, frame,
data, len);
break;
}
diff --git a/trunk/drivers/media/video/gspca/spca508.c b/trunk/drivers/media/video/gspca/spca508.c
index 699340c17dea..b608a27ad115 100644
--- a/trunk/drivers/media/video/gspca/spca508.c
+++ b/trunk/drivers/media/video/gspca/spca508.c
@@ -63,23 +63,23 @@ static struct ctrl sd_ctrls[] = {
};
static struct v4l2_pix_format sif_mode[] = {
- {160, 120, V4L2_PIX_FMT_SPCA508, V4L2_FIELD_NONE,
- .bytesperline = 160,
+ {160, 120, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
+ .bytesperline = 160 * 3,
.sizeimage = 160 * 120 * 3 / 2,
.colorspace = V4L2_COLORSPACE_SRGB,
.priv = 3},
- {176, 144, V4L2_PIX_FMT_SPCA508, V4L2_FIELD_NONE,
- .bytesperline = 176,
+ {176, 144, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
+ .bytesperline = 176 * 3,
.sizeimage = 176 * 144 * 3 / 2,
.colorspace = V4L2_COLORSPACE_SRGB,
.priv = 2},
- {320, 240, V4L2_PIX_FMT_SPCA508, V4L2_FIELD_NONE,
- .bytesperline = 320,
+ {320, 240, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
+ .bytesperline = 320 * 3,
.sizeimage = 320 * 240 * 3 / 2,
.colorspace = V4L2_COLORSPACE_SRGB,
.priv = 1},
- {352, 288, V4L2_PIX_FMT_SPCA508, V4L2_FIELD_NONE,
- .bytesperline = 352,
+ {352, 288, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
+ .bytesperline = 352 * 3,
.sizeimage = 352 * 288 * 3 / 2,
.colorspace = V4L2_COLORSPACE_SRGB,
.priv = 0},
@@ -1583,7 +1583,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
default:
data += 1;
len -= 1;
- gspca_frame_add(gspca_dev, INTER_PACKET, frame,
+ gspca_frame_add(gspca_dev, FIRST_PACKET, frame,
data, len);
break;
}
diff --git a/trunk/drivers/media/video/gspca/spca561.c b/trunk/drivers/media/video/gspca/spca561.c
index 1073ac3d2ec6..a26174508cb9 100644
--- a/trunk/drivers/media/video/gspca/spca561.c
+++ b/trunk/drivers/media/video/gspca/spca561.c
@@ -644,18 +644,6 @@ static void setcontrast(struct gspca_dev *gspca_dev)
}
}
-static void setautogain(struct gspca_dev *gspca_dev)
-{
- struct sd *sd = (struct sd *) gspca_dev;
-
- if (sd->chip_revision == Rev072A) {
- if (sd->autogain)
- sd->ag_cnt = AG_CNT_START;
- else
- sd->ag_cnt = -1;
- }
-}
-
static void sd_start(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
@@ -683,7 +671,6 @@ static void sd_start(struct gspca_dev *gspca_dev)
reg_w_val(dev, 0x8500, mode); /* mode */
reg_w_val(dev, 0x8700, Clck); /* 0x27 clock */
reg_w_val(dev, 0x8112, 0x10 | 0x20);
- setautogain(gspca_dev);
break;
default:
/* case Rev012A: */
@@ -733,24 +720,18 @@ static void sd_close(struct gspca_dev *gspca_dev)
reg_w_val(gspca_dev->dev, 0x8114, 0);
}
-static void do_autogain(struct gspca_dev *gspca_dev)
+static void setautogain(struct gspca_dev *gspca_dev)
{
struct sd *sd = (struct sd *) gspca_dev;
- int expotimes;
- int pixelclk;
- int gainG;
+ int expotimes = 0;
+ int pixelclk = 0;
+ int gainG = 0;
__u8 R, Gr, Gb, B;
int y;
__u8 luma_mean = 110;
__u8 luma_delta = 20;
__u8 spring = 4;
- if (sd->ag_cnt < 0)
- return;
- if (--sd->ag_cnt >= 0)
- return;
- sd->ag_cnt = AG_CNT_START;
-
switch (sd->chip_revision) {
case Rev072A:
reg_r(gspca_dev, 0x8621, 1);
@@ -814,10 +795,18 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
__u8 *data, /* isoc packet */
int len) /* iso packet length */
{
+ struct sd *sd = (struct sd *) gspca_dev;
+
switch (data[0]) {
case 0: /* start of frame */
frame = gspca_frame_add(gspca_dev, LAST_PACKET, frame,
data, 0);
+ if (sd->ag_cnt >= 0) {
+ if (--sd->ag_cnt < 0) {
+ sd->ag_cnt = AG_CNT_START;
+ setautogain(gspca_dev);
+ }
+ }
data += SPCA561_OFFSET_DATA;
len -= SPCA561_OFFSET_DATA;
if (data[1] & 0x10) {
@@ -955,8 +944,10 @@ static int sd_setautogain(struct gspca_dev *gspca_dev, __s32 val)
struct sd *sd = (struct sd *) gspca_dev;
sd->autogain = val;
- if (gspca_dev->streaming)
- setautogain(gspca_dev);
+ if (val)
+ sd->ag_cnt = AG_CNT_START;
+ else
+ sd->ag_cnt = -1;
return 0;
}
@@ -980,7 +971,6 @@ static const struct sd_desc sd_desc = {
.stop0 = sd_stop0,
.close = sd_close,
.pkt_scan = sd_pkt_scan,
- .dq_callback = do_autogain,
};
/* -- module initialisation -- */
diff --git a/trunk/drivers/media/video/gspca/vc032x.c b/trunk/drivers/media/video/gspca/vc032x.c
index f4a52956e0d9..a4221753e1bf 100644
--- a/trunk/drivers/media/video/gspca/vc032x.c
+++ b/trunk/drivers/media/video/gspca/vc032x.c
@@ -88,12 +88,12 @@ static struct ctrl sd_ctrls[] = {
static struct v4l2_pix_format vc0321_mode[] = {
{320, 240, V4L2_PIX_FMT_YUV420, V4L2_FIELD_NONE,
- .bytesperline = 320,
+ .bytesperline = 320 * 2,
.sizeimage = 320 * 240 * 2,
.colorspace = V4L2_COLORSPACE_SRGB,
.priv = 1},
{640, 480, V4L2_PIX_FMT_YUV420, V4L2_FIELD_NONE,
- .bytesperline = 640,
+ .bytesperline = 640 * 2,
.sizeimage = 640 * 480 * 2,
.colorspace = V4L2_COLORSPACE_SRGB,
.priv = 0},
diff --git a/trunk/drivers/media/video/gspca/zc3xx.c b/trunk/drivers/media/video/gspca/zc3xx.c
index bc7d0eedcd81..22a994ccb1d5 100644
--- a/trunk/drivers/media/video/gspca/zc3xx.c
+++ b/trunk/drivers/media/video/gspca/zc3xx.c
@@ -6469,7 +6469,7 @@ static void setcontrast(struct gspca_dev *gspca_dev)
NULL, Tgradient_1, Tgradient_2,
Tgradient_3, Tgradient_4, Tgradient_5, Tgradient_6
};
-#ifdef GSPCA_DEBUG
+#ifdef CONFIG_VIDEO_ADV_DEBUG
__u8 v[16];
#endif
@@ -6487,7 +6487,7 @@ static void setcontrast(struct gspca_dev *gspca_dev)
else if (g <= 0)
g = 1;
reg_w(dev, g, 0x0120 + i); /* gamma */
-#ifdef GSPCA_DEBUG
+#ifdef CONFIG_VIDEO_ADV_DEBUG
if (gspca_debug & D_CONF)
v[i] = g;
#endif
@@ -6507,7 +6507,7 @@ static void setcontrast(struct gspca_dev *gspca_dev)
g = 1;
}
reg_w(dev, g, 0x0130 + i); /* gradient */
-#ifdef GSPCA_DEBUG
+#ifdef CONFIG_VIDEO_ADV_DEBUG
if (gspca_debug & D_CONF)
v[i] = g;
#endif
diff --git a/trunk/drivers/media/video/pxa_camera.c b/trunk/drivers/media/video/pxa_camera.c
index ead87ddaf7fb..b15f82c49766 100644
--- a/trunk/drivers/media/video/pxa_camera.c
+++ b/trunk/drivers/media/video/pxa_camera.c
@@ -128,8 +128,6 @@ struct pxa_camera_dev {
struct pxa_buffer *active;
struct pxa_dma_desc *sg_tail[3];
-
- u32 save_cicr[5];
};
static const char *pxa_cam_driver_description = "PXA_Camera";
@@ -999,64 +997,10 @@ static int pxa_camera_querycap(struct soc_camera_host *ici,
return 0;
}
-static int pxa_camera_suspend(struct soc_camera_device *icd, pm_message_t state)
-{
- struct soc_camera_host *ici =
- to_soc_camera_host(icd->dev.parent);
- struct pxa_camera_dev *pcdev = ici->priv;
- int i = 0, ret = 0;
-
- pcdev->save_cicr[i++] = CICR0;
- pcdev->save_cicr[i++] = CICR1;
- pcdev->save_cicr[i++] = CICR2;
- pcdev->save_cicr[i++] = CICR3;
- pcdev->save_cicr[i++] = CICR4;
-
- if ((pcdev->icd) && (pcdev->icd->ops->suspend))
- ret = pcdev->icd->ops->suspend(pcdev->icd, state);
-
- return ret;
-}
-
-static int pxa_camera_resume(struct soc_camera_device *icd)
-{
- struct soc_camera_host *ici =
- to_soc_camera_host(icd->dev.parent);
- struct pxa_camera_dev *pcdev = ici->priv;
- int i = 0, ret = 0;
-
- DRCMR68 = pcdev->dma_chans[0] | DRCMR_MAPVLD;
- DRCMR69 = pcdev->dma_chans[1] | DRCMR_MAPVLD;
- DRCMR70 = pcdev->dma_chans[2] | DRCMR_MAPVLD;
-
- CICR0 = pcdev->save_cicr[i++] & ~CICR0_ENB;
- CICR1 = pcdev->save_cicr[i++];
- CICR2 = pcdev->save_cicr[i++];
- CICR3 = pcdev->save_cicr[i++];
- CICR4 = pcdev->save_cicr[i++];
-
- if ((pcdev->icd) && (pcdev->icd->ops->resume))
- ret = pcdev->icd->ops->resume(pcdev->icd);
-
- /* Restart frame capture if active buffer exists */
- if (!ret && pcdev->active) {
- /* Reset the FIFOs */
- CIFR |= CIFR_RESET_F;
- /* Enable End-Of-Frame Interrupt */
- CICR0 &= ~CICR0_EOFM;
- /* Restart the Capture Interface */
- CICR0 |= CICR0_ENB;
- }
-
- return ret;
-}
-
static struct soc_camera_host_ops pxa_soc_camera_host_ops = {
.owner = THIS_MODULE,
.add = pxa_camera_add_device,
.remove = pxa_camera_remove_device,
- .suspend = pxa_camera_suspend,
- .resume = pxa_camera_resume,
.set_fmt_cap = pxa_camera_set_fmt_cap,
.try_fmt_cap = pxa_camera_try_fmt_cap,
.init_videobuf = pxa_camera_init_videobuf,
@@ -1254,7 +1198,7 @@ static int __devinit pxa_camera_init(void)
static void __exit pxa_camera_exit(void)
{
- platform_driver_unregister(&pxa_camera_driver);
+ return platform_driver_unregister(&pxa_camera_driver);
}
module_init(pxa_camera_init);
diff --git a/trunk/drivers/media/video/sh_mobile_ceu_camera.c b/trunk/drivers/media/video/sh_mobile_ceu_camera.c
index 318754e73132..f7ca3cb9340a 100644
--- a/trunk/drivers/media/video/sh_mobile_ceu_camera.c
+++ b/trunk/drivers/media/video/sh_mobile_ceu_camera.c
@@ -647,7 +647,7 @@ static int __init sh_mobile_ceu_init(void)
static void __exit sh_mobile_ceu_exit(void)
{
- platform_driver_unregister(&sh_mobile_ceu_driver);
+ return platform_driver_unregister(&sh_mobile_ceu_driver);
}
module_init(sh_mobile_ceu_init);
diff --git a/trunk/drivers/media/video/soc_camera.c b/trunk/drivers/media/video/soc_camera.c
index 66ebe5956a87..b6be5ee678b6 100644
--- a/trunk/drivers/media/video/soc_camera.c
+++ b/trunk/drivers/media/video/soc_camera.c
@@ -732,36 +732,10 @@ static int soc_camera_remove(struct device *dev)
return 0;
}
-static int soc_camera_suspend(struct device *dev, pm_message_t state)
-{
- struct soc_camera_device *icd = to_soc_camera_dev(dev);
- struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
- int ret = 0;
-
- if (ici->ops->suspend)
- ret = ici->ops->suspend(icd, state);
-
- return ret;
-}
-
-static int soc_camera_resume(struct device *dev)
-{
- struct soc_camera_device *icd = to_soc_camera_dev(dev);
- struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent);
- int ret = 0;
-
- if (ici->ops->resume)
- ret = ici->ops->resume(icd);
-
- return ret;
-}
-
static struct bus_type soc_camera_bus_type = {
.name = "soc-camera",
.probe = soc_camera_probe,
.remove = soc_camera_remove,
- .suspend = soc_camera_suspend,
- .resume = soc_camera_resume,
};
static struct device_driver ic_drv = {
diff --git a/trunk/drivers/media/video/soc_camera_platform.c b/trunk/drivers/media/video/soc_camera_platform.c
index 1adc257ebdb9..eefb0327ebb6 100644
--- a/trunk/drivers/media/video/soc_camera_platform.c
+++ b/trunk/drivers/media/video/soc_camera_platform.c
@@ -187,7 +187,7 @@ static int __init soc_camera_platform_module_init(void)
static void __exit soc_camera_platform_module_exit(void)
{
- platform_driver_unregister(&soc_camera_platform_driver);
+ return platform_driver_unregister(&soc_camera_platform_driver);
}
module_init(soc_camera_platform_module_init);
diff --git a/trunk/drivers/media/video/uvc/uvc_ctrl.c b/trunk/drivers/media/video/uvc/uvc_ctrl.c
index 6ef3e5297de8..626f4ad7e876 100644
--- a/trunk/drivers/media/video/uvc/uvc_ctrl.c
+++ b/trunk/drivers/media/video/uvc/uvc_ctrl.c
@@ -585,17 +585,13 @@ int uvc_query_v4l2_ctrl(struct uvc_video_device *video,
struct uvc_control_mapping *mapping;
struct uvc_menu_info *menu;
unsigned int i;
- __u8 *data;
+ __u8 data[8];
int ret;
ctrl = uvc_find_control(video, v4l2_ctrl->id, &mapping);
if (ctrl == NULL)
return -EINVAL;
- data = kmalloc(8, GFP_KERNEL);
- if (data == NULL)
- return -ENOMEM;
-
memset(v4l2_ctrl, 0, sizeof *v4l2_ctrl);
v4l2_ctrl->id = mapping->id;
v4l2_ctrl->type = mapping->v4l2_type;
@@ -608,8 +604,8 @@ int uvc_query_v4l2_ctrl(struct uvc_video_device *video,
if (ctrl->info->flags & UVC_CONTROL_GET_DEF) {
if ((ret = uvc_query_ctrl(video->dev, GET_DEF, ctrl->entity->id,
video->dev->intfnum, ctrl->info->selector,
- data, ctrl->info->size)) < 0)
- goto out;
+ &data, ctrl->info->size)) < 0)
+ return ret;
v4l2_ctrl->default_value = uvc_get_le_value(data, mapping);
}
@@ -627,15 +623,13 @@ int uvc_query_v4l2_ctrl(struct uvc_video_device *video,
}
}
- ret = 0;
- goto out;
+ return 0;
case V4L2_CTRL_TYPE_BOOLEAN:
v4l2_ctrl->minimum = 0;
v4l2_ctrl->maximum = 1;
v4l2_ctrl->step = 1;
- ret = 0;
- goto out;
+ return 0;
default:
break;
@@ -644,29 +638,26 @@ int uvc_query_v4l2_ctrl(struct uvc_video_device *video,
if (ctrl->info->flags & UVC_CONTROL_GET_MIN) {
if ((ret = uvc_query_ctrl(video->dev, GET_MIN, ctrl->entity->id,
video->dev->intfnum, ctrl->info->selector,
- data, ctrl->info->size)) < 0)
- goto out;
+ &data, ctrl->info->size)) < 0)
+ return ret;
v4l2_ctrl->minimum = uvc_get_le_value(data, mapping);
}
if (ctrl->info->flags & UVC_CONTROL_GET_MAX) {
if ((ret = uvc_query_ctrl(video->dev, GET_MAX, ctrl->entity->id,
video->dev->intfnum, ctrl->info->selector,
- data, ctrl->info->size)) < 0)
- goto out;
+ &data, ctrl->info->size)) < 0)
+ return ret;
v4l2_ctrl->maximum = uvc_get_le_value(data, mapping);
}
if (ctrl->info->flags & UVC_CONTROL_GET_RES) {
if ((ret = uvc_query_ctrl(video->dev, GET_RES, ctrl->entity->id,
video->dev->intfnum, ctrl->info->selector,
- data, ctrl->info->size)) < 0)
- goto out;
+ &data, ctrl->info->size)) < 0)
+ return ret;
v4l2_ctrl->step = uvc_get_le_value(data, mapping);
}
- ret = 0;
-out:
- kfree(data);
- return ret;
+ return 0;
}
diff --git a/trunk/drivers/media/video/uvc/uvc_driver.c b/trunk/drivers/media/video/uvc/uvc_driver.c
index 7e102034d38d..b3c4d75e8490 100644
--- a/trunk/drivers/media/video/uvc/uvc_driver.c
+++ b/trunk/drivers/media/video/uvc/uvc_driver.c
@@ -1884,7 +1884,7 @@ static struct usb_device_id uvc_ids[] = {
.bInterfaceSubClass = 1,
.bInterfaceProtocol = 0,
.driver_info = UVC_QUIRK_PROBE_MINMAX },
- /* Packard Bell OEM Webcam - Bison Electronics */
+ /* Packard Bell OEM Webcam */
{ .match_flags = USB_DEVICE_ID_MATCH_DEVICE
| USB_DEVICE_ID_MATCH_INT_INFO,
.idVendor = 0x5986,
@@ -1893,7 +1893,7 @@ static struct usb_device_id uvc_ids[] = {
.bInterfaceSubClass = 1,
.bInterfaceProtocol = 0,
.driver_info = UVC_QUIRK_PROBE_MINMAX },
- /* Acer Crystal Eye webcam - Bison Electronics */
+ /* Acer Crystal Eye webcam */
{ .match_flags = USB_DEVICE_ID_MATCH_DEVICE
| USB_DEVICE_ID_MATCH_INT_INFO,
.idVendor = 0x5986,
@@ -1902,7 +1902,7 @@ static struct usb_device_id uvc_ids[] = {
.bInterfaceSubClass = 1,
.bInterfaceProtocol = 0,
.driver_info = UVC_QUIRK_PROBE_MINMAX },
- /* Medion Akoya Mini E1210 - Bison Electronics */
+ /* Medion Akoya Mini E1210 */
{ .match_flags = USB_DEVICE_ID_MATCH_DEVICE
| USB_DEVICE_ID_MATCH_INT_INFO,
.idVendor = 0x5986,
@@ -1911,7 +1911,7 @@ static struct usb_device_id uvc_ids[] = {
.bInterfaceSubClass = 1,
.bInterfaceProtocol = 0,
.driver_info = UVC_QUIRK_PROBE_MINMAX },
- /* Acer OrbiCam - Bison Electronics */
+ /* Acer OrbiCam - Unknown vendor */
{ .match_flags = USB_DEVICE_ID_MATCH_DEVICE
| USB_DEVICE_ID_MATCH_INT_INFO,
.idVendor = 0x5986,
@@ -1920,24 +1920,6 @@ static struct usb_device_id uvc_ids[] = {
.bInterfaceSubClass = 1,
.bInterfaceProtocol = 0,
.driver_info = UVC_QUIRK_PROBE_MINMAX },
- /* Bison Electronics */
- { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
- | USB_DEVICE_ID_MATCH_INT_INFO,
- .idVendor = 0x5986,
- .idProduct = 0x0300,
- .bInterfaceClass = USB_CLASS_VIDEO,
- .bInterfaceSubClass = 1,
- .bInterfaceProtocol = 0,
- .driver_info = UVC_QUIRK_PROBE_MINMAX },
- /* Clevo M570TU - Bison Electronics */
- { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
- | USB_DEVICE_ID_MATCH_INT_INFO,
- .idVendor = 0x5986,
- .idProduct = 0x0303,
- .bInterfaceClass = USB_CLASS_VIDEO,
- .bInterfaceSubClass = 1,
- .bInterfaceProtocol = 0,
- .driver_info = UVC_QUIRK_PROBE_MINMAX },
/* Generic USB Video Class */
{ USB_INTERFACE_INFO(USB_CLASS_VIDEO, 1, 0) },
{}
diff --git a/trunk/drivers/media/video/uvc/uvc_video.c b/trunk/drivers/media/video/uvc/uvc_video.c
index 6854ac78a161..ad63794fda77 100644
--- a/trunk/drivers/media/video/uvc/uvc_video.c
+++ b/trunk/drivers/media/video/uvc/uvc_video.c
@@ -90,20 +90,17 @@ static void uvc_fixup_buffer_size(struct uvc_video_device *video,
static int uvc_get_video_ctrl(struct uvc_video_device *video,
struct uvc_streaming_control *ctrl, int probe, __u8 query)
{
- __u8 *data;
- __u16 size;
+ __u8 data[34];
+ __u8 size;
int ret;
size = video->dev->uvc_version >= 0x0110 ? 34 : 26;
- data = kmalloc(size, GFP_KERNEL);
- if (data == NULL)
- return -ENOMEM;
-
ret = __uvc_query_ctrl(video->dev, query, 0, video->streaming->intfnum,
- probe ? VS_PROBE_CONTROL : VS_COMMIT_CONTROL, data, size,
+ probe ? VS_PROBE_CONTROL : VS_COMMIT_CONTROL, &data, size,
UVC_CTRL_STREAMING_TIMEOUT);
+
if (ret < 0)
- goto out;
+ return ret;
ctrl->bmHint = le16_to_cpup((__le16 *)&data[0]);
ctrl->bFormatIndex = data[2];
@@ -139,22 +136,17 @@ static int uvc_get_video_ctrl(struct uvc_video_device *video,
*/
uvc_fixup_buffer_size(video, ctrl);
-out:
- kfree(data);
- return ret;
+ return 0;
}
int uvc_set_video_ctrl(struct uvc_video_device *video,
struct uvc_streaming_control *ctrl, int probe)
{
- __u8 *data;
- __u16 size;
- int ret;
+ __u8 data[34];
+ __u8 size;
size = video->dev->uvc_version >= 0x0110 ? 34 : 26;
- data = kzalloc(size, GFP_KERNEL);
- if (data == NULL)
- return -ENOMEM;
+ memset(data, 0, sizeof data);
*(__le16 *)&data[0] = cpu_to_le16(ctrl->bmHint);
data[2] = ctrl->bFormatIndex;
@@ -182,13 +174,10 @@ int uvc_set_video_ctrl(struct uvc_video_device *video,
data[33] = ctrl->bMaxVersion;
}
- ret = __uvc_query_ctrl(video->dev, SET_CUR, 0,
+ return __uvc_query_ctrl(video->dev, SET_CUR, 0,
video->streaming->intfnum,
- probe ? VS_PROBE_CONTROL : VS_COMMIT_CONTROL, data, size,
+ probe ? VS_PROBE_CONTROL : VS_COMMIT_CONTROL, &data, size,
UVC_CTRL_STREAMING_TIMEOUT);
-
- kfree(data);
- return ret;
}
int uvc_probe_video(struct uvc_video_device *video,
diff --git a/trunk/drivers/media/video/v4l2-dev.c b/trunk/drivers/media/video/v4l2-dev.c
index 6f36006aecda..556615fe93de 100644
--- a/trunk/drivers/media/video/v4l2-dev.c
+++ b/trunk/drivers/media/video/v4l2-dev.c
@@ -222,13 +222,11 @@ int video_register_device(struct video_device *vfd, int type, int nr)
EXPORT_SYMBOL(video_register_device);
/**
- * video_register_device_index - register video4linux devices
+ * video_register_device - register video4linux devices
* @vfd: video device structure we want to register
* @type: type of device to register
* @nr: which device number (0 == /dev/video0, 1 == /dev/video1, ...
* -1 == first free)
- * @index: stream number based on parent device;
- * -1 if auto assign, requested number otherwise
*
* The registration code assigns minor numbers based on the type
* requested. -ENFILE is returned in all the device slots for this
diff --git a/trunk/drivers/media/video/vino.c b/trunk/drivers/media/video/vino.c
index 1edda456fc64..ef7572cbc4ab 100644
--- a/trunk/drivers/media/video/vino.c
+++ b/trunk/drivers/media/video/vino.c
@@ -41,7 +41,6 @@
#include
#include
#include
-#include
#include
#include
diff --git a/trunk/drivers/misc/Kconfig b/trunk/drivers/misc/Kconfig
index a726f3b01a6b..82af385460e4 100644
--- a/trunk/drivers/misc/Kconfig
+++ b/trunk/drivers/misc/Kconfig
@@ -427,10 +427,10 @@ config ENCLOSURE_SERVICES
config SGI_XP
tristate "Support communication between SGI SSIs"
depends on NET
- depends on (IA64_GENERIC || IA64_SGI_SN2 || IA64_SGI_UV || X86_64) && SMP
+ depends on IA64_GENERIC || IA64_SGI_SN2 || IA64_SGI_UV || (X86_64 && SMP)
select IA64_UNCACHED_ALLOCATOR if IA64_GENERIC || IA64_SGI_SN2
select GENERIC_ALLOCATOR if IA64_GENERIC || IA64_SGI_SN2
- select SGI_GRU if (IA64_GENERIC || IA64_SGI_UV || X86_64) && SMP
+ select SGI_GRU if IA64_GENERIC || IA64_SGI_UV || (X86_64 && SMP)
---help---
An SGI machine can be divided into multiple Single System
Images which act independently of each other and have
diff --git a/trunk/drivers/watchdog/Kconfig b/trunk/drivers/watchdog/Kconfig
index 32b9fe153641..48399e134c0d 100644
--- a/trunk/drivers/watchdog/Kconfig
+++ b/trunk/drivers/watchdog/Kconfig
@@ -463,7 +463,7 @@ config PC87413_WDT
module will be called pc87413_wdt.
Most people will say N.
-
+
config 60XX_WDT
tristate "SBC-60XX Watchdog Timer"
depends on X86
@@ -695,17 +695,9 @@ config 8xx_WDT
tristate "MPC8xx Watchdog Timer"
depends on 8xx
-config 8xxx_WDT
- tristate "MPC8xxx Platform Watchdog Timer"
- depends on PPC_8xx || PPC_83xx || PPC_86xx
- help
- This driver is for a SoC level watchdog that exists on some
- Freescale PowerPC processors. So far this driver supports:
- - MPC8xx watchdogs
- - MPC83xx watchdogs
- - MPC86xx watchdogs
-
- For BookE processors (MPC85xx) use the BOOKE_WDT driver instead.
+config 83xx_WDT
+ tristate "MPC83xx Watchdog Timer"
+ depends on PPC_83xx
config MV64X60_WDT
tristate "MV64X60 (Marvell Discovery) Watchdog Timer"
diff --git a/trunk/drivers/watchdog/Makefile b/trunk/drivers/watchdog/Makefile
index 049c91895699..edd305a64e63 100644
--- a/trunk/drivers/watchdog/Makefile
+++ b/trunk/drivers/watchdog/Makefile
@@ -92,7 +92,7 @@ obj-$(CONFIG_SBC_EPX_C3_WATCHDOG) += sbc_epx_c3.o
# MIPS Architecture
obj-$(CONFIG_INDYDOG) += indydog.o
-obj-$(CONFIG_WDT_MTX1) += mtx-1_wdt.o
+obj-$(CONFIG_WDT_MTX1) += mtx-1_wdt.o
obj-$(CONFIG_WDT_RM9K_GPI) += rm9k_wdt.o
obj-$(CONFIG_SIBYTE_WDOG) += sb_wdog.o
obj-$(CONFIG_AR7_WDT) += ar7_wdt.o
@@ -103,7 +103,7 @@ obj-$(CONFIG_TXX9_WDT) += txx9wdt.o
# POWERPC Architecture
obj-$(CONFIG_8xx_WDT) += mpc8xx_wdt.o
obj-$(CONFIG_MPC5200_WDT) += mpc5200_wdt.o
-obj-$(CONFIG_8xxx_WDT) += mpc8xxx_wdt.o
+obj-$(CONFIG_83xx_WDT) += mpc83xx_wdt.o
obj-$(CONFIG_MV64X60_WDT) += mv64x60_wdt.o
obj-$(CONFIG_BOOKE_WDT) += booke_wdt.o
diff --git a/trunk/drivers/watchdog/acquirewdt.c b/trunk/drivers/watchdog/acquirewdt.c
index 6e46a551395c..85269c365a10 100644
--- a/trunk/drivers/watchdog/acquirewdt.c
+++ b/trunk/drivers/watchdog/acquirewdt.c
@@ -58,45 +58,39 @@
#include /* For standard types (like size_t) */
#include /* For the -ENODEV/... values */
#include /* For printk/panic/... */
-#include /* For MODULE_ALIAS_MISCDEV
- (WATCHDOG_MINOR) */
+#include /* For MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR) */
#include /* For the watchdog specific items */
#include /* For file operations */
#include /* For io-port access */
#include /* For platform_driver framework */
#include /* For __init/__exit/... */
-#include /* For copy_to_user/put_user/... */
-#include /* For inb/outb/... */
+
+#include /* For copy_to_user/put_user/... */
+#include /* For inb/outb/... */
/* Module information */
#define DRV_NAME "acquirewdt"
#define PFX DRV_NAME ": "
#define WATCHDOG_NAME "Acquire WDT"
-/* There is no way to see what the correct time-out period is */
-#define WATCHDOG_HEARTBEAT 0
+#define WATCHDOG_HEARTBEAT 0 /* There is no way to see what the correct time-out period is */
/* internal variables */
-/* the watchdog platform device */
-static struct platform_device *acq_platform_device;
+static struct platform_device *acq_platform_device; /* the watchdog platform device */
static unsigned long acq_is_open;
static char expect_close;
/* module parameters */
-/* You must set this - there is no sane way to probe for this board. */
-static int wdt_stop = 0x43;
+static int wdt_stop = 0x43; /* You must set this - there is no sane way to probe for this board. */
module_param(wdt_stop, int, 0);
MODULE_PARM_DESC(wdt_stop, "Acquire WDT 'stop' io port (default 0x43)");
-/* You must set this - there is no sane way to probe for this board. */
-static int wdt_start = 0x443;
+static int wdt_start = 0x443; /* You must set this - there is no sane way to probe for this board. */
module_param(wdt_start, int, 0);
MODULE_PARM_DESC(wdt_start, "Acquire WDT 'start' io port (default 0x443)");
static int nowayout = WATCHDOG_NOWAYOUT;
module_param(nowayout, int, 0);
-MODULE_PARM_DESC(nowayout,
- "Watchdog cannot be stopped once started (default="
- __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
/*
* Watchdog Operations
@@ -118,18 +112,18 @@ static void acq_stop(void)
* /dev/watchdog handling
*/
-static ssize_t acq_write(struct file *file, const char __user *buf,
- size_t count, loff_t *ppos)
+static ssize_t acq_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
{
/* See if we got the magic character 'V' and reload the timer */
- if (count) {
+ if(count) {
if (!nowayout) {
size_t i;
+
/* note: just in case someone wrote the magic character
- five months ago... */
+ * five months ago... */
expect_close = 0;
- /* scan to see whether or not we got the
- magic character */
+
+ /* scan to see whether or not we got the magic character */
for (i = 0; i != count; i++) {
char c;
if (get_user(c, buf + i))
@@ -138,55 +132,64 @@ static ssize_t acq_write(struct file *file, const char __user *buf,
expect_close = 42;
}
}
- /* Well, anyhow someone wrote to us, we should
- return that favour */
+
+ /* Well, anyhow someone wrote to us, we should return that favour */
acq_keepalive();
}
return count;
}
-static long acq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
+static int acq_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
+ unsigned long arg)
{
int options, retval = -EINVAL;
void __user *argp = (void __user *)arg;
int __user *p = argp;
- static struct watchdog_info ident = {
+ static struct watchdog_info ident =
+ {
.options = WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE,
.firmware_version = 1,
.identity = WATCHDOG_NAME,
};
- switch (cmd) {
+ switch(cmd)
+ {
case WDIOC_GETSUPPORT:
- return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0;
+ return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0;
case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS:
- return put_user(0, p);
+ return put_user(0, p);
- case WDIOC_SETOPTIONS:
- {
- if (get_user(options, p))
- return -EFAULT;
- if (options & WDIOS_DISABLECARD) {
- acq_stop();
- retval = 0;
- }
- if (options & WDIOS_ENABLECARD) {
- acq_keepalive();
- retval = 0;
- }
- return retval;
- }
case WDIOC_KEEPALIVE:
- acq_keepalive();
- return 0;
+ acq_keepalive();
+ return 0;
case WDIOC_GETTIMEOUT:
- return put_user(WATCHDOG_HEARTBEAT, p);
+ return put_user(WATCHDOG_HEARTBEAT, p);
+
+ case WDIOC_SETOPTIONS:
+ {
+ if (get_user(options, p))
+ return -EFAULT;
+
+ if (options & WDIOS_DISABLECARD)
+ {
+ acq_stop();
+ retval = 0;
+ }
+
+ if (options & WDIOS_ENABLECARD)
+ {
+ acq_keepalive();
+ retval = 0;
+ }
+
+ return retval;
+ }
default:
- return -ENOTTY;
+ return -ENOTTY;
}
}
@@ -208,8 +211,7 @@ static int acq_close(struct inode *inode, struct file *file)
if (expect_close == 42) {
acq_stop();
} else {
- printk(KERN_CRIT PFX
- "Unexpected close, not stopping watchdog!\n");
+ printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n");
acq_keepalive();
}
clear_bit(0, &acq_is_open);
@@ -225,7 +227,7 @@ static const struct file_operations acq_fops = {
.owner = THIS_MODULE,
.llseek = no_llseek,
.write = acq_write,
- .unlocked_ioctl = acq_ioctl,
+ .ioctl = acq_ioctl,
.open = acq_open,
.release = acq_close,
};
@@ -246,29 +248,32 @@ static int __devinit acq_probe(struct platform_device *dev)
if (wdt_stop != wdt_start) {
if (!request_region(wdt_stop, 1, WATCHDOG_NAME)) {
- printk(KERN_ERR PFX
- "I/O address 0x%04x already in use\n", wdt_stop);
+ printk (KERN_ERR PFX "I/O address 0x%04x already in use\n",
+ wdt_stop);
ret = -EIO;
goto out;
}
}
if (!request_region(wdt_start, 1, WATCHDOG_NAME)) {
- printk(KERN_ERR PFX "I/O address 0x%04x already in use\n",
+ printk (KERN_ERR PFX "I/O address 0x%04x already in use\n",
wdt_start);
ret = -EIO;
goto unreg_stop;
}
+
ret = misc_register(&acq_miscdev);
if (ret != 0) {
- printk(KERN_ERR PFX
- "cannot register miscdev on minor=%d (err=%d)\n",
- WATCHDOG_MINOR, ret);
+ printk (KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
+ WATCHDOG_MINOR, ret);
goto unreg_regions;
}
- printk(KERN_INFO PFX "initialized. (nowayout=%d)\n", nowayout);
+
+ printk (KERN_INFO PFX "initialized. (nowayout=%d)\n",
+ nowayout);
return 0;
+
unreg_regions:
release_region(wdt_start, 1);
unreg_stop:
@@ -281,9 +286,9 @@ static int __devinit acq_probe(struct platform_device *dev)
static int __devexit acq_remove(struct platform_device *dev)
{
misc_deregister(&acq_miscdev);
- release_region(wdt_start, 1);
- if (wdt_stop != wdt_start)
- release_region(wdt_stop, 1);
+ release_region(wdt_start,1);
+ if(wdt_stop != wdt_start)
+ release_region(wdt_stop,1);
return 0;
}
@@ -308,19 +313,18 @@ static int __init acq_init(void)
{
int err;
- printk(KERN_INFO
- "WDT driver for Acquire single board computer initialising.\n");
+ printk(KERN_INFO "WDT driver for Acquire single board computer initialising.\n");
err = platform_driver_register(&acquirewdt_driver);
if (err)
return err;
- acq_platform_device = platform_device_register_simple(DRV_NAME,
- -1, NULL, 0);
+ acq_platform_device = platform_device_register_simple(DRV_NAME, -1, NULL, 0);
if (IS_ERR(acq_platform_device)) {
err = PTR_ERR(acq_platform_device);
goto unreg_platform_driver;
}
+
return 0;
unreg_platform_driver:
diff --git a/trunk/drivers/watchdog/advantechwdt.c b/trunk/drivers/watchdog/advantechwdt.c
index a5110f93a755..8121cc247343 100644
--- a/trunk/drivers/watchdog/advantechwdt.c
+++ b/trunk/drivers/watchdog/advantechwdt.c
@@ -37,9 +37,9 @@
#include
#include
#include
-#include
-#include
+#include
+#include
#include
#define DRV_NAME "advantechwdt"
@@ -47,8 +47,7 @@
#define WATCHDOG_NAME "Advantech WDT"
#define WATCHDOG_TIMEOUT 60 /* 60 sec default timeout */
-/* the watchdog platform device */
-static struct platform_device *advwdt_platform_device;
+static struct platform_device *advwdt_platform_device; /* the watchdog platform device */
static unsigned long advwdt_is_open;
static char adv_expect_close;
@@ -73,35 +72,35 @@ MODULE_PARM_DESC(wdt_start, "Advantech WDT 'start' io port (default 0x443)");
static int timeout = WATCHDOG_TIMEOUT; /* in seconds */
module_param(timeout, int, 0);
-MODULE_PARM_DESC(timeout,
- "Watchdog timeout in seconds. 1<= timeout <=63, default="
- __MODULE_STRING(WATCHDOG_TIMEOUT) ".");
+MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. 1<= timeout <=63, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ".");
static int nowayout = WATCHDOG_NOWAYOUT;
module_param(nowayout, int, 0);
-MODULE_PARM_DESC(nowayout,
- "Watchdog cannot be stopped once started (default="
- __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
/*
* Watchdog Operations
*/
-static void advwdt_ping(void)
+static void
+advwdt_ping(void)
{
/* Write a watchdog value */
outb_p(timeout, wdt_start);
}
-static void advwdt_disable(void)
+static void
+advwdt_disable(void)
{
inb_p(wdt_stop);
}
-static int advwdt_set_heartbeat(int t)
+static int
+advwdt_set_heartbeat(int t)
{
- if (t < 1 || t > 63)
+ if ((t < 1) || (t > 63))
return -EINVAL;
+
timeout = t;
return 0;
}
@@ -110,8 +109,8 @@ static int advwdt_set_heartbeat(int t)
* /dev/watchdog handling
*/
-static ssize_t advwdt_write(struct file *file, const char __user *buf,
- size_t count, loff_t *ppos)
+static ssize_t
+advwdt_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
{
if (count) {
if (!nowayout) {
@@ -121,7 +120,7 @@ static ssize_t advwdt_write(struct file *file, const char __user *buf,
for (i = 0; i != count; i++) {
char c;
- if (get_user(c, buf + i))
+ if (get_user(c, buf+i))
return -EFAULT;
if (c == 'V')
adv_expect_close = 42;
@@ -132,7 +131,9 @@ static ssize_t advwdt_write(struct file *file, const char __user *buf,
return count;
}
-static long advwdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
+static int
+advwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
+ unsigned long arg)
{
int new_timeout;
void __user *argp = (void __user *)arg;
@@ -145,50 +146,57 @@ static long advwdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
switch (cmd) {
case WDIOC_GETSUPPORT:
- if (copy_to_user(argp, &ident, sizeof(ident)))
- return -EFAULT;
- break;
+ if (copy_to_user(argp, &ident, sizeof(ident)))
+ return -EFAULT;
+ break;
case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS:
- return put_user(0, p);
+ return put_user(0, p);
+
+ case WDIOC_KEEPALIVE:
+ advwdt_ping();
+ break;
+
+ case WDIOC_SETTIMEOUT:
+ if (get_user(new_timeout, p))
+ return -EFAULT;
+ if (advwdt_set_heartbeat(new_timeout))
+ return -EINVAL;
+ advwdt_ping();
+ /* Fall */
+
+ case WDIOC_GETTIMEOUT:
+ return put_user(timeout, p);
case WDIOC_SETOPTIONS:
{
- int options, retval = -EINVAL;
+ int options, retval = -EINVAL;
- if (get_user(options, p))
- return -EFAULT;
- if (options & WDIOS_DISABLECARD) {
- advwdt_disable();
- retval = 0;
- }
- if (options & WDIOS_ENABLECARD) {
- advwdt_ping();
- retval = 0;
- }
- return retval;
+ if (get_user(options, p))
+ return -EFAULT;
+
+ if (options & WDIOS_DISABLECARD) {
+ advwdt_disable();
+ retval = 0;
+ }
+
+ if (options & WDIOS_ENABLECARD) {
+ advwdt_ping();
+ retval = 0;
+ }
+
+ return retval;
}
- case WDIOC_KEEPALIVE:
- advwdt_ping();
- break;
- case WDIOC_SETTIMEOUT:
- if (get_user(new_timeout, p))
- return -EFAULT;
- if (advwdt_set_heartbeat(new_timeout))
- return -EINVAL;
- advwdt_ping();
- /* Fall */
- case WDIOC_GETTIMEOUT:
- return put_user(timeout, p);
default:
- return -ENOTTY;
+ return -ENOTTY;
}
return 0;
}
-static int advwdt_open(struct inode *inode, struct file *file)
+static int
+advwdt_open(struct inode *inode, struct file *file)
{
if (test_and_set_bit(0, &advwdt_is_open))
return -EBUSY;
@@ -200,13 +208,13 @@ static int advwdt_open(struct inode *inode, struct file *file)
return nonseekable_open(inode, file);
}
-static int advwdt_close(struct inode *inode, struct file *file)
+static int
+advwdt_close(struct inode *inode, struct file *file)
{
if (adv_expect_close == 42) {
advwdt_disable();
} else {
- printk(KERN_CRIT PFX
- "Unexpected close, not stopping watchdog!\n");
+ printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n");
advwdt_ping();
}
clear_bit(0, &advwdt_is_open);
@@ -222,7 +230,7 @@ static const struct file_operations advwdt_fops = {
.owner = THIS_MODULE,
.llseek = no_llseek,
.write = advwdt_write,
- .unlocked_ioctl = advwdt_ioctl,
+ .ioctl = advwdt_ioctl,
.open = advwdt_open,
.release = advwdt_close,
};
@@ -237,24 +245,23 @@ static struct miscdevice advwdt_miscdev = {
* Init & exit routines
*/
-static int __devinit advwdt_probe(struct platform_device *dev)
+static int __devinit
+advwdt_probe(struct platform_device *dev)
{
int ret;
if (wdt_stop != wdt_start) {
if (!request_region(wdt_stop, 1, WATCHDOG_NAME)) {
- printk(KERN_ERR PFX
- "I/O address 0x%04x already in use\n",
- wdt_stop);
+ printk (KERN_ERR PFX "I/O address 0x%04x already in use\n",
+ wdt_stop);
ret = -EIO;
goto out;
}
}
if (!request_region(wdt_start, 1, WATCHDOG_NAME)) {
- printk(KERN_ERR PFX
- "I/O address 0x%04x already in use\n",
- wdt_start);
+ printk (KERN_ERR PFX "I/O address 0x%04x already in use\n",
+ wdt_start);
ret = -EIO;
goto unreg_stop;
}
@@ -262,19 +269,20 @@ static int __devinit advwdt_probe(struct platform_device *dev)
/* Check that the heartbeat value is within it's range ; if not reset to the default */
if (advwdt_set_heartbeat(timeout)) {
advwdt_set_heartbeat(WATCHDOG_TIMEOUT);
- printk(KERN_INFO PFX
- "timeout value must be 1<=x<=63, using %d\n", timeout);
+ printk (KERN_INFO PFX "timeout value must be 1<=x<=63, using %d\n",
+ timeout);
}
ret = misc_register(&advwdt_miscdev);
if (ret != 0) {
- printk(KERN_ERR PFX
- "cannot register miscdev on minor=%d (err=%d)\n",
- WATCHDOG_MINOR, ret);
+ printk (KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
+ WATCHDOG_MINOR, ret);
goto unreg_regions;
}
- printk(KERN_INFO PFX "initialized. timeout=%d sec (nowayout=%d)\n",
+
+ printk (KERN_INFO PFX "initialized. timeout=%d sec (nowayout=%d)\n",
timeout, nowayout);
+
out:
return ret;
unreg_regions:
@@ -285,17 +293,19 @@ static int __devinit advwdt_probe(struct platform_device *dev)
goto out;
}
-static int __devexit advwdt_remove(struct platform_device *dev)
+static int __devexit
+advwdt_remove(struct platform_device *dev)
{
misc_deregister(&advwdt_miscdev);
- release_region(wdt_start, 1);
- if (wdt_stop != wdt_start)
- release_region(wdt_stop, 1);
+ release_region(wdt_start,1);
+ if(wdt_stop != wdt_start)
+ release_region(wdt_stop,1);
return 0;
}
-static void advwdt_shutdown(struct platform_device *dev)
+static void
+advwdt_shutdown(struct platform_device *dev)
{
/* Turn the WDT off if we have a soft shutdown */
advwdt_disable();
@@ -311,19 +321,18 @@ static struct platform_driver advwdt_driver = {
},
};
-static int __init advwdt_init(void)
+static int __init
+advwdt_init(void)
{
int err;
- printk(KERN_INFO
- "WDT driver for Advantech single board computer initialising.\n");
+ printk(KERN_INFO "WDT driver for Advantech single board computer initialising.\n");
err = platform_driver_register(&advwdt_driver);
if (err)
return err;
- advwdt_platform_device = platform_device_register_simple(DRV_NAME,
- -1, NULL, 0);
+ advwdt_platform_device = platform_device_register_simple(DRV_NAME, -1, NULL, 0);
if (IS_ERR(advwdt_platform_device)) {
err = PTR_ERR(advwdt_platform_device);
goto unreg_platform_driver;
@@ -336,7 +345,8 @@ static int __init advwdt_init(void)
return err;
}
-static void __exit advwdt_exit(void)
+static void __exit
+advwdt_exit(void)
{
platform_device_unregister(advwdt_platform_device);
platform_driver_unregister(&advwdt_driver);
diff --git a/trunk/drivers/watchdog/alim1535_wdt.c b/trunk/drivers/watchdog/alim1535_wdt.c
index 2a7690ecf97d..2b1fbdb2fcf7 100644
--- a/trunk/drivers/watchdog/alim1535_wdt.c
+++ b/trunk/drivers/watchdog/alim1535_wdt.c
@@ -18,8 +18,9 @@
#include
#include
#include
-#include
-#include
+
+#include
+#include
#define WATCHDOG_NAME "ALi_M1535"
#define PFX WATCHDOG_NAME ": "
@@ -29,21 +30,17 @@
static unsigned long ali_is_open;
static char ali_expect_release;
static struct pci_dev *ali_pci;
-static u32 ali_timeout_bits; /* stores the computed timeout */
+static u32 ali_timeout_bits; /* stores the computed timeout */
static DEFINE_SPINLOCK(ali_lock); /* Guards the hardware */
/* module parameters */
static int timeout = WATCHDOG_TIMEOUT;
module_param(timeout, int, 0);
-MODULE_PARM_DESC(timeout,
- "Watchdog timeout in seconds. (0 < timeout < 18000, default="
- __MODULE_STRING(WATCHDOG_TIMEOUT) ")");
+MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. (0= 18000) {
timeout = WATCHDOG_TIMEOUT;
- printk(KERN_INFO PFX
- "timeout value must be 0 < timeout < 18000, using %d\n",
- timeout);
+ printk(KERN_INFO PFX "timeout value must be 0
#include
#include
-#include
-#include
+#include
+#include
#include
#define OUR_NAME "alim7101_wdt"
@@ -60,17 +60,13 @@
*/
#define WATCHDOG_TIMEOUT 30 /* 30 sec default timeout */
-/* in seconds, will be multiplied by HZ to get seconds to wait for a ping */
-static int timeout = WATCHDOG_TIMEOUT;
+static int timeout = WATCHDOG_TIMEOUT; /* in seconds, will be multiplied by HZ to get seconds to wait for a ping */
module_param(timeout, int, 0);
-MODULE_PARM_DESC(timeout,
- "Watchdog timeout in seconds. (1<=timeout<=3600, default="
- __MODULE_STRING(WATCHDOG_TIMEOUT) ")");
+MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. (1<=timeout<=3600, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ")");
-static int use_gpio; /* Use the pic (for a1d revision alim7101) */
+static int use_gpio = 0; /* Use the pic (for a1d revision alim7101) */
module_param(use_gpio, int, 0);
-MODULE_PARM_DESC(use_gpio,
- "Use the gpio watchdog (required by old cobalt boards).");
+MODULE_PARM_DESC(use_gpio, "Use the gpio watchdog. (required by old cobalt boards)");
static void wdt_timer_ping(unsigned long);
static DEFINE_TIMER(timer, wdt_timer_ping, 0, 1);
@@ -81,9 +77,8 @@ static struct pci_dev *alim7101_pmu;
static int nowayout = WATCHDOG_NOWAYOUT;
module_param(nowayout, int, 0);
-MODULE_PARM_DESC(nowayout,
- "Watchdog cannot be stopped once started (default="
- __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
+ __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
/*
* Whack the dog
@@ -94,26 +89,23 @@ static void wdt_timer_ping(unsigned long data)
/* If we got a heartbeat pulse within the WDT_US_INTERVAL
* we agree to ping the WDT
*/
- char tmp;
+ char tmp;
- if (time_before(jiffies, next_heartbeat)) {
+ if(time_before(jiffies, next_heartbeat))
+ {
/* Ping the WDT (this is actually a disarm/arm sequence) */
pci_read_config_byte(alim7101_pmu, 0x92, &tmp);
- pci_write_config_byte(alim7101_pmu,
- ALI_7101_WDT, (tmp & ~ALI_WDT_ARM));
- pci_write_config_byte(alim7101_pmu,
- ALI_7101_WDT, (tmp | ALI_WDT_ARM));
+ pci_write_config_byte(alim7101_pmu, ALI_7101_WDT, (tmp & ~ALI_WDT_ARM));
+ pci_write_config_byte(alim7101_pmu, ALI_7101_WDT, (tmp | ALI_WDT_ARM));
if (use_gpio) {
- pci_read_config_byte(alim7101_pmu,
- ALI_7101_GPIO_O, &tmp);
- pci_write_config_byte(alim7101_pmu,
- ALI_7101_GPIO_O, tmp | 0x20);
- pci_write_config_byte(alim7101_pmu,
- ALI_7101_GPIO_O, tmp & ~0x20);
+ pci_read_config_byte(alim7101_pmu, ALI_7101_GPIO_O, &tmp);
+ pci_write_config_byte(alim7101_pmu, ALI_7101_GPIO_O, tmp
+ | 0x20);
+ pci_write_config_byte(alim7101_pmu, ALI_7101_GPIO_O, tmp
+ & ~0x20);
}
} else {
- printk(KERN_WARNING PFX
- "Heartbeat lost! Will not ping the watchdog\n");
+ printk(KERN_WARNING PFX "Heartbeat lost! Will not ping the watchdog\n");
}
/* Re-set the timer interval */
mod_timer(&timer, jiffies + WDT_INTERVAL);
@@ -125,27 +117,21 @@ static void wdt_timer_ping(unsigned long data)
static void wdt_change(int writeval)
{
- char tmp;
+ char tmp;
pci_read_config_byte(alim7101_pmu, ALI_7101_WDT, &tmp);
if (writeval == WDT_ENABLE) {
- pci_write_config_byte(alim7101_pmu,
- ALI_7101_WDT, (tmp | ALI_WDT_ARM));
+ pci_write_config_byte(alim7101_pmu, ALI_7101_WDT, (tmp | ALI_WDT_ARM));
if (use_gpio) {
- pci_read_config_byte(alim7101_pmu,
- ALI_7101_GPIO_O, &tmp);
- pci_write_config_byte(alim7101_pmu,
- ALI_7101_GPIO_O, tmp & ~0x20);
+ pci_read_config_byte(alim7101_pmu, ALI_7101_GPIO_O, &tmp);
+ pci_write_config_byte(alim7101_pmu, ALI_7101_GPIO_O, tmp & ~0x20);
}
} else {
- pci_write_config_byte(alim7101_pmu,
- ALI_7101_WDT, (tmp & ~ALI_WDT_ARM));
+ pci_write_config_byte(alim7101_pmu, ALI_7101_WDT, (tmp & ~ALI_WDT_ARM));
if (use_gpio) {
- pci_read_config_byte(alim7101_pmu,
- ALI_7101_GPIO_O, &tmp);
- pci_write_config_byte(alim7101_pmu,
- ALI_7101_GPIO_O, tmp | 0x20);
+ pci_read_config_byte(alim7101_pmu, ALI_7101_GPIO_O, &tmp);
+ pci_write_config_byte(alim7101_pmu, ALI_7101_GPIO_O, tmp | 0x20);
}
}
}
@@ -183,11 +169,10 @@ static void wdt_keepalive(void)
* /dev/watchdog handling
*/
-static ssize_t fop_write(struct file *file, const char __user *buf,
- size_t count, loff_t *ppos)
+static ssize_t fop_write(struct file * file, const char __user * buf, size_t count, loff_t * ppos)
{
/* See if we got the magic character 'V' and reload the timer */
- if (count) {
+ if(count) {
if (!nowayout) {
size_t ofs;
@@ -198,7 +183,7 @@ static ssize_t fop_write(struct file *file, const char __user *buf,
/* now scan */
for (ofs = 0; ofs != count; ofs++) {
char c;
- if (get_user(c, buf + ofs))
+ if (get_user(c, buf+ofs))
return -EFAULT;
if (c == 'V')
wdt_expect_close = 42;
@@ -210,116 +195,119 @@ static ssize_t fop_write(struct file *file, const char __user *buf,
return count;
}
-static int fop_open(struct inode *inode, struct file *file)
+static int fop_open(struct inode * inode, struct file * file)
{
/* Just in case we're already talking to someone... */
- if (test_and_set_bit(0, &wdt_is_open))
+ if(test_and_set_bit(0, &wdt_is_open))
return -EBUSY;
/* Good, fire up the show */
wdt_startup();
return nonseekable_open(inode, file);
}
-static int fop_close(struct inode *inode, struct file *file)
+static int fop_close(struct inode * inode, struct file * file)
{
- if (wdt_expect_close == 42)
+ if(wdt_expect_close == 42)
wdt_turnoff();
else {
/* wim: shouldn't there be a: del_timer(&timer); */
- printk(KERN_CRIT PFX
- "device file closed unexpectedly. Will not stop the WDT!\n");
+ printk(KERN_CRIT PFX "device file closed unexpectedly. Will not stop the WDT!\n");
}
clear_bit(0, &wdt_is_open);
wdt_expect_close = 0;
return 0;
}
-static long fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
+static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
{
void __user *argp = (void __user *)arg;
int __user *p = argp;
- static struct watchdog_info ident = {
- .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT
- | WDIOF_MAGICCLOSE,
+ static struct watchdog_info ident =
+ {
+ .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE,
.firmware_version = 1,
.identity = "ALiM7101",
};
- switch (cmd) {
- case WDIOC_GETSUPPORT:
- return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0;
- case WDIOC_GETSTATUS:
- case WDIOC_GETBOOTSTATUS:
- return put_user(0, p);
- case WDIOC_SETOPTIONS:
+ switch(cmd)
{
- int new_options, retval = -EINVAL;
+ case WDIOC_GETSUPPORT:
+ return copy_to_user(argp, &ident, sizeof(ident))?-EFAULT:0;
+ case WDIOC_GETSTATUS:
+ case WDIOC_GETBOOTSTATUS:
+ return put_user(0, p);
+ case WDIOC_KEEPALIVE:
+ wdt_keepalive();
+ return 0;
+ case WDIOC_SETOPTIONS:
+ {
+ int new_options, retval = -EINVAL;
+
+ if(get_user(new_options, p))
+ return -EFAULT;
+
+ if(new_options & WDIOS_DISABLECARD) {
+ wdt_turnoff();
+ retval = 0;
+ }
- if (get_user(new_options, p))
- return -EFAULT;
- if (new_options & WDIOS_DISABLECARD) {
- wdt_turnoff();
- retval = 0;
+ if(new_options & WDIOS_ENABLECARD) {
+ wdt_startup();
+ retval = 0;
+ }
+
+ return retval;
}
- if (new_options & WDIOS_ENABLECARD) {
- wdt_startup();
- retval = 0;
+ case WDIOC_SETTIMEOUT:
+ {
+ int new_timeout;
+
+ if(get_user(new_timeout, p))
+ return -EFAULT;
+
+ if(new_timeout < 1 || new_timeout > 3600) /* arbitrary upper limit */
+ return -EINVAL;
+
+ timeout = new_timeout;
+ wdt_keepalive();
+ /* Fall through */
}
- return retval;
- }
- case WDIOC_KEEPALIVE:
- wdt_keepalive();
- return 0;
- case WDIOC_SETTIMEOUT:
- {
- int new_timeout;
-
- if (get_user(new_timeout, p))
- return -EFAULT;
- /* arbitrary upper limit */
- if (new_timeout < 1 || new_timeout > 3600)
- return -EINVAL;
- timeout = new_timeout;
- wdt_keepalive();
- /* Fall through */
- }
- case WDIOC_GETTIMEOUT:
- return put_user(timeout, p);
- default:
- return -ENOTTY;
+ case WDIOC_GETTIMEOUT:
+ return put_user(timeout, p);
+ default:
+ return -ENOTTY;
}
}
static const struct file_operations wdt_fops = {
- .owner = THIS_MODULE,
- .llseek = no_llseek,
- .write = fop_write,
- .open = fop_open,
- .release = fop_close,
- .unlocked_ioctl = fop_ioctl,
+ .owner= THIS_MODULE,
+ .llseek= no_llseek,
+ .write= fop_write,
+ .open= fop_open,
+ .release= fop_close,
+ .ioctl= fop_ioctl,
};
static struct miscdevice wdt_miscdev = {
- .minor = WATCHDOG_MINOR,
- .name = "watchdog",
- .fops = &wdt_fops,
+ .minor=WATCHDOG_MINOR,
+ .name="watchdog",
+ .fops=&wdt_fops,
};
/*
* Notifier for system down
*/
-static int wdt_notify_sys(struct notifier_block *this,
- unsigned long code, void *unused)
+static int wdt_notify_sys(struct notifier_block *this, unsigned long code, void *unused)
{
- if (code == SYS_DOWN || code == SYS_HALT)
+ if (code==SYS_DOWN || code==SYS_HALT)
wdt_turnoff();
- if (code == SYS_RESTART) {
+ if (code==SYS_RESTART) {
/*
- * Cobalt devices have no way of rebooting themselves other
- * than getting the watchdog to pull reset, so we restart the
- * watchdog on reboot with no heartbeat
+ * Cobalt devices have no way of rebooting themselves other than
+ * getting the watchdog to pull reset, so we restart the watchdog on
+ * reboot with no heartbeat
*/
wdt_change(WDT_ENABLE);
printk(KERN_INFO PFX "Watchdog timer is now enabled with no heartbeat - should reboot in ~1 second.\n");
@@ -332,7 +320,8 @@ static int wdt_notify_sys(struct notifier_block *this,
* turn the timebomb registers off.
*/
-static struct notifier_block wdt_notifier = {
+static struct notifier_block wdt_notifier=
+{
.notifier_call = wdt_notify_sys,
};
@@ -365,8 +354,7 @@ static int __init alim7101_wdt_init(void)
ali1543_south = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533,
NULL);
if (!ali1543_south) {
- printk(KERN_INFO PFX
- "ALi 1543 South-Bridge not present - WDT not set\n");
+ printk(KERN_INFO PFX "ALi 1543 South-Bridge not present - WDT not set\n");
goto err_out;
}
pci_read_config_byte(ali1543_south, 0x5e, &tmp);
@@ -375,25 +363,24 @@ static int __init alim7101_wdt_init(void)
if (!use_gpio) {
printk(KERN_INFO PFX "Detected old alim7101 revision 'a1d'. If this is a cobalt board, set the 'use_gpio' module parameter.\n");
goto err_out;
- }
+ }
nowayout = 1;
} else if ((tmp & 0x1e) != 0x12 && (tmp & 0x1e) != 0x00) {
printk(KERN_INFO PFX "ALi 1543 South-Bridge does not have the correct revision number (???1001?) - WDT not set\n");
goto err_out;
}
- if (timeout < 1 || timeout > 3600) {
- /* arbitrary upper limit */
+ if(timeout < 1 || timeout > 3600) /* arbitrary upper limit */
+ {
timeout = WATCHDOG_TIMEOUT;
- printk(KERN_INFO PFX
- "timeout value must be 1 <= x <= 3600, using %d\n",
- timeout);
+ printk(KERN_INFO PFX "timeout value must be 1<=x<=3600, using %d\n",
+ timeout);
}
rc = register_reboot_notifier(&wdt_notifier);
if (rc) {
- printk(KERN_ERR PFX
- "cannot register reboot notifier (err=%d)\n", rc);
+ printk(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n",
+ rc);
goto err_out;
}
@@ -404,8 +391,9 @@ static int __init alim7101_wdt_init(void)
goto err_out_reboot;
}
- if (nowayout)
+ if (nowayout) {
__module_get(THIS_MODULE);
+ }
printk(KERN_INFO PFX "WDT driver for ALi M7101 initialised. timeout=%d sec (nowayout=%d)\n",
timeout, nowayout);
diff --git a/trunk/drivers/watchdog/ar7_wdt.c b/trunk/drivers/watchdog/ar7_wdt.c
index 55dcbfe2bb72..ef7b0d67095e 100644
--- a/trunk/drivers/watchdog/ar7_wdt.c
+++ b/trunk/drivers/watchdog/ar7_wdt.c
@@ -213,7 +213,7 @@ static int ar7_wdt_notify_sys(struct notifier_block *this,
}
static struct notifier_block ar7_wdt_notifier = {
- .notifier_call = ar7_wdt_notify_sys,
+ .notifier_call = ar7_wdt_notify_sys
};
static ssize_t ar7_wdt_write(struct file *file, const char *data,
@@ -230,7 +230,7 @@ static ssize_t ar7_wdt_write(struct file *file, const char *data,
expect_close = 0;
for (i = 0; i < len; ++i) {
char c;
- if (get_user(c, data + i))
+ if (get_user(c, data+i))
return -EFAULT;
if (c == 'V')
expect_close = 1;
@@ -251,6 +251,8 @@ static long ar7_wdt_ioctl(struct file *file,
int new_margin;
switch (cmd) {
+ default:
+ return -ENOTTY;
case WDIOC_GETSUPPORT:
if (copy_to_user((struct watchdog_info *)arg, &ident,
sizeof(ident)))
@@ -279,8 +281,6 @@ static long ar7_wdt_ioctl(struct file *file,
if (put_user(margin, (int *)arg))
return -EFAULT;
return 0;
- default:
- return -ENOTTY;
}
}
diff --git a/trunk/drivers/watchdog/at32ap700x_wdt.c b/trunk/drivers/watchdog/at32ap700x_wdt.c
index e8ae638e5804..ae0fca5e8749 100644
--- a/trunk/drivers/watchdog/at32ap700x_wdt.c
+++ b/trunk/drivers/watchdog/at32ap700x_wdt.c
@@ -212,8 +212,8 @@ static struct watchdog_info at32_wdt_info = {
/*
* Handle commands from user-space.
*/
-static long at32_wdt_ioctl(struct file *file,
- unsigned int cmd, unsigned long arg)
+static int at32_wdt_ioctl(struct inode *inode, struct file *file,
+ unsigned int cmd, unsigned long arg)
{
int ret = -ENOTTY;
int time;
@@ -221,10 +221,27 @@ static long at32_wdt_ioctl(struct file *file,
int __user *p = argp;
switch (cmd) {
+ case WDIOC_KEEPALIVE:
+ at32_wdt_pat();
+ ret = 0;
+ break;
case WDIOC_GETSUPPORT:
ret = copy_to_user(argp, &at32_wdt_info,
sizeof(at32_wdt_info)) ? -EFAULT : 0;
break;
+ case WDIOC_SETTIMEOUT:
+ ret = get_user(time, p);
+ if (ret)
+ break;
+ ret = at32_wdt_settimeout(time);
+ if (ret)
+ break;
+ /* Enable new time value */
+ at32_wdt_start();
+ /* fall through */
+ case WDIOC_GETTIMEOUT:
+ ret = put_user(wdt->timeout, p);
+ break;
case WDIOC_GETSTATUS:
ret = put_user(0, p);
break;
@@ -241,23 +258,6 @@ static long at32_wdt_ioctl(struct file *file,
at32_wdt_start();
ret = 0;
break;
- case WDIOC_KEEPALIVE:
- at32_wdt_pat();
- ret = 0;
- break;
- case WDIOC_SETTIMEOUT:
- ret = get_user(time, p);
- if (ret)
- break;
- ret = at32_wdt_settimeout(time);
- if (ret)
- break;
- /* Enable new time value */
- at32_wdt_start();
- /* fall through */
- case WDIOC_GETTIMEOUT:
- ret = put_user(wdt->timeout, p);
- break;
}
return ret;
@@ -283,7 +283,7 @@ static ssize_t at32_wdt_write(struct file *file, const char __user *data,
*/
for (i = 0; i != len; i++) {
char c;
- if (get_user(c, data + i))
+ if (get_user(c, data+i))
return -EFAULT;
if (c == 'V')
expect_release = 42;
@@ -298,7 +298,7 @@ static ssize_t at32_wdt_write(struct file *file, const char __user *data,
static const struct file_operations at32_wdt_fops = {
.owner = THIS_MODULE,
.llseek = no_llseek,
- .unlocked_ioctl = at32_wdt_ioctl,
+ .ioctl = at32_wdt_ioctl,
.open = at32_wdt_open,
.release = at32_wdt_close,
.write = at32_wdt_write,
@@ -391,6 +391,7 @@ static int __exit at32_wdt_remove(struct platform_device *pdev)
wdt = NULL;
platform_set_drvdata(pdev, NULL);
}
+
return 0;
}
diff --git a/trunk/drivers/watchdog/at91rm9200_wdt.c b/trunk/drivers/watchdog/at91rm9200_wdt.c
index 2313f44144f8..9ff9a9565320 100644
--- a/trunk/drivers/watchdog/at91rm9200_wdt.c
+++ b/trunk/drivers/watchdog/at91rm9200_wdt.c
@@ -20,7 +20,7 @@
#include
#include
#include
-#include
+#include
#include
@@ -31,14 +31,11 @@ static int wdt_time = WDT_DEFAULT_TIME;
static int nowayout = WATCHDOG_NOWAYOUT;
module_param(wdt_time, int, 0);
-MODULE_PARM_DESC(wdt_time, "Watchdog time in seconds. (default="
- __MODULE_STRING(WDT_DEFAULT_TIME) ")");
+MODULE_PARM_DESC(wdt_time, "Watchdog time in seconds. (default="__MODULE_STRING(WDT_DEFAULT_TIME) ")");
#ifdef CONFIG_WATCHDOG_NOWAYOUT
module_param(nowayout, int, 0);
-MODULE_PARM_DESC(nowayout,
- "Watchdog cannot be stopped once started (default="
- __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
#endif
@@ -49,7 +46,7 @@ static unsigned long at91wdt_busy;
/*
* Disable the watchdog.
*/
-static inline void at91_wdt_stop(void)
+static void inline at91_wdt_stop(void)
{
at91_sys_write(AT91_ST_WDMR, AT91_ST_EXTEN);
}
@@ -57,17 +54,16 @@ static inline void at91_wdt_stop(void)
/*
* Enable and reset the watchdog.
*/
-static inline void at91_wdt_start(void)
+static void inline at91_wdt_start(void)
{
- at91_sys_write(AT91_ST_WDMR, AT91_ST_EXTEN | AT91_ST_RSTEN |
- (((65536 * wdt_time) >> 8) & AT91_ST_WDV));
+ at91_sys_write(AT91_ST_WDMR, AT91_ST_EXTEN | AT91_ST_RSTEN | (((65536 * wdt_time) >> 8) & AT91_ST_WDV));
at91_sys_write(AT91_ST_CR, AT91_ST_WDRST);
}
/*
* Reload the watchdog timer. (ie, pat the watchdog)
*/
-static inline void at91_wdt_reload(void)
+static void inline at91_wdt_reload(void)
{
at91_sys_write(AT91_ST_CR, AT91_ST_WDRST);
}
@@ -93,9 +89,8 @@ static int at91_wdt_open(struct inode *inode, struct file *file)
*/
static int at91_wdt_close(struct inode *inode, struct file *file)
{
- /* Disable the watchdog when file is closed */
if (!nowayout)
- at91_wdt_stop();
+ at91_wdt_stop(); /* Disable the watchdog when file is closed */
clear_bit(0, &at91wdt_busy);
return 0;
@@ -115,8 +110,7 @@ static int at91_wdt_settimeout(int new_time)
if ((new_time <= 0) || (new_time > WDT_MAX_TIME))
return -EINVAL;
- /* Set new watchdog time. It will be used when
- at91_wdt_start() is called. */
+ /* Set new watchdog time. It will be used when at91_wdt_start() is called. */
wdt_time = new_time;
return 0;
}
@@ -129,52 +123,60 @@ static struct watchdog_info at91_wdt_info = {
/*
* Handle commands from user-space.
*/
-static long at91_wdt_ioct(struct file *file,
- unsigned int cmd, unsigned long arg)
+static int at91_wdt_ioctl(struct inode *inode, struct file *file,
+ unsigned int cmd, unsigned long arg)
{
void __user *argp = (void __user *)arg;
int __user *p = argp;
int new_value;
- switch (cmd) {
- case WDIOC_GETSUPPORT:
- return copy_to_user(argp, &at91_wdt_info,
- sizeof(at91_wdt_info)) ? -EFAULT : 0;
- case WDIOC_GETSTATUS:
- case WDIOC_GETBOOTSTATUS:
- return put_user(0, p);
- case WDIOC_SETOPTIONS:
- if (get_user(new_value, p))
- return -EFAULT;
- if (new_value & WDIOS_DISABLECARD)
- at91_wdt_stop();
- if (new_value & WDIOS_ENABLECARD)
+ switch(cmd) {
+ case WDIOC_KEEPALIVE:
+ at91_wdt_reload(); /* pat the watchdog */
+ return 0;
+
+ case WDIOC_GETSUPPORT:
+ return copy_to_user(argp, &at91_wdt_info, sizeof(at91_wdt_info)) ? -EFAULT : 0;
+
+ case WDIOC_SETTIMEOUT:
+ if (get_user(new_value, p))
+ return -EFAULT;
+
+ if (at91_wdt_settimeout(new_value))
+ return -EINVAL;
+
+ /* Enable new time value */
at91_wdt_start();
- return 0;
- case WDIOC_KEEPALIVE:
- at91_wdt_reload(); /* pat the watchdog */
- return 0;
- case WDIOC_SETTIMEOUT:
- if (get_user(new_value, p))
- return -EFAULT;
- if (at91_wdt_settimeout(new_value))
- return -EINVAL;
- /* Enable new time value */
- at91_wdt_start();
- /* Return current value */
- return put_user(wdt_time, p);
- case WDIOC_GETTIMEOUT:
- return put_user(wdt_time, p);
- default:
- return -ENOTTY;
+
+ /* Return current value */
+ return put_user(wdt_time, p);
+
+ case WDIOC_GETTIMEOUT:
+ return put_user(wdt_time, p);
+
+ case WDIOC_GETSTATUS:
+ case WDIOC_GETBOOTSTATUS:
+ return put_user(0, p);
+
+ case WDIOC_SETOPTIONS:
+ if (get_user(new_value, p))
+ return -EFAULT;
+
+ if (new_value & WDIOS_DISABLECARD)
+ at91_wdt_stop();
+ if (new_value & WDIOS_ENABLECARD)
+ at91_wdt_start();
+ return 0;
+
+ default:
+ return -ENOTTY;
}
}
/*
* Pat the watchdog whenever device is written to.
*/
-static ssize_t at91_wdt_write(struct file *file, const char *data,
- size_t len, loff_t *ppos)
+static ssize_t at91_wdt_write(struct file *file, const char *data, size_t len, loff_t *ppos)
{
at91_wdt_reload(); /* pat the watchdog */
return len;
@@ -185,7 +187,7 @@ static ssize_t at91_wdt_write(struct file *file, const char *data,
static const struct file_operations at91wdt_fops = {
.owner = THIS_MODULE,
.llseek = no_llseek,
- .unlocked_ioctl = at91_wdt_ioctl,
+ .ioctl = at91_wdt_ioctl,
.open = at91_wdt_open,
.release = at91_wdt_close,
.write = at91_wdt_write,
@@ -209,8 +211,7 @@ static int __init at91wdt_probe(struct platform_device *pdev)
if (res)
return res;
- printk(KERN_INFO "AT91 Watchdog Timer enabled (%d seconds%s)\n",
- wdt_time, nowayout ? ", nowayout" : "");
+ printk("AT91 Watchdog Timer enabled (%d seconds%s)\n", wdt_time, nowayout ? ", nowayout" : "");
return 0;
}
@@ -264,8 +265,7 @@ static struct platform_driver at91wdt_driver = {
static int __init at91_wdt_init(void)
{
- /* Check that the heartbeat value is within range;
- if not reset to the default */
+ /* Check that the heartbeat value is within range; if not reset to the default */
if (at91_wdt_settimeout(wdt_time)) {
at91_wdt_settimeout(WDT_DEFAULT_TIME);
pr_info("at91_wdt: wdt_time value must be 1 <= wdt_time <= 256, using %d\n", wdt_time);
diff --git a/trunk/drivers/watchdog/bfin_wdt.c b/trunk/drivers/watchdog/bfin_wdt.c
index 31b42253054e..03b3e3d91e7c 100644
--- a/trunk/drivers/watchdog/bfin_wdt.c
+++ b/trunk/drivers/watchdog/bfin_wdt.c
@@ -24,8 +24,8 @@
#include
#include
#include
-#include
#include
+#include
#define stamp(fmt, args...) pr_debug("%s:%i: " fmt "\n", __func__, __LINE__, ## args)
#define stampit() stamp("here i am")
@@ -148,8 +148,7 @@ static int bfin_wdt_set_timeout(unsigned long t)
int run = bfin_wdt_running();
bfin_wdt_stop();
bfin_write_WDOG_CNT(cnt);
- if (run)
- bfin_wdt_start();
+ if (run) bfin_wdt_start();
}
spin_unlock_irqrestore(&bfin_wdt_spinlock, flags);
@@ -192,15 +191,16 @@ static int bfin_wdt_release(struct inode *inode, struct file *file)
{
stampit();
- if (expect_close == 42)
+ if (expect_close == 42) {
bfin_wdt_stop();
- else {
- printk(KERN_CRIT PFX
- "Unexpected close, not stopping watchdog!\n");
+ } else {
+ printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n");
bfin_wdt_keepalive();
}
+
expect_close = 0;
clear_bit(0, &open_check);
+
return 0;
}
@@ -214,7 +214,7 @@ static int bfin_wdt_release(struct inode *inode, struct file *file)
* Pings the watchdog on write.
*/
static ssize_t bfin_wdt_write(struct file *file, const char __user *data,
- size_t len, loff_t *ppos)
+ size_t len, loff_t *ppos)
{
stampit();
@@ -241,6 +241,7 @@ static ssize_t bfin_wdt_write(struct file *file, const char __user *data,
/**
* bfin_wdt_ioctl - Query Device
+ * @inode: inode of device
* @file: file handle of device
* @cmd: watchdog command
* @arg: argument
@@ -248,8 +249,8 @@ static ssize_t bfin_wdt_write(struct file *file, const char __user *data,
* Query basic information from the device or ping it, as outlined by the
* watchdog API.
*/
-static long bfin_wdt_ioctl(struct file *file,
- unsigned int cmd, unsigned long arg)
+static int bfin_wdt_ioctl(struct inode *inode, struct file *file,
+ unsigned int cmd, unsigned long arg)
{
void __user *argp = (void __user *)arg;
int __user *p = argp;
@@ -257,49 +258,59 @@ static long bfin_wdt_ioctl(struct file *file,
stampit();
switch (cmd) {
- case WDIOC_GETSUPPORT:
- if (copy_to_user(argp, &bfin_wdt_info, sizeof(bfin_wdt_info)))
- return -EFAULT;
- else
+ default:
+ return -ENOTTY;
+
+ case WDIOC_GETSUPPORT:
+ if (copy_to_user(argp, &bfin_wdt_info, sizeof(bfin_wdt_info)))
+ return -EFAULT;
+ else
+ return 0;
+
+ case WDIOC_GETSTATUS:
+ case WDIOC_GETBOOTSTATUS:
+ return put_user(!!(_bfin_swrst & SWRST_RESET_WDOG), p);
+
+ case WDIOC_KEEPALIVE:
+ bfin_wdt_keepalive();
return 0;
- case WDIOC_GETSTATUS:
- case WDIOC_GETBOOTSTATUS:
- return put_user(!!(_bfin_swrst & SWRST_RESET_WDOG), p);
- case WDIOC_SETOPTIONS: {
- unsigned long flags;
- int options, ret = -EINVAL;
-
- if (get_user(options, p))
- return -EFAULT;
-
- spin_lock_irqsave(&bfin_wdt_spinlock, flags);
- if (options & WDIOS_DISABLECARD) {
- bfin_wdt_stop();
- ret = 0;
+
+ case WDIOC_SETTIMEOUT: {
+ int new_timeout;
+
+ if (get_user(new_timeout, p))
+ return -EFAULT;
+
+ if (bfin_wdt_set_timeout(new_timeout))
+ return -EINVAL;
}
- if (options & WDIOS_ENABLECARD) {
- bfin_wdt_start();
- ret = 0;
+ /* Fall */
+ case WDIOC_GETTIMEOUT:
+ return put_user(timeout, p);
+
+ case WDIOC_SETOPTIONS: {
+ unsigned long flags;
+ int options, ret = -EINVAL;
+
+ if (get_user(options, p))
+ return -EFAULT;
+
+ spin_lock_irqsave(&bfin_wdt_spinlock, flags);
+
+ if (options & WDIOS_DISABLECARD) {
+ bfin_wdt_stop();
+ ret = 0;
+ }
+
+ if (options & WDIOS_ENABLECARD) {
+ bfin_wdt_start();
+ ret = 0;
+ }
+
+ spin_unlock_irqrestore(&bfin_wdt_spinlock, flags);
+
+ return ret;
}
- spin_unlock_irqrestore(&bfin_wdt_spinlock, flags);
- return ret;
- }
- case WDIOC_KEEPALIVE:
- bfin_wdt_keepalive();
- return 0;
- case WDIOC_SETTIMEOUT: {
- int new_timeout;
-
- if (get_user(new_timeout, p))
- return -EFAULT;
- if (bfin_wdt_set_timeout(new_timeout))
- return -EINVAL;
- }
- /* Fall */
- case WDIOC_GETTIMEOUT:
- return put_user(timeout, p);
- default:
- return -ENOTTY;
}
}
@@ -312,8 +323,8 @@ static long bfin_wdt_ioctl(struct file *file,
* Handles specific events, such as turning off the watchdog during a
* shutdown event.
*/
-static int bfin_wdt_notify_sys(struct notifier_block *this,
- unsigned long code, void *unused)
+static int bfin_wdt_notify_sys(struct notifier_block *this, unsigned long code,
+ void *unused)
{
stampit();
@@ -368,12 +379,12 @@ static int bfin_wdt_resume(struct platform_device *pdev)
#endif
static const struct file_operations bfin_wdt_fops = {
- .owner = THIS_MODULE,
- .llseek = no_llseek,
- .write = bfin_wdt_write,
- .unlocked_ioctl = bfin_wdt_ioctl,
- .open = bfin_wdt_open,
- .release = bfin_wdt_release,
+ .owner = THIS_MODULE,
+ .llseek = no_llseek,
+ .write = bfin_wdt_write,
+ .ioctl = bfin_wdt_ioctl,
+ .open = bfin_wdt_open,
+ .release = bfin_wdt_release,
};
static struct miscdevice bfin_wdt_miscdev = {
@@ -385,8 +396,8 @@ static struct miscdevice bfin_wdt_miscdev = {
static struct watchdog_info bfin_wdt_info = {
.identity = "Blackfin Watchdog",
.options = WDIOF_SETTIMEOUT |
- WDIOF_KEEPALIVEPING |
- WDIOF_MAGICCLOSE,
+ WDIOF_KEEPALIVEPING |
+ WDIOF_MAGICCLOSE,
};
static struct notifier_block bfin_wdt_notifier = {
@@ -405,16 +416,14 @@ static int __devinit bfin_wdt_probe(struct platform_device *pdev)
ret = register_reboot_notifier(&bfin_wdt_notifier);
if (ret) {
- pr_devinit(KERN_ERR PFX
- "cannot register reboot notifier (err=%d)\n", ret);
+ pr_devinit(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n", ret);
return ret;
}
ret = misc_register(&bfin_wdt_miscdev);
if (ret) {
- pr_devinit(KERN_ERR PFX
- "cannot register miscdev on minor=%d (err=%d)\n",
- WATCHDOG_MINOR, ret);
+ pr_devinit(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
+ WATCHDOG_MINOR, ret);
unregister_reboot_notifier(&bfin_wdt_notifier);
return ret;
}
@@ -507,11 +516,7 @@ MODULE_LICENSE("GPL");
MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
module_param(timeout, uint, 0);
-MODULE_PARM_DESC(timeout,
- "Watchdog timeout in seconds. (1<=timeout<=((2^32)/SCLK), default="
- __MODULE_STRING(WATCHDOG_TIMEOUT) ")");
+MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. (1<=timeout<=((2^32)/SCLK), default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ")");
module_param(nowayout, int, 0);
-MODULE_PARM_DESC(nowayout,
- "Watchdog cannot be stopped once started (default="
- __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
diff --git a/trunk/drivers/watchdog/booke_wdt.c b/trunk/drivers/watchdog/booke_wdt.c
index c3b78a76f173..770824458d45 100644
--- a/trunk/drivers/watchdog/booke_wdt.c
+++ b/trunk/drivers/watchdog/booke_wdt.c
@@ -18,9 +18,9 @@
#include
#include
#include
-#include
#include
+#include
#include
/* If the kernel parameter wdt=1, the watchdog will be enabled at boot.
@@ -32,7 +32,7 @@
*/
#ifdef CONFIG_FSL_BOOKE
-#define WDT_PERIOD_DEFAULT 63 /* Ex. wdt_period=28 bus=333Mhz,reset=~40sec */
+#define WDT_PERIOD_DEFAULT 63 /* Ex. wdt_period=28 bus=333Mhz , reset=~40sec */
#else
#define WDT_PERIOD_DEFAULT 3 /* Refer to the PPC40x and PPC4xx manuals */
#endif /* for timing information */
@@ -82,15 +82,16 @@ static struct watchdog_info ident = {
.identity = "PowerPC Book-E Watchdog",
};
-static long booke_wdt_ioctl(struct file *file,
- unsigned int cmd, unsigned long arg)
+static int booke_wdt_ioctl(struct inode *inode, struct file *file,
+ unsigned int cmd, unsigned long arg)
{
u32 tmp = 0;
u32 __user *p = (u32 __user *)arg;
switch (cmd) {
case WDIOC_GETSUPPORT:
- if (copy_to_user(arg, &ident, sizeof(struct watchdog_info)))
+ if (copy_to_user((struct watchdog_info __user *)arg, &ident,
+ sizeof(struct watchdog_info)))
return -EFAULT;
case WDIOC_GETSTATUS:
return put_user(ident.options, p);
@@ -99,26 +100,25 @@ static long booke_wdt_ioctl(struct file *file,
tmp = mfspr(SPRN_TSR) & TSR_WRS(3);
/* returns 1 if last reset was caused by the WDT */
return (tmp ? 1 : 0);
- case WDIOC_SETOPTIONS:
- if (get_user(tmp, p))
- return -EINVAL;
- if (tmp == WDIOS_ENABLECARD) {
- booke_wdt_ping();
- break;
- } else
- return -EINVAL;
- return 0;
case WDIOC_KEEPALIVE:
booke_wdt_ping();
return 0;
case WDIOC_SETTIMEOUT:
if (get_user(booke_wdt_period, p))
return -EFAULT;
- mtspr(SPRN_TCR, (mfspr(SPRN_TCR) & ~WDTP(0)) |
- WDTP(booke_wdt_period));
+ mtspr(SPRN_TCR, (mfspr(SPRN_TCR)&~WDTP(0))|WDTP(booke_wdt_period));
return 0;
case WDIOC_GETTIMEOUT:
return put_user(booke_wdt_period, p);
+ case WDIOC_SETOPTIONS:
+ if (get_user(tmp, p))
+ return -EINVAL;
+ if (tmp == WDIOS_ENABLECARD) {
+ booke_wdt_ping();
+ break;
+ } else
+ return -EINVAL;
+ return 0;
default:
return -ENOTTY;
}
@@ -132,9 +132,8 @@ static int booke_wdt_open(struct inode *inode, struct file *file)
if (booke_wdt_enabled == 0) {
booke_wdt_enabled = 1;
on_each_cpu(__booke_wdt_enable, NULL, 0);
- printk(KERN_INFO
- "PowerPC Book-E Watchdog Timer Enabled (wdt_period=%d)\n",
- booke_wdt_period);
+ printk(KERN_INFO "PowerPC Book-E Watchdog Timer Enabled "
+ "(wdt_period=%d)\n", booke_wdt_period);
}
spin_unlock(&booke_wdt_lock);
@@ -145,7 +144,7 @@ static const struct file_operations booke_wdt_fops = {
.owner = THIS_MODULE,
.llseek = no_llseek,
.write = booke_wdt_write,
- .unlocked_ioctl = booke_wdt_ioctl,
+ .ioctl = booke_wdt_ioctl,
.open = booke_wdt_open,
};
@@ -176,9 +175,8 @@ static int __init booke_wdt_init(void)
spin_lock(&booke_wdt_lock);
if (booke_wdt_enabled == 1) {
- printk(KERN_INFO
- "PowerPC Book-E Watchdog Timer Enabled (wdt_period=%d)\n",
- booke_wdt_period);
+ printk(KERN_INFO "PowerPC Book-E Watchdog Timer Enabled "
+ "(wdt_period=%d)\n", booke_wdt_period);
on_each_cpu(__booke_wdt_enable, NULL, 0);
}
spin_unlock(&booke_wdt_lock);
diff --git a/trunk/drivers/watchdog/cpu5wdt.c b/trunk/drivers/watchdog/cpu5wdt.c
index 71f6d7eec9a8..df72f90123df 100644
--- a/trunk/drivers/watchdog/cpu5wdt.c
+++ b/trunk/drivers/watchdog/cpu5wdt.c
@@ -30,16 +30,16 @@
#include
#include
#include
-#include
-#include
+#include
+#include
+
#include
/* adjustable parameters */
-static int verbose;
+static int verbose = 0;
static int port = 0x91;
static int ticks = 10000;
-static spinlock_t cpu5wdt_lock;
#define PFX "cpu5wdt: "
@@ -70,13 +70,12 @@ static struct {
static void cpu5wdt_trigger(unsigned long unused)
{
- if (verbose > 2)
+ if ( verbose > 2 )
printk(KERN_DEBUG PFX "trigger at %i ticks\n", ticks);
- if (cpu5wdt_device.running)
+ if( cpu5wdt_device.running )
ticks--;
- spin_lock(&cpu5wdt_lock);
/* keep watchdog alive */
outb(1, port + CPU5WDT_TRIGGER_REG);
@@ -87,7 +86,6 @@ static void cpu5wdt_trigger(unsigned long unused)
/* ticks doesn't matter anyway */
complete(&cpu5wdt_device.stop);
}
- spin_unlock(&cpu5wdt_lock);
}
@@ -95,17 +93,14 @@ static void cpu5wdt_reset(void)
{
ticks = cpu5wdt_device.default_ticks;
- if (verbose)
+ if ( verbose )
printk(KERN_DEBUG PFX "reset (%i ticks)\n", (int) ticks);
}
static void cpu5wdt_start(void)
{
- unsigned long flags;
-
- spin_lock_irqsave(&cpu5wdt_lock, flags);
- if (!cpu5wdt_device.queue) {
+ if ( !cpu5wdt_device.queue ) {
cpu5wdt_device.queue = 1;
outb(0, port + CPU5WDT_TIME_A_REG);
outb(0, port + CPU5WDT_TIME_B_REG);
@@ -116,20 +111,18 @@ static void cpu5wdt_start(void)
}
/* if process dies, counter is not decremented */
cpu5wdt_device.running++;
- spin_unlock_irqrestore(&cpu5wdt_lock, flags);
}
static int cpu5wdt_stop(void)
{
- unsigned long flags;
-
- spin_lock_irqsave(&cpu5wdt_lock, flags);
- if (cpu5wdt_device.running)
+ if ( cpu5wdt_device.running )
cpu5wdt_device.running = 0;
+
ticks = cpu5wdt_device.default_ticks;
- spin_unlock_irqrestore(&cpu5wdt_lock, flags);
- if (verbose)
+
+ if ( verbose )
printk(KERN_CRIT PFX "stop not possible\n");
+
return -EIO;
}
@@ -137,8 +130,9 @@ static int cpu5wdt_stop(void)
static int cpu5wdt_open(struct inode *inode, struct file *file)
{
- if (test_and_set_bit(0, &cpu5wdt_device.inuse))
+ if ( test_and_set_bit(0, &cpu5wdt_device.inuse) )
return -EBUSY;
+
return nonseekable_open(inode, file);
}
@@ -148,58 +142,67 @@ static int cpu5wdt_release(struct inode *inode, struct file *file)
return 0;
}
-static long cpu5wdt_ioctl(struct file *file, unsigned int cmd,
- unsigned long arg)
+static int cpu5wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
{
void __user *argp = (void __user *)arg;
- int __user *p = argp;
unsigned int value;
- static struct watchdog_info ident = {
+ static struct watchdog_info ident =
+ {
.options = WDIOF_CARDRESET,
.identity = "CPU5 WDT",
};
- switch (cmd) {
- case WDIOC_GETSUPPORT:
- if (copy_to_user(argp, &ident, sizeof(ident)))
- return -EFAULT;
- break;
- case WDIOC_GETSTATUS:
- value = inb(port + CPU5WDT_STATUS_REG);
- value = (value >> 2) & 1;
- return put_user(value, p);
- case WDIOC_GETBOOTSTATUS:
- return put_user(0, p);
- case WDIOC_SETOPTIONS:
- if (get_user(value, p))
- return -EFAULT;
- if (value & WDIOS_ENABLECARD)
- cpu5wdt_start();
- if (value & WDIOS_DISABLECARD)
- cpu5wdt_stop();
- break;
- case WDIOC_KEEPALIVE:
- cpu5wdt_reset();
- break;
- default:
- return -ENOTTY;
+ switch(cmd) {
+ case WDIOC_KEEPALIVE:
+ cpu5wdt_reset();
+ break;
+ case WDIOC_GETSTATUS:
+ value = inb(port + CPU5WDT_STATUS_REG);
+ value = (value >> 2) & 1;
+ if ( copy_to_user(argp, &value, sizeof(int)) )
+ return -EFAULT;
+ break;
+ case WDIOC_GETBOOTSTATUS:
+ if ( copy_to_user(argp, &value, sizeof(int)) )
+ return -EFAULT;
+ break;
+ case WDIOC_GETSUPPORT:
+ if ( copy_to_user(argp, &ident, sizeof(ident)) )
+ return -EFAULT;
+ break;
+ case WDIOC_SETOPTIONS:
+ if ( copy_from_user(&value, argp, sizeof(int)) )
+ return -EFAULT;
+ switch(value) {
+ case WDIOS_ENABLECARD:
+ cpu5wdt_start();
+ break;
+ case WDIOS_DISABLECARD:
+ return cpu5wdt_stop();
+ default:
+ return -EINVAL;
+ }
+ break;
+ default:
+ return -ENOTTY;
}
return 0;
}
-static ssize_t cpu5wdt_write(struct file *file, const char __user *buf,
- size_t count, loff_t *ppos)
+static ssize_t cpu5wdt_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
{
- if (!count)
+ if ( !count )
return -EIO;
+
cpu5wdt_reset();
+
return count;
}
static const struct file_operations cpu5wdt_fops = {
.owner = THIS_MODULE,
.llseek = no_llseek,
- .unlocked_ioctl = cpu5wdt_ioctl,
+ .ioctl = cpu5wdt_ioctl,
.open = cpu5wdt_open,
.write = cpu5wdt_write,
.release = cpu5wdt_release,
@@ -218,36 +221,37 @@ static int __devinit cpu5wdt_init(void)
unsigned int val;
int err;
- if (verbose)
- printk(KERN_DEBUG PFX
- "port=0x%x, verbose=%i\n", port, verbose);
+ if ( verbose )
+ printk(KERN_DEBUG PFX "port=0x%x, verbose=%i\n", port, verbose);
- init_completion(&cpu5wdt_device.stop);
- spin_lock_init(&cpu5wdt_lock);
- cpu5wdt_device.queue = 0;
- setup_timer(&cpu5wdt_device.timer, cpu5wdt_trigger, 0);
- cpu5wdt_device.default_ticks = ticks;
-
- if (!request_region(port, CPU5WDT_EXTENT, PFX)) {
+ if ( !request_region(port, CPU5WDT_EXTENT, PFX) ) {
printk(KERN_ERR PFX "request_region failed\n");
err = -EBUSY;
goto no_port;
}
+ if ( (err = misc_register(&cpu5wdt_misc)) < 0 ) {
+ printk(KERN_ERR PFX "misc_register failed\n");
+ goto no_misc;
+ }
+
/* watchdog reboot? */
val = inb(port + CPU5WDT_STATUS_REG);
val = (val >> 2) & 1;
- if (!val)
+ if ( !val )
printk(KERN_INFO PFX "sorry, was my fault\n");
- err = misc_register(&cpu5wdt_misc);
- if (err < 0) {
- printk(KERN_ERR PFX "misc_register failed\n");
- goto no_misc;
- }
+ init_completion(&cpu5wdt_device.stop);
+ cpu5wdt_device.queue = 0;
+
+ clear_bit(0, &cpu5wdt_device.inuse);
+ setup_timer(&cpu5wdt_device.timer, cpu5wdt_trigger, 0);
+
+ cpu5wdt_device.default_ticks = ticks;
printk(KERN_INFO PFX "init success\n");
+
return 0;
no_misc:
@@ -263,7 +267,7 @@ static int __devinit cpu5wdt_init_module(void)
static void __devexit cpu5wdt_exit(void)
{
- if (cpu5wdt_device.queue) {
+ if ( cpu5wdt_device.queue ) {
cpu5wdt_device.queue = 0;
wait_for_completion(&cpu5wdt_device.stop);
}
diff --git a/trunk/drivers/watchdog/davinci_wdt.c b/trunk/drivers/watchdog/davinci_wdt.c
index 802aeba347a0..1782c79eff06 100644
--- a/trunk/drivers/watchdog/davinci_wdt.c
+++ b/trunk/drivers/watchdog/davinci_wdt.c
@@ -22,10 +22,10 @@
#include
#include
#include
-#include
-#include
#include
+#include
+#include
#define MODULE_NAME "DAVINCI-WDT: "
@@ -143,8 +143,9 @@ static struct watchdog_info ident = {
.identity = "DaVinci Watchdog",
};
-static long davinci_wdt_ioctl(struct file *file,
- unsigned int cmd, unsigned long arg)
+static int
+davinci_wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
+ unsigned long arg)
{
int ret = -ENOTTY;
@@ -159,14 +160,14 @@ static long davinci_wdt_ioctl(struct file *file,
ret = put_user(0, (int *)arg);
break;
+ case WDIOC_GETTIMEOUT:
+ ret = put_user(heartbeat, (int *)arg);
+ break;
+
case WDIOC_KEEPALIVE:
wdt_service();
ret = 0;
break;
-
- case WDIOC_GETTIMEOUT:
- ret = put_user(heartbeat, (int *)arg);
- break;
}
return ret;
}
@@ -183,7 +184,7 @@ static const struct file_operations davinci_wdt_fops = {
.owner = THIS_MODULE,
.llseek = no_llseek,
.write = davinci_wdt_write,
- .unlocked_ioctl = davinci_wdt_ioctl,
+ .ioctl = davinci_wdt_ioctl,
.open = davinci_wdt_open,
.release = davinci_wdt_release,
};
diff --git a/trunk/drivers/watchdog/ep93xx_wdt.c b/trunk/drivers/watchdog/ep93xx_wdt.c
index 07b74a768922..0e4787a0bb87 100644
--- a/trunk/drivers/watchdog/ep93xx_wdt.c
+++ b/trunk/drivers/watchdog/ep93xx_wdt.c
@@ -28,9 +28,9 @@
#include
#include
#include
-#include
#include
+#include
#define WDT_VERSION "0.3"
#define PFX "ep93xx_wdt: "
@@ -136,8 +136,9 @@ static struct watchdog_info ident = {
.identity = "EP93xx Watchdog",
};
-static long ep93xx_wdt_ioctl(struct file *file,
- unsigned int cmd, unsigned long arg)
+static int
+ep93xx_wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
+ unsigned long arg)
{
int ret = -ENOTTY;
@@ -155,15 +156,15 @@ static long ep93xx_wdt_ioctl(struct file *file,
ret = put_user(boot_status, (int __user *)arg);
break;
- case WDIOC_KEEPALIVE:
- wdt_keepalive();
- ret = 0;
- break;
-
case WDIOC_GETTIMEOUT:
/* actually, it is 0.250 seconds.... */
ret = put_user(1, (int __user *)arg);
break;
+
+ case WDIOC_KEEPALIVE:
+ wdt_keepalive();
+ ret = 0;
+ break;
}
return ret;
}
@@ -173,8 +174,8 @@ static int ep93xx_wdt_release(struct inode *inode, struct file *file)
if (test_bit(WDT_OK_TO_CLOSE, &wdt_status))
wdt_shutdown();
else
- printk(KERN_CRIT PFX
- "Device closed unexpectedly - timer will not stop\n");
+ printk(KERN_CRIT PFX "Device closed unexpectedly - "
+ "timer will not stop\n");
clear_bit(WDT_IN_USE, &wdt_status);
clear_bit(WDT_OK_TO_CLOSE, &wdt_status);
@@ -185,7 +186,7 @@ static int ep93xx_wdt_release(struct inode *inode, struct file *file)
static const struct file_operations ep93xx_wdt_fops = {
.owner = THIS_MODULE,
.write = ep93xx_wdt_write,
- .unlocked_ioctl = ep93xx_wdt_ioctl,
+ .ioctl = ep93xx_wdt_ioctl,
.open = ep93xx_wdt_open,
.release = ep93xx_wdt_release,
};
@@ -242,9 +243,7 @@ module_param(nowayout, int, 0);
MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started");
module_param(timeout, int, 0);
-MODULE_PARM_DESC(timeout,
- "Watchdog timeout in seconds. (1<=timeout<=3600, default="
- __MODULE_STRING(WATCHDOG_TIMEOUT) ")");
+MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. (1<=timeout<=3600, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ")");
MODULE_AUTHOR("Ray Lehtiniemi ,"
"Alessandro Zummo ");
diff --git a/trunk/drivers/watchdog/eurotechwdt.c b/trunk/drivers/watchdog/eurotechwdt.c
index bbd14e34319f..b14e9d1f164d 100644
--- a/trunk/drivers/watchdog/eurotechwdt.c
+++ b/trunk/drivers/watchdog/eurotechwdt.c
@@ -56,15 +56,14 @@
#include
#include
#include
-#include
-#include
+#include
+#include
#include
static unsigned long eurwdt_is_open;
static int eurwdt_timeout;
static char eur_expect_close;
-static spinlock_t eurwdt_lock;
/*
* You must set these - there is no sane way to probe for this board.
@@ -79,9 +78,7 @@ static char *ev = "int";
static int nowayout = WATCHDOG_NOWAYOUT;
module_param(nowayout, int, 0);
-MODULE_PARM_DESC(nowayout,
- "Watchdog cannot be stopped once started (default="
- __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
/*
* Some symbolic names
@@ -140,8 +137,7 @@ static void eurwdt_activate_timer(void)
{
eurwdt_disable_timer();
eurwdt_write_reg(WDT_CTRL_REG, 0x01); /* activate the WDT */
- eurwdt_write_reg(WDT_OUTPIN_CFG,
- !strcmp("int", ev) ? WDT_EVENT_INT : WDT_EVENT_REBOOT);
+ eurwdt_write_reg(WDT_OUTPIN_CFG, !strcmp("int", ev) ? WDT_EVENT_INT : WDT_EVENT_REBOOT);
/* Setting interrupt line */
if (irq == 2 || irq > 15 || irq < 0) {
@@ -210,21 +206,21 @@ size_t count, loff_t *ppos)
for (i = 0; i != count; i++) {
char c;
- if (get_user(c, buf + i))
+ if(get_user(c, buf+i))
return -EFAULT;
if (c == 'V')
eur_expect_close = 42;
}
}
- spin_lock(&eurwdt_lock);
eurwdt_ping(); /* the default timeout */
- spin_unlock(&eurwdt_lock);
}
+
return count;
}
/**
* eurwdt_ioctl:
+ * @inode: inode of the device
* @file: file handle to the device
* @cmd: watchdog command
* @arg: argument pointer
@@ -233,14 +229,13 @@ size_t count, loff_t *ppos)
* according to their available features.
*/
-static long eurwdt_ioctl(struct file *file,
- unsigned int cmd, unsigned long arg)
+static int eurwdt_ioctl(struct inode *inode, struct file *file,
+ unsigned int cmd, unsigned long arg)
{
void __user *argp = (void __user *)arg;
int __user *p = argp;
static struct watchdog_info ident = {
- .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT
- | WDIOF_MAGICCLOSE,
+ .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE,
.firmware_version = 1,
.identity = "WDT Eurotech CPU-1220/1410",
};
@@ -248,7 +243,10 @@ static long eurwdt_ioctl(struct file *file,
int time;
int options, retval = -EINVAL;
- switch (cmd) {
+ switch(cmd) {
+ default:
+ return -ENOTTY;
+
case WDIOC_GETSUPPORT:
return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0;
@@ -256,26 +254,8 @@ static long eurwdt_ioctl(struct file *file,
case WDIOC_GETBOOTSTATUS:
return put_user(0, p);
- case WDIOC_SETOPTIONS:
- if (get_user(options, p))
- return -EFAULT;
- spin_lock(&eurwdt_lock);
- if (options & WDIOS_DISABLECARD) {
- eurwdt_disable_timer();
- retval = 0;
- }
- if (options & WDIOS_ENABLECARD) {
- eurwdt_activate_timer();
- eurwdt_ping();
- retval = 0;
- }
- spin_unlock(&eurwdt_lock);
- return retval;
-
case WDIOC_KEEPALIVE:
- spin_lock(&eurwdt_lock);
eurwdt_ping();
- spin_unlock(&eurwdt_lock);
return 0;
case WDIOC_SETTIMEOUT:
@@ -286,17 +266,26 @@ static long eurwdt_ioctl(struct file *file,
if (time < 0 || time > 255)
return -EINVAL;
- spin_lock(&eurwdt_lock);
eurwdt_timeout = time;
eurwdt_set_timeout(time);
- spin_unlock(&eurwdt_lock);
/* Fall */
case WDIOC_GETTIMEOUT:
return put_user(eurwdt_timeout, p);
- default:
- return -ENOTTY;
+ case WDIOC_SETOPTIONS:
+ if (get_user(options, p))
+ return -EFAULT;
+ if (options & WDIOS_DISABLECARD) {
+ eurwdt_disable_timer();
+ retval = 0;
+ }
+ if (options & WDIOS_ENABLECARD) {
+ eurwdt_activate_timer();
+ eurwdt_ping();
+ retval = 0;
+ }
+ return retval;
}
}
@@ -333,11 +322,10 @@ static int eurwdt_open(struct inode *inode, struct file *file)
static int eurwdt_release(struct inode *inode, struct file *file)
{
- if (eur_expect_close == 42)
+ if (eur_expect_close == 42) {
eurwdt_disable_timer();
- else {
- printk(KERN_CRIT
- "eurwdt: Unexpected close, not stopping watchdog!\n");
+ } else {
+ printk(KERN_CRIT "eurwdt: Unexpected close, not stopping watchdog!\n");
eurwdt_ping();
}
clear_bit(0, &eurwdt_is_open);
@@ -360,8 +348,10 @@ static int eurwdt_release(struct inode *inode, struct file *file)
static int eurwdt_notify_sys(struct notifier_block *this, unsigned long code,
void *unused)
{
- if (code == SYS_DOWN || code == SYS_HALT)
- eurwdt_disable_timer(); /* Turn the card off */
+ if (code == SYS_DOWN || code == SYS_HALT) {
+ /* Turn the card off */
+ eurwdt_disable_timer();
+ }
return NOTIFY_DONE;
}
@@ -372,11 +362,11 @@ static int eurwdt_notify_sys(struct notifier_block *this, unsigned long code,
static const struct file_operations eurwdt_fops = {
- .owner = THIS_MODULE,
- .llseek = no_llseek,
- .write = eurwdt_write,
- .unlocked_ioctl = eurwdt_ioctl,
- .open = eurwdt_open,
+ .owner = THIS_MODULE,
+ .llseek = no_llseek,
+ .write = eurwdt_write,
+ .ioctl = eurwdt_ioctl,
+ .open = eurwdt_open,
.release = eurwdt_release,
};
@@ -429,7 +419,7 @@ static int __init eurwdt_init(void)
int ret;
ret = request_irq(irq, eurwdt_interrupt, IRQF_DISABLED, "eurwdt", NULL);
- if (ret) {
+ if(ret) {
printk(KERN_ERR "eurwdt: IRQ %d is not free.\n", irq);
goto out;
}
@@ -442,13 +432,10 @@ static int __init eurwdt_init(void)
ret = register_reboot_notifier(&eurwdt_notifier);
if (ret) {
- printk(KERN_ERR
- "eurwdt: can't register reboot notifier (err=%d)\n", ret);
+ printk(KERN_ERR "eurwdt: can't register reboot notifier (err=%d)\n", ret);
goto outreg;
}
- spin_lock_init(&eurwdt_lock);
-
ret = misc_register(&eurwdt_miscdev);
if (ret) {
printk(KERN_ERR "eurwdt: can't misc_register on minor=%d\n",
diff --git a/trunk/drivers/watchdog/geodewdt.c b/trunk/drivers/watchdog/geodewdt.c
index 614a5c7017b6..30d09cbbad94 100644
--- a/trunk/drivers/watchdog/geodewdt.c
+++ b/trunk/drivers/watchdog/geodewdt.c
@@ -17,8 +17,8 @@
#include
#include
#include
-#include
+#include
#include
#define GEODEWDT_HZ 500
@@ -77,24 +77,27 @@ static int geodewdt_set_heartbeat(int val)
return 0;
}
-static int geodewdt_open(struct inode *inode, struct file *file)
+static int
+geodewdt_open(struct inode *inode, struct file *file)
{
- if (test_and_set_bit(WDT_FLAGS_OPEN, &wdt_flags))
- return -EBUSY;
+ if (test_and_set_bit(WDT_FLAGS_OPEN, &wdt_flags))
+ return -EBUSY;
- if (!test_and_clear_bit(WDT_FLAGS_ORPHAN, &wdt_flags))
- __module_get(THIS_MODULE);
+ if (!test_and_clear_bit(WDT_FLAGS_ORPHAN, &wdt_flags))
+ __module_get(THIS_MODULE);
geodewdt_ping();
- return nonseekable_open(inode, file);
+ return nonseekable_open(inode, file);
}
-static int geodewdt_release(struct inode *inode, struct file *file)
+static int
+geodewdt_release(struct inode *inode, struct file *file)
{
if (safe_close) {
geodewdt_disable();
module_put(THIS_MODULE);
- } else {
+ }
+ else {
printk(KERN_CRIT "Unexpected close - watchdog is not stopping.\n");
geodewdt_ping();
@@ -106,10 +109,11 @@ static int geodewdt_release(struct inode *inode, struct file *file)
return 0;
}
-static ssize_t geodewdt_write(struct file *file, const char __user *data,
- size_t len, loff_t *ppos)
+static ssize_t
+geodewdt_write(struct file *file, const char __user *data, size_t len,
+ loff_t *ppos)
{
- if (len) {
+ if(len) {
if (!nowayout) {
size_t i;
safe_close = 0;
@@ -130,8 +134,9 @@ static ssize_t geodewdt_write(struct file *file, const char __user *data,
return len;
}
-static int geodewdt_ioctl(struct inode *inode, struct file *file,
- unsigned int cmd, unsigned long arg)
+static int
+geodewdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
+ unsigned long arg)
{
void __user *argp = (void __user *)arg;
int __user *p = argp;
@@ -142,9 +147,9 @@ static int geodewdt_ioctl(struct inode *inode, struct file *file,
| WDIOF_MAGICCLOSE,
.firmware_version = 1,
.identity = WATCHDOG_NAME,
- };
+ };
- switch (cmd) {
+ switch(cmd) {
case WDIOC_GETSUPPORT:
return copy_to_user(argp, &ident,
sizeof(ident)) ? -EFAULT : 0;
@@ -154,6 +159,22 @@ static int geodewdt_ioctl(struct inode *inode, struct file *file,
case WDIOC_GETBOOTSTATUS:
return put_user(0, p);
+ case WDIOC_KEEPALIVE:
+ geodewdt_ping();
+ return 0;
+
+ case WDIOC_SETTIMEOUT:
+ if (get_user(interval, p))
+ return -EFAULT;
+
+ if (geodewdt_set_heartbeat(interval))
+ return -EINVAL;
+
+/* Fall through */
+
+ case WDIOC_GETTIMEOUT:
+ return put_user(timeout, p);
+
case WDIOC_SETOPTIONS:
{
int options, ret = -EINVAL;
@@ -173,20 +194,6 @@ static int geodewdt_ioctl(struct inode *inode, struct file *file,
return ret;
}
- case WDIOC_KEEPALIVE:
- geodewdt_ping();
- return 0;
-
- case WDIOC_SETTIMEOUT:
- if (get_user(interval, p))
- return -EFAULT;
-
- if (geodewdt_set_heartbeat(interval))
- return -EINVAL;
- /* Fall through */
- case WDIOC_GETTIMEOUT:
- return put_user(timeout, p);
-
default:
return -ENOTTY;
}
@@ -195,21 +202,22 @@ static int geodewdt_ioctl(struct inode *inode, struct file *file,
}
static const struct file_operations geodewdt_fops = {
- .owner = THIS_MODULE,
- .llseek = no_llseek,
- .write = geodewdt_write,
- .ioctl = geodewdt_ioctl,
- .open = geodewdt_open,
- .release = geodewdt_release,
+ .owner = THIS_MODULE,
+ .llseek = no_llseek,
+ .write = geodewdt_write,
+ .ioctl = geodewdt_ioctl,
+ .open = geodewdt_open,
+ .release = geodewdt_release,
};
static struct miscdevice geodewdt_miscdev = {
.minor = WATCHDOG_MINOR,
.name = "watchdog",
- .fops = &geodewdt_fops,
+ .fops = &geodewdt_fops
};
-static int __devinit geodewdt_probe(struct platform_device *dev)
+static int __devinit
+geodewdt_probe(struct platform_device *dev)
{
int ret, timer;
@@ -240,13 +248,15 @@ static int __devinit geodewdt_probe(struct platform_device *dev)
return ret;
}
-static int __devexit geodewdt_remove(struct platform_device *dev)
+static int __devexit
+geodewdt_remove(struct platform_device *dev)
{
misc_deregister(&geodewdt_miscdev);
return 0;
}
-static void geodewdt_shutdown(struct platform_device *dev)
+static void
+geodewdt_shutdown(struct platform_device *dev)
{
geodewdt_disable();
}
@@ -261,7 +271,8 @@ static struct platform_driver geodewdt_driver = {
},
};
-static int __init geodewdt_init(void)
+static int __init
+geodewdt_init(void)
{
int ret;
@@ -281,7 +292,8 @@ static int __init geodewdt_init(void)
return ret;
}
-static void __exit geodewdt_exit(void)
+static void __exit
+geodewdt_exit(void)
{
platform_device_unregister(geodewdt_platform_device);
platform_driver_unregister(&geodewdt_driver);
diff --git a/trunk/drivers/watchdog/hpwdt.c b/trunk/drivers/watchdog/hpwdt.c
index d039d5f2fd1c..ccd6c530782d 100644
--- a/trunk/drivers/watchdog/hpwdt.c
+++ b/trunk/drivers/watchdog/hpwdt.c
@@ -39,7 +39,9 @@
#include
#include
#include
+#include
#include
+#include
#define PCI_BIOS32_SD_VALUE 0x5F32335F /* "_32_" */
#define CRU_BIOS_SIGNATURE_VALUE 0x55524324
@@ -405,7 +407,7 @@ static int __devinit detect_cru_service(void)
dmi_walk(dmi_find_cru);
/* if cru_rom_addr has been set then we found a CRU service */
- return ((cru_rom_addr != NULL) ? 0: -ENODEV);
+ return ((cru_rom_addr != NULL)? 0: -ENODEV);
}
/* ------------------------------------------------------------------------- */
@@ -533,7 +535,7 @@ static ssize_t hpwdt_write(struct file *file, const char __user *data,
/* scan to see whether or not we got the magic char. */
for (i = 0; i != len; i++) {
char c;
- if (get_user(c, data + i))
+ if (get_user(c, data+i))
return -EFAULT;
if (c == 'V')
expect_release = 42;
diff --git a/trunk/drivers/watchdog/i6300esb.c b/trunk/drivers/watchdog/i6300esb.c
index c13383f7fcb9..ca44fd9b19bb 100644
--- a/trunk/drivers/watchdog/i6300esb.c
+++ b/trunk/drivers/watchdog/i6300esb.c
@@ -9,18 +9,18 @@
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
- * based on i810-tco.c which is in turn based on softdog.c
+ * based on i810-tco.c which is in turn based on softdog.c
*
- * The timer is implemented in the following I/O controller hubs:
- * (See the intel documentation on http://developer.intel.com.)
- * 6300ESB chip : document number 300641-003
+ * The timer is implemented in the following I/O controller hubs:
+ * (See the intel documentation on http://developer.intel.com.)
+ * 6300ESB chip : document number 300641-003
*
* 2004YYZZ Ross Biro
* Initial version 0.01
* 2004YYZZ Ross Biro
- * Version 0.02
+ * Version 0.02
* 20050210 David Härdeman
- * Ported driver to kernel 2.6
+ * Ported driver to kernel 2.6
*/
/*
@@ -38,8 +38,9 @@
#include
#include
#include
-#include
-#include
+
+#include
+#include
/* Module and version information */
#define ESB_VERSION "0.03"
@@ -58,17 +59,17 @@
#define ESB_RELOAD_REG BASEADDR + 0x0c /* Reload register */
/* Lock register bits */
-#define ESB_WDT_FUNC (0x01 << 2) /* Watchdog functionality */
-#define ESB_WDT_ENABLE (0x01 << 1) /* Enable WDT */
-#define ESB_WDT_LOCK (0x01 << 0) /* Lock (nowayout) */
+#define ESB_WDT_FUNC ( 0x01 << 2 ) /* Watchdog functionality */
+#define ESB_WDT_ENABLE ( 0x01 << 1 ) /* Enable WDT */
+#define ESB_WDT_LOCK ( 0x01 << 0 ) /* Lock (nowayout) */
/* Config register bits */
-#define ESB_WDT_REBOOT (0x01 << 5) /* Enable reboot on timeout */
-#define ESB_WDT_FREQ (0x01 << 2) /* Decrement frequency */
-#define ESB_WDT_INTTYPE (0x11 << 0) /* Interrupt type on timer1 timeout */
+#define ESB_WDT_REBOOT ( 0x01 << 5 ) /* Enable reboot on timeout */
+#define ESB_WDT_FREQ ( 0x01 << 2 ) /* Decrement frequency */
+#define ESB_WDT_INTTYPE ( 0x11 << 0 ) /* Interrupt type on timer1 timeout */
/* Reload register bits */
-#define ESB_WDT_RELOAD (0x01 << 8) /* prevent timeout */
+#define ESB_WDT_RELOAD ( 0x01 << 8 ) /* prevent timeout */
/* Magic constants */
#define ESB_UNLOCK1 0x80 /* Step 1 to unlock reset registers */
@@ -83,20 +84,14 @@ static unsigned short triggered; /* The status of the watchdog upon boot */
static char esb_expect_close;
/* module parameters */
-/* 30 sec default heartbeat (1 < heartbeat < 2*1023) */
-#define WATCHDOG_HEARTBEAT 30
+#define WATCHDOG_HEARTBEAT 30 /* 30 sec default heartbeat (1 /* For printk/panic/... */
#include /* For __init/__exit/... */
#include /* For io-port access */
-#include /* For inb/outb/... */
-#include "iTCO_vendor.h"
+#include /* For inb/outb/... */
/* iTCO defines */
#define SMI_EN acpibase + 0x30 /* SMI Control and Enable Register */
-#define TCOBASE acpibase + 0x60 /* TCO base address */
-#define TCO1_STS TCOBASE + 0x04 /* TCO1 Status Register */
+#define TCOBASE acpibase + 0x60 /* TCO base address */
+#define TCO1_STS TCOBASE + 0x04 /* TCO1 Status Register */
/* List of vendor support modes */
-/* SuperMicro Pentium 3 Era 370SSE+-OEM1/P3TSSE */
-#define SUPERMICRO_OLD_BOARD 1
-/* SuperMicro Pentium 4 / Xeon 4 / EMT64T Era Systems */
-#define SUPERMICRO_NEW_BOARD 2
+#define SUPERMICRO_OLD_BOARD 1 /* SuperMicro Pentium 3 Era 370SSE+-OEM1/P3TSSE */
+#define SUPERMICRO_NEW_BOARD 2 /* SuperMicro Pentium 4 / Xeon 4 / EMT64T Era Systems */
-static int vendorsupport;
+static int vendorsupport = 0;
module_param(vendorsupport, int, 0);
MODULE_PARM_DESC(vendorsupport, "iTCO vendor specific support mode, default=0 (none), 1=SuperMicro Pent3, 2=SuperMicro Pent4+");
@@ -146,35 +143,34 @@ static void supermicro_old_pre_keepalive(unsigned long acpibase)
*/
/* I/O Port's */
-#define SM_REGINDEX 0x2e /* SuperMicro ICH4+ Register Index */
-#define SM_DATAIO 0x2f /* SuperMicro ICH4+ Register Data I/O */
+#define SM_REGINDEX 0x2e /* SuperMicro ICH4+ Register Index */
+#define SM_DATAIO 0x2f /* SuperMicro ICH4+ Register Data I/O */
/* Control Register's */
-#define SM_CTLPAGESW 0x07 /* SuperMicro ICH4+ Control Page Switch */
-#define SM_CTLPAGE 0x08 /* SuperMicro ICH4+ Control Page Num */
+#define SM_CTLPAGESW 0x07 /* SuperMicro ICH4+ Control Page Switch */
+#define SM_CTLPAGE 0x08 /* SuperMicro ICH4+ Control Page Num */
-#define SM_WATCHENABLE 0x30 /* Watchdog enable: Bit 0: 0=off, 1=on */
+#define SM_WATCHENABLE 0x30 /* Watchdog enable: Bit 0: 0=off, 1=on */
-#define SM_WATCHPAGE 0x87 /* Watchdog unlock control page */
+#define SM_WATCHPAGE 0x87 /* Watchdog unlock control page */
-#define SM_ENDWATCH 0xAA /* Watchdog lock control page */
+#define SM_ENDWATCH 0xAA /* Watchdog lock control page */
-#define SM_COUNTMODE 0xf5 /* Watchdog count mode select */
- /* (Bit 3: 0 = seconds, 1 = minutes */
+#define SM_COUNTMODE 0xf5 /* Watchdog count mode select */
+ /* (Bit 3: 0 = seconds, 1 = minutes */
-#define SM_WATCHTIMER 0xf6 /* 8-bits, Watchdog timer counter (RW) */
+#define SM_WATCHTIMER 0xf6 /* 8-bits, Watchdog timer counter (RW) */
-#define SM_RESETCONTROL 0xf7 /* Watchdog reset control */
- /* Bit 6: timer is reset by kbd interrupt */
- /* Bit 7: timer is reset by mouse interrupt */
+#define SM_RESETCONTROL 0xf7 /* Watchdog reset control */
+ /* Bit 6: timer is reset by kbd interrupt */
+ /* Bit 7: timer is reset by mouse interrupt */
static void supermicro_new_unlock_watchdog(void)
{
- /* Write 0x87 to port 0x2e twice */
+ outb(SM_WATCHPAGE, SM_REGINDEX); /* Write 0x87 to port 0x2e twice */
outb(SM_WATCHPAGE, SM_REGINDEX);
- outb(SM_WATCHPAGE, SM_REGINDEX);
- /* Switch to watchdog control page */
- outb(SM_CTLPAGESW, SM_REGINDEX);
+
+ outb(SM_CTLPAGESW, SM_REGINDEX); /* Switch to watchdog control page */
outb(SM_CTLPAGE, SM_DATAIO);
}
@@ -196,7 +192,7 @@ static void supermicro_new_pre_start(unsigned int heartbeat)
outb(val, SM_DATAIO);
/* Write heartbeat interval to WDOG */
- outb(SM_WATCHTIMER, SM_REGINDEX);
+ outb (SM_WATCHTIMER, SM_REGINDEX);
outb((heartbeat & 255), SM_DATAIO);
/* Make sure keyboard/mouse interrupts don't interfere */
@@ -281,7 +277,7 @@ EXPORT_SYMBOL(iTCO_vendor_pre_set_heartbeat);
int iTCO_vendor_check_noreboot_on(void)
{
- switch (vendorsupport) {
+ switch(vendorsupport) {
case SUPERMICRO_OLD_BOARD:
return 0;
default:
@@ -292,13 +288,13 @@ EXPORT_SYMBOL(iTCO_vendor_check_noreboot_on);
static int __init iTCO_vendor_init_module(void)
{
- printk(KERN_INFO PFX "vendor-support=%d\n", vendorsupport);
+ printk (KERN_INFO PFX "vendor-support=%d\n", vendorsupport);
return 0;
}
static void __exit iTCO_vendor_exit_module(void)
{
- printk(KERN_INFO PFX "Module Unloaded\n");
+ printk (KERN_INFO PFX "Module Unloaded\n");
}
module_init(iTCO_vendor_init_module);
diff --git a/trunk/drivers/watchdog/iTCO_wdt.c b/trunk/drivers/watchdog/iTCO_wdt.c
index bfb93bc2ca9f..95ba985bd341 100644
--- a/trunk/drivers/watchdog/iTCO_wdt.c
+++ b/trunk/drivers/watchdog/iTCO_wdt.c
@@ -55,9 +55,9 @@
*/
/* Module and version information */
-#define DRV_NAME "iTCO_wdt"
-#define DRV_VERSION "1.03"
-#define DRV_RELDATE "30-Apr-2008"
+#define DRV_NAME "iTCO_wdt"
+#define DRV_VERSION "1.03"
+#define DRV_RELDATE "30-Apr-2008"
#define PFX DRV_NAME ": "
/* Includes */
@@ -66,8 +66,7 @@
#include /* For standard types (like size_t) */
#include /* For the -ENODEV/... values */
#include /* For printk/panic/... */
-#include /* For MODULE_ALIAS_MISCDEV
- (WATCHDOG_MINOR) */
+#include /* For MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR) */
#include /* For the watchdog specific items */
#include /* For __init/__exit/... */
#include /* For file operations */
@@ -75,10 +74,9 @@
#include /* For pci functions */
#include /* For io-port access */
#include /* For spin_lock/spin_unlock/... */
-#include /* For copy_to_user/put_user/... */
-#include /* For inb/outb/... */
-#include "iTCO_vendor.h"
+#include /* For copy_to_user/put_user/... */
+#include /* For inb/outb/... */
/* TCO related info */
enum iTCO_chipsets {
@@ -107,7 +105,7 @@ enum iTCO_chipsets {
TCO_ICH9, /* ICH9 */
TCO_ICH9R, /* ICH9R */
TCO_ICH9DH, /* ICH9DH */
- TCO_ICH9DO, /* ICH9DO */
+ TCO_ICH9DO, /* ICH9DO */
TCO_631XESB, /* 631xESB/632xESB */
};
@@ -142,7 +140,7 @@ static struct {
{"ICH9DH", 2},
{"ICH9DO", 2},
{"631xESB/632xESB", 2},
- {NULL, 0}
+ {NULL,0}
};
#define ITCO_PCI_DEVICE(dev, data) \
@@ -161,32 +159,32 @@ static struct {
* functions that probably will be registered by other drivers.
*/
static struct pci_device_id iTCO_wdt_pci_tbl[] = {
- { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801AA_0, TCO_ICH)},
- { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801AB_0, TCO_ICH0)},
- { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801BA_0, TCO_ICH2)},
- { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801BA_10, TCO_ICH2M)},
- { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801CA_0, TCO_ICH3)},
- { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801CA_12, TCO_ICH3M)},
- { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801DB_0, TCO_ICH4)},
- { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801DB_12, TCO_ICH4M)},
- { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801E_0, TCO_CICH)},
- { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801EB_0, TCO_ICH5)},
+ { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801AA_0, TCO_ICH )},
+ { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801AB_0, TCO_ICH0 )},
+ { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801BA_0, TCO_ICH2 )},
+ { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801BA_10, TCO_ICH2M )},
+ { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801CA_0, TCO_ICH3 )},
+ { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801CA_12, TCO_ICH3M )},
+ { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801DB_0, TCO_ICH4 )},
+ { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801DB_12, TCO_ICH4M )},
+ { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801E_0, TCO_CICH )},
+ { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_82801EB_0, TCO_ICH5 )},
{ ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ESB_1, TCO_6300ESB)},
- { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH6_0, TCO_ICH6)},
- { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH6_1, TCO_ICH6M)},
- { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH6_2, TCO_ICH6W)},
- { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH7_0, TCO_ICH7)},
- { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH7_1, TCO_ICH7M)},
+ { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH6_0, TCO_ICH6 )},
+ { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH6_1, TCO_ICH6M )},
+ { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH6_2, TCO_ICH6W )},
+ { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH7_0, TCO_ICH7 )},
+ { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH7_1, TCO_ICH7M )},
{ ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH7_31, TCO_ICH7MDH)},
- { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH8_0, TCO_ICH8)},
- { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH8_1, TCO_ICH8ME)},
- { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH8_2, TCO_ICH8DH)},
- { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH8_3, TCO_ICH8DO)},
- { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH8_4, TCO_ICH8M)},
- { ITCO_PCI_DEVICE(0x2918, TCO_ICH9)},
- { ITCO_PCI_DEVICE(0x2916, TCO_ICH9R)},
- { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH9_2, TCO_ICH9DH)},
- { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH9_4, TCO_ICH9DO)},
+ { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH8_0, TCO_ICH8 )},
+ { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH8_1, TCO_ICH8ME )},
+ { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH8_2, TCO_ICH8DH )},
+ { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH8_3, TCO_ICH8DO )},
+ { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH8_4, TCO_ICH8M )},
+ { ITCO_PCI_DEVICE(0x2918, TCO_ICH9 )},
+ { ITCO_PCI_DEVICE(0x2916, TCO_ICH9R )},
+ { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH9_2, TCO_ICH9DH )},
+ { ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ICH9_4, TCO_ICH9DO )},
{ ITCO_PCI_DEVICE(PCI_DEVICE_ID_INTEL_ESB2_0, TCO_631XESB)},
{ ITCO_PCI_DEVICE(0x2671, TCO_631XESB)},
{ ITCO_PCI_DEVICE(0x2672, TCO_631XESB)},
@@ -205,15 +203,13 @@ static struct pci_device_id iTCO_wdt_pci_tbl[] = {
{ ITCO_PCI_DEVICE(0x267f, TCO_631XESB)},
{ 0, }, /* End of list */
};
-MODULE_DEVICE_TABLE(pci, iTCO_wdt_pci_tbl);
+MODULE_DEVICE_TABLE (pci, iTCO_wdt_pci_tbl);
/* Address definitions for the TCO */
-/* TCO base address */
-#define TCOBASE iTCO_wdt_private.ACPIBASE + 0x60
-/* SMI Control and Enable Register */
-#define SMI_EN iTCO_wdt_private.ACPIBASE + 0x30
+#define TCOBASE iTCO_wdt_private.ACPIBASE + 0x60 /* TCO base address */
+#define SMI_EN iTCO_wdt_private.ACPIBASE + 0x30 /* SMI Control and Enable Register */
-#define TCO_RLD TCOBASE + 0x00 /* TCO Timer Reload and Curr. Value */
+#define TCO_RLD TCOBASE + 0x00 /* TCO Timer Reload and Current Value */
#define TCOv1_TMR TCOBASE + 0x01 /* TCOv1 Timer Initial Value */
#define TCO_DAT_IN TCOBASE + 0x02 /* TCO Data In Register */
#define TCO_DAT_OUT TCOBASE + 0x03 /* TCO Data Out Register */
@@ -226,21 +222,15 @@ MODULE_DEVICE_TABLE(pci, iTCO_wdt_pci_tbl);
/* internal variables */
static unsigned long is_active;
static char expect_release;
-static struct { /* this is private data for the iTCO_wdt device */
- /* TCO version/generation */
- unsigned int iTCO_version;
- /* The cards ACPIBASE address (TCOBASE = ACPIBASE+0x60) */
- unsigned long ACPIBASE;
- /* NO_REBOOT flag is Memory-Mapped GCS register bit 5 (TCO version 2)*/
- unsigned long __iomem *gcs;
- /* the lock for io operations */
- spinlock_t io_lock;
- /* the PCI-device */
- struct pci_dev *pdev;
+static struct { /* this is private data for the iTCO_wdt device */
+ unsigned int iTCO_version; /* TCO version/generation */
+ unsigned long ACPIBASE; /* The cards ACPIBASE address (TCOBASE = ACPIBASE+0x60) */
+ unsigned long __iomem *gcs; /* NO_REBOOT flag is Memory-Mapped GCS register bit 5 (TCO version 2) */
+ spinlock_t io_lock; /* the lock for io operations */
+ struct pci_dev *pdev; /* the PCI-device */
} iTCO_wdt_private;
-/* the watchdog platform device */
-static struct platform_device *iTCO_wdt_platform_device;
+static struct platform_device *iTCO_wdt_platform_device; /* the watchdog platform device */
/* module parameters */
#define WATCHDOG_HEARTBEAT 30 /* 30 sec default heartbeat */
@@ -250,9 +240,22 @@ MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds. (2driver_data].iTCO_version;
+ iTCO_wdt_private.iTCO_version = iTCO_chipset_info[ent->driver_data].iTCO_version;
iTCO_wdt_private.ACPIBASE = base_address;
iTCO_wdt_private.pdev = pdev;
- /* Get the Memory-Mapped GCS register, we need it for the
- NO_REBOOT flag (TCO v2). To get access to it you have to
- read RCBA from PCI Config space 0xf0 and use it as base.
- GCS = RCBA + ICH6_GCS(0x3410). */
+ /* Get the Memory-Mapped GCS register, we need it for the NO_REBOOT flag (TCO v2) */
+ /* To get access to it you have to read RCBA from PCI Config space 0xf0
+ and use it as base. GCS = RCBA + ICH6_GCS(0x3410). */
if (iTCO_wdt_private.iTCO_version == 2) {
pci_read_config_dword(pdev, 0xf0, &base_address);
RCBA = base_address & 0xffffc000;
- iTCO_wdt_private.gcs = ioremap((RCBA + 0x3410), 4);
+ iTCO_wdt_private.gcs = ioremap((RCBA + 0x3410),4);
}
/* Check chipset's NO_REBOOT bit */
@@ -646,8 +657,8 @@ static int __devinit iTCO_wdt_init(struct pci_dev *pdev,
/* Set the TCO_EN bit in SMI_EN register */
if (!request_region(SMI_EN, 4, "iTCO_wdt")) {
- printk(KERN_ERR PFX
- "I/O address 0x%04lx already in use\n", SMI_EN);
+ printk(KERN_ERR PFX "I/O address 0x%04lx already in use\n",
+ SMI_EN );
ret = -EIO;
goto out;
}
@@ -656,20 +667,18 @@ static int __devinit iTCO_wdt_init(struct pci_dev *pdev,
outl(val32, SMI_EN);
release_region(SMI_EN, 4);
- /* The TCO I/O registers reside in a 32-byte range pointed to
- by the TCOBASE value */
- if (!request_region(TCOBASE, 0x20, "iTCO_wdt")) {
- printk(KERN_ERR PFX "I/O address 0x%04lx already in use\n",
+ /* The TCO I/O registers reside in a 32-byte range pointed to by the TCOBASE value */
+ if (!request_region (TCOBASE, 0x20, "iTCO_wdt")) {
+ printk (KERN_ERR PFX "I/O address 0x%04lx already in use\n",
TCOBASE);
ret = -EIO;
goto out;
}
- printk(KERN_INFO PFX
- "Found a %s TCO device (Version=%d, TCOBASE=0x%04lx)\n",
- iTCO_chipset_info[ent->driver_data].name,
- iTCO_chipset_info[ent->driver_data].iTCO_version,
- TCOBASE);
+ printk(KERN_INFO PFX "Found a %s TCO device (Version=%d, TCOBASE=0x%04lx)\n",
+ iTCO_chipset_info[ent->driver_data].name,
+ iTCO_chipset_info[ent->driver_data].iTCO_version,
+ TCOBASE);
/* Clear out the (probably old) status */
outb(0, TCO1_STS);
@@ -678,29 +687,27 @@ static int __devinit iTCO_wdt_init(struct pci_dev *pdev,
/* Make sure the watchdog is not running */
iTCO_wdt_stop();
- /* Check that the heartbeat value is within it's range;
- if not reset to the default */
+ /* Check that the heartbeat value is within it's range ; if not reset to the default */
if (iTCO_wdt_set_heartbeat(heartbeat)) {
iTCO_wdt_set_heartbeat(WATCHDOG_HEARTBEAT);
- printk(KERN_INFO PFX "heartbeat value must be 2 < heartbeat < 39 (TCO v1) or 613 (TCO v2), using %d\n",
- heartbeat);
+ printk(KERN_INFO PFX "heartbeat value must be 2
#include
#include
-#include
-#include
+#include
+#include
#include
static struct platform_device *ibwdt_platform_device;
@@ -120,16 +120,15 @@ static int wd_margin = WD_TIMO;
static int nowayout = WATCHDOG_NOWAYOUT;
module_param(nowayout, int, 0);
-MODULE_PARM_DESC(nowayout,
- "Watchdog cannot be stopped once started (default="
- __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
/*
* Watchdog Operations
*/
-static void ibwdt_ping(void)
+static void
+ibwdt_ping(void)
{
spin_lock(&ibwdt_lock);
@@ -139,14 +138,16 @@ static void ibwdt_ping(void)
spin_unlock(&ibwdt_lock);
}
-static void ibwdt_disable(void)
+static void
+ibwdt_disable(void)
{
spin_lock(&ibwdt_lock);
outb_p(0, WDT_STOP);
spin_unlock(&ibwdt_lock);
}
-static int ibwdt_set_heartbeat(int t)
+static int
+ibwdt_set_heartbeat(int t)
{
int i;
@@ -164,8 +165,8 @@ static int ibwdt_set_heartbeat(int t)
* /dev/watchdog handling
*/
-static ssize_t ibwdt_write(struct file *file, const char __user *buf,
- size_t count, loff_t *ppos)
+static ssize_t
+ibwdt_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
{
if (count) {
if (!nowayout) {
@@ -187,71 +188,77 @@ static ssize_t ibwdt_write(struct file *file, const char __user *buf,
return count;
}
-static long ibwdt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
+static int
+ibwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
+ unsigned long arg)
{
int new_margin;
void __user *argp = (void __user *)arg;
int __user *p = argp;
static struct watchdog_info ident = {
- .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT
- | WDIOF_MAGICCLOSE,
+ .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE,
.firmware_version = 1,
.identity = "IB700 WDT",
};
switch (cmd) {
case WDIOC_GETSUPPORT:
- if (copy_to_user(argp, &ident, sizeof(ident)))
- return -EFAULT;
- break;
+ if (copy_to_user(argp, &ident, sizeof(ident)))
+ return -EFAULT;
+ break;
case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS:
- return put_user(0, p);
+ return put_user(0, p);
+
+ case WDIOC_KEEPALIVE:
+ ibwdt_ping();
+ break;
+
+ case WDIOC_SETTIMEOUT:
+ if (get_user(new_margin, p))
+ return -EFAULT;
+ if (ibwdt_set_heartbeat(new_margin))
+ return -EINVAL;
+ ibwdt_ping();
+ /* Fall */
+
+ case WDIOC_GETTIMEOUT:
+ return put_user(wd_times[wd_margin], p);
case WDIOC_SETOPTIONS:
{
- int options, retval = -EINVAL;
+ int options, retval = -EINVAL;
- if (get_user(options, p))
- return -EFAULT;
+ if (get_user(options, p))
+ return -EFAULT;
- if (options & WDIOS_DISABLECARD) {
- ibwdt_disable();
- retval = 0;
- }
- if (options & WDIOS_ENABLECARD) {
- ibwdt_ping();
- retval = 0;
- }
- return retval;
- }
- case WDIOC_KEEPALIVE:
- ibwdt_ping();
- break;
+ if (options & WDIOS_DISABLECARD) {
+ ibwdt_disable();
+ retval = 0;
+ }
- case WDIOC_SETTIMEOUT:
- if (get_user(new_margin, p))
- return -EFAULT;
- if (ibwdt_set_heartbeat(new_margin))
- return -EINVAL;
- ibwdt_ping();
- /* Fall */
+ if (options & WDIOS_ENABLECARD) {
+ ibwdt_ping();
+ retval = 0;
+ }
- case WDIOC_GETTIMEOUT:
- return put_user(wd_times[wd_margin], p);
+ return retval;
+ }
default:
- return -ENOTTY;
+ return -ENOTTY;
}
return 0;
}
-static int ibwdt_open(struct inode *inode, struct file *file)
+static int
+ibwdt_open(struct inode *inode, struct file *file)
{
- if (test_and_set_bit(0, &ibwdt_is_open))
+ if (test_and_set_bit(0, &ibwdt_is_open)) {
return -EBUSY;
+ }
if (nowayout)
__module_get(THIS_MODULE);
@@ -260,13 +267,13 @@ static int ibwdt_open(struct inode *inode, struct file *file)
return nonseekable_open(inode, file);
}
-static int ibwdt_close(struct inode *inode, struct file *file)
+static int
+ibwdt_close(struct inode *inode, struct file *file)
{
if (expect_close == 42) {
ibwdt_disable();
} else {
- printk(KERN_CRIT PFX
- "WDT device closed unexpectedly. WDT will not stop!\n");
+ printk(KERN_CRIT PFX "WDT device closed unexpectedly. WDT will not stop!\n");
ibwdt_ping();
}
clear_bit(0, &ibwdt_is_open);
@@ -282,7 +289,7 @@ static const struct file_operations ibwdt_fops = {
.owner = THIS_MODULE,
.llseek = no_llseek,
.write = ibwdt_write,
- .unlocked_ioctl = ibwdt_ioctl,
+ .ioctl = ibwdt_ioctl,
.open = ibwdt_open,
.release = ibwdt_close,
};
@@ -303,23 +310,21 @@ static int __devinit ibwdt_probe(struct platform_device *dev)
#if WDT_START != WDT_STOP
if (!request_region(WDT_STOP, 1, "IB700 WDT")) {
- printk(KERN_ERR PFX "STOP method I/O %X is not available.\n",
- WDT_STOP);
+ printk (KERN_ERR PFX "STOP method I/O %X is not available.\n", WDT_STOP);
res = -EIO;
goto out_nostopreg;
}
#endif
if (!request_region(WDT_START, 1, "IB700 WDT")) {
- printk(KERN_ERR PFX "START method I/O %X is not available.\n",
- WDT_START);
+ printk (KERN_ERR PFX "START method I/O %X is not available.\n", WDT_START);
res = -EIO;
goto out_nostartreg;
}
res = misc_register(&ibwdt_miscdev);
if (res) {
- printk(KERN_ERR PFX "failed to register misc device\n");
+ printk (KERN_ERR PFX "failed to register misc device\n");
goto out_nomisc;
}
return 0;
@@ -337,9 +342,9 @@ static int __devinit ibwdt_probe(struct platform_device *dev)
static int __devexit ibwdt_remove(struct platform_device *dev)
{
misc_deregister(&ibwdt_miscdev);
- release_region(WDT_START, 1);
+ release_region(WDT_START,1);
#if WDT_START != WDT_STOP
- release_region(WDT_STOP, 1);
+ release_region(WDT_STOP,1);
#endif
return 0;
}
@@ -364,15 +369,13 @@ static int __init ibwdt_init(void)
{
int err;
- printk(KERN_INFO PFX
- "WDT driver for IB700 single board computer initialising.\n");
+ printk(KERN_INFO PFX "WDT driver for IB700 single board computer initialising.\n");
err = platform_driver_register(&ibwdt_driver);
if (err)
return err;
- ibwdt_platform_device = platform_device_register_simple(DRV_NAME,
- -1, NULL, 0);
+ ibwdt_platform_device = platform_device_register_simple(DRV_NAME, -1, NULL, 0);
if (IS_ERR(ibwdt_platform_device)) {
err = PTR_ERR(ibwdt_platform_device);
goto unreg_platform_driver;
diff --git a/trunk/drivers/watchdog/ibmasr.c b/trunk/drivers/watchdog/ibmasr.c
index b82405cfb4cd..94155f6136c2 100644
--- a/trunk/drivers/watchdog/ibmasr.c
+++ b/trunk/drivers/watchdog/ibmasr.c
@@ -19,8 +19,9 @@
#include
#include
#include
-#include
-#include
+
+#include
+#include
enum {
@@ -69,13 +70,10 @@ static char asr_expect_close;
static unsigned int asr_type, asr_base, asr_length;
static unsigned int asr_read_addr, asr_write_addr;
static unsigned char asr_toggle_mask, asr_disable_mask;
-static spinlock_t asr_lock;
-static void __asr_toggle(void)
+static void asr_toggle(void)
{
- unsigned char reg;
-
- reg = inb(asr_read_addr);
+ unsigned char reg = inb(asr_read_addr);
outb(reg & ~asr_toggle_mask, asr_write_addr);
reg = inb(asr_read_addr);
@@ -85,21 +83,12 @@ static void __asr_toggle(void)
outb(reg & ~asr_toggle_mask, asr_write_addr);
reg = inb(asr_read_addr);
- spin_unlock(&asr_lock);
-}
-
-static void asr_toggle(void)
-{
- spin_lock(&asr_lock);
- __asr_toggle();
- spin_unlock(&asr_lock);
}
static void asr_enable(void)
{
unsigned char reg;
- spin_lock(&asr_lock);
if (asr_type == ASMTYPE_TOPAZ) {
/* asr_write_addr == asr_read_addr */
reg = inb(asr_read_addr);
@@ -110,21 +99,17 @@ static void asr_enable(void)
* First make sure the hardware timer is reset by toggling
* ASR hardware timer line.
*/
- __asr_toggle();
+ asr_toggle();
reg = inb(asr_read_addr);
outb(reg & ~asr_disable_mask, asr_write_addr);
}
reg = inb(asr_read_addr);
- spin_unlock(&asr_lock);
}
static void asr_disable(void)
{
- unsigned char reg;
-
- spin_lock(&asr_lock);
- reg = inb(asr_read_addr);
+ unsigned char reg = inb(asr_read_addr);
if (asr_type == ASMTYPE_TOPAZ)
/* asr_write_addr == asr_read_addr */
@@ -137,7 +122,6 @@ static void asr_disable(void)
outb(reg | asr_disable_mask, asr_write_addr);
}
reg = inb(asr_read_addr);
- spin_unlock(&asr_lock);
}
static int __init asr_get_base_address(void)
@@ -149,8 +133,7 @@ static int __init asr_get_base_address(void)
switch (asr_type) {
case ASMTYPE_TOPAZ:
- /* SELECT SuperIO CHIP FOR QUERYING
- (WRITE 0x07 TO BOTH 0x2E and 0x2F) */
+ /* SELECT SuperIO CHIP FOR QUERYING (WRITE 0x07 TO BOTH 0x2E and 0x2F) */
outb(0x07, 0x2e);
outb(0x07, 0x2f);
@@ -171,26 +154,14 @@ static int __init asr_get_base_address(void)
case ASMTYPE_JASPER:
type = "Jaspers ";
-#if 0
- u32 r;
- /* Suggested fix */
- pdev = pci_get_bus_and_slot(0, DEVFN(0x1f, 0));
- if (pdev == NULL)
- return -ENODEV;
- pci_read_config_dword(pdev, 0x58, &r);
- asr_base = r & 0xFFFE;
- pci_dev_put(pdev);
-#else
- /* FIXME: need to use pci_config_lock here,
- but it's not exported */
+
+ /* FIXME: need to use pci_config_lock here, but it's not exported */
/* spin_lock_irqsave(&pci_config_lock, flags);*/
/* Select the SuperIO chip in the PCI I/O port register */
outl(0x8000f858, 0xcf8);
- /* BUS 0, Slot 1F, fnc 0, offset 58 */
-
/*
* Read the base address for the SuperIO chip.
* Only the lower 16 bits are valid, but the address is word
@@ -199,7 +170,7 @@ static int __init asr_get_base_address(void)
asr_base = inl(0xcfc) & 0xfffe;
/* spin_unlock_irqrestore(&pci_config_lock, flags);*/
-#endif
+
asr_read_addr = asr_write_addr =
asr_base + JASPER_ASR_REG_OFFSET;
asr_toggle_mask = JASPER_ASR_TOGGLE_MASK;
@@ -270,57 +241,66 @@ static ssize_t asr_write(struct file *file, const char __user *buf,
return count;
}
-static long asr_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
+static int asr_ioctl(struct inode *inode, struct file *file,
+ unsigned int cmd, unsigned long arg)
{
static const struct watchdog_info ident = {
- .options = WDIOF_KEEPALIVEPING |
+ .options = WDIOF_KEEPALIVEPING |
WDIOF_MAGICCLOSE,
- .identity = "IBM ASR",
+ .identity = "IBM ASR"
};
void __user *argp = (void __user *)arg;
int __user *p = argp;
int heartbeat;
switch (cmd) {
- case WDIOC_GETSUPPORT:
- return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0;
- case WDIOC_GETSTATUS:
- case WDIOC_GETBOOTSTATUS:
- return put_user(0, p);
- case WDIOC_SETOPTIONS:
- {
- int new_options, retval = -EINVAL;
- if (get_user(new_options, p))
- return -EFAULT;
- if (new_options & WDIOS_DISABLECARD) {
- asr_disable();
- retval = 0;
- }
- if (new_options & WDIOS_ENABLECARD) {
- asr_enable();
+ case WDIOC_GETSUPPORT:
+ return copy_to_user(argp, &ident, sizeof(ident)) ?
+ -EFAULT : 0;
+
+ case WDIOC_GETSTATUS:
+ case WDIOC_GETBOOTSTATUS:
+ return put_user(0, p);
+
+ case WDIOC_KEEPALIVE:
asr_toggle();
- retval = 0;
+ return 0;
+
+ /*
+ * The hardware has a fixed timeout value, so no WDIOC_SETTIMEOUT
+ * and WDIOC_GETTIMEOUT always returns 256.
+ */
+ case WDIOC_GETTIMEOUT:
+ heartbeat = 256;
+ return put_user(heartbeat, p);
+
+ case WDIOC_SETOPTIONS: {
+ int new_options, retval = -EINVAL;
+
+ if (get_user(new_options, p))
+ return -EFAULT;
+
+ if (new_options & WDIOS_DISABLECARD) {
+ asr_disable();
+ retval = 0;
+ }
+
+ if (new_options & WDIOS_ENABLECARD) {
+ asr_enable();
+ asr_toggle();
+ retval = 0;
+ }
+
+ return retval;
}
- return retval;
- }
- case WDIOC_KEEPALIVE:
- asr_toggle();
- return 0;
- /*
- * The hardware has a fixed timeout value, so no WDIOC_SETTIMEOUT
- * and WDIOC_GETTIMEOUT always returns 256.
- */
- case WDIOC_GETTIMEOUT:
- heartbeat = 256;
- return put_user(heartbeat, p);
- default:
- return -ENOTTY;
}
+
+ return -ENOTTY;
}
static int asr_open(struct inode *inode, struct file *file)
{
- if (test_and_set_bit(0, &asr_is_open))
+ if(test_and_set_bit(0, &asr_is_open))
return -EBUSY;
asr_toggle();
@@ -334,8 +314,7 @@ static int asr_release(struct inode *inode, struct file *file)
if (asr_expect_close == 42)
asr_disable();
else {
- printk(KERN_CRIT PFX
- "unexpected close, not stopping watchdog!\n");
+ printk(KERN_CRIT PFX "unexpected close, not stopping watchdog!\n");
asr_toggle();
}
clear_bit(0, &asr_is_open);
@@ -344,12 +323,12 @@ static int asr_release(struct inode *inode, struct file *file)
}
static const struct file_operations asr_fops = {
- .owner = THIS_MODULE,
- .llseek = no_llseek,
- .write = asr_write,
- .unlocked_ioctl = asr_ioctl,
- .open = asr_open,
- .release = asr_release,
+ .owner = THIS_MODULE,
+ .llseek = no_llseek,
+ .write = asr_write,
+ .ioctl = asr_ioctl,
+ .open = asr_open,
+ .release = asr_release,
};
static struct miscdevice asr_miscdev = {
@@ -388,8 +367,6 @@ static int __init ibmasr_init(void)
if (!asr_type)
return -ENODEV;
- spin_lock_init(&asr_lock);
-
rc = asr_get_base_address();
if (rc)
return rc;
@@ -418,9 +395,7 @@ module_init(ibmasr_init);
module_exit(ibmasr_exit);
module_param(nowayout, int, 0);
-MODULE_PARM_DESC(nowayout,
- "Watchdog cannot be stopped once started (default="
- __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
MODULE_DESCRIPTION("IBM Automatic Server Restart driver");
MODULE_AUTHOR("Andrey Panin");
diff --git a/trunk/drivers/watchdog/indydog.c b/trunk/drivers/watchdog/indydog.c
index 73c9e7992feb..788245bdaa7f 100644
--- a/trunk/drivers/watchdog/indydog.c
+++ b/trunk/drivers/watchdog/indydog.c
@@ -1,8 +1,7 @@
/*
* IndyDog 0.3 A Hardware Watchdog Device for SGI IP22
*
- * (c) Copyright 2002 Guido Guenther ,
- * All Rights Reserved.
+ * (c) Copyright 2002 Guido Guenther , All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -23,42 +22,32 @@
#include
#include
#include
-#include
+#include
#include
#define PFX "indydog: "
-static unsigned long indydog_alive;
-static spinlock_t indydog_lock;
+static int indydog_alive;
#define WATCHDOG_TIMEOUT 30 /* 30 sec default timeout */
static int nowayout = WATCHDOG_NOWAYOUT;
module_param(nowayout, int, 0);
-MODULE_PARM_DESC(nowayout,
- "Watchdog cannot be stopped once started (default="
- __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
static void indydog_start(void)
{
- u32 mc_ctrl0;
+ u32 mc_ctrl0 = sgimc->cpuctrl0;
- spin_lock(&indydog_lock);
- mc_ctrl0 = sgimc->cpuctrl0;
mc_ctrl0 = sgimc->cpuctrl0 | SGIMC_CCTRL0_WDOG;
sgimc->cpuctrl0 = mc_ctrl0;
- spin_unlock(&indydog_lock);
}
static void indydog_stop(void)
{
- u32 mc_ctrl0;
+ u32 mc_ctrl0 = sgimc->cpuctrl0;
- spin_lock(&indydog_lock);
-
- mc_ctrl0 = sgimc->cpuctrl0;
mc_ctrl0 &= ~SGIMC_CCTRL0_WDOG;
sgimc->cpuctrl0 = mc_ctrl0;
- spin_unlock(&indydog_lock);
printk(KERN_INFO PFX "Stopped watchdog timer.\n");
}
@@ -73,7 +62,7 @@ static void indydog_ping(void)
*/
static int indydog_open(struct inode *inode, struct file *file)
{
- if (test_and_set_bit(0, &indydog_alive))
+ if (indydog_alive)
return -EBUSY;
if (nowayout)
@@ -95,21 +84,23 @@ static int indydog_release(struct inode *inode, struct file *file)
* Lock it in if it's a module and we defined ...NOWAYOUT */
if (!nowayout)
indydog_stop(); /* Turn the WDT off */
- clear_bit(0, &indydog_alive);
+
+ indydog_alive = 0;
+
return 0;
}
-static ssize_t indydog_write(struct file *file, const char *data,
- size_t len, loff_t *ppos)
+static ssize_t indydog_write(struct file *file, const char *data, size_t len, loff_t *ppos)
{
/* Refresh the timer. */
- if (len)
+ if (len) {
indydog_ping();
+ }
return len;
}
-static long indydog_ioctl(struct file *file, unsigned int cmd,
- unsigned long arg)
+static int indydog_ioctl(struct inode *inode, struct file *file,
+ unsigned int cmd, unsigned long arg)
{
int options, retval = -EINVAL;
static struct watchdog_info ident = {
@@ -120,40 +111,42 @@ static long indydog_ioctl(struct file *file, unsigned int cmd,
};
switch (cmd) {
- case WDIOC_GETSUPPORT:
- if (copy_to_user((struct watchdog_info *)arg,
- &ident, sizeof(ident)))
- return -EFAULT;
- return 0;
- case WDIOC_GETSTATUS:
- case WDIOC_GETBOOTSTATUS:
- return put_user(0, (int *)arg);
- case WDIOC_SETOPTIONS:
- {
- if (get_user(options, (int *)arg))
- return -EFAULT;
- if (options & WDIOS_DISABLECARD) {
- indydog_stop();
- retval = 0;
+ default:
+ return -ENOTTY;
+ case WDIOC_GETSUPPORT:
+ if (copy_to_user((struct watchdog_info *)arg,
+ &ident, sizeof(ident)))
+ return -EFAULT;
+ return 0;
+ case WDIOC_GETSTATUS:
+ case WDIOC_GETBOOTSTATUS:
+ return put_user(0,(int *)arg);
+ case WDIOC_KEEPALIVE:
+ indydog_ping();
+ return 0;
+ case WDIOC_GETTIMEOUT:
+ return put_user(WATCHDOG_TIMEOUT,(int *)arg);
+ case WDIOC_SETOPTIONS:
+ {
+ if (get_user(options, (int *)arg))
+ return -EFAULT;
+
+ if (options & WDIOS_DISABLECARD) {
+ indydog_stop();
+ retval = 0;
+ }
+
+ if (options & WDIOS_ENABLECARD) {
+ indydog_start();
+ retval = 0;
+ }
+
+ return retval;
}
- if (options & WDIOS_ENABLECARD) {
- indydog_start();
- retval = 0;
- }
- return retval;
- }
- case WDIOC_KEEPALIVE:
- indydog_ping();
- return 0;
- case WDIOC_GETTIMEOUT:
- return put_user(WATCHDOG_TIMEOUT, (int *)arg);
- default:
- return -ENOTTY;
}
}
-static int indydog_notify_sys(struct notifier_block *this,
- unsigned long code, void *unused)
+static int indydog_notify_sys(struct notifier_block *this, unsigned long code, void *unused)
{
if (code == SYS_DOWN || code == SYS_HALT)
indydog_stop(); /* Turn the WDT off */
@@ -165,7 +158,7 @@ static const struct file_operations indydog_fops = {
.owner = THIS_MODULE,
.llseek = no_llseek,
.write = indydog_write,
- .unlocked_ioctl = indydog_ioctl,
+ .ioctl = indydog_ioctl,
.open = indydog_open,
.release = indydog_release,
};
@@ -187,20 +180,17 @@ static int __init watchdog_init(void)
{
int ret;
- spin_lock_init(&indydog_lock);
-
ret = register_reboot_notifier(&indydog_notifier);
if (ret) {
- printk(KERN_ERR PFX
- "cannot register reboot notifier (err=%d)\n", ret);
+ printk(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n",
+ ret);
return ret;
}
ret = misc_register(&indydog_miscdev);
if (ret) {
- printk(KERN_ERR PFX
- "cannot register miscdev on minor=%d (err=%d)\n",
- WATCHDOG_MINOR, ret);
+ printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
+ WATCHDOG_MINOR, ret);
unregister_reboot_notifier(&indydog_notifier);
return ret;
}
diff --git a/trunk/drivers/watchdog/iop_wdt.c b/trunk/drivers/watchdog/iop_wdt.c
index 8278b13f77c7..bbbd91af754d 100644
--- a/trunk/drivers/watchdog/iop_wdt.c
+++ b/trunk/drivers/watchdog/iop_wdt.c
@@ -37,7 +37,6 @@
static int nowayout = WATCHDOG_NOWAYOUT;
static unsigned long wdt_status;
static unsigned long boot_status;
-static spinlock_t wdt_lock;
#define WDT_IN_USE 0
#define WDT_OK_TO_CLOSE 1
@@ -69,10 +68,8 @@ static void wdt_enable(void)
/* Arm and enable the Timer to starting counting down from 0xFFFF.FFFF
* Takes approx. 10.7s to timeout
*/
- spin_lock(&wdt_lock);
write_wdtcr(IOP_WDTCR_EN_ARM);
write_wdtcr(IOP_WDTCR_EN);
- spin_unlock(&wdt_lock);
}
/* returns 0 if the timer was successfully disabled */
@@ -80,11 +77,9 @@ static int wdt_disable(void)
{
/* Stop Counting */
if (wdt_supports_disable()) {
- spin_lock(&wdt_lock);
write_wdtcr(IOP_WDTCR_DIS_ARM);
write_wdtcr(IOP_WDTCR_DIS);
clear_bit(WDT_ENABLED, &wdt_status);
- spin_unlock(&wdt_lock);
printk(KERN_INFO "WATCHDOG: Disabled\n");
return 0;
} else
@@ -97,12 +92,16 @@ static int iop_wdt_open(struct inode *inode, struct file *file)
return -EBUSY;
clear_bit(WDT_OK_TO_CLOSE, &wdt_status);
+
wdt_enable();
+
set_bit(WDT_ENABLED, &wdt_status);
+
return nonseekable_open(inode, file);
}
-static ssize_t iop_wdt_write(struct file *file, const char *data, size_t len,
+static ssize_t
+iop_wdt_write(struct file *file, const char *data, size_t len,
loff_t *ppos)
{
if (len) {
@@ -122,35 +121,46 @@ static ssize_t iop_wdt_write(struct file *file, const char *data, size_t len,
}
wdt_enable();
}
+
return len;
}
-static const struct watchdog_info ident = {
+static struct watchdog_info ident = {
.options = WDIOF_CARDRESET | WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING,
.identity = "iop watchdog",
};
-static long iop_wdt_ioctl(struct file *file,
- unsigned int cmd, unsigned long arg)
+static int
+iop_wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
+ unsigned long arg)
{
int options;
int ret = -ENOTTY;
- int __user *argp = (int __user *)arg;
switch (cmd) {
case WDIOC_GETSUPPORT:
- if (copy_to_user(argp, &ident, sizeof ident))
+ if (copy_to_user
+ ((struct watchdog_info *)arg, &ident, sizeof ident))
ret = -EFAULT;
else
ret = 0;
break;
case WDIOC_GETSTATUS:
- ret = put_user(0, argp);
+ ret = put_user(0, (int *)arg);
break;
case WDIOC_GETBOOTSTATUS:
- ret = put_user(boot_status, argp);
+ ret = put_user(boot_status, (int *)arg);
+ break;
+
+ case WDIOC_GETTIMEOUT:
+ ret = put_user(iop_watchdog_timeout(), (int *)arg);
+ break;
+
+ case WDIOC_KEEPALIVE:
+ wdt_enable();
+ ret = 0;
break;
case WDIOC_SETOPTIONS:
@@ -167,21 +177,14 @@ static long iop_wdt_ioctl(struct file *file,
} else
ret = 0;
}
+
if (options & WDIOS_ENABLECARD) {
wdt_enable();
ret = 0;
}
break;
-
- case WDIOC_KEEPALIVE:
- wdt_enable();
- ret = 0;
- break;
-
- case WDIOC_GETTIMEOUT:
- ret = put_user(iop_watchdog_timeout(), argp);
- break;
}
+
return ret;
}
@@ -211,7 +214,7 @@ static const struct file_operations iop_wdt_fops = {
.owner = THIS_MODULE,
.llseek = no_llseek,
.write = iop_wdt_write,
- .unlocked_ioctl = iop_wdt_ioctl,
+ .ioctl = iop_wdt_ioctl,
.open = iop_wdt_open,
.release = iop_wdt_release,
};
@@ -226,8 +229,10 @@ static int __init iop_wdt_init(void)
{
int ret;
- spin_lock_init(&wdt_lock);
-
+ ret = misc_register(&iop_wdt_miscdev);
+ if (ret == 0)
+ printk("iop watchdog timer: timeout %lu sec\n",
+ iop_watchdog_timeout());
/* check if the reset was caused by the watchdog timer */
boot_status = (read_rcsr() & IOP_RCSR_WDT) ? WDIOF_CARDRESET : 0;
@@ -237,13 +242,6 @@ static int __init iop_wdt_init(void)
*/
write_wdtsr(IOP13XX_WDTCR_IB_RESET);
- /* Register after we have the device set up so we cannot race
- with an open */
- ret = misc_register(&iop_wdt_miscdev);
- if (ret == 0)
- printk(KERN_INFO "iop watchdog timer: timeout %lu sec\n",
- iop_watchdog_timeout());
-
return ret;
}
diff --git a/trunk/drivers/watchdog/it8712f_wdt.c b/trunk/drivers/watchdog/it8712f_wdt.c
index 2270ee07c01b..51bfd5721833 100644
--- a/trunk/drivers/watchdog/it8712f_wdt.c
+++ b/trunk/drivers/watchdog/it8712f_wdt.c
@@ -221,7 +221,7 @@ static ssize_t it8712f_wdt_write(struct file *file, const char __user *data,
expect_close = 0;
for (i = 0; i < len; ++i) {
char c;
- if (get_user(c, data + i))
+ if (get_user(c, data+i))
return -EFAULT;
if (c == 'V')
expect_close = 42;
@@ -244,6 +244,8 @@ static long it8712f_wdt_ioctl(struct file *file, unsigned int cmd,
int value;
switch (cmd) {
+ default:
+ return -ENOTTY;
case WDIOC_GETSUPPORT:
if (copy_to_user(argp, &ident, sizeof(ident)))
return -EFAULT;
@@ -282,8 +284,6 @@ static long it8712f_wdt_ioctl(struct file *file, unsigned int cmd,
if (put_user(margin, p))
return -EFAULT;
return 0;
- default:
- return -ENOTTY;
}
}
diff --git a/trunk/drivers/watchdog/ixp2000_wdt.c b/trunk/drivers/watchdog/ixp2000_wdt.c
index a77f69d52877..dc7548dcaf35 100644
--- a/trunk/drivers/watchdog/ixp2000_wdt.c
+++ b/trunk/drivers/watchdog/ixp2000_wdt.c
@@ -25,45 +25,42 @@
#include
#include
#include
-#include
#include
+#include
static int nowayout = WATCHDOG_NOWAYOUT;
static unsigned int heartbeat = 60; /* (secs) Default is 1 minute */
static unsigned long wdt_status;
-static spinlock_t wdt_lock;
#define WDT_IN_USE 0
#define WDT_OK_TO_CLOSE 1
static unsigned long wdt_tick_rate;
-static void wdt_enable(void)
+static void
+wdt_enable(void)
{
- spin_lock(&wdt_lock);
ixp2000_reg_write(IXP2000_RESET0, *(IXP2000_RESET0) | WDT_RESET_ENABLE);
ixp2000_reg_write(IXP2000_TWDE, WDT_ENABLE);
ixp2000_reg_write(IXP2000_T4_CLD, heartbeat * wdt_tick_rate);
ixp2000_reg_write(IXP2000_T4_CTL, TIMER_DIVIDER_256 | TIMER_ENABLE);
- spin_unlock(&wdt_lock);
}
-static void wdt_disable(void)
+static void
+wdt_disable(void)
{
- spin_lock(&wdt_lock);
ixp2000_reg_write(IXP2000_T4_CTL, 0);
- spin_unlock(&wdt_lock);
}
-static void wdt_keepalive(void)
+static void
+wdt_keepalive(void)
{
- spin_lock(&wdt_lock);
ixp2000_reg_write(IXP2000_T4_CLD, heartbeat * wdt_tick_rate);
- spin_unlock(&wdt_lock);
}
-static int ixp2000_wdt_open(struct inode *inode, struct file *file)
+static int
+ixp2000_wdt_open(struct inode *inode, struct file *file)
{
if (test_and_set_bit(WDT_IN_USE, &wdt_status))
return -EBUSY;
@@ -75,8 +72,8 @@ static int ixp2000_wdt_open(struct inode *inode, struct file *file)
return nonseekable_open(inode, file);
}
-static ssize_t ixp2000_wdt_write(struct file *file, const char *data,
- size_t len, loff_t *ppos)
+static ssize_t
+ixp2000_wdt_write(struct file *file, const char *data, size_t len, loff_t *ppos)
{
if (len) {
if (!nowayout) {
@@ -106,8 +103,9 @@ static struct watchdog_info ident = {
.identity = "IXP2000 Watchdog",
};
-static long ixp2000_wdt_ioctl(struct file *file, unsigned int cmd,
- unsigned long arg)
+static int
+ixp2000_wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
+ unsigned long arg)
{
int ret = -ENOTTY;
int time;
@@ -126,11 +124,6 @@ static long ixp2000_wdt_ioctl(struct file *file, unsigned int cmd,
ret = put_user(0, (int *)arg);
break;
- case WDIOC_KEEPALIVE:
- wdt_enable();
- ret = 0;
- break;
-
case WDIOC_SETTIMEOUT:
ret = get_user(time, (int *)arg);
if (ret)
@@ -148,18 +141,26 @@ static long ixp2000_wdt_ioctl(struct file *file, unsigned int cmd,
case WDIOC_GETTIMEOUT:
ret = put_user(heartbeat, (int *)arg);
break;
+
+ case WDIOC_KEEPALIVE:
+ wdt_enable();
+ ret = 0;
+ break;
}
return ret;
}
-static int ixp2000_wdt_release(struct inode *inode, struct file *file)
+static int
+ixp2000_wdt_release(struct inode *inode, struct file *file)
{
- if (test_bit(WDT_OK_TO_CLOSE, &wdt_status))
+ if (test_bit(WDT_OK_TO_CLOSE, &wdt_status)) {
wdt_disable();
- else
+ } else {
printk(KERN_CRIT "WATCHDOG: Device closed unexpectedly - "
"timer will not stop\n");
+ }
+
clear_bit(WDT_IN_USE, &wdt_status);
clear_bit(WDT_OK_TO_CLOSE, &wdt_status);
@@ -167,16 +168,18 @@ static int ixp2000_wdt_release(struct inode *inode, struct file *file)
}
-static const struct file_operations ixp2000_wdt_fops = {
+static const struct file_operations ixp2000_wdt_fops =
+{
.owner = THIS_MODULE,
.llseek = no_llseek,
.write = ixp2000_wdt_write,
- .unlocked_ioctl = ixp2000_wdt_ioctl,
+ .ioctl = ixp2000_wdt_ioctl,
.open = ixp2000_wdt_open,
.release = ixp2000_wdt_release,
};
-static struct miscdevice ixp2000_wdt_miscdev = {
+static struct miscdevice ixp2000_wdt_miscdev =
+{
.minor = WATCHDOG_MINOR,
.name = "watchdog",
.fops = &ixp2000_wdt_fops,
@@ -188,8 +191,9 @@ static int __init ixp2000_wdt_init(void)
printk(KERN_INFO "Unable to use IXP2000 watchdog due to IXP2800 erratum #25.\n");
return -EIO;
}
+
wdt_tick_rate = (*IXP2000_T1_CLD * HZ) / 256;
- spin_lock_init(&wdt_lock);
+
return misc_register(&ixp2000_wdt_miscdev);
}
diff --git a/trunk/drivers/watchdog/ixp4xx_wdt.c b/trunk/drivers/watchdog/ixp4xx_wdt.c
index ef3157dc9ac1..5864bb865cfe 100644
--- a/trunk/drivers/watchdog/ixp4xx_wdt.c
+++ b/trunk/drivers/watchdog/ixp4xx_wdt.c
@@ -22,48 +22,48 @@
#include
#include
#include
-#include
#include
+#include
static int nowayout = WATCHDOG_NOWAYOUT;
static int heartbeat = 60; /* (secs) Default is 1 minute */
static unsigned long wdt_status;
static unsigned long boot_status;
-static spin_lock_t wdt_lock;
#define WDT_TICK_RATE (IXP4XX_PERIPHERAL_BUS_CLOCK * 1000000UL)
#define WDT_IN_USE 0
#define WDT_OK_TO_CLOSE 1
-static void wdt_enable(void)
+static void
+wdt_enable(void)
{
- spin_lock(&wdt_lock);
*IXP4XX_OSWK = IXP4XX_WDT_KEY;
*IXP4XX_OSWE = 0;
*IXP4XX_OSWT = WDT_TICK_RATE * heartbeat;
*IXP4XX_OSWE = IXP4XX_WDT_COUNT_ENABLE | IXP4XX_WDT_RESET_ENABLE;
*IXP4XX_OSWK = 0;
- spin_unlock(&wdt_lock);
}
-static void wdt_disable(void)
+static void
+wdt_disable(void)
{
- spin_lock(&wdt_lock);
*IXP4XX_OSWK = IXP4XX_WDT_KEY;
*IXP4XX_OSWE = 0;
*IXP4XX_OSWK = 0;
- spin_unlock(&wdt_lock);
}
-static int ixp4xx_wdt_open(struct inode *inode, struct file *file)
+static int
+ixp4xx_wdt_open(struct inode *inode, struct file *file)
{
if (test_and_set_bit(WDT_IN_USE, &wdt_status))
return -EBUSY;
clear_bit(WDT_OK_TO_CLOSE, &wdt_status);
+
wdt_enable();
+
return nonseekable_open(inode, file);
}
@@ -87,6 +87,7 @@ ixp4xx_wdt_write(struct file *file, const char *data, size_t len, loff_t *ppos)
}
wdt_enable();
}
+
return len;
}
@@ -97,8 +98,9 @@ static struct watchdog_info ident = {
};
-static long ixp4xx_wdt_ioctl(struct file *file, unsigned int cmd,
- unsigned long arg)
+static int
+ixp4xx_wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
+ unsigned long arg)
{
int ret = -ENOTTY;
int time;
@@ -117,11 +119,6 @@ static long ixp4xx_wdt_ioctl(struct file *file, unsigned int cmd,
ret = put_user(boot_status, (int *)arg);
break;
- case WDIOC_KEEPALIVE:
- wdt_enable();
- ret = 0;
- break;
-
case WDIOC_SETTIMEOUT:
ret = get_user(time, (int *)arg);
if (ret)
@@ -139,17 +136,25 @@ static long ixp4xx_wdt_ioctl(struct file *file, unsigned int cmd,
case WDIOC_GETTIMEOUT:
ret = put_user(heartbeat, (int *)arg);
break;
+
+ case WDIOC_KEEPALIVE:
+ wdt_enable();
+ ret = 0;
+ break;
}
return ret;
}
-static int ixp4xx_wdt_release(struct inode *inode, struct file *file)
+static int
+ixp4xx_wdt_release(struct inode *inode, struct file *file)
{
- if (test_bit(WDT_OK_TO_CLOSE, &wdt_status))
+ if (test_bit(WDT_OK_TO_CLOSE, &wdt_status)) {
wdt_disable();
- else
+ } else {
printk(KERN_CRIT "WATCHDOG: Device closed unexpectedly - "
"timer will not stop\n");
+ }
+
clear_bit(WDT_IN_USE, &wdt_status);
clear_bit(WDT_OK_TO_CLOSE, &wdt_status);
@@ -157,16 +162,18 @@ static int ixp4xx_wdt_release(struct inode *inode, struct file *file)
}
-static const struct file_operations ixp4xx_wdt_fops = {
+static const struct file_operations ixp4xx_wdt_fops =
+{
.owner = THIS_MODULE,
.llseek = no_llseek,
.write = ixp4xx_wdt_write,
- .unlocked_ioctl = ixp4xx_wdt_ioctl,
+ .ioctl = ixp4xx_wdt_ioctl,
.open = ixp4xx_wdt_open,
.release = ixp4xx_wdt_release,
};
-static struct miscdevice ixp4xx_wdt_miscdev = {
+static struct miscdevice ixp4xx_wdt_miscdev =
+{
.minor = WATCHDOG_MINOR,
.name = "watchdog",
.fops = &ixp4xx_wdt_fops,
@@ -179,18 +186,19 @@ static int __init ixp4xx_wdt_init(void)
asm("mrc p15, 0, %0, cr0, cr0, 0;" : "=r"(processor_id) :);
if (!(processor_id & 0xf) && !cpu_is_ixp46x()) {
- printk(KERN_ERR "IXP4XXX Watchdog: Rev. A0 IXP42x CPU detected"
- " - watchdog disabled\n");
+ printk("IXP4XXX Watchdog: Rev. A0 IXP42x CPU detected - "
+ "watchdog disabled\n");
return -ENODEV;
}
- spin_lock_init(&wdt_lock);
- boot_status = (*IXP4XX_OSST & IXP4XX_OSST_TIMER_WARM_RESET) ?
- WDIOF_CARDRESET : 0;
+
ret = misc_register(&ixp4xx_wdt_miscdev);
if (ret == 0)
- printk(KERN_INFO "IXP4xx Watchdog Timer: heartbeat %d sec\n",
- heartbeat);
+ printk("IXP4xx Watchdog Timer: heartbeat %d sec\n", heartbeat);
+
+ boot_status = (*IXP4XX_OSST & IXP4XX_OSST_TIMER_WARM_RESET) ?
+ WDIOF_CARDRESET : 0;
+
return ret;
}
diff --git a/trunk/drivers/watchdog/ks8695_wdt.c b/trunk/drivers/watchdog/ks8695_wdt.c
index f8566d5c62fe..df5a6b811ccd 100644
--- a/trunk/drivers/watchdog/ks8695_wdt.c
+++ b/trunk/drivers/watchdog/ks8695_wdt.c
@@ -19,8 +19,8 @@
#include
#include
#include
-#include
-#include
+#include
+#include
#include
@@ -31,44 +31,38 @@ static int wdt_time = WDT_DEFAULT_TIME;
static int nowayout = WATCHDOG_NOWAYOUT;
module_param(wdt_time, int, 0);
-MODULE_PARM_DESC(wdt_time, "Watchdog time in seconds. (default="
- __MODULE_STRING(WDT_DEFAULT_TIME) ")");
+MODULE_PARM_DESC(wdt_time, "Watchdog time in seconds. (default="__MODULE_STRING(WDT_DEFAULT_TIME) ")");
#ifdef CONFIG_WATCHDOG_NOWAYOUT
module_param(nowayout, int, 0);
-MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
- __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
#endif
static unsigned long ks8695wdt_busy;
-static spinlock_t ks8695_lock;
/* ......................................................................... */
/*
* Disable the watchdog.
*/
-static inline void ks8695_wdt_stop(void)
+static void inline ks8695_wdt_stop(void)
{
unsigned long tmcon;
- spin_lock(&ks8695_lock);
/* disable timer0 */
tmcon = __raw_readl(KS8695_TMR_VA + KS8695_TMCON);
__raw_writel(tmcon & ~TMCON_T0EN, KS8695_TMR_VA + KS8695_TMCON);
- spin_unlock(&ks8695_lock);
}
/*
* Enable and reset the watchdog.
*/
-static inline void ks8695_wdt_start(void)
+static void inline ks8695_wdt_start(void)
{
unsigned long tmcon;
unsigned long tval = wdt_time * CLOCK_TICK_RATE;
- spin_lock(&ks8695_lock);
/* disable timer0 */
tmcon = __raw_readl(KS8695_TMR_VA + KS8695_TMCON);
__raw_writel(tmcon & ~TMCON_T0EN, KS8695_TMR_VA + KS8695_TMCON);
@@ -79,22 +73,19 @@ static inline void ks8695_wdt_start(void)
/* re-enable timer0 */
tmcon = __raw_readl(KS8695_TMR_VA + KS8695_TMCON);
__raw_writel(tmcon | TMCON_T0EN, KS8695_TMR_VA + KS8695_TMCON);
- spin_unlock(&ks8695_lock);
}
/*
* Reload the watchdog timer. (ie, pat the watchdog)
*/
-static inline void ks8695_wdt_reload(void)
+static void inline ks8695_wdt_reload(void)
{
unsigned long tmcon;
- spin_lock(&ks8695_lock);
/* disable, then re-enable timer0 */
tmcon = __raw_readl(KS8695_TMR_VA + KS8695_TMCON);
__raw_writel(tmcon & ~TMCON_T0EN, KS8695_TMR_VA + KS8695_TMCON);
__raw_writel(tmcon | TMCON_T0EN, KS8695_TMR_VA + KS8695_TMCON);
- spin_unlock(&ks8695_lock);
}
/*
@@ -111,8 +102,7 @@ static int ks8695_wdt_settimeout(int new_time)
if ((new_time <= 0) || (new_time > WDT_MAX_TIME))
return -EINVAL;
- /* Set new watchdog time. It will be used when
- ks8695_wdt_start() is called. */
+ /* Set new watchdog time. It will be used when ks8695_wdt_start() is called. */
wdt_time = new_time;
return 0;
}
@@ -138,9 +128,9 @@ static int ks8695_wdt_open(struct inode *inode, struct file *file)
*/
static int ks8695_wdt_close(struct inode *inode, struct file *file)
{
- /* Disable the watchdog when file is closed */
if (!nowayout)
- ks8695_wdt_stop();
+ ks8695_wdt_stop(); /* Disable the watchdog when file is closed */
+
clear_bit(0, &ks8695wdt_busy);
return 0;
}
@@ -153,52 +143,60 @@ static struct watchdog_info ks8695_wdt_info = {
/*
* Handle commands from user-space.
*/
-static long ks8695_wdt_ioctl(struct file *file, unsigned int cmd,
- unsigned long arg)
+static int ks8695_wdt_ioctl(struct inode *inode, struct file *file,
+ unsigned int cmd, unsigned long arg)
{
void __user *argp = (void __user *)arg;
int __user *p = argp;
int new_value;
- switch (cmd) {
- case WDIOC_GETSUPPORT:
- return copy_to_user(argp, &ks8695_wdt_info,
- sizeof(ks8695_wdt_info)) ? -EFAULT : 0;
- case WDIOC_GETSTATUS:
- case WDIOC_GETBOOTSTATUS:
- return put_user(0, p);
- case WDIOC_SETOPTIONS:
- if (get_user(new_value, p))
- return -EFAULT;
- if (new_value & WDIOS_DISABLECARD)
- ks8695_wdt_stop();
- if (new_value & WDIOS_ENABLECARD)
+ switch(cmd) {
+ case WDIOC_KEEPALIVE:
+ ks8695_wdt_reload(); /* pat the watchdog */
+ return 0;
+
+ case WDIOC_GETSUPPORT:
+ return copy_to_user(argp, &ks8695_wdt_info, sizeof(ks8695_wdt_info)) ? -EFAULT : 0;
+
+ case WDIOC_SETTIMEOUT:
+ if (get_user(new_value, p))
+ return -EFAULT;
+
+ if (ks8695_wdt_settimeout(new_value))
+ return -EINVAL;
+
+ /* Enable new time value */
ks8695_wdt_start();
- return 0;
- case WDIOC_KEEPALIVE:
- ks8695_wdt_reload(); /* pat the watchdog */
- return 0;
- case WDIOC_SETTIMEOUT:
- if (get_user(new_value, p))
- return -EFAULT;
- if (ks8695_wdt_settimeout(new_value))
- return -EINVAL;
- /* Enable new time value */
- ks8695_wdt_start();
- /* Return current value */
- return put_user(wdt_time, p);
- case WDIOC_GETTIMEOUT:
- return put_user(wdt_time, p);
- default:
- return -ENOTTY;
+
+ /* Return current value */
+ return put_user(wdt_time, p);
+
+ case WDIOC_GETTIMEOUT:
+ return put_user(wdt_time, p);
+
+ case WDIOC_GETSTATUS:
+ case WDIOC_GETBOOTSTATUS:
+ return put_user(0, p);
+
+ case WDIOC_SETOPTIONS:
+ if (get_user(new_value, p))
+ return -EFAULT;
+
+ if (new_value & WDIOS_DISABLECARD)
+ ks8695_wdt_stop();
+ if (new_value & WDIOS_ENABLECARD)
+ ks8695_wdt_start();
+ return 0;
+
+ default:
+ return -ENOTTY;
}
}
/*
* Pat the watchdog whenever device is written to.
*/
-static ssize_t ks8695_wdt_write(struct file *file, const char *data,
- size_t len, loff_t *ppos)
+static ssize_t ks8695_wdt_write(struct file *file, const char *data, size_t len, loff_t *ppos)
{
ks8695_wdt_reload(); /* pat the watchdog */
return len;
@@ -209,7 +207,7 @@ static ssize_t ks8695_wdt_write(struct file *file, const char *data,
static const struct file_operations ks8695wdt_fops = {
.owner = THIS_MODULE,
.llseek = no_llseek,
- .unlocked_ioctl = ks8695_wdt_ioctl,
+ .ioctl = ks8695_wdt_ioctl,
.open = ks8695_wdt_open,
.release = ks8695_wdt_close,
.write = ks8695_wdt_write,
@@ -233,8 +231,7 @@ static int __init ks8695wdt_probe(struct platform_device *pdev)
if (res)
return res;
- printk(KERN_INFO "KS8695 Watchdog Timer enabled (%d seconds%s)\n",
- wdt_time, nowayout ? ", nowayout" : "");
+ printk("KS8695 Watchdog Timer enabled (%d seconds%s)\n", wdt_time, nowayout ? ", nowayout" : "");
return 0;
}
@@ -288,14 +285,12 @@ static struct platform_driver ks8695wdt_driver = {
static int __init ks8695_wdt_init(void)
{
- spin_lock_init(&ks8695_lock);
- /* Check that the heartbeat value is within range;
- if not reset to the default */
+ /* Check that the heartbeat value is within range; if not reset to the default */
if (ks8695_wdt_settimeout(wdt_time)) {
ks8695_wdt_settimeout(WDT_DEFAULT_TIME);
- pr_info("ks8695_wdt: wdt_time value must be 1 <= wdt_time <= %i, using %d\n",
- wdt_time, WDT_MAX_TIME);
+ pr_info("ks8695_wdt: wdt_time value must be 1 <= wdt_time <= %i, using %d\n", wdt_time, WDT_MAX_TIME);
}
+
return platform_driver_register(&ks8695wdt_driver);
}
diff --git a/trunk/drivers/watchdog/machzwd.c b/trunk/drivers/watchdog/machzwd.c
index 2dfc27559bf7..6905135a776c 100644
--- a/trunk/drivers/watchdog/machzwd.c
+++ b/trunk/drivers/watchdog/machzwd.c
@@ -40,9 +40,9 @@
#include
#include
#include
-#include
-#include
+#include
+#include
#include
/* ports */
@@ -95,9 +95,7 @@ MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
static int nowayout = WATCHDOG_NOWAYOUT;
module_param(nowayout, int, 0);
-MODULE_PARM_DESC(nowayout,
- "Watchdog cannot be stopped once started (default="
- __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
#define PFX "machzwd"
@@ -116,7 +114,7 @@ static struct watchdog_info zf_info = {
* 3 = GEN_SCI
* defaults to GEN_RESET (0)
*/
-static int action;
+static int action = 0;
module_param(action, int, 0);
MODULE_PARM_DESC(action, "after watchdog resets, generate: 0 = RESET(*) 1 = SMI 2 = NMI 3 = SCI");
@@ -125,9 +123,10 @@ static void zf_ping(unsigned long data);
static int zf_action = GEN_RESET;
static unsigned long zf_is_open;
static char zf_expect_close;
+static DEFINE_SPINLOCK(zf_lock);
static DEFINE_SPINLOCK(zf_port_lock);
static DEFINE_TIMER(zf_timer, zf_ping, 0, 0);
-static unsigned long next_heartbeat;
+static unsigned long next_heartbeat = 0;
/* timeout for user land heart beat (10 seconds) */
@@ -172,13 +171,13 @@ static inline void zf_set_control(unsigned short new)
static inline void zf_set_timer(unsigned short new, unsigned char n)
{
- switch (n) {
- case WD1:
- zf_writew(COUNTER_1, new);
- case WD2:
- zf_writeb(COUNTER_2, new > 0xff ? 0xff : new);
- default:
- return;
+ switch(n){
+ case WD1:
+ zf_writew(COUNTER_1, new);
+ case WD2:
+ zf_writeb(COUNTER_2, new > 0xff ? 0xff : new);
+ default:
+ return;
}
}
@@ -242,8 +241,10 @@ static void zf_ping(unsigned long data)
zf_writeb(COUNTER_2, 0xff);
- if (time_before(jiffies, next_heartbeat)) {
+ if(time_before(jiffies, next_heartbeat)){
+
dprintk("time_before: %ld\n", next_heartbeat - jiffies);
+
/*
* reset event is activated by transition from 0 to 1 on
* RESET_WD1 bit and we assume that it is already zero...
@@ -260,21 +261,24 @@ static void zf_ping(unsigned long data)
spin_unlock_irqrestore(&zf_port_lock, flags);
mod_timer(&zf_timer, jiffies + ZF_HW_TIMEO);
- } else
+ }else{
printk(KERN_CRIT PFX ": I will reset your machine\n");
+ }
}
static ssize_t zf_write(struct file *file, const char __user *buf, size_t count,
loff_t *ppos)
{
/* See if we got the magic character */
- if (count) {
+ if(count){
+
/*
* no need to check for close confirmation
* no way to disable watchdog ;)
*/
if (!nowayout) {
size_t ofs;
+
/*
* note: just in case someone wrote the magic character
* five months ago...
@@ -282,11 +286,11 @@ static ssize_t zf_write(struct file *file, const char __user *buf, size_t count,
zf_expect_close = 0;
/* now scan */
- for (ofs = 0; ofs != count; ofs++) {
+ for (ofs = 0; ofs != count; ofs++){
char c;
if (get_user(c, buf + ofs))
return -EFAULT;
- if (c == 'V') {
+ if (c == 'V'){
zf_expect_close = 42;
dprintk("zf_expect_close = 42\n");
}
@@ -299,11 +303,14 @@ static ssize_t zf_write(struct file *file, const char __user *buf, size_t count,
*/
next_heartbeat = jiffies + ZF_USER_TIMEO;
dprintk("user ping at %ld\n", jiffies);
+
}
+
return count;
}
-static long zf_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
+static int zf_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
+ unsigned long arg)
{
void __user *argp = (void __user *)arg;
int __user *p = argp;
@@ -312,38 +319,55 @@ static long zf_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
if (copy_to_user(argp, &zf_info, sizeof(zf_info)))
return -EFAULT;
break;
+
case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS:
return put_user(0, p);
+
case WDIOC_KEEPALIVE:
zf_ping(0);
break;
+
default:
return -ENOTTY;
}
+
return 0;
}
static int zf_open(struct inode *inode, struct file *file)
{
- if (test_and_set_bit(0, &zf_is_open))
+ spin_lock(&zf_lock);
+ if(test_and_set_bit(0, &zf_is_open)) {
+ spin_unlock(&zf_lock);
return -EBUSY;
+ }
+
if (nowayout)
__module_get(THIS_MODULE);
+
+ spin_unlock(&zf_lock);
+
zf_timer_on();
+
return nonseekable_open(inode, file);
}
static int zf_close(struct inode *inode, struct file *file)
{
- if (zf_expect_close == 42)
+ if(zf_expect_close == 42){
zf_timer_off();
- else {
+ } else {
del_timer(&zf_timer);
printk(KERN_ERR PFX ": device file closed unexpectedly. Will not stop the WDT!\n");
}
+
+ spin_lock(&zf_lock);
clear_bit(0, &zf_is_open);
+ spin_unlock(&zf_lock);
+
zf_expect_close = 0;
+
return 0;
}
@@ -354,18 +378,23 @@ static int zf_close(struct inode *inode, struct file *file)
static int zf_notify_sys(struct notifier_block *this, unsigned long code,
void *unused)
{
- if (code == SYS_DOWN || code == SYS_HALT)
+ if(code == SYS_DOWN || code == SYS_HALT){
zf_timer_off();
+ }
+
return NOTIFY_DONE;
}
+
+
+
static const struct file_operations zf_fops = {
- .owner = THIS_MODULE,
- .llseek = no_llseek,
- .write = zf_write,
- .unlocked_ioctl = zf_ioctl,
- .open = zf_open,
- .release = zf_close,
+ .owner = THIS_MODULE,
+ .llseek = no_llseek,
+ .write = zf_write,
+ .ioctl = zf_ioctl,
+ .open = zf_open,
+ .release = zf_close,
};
static struct miscdevice zf_miscdev = {
@@ -373,7 +402,7 @@ static struct miscdevice zf_miscdev = {
.name = "watchdog",
.fops = &zf_fops,
};
-
+
/*
* The device needs to learn about soft shutdowns in order to
@@ -394,23 +423,22 @@ static int __init zf_init(void)
{
int ret;
- printk(KERN_INFO PFX
- ": MachZ ZF-Logic Watchdog driver initializing.\n");
+ printk(KERN_INFO PFX ": MachZ ZF-Logic Watchdog driver initializing.\n");
ret = zf_get_ZFL_version();
- if (!ret || ret == 0xffff) {
+ if ((!ret) || (ret == 0xffff)) {
printk(KERN_WARNING PFX ": no ZF-Logic found\n");
return -ENODEV;
}
- if (action <= 3 && action >= 0)
- zf_action = zf_action >> action;
- else
+ if((action <= 3) && (action >= 0)){
+ zf_action = zf_action>>action;
+ } else
action = 0;
zf_show_action(action);
- if (!request_region(ZF_IOBASE, 3, "MachZ ZFL WDT")) {
+ if(!request_region(ZF_IOBASE, 3, "MachZ ZFL WDT")){
printk(KERN_ERR "cannot reserve I/O ports at %d\n",
ZF_IOBASE);
ret = -EBUSY;
@@ -418,14 +446,14 @@ static int __init zf_init(void)
}
ret = register_reboot_notifier(&zf_notifier);
- if (ret) {
+ if(ret){
printk(KERN_ERR "can't register reboot notifier (err=%d)\n",
ret);
goto no_reboot;
}
ret = misc_register(&zf_miscdev);
- if (ret) {
+ if (ret){
printk(KERN_ERR "can't misc_register on minor=%d\n",
WATCHDOG_MINOR);
goto no_misc;
diff --git a/trunk/drivers/watchdog/mixcomwd.c b/trunk/drivers/watchdog/mixcomwd.c
index 407b025cb104..1adf1d56027d 100644
--- a/trunk/drivers/watchdog/mixcomwd.c
+++ b/trunk/drivers/watchdog/mixcomwd.c
@@ -29,8 +29,7 @@
* - support for one more type board
*
* Version 0.5 (2001/12/14) Matt Domsch
- * - added nowayout module option to override
- * CONFIG_WATCHDOG_NOWAYOUT
+ * - added nowayout module option to override CONFIG_WATCHDOG_NOWAYOUT
*
* Version 0.6 (2002/04/12): Rob Radez
* - make mixcomwd_opened unsigned,
@@ -54,8 +53,8 @@
#include
#include
#include
-#include
-#include