Skip to content
Snippets Groups Projects
Commit 84e9c87e authored by Linus Torvalds's avatar Linus Torvalds
Browse files

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

Pull MFD updates from Lee Jones:
 "Changes to existing drivers:
   - Constify structures; throughout the subsystem
   - Move support to DT in; cros_ec
   - DT changes and documentation; cros-ec, max77693, max77686, arizona, da9063
   - ACPI changes and documentation; mfd-core
   - Use different platform specific API in; cros_ec_*, arizona-core
   - Remove unused parent field from; cros_ec_i2c
   - Add wake-up/reset delay in; cross_ec_spi, arizona-core
   - Staticise structures/functions in; cros_ec
   - Remove redundant code; arizona-core, max77686
   - Bugfix; twl4030-power
   - Allow compile test; aat2870, tps65910
   - MAINTAINERS adaptions; samsung, syscon
   - Resource Management (devm_*); arizona-core
   - Refactor Reset code; arizona-core
   - Insist on at least one full boot; arizona-core
   - Trivial formatting; arizona-core
   - Add low-power-sleep; arizona-core
   - IRQ ONESHOT changes; twl4030-irq, mc13xxx-core, wm831x-auxadc, htc-i2cpld,
                          wm8350-core, ab8500-debugfs, ab8500-gpadc, si476x-i2c

  (Re-)moved drivers:
   - Move protocol helpers out to drivers/platform; cros_ec

  New drivers/supported devices:
   - Add support for AXP22x into axp20x
   - Add support for OnKey into da9063-core
   - Add support for Pinctrl into mt6397-core
   - New STMicroelectronics LPC Watchdog driver
   - New STMicroelectronics LPC Real-Time Clock driver"

* tag 'mfd-for-linus-4.2' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (59 commits)
  mfd: lpc_ich: Assign subdevice ids automatically
  mfd: si476x-i2c: Pass the IRQF_ONESHOT flag
  mfd: ab8500-gpadc: Pass the IRQF_ONESHOT flag
  mfd: ab8500-debugfs: Pass the IRQF_ONESHOT flag
  mfd: wm8350-core: Pass the IRQF_ONESHOT flag
  mfd: htc-i2cpld: Pass the IRQF_ONESHOT flag
  mfd: wm831x-auxadc: Pass the IRQF_ONESHOT flag
  mfd: mc13xxx-core: Pass the IRQF_ONESHOT flag
  mfd: twl4030-irq: Pass the IRQF_ONESHOT flag
  mfd: mt6397-core: Add GPIO sub-module support
  mfd: arizona: Add convience defines for micd_rate/micd_bias_starttime
  mfd: dt: Add bindings for DA9063 OnKey
  mfd: da9063: Add support for OnKey driver
  mfd: arizona: Fix incorrect Makefile conditionals
  mfd: arizona: Add stub for wm5102_patch()
  mfd: Check ACPI device companion before checking resources
  Documentation: Add WM8998/WM1814 device tree bindings
  mfd: arizona: Split INx_MODE into two fields
  mfd: wm5110: Add delay before releasing reset line
  mfd: arizona: Add better support for system suspend
  ...
