Commit graph

378 commits

Author SHA1 Message Date
Linus Torvalds 250f6715a4 The following text was taken from the original review request:
"[RFC PATCH 0/2] audit of linux/device.h users in include/*"
 		https://lkml.org/lkml/2012/3/4/159
 --
 
 Nearly every subsystem has some kind of header with a proto like:
 
 	void foo(struct device *dev);
 
 and yet there is no reason for most of these guys to care about the
 sub fields within the device struct.  This allows us to significantly
 reduce the scope of headers including headers.  For this instance, a
 reduction of about 40% is achieved by replacing the include with the
 simple fact that the device is some kind of a struct.
 
 Unlike the much larger module.h cleanup, this one is simply two
 commits.  One to fix the implicit <linux/device.h> users, and then
 one to delete the device.h includes from the linux/include/ dir
 wherever possible.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (GNU/Linux)
 
 iQIcBAABAgAGBQJPbNxLAAoJEOvOhAQsB9HWR6QQAMRUZ94O2069/nW9h4TO/xTr
 Hq/80lo/TBBiRmob3iWBP76lzgeeMPPVEX1I6N7YYlhL3IL7HsaJH1DvpIPPHXQP
 GFKcBsZ5ZLV8c4CBDSr+/HFNdhXc0bw0awBjBvR7gAsWuZpNFn4WbhizJi4vWAoE
 4ydhPu55G1G8TkBtYLJQ8xavxsmiNBSDhd2i+0vn6EVpgmXynjOMG8qXyaS97Jvg
 pZLwnN5Wu21coj6+xH3QUKCl1mJ+KGyamWX5gFBVIfsDB3k5H4neijVm7t1en4b0
 cWxmXeR/JE3VLEl/17yN2dodD8qw1QzmTWzz1vmwJl2zK+rRRAByBrL0DP7QCwCZ
 ppeJbdhkMBwqjtknwrmMwsuAzUdJd79GXA+6Vm+xSEkr6FEPK1M0kGbvaqV9Usgd
 ohMewewbO6ddgR9eF7Kw2FAwo0hwkPNEplXIym9rZzFG1h+T0STGSHvkn7LV765E
 ul1FapSV3GCxEVRwWTwD28FLU2+0zlkOZ5sxXwNPTT96cNmW+R7TGuslZKNaMNjX
 q7eBZxo8DtVt/jqJTntR8bs8052c8g1Ac1IKmlW8VSmFwT1M6VBGRn1/JWAhuUgv
 dBK/FF+I1GJTAJWIhaFcKXLHvmV9uhS6JaIhLMDOetoOkpqSptJ42hDG+89WkFRk
 o55GQ5TFdoOpqxVzGbvE
 =3j4+
 -----END PGP SIGNATURE-----

Merge tag 'device-for-3.4' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux

Pull <linux/device.h> avoidance patches from Paul Gortmaker:
 "Nearly every subsystem has some kind of header with a proto like:

	void foo(struct device *dev);

  and yet there is no reason for most of these guys to care about the
  sub fields within the device struct.  This allows us to significantly
  reduce the scope of headers including headers.  For this instance, a
  reduction of about 40% is achieved by replacing the include with the
  simple fact that the device is some kind of a struct.

  Unlike the much larger module.h cleanup, this one is simply two
  commits.  One to fix the implicit <linux/device.h> users, and then one
  to delete the device.h includes from the linux/include/ dir wherever
  possible."

* tag 'device-for-3.4' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux:
  device.h: audit and cleanup users in main include dir
  device.h: cleanup users outside of linux/include (C files)
