platform/kernel/linux-rpi.git
5 years agodt-bindings: pinctrl: qcom: Add QCS404 pinctrl binding
Bjorn Andersson [Mon, 24 Sep 2018 22:17:47 +0000 (15:17 -0700)]
dt-bindings: pinctrl: qcom: Add QCS404 pinctrl binding

Add the binding for the TLMM pinctrl block found in the QCS404 platform.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: qcom: Support dispersed tiles
Bjorn Andersson [Mon, 24 Sep 2018 22:17:46 +0000 (15:17 -0700)]
pinctrl: qcom: Support dispersed tiles

On some new platforms the tiles have been placed too far apart to be
covered in a single ioremap. Turn "regs" into an array of base addresses
and make the pingroup carry the information about which tile the pin
resides in.

For existing platforms we map the first entry regs and the existing
pingroups will all use tile 0, meaning that there's no functional
change.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: qcom: Introduce readl/writel accessors
Bjorn Andersson [Mon, 24 Sep 2018 22:17:45 +0000 (15:17 -0700)]
pinctrl: qcom: Introduce readl/writel accessors

In preparation for the support for dispersed tiles move all readl and
writel calls to helper functions. This will allow us to isolate the
added complexity of another indirection.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agodt-bindings: pinctrl: qcom-pmic-gpio: Add pms405 support
Vinod Koul [Tue, 25 Sep 2018 00:06:56 +0000 (17:06 -0700)]
dt-bindings: pinctrl: qcom-pmic-gpio: Add pms405 support

Add support for the PMS405 GPIO support to the Qualcomm PMIC GPIO
binding.

Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: qcom: Add sdm660 pinctrl driver
Neeraj Upadhyay [Tue, 25 Sep 2018 17:37:59 +0000 (18:37 +0100)]
pinctrl: qcom: Add sdm660 pinctrl driver

Add initial pinctrl driver to support pin configuration with
pinctrl framework for sdm660.
Based off CAF implementation.

Signed-off-by: Neeraj Upadhyay <neeraju@codeaurora.org>
Co-Developed-by: Venkatesh Yadav Abbarapu <vabbar@codeaurora.org>
Signed-off-by: Venkatesh Yadav Abbarapu <vabbar@codeaurora.org>
[craig: minor updates for upstreaming, updated tile handling]
Signed-off-by: Craig Tatlor <ctatlor97@gmail.com>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: intel: merrifield: Group IO accessors in code
Andy Shevchenko [Sat, 22 Sep 2018 13:51:16 +0000 (16:51 +0300)]
pinctrl: intel: merrifield: Group IO accessors in code

Consolidate IO accessors in the code to make maintenance a little bit easier
in the future.

No functional change intended.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: intel: merrifield: Introduce mrfld_read_bufcfg()
Andy Shevchenko [Sat, 22 Sep 2018 13:51:15 +0000 (16:51 +0300)]
pinctrl: intel: merrifield: Introduce mrfld_read_bufcfg()

mrfld_read_bufcfg() helper checks if pin is correct and reads back
the current value of corresponding BUFCFG register.

While it adds lines of code it will be easier to maintain in the future.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: sunxi: fix 'pctrl->functions' allocation in sunxi_pinctrl_build_state
YueHaibing [Fri, 21 Sep 2018 01:59:41 +0000 (09:59 +0800)]
pinctrl: sunxi: fix 'pctrl->functions' allocation in sunxi_pinctrl_build_state

fixes following Smatch static check warning:

 ./drivers/pinctrl/sunxi/pinctrl-sunxi.c:1112 sunxi_pinctrl_build_state()
 warn: passing devm_ allocated variable to kfree. 'pctrl->functions'

As we will be calling krealloc() on pointer 'pctrl->functions', which means
kfree() will be called in there, devm_kzalloc() shouldn't be used with
the allocation in the first place.  Fix the warning by calling kcalloc()
and managing the free procedure in error path on our own.

Fixes: 0e37f88d9ad8 ("ARM: sunxi: Add pinctrl driver for Allwinner SoCs")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: mediatek: add eint support to MT6765 pinctrl driver
Mars Cheng [Fri, 21 Sep 2018 04:07:38 +0000 (12:07 +0800)]
pinctrl: mediatek: add eint support to MT6765 pinctrl driver

Just add eint support to MT6765 pinctrl driver as usual as
happens on the other SoCs.

Signed-off-by: Mars Cheng <mars.cheng@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: mediatek: add MT6765 pinctrl driver
ZH Chen [Fri, 21 Sep 2018 04:07:37 +0000 (12:07 +0800)]
pinctrl: mediatek: add MT6765 pinctrl driver

Add MT6765 pinctrl driver based on MediaTek pinctrl-paris core.

Signed-off-by: Mars Cheng <mars.cheng@mediatek.com>
Signed-off-by: ZH Chen <zh.chen@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: mediatek: add no eint function for pin define
Mars Cheng [Fri, 21 Sep 2018 04:07:36 +0000 (12:07 +0800)]
pinctrl: mediatek: add no eint function for pin define

Add NO_EINT_SUPPORT back to pinctrl-mtk-common-v2.h as the alias of
EINT_NA to indicate that some pin not capable of being controlled as eint
and that is required by pinctrl-paris based driver as old
pinctrl-mtk-common.h already had.

Signed-off-by: Mars Cheng <mars.cheng@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: mediatek: fix static checker warning caused by EINT_NA
Sean Wang [Fri, 21 Sep 2018 04:07:35 +0000 (12:07 +0800)]
pinctrl: mediatek: fix static checker warning caused by EINT_NA

EINT_NA is an u16 number, so it should be U16_MAX instead of -1
to fix up drivers/pinctrl/mediatek/pinctrl-paris.c:732 mtk_gpio_to_irq()
warn: impossible condition (desc->eint.eint_n == -1) => (0-u16max == (-1))

Also happens in
drivers/pinctrl/mediatek/pinctrl-paris.c:749 mtk_gpio_set_config()
warn: impossible condition (desc->eint.eint_n == -1) => (0-u16max == (-1))

drivers/pinctrl/mediatek/pinctrl-moore.c:479 mtk_gpio_to_irq()
warn: impossible condition (desc->eint.eint_n == -1) => (0-u16max == (-1))

drivers/pinctrl/mediatek/pinctrl-moore.c:496 mtk_gpio_set_config()
warn: impossible condition '(desc->eint.eint_n == -1) => (0-u16max == (-1))

