Skip to contentSkip to conversation

Add AMS AS3722 mfd, pincontrol and RTC driver.

PATCH Superseded Laxman Dewangan 6 participants 11 messages Oct 9, 2013 – Oct 22, 2013

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

v5 cover Add AMS AS3722 mfd, pincontrol and RTC driver.

This series add the driver support for AMS AS3722 PMIC. The driver includes MFD, pincontrol and GPIO, regulator and RTC.

Changes from V1:
- Remove compatible string from DT for subnode.
- Add macro in regmap.h for definign range.
- Nit cleanups in driver and use module_i2c_driver/module_platform_driver.
- Use linear_range and added regulator_map_* on regulators.
- Move OC configuration to regulator_current limit setting.
- Get rid of clk32k out configuration from RTC. Will add clock driver.

Changes from V2:
- Drop the already applied patches on V2 series
regmap: add helper macro to set min/max range of register
regulator: as3722: add regulator driver for AMS AS3722
- Move the GPIo driver to pincontrol driver to expose the pin configuration through pincontrol.
- rewrite the DT binding of the mfd.

Changes from V3:
- Change AMS to ams
- combine DT of regulator, pincontrol to the mfd.
- Taken care of Lee's nits feedback.

Changes from V4:
- Rephrased the DT binding document.
- Add header for dt-binding macros.

Laxman Dewangan (3):
mfd: add support for ams AS3722 PMIC
pincntrl: add support for ams AS3722 pin control driver drivers/rtc/rtc-as3722: add RTC driver

 Documentation/devicetree/bindings/mfd/as3722.txt |  194 +++++++
 drivers/mfd/Kconfig                              |   12 +
 drivers/mfd/Makefile                             |    1 +
 drivers/mfd/as3722.c                             |  449 +++++++++++++++
 drivers/pinctrl/Kconfig                          |   11 +
 drivers/pinctrl/Makefile                         |    1 +
 drivers/pinctrl/pinctrl-as3722.c                 |  630 ++++++++++++++++++++++
 drivers/rtc/Kconfig                              |   10 +
 drivers/rtc/Makefile                             |    1 +
 drivers/rtc/rtc-as3722.c                         |  296 ++++++++++
 include/dt-bindings/mfd/as3722.h                 |   52 ++
 include/linux/mfd/as3722.h                       |  423 +++++++++++++++
 12 files changed, 2080 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mfd/as3722.txt
 create mode 100644 drivers/mfd/as3722.c
 create mode 100644 drivers/pinctrl/pinctrl-as3722.c
 create mode 100644 drivers/rtc/rtc-as3722.c
 create mode 100644 include/dt-bindings/mfd/as3722.h
 create mode 100644 include/linux/mfd/as3722.h
#1 lore raw

PATCH v5 1/3 mfd: add support for ams AS3722 PMIC

The ams AS3722 is a compact system PMU suitable for mobile phones, tablets etc. It has 4 DC/DC step-down regulators, 3 DC/DC step-down controller, 11 LDOs, RTC, automatic battery, temperature and over-current monitoring, 8 GPIOs, ADC and a watchdog.

Add MFD core driver for the AS3722 to support core functionality.

---
Changes from V1:
- Remove compatible string from DT for subnode.
- Nit cleanups in driver and use module_i2c_driver

Changes from V2:
- Change DT file to reflect the changes in gpio/pincntrl driver. Now there is no extra subnode.

Changes from V3:
- Combine DT of pincontrol and regulator to mfd.
- Nits cleanups.
- AMS to ams.

Changes from V4:
- Rephrased the dt binding documents.
- Added dt-binding header for DTS file.
- Fix some of indention issue in dt documents.

 Documentation/devicetree/bindings/mfd/as3722.txt |  194 ++++++++++
 drivers/mfd/Kconfig                              |   12 +
 drivers/mfd/Makefile                             |    1 +
 drivers/mfd/as3722.c                             |  449 ++++++++++++++++++++++
 include/dt-bindings/mfd/as3722.h                 |   52 +++
 include/linux/mfd/as3722.h                       |  423 ++++++++++++++++++++
 6 files changed, 1131 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mfd/as3722.txt
 create mode 100644 drivers/mfd/as3722.c
 create mode 100644 include/dt-bindings/mfd/as3722.h
 create mode 100644 include/linux/mfd/as3722.h
