Skip to content

Commit 3ea172c

Browse files
committed
Merge tag 'mfd-next-4.20' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd
Pull MFD updates from Lee Jones: "New Drivers - Add support for USART SPI to AT91* New Functionality - Add support for Audio CODECs to motorola-cpcap Fix-ups - DT documentation fix-ups; atmel-usart - Staticise functions/structs; spi-at91-usart, arizona-core - Constify; ti-lmu - Fix memory leaks; menelaus - Change device 'wake-up' status; ti_am335x_tscadc, max8997 - Power Management (suspend/resume) semantic changes; ti_am335x_adc, cros_ec, max8997 - SPDX churn; sec-core (+ headers), max* (+ headers), intel* (+ headers), - Trivial (whitespace, email addresses, alphabetisise); Kconfig, adp5520, intel_soc_pmic_* - Build as module; sec-irq - Use new %pOFn printk format for device_node.name; max77620 - Remove unused code; madera - Use generic MACROs; intel_msic, intel_soc_pmic_crc - Move to GPIOD; ti-lmu - Use managed resources; ti-lmu Bug Fixes - Add missing headers; at91-usart - Prevent device from entering low-power mode; arizona-core - Poll for BOOT_DONE to avoid still-booting NACK; madera-core - Prevent ADC read from shutting down device; mc13xxx-core" * tag 'mfd-next-4.20' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (45 commits) mfd: cros_ec: Avoid unneeded internal declaration warning mfd: ti-lmu: Use of_device_get_match_data() helper mfd: ti-lmu: Use managed resource for everything mfd: ti-lmu: Switch to GPIOD mfd: ti-lmu: constify mfd_cell tables mfd: max8997: Disable interrupt handling for suspend/resume cycle mfd: max8997: Enale irq-wakeup unconditionally mfd: arizona: Make array mclk_name static, shrinks object size MAINTAINERS: Add myself as designated reviewer of Intel MFD PMIC mfd: Convert Intel PMIC drivers to use SPDX identifier 1;5201;0c Reduce size of duplicated comments by switching to use SPDX identifier. mfd: Sort headers alphabetically for Intel PMIC drivers mfd: intel_soc_pmic_bxtwc: Chain power button IRQs as well mfd: intel_soc_pmic_crc: Use REGMAP_IRQ_REG() macro mfd: intel_soc_pmic_crc: Use DEFINE_RES_IRQ_NAMED() macro mfd: intel_msic: Use DEFINE_RES_IRQ() macro mfd: motorola-cpcap: Add audio-codec support mfd: mc13xxx-core: Fix PMIC shutdown when reading ADC values mfd: madera: Remove unused forward reference mfd: max77620: Convert to using %pOFn instead of device_node.name mfd: madera: Don't use regmap_read_poll_timeout to poll for BOOT_DONE ...
2 parents 01aa9d5 + 6eb3578 commit 3ea172c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+1045
-733
lines changed

Documentation/devicetree/bindings/serial/atmel-usart.txt renamed to Documentation/devicetree/bindings/mfd/atmel-usart.txt

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
* Atmel Universal Synchronous Asynchronous Receiver/Transmitter (USART)
22

3-
Required properties:
3+
Required properties for USART:
44
- compatible: Should be "atmel,<chip>-usart" or "atmel,<chip>-dbgu"
55
The compatible <chip> indicated will be the first SoC to support an
66
additional mode or an USART new feature.
@@ -11,7 +11,13 @@ Required properties:
1111
Required elements: "usart"
1212
- clocks: phandles to input clocks.
1313

14-
Optional properties:
14+
Required properties for USART in SPI mode:
15+
- #size-cells : Must be <0>
16+
- #address-cells : Must be <1>
17+
- cs-gpios: chipselects (internal cs not supported)
18+
- atmel,usart-mode : Must be <AT91_USART_MODE_SPI> (found in dt-bindings/mfd/at91-usart.h)
19+
20+
Optional properties in serial mode:
1521
- atmel,use-dma-rx: use of PDC or DMA for receiving data
1622
- atmel,use-dma-tx: use of PDC or DMA for transmitting data
1723
- {rts,cts,dtr,dsr,rng,dcd}-gpios: specify a GPIO for RTS/CTS/DTR/DSR/RI/DCD line respectively.
@@ -62,3 +68,18 @@ Example:
6268
dma-names = "tx", "rx";
6369
atmel,fifo-size = <32>;
6470
};
71+
72+
- SPI mode:
73+
#include <dt-bindings/mfd/at91-usart.h>
74+
75+
spi0: spi@f001c000 {
76+
#address-cells = <1>;
77+
#size-cells = <0>;
78+
compatible = "atmel,at91rm9200-usart", "atmel,at91sam9260-usart";
79+
atmel,usart-mode = <AT91_USART_MODE_SPI>;
80+
reg = <0xf001c000 0x100>;
81+
interrupts = <12 IRQ_TYPE_LEVEL_HIGH 5>;
82+
clocks = <&usart0_clk>;
83+
clock-names = "usart";
84+
cs-gpios = <&pioB 3 0>;
85+
};