Fixes: 6561859b067f ("pinctrl: mediatek: add eint support to MT8183 pinctrl driver")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: mediatek: moore: fix return value check in mtk_moore_pinctrl_probe()
Wei Yongjun [Thu, 20 Sep 2018 06:21:50 +0000 (06:21 +0000)]
pinctrl: mediatek: moore: fix return value check in mtk_moore_pinctrl_probe()

In case of error, the function devm_kmalloc_array() returns NULL pointer
not ERR_PTR(). The IS_ERR() test in the return value check should be
replaced with NULL test.

Fixes: b7d7f9eeca55 ("pinctrl: mediatek: extend struct mtk_pin_desc which per-pin driver depends on")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Acked-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: mediatek: make symbol 'mtk_drive' static
Wei Yongjun [Thu, 20 Sep 2018 06:21:42 +0000 (06:21 +0000)]
pinctrl: mediatek: make symbol 'mtk_drive' static

Fixes the following sparse warning:

drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c:37:29: warning:
 symbol 'mtk_drive' was not declared. Should it be static?

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Acked-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: mediatek: paris: fix return value check in mtk_paris_pinctrl_probe()
Wei Yongjun [Thu, 20 Sep 2018 06:21:28 +0000 (06:21 +0000)]
pinctrl: mediatek: paris: fix return value check in mtk_paris_pinctrl_probe()

In case of error, the function devm_kmalloc_array() returns NULL pointer
not ERR_PTR(). The IS_ERR() test in the return value check should be
replaced with NULL test.

Fixes: 805250982bb5 ("pinctrl: mediatek: add pinctrl-paris that implements the vendor dt-bindings")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Acked-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: qcom: spmi-mpp: Fix err handling of pmic_mpp_set_mux
YueHaibing [Thu, 20 Sep 2018 01:58:18 +0000 (01:58 +0000)]
pinctrl: qcom: spmi-mpp: Fix err handling of pmic_mpp_set_mux

'ret' should be returned while pmic_mpp_write_mode_ctl fails.

Fixes: 0e948042c420 ("pinctrl: qcom: spmi-mpp: Implement support for sink mode")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: mxs: do not export mxs_pinctrl_probe
Fabio Estevam [Thu, 20 Sep 2018 15:42:21 +0000 (12:42 -0300)]
pinctrl: mxs: do not export mxs_pinctrl_probe

No user of mxs_pinctrl_probe() can be built as a module, hence
exporting the symbol is not necessary. Drop EXPORT_SYMBOL_GPL.

Inspired by a patch from Stefan Agner for the tegra pinctrl driver.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Reviewed-by: Stefan Agner <stefan@agner.ch>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: tegra: do not export tegra_pinctrl_probe
Stefan Agner [Wed, 19 Sep 2018 01:24:26 +0000 (18:24 -0700)]
pinctrl: tegra: do not export tegra_pinctrl_probe

No user of tegra_pinctrl_probe can be built as a module, hence
exporting the symbol is not necessary. Drop EXPORT_SYMBOL_GPL.

Signed-off-by: Stefan Agner <stefan@agner.ch>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: mtk: Fix up GPIO includes
Linus Walleij [Tue, 18 Sep 2018 22:03:13 +0000 (15:03 -0700)]
pinctrl: mtk: Fix up GPIO includes

Include only <linux/gpio/driver.h> since this is a driver,
not a consumer.

Cc: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: cherryview: Remove linux/init.h and sort headers
Andy Shevchenko [Tue, 4 Sep 2018 11:26:25 +0000 (14:26 +0300)]
pinctrl: cherryview: Remove linux/init.h and sort headers

There is no need to include linux/init.h when at the same time
we include linux/module.h.

Remove redundant inclusion.

While here, sort header block alphabetically for easy maintenance.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: cherryview: Describe members of couple of structs
Andy Shevchenko [Tue, 4 Sep 2018 11:26:23 +0000 (14:26 +0300)]
pinctrl: cherryview: Describe members of couple of structs

Compiler unsatisfied to see half described data structures
and issues warnings:

drivers/pinctrl/intel/pinctrl-cherryview.c:136: warning: Function parameter or member 'acpi_space_id' not described in 'chv_community'
drivers/pinctrl/intel/pinctrl-cherryview.c:169: warning: Function parameter or member 'saved_intmask' not described in 'chv_pinctrl'
drivers/pinctrl/intel/pinctrl-cherryview.c:169: warning: Function parameter or member 'saved_pin_context' not described in 'chv_pinctrl'

To satisfy it, describe mentioned members.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: cherryview: Remove unused groups of pins
Andy Shevchenko [Tue, 4 Sep 2018 11:26:22 +0000 (14:26 +0300)]
pinctrl: cherryview: Remove unused groups of pins

For the long time no one complained about unused groups of pins
for fSPI and SMBUS.

Remove them for good and at the same time satisfy compiler,
otherwise get warning:

CC      drivers/pinctrl/intel/pinctrl-cherryview.o
drivers/pinctrl/intel/pinctrl-cherryview.c:285:23: warning: ‘southwest_smbus_pins’ defined but not used [-Wunused-const-variable=]
  static const unsigned southwest_smbus_pins[] = { 79, 81, 82 };
                        ^~~~~~~~~~~~~~~~~~~~
drivers/pinctrl/intel/pinctrl-cherryview.c:269:23: warning: ‘southwest_fspi_pins’ defined but not used [-Wunused-const-variable=]
  static const unsigned southwest_fspi_pins[] = { 0, 1, 2, 3, 4, 5, 6, 7 };
                        ^~~~~~~~~~~~~~~~~~~

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: cherryview: Re-use data structures from pinctrl-intel.h
Andy Shevchenko [Tue, 4 Sep 2018 11:26:21 +0000 (14:26 +0300)]
pinctrl: cherryview: Re-use data structures from pinctrl-intel.h

We have some data structures duplicated across the drivers.
Let's deduplicate them by using ones that being provided by
pinctrl-intel.h.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: baytrail: Sort headers alphabetically
Andy Shevchenko [Tue, 4 Sep 2018 11:26:20 +0000 (14:26 +0300)]
pinctrl: baytrail: Sort headers alphabetically

Sort header block alphabetically for easy maintenance.

