On the device we're currently developing, battery sizes of ~2.8Ah and
current flow of ~600mA are typical.
With that values, the life_sec computation overflows due to the
multiplication by 3600.
Signed-off-by: Daniel Mack <daniel@caiaq.de>
Cc: Szabolcs Gyurko <szabolcs.gyurko@tlt.hu>
Cc: Matt Reimer <mreimer@vpop.net>
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
This patch converts the wm97xx-battery driver to use platform_data
supplied by ac97 bus.
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
The ds2760's internal current meter is not reliable enough as it has an
inacurracy of around ~15%. Without any correction for that error, the
current accumulator is couting up all the time, even though the battery
is already fully charged and hence destroys the static information. The
longer it is connected, the worse is the aberration.
Fortunately, this can be corrected by the DS2760_CURRENT_OFFSET_BIAS
register. Using the external power_supply_set_battery_charged()
function, this register is now gauging the measurement.
A delayed work is used to debounce flaky GPIO signals and to let the
current value settle. Also see Maxim's application note AN4188.
Signed-off-by: Daniel Mack <daniel@caiaq.de>
Cc: Szabolcs Gyurko <szabolcs.gyurko@tlt.hu>
Cc: Matt Reimer <mreimer@vpop.net>
Cc: Anton Vorontsov <cbou@mail.ru>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
This adds a function that indicates that a battery is fully charged.
It also includes functions to get a power_supply device from the class
of registered devices by name reference. These can be used to find a
specific battery to call power_supply_set_battery_charged() on.
Some battery drivers might need this information to calibrate
themselves.
Signed-off-by: Daniel Mack <daniel@caiaq.de>
Cc: Ian Molton <spyro@f2s.com>
Cc: Anton Vorontsov <cbou@mail.ru>
Cc: Matt Reimer <mreimer@vpop.net>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
While I'm at it, cleanup the power supply code so that EXPORT_SYMBOL_GPL
appears directly after the symbole declaration. checkpatch.pl wants it
that way.
Signed-off-by: Daniel Mack <daniel@caiaq.de>
Cc: Ian Molton <spyro@f2s.com>
Cc: Matt Reimer <mreimer@vpop.net>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
When connecting a ds2760 to a partly loaded battery the first time,
there must be a way to bootstrap the current_accum value. Without that,
the current capactity value is bogus until the battery is fully charged
for the first time.
Signed-off-by: Daniel Mack <daniel@caiaq.de>
Cc: Szabolcs Gyurko <szabolcs.gyurko@tlt.hu>
Cc: Matt Reimer <mreimer@vpop.net>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
In systems where the battery monitor is not part of the battery pack and
is hence not bootstrapped with sane values, the full_active_uAh is
likely to be zero.
Handle that case by defaulting to the rated_capacity information which
can be passed to the driver using the new module parameter.
Signed-off-by: Daniel Mack <daniel@caiaq.de>
Cc: Szabolcs Gyurko <szabolcs.gyurko@tlt.hu>
Acked-by: Matt Reimer <mreimer@vpop.net>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
For systems where the ds2760 is soldered directly on the PCB, the 'rated
capacity' register is not set to anything useful.
In order to allow users to bootstrap this value, introduce a new module
parameter 'rated_capacity' and use it to write the internal EEPROM in
case the value differes from what's been given.
Signed-off-by: Daniel Mack <daniel@caiaq.de>
Cc: Szabolcs Gyurko <szabolcs.gyurko@tlt.hu>
Acked-by: Matt Reimer <mreimer@vpop.net>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
Export POWER_SUPPLY_PROP_TIME_TO_EMPTY_NOW and POWER_SUPPLY_PROP_CAPACITY
features to the power supply core.
Signed-off-by: Daniel Mack <daniel@caiaq.de>
Cc: Szabolcs Gyurko <szabolcs.gyurko@tlt.hu>
Acked-by: Matt Reimer <mreimer@vpop.net>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
This fixes a race condition I recently introduced with the PMOD feature
addition (cef437e3: "w1: ds2760_battery: add support for sleep mode
feature").
Postpone the call to power_supply_register() to fix it.
Signed-off-by: Daniel Mack <daniel@caiaq.de>
Cc: Szabolcs Gyurko <szabolcs.gyurko@tlt.hu>
Acked-by: Matt Reimer <mreimer@vpop.net>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
This adds a new sysfs file called 'charge_type' which displays the
type of charging (unknown, n/a, trickle charge, or fast charging).
This allows things like battery diagnostics to determine what the
battery/EC is doing without resorting to changing the 'status' sysfs
output.
Signed-off-by: Andres Salomon <dilinger@collabora.co.uk>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
Grab the error code from EC_BAT_ERRCODE and let the user see it (rather
than attempting to decode it as we do with PROP_HEALTH) with a separate
error sysfs file.
Signed-off-by: Andres Salomon <dilinger@collabora.co.uk>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
This reverts commit 8efe444038 and
4cbc76eadf.
Richard@laptop.org was apparently using CAPACITY_LEVEL for debugging
battery/EC problems, and was upset that it was removed. This readds it.
Conflicts:
Documentation/power_supply_class.txt
Signed-off-by: Andres Salomon <dilinger@collabora.co.uk>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
This patch adds a driver for ds2782 battery devices.
Signed-off-by: Ryan Mallon <ryan@bluewatersys.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
There are times when the battery is present but trickle charging,
and the EC sets only the TRICKLE bit. So we must check for the bit
when we're checking the charging/present status.
Signed-off-by: Andres Salomon <dilinger@collabora.co.uk>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
The eeprom read function was placing values into the wrong place in
'buf'; we were starting from buf[off], rather than buf[0].
Also, the for loop that we were using was much uglier than it needed to
be. This cleans it up a bit.
Signed-off-by: Andres Salomon <dilinger@collabora.co.uk>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide-2.6:
ide: memory overrun in ide_get_identity_ioctl() on big endian machines using ioctl HDIO_OBSOLETE_IDENTITY
ide: fix resume for CONFIG_BLK_DEV_IDEACPI=y
ide-cd: handle fragmented packet commands gracefully
ide: always kill the whole request on error
ide: fix ide_kill_rq() for special ide-{floppy,tape} driver requests
This patch fixes a memory overrun in function ide_get_identity_ioctl() which
chooses the size of a memory buffer depending on the ioctl command that led
to the function call, however, passes that buffer to a function which needs the
buffer size to be always chosen unconditionally.
Due to conditional compilation the memory overrun can only happen on big endian
machines. The error can be triggered using ioctl HDIO_OBSOLETE_IDENTITY. Usage
of ioctl HDIO_GET_IDENTITY is safe.
Signed-off-by: Christian Engelmayer <christian.engelmayer@frequentis.com>
Acked-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
commit 2f0d0fd2a6 ("ide-acpi: cleanup
do_drive_get_GTF()") didn't account for the lack of hwif->acpidata
check in generic_ide_suspend() [ indirect user of do_drive_get_GTF()
through ide_acpi_exec_tfs() ] resulting in broken resume when ACPI
support is enabled but ACPI data is unavailable.
Fix it by adding ide_port_acpi() helper for checking if port needs
ACPI handling and cleaning generic_ide_{suspend,resume}() to use it
instead of hiding hwif->acpidata and ide_noacpi checks in IDE ACPI
helpers (this should help in preventing similar bugs in the future).
While at it:
- kill superfluous debugging printks in ide_acpi_{get,push}_timing()
Reported-and-tested-by: Etienne Basset <etienne.basset@numericable.fr>
Also-reported-and-tested-by: Jeff Chua <jeff.chua.linux@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6:
sound: OSS: mpu401, fix deadlock
ALSA: hda - Add missing initializations for ALC268 and ALC269
ALSA: cmi8330: fix MPU-401 PnP init copy&paste bug
ALSA: hda - Line In for Acer Inspire 6530G model
sound: oxygen: make mic volume control mono
MAINTAINERS: Add entry for twl4030 series soc codec driver
ALSA: lx6464es - configure ethersound io channels
sound: Use PCI_VDEVICE for CREATIVE and ECTIVA
sound: Use PCI_VDEVICE
ALSA: hda - Use model=acer-aspire-6530g for Acer Aspire 6930G
ALSA: hda - Fix acer-aspire-6530g model quirk
ALSA: hda - Add pin-sense trigger when needed for Realtek codecs
ALSA: hda - Fix support for Samsung P50 with AD1986A codec
ALSA: hda - Generalize the pin-detect quirk for Lenovo N100
ALSA: hda - Simplify AD1986A mixer definitions
* 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
Revert "x86: cap iomem_resource to addressable physical memory"
FYI, there's a post-rc1 build regression with certain configs:
drivers/built-in.o: In function `pci_hp_deregister':
(.text+0xb166): undefined reference to `pci_hp_remove_module_link'
drivers/built-in.o: In function `pci_hp_deregister':
(.text+0xb19f): undefined reference to `pci_destroy_slot'
drivers/built-in.o: In function `__pci_hp_register':
(.text+0xb583): undefined reference to `pci_create_slot'
drivers/built-in.o: In function `__pci_hp_register':
(.text+0xb5b1): undefined reference to `pci_hp_create_module_link'
make: *** [.tmp_vmlinux1] Error 1
Caused by:
| 2b121bc262 is first bad commit
| commit 2b121bc262
| Date: Thu Jun 25 13:25:36 2009 +0200
|
| eeepc-laptop: Register as a pci-hotplug device
which changed the driver to use the PCI hotplug infrastructure, but
didn't do a good job on the Kconfig rules.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Acked-by: Randy Dunlap <randy.dunlap@oracle.com>
Acked-by: Len Brown <len.brown@intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Currently we reinit the ldisc on final tty close which is what the old code
did to ensure that if the device retained its termios settings then it had the
right ldisc. tty_ldisc_reinit does that but also leaves us with the reset
ldisc reference which is then leaked.
At this point we know the port will be recycled so we can kill the ldisc
off completely rather than try and add another ldisc free up when the kref
count hits zero.
At this point it is safe to keep the ldisc closed as tty_ldisc waiting
methods are only used from the user side, and as the final close we are
the last such reference. Interrupt/driver side methods will always use the
non wait version and get back a NULL.
Found with kmemleak and investigated/identified by Catalin Marinas.
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mpu401_chk_version is called with a spin lock already held. Don't take it
again.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
* fix/hda:
ALSA: hda - Add missing initializations for ALC268 and ALC269
ALSA: hda - Line In for Acer Inspire 6530G model
ALSA: hda - Use model=acer-aspire-6530g for Acer Aspire 6930G
ALSA: hda - Fix acer-aspire-6530g model quirk
ALSA: hda - Add pin-sense trigger when needed for Realtek codecs
The new fsnotify infrastructure (starting at 90586523) causes an oops in
spufs, where we populate a directory with files before instantiating the
directory itself. The new changes seem to have introduced an assumption
that a dentry's parent will be positive when instantiating.
This change makes it once again possible to d_instantiate a dentry
with a negative parent, and brings __fsnotify_d_instantiate() into
line with inotify_d_instantiate(), which already has this NULL check.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Eric Paris <eparis@redhat.com>
This adds input keyboard gpio support on at91sam9g20ek board.
It adds button 3 and 4.
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Andrew Victor <linux@maxim.org.za>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
During the changes to clean up / fix the realtek codec initialization
routines in commit 4a79ba34ca,
I forgot to add the check for ALC268 and ALC269.
This resulted in the missing EAPD and COEF setup for these codecs.
This patch adds the missing checks for these codecs.
Reference: bko#13633
http://bugzilla.kernel.org/show_bug.cgi?id=13633
Signed-off-by: Takashi Iwai <tiwai@suse.de>
The Line In connector is set up as PIN_IN by default, using
VREF_HIZ. It is connected to both ADCs, so add it to both
input selectors.
Also add the ability to use the input mix (on a SoundBlaster
one would call this "What You Hear").
Signed-off-by: Tony Vroon <tony@linx.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6:
be2net: Fix to avoid a crash seen on PPC with LRO and Jumbo frames.
gro: Flush GRO packets in napi_disable_pending path
inet: Call skb_orphan before tproxy activates
mac80211: Use rcu_barrier() on unload.
sunrpc: Use rcu_barrier() on unload.
bridge: Use rcu_barrier() instead of syncronize_net() on unload.
ipv6: Use rcu_barrier() on module unload.
decnet: Use rcu_barrier() on module unload.
sky2: Fix checksum endianness
mdio add missing GPL flag
sh_eth: remove redundant test on unsigned
fsl_pq_mdio: Fix fsl_pq_mdio to work with modules
ipv6: avoid wraparound for expired preferred lifetime
tcp: missing check ACK flag of received segment in FIN-WAIT-2 state
atl1*: add device_set_wakeup_enable to atl1*_set_wol
Phonet: generate Netlink RTM_DELADDR when destroying a device
Phonet: publicize the Netlink notification function
Revert "veth: prevent oops caused by netdev destructor"
cpmac: fix compilation failure introduced with netdev_ops conversion
ipsec: Fix name of CAST algorithm
While testing the driver on PPC, we ran into a crash with LRO, Jumbo frames.
With CONFIG_PPC_64K_PAGES configured (a default in PPC), MAX_SKB_FRAGS drops to 3 and we were crossing the array limits on skb_shinfo(skb)->frags[].
Now we coalesce the frags from the same physical page into one slot in
skb_shinfo(skb)->frags[] and go to the next index when the frag is from
different physical page.
This patch is against the net-2.6 tree.
Signed-off-by: Ajit Khaparde <ajitk@serverengines.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This patch fixes an imbalance message as reported by J.R. Okajima.
The IMA file counters are incremented in ima_path_check. If the
actual open fails, such as ETXTBSY, decrement the counters to
prevent unnecessary imbalance messages.
Reported-by: J.R. Okajima <hooanon05@yahoo.co.jp>
Signed-off-by: Mimi Zohar <zohar@us.ibm.com>
Signed-off-by: James Morris <jmorris@namei.org>
This patch fixes an imbalance message as reported by Sanchin Sant.
As we don't need to measure the message queue, just increment the
counters.
Reported-by: Sanchin Sant <sanchinp@in.ibm.com>
Signed-off-by: Mimi Zohar <zohar@us.ibm.com>
Acked-by: Serge Hallyn <serue@us.ibm.com>
Signed-off-by: James Morris <jmorris@namei.org>
* 'kvm-updates/2.6.31' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
KVM: shut up uninit compiler warning in paging_tmpl.h
KVM: Ignore reads to K7 EVNTSEL MSRs
KVM: VMX: Handle vmx instruction vmexits
KVM: s390: Allow stfle instruction in the guest
KVM: kvm/x86_emulate.c toggle_interruptibility() should be static
KVM: ia64: fix ia64 build due to missing kallsyms_lookup() and double export
KVM: protect concurrent make_all_cpus_request
KVM: MMU: Allow 4K ptes with bit 7 (PAT) set
KVM: Fix dirty bit tracking for slots with large pages