parents 7fe0bf90 1abf25a2
No related branches found
No related tags found
No related merge requests found
Showing
with 572 additions and 115 deletions
......@@ -10,6 +10,9 @@ Required properties:
"wlf,wm5110"
"wlf,wm8280"
"wlf,wm8997"
"wlf,wm8998"
"wlf,wm1814"
- reg : I2C slave address when connected using I2C, chip select number when
using SPI.
......@@ -31,10 +34,10 @@ Required properties:
as covered in Documentation/devicetree/bindings/regulator/regulator.txt
- DBVDD2-supply, DBVDD3-supply : Additional databus power supplies (wm5102,
wm5110, wm8280)
wm5110, wm8280, wm8998, wm1814)
- SPKVDDL-supply, SPKVDDR-supply : Speaker driver power supplies (wm5102,
wm5110, wm8280)
wm5110, wm8280, wm8998, wm1814)
- SPKVDD-supply : Speaker driver power supply (wm8997)
......@@ -53,8 +56,10 @@ Optional properties:
of input signals. Valid values are 0 (Differential), 1 (Single-ended) and
2 (Digital Microphone). If absent, INn_MODE registers set to 0 by default.
If present, values must be specified less than or equal to the number of
input singals. If values less than the number of input signals, elements
that has not been specifed are set to 0 by default.
input signals. If values less than the number of input signals, elements
that have not been specified are set to 0 by default. Entries are:
<IN1, IN2, IN3, IN4> (wm5102, wm5110, wm8280, wm8997)
<IN1A, IN2A, IN1B, IN2B> (wm8998, wm1814)
- wlf,dmic-ref : DMIC reference voltage source for each input, can be
selected from either MICVDD or one of the MICBIAS's, defines
......
AXP202/AXP209 device tree bindings
AXP family PMIC device tree bindings
The axp20x family current members :
axp202 (X-Powers)
axp209 (X-Powers)
axp221 (X-Powers)
Required properties:
- compatible: "x-powers,axp202" or "x-powers,axp209"
- compatible: "x-powers,axp202", "x-powers,axp209", "x-powers,axp221"
- reg: The I2C slave address for the AXP chip
- interrupt-parent: The parent interrupt controller
- interrupts: SoC NMI / GPIO interrupt connected to the PMIC's IRQ pin
- interrupt-controller: axp20x has its own internal IRQs
- interrupt-controller: The PMIC has its own internal IRQs
- #interrupt-cells: Should be set to 1
Optional properties:
......@@ -48,6 +49,31 @@ LDO3 : LDO : ldo3in-supply
LDO4 : LDO : ldo24in-supply : shared supply
LDO5 : LDO : ldo5in-supply
AXP221 regulators, type, and corresponding input supply names:
Regulator Type Supply Name Notes
--------- ---- ----------- -----
DCDC1 : DC-DC buck : vin1-supply
DCDC2 : DC-DC buck : vin2-supply
DCDC3 : DC-DC buck : vin3-supply
DCDC4 : DC-DC buck : vin4-supply
DCDC5 : DC-DC buck : vin5-supply
DC1SW : On/Off Switch : dcdc1-supply : DCDC1 secondary output
DC5LDO : LDO : dcdc5-supply : input from DCDC5
ALDO1 : LDO : aldoin-supply : shared supply
ALDO2 : LDO : aldoin-supply : shared supply
ALDO3 : LDO : aldoin-supply : shared supply
DLDO1 : LDO : dldoin-supply : shared supply
DLDO2 : LDO : dldoin-supply : shared supply
DLDO3 : LDO : dldoin-supply : shared supply
DLDO4 : LDO : dldoin-supply : shared supply
ELDO1 : LDO : eldoin-supply : shared supply
ELDO2 : LDO : eldoin-supply : shared supply
ELDO3 : LDO : eldoin-supply : shared supply
LDO_IO0 : LDO : ips-supply : GPIO 0
LDO_IO1 : LDO : ips-supply : GPIO 1
RTC_LDO : LDO : ips-supply : always on
Example:
axp209: pmic@34 {
......
......@@ -18,6 +18,10 @@ Required properties (SPI):
- reg: SPI chip select
Optional properties (SPI):
- google,cros-ec-spi-pre-delay: Some implementations of the EC need a little
time to wake up from sleep before they can receive SPI transfers at a high
clock rate. This property specifies the delay, in usecs, between the
assertion of the CS to the start of the first clock pulse.
- google,cros-ec-spi-msg-delay: Some implementations of the EC require some
additional processing time in order to accept new transactions. If the delay
between transactions is not long enough the EC may not be able to respond
......
......@@ -5,6 +5,7 @@ DA9093 consists of a large and varied group of sub-devices (I2C Only):
Device Supply Names Description
------ ------------ -----------
da9063-regulator : : LDOs & BUCKs
da9063-onkey : : On Key
da9063-rtc : : Real-Time Clock
da9063-watchdog : : Watchdog
......@@ -51,6 +52,18 @@ Sub-nodes:
the DA9063. There are currently no entries in this binding, however
compatible = "dlg,da9063-rtc" should be added if a node is created.
- onkey : This node defines the OnKey settings for controlling the key
functionality of the device. The node should contain the compatible property
with the value "dlg,da9063-onkey".
Optional onkey properties:
- dlg,disable-key-power : Disable power-down using a long key-press. If this
entry exists the OnKey driver will remove support for the KEY_POWER key
press. If this entry does not exist then by default the key-press
triggered power down is enabled and the OnKey will support both KEY_POWER
and KEY_SLEEP.
- watchdog : This node defines settings for the Watchdog timer associated
with the DA9063. There are currently no entries in this binding, however
compatible = "dlg,da9063-watchdog" should be added if a node is created.
......@@ -73,6 +86,11 @@ Example:
compatible = "dlg,da9063-watchdog";
};
onkey {
compatible = "dlg,da9063-onkey";
dlg,disable-key-power;
};
regulators {
DA9063_BCORE1: bcore1 {
regulator-name = "BCORE1";
......
Maxim MAX77686 multi-function device
MAX77686 is a Mulitifunction device with PMIC, RTC and Charger on chip. It is
MAX77686 is a Multifunction device with PMIC, RTC and Charger on chip. It is
interfaced to host controller using i2c interface. PMIC and Charger submodules
are addressed using same i2c slave address whereas RTC submodule uses
different i2c slave address,presently for which we are statically creating i2c
......
......@@ -76,7 +76,60 @@ Optional properties:
Valid values: 4300000, 4700000, 4800000, 4900000
Default: 4300000
- led : the LED submodule device node
There are two LED outputs available - FLED1 and FLED2. Each of them can
control a separate LED or they can be connected together to double
the maximum current for a single connected LED. One LED is represented
by one child node.
Required properties:
- compatible : Must be "maxim,max77693-led".
Optional properties:
- maxim,boost-mode :
In boost mode the device can produce up to 1.2A of total current
on both outputs. The maximum current on each output is reduced
to 625mA then. If not enabled explicitly, boost setting defaults to
LEDS_BOOST_FIXED in case both current sources are used.
Possible values:
LEDS_BOOST_OFF (0) - no boost,
LEDS_BOOST_ADAPTIVE (1) - adaptive mode,
LEDS_BOOST_FIXED (2) - fixed mode.
- maxim,boost-mvout : Output voltage of the boost module in millivolts.
Valid values: 3300 - 5500, step by 25 (rounded down)
Default: 3300
- maxim,mvsys-min : Low input voltage level in millivolts. Flash is not fired
if chip estimates that system voltage could drop below this level due
to flash power consumption.
Valid values: 2400 - 3400, step by 33 (rounded down)
Default: 2400
Required properties for the LED child node:
- led-sources : see Documentation/devicetree/bindings/leds/common.txt;
device current output identifiers: 0 - FLED1, 1 - FLED2
- led-max-microamp : see Documentation/devicetree/bindings/leds/common.txt
Valid values for a LED connected to one FLED output:
15625 - 250000, step by 15625 (rounded down)
Valid values for a LED connected to both FLED outputs:
15625 - 500000, step by 15625 (rounded down)
- flash-max-microamp : see Documentation/devicetree/bindings/leds/common.txt
Valid values for a single LED connected to one FLED output
(boost mode must be turned off):
15625 - 1000000, step by 15625 (rounded down)
Valid values for a single LED connected to both FLED outputs:
15625 - 1250000, step by 15625 (rounded down)
Valid values for two LEDs case:
15625 - 625000, step by 15625 (rounded down)
- flash-max-timeout-us : see Documentation/devicetree/bindings/leds/common.txt
Valid values: 62500 - 1000000, step by 62500 (rounded down)
Optional properties for the LED child node:
- label : see Documentation/devicetree/bindings/leds/common.txt
Example:
#include <dt-bindings/leds/common.h>
max77693@66 {
compatible = "maxim,max77693";
reg = <0x66>;
......@@ -117,5 +170,19 @@ Example:
maxim,thermal-regulation-celsius = <75>;
maxim,battery-overcurrent-microamp = <3000000>;
maxim,charge-input-threshold-microvolt = <4300000>;
led {
compatible = "maxim,max77693-led";
maxim,boost-mode = <LEDS_BOOST_FIXED>;
maxim,boost-mvout = <5000>;
maxim,mvsys-min = <2400>;
camera_flash: flash-led {
label = "max77693-flash";
led-sources = <0>, <1>;
led-max-microamp = <500000>;
flash-max-microamp = <1250000>;
flash-max-timeout-us = <1000000>;
};
};
};
STMicroelectronics Low Power Controller (LPC) - RTC
===================================================
LPC currently supports Watchdog OR Real Time Clock functionality.
[See: ../watchdog/st_lpc_wdt.txt for Watchdog options]
Required properties
- compatible : Must be one of: "st,stih407-lpc" "st,stih416-lpc"
"st,stih415-lpc" "st,stid127-lpc"
- reg : LPC registers base address + size
- interrupts : LPC interrupt line number and associated flags
- clocks : Clock used by LPC device (See: ../clock/clock-bindings.txt)
- st,lpc-mode : The LPC can run either one of two modes ST_LPC_MODE_RTC [0] or
ST_LPC_MODE_WDT [1]. One (and only one) mode must be
selected.
Example:
lpc@fde05000 {
compatible = "st,stih407-lpc";
reg = <0xfde05000 0x1000>;
clocks = <&clk_s_d3_flexgen CLK_LPC_0>;
st,lpc-mode = <ST_LPC_MODE_RTC>;
};
STMicroelectronics Low Power Controller (LPC) - Watchdog
========================================================
LPC currently supports Watchdog OR Real Time Clock functionality.
[See: ../rtc/rtc-st-lpc.txt for RTC options]
Required properties
- compatible : Must be one of: "st,stih407-lpc" "st,stih416-lpc"
"st,stih415-lpc" "st,stid127-lpc"
- reg : LPC registers base address + size
- interrupts : LPC interrupt line number and associated flags
- clocks : Clock used by LPC device (See: ../clock/clock-bindings.txt)
- st,lpc-mode : The LPC can run either one of two modes ST_LPC_MODE_RTC [0] or
ST_LPC_MODE_WDT [1]. One (and only one) mode must be
selected.
Required properties [watchdog mode]
- st,syscfg : Phandle to syscfg node used to enable watchdog and configure
CPU reset type.
- timeout-sec : Watchdog timeout in seconds
Optional properties [watchdog mode]
- st,warm-reset : If present reset type will be 'warm' - if not it will be cold
Example:
lpc@fde05000 {
compatible = "st,stih407-lpc";
reg = <0xfde05000 0x1000>;
clocks = <&clk_s_d3_flexgen CLK_LPC_0>;
st,syscfg = <&syscfg_core>;
timeout-sec = <120>;
st,lpc-mode = <ST_LPC_MODE_WDT>;
st,warm-reset;
};
......@@ -1489,10 +1489,12 @@ F: drivers/phy/phy-stih407-usb.c
F: drivers/phy/phy-stih41x-usb.c
F: drivers/pinctrl/pinctrl-st.c
F: drivers/reset/sti/
F: drivers/rtc/rtc-st-lpc.c
F: drivers/tty/serial/st-asc.c
F: drivers/usb/dwc3/dwc3-st.c
F: drivers/usb/host/ehci-st.c
F: drivers/usb/host/ohci-st.c
F: drivers/watchdog/st_lpc_wdt.c
F: drivers/ata/ahci_st.c
ARM/TECHNOLOGIC SYSTEMS TS7250 MACHINE SUPPORT
......@@ -8581,14 +8583,20 @@ L: linux-fbdev@vger.kernel.org
S: Maintained
F: drivers/video/fbdev/s3c-fb.c
SAMSUNG MULTIFUNCTION DEVICE DRIVERS
SAMSUNG MULTIFUNCTION PMIC DEVICE DRIVERS
M: Sangbeom Kim <sbkim73@samsung.com>
M: Krzysztof Kozlowski <k.kozlowski@samsung.com>
L: linux-kernel@vger.kernel.org
L: linux-samsung-soc@vger.kernel.org
S: Supported
F: drivers/mfd/sec*.c
F: drivers/regulator/s2m*.c
F: drivers/regulator/s5m*.c
F: drivers/clk/clk-s2mps11.c
F: drivers/rtc/rtc-s5m.c
F: include/linux/mfd/samsung/
F: Documentation/devicetree/bindings/regulator/s5m8767-regulator.txt
F: Documentation/devicetree/bindings/mfd/s2mp*.txt
SAMSUNG S5P/EXYNOS4 SOC SERIES CAMERA SUBSYSTEM DRIVERS
M: Kyungmin Park <kyungmin.park@samsung.com>
......@@ -9627,6 +9635,13 @@ F: arch/arc/
F: Documentation/devicetree/bindings/arc/
F: drivers/tty/serial/arc_uart.c
SYSTEM CONFIGURATION (SYSCON)
M: Lee Jones <lee.jones@linaro.org>
M: Arnd Bergmann <arnd@arndb.de>
T: git git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git
S: Supported
F: drivers/mfd/syscon.c
SYSV FILESYSTEM
M: Christoph Hellwig <hch@infradead.org>
S: Maintained
......
......@@ -1103,7 +1103,7 @@ config I2C_SIBYTE
config I2C_CROS_EC_TUNNEL
tristate "ChromeOS EC tunnel I2C bus"
depends on MFD_CROS_EC
depends on CROS_EC_PROTO
help
If you say yes here you get an I2C bus that will tunnel i2c commands
through to the other side of the ChromeOS EC to the i2c bus
......
......@@ -182,8 +182,9 @@ static int ec_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg i2c_msgs[],
const u16 bus_num = bus->remote_bus;
int request_len;
int response_len;
int alloc_size;
int result;
struct cros_ec_command msg = { };
struct cros_ec_command *msg;
request_len = ec_i2c_count_message(i2c_msgs, num);
if (request_len < 0) {
......@@ -198,25 +199,39 @@ static int ec_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg i2c_msgs[],
return response_len;
}
result = ec_i2c_construct_message(msg.outdata, i2c_msgs, num, bus_num);
if (result)
return result;
alloc_size = max(request_len, response_len);
msg = kmalloc(sizeof(*msg) + alloc_size, GFP_KERNEL);
if (!msg)
return -ENOMEM;
msg.version = 0;
msg.command = EC_CMD_I2C_PASSTHRU;
msg.outsize = request_len;
msg.insize = response_len;
result = ec_i2c_construct_message(msg->data, i2c_msgs, num, bus_num);
if (result) {
dev_err(dev, "Error constructing EC i2c message %d\n", result);
goto exit;
}
result = cros_ec_cmd_xfer(bus->ec, &msg);
if (result < 0)
return result;
msg->version = 0;
msg->command = EC_CMD_I2C_PASSTHRU;
msg->outsize = request_len;
msg->insize = response_len;
result = ec_i2c_parse_response(msg.indata, i2c_msgs, &num);
if (result < 0)
return result;
result = cros_ec_cmd_xfer(bus->ec, msg);
if (result < 0) {
dev_err(dev, "Error transferring EC i2c message %d\n", result);
goto exit;
}
result = ec_i2c_parse_response(msg->data, i2c_msgs, &num);
if (result < 0) {
dev_err(dev, "Error parsing EC i2c message %d\n", result);
goto exit;
}
/* Indicate success by saying how many messages were sent */
return num;
result = num;
exit:
kfree(msg);
return result;
}
static u32 ec_i2c_functionality(struct i2c_adapter *adap)
......
......@@ -677,7 +677,7 @@ config KEYBOARD_W90P910
config KEYBOARD_CROS_EC
tristate "ChromeOS EC keyboard"
select INPUT_MATRIXKMAP
depends on MFD_CROS_EC
depends on CROS_EC_PROTO
help
Say Y here to enable the matrix keyboard used by ChromeOS devices
and implemented on the ChromeOS EC. You must enable one bus option
......
......@@ -148,19 +148,28 @@ static void cros_ec_keyb_process(struct cros_ec_keyb *ckdev,
static int cros_ec_keyb_get_state(struct cros_ec_keyb *ckdev, uint8_t *kb_state)
{
int ret;
struct cros_ec_command msg = {
.command = EC_CMD_MKBP_STATE,
.insize = ckdev->cols,
};
int ret = 0;
struct cros_ec_command *msg;
ret = cros_ec_cmd_xfer(ckdev->ec, &msg);
if (ret < 0)
return ret;
msg = kmalloc(sizeof(*msg) + ckdev->cols, GFP_KERNEL);
if (!msg)
return -ENOMEM;
memcpy(kb_state, msg.indata, ckdev->cols);
msg->version = 0;
msg->command = EC_CMD_MKBP_STATE;
msg->insize = ckdev->cols;
msg->outsize = 0;
return 0;
ret = cros_ec_cmd_xfer(ckdev->ec, msg);
if (ret < 0) {
dev_err(ckdev->dev, "Error transferring EC message %d\n", ret);
goto exit;
}
memcpy(kb_state, msg->data, ckdev->cols);
exit:
kfree(msg);
return ret;
}
static irqreturn_t cros_ec_keyb_irq(int irq, void *data)
......@@ -266,7 +275,7 @@ static int cros_ec_keyb_probe(struct platform_device *pdev)
ckdev->dev = dev;
dev_set_drvdata(&pdev->dev, ckdev);
idev->name = ec->ec_name;
idev->name = CROS_EC_DEV_NAME;
idev->phys = ec->phys_name;
__set_bit(EV_REP, idev->evbit);
......
......@@ -566,7 +566,7 @@ static int pm860x_irq_domain_map(struct irq_domain *d, unsigned int virq,
return 0;
}
static struct irq_domain_ops pm860x_irq_domain_ops = {
static const struct irq_domain_ops pm860x_irq_domain_ops = {
.map = pm860x_irq_domain_map,
.xlate = irq_domain_xlate_onetwocell,
};
......
......@@ -52,7 +52,8 @@ config PMIC_ADP5520
config MFD_AAT2870_CORE
bool "AnalogicTech AAT2870"
select MFD_CORE
depends on I2C=y && GPIOLIB
depends on I2C=y
depends on GPIOLIB || COMPILE_TEST
help
If you say yes here you get support for the AAT2870.
This driver provides common support for accessing the device,
......@@ -94,6 +95,8 @@ config MFD_AXP20X
config MFD_CROS_EC
tristate "ChromeOS Embedded Controller"
select MFD_CORE
select CHROME_PLATFORMS
select CROS_EC_PROTO
help
If you say Y here you get support for the ChromeOS Embedded
Controller (EC) providing keyboard, battery and power services.
......@@ -102,7 +105,7 @@ config MFD_CROS_EC
config MFD_CROS_EC_I2C
tristate "ChromeOS Embedded Controller (I2C)"
depends on MFD_CROS_EC && I2C
depends on MFD_CROS_EC && CROS_EC_PROTO && I2C
help
If you say Y here, you get support for talking to the ChromeOS
......@@ -112,7 +115,7 @@ config MFD_CROS_EC_I2C
config MFD_CROS_EC_SPI
tristate "ChromeOS Embedded Controller (SPI)"
depends on MFD_CROS_EC && SPI && OF
depends on MFD_CROS_EC && CROS_EC_PROTO && SPI && OF
---help---
If you say Y here, you get support for talking to the ChromeOS EC
......@@ -1115,7 +1118,8 @@ config MFD_TPS6586X
config MFD_TPS65910
bool "TI TPS65910 Power Management chip"
depends on I2C=y && GPIOLIB
depends on I2C=y
depends on GPIOLIB || COMPILE_TEST
select MFD_CORE
select REGMAP_I2C
select REGMAP_IRQ
......
......@@ -39,13 +39,13 @@ obj-$(CONFIG_MFD_ARIZONA) += arizona-core.o
obj-$(CONFIG_MFD_ARIZONA) += arizona-irq.o
obj-$(CONFIG_MFD_ARIZONA_I2C) += arizona-i2c.o
obj-$(CONFIG_MFD_ARIZONA_SPI) += arizona-spi.o
ifneq ($(CONFIG_MFD_WM5102),n)
ifeq ($(CONFIG_MFD_WM5102),y)
obj-$(CONFIG_MFD_ARIZONA) += wm5102-tables.o
endif
ifneq ($(CONFIG_MFD_WM5110),n)
ifeq ($(CONFIG_MFD_WM5110),y)
obj-$(CONFIG_MFD_ARIZONA) += wm5110-tables.o
endif
ifneq ($(CONFIG_MFD_WM8997),n)
ifeq ($(CONFIG_MFD_WM8997),y)
obj-$(CONFIG_MFD_ARIZONA) += wm8997-tables.o
endif
obj-$(CONFIG_MFD_WM8400) += wm8400-core.o
......
......@@ -574,7 +574,7 @@ static int ab8500_irq_map(struct irq_domain *d, unsigned int virq,
return 0;
}
static struct irq_domain_ops ab8500_irq_ops = {
static const struct irq_domain_ops ab8500_irq_ops = {
.map = ab8500_irq_map,
.xlate = irq_domain_xlate_twocell,
};
......
......@@ -2885,7 +2885,7 @@ static ssize_t ab8500_subscribe_write(struct file *file,
}
err = request_threaded_irq(user_val, NULL, ab8500_debug_handler,
IRQF_SHARED | IRQF_NO_SUSPEND,
IRQF_SHARED | IRQF_NO_SUSPEND | IRQF_ONESHOT,
"ab8500-debug", &dev->kobj);
if (err < 0) {
pr_info("request_threaded_irq failed %d, %lu\n",
......
......@@ -948,7 +948,8 @@ static int ab8500_gpadc_probe(struct platform_device *pdev)
if (gpadc->irq_sw >= 0) {
ret = request_threaded_irq(gpadc->irq_sw, NULL,
ab8500_bm_gpadcconvend_handler,
IRQF_NO_SUSPEND | IRQF_SHARED, "ab8500-gpadc-sw",
IRQF_NO_SUSPEND | IRQF_SHARED | IRQF_ONESHOT,
"ab8500-gpadc-sw",
gpadc);
if (ret < 0) {
dev_err(gpadc->dev,
......@@ -961,7 +962,8 @@ static int ab8500_gpadc_probe(struct platform_device *pdev)
if (gpadc->irq_hw >= 0) {
ret = request_threaded_irq(gpadc->irq_hw, NULL,
ab8500_bm_gpadcconvend_handler,
IRQF_NO_SUSPEND | IRQF_SHARED, "ab8500-gpadc-hw",
IRQF_NO_SUSPEND | IRQF_SHARED | IRQF_ONESHOT,
"ab8500-gpadc-hw",
gpadc);
if (ret < 0) {
dev_err(gpadc->dev,
......
......@@ -250,20 +250,50 @@ static int arizona_wait_for_boot(struct arizona *arizona)
return ret;
}
static int arizona_apply_hardware_patch(struct arizona* arizona)
static inline void arizona_enable_reset(struct arizona *arizona)
{
if (arizona->pdata.reset)
gpio_set_value_cansleep(arizona->pdata.reset, 0);
}
static void arizona_disable_reset(struct arizona *arizona)
{
if (arizona->pdata.reset) {
switch (arizona->type) {
case WM5110:
case WM8280:
/* Meet requirements for minimum reset duration */
msleep(5);
break;
default:
break;
}
gpio_set_value_cansleep(arizona->pdata.reset, 1);
msleep(1);
}
}
struct arizona_sysclk_state {
unsigned int fll;
unsigned int sysclk;
};
static int arizona_enable_freerun_sysclk(struct arizona *arizona,
struct arizona_sysclk_state *state)
{
unsigned int fll, sysclk;
int ret, err;
/* Cache existing FLL and SYSCLK settings */
ret = regmap_read(arizona->regmap, ARIZONA_FLL1_CONTROL_1, &fll);
if (ret != 0) {
ret = regmap_read(arizona->regmap, ARIZONA_FLL1_CONTROL_1, &state->fll);
if (ret) {
dev_err(arizona->dev, "Failed to cache FLL settings: %d\n",
ret);
return ret;
}
ret = regmap_read(arizona->regmap, ARIZONA_SYSTEM_CLOCK_1, &sysclk);
if (ret != 0) {
ret = regmap_read(arizona->regmap, ARIZONA_SYSTEM_CLOCK_1,
&state->sysclk);
if (ret) {
dev_err(arizona->dev, "Failed to cache SYSCLK settings: %d\n",
ret);
return ret;
......@@ -272,7 +302,7 @@ static int arizona_apply_hardware_patch(struct arizona* arizona)
/* Start up SYSCLK using the FLL in free running mode */
ret = regmap_write(arizona->regmap, ARIZONA_FLL1_CONTROL_1,
ARIZONA_FLL1_ENA | ARIZONA_FLL1_FREERUN);
if (ret != 0) {
if (ret) {
dev_err(arizona->dev,
"Failed to start FLL in freerunning mode: %d\n",
ret);
......@@ -281,53 +311,137 @@ static int arizona_apply_hardware_patch(struct arizona* arizona)
ret = arizona_poll_reg(arizona, 25, ARIZONA_INTERRUPT_RAW_STATUS_5,
ARIZONA_FLL1_CLOCK_OK_STS,
ARIZONA_FLL1_CLOCK_OK_STS);
if (ret != 0) {
if (ret) {
ret = -ETIMEDOUT;
goto err_fll;
}
ret = regmap_write(arizona->regmap, ARIZONA_SYSTEM_CLOCK_1, 0x0144);
if (ret != 0) {
if (ret) {
dev_err(arizona->dev, "Failed to start SYSCLK: %d\n", ret);
goto err_fll;
}
return 0;
err_fll:
err = regmap_write(arizona->regmap, ARIZONA_FLL1_CONTROL_1, state->fll);
if (err)
dev_err(arizona->dev,
"Failed to re-apply old FLL settings: %d\n", err);
return ret;
}
static int arizona_disable_freerun_sysclk(struct arizona *arizona,
struct arizona_sysclk_state *state)
{
int ret;
ret = regmap_write(arizona->regmap, ARIZONA_SYSTEM_CLOCK_1,
state->sysclk);
if (ret) {
dev_err(arizona->dev,
"Failed to re-apply old SYSCLK settings: %d\n", ret);
return ret;
}
ret = regmap_write(arizona->regmap, ARIZONA_FLL1_CONTROL_1, state->fll);
if (ret) {
dev_err(arizona->dev,
"Failed to re-apply old FLL settings: %d\n", ret);
return ret;
}
return 0;
}
static int wm5102_apply_hardware_patch(struct arizona *arizona)
{
struct arizona_sysclk_state state;
int err, ret;
ret = arizona_enable_freerun_sysclk(arizona, &state);
if (ret)
return ret;
/* Start the write sequencer and wait for it to finish */
ret = regmap_write(arizona->regmap, ARIZONA_WRITE_SEQUENCER_CTRL_0,
ARIZONA_WSEQ_ENA | ARIZONA_WSEQ_START | 160);
if (ret != 0) {
ARIZONA_WSEQ_ENA | ARIZONA_WSEQ_START | 160);
if (ret) {
dev_err(arizona->dev, "Failed to start write sequencer: %d\n",
ret);
goto err_sysclk;
goto err;
}
ret = arizona_poll_reg(arizona, 5, ARIZONA_WRITE_SEQUENCER_CTRL_1,
ARIZONA_WSEQ_BUSY, 0);
if (ret != 0) {
if (ret) {
regmap_write(arizona->regmap, ARIZONA_WRITE_SEQUENCER_CTRL_0,
ARIZONA_WSEQ_ABORT);
ARIZONA_WSEQ_ABORT);
ret = -ETIMEDOUT;
}
err_sysclk:
err = regmap_write(arizona->regmap, ARIZONA_SYSTEM_CLOCK_1, sysclk);
if (err != 0) {
dev_err(arizona->dev,
"Failed to re-apply old SYSCLK settings: %d\n",
err);
}
err:
err = arizona_disable_freerun_sysclk(arizona, &state);
err_fll:
err = regmap_write(arizona->regmap, ARIZONA_FLL1_CONTROL_1, fll);
if (err != 0) {
return ret ?: err;
}
/*
* Register patch to some of the CODECs internal write sequences
* to ensure a clean exit from the low power sleep state.
*/
static const struct reg_default wm5110_sleep_patch[] = {
{ 0x337A, 0xC100 },
{ 0x337B, 0x0041 },
{ 0x3300, 0xA210 },
{ 0x3301, 0x050C },
};
static int wm5110_apply_sleep_patch(struct arizona *arizona)
{
struct arizona_sysclk_state state;
int err, ret;
ret = arizona_enable_freerun_sysclk(arizona, &state);
if (ret)
return ret;
ret = regmap_multi_reg_write_bypassed(arizona->regmap,
wm5110_sleep_patch,
ARRAY_SIZE(wm5110_sleep_patch));
err = arizona_disable_freerun_sysclk(arizona, &state);
return ret ?: err;
}
static int wm5102_clear_write_sequencer(struct arizona *arizona)
{
int ret;
ret = regmap_write(arizona->regmap, ARIZONA_WRITE_SEQUENCER_CTRL_3,
0x0);
if (ret) {
dev_err(arizona->dev,
"Failed to re-apply old FLL settings: %d\n",
err);
"Failed to clear write sequencer state: %d\n", ret);
return ret;
}
if (ret != 0)
arizona_enable_reset(arizona);
regulator_disable(arizona->dcvdd);
msleep(20);
ret = regulator_enable(arizona->dcvdd);
if (ret) {
dev_err(arizona->dev, "Failed to re-enable DCVDD: %d\n", ret);
return ret;
else
return err;
}
arizona_disable_reset(arizona);
return 0;
}
#ifdef CONFIG_PM
......@@ -338,12 +452,33 @@ static int arizona_runtime_resume(struct device *dev)
dev_dbg(arizona->dev, "Leaving AoD mode\n");
if (arizona->has_fully_powered_off) {
dev_dbg(arizona->dev, "Re-enabling core supplies\n");
ret = regulator_bulk_enable(arizona->num_core_supplies,
arizona->core_supplies);
if (ret) {
dev_err(dev, "Failed to enable core supplies: %d\n",
ret);
return ret;
}
}
ret = regulator_enable(arizona->dcvdd);
if (ret != 0) {
dev_err(arizona->dev, "Failed to enable DCVDD: %d\n", ret);
if (arizona->has_fully_powered_off)
regulator_bulk_disable(arizona->num_core_supplies,
arizona->core_supplies);
return ret;
}
if (arizona->has_fully_powered_off) {
arizona_disable_reset(arizona);
enable_irq(arizona->irq);
arizona->has_fully_powered_off = false;
}
regcache_cache_only(arizona->regmap, false);
switch (arizona->type) {
......@@ -366,14 +501,53 @@ static int arizona_runtime_resume(struct device *dev)
goto err;
}
ret = arizona_apply_hardware_patch(arizona);
if (ret != 0) {
ret = wm5102_apply_hardware_patch(arizona);
if (ret) {
dev_err(arizona->dev,
"Failed to apply hardware patch: %d\n",
ret);
goto err;
}
break;
case WM5110:
case WM8280:
ret = arizona_wait_for_boot(arizona);
if (ret)
goto err;
if (arizona->external_dcvdd) {
ret = regmap_update_bits(arizona->regmap,
ARIZONA_ISOLATION_CONTROL,
ARIZONA_ISOLATE_DCVDD1, 0);
if (ret) {
dev_err(arizona->dev,
"Failed to connect DCVDD: %d\n", ret);
goto err;
}
} else {
/*
* As this is only called for the internal regulator
* (where we know voltage ranges available) it is ok
* to request an exact range.
*/
ret = regulator_set_voltage(arizona->dcvdd,
1200000, 1200000);
if (ret < 0) {
dev_err(arizona->dev,
"Failed to set resume voltage: %d\n",
ret);
goto err;
}
}
ret = wm5110_apply_sleep_patch(arizona);
if (ret) {
dev_err(arizona->dev,
"Failed to re-apply sleep patch: %d\n",
ret);
goto err;
}
break;
default:
ret = arizona_wait_for_boot(arizona);
if (ret != 0) {
......@@ -410,10 +584,17 @@ static int arizona_runtime_resume(struct device *dev)
static int arizona_runtime_suspend(struct device *dev)
{
struct arizona *arizona = dev_get_drvdata(dev);
unsigned int val;
int ret;
dev_dbg(arizona->dev, "Entering AoD mode\n");
ret = regmap_read(arizona->regmap, ARIZONA_JACK_DETECT_ANALOGUE, &val);
if (ret) {
dev_err(dev, "Failed to check jack det status: %d\n", ret);
return ret;
}
if (arizona->external_dcvdd) {
ret = regmap_update_bits(arizona->regmap,
ARIZONA_ISOLATION_CONTROL,
......@@ -426,10 +607,56 @@ static int arizona_runtime_suspend(struct device *dev)
}
}
switch (arizona->type) {
case WM5110:
case WM8280:
if (arizona->external_dcvdd)
break;
/*
* As this is only called for the internal regulator
* (where we know voltage ranges available) it is ok
* to request an exact range.
*/
ret = regulator_set_voltage(arizona->dcvdd, 1175000, 1175000);
if (ret < 0) {
dev_err(arizona->dev,
"Failed to set suspend voltage: %d\n", ret);
return ret;
}
break;
case WM5102:
if (!(val & ARIZONA_JD1_ENA)) {
ret = regmap_write(arizona->regmap,
ARIZONA_WRITE_SEQUENCER_CTRL_3, 0x0);
if (ret) {
dev_err(arizona->dev,
"Failed to clear write sequencer: %d\n",
ret);
return ret;
}
}
break;
default:
break;
}
regcache_cache_only(arizona->regmap, true);
regcache_mark_dirty(arizona->regmap);
regulator_disable(arizona->dcvdd);
/* Allow us to completely power down if no jack detection */
if (!(val & ARIZONA_JD1_ENA)) {
dev_dbg(arizona->dev, "Fully powering off\n");
arizona->has_fully_powered_off = true;
disable_irq(arizona->irq);
arizona_enable_reset(arizona);
regulator_bulk_disable(arizona->num_core_supplies,
arizona->core_supplies);
}
return 0;
}
#endif
......@@ -728,9 +955,9 @@ int arizona_dev_init(struct arizona *arizona)
if (arizona->pdata.reset) {
/* Start out with /RESET low to put the chip into reset */
ret = gpio_request_one(arizona->pdata.reset,
GPIOF_DIR_OUT | GPIOF_INIT_LOW,
"arizona /RESET");
ret = devm_gpio_request_one(arizona->dev, arizona->pdata.reset,
GPIOF_DIR_OUT | GPIOF_INIT_LOW,
"arizona /RESET");
if (ret != 0) {
dev_err(dev, "Failed to request /RESET: %d\n", ret);
goto err_dcvdd;
......@@ -751,10 +978,7 @@ int arizona_dev_init(struct arizona *arizona)
goto err_enable;
}
if (arizona->pdata.reset) {
gpio_set_value_cansleep(arizona->pdata.reset, 1);
msleep(1);
}
arizona_disable_reset(arizona);
regcache_cache_only(arizona->regmap, false);
......@@ -777,8 +1001,6 @@ int arizona_dev_init(struct arizona *arizona)
/* If we have a /RESET GPIO we'll already be reset */
if (!arizona->pdata.reset) {
regcache_mark_dirty(arizona->regmap);
ret = regmap_write(arizona->regmap, ARIZONA_SOFTWARE_RESET, 0);
if (ret != 0) {
dev_err(dev, "Failed to reset device: %d\n", ret);
......@@ -786,12 +1008,6 @@ int arizona_dev_init(struct arizona *arizona)
}
msleep(1);
ret = regcache_sync(arizona->regmap);
if (ret != 0) {
dev_err(dev, "Failed to sync device: %d\n", ret);
goto err_reset;
}
}
/* Ensure device startup is complete */
......@@ -799,21 +1015,24 @@ int arizona_dev_init(struct arizona *arizona)
case WM5102:
ret = regmap_read(arizona->regmap,
ARIZONA_WRITE_SEQUENCER_CTRL_3, &val);
if (ret != 0)
if (ret) {
dev_err(dev,
"Failed to check write sequencer state: %d\n",
ret);
else if (val & 0x01)
break;
/* Fall through */
default:
ret = arizona_wait_for_boot(arizona);
if (ret != 0) {
dev_err(arizona->dev,
"Device failed initial boot: %d\n", ret);
goto err_reset;
} else if (val & 0x01) {
ret = wm5102_clear_write_sequencer(arizona);
if (ret)
return ret;
}
break;
default:
break;
}
ret = arizona_wait_for_boot(arizona);
if (ret) {
dev_err(arizona->dev, "Device failed initial boot: %d\n", ret);
goto err_reset;
}
/* Read the device ID information & do device specific stuff */
......@@ -891,14 +1110,24 @@ int arizona_dev_init(struct arizona *arizona)
switch (arizona->type) {
case WM5102:
ret = arizona_apply_hardware_patch(arizona);
if (ret != 0) {
ret = wm5102_apply_hardware_patch(arizona);
if (ret) {
dev_err(arizona->dev,
"Failed to apply hardware patch: %d\n",
ret);
goto err_reset;
}
break;
case WM5110:
case WM8280:
ret = wm5110_apply_sleep_patch(arizona);
if (ret) {
dev_err(arizona->dev,
"Failed to apply sleep patch: %d\n",
ret);
goto err_reset;
}
break;
default:
break;
}
......@@ -977,12 +1206,16 @@ int arizona_dev_init(struct arizona *arizona)
/* Default for both is 0 so noop with defaults */
val = arizona->pdata.dmic_ref[i]
<< ARIZONA_IN1_DMIC_SUP_SHIFT;
val |= arizona->pdata.inmode[i] << ARIZONA_IN1_MODE_SHIFT;
if (arizona->pdata.inmode[i] & ARIZONA_INMODE_DMIC)
val |= 1 << ARIZONA_IN1_MODE_SHIFT;
if (arizona->pdata.inmode[i] & ARIZONA_INMODE_SE)
val |= 1 << ARIZONA_IN1_SINGLE_ENDED_SHIFT;
regmap_update_bits(arizona->regmap,
ARIZONA_IN1L_CONTROL + (i * 8),
ARIZONA_IN1_DMIC_SUP_MASK |
ARIZONA_IN1_MODE_MASK, val);
ARIZONA_IN1_MODE_MASK |
ARIZONA_IN1_SINGLE_ENDED_MASK, val);
}
for (i = 0; i < ARIZONA_MAX_OUTPUT; i++) {
......@@ -1054,10 +1287,7 @@ int arizona_dev_init(struct arizona *arizona)
err_irq:
arizona_irq_exit(arizona);
err_reset:
if (arizona->pdata.reset) {
gpio_set_value_cansleep(arizona->pdata.reset, 0);
gpio_free(arizona->pdata.reset);
}
arizona_enable_reset(arizona);
regulator_disable(arizona->dcvdd);
err_enable:
regulator_bulk_disable(arizona->num_core_supplies,
......@@ -1082,8 +1312,7 @@ int arizona_dev_exit(struct arizona *arizona)
arizona_free_irq(arizona, ARIZONA_IRQ_OVERCLOCKED, arizona);
arizona_free_irq(arizona, ARIZONA_IRQ_CLKGEN_ERR, arizona);
arizona_irq_exit(arizona);
if (arizona->pdata.reset)
gpio_set_value_cansleep(arizona->pdata.reset, 0);
arizona_enable_reset(arizona);
regulator_bulk_disable(arizona->num_core_supplies,
arizona->core_supplies);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment