diff mbox

[v5] rtc: omap: Support ext_wakeup configuration

Message ID 20160908105203.8641-1-m.niestroj@grinn-global.com (mailing list archive)
State New, archived
Headers show

Commit Message

Marcin Niestroj Sept. 8, 2016, 10:52 a.m. UTC
Support configuration of ext_wakeup sources. This patch makes it
possible to enable ext_wakeup and set it's polarity, depending on board
configuration. AM335x's dedicated PMIC (tps65217) uses ext_wakeup to
notify about power-button presses. Handling power-button presses enables
to recover from RTC-only power states correctly.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
---
Hi,

This patch adds support for ext_wakeup using generic pinconf device-tree
bindings, with one added custom property.

Changes v4 -> v5 (suggested by Rob):
 * Don't use GPIO defines in ti,input-polarity, use optional ti,active-high
   boolean instead.
 * Use '-' instead of '_' in node name.

Changes v1 -> v4:
 * This is a total reimplementation, so it is not based on any of the previous
   patch versions. This approach has been suggested by Tony and Grygorii
   in [1].

Patch was developed on 4.7, rebased on 4.8-rc5, tested using chiliBoard.

[1] http://www.spinics.net/lists/devicetree/msg131516.html

 Documentation/devicetree/bindings/rtc/rtc-omap.txt |  21 +++
 drivers/rtc/Kconfig                                |   1 +
 drivers/rtc/rtc-omap.c                             | 168 ++++++++++++++++++++-
 3 files changed, 182 insertions(+), 8 deletions(-)

Comments

kernel test robot Sept. 8, 2016, 2:20 p.m. UTC | #1
Hi Marcin,