No functional change intended.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: baytrail: Remove unneeded MODULE_DEVICE_TABLE()
Andy Shevchenko [Tue, 4 Sep 2018 11:26:18 +0000 (14:26 +0300)]
pinctrl: baytrail: Remove unneeded MODULE_DEVICE_TABLE()

Since the driver can't be compiled as a module, there is no need
to use no-op macros in the code.

Thus, remove unneeded MODULE_DEVICE_TABLE() macro from the driver.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: intel: Move linux/pm.h to the local header
Andy Shevchenko [Tue, 4 Sep 2018 11:26:17 +0000 (14:26 +0300)]
pinctrl: intel: Move linux/pm.h to the local header

We now using a common macro for PM operations in pin control drivers for Intel
SoCs, and since that macro relies on the definition and macro from linux/pm.h
header file, it's logical to include it directly in pinctrl-intel.h. Otherwise
it's a bit fragile and requires a proper ordering of header inclusion in C
files.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agoMerge branch 'ib-mtk' into devel
Linus Walleij [Tue, 18 Sep 2018 21:55:54 +0000 (14:55 -0700)]
Merge branch 'ib-mtk' into devel

5 years agopinctrl: mediatek: add eint support to MT8183 pinctrl driver
Sean Wang [Sat, 8 Sep 2018 11:07:38 +0000 (19:07 +0800)]
pinctrl: mediatek: add eint support to MT8183 pinctrl driver

Just add eint support to MT8183 pinctrl driver as usual as
happens on the other SoCs.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: mediatek: extend eint build to pinctrl-mtk-common-v2.c
Sean Wang [Sat, 8 Sep 2018 11:07:37 +0000 (19:07 +0800)]
pinctrl: mediatek: extend eint build to pinctrl-mtk-common-v2.c

Almost all MediaTek SoCs apply the exact same logic to build eint, so move
the common functions into pinctrl-mtk-common-v2.c to allow each new pinctrl
driver to reuse them. Also, add a protection checker on hw->soc->eint_hw to
avoid invalid memory access when there's certain SoC not to define its
eint_hw properly in the code flow.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopintcrl: mediatek: add pull tweaks for I2C related pins on MT8183
Zhiyong Tao [Sat, 8 Sep 2018 11:07:36 +0000 (19:07 +0800)]
pintcrl: mediatek: add pull tweaks for I2C related pins on MT8183

This patch provides the advanced pull for I2C used pins on MT8183.

Signed-off-by: Zhiyong Tao <zhiyong.tao@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: mediatek: extend advanced pull support in pinctrl-mtk-common-v2.c
Sean Wang [Sat, 8 Sep 2018 11:07:35 +0000 (19:07 +0800)]
pinctrl: mediatek: extend advanced pull support in pinctrl-mtk-common-v2.c

Extend the advanced pull based on the legacy bias plus additional r0 and r1
to tweak the resistor level.

Signed-off-by: Zhiyong Tao <zhiyong.tao@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: mediatek: add MT8183 pinctrl driver
Zhiyong Tao [Sat, 8 Sep 2018 11:07:34 +0000 (19:07 +0800)]
pinctrl: mediatek: add MT8183 pinctrl driver

Add MT8183 pinctrl driver based on  MediaTek pinctrl-paris core.

Signed-off-by: Zhiyong Tao <zhiyong.tao@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: mediatek: add pinctrl-paris that implements the vendor dt-bindings
Zhiyong Tao [Sat, 8 Sep 2018 11:07:33 +0000 (19:07 +0800)]
pinctrl: mediatek: add pinctrl-paris that implements the vendor dt-bindings

Add pinctrl-paris core that implements vendor dt-binding which MediaTek
tablet, box and smartphone-based SoCs such as MT81xx, MT27xx, and MT67xx
SoCs really want to depend on. The driver is just completely rewritten
according to pinctrl-mtk-common.c but uses the new logic from
pinctrl-mtk-common-v2.c to have an elegant way to support new SoCs in the
future.

Signed-off-by: Zhiyong Tao <zhiyong.tao@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: mediatek: extend struct mtk_pin_desc which per-pin driver depends on
Sean Wang [Sat, 8 Sep 2018 11:07:32 +0000 (19:07 +0800)]
pinctrl: mediatek: extend struct mtk_pin_desc which per-pin driver depends on

Because the pincrl-mtk-common.c is an implementation for per-pin binding,
its pin descriptor includes more information than pinctrl-mtk-common-v2
so far can support. So, we complement these data before writing a driver
using pincrl-mtk-common-v2.c for per-pin binding. By the way, the size of
struct mtk_pin_desc would be larger than struct pinctrl_pin_desc can hold,
so it's necessary to have a copy before the pins information is being
registered into the core.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: mediatek: adjust error code and message when some register not supported...
Sean Wang [Sat, 8 Sep 2018 11:07:31 +0000 (19:07 +0800)]
pinctrl: mediatek: adjust error code and message when some register not supported is found

It's usual and not an error for there's some register not supported by a
certain SoC or a pin so that in the case we have to adjust the message to
print and the error code to get rid of unnecessary false alarm.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: mediatek: add multiple register bases support to pinctrl-mtk-common-v2.c
Sean Wang [Sat, 8 Sep 2018 11:07:30 +0000 (19:07 +0800)]
pinctrl: mediatek: add multiple register bases support to pinctrl-mtk-common-v2.c

Certain SoC own multiple register base for accessing each pin groups,
it's easy to be done with extend struct mtk_pin_field_calc to support
the kind of SoC such as MT8183.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: mediatek: use pin descriptor all in pinctrl-mtk-common-v2.c
Sean Wang [Sat, 8 Sep 2018 11:07:29 +0000 (19:07 +0800)]
pinctrl: mediatek: use pin descriptor all in pinctrl-mtk-common-v2.c

all use pin descriptor instead in pinctrl-mtk-common-v2.c for the
consistency and extensibility.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: mediatek: add MT7623 pinctrl driver based on generic pinctrl binding
Sean Wang [Sat, 8 Sep 2018 11:07:28 +0000 (19:07 +0800)]
pinctrl: mediatek: add MT7623 pinctrl driver based on generic pinctrl binding