MAINTAINERS

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7546,6 +7546,14 @@ F: drivers/platform/x86/intel_punit_ipc.c
75467546
F: arch/x86/include/asm/intel_pmc_ipc.h
75477547
F: arch/x86/include/asm/intel_punit_ipc.h
75487548

7549+
INTEL MULTIFUNCTION PMIC DEVICE DRIVERS
7550+
R: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
7551+
S: Maintained
7552+
F: drivers/mfd/intel_msic.c
7553+
F: drivers/mfd/intel_soc_pmic*
7554+
F: include/linux/mfd/intel_msic.h
7555+
F: include/linux/mfd/intel_soc_pmic*
7556+
75497557
INTEL PRO/WIRELESS 2100, 2200BG, 2915ABG NETWORK CONNECTION SUPPORT
75507558
M: Stanislav Yakovlev <stas.yakovlev@gmail.com>
75517559
L: linux-wireless@vger.kernel.org
@@ -9589,6 +9597,7 @@ M: Richard Genoud <richard.genoud@gmail.com>
95899597
S: Maintained
95909598
F: drivers/tty/serial/atmel_serial.c
95919599
F: drivers/tty/serial/atmel_serial.h
9600+
F: Documentation/devicetree/bindings/mfd/atmel-usart.txt
95929601