Documentation/devicetree/bindings/mfd/as3722.txt new file +194 -0
new file mode 100644
index 0000000..fc2191e
@@ -0,0 +1,194 @@
+* ams AS3722 Power management IC.
+
+Required properties:
+-------------------
+- compatible: Must be "ams,as3722".
+- reg: I2C device address.
+- interrupt-controller: AS3722 has internal interrupt controller which takes the
+  interrupt request from internal sub-blocks like RTC, regulators, GPIOs as well
+  as external input.
+- #interrupt-cells: Should be set to 2 for IRQ number and flags.
+  The first cell is the IRQ number. IRQ numbers for different interrupt source
+  of AS3722 are defined at dt-bindings/mfd/as3722.h
+  The second cell is the flags, encoded as the trigger masks from binding document
+	interrupts.txt, using dt-bindings/irq.
+
+Optional submodule and their properties:
+=======================================
+
+Pinmux and GPIO:
+===============
+Device has 8 GPIO pins which can be configured as GPIO as well as the special IO
+functions.
+
+Please refer to pinctrl-bindings.txt in this directory for details of the
+common pinctrl bindings used by client devices, including the meaning of the
+phrase "pin configuration node".
+
+Following are properties which is needed if GPIO and pinmux functionality
+is required:
+    Required properties:
+    -------------------
+	- gpio-controller: Marks the device node as a GPIO controller.
+	- #gpio-cells: Number of GPIO cells. Refer to binding document
+			gpio/gpio.txt
+
+    Optional properties:
+    --------------------
+	Following properties are require if pin control setting is required
+	at boot.
+	- pinctrl-names: A pinctrl state named "default" be defined, using the
+		bindings in pinctrl/pinctrl-binding.txt.
+	- pinctrl[0...n]: Properties to contain the phandle that refer to
+		different nodes of pin control settings. These nodes represents
+		the pin control setting of state 0 to state n. Each of these
+		nodes contains different subnodes to represents some desired
+		configuration for a list of pins. This configuration can
+		include the mux function to select on those pin(s), and
+		various pin configuration parameters, such as pull-up,
+		open drain.
+
+		Each subnode have following properties:
+		Required properties:
+		    - pins: List of pins. Valid values of pins properties are:
+				gpio0, gpio1, gpio2, gpio3, gpio4, gpio5,
+				gpio6, gpio7
+
+		Optional properties:
+			function, bias-disable, bias-pull-up, bias-pull-down,
+			bias-high-impedance, drive-open-drain.
+
+			Valid values for function properties are:
+				gpio, interrupt-out, gpio-in-interrupt,
+				vsup-vbat-low-undebounce-out,
+				vsup-vbat-low-debounce-out,
+				voltage-in-standby, oc-pg-sd0, oc-pg-sd6,
+				powergood-out, pwm-in, pwm-out, clk32k-out,
+				watchdog-in, soft-reset-in
+
+Regulators:
+===========
+Device has multiple DCDC and LDOs. The node "regulators" is require if regulator
+functionality is needed.
+
+Following are properties of regulator subnode.
+
+    Optional properties:
+    -------------------
+	The input supply of regulators are the optional properties on the
+	regulator node. The input supply of these regulators are provided
+	through following properties:
+		vsup-sd2-supply: Input supply for SD2.
+		vsup-sd3-supply: Input supply for SD3.
+		vsup-sd4-supply: Input supply for SD4.
+		vsup-sd5-supply: Input supply for SD5.
+		vin-ldo0-supply: Input supply for LDO0.
+		vin-ldo1-6-supply: Input supply for LDO1 and LDO6.
+		vin-ldo2-5-7-supply: Input supply for LDO2, LDO5 and LDO7.
+		vin-ldo3-4-supply: Input supply for LDO3 and LDO4.
+		vin-ldo9-10-supply: Input supply for LDO9 and LDO10.
+		vin-ldo11-supply: Input supply for LDO11.
+
+    Optional sub nodes for regulators:
+    ---------------------------------
+	The subnodes name is the name of regulator and it must be one of:
+	sd[0-6], ldo[0-7], ldo[9-11]
+
+	Each sub-node should contain the constraints and initialization
+	information for that regulator. See regulator.txt for a description
+	of standard properties for these sub-nodes.
+	Additional optional custom properties  are listed below.
+		ams,ext-control: External control of the rail. The option of
+			this properties will tell which external input is
+			controlling this rail. Valid values are 0, 1, 2 ad 3.
+			0: There is no external control of this rail.
+			1: Rail is controlled by ENABLE1 input pin.
+			2: Rail is controlled by ENABLE2 input pin.
+			3: Rail is controlled by ENABLE3 input pin.
+			Missing this property on DT will be assume as no
+			external control. The external control pin macros
+			are defined @dt-bindings/mfd/as3722.h
+
+		ams,enable-tracking: Enable tracking with SD1, only supported
+			by LDO3.
+
+Example:
+--------
+#include <dt-bindings/mfd/as3722.h>
+...
+ams3722 {
+	compatible = "ams,as3722";
+	reg = <0x48>;
+
+	interrupt-parent = <&intc>;
+	interrupt-controller;
+	#interrupt-cells = <2>;
+
+	gpio-controller;
+	#gpio-cells = <2>;
+
+	pinctrl-names = "default";
+	pinctrl-0 = <&as3722_default>;
+
+	as3722_default: pinmux {
+			gpio0 {
+				pins = "gpio0";
+				function = "gpio";
+				bias-pull-down;
+			};
+
+			gpio1_2_4_7 {
+				pins = "gpio1", "gpio2", "gpio4", "gpio7";
+				function = "gpio";
+				bias-pull-up;
+			};
+
+			gpio5 {
+				pins = "gpio5";
+				function = "clk32k_out";
+			};
+	}
+
+	regulators {
+			vsup-sd2-supply = <...>;
+			...
+
+			sd0 {
+				regulator-name = "vdd_cpu";
+				regulator-min-microvolt = <700000>;
+				regulator-max-microvolt = <1400000>;
+				regulator-always-on;
+				ams,ext-control = <2>;
+			};
+
+			sd1 {
+				regulator-name = "vdd_core";
+				regulator-min-microvolt = <700000>;
+				regulator-max-microvolt = <1400000>;
+				regulator-always-on;
+				ams,ext-control = <1>;
+			};
+
+			sd2 {
+				regulator-name = "vddio_ddr";
+				regulator-min-microvolt = <1350000>;
+				regulator-max-microvolt = <1350000>;
+				regulator-always-on;
+			};
+
+			sd4 {
+				regulator-name = "avdd-hdmi-pex";
+				regulator-min-microvolt = <1050000>;
+				regulator-max-microvolt = <1050000>;
+				regulator-always-on;
+			};
+
+			sd5 {
+				regulator-name = "vdd-1v8";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+				regulator-always-on;
+			};
+			....
+	};
+};
drivers/mfd/Kconfig +12 -0
index d078fe4..b7c74a7 100644
@@ -27,6 +27,18 @@ config MFD_AS3711
 	help
 	  Support for the AS3711 PMIC from AMS
 