Adding MT7623 pinctrl driver based on generic pinctrl binding, that is
good example and demonstrates how to port any other MediaTek SoCs
pinctrl-moore core when people really would like to use the generic
pinctrl binding to support these MediaTek SoCs.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: mediatek: add pullen, pullsel register support to pinctrl-mtk-common-v2.c
Sean Wang [Sat, 8 Sep 2018 11:07:27 +0000 (19:07 +0800)]
pinctrl: mediatek: add pullen, pullsel register support to pinctrl-mtk-common-v2.c

Certain SoCs have to program an extra PULLEN, PULLSEL register to configure
bias related function so that we add it in the existing path.

Signed-off-by: Ryder.Lee <ryder.lee@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: mediatek: add ies register support to pinctrl-mtk-common-v2.c
Sean Wang [Sat, 8 Sep 2018 11:07:26 +0000 (19:07 +0800)]
pinctrl: mediatek: add ies register support to pinctrl-mtk-common-v2.c

Certain SoCs have to program an extra IES register to configure input
enabled mode so that we add it in the existing path as an option.

Signed-off-by: Ryder.Lee <ryder.lee@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: mediatek: add advanced pull related support to pinctrl-mtk-common-v2.c
Sean Wang [Sat, 8 Sep 2018 11:07:25 +0000 (19:07 +0800)]
pinctrl: mediatek: add advanced pull related support to pinctrl-mtk-common-v2.c

There are some specific pins (i.e. MMC/SD) need specific registers to
turn on/off the 10K & 50k(75K) resistors when pull up/down.

Therefore, this patch adds the custom prarmeters so that the user could
control it through device tree.

Signed-off-by: Ryder.Lee <ryder.lee@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: mediatek: add pull related support to pinctrl-mtk-common-v2.c
Sean Wang [Sat, 8 Sep 2018 11:07:24 +0000 (19:07 +0800)]
pinctrl: mediatek: add pull related support to pinctrl-mtk-common-v2.c

Put pull control support related functions to pinctrl-mtk-common-v2.c
as these operations might be different by chips and allow different
type of driver to reuse them.

Signed-off-by: Ryder.Lee <ryder.lee@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: mediatek: add drv register support to pinctrl-mtk-common-v2.c
Sean Wang [Sat, 8 Sep 2018 11:07:23 +0000 (19:07 +0800)]
pinctrl: mediatek: add drv register support to pinctrl-mtk-common-v2.c

Certain SoCs have to program DRV register to configure driving
strength so that we add it in the existing path as an option.

Signed-off-by: Ryder.Lee <ryder.lee@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: mediatek: add driving strength related support to pinctrl-mtk-common-v2.c
Sean Wang [Sat, 8 Sep 2018 11:07:22 +0000 (19:07 +0800)]
pinctrl: mediatek: add driving strength related support to pinctrl-mtk-common-v2.c

Put driving strength support related functions to pinctrl-mtk-common-v2.c
as these operations might be different by chips and allow different type
of driver to reuse them.

Signed-off-by: Ryder.Lee <ryder.lee@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: mediatek: extend struct mtk_pin_soc to pinctrl-mtk-common-v2.c
Sean Wang [Sat, 8 Sep 2018 11:07:21 +0000 (19:07 +0800)]
pinctrl: mediatek: extend struct mtk_pin_soc to pinctrl-mtk-common-v2.c

Add two parameters gpio_m and eint_m for configuring GPIO mode and EINT
mode, they might be varying depend on SoC.

Signed-off-by: Ryder.Lee <ryder.lee@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: mediatek: extend struct mtk_pin_desc to pinctrl-mtk-common-v2.c
Sean Wang [Sat, 8 Sep 2018 11:07:20 +0000 (19:07 +0800)]
pinctrl: mediatek: extend struct mtk_pin_desc to pinctrl-mtk-common-v2.c

This patch introduces a data structure mtk_pin_desc, which is used to
provide information per pin characteristic such as driving current,
eint number and a driving index, that is used to lookup table describing
the details about the groups of driving current by which the pin is able
to adjust the driving strength so that the driver could get the
appropriate driving group when calls .pin_config_get()/set().

Signed-off-by: Ryder.Lee <ryder.lee@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: mediatek: extend struct mtk_pin_field_calc to pinctrl-mtk-common-v2.c
Sean Wang [Sat, 8 Sep 2018 11:07:19 +0000 (19:07 +0800)]
pinctrl: mediatek: extend struct mtk_pin_field_calc to pinctrl-mtk-common-v2.c

This patch adds members sz_reg fixed in struct mtk_pin_field_calc

- The 'fixed' is used to represent the consecutive pins share the same
bits within the same register with the 1st pin so that it can largely
reduce the entry size a bit.

- The 'sz_reg' is used to indicate the range of bits we use in a register
  that may vary by SoC

The above changes make the code more generic and this is useful as there
might be other existing or future chips all use the same logic to access
their register set and then being a little more abstract could help in the
long run.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: mediatek: add pinctrl-moore that implements the generic pinctrl dt-bindings
Sean Wang [Sat, 8 Sep 2018 11:07:18 +0000 (19:07 +0800)]
pinctrl: mediatek: add pinctrl-moore that implements the generic pinctrl dt-bindings

Add a generic driver pinctrl-moore.c for MT762x SoC and any other SoC
that would like to use generic dt-binding. The patch is furtherly
refactored from pinctrl-mt7622.c that totally uses the functions back by
the generic pinctrl core such as GENERIC_PINCONF, GENERIC_PINCTRL_GROUPS,
and GENERIC_PINMUX_FUNCTIONS and its binding also completely follows up
pinctrl-bindings.txt in Documentation/devicetree/bindings/pinctrl/ to
implement.

Signed-off-by: Ryder.Lee <ryder.lee@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: mediatek: add pinctrl-mtk-common-v2 for all MediaTek pinctrls
Sean Wang [Sat, 8 Sep 2018 11:07:17 +0000 (19:07 +0800)]
pinctrl: mediatek: add pinctrl-mtk-common-v2 for all MediaTek pinctrls

Irregular register arrangement and distinct logic access from various
MediaTek SoCs would cause pinctrl-mtk-common to bloat and really hard to
maintain in the future so that the patch creates pinctrl-mtk-common-v2
based on the core of mt7622-pinctrl.

The goals pinctrl-mtk-common-v2 want to achieve are to hopefully support
all of MediaTek SoCs, and two kinds of dt-bindings being supported,
Linux generic pinctrl dt-binding mt7622 supports and MediaTek per-pin
dt-binding the other SoCs support the MT8183 and MT6765 incline to make
use of.