2012-03-24 10:41:37 -07:00
Linus Torvalds 11bcb32848 The following text was taken from the original review request:
"[PATCH 0/3] RFC - module.h usage cleanups in fs/ and lib/"
 		https://lkml.org/lkml/2012/2/29/589
 --
 
 Fix up files in fs/ and lib/ dirs to only use module.h if they really
 need it.
 
 These are trivial in scope vs. the work done previously.  We now have
 things where any few remaining cleanups can be farmed out to arch or
 subsystem maintainers, and I have done so when possible.  What is
 remaining here represents the bits that don't clearly lie within a
 single arch/subsystem boundary, like the fs dir and the lib dir.
 
 Some duplicate includes arising from overlapping fixes from
 independent subsystem maintainer submissions are also quashed.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (GNU/Linux)
 
 iQIcBAABAgAGBQJPbNw3AAoJEOvOhAQsB9HWA7wQALrsQ6V6Z+B3KsvSoD5kFnpZ
 Y+4uggs+GdUdWmtRrZnTBp896gGuUgBxc3syA2XWd7Oqi49+c5c1m0cFxKyVdIHm
 fB+jmxS69soADtHR3cXmxcQshrUzUf2rTn8frcw4O/BmJuplv4xT9uPQzwGaRSZT
 gomQsQ1bGnkwjO2jfS8f/N5Mjr8u/z0WF7TTOTUSq+Cv3BervPaSPF1Ea6J8oo+N
 4+/n8RlU1HWiI4inrgrFPN6UHmE45BAL2xGbB47LgooHJW8P5kAnU+vxGScaoy1Q
 JKX9WKT3VCiwR3VOPa86iLKP3Y8a3VlhyGn+yzzcYkGX/n0tbT7aoRhQm21sGIv0
 DoeXWe7aiiY8cEW69G6GIfRPFl+Zh81m1Whbu7IZT/sV3asx6jWmEXE8CgCfeDt5
 mNQk9D4Irf6+rmCSbeSVC4L0eFfLxNFouNyh2aus/q+gIjKNKYwZQryHrodK4wpv
 UgMKSTZfPrTAWay2gCNWNqo3Zs8e1LDqkftetxeU3jx2kTuaNzBl4Y7mhsX7sLYe
 MsFX3JUJ2pn6XWbgqcY+bdr/mzgsCrjzqdf15MTUzEc5SIfVF+XpNNZN1ITwl6UA
 /ZH9keBu1mEdCoPU5W74kYwx4p35hIeWJGfc0MRp07ruf941F+SBgMD11B0+06f0
 pN0DcITTkD16+sS4x1cB
 =Z4w0
 -----END PGP SIGNATURE-----

Merge tag 'module-for-3.4' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux

Pull cleanup of fs/ and lib/ users of module.h from Paul Gortmaker:
 "Fix up files in fs/ and lib/ dirs to only use module.h if they really
  need it.

  These are trivial in scope vs the work done previously.  We now have
  things where any few remaining cleanups can be farmed out to arch or
  subsystem maintainers, and I have done so when possible.  What is
  remaining here represents the bits that don't clearly lie within a
  single arch/subsystem boundary, like the fs dir and the lib dir.

  Some duplicate includes arising from overlapping fixes from
  independent subsystem maintainer submissions are also quashed."

Fix up trivial conflicts due to clashes with other include file cleanups
(including some due to the previous bug.h cleanup pull).

* tag 'module-for-3.4' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux:
  lib: reduce the use of module.h wherever possible
  fs: reduce the use of module.h wherever possible
  includecheck: delete any duplicate instances of module.h
2012-03-24 10:24:31 -07:00
Linus Torvalds 69a7aebcf0 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial
Pull trivial tree from Jiri Kosina:
 "It's indeed trivial -- mostly documentation updates and a bunch of
  typo fixes from Masanari.

  There are also several linux/version.h include removals from Jesper."

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (101 commits)
  kcore: fix spelling in read_kcore() comment
  constify struct pci_dev * in obvious cases
  Revert "char: Fix typo in viotape.c"
  init: fix wording error in mm_init comment
  usb: gadget: Kconfig: fix typo for 'different'
  Revert "power, max8998: Include linux/module.h just once in drivers/power/max8998_charger.c"
  writeback: fix fn name in writeback_inodes_sb_nr_if_idle() comment header
  writeback: fix typo in the writeback_control comment
  Documentation: Fix multiple typo in Documentation
  tpm_tis: fix tis_lock with respect to RCU
  Revert "media: Fix typo in mixer_drv.c and hdmi_drv.c"
  Doc: Update numastat.txt
  qla4xxx: Add missing spaces to error messages
  compiler.h: Fix typo
  security: struct security_operations kerneldoc fix
  Documentation: broken URL in libata.tmpl
  Documentation: broken URL in filesystems.tmpl
  mtd: simplify return logic in do_map_probe()
  mm: fix comment typo of truncate_inode_pages_range
  power: bq27x00: Fix typos in comment
  ...