+config MFD_AS3722
+	bool "ams AS3722 Power Management IC"
+	select MFD_CORE
+	select REGMAP_I2C
+	select REGMAP_IRQ
+	depends on I2C && OF
+	help
+	  The ams AS3722 is a compact system PMU suitable for mobile phones,
+	  tablets etc. It has 4 DC/DC step-down regulators, 3 DC/DC step-down
+	  controllers, 11 LDOs, RTC, automatic battery, temperature and
+	  over current monitoring, GPIOs, ADC and a watchdog.
+
 config PMIC_ADP5520
 	bool "Analog Devices ADP5520/01 MFD PMIC Core Support"
 	depends on I2C=y
drivers/mfd/Makefile +1 -0
index 656cec9..8a28dc9 100644
@@ -162,4 +162,5 @@ obj-$(CONFIG_MFD_LM3533)	+= lm3533-core.o lm3533-ctrlbank.o
 obj-$(CONFIG_VEXPRESS_CONFIG)	+= vexpress-config.o vexpress-sysreg.o
 obj-$(CONFIG_MFD_RETU)		+= retu-mfd.o
 obj-$(CONFIG_MFD_AS3711)	+= as3711.o
+obj-$(CONFIG_MFD_AS3722)	+= as3722.o
 obj-$(CONFIG_MFD_STW481X)	+= stw481x.o
drivers/mfd/as3722.c new file +449 -0

449 lines not on this page · raw message