The patch starts to refactor MT7622 pinctrl driver first with splitting
out these portable ways from there such as table-based register operation
and drive strength control that is common in both kinds of driver.

Signed-off-by: Ryder.Lee <ryder.lee@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: Include <linux/gpio/driver.h> nothing else
Linus Walleij [Thu, 13 Sep 2018 11:58:21 +0000 (13:58 +0200)]
pinctrl: Include <linux/gpio/driver.h> nothing else

These drivers are GPIO drivers, and the do not need to use the
legacy header in <linux/gpio.h>, go directly for
<linux/gpio/driver.h> instead.

Replace any use of GPIOF_* with 0/1, these flags are for
consumers, not drivers.

Get rid of a few gpio_to_irq() users that was littering
around the place, use local callbacks or avoid using it at
all.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: at91-pio4: Get rid of legacy call
Linus Walleij [Thu, 13 Sep 2018 12:02:12 +0000 (14:02 +0200)]
pinctrl: at91-pio4: Get rid of legacy call

By just moving the atmel_gpio_to_irq() and calling the internal
function we can get rid of the driver calling back out into the
deprecated external consumer API.

Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: at91: don't use the same irqchip with multiple gpiochips
Ludovic Desroches [Thu, 13 Sep 2018 12:42:13 +0000 (14:42 +0200)]
pinctrl: at91: don't use the same irqchip with multiple gpiochips

Sharing the same irqchip with multiple gpiochips is not a good
practice. For instance, when installing hooks, we change the state
of the irqchip. The initial state of the irqchip for the second
gpiochip to register is then disrupted.

Signed-off-by: Ludovic Desroches <ludovic.desroches@microchip.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: at91-pio4: fix has_config check in atmel_pctl_dt_subnode_to_map()
Dan Carpenter [Mon, 10 Sep 2018 08:37:45 +0000 (11:37 +0300)]
pinctrl: at91-pio4: fix has_config check in atmel_pctl_dt_subnode_to_map()

Smatch complains about this condition:

if (has_config && num_pins >= 1)

The "has_config" variable is either uninitialized or true.  The
"num_pins" variable is unsigned and we verified that it is non-zero on
the lines before so we know "num_pines >= 1" is true.  Really, we could
just check "num_configs" directly and remove the "has_config" variable.

Fixes: 776180848b57 ("pinctrl: introduce driver for Atmel PIO4 controller")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: qcom: spmi-mpp: Fix drive strength setting
Stephen Boyd [Fri, 31 Aug 2018 00:58:52 +0000 (17:58 -0700)]
pinctrl: qcom: spmi-mpp: Fix drive strength setting

It looks like we parse the drive strength setting here, but never
actually write it into the hardware to update it. Parse the setting and
then write it at the end of the pinconf setting function so that it
actually sticks in the hardware.

Fixes: 0e948042c420 ("pinctrl: qcom: spmi-mpp: Implement support for sink mode")
Cc: Doug Anderson <dianders@chromium.org>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: sirf: atlas7: remove set but not used variables 'conf, bank'
YueHaibing [Fri, 31 Aug 2018 02:09:06 +0000 (02:09 +0000)]
pinctrl: sirf: atlas7: remove set but not used variables 'conf, bank'

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/pinctrl/sirf/pinctrl-atlas7.c: In function 'atlas7_pinmux_resume_noirq':
drivers/pinctrl/sirf/pinctrl-atlas7.c:5545:6: warning:
 variable 'bank' set but not used [-Wunused-but-set-variable]
  u32 bank;

drivers/pinctrl/sirf/pinctrl-atlas7.c:5543:28: warning:
 variable 'conf' set but not used [-Wunused-but-set-variable]
  struct atlas7_pad_config *conf;

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: spmi-mpp: Fix pmic_mpp_config_get() to be compliant
Douglas Anderson [Thu, 30 Aug 2018 15:23:39 +0000 (08:23 -0700)]
pinctrl: spmi-mpp: Fix pmic_mpp_config_get() to be compliant

If you look at "pinconf-groups" in debugfs for ssbi-mpp you'll notice
it looks like nonsense.