[auto build test ERROR on abelloni/rtc-next]
[also build test ERROR on v4.8-rc5]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
[Suggest to use git(>=2.9.0) format-patch --base=<commit> (or --base=auto for convenience) to record what (public, well-known) commit your patch series was built on]
[Check https://git-scm.com/docs/git-format-patch for more information]

url:    https://github.com/0day-ci/linux/commits/Marcin-Niestroj/rtc-omap-Support-ext_wakeup-configuration/20160908-190900
base:   https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git rtc-next
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 4.9.0
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=ia64 

All error/warnings (new ones prefixed by >>):

>> drivers/rtc/rtc-omap.c:535:38: error: array type has incomplete element type
    static const struct pinctrl_pin_desc rtc_pins_desc[] = {
                                         ^
>> drivers/rtc/rtc-omap.c:536:2: error: implicit declaration of function 'PINCTRL_PIN' [-Werror=implicit-function-declaration]
     PINCTRL_PIN(0, "ext_wakeup0"),
     ^
>> drivers/rtc/rtc-omap.c:553:21: error: variable 'rtc_pinctrl_ops' has initializer but incomplete type
    static const struct pinctrl_ops rtc_pinctrl_ops = {
                        ^
>> drivers/rtc/rtc-omap.c:554:2: error: unknown field 'get_groups_count' specified in initializer
     .get_groups_count = rtc_pinctrl_get_groups_count,
     ^
>> drivers/rtc/rtc-omap.c:554:2: warning: excess elements in struct initializer
   drivers/rtc/rtc-omap.c:554:2: warning: (near initialization for 'rtc_pinctrl_ops')
>> drivers/rtc/rtc-omap.c:555:2: error: unknown field 'get_group_name' specified in initializer
     .get_group_name = rtc_pinctrl_get_group_name,
     ^
   drivers/rtc/rtc-omap.c:555:2: warning: excess elements in struct initializer
   drivers/rtc/rtc-omap.c:555:2: warning: (near initialization for 'rtc_pinctrl_ops')
>> drivers/rtc/rtc-omap.c:556:2: error: unknown field 'dt_node_to_map' specified in initializer
     .dt_node_to_map = pinconf_generic_dt_node_to_map_pin,
     ^
   drivers/rtc/rtc-omap.c:556:2: warning: excess elements in struct initializer
   drivers/rtc/rtc-omap.c:556:2: warning: (near initialization for 'rtc_pinctrl_ops')
>> drivers/rtc/rtc-omap.c:557:2: error: unknown field 'dt_free_map' specified in initializer
     .dt_free_map = pinconf_generic_dt_free_map,
     ^
   drivers/rtc/rtc-omap.c:557:2: warning: excess elements in struct initializer
   drivers/rtc/rtc-omap.c:557:2: warning: (near initialization for 'rtc_pinctrl_ops')
   drivers/rtc/rtc-omap.c: In function 'rtc_pinconf_get':
>> drivers/rtc/rtc-omap.c:577:9: error: implicit declaration of function 'pinctrl_dev_get_drvdata' [-Werror=implicit-function-declaration]
     struct omap_rtc *rtc = pinctrl_dev_get_drvdata(pctldev);
            ^
>> drivers/rtc/rtc-omap.c:577:25: warning: initialization makes pointer from integer without a cast
     struct omap_rtc *rtc = pinctrl_dev_get_drvdata(pctldev);
                            ^
   drivers/rtc/rtc-omap.c: In function 'rtc_pinconf_set':
   drivers/rtc/rtc-omap.c:608:25: warning: initialization makes pointer from integer without a cast
     struct omap_rtc *rtc = pinctrl_dev_get_drvdata(pctldev);
                            ^
   drivers/rtc/rtc-omap.c: At top level:
>> drivers/rtc/rtc-omap.c:649:21: error: variable 'rtc_pinconf_ops' has initializer but incomplete type
    static const struct pinconf_ops rtc_pinconf_ops = {
                        ^
>> drivers/rtc/rtc-omap.c:650:2: error: unknown field 'is_generic' specified in initializer
     .is_generic = true,
     ^
   drivers/rtc/rtc-omap.c:650:2: warning: excess elements in struct initializer
   drivers/rtc/rtc-omap.c:650:2: warning: (near initialization for 'rtc_pinconf_ops')
>> drivers/rtc/rtc-omap.c:651:2: error: unknown field 'pin_config_get' specified in initializer
     .pin_config_get = rtc_pinconf_get,
     ^
   drivers/rtc/rtc-omap.c:651:2: warning: excess elements in struct initializer
   drivers/rtc/rtc-omap.c:651:2: warning: (near initialization for 'rtc_pinconf_ops')
>> drivers/rtc/rtc-omap.c:652:2: error: unknown field 'pin_config_set' specified in initializer
     .pin_config_set = rtc_pinconf_set,
     ^
   drivers/rtc/rtc-omap.c:652:2: warning: excess elements in struct initializer
   drivers/rtc/rtc-omap.c:652:2: warning: (near initialization for 'rtc_pinconf_ops')
>> drivers/rtc/rtc-omap.c:655:15: error: variable 'rtc_pinctrl_desc' has initializer but incomplete type
    static struct pinctrl_desc rtc_pinctrl_desc = {
                  ^
>> drivers/rtc/rtc-omap.c:656:2: error: unknown field 'pins' specified in initializer
     .pins = rtc_pins_desc,
     ^
   drivers/rtc/rtc-omap.c:656:2: warning: excess elements in struct initializer
   drivers/rtc/rtc-omap.c:656:2: warning: (near initialization for 'rtc_pinctrl_desc')
>> drivers/rtc/rtc-omap.c:657:2: error: unknown field 'npins' specified in initializer
     .npins = ARRAY_SIZE(rtc_pins_desc),
     ^
   In file included from include/linux/debug_locks.h:6:0,
                    from include/linux/mutex-debug.h:6,
                    from include/linux/mutex.h:82,
                    from include/linux/notifier.h:13,
                    from include/linux/clk.h:17,
                    from drivers/rtc/rtc-omap.c:18:
   include/linux/bug.h:34:45: error: bit-field '<anonymous>' width not an integer constant
    #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
                                                ^
   include/linux/compiler-gcc.h:64:28: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
    #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
                               ^
   include/linux/kernel.h:53:59: note: in expansion of macro '__must_be_array'
    #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
                                                              ^
>> drivers/rtc/rtc-omap.c:657:11: note: in expansion of macro 'ARRAY_SIZE'
     .npins = ARRAY_SIZE(rtc_pins_desc),
              ^
   include/linux/bug.h:34:45: warning: excess elements in struct initializer
    #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
                                                ^
   include/linux/compiler-gcc.h:64:28: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
    #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
                               ^
   include/linux/kernel.h:53:59: note: in expansion of macro '__must_be_array'
    #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
                                                              ^
>> drivers/rtc/rtc-omap.c:657:11: note: in expansion of macro 'ARRAY_SIZE'
     .npins = ARRAY_SIZE(rtc_pins_desc),
              ^
   include/linux/bug.h:34:45: warning: (near initialization for 'rtc_pinctrl_desc')
    #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
                                                ^
   include/linux/compiler-gcc.h:64:28: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
    #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
                               ^
   include/linux/kernel.h:53:59: note: in expansion of macro '__must_be_array'
    #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
                                                              ^
>> drivers/rtc/rtc-omap.c:657:11: note: in expansion of macro 'ARRAY_SIZE'
     .npins = ARRAY_SIZE(rtc_pins_desc),
              ^

vim +535 drivers/rtc/rtc-omap.c

   529		}, {
   530			/* sentinel */
   531		}
   532	};
   533	MODULE_DEVICE_TABLE(of, omap_rtc_of_match);
   534	
 > 535	static const struct pinctrl_pin_desc rtc_pins_desc[] = {
 > 536		PINCTRL_PIN(0, "ext_wakeup0"),
   537		PINCTRL_PIN(1, "ext_wakeup1"),
   538		PINCTRL_PIN(2, "ext_wakeup2"),
   539		PINCTRL_PIN(3, "ext_wakeup3"),
   540	};
   541	
   542	static int rtc_pinctrl_get_groups_count(struct pinctrl_dev *pctldev)
   543	{
   544		return 0;
   545	}
   546	
   547	static const char *rtc_pinctrl_get_group_name(struct pinctrl_dev *pctldev,
   548						unsigned int group)
   549	{
   550		return NULL;
   551	}
   552	
 > 553	static const struct pinctrl_ops rtc_pinctrl_ops = {
 > 554		.get_groups_count = rtc_pinctrl_get_groups_count,
 > 555		.get_group_name = rtc_pinctrl_get_group_name,
 > 556		.dt_node_to_map = pinconf_generic_dt_node_to_map_pin,
 > 557		.dt_free_map = pinconf_generic_dt_free_map,
   558	};
   559	
   560	enum rtc_pin_config_param {
   561		PIN_CONFIG_ACTIVE_HIGH = PIN_CONFIG_END + 1,
   562	};
   563	
   564	static const struct pinconf_generic_params rtc_params[] = {
   565		{"ti,active-high", PIN_CONFIG_ACTIVE_HIGH, 0},
   566	};
   567	
   568	#ifdef CONFIG_DEBUG_FS
   569	static const struct pin_config_item rtc_conf_items[ARRAY_SIZE(rtc_params)] = {
   570		PCONFDUMP(PIN_CONFIG_ACTIVE_HIGH, "input active high", NULL, false),
   571	};
   572	#endif
   573	
   574	static int rtc_pinconf_get(struct pinctrl_dev *pctldev,
   575				unsigned int pin, unsigned long *config)
   576	{
 > 577		struct omap_rtc *rtc = pinctrl_dev_get_drvdata(pctldev);
   578		unsigned int param = pinconf_to_config_param(*config);
   579		u32 val;
   580		u16 arg = 0;
   581	
   582		rtc->type->unlock(rtc);
   583		val = rtc_readl(rtc, OMAP_RTC_PMIC_REG);
   584		rtc->type->lock(rtc);
   585	
   586		switch (param) {
   587		case PIN_CONFIG_INPUT_ENABLE:
   588			if (!(val & OMAP_RTC_PMIC_EXT_WKUP_EN(pin)))
   589				return -EINVAL;
   590			break;
   591		case PIN_CONFIG_ACTIVE_HIGH:
   592			if (val & OMAP_RTC_PMIC_EXT_WKUP_POL(pin))
   593				return -EINVAL;
   594			break;
   595		default:
   596			return -ENOTSUPP;
   597		};
   598	
   599		*config = pinconf_to_config_packed(param, arg);
   600	
   601		return 0;
   602	}
   603	
   604	static int rtc_pinconf_set(struct pinctrl_dev *pctldev,
   605				unsigned int pin, unsigned long *configs,
   606				unsigned int num_configs)
   607	{
 > 608		struct omap_rtc *rtc = pinctrl_dev_get_drvdata(pctldev);
   609		u32 val;
   610		unsigned int param;
   611		u16 param_val;
   612		int i;
   613	
   614		rtc->type->unlock(rtc);
   615		val = rtc_readl(rtc, OMAP_RTC_PMIC_REG);
   616		rtc->type->lock(rtc);
   617	
   618		/* active low by default */
   619		val |= OMAP_RTC_PMIC_EXT_WKUP_POL(pin);
   620	
   621		for (i = 0; i < num_configs; i++) {
   622			param = pinconf_to_config_param(configs[i]);
   623			param_val = pinconf_to_config_argument(configs[i]);
   624	
   625			switch (param) {
   626			case PIN_CONFIG_INPUT_ENABLE:
   627				if (param_val)
   628					val |= OMAP_RTC_PMIC_EXT_WKUP_EN(pin);
   629				else
   630					val &= ~OMAP_RTC_PMIC_EXT_WKUP_EN(pin);
   631				break;
   632			case PIN_CONFIG_ACTIVE_HIGH:
   633				val &= ~OMAP_RTC_PMIC_EXT_WKUP_POL(pin);
   634				break;
   635			default:
   636				dev_err(&rtc->rtc->dev, "Property %u not supported\n",
   637					param);
   638				return -ENOTSUPP;
   639			}
   640		}
   641	
   642		rtc->type->unlock(rtc);
   643		rtc_writel(rtc, OMAP_RTC_PMIC_REG, val);
   644		rtc->type->lock(rtc);
   645	
   646		return 0;
   647	}
   648	
 > 649	static const struct pinconf_ops rtc_pinconf_ops = {
 > 650		.is_generic = true,
 > 651		.pin_config_get = rtc_pinconf_get,
 > 652		.pin_config_set = rtc_pinconf_set,
   653	};
   654	
 > 655	static struct pinctrl_desc rtc_pinctrl_desc = {
 > 656		.pins = rtc_pins_desc,
 > 657		.npins = ARRAY_SIZE(rtc_pins_desc),
 > 658		.pctlops = &rtc_pinctrl_ops,
 > 659		.confops = &rtc_pinconf_ops,
 > 660		.custom_params = rtc_params,
 > 661		.num_custom_params = ARRAY_SIZE(rtc_params),
   662	#ifdef CONFIG_DEBUG_FS
 > 663		.custom_conf_items = rtc_conf_items,
   664	#endif
 > 665		.owner = THIS_MODULE,
   666	};
   667	
   668	static int omap_rtc_probe(struct platform_device *pdev)

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
kernel test robot Sept. 8, 2016, 2:27 p.m. UTC | #2
Hi Marcin,

[auto build test ERROR on abelloni/rtc-next]
[also build test ERROR on v4.8-rc5 next-20160908]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
[Suggest to use git(>=2.9.0) format-patch --base=<commit> (or --base=auto for convenience) to record what (public, well-known) commit your patch series was built on]
[Check https://git-scm.com/docs/git-format-patch for more information]

url:    https://github.com/0day-ci/linux/commits/Marcin-Niestroj/rtc-omap-Support-ext_wakeup-configuration/20160908-190900
base:   https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git rtc-next
config: blackfin-allmodconfig (attached as .config)
compiler: bfin-uclinux-gcc (GCC) 4.6.3
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=blackfin 

All errors (new ones prefixed by >>):

   drivers/rtc/rtc-omap.c:535:38: error: array type has incomplete element type
   drivers/rtc/rtc-omap.c:536:2: error: implicit declaration of function 'PINCTRL_PIN' [-Werror=implicit-function-declaration]
   drivers/rtc/rtc-omap.c:553:21: error: variable 'rtc_pinctrl_ops' has initializer but incomplete type
   drivers/rtc/rtc-omap.c:554:2: error: unknown field 'get_groups_count' specified in initializer
   drivers/rtc/rtc-omap.c:554:2: warning: excess elements in struct initializer [enabled by default]
   drivers/rtc/rtc-omap.c:554:2: warning: (near initialization for 'rtc_pinctrl_ops') [enabled by default]
   drivers/rtc/rtc-omap.c:555:2: error: unknown field 'get_group_name' specified in initializer
   drivers/rtc/rtc-omap.c:555:2: warning: excess elements in struct initializer [enabled by default]
   drivers/rtc/rtc-omap.c:555:2: warning: (near initialization for 'rtc_pinctrl_ops') [enabled by default]
   drivers/rtc/rtc-omap.c:556:2: error: unknown field 'dt_node_to_map' specified in initializer
   drivers/rtc/rtc-omap.c:556:2: warning: excess elements in struct initializer [enabled by default]
   drivers/rtc/rtc-omap.c:556:2: warning: (near initialization for 'rtc_pinctrl_ops') [enabled by default]
   drivers/rtc/rtc-omap.c:557:2: error: unknown field 'dt_free_map' specified in initializer
   drivers/rtc/rtc-omap.c:557:2: warning: excess elements in struct initializer [enabled by default]
   drivers/rtc/rtc-omap.c:557:2: warning: (near initialization for 'rtc_pinctrl_ops') [enabled by default]
   drivers/rtc/rtc-omap.c: In function 'rtc_pinconf_get':
   drivers/rtc/rtc-omap.c:577:9: error: implicit declaration of function 'pinctrl_dev_get_drvdata' [-Werror=implicit-function-declaration]
   drivers/rtc/rtc-omap.c:577:25: warning: initialization makes pointer from integer without a cast [enabled by default]
   drivers/rtc/rtc-omap.c: In function 'rtc_pinconf_set':
   drivers/rtc/rtc-omap.c:608:25: warning: initialization makes pointer from integer without a cast [enabled by default]
   drivers/rtc/rtc-omap.c: At top level:
   drivers/rtc/rtc-omap.c:649:21: error: variable 'rtc_pinconf_ops' has initializer but incomplete type
   drivers/rtc/rtc-omap.c:650:2: error: unknown field 'is_generic' specified in initializer
   drivers/rtc/rtc-omap.c:650:2: warning: excess elements in struct initializer [enabled by default]
   drivers/rtc/rtc-omap.c:650:2: warning: (near initialization for 'rtc_pinconf_ops') [enabled by default]
   drivers/rtc/rtc-omap.c:651:2: error: unknown field 'pin_config_get' specified in initializer
   drivers/rtc/rtc-omap.c:651:2: warning: excess elements in struct initializer [enabled by default]
   drivers/rtc/rtc-omap.c:651:2: warning: (near initialization for 'rtc_pinconf_ops') [enabled by default]
   drivers/rtc/rtc-omap.c:652:2: error: unknown field 'pin_config_set' specified in initializer
   drivers/rtc/rtc-omap.c:652:2: warning: excess elements in struct initializer [enabled by default]
   drivers/rtc/rtc-omap.c:652:2: warning: (near initialization for 'rtc_pinconf_ops') [enabled by default]
   drivers/rtc/rtc-omap.c:655:15: error: variable 'rtc_pinctrl_desc' has initializer but incomplete type
   drivers/rtc/rtc-omap.c:656:2: error: unknown field 'pins' specified in initializer
   drivers/rtc/rtc-omap.c:656:2: warning: excess elements in struct initializer [enabled by default]
   drivers/rtc/rtc-omap.c:656:2: warning: (near initialization for 'rtc_pinctrl_desc') [enabled by default]
   drivers/rtc/rtc-omap.c:657:2: error: unknown field 'npins' specified in initializer
>> drivers/rtc/rtc-omap.c:657:11: error: negative width in bit-field '<anonymous>'
   drivers/rtc/rtc-omap.c:657:11: warning: excess elements in struct initializer [enabled by default]
   drivers/rtc/rtc-omap.c:657:11: warning: (near initialization for 'rtc_pinctrl_desc') [enabled by default]
   drivers/rtc/rtc-omap.c:658:2: error: unknown field 'pctlops' specified in initializer
   drivers/rtc/rtc-omap.c:658:2: warning: excess elements in struct initializer [enabled by default]
   drivers/rtc/rtc-omap.c:658:2: warning: (near initialization for 'rtc_pinctrl_desc') [enabled by default]
   drivers/rtc/rtc-omap.c:659:2: error: unknown field 'confops' specified in initializer
   drivers/rtc/rtc-omap.c:659:2: warning: excess elements in struct initializer [enabled by default]
   drivers/rtc/rtc-omap.c:659:2: warning: (near initialization for 'rtc_pinctrl_desc') [enabled by default]
   drivers/rtc/rtc-omap.c:660:2: error: unknown field 'custom_params' specified in initializer
   drivers/rtc/rtc-omap.c:660:2: warning: excess elements in struct initializer [enabled by default]
   drivers/rtc/rtc-omap.c:660:2: warning: (near initialization for 'rtc_pinctrl_desc') [enabled by default]
   drivers/rtc/rtc-omap.c:661:2: error: unknown field 'num_custom_params' specified in initializer
   drivers/rtc/rtc-omap.c:661:23: warning: excess elements in struct initializer [enabled by default]
   drivers/rtc/rtc-omap.c:661:23: warning: (near initialization for 'rtc_pinctrl_desc') [enabled by default]
   drivers/rtc/rtc-omap.c:663:2: error: unknown field 'custom_conf_items' specified in initializer
   drivers/rtc/rtc-omap.c:663:2: warning: excess elements in struct initializer [enabled by default]
   drivers/rtc/rtc-omap.c:663:2: warning: (near initialization for 'rtc_pinctrl_desc') [enabled by default]
   drivers/rtc/rtc-omap.c:665:2: error: unknown field 'owner' specified in initializer
   drivers/rtc/rtc-omap.c:665:2: warning: excess elements in struct initializer [enabled by default]
   drivers/rtc/rtc-omap.c:665:2: warning: (near initialization for 'rtc_pinctrl_desc') [enabled by default]
   drivers/rtc/rtc-omap.c: In function 'omap_rtc_probe':
   drivers/rtc/rtc-omap.c:825:2: error: invalid use of undefined type 'struct pinctrl_desc'
   drivers/rtc/rtc-omap.c:827:2: error: implicit declaration of function 'pinctrl_register' [-Werror=implicit-function-declaration]
   drivers/rtc/rtc-omap.c:827:15: warning: assignment makes pointer from integer without a cast [enabled by default]
   drivers/rtc/rtc-omap.c: In function 'omap_rtc_remove':
   drivers/rtc/rtc-omap.c:877:2: error: implicit declaration of function 'pinctrl_unregister' [-Werror=implicit-function-declaration]
   drivers/rtc/rtc-omap.c: At top level:
   drivers/rtc/rtc-omap.c:535:38: warning: 'rtc_pins_desc' defined but not used [-Wunused-variable]
   cc1: some warnings being treated as errors

vim +657 drivers/rtc/rtc-omap.c

   645	
   646		return 0;
   647	}
   648	
   649	static const struct pinconf_ops rtc_pinconf_ops = {
   650		.is_generic = true,
 > 651		.pin_config_get = rtc_pinconf_get,
   652		.pin_config_set = rtc_pinconf_set,
   653	};
   654	
   655	static struct pinctrl_desc rtc_pinctrl_desc = {
   656		.pins = rtc_pins_desc,
 > 657		.npins = ARRAY_SIZE(rtc_pins_desc),
   658		.pctlops = &rtc_pinctrl_ops,
   659		.confops = &rtc_pinconf_ops,
   660		.custom_params = rtc_params,

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
kernel test robot Sept. 8, 2016, 3:03 p.m. UTC | #3
Hi Marcin,

[auto build test WARNING on abelloni/rtc-next]
[also build test WARNING on v4.8-rc5 next-20160908]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
[Suggest to use git(>=2.9.0) format-patch --base=<commit> (or --base=auto for convenience) to record what (public, well-known) commit your patch series was built on]
[Check https://git-scm.com/docs/git-format-patch for more information]

url:    https://github.com/0day-ci/linux/commits/Marcin-Niestroj/rtc-omap-Support-ext_wakeup-configuration/20160908-190900
base:   https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git rtc-next
config: xtensa-allyesconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 4.9.0
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=xtensa 

All warnings (new ones prefixed by >>):

                    from drivers/rtc/rtc-omap.c:18:
   include/linux/bug.h:34:45: error: bit-field '<anonymous>' width not an integer constant
    #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
                                                ^
   include/linux/compiler-gcc.h:64:28: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
    #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
                               ^
   include/linux/kernel.h:53:59: note: in expansion of macro '__must_be_array'
    #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
                                                              ^
   drivers/rtc/rtc-omap.c:657:11: note: in expansion of macro 'ARRAY_SIZE'
     .npins = ARRAY_SIZE(rtc_pins_desc),
              ^
   include/linux/bug.h:34:45: warning: excess elements in struct initializer
    #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
                                                ^
   include/linux/compiler-gcc.h:64:28: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
    #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
                               ^
   include/linux/kernel.h:53:59: note: in expansion of macro '__must_be_array'
    #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
                                                              ^
   drivers/rtc/rtc-omap.c:657:11: note: in expansion of macro 'ARRAY_SIZE'
     .npins = ARRAY_SIZE(rtc_pins_desc),
              ^
   include/linux/bug.h:34:45: warning: (near initialization for 'rtc_pinctrl_desc')
    #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
                                                ^
   include/linux/compiler-gcc.h:64:28: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
    #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
                               ^
   include/linux/kernel.h:53:59: note: in expansion of macro '__must_be_array'
    #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
                                                              ^
   drivers/rtc/rtc-omap.c:657:11: note: in expansion of macro 'ARRAY_SIZE'
     .npins = ARRAY_SIZE(rtc_pins_desc),
              ^
   drivers/rtc/rtc-omap.c:658:2: error: unknown field 'pctlops' specified in initializer
     .pctlops = &rtc_pinctrl_ops,
     ^
   drivers/rtc/rtc-omap.c:658:2: warning: excess elements in struct initializer
   drivers/rtc/rtc-omap.c:658:2: warning: (near initialization for 'rtc_pinctrl_desc')
   drivers/rtc/rtc-omap.c:659:2: error: unknown field 'confops' specified in initializer
     .confops = &rtc_pinconf_ops,
     ^
   drivers/rtc/rtc-omap.c:659:2: warning: excess elements in struct initializer
   drivers/rtc/rtc-omap.c:659:2: warning: (near initialization for 'rtc_pinctrl_desc')
   drivers/rtc/rtc-omap.c:660:2: error: unknown field 'custom_params' specified in initializer
     .custom_params = rtc_params,
     ^
   drivers/rtc/rtc-omap.c:660:2: warning: excess elements in struct initializer
   drivers/rtc/rtc-omap.c:660:2: warning: (near initialization for 'rtc_pinctrl_desc')
   drivers/rtc/rtc-omap.c:661:2: error: unknown field 'num_custom_params' specified in initializer
     .num_custom_params = ARRAY_SIZE(rtc_params),
     ^
   In file included from include/linux/thread_info.h:11:0,
                    from arch/xtensa/include/asm/current.h:16,
                    from include/linux/mutex.h:13,
                    from include/linux/notifier.h:13,
                    from include/linux/clk.h:17,
                    from drivers/rtc/rtc-omap.c:18:
   include/linux/bug.h:34:45: warning: excess elements in struct initializer
    #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
                                                ^
   include/linux/compiler-gcc.h:64:28: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
    #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
                               ^
   include/linux/kernel.h:53:59: note: in expansion of macro '__must_be_array'
    #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
                                                              ^
   drivers/rtc/rtc-omap.c:661:23: note: in expansion of macro 'ARRAY_SIZE'
     .num_custom_params = ARRAY_SIZE(rtc_params),
                          ^
   include/linux/bug.h:34:45: warning: (near initialization for 'rtc_pinctrl_desc')
    #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
                                                ^
   include/linux/compiler-gcc.h:64:28: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
    #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
                               ^
   include/linux/kernel.h:53:59: note: in expansion of macro '__must_be_array'
    #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
                                                              ^
   drivers/rtc/rtc-omap.c:661:23: note: in expansion of macro 'ARRAY_SIZE'
     .num_custom_params = ARRAY_SIZE(rtc_params),
                          ^
   drivers/rtc/rtc-omap.c:663:2: error: unknown field 'custom_conf_items' specified in initializer
     .custom_conf_items = rtc_conf_items,
     ^
   drivers/rtc/rtc-omap.c:663:2: warning: excess elements in struct initializer
   drivers/rtc/rtc-omap.c:663:2: warning: (near initialization for 'rtc_pinctrl_desc')
   drivers/rtc/rtc-omap.c:665:2: error: unknown field 'owner' specified in initializer
     .owner = THIS_MODULE,
     ^
   In file included from include/linux/linkage.h:6:0,
                    from include/linux/kernel.h:6,
                    from include/linux/clk.h:16,
                    from drivers/rtc/rtc-omap.c:18:
   include/linux/export.h:36:30: warning: excess elements in struct initializer
    #define THIS_MODULE ((struct module *)0)
                                 ^
>> drivers/rtc/rtc-omap.c:665:11: note: in expansion of macro 'THIS_MODULE'
     .owner = THIS_MODULE,
              ^
   include/linux/export.h:36:30: warning: (near initialization for 'rtc_pinctrl_desc')
    #define THIS_MODULE ((struct module *)0)
                                 ^
>> drivers/rtc/rtc-omap.c:665:11: note: in expansion of macro 'THIS_MODULE'
     .owner = THIS_MODULE,
              ^
   drivers/rtc/rtc-omap.c: In function 'omap_rtc_probe':
   drivers/rtc/rtc-omap.c:825:2: error: invalid use of undefined type 'struct pinctrl_desc'
     rtc_pinctrl_desc.name = dev_name(&pdev->dev);
     ^
   drivers/rtc/rtc-omap.c:827:2: error: implicit declaration of function 'pinctrl_register' [-Werror=implicit-function-declaration]
     rtc->pctldev = pinctrl_register(&rtc_pinctrl_desc, &pdev->dev, rtc);
     ^
   drivers/rtc/rtc-omap.c:827:15: warning: assignment makes pointer from integer without a cast
     rtc->pctldev = pinctrl_register(&rtc_pinctrl_desc, &pdev->dev, rtc);
                  ^
   drivers/rtc/rtc-omap.c: In function 'omap_rtc_remove':
   drivers/rtc/rtc-omap.c:877:2: error: implicit declaration of function 'pinctrl_unregister' [-Werror=implicit-function-declaration]
     pinctrl_unregister(rtc->pctldev);
     ^
   drivers/rtc/rtc-omap.c: At top level:
   drivers/rtc/rtc-omap.c:535:38: warning: 'rtc_pins_desc' defined but not used [-Wunused-variable]
    static const struct pinctrl_pin_desc rtc_pins_desc[] = {
                                         ^
   cc1: some warnings being treated as errors

vim +/THIS_MODULE +665 drivers/rtc/rtc-omap.c

   649	static const struct pinconf_ops rtc_pinconf_ops = {
   650		.is_generic = true,
   651		.pin_config_get = rtc_pinconf_get,
   652		.pin_config_set = rtc_pinconf_set,
   653	};
   654	
   655	static struct pinctrl_desc rtc_pinctrl_desc = {
   656		.pins = rtc_pins_desc,
   657		.npins = ARRAY_SIZE(rtc_pins_desc),
   658		.pctlops = &rtc_pinctrl_ops,
   659		.confops = &rtc_pinconf_ops,
   660		.custom_params = rtc_params,
   661		.num_custom_params = ARRAY_SIZE(rtc_params),
   662	#ifdef CONFIG_DEBUG_FS
   663		.custom_conf_items = rtc_conf_items,
   664	#endif
 > 665		.owner = THIS_MODULE,
   666	};
   667	
   668	static int omap_rtc_probe(struct platform_device *pdev)
   669	{
   670		struct omap_rtc	*rtc;
   671		struct resource	*res;
   672		u8 reg, mask, new_ctrl;
   673		const struct platform_device_id *id_entry;

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
Marcin Niestroj Sept. 12, 2016, 9:01 a.m. UTC | #4
I guess we are missing PINCTRL in Kconfig. I didn't add that before,
because I thought that there is a dependency chain GENERIC_PINCONF ->
PINCONF -> PINCTRL.

So to resolve this issue:
1) Should we add "select" or "depends on" for PINCTRL?
2) Should this option be somehow related to COMPILE_TEST?

On 08.09.2016 16:20, kbuild test robot wrote:
> Hi Marcin,
>
> [auto build test ERROR on abelloni/rtc-next]
> [also build test ERROR on v4.8-rc5]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
> [Suggest to use git(>=2.9.0) format-patch --base=<commit> (or --base=auto for convenience) to record what (public, well-known) commit your patch series was built on]
> [Check https://git-scm.com/docs/git-format-patch for more information]
>
> url:    https://github.com/0day-ci/linux/commits/Marcin-Niestroj/rtc-omap-Support-ext_wakeup-configuration/20160908-190900
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git rtc-next
> config: ia64-allmodconfig (attached as .config)
> compiler: ia64-linux-gcc (GCC) 4.9.0
> reproduce:
>         wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # save the attached .config to linux build tree
>         make.cross ARCH=ia64
>
> All error/warnings (new ones prefixed by >>):
>
>>> drivers/rtc/rtc-omap.c:535:38: error: array type has incomplete element type
>     static const struct pinctrl_pin_desc rtc_pins_desc[] = {
>                                          ^
>>> drivers/rtc/rtc-omap.c:536:2: error: implicit declaration of function 'PINCTRL_PIN' [-Werror=implicit-function-declaration]
>      PINCTRL_PIN(0, "ext_wakeup0"),
>      ^
>>> drivers/rtc/rtc-omap.c:553:21: error: variable 'rtc_pinctrl_ops' has initializer but incomplete type
>     static const struct pinctrl_ops rtc_pinctrl_ops = {
>                         ^
>>> drivers/rtc/rtc-omap.c:554:2: error: unknown field 'get_groups_count' specified in initializer
>      .get_groups_count = rtc_pinctrl_get_groups_count,
>      ^
>>> drivers/rtc/rtc-omap.c:554:2: warning: excess elements in struct initializer
>    drivers/rtc/rtc-omap.c:554:2: warning: (near initialization for 'rtc_pinctrl_ops')
>>> drivers/rtc/rtc-omap.c:555:2: error: unknown field 'get_group_name' specified in initializer
>      .get_group_name = rtc_pinctrl_get_group_name,
>      ^
>    drivers/rtc/rtc-omap.c:555:2: warning: excess elements in struct initializer
>    drivers/rtc/rtc-omap.c:555:2: warning: (near initialization for 'rtc_pinctrl_ops')
>>> drivers/rtc/rtc-omap.c:556:2: error: unknown field 'dt_node_to_map' specified in initializer
>      .dt_node_to_map = pinconf_generic_dt_node_to_map_pin,
>      ^
>    drivers/rtc/rtc-omap.c:556:2: warning: excess elements in struct initializer
>    drivers/rtc/rtc-omap.c:556:2: warning: (near initialization for 'rtc_pinctrl_ops')
>>> drivers/rtc/rtc-omap.c:557:2: error: unknown field 'dt_free_map' specified in initializer
>      .dt_free_map = pinconf_generic_dt_free_map,
>      ^
>    drivers/rtc/rtc-omap.c:557:2: warning: excess elements in struct initializer
>    drivers/rtc/rtc-omap.c:557:2: warning: (near initialization for 'rtc_pinctrl_ops')
>    drivers/rtc/rtc-omap.c: In function 'rtc_pinconf_get':
>>> drivers/rtc/rtc-omap.c:577:9: error: implicit declaration of function 'pinctrl_dev_get_drvdata' [-Werror=implicit-function-declaration]
>      struct omap_rtc *rtc = pinctrl_dev_get_drvdata(pctldev);
>             ^
>>> drivers/rtc/rtc-omap.c:577:25: warning: initialization makes pointer from integer without a cast
>      struct omap_rtc *rtc = pinctrl_dev_get_drvdata(pctldev);
>                             ^
>    drivers/rtc/rtc-omap.c: In function 'rtc_pinconf_set':
>    drivers/rtc/rtc-omap.c:608:25: warning: initialization makes pointer from integer without a cast
>      struct omap_rtc *rtc = pinctrl_dev_get_drvdata(pctldev);
>                             ^
>    drivers/rtc/rtc-omap.c: At top level:
>>> drivers/rtc/rtc-omap.c:649:21: error: variable 'rtc_pinconf_ops' has initializer but incomplete type
>     static const struct pinconf_ops rtc_pinconf_ops = {
>                         ^
>>> drivers/rtc/rtc-omap.c:650:2: error: unknown field 'is_generic' specified in initializer
>      .is_generic = true,
>      ^
>    drivers/rtc/rtc-omap.c:650:2: warning: excess elements in struct initializer
>    drivers/rtc/rtc-omap.c:650:2: warning: (near initialization for 'rtc_pinconf_ops')
>>> drivers/rtc/rtc-omap.c:651:2: error: unknown field 'pin_config_get' specified in initializer
>      .pin_config_get = rtc_pinconf_get,
>      ^
>    drivers/rtc/rtc-omap.c:651:2: warning: excess elements in struct initializer
>    drivers/rtc/rtc-omap.c:651:2: warning: (near initialization for 'rtc_pinconf_ops')
>>> drivers/rtc/rtc-omap.c:652:2: error: unknown field 'pin_config_set' specified in initializer
>      .pin_config_set = rtc_pinconf_set,
>      ^
>    drivers/rtc/rtc-omap.c:652:2: warning: excess elements in struct initializer
>    drivers/rtc/rtc-omap.c:652:2: warning: (near initialization for 'rtc_pinconf_ops')
>>> drivers/rtc/rtc-omap.c:655:15: error: variable 'rtc_pinctrl_desc' has initializer but incomplete type
>     static struct pinctrl_desc rtc_pinctrl_desc = {
>                   ^
>>> drivers/rtc/rtc-omap.c:656:2: error: unknown field 'pins' specified in initializer
>      .pins = rtc_pins_desc,
>      ^
>    drivers/rtc/rtc-omap.c:656:2: warning: excess elements in struct initializer
>    drivers/rtc/rtc-omap.c:656:2: warning: (near initialization for 'rtc_pinctrl_desc')
>>> drivers/rtc/rtc-omap.c:657:2: error: unknown field 'npins' specified in initializer
>      .npins = ARRAY_SIZE(rtc_pins_desc),
>      ^
>    In file included from include/linux/debug_locks.h:6:0,
>                     from include/linux/mutex-debug.h:6,
>                     from include/linux/mutex.h:82,
>                     from include/linux/notifier.h:13,
>                     from include/linux/clk.h:17,
>                     from drivers/rtc/rtc-omap.c:18:
>    include/linux/bug.h:34:45: error: bit-field '<anonymous>' width not an integer constant
>     #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
>                                                 ^
>    include/linux/compiler-gcc.h:64:28: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
>     #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
>                                ^
>    include/linux/kernel.h:53:59: note: in expansion of macro '__must_be_array'
>     #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
>                                                               ^
>>> drivers/rtc/rtc-omap.c:657:11: note: in expansion of macro 'ARRAY_SIZE'
>      .npins = ARRAY_SIZE(rtc_pins_desc),
>               ^
>    include/linux/bug.h:34:45: warning: excess elements in struct initializer
>     #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
>                                                 ^
>    include/linux/compiler-gcc.h:64:28: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
>     #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
>                                ^
>    include/linux/kernel.h:53:59: note: in expansion of macro '__must_be_array'
>     #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
>                                                               ^
>>> drivers/rtc/rtc-omap.c:657:11: note: in expansion of macro 'ARRAY_SIZE'
>      .npins = ARRAY_SIZE(rtc_pins_desc),
>               ^
>    include/linux/bug.h:34:45: warning: (near initialization for 'rtc_pinctrl_desc')
>     #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
>                                                 ^
>    include/linux/compiler-gcc.h:64:28: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
>     #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
>                                ^
>    include/linux/kernel.h:53:59: note: in expansion of macro '__must_be_array'
>     #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
>                                                               ^
>>> drivers/rtc/rtc-omap.c:657:11: note: in expansion of macro 'ARRAY_SIZE'
>      .npins = ARRAY_SIZE(rtc_pins_desc),
>               ^
>
> vim +535 drivers/rtc/rtc-omap.c
>
>    529		}, {
>    530			/* sentinel */
>    531		}
>    532	};
>    533	MODULE_DEVICE_TABLE(of, omap_rtc_of_match);
>    534	
>  > 535	static const struct pinctrl_pin_desc rtc_pins_desc[] = {
>  > 536		PINCTRL_PIN(0, "ext_wakeup0"),
>    537		PINCTRL_PIN(1, "ext_wakeup1"),
>    538		PINCTRL_PIN(2, "ext_wakeup2"),
>    539		PINCTRL_PIN(3, "ext_wakeup3"),
>    540	};
>    541	
>    542	static int rtc_pinctrl_get_groups_count(struct pinctrl_dev *pctldev)
>    543	{
>    544		return 0;
>    545	}
>    546	
>    547	static const char *rtc_pinctrl_get_group_name(struct pinctrl_dev *pctldev,
>    548						unsigned int group)
>    549	{
>    550		return NULL;
>    551	}
>    552	
>  > 553	static const struct pinctrl_ops rtc_pinctrl_ops = {
>  > 554		.get_groups_count = rtc_pinctrl_get_groups_count,
>  > 555		.get_group_name = rtc_pinctrl_get_group_name,
>  > 556		.dt_node_to_map = pinconf_generic_dt_node_to_map_pin,
>  > 557		.dt_free_map = pinconf_generic_dt_free_map,
>    558	};
>    559	
>    560	enum rtc_pin_config_param {
>    561		PIN_CONFIG_ACTIVE_HIGH = PIN_CONFIG_END + 1,
>    562	};
>    563	
>    564	static const struct pinconf_generic_params rtc_params[] = {
>    565		{"ti,active-high", PIN_CONFIG_ACTIVE_HIGH, 0},
>    566	};
>    567	
>    568	#ifdef CONFIG_DEBUG_FS
>    569	static const struct pin_config_item rtc_conf_items[ARRAY_SIZE(rtc_params)] = {
>    570		PCONFDUMP(PIN_CONFIG_ACTIVE_HIGH, "input active high", NULL, false),
>    571	};
>    572	#endif
>    573	
>    574	static int rtc_pinconf_get(struct pinctrl_dev *pctldev,
>    575				unsigned int pin, unsigned long *config)
>    576	{
>  > 577		struct omap_rtc *rtc = pinctrl_dev_get_drvdata(pctldev);
>    578		unsigned int param = pinconf_to_config_param(*config);
>    579		u32 val;
>    580		u16 arg = 0;
>    581	
>    582		rtc->type->unlock(rtc);
>    583		val = rtc_readl(rtc, OMAP_RTC_PMIC_REG);
>    584		rtc->type->lock(rtc);
>    585	
>    586		switch (param) {
>    587		case PIN_CONFIG_INPUT_ENABLE:
>    588			if (!(val & OMAP_RTC_PMIC_EXT_WKUP_EN(pin)))
>    589				return -EINVAL;
>    590			break;
>    591		case PIN_CONFIG_ACTIVE_HIGH:
>    592			if (val & OMAP_RTC_PMIC_EXT_WKUP_POL(pin))
>    593				return -EINVAL;
>    594			break;
>    595		default:
>    596			return -ENOTSUPP;
>    597		};
>    598	
>    599		*config = pinconf_to_config_packed(param, arg);
>    600	
>    601		return 0;
>    602	}
>    603	
>    604	static int rtc_pinconf_set(struct pinctrl_dev *pctldev,
>    605				unsigned int pin, unsigned long *configs,
>    606				unsigned int num_configs)
>    607	{
>  > 608		struct omap_rtc *rtc = pinctrl_dev_get_drvdata(pctldev);
>    609		u32 val;
>    610		unsigned int param;
>    611		u16 param_val;
>    612		int i;
>    613	
>    614		rtc->type->unlock(rtc);
>    615		val = rtc_readl(rtc, OMAP_RTC_PMIC_REG);
>    616		rtc->type->lock(rtc);
>    617	
>    618		/* active low by default */
>    619		val |= OMAP_RTC_PMIC_EXT_WKUP_POL(pin);
>    620	
>    621		for (i = 0; i < num_configs; i++) {
>    622			param = pinconf_to_config_param(configs[i]);
>    623			param_val = pinconf_to_config_argument(configs[i]);
>    624	
>    625			switch (param) {
>    626			case PIN_CONFIG_INPUT_ENABLE:
>    627				if (param_val)
>    628					val |= OMAP_RTC_PMIC_EXT_WKUP_EN(pin);
>    629				else
>    630					val &= ~OMAP_RTC_PMIC_EXT_WKUP_EN(pin);
>    631				break;
>    632			case PIN_CONFIG_ACTIVE_HIGH:
>    633				val &= ~OMAP_RTC_PMIC_EXT_WKUP_POL(pin);
>    634				break;
>    635			default:
>    636				dev_err(&rtc->rtc->dev, "Property %u not supported\n",
>    637					param);
>    638				return -ENOTSUPP;
>    639			}
>    640		}
>    641	
>    642		rtc->type->unlock(rtc);
>    643		rtc_writel(rtc, OMAP_RTC_PMIC_REG, val);
>    644		rtc->type->lock(rtc);
>    645	
>    646		return 0;
>    647	}
>    648	
>  > 649	static const struct pinconf_ops rtc_pinconf_ops = {
>  > 650		.is_generic = true,
>  > 651		.pin_config_get = rtc_pinconf_get,
>  > 652		.pin_config_set = rtc_pinconf_set,
>    653	};
>    654	
>  > 655	static struct pinctrl_desc rtc_pinctrl_desc = {
>  > 656		.pins = rtc_pins_desc,
>  > 657		.npins = ARRAY_SIZE(rtc_pins_desc),
>  > 658		.pctlops = &rtc_pinctrl_ops,
>  > 659		.confops = &rtc_pinconf_ops,
>  > 660		.custom_params = rtc_params,
>  > 661		.num_custom_params = ARRAY_SIZE(rtc_params),
>    662	#ifdef CONFIG_DEBUG_FS
>  > 663		.custom_conf_items = rtc_conf_items,
>    664	#endif
>  > 665		.owner = THIS_MODULE,
>    666	};
>    667	
>    668	static int omap_rtc_probe(struct platform_device *pdev)
>
> ---
> 0-DAY kernel test infrastructure                Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
>
Alexandre Belloni Sept. 13, 2016, 9:58 p.m. UTC | #5
Hi,

On 12/09/2016 at 11:01:05 +0200, Marcin Niestroj wrote :
> I guess we are missing PINCTRL in Kconfig. I didn't add that before,
> because I thought that there is a dependency chain GENERIC_PINCONF ->
> PINCONF -> PINCTRL.
> 
> So to resolve this issue:
> 1) Should we add "select" or "depends on" for PINCTRL?
> 2) Should this option be somehow related to COMPILE_TEST?
> 

Adding a "depends on PINCTRL" line should be enough to solve that issue.

> On 08.09.2016 16:20, kbuild test robot wrote:
> > Hi Marcin,
> > 
> > [auto build test ERROR on abelloni/rtc-next]
> > [also build test ERROR on v4.8-rc5]
> > [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
> > [Suggest to use git(>=2.9.0) format-patch --base=<commit> (or --base=auto for convenience) to record what (public, well-known) commit your patch series was built on]
> > [Check https://git-scm.com/docs/git-format-patch for more information]
> > 
> > url:    https://github.com/0day-ci/linux/commits/Marcin-Niestroj/rtc-omap-Support-ext_wakeup-configuration/20160908-190900
> > base:   https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git rtc-next
> > config: ia64-allmodconfig (attached as .config)
> > compiler: ia64-linux-gcc (GCC) 4.9.0
> > reproduce:
> >         wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
> >         chmod +x ~/bin/make.cross
> >         # save the attached .config to linux build tree
> >         make.cross ARCH=ia64
> > 
> > All error/warnings (new ones prefixed by >>):
> > 
> > > > drivers/rtc/rtc-omap.c:535:38: error: array type has incomplete element type
> >     static const struct pinctrl_pin_desc rtc_pins_desc[] = {
> >                                          ^
> > > > drivers/rtc/rtc-omap.c:536:2: error: implicit declaration of function 'PINCTRL_PIN' [-Werror=implicit-function-declaration]
> >      PINCTRL_PIN(0, "ext_wakeup0"),
> >      ^
> > > > drivers/rtc/rtc-omap.c:553:21: error: variable 'rtc_pinctrl_ops' has initializer but incomplete type
> >     static const struct pinctrl_ops rtc_pinctrl_ops = {
> >                         ^
> > > > drivers/rtc/rtc-omap.c:554:2: error: unknown field 'get_groups_count' specified in initializer
> >      .get_groups_count = rtc_pinctrl_get_groups_count,
> >      ^
> > > > drivers/rtc/rtc-omap.c:554:2: warning: excess elements in struct initializer
> >    drivers/rtc/rtc-omap.c:554:2: warning: (near initialization for 'rtc_pinctrl_ops')
> > > > drivers/rtc/rtc-omap.c:555:2: error: unknown field 'get_group_name' specified in initializer
> >      .get_group_name = rtc_pinctrl_get_group_name,
> >      ^
> >    drivers/rtc/rtc-omap.c:555:2: warning: excess elements in struct initializer
> >    drivers/rtc/rtc-omap.c:555:2: warning: (near initialization for 'rtc_pinctrl_ops')
> > > > drivers/rtc/rtc-omap.c:556:2: error: unknown field 'dt_node_to_map' specified in initializer
> >      .dt_node_to_map = pinconf_generic_dt_node_to_map_pin,
> >      ^
> >    drivers/rtc/rtc-omap.c:556:2: warning: excess elements in struct initializer
> >    drivers/rtc/rtc-omap.c:556:2: warning: (near initialization for 'rtc_pinctrl_ops')
> > > > drivers/rtc/rtc-omap.c:557:2: error: unknown field 'dt_free_map' specified in initializer
> >      .dt_free_map = pinconf_generic_dt_free_map,
> >      ^
> >    drivers/rtc/rtc-omap.c:557:2: warning: excess elements in struct initializer
> >    drivers/rtc/rtc-omap.c:557:2: warning: (near initialization for 'rtc_pinctrl_ops')
> >    drivers/rtc/rtc-omap.c: In function 'rtc_pinconf_get':
> > > > drivers/rtc/rtc-omap.c:577:9: error: implicit declaration of function 'pinctrl_dev_get_drvdata' [-Werror=implicit-function-declaration]
> >      struct omap_rtc *rtc = pinctrl_dev_get_drvdata(pctldev);
> >             ^
> > > > drivers/rtc/rtc-omap.c:577:25: warning: initialization makes pointer from integer without a cast
> >      struct omap_rtc *rtc = pinctrl_dev_get_drvdata(pctldev);
> >                             ^
> >    drivers/rtc/rtc-omap.c: In function 'rtc_pinconf_set':
> >    drivers/rtc/rtc-omap.c:608:25: warning: initialization makes pointer from integer without a cast
> >      struct omap_rtc *rtc = pinctrl_dev_get_drvdata(pctldev);
> >                             ^
> >    drivers/rtc/rtc-omap.c: At top level:
> > > > drivers/rtc/rtc-omap.c:649:21: error: variable 'rtc_pinconf_ops' has initializer but incomplete type
> >     static const struct pinconf_ops rtc_pinconf_ops = {
> >                         ^
> > > > drivers/rtc/rtc-omap.c:650:2: error: unknown field 'is_generic' specified in initializer
> >      .is_generic = true,
> >      ^
> >    drivers/rtc/rtc-omap.c:650:2: warning: excess elements in struct initializer
> >    drivers/rtc/rtc-omap.c:650:2: warning: (near initialization for 'rtc_pinconf_ops')
> > > > drivers/rtc/rtc-omap.c:651:2: error: unknown field 'pin_config_get' specified in initializer
> >      .pin_config_get = rtc_pinconf_get,
> >      ^
> >    drivers/rtc/rtc-omap.c:651:2: warning: excess elements in struct initializer
> >    drivers/rtc/rtc-omap.c:651:2: warning: (near initialization for 'rtc_pinconf_ops')
> > > > drivers/rtc/rtc-omap.c:652:2: error: unknown field 'pin_config_set' specified in initializer
> >      .pin_config_set = rtc_pinconf_set,
> >      ^
> >    drivers/rtc/rtc-omap.c:652:2: warning: excess elements in struct initializer
> >    drivers/rtc/rtc-omap.c:652:2: warning: (near initialization for 'rtc_pinconf_ops')
> > > > drivers/rtc/rtc-omap.c:655:15: error: variable 'rtc_pinctrl_desc' has initializer but incomplete type
> >     static struct pinctrl_desc rtc_pinctrl_desc = {
> >                   ^
> > > > drivers/rtc/rtc-omap.c:656:2: error: unknown field 'pins' specified in initializer
> >      .pins = rtc_pins_desc,
> >      ^
> >    drivers/rtc/rtc-omap.c:656:2: warning: excess elements in struct initializer
> >    drivers/rtc/rtc-omap.c:656:2: warning: (near initialization for 'rtc_pinctrl_desc')
> > > > drivers/rtc/rtc-omap.c:657:2: error: unknown field 'npins' specified in initializer
> >      .npins = ARRAY_SIZE(rtc_pins_desc),
> >      ^
> >    In file included from include/linux/debug_locks.h:6:0,
> >                     from include/linux/mutex-debug.h:6,
> >                     from include/linux/mutex.h:82,
> >                     from include/linux/notifier.h:13,
> >                     from include/linux/clk.h:17,
> >                     from drivers/rtc/rtc-omap.c:18:
> >    include/linux/bug.h:34:45: error: bit-field '<anonymous>' width not an integer constant
> >     #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
> >                                                 ^
> >    include/linux/compiler-gcc.h:64:28: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
> >     #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
> >                                ^
> >    include/linux/kernel.h:53:59: note: in expansion of macro '__must_be_array'
> >     #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
> >                                                               ^
> > > > drivers/rtc/rtc-omap.c:657:11: note: in expansion of macro 'ARRAY_SIZE'
> >      .npins = ARRAY_SIZE(rtc_pins_desc),
> >               ^
> >    include/linux/bug.h:34:45: warning: excess elements in struct initializer
> >     #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
> >                                                 ^
> >    include/linux/compiler-gcc.h:64:28: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
> >     #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
> >                                ^
> >    include/linux/kernel.h:53:59: note: in expansion of macro '__must_be_array'
> >     #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
> >                                                               ^
> > > > drivers/rtc/rtc-omap.c:657:11: note: in expansion of macro 'ARRAY_SIZE'
> >      .npins = ARRAY_SIZE(rtc_pins_desc),
> >               ^
> >    include/linux/bug.h:34:45: warning: (near initialization for 'rtc_pinctrl_desc')
> >     #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
> >                                                 ^
> >    include/linux/compiler-gcc.h:64:28: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
> >     #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
> >                                ^
> >    include/linux/kernel.h:53:59: note: in expansion of macro '__must_be_array'
> >     #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
> >                                                               ^
> > > > drivers/rtc/rtc-omap.c:657:11: note: in expansion of macro 'ARRAY_SIZE'
> >      .npins = ARRAY_SIZE(rtc_pins_desc),
> >               ^
> > 
> > vim +535 drivers/rtc/rtc-omap.c
> > 
> >    529		}, {
> >    530			/* sentinel */
> >    531		}
> >    532	};
> >    533	MODULE_DEVICE_TABLE(of, omap_rtc_of_match);
> >    534	
> >  > 535	static const struct pinctrl_pin_desc rtc_pins_desc[] = {
> >  > 536		PINCTRL_PIN(0, "ext_wakeup0"),
> >    537		PINCTRL_PIN(1, "ext_wakeup1"),
> >    538		PINCTRL_PIN(2, "ext_wakeup2"),
> >    539		PINCTRL_PIN(3, "ext_wakeup3"),
> >    540	};
> >    541	
> >    542	static int rtc_pinctrl_get_groups_count(struct pinctrl_dev *pctldev)
> >    543	{
> >    544		return 0;
> >    545	}
> >    546	
> >    547	static const char *rtc_pinctrl_get_group_name(struct pinctrl_dev *pctldev,
> >    548						unsigned int group)
> >    549	{
> >    550		return NULL;
> >    551	}
> >    552	
> >  > 553	static const struct pinctrl_ops rtc_pinctrl_ops = {
> >  > 554		.get_groups_count = rtc_pinctrl_get_groups_count,
> >  > 555		.get_group_name = rtc_pinctrl_get_group_name,
> >  > 556		.dt_node_to_map = pinconf_generic_dt_node_to_map_pin,
> >  > 557		.dt_free_map = pinconf_generic_dt_free_map,
> >    558	};
> >    559	
> >    560	enum rtc_pin_config_param {
> >    561		PIN_CONFIG_ACTIVE_HIGH = PIN_CONFIG_END + 1,
> >    562	};
> >    563	
> >    564	static const struct pinconf_generic_params rtc_params[] = {
> >    565		{"ti,active-high", PIN_CONFIG_ACTIVE_HIGH, 0},
> >    566	};
> >    567	
> >    568	#ifdef CONFIG_DEBUG_FS
> >    569	static const struct pin_config_item rtc_conf_items[ARRAY_SIZE(rtc_params)] = {
> >    570		PCONFDUMP(PIN_CONFIG_ACTIVE_HIGH, "input active high", NULL, false),
> >    571	};
> >    572	#endif
> >    573	
> >    574	static int rtc_pinconf_get(struct pinctrl_dev *pctldev,
> >    575				unsigned int pin, unsigned long *config)
> >    576	{
> >  > 577		struct omap_rtc *rtc = pinctrl_dev_get_drvdata(pctldev);
> >    578		unsigned int param = pinconf_to_config_param(*config);
> >    579		u32 val;
> >    580		u16 arg = 0;
> >    581	
> >    582		rtc->type->unlock(rtc);
> >    583		val = rtc_readl(rtc, OMAP_RTC_PMIC_REG);
> >    584		rtc->type->lock(rtc);
> >    585	
> >    586		switch (param) {
> >    587		case PIN_CONFIG_INPUT_ENABLE:
> >    588			if (!(val & OMAP_RTC_PMIC_EXT_WKUP_EN(pin)))
> >    589				return -EINVAL;
> >    590			break;
> >    591		case PIN_CONFIG_ACTIVE_HIGH:
> >    592			if (val & OMAP_RTC_PMIC_EXT_WKUP_POL(pin))
> >    593				return -EINVAL;
> >    594			break;
> >    595		default:
> >    596			return -ENOTSUPP;
> >    597		};
> >    598	
> >    599		*config = pinconf_to_config_packed(param, arg);
> >    600	
> >    601		return 0;
> >    602	}
> >    603	
> >    604	static int rtc_pinconf_set(struct pinctrl_dev *pctldev,
> >    605				unsigned int pin, unsigned long *configs,
> >    606				unsigned int num_configs)
> >    607	{
> >  > 608		struct omap_rtc *rtc = pinctrl_dev_get_drvdata(pctldev);
> >    609		u32 val;
> >    610		unsigned int param;
> >    611		u16 param_val;
> >    612		int i;
> >    613	
> >    614		rtc->type->unlock(rtc);
> >    615		val = rtc_readl(rtc, OMAP_RTC_PMIC_REG);
> >    616		rtc->type->lock(rtc);
> >    617	
> >    618		/* active low by default */
> >    619		val |= OMAP_RTC_PMIC_EXT_WKUP_POL(pin);
> >    620	
> >    621		for (i = 0; i < num_configs; i++) {
> >    622			param = pinconf_to_config_param(configs[i]);
> >    623			param_val = pinconf_to_config_argument(configs[i]);
> >    624	
> >    625			switch (param) {
> >    626			case PIN_CONFIG_INPUT_ENABLE:
> >    627				if (param_val)
> >    628					val |= OMAP_RTC_PMIC_EXT_WKUP_EN(pin);
> >    629				else
> >    630					val &= ~OMAP_RTC_PMIC_EXT_WKUP_EN(pin);
> >    631				break;
> >    632			case PIN_CONFIG_ACTIVE_HIGH:
> >    633				val &= ~OMAP_RTC_PMIC_EXT_WKUP_POL(pin);
> >    634				break;
> >    635			default:
> >    636				dev_err(&rtc->rtc->dev, "Property %u not supported\n",
> >    637					param);
> >    638				return -ENOTSUPP;
> >    639			}
> >    640		}
> >    641	
> >    642		rtc->type->unlock(rtc);
> >    643		rtc_writel(rtc, OMAP_RTC_PMIC_REG, val);
> >    644		rtc->type->lock(rtc);
> >    645	
> >    646		return 0;
> >    647	}
> >    648	
> >  > 649	static const struct pinconf_ops rtc_pinconf_ops = {
> >  > 650		.is_generic = true,
> >  > 651		.pin_config_get = rtc_pinconf_get,
> >  > 652		.pin_config_set = rtc_pinconf_set,
> >    653	};
> >    654	
> >  > 655	static struct pinctrl_desc rtc_pinctrl_desc = {
> >  > 656		.pins = rtc_pins_desc,
> >  > 657		.npins = ARRAY_SIZE(rtc_pins_desc),
> >  > 658		.pctlops = &rtc_pinctrl_ops,
> >  > 659		.confops = &rtc_pinconf_ops,
> >  > 660		.custom_params = rtc_params,
> >  > 661		.num_custom_params = ARRAY_SIZE(rtc_params),
> >    662	#ifdef CONFIG_DEBUG_FS
> >  > 663		.custom_conf_items = rtc_conf_items,
> >    664	#endif
> >  > 665		.owner = THIS_MODULE,
> >    666	};
> >    667	
> >    668	static int omap_rtc_probe(struct platform_device *pdev)
> > 
> > ---
> > 0-DAY kernel test infrastructure                Open Source Technology Center
> > https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
> > 
> 
> -- 
> Marcin Niestroj
Marcin Niestroj Sept. 14, 2016, 9:21 a.m. UTC | #6
On 13.09.2016 23:58, Alexandre Belloni wrote:
> Hi,
>
> On 12/09/2016 at 11:01:05 +0200, Marcin Niestroj wrote :
>> I guess we are missing PINCTRL in Kconfig. I didn't add that before,
>> because I thought that there is a dependency chain GENERIC_PINCONF ->
>> PINCONF -> PINCTRL.
>>
>> So to resolve this issue:
>> 1) Should we add "select" or "depends on" for PINCTRL?
>> 2) Should this option be somehow related to COMPILE_TEST?
>>
>
> Adding a "depends on PINCTRL" line should be enough to solve that issue.
>

Ok, will add that together with "depends on OF", as I noticed it is
also needed.


But right now we will not be able to compile this driver with
COMPILE_TEST, unless we select some architecture that selects PINCTRL.

So maybe it is a good idea to change "config PINCTRL" option from
'bool' to 'bool "Support PINCTRL" if COMPILE_TEST', so we can enable it
manually?
Alexandre Belloni Sept. 15, 2016, 12:08 p.m. UTC | #7
On 14/09/2016 at 11:21:48 +0200, Marcin Niestroj wrote :
> On 13.09.2016 23:58, Alexandre Belloni wrote:
> > Hi,
> > 
> > On 12/09/2016 at 11:01:05 +0200, Marcin Niestroj wrote :
> > > I guess we are missing PINCTRL in Kconfig. I didn't add that before,
> > > because I thought that there is a dependency chain GENERIC_PINCONF ->
> > > PINCONF -> PINCTRL.
> > > 
> > > So to resolve this issue:
> > > 1) Should we add "select" or "depends on" for PINCTRL?
> > > 2) Should this option be somehow related to COMPILE_TEST?
> > > 
> > 
> > Adding a "depends on PINCTRL" line should be enough to solve that issue.
> > 
> 
> Ok, will add that together with "depends on OF", as I noticed it is
> also needed.
> 
> 
> But right now we will not be able to compile this driver with
> COMPILE_TEST, unless we select some architecture that selects PINCTRL.
> 

That is find, Arnd was pointing out that the main use case is x86
allmodconfig and that enables PINCTRL.

> So maybe it is a good idea to change "config PINCTRL" option from
> 'bool' to 'bool "Support PINCTRL" if COMPILE_TEST', so we can enable it
> manually?
> 

This can be done too Mark Brown was suggesting it is a good idea. This
can be submitted as a separate, unrelated patch.
Rob Herring (Arm) Sept. 16, 2016, 3:37 p.m. UTC | #8
On Thu, Sep 08, 2016 at 12:52:03PM +0200, Marcin Niestroj wrote:
> Support configuration of ext_wakeup sources. This patch makes it
> possible to enable ext_wakeup and set it's polarity, depending on board
> configuration. AM335x's dedicated PMIC (tps65217) uses ext_wakeup to
> notify about power-button presses. Handling power-button presses enables
> to recover from RTC-only power states correctly.
> 
> Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
> ---
> Hi,
> 
> This patch adds support for ext_wakeup using generic pinconf device-tree
> bindings, with one added custom property.
> 
> Changes v4 -> v5 (suggested by Rob):
>  * Don't use GPIO defines in ti,input-polarity, use optional ti,active-high
>    boolean instead.
>  * Use '-' instead of '_' in node name.
> 
> Changes v1 -> v4:
>  * This is a total reimplementation, so it is not based on any of the previous
>    patch versions. This approach has been suggested by Tony and Grygorii
>    in [1].
> 
> Patch was developed on 4.7, rebased on 4.8-rc5, tested using chiliBoard.
> 
> [1] http://www.spinics.net/lists/devicetree/msg131516.html
> 
>  Documentation/devicetree/bindings/rtc/rtc-omap.txt |  21 +++

For the binding:

Acked-by: Rob Herring <robh@kernel.org>

>  drivers/rtc/Kconfig                                |   1 +
>  drivers/rtc/rtc-omap.c                             | 168 ++++++++++++++++++++-
>  3 files changed, 182 insertions(+), 8 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/Documentation/devicetree/bindings/rtc/rtc-omap.txt b/Documentation/devicetree/bindings/rtc/rtc-omap.txt
index bf7d11a..bee41f9 100644
--- a/Documentation/devicetree/bindings/rtc/rtc-omap.txt
+++ b/Documentation/devicetree/bindings/rtc/rtc-omap.txt
@@ -18,6 +18,18 @@  Optional properties:
   through pmic_power_en
 - clocks: Any internal or external clocks feeding in to rtc
 - clock-names: Corresponding names of the clocks
+- pinctrl-0: a phandle pointing to the pin settings for the device
+- pinctrl-names: should be "default"
+
+Optional subnodes:
+- generic pinctrl node
+
+Required pinctrl subnodes properties:
+- pins - Names of ext_wakeup pins to configure
+
+Optional pinctrl subnodes properties:
+- input-enable - Enables ext_wakeup
+- ti,active-high - Set input active high (by default active low)
 
 Example:
 
@@ -30,4 +42,13 @@  rtc@1c23000 {
 	system-power-controller;
 	clocks = <&clk_32k_rtc>, <&clk_32768_ck>;
 	clock-names = "ext-clk", "int-clk";
+
+	pinctrl-0 = <&ext_wakeup>;
+	pinctrl-names = "default";
+
+	ext_wakeup: ext-wakeup {
+		pins = "ext_wakeup0";
+		input-enable;
+		ti,active-high;
+	};
 };
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index e215f50..647d913 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -1231,6 +1231,7 @@  config RTC_DRV_IMXDI
 config RTC_DRV_OMAP
 	tristate "TI OMAP Real Time Clock"
 	depends on ARCH_OMAP || ARCH_DAVINCI || COMPILE_TEST
+	select GENERIC_PINCONF
 	help
 	  Say "yes" here to support the on chip real time clock
 	  present on TI OMAP1, AM33xx, DA8xx/OMAP-L13x, AM43xx and DRA7xx.
diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c
index ec2e9c5..d5b4140 100644
--- a/drivers/rtc/rtc-omap.c
+++ b/drivers/rtc/rtc-omap.c
@@ -13,19 +13,23 @@ 
  * 2 of the License, or (at your option) any later version.
  */
 
-#include <linux/kernel.h>
+#include <dt-bindings/gpio/gpio.h>
+#include <linux/bcd.h>
+#include <linux/clk.h>
+#include <linux/delay.h>
 #include <linux/init.h>
-#include <linux/module.h>
+#include <linux/io.h>
 #include <linux/ioport.h>
-#include <linux/delay.h>
-#include <linux/rtc.h>
-#include <linux/bcd.h>
-#include <linux/platform_device.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
+#include <linux/pinctrl/pinctrl.h>
+#include <linux/pinctrl/pinconf.h>
+#include <linux/pinctrl/pinconf-generic.h>
+#include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
-#include <linux/io.h>
-#include <linux/clk.h>
+#include <linux/rtc.h>
 
 /*
  * The OMAP RTC is a year/month/day/hours/minutes/seconds BCD clock
@@ -115,6 +119,8 @@ 
 
 /* OMAP_RTC_PMIC bit fields: */
 #define OMAP_RTC_PMIC_POWER_EN_EN	BIT(16)
+#define OMAP_RTC_PMIC_EXT_WKUP_EN(x)	BIT(x)
+#define OMAP_RTC_PMIC_EXT_WKUP_POL(x)	BIT(4 + x)
 
 /* OMAP_RTC_KICKER values */
 #define	KICK0_VALUE			0x83e70b13
@@ -141,6 +147,7 @@  struct omap_rtc {
 	bool is_pmic_controller;
 	bool has_ext_clk;
 	const struct omap_rtc_device_type *type;
+	struct pinctrl_dev *pctldev;
 };
 
 static inline u8 rtc_read(struct omap_rtc *rtc, unsigned int reg)
@@ -525,6 +532,139 @@  static const struct of_device_id omap_rtc_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, omap_rtc_of_match);
 
+static const struct pinctrl_pin_desc rtc_pins_desc[] = {
+	PINCTRL_PIN(0, "ext_wakeup0"),
+	PINCTRL_PIN(1, "ext_wakeup1"),
+	PINCTRL_PIN(2, "ext_wakeup2"),
+	PINCTRL_PIN(3, "ext_wakeup3"),
+};
+
+static int rtc_pinctrl_get_groups_count(struct pinctrl_dev *pctldev)
+{
+	return 0;
+}
+
+static const char *rtc_pinctrl_get_group_name(struct pinctrl_dev *pctldev,
+					unsigned int group)
+{
+	return NULL;
+}
+
+static const struct pinctrl_ops rtc_pinctrl_ops = {
+	.get_groups_count = rtc_pinctrl_get_groups_count,
+	.get_group_name = rtc_pinctrl_get_group_name,
+	.dt_node_to_map = pinconf_generic_dt_node_to_map_pin,
+	.dt_free_map = pinconf_generic_dt_free_map,
+};
+
+enum rtc_pin_config_param {
+	PIN_CONFIG_ACTIVE_HIGH = PIN_CONFIG_END + 1,
+};
+
+static const struct pinconf_generic_params rtc_params[] = {
+	{"ti,active-high", PIN_CONFIG_ACTIVE_HIGH, 0},
+};
+
+#ifdef CONFIG_DEBUG_FS
+static const struct pin_config_item rtc_conf_items[ARRAY_SIZE(rtc_params)] = {
+	PCONFDUMP(PIN_CONFIG_ACTIVE_HIGH, "input active high", NULL, false),
+};
+#endif
+
+static int rtc_pinconf_get(struct pinctrl_dev *pctldev,
+			unsigned int pin, unsigned long *config)
+{
+	struct omap_rtc *rtc = pinctrl_dev_get_drvdata(pctldev);
+	unsigned int param = pinconf_to_config_param(*config);
+	u32 val;
+	u16 arg = 0;
+
+	rtc->type->unlock(rtc);
+	val = rtc_readl(rtc, OMAP_RTC_PMIC_REG);
+	rtc->type->lock(rtc);
+
+	switch (param) {
+	case PIN_CONFIG_INPUT_ENABLE:
+		if (!(val & OMAP_RTC_PMIC_EXT_WKUP_EN(pin)))
+			return -EINVAL;
+		break;
+	case PIN_CONFIG_ACTIVE_HIGH:
+		if (val & OMAP_RTC_PMIC_EXT_WKUP_POL(pin))
+			return -EINVAL;
+		break;
+	default:
+		return -ENOTSUPP;
+	};
+
+	*config = pinconf_to_config_packed(param, arg);
+
+	return 0;
+}
+
+static int rtc_pinconf_set(struct pinctrl_dev *pctldev,
+			unsigned int pin, unsigned long *configs,
+			unsigned int num_configs)
+{
+	struct omap_rtc *rtc = pinctrl_dev_get_drvdata(pctldev);
+	u32 val;
+	unsigned int param;
+	u16 param_val;
+	int i;
+
+	rtc->type->unlock(rtc);
+	val = rtc_readl(rtc, OMAP_RTC_PMIC_REG);
+	rtc->type->lock(rtc);
+
+	/* active low by default */
+	val |= OMAP_RTC_PMIC_EXT_WKUP_POL(pin);
+
+	for (i = 0; i < num_configs; i++) {
+		param = pinconf_to_config_param(configs[i]);
+		param_val = pinconf_to_config_argument(configs[i]);
+
+		switch (param) {
+		case PIN_CONFIG_INPUT_ENABLE:
+			if (param_val)
+				val |= OMAP_RTC_PMIC_EXT_WKUP_EN(pin);
+			else
+				val &= ~OMAP_RTC_PMIC_EXT_WKUP_EN(pin);
+			break;
+		case PIN_CONFIG_ACTIVE_HIGH:
+			val &= ~OMAP_RTC_PMIC_EXT_WKUP_POL(pin);
+			break;
+		default:
+			dev_err(&rtc->rtc->dev, "Property %u not supported\n",
+				param);
+			return -ENOTSUPP;
+		}
+	}
+
+	rtc->type->unlock(rtc);
+	rtc_writel(rtc, OMAP_RTC_PMIC_REG, val);
+	rtc->type->lock(rtc);
+
+	return 0;
+}
+
+static const struct pinconf_ops rtc_pinconf_ops = {
+	.is_generic = true,
+	.pin_config_get = rtc_pinconf_get,
+	.pin_config_set = rtc_pinconf_set,
+};
+
+static struct pinctrl_desc rtc_pinctrl_desc = {
+	.pins = rtc_pins_desc,
+	.npins = ARRAY_SIZE(rtc_pins_desc),
+	.pctlops = &rtc_pinctrl_ops,
+	.confops = &rtc_pinconf_ops,
+	.custom_params = rtc_params,
+	.num_custom_params = ARRAY_SIZE(rtc_params),
+#ifdef CONFIG_DEBUG_FS
+	.custom_conf_items = rtc_conf_items,
+#endif
+	.owner = THIS_MODULE,
+};
+
 static int omap_rtc_probe(struct platform_device *pdev)
 {
 	struct omap_rtc	*rtc;
@@ -681,6 +821,15 @@  static int omap_rtc_probe(struct platform_device *pdev)
 		}
 	}
 
+	/* Support ext_wakeup pinconf */
+	rtc_pinctrl_desc.name = dev_name(&pdev->dev);
+
+	rtc->pctldev = pinctrl_register(&rtc_pinctrl_desc, &pdev->dev, rtc);
+	if (IS_ERR(rtc->pctldev)) {
+		dev_err(&pdev->dev, "Couldn't register pinctrl driver\n");
+		return PTR_ERR(rtc->pctldev);
+	}
+
 	return 0;
 
 err:
@@ -724,6 +873,9 @@  static int __exit omap_rtc_remove(struct platform_device *pdev)
 	pm_runtime_put_sync(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
 
+	/* Remove ext_wakeup pinconf */
+	pinctrl_unregister(rtc->pctldev);
+
 	return 0;
 }