include/dt-bindings/mfd/as3722.h new file +52 -0

52 lines not on this page · raw message

include/linux/mfd/as3722.h new file +423 -0

423 lines not on this page · raw message

Signature · 1 line
1.7.1.1
Acked-by on v5 1/3
#2 lore raw

Re: [PATCH V5 1/3] mfd: add support for ams AS3722 PMIC

Quoted 6 lines · Laxman Dewangan

The ams AS3722 is a compact system PMU suitable for mobile phones, tablets etc. It has 4 DC/DC step-down regulators, 3 DC/DC step-down controller, 11 LDOs, RTC, automatic battery, temperature and over-current monitoring, 8 GPIOs, ADC and a watchdog.

Add MFD core driver for the AS3722 to support core functionality.

OK, I think the binding here is about clear enough, so the binding,

#3 lore raw

Re: [PATCH V5 1/3] mfd: add support for ams AS3722 PMIC

Hi Lee/Samuel,

Quoted 9 lines · Stephen Warren
Quoted 6 lines · Laxman Dewangan

The ams AS3722 is a compact system PMU suitable for mobile phones, tablets etc. It has 4 DC/DC step-down regulators, 3 DC/DC step-down controller, 11 LDOs, RTC, automatic battery, temperature and over-current monitoring, 8 GPIOs, ADC and a watchdog.

Add MFD core driver for the AS3722 to support core functionality.

OK, I think the binding here is about clear enough, so the binding,

I saw that Lee has already acked this (V4) for the nondt side.

As there is no issue on dt side also, can it be apply please?

#4 lore raw

Re: [PATCH V5 1/3] mfd: add support for ams AS3722 PMIC

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

The ams AS3722 is a compact system PMU suitable for mobile phones, tablets etc. It has 4 DC/DC step-down regulators, 3 DC/DC step-down controller, 11 LDOs, RTC, automatic battery, temperature and over-current monitoring, 8 GPIOs, ADC and a watchdog.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Add MFD core driver for the AS3722 to support core functionality.

OK, I think the binding here is about clear enough, so the binding,

I saw that Lee has already acked this (V4) for the nondt side.

As there is no issue on dt side also, can it be apply please?

There is no IMAP access here at the Summit.

Would you be able to do me a favour and resend this patch with Stephen's and my Acks and I will apply?

Signature · 8 lines
Lee Jones
Linaro ST Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#5 lore raw

PATCH v5 2/3 pincntrl: add support for ams AS3722 pin control driver

In reply to Laxman Dewangan

The AS3722 is a compact system PMU suitable for mobile phones, tablets etc.

Add a driver to support accessing the GPIO, pinmux and pin configuration of 8 GPIO pins found on the ams AS3722 through pin control driver and gpiolib.

The driver will register itself as the pincontrol driver and gpio driver.

---
Changes from V1:
- Nit cleanups in driver and use module_platform_driver.

Changes from V2:
- Move the gpio driver from gpio folder to pinctnrl driver and register driver as pincontrol driver.
- Provide pin configuration through pincntrl framework.

Changes from V3:
- Added gpio ranges and pinctrl_gpio calls.
- Used pinctrl_gpio_* calls on gpio chips callback.
- Remove dummy function which just return not supported.
- Nit cleanups.

Changes from V4:
- Drop separate DT binding document as it is moved to mfd/as3722.txt.
- Added ack from Linus.

 drivers/pinctrl/Kconfig          |   11 +
 drivers/pinctrl/Makefile         |    1 +
 drivers/pinctrl/pinctrl-as3722.c |  630 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 642 insertions(+), 0 deletions(-)
 create mode 100644 drivers/pinctrl/pinctrl-as3722.c
drivers/pinctrl/Kconfig +11 -0
index 21db201..85f5462 100644
@@ -59,6 +59,17 @@ config PINCTRL_ADI2
 	  future processors. This option is selected automatically when specific
 	  machine and arch are selected to build.
 
+config PINCTRL_AS3722
+	bool "Pinctrl and GPIO driver for ams AS3722 PMIC"
+	depends on MFD_AS3722 && GPIOLIB
+	select PINMUX
+	select GENERIC_PINCONF
+	help
+	  AS3722 device supports the configuration of GPIO pins for different
+	  functionality. This driver supports the pinmux, push-pull and
+	  open drain configuration for the GPIO pins of AS3722 devices. It also
+	  supports the GPIO functionality through gpiolib.
+
 config PINCTRL_BF54x
 	def_bool y if BF54x
 	select PINCTRL_ADI2