95939602
MICROCHIP / ATMEL DMA DRIVER
95949603
M: Ludovic Desroches <ludovic.desroches@microchip.com>
@@ -9620,6 +9629,21 @@ S: Supported
96209629
F: drivers/mtd/nand/raw/atmel/*
96219630
F: Documentation/devicetree/bindings/mtd/atmel-nand.txt
96229631

9632+
MICROCHIP AT91 USART MFD DRIVER
9633+
M: Radu Pirea <radu_nicolae.pirea@upb.ro>
9634+
L: linux-kernel@vger.kernel.org
9635+
S: Supported
9636+
F: drivers/mfd/at91-usart.c
9637+
F: include/dt-bindings/mfd/at91-usart.h
9638+
F: Documentation/devicetree/bindings/mfd/atmel-usart.txt
9639+
9640+
MICROCHIP AT91 USART SPI DRIVER
9641+
M: Radu Pirea <radu_nicolae.pirea@upb.ro>
9642+
L: linux-spi@vger.kernel.org
9643+
S: Supported
9644+
F: drivers/spi/spi-at91-usart.c
9645+
F: Documentation/devicetree/bindings/mfd/atmel-usart.txt
9646+
96239647
MICROCHIP KSZ SERIES ETHERNET SWITCH DRIVER
96249648
M: Woojung Huh <Woojung.Huh@microchip.com>
96259649
M: Microchip Linux Driver Support <UNGLinuxDriver@microchip.com>

drivers/iio/adc/ti_am335x_adc.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -693,16 +693,12 @@ static int __maybe_unused tiadc_suspend(struct device *dev)
693693
{
694694
struct iio_dev *indio_dev = dev_get_drvdata(dev);
695695
struct tiadc_device *adc_dev = iio_priv(indio_dev);
696-
struct ti_tscadc_dev *tscadc_dev;
697696
unsigned int idle;
698697

699-
tscadc_dev = ti_tscadc_dev_get(to_platform_device(dev));
700-
if (!device_may_wakeup(tscadc_dev->dev)) {
701-
idle = tiadc_readl(adc_dev, REG_CTRL);
702-
idle &= ~(CNTRLREG_TSCSSENB);
703-
tiadc_writel(adc_dev, REG_CTRL, (idle |
704-
CNTRLREG_POWERDOWN));
705-
}
698+
idle = tiadc_readl(adc_dev, REG_CTRL);
699+
idle &= ~(CNTRLREG_TSCSSENB);
700+
tiadc_writel(adc_dev, REG_CTRL, (idle |
701+
CNTRLREG_POWERDOWN));
706702

707703
return 0;
708704
}

drivers/input/touchscreen/ti_am335x_tsc.c

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include <linux/of.h>
2828
#include <linux/of_device.h>
2929
#include <linux/sort.h>
30+
#include <linux/pm_wakeirq.h>
3031

3132
#include <linux/mfd/ti_am335x_tscadc.h>
3233

@@ -46,6 +47,7 @@ static const int config_pins[] = {
4647
struct titsc {
4748
struct input_dev *input;
4849
struct ti_tscadc_dev *mfd_tscadc;
50+
struct device *dev;
4951
unsigned int irq;
5052
unsigned int wires;
5153
unsigned int x_plate_resistance;
@@ -276,7 +278,7 @@ static irqreturn_t titsc_irq(int irq, void *dev)
276278
if (status & IRQENB_HW_PEN) {
277279
ts_dev->pen_down = true;
278280
irqclr |= IRQENB_HW_PEN;
279-
pm_stay_awake(ts_dev->mfd_tscadc->dev);
281+
pm_stay_awake(ts_dev->dev);
280282
}
281283

282284
if (status & IRQENB_PENUP) {
@@ -286,7 +288,7 @@ static irqreturn_t titsc_irq(int irq, void *dev)
286288
input_report_key(input_dev, BTN_TOUCH, 0);
287289
input_report_abs(input_dev, ABS_PRESSURE, 0);
288290
input_sync(input_dev);
289-
pm_relax(ts_dev->mfd_tscadc->dev);
291+
pm_relax(ts_dev->dev);
290292
} else {
291293
ts_dev->pen_down = true;
292294
}
@@ -422,6 +424,7 @@ static int titsc_probe(struct platform_device *pdev)
422424
ts_dev->mfd_tscadc = tscadc_dev;
423425
ts_dev->input = input_dev;
424426
ts_dev->irq = tscadc_dev->irq;
427+
ts_dev->dev = &pdev->dev;
425428

426429
err = titsc_parse_dt(pdev, ts_dev);
427430
if (err) {
@@ -436,6 +439,11 @@ static int titsc_probe(struct platform_device *pdev)
436439
goto err_free_mem;
437440
}
438441

442+
device_init_wakeup(&pdev->dev, true);
443+
err = dev_pm_set_wake_irq(&pdev->dev, ts_dev->irq);
444+
if (err)
445+
dev_err(&pdev->dev, "irq wake enable failed.\n");
446+
439447
titsc_writel(ts_dev, REG_IRQSTATUS, TSC_IRQENB_MASK);
440448
titsc_writel(ts_dev, REG_IRQENABLE, IRQENB_FIFO0THRES);
441449
titsc_writel(ts_dev, REG_IRQENABLE, IRQENB_EOS);
@@ -467,6 +475,8 @@ static int titsc_probe(struct platform_device *pdev)
467475
return 0;
468476

469477
err_free_irq:
478+
dev_pm_clear_wake_irq(&pdev->dev);
479+
device_init_wakeup(&pdev->dev, false);
470480
free_irq(ts_dev->irq, ts_dev);
471481
err_free_mem:
472482
input_free_device(input_dev);
@@ -479,6 +489,8 @@ static int titsc_remove(struct platform_device *pdev)
479489
struct titsc *ts_dev = platform_get_drvdata(pdev);
480490
u32 steps;
481491

492+
dev_pm_clear_wake_irq(&pdev->dev);
493+
device_init_wakeup(&pdev->dev, false);
482494
free_irq(ts_dev->irq, ts_dev);
483495

484496
/* total steps followed by the enable mask */
@@ -499,7 +511,7 @@ static int __maybe_unused titsc_suspend(struct device *dev)
499511
unsigned int idle;
500512

