Commit graph

3047 commits

Author SHA1 Message Date
Tony Lindgren
5c188d7482 mfd: twl4030-power: Fix pmic for boards that need AC charger disabled
I noticed the PMIC configuration on 37xx-evm won't actually shut down
the voltages during off-idle. Turns out 37xx-evm needs the AC charger
state transitions disabled like we are doing for SDP and LDP in the
legacy booting case.

Let's fix this for device tree based booting by setting up the quirk
flag based on the compatible flag. And let's also use the existing
define for STARTON_CHG.

Note that SDP and EVM do not have the PMIC clken wired to gate the
the oscillator while LDP has.

Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-06-22 12:25:04 +01:00
Charles Keepax
b375e9f90f mfd: arizona: Remove redundant register sync
This soft reset used to be located after the register patch had been
applied, but has since moved to before the patch is applied. At the new
location there is no requirement to do a register sync as no register
writes will have happened yet.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-06-22 12:25:03 +01:00
Krzysztof Kozlowski
7ce7b26f84 mfd: Constify regmap and irq configuration data
Constify in various drivers configuration data which is not modified:
 - regmap_irq_chip,
 - individual regmap_irq's in array,
 - regmap_config,
 - irq_domain_ops,

Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-06-22 12:25:01 +01:00
Lee Jones
79aa79342c Merge branches 'ib-mfd-watchdog-rtc-4.2', 'ib-mfd-regulator-4.2' and 'ib-mfd-i2c-input-chrome-4.2' into ibs-for-mfd-merged 2015-06-22 12:24:25 +01:00
Lee Jones
cf649e0076 mfd: cros_ec: Staticise some newly introduced structures
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-06-22 12:23:02 +01:00
Alexandru M Stan
ff4378f4b8 mfd: cros_ec: spi: Add delay for asserting CS
Some ECs need a little time for waking up before they can accept
SPI data at a high speed. This is configurable via a DT property
"google,cros-ec-spi-pre-delay".

This patch makes the cros_ec_spi driver to cause a delay before
the beginning of a SPI transaction, to make sure that the EC has
already woken up, if the property has been defined in the DTS.

Signed-off-by: Alexandru M Stan <amstan@chromium.org>
Reviewed-by: Doug Anderson <dianders@chromium.org>
Signed-off-by: Chris Zhong <zyw@rock-chips.com>
Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-06-15 13:18:24 +01:00
Gwendal Grignou
57b33ff077 mfd: cros_ec: Support multiple EC in a system
Chromebooks can have more than one Embedded Controller so the
cros_ec device id has to be incremented for each EC registered.

Add a new structure to represent multiple EC as different char
devices (e.g: /dev/cros_ec, /dev/cros_pd). It connects to
cros_ec_device and allows sysfs inferface for cros_pd.

Also reduce number of allocated objects, make chromeos sysfs
class object a static and add refcounting to prevent object
deletion while command is in progress.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Dmitry Torokhov <dtor@chromium.org>
Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-06-15 13:18:23 +01:00
Stephen Barber
d365407079 mfd: cros_ec: add bus-specific proto v3 code
Add proto v3 support to the SPI, I2C, and LPC.

Signed-off-by: Stephen Barber <smbarber@chromium.org>
Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Tested-by: Gwendal Grignou <gwendal@chromium.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-06-15 13:18:22 +01:00
Stephen Barber
2c7589af3c mfd: cros_ec: add proto v3 skeleton
Add support in cros_ec.c to handle EC host command protocol v3.
For v3+, probe for maximum shared protocol version and max
request, response, and passthrough sizes. For now, this will
always fall back to v2, since there is no bus-specific code
for handling proto v3 packets.

Signed-off-by: Stephen Barber <smbarber@chromium.org>
Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Tested-by: Gwendal Grignou <gwendal@chromium.org>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-06-15 13:18:21 +01:00
Javier Martinez Canillas
062476f24a mfd: cros_ec: Move protocol helpers out of the MFD driver
The MFD driver should only have the logic to instantiate its child devices
and setup any shared resources that will be used by the subdevices drivers.

The cros_ec MFD is more complex than expected since it also has helpers to
communicate with the EC. So the driver will only get more bigger as other
protocols are supported in the future. So move the communication protocol
helpers to its own driver as drivers/platform/chrome/cros_ec_proto.c.