drivers/pinctrl/Makefile +1 -0
index bbeb980..3d14cb8 100644
@@ -15,6 +15,7 @@ obj-$(CONFIG_PINCTRL_AB8540)	+= pinctrl-ab8540.o
 obj-$(CONFIG_PINCTRL_AB9540)	+= pinctrl-ab9540.o
 obj-$(CONFIG_PINCTRL_AB8505)	+= pinctrl-ab8505.o
 obj-$(CONFIG_PINCTRL_ADI2)	+= pinctrl-adi2.o
+obj-$(CONFIG_PINCTRL_AS3722)	+= pinctrl-as3722.o
 obj-$(CONFIG_PINCTRL_BF54x)	+= pinctrl-adi2-bf54x.o
 obj-$(CONFIG_PINCTRL_BF60x)	+= pinctrl-adi2-bf60x.o
 obj-$(CONFIG_PINCTRL_AT91)	+= pinctrl-at91.o
drivers/pinctrl/pinctrl-as3722.c new file +630 -0

630 lines not on this page · raw message

Signature · 1 line
1.7.1.1
#6 lore raw

PATCH v5 3/3 drivers/rtc/rtc-as3722: add RTC driver

In reply to Laxman Dewangan

The ams AS3722 is a compact system PMU suitable for mobile phones, tablets etc.

Add a driver to support accessing the RTC found on the ams AS3722 PMIC using RTC framework.

---
Changes from V1:
- Get rid of clk32k out configuration from RTC. Will add clock driver.

Changes from V2:
- None.

Changes form V3:
- Change AMS to ams.

Changes form V4:
- None

 drivers/rtc/Kconfig      |   10 ++
 drivers/rtc/Makefile     |    1 +
 drivers/rtc/rtc-as3722.c |  296 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 307 insertions(+), 0 deletions(-)
 create mode 100644 drivers/rtc/rtc-as3722.c
drivers/rtc/Kconfig +10 -0
index 9654aa3..d8785d7 100644
@@ -153,6 +153,16 @@ config RTC_DRV_88PM80X
 	  This driver can also be built as a module. If so, the module
 	  will be called rtc-88pm80x.
 
+config RTC_DRV_AS3722
+	tristate "ams AS3722 RTC driver"
+	depends on MFD_AS3722
+	help
+	  If you say yes here you get support for the RTC of ams AS3722 PMIC
+	  chips.
+
+	  This driver can also be built as a module. If so, the module
+	  will be called rtc-as3722.
+
 config RTC_DRV_DS1307
 	tristate "Dallas/Maxim DS1307/37/38/39/40, ST M41T00, EPSON RX-8025"
 	help
drivers/rtc/Makefile +1 -0
index 2dff3d2..fdb5764 100644
@@ -20,6 +20,7 @@ obj-$(CONFIG_RTC_DRV_88PM860X)  += rtc-88pm860x.o
 obj-$(CONFIG_RTC_DRV_88PM80X)	+= rtc-88pm80x.o
 obj-$(CONFIG_RTC_DRV_AB3100)	+= rtc-ab3100.o
 obj-$(CONFIG_RTC_DRV_AB8500)	+= rtc-ab8500.o
+obj-$(CONFIG_RTC_DRV_AS3722)	+= rtc-as3722.o
 obj-$(CONFIG_RTC_DRV_AT32AP700X)+= rtc-at32ap700x.o
 obj-$(CONFIG_RTC_DRV_AT91RM9200)+= rtc-at91rm9200.o
 obj-$(CONFIG_RTC_DRV_AT91SAM9)	+= rtc-at91sam9.o
drivers/rtc/rtc-as3722.c new file +296 -0

296 lines not on this page · raw message

Signature · 1 line
1.7.1.1
#7 lore raw

Re: [PATCH V5 3/3] drivers/rtc/rtc-as3722: add RTC driver

Quoted 5 lines · On Wed, 9 Oct 2013 17:59:21 +0530 Laxman Dewangan <[email protected]> wrote:

The ams AS3722 is a compact system PMU suitable for mobile phones, tablets etc.