501513
tscadc_dev = ti_tscadc_dev_get(to_platform_device(dev));
502-
if (device_may_wakeup(tscadc_dev->dev)) {
514+
if (device_may_wakeup(dev)) {
503515
titsc_writel(ts_dev, REG_IRQSTATUS, TSC_IRQENB_MASK);
504516
idle = titsc_readl(ts_dev, REG_IRQENABLE);
505517
titsc_writel(ts_dev, REG_IRQENABLE,
@@ -515,11 +527,11 @@ static int __maybe_unused titsc_resume(struct device *dev)
515527
struct ti_tscadc_dev *tscadc_dev;
516528

517529
tscadc_dev = ti_tscadc_dev_get(to_platform_device(dev));
518-
if (device_may_wakeup(tscadc_dev->dev)) {
530+
if (device_may_wakeup(dev)) {
519531
titsc_writel(ts_dev, REG_IRQWAKEUP,
520532
0x00);
521533
titsc_writel(ts_dev, REG_IRQCLR, IRQENB_HW_PEN);
522-
pm_relax(ts_dev->mfd_tscadc->dev);
534+
pm_relax(dev);
523535
}
524536
titsc_step_config(ts_dev);
525537
titsc_writel(ts_dev, REG_FIFO0THR,

drivers/mfd/Kconfig

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,15 @@ config MFD_AAT2870_CORE
9999
additional drivers must be enabled in order to use the
100100
functionality of the device.
101101

102+
config MFD_AT91_USART
103+
tristate "AT91 USART Driver"
104+
select MFD_CORE
105+
help
106+
Select this to get support for AT91 USART IP. This is a wrapper
107+
over at91-usart-serial driver and usart-spi-driver. Only one function
108+
can be used at a time. The choice is done at boot time by the probe
109+
function of this MFD driver according to a device tree property.
110+
102111
config MFD_ATMEL_FLEXCOM
103112
tristate "Atmel Flexcom (Flexible Serial Communication Unit)"
104113
select MFD_CORE
@@ -1023,16 +1032,23 @@ config MFD_RN5T618
10231032
functionality of the device.
10241033

10251034
config MFD_SEC_CORE
1026-
bool "SAMSUNG Electronics PMIC Series Support"
1035+
tristate "SAMSUNG Electronics PMIC Series Support"
10271036
depends on I2C=y
10281037
select MFD_CORE
10291038
select REGMAP_I2C
10301039
select REGMAP_IRQ
10311040
help
1032-
Support for the Samsung Electronics MFD series.
1033-
This driver provides common support for accessing the device,
1034-
additional drivers must be enabled in order to use the functionality
1035-
of the device
1041+
Support for the Samsung Electronics PMIC devices coming
1042+
usually along with Samsung Exynos SoC chipset.
1043+
This driver provides common support for accessing the device,
1044+
additional drivers must be enabled in order to use the functionality
1045+
of the device
1046+
1047+
To compile this driver as a module, choose M here: the
1048+
module will be called sec-core.
1049+
Have in mind that important core drivers (like regulators) depend
1050+
on this driver so building this as a module might require proper
1051+
initial ramdisk or might not boot up as well in certain scenarios.
10361052

10371053
config MFD_SI476X_CORE
10381054
tristate "Silicon Laboratories 4761/64/68 AM/FM radio."

drivers/mfd/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ obj-$(CONFIG_MFD_SPMI_PMIC) += qcom-spmi-pmic.o
196196
obj-$(CONFIG_TPS65911_COMPARATOR) += tps65911-comparator.o
197197
obj-$(CONFIG_MFD_TPS65090) += tps65090.o
198198
obj-$(CONFIG_MFD_AAT2870_CORE) += aat2870-core.o
199+
obj-$(CONFIG_MFD_AT91_USART) += at91-usart.o
199200
obj-$(CONFIG_MFD_ATMEL_FLEXCOM) += atmel-flexcom.o
200201
obj-$(CONFIG_MFD_ATMEL_HLCDC) += atmel-hlcdc.o
201202
obj-$(CONFIG_MFD_ATMEL_SMC) += atmel-smc.o

drivers/mfd/adp5520.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,6 @@ static struct i2c_driver adp5520_driver = {
360360

361361
module_i2c_driver(adp5520_driver);
362362

363-
MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>");
363+
MODULE_AUTHOR("Michael Hennerich <michael.hennerich@analog.com>");
364364
MODULE_DESCRIPTION("ADP5520(01) PMIC-MFD Driver");
365365
MODULE_LICENSE("GPL");

drivers/mfd/arizona-core.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,10 @@ int arizona_clk32k_enable(struct arizona *arizona)
5252
if (ret != 0)
5353
goto err_ref;
5454
ret = clk_prepare_enable(arizona->mclk[ARIZONA_MCLK1]);
55-
if (ret != 0)
56-
goto err_pm;
55+
if (ret != 0) {
56+
pm_runtime_put_sync(arizona->dev);
57+
goto err_ref;
58+
}
5759
break;
5860
case ARIZONA_32KZ_MCLK2:
5961
ret = clk_prepare_enable(arizona->mclk[ARIZONA_MCLK2]);
@@ -67,8 +69,6 @@ int arizona_clk32k_enable(struct arizona *arizona)
6769
ARIZONA_CLK_32K_ENA);
6870
}
6971

70-
err_pm:
71-
pm_runtime_put_sync(arizona->dev);
7272
err_ref:
7373
if (ret != 0)
7474
arizona->clk32k_ref--;
@@ -990,7 +990,7 @@ static const struct mfd_cell wm8998_devs[] = {
990990

991991
int arizona_dev_init(struct arizona *arizona)
992992
{
993-
const char * const mclk_name[] = { "mclk1", "mclk2" };
993+
static const char * const mclk_name[] = { "mclk1", "mclk2" };
994994
struct device *dev = arizona->dev;
995995
const char *type_name = NULL;
996996
unsigned int reg, val;

drivers/mfd/at91-usart.c

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
/*
3+
* Driver for AT91 USART
4+
*
5+
* Copyright (C) 2018 Microchip Technology
6+
*
7+
* Author: Radu Pirea <radu.pirea@microchip.com>
8+
*
9+
*/
10+
11+
#include <dt-bindings/mfd/at91-usart.h>
12+
13+
#include <linux/module.h>
14+
#include <linux/mfd/core.h>
15+
#include <linux/of.h>
16+
#include <linux/property.h>
17+
18+
static struct mfd_cell at91_usart_spi_subdev = {
19+
.name = "at91_usart_spi",
20+
.of_compatible = "microchip,at91sam9g45-usart-spi",
21+
};
22+
23+
static struct mfd_cell at91_usart_serial_subdev = {
24+
.name = "atmel_usart_serial",
25+
.of_compatible = "atmel,at91rm9200-usart-serial",
26+
};
27+
28+
static int at91_usart_mode_probe(struct platform_device *pdev)
29+
{
30+
struct mfd_cell cell;
31+
u32 opmode = AT91_USART_MODE_SERIAL;
32+
33+
device_property_read_u32(&pdev->dev, "atmel,usart-mode", &opmode);
34+
35+
switch (opmode) {
36+
case AT91_USART_MODE_SPI:
37+
cell = at91_usart_spi_subdev;
38+
break;
39+
case AT91_USART_MODE_SERIAL:
40+
cell = at91_usart_serial_subdev;
41+
break;
42+
default:
43+
dev_err(&pdev->dev, "atmel,usart-mode has an invalid value %u\n",
44+
opmode);
45+
return -EINVAL;
46+
}
47+
48+
return devm_mfd_add_devices(&pdev->dev, PLATFORM_DEVID_AUTO, &cell, 1,
49+
NULL, 0, NULL);
50+
}
51+
52+
static const struct of_device_id at91_usart_mode_of_match[] = {
53+
{ .compatible = "atmel,at91rm9200-usart" },
54+
{ .compatible = "atmel,at91sam9260-usart" },
55+
{ /* sentinel */ }
56+
};
57+
58+
MODULE_DEVICE_TABLE(of, at91_usart_mode_of_match);
59+
60+
static struct platform_driver at91_usart_mfd = {
61+
.probe = at91_usart_mode_probe,
62+
.driver = {
63+
.name = "at91_usart_mode",
64+
.of_match_table = at91_usart_mode_of_match,
65+
},
66+
};
67+
68+
module_platform_driver(at91_usart_mfd);
69+
70+
MODULE_AUTHOR("Radu Pirea <radu.pirea@microchip.com>");
71+
MODULE_DESCRIPTION("AT91 USART MFD driver");
72+
MODULE_LICENSE("GPL v2");

drivers/mfd/cros_ec.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,8 @@ EXPORT_SYMBOL(cros_ec_suspend);
218218

219219
static void cros_ec_report_events_during_suspend(struct cros_ec_device *ec_dev)
220220
{
221-
while (cros_ec_get_next_event(ec_dev, NULL) > 0)
221+
while (ec_dev->mkbp_event_supported &&
222+
cros_ec_get_next_event(ec_dev, NULL) > 0)
222223
blocking_notifier_call_chain(&ec_dev->event_notifier,
223224
1, ec_dev);
224225
}

0 commit comments

Comments
 (0)