Suggested-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-06-15 13:18:20 +01:00
Javier Martinez Canillas
a841178445 mfd: cros_ec: Use a zero-length array for command data
Commit 1b84f2a4cd ("mfd: cros_ec: Use fixed size arrays to transfer
data with the EC") modified the struct cros_ec_command fields to not
use pointers for the input and output buffers and use fixed length
arrays instead.

This change was made because the cros_ec ioctl API uses that struct
cros_ec_command to allow user-space to send commands to the EC and
to get data from the EC. So using pointers made the API not 64-bit
safe. Unfortunately this approach was not flexible enough for all
the use-cases since there may be a need to send larger commands
on newer versions of the EC command protocol.

So to avoid to choose a constant length that it may be too big for
most commands and thus wasting memory and CPU cycles on copy from
and to user-space or having a size that is too small for some big
commands, use a zero-length array that is both 64-bit safe and
flexible. The same buffer is used for both output and input data
so the maximum of these values should be used to allocate it.

Suggested-by: Gwendal Grignou <gwendal@chromium.org>
Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-06-15 13:18:19 +01:00
Todd Broch
bb03ffb96c mfd: cros_ec: Instantiate sub-devices from device tree
If the EC device tree node has sub-nodes, try to instantiate them as
MFD sub-devices.  We can configure the EC features provided by the board.

Signed-off-by: Todd Broch <tbroch@chromium.org>
Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-06-15 13:18:18 +01:00
Gwendal Grignou
e7b707f968 mfd: cros_ec: Remove parent field
Parent and device were pointing to the same device structure.

Parent is unused, removed.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Tested-by: Stephen Barber <smbarber@chromium.org>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Tested-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Puthikorn Voravootivat <puthik@chromium.org>
Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-06-15 13:18:17 +01:00
Chen-Yu Tsai
6d4fa89dcd mfd: axp20x: Enable AXP22X regulators
Now that the axp20x-regulators driver supports different variants of the
AXP family, we can enable regulator support for AXP22X without the risk
of incorrectly configuring regulators.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-05-13 16:26:34 +01:00
Boris BREZILLON
f05be589ff mfd: axp20x: Add AXP22x PMIC support
Add support for the AXP22x PMIC devices to the existing AXP20x driver.
This includes the AXP221 and AXP223, which are identical except for
the external data bus. Only AXP221 is added for now. AXP223 will be
added after it's Reduced Serial Bus (RSB) interface is supported.

AXP22x defines a new set of registers, power supplies and regulators,
but most of the API is similar to the AXP20x ones.

A new irq chip definition is used, even though the available interrupts
on AXP22x is a subset of those on AXP20x. This is done so the interrupt
numbers match those on the datasheet.

This patch only enables the interrupts, system power-off function, and PEK
sub-device. The regulator driver must first support different variants
before we enable it from the mfd driver.

Signed-off-by: Boris BREZILLON <boris.brezillon@free-electrons.com>
[wens@csie.org: fix interrupts and move regulators to separate patch]
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-05-13 16:25:35 +01:00
Linus Torvalds
36a8032d77 platform/chrome: Updates for v4.1
Here's a set of updates to the Chrome OS platform drivers for this merge window.
 
 Main new things this cycle is:
 
 - Driver changes to expose the lightbar to users. With this, you can make your
   own blinkenlights on Chromebook Pixels.
 - Changes in the way that the atmel_mxt trackpads are probed. The laptop driver
   is trying to be smart and not instantiate the devices that don't answer to
   probe. For the trackpad that can come up in two modes (bootloader or regular),
   this gets complicated since the driver already knows how to handle the two
   modes including the actual addresses used. So now the laptop driver needs to
   know more too, instantiating the regular address even if the bootloader one
   is the probe that passed.
 - mfd driver improvements by Javier Martines Canillas, and a few bugfixes
   from him, kbuild and myself.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJVOyVhAAoJEIwa5zzehBx3U/gP/jEqIMKEB6r0qApnYLU/0v2V
 6AiAtQBDZ6PSNDOqy5Mo5HoMQ0WI09n4xvml3Ntmx0/584RGECn8nlFvwlowIxNo
 FLGYcKWuy8w8wKgN19hhEYySnTEex4+kBuDTITvya61SpvxUUfu7fpGV+DXwM2CS
 aJQdMOwl24BJ4gjev9JS5QasyZrAzZVuDwo8vSKG6PKZNGgC1uyjOrm+NjiTEW15
 FzCk77rRHfiN6Zr9C79ZfqV/nWKm4rPvaJJOiNr2vZUQ/0bhbvSHp3/BekjtnlOv
 W6GbUCoDT6/DU/p1SP2Yegqk5pOEcqKQFe7Uc3YDSfiNLNCp03nF1RuIoi/NzfDy
 1GcLYWAvHCrtmpQwqM/gIgc9uAsFN9Stin2G79xt3U/dUitdAmwMsCfqDE1FO63e
 pGjPx0H7e1Ot3en3O5agaAlYlsokptKl3bIVOMfK6s6bH3RK4Y83LxwsVQKYkayA
 TyulczOPnx6i4+acQroIwpFTj8QhhNjjhBU5gXTebVj4B/CwfieZBadaYF23O765
 shX71oUJ1gQ6LCZtu8brl/82uk3sSkpVDi8e5WWaSnLfnAmqtU/ITy5yg77uuD0b
 RAdHxVFUO6Y0FspWmWzBckrPec7ub+SKglCACq8HNciGx/9BWx6NUWI9FK93CDIu
 O36D/l9hoUvA0gds5Iom
 =NVa4
 -----END PGP SIGNATURE-----

Merge tag 'chrome-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/olof/chrome-platform

Pull chrome platform updates from Olof Johansson:
 "Here's a set of updates to the Chrome OS platform drivers for this
  merge window.

  Main new things this cycle is:

   - Driver changes to expose the lightbar to users.  With this, you can
     make your own blinkenlights on Chromebook Pixels.

   - Changes in the way that the atmel_mxt trackpads are probed.  The
     laptop driver is trying to be smart and not instantiate the devices
     that don't answer to probe.  For the trackpad that can come up in
     two modes (bootloader or regular), this gets complicated since the
     driver already knows how to handle the two modes including the
     actual addresses used.  So now the laptop driver needs to know more
     too, instantiating the regular address even if the bootloader one
     is the probe that passed.

   - mfd driver improvements by Javier Martines Canillas, and a few
     bugfixes from him, kbuild and myself"

* tag 'chrome-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/olof/chrome-platform:
  platform/chrome: chromeos_laptop - instantiate Atmel at primary address
  platform/chrome: cros_ec_lpc - Depend on X86 || COMPILE_TEST
  platform/chrome: cros_ec_lpc - Include linux/io.h header file
  platform/chrome: fix platform_no_drv_owner.cocci warnings
  platform/chrome: cros_ec_lightbar - fix duplicate const warning
  platform/chrome: cros_ec_dev - fix Unknown escape '%' warning
  platform/chrome: Expose Chrome OS Lightbar to users
  platform/chrome: Create sysfs attributes for the ChromeOS EC
  mfd: cros_ec: Instantiate ChromeOS EC character device
  platform/chrome: Add Chrome OS EC userspace device interface
  platform/chrome: Add cros_ec_lpc driver for x86 devices
  mfd: cros_ec: Add char dev and virtual dev pointers
  mfd: cros_ec: Use fixed size arrays to transfer data with the EC
2015-04-26 13:36:02 -07:00
Linus Torvalds
f0c1bc95a1 == Changes to existing drivers ==
- Rename child driver [axp288_battery => axp288_fuel_gauge]; axp20x
    - Rename child driver [max77693-flash => max77693-led]; max77693
    - Error handling fixes; intel_soc_pmic
    - GPIO tweaking; intel_soc_pmic
    - Remove non-DT code; vexpress-sysreg, tc3589x
    - Remove unused/legacy code; ti_am335x_tscadc, rts5249, rtsx_gops, rtsx_pcr,
                                 rtc-s5m, sec-core, max77693, menelaus,
                                 wm5102-tables
    - Trivial fixups; rtsx_pci, da9150-core, sec-core, max7769, max77693,
                      mc13xxx-core, dln2, hi6421-pmic-core, rk808, twl4030-power,
                      lpc_ich, menelaus, twl6040
    - Update register/address values; rts5227, rts5249
    - DT and/or binding document fixups; arizona, da9150, mt6397, axp20x,
                                         qcom-rpm, qcom-spmi-pmic
    - Couple of trivial core Kconfig fixups
    - Remove use of seq_printf return value; ab8500-debugfs
    - Remove __exit markups; menelaus, tps65010
    - Fix platform-device name collisions; mfd-core
 
  == New drivers/supported devices ==
    - Add support for wm8280/wm8281 into arizona
    - Add support for COMe-cBL6 into kempld-core
    - Add support for rts524a and rts525a into rts5249
    - Add support for ipq8064 into qcom_rpm
    - Add support for extcon into axp20x
    - New MediaTek MT6397 PMIC driver
    - New Maxim MAX77843 PMIC dirver
    - New Intel Quark X1000 I2C-GPIO driver
    - New Skyworks SKY81452 driver
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJVLQlhAAoJEFGvii+H/HdhnSYP/i7h+0/uvI32+49XlQWO/zZv
 SIcnNcekSj/8MIIpSOZftY+ejdqyo8NHY0dvNTmxekY65ov/yXA6aJGDd5rr3xyL
 hd9E5e5nwxc4UTV2kJwPBgCIKIjx/idRgOMTEpIa1v4KY8Gn43xc81X4s+BusbCE
 WK8hPdBUePRDmMLrRzhkVHqrfeMSSLN5Z/fhmQehWqahE1asPZ2FOnTC6tFlGxgm
 I55FAMvWey+qv4g28+nQrC9RQMetCL2f/6o53jMEQoaRQdJbbrxMybBnNvpcXwbR
 JECPiV+2R0EqBd3xiT2gbPLAqmMDexIP1Cybh3BBRcFveJeJGqmMCFwMio6kotkA
 IIMlYNcwczufPVWIIqz3U2OtJ5EWzxPgco2aA4a1Ej1nbUC29o829fMahZY0SR8m
 O2zX/MpmYPZCg3mHOFQ4oPwalIM7oKv79NTV25Ks9r+rv+zNaBc8TPCE/Oxkxfj8
 IdJ/vKQaKMmMZA1THO8HMK9qAQV7vZL12XquVzrAgq40RZa+nOUXEk0J0rHI0VaO
 BHNMBv1D3iNQfR7cWAappDavhoZcFtIY/Z9x7OsLYm/W8+CxhdAafMNH0AJPlfts
 NR7RoNtStumXdq6QzDdA27Mp1sXkHz/kgGMVE4t9mdLVmD9C0MqVi8VPFUN+sST0
 vAKAhQ/cnXCKVxe6I9/3
 =QPNn
 -----END PGP SIGNATURE-----

Merge tag 'mfd-for-linus-4.1' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd

Pull MFD updates from Lee Jones:
 "Changes to existing drivers:

   - Rename child driver [axp288_battery => axp288_fuel_gauge]; axp20x
   - Rename child driver [max77693-flash => max77693-led]; max77693
   - Error handling fixes; intel_soc_pmic
   - GPIO tweaking; intel_soc_pmic
   - Remove non-DT code; vexpress-sysreg, tc3589x
   - Remove unused/legacy code; ti_am335x_tscadc, rts5249, rtsx_gops, rtsx_pcr,
                                rtc-s5m, sec-core, max77693, menelaus,
                                wm5102-tables
   - Trivial fixups; rtsx_pci, da9150-core, sec-core, max7769, max77693,
                     mc13xxx-core, dln2, hi6421-pmic-core, rk808, twl4030-power,
                     lpc_ich, menelaus, twl6040
   - Update register/address values; rts5227, rts5249
   - DT and/or binding document fixups; arizona, da9150, mt6397, axp20x,
                                        qcom-rpm, qcom-spmi-pmic
   - Couple of trivial core Kconfig fixups
   - Remove use of seq_printf return value; ab8500-debugfs
   - Remove __exit markups; menelaus, tps65010
   - Fix platform-device name collisions; mfd-core

  New drivers/supported devices:

   - Add support for wm8280/wm8281 into arizona
   - Add support for COMe-cBL6 into kempld-core
   - Add support for rts524a and rts525a into rts5249
   - Add support for ipq8064 into qcom_rpm
   - Add support for extcon into axp20x
   - New MediaTek MT6397 PMIC driver
   - New Maxim MAX77843 PMIC dirver
   - New Intel Quark X1000 I2C-GPIO driver
   - New Skyworks SKY81452 driver"

* tag 'mfd-for-linus-4.1' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (76 commits)
  mfd: sec: Fix RTC alarm interrupt number on S2MPS11
  mfd: wm5102: Remove registers for output 3R from readable list
  mfd: tps65010: Remove incorrect __exit markups
  mfd: devicetree: bindings: Add Qualcomm RPM regulator subnodes
  mfd: axp20x: Add support for extcon cell
  mfd: lpc_ich: Sort IDs
  mfd: twl6040: Remove wrong and unneeded "platform:twl6040" modalias
  mfd: qcom-spmi-pmic: Add specific compatible strings for Qualcomm's SPMI PMIC's
  mfd: axp20x: Fix duplicate const for model names
  mfd: menelaus: Use macro for magic number
  mfd: menelaus: Drop support for SW controller VCORE
  mfd: menelaus: Delete omap_has_menelaus
  mfd: arizona: Correct type of gpio_defaults
  mfd: lpc_ich: Sort IDs
  mfd: Fix a typo in Kconfig
  mfd: qcom_rpm: Add support for IPQ8064
  mfd: devicetree: qcom_rpm: Document IPQ8064 resources
  mfd: core: Fix platform-device name collisions
  mfd: intel_quark_i2c_gpio: Don't crash if !DMI
  dt-bindings: Add vendor-prefix for X-Powers
  ...
2015-04-14 17:29:55 -07:00
Linus Torvalds
d0bbe0dd35 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial
Pull trivial tree from Jiri Kosina:
 "Usual trivial tree updates.  Nothing outstanding -- mostly printk()
  and comment fixes and unused identifier removals"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial:
  goldfish: goldfish_tty_probe() is not using 'i' any more
  powerpc: Fix comment in smu.h
  qla2xxx: Fix printks in ql_log message
  lib: correct link to the original source for div64_u64
  si2168, tda10071, m88ds3103: Fix firmware wording
  usb: storage: Fix printk in isd200_log_config()
  qla2xxx: Fix printk in qla25xx_setup_mode
  init/main: fix reset_device comment
  ipwireless: missing assignment
  goldfish: remove unreachable line of code
  coredump: Fix do_coredump() comment
  stacktrace.h: remove duplicate declaration task_struct
  smpboot.h: Remove unused function prototype
  treewide: Fix typo in printk messages
  treewide: Fix typo in printk messages
  mod_devicetable: fix comment for match_flags
2015-04-14 09:50:27 -07:00
Linus Torvalds
a21c1ea656 power supply and reset changes for the v4.1 series
* new API for safe access of power supply function attrs
  * devres support for power supply (un)registration
  * new drivers / chips
   - generic syscon based poweroff driver
   - iio & charger driver for da9150
   - fuel gauge driver for axp288
   - bq27x00: add support for bq27510
   - bq2415x: add support for bq24157s
  * twl4030-madc-battery: convert to iio consumer
  * misc fixes
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABCgAGBQJVK8KPAAoJENju1/PIO/qaKIIP/jYZr1NJ7zrSAfm/hiCS+1Kz
 f68H5zlC3IOD2YlH7Yx3EUnag4k8wXiwp5LlRFMmek78H6UtKgr274cVyBA730Qk
 qGYyI6rZqBi9nheIwbXugUTs65R+S1bSaLksZvNfTmnKRiHUpO5nsJJezusJM/O1
 lSUJb166kR9agFL+7MSjOW4FTpqDCrndEmYOXiUmzpOS1+1ZJXPN8EMyktJxcZu9
 fxE8smy2fr0rqkZoSX4irYI28DoAqb5jImv0/GlVLVKsGukzkOkwMdKunWbFywvT
 mg/mkyfpPb3xWNUPuyVRzhgsPnaNYm5uNwr2yWuFvyxNOTweyjRriGMflewkKscf
 aGJLOiFThJrdyTjscMCfdVuNr1a+Bzd9UdiNH1I6mS99zW7wLEukHJi2CH8+9UGE
 eDRrnb6wiKAqpvIDeIatEbQUTV5JXM0vWbKIHx7m1M3P5/hLGiOWguO7V2x4RsTp
 B21mXXj6/AUYA7IKIiPjNC7HJ71J80Gali40zOYRni9MFybi1SE9MzeHNdQhdbyn
 EW+3irBTruSl93qMpsCivxMhnSeclB/PuPvH6wPOfhftlAvN+9GhGaIQzLl0mo5E
 ckXbc23QfDCwcygCnkcQy+dgQOOttk6wDUkmhAiGriciO57NgTz9KnrhOexptw+h
 2wCLGqBPSO2rADJ5RE9f
 =WbZu
 -----END PGP SIGNATURE-----

Merge tag 'for-v4.1' of git://git.infradead.org/battery-2.6

Pull power supply and reset changes from Sebastian Reichel:

 - new API for safe access of power supply function attrs

 - devres support for power supply (un)registration

 - new drivers / chips:
     - generic syscon based poweroff driver
     - iio & charger driver for da9150
     - fuel gauge driver for axp288
     - bq27x00: add support for bq27510
     - bq2415x: add support for bq24157s

 - twl4030-madc-battery: convert to iio consumer

 - misc fixes

* tag 'for-v4.1' of git://git.infradead.org/battery-2.6: (66 commits)
  power: twl4030_madc_battery: Add missing MODULE_ALIAS
  power: twl4030-madc-battery: Convert to iio consumer.
  dt: power: Add docs for generic SYSCON poweroff driver.
  power: reset: Add generic SYSCON register mapped poweroff.
  power: max17042_battery: add missed blank
  power: max17042_battery: Use reg type instead of chip type
  power/reset: at91: big endian fixes for atsama5d3x
  power_supply: charger-manager: Fix dereferencing of ERR_PTR
  HID: input: Fix NULL pointer dereference when power_supply_register fails
  power: constify of_device_id array
  power/reset/rmobile-reset.c: Fix !HAS_IOMEM build
  power_supply: 88pm860x_charger: Fix possible NULL pointer dereference and use of initialized variable
  arm: mach-pxa: Decrement the power supply's device reference counter
  mfd: ab8500: Decrement the power supply's device reference counter
  power_supply: bq2415x_charger: Decrement the power supply's device reference counter
  power_supply: 88pm860x_charger: Decrement the power supply's device reference counter
  x86/olpc/xo15/sci: Use newly added power_supply_put API
  x86/olpc/xo1/sci: Use newly added power_supply_put API
  power_supply: charger-manager: Decrement the power supply's device reference counter
  power_supply: Increment power supply use counter when obtaining references
  ...
2015-04-13 15:21:34 -07:00
Krzysztof Kozlowski
e554a99ee8 mfd: sec: Fix RTC alarm interrupt number on S2MPS11
The RTC on S2MPS11 is the same as S2MPS14. However interrupt numbers of
RTC alarms 0 and 1 were inversed between these two devices. So when
rtc-s5m driver requested S2MPS14_IRQ_RTCA0 interrupt, it matched to
S2MPS11_IRQ_RTCA1, not RTCA0.

Fix this by using consistent RTC alarm interrupt numbers and adding a
BUILD_BUG_ON for future generations.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-04-09 10:26:54 +01:00
Charles Keepax
dcbbcba926 mfd: wm5102: Remove registers for output 3R from readable list
The earpiece on 5102 is mono, thus there is no output 3R. Remove the
registers associated with the unused right channel from the readable
registers list.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-04-09 10:26:48 +01:00
Dmitry Torokhov
bb73370791 mfd: tps65010: Remove incorrect __exit markups
Even if bus is not hot-pluggable, the devices can be unbound from the
driver via sysfs, so we should not be using __exit annotations on
remove() methods. The only exception is drivers registered with
platform_driver_probe() which specifically disables sysfs bind/unbind
attributes.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-04-09 10:26:40 +01:00
Ramakrishna Pallala
bdb01f7823 mfd: axp20x: Add support for extcon cell
This patch adds the mfd cell info for axp288 extcon device.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-04-09 10:26:15 +01:00
Andy Shevchenko
7271575788 mfd: lpc_ich: Sort IDs
The patch sorts IDs in the table for easier maintenance. There is no
functional change.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-04-09 10:25:54 +01:00
Axel Lin
ba867bc60a mfd: twl6040: Remove wrong and unneeded "platform:twl6040" modalias
This is a I2C driver, so it's wrong to use platform prefix for the
modalias. We have all needed i2c aliases coming form MODULE_DEVICE_TABLE,
so let's remove the wrong and unneeded "platform:twl6040" modalias.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-03-30 12:39:22 +01:00
Ivan T. Ivanov
dc716bbf1d mfd: qcom-spmi-pmic: Add specific compatible strings for Qualcomm's SPMI PMIC's
Some of the PMIC's could have specific regmap configuration
tables in future, so add specific compatible strings for known
PMIC's. Also print runtime detected chip revision information.

Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
Acked-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-03-30 10:07:08 +01:00
Krzysztof Kozlowski
c31e858b1a mfd: axp20x: Fix duplicate const for model names
Replace duplicated const keyword for 'axp20x_model_names' with proper
array of const pointers to const strings.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-03-30 10:07:03 +01:00
Aaro Koskinen
dfe514b67a mfd: menelaus: Use macro for magic number
Use macro to check a register bit.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-03-30 10:06:55 +01:00
Aaro Koskinen
1ea8684e1e mfd: menelaus: Drop support for SW controller VCORE
Drop support for SW controlled VCORE, nobody uses it.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-03-30 10:06:50 +01:00
Andy Shevchenko
aec9038ec9 mfd: lpc_ich: Sort IDs
This patch just sorts IDs in the table for better maintenance. There is no
functional change.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-03-30 10:06:16 +01:00
Łukasz Stelmach
78c059c65a mfd: Fix a typo in Kconfig
Signed-off-by: Łukasz Stelmach <stlman@poczta.fm>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-03-30 10:05:07 +01:00
Josh Cartwright
4d54b0adfa mfd: qcom_rpm: Add support for IPQ8064
The IPQ8064 also includes an RPM following the same message structure as
other chips.  In addition, it supports a few new resource types to
support the NSS fabric clocks and the SMB208/SMB209 regulators found on
the reference boards.

Signed-off-by: Josh Cartwright <joshc@codeaurora.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-03-30 08:19:58 +01:00
Johan Hovold
a77c50b44c mfd: core: Fix platform-device name collisions
Since commit 6e3f62f079 ("mfd: core: Fix platform-device id
generation") we honour PLATFORM_DEVID_AUTO and PLATFORM_DEVID_NONE when
registering mfd-devices.

Unfortunately, some mfd-drivers rely on the old behaviour of generating
platform-device ids by adding the cell id also to the special value of
PLATFORM_DEVID_NONE. The resulting platform ids are not only used to
generate device-unique names, but are also used instead of the cell id
to identify cells when probing subdevices.

These drivers should be updated to use PLATFORM_DEVID_AUTO, which would
also allow more than one device to be registered without resorting to
hacks (see for example wm831x), but lets fix the regression first by
partially reverting the above mentioned commit with respect to
PLATFORM_DEVID_NONE.

Fixes: 6e3f62f079 ("mfd: core: Fix platform-device id generation")
Cc: stable <stable@vger.kernel.org>	# v3.19
Reported-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Acked-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-03-30 08:19:57 +01:00
Andy Shevchenko
bafc1face2 mfd: intel_quark_i2c_gpio: Don't crash if !DMI
dmi_get_system_info() may return NULL either when CONFIG_DMI is not set or when
board has an old firmware. The patch prevents a crash and changes the default
frequency to be in align with older board.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
[Lee: Removed overt "sentinel" comment and extra lines]
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-03-30 08:19:56 +01:00
Krzysztof Kozlowski
eea2e59606 mfd: sec-core: Enable RTC on S2MPS11 PMIC
The S2MPS11 PMIC (present on Arndale Octa board) has the same RTC module
as S2MPS14 device. Add respective mfd cell to enable it.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-03-26 14:20:19 +00:00
Fabian Frederick
908725d541 mfd: Constify of_device_id array
of_device_id is always used as const.

(See driver.of_match_table and open firmware functions)

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-03-26 14:20:18 +00:00
Nicholas Mc Guire
48579a9ae8 mfd: dln2: Use msecs_to_jiffies for time conversion
Converting milliseconds to jiffies by "val * HZ / 1000" is technically
OK but msecs_to_jiffies(val) is the cleaner solution and handles all
corner cases correctly. This is a minor API consolidation only and
should make things more readable.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-03-26 14:20:18 +00:00
Linus Walleij
1422731dbc mfd: tc3589x: Enforce device-tree only mode
All systems using the TC3589x multifunction expander uses
devicetree, so don't clutter the place with a lot of
and assume it is there.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-03-26 14:20:17 +00:00
Scott Wood
5d5a7bffd0 mfd: mc13xxx-core: %pF is only for function pointers
Use %pS for actual addresses, otherwise you'll get bad output
on arches like ppc64 where %pF expects a function descriptor.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-03-23 11:48:30 +00:00
Dmitry Torokhov
eac8a5c91b mfd: menelaus: Remove incorrect __exit markups
Even if bus is not hot-pluggable, the devices can be unbound from the
driver via sysfs, so we should not be using __exit annotations on
remove() methods. The only exception is drivers registered with
platform_driver_probe() which specifically disables sysfs bind/unbind
attributes.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-03-23 11:47:38 +00:00
Krzysztof Kozlowski
6ff9d25baf mfd: ab8500: Decrement the power supply's device reference counter
Use power_supply_put() to decrement the power supply's device reference
counter.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Reviewed-by: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-03-13 23:15:54 +01:00
Krzysztof Kozlowski
091e73a23a mfd: ab8500: Use power_supply_*() API for accessing function attrs
Replace direct calls to power supply function attributes with wrappers.
Wrappers provide safe access in case of unregistering the power
supply (e.g. by removing the driver). Replace:
 - get_property -> power_supply_get_property

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Acked-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Acked-by: Lee Jones <lee.jones@linaro.org>
Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Reviewed-by: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-03-13 23:15:50 +01:00
Ameya Palande
c8648508eb mfd: kempld-core: Fix callback return value check
On success, callback function returns 0. So invert the if condition
check so that we can break out of loop.

Cc: stable@vger.kernel.org
Signed-off-by: Ameya Palande <2ameya@gmail.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-03-12 09:27:58 +00:00
Roger Tseng
3a43477fa3 mfd: rtsx_usb: Prevent DMA from stack
Functions rtsx_usb_ep0_read_register() and rtsx_usb_get_card_status()
both use arbitrary buffer addresses from arguments directly for DMA and
the buffers could be located in stack. This was caught by DMA-API debug
check.

Fixes this by using double-buffers via kzalloc in both functions to
guarantee the validity of DMA buffer.

WARNING: CPU: 1 PID: 25 at lib/dma-debug.c:1166 check_for_stack+0x96/0xe0()
ehci-pci 0000:00:1a.0: DMA-API: device driver maps memory from stack
[addr=ffff8801199e3cef]
Modules linked in: rtsx_usb_ms arc4 memstick intel_rapl iosf_mbi
rtl8192ce snd_hda_codec_hdmi snd_hda_codec_realtek
snd_hda_codec_generic snd_hda_intel rtl_pci rtl8192c_common
snd_hda_controller x86_pkg_temp_thermal snd_hda_codec rtlwifi mac80211
coretemp kvm_intel kvm iTCO_wdt snd_hwdep snd_seq snd_seq_device
crct10dif_pclmul iTCO_vendor_support sparse_keymap cfg80211
crc32_pclmul snd_pcm crc32c_intel ghash_clmulni_intel rfkill i2c_i801
snd_timer shpchp snd serio_raw mei_me lpc_ich soundcore mei tpm_tis
tpm wmi nfsd auth_rpcgss nfs_acl lockd grace sunrpc i915
rtsx_usb_sdmmc mmc_core 8021q uas garp stp i2c_algo_bit llc mrp
drm_kms_helper usb_storage drm rtsx_usb mfd_core r8169 mii video
CPU: 1 PID: 25 Comm: kworker/1:2 Not tainted 3.20.0-0.rc0.git7.3.fc22.x86_64 #1
Hardware name: WB WB-B06211/WB-B0621, BIOS EB062IWB V1.0 12/12/2013
Workqueue: events rtsx_usb_ms_handle_req [rtsx_usb_ms]
 0000000000000000 000000003d188e66 ffff8801199e3808 ffffffff8187642b
 0000000000000000 ffff8801199e3860 ffff8801199e3848 ffffffff810ab39a
 ffff8801199e3864 ffff8801199e3cef ffff880119b57098 ffff880119b37320
Call Trace:
 [<ffffffff8187642b>] dump_stack+0x4c/0x65
 [<ffffffff810ab39a>] warn_slowpath_common+0x8a/0xc0
 [<ffffffff810ab425>] warn_slowpath_fmt+0x55/0x70
 [<ffffffff8187efe6>] ? _raw_spin_unlock_irqrestore+0x36/0x70
 [<ffffffff81453156>] check_for_stack+0x96/0xe0
 [<ffffffff81453934>] debug_dma_map_page+0x104/0x150
 [<ffffffff81613b86>] usb_hcd_map_urb_for_dma+0x646/0x790
 [<ffffffff81614165>] usb_hcd_submit_urb+0x1d5/0xa90
 [<ffffffff81106f8f>] ? mark_held_locks+0x7f/0xc0
 [<ffffffff81106f8f>] ? mark_held_locks+0x7f/0xc0
 [<ffffffff81103a15>] ? lockdep_init_map+0x65/0x5d0
 [<ffffffff81615d7e>] usb_submit_urb+0x42e/0x5f0
 [<ffffffff81616787>] usb_start_wait_urb+0x77/0x190
 [<ffffffff8124f035>] ? __kmalloc+0x205/0x2d0
 [<ffffffff8161697c>] usb_control_msg+0xdc/0x130
 [<ffffffffa0031669>] rtsx_usb_ep0_read_register+0x59/0x70 [rtsx_usb]
 [<ffffffffa00310c1>] ? rtsx_usb_get_rsp+0x41/0x50 [rtsx_usb]
 [<ffffffffa071da4e>] rtsx_usb_ms_handle_req+0x7ce/0x9c5 [rtsx_usb_ms]

Reported-by: Josh Boyer <jwboyer@fedoraproject.org>
Signed-off-by: Roger Tseng <rogerable@realtek.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-03-12 09:27:41 +00:00
Gyungoh Yoo
2698dc2229 mfd: Add support for Skyworks SKY81452 driver
Signed-off-by: Gyungoh Yoo <jack.yoo@skyworksinc.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-03-12 09:08:12 +00:00
Charles Keepax
e7ad27cac9 mfd: arizona: Add DT binding for the DMIC reference voltages
Add a DT binding that lets the DMIC reference voltage source be
specified for each input.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-03-12 09:08:01 +00:00
Jacek Anaszewski
224995d780 mfd: max77693: Modify flash cell name identifiers
Change flash cell identifiers from max77693-flash to max77693-led
to avoid confusion with NOR/NAND Flash.

Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-03-12 09:07:54 +00:00
Raymond Tan
60ae5b9f5c mfd: intel_quark_i2c_gpio: Add Intel Quark X1000 I2C-GPIO MFD Driver
In Quark X1000, there's a single PCI device that provides both
an I2C controller and a GPIO controller. This MFD driver will
split the 2 devices for their respective drivers.

This patch is based on Josef Ahmad's initial work for Quark enabling.

Acked-by: Michael Turquette <mturquette@linaro.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Weike Chen <alvin.chen@intel.com>
Signed-off-by: Raymond Tan <raymond.tan@intel.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-03-12 09:07:17 +00:00
Chris Zhong
e19f742885 mfd: rk808: Disable the under voltage detect
Rk808 has a under voltage detect function, when the voltage of buck is
under 85% the target voltage, the buck output will reset. But if the
power load is too heavy, this function maybe err, when current over
4.2A, although the voltage is normal, but RK808 mistakenly think it is
under 85%, and reset the buck. So let's disable this function.

Signed-off-by: Chris Zhong <zyw@rock-chips.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-03-12 09:07:10 +00:00
Joe Perches
9a503a7d9c mfd: ab8500-debugfs: Remove use of seq_printf return value
The seq_printf return value, because it's frequently misused,
will eventually be converted to void.

See: commit 1f33c41c03 ("seq_file: Rename seq_overflow() to
     seq_has_overflowed() and make public")

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-03-12 09:07:03 +00:00