2012-03-20 21:12:50 -07:00
Linus Torvalds ed378a52da USB merge for 3.4-rc1
Here's the big USB merge for the 3.4-rc1 merge window.
 
 Lots of gadget driver reworks here, driver updates, xhci changes, some
 new drivers added, usb-serial core reworking to fix some bugs, and other
 various minor things.
 
 There are some patches touching arch code, but they have all been acked
 by the various arch maintainers.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.18 (GNU/Linux)
 
 iEYEABECAAYFAk9njL8ACgkQMUfUDdst+ylQ9wCfbBOnIT01lGOorkaE9pom0hhk
 HfMAoKq1xzCR2B+OS3UMyUQffk+Ri9Ri
 =KIQ2
 -----END PGP SIGNATURE-----

Merge tag 'usb-3.3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb

Pull USB merge for 3.4-rc1 from Greg KH:
 "Here's the big USB merge for the 3.4-rc1 merge window.

  Lots of gadget driver reworks here, driver updates, xhci changes, some
  new drivers added, usb-serial core reworking to fix some bugs, and
  other various minor things.

  There are some patches touching arch code, but they have all been
  acked by the various arch maintainers."

* tag 'usb-3.3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (302 commits)
  net: qmi_wwan: add support for ZTE MF820D
  USB: option: add ZTE MF820D
  usb: gadget: f_fs: Remove lock is held before freeing checks
  USB: option: make interface blacklist work again
  usb/ub: deprecate & schedule for removal the "Low Performance USB Block" driver
  USB: ohci-pxa27x: add clk_prepare/clk_unprepare calls
  USB: use generic platform driver on ath79
  USB: EHCI: Add a generic platform device driver
  USB: OHCI: Add a generic platform device driver
  USB: ftdi_sio: new PID: LUMEL PD12
  USB: ftdi_sio: add support for FT-X series devices
  USB: serial: mos7840: Fixed MCS7820 device attach problem
  usb: Don't make USB_ARCH_HAS_{XHCI,OHCI,EHCI} depend on USB_SUPPORT.
  usb gadget: fix a section mismatch when compiling g_ffs with CONFIG_USB_FUNCTIONFS_ETH
  USB: ohci-nxp: Remove i2c_write(), use smbus
  USB: ohci-nxp: Support for LPC32xx
  USB: ohci-nxp: Rename symbols from pnx4008 to nxp
  USB: OHCI-HCD: Rename ohci-pnx4008 to ohci-nxp
  usb: gadget: Kconfig: fix typo for 'different'
  usb: dwc3: pci: fix another failure path in dwc3_pci_probe()
  ...