Add a driver to support accessing the RTC found on the ams AS3722 PMIC using RTC framework.

I hate these patchsets, because ...

drivers/rtc/Kconfig config RTC_DRV_88PM80X · line 158

Quoted 10 lines

index 9654aa3..d8785d7 100644

drivers/rtc/Kconfig +3 -0
@@ -153,6 +153,16 @@ config RTC_DRV_88PM80X
 	  This driver can also be built as a module. If so, the module
 	  will be called rtc-88pm80x.
 
+config RTC_DRV_AS3722
+	tristate "ams AS3722 RTC driver"
+	depends on MFD_AS3722

... the rtc patch depends on an mfd patch, so everyone ends up sitting around looking at everyone else, wondering who will merge it all.

Quoted 34 lines
drivers/rtc/Kconfig +31 -0
+	help
+	  If you say yes here you get support for the RTC of ams AS3722 PMIC
+	  chips.
+
+	  This driver can also be built as a module. If so, the module
+	  will be called rtc-as3722.
+
 
...
 
+static int as3722_rtc_probe(struct platform_device *pdev)
+{
+	struct as3722 *as3722 = dev_get_drvdata(pdev->dev.parent);
+	struct as3722_rtc *as3722_rtc;
+	int val;
+	int ret;
+
+	as3722_rtc = devm_kzalloc(&pdev->dev, sizeof(*as3722_rtc), GFP_KERNEL);
+	if (!as3722_rtc)
+		return -ENOMEM;
+
+	as3722_rtc->as3722 = as3722;
+	as3722_rtc->dev = &pdev->dev;
+	platform_set_drvdata(pdev, as3722_rtc);
+
+	/* Enable the RTC to make sure it is running. */
+	ret = as3722_update_bits(as3722, AS3722_RTC_CONTROL_REG,
+				AS3722_RTC_ON, AS3722_RTC_ON);
+	if (ret < 0) {
+		dev_err(&pdev->dev, "RTC_CONTROL reg update failed: %d\n", ret);
+		return ret;
+	}
+
+	val = AS3722_RTC_ON | AS3722_RTC_ALARM_WAKEUP_EN;

drivers/rtc/Kconfig config RTC_DRV_88PM80X

Quoted 10 lines
drivers/rtc/Kconfig +10 -0
+	ret = as3722_write(as3722, AS3722_RTC_CONTROL_REG, val);
+	if (ret < 0) {
+		dev_err(&pdev->dev, "RTC_CONTROL reg write failed: %d\n", ret);
+		return ret;
+	}
+
+	device_init_wakeup(&pdev->dev, 1);
+
+	as3722_rtc->rtc = rtc_device_register("as3722", &pdev->dev,
+				&as3722_rtc_ops, THIS_MODULE);

devm_rtc_device_register()?

drivers/rtc/Kconfig

Quoted 12 lines
drivers/rtc/Kconfig +12 -0
+	if (IS_ERR(as3722_rtc->rtc)) {
+		ret = PTR_ERR(as3722_rtc->rtc);
+		dev_err(&pdev->dev, "RTC register failed: %d\n", ret);
+		return ret;
+	}
+
+	as3722_rtc->alarm_irq = platform_get_irq(pdev, 0);
+	dev_info(&pdev->dev, "RTC interrupt %d\n", as3722_rtc->alarm_irq);
+
+	ret = request_threaded_irq(as3722_rtc->alarm_irq, NULL,
+			as3722_alarm_irq, IRQF_ONESHOT | IRQF_EARLY_RESUME,
+			"rtc-alarm", as3722_rtc);

devm_request_threaded_irq()?

drivers/rtc/Kconfig

Quoted 6 lines
drivers/rtc/Kconfig +6 -0
+	if (ret < 0) {
+		dev_err(&pdev->dev, "Failed to request alarm IRQ %d: %d\n",
+				as3722_rtc->alarm_irq, ret);
+		goto scrub;
+	}
+	disable_irq(as3722_rtc->alarm_irq);

It seems strange to disable your IRQ here.

drivers/rtc/Kconfig

Quoted 5 lines
drivers/rtc/Kconfig +5 -0
+	return 0;
+scrub:
+	rtc_device_unregister(as3722_rtc->rtc);
+	return ret;
+}

The function is a bit confused. It uses a mix of the "returns sprinkled all over the place" approach and the "goto out" approach. The latter is preferred.