The problem is fairly well described in commit 1cf86bc21257 ("pinctrl:
qcom: spmi-gpio: Fix pmic_gpio_config_get() to be compliant") and
commit 05e0c828955c ("pinctrl: msm: Fix msm_config_group_get() to be
compliant"), but it was pointed out that ssbi-mpp has the same
problem.  Let's fix it there too.

NOTE: in case it's helpful to someone reading this, the way to tell
whether to do the -EINVAL or not is to look at the PCONFDUMP for a
given attribute.  If the last element (has_arg) is false then you need
to do the -EINVAL trick.

ALSO NOTE: it seems unlikely that the values returned when we try to
get PIN_CONFIG_BIAS_PULL_UP will actually be printed since "has_arg"
is false for that one, but I guess it's still fine to return different
values so I kept doing that.  It seems like another driver (ssbi-gpio)
uses a custom attribute (PM8XXX_QCOM_PULL_UP_STRENGTH) for something
similar so maybe a future change should do that here too.

Fixes: cfb24f6ebd38 ("pinctrl: Qualcomm SPMI PMIC MPP pin controller driver")
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Stephen Boyd <sboyd@kernel.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: ssbi-gpio: Fix pm8xxx_pin_config_get() to be compliant
Douglas Anderson [Thu, 30 Aug 2018 15:23:38 +0000 (08:23 -0700)]
pinctrl: ssbi-gpio: Fix pm8xxx_pin_config_get() to be compliant

If you look at "pinconf-groups" in debugfs for ssbi-gpio you'll notice
it looks like nonsense.

The problem is fairly well described in commit 1cf86bc21257 ("pinctrl:
qcom: spmi-gpio: Fix pmic_gpio_config_get() to be compliant") and
commit 05e0c828955c ("pinctrl: msm: Fix msm_config_group_get() to be
compliant"), but it was pointed out that ssbi-gpio has the same
problem.  Let's fix it there too.

Fixes: b4c45fe974bc ("pinctrl: qcom: ssbi: Family A gpio & mpp drivers")
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Stephen Boyd <sboyd@kernel.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agoMerge tag 'sh-pfc-for-v4.20-tag1' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Walleij [Fri, 31 Aug 2018 13:42:33 +0000 (15:42 +0200)]
Merge tag 'sh-pfc-for-v4.20-tag1' of git://git./linux/kernel/git/geert/renesas-drivers into devel

pinctrl: sh-pfc: Updates for v4.20

  - Add SATA and audio pin groups on R-Car M3-N,
  - Add EtherAVB pin groups on RZ/G1C,
  - Add PWM and display (DU) pin groups on R-Car E3,
  - Add support for the new RZ/G2M (r8a774a1) SoC.

5 years agopinctrl: remove unnecessary unlikely()
Igor Stoppa [Thu, 30 Aug 2018 22:34:25 +0000 (01:34 +0300)]
pinctrl: remove unnecessary unlikely()

WARN_ON() already contains an unlikely(), so it's not necessary to
wrap it into another.

Signed-off-by: Igor Stoppa <igor.stoppa@huawei.com>
Cc: Andrew Jeffery <andrew@aj.id.au>
Cc: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: lewisburg: Define PM ops via INTEL_PINCTRL_PM_OPS()
Andy Shevchenko [Thu, 30 Aug 2018 16:27:51 +0000 (19:27 +0300)]
pinctrl: lewisburg: Define PM ops via INTEL_PINCTRL_PM_OPS()

Instead of open coding same structure definition for PM operations,
replace it with a common macro.

No functional change intended.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: sunrisepoint: Define PM ops via INTEL_PINCTRL_PM_OPS()
Andy Shevchenko [Thu, 30 Aug 2018 16:27:50 +0000 (19:27 +0300)]
pinctrl: sunrisepoint: Define PM ops via INTEL_PINCTRL_PM_OPS()

Instead of open coding same structure definition for PM operations,
replace it with a common macro.

No functional change intended.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: icelake: Define PM ops via INTEL_PINCTRL_PM_OPS()
Andy Shevchenko [Thu, 30 Aug 2018 16:27:49 +0000 (19:27 +0300)]
pinctrl: icelake: Define PM ops via INTEL_PINCTRL_PM_OPS()

Instead of open coding same structure definition for PM operations,
replace it with a common macro.

No functional change intended.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: geminilake: Define PM ops via INTEL_PINCTRL_PM_OPS()
Andy Shevchenko [Thu, 30 Aug 2018 16:27:48 +0000 (19:27 +0300)]
pinctrl: geminilake: Define PM ops via INTEL_PINCTRL_PM_OPS()

Instead of open coding same structure definition for PM operations,
replace it with a common macro.

No functional change intended.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: denverton: Define PM ops via INTEL_PINCTRL_PM_OPS()
Andy Shevchenko [Thu, 30 Aug 2018 16:27:47 +0000 (19:27 +0300)]
pinctrl: denverton: Define PM ops via INTEL_PINCTRL_PM_OPS()

Instead of open coding same structure definition for PM operations,
replace it with a common macro.

No functional change intended.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: cedarfork: Define PM ops via INTEL_PINCTRL_PM_OPS()
Andy Shevchenko [Thu, 30 Aug 2018 16:27:46 +0000 (19:27 +0300)]
pinctrl: cedarfork: Define PM ops via INTEL_PINCTRL_PM_OPS()

Instead of open coding same structure definition for PM operations,
replace it with a common macro.

No functional change intended.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: cannonlake: Define PM ops via INTEL_PINCTRL_PM_OPS()
Andy Shevchenko [Thu, 30 Aug 2018 16:27:45 +0000 (19:27 +0300)]
pinctrl: cannonlake: Define PM ops via INTEL_PINCTRL_PM_OPS()

Instead of open coding same structure definition for PM operations,
replace it with a common macro.

No functional change intended.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: broxton: Define PM ops via INTEL_PINCTRL_PM_OPS()
Andy Shevchenko [Thu, 30 Aug 2018 16:27:44 +0000 (19:27 +0300)]
pinctrl: broxton: Define PM ops via INTEL_PINCTRL_PM_OPS()

Instead of open coding same structure definition for PM operations,
replace it with a common macro.

No functional change intended.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: intel: Introduce common macro for PM operations
Andy Shevchenko [Thu, 30 Aug 2018 16:27:43 +0000 (19:27 +0300)]
pinctrl: intel: Introduce common macro for PM operations

This common macro will simplify the code of pin control drivers
for Intel SoCs.

Suggested-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: sunrisepoint: Convert to use intel_pinctrl_probe_by_hid()
Andy Shevchenko [Thu, 30 Aug 2018 16:27:42 +0000 (19:27 +0300)]
pinctrl: sunrisepoint: Convert to use intel_pinctrl_probe_by_hid()

Get rid of code duplication by converting to use intel_pinctrl_probe_by_hid().

No functional change intended.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: cannonlake: Convert to use intel_pinctrl_probe_by_hid()
Andy Shevchenko [Thu, 30 Aug 2018 16:27:41 +0000 (19:27 +0300)]
pinctrl: cannonlake: Convert to use intel_pinctrl_probe_by_hid()

Get rid of code duplication by converting to use intel_pinctrl_probe_by_hid().

No functional change intended.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: intel: Introduce intel_pinctrl_probe_by_hid() internal API
Andy Shevchenko [Thu, 30 Aug 2018 16:27:40 +0000 (19:27 +0300)]
pinctrl: intel: Introduce intel_pinctrl_probe_by_hid() internal API

Introduce intel_pinctrl_probe_by_hid() internal API to simplify drivers,
which are using ACPI _HID to distinguish which SoC data needs to be used
when being probed.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: baytrail: Convert to use device_get_match_data()
Andy Shevchenko [Thu, 30 Aug 2018 16:27:39 +0000 (19:27 +0300)]
pinctrl: baytrail: Convert to use device_get_match_data()

Get rid of code duplication by converting to use device_get_match_data().

No functional change intended.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: geminilake: Convert to use intel_pinctrl_probe_by_uid()
Andy Shevchenko [Thu, 30 Aug 2018 16:27:38 +0000 (19:27 +0300)]
pinctrl: geminilake: Convert to use intel_pinctrl_probe_by_uid()

Get rid of code duplication by converting to use intel_pinctrl_probe_by_uid().

No functional change intended.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: broxton: Convert to use intel_pinctrl_probe_by_uid()
Andy Shevchenko [Thu, 30 Aug 2018 16:27:37 +0000 (19:27 +0300)]
pinctrl: broxton: Convert to use intel_pinctrl_probe_by_uid()

Get rid of code duplication by converting to use intel_pinctrl_probe_by_uid().

No functional change intended.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: intel: Introduce intel_pinctrl_probe_by_uid() internal API
Andy Shevchenko [Thu, 30 Aug 2018 16:27:36 +0000 (19:27 +0300)]
pinctrl: intel: Introduce intel_pinctrl_probe_by_uid() internal API

Introduce intel_pinctrl_probe_by_uid() internal API to simplify drivers,
which are using ACPI _UID to distinguish which SoC data needs to be used
when being probed.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: sh-pfc: r8a77990: Add DU pins, groups and function
Laurent Pinchart [Tue, 28 Aug 2018 11:11:04 +0000 (14:11 +0300)]
pinctrl: sh-pfc: r8a77990: Add DU pins, groups and function

This patch adds DU pins, groups and function for the R8A77990 (E3) SoC.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
5 years agoMerge branch 'ib-ingenic' into devel
Linus Walleij [Wed, 29 Aug 2018 12:10:34 +0000 (14:10 +0200)]
Merge branch 'ib-ingenic' into devel

5 years agopinctrl: Convert to using %pOFn instead of device_node.name
Rob Herring [Tue, 28 Aug 2018 01:52:41 +0000 (20:52 -0500)]
pinctrl: Convert to using %pOFn instead of device_node.name

In preparation to remove the node name pointer from struct device_node,
convert printf users to use the %pOFn format specifier.

Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Dong Aisheng <aisheng.dong@nxp.com>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Stefan Agner <stefan@agner.ch>
Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
Cc: Sean Wang <sean.wang@mediatek.com>
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Cc: Carlo Caione <carlo@caione.org>
Cc: Kevin Hilman <khilman@baylibre.com>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Gregory Clement <gregory.clement@bootlin.com>
Cc: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: Heiko Stuebner <heiko@sntech.de>
Cc: Tony Lindgren <tony@atomide.com>
Cc: Haojian Zhuang <haojian.zhuang@linaro.org>
Cc: Patrice Chotard <patrice.chotard@st.com>
Cc: Barry Song <baohua@kernel.org>
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: Alexandre Torgue <alexandre.torgue@st.com>
Cc: Maxime Ripard <maxime.ripard@bootlin.com>
Cc: Chen-Yu Tsai <wens@csie.org>
Cc: linux-gpio@vger.kernel.org
Cc: linux-mediatek@lists.infradead.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-amlogic@lists.infradead.org
Cc: linux-rockchip@lists.infradead.org
Cc: linux-omap@vger.kernel.org
Acked-by: Dong Aisheng <aisheng.dong@nxp.com>
Reviewed-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Acked-by: Sean Wang <sean.wang@mediatek.com>
Acked-by: Chen-Yu Tsai <wens@csie.org>
Acked-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: intel: Fix a spelling typo in kernel documentation
Andy Shevchenko [Mon, 20 Aug 2018 13:35:07 +0000 (16:35 +0300)]
pinctrl: intel: Fix a spelling typo in kernel documentation

The parameter 'community' had been spelled incorrectly.
Fix it here.

As a side effect it satisfies static checkers that issue
the following warnings:

drivers/pinctrl/intel/pinctrl-intel.c:845: warning: Function parameter or member 'community' not described in 'intel_gpio_to_pin'
drivers/pinctrl/intel/pinctrl-intel.c:845: warning: Excess function parameter 'commmunity' description in 'intel_gpio_to_pin'

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: lpc18xx: mark expected switch fall-throughs
Gustavo A. R. Silva [Wed, 15 Aug 2018 17:10:35 +0000 (12:10 -0500)]
pinctrl: lpc18xx: mark expected switch fall-throughs

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Addresses-Coverity-ID: 1292308 ("Missing break in switch")
Addresses-Coverity-ID: 1292309 ("Missing break in switch")
Addresses-Coverity-ID: 1309546 ("Missing break in switch")
Addresses-Coverity-ID: 1357369 ("Missing break in switch")
Addresses-Coverity-ID: 1357389 ("Missing break in switch")
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: ingenic: Include the right header
Linus Walleij [Wed, 29 Aug 2018 11:39:54 +0000 (13:39 +0200)]
pinctrl: ingenic: Include the right header

This is a GPIO driver so only include <linux/gpio/driver.h>

Cc: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agogpio: ingenic: Remove driver
Paul Cercueil [Tue, 21 Aug 2018 16:42:36 +0000 (18:42 +0200)]
gpio: ingenic: Remove driver

The pinctrl-ingenic driver is now handling the GPIO chips directly.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: ingenic: Drop dependency on MACH_INGENIC
Paul Cercueil [Tue, 21 Aug 2018 16:42:35 +0000 (18:42 +0200)]
pinctrl: ingenic: Drop dependency on MACH_INGENIC

Depending on MACH_INGENIC prevent us from creating a generic kernel that
works on more than one MIPS board. Instead, we just depend on MIPS being
set.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: ingenic: Add support for the JZ4725B
Paul Cercueil [Tue, 21 Aug 2018 16:42:34 +0000 (18:42 +0200)]
pinctrl: ingenic: Add support for the JZ4725B

Add support for the JZ4725B and compatible SoCs from Ingenic.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: ingenic: Implement .get_direction for GPIO chips
Paul Cercueil [Tue, 21 Aug 2018 16:42:33 +0000 (18:42 +0200)]
pinctrl: ingenic: Implement .get_direction for GPIO chips

This allows to read from debugfs whether the GPIOs requested are set as
input or output.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: ingenic: Merge GPIO functionality
Paul Cercueil [Tue, 21 Aug 2018 16:42:32 +0000 (18:42 +0200)]
pinctrl: ingenic: Merge GPIO functionality

Merge the code of the gpio-ingenic driver into the pinctrl-ingenic
driver.

The reason behind this, is that the same hardware block handles both pin
config / muxing and GPIO.

ingenic_gpio_probe() have been marked as __init, but for the most part,
the code is the exact same as what it was in the gpio-ingenic driver.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: ingenic: Mark probe function as __init
Paul Cercueil [Tue, 21 Aug 2018 16:42:31 +0000 (18:42 +0200)]
pinctrl: ingenic: Mark probe function as __init

By using platform_driver_probe() instead of platform_driver_register(),
we can mark the ingenic_pinctrl_probe() function as __init.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: ingenic: Probe driver at subsys_initcall
Paul Cercueil [Tue, 21 Aug 2018 16:42:30 +0000 (18:42 +0200)]
pinctrl: ingenic: Probe driver at subsys_initcall

Using postcore_initcall() makes the driver try to initialize way too
early.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agodt-bindings: pinctrl: Update pinctrl-ingenic for JZ4725B and GPIO merge
Paul Cercueil [Tue, 21 Aug 2018 16:42:29 +0000 (18:42 +0200)]
dt-bindings: pinctrl: Update pinctrl-ingenic for JZ4725B and GPIO merge

The pinctrl-ingenic driver now supports the JZ4725B SoC.

Furthermore, the gpio-ingenic driver was dropped and the pinctrl-ingenic
driver is now responsible for providing the GPIO functionality.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: uniphier: drop meaningless pin from SD1 pin-mux of Pro4
Masahiro Yamada [Sat, 11 Aug 2018 02:16:13 +0000 (11:16 +0900)]
pinctrl: uniphier: drop meaningless pin from SD1 pin-mux of Pro4

The pin 327 was supposed to be used as a voltage control line for the
SD card regulator, but the SD card port1 does not support UHS-I.  It
only supports 3.3V signaling, hence this pin is pointless.

Just a note about the background.  At first, hardware engineers tried
to implement the UHS for this port.  Then, they needed to shrink the
silicon die size, and gave up the UHS, but forgot to remove the pin
assignment.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: madera: Fix missing space in debugfs output
Richard Fitzgerald [Tue, 7 Aug 2018 09:32:26 +0000 (10:32 +0100)]
pinctrl: madera: Fix missing space in debugfs output

The SCHMITT tag was being dumped without a separating space.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: madera: Return ENOTSUPP for unsupported pin attributes
Richard Fitzgerald [Tue, 7 Aug 2018 09:32:25 +0000 (10:32 +0100)]
pinctrl: madera: Return ENOTSUPP for unsupported pin attributes

The pin_config_[get|set] functions should return ENOTSUPP if
the requested attribute isn't supported.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: madera: Set is_generic
Richard Fitzgerald [Tue, 7 Aug 2018 09:32:24 +0000 (10:32 +0100)]
pinctrl: madera: Set is_generic

We are using the generic pin configuration interface so
we can set is_generic.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: meson-g12a: add pinctrl driver support
Yixun Lan [Tue, 7 Aug 2018 02:06:34 +0000 (10:06 +0800)]
pinctrl: meson-g12a: add pinctrl driver support

Add the pinctrl driver for Meson-G12A SoC which share the similar IP as
the previous Meson-AXG SoC, both use same pinmux ops (register layout).
A new driver is needed here due to the differences in the pins.

Starting from Meson-AXG SoC, the pinctrl controller block use 4
continues register bits to specific the pin mux function, while comparing
to old generation SoC which using variable length register bits for
the pin mux definition. The new design greatly simplify the software model.

For the detail example, one 32bit register can be divided into 8 parts,
each has 4 bits whose value start from 0 - 7, each can describe one pin,
the value 0 is always devoted to GPIO function, while 1 - 7 devoted to
the mux pin function.

Please note, the GPIOE is actually located at AO (always on) bank.

Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Xingyu Chen <xingyu.chen@amlogic.com>
Signed-off-by: Yixun Lan <yixun.lan@amlogic.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: Add compatibles for Amlogic Meson G12A pin controllers
Yixun Lan [Tue, 7 Aug 2018 02:06:33 +0000 (10:06 +0800)]
pinctrl: Add compatibles for Amlogic Meson G12A pin controllers

Add new compatible name for Amlogic's Meson-G12A pin controllers,
add a dt-binding header file which document the detail pin names.

Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Xingyu Chen <xingyu.chen@amlogic.com>
Signed-off-by: Yixun Lan <yixun.lan@amlogic.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: nuvoton: add NPCM7xx pinctrl and GPIO driver
Tomer Maimon [Wed, 8 Aug 2018 09:25:26 +0000 (12:25 +0300)]
pinctrl: nuvoton: add NPCM7xx pinctrl and GPIO driver

Add Nuvoton BMC NPCM750/730/715/705 Pinmux and
GPIO controller driver.

Signed-off-by: Tomer Maimon <tmaimon77@gmail.com>
[Add back select GPIO_GENERIC]
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agodt-binding: pinctrl: Add NPCM7xx pinctrl and GPIO documentation
Tomer Maimon [Wed, 8 Aug 2018 09:25:25 +0000 (12:25 +0300)]
dt-binding: pinctrl: Add NPCM7xx pinctrl and GPIO documentation

Added device tree binding documentation for Nuvoton BMC
NPCM750/730/715/705 pinmux and GPIO controller.

Signed-off-by: Tomer Maimon <tmaimon77@gmail.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: msm: Configure interrupts as input and gpio mode
Stephen Boyd [Thu, 16 Aug 2018 20:06:48 +0000 (13:06 -0700)]
pinctrl: msm: Configure interrupts as input and gpio mode

When requesting a gpio as an interrupt, we should make sure to mux the
pin as the GPIO function and configure it to be an input so that various
functions or output signals don't affect the interrupt state of the pin.
So far, we've relied on pinmux configurations in DT to handle this, but
let's explicitly configure this in the code so that DT implementers
don't have to get this part right.

Cc: Doug Anderson <dianders@chromium.org>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: msm: Mux out gpio function with gpio_request()
Stephen Boyd [Thu, 16 Aug 2018 20:06:47 +0000 (13:06 -0700)]
pinctrl: msm: Mux out gpio function with gpio_request()

We rely on devices to use pinmuxing configurations in DT to select the
GPIO function (function 0) if they're going to use the gpio in GPIO
mode. Let's simplify things for driver authors by implementing
gpio_request_enable() for this pinctrl driver to mux out the GPIO
function when the gpio is use from gpiolib.

Cc: Doug Anderson <dianders@chromium.org>
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
5 years agopinctrl: sh-pfc: r8a77965: Add Audio SSI pin support
Hoan Nguyen An [Tue, 28 Aug 2018 04:37:19 +0000 (13:37 +0900)]
pinctrl: sh-pfc: r8a77965: Add Audio SSI pin support

Add Audio SSI pin support for r8a77965.

Signed-off-by: Hoan Nguyen An <na-hoan@jinso.co.jp>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>