2012-03-20 11:26:30 -07:00
Paul Gortmaker 51990e8254 device.h: cleanup users outside of linux/include (C files)
For files that are actively using linux/device.h, make sure
that they call it out.  This will allow us to clean up some
of the implicit uses of linux/device.h within include/*
without introducing build regressions.

Yes, this was created by "cheating" -- i.e. the headers were
cleaned up, and then the fallout was found and fixed, and then
the two commits were reordered.  This ensures we don't introduce
build regressions into the git history.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
2012-03-11 14:27:37 -04:00
Greg Kroah-Hartman 263a5c8e16 Merge 3.3-rc6 into driver-core-next
This was done to resolve a conflict in the drivers/base/cpu.c file.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-03-09 12:35:53 -08:00
Renata Sayakhova fef37e9a47 DS2781 Maxim Stand-Alone Fuel Gauge battery and w1 slave drivers
Signed-off-by: Renata Sayakhova <rsayakhova@gmail.com>
Acked-by: Evgeniy Polyakov <zbr@ioremap.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-03-08 11:15:33 -08:00
Jiri Kosina 4f3612b16e Revert "power, max8998: Include linux/module.h just once in drivers/power/max8998_charger.c"
This reverts commit ce64b8d85d. It is done
via moduleh tree as part of a larger cleanup.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
2012-03-07 16:08:46 +01:00
Greg Kroah-Hartman 8062d94a54 Here we have a big rework done by Heikki Krogerus (thanks) which
splits OTG functionality away from transceivers.
 
 We have known for quite a long time that struct otg_transceiver was
 a bad name for the structure, considering transceiver is far from
 being OTG-specific (see 4e67185).
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (GNU/Linux)
 
 iQIcBAABAgAGBQJPTeeMAAoJEIaOsuA1yqRE6ZAP/j2G6DaDyng6vpyYQi2drXaY
 NKx3pA0sC98NACOv6sh+urcMDcDctLmOnwV18U+GNNP+qExQFnyuc7iGsXRxfUOj
 qkIbVPxzPcE0opmEMFJ5ZT85rw33DqKjFnQT4av3wwXe/qSrEkAfBoBSb6wn73rA
 v0JOhceGsFb+kJAc7U9Ji9A9xSjj+6uw08RTuuQv8KBLb5Pws+NoQ6UEjlni8umA
 lkOSelyBZN1OJU+fZKIpS4+SiwtdkZCm2wSIUiwaPosdJgw0w8fz0zNjn/4gAHB1
 oPyjjjP3/VDegp9CuYDRlnBgQa2K4V1vbjrBfhKbyar8fsOSoaPVv1fR9VKgVnT8
 RKlXKSeFEsdP4fOGYCjNKAzjeQH/qSNzdzo+s4GMqoWq7Lm3+b56zdQWvRmTT7Xg
 ++bMqFAi0noeU8aZWwSDMFiYv6O19o+Px4OTS/3aRmR1wdJpUUSk2M7Quw6A/YNj
 4Q5hDvio2eYtI1nya9yMS/j4ZiJ5fDQb5jUfBDB1MKtkZKKzVVSboK8P/rFq5+xf
 xdUfBRd7/fMk+he6RtemfjhMdYTiX6Cm6VzveZVBL4+7dERbnJDRgDhSJOYvA/eW
 Bvc7BY+/EYz7msF0gjLyWu3BBiChajk/D5ukoCIssUPGuIhmO1S7JRi1s+fLaNs3
 Bz8Haxql69YWrNL2ouQf
 =WiB6
 -----END PGP SIGNATURE-----

Merge tag 'xceiv-for-v3.4' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-next

USB: transceiver changes for 3.4

Here we have a big rework done by Heikki Krogerus (thanks) which
splits OTG functionality away from transceivers.

We have known for quite a long time that struct otg_transceiver was
a bad name for the structure, considering transceiver is far from
being OTG-specific (see 4e67185).
2012-03-01 08:45:33 -08:00
Paul Gortmaker 13ae246db4 includecheck: delete any duplicate instances of module.h
Different tree maintainers picked up independently generated
trivial compile fixes based on linux-next testing, resulting
in some cases where a file would have got more than one addition
of module.h once everything was all merged together.

Delete any duplicates so includecheck isn't complaining about
anything related to module.h/export.h changes.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
2012-02-28 19:31:56 -05:00
Heikki Krogerus b1c711d629 usb: otg: mv_otg: Start using struct usb_otg
Use struct usb_otg members with OTG specific functions instead
of usb_phy members.

[ balbi@ti.com : fixed a compile error on isp1704_charger.c ]

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Reviewed-by: Marek Vasut <marek.vasut@gmail.com>
Acked-by: Neil Zhang <zhangwm@marvell.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-02-27 15:41:22 +02:00
Thomas Weber 202e0116b4 power: bq27x00: Fix typos in comment
Fix two typos in comments.

Signed-off-by: Thomas Weber <weber@corscience.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2012-02-21 11:49:26 +01:00
Heikki Krogerus fcc8ebc990 power_supply: Convert all users to new usb_phy
Use the new usb_phy_* functions instead of the old
otg_* ones.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Acked-by: Anton Vorontsov <cbouatmailru@gmail.com>
Reviewed-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-02-13 13:53:21 +02:00
Heikki Krogerus 8675381109 usb: otg: Rename otg_transceiver to usb_phy
This is the first step in separating USB transceivers from
USB OTG utilities.

Includes fixes to IMX code from Sascha Hauer.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Acked-by: Li Yang <leoli@freescale.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: Igor Grinberg <grinberg@compulab.co.il>
Reviewed-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-02-13 13:34:36 +02:00
Jesper Juhl ce64b8d85d power, max8998: Include linux/module.h just once in drivers/power/max8998_charger.c
Remove the duplicate.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2012-02-10 09:52:19 +01:00
Axel Lin 455a0e2cd8 lp8727_charger: Add terminating entry for i2c_device_id table
The i2c_device_id table is supposed to be zero-terminated.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2012-02-01 21:34:26 +04:00
Axel Lin 1bbe24d465 power_supply: Fix modalias for charger-manager
Since 43cc71eed1, the platform
modalias is prefixed with "platform:".
Current code has the id_table, thus add MODULE_DEVICE_TABLE will
automatically setup the modalias.

Also make charger_manager_id static as it is only used in this driver.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2012-02-01 21:29:52 +04:00
Grazvydas Ignotas 4d4036591b bq27x00_battery: Fix flag register read
When reading flags, bq27x00_read() argument is inverted and causes
reads 2 of bytes for bq27200 and 1 byte for bq27500, while their register
sizes are 1 and 2 bytes respectively. This causes bq27500 upper flag
bits always to be returned as 0, causing full charge state to never be
reported correctly, so fix it.

Cc: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Acked-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2012-02-01 21:27:28 +04:00
Anton Vorontsov b7aaacf56a Revert "bq27x00_battery: Fix reporting status value for bq27500 battery"
This reverts commit 270968c098.

Grazvydas Ignotas wrote:

After 270968c098 "bq27x00_battery: Fix reporting status value for
bq27500 battery" status doesn't seem to be reported correctly when the
battery is close to fully charged state. It reports "Not charging"
while in fact there is >130mA current flowing to the battery according
to current_now.

This status report seems to be based on CHG bit in status register,
but looking at the datasheet the description says "(Fast) charging
allowed", which I guess means that the chip recommends charging and
not that charging is actually going on? If you check the bit while
battery is discharging and it's not full, the bit is also set.

Suggested-by: Grazvydas Ignotas <notasas@gmail.com>
Acked-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2012-02-01 21:21:29 +04:00
Rusty Russell 90ab5ee941 module_param: make bool parameters really bool (drivers & misc)
module_param(bool) used to counter-intuitively take an int.  In
fddd5201 (mid-2009) we allowed bool or int/unsigned int using a messy
trick.

It's time to remove the int/unsigned int option.  For this version
it'll simply give a warning, but it'll break next kernel version.

Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-01-13 09:32:20 +10:30
Linus Torvalds b24ca57e76 Merge git://git.infradead.org/battery-2.6
* git://git.infradead.org/battery-2.6: (68 commits)
  power_supply: Mark da9052 driver as broken
  power_supply: Drop usage of nowarn variant of sysfs_create_link()
  s3c_adc_battery: Average over more than one adc sample
  power_supply: Add DA9052 battery driver
  isp1704_charger: Fix missing check
  jz4740-battery: Fix signedness bug
  power_supply: Assume mains power by default
  sbs-battery: Fix devicetree match table
  ARM: rx51: Add bq27200 i2c board info
  sbs-battery: Change power supply name
  devicetree-bindings: Propagate bq20z75->sbs rename to dt bindings
  devicetree-bindings: Add vendor entry for Smart Battery Systems
  sbs-battery: Rename internals to new name
  bq20z75: Rename to sbs-battery
  wm97xx_battery: Use DEFINE_MUTEX() for work_lock
  max8997_charger: Remove duplicate module.h
  lp8727_charger: Some minor fixes for the header
  lp8727_charger: Add header file
  power_supply: Convert drivers/power/* to use module_platform_driver()
  power_supply: Add "unknown" in power supply type
  ...
2012-01-11 18:53:05 -08:00
Anton Vorontsov 913272b386 Merge git://git.infradead.org/users/cbou/battery-urgent 2012-01-10 20:55:11 +04:00
Anton Vorontsov 6cfc2a2354 power_supply: Mark da9052 driver as broken
There are some problems with MFD part of this driver, so the
driver fails to build:

drivers/power/da9052-battery.c: In function 'da9052_bat_read_volt':
drivers/power/da9052-battery.c:293:2: error: implicit declaration of function 'da9052_adc_manual_read' [-Werror=implicit-function-declaration]
drivers/power/da9052-battery.c: In function 'da9052_bat_check_presence':
drivers/power/da9052-battery.c:306:2: error: implicit declaration of function 'da9052_adc_read_temp' [-Werror=implicit-function-declaration]
drivers/power/da9052-battery.c: In function 'da9052_determine_vc_tbl_index':
drivers/power/da9052-battery.c:348:1: warning: control reaches end of non-void function [-Wreturn-type]
cc1: some warnings being treated as errors

The fix for MFD part will probably go post -rc1 (or in the next merge
window), so let's disable the driver for now.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2012-01-10 05:14:10 +04:00
Anton Vorontsov 93278d151e power_supply: Drop usage of nowarn variant of sysfs_create_link()
The function is not exported to modules, plus we do want to catch anyone
who tries to create complex hierarchy (in that case we'd need to change
'powers' symlink to a directory, probably under a different name to not
break ABI).

This patch fixes the following build error:

 ERROR: "sysfs_create_link_nowarn" [drivers/power/power_supply.ko] undefined!

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2012-01-07 15:24:51 +04:00
Heiko Stübner 34aed73df3 s3c_adc_battery: Average over more than one adc sample
Some sources for adc battery information provide only inaccurate results
where the read value differs from the real value with positive and negative
offsets. For such sources it can be more accurate to collect two or more
value sample and use the average of all collected values.

This patch adds pdata options volt_samples, current_samples and
backup_volt_samples to specifiy the number of samples to collect,
reads the specified number of samples and calculates the average of those.
For unset sample-number-values a default of 1 is assumed.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2012-01-06 06:13:35 +04:00
Ashish Jangam ded7fc7b05 power_supply: Add DA9052 battery driver
Driver for DA9052 battery charger. This driver depends on DA9052 MFD core
dirver for definitions and methods.

This patch is functionally tested on Samsung SMDKV6410.

Signed-off-by: David Dajun Chen <dchen@diasemi.com>
Signed-off-by: Ashish Jangam <ashish.jangam@kpitcummins.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2012-01-06 06:10:02 +04:00
Felipe Contreras c934502db7 isp1704_charger: Fix missing check
A segfault happens if there's no board information.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Acked-by: Heikki Krogerus <krohei@gmail.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2012-01-06 06:01:58 +04:00
Axel Lin ef7906f320 jz4740-battery: Fix signedness bug
wait_for_completion_interruptible_timeout() may return negative value.
In this case, checking if (t > 0)  will return true if t is unsigned.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2012-01-06 05:57:17 +04:00
Jean Delvare 2530daa187 power_supply: Assume mains power by default
If no power class device is found in power_supply_is_system_supplied(),
the function currently returns 0, which basically means that the system
is supposed to be running on battery. In practice, mobile devices tend
to always implement at least one power class device and more often two
(battery and AC adapter). Systems with no registered power class
devices are more likely to be desktop systems, where the system is
always powered by mains.

So, change the default return value of
power_supply_is_system_supplied() from 0 (running on battery) to 1
(running on mains.)

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Matthew Garrett <mjg59@srcf.ucam.org>
Cc: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2012-01-06 05:50:32 +04:00
Olof Johansson 62df3935a7 sbs-battery: Fix devicetree match table
It should be an of module table, not i2c.

Signed-off-by: Olof Johansson <olof@lixom.net>
Acked-by: Rhyland Klein <rklein@nvidia.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2012-01-06 05:46:18 +04:00
Rhyland Klein 52f56c69be sbs-battery: Change power supply name
The power supply name used to be fixed as "battery". This change allows
for multiple batteries by generating the name rather than using a fixed
value.

Signed-off-by: Rhyland Klein <rklein@nvidia.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2012-01-06 05:27:36 +04:00
Rhyland Klein 3ddca062f8 sbs-battery: Rename internals to new name
Now that this driver is named more generally, this change updates
the internal variables, defines and functions to use this new name.

Signed-off-by: Rhyland Klein <rklein@nvidia.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2012-01-06 05:22:21 +04:00
Rhyland Klein c78f2b6496 bq20z75: Rename to sbs-battery
This driver for the bq20z75 implemented the register spec defined
by the SBS standard. As this is not unique to this the TI part this
was originally written for, we can generalize this driver to
show its support for any SBS compliant battery.

Signed-off-by: Rhyland Klein <rklein@nvidia.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2012-01-06 05:22:12 +04:00
Axel Lin daf22c3c44 wm97xx_battery: Use DEFINE_MUTEX() for work_lock
work_lock can be initialized automatically with
DEFINE_MUTEX() rather than explicitly calling mutex_init().

This patch also removes an unused bat_lock mutex.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2012-01-06 05:00:30 +04:00
Jonghwan Choi 68597986f7 max8997_charger: Remove duplicate module.h
module.h was included twice.

Signed-off-by: Jonghwan Choi <jhbird.choi@samsung.com>
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2012-01-06 04:59:25 +04:00
Axel Lin 300bac7fb8 power_supply: Convert drivers/power/* to use module_platform_driver()
This patch converts the drivers in drivers/power/* to use the
module_platform_driver() macro which makes the code smaller and a bit
simpler.

Cc: Mike Rapoport <mike@compulab.co.il>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Nithish Mahalingam <nithish.mahalingam@intel.com>
Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
Cc: Haojian Zhuang <haojian.zhuang@marvell.com>
Cc: Balaji Rao <balajirrao@openmoko.org>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Clifton Barnes <cabarnes@indesign-llc.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2012-01-04 09:12:07 +04:00
Anton Vorontsov 251f39fe42 Merge branch 'power-supply-scope' of git://git.kernel.org/pub/scm/linux/kernel/git/jeremy/xen 2012-01-04 09:09:35 +04:00
Kim, Milo 9b8872273a power_supply: Add "unknown" in power supply type
For the default value of power supply type, "unknown" is added.
With default prop value, supply type property can be displayed
as default - "Unknown".

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2012-01-04 09:05:51 +04:00
Kim, Milo ce09affc59 lp8727_charger: Coding style changes
1. Useless braces were omitted
2. Useless void casts were omitted
3. module exit name changed
   lp8727_chg_exit -> lp8727_exit
4. Pointer coding style changes
   no space between pointer('*') and pointer name
   ex) u8 * data -> u8 *data
5. Author information change : email and additional author

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2012-01-04 09:05:51 +04:00
Kim, Milo 998a8e7a72 lp8727_charger: Add supported i2c functionality check routine
lp8727 i2c r/w functions are based on SMBUS I2C BLOCK. So the driver needs to
check whether i2c bus supports this functionality or not.

Signed-off-by: Woogyom Kim <milo.kim@ti.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2012-01-04 08:34:20 +04:00
Woogyom Kim 2165c8a45b power_supply: Add LP8727 charger driver
National Semiconductor LP8727 is the battery charger with Micro/Mini
USB interface. This IC includes below functions:

- I2C interface for accessing user registers
- Single input Li-Ion battery charger
- Charger input ID detection from Micro/Mini USB
- Multiplexing switches on USB, UART

Signed-off-by: Woogyom Kim <milo.kim@ti.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2012-01-04 08:29:43 +04:00
Donggeun Kim ad3d13eee7 power_supply: Charger-Manager: Add properties for power-supply-class
Charger Manager provides power-supply-class aggregating
information from multiple chargers and a fuel-gauge.

Signed-off-by: Donggeun Kim <dg77.kim@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2012-01-04 08:08:45 +04:00
Donggeun Kim 3bb3dbbd56 power_supply: Add initial Charger-Manager driver
Because battery health monitoring should be done even when suspended,
it needs to wake up and suspend periodically. Thus, userspace battery
monitoring may incur too much overhead; every device and task is woken
up periodically. Charger Manager uses suspend-again to provide
in-suspend monitoring.

This patch allows to monitor battery health in-suspend state.

Signed-off-by: Donggeun Kim <dg77.kim@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2012-01-04 08:08:27 +04:00
Al Viro 587a1f1659 switch ->is_visible() to returning umode_t
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2012-01-03 22:54:55 -05:00
Jeremy Fitzhardinge 8351665195 power_supply: allow a power supply to explicitly point to powered device
If a power supply has a scope of "Device", then allow the power supply
to indicate what device it actually powers. This is represented in the
power supply's sysfs directory as a symlink named "powers", which points to
the sysfs directory of the powered device.

If the device has children, then the sub-devices are also powered by
the same power supply.

Signed-off-by: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: Richard Hughes <richard@hughsie.com>
2011-12-09 09:52:07 -08:00
Jeremy Fitzhardinge 25a0bc2dfc power_supply: add SCOPE attribute to power supplies
This adds a "scope" attribute to a power_supply, which indicates how
much of the system it powers.  It appears in sysfs as "scope" or in
the uevent file as POWER_SUPPLY_SCOPE=.  There are presently three
possible values:
	Unknown - unknown power topology
	System - the power supply powers the whole system
	Device - it powers a specific device, or tree of devices

A power supply which doesn't have a "scope" attribute should be assumed to
have "System" scope.

In general, usermode should assume that loss of all System-scoped power
supplies will power off the whole system, but any single one is sufficient
to power the system.

Signed-off-by: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: Richard Hughes <richard@hughsie.com>
2011-12-09 09:42:05 -08:00
Major Lee a7a280493f x86/mrst: Battery fixes
When DCDC input line over current detecting, PMIC will change
charging current automatically.  Logging event is enough.

Signed-off-by: Major Lee <major_lee@wistron.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Cc: Mathias Nyman <mathias.nyman@linux.intel.com>
Cc: Feng Tang <feng.tang@intel.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
[fix build]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2011-12-05 17:06:37 +01:00
Philip Rakity 00a159a556 max8925_power: Check at probe time if power to set online
The interrupt for ac on/off can be missed during boot time.
Check if online by seeing if we have power.  We choose 0.5V
since this is high enough to avoid random reading from a
input that could be floating if no charger.

Signed-off-by: Philip Rakity <prakity@marvell.com>
Signed-off-by: Ted Bennett <tbennett@marvell.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2011-11-26 04:32:46 +04:00
Philip Rakity b57f2f6108 max8925_power: Do not read random data from chip registers
Reading the voltage, charge etc requires that we tell the chip
what property we want to read before reading it according to
maxim.

Signed-off-by: Philip Rakity <prakity@marvell.com>
Signed-off-by: Thomas Liu <Thomas.Liu@maxim-ic.com>
Tested-by: Ted Bennett <tbennett@marvell.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2011-11-26 04:31:47 +04:00
Ramakrishna Pallala 60a1f6e446 max17042_battery: Fix error handling
In max17042_get_property(...), the values returned by
max17042_read_reg are directly assigned to the variables,
even if the read results in an error.

This patch checks for the return code from max17042_read_reg and
exits the function if there is any error.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2011-11-26 04:11:15 +04:00