drivers/rtc/Kconfig

Quoted 10 lines
drivers/rtc/Kconfig +10 -0
+static int as3722_rtc_remove(struct platform_device *pdev)
+{
+	struct as3722_rtc *as3722_rtc = platform_get_drvdata(pdev);
+
+	free_irq(as3722_rtc->alarm_irq, as3722_rtc);
+	rtc_device_unregister(as3722_rtc->rtc);
+	return 0;
+}
+
+#ifdef CONFIG_PM

Most (but not all!) rtc drivers use CONFIG_PM_SLEEP. People have madly mucked with CONFIG_PM* and I don't know the difference and I don't know what's going on and I don't know of a convenient place to go to find out. If you work it out, please be sure to tell me! But as soon as I figure it out I'm sure they'll go and madly muck with it again.

#8 lore raw

Re: [PATCH V5 3/3] drivers/rtc/rtc-as3722: add RTC driver

Quoted 8 lines · Andrew Morton

drivers/rtc/Kconfig config RTC_DRV_88PM80X · line 158

Quoted 3 lines · On Wed, 9 Oct 2013 17:59:21 +0530 Laxman Dewangan <[email protected]> wrote:
drivers/rtc/Kconfig +3 -0
+config RTC_DRV_AS3722
+	tristate "ams AS3722 RTC driver"
+	depends on MFD_AS3722

... the rtc patch depends on an mfd patch, so everyone ends up sitting around looking at everyone else, wondering who will merge it all.

With the MFD ones providing you trust the interfaces with the core are going to be OK there's no problem to just merge them via individual trees - the dependency on the MFD will prevent bisection problems.

Quoted 7 lines
Quoted 1 line

+#ifdef CONFIG_PM

Most (but not all!) rtc drivers use CONFIG_PM_SLEEP. People have madly mucked with CONFIG_PM* and I don't know the difference and I don't know what's going on and I don't know of a convenient place to go to find out. If you work it out, please be sure to tell me! But as soon as I figure it out I'm sure they'll go and madly muck with it again.

The two effective options for this stuff are PM_SLEEP (for system suspend) and PM_RUNTIME (for runtime suspend which RTCs are unlikely to use I guess). PM mostly just enables selection of the other two.

#9 lore raw

Re: [rtc-linux] Re: [PATCH V5 3/3] drivers/rtc/rtc-as3722: add RTC driver

Quoted 7 lines · Mark Brown
Quoted 5 lines · Andrew Morton
Quoted 3 lines · On Wed, 9 Oct 2013 17:59:21 +0530 Laxman Dewangan <[email protected]> wrote:
drivers/rtc/Kconfig +3 -0
+config RTC_DRV_AS3722
+   tristate "ams AS3722 RTC driver"
+   depends on MFD_AS3722
Quoted 6 lines
Quoted 2 lines

... the rtc patch depends on an mfd patch, so everyone ends up sitting around looking at everyone else, wondering who will merge it all.

With the MFD ones providing you trust the interfaces with the core are going to be OK there's no problem to just merge them via individual trees - the dependency on the MFD will prevent bisection problems.

Yes this is why I merged the pinctrl portions into the pinctrl tree. We do have some indication that the MFD driver is in good shape and will be accepted. In the worst case (if it's not getting in through the same merge window or the next) we can just revert it.

Yours,
Linus Walleij

#10 lore raw

Re: [PATCH V5 3/3] drivers/rtc/rtc-as3722: add RTC driver

In reply to Mark Brown
Quoted 5 lines · Mark Brown

* PGP Signed by an unknown key

Quoted 1 line · Andrew Morton
Quoted 1 line

+#ifdef CONFIG_PM

Quoted 8 lines
Quoted 5 lines

Most (but not all!) rtc drivers use CONFIG_PM_SLEEP. People have madly mucked with CONFIG_PM* and I don't know the difference and I don't know what's going on and I don't know of a convenient place to go to find out. If you work it out, please be sure to tell me! But as soon as I figure it out I'm sure they'll go and madly muck with it again.

The two effective options for this stuff are PM_SLEEP (for system suspend) and PM_RUNTIME (for runtime suspend which RTCs are unlikely to use I guess). PM mostly just enables selection of the other two.

I think, correct defs is CONFIG_PM_SLEEP here. I will re-spin this patch.