Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'pinctrl-v5.7-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl

Pull pin control updates from Linus Walleij:
"This is the bulk of pin control changes for the v5.7 kernel cycle.

There are no core changes this time, only driver developments:

- New driver for the Dialog Semiconductor DA9062 Power Management
Integrated Circuit (PMIC).

- Renesas SH-PFC has improved consistency, with group and register
checks in the configuration checker.

- New subdriver for the Qualcomm IPQ6018.

- Add the RGMII pin control functionality to Qualcomm IPQ8064.

- Performance and code quality cleanups in the Mediatek driver.

- Improve the Broadcom BCM2835 support to cover all the GPIOs that
exist in it.

- The Allwinner/Sunxi driver properly masks non-wakeup IRQs on
suspend.

- Add some missing groups and functions to the Ingenic driver.

- Convert some of the Freescale device tree bindings to use the new
and all improved JSON YAML markup.

- Refactorings and support for the SFIO/GPIO in the Tegra194 SoC
driver.

- Support high impedance mode in the Spreadtrum/Unisoc driver"

* tag 'pinctrl-v5.7-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl: (64 commits)
pinctrl: qcom: fix compilation error
pinctrl: qcom: use scm_call to route GPIO irq to Apps
pinctrl: sprd: Add pin high impedance mode support
pinctrl: sprd: Use the correct pin output configuration
pinctrl: tegra: Add SFIO/GPIO programming on Tegra194
pinctrl: tegra: Renumber the GG.0 and GG.1 pins
pinctrl: tegra: Do not add default pin range on Tegra194
pinctrl: tegra: Pass struct tegra_pmx for pin range check
pinctrl: tegra: Fix "Scmitt" -> "Schmitt" typo
pinctrl: tegra: Fix whitespace issues for improved readability
pinctrl: mediatek: Use scnprintf() for avoiding potential buffer overflow
pinctrl: freescale: drop the dependency on ARM64 for i.MX8M
Revert "pinctrl: mvebu: armada-37xx: use use platform api"
dt-bindings: pinctrl: at91: Fix a typo ("descibe")
pinctrl: meson: add tsin pinctrl for meson gxbb/gxl/gxm
pinctrl: sprd: Fix the kconfig warning
pinctrl: ingenic: add hdmi-ddc pin control group
pinctrl: sirf/atlas7: Replace zero-length array with flexible-array member
pinctrl: sprd: Allow the SPRD pinctrl driver building into a module
pinctrl: Export some needed symbols at module load time
...

+3365 -758
+1 -1
Documentation/devicetree/bindings/pinctrl/atmel,at91-pinctrl.txt
··· 38 38 0xffffffff 0x7fff3ccf /* pioB */ 39 39 0xffffffff 0x007fffff /* pioC */ 40 40 41 - For each peripheral/bank we will descibe in a u32 if a pin can be 41 + For each peripheral/bank we will describe in a u32 if a pin can be 42 42 configured in it by putting 1 to the pin bit (1 << pin) 43 43 44 44 Let's take the pioA on peripheral B
-36
Documentation/devicetree/bindings/pinctrl/fsl,imx8mm-pinctrl.txt
··· 1 - * Freescale IMX8MM IOMUX Controller 2 - 3 - Please refer to fsl,imx-pinctrl.txt and pinctrl-bindings.txt in this directory 4 - for common binding part and usage. 5 - 6 - Required properties: 7 - - compatible: "fsl,imx8mm-iomuxc" 8 - - reg: should contain the base physical address and size of the iomuxc 9 - registers. 10 - 11 - Required properties in sub-nodes: 12 - - fsl,pins: each entry consists of 6 integers and represents the mux and config 13 - setting for one pin. The first 5 integers <mux_reg conf_reg input_reg mux_val 14 - input_val> are specified using a PIN_FUNC_ID macro, which can be found in 15 - <arch/arm64/boot/dts/freescale/imx8mm-pinfunc.h>. The last integer CONFIG is 16 - the pad setting value like pull-up on this pin. Please refer to i.MX8M Mini 17 - Reference Manual for detailed CONFIG settings. 18 - 19 - Examples: 20 - 21 - &uart1 { 22 - pinctrl-names = "default"; 23 - pinctrl-0 = <&pinctrl_uart1>; 24 - }; 25 - 26 - iomuxc: pinctrl@30330000 { 27 - compatible = "fsl,imx8mm-iomuxc"; 28 - reg = <0x0 0x30330000 0x0 0x10000>; 29 - 30 - pinctrl_uart1: uart1grp { 31 - fsl,pins = < 32 - MX8MM_IOMUXC_UART1_RXD_UART1_DCE_RX 0x140 33 - MX8MM_IOMUXC_UART1_TXD_UART1_DCE_TX 0x140 34 - >; 35 - }; 36 - };
+82
Documentation/devicetree/bindings/pinctrl/fsl,imx8mm-pinctrl.yaml
··· 1 + # SPDX-License-Identifier: GPL-2.0 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/pinctrl/fsl,imx8mm-pinctrl.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Freescale IMX8MM IOMUX Controller 8 + 9 + maintainers: 10 + - Anson Huang <Anson.Huang@nxp.com> 11 + 12 + description: 13 + Please refer to fsl,imx-pinctrl.txt and pinctrl-bindings.txt in this directory 14 + for common binding part and usage. 15 + 16 + properties: 17 + compatible: 18 + const: fsl,imx8mm-iomuxc 19 + 20 + reg: 21 + maxItems: 1 22 + 23 + # Client device subnode's properties 24 + patternProperties: 25 + 'grp$': 26 + type: object 27 + description: 28 + Pinctrl node's client devices use subnodes for desired pin configuration. 29 + Client device subnodes use below standard properties. 30 + 31 + properties: 32 + fsl,pins: 33 + description: 34 + each entry consists of 6 integers and represents the mux and config 35 + setting for one pin. The first 5 integers <mux_reg conf_reg input_reg 36 + mux_val input_val> are specified using a PIN_FUNC_ID macro, which can 37 + be found in <arch/arm64/boot/dts/freescale/imx8mm-pinfunc.h>. The last 38 + integer CONFIG is the pad setting value like pull-up on this pin. Please 39 + refer to i.MX8M Mini Reference Manual for detailed CONFIG settings. 40 + allOf: 41 + - $ref: /schemas/types.yaml#/definitions/uint32-matrix 42 + - items: 43 + items: 44 + - description: | 45 + "mux_reg" indicates the offset of mux register. 46 + - description: | 47 + "conf_reg" indicates the offset of pad configuration register. 48 + - description: | 49 + "input_reg" indicates the offset of select input register. 50 + - description: | 51 + "mux_val" indicates the mux value to be applied. 52 + - description: | 53 + "input_val" indicates the select input value to be applied. 54 + - description: | 55 + "pad_setting" indicates the pad configuration value to be applied. 56 + 57 + required: 58 + - fsl,pins 59 + 60 + additionalProperties: false 61 + 62 + required: 63 + - compatible 64 + - reg 65 + 66 + additionalProperties: false 67 + 68 + examples: 69 + # Pinmux controller node 70 + - | 71 + iomuxc: pinctrl@30330000 { 72 + compatible = "fsl,imx8mm-iomuxc"; 73 + reg = <0x30330000 0x10000>; 74 + 75 + pinctrl_uart2: uart2grp { 76 + fsl,pins = 77 + <0x23C 0x4A4 0x4FC 0x0 0x0 0x140>, 78 + <0x240 0x4A8 0x000 0x0 0x0 0x140>; 79 + }; 80 + }; 81 + 82 + ...
-39
Documentation/devicetree/bindings/pinctrl/fsl,imx8mn-pinctrl.txt
··· 1 - * Freescale IMX8MN IOMUX Controller 2 - 3 - Please refer to fsl,imx-pinctrl.txt and pinctrl-bindings.txt in this directory 4 - for common binding part and usage. 5 - 6 - Required properties: 7 - - compatible: "fsl,imx8mn-iomuxc" 8 - - reg: should contain the base physical address and size of the iomuxc 9 - registers. 10 - 11 - Required properties in sub-nodes: 12 - - fsl,pins: each entry consists of 6 integers and represents the mux and config 13 - setting for one pin. The first 5 integers <mux_reg conf_reg input_reg mux_val 14 - input_val> are specified using a PIN_FUNC_ID macro, which can be found in 15 - <arch/arm64/boot/dts/freescale/imx8mn-pinfunc.h>. The last integer CONFIG is 16 - the pad setting value like pull-up on this pin. Please refer to i.MX8M Nano 17 - Reference Manual for detailed CONFIG settings. 18 - 19 - Examples: 20 - 21 - &uart1 { 22 - pinctrl-names = "default"; 23 - pinctrl-0 = <&pinctrl_uart1>; 24 - }; 25 - 26 - iomuxc: pinctrl@30330000 { 27 - compatible = "fsl,imx8mn-iomuxc"; 28 - reg = <0x0 0x30330000 0x0 0x10000>; 29 - 30 - pinctrl_uart1: uart1grp { 31 - fsl,pins = < 32 - MX8MN_IOMUXC_UART1_RXD_UART1_DCE_RX 0x140 33 - MX8MN_IOMUXC_UART1_TXD_UART1_DCE_TX 0x140 34 - MX8MN_IOMUXC_UART3_RXD_UART1_DCE_CTS_B 0x140 35 - MX8MN_IOMUXC_UART3_TXD_UART1_DCE_RTS_B 0x140 36 - MX8MN_IOMUXC_SD1_DATA4_GPIO2_IO6 0x19 37 - >; 38 - }; 39 - };
+82
Documentation/devicetree/bindings/pinctrl/fsl,imx8mn-pinctrl.yaml
··· 1 + # SPDX-License-Identifier: GPL-2.0 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/pinctrl/fsl,imx8mn-pinctrl.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Freescale IMX8MN IOMUX Controller 8 + 9 + maintainers: 10 + - Anson Huang <Anson.Huang@nxp.com> 11 + 12 + description: 13 + Please refer to fsl,imx-pinctrl.txt and pinctrl-bindings.txt in this directory 14 + for common binding part and usage. 15 + 16 + properties: 17 + compatible: 18 + const: fsl,imx8mn-iomuxc 19 + 20 + reg: 21 + maxItems: 1 22 + 23 + # Client device subnode's properties 24 + patternProperties: 25 + 'grp$': 26 + type: object 27 + description: 28 + Pinctrl node's client devices use subnodes for desired pin configuration. 29 + Client device subnodes use below standard properties. 30 + 31 + properties: 32 + fsl,pins: 33 + description: 34 + each entry consists of 6 integers and represents the mux and config 35 + setting for one pin. The first 5 integers <mux_reg conf_reg input_reg 36 + mux_val input_val> are specified using a PIN_FUNC_ID macro, which can 37 + be found in <arch/arm64/boot/dts/freescale/imx8mn-pinfunc.h>. The last 38 + integer CONFIG is the pad setting value like pull-up on this pin. Please 39 + refer to i.MX8M Nano Reference Manual for detailed CONFIG settings. 40 + allOf: 41 + - $ref: /schemas/types.yaml#/definitions/uint32-matrix 42 + - items: 43 + items: 44 + - description: | 45 + "mux_reg" indicates the offset of mux register. 46 + - description: | 47 + "conf_reg" indicates the offset of pad configuration register. 48 + - description: | 49 + "input_reg" indicates the offset of select input register. 50 + - description: | 51 + "mux_val" indicates the mux value to be applied. 52 + - description: | 53 + "input_val" indicates the select input value to be applied. 54 + - description: | 55 + "pad_setting" indicates the pad configuration value to be applied. 56 + 57 + required: 58 + - fsl,pins 59 + 60 + additionalProperties: false 61 + 62 + required: 63 + - compatible 64 + - reg 65 + 66 + additionalProperties: false 67 + 68 + examples: 69 + # Pinmux controller node 70 + - | 71 + iomuxc: pinctrl@30330000 { 72 + compatible = "fsl,imx8mn-iomuxc"; 73 + reg = <0x30330000 0x10000>; 74 + 75 + pinctrl_uart2: uart2grp { 76 + fsl,pins = 77 + <0x23C 0x4A4 0x4FC 0x0 0x0 0x140>, 78 + <0x240 0x4A8 0x000 0x0 0x0 0x140>; 79 + }; 80 + }; 81 + 82 + ...
+19 -6
Documentation/devicetree/bindings/pinctrl/fsl,imx8mp-pinctrl.yaml
··· 30 30 31 31 properties: 32 32 fsl,pins: 33 - allOf: 34 - - $ref: /schemas/types.yaml#/definitions/uint32-array 35 33 description: 36 34 each entry consists of 6 integers and represents the mux and config 37 35 setting for one pin. The first 5 integers <mux_reg conf_reg input_reg ··· 37 39 be found in <arch/arm64/boot/dts/freescale/imx8mp-pinfunc.h>. The last 38 40 integer CONFIG is the pad setting value like pull-up on this pin. Please 39 41 refer to i.MX8M Plus Reference Manual for detailed CONFIG settings. 42 + allOf: 43 + - $ref: /schemas/types.yaml#/definitions/uint32-matrix 44 + - items: 45 + items: 46 + - description: | 47 + "mux_reg" indicates the offset of mux register. 48 + - description: | 49 + "conf_reg" indicates the offset of pad configuration register. 50 + - description: | 51 + "input_reg" indicates the offset of select input register. 52 + - description: | 53 + "mux_val" indicates the mux value to be applied. 54 + - description: | 55 + "input_val" indicates the select input value to be applied. 56 + - description: | 57 + "pad_setting" indicates the pad configuration value to be applied. 40 58 41 59 required: 42 60 - fsl,pins ··· 73 59 reg = <0x30330000 0x10000>; 74 60 75 61 pinctrl_uart2: uart2grp { 76 - fsl,pins = < 77 - 0x228 0x488 0x5F0 0x0 0x6 0x49 78 - 0x228 0x488 0x000 0x0 0x0 0x49 79 - >; 62 + fsl,pins = 63 + <0x228 0x488 0x5F0 0x0 0x6 0x49>, 64 + <0x228 0x488 0x000 0x0 0x0 0x49>; 80 65 }; 81 66 }; 82 67
-36
Documentation/devicetree/bindings/pinctrl/fsl,imx8mq-pinctrl.txt
··· 1 - * Freescale IMX8MQ IOMUX Controller 2 - 3 - Please refer to fsl,imx-pinctrl.txt and pinctrl-bindings.txt in this directory 4 - for common binding part and usage. 5 - 6 - Required properties: 7 - - compatible: "fsl,imx8mq-iomuxc" 8 - - reg: should contain the base physical address and size of the iomuxc 9 - registers. 10 - 11 - Required properties in sub-nodes: 12 - - fsl,pins: each entry consists of 6 integers and represents the mux and config 13 - setting for one pin. The first 5 integers <mux_reg conf_reg input_reg mux_val 14 - input_val> are specified using a PIN_FUNC_ID macro, which can be found in 15 - imx8mq-pinfunc.h under device tree source folder. The last integer CONFIG is 16 - the pad setting value like pull-up on this pin. Please refer to i.MX8M Quad 17 - Reference Manual for detailed CONFIG settings. 18 - 19 - Examples: 20 - 21 - &uart1 { 22 - pinctrl-names = "default"; 23 - pinctrl-0 = <&pinctrl_uart1>; 24 - }; 25 - 26 - iomuxc: pinctrl@30330000 { 27 - compatible = "fsl,imx8mq-iomuxc"; 28 - reg = <0x0 0x30330000 0x0 0x10000>; 29 - 30 - pinctrl_uart1: uart1grp { 31 - fsl,pins = < 32 - MX8MQ_IOMUXC_UART1_RXD_UART1_DCE_RX 0x49 33 - MX8MQ_IOMUXC_UART1_TXD_UART1_DCE_TX 0x49 34 - >; 35 - }; 36 - };
+82
Documentation/devicetree/bindings/pinctrl/fsl,imx8mq-pinctrl.yaml
··· 1 + # SPDX-License-Identifier: GPL-2.0 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/pinctrl/fsl,imx8mq-pinctrl.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Freescale IMX8MQ IOMUX Controller 8 + 9 + maintainers: 10 + - Anson Huang <Anson.Huang@nxp.com> 11 + 12 + description: 13 + Please refer to fsl,imx-pinctrl.txt and pinctrl-bindings.txt in this directory 14 + for common binding part and usage. 15 + 16 + properties: 17 + compatible: 18 + const: fsl,imx8mq-iomuxc 19 + 20 + reg: 21 + maxItems: 1 22 + 23 + # Client device subnode's properties 24 + patternProperties: 25 + 'grp$': 26 + type: object 27 + description: 28 + Pinctrl node's client devices use subnodes for desired pin configuration. 29 + Client device subnodes use below standard properties. 30 + 31 + properties: 32 + fsl,pins: 33 + description: 34 + each entry consists of 6 integers and represents the mux and config 35 + setting for one pin. The first 5 integers <mux_reg conf_reg input_reg 36 + mux_val input_val> are specified using a PIN_FUNC_ID macro, which can 37 + be found in <arch/arm64/boot/dts/freescale/imx8mq-pinfunc.h>. The last 38 + integer CONFIG is the pad setting value like pull-up on this pin. Please 39 + refer to i.MX8M Quad Reference Manual for detailed CONFIG settings. 40 + allOf: 41 + - $ref: /schemas/types.yaml#/definitions/uint32-matrix 42 + - items: 43 + items: 44 + - description: | 45 + "mux_reg" indicates the offset of mux register. 46 + - description: | 47 + "conf_reg" indicates the offset of pad configuration register. 48 + - description: | 49 + "input_reg" indicates the offset of select input register. 50 + - description: | 51 + "mux_val" indicates the mux value to be applied. 52 + - description: | 53 + "input_val" indicates the select input value to be applied. 54 + - description: | 55 + "pad_setting" indicates the pad configuration value to be applied. 56 + 57 + required: 58 + - fsl,pins 59 + 60 + additionalProperties: false 61 + 62 + required: 63 + - compatible 64 + - reg 65 + 66 + additionalProperties: false 67 + 68 + examples: 69 + # Pinmux controller node 70 + - | 71 + iomuxc: pinctrl@30330000 { 72 + compatible = "fsl,imx8mq-iomuxc"; 73 + reg = <0x30330000 0x10000>; 74 + 75 + pinctrl_uart1: uart1grp { 76 + fsl,pins = 77 + <0x234 0x49C 0x4F4 0x0 0x0 0x49>, 78 + <0x238 0x4A0 0x4F4 0x0 0x0 0x49>; 79 + }; 80 + }; 81 + 82 + ...
+153
Documentation/devicetree/bindings/pinctrl/qcom,ipq6018-pinctrl.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/pinctrl/qcom,ipq6018-pinctrl.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Qualcomm Technologies, Inc. IPQ6018 TLMM block 8 + 9 + maintainers: 10 + - Sricharan R <sricharan@codeaurora.org> 11 + 12 + description: | 13 + This binding describes the Top Level Mode Multiplexer block found in the 14 + IPQ6018 platform. 15 + 16 + properties: 17 + compatible: 18 + const: qcom,ipq6018-pinctrl 19 + 20 + reg: 21 + maxItems: 1 22 + 23 + interrupts: 24 + description: Specifies the TLMM summary IRQ 25 + maxItems: 1 26 + 27 + interrupt-controller: true 28 + 29 + '#interrupt-cells': 30 + description: 31 + Specifies the PIN numbers and Flags, as defined in defined in 32 + include/dt-bindings/interrupt-controller/irq.h 33 + const: 2 34 + 35 + gpio-controller: true 36 + 37 + '#gpio-cells': 38 + description: Specifying the pin number and flags, as defined in 39 + include/dt-bindings/gpio/gpio.h 40 + const: 2 41 + 42 + gpio-ranges: 43 + maxItems: 1 44 + 45 + #PIN CONFIGURATION NODES 46 + patternProperties: 47 + '-pinmux$': 48 + type: object 49 + description: 50 + Pinctrl node's client devices use subnodes for desired pin configuration. 51 + Client device subnodes use below standard properties. 52 + allOf: 53 + - $ref: "/schemas/pinctrl/pincfg-node.yaml" 54 + 55 + properties: 56 + pins: 57 + description: 58 + List of gpio pins affected by the properties specified in this 59 + subnode. 60 + items: 61 + oneOf: 62 + - pattern: "^gpio([1-9]|[1-7][0-9]|80)$" 63 + - enum: [ sdc1_clk, sdc1_cmd, sdc1_data, sdc2_clk, sdc2_cmd, 64 + sdc2_data, qdsd_cmd, qdsd_data0, qdsd_data1, qdsd_data2, 65 + qdsd_data3 ] 66 + minItems: 1 67 + maxItems: 4 68 + 69 + function: 70 + description: 71 + Specify the alternative function to be configured for the specified 72 + pins. 73 + enum: [ adsp_ext, alsp_int, atest_bbrx0, atest_bbrx1, atest_char, 74 + atest_char0, atest_char1, atest_char2, atest_char3, atest_combodac, 75 + atest_gpsadc0, atest_gpsadc1, atest_tsens, atest_wlan0, 76 + atest_wlan1, backlight_en, bimc_dte0, bimc_dte1, blsp1_i2c, 77 + blsp2_i2c, blsp3_i2c, blsp4_i2c, blsp5_i2c, blsp6_i2c, blsp1_spi, 78 + blsp1_spi_cs1, blsp1_spi_cs2, blsp1_spi_cs3, blsp2_spi, 79 + blsp2_spi_cs1, blsp2_spi_cs2, blsp2_spi_cs3, blsp3_spi, 80 + blsp3_spi_cs1, blsp3_spi_cs2, blsp3_spi_cs3, blsp4_spi, blsp5_spi, 81 + blsp6_spi, blsp1_uart, blsp2_uart, blsp1_uim, blsp2_uim, cam1_rst, 82 + cam1_standby, cam_mclk0, cam_mclk1, cci_async, cci_i2c, cci_timer0, 83 + cci_timer1, cci_timer2, cdc_pdm0, codec_mad, dbg_out, display_5v, 84 + dmic0_clk, dmic0_data, dsi_rst, ebi0_wrcdc, euro_us, ext_lpass, 85 + flash_strobe, gcc_gp1_clk_a, gcc_gp1_clk_b, gcc_gp2_clk_a, 86 + gcc_gp2_clk_b, gcc_gp3_clk_a, gcc_gp3_clk_b, gpio, gsm0_tx0, 87 + gsm0_tx1, gsm1_tx0, gsm1_tx1, gyro_accl, kpsns0, kpsns1, kpsns2, 88 + ldo_en, ldo_update, mag_int, mdp_vsync, modem_tsync, m_voc, 89 + nav_pps, nav_tsync, pa_indicator, pbs0, pbs1, pbs2, pri_mi2s, 90 + pri_mi2s_ws, prng_rosc, pwr_crypto_enabled_a, pwr_crypto_enabled_b, 91 + pwr_modem_enabled_a, pwr_modem_enabled_b, pwr_nav_enabled_a, 92 + pwr_nav_enabled_b, qdss_ctitrig_in_a0, qdss_ctitrig_in_a1, 93 + qdss_ctitrig_in_b0, qdss_ctitrig_in_b1, qdss_ctitrig_out_a0, 94 + qdss_ctitrig_out_a1, qdss_ctitrig_out_b0, qdss_ctitrig_out_b1, 95 + qdss_traceclk_a, qdss_traceclk_b, qdss_tracectl_a, qdss_tracectl_b, 96 + qdss_tracedata_a, qdss_tracedata_b, reset_n, sd_card, sd_write, 97 + sec_mi2s, smb_int, ssbi_wtr0, ssbi_wtr1, uim1, uim2, uim3, 98 + uim_batt, wcss_bt, wcss_fm, wcss_wlan, webcam1_rst ] 99 + 100 + drive-strength: 101 + enum: [2, 4, 6, 8, 10, 12, 14, 16] 102 + default: 2 103 + description: 104 + Selects the drive strength for the specified pins, in mA. 105 + 106 + bias-pull-down: true 107 + 108 + bias-pull-up: true 109 + 110 + bias-disable: true 111 + 112 + output-high: true 113 + 114 + output-low: true 115 + 116 + required: 117 + - pins 118 + - function 119 + 120 + additionalProperties: false 121 + 122 + required: 123 + - compatible 124 + - reg 125 + - interrupts 126 + - interrupt-controller 127 + - '#interrupt-cells' 128 + - gpio-controller 129 + - '#gpio-cells' 130 + - gpio-ranges 131 + 132 + additionalProperties: false 133 + 134 + examples: 135 + - | 136 + #include <dt-bindings/interrupt-controller/arm-gic.h> 137 + tlmm: pinctrl@1000000 { 138 + compatible = "qcom,ipq6018-pinctrl"; 139 + reg = <0x01000000 0x300000>; 140 + interrupts = <GIC_SPI 208 IRQ_TYPE_LEVEL_HIGH>; 141 + interrupt-controller; 142 + #interrupt-cells = <2>; 143 + gpio-controller; 144 + #gpio-cells = <2>; 145 + gpio-ranges = <&tlmm 0 80>; 146 + 147 + serial3-pinmux { 148 + pins = "gpio44", "gpio45"; 149 + function = "blsp2_uart"; 150 + drive-strength = <8>; 151 + bias-pull-down; 152 + }; 153 + };
+19 -18
MAINTAINERS
··· 2743 2743 L: openbmc@lists.ozlabs.org (moderated for non-subscribers) 2744 2744 L: linux-gpio@vger.kernel.org 2745 2745 S: Maintained 2746 - F: drivers/pinctrl/aspeed/ 2747 2746 F: Documentation/devicetree/bindings/pinctrl/aspeed,* 2747 + F: drivers/pinctrl/aspeed/ 2748 2748 2749 2749 ASPEED SCU INTERRUPT CONTROLLER DRIVER 2750 2750 M: Eddie James <eajames@linux.ibm.com> ··· 4958 4958 F: drivers/mfd/da903x.c 4959 4959 F: drivers/mfd/da90??-*.c 4960 4960 F: drivers/mfd/da91??-*.c 4961 + F: drivers/pinctrl/pinctrl-da90??.c 4961 4962 F: drivers/power/supply/da9052-battery.c 4962 4963 F: drivers/power/supply/da91??-*.c 4963 4964 F: drivers/regulator/da903x.c ··· 13268 13267 PIN CONTROL SUBSYSTEM 13269 13268 M: Linus Walleij <linus.walleij@linaro.org> 13270 13269 L: linux-gpio@vger.kernel.org 13271 - T: git git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git 13272 13270 S: Maintained 13271 + T: git git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git 13273 13272 F: Documentation/devicetree/bindings/pinctrl/ 13274 13273 F: Documentation/driver-api/pinctl.rst 13275 13274 F: drivers/pinctrl/ 13276 13275 F: include/linux/pinctrl/ 13277 - 13278 - PIN CONTROLLER - MICROCHIP AT91 13279 - M: Ludovic Desroches <ludovic.desroches@microchip.com> 13280 - L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 13281 - L: linux-gpio@vger.kernel.org 13282 - S: Supported 13283 - F: drivers/pinctrl/pinctrl-at91* 13284 - F: drivers/gpio/gpio-sama5d2-piobu.c 13285 13276 13286 13277 PIN CONTROLLER - FREESCALE 13287 13278 M: Dong Aisheng <aisheng.dong@nxp.com> ··· 13283 13290 R: Pengutronix Kernel Team <kernel@pengutronix.de> 13284 13291 L: linux-gpio@vger.kernel.org 13285 13292 S: Maintained 13286 - F: drivers/pinctrl/freescale/ 13287 13293 F: Documentation/devicetree/bindings/pinctrl/fsl,* 13294 + F: drivers/pinctrl/freescale/ 13288 13295 13289 13296 PIN CONTROLLER - INTEL 13290 13297 M: Mika Westerberg <mika.westerberg@linux.intel.com> 13291 13298 M: Andy Shevchenko <andy@kernel.org> 13292 - T: git git://git.kernel.org/pub/scm/linux/kernel/git/pinctrl/intel.git 13293 13299 S: Maintained 13300 + T: git git://git.kernel.org/pub/scm/linux/kernel/git/pinctrl/intel.git 13294 13301 F: drivers/pinctrl/intel/ 13295 13302 13296 13303 PIN CONTROLLER - MEDIATEK ··· 13301 13308 F: Documentation/devicetree/bindings/pinctrl/pinctrl-mt7622.txt 13302 13309 F: drivers/pinctrl/mediatek/ 13303 13310 13311 + PIN CONTROLLER - MICROCHIP AT91 13312 + M: Ludovic Desroches <ludovic.desroches@microchip.com> 13313 + L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 13314 + L: linux-gpio@vger.kernel.org 13315 + S: Supported 13316 + F: drivers/gpio/gpio-sama5d2-piobu.c 13317 + F: drivers/pinctrl/pinctrl-at91* 13318 + 13304 13319 PIN CONTROLLER - QUALCOMM 13305 13320 M: Bjorn Andersson <bjorn.andersson@linaro.org> 13306 - S: Maintained 13307 13321 L: linux-arm-msm@vger.kernel.org 13322 + S: Maintained 13308 13323 F: Documentation/devicetree/bindings/pinctrl/qcom,*.txt 13309 13324 F: drivers/pinctrl/qcom/ 13310 13325 13311 13326 PIN CONTROLLER - RENESAS 13312 13327 M: Geert Uytterhoeven <geert+renesas@glider.be> 13313 13328 L: linux-renesas-soc@vger.kernel.org 13314 - T: git git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers.git sh-pfc 13315 13329 S: Maintained 13330 + T: git git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers.git sh-pfc 13316 13331 F: drivers/pinctrl/pinctrl-rz* 13317 13332 F: drivers/pinctrl/sh-pfc/ 13318 13333 ··· 13330 13329 M: Sylwester Nawrocki <s.nawrocki@samsung.com> 13331 13330 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 13332 13331 L: linux-samsung-soc@vger.kernel.org (moderated for non-subscribers) 13333 - Q: https://patchwork.kernel.org/project/linux-samsung-soc/list/ 13334 - T: git git://git.kernel.org/pub/scm/linux/kernel/git/pinctrl/samsung.git 13335 13332 S: Maintained 13333 + T: git git://git.kernel.org/pub/scm/linux/kernel/git/pinctrl/samsung.git 13334 + Q: https://patchwork.kernel.org/project/linux-samsung-soc/list/ 13335 + F: Documentation/devicetree/bindings/pinctrl/samsung-pinctrl.txt 13336 13336 F: drivers/pinctrl/samsung/ 13337 13337 F: include/dt-bindings/pinctrl/samsung.h 13338 - F: Documentation/devicetree/bindings/pinctrl/samsung-pinctrl.txt 13339 13338 13340 13339 PIN CONTROLLER - SINGLE 13341 13340 M: Tony Lindgren <tony@atomide.com> ··· 13348 13347 PIN CONTROLLER - ST SPEAR 13349 13348 M: Viresh Kumar <vireshk@kernel.org> 13350 13349 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 13351 - W: http://www.st.com/spear 13352 13350 S: Maintained 13351 + W: http://www.st.com/spear 13353 13352 F: drivers/pinctrl/spear/ 13354 13353 13355 13354 PISTACHIO SOC SUPPORT
+1
drivers/gpio/gpiolib.c
··· 149 149 150 150 return &gdev->descs[hwnum]; 151 151 } 152 + EXPORT_SYMBOL_GPL(gpiochip_get_desc); 152 153 153 154 /** 154 155 * desc_to_gpio - convert a GPIO descriptor to the integer namespace
+12
drivers/pinctrl/Kconfig
··· 126 126 Driver for TI DA850/OMAP-L138/AM18XX pinconf. Used to control 127 127 pullup/pulldown pin groups. 128 128 129 + config PINCTRL_DA9062 130 + tristate "Dialog Semiconductor DA9062 PMIC pinctrl and GPIO Support" 131 + depends on MFD_DA9062 132 + select GPIOLIB 133 + help 134 + The Dialog DA9062 PMIC provides multiple GPIOs that can be muxed for 135 + different functions. This driver bundles a pinctrl driver to select the 136 + function muxing and a GPIO driver to handle the GPIO when the GPIO 137 + function is selected. 138 + 139 + Say yes to enable pinctrl and GPIO support for the DA9062 PMIC. 140 + 129 141 config PINCTRL_DIGICOLOR 130 142 bool 131 143 depends on OF && (ARCH_DIGICOLOR || COMPILE_TEST)
+1
drivers/pinctrl/Makefile
··· 16 16 obj-$(CONFIG_PINCTRL_AMD) += pinctrl-amd.o 17 17 obj-$(CONFIG_PINCTRL_BM1880) += pinctrl-bm1880.o 18 18 obj-$(CONFIG_PINCTRL_DA850_PUPD) += pinctrl-da850-pupd.o 19 + obj-$(CONFIG_PINCTRL_DA9062) += pinctrl-da9062.o 19 20 obj-$(CONFIG_PINCTRL_DIGICOLOR) += pinctrl-digicolor.o 20 21 obj-$(CONFIG_PINCTRL_FALCON) += pinctrl-falcon.o 21 22 obj-$(CONFIG_PINCTRL_GEMINI) += pinctrl-gemini.o
+255 -255
drivers/pinctrl/actions/pinctrl-s700.c
··· 1125 1125 }; 1126 1126 1127 1127 static const char * const nor_groups[] = { 1128 - "lcd0_d18", 1129 - "i2s_d0", 1130 - "i2s0_pcm0", 1131 - "i2s1_pcm0", 1132 - "i2s_d1", 1133 - "ks_in2", 1134 - "ks_in1", 1135 - "ks_in0", 1136 - "ks_in3", 1137 - "ks_out0", 1138 - "ks_out1", 1139 - "ks_out2", 1140 - "lcd0_d2", 1141 - "lvds_ee_pn", 1142 - "uart2_rx_tx", 1143 - "spi0_i2c_pcm", 1144 - "lvds_e_pn", 1145 - "sd0_d0", 1146 - "sd0_d1", 1147 - "sd0_d2_d3", 1148 - "sd1_d0_d3", 1149 - "sd0_cmd", 1150 - "sd1_cmd", 1151 - "sens0_ckout", 1152 - "sen0_pclk", 1128 + "lcd0_d18_mfp", 1129 + "i2s_d0_mfp", 1130 + "i2s0_pcm0_mfp", 1131 + "i2s1_pcm0_mfp", 1132 + "i2s_d1_mfp", 1133 + "ks_in2_mfp", 1134 + "ks_in1_mfp", 1135 + "ks_in0_mfp", 1136 + "ks_in3_mfp", 1137 + "ks_out0_mfp", 1138 + "ks_out1_mfp", 1139 + "ks_out2_mfp", 1140 + "lcd0_d2_mfp", 1141 + "lvds_ee_pn_mfp", 1142 + "uart2_rx_tx_mfp", 1143 + "spi0_i2c_pcm_mfp", 1144 + "lvds_e_pn_mfp", 1145 + "sd0_d0_mfp", 1146 + "sd0_d1_mfp", 1147 + "sd0_d2_d3_mfp", 1148 + "sd1_d0_d3_mfp", 1149 + "sd0_cmd_mfp", 1150 + "sd1_cmd_mfp", 1151 + "sens0_ckout_mfp", 1152 + "sen0_pclk_mfp", 1153 1153 }; 1154 1154 1155 1155 static const char * const eth_rmii_groups[] = { 1156 - "rgmii_txd23", 1157 - "rgmii_rxd2", 1158 - "rgmii_rxd3", 1159 - "rgmii_txd01", 1160 - "rgmii_txd0", 1161 - "rgmii_txd1", 1162 - "rgmii_txen", 1163 - "rgmii_rxen", 1164 - "rgmii_rxd1", 1165 - "rgmii_rxd0", 1166 - "rgmii_ref_clk", 1156 + "rgmii_txd23_mfp", 1157 + "rgmii_rxd2_mfp", 1158 + "rgmii_rxd3_mfp", 1159 + "rgmii_txd01_mfp", 1160 + "rgmii_txd0_mfp", 1161 + "rgmii_txd1_mfp", 1162 + "rgmii_txen_mfp", 1163 + "rgmii_rxen_mfp", 1164 + "rgmii_rxd1_mfp", 1165 + "rgmii_rxd0_mfp", 1166 + "rgmii_ref_clk_mfp", 1167 1167 "eth_smi_dummy", 1168 1168 }; 1169 1169 1170 1170 static const char * const eth_smii_groups[] = { 1171 - "rgmii_txd0", 1172 - "rgmii_txd1", 1173 - "rgmii_rxd0", 1174 - "rgmii_rxd1", 1175 - "rgmii_ref_clk", 1171 + "rgmii_txd0_mfp", 1172 + "rgmii_txd1_mfp", 1173 + "rgmii_rxd0_mfp", 1174 + "rgmii_rxd1_mfp", 1175 + "rgmii_ref_clk_mfp", 1176 1176 "eth_smi_dummy", 1177 1177 }; 1178 1178 1179 1179 static const char * const spi0_groups[] = { 1180 - "dsi_dn0", 1181 - "dsi_dp2", 1182 - "dsi_dp0", 1183 - "uart2_rx_tx", 1184 - "spi0_i2c_pcm", 1185 - "dsi_dn2", 1180 + "dsi_dn0_mfp", 1181 + "dsi_dp2_mfp", 1182 + "dsi_dp0_mfp", 1183 + "uart2_rx_tx_mfp", 1184 + "spi0_i2c_pcm_mfp", 1185 + "dsi_dn2_mfp", 1186 1186 }; 1187 1187 1188 1188 static const char * const spi1_groups[] = { 1189 - "uart0_rx", 1190 - "uart0_tx", 1189 + "uart0_rx_mfp", 1190 + "uart0_tx_mfp", 1191 1191 "i2c0_mfp", 1192 1192 }; 1193 1193 1194 1194 static const char * const spi2_groups[] = { 1195 - "rgmii_txd01", 1196 - "rgmii_txd0", 1197 - "rgmii_txd1", 1198 - "rgmii_ref_clk", 1199 - "dnand_acle_ce0", 1195 + "rgmii_txd01_mfp", 1196 + "rgmii_txd0_mfp", 1197 + "rgmii_txd1_mfp", 1198 + "rgmii_ref_clk_mfp", 1199 + "dnand_acle_ce0_mfp", 1200 1200 }; 1201 1201 1202 1202 static const char * const spi3_groups[] = { 1203 - "rgmii_txen", 1204 - "rgmii_rxen", 1205 - "rgmii_rxd1", 1206 - "rgmii_rxd0", 1203 + "rgmii_txen_mfp", 1204 + "rgmii_rxen_mfp", 1205 + "rgmii_rxd1_mfp", 1206 + "rgmii_rxd0_mfp", 1207 1207 }; 1208 1208 1209 1209 static const char * const sens0_groups[] = { 1210 - "csi_cn_cp", 1211 - "sens0_ckout", 1212 - "csi_dn_dp", 1213 - "sen0_pclk", 1210 + "csi_cn_cp_mfp", 1211 + "sens0_ckout_mfp", 1212 + "csi_dn_dp_mfp", 1213 + "sen0_pclk_mfp", 1214 1214 }; 1215 1215 1216 1216 static const char * const sens1_groups[] = { 1217 - "lcd0_d18", 1218 - "ks_in2", 1219 - "ks_in1", 1220 - "ks_in0", 1221 - "ks_in3", 1222 - "ks_out0", 1223 - "ks_out1", 1224 - "ks_out2", 1225 - "sens0_ckout", 1226 - "pcm1_in", 1227 - "pcm1_clk", 1228 - "pcm1_sync", 1229 - "pcm1_out", 1217 + "lcd0_d18_mfp", 1218 + "ks_in2_mfp", 1219 + "ks_in1_mfp", 1220 + "ks_in0_mfp", 1221 + "ks_in3_mfp", 1222 + "ks_out0_mfp", 1223 + "ks_out1_mfp", 1224 + "ks_out2_mfp", 1225 + "sens0_ckout_mfp", 1226 + "pcm1_in_mfp", 1227 + "pcm1_clk_mfp", 1228 + "pcm1_sync_mfp", 1229 + "pcm1_out_mfp", 1230 1230 }; 1231 1231 1232 1232 static const char * const uart0_groups[] = { 1233 - "uart2_rtsb", 1234 - "uart2_ctsb", 1235 - "uart0_rx", 1236 - "uart0_tx", 1233 + "uart2_rtsb_mfp", 1234 + "uart2_ctsb_mfp", 1235 + "uart0_rx_mfp", 1236 + "uart0_tx_mfp", 1237 1237 }; 1238 1238 1239 1239 static const char * const uart1_groups[] = { 1240 - "sd0_d2_d3", 1240 + "sd0_d2_d3_mfp", 1241 1241 "i2c0_mfp", 1242 1242 }; 1243 1243 1244 1244 static const char * const uart2_groups[] = { 1245 - "rgmii_txen", 1246 - "rgmii_rxen", 1247 - "rgmii_rxd1", 1248 - "rgmii_rxd0", 1249 - "dsi_dn0", 1250 - "dsi_dp2", 1251 - "dsi_dp0", 1252 - "uart2_rx_tx", 1253 - "dsi_dn2", 1254 - "uart2_rtsb", 1255 - "uart2_ctsb", 1256 - "sd0_d0", 1257 - "sd0_d1", 1258 - "sd0_d2_d3", 1259 - "uart0_rx", 1260 - "uart0_tx", 1245 + "rgmii_txen_mfp", 1246 + "rgmii_rxen_mfp", 1247 + "rgmii_rxd1_mfp", 1248 + "rgmii_rxd0_mfp", 1249 + "dsi_dn0_mfp", 1250 + "dsi_dp2_mfp", 1251 + "dsi_dp0_mfp", 1252 + "uart2_rx_tx_mfp", 1253 + "dsi_dn2_mfp", 1254 + "uart2_rtsb_mfp", 1255 + "uart2_ctsb_mfp", 1256 + "sd0_d0_mfp", 1257 + "sd0_d1_mfp", 1258 + "sd0_d2_d3_mfp", 1259 + "uart0_rx_mfp", 1260 + "uart0_tx_mfp", 1261 1261 "i2c0_mfp", 1262 1262 "uart2_dummy" 1263 1263 }; 1264 1264 1265 1265 static const char * const uart3_groups[] = { 1266 - "rgmii_txd23", 1267 - "rgmii_rxd2", 1268 - "rgmii_rxd3", 1269 - "uart3_rtsb", 1270 - "uart3_ctsb", 1266 + "rgmii_txd23_mfp", 1267 + "rgmii_rxd2_mfp", 1268 + "rgmii_rxd3_mfp", 1269 + "uart3_rtsb_mfp", 1270 + "uart3_ctsb_mfp", 1271 1271 "uart3_dummy" 1272 1272 }; 1273 1273 1274 1274 static const char * const uart4_groups[] = { 1275 - "rgmii_txd01", 1276 - "rgmii_ref_clk", 1277 - "ks_out0", 1278 - "ks_out1", 1275 + "rgmii_txd01_mfp", 1276 + "rgmii_ref_clk_mfp", 1277 + "ks_out0_mfp", 1278 + "ks_out1_mfp", 1279 1279 }; 1280 1280 1281 1281 static const char * const uart5_groups[] = { 1282 - "rgmii_rxd1", 1283 - "rgmii_rxd0", 1284 - "ks_out0", 1285 - "ks_out2", 1286 - "uart3_rtsb", 1287 - "uart3_ctsb", 1288 - "sd0_d0", 1289 - "sd0_d1", 1282 + "rgmii_rxd1_mfp", 1283 + "rgmii_rxd0_mfp", 1284 + "ks_out0_mfp", 1285 + "ks_out2_mfp", 1286 + "uart3_rtsb_mfp", 1287 + "uart3_ctsb_mfp", 1288 + "sd0_d0_mfp", 1289 + "sd0_d1_mfp", 1290 1290 }; 1291 1291 1292 1292 static const char * const uart6_groups[] = { 1293 - "rgmii_txd0", 1294 - "rgmii_txd1", 1293 + "rgmii_txd0_mfp", 1294 + "rgmii_txd1_mfp", 1295 1295 }; 1296 1296 1297 1297 static const char * const i2s0_groups[] = { 1298 - "i2s_d0", 1299 - "i2s_pcm1", 1300 - "i2s0_pcm0", 1298 + "i2s_d0_mfp", 1299 + "i2s_pcm1_mfp", 1300 + "i2s0_pcm0_mfp", 1301 1301 }; 1302 1302 1303 1303 static const char * const i2s1_groups[] = { 1304 - "i2s1_pcm0", 1305 - "i2s_d1", 1304 + "i2s1_pcm0_mfp", 1305 + "i2s_d1_mfp", 1306 1306 "i2s1_dummy", 1307 - "spi0_i2c_pcm", 1308 - "uart0_rx", 1309 - "uart0_tx", 1307 + "spi0_i2c_pcm_mfp", 1308 + "uart0_rx_mfp", 1309 + "uart0_tx_mfp", 1310 1310 }; 1311 1311 1312 1312 static const char * const pcm1_groups[] = { 1313 - "i2s_pcm1", 1314 - "spi0_i2c_pcm", 1315 - "uart0_rx", 1316 - "uart0_tx", 1317 - "pcm1_in", 1318 - "pcm1_clk", 1319 - "pcm1_sync", 1320 - "pcm1_out", 1313 + "i2s_pcm1_mfp", 1314 + "spi0_i2c_pcm_mfp", 1315 + "uart0_rx_mfp", 1316 + "uart0_tx_mfp", 1317 + "pcm1_in_mfp", 1318 + "pcm1_clk_mfp", 1319 + "pcm1_sync_mfp", 1320 + "pcm1_out_mfp", 1321 1321 }; 1322 1322 1323 1323 static const char * const pcm0_groups[] = { 1324 - "i2s0_pcm0", 1325 - "i2s1_pcm0", 1326 - "uart2_rx_tx", 1327 - "spi0_i2c_pcm", 1324 + "i2s0_pcm0_mfp", 1325 + "i2s1_pcm0_mfp", 1326 + "uart2_rx_tx_mfp", 1327 + "spi0_i2c_pcm_mfp", 1328 1328 }; 1329 1329 1330 1330 static const char * const ks_groups[] = { 1331 - "ks_in2", 1332 - "ks_in1", 1333 - "ks_in0", 1334 - "ks_in3", 1335 - "ks_out0", 1336 - "ks_out1", 1337 - "ks_out2", 1331 + "ks_in2_mfp", 1332 + "ks_in1_mfp", 1333 + "ks_in0_mfp", 1334 + "ks_in3_mfp", 1335 + "ks_out0_mfp", 1336 + "ks_out1_mfp", 1337 + "ks_out2_mfp", 1338 1338 }; 1339 1339 1340 1340 static const char * const jtag_groups[] = { 1341 - "ks_in2", 1342 - "ks_in1", 1343 - "ks_in0", 1344 - "ks_in3", 1345 - "ks_out1", 1346 - "sd0_d0", 1347 - "sd0_d2_d3", 1348 - "sd0_cmd", 1349 - "sd0_clk", 1341 + "ks_in2_mfp", 1342 + "ks_in1_mfp", 1343 + "ks_in0_mfp", 1344 + "ks_in3_mfp", 1345 + "ks_out1_mfp", 1346 + "sd0_d0_mfp", 1347 + "sd0_d2_d3_mfp", 1348 + "sd0_cmd_mfp", 1349 + "sd0_clk_mfp", 1350 1350 }; 1351 1351 1352 1352 static const char * const pwm0_groups[] = { 1353 - "rgmii_rxd2", 1354 - "rgmii_txen", 1355 - "ks_in2", 1356 - "sen0_pclk", 1353 + "rgmii_rxd2_mfp", 1354 + "rgmii_txen_mfp", 1355 + "ks_in2_mfp", 1356 + "sen0_pclk_mfp", 1357 1357 }; 1358 1358 1359 1359 static const char * const pwm1_groups[] = { 1360 - "rgmii_rxen", 1361 - "ks_in1", 1362 - "ks_in3", 1363 - "sens0_ckout", 1360 + "rgmii_rxen_mfp", 1361 + "ks_in1_mfp", 1362 + "ks_in3_mfp", 1363 + "sens0_ckout_mfp", 1364 1364 }; 1365 1365 1366 1366 static const char * const pwm2_groups[] = { 1367 - "lcd0_d18", 1368 - "rgmii_rxd3", 1369 - "rgmii_rxd1", 1370 - "ks_out0", 1371 - "ks_out2", 1367 + "lcd0_d18_mfp", 1368 + "rgmii_rxd3_mfp", 1369 + "rgmii_rxd1_mfp", 1370 + "ks_out0_mfp", 1371 + "ks_out2_mfp", 1372 1372 }; 1373 1373 1374 1374 static const char * const pwm3_groups[] = { 1375 - "rgmii_rxd0", 1376 - "ks_out1", 1377 - "lcd0_d2", 1375 + "rgmii_rxd0_mfp", 1376 + "ks_out1_mfp", 1377 + "lcd0_d2_mfp", 1378 1378 }; 1379 1379 1380 1380 static const char * const pwm4_groups[] = { 1381 - "lcd0_d18", 1382 - "rgmii_txd01", 1383 - "rgmii_txd0", 1384 - "ks_in0", 1385 - "pcm1_in", 1386 - "nand_ceb3", 1381 + "lcd0_d18_mfp", 1382 + "rgmii_txd01_mfp", 1383 + "rgmii_txd0_mfp", 1384 + "ks_in0_mfp", 1385 + "pcm1_in_mfp", 1386 + "nand_ceb3_mfp", 1387 1387 }; 1388 1388 1389 1389 static const char * const pwm5_groups[] = { 1390 - "rgmii_txd1", 1391 - "ks_in1", 1392 - "pcm1_clk", 1393 - "nand_ceb2", 1390 + "rgmii_txd1_mfp", 1391 + "ks_in1_mfp", 1392 + "pcm1_clk_mfp", 1393 + "nand_ceb2_mfp", 1394 1394 }; 1395 1395 1396 1396 static const char * const p0_groups[] = { 1397 - "ks_in2", 1398 - "ks_in0", 1397 + "ks_in2_mfp", 1398 + "ks_in0_mfp", 1399 1399 }; 1400 1400 1401 1401 static const char * const sd0_groups[] = { 1402 - "ks_out0", 1403 - "ks_out1", 1404 - "ks_out2", 1405 - "lcd0_d2", 1406 - "dsi_dp3", 1407 - "dsi_dp0", 1408 - "sd0_d0", 1409 - "sd0_d1", 1410 - "sd0_d2_d3", 1411 - "sd1_d0_d3", 1412 - "sd0_cmd", 1413 - "sd0_clk", 1402 + "ks_out0_mfp", 1403 + "ks_out1_mfp", 1404 + "ks_out2_mfp", 1405 + "lcd0_d2_mfp", 1406 + "dsi_dp3_mfp", 1407 + "dsi_dp0_mfp", 1408 + "sd0_d0_mfp", 1409 + "sd0_d1_mfp", 1410 + "sd0_d2_d3_mfp", 1411 + "sd1_d0_d3_mfp", 1412 + "sd0_cmd_mfp", 1413 + "sd0_clk_mfp", 1414 1414 }; 1415 1415 1416 1416 static const char * const sd1_groups[] = { 1417 - "dsi_dp2", 1418 - "mfp1_16_14", 1419 - "lcd0_d2", 1420 - "mfp1_16_14_d17", 1421 - "dsi_dp3", 1422 - "dsi_dn3", 1423 - "dsi_dnp1_cp_d2", 1424 - "dsi_dnp1_cp_d17", 1425 - "dsi_dn2", 1426 - "sd1_d0_d3", 1427 - "sd1_cmd", 1417 + "dsi_dp2_mfp", 1418 + "mfp1_16_14_mfp", 1419 + "lcd0_d2_mfp", 1420 + "mfp1_16_14_d17_mfp", 1421 + "dsi_dp3_mfp", 1422 + "dsi_dn3_mfp", 1423 + "dsi_dnp1_cp_d2_mfp", 1424 + "dsi_dnp1_cp_d17_mfp", 1425 + "dsi_dn2_mfp", 1426 + "sd1_d0_d3_mfp", 1427 + "sd1_cmd_mfp", 1428 1428 "sd1_dummy", 1429 1429 }; 1430 1430 1431 1431 static const char * const sd2_groups[] = { 1432 - "dnand_data_wr", 1432 + "dnand_data_wr_mfp", 1433 1433 }; 1434 1434 1435 1435 static const char * const i2c0_groups[] = { 1436 - "uart0_rx", 1437 - "uart0_tx", 1438 - "i2c0_mfp", 1436 + "uart0_rx_mfp", 1437 + "uart0_tx_mfp", 1438 + "i2c0_mfp_mfp", 1439 1439 }; 1440 1440 1441 1441 static const char * const i2c1_groups[] = { ··· 1448 1448 }; 1449 1449 1450 1450 static const char * const i2c3_groups[] = { 1451 - "uart2_rx_tx", 1452 - "pcm1_sync", 1453 - "pcm1_out", 1451 + "uart2_rx_tx_mfp", 1452 + "pcm1_sync_mfp", 1453 + "pcm1_out_mfp", 1454 1454 }; 1455 1455 1456 1456 static const char * const lvds_groups[] = { 1457 - "lvds_o_pn", 1458 - "lvds_ee_pn", 1459 - "lvds_e_pn", 1457 + "lvds_o_pn_mfp", 1458 + "lvds_ee_pn_mfp", 1459 + "lvds_e_pn_mfp", 1460 1460 }; 1461 1461 1462 1462 static const char * const bt_groups[] = { 1463 - "i2s_pcm1", 1464 - "i2s0_pcm0", 1465 - "i2s1_pcm0", 1466 - "ks_in2", 1467 - "ks_in1", 1468 - "ks_in0", 1469 - "ks_in3", 1470 - "ks_out0", 1471 - "ks_out1", 1472 - "ks_out2", 1473 - "lvds_o_pn", 1474 - "lvds_ee_pn", 1475 - "pcm1_in", 1476 - "pcm1_clk", 1477 - "pcm1_sync", 1478 - "pcm1_out", 1463 + "i2s_pcm1_mfp", 1464 + "i2s0_pcm0_mfp", 1465 + "i2s1_pcm0_mfp", 1466 + "ks_in2_mfp", 1467 + "ks_in1_mfp", 1468 + "ks_in0_mfp", 1469 + "ks_in3_mfp", 1470 + "ks_out0_mfp", 1471 + "ks_out1_mfp", 1472 + "ks_out2_mfp", 1473 + "lvds_o_pn_mfp", 1474 + "lvds_ee_pn_mfp", 1475 + "pcm1_in_mfp", 1476 + "pcm1_clk_mfp", 1477 + "pcm1_sync_mfp", 1478 + "pcm1_out_mfp", 1479 1479 }; 1480 1480 1481 1481 static const char * const lcd0_groups[] = { 1482 - "lcd0_d18", 1483 - "lcd0_d2", 1484 - "mfp1_16_14_d17", 1485 - "lvds_o_pn", 1486 - "dsi_dp3", 1487 - "dsi_dn3", 1488 - "lvds_ee_pn", 1489 - "dsi_dnp1_cp_d2", 1490 - "dsi_dnp1_cp_d17", 1491 - "lvds_e_pn", 1482 + "lcd0_d18_mfp", 1483 + "lcd0_d2_mfp", 1484 + "mfp1_16_14_d17_mfp", 1485 + "lvds_o_pn_mfp", 1486 + "dsi_dp3_mfp", 1487 + "dsi_dn3_mfp", 1488 + "lvds_ee_pn_mfp", 1489 + "dsi_dnp1_cp_d2_mfp", 1490 + "dsi_dnp1_cp_d17_mfp", 1491 + "lvds_e_pn_mfp", 1492 1492 }; 1493 1493 1494 1494 1495 1495 static const char * const usb30_groups[] = { 1496 - "ks_in1", 1496 + "ks_in1_mfp", 1497 1497 }; 1498 1498 1499 1499 static const char * const clko_25m_groups[] = { 1500 - "clko_25m", 1500 + "clko_25m_mfp", 1501 1501 }; 1502 1502 1503 1503 static const char * const mipi_csi_groups[] = { 1504 - "csi_cn_cp", 1505 - "csi_dn_dp", 1504 + "csi_cn_cp_mfp", 1505 + "csi_dn_dp_mfp", 1506 1506 }; 1507 1507 1508 1508 static const char * const dsi_groups[] = { 1509 - "dsi_dn0", 1510 - "dsi_dp2", 1511 - "dsi_dp3", 1512 - "dsi_dn3", 1513 - "dsi_dp0", 1514 - "dsi_dnp1_cp_d2", 1515 - "dsi_dnp1_cp_d17", 1516 - "dsi_dn2", 1509 + "dsi_dn0_mfp", 1510 + "dsi_dp2_mfp", 1511 + "dsi_dp3_mfp", 1512 + "dsi_dn3_mfp", 1513 + "dsi_dp0_mfp", 1514 + "dsi_dnp1_cp_d2_mfp", 1515 + "dsi_dnp1_cp_d17_mfp", 1516 + "dsi_dn2_mfp", 1517 1517 "dsi_dummy", 1518 1518 }; 1519 1519 1520 1520 static const char * const nand_groups[] = { 1521 - "dnand_data_wr", 1522 - "dnand_acle_ce0", 1523 - "nand_ceb2", 1524 - "nand_ceb3", 1521 + "dnand_data_wr_mfp", 1522 + "dnand_acle_ce0_mfp", 1523 + "nand_ceb2_mfp", 1524 + "nand_ceb3_mfp", 1525 1525 "nand_dummy", 1526 1526 }; 1527 1527 1528 1528 static const char * const spdif_groups[] = { 1529 - "uart0_tx", 1529 + "uart0_tx_mfp", 1530 1530 }; 1531 1531 1532 1532 static const char * const sirq0_groups[] = {
+86 -25
drivers/pinctrl/bcm/pinctrl-bcm2835.c
··· 37 37 38 38 #define MODULE_NAME "pinctrl-bcm2835" 39 39 #define BCM2835_NUM_GPIOS 54 40 + #define BCM2711_NUM_GPIOS 58 40 41 #define BCM2835_NUM_BANKS 2 41 42 #define BCM2835_NUM_IRQS 3 42 - 43 - #define BCM2835_PIN_BITMAP_SZ \ 44 - DIV_ROUND_UP(BCM2835_NUM_GPIOS, sizeof(unsigned long) * 8) 45 43 46 44 /* GPIO register offsets */ 47 45 #define GPFSEL0 0x0 /* Function Select */ ··· 79 81 80 82 /* note: locking assumes each bank will have its own unsigned long */ 81 83 unsigned long enabled_irq_map[BCM2835_NUM_BANKS]; 82 - unsigned int irq_type[BCM2835_NUM_GPIOS]; 84 + unsigned int irq_type[BCM2711_NUM_GPIOS]; 83 85 84 86 struct pinctrl_dev *pctl_dev; 85 87 struct gpio_chip gpio_chip; 88 + struct pinctrl_desc pctl_desc; 86 89 struct pinctrl_gpio_range gpio_range; 87 90 88 91 raw_spinlock_t irq_lock[BCM2835_NUM_BANKS]; ··· 146 147 BCM2835_GPIO_PIN(51), 147 148 BCM2835_GPIO_PIN(52), 148 149 BCM2835_GPIO_PIN(53), 150 + BCM2835_GPIO_PIN(54), 151 + BCM2835_GPIO_PIN(55), 152 + BCM2835_GPIO_PIN(56), 153 + BCM2835_GPIO_PIN(57), 149 154 }; 150 155 151 156 /* one pin per group */ ··· 208 205 "gpio51", 209 206 "gpio52", 210 207 "gpio53", 208 + "gpio54", 209 + "gpio55", 210 + "gpio56", 211 + "gpio57", 211 212 }; 212 213 213 214 enum bcm2835_fsel { ··· 329 322 if (fsel > BCM2835_FSEL_GPIO_OUT) 330 323 return -EINVAL; 331 324 332 - return (fsel == BCM2835_FSEL_GPIO_IN); 325 + if (fsel == BCM2835_FSEL_GPIO_IN) 326 + return GPIO_LINE_DIRECTION_IN; 327 + 328 + return GPIO_LINE_DIRECTION_OUT; 333 329 } 334 330 335 331 static void bcm2835_gpio_set(struct gpio_chip *chip, unsigned offset, int value) ··· 362 352 .set_config = gpiochip_generic_config, 363 353 .base = -1, 364 354 .ngpio = BCM2835_NUM_GPIOS, 355 + .can_sleep = false, 356 + }; 357 + 358 + static const struct gpio_chip bcm2711_gpio_chip = { 359 + .label = "pinctrl-bcm2711", 360 + .owner = THIS_MODULE, 361 + .request = gpiochip_generic_request, 362 + .free = gpiochip_generic_free, 363 + .direction_input = bcm2835_gpio_direction_input, 364 + .direction_output = bcm2835_gpio_direction_output, 365 + .get_direction = bcm2835_gpio_get_direction, 366 + .get = bcm2835_gpio_get, 367 + .set = bcm2835_gpio_set, 368 + .set_config = gpiochip_generic_config, 369 + .base = -1, 370 + .ngpio = BCM2711_NUM_GPIOS, 365 371 .can_sleep = false, 366 372 }; 367 373 ··· 427 401 bcm2835_gpio_irq_handle_bank(pc, 0, 0xf0000000); 428 402 bcm2835_gpio_irq_handle_bank(pc, 1, 0x00003fff); 429 403 break; 430 - case 2: /* IRQ2 covers GPIOs 46-53 */ 404 + case 2: /* IRQ2 covers GPIOs 46-57 */ 431 405 bcm2835_gpio_irq_handle_bank(pc, 1, 0x003fc000); 432 406 break; 433 407 } ··· 646 620 647 621 static int bcm2835_pctl_get_groups_count(struct pinctrl_dev *pctldev) 648 622 { 649 - return ARRAY_SIZE(bcm2835_gpio_groups); 623 + return BCM2835_NUM_GPIOS; 650 624 } 651 625 652 626 static const char *bcm2835_pctl_get_group_name(struct pinctrl_dev *pctldev, ··· 804 778 err = of_property_read_u32_index(np, "brcm,pins", i, &pin); 805 779 if (err) 806 780 goto out; 807 - if (pin >= ARRAY_SIZE(bcm2835_gpio_pins)) { 781 + if (pin >= pc->pctl_desc.npins) { 808 782 dev_err(pc->dev, "%pOF: invalid brcm,pins value %d\n", 809 783 np, pin); 810 784 err = -EINVAL; ··· 880 854 { 881 855 /* every pin can do every function */ 882 856 *groups = bcm2835_gpio_groups; 883 - *num_groups = ARRAY_SIZE(bcm2835_gpio_groups); 857 + *num_groups = BCM2835_NUM_GPIOS; 884 858 885 859 return 0; 886 860 } ··· 1080 1054 .pin_config_set = bcm2711_pinconf_set, 1081 1055 }; 1082 1056 1083 - static struct pinctrl_desc bcm2835_pinctrl_desc = { 1057 + static const struct pinctrl_desc bcm2835_pinctrl_desc = { 1084 1058 .name = MODULE_NAME, 1085 1059 .pins = bcm2835_gpio_pins, 1086 - .npins = ARRAY_SIZE(bcm2835_gpio_pins), 1060 + .npins = BCM2835_NUM_GPIOS, 1087 1061 .pctlops = &bcm2835_pctl_ops, 1088 1062 .pmxops = &bcm2835_pmx_ops, 1089 1063 .confops = &bcm2835_pinconf_ops, 1090 1064 .owner = THIS_MODULE, 1091 1065 }; 1092 1066 1093 - static struct pinctrl_gpio_range bcm2835_pinctrl_gpio_range = { 1067 + static const struct pinctrl_desc bcm2711_pinctrl_desc = { 1068 + .name = "pinctrl-bcm2711", 1069 + .pins = bcm2835_gpio_pins, 1070 + .npins = BCM2711_NUM_GPIOS, 1071 + .pctlops = &bcm2835_pctl_ops, 1072 + .pmxops = &bcm2835_pmx_ops, 1073 + .confops = &bcm2711_pinconf_ops, 1074 + .owner = THIS_MODULE, 1075 + }; 1076 + 1077 + static const struct pinctrl_gpio_range bcm2835_pinctrl_gpio_range = { 1094 1078 .name = MODULE_NAME, 1095 1079 .npins = BCM2835_NUM_GPIOS, 1080 + }; 1081 + 1082 + static const struct pinctrl_gpio_range bcm2711_pinctrl_gpio_range = { 1083 + .name = "pinctrl-bcm2711", 1084 + .npins = BCM2711_NUM_GPIOS, 1085 + }; 1086 + 1087 + struct bcm_plat_data { 1088 + const struct gpio_chip *gpio_chip; 1089 + const struct pinctrl_desc *pctl_desc; 1090 + const struct pinctrl_gpio_range *gpio_range; 1091 + }; 1092 + 1093 + static const struct bcm_plat_data bcm2835_plat_data = { 1094 + .gpio_chip = &bcm2835_gpio_chip, 1095 + .pctl_desc = &bcm2835_pinctrl_desc, 1096 + .gpio_range = &bcm2835_pinctrl_gpio_range, 1097 + }; 1098 + 1099 + static const struct bcm_plat_data bcm2711_plat_data = { 1100 + .gpio_chip = &bcm2711_gpio_chip, 1101 + .pctl_desc = &bcm2711_pinctrl_desc, 1102 + .gpio_range = &bcm2711_pinctrl_gpio_range, 1096 1103 }; 1097 1104 1098 1105 static const struct of_device_id bcm2835_pinctrl_match[] = { 1099 1106 { 1100 1107 .compatible = "brcm,bcm2835-gpio", 1101 - .data = &bcm2835_pinconf_ops, 1108 + .data = &bcm2835_plat_data, 1102 1109 }, 1103 1110 { 1104 1111 .compatible = "brcm,bcm2711-gpio", 1105 - .data = &bcm2711_pinconf_ops, 1112 + .data = &bcm2711_plat_data, 1106 1113 }, 1107 1114 {} 1108 1115 }; ··· 1144 1085 { 1145 1086 struct device *dev = &pdev->dev; 1146 1087 struct device_node *np = dev->of_node; 1088 + const struct bcm_plat_data *pdata; 1147 1089 struct bcm2835_pinctrl *pc; 1148 1090 struct gpio_irq_chip *girq; 1149 1091 struct resource iomem; 1150 1092 int err, i; 1151 1093 const struct of_device_id *match; 1152 1094 1153 - BUILD_BUG_ON(ARRAY_SIZE(bcm2835_gpio_pins) != BCM2835_NUM_GPIOS); 1154 - BUILD_BUG_ON(ARRAY_SIZE(bcm2835_gpio_groups) != BCM2835_NUM_GPIOS); 1095 + BUILD_BUG_ON(ARRAY_SIZE(bcm2835_gpio_pins) != BCM2711_NUM_GPIOS); 1096 + BUILD_BUG_ON(ARRAY_SIZE(bcm2835_gpio_groups) != BCM2711_NUM_GPIOS); 1155 1097 1156 1098 pc = devm_kzalloc(dev, sizeof(*pc), GFP_KERNEL); 1157 1099 if (!pc) ··· 1171 1111 if (IS_ERR(pc->base)) 1172 1112 return PTR_ERR(pc->base); 1173 1113 1174 - pc->gpio_chip = bcm2835_gpio_chip; 1114 + match = of_match_node(bcm2835_pinctrl_match, pdev->dev.of_node); 1115 + if (!match) 1116 + return -EINVAL; 1117 + 1118 + pdata = match->data; 1119 + 1120 + pc->gpio_chip = *pdata->gpio_chip; 1175 1121 pc->gpio_chip.parent = dev; 1176 1122 pc->gpio_chip.of_node = np; 1177 1123 ··· 1228 1162 return err; 1229 1163 } 1230 1164 1231 - match = of_match_node(bcm2835_pinctrl_match, pdev->dev.of_node); 1232 - if (match) { 1233 - bcm2835_pinctrl_desc.confops = 1234 - (const struct pinconf_ops *)match->data; 1235 - } 1236 - 1237 - pc->pctl_dev = devm_pinctrl_register(dev, &bcm2835_pinctrl_desc, pc); 1165 + pc->pctl_desc = *pdata->pctl_desc; 1166 + pc->pctl_dev = devm_pinctrl_register(dev, &pc->pctl_desc, pc); 1238 1167 if (IS_ERR(pc->pctl_dev)) { 1239 1168 gpiochip_remove(&pc->gpio_chip); 1240 1169 return PTR_ERR(pc->pctl_dev); 1241 1170 } 1242 1171 1243 - pc->gpio_range = bcm2835_pinctrl_gpio_range; 1172 + pc->gpio_range = *pdata->gpio_range; 1244 1173 pc->gpio_range.base = pc->gpio_chip.base; 1245 1174 pc->gpio_range.gc = &pc->gpio_chip; 1246 1175 pinctrl_add_gpio_range(pc->pctl_dev, &pc->gpio_range);
+4 -1
drivers/pinctrl/bcm/pinctrl-iproc-gpio.c
··· 363 363 unsigned int offset = IPROC_GPIO_REG(gpio, IPROC_GPIO_OUT_EN_OFFSET); 364 364 unsigned int shift = IPROC_GPIO_SHIFT(gpio); 365 365 366 - return !(readl(chip->base + offset) & BIT(shift)); 366 + if (readl(chip->base + offset) & BIT(shift)) 367 + return GPIO_LINE_DIRECTION_OUT; 368 + 369 + return GPIO_LINE_DIRECTION_IN; 367 370 } 368 371 369 372 static void iproc_gpio_set(struct gpio_chip *gc, unsigned gpio, int val)
+1
drivers/pinctrl/core.c
··· 176 176 177 177 return desc->name; 178 178 } 179 + EXPORT_SYMBOL_GPL(pin_get_name); 179 180 180 181 /* Deletes a range of pin descriptors */ 181 182 static void pinctrl_free_pindescs(struct pinctrl_dev *pctldev,
+4 -4
drivers/pinctrl/freescale/Kconfig
··· 125 125 126 126 config PINCTRL_IMX8MM 127 127 bool "IMX8MM pinctrl driver" 128 - depends on ARCH_MXC && ARM64 128 + depends on ARCH_MXC 129 129 select PINCTRL_IMX 130 130 help 131 131 Say Y here to enable the imx8mm pinctrl driver 132 132 133 133 config PINCTRL_IMX8MN 134 134 bool "IMX8MN pinctrl driver" 135 - depends on ARCH_MXC && ARM64 135 + depends on ARCH_MXC 136 136 select PINCTRL_IMX 137 137 help 138 138 Say Y here to enable the imx8mn pinctrl driver 139 139 140 140 config PINCTRL_IMX8MP 141 141 bool "IMX8MP pinctrl driver" 142 - depends on ARCH_MXC && ARM64 142 + depends on ARCH_MXC 143 143 select PINCTRL_IMX 144 144 help 145 145 Say Y here to enable the imx8mp pinctrl driver 146 146 147 147 config PINCTRL_IMX8MQ 148 148 bool "IMX8MQ pinctrl driver" 149 - depends on ARCH_MXC && ARM64 149 + depends on ARCH_MXC 150 150 select PINCTRL_IMX 151 151 help 152 152 Say Y here to enable the imx8mq pinctrl driver
+4 -7
drivers/pinctrl/mediatek/pinctrl-mt6765.c
··· 1070 1070 .ngrps = ARRAY_SIZE(mtk_pins_mt6765), 1071 1071 .eint_hw = &mt6765_eint_hw, 1072 1072 .gpio_m = 0, 1073 - .ies_present = true, 1074 1073 .base_names = mt6765_pinctrl_register_base_names, 1075 1074 .nbase_names = ARRAY_SIZE(mt6765_pinctrl_register_base_names), 1076 - .bias_disable_set = mtk_pinconf_bias_disable_set, 1077 - .bias_disable_get = mtk_pinconf_bias_disable_get, 1078 - .bias_set = mtk_pinconf_bias_set, 1079 - .bias_get = mtk_pinconf_bias_get, 1080 - .drive_set = mtk_pinconf_drive_set_rev1, 1081 - .drive_get = mtk_pinconf_drive_get_rev1, 1075 + .bias_set_combo = mtk_pinconf_bias_set_combo, 1076 + .bias_get_combo = mtk_pinconf_bias_get_combo, 1077 + .drive_set = mtk_pinconf_drive_set_raw, 1078 + .drive_get = mtk_pinconf_drive_get_raw, 1082 1079 .adv_pull_get = mtk_pinconf_adv_pull_get, 1083 1080 .adv_pull_set = mtk_pinconf_adv_pull_set, 1084 1081 };
+2 -5
drivers/pinctrl/mediatek/pinctrl-mt8183.c
··· 554 554 .ngrps = ARRAY_SIZE(mtk_pins_mt8183), 555 555 .eint_hw = &mt8183_eint_hw, 556 556 .gpio_m = 0, 557 - .ies_present = true, 558 557 .base_names = mt8183_pinctrl_register_base_names, 559 558 .nbase_names = ARRAY_SIZE(mt8183_pinctrl_register_base_names), 560 - .bias_disable_set = mtk_pinconf_bias_disable_set_rev1, 561 - .bias_disable_get = mtk_pinconf_bias_disable_get_rev1, 562 - .bias_set = mtk_pinconf_bias_set_rev1, 563 - .bias_get = mtk_pinconf_bias_get_rev1, 559 + .bias_set_combo = mtk_pinconf_bias_set_combo, 560 + .bias_get_combo = mtk_pinconf_bias_get_combo, 564 561 .drive_set = mtk_pinconf_drive_set_rev1, 565 562 .drive_get = mtk_pinconf_drive_get_rev1, 566 563 .adv_pull_get = mtk_pinconf_adv_pull_get,
+255 -9
drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c
··· 6 6 * 7 7 */ 8 8 9 + #include <dt-bindings/pinctrl/mt65xx.h> 9 10 #include <linux/device.h> 10 11 #include <linux/err.h> 11 12 #include <linux/gpio/driver.h> ··· 67 66 const struct mtk_pin_desc *desc, 68 67 int field, struct mtk_pin_field *pfd) 69 68 { 70 - const struct mtk_pin_field_calc *c, *e; 69 + const struct mtk_pin_field_calc *c; 71 70 const struct mtk_pin_reg_calc *rc; 71 + int start = 0, end, check; 72 + bool found = false; 72 73 u32 bits; 73 74 74 75 if (hw->soc->reg_cal && hw->soc->reg_cal[field].range) { 75 76 rc = &hw->soc->reg_cal[field]; 76 77 } else { 77 78 dev_dbg(hw->dev, 78 - "Not support field %d for pin %d (%s)\n", 79 - field, desc->number, desc->name); 79 + "Not support field %d for this soc\n", field); 80 80 return -ENOTSUPP; 81 81 } 82 82 83 - c = rc->range; 84 - e = c + rc->nranges; 83 + end = rc->nranges - 1; 85 84 86 - while (c < e) { 87 - if (desc->number >= c->s_pin && desc->number <= c->e_pin) 85 + while (start <= end) { 86 + check = (start + end) >> 1; 87 + if (desc->number >= rc->range[check].s_pin 88 + && desc->number <= rc->range[check].e_pin) { 89 + found = true; 88 90 break; 89 - c++; 91 + } else if (start == end) 92 + break; 93 + else if (desc->number < rc->range[check].s_pin) 94 + end = check - 1; 95 + else 96 + start = check + 1; 90 97 } 91 98 92 - if (c >= e) { 99 + if (!found) { 93 100 dev_dbg(hw->dev, "Not support field %d for pin = %d (%s)\n", 94 101 field, desc->number, desc->name); 95 102 return -ENOTSUPP; 96 103 } 104 + 105 + c = rc->range + check; 97 106 98 107 if (c->i_base > hw->nbase - 1) { 99 108 dev_err(hw->dev, ··· 192 181 err = mtk_hw_pin_field_get(hw, desc, field, &pf); 193 182 if (err) 194 183 return err; 184 + 185 + if (value < 0 || value > pf.mask) 186 + return -EINVAL; 195 187 196 188 if (!pf.next) 197 189 mtk_rmw(hw, pf.index, pf.offset, pf.mask << pf.bitpos, ··· 516 502 return 0; 517 503 } 518 504 505 + /* Combo for the following pull register type: 506 + * 1. PU + PD 507 + * 2. PULLSEL + PULLEN 508 + * 3. PUPD + R0 + R1 509 + */ 510 + static int mtk_pinconf_bias_set_pu_pd(struct mtk_pinctrl *hw, 511 + const struct mtk_pin_desc *desc, 512 + u32 pullup, u32 arg) 513 + { 514 + int err, pu, pd; 515 + 516 + if (arg == MTK_DISABLE) { 517 + pu = 0; 518 + pd = 0; 519 + } else if ((arg == MTK_ENABLE) && pullup) { 520 + pu = 1; 521 + pd = 0; 522 + } else if ((arg == MTK_ENABLE) && !pullup) { 523 + pu = 0; 524 + pd = 1; 525 + } else { 526 + err = -EINVAL; 527 + goto out; 528 + } 529 + 530 + err = mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_PU, pu); 531 + if (err) 532 + goto out; 533 + 534 + err = mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_PD, pd); 535 + 536 + out: 537 + return err; 538 + } 539 + 540 + static int mtk_pinconf_bias_set_pullsel_pullen(struct mtk_pinctrl *hw, 541 + const struct mtk_pin_desc *desc, 542 + u32 pullup, u32 arg) 543 + { 544 + int err, enable; 545 + 546 + if (arg == MTK_DISABLE) 547 + enable = 0; 548 + else if (arg == MTK_ENABLE) 549 + enable = 1; 550 + else { 551 + err = -EINVAL; 552 + goto out; 553 + } 554 + 555 + err = mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_PULLEN, enable); 556 + if (err) 557 + goto out; 558 + 559 + err = mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_PULLSEL, pullup); 560 + 561 + out: 562 + return err; 563 + } 564 + 565 + static int mtk_pinconf_bias_set_pupd_r1_r0(struct mtk_pinctrl *hw, 566 + const struct mtk_pin_desc *desc, 567 + u32 pullup, u32 arg) 568 + { 569 + int err, r0, r1; 570 + 571 + if ((arg == MTK_DISABLE) || (arg == MTK_PUPD_SET_R1R0_00)) { 572 + pullup = 0; 573 + r0 = 0; 574 + r1 = 0; 575 + } else if (arg == MTK_PUPD_SET_R1R0_01) { 576 + r0 = 1; 577 + r1 = 0; 578 + } else if (arg == MTK_PUPD_SET_R1R0_10) { 579 + r0 = 0; 580 + r1 = 1; 581 + } else if (arg == MTK_PUPD_SET_R1R0_11) { 582 + r0 = 1; 583 + r1 = 1; 584 + } else { 585 + err = -EINVAL; 586 + goto out; 587 + } 588 + 589 + /* MTK HW PUPD bit: 1 for pull-down, 0 for pull-up */ 590 + err = mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_PUPD, !pullup); 591 + if (err) 592 + goto out; 593 + 594 + err = mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_R0, r0); 595 + if (err) 596 + goto out; 597 + 598 + err = mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_R1, r1); 599 + 600 + out: 601 + return err; 602 + } 603 + 604 + static int mtk_pinconf_bias_get_pu_pd(struct mtk_pinctrl *hw, 605 + const struct mtk_pin_desc *desc, 606 + u32 *pullup, u32 *enable) 607 + { 608 + int err, pu, pd; 609 + 610 + err = mtk_hw_get_value(hw, desc, PINCTRL_PIN_REG_PU, &pu); 611 + if (err) 612 + goto out; 613 + 614 + err = mtk_hw_get_value(hw, desc, PINCTRL_PIN_REG_PD, &pd); 615 + if (err) 616 + goto out; 617 + 618 + if (pu == 0 && pd == 0) { 619 + *pullup = 0; 620 + *enable = MTK_DISABLE; 621 + } else if (pu == 1 && pd == 0) { 622 + *pullup = 1; 623 + *enable = MTK_ENABLE; 624 + } else if (pu == 0 && pd == 1) { 625 + *pullup = 0; 626 + *enable = MTK_ENABLE; 627 + } else 628 + err = -EINVAL; 629 + 630 + out: 631 + return err; 632 + } 633 + 634 + static int mtk_pinconf_bias_get_pullsel_pullen(struct mtk_pinctrl *hw, 635 + const struct mtk_pin_desc *desc, 636 + u32 *pullup, u32 *enable) 637 + { 638 + int err; 639 + 640 + err = mtk_hw_get_value(hw, desc, PINCTRL_PIN_REG_PULLSEL, pullup); 641 + if (err) 642 + goto out; 643 + 644 + err = mtk_hw_get_value(hw, desc, PINCTRL_PIN_REG_PULLEN, enable); 645 + 646 + out: 647 + return err; 648 + } 649 + 650 + static int mtk_pinconf_bias_get_pupd_r1_r0(struct mtk_pinctrl *hw, 651 + const struct mtk_pin_desc *desc, 652 + u32 *pullup, u32 *enable) 653 + { 654 + int err, r0, r1; 655 + 656 + err = mtk_hw_get_value(hw, desc, PINCTRL_PIN_REG_PUPD, pullup); 657 + if (err) 658 + goto out; 659 + /* MTK HW PUPD bit: 1 for pull-down, 0 for pull-up */ 660 + *pullup = !(*pullup); 661 + 662 + err = mtk_hw_get_value(hw, desc, PINCTRL_PIN_REG_R0, &r0); 663 + if (err) 664 + goto out; 665 + 666 + err = mtk_hw_get_value(hw, desc, PINCTRL_PIN_REG_R1, &r1); 667 + if (err) 668 + goto out; 669 + 670 + if ((r1 == 0) && (r0 == 0)) 671 + *enable = MTK_PUPD_SET_R1R0_00; 672 + else if ((r1 == 0) && (r0 == 1)) 673 + *enable = MTK_PUPD_SET_R1R0_01; 674 + else if ((r1 == 1) && (r0 == 0)) 675 + *enable = MTK_PUPD_SET_R1R0_10; 676 + else if ((r1 == 1) && (r0 == 1)) 677 + *enable = MTK_PUPD_SET_R1R0_11; 678 + else 679 + err = -EINVAL; 680 + 681 + out: 682 + return err; 683 + } 684 + 685 + int mtk_pinconf_bias_set_combo(struct mtk_pinctrl *hw, 686 + const struct mtk_pin_desc *desc, 687 + u32 pullup, u32 arg) 688 + { 689 + int err; 690 + 691 + err = mtk_pinconf_bias_set_pu_pd(hw, desc, pullup, arg); 692 + if (!err) 693 + goto out; 694 + 695 + err = mtk_pinconf_bias_set_pullsel_pullen(hw, desc, pullup, arg); 696 + if (!err) 697 + goto out; 698 + 699 + err = mtk_pinconf_bias_set_pupd_r1_r0(hw, desc, pullup, arg); 700 + 701 + out: 702 + return err; 703 + } 704 + 705 + int mtk_pinconf_bias_get_combo(struct mtk_pinctrl *hw, 706 + const struct mtk_pin_desc *desc, 707 + u32 *pullup, u32 *enable) 708 + { 709 + int err; 710 + 711 + err = mtk_pinconf_bias_get_pu_pd(hw, desc, pullup, enable); 712 + if (!err) 713 + goto out; 714 + 715 + err = mtk_pinconf_bias_get_pullsel_pullen(hw, desc, pullup, enable); 716 + if (!err) 717 + goto out; 718 + 719 + err = mtk_pinconf_bias_get_pupd_r1_r0(hw, desc, pullup, enable); 720 + 721 + out: 722 + return err; 723 + } 724 + 519 725 /* Revision 0 */ 520 726 int mtk_pinconf_drive_set(struct mtk_pinctrl *hw, 521 727 const struct mtk_pin_desc *desc, u32 arg) ··· 825 591 *val = ((val1 & 0x7) / tb->scal + 1) * tb->step; 826 592 827 593 return 0; 594 + } 595 + 596 + int mtk_pinconf_drive_set_raw(struct mtk_pinctrl *hw, 597 + const struct mtk_pin_desc *desc, u32 arg) 598 + { 599 + return mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_DRV, arg); 600 + } 601 + 602 + int mtk_pinconf_drive_get_raw(struct mtk_pinctrl *hw, 603 + const struct mtk_pin_desc *desc, int *val) 604 + { 605 + return mtk_hw_get_value(hw, desc, PINCTRL_PIN_REG_DRV, val); 828 606 } 829 607 830 608 int mtk_pinconf_adv_pull_set(struct mtk_pinctrl *hw,
+16
drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.h
··· 216 216 int (*bias_get)(struct mtk_pinctrl *hw, 217 217 const struct mtk_pin_desc *desc, bool pullup, int *res); 218 218 219 + int (*bias_set_combo)(struct mtk_pinctrl *hw, 220 + const struct mtk_pin_desc *desc, u32 pullup, u32 arg); 221 + int (*bias_get_combo)(struct mtk_pinctrl *hw, 222 + const struct mtk_pin_desc *desc, u32 *pullup, u32 *arg); 223 + 219 224 int (*drive_set)(struct mtk_pinctrl *hw, 220 225 const struct mtk_pin_desc *desc, u32 arg); 221 226 int (*drive_get)(struct mtk_pinctrl *hw, ··· 282 277 int mtk_pinconf_bias_get_rev1(struct mtk_pinctrl *hw, 283 278 const struct mtk_pin_desc *desc, bool pullup, 284 279 int *res); 280 + int mtk_pinconf_bias_set_combo(struct mtk_pinctrl *hw, 281 + const struct mtk_pin_desc *desc, 282 + u32 pullup, u32 enable); 283 + int mtk_pinconf_bias_get_combo(struct mtk_pinctrl *hw, 284 + const struct mtk_pin_desc *desc, 285 + u32 *pullup, u32 *enable); 285 286 286 287 int mtk_pinconf_drive_set(struct mtk_pinctrl *hw, 287 288 const struct mtk_pin_desc *desc, u32 arg); ··· 297 286 int mtk_pinconf_drive_set_rev1(struct mtk_pinctrl *hw, 298 287 const struct mtk_pin_desc *desc, u32 arg); 299 288 int mtk_pinconf_drive_get_rev1(struct mtk_pinctrl *hw, 289 + const struct mtk_pin_desc *desc, int *val); 290 + 291 + int mtk_pinconf_drive_set_raw(struct mtk_pinctrl *hw, 292 + const struct mtk_pin_desc *desc, u32 arg); 293 + int mtk_pinconf_drive_get_raw(struct mtk_pinctrl *hw, 300 294 const struct mtk_pin_desc *desc, int *val); 301 295 302 296 int mtk_pinconf_adv_pull_set(struct mtk_pinctrl *hw,
+4 -1
drivers/pinctrl/mediatek/pinctrl-mtk-common.c
··· 804 804 pctl->devdata->spec_dir_set(&reg_addr, offset); 805 805 806 806 regmap_read(pctl->regmap1, reg_addr, &read_val); 807 - return !(read_val & bit); 807 + if (read_val & bit) 808 + return GPIO_LINE_DIRECTION_OUT; 809 + 810 + return GPIO_LINE_DIRECTION_IN; 808 811 } 809 812 810 813 static int mtk_gpio_get(struct gpio_chip *chip, unsigned offset)
+244 -149
drivers/pinctrl/mediatek/pinctrl-paris.c
··· 78 78 { 79 79 struct mtk_pinctrl *hw = pinctrl_dev_get_drvdata(pctldev); 80 80 u32 param = pinconf_to_config_param(*config); 81 - int val, val2, err, reg, ret = 1; 81 + int pullup, err, reg, ret = 1; 82 82 const struct mtk_pin_desc *desc; 83 83 84 + if (pin >= hw->soc->npins) { 85 + err = -EINVAL; 86 + goto out; 87 + } 84 88 desc = (const struct mtk_pin_desc *)&hw->soc->pins[pin]; 85 89 86 90 switch (param) { 87 91 case PIN_CONFIG_BIAS_DISABLE: 88 - if (hw->soc->bias_disable_get) { 89 - err = hw->soc->bias_disable_get(hw, desc, &ret); 90 - if (err) 91 - return err; 92 - } else { 93 - return -ENOTSUPP; 94 - } 95 - break; 96 92 case PIN_CONFIG_BIAS_PULL_UP: 97 - if (hw->soc->bias_get) { 98 - err = hw->soc->bias_get(hw, desc, 1, &ret); 99 - if (err) 100 - return err; 101 - } else { 102 - return -ENOTSUPP; 103 - } 104 - break; 105 93 case PIN_CONFIG_BIAS_PULL_DOWN: 106 - if (hw->soc->bias_get) { 107 - err = hw->soc->bias_get(hw, desc, 0, &ret); 94 + if (hw->soc->bias_get_combo) { 95 + err = hw->soc->bias_get_combo(hw, desc, &pullup, &ret); 108 96 if (err) 109 - return err; 110 - } else { 111 - return -ENOTSUPP; 112 - } 113 - break; 114 - case PIN_CONFIG_SLEW_RATE: 115 - err = mtk_hw_get_value(hw, desc, PINCTRL_PIN_REG_SR, &val); 116 - if (err) 117 - return err; 118 - 119 - if (!val) 120 - return -EINVAL; 121 - 122 - break; 123 - case PIN_CONFIG_INPUT_ENABLE: 124 - case PIN_CONFIG_OUTPUT_ENABLE: 125 - err = mtk_hw_get_value(hw, desc, PINCTRL_PIN_REG_DIR, &val); 126 - if (err) 127 - return err; 128 - 129 - /* HW takes input mode as zero; output mode as non-zero */ 130 - if ((val && param == PIN_CONFIG_INPUT_ENABLE) || 131 - (!val && param == PIN_CONFIG_OUTPUT_ENABLE)) 132 - return -EINVAL; 133 - 134 - break; 135 - case PIN_CONFIG_INPUT_SCHMITT_ENABLE: 136 - err = mtk_hw_get_value(hw, desc, PINCTRL_PIN_REG_DIR, &val); 137 - if (err) 138 - return err; 139 - 140 - err = mtk_hw_get_value(hw, desc, PINCTRL_PIN_REG_SMT, &val2); 141 - if (err) 142 - return err; 143 - 144 - if (val || !val2) 145 - return -EINVAL; 146 - 147 - break; 148 - case PIN_CONFIG_DRIVE_STRENGTH: 149 - if (hw->soc->drive_get) { 150 - err = hw->soc->drive_get(hw, desc, &ret); 151 - if (err) 152 - return err; 97 + goto out; 98 + if (param == PIN_CONFIG_BIAS_DISABLE) { 99 + if (ret == MTK_PUPD_SET_R1R0_00) 100 + ret = MTK_DISABLE; 101 + } else if (param == PIN_CONFIG_BIAS_PULL_UP) { 102 + /* When desire to get pull-up value, return 103 + * error if current setting is pull-down 104 + */ 105 + if (!pullup) 106 + err = -EINVAL; 107 + } else if (param == PIN_CONFIG_BIAS_PULL_DOWN) { 108 + /* When desire to get pull-down value, return 109 + * error if current setting is pull-up 110 + */ 111 + if (pullup) 112 + err = -EINVAL; 113 + } 153 114 } else { 154 115 err = -ENOTSUPP; 155 116 } 117 + break; 118 + case PIN_CONFIG_SLEW_RATE: 119 + err = mtk_hw_get_value(hw, desc, PINCTRL_PIN_REG_SR, &ret); 120 + break; 121 + case PIN_CONFIG_INPUT_ENABLE: 122 + case PIN_CONFIG_OUTPUT_ENABLE: 123 + err = mtk_hw_get_value(hw, desc, PINCTRL_PIN_REG_DIR, &ret); 124 + if (err) 125 + goto out; 126 + /* CONFIG Current direction return value 127 + * ------------- ----------------- ---------------------- 128 + * OUTPUT_ENABLE output 1 (= HW value) 129 + * input 0 (= HW value) 130 + * INPUT_ENABLE output 0 (= reverse HW value) 131 + * input 1 (= reverse HW value) 132 + */ 133 + if (param == PIN_CONFIG_INPUT_ENABLE) 134 + ret = !ret; 135 + 136 + break; 137 + case PIN_CONFIG_INPUT_SCHMITT_ENABLE: 138 + err = mtk_hw_get_value(hw, desc, PINCTRL_PIN_REG_DIR, &ret); 139 + if (err) 140 + goto out; 141 + /* return error when in output mode 142 + * because schmitt trigger only work in input mode 143 + */ 144 + if (ret) { 145 + err = -EINVAL; 146 + goto out; 147 + } 148 + 149 + err = mtk_hw_get_value(hw, desc, PINCTRL_PIN_REG_SMT, &ret); 150 + 151 + break; 152 + case PIN_CONFIG_DRIVE_STRENGTH: 153 + if (hw->soc->drive_get) 154 + err = hw->soc->drive_get(hw, desc, &ret); 155 + else 156 + err = -ENOTSUPP; 156 157 break; 157 158 case MTK_PIN_CONFIG_TDSEL: 158 159 case MTK_PIN_CONFIG_RDSEL: 159 160 reg = (param == MTK_PIN_CONFIG_TDSEL) ? 160 161 PINCTRL_PIN_REG_TDSEL : PINCTRL_PIN_REG_RDSEL; 161 - 162 - err = mtk_hw_get_value(hw, desc, reg, &val); 163 - if (err) 164 - return err; 165 - 166 - ret = val; 167 - 162 + err = mtk_hw_get_value(hw, desc, reg, &ret); 168 163 break; 169 164 case MTK_PIN_CONFIG_PU_ADV: 170 165 case MTK_PIN_CONFIG_PD_ADV: ··· 168 173 169 174 pullup = param == MTK_PIN_CONFIG_PU_ADV; 170 175 err = hw->soc->adv_pull_get(hw, desc, pullup, &ret); 171 - if (err) 172 - return err; 173 - } else { 174 - return -ENOTSUPP; 175 - } 176 + } else 177 + err = -ENOTSUPP; 176 178 break; 177 179 case MTK_PIN_CONFIG_DRV_ADV: 178 - if (hw->soc->adv_drive_get) { 180 + if (hw->soc->adv_drive_get) 179 181 err = hw->soc->adv_drive_get(hw, desc, &ret); 180 - if (err) 181 - return err; 182 - } else { 183 - return -ENOTSUPP; 184 - } 182 + else 183 + err = -ENOTSUPP; 185 184 break; 186 185 default: 187 - return -ENOTSUPP; 186 + err = -ENOTSUPP; 188 187 } 189 188 190 - *config = pinconf_to_config_packed(param, ret); 189 + out: 190 + if (!err) 191 + *config = pinconf_to_config_packed(param, ret); 191 192 192 - return 0; 193 + return err; 193 194 } 194 195 195 196 static int mtk_pinconf_set(struct pinctrl_dev *pctldev, unsigned int pin, ··· 197 206 int err = 0; 198 207 u32 reg; 199 208 209 + if (pin >= hw->soc->npins) { 210 + err = -EINVAL; 211 + goto err; 212 + } 200 213 desc = (const struct mtk_pin_desc *)&hw->soc->pins[pin]; 201 214 202 215 switch ((u32)param) { 203 216 case PIN_CONFIG_BIAS_DISABLE: 204 - if (hw->soc->bias_disable_set) { 205 - err = hw->soc->bias_disable_set(hw, desc); 206 - if (err) 207 - return err; 208 - } else { 209 - return -ENOTSUPP; 210 - } 217 + if (hw->soc->bias_set_combo) 218 + err = hw->soc->bias_set_combo(hw, desc, 0, MTK_DISABLE); 219 + else 220 + err = -ENOTSUPP; 211 221 break; 212 222 case PIN_CONFIG_BIAS_PULL_UP: 213 - if (hw->soc->bias_set) { 214 - err = hw->soc->bias_set(hw, desc, 1); 215 - if (err) 216 - return err; 217 - } else { 218 - return -ENOTSUPP; 219 - } 223 + if (hw->soc->bias_set_combo) 224 + err = hw->soc->bias_set_combo(hw, desc, 1, arg); 225 + else 226 + err = -ENOTSUPP; 220 227 break; 221 228 case PIN_CONFIG_BIAS_PULL_DOWN: 222 - if (hw->soc->bias_set) { 223 - err = hw->soc->bias_set(hw, desc, 0); 224 - if (err) 225 - return err; 226 - } else { 227 - return -ENOTSUPP; 228 - } 229 + if (hw->soc->bias_set_combo) 230 + err = hw->soc->bias_set_combo(hw, desc, 0, arg); 231 + else 232 + err = -ENOTSUPP; 229 233 break; 230 234 case PIN_CONFIG_OUTPUT_ENABLE: 231 235 err = mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_SMT, 232 236 MTK_DISABLE); 233 - if (err) 237 + /* Keep set direction to consider the case that a GPIO pin 238 + * does not have SMT control 239 + */ 240 + if (err != -ENOTSUPP) 234 241 goto err; 235 242 236 243 err = mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_DIR, 237 244 MTK_OUTPUT); 238 - if (err) 239 - goto err; 240 245 break; 241 246 case PIN_CONFIG_INPUT_ENABLE: 242 - if (hw->soc->ies_present) { 243 - mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_IES, 244 - MTK_ENABLE); 245 - } 247 + /* regard all non-zero value as enable */ 248 + err = mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_IES, !!arg); 249 + if (err) 250 + goto err; 246 251 247 252 err = mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_DIR, 248 253 MTK_INPUT); 249 - if (err) 250 - goto err; 251 254 break; 252 255 case PIN_CONFIG_SLEW_RATE: 253 - err = mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_SR, 254 - arg); 255 - if (err) 256 - goto err; 257 - 256 + /* regard all non-zero value as enable */ 257 + err = mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_SR, !!arg); 258 258 break; 259 259 case PIN_CONFIG_OUTPUT: 260 260 err = mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_DIR, ··· 255 273 256 274 err = mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_DO, 257 275 arg); 258 - if (err) 259 - goto err; 260 276 break; 277 + case PIN_CONFIG_INPUT_SCHMITT: 261 278 case PIN_CONFIG_INPUT_SCHMITT_ENABLE: 262 279 /* arg = 1: Input mode & SMT enable ; 263 280 * arg = 0: Output mode & SMT disable 264 281 */ 265 - arg = arg ? 2 : 1; 266 - err = mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_DIR, 267 - arg & 1); 282 + err = mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_DIR, !arg); 268 283 if (err) 269 284 goto err; 270 285 271 - err = mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_SMT, 272 - !!(arg & 2)); 273 - if (err) 274 - goto err; 286 + err = mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_SMT, !!arg); 275 287 break; 276 288 case PIN_CONFIG_DRIVE_STRENGTH: 277 - if (hw->soc->drive_set) { 289 + if (hw->soc->drive_set) 278 290 err = hw->soc->drive_set(hw, desc, arg); 279 - if (err) 280 - return err; 281 - } else { 282 - return -ENOTSUPP; 283 - } 291 + else 292 + err = -ENOTSUPP; 284 293 break; 285 294 case MTK_PIN_CONFIG_TDSEL: 286 295 case MTK_PIN_CONFIG_RDSEL: 287 296 reg = (param == MTK_PIN_CONFIG_TDSEL) ? 288 297 PINCTRL_PIN_REG_TDSEL : PINCTRL_PIN_REG_RDSEL; 289 - 290 298 err = mtk_hw_set_value(hw, desc, reg, arg); 291 - if (err) 292 - goto err; 293 299 break; 294 300 case MTK_PIN_CONFIG_PU_ADV: 295 301 case MTK_PIN_CONFIG_PD_ADV: ··· 287 317 pullup = param == MTK_PIN_CONFIG_PU_ADV; 288 318 err = hw->soc->adv_pull_set(hw, desc, pullup, 289 319 arg); 290 - if (err) 291 - return err; 292 - } else { 293 - return -ENOTSUPP; 294 - } 320 + } else 321 + err = -ENOTSUPP; 295 322 break; 296 323 case MTK_PIN_CONFIG_DRV_ADV: 297 - if (hw->soc->adv_drive_set) { 324 + if (hw->soc->adv_drive_set) 298 325 err = hw->soc->adv_drive_set(hw, desc, arg); 299 - if (err) 300 - return err; 301 - } else { 302 - return -ENOTSUPP; 303 - } 326 + else 327 + err = -ENOTSUPP; 304 328 break; 305 329 default: 306 330 err = -ENOTSUPP; ··· 539 575 return 0; 540 576 } 541 577 578 + static int mtk_hw_get_value_wrap(struct mtk_pinctrl *hw, unsigned int gpio, int field) 579 + { 580 + const struct mtk_pin_desc *desc; 581 + int value, err; 582 + 583 + if (gpio >= hw->soc->npins) 584 + return -EINVAL; 585 + 586 + desc = (const struct mtk_pin_desc *)&hw->soc->pins[gpio]; 587 + 588 + err = mtk_hw_get_value(hw, desc, field, &value); 589 + if (err) 590 + return err; 591 + 592 + return value; 593 + } 594 + 595 + #define mtk_pctrl_get_pinmux(hw, gpio) \ 596 + mtk_hw_get_value_wrap(hw, gpio, PINCTRL_PIN_REG_MODE) 597 + 598 + #define mtk_pctrl_get_direction(hw, gpio) \ 599 + mtk_hw_get_value_wrap(hw, gpio, PINCTRL_PIN_REG_DIR) 600 + 601 + #define mtk_pctrl_get_out(hw, gpio) \ 602 + mtk_hw_get_value_wrap(hw, gpio, PINCTRL_PIN_REG_DO) 603 + 604 + #define mtk_pctrl_get_in(hw, gpio) \ 605 + mtk_hw_get_value_wrap(hw, gpio, PINCTRL_PIN_REG_DI) 606 + 607 + #define mtk_pctrl_get_smt(hw, gpio) \ 608 + mtk_hw_get_value_wrap(hw, gpio, PINCTRL_PIN_REG_SMT) 609 + 610 + #define mtk_pctrl_get_ies(hw, gpio) \ 611 + mtk_hw_get_value_wrap(hw, gpio, PINCTRL_PIN_REG_IES) 612 + 613 + #define mtk_pctrl_get_driving(hw, gpio) \ 614 + mtk_hw_get_value_wrap(hw, gpio, PINCTRL_PIN_REG_DRV) 615 + 616 + ssize_t mtk_pctrl_show_one_pin(struct mtk_pinctrl *hw, 617 + unsigned int gpio, char *buf, unsigned int bufLen) 618 + { 619 + int pinmux, pullup, pullen, len = 0, r1 = -1, r0 = -1; 620 + const struct mtk_pin_desc *desc; 621 + 622 + if (gpio >= hw->soc->npins) 623 + return -EINVAL; 624 + 625 + desc = (const struct mtk_pin_desc *)&hw->soc->pins[gpio]; 626 + pinmux = mtk_pctrl_get_pinmux(hw, gpio); 627 + if (pinmux >= hw->soc->nfuncs) 628 + pinmux -= hw->soc->nfuncs; 629 + 630 + mtk_pinconf_bias_get_combo(hw, desc, &pullup, &pullen); 631 + if (pullen == MTK_PUPD_SET_R1R0_00) { 632 + pullen = 0; 633 + r1 = 0; 634 + r0 = 0; 635 + } else if (pullen == MTK_PUPD_SET_R1R0_01) { 636 + pullen = 1; 637 + r1 = 0; 638 + r0 = 1; 639 + } else if (pullen == MTK_PUPD_SET_R1R0_10) { 640 + pullen = 1; 641 + r1 = 1; 642 + r0 = 0; 643 + } else if (pullen == MTK_PUPD_SET_R1R0_11) { 644 + pullen = 1; 645 + r1 = 1; 646 + r0 = 1; 647 + } else if (pullen != MTK_DISABLE && pullen != MTK_ENABLE) { 648 + pullen = 0; 649 + } 650 + len += scnprintf(buf + len, bufLen - len, 651 + "%03d: %1d%1d%1d%1d%02d%1d%1d%1d%1d", 652 + gpio, 653 + pinmux, 654 + mtk_pctrl_get_direction(hw, gpio), 655 + mtk_pctrl_get_out(hw, gpio), 656 + mtk_pctrl_get_in(hw, gpio), 657 + mtk_pctrl_get_driving(hw, gpio), 658 + mtk_pctrl_get_smt(hw, gpio), 659 + mtk_pctrl_get_ies(hw, gpio), 660 + pullen, 661 + pullup); 662 + 663 + if (r1 != -1) { 664 + len += scnprintf(buf + len, bufLen - len, " (%1d %1d)\n", 665 + r1, r0); 666 + } else { 667 + len += scnprintf(buf + len, bufLen - len, "\n"); 668 + } 669 + 670 + return len; 671 + } 672 + 673 + #define PIN_DBG_BUF_SZ 96 674 + static void mtk_pctrl_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s, 675 + unsigned int gpio) 676 + { 677 + struct mtk_pinctrl *hw = pinctrl_dev_get_drvdata(pctldev); 678 + char buf[PIN_DBG_BUF_SZ]; 679 + 680 + (void)mtk_pctrl_show_one_pin(hw, gpio, buf, PIN_DBG_BUF_SZ); 681 + 682 + seq_printf(s, "%s", buf); 683 + } 684 + 542 685 static const struct pinctrl_ops mtk_pctlops = { 543 686 .dt_node_to_map = mtk_pctrl_dt_node_to_map, 544 687 .dt_free_map = pinctrl_utils_free_map, 545 688 .get_groups_count = mtk_pctrl_get_groups_count, 546 689 .get_group_name = mtk_pctrl_get_group_name, 547 690 .get_group_pins = mtk_pctrl_get_group_pins, 691 + .pin_dbg_show = mtk_pctrl_dbg_show, 548 692 }; 549 693 550 694 static int mtk_pmx_get_funcs_cnt(struct pinctrl_dev *pctldev) ··· 749 677 .pin_config_get = mtk_pinconf_get, 750 678 .pin_config_group_get = mtk_pconf_group_get, 751 679 .pin_config_group_set = mtk_pconf_group_set, 680 + .is_generic = true, 752 681 }; 753 682 754 683 static struct pinctrl_desc mtk_desc = { ··· 766 693 const struct mtk_pin_desc *desc; 767 694 int value, err; 768 695 696 + if (gpio >= hw->soc->npins) 697 + return -EINVAL; 698 + 769 699 desc = (const struct mtk_pin_desc *)&hw->soc->pins[gpio]; 770 700 771 701 err = mtk_hw_get_value(hw, desc, PINCTRL_PIN_REG_DIR, &value); 772 702 if (err) 773 703 return err; 774 704 775 - return !value; 705 + if (value) 706 + return GPIO_LINE_DIRECTION_OUT; 707 + 708 + return GPIO_LINE_DIRECTION_IN; 776 709 } 777 710 778 711 static int mtk_gpio_get(struct gpio_chip *chip, unsigned int gpio) ··· 786 707 struct mtk_pinctrl *hw = gpiochip_get_data(chip); 787 708 const struct mtk_pin_desc *desc; 788 709 int value, err; 710 + 711 + if (gpio >= hw->soc->npins) 712 + return -EINVAL; 789 713 790 714 desc = (const struct mtk_pin_desc *)&hw->soc->pins[gpio]; 791 715 ··· 804 722 struct mtk_pinctrl *hw = gpiochip_get_data(chip); 805 723 const struct mtk_pin_desc *desc; 806 724 725 + if (gpio >= hw->soc->npins) 726 + return; 727 + 807 728 desc = (const struct mtk_pin_desc *)&hw->soc->pins[gpio]; 808 729 809 730 mtk_hw_set_value(hw, desc, PINCTRL_PIN_REG_DO, !!value); ··· 814 729 815 730 static int mtk_gpio_direction_input(struct gpio_chip *chip, unsigned int gpio) 816 731 { 732 + struct mtk_pinctrl *hw = gpiochip_get_data(chip); 733 + 734 + if (gpio >= hw->soc->npins) 735 + return -EINVAL; 736 + 817 737 return pinctrl_gpio_direction_input(chip->base + gpio); 818 738 } 819 739 820 740 static int mtk_gpio_direction_output(struct gpio_chip *chip, unsigned int gpio, 821 741 int value) 822 742 { 743 + struct mtk_pinctrl *hw = gpiochip_get_data(chip); 744 + 745 + if (gpio >= hw->soc->npins) 746 + return -EINVAL; 747 + 823 748 mtk_gpio_set(chip, gpio, value); 824 749 825 750 return pinctrl_gpio_direction_output(chip->base + gpio);
+3
drivers/pinctrl/mediatek/pinctrl-paris.h
··· 60 60 int mtk_paris_pinctrl_probe(struct platform_device *pdev, 61 61 const struct mtk_pin_soc *soc); 62 62 63 + ssize_t mtk_pctrl_show_one_pin(struct mtk_pinctrl *hw, 64 + unsigned int gpio, char *buf, unsigned int bufLen); 65 + 63 66 extern const struct dev_pm_ops mtk_paris_pinctrl_pm_ops; 64 67 65 68 #endif /* __PINCTRL_PARIS_H */
+35
drivers/pinctrl/meson/pinctrl-meson-gxbb.c
··· 231 231 static const unsigned int hdmi_sda_pins[] = { GPIOH_1 }; 232 232 static const unsigned int hdmi_scl_pins[] = { GPIOH_2 }; 233 233 234 + static const unsigned int tsin_a_d_valid_pins[] = { GPIOY_0 }; 235 + static const unsigned int tsin_a_sop_pins[] = { GPIOY_1 }; 236 + static const unsigned int tsin_a_clk_pins[] = { GPIOY_2 }; 237 + static const unsigned int tsin_a_d0_pins[] = { GPIOY_3 }; 238 + static const unsigned int tsin_a_dp_pins[] = { 239 + GPIOY_4, GPIOY_5, GPIOY_6, GPIOY_7, GPIOY_8, GPIOY_9, GPIOY_10 240 + }; 241 + 242 + static const unsigned int tsin_a_fail_pins[] = { GPIOY_11 }; 234 243 static const unsigned int i2s_out_ch23_y_pins[] = { GPIOY_8 }; 235 244 static const unsigned int i2s_out_ch45_y_pins[] = { GPIOY_9 }; 236 245 static const unsigned int i2s_out_ch67_y_pins[] = { GPIOY_10 }; 246 + 247 + static const unsigned int tsin_b_d_valid_pins[] = { GPIOX_6 }; 248 + static const unsigned int tsin_b_sop_pins[] = { GPIOX_7 }; 249 + static const unsigned int tsin_b_clk_pins[] = { GPIOX_8 }; 250 + static const unsigned int tsin_b_d0_pins[] = { GPIOX_9 }; 237 251 238 252 static const unsigned int spdif_out_y_pins[] = { GPIOY_12 }; 239 253 ··· 451 437 GROUP(pwm_a_x, 3, 17), 452 438 GROUP(pwm_e, 2, 30), 453 439 GROUP(pwm_f_x, 3, 18), 440 + GROUP(tsin_b_d_valid, 3, 9), 441 + GROUP(tsin_b_sop, 3, 8), 442 + GROUP(tsin_b_clk, 3, 10), 443 + GROUP(tsin_b_d0, 3, 7), 454 444 455 445 /* Bank Y */ 456 446 GROUP(uart_cts_c, 1, 17), 457 447 GROUP(uart_rts_c, 1, 16), 458 448 GROUP(uart_tx_c, 1, 19), 459 449 GROUP(uart_rx_c, 1, 18), 450 + GROUP(tsin_a_fail, 3, 3), 451 + GROUP(tsin_a_d_valid, 3, 2), 452 + GROUP(tsin_a_sop, 3, 1), 453 + GROUP(tsin_a_clk, 3, 0), 454 + GROUP(tsin_a_d0, 3, 4), 455 + GROUP(tsin_a_dp, 3, 5), 460 456 GROUP(pwm_a_y, 1, 21), 461 457 GROUP(pwm_f_y, 1, 20), 462 458 GROUP(i2s_out_ch23_y, 1, 5), ··· 623 599 "GPIOX_10", "GPIOX_11", "GPIOX_12", "GPIOX_13", "GPIOX_14", 624 600 "GPIOX_15", "GPIOX_16", "GPIOX_17", "GPIOX_18", "GPIOX_19", 625 601 "GPIOX_20", "GPIOX_21", "GPIOX_22", 602 + }; 603 + 604 + static const char * const tsin_a_groups[] = { 605 + "tsin_a_clk", "tsin_a_sop", "tsin_a_d_valid", "tsin_a_d0", 606 + "tsin_a_dp", "tsin_a_fail", 607 + }; 608 + 609 + static const char * const tsin_b_groups[] = { 610 + "tsin_b_clk", "tsin_b_sop", "tsin_b_d_valid", "tsin_b_d0", 626 611 }; 627 612 628 613 static const char * const emmc_groups[] = { ··· 825 792 FUNCTION(i2s_out), 826 793 FUNCTION(spdif_out), 827 794 FUNCTION(gen_clk_out), 795 + FUNCTION(tsin_a), 796 + FUNCTION(tsin_b), 828 797 }; 829 798 830 799 static struct meson_pmx_func meson_gxbb_aobus_functions[] = {
+27
drivers/pinctrl/meson/pinctrl-meson-gxl.c
··· 241 241 GPIODV_1, GPIODV_2, GPIODV_3, GPIODV_4, GPIODV_5, GPIODV_6, GPIODV_7, 242 242 }; 243 243 244 + static const unsigned int tsin_b_clk_pins[] = { GPIOH_6 }; 245 + static const unsigned int tsin_b_d0_pins[] = { GPIOH_7 }; 246 + static const unsigned int tsin_b_sop_pins[] = { GPIOH_8 }; 247 + static const unsigned int tsin_b_d_valid_pins[] = { GPIOH_9 }; 248 + 249 + static const unsigned int tsin_b_fail_z4_pins[] = { GPIOZ_4 }; 250 + static const unsigned int tsin_b_clk_z3_pins[] = { GPIOZ_3 }; 251 + static const unsigned int tsin_b_d0_z2_pins[] = { GPIOZ_2 }; 252 + static const unsigned int tsin_b_sop_z1_pins[] = { GPIOZ_1 }; 253 + static const unsigned int tsin_b_d_valid_z0_pins[] = { GPIOZ_0 }; 254 + 244 255 static const struct pinctrl_pin_desc meson_gxl_aobus_pins[] = { 245 256 MESON_PIN(GPIOAO_0), 246 257 MESON_PIN(GPIOAO_1), ··· 449 438 GROUP(eth_txd1, 4, 12), 450 439 GROUP(eth_txd2, 4, 11), 451 440 GROUP(eth_txd3, 4, 10), 441 + GROUP(tsin_b_fail_z4, 3, 15), 442 + GROUP(tsin_b_clk_z3, 3, 16), 443 + GROUP(tsin_b_d0_z2, 3, 17), 444 + GROUP(tsin_b_sop_z1, 3, 18), 445 + GROUP(tsin_b_d_valid_z0, 3, 19), 452 446 GROUP(pwm_c, 3, 20), 453 447 GROUP(i2s_out_ch23_z, 3, 26), 454 448 GROUP(i2s_out_ch45_z, 3, 25), ··· 470 454 GROUP(i2s_out_lr_clk, 6, 24), 471 455 GROUP(i2s_out_ch01, 6, 23), 472 456 GROUP(spdif_out_h, 6, 28), 457 + GROUP(tsin_b_d0, 6, 17), 458 + GROUP(tsin_b_sop, 6, 18), 459 + GROUP(tsin_b_d_valid, 6, 19), 460 + GROUP(tsin_b_clk, 6, 20), 473 461 474 462 /* Bank DV */ 475 463 GROUP(uart_tx_b, 2, 16), ··· 709 689 "tsin_a_dp", "tsin_a_fail", 710 690 }; 711 691 692 + static const char * const tsin_b_groups[] = { 693 + "tsin_b_clk", "tsin_b_sop", "tsin_b_d_valid", "tsin_b_d0", 694 + "tsin_b_clk_z3", "tsin_b_sop_z1", "tsin_b_d_valid_z0", "tsin_b_d0_z2", 695 + "tsin_b_fail_z4", 696 + }; 697 + 712 698 static const char * const gpio_aobus_groups[] = { 713 699 "GPIOAO_0", "GPIOAO_1", "GPIOAO_2", "GPIOAO_3", "GPIOAO_4", 714 700 "GPIOAO_5", "GPIOAO_6", "GPIOAO_7", "GPIOAO_8", "GPIOAO_9", ··· 790 764 FUNCTION(spdif_out), 791 765 FUNCTION(eth_led), 792 766 FUNCTION(tsin_a), 767 + FUNCTION(tsin_b), 793 768 }; 794 769 795 770 static struct meson_pmx_func meson_gxl_aobus_functions[] = {
+7 -10
drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
··· 15 15 #include <linux/of.h> 16 16 #include <linux/of_address.h> 17 17 #include <linux/of_device.h> 18 + #include <linux/of_irq.h> 18 19 #include <linux/pinctrl/pinconf-generic.h> 19 20 #include <linux/pinctrl/pinconf.h> 20 21 #include <linux/pinctrl/pinctrl.h> ··· 403 402 mask = BIT(offset); 404 403 regmap_read(info->regmap, reg, &val); 405 404 406 - return !(val & mask); 405 + if (val & mask) 406 + return GPIO_LINE_DIRECTION_OUT; 407 + 408 + return GPIO_LINE_DIRECTION_IN; 407 409 } 408 410 409 411 static int armada_37xx_gpio_direction_output(struct gpio_chip *chip, ··· 742 738 return ret; 743 739 } 744 740 745 - nr_irq_parent = platform_irq_count(pdev); 746 - if (nr_irq_parent < 0) { 747 - if (nr_irq_parent != -EPROBE_DEFER) 748 - dev_err(dev, "Couldn't determine irq count: %pe\n", 749 - ERR_PTR(nr_irq_parent)); 750 - return nr_irq_parent; 751 - } 752 - 741 + nr_irq_parent = of_irq_count(np); 753 742 spin_lock_init(&info->irq_lock); 754 743 755 744 if (!nr_irq_parent) { ··· 779 782 if (!girq->parents) 780 783 return -ENOMEM; 781 784 for (i = 0; i < nr_irq_parent; i++) { 782 - int irq = platform_get_irq(pdev, i); 785 + int irq = irq_of_parse_and_map(np, i); 783 786 784 787 if (irq < 0) 785 788 continue;
+5 -2
drivers/pinctrl/nomadik/pinctrl-nomadik.c
··· 831 831 832 832 clk_enable(nmk_chip->clk); 833 833 834 - dir = !(readl(nmk_chip->addr + NMK_GPIO_DIR) & BIT(offset)); 834 + dir = readl(nmk_chip->addr + NMK_GPIO_DIR) & BIT(offset); 835 835 836 836 clk_disable(nmk_chip->clk); 837 837 838 - return dir; 838 + if (dir) 839 + return GPIO_LINE_DIRECTION_OUT; 840 + 841 + return GPIO_LINE_DIRECTION_IN; 839 842 } 840 843 841 844 static int nmk_gpio_make_input(struct gpio_chip *chip, unsigned offset)
+1
drivers/pinctrl/pinconf-generic.c
··· 286 286 kfree(cfg); 287 287 return ret; 288 288 } 289 + EXPORT_SYMBOL_GPL(pinconf_generic_parse_dt_config); 289 290 290 291 int pinconf_generic_dt_subnode_to_map(struct pinctrl_dev *pctldev, 291 292 struct device_node *np, struct pinctrl_map **map,
+4 -1
drivers/pinctrl/pinctrl-amd.c
··· 46 46 pin_reg = readl(gpio_dev->base + offset * 4); 47 47 raw_spin_unlock_irqrestore(&gpio_dev->lock, flags); 48 48 49 - return !(pin_reg & BIT(OUTPUT_ENABLE_OFF)); 49 + if (pin_reg & BIT(OUTPUT_ENABLE_OFF)) 50 + return GPIO_LINE_DIRECTION_OUT; 51 + 52 + return GPIO_LINE_DIRECTION_IN; 50 53 } 51 54 52 55 static int amd_gpio_direction_input(struct gpio_chip *gc, unsigned offset)
+4 -1
drivers/pinctrl/pinctrl-at91.c
··· 1414 1414 u32 osr; 1415 1415 1416 1416 osr = readl_relaxed(pio + PIO_OSR); 1417 - return !(osr & mask); 1417 + if (osr & mask) 1418 + return GPIO_LINE_DIRECTION_OUT; 1419 + 1420 + return GPIO_LINE_DIRECTION_IN; 1418 1421 } 1419 1422 1420 1423 static int at91_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
+5 -2
drivers/pinctrl/pinctrl-axp209.c
··· 149 149 * going to change the value soon anyway. Default to output. 150 150 */ 151 151 if ((val & AXP20X_GPIO_FUNCTIONS) > 2) 152 - return 0; 152 + return GPIO_LINE_DIRECTION_OUT; 153 153 154 154 /* 155 155 * The GPIO directions are the three lowest values. 156 156 * 2 is input, 0 and 1 are output 157 157 */ 158 - return val & 2; 158 + if (val & 2) 159 + return GPIO_LINE_DIRECTION_IN; 160 + 161 + return GPIO_LINE_DIRECTION_OUT; 159 162 } 160 163 161 164 static int axp20x_gpio_output(struct gpio_chip *chip, unsigned int offset,
+300
drivers/pinctrl/pinctrl-da9062.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * Dialog DA9062 pinctrl and GPIO driver. 4 + * Based on DA9055 GPIO driver. 5 + * 6 + * TODO: 7 + * - add pinmux and pinctrl support (gpio alternate mode) 8 + * 9 + * Documents: 10 + * [1] https://www.dialog-semiconductor.com/sites/default/files/da9062_datasheet_3v6.pdf 11 + * 12 + * Copyright (C) 2019 Pengutronix, Marco Felsch <kernel@pengutronix.de> 13 + */ 14 + #include <linux/bits.h> 15 + #include <linux/module.h> 16 + #include <linux/platform_device.h> 17 + #include <linux/regmap.h> 18 + 19 + #include <linux/gpio/driver.h> 20 + 21 + #include <linux/mfd/da9062/core.h> 22 + #include <linux/mfd/da9062/registers.h> 23 + 24 + /* 25 + * We need this get the gpio_desc from a <gpio_chip,offset> tuple to decide if 26 + * the gpio is active low without a vendor specific dt-binding. 27 + */ 28 + #include "../gpio/gpiolib.h" 29 + 30 + #define DA9062_TYPE(offset) (4 * (offset % 2)) 31 + #define DA9062_PIN_SHIFT(offset) (4 * (offset % 2)) 32 + #define DA9062_PIN_ALTERNATE 0x00 /* gpio alternate mode */ 33 + #define DA9062_PIN_GPI 0x01 /* gpio in */ 34 + #define DA9062_PIN_GPO_OD 0x02 /* gpio out open-drain */ 35 + #define DA9062_PIN_GPO_PP 0x03 /* gpio out push-pull */ 36 + #define DA9062_GPIO_NUM 5 37 + 38 + struct da9062_pctl { 39 + struct da9062 *da9062; 40 + struct gpio_chip gc; 41 + unsigned int pin_config[DA9062_GPIO_NUM]; 42 + }; 43 + 44 + static int da9062_pctl_get_pin_mode(struct da9062_pctl *pctl, 45 + unsigned int offset) 46 + { 47 + struct regmap *regmap = pctl->da9062->regmap; 48 + int ret, val; 49 + 50 + ret = regmap_read(regmap, DA9062AA_GPIO_0_1 + (offset >> 1), &val); 51 + if (ret < 0) 52 + return ret; 53 + 54 + val >>= DA9062_PIN_SHIFT(offset); 55 + val &= DA9062AA_GPIO0_PIN_MASK; 56 + 57 + return val; 58 + } 59 + 60 + static int da9062_pctl_set_pin_mode(struct da9062_pctl *pctl, 61 + unsigned int offset, unsigned int mode_req) 62 + { 63 + struct regmap *regmap = pctl->da9062->regmap; 64 + unsigned int mode = mode_req; 65 + unsigned int mask; 66 + int ret; 67 + 68 + mode &= DA9062AA_GPIO0_PIN_MASK; 69 + mode <<= DA9062_PIN_SHIFT(offset); 70 + mask = DA9062AA_GPIO0_PIN_MASK << DA9062_PIN_SHIFT(offset); 71 + 72 + ret = regmap_update_bits(regmap, DA9062AA_GPIO_0_1 + (offset >> 1), 73 + mask, mode); 74 + if (!ret) 75 + pctl->pin_config[offset] = mode_req; 76 + 77 + return ret; 78 + } 79 + 80 + static int da9062_gpio_get(struct gpio_chip *gc, unsigned int offset) 81 + { 82 + struct da9062_pctl *pctl = gpiochip_get_data(gc); 83 + struct regmap *regmap = pctl->da9062->regmap; 84 + int gpio_mode, val; 85 + int ret; 86 + 87 + gpio_mode = da9062_pctl_get_pin_mode(pctl, offset); 88 + if (gpio_mode < 0) 89 + return gpio_mode; 90 + 91 + switch (gpio_mode) { 92 + case DA9062_PIN_ALTERNATE: 93 + return -ENOTSUPP; 94 + case DA9062_PIN_GPI: 95 + ret = regmap_read(regmap, DA9062AA_STATUS_B, &val); 96 + if (ret < 0) 97 + return ret; 98 + break; 99 + case DA9062_PIN_GPO_OD: 100 + case DA9062_PIN_GPO_PP: 101 + ret = regmap_read(regmap, DA9062AA_GPIO_MODE0_4, &val); 102 + if (ret < 0) 103 + return ret; 104 + } 105 + 106 + return !!(val & BIT(offset)); 107 + } 108 + 109 + static void da9062_gpio_set(struct gpio_chip *gc, unsigned int offset, 110 + int value) 111 + { 112 + struct da9062_pctl *pctl = gpiochip_get_data(gc); 113 + struct regmap *regmap = pctl->da9062->regmap; 114 + 115 + regmap_update_bits(regmap, DA9062AA_GPIO_MODE0_4, BIT(offset), 116 + value << offset); 117 + } 118 + 119 + static int da9062_gpio_get_direction(struct gpio_chip *gc, unsigned int offset) 120 + { 121 + struct da9062_pctl *pctl = gpiochip_get_data(gc); 122 + int gpio_mode; 123 + 124 + gpio_mode = da9062_pctl_get_pin_mode(pctl, offset); 125 + if (gpio_mode < 0) 126 + return gpio_mode; 127 + 128 + switch (gpio_mode) { 129 + case DA9062_PIN_ALTERNATE: 130 + return -ENOTSUPP; 131 + case DA9062_PIN_GPI: 132 + return GPIO_LINE_DIRECTION_IN; 133 + case DA9062_PIN_GPO_OD: 134 + case DA9062_PIN_GPO_PP: 135 + return GPIO_LINE_DIRECTION_OUT; 136 + } 137 + 138 + return -EINVAL; 139 + } 140 + 141 + static int da9062_gpio_direction_input(struct gpio_chip *gc, 142 + unsigned int offset) 143 + { 144 + struct da9062_pctl *pctl = gpiochip_get_data(gc); 145 + struct regmap *regmap = pctl->da9062->regmap; 146 + struct gpio_desc *desc = gpiochip_get_desc(gc, offset); 147 + unsigned int gpi_type; 148 + int ret; 149 + 150 + ret = da9062_pctl_set_pin_mode(pctl, offset, DA9062_PIN_GPI); 151 + if (ret) 152 + return ret; 153 + 154 + /* 155 + * If the gpio is active low we should set it in hw too. No worries 156 + * about gpio_get() because we read and return the gpio-level. So the 157 + * gpiolib active_low handling is still correct. 158 + * 159 + * 0 - active low, 1 - active high 160 + */ 161 + gpi_type = !gpiod_is_active_low(desc); 162 + 163 + return regmap_update_bits(regmap, DA9062AA_GPIO_0_1 + (offset >> 1), 164 + DA9062AA_GPIO0_TYPE_MASK << DA9062_TYPE(offset), 165 + gpi_type << DA9062_TYPE(offset)); 166 + } 167 + 168 + static int da9062_gpio_direction_output(struct gpio_chip *gc, 169 + unsigned int offset, int value) 170 + { 171 + struct da9062_pctl *pctl = gpiochip_get_data(gc); 172 + unsigned int pin_config = pctl->pin_config[offset]; 173 + int ret; 174 + 175 + ret = da9062_pctl_set_pin_mode(pctl, offset, pin_config); 176 + if (ret) 177 + return ret; 178 + 179 + da9062_gpio_set(gc, offset, value); 180 + 181 + return 0; 182 + } 183 + 184 + static int da9062_gpio_set_config(struct gpio_chip *gc, unsigned int offset, 185 + unsigned long config) 186 + { 187 + struct da9062_pctl *pctl = gpiochip_get_data(gc); 188 + struct regmap *regmap = pctl->da9062->regmap; 189 + int gpio_mode; 190 + 191 + /* 192 + * We need to meet the following restrictions [1, Figure 18]: 193 + * - PIN_CONFIG_BIAS_PULL_DOWN -> only allowed if the pin is used as 194 + * gpio input 195 + * - PIN_CONFIG_BIAS_PULL_UP -> only allowed if the pin is used as 196 + * gpio output open-drain. 197 + */ 198 + 199 + switch (pinconf_to_config_param(config)) { 200 + case PIN_CONFIG_BIAS_DISABLE: 201 + return regmap_update_bits(regmap, DA9062AA_CONFIG_K, 202 + BIT(offset), 0); 203 + case PIN_CONFIG_BIAS_PULL_DOWN: 204 + gpio_mode = da9062_pctl_get_pin_mode(pctl, offset); 205 + if (gpio_mode < 0) 206 + return -EINVAL; 207 + else if (gpio_mode != DA9062_PIN_GPI) 208 + return -ENOTSUPP; 209 + return regmap_update_bits(regmap, DA9062AA_CONFIG_K, 210 + BIT(offset), BIT(offset)); 211 + case PIN_CONFIG_BIAS_PULL_UP: 212 + gpio_mode = da9062_pctl_get_pin_mode(pctl, offset); 213 + if (gpio_mode < 0) 214 + return -EINVAL; 215 + else if (gpio_mode != DA9062_PIN_GPO_OD) 216 + return -ENOTSUPP; 217 + return regmap_update_bits(regmap, DA9062AA_CONFIG_K, 218 + BIT(offset), BIT(offset)); 219 + case PIN_CONFIG_DRIVE_OPEN_DRAIN: 220 + return da9062_pctl_set_pin_mode(pctl, offset, 221 + DA9062_PIN_GPO_OD); 222 + case PIN_CONFIG_DRIVE_PUSH_PULL: 223 + return da9062_pctl_set_pin_mode(pctl, offset, 224 + DA9062_PIN_GPO_PP); 225 + default: 226 + return -ENOTSUPP; 227 + } 228 + } 229 + 230 + static int da9062_gpio_to_irq(struct gpio_chip *gc, unsigned int offset) 231 + { 232 + struct da9062_pctl *pctl = gpiochip_get_data(gc); 233 + struct da9062 *da9062 = pctl->da9062; 234 + 235 + return regmap_irq_get_virq(da9062->regmap_irq, 236 + DA9062_IRQ_GPI0 + offset); 237 + } 238 + 239 + static const struct gpio_chip reference_gc = { 240 + .owner = THIS_MODULE, 241 + .get = da9062_gpio_get, 242 + .set = da9062_gpio_set, 243 + .get_direction = da9062_gpio_get_direction, 244 + .direction_input = da9062_gpio_direction_input, 245 + .direction_output = da9062_gpio_direction_output, 246 + .set_config = da9062_gpio_set_config, 247 + .to_irq = da9062_gpio_to_irq, 248 + .can_sleep = true, 249 + .ngpio = DA9062_GPIO_NUM, 250 + .base = -1, 251 + }; 252 + 253 + static int da9062_pctl_probe(struct platform_device *pdev) 254 + { 255 + struct device *parent = pdev->dev.parent; 256 + struct da9062_pctl *pctl; 257 + int i; 258 + 259 + pctl = devm_kzalloc(&pdev->dev, sizeof(*pctl), GFP_KERNEL); 260 + if (!pctl) 261 + return -ENOMEM; 262 + 263 + pctl->da9062 = dev_get_drvdata(parent); 264 + if (!pctl->da9062) 265 + return -EINVAL; 266 + 267 + if (!device_property_present(parent, "gpio-controller")) 268 + return 0; 269 + 270 + for (i = 0; i < ARRAY_SIZE(pctl->pin_config); i++) 271 + pctl->pin_config[i] = DA9062_PIN_GPO_PP; 272 + 273 + /* 274 + * Currently the driver handles only the GPIO support. The 275 + * pinctrl/pinmux support can be added later if needed. 276 + */ 277 + pctl->gc = reference_gc; 278 + pctl->gc.label = dev_name(&pdev->dev); 279 + pctl->gc.parent = &pdev->dev; 280 + #ifdef CONFIG_OF_GPIO 281 + pctl->gc.of_node = parent->of_node; 282 + #endif 283 + 284 + platform_set_drvdata(pdev, pctl); 285 + 286 + return devm_gpiochip_add_data(&pdev->dev, &pctl->gc, pctl); 287 + } 288 + 289 + static struct platform_driver da9062_pctl_driver = { 290 + .probe = da9062_pctl_probe, 291 + .driver = { 292 + .name = "da9062-gpio", 293 + }, 294 + }; 295 + module_platform_driver(da9062_pctl_driver); 296 + 297 + MODULE_AUTHOR("Marco Felsch <kernel@pengutronix.de>"); 298 + MODULE_DESCRIPTION("DA9062 PMIC pinctrl and GPIO Driver"); 299 + MODULE_LICENSE("GPL v2"); 300 + MODULE_ALIAS("platform:da9062-gpio");
+50 -5
drivers/pinctrl/pinctrl-ingenic.c
··· 4 4 * 5 5 * Copyright (c) 2017 Paul Cercueil <paul@crapouillou.net> 6 6 * Copyright (c) 2019 周琰杰 (Zhou Yanjie) <zhouyanjie@wanyeetech.com> 7 + * Copyright (c) 2017, 2019 Paul Boddie <paul@boddie.org.uk> 7 8 */ 8 9 9 10 #include <linux/compiler.h> ··· 901 900 static int jz4780_i2c3_pins[] = { 0x6a, 0x6b, }; 902 901 static int jz4780_i2c4_e_pins[] = { 0x8c, 0x8d, }; 903 902 static int jz4780_i2c4_f_pins[] = { 0xb9, 0xb8, }; 903 + static int jz4780_hdmi_ddc_pins[] = { 0xb9, 0xb8, }; 904 904 905 905 static int jz4780_uart2_data_funcs[] = { 1, 1, }; 906 906 static int jz4780_uart2_hwflow_funcs[] = { 1, 1, }; ··· 910 908 static int jz4780_i2c3_funcs[] = { 1, 1, }; 911 909 static int jz4780_i2c4_e_funcs[] = { 1, 1, }; 912 910 static int jz4780_i2c4_f_funcs[] = { 1, 1, }; 911 + static int jz4780_hdmi_ddc_funcs[] = { 0, 0, }; 913 912 914 913 static const struct group_desc jz4780_groups[] = { 915 914 INGENIC_PIN_GROUP("uart0-data", jz4770_uart0_data), ··· 953 950 INGENIC_PIN_GROUP("i2c3-data", jz4780_i2c3), 954 951 INGENIC_PIN_GROUP("i2c4-data-e", jz4780_i2c4_e), 955 952 INGENIC_PIN_GROUP("i2c4-data-f", jz4780_i2c4_f), 953 + INGENIC_PIN_GROUP("hdmi-ddc", jz4780_hdmi_ddc), 956 954 INGENIC_PIN_GROUP("cim-data", jz4770_cim_8bit), 957 955 INGENIC_PIN_GROUP("lcd-24bit", jz4770_lcd_24bit), 958 956 { "lcd-no-pins", }, ··· 986 982 static const char *jz4780_i2c3_groups[] = { "i2c3-data", }; 987 983 static const char *jz4780_i2c4_groups[] = { "i2c4-data-e", "i2c4-data-f", }; 988 984 static const char *jz4780_cim_groups[] = { "cim-data", }; 985 + static const char *jz4780_hdmi_ddc_groups[] = { "hdmi-ddc", }; 989 986 990 987 static const struct function_desc jz4780_functions[] = { 991 988 { "uart0", jz4770_uart0_groups, ARRAY_SIZE(jz4770_uart0_groups), }, ··· 1019 1014 { "pwm5", jz4770_pwm5_groups, ARRAY_SIZE(jz4770_pwm5_groups), }, 1020 1015 { "pwm6", jz4770_pwm6_groups, ARRAY_SIZE(jz4770_pwm6_groups), }, 1021 1016 { "pwm7", jz4770_pwm7_groups, ARRAY_SIZE(jz4770_pwm7_groups), }, 1017 + { "hdmi-ddc", jz4780_hdmi_ddc_groups, 1018 + ARRAY_SIZE(jz4780_hdmi_ddc_groups), }, 1022 1019 }; 1023 1020 1024 1021 static const struct ingenic_chip_info jz4780_chip_info = { ··· 1444 1437 static int x1830_i2c0_pins[] = { 0x0c, 0x0d, }; 1445 1438 static int x1830_i2c1_pins[] = { 0x39, 0x3a, }; 1446 1439 static int x1830_i2c2_pins[] = { 0x5b, 0x5c, }; 1440 + static int x1830_lcd_rgb_18bit_pins[] = { 1441 + 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 1442 + 0x68, 0x69, 0x6c, 0x6d, 0x6e, 0x6f, 1443 + 0x70, 0x71, 0x72, 0x73, 0x76, 0x77, 1444 + 0x78, 0x79, 0x7a, 0x7b, 1445 + }; 1446 + static int x1830_lcd_slcd_8bit_pins[] = { 1447 + 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x6c, 0x6d, 1448 + 0x69, 0x72, 0x73, 0x7b, 0x7a, 1449 + }; 1450 + static int x1830_lcd_slcd_16bit_pins[] = { 1451 + 0x6e, 0x6f, 0x70, 0x71, 0x76, 0x77, 0x78, 0x79, 1452 + }; 1447 1453 static int x1830_pwm_pwm0_b_pins[] = { 0x31, }; 1448 1454 static int x1830_pwm_pwm0_c_pins[] = { 0x4b, }; 1449 1455 static int x1830_pwm_pwm1_b_pins[] = { 0x32, }; ··· 1506 1486 static int x1830_i2c0_funcs[] = { 1, 1, }; 1507 1487 static int x1830_i2c1_funcs[] = { 0, 0, }; 1508 1488 static int x1830_i2c2_funcs[] = { 1, 1, }; 1489 + static int x1830_lcd_rgb_18bit_funcs[] = { 1490 + 0, 0, 0, 0, 0, 0, 1491 + 0, 0, 0, 0, 0, 0, 1492 + 0, 0, 0, 0, 0, 0, 1493 + 0, 0, 0, 0, 1494 + }; 1495 + static int x1830_lcd_slcd_8bit_funcs[] = { 1496 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1497 + }; 1498 + static int x1830_lcd_slcd_16bit_funcs[] = { 1, 1, 1, 1, 1, 1, 1, 1, }; 1509 1499 static int x1830_pwm_pwm0_b_funcs[] = { 0, }; 1510 1500 static int x1830_pwm_pwm0_c_funcs[] = { 1, }; 1511 1501 static int x1830_pwm_pwm1_b_funcs[] = { 0, }; ··· 1564 1534 INGENIC_PIN_GROUP("i2c0-data", x1830_i2c0), 1565 1535 INGENIC_PIN_GROUP("i2c1-data", x1830_i2c1), 1566 1536 INGENIC_PIN_GROUP("i2c2-data", x1830_i2c2), 1537 + INGENIC_PIN_GROUP("lcd-rgb-18bit", x1830_lcd_rgb_18bit), 1538 + INGENIC_PIN_GROUP("lcd-slcd-8bit", x1830_lcd_slcd_8bit), 1539 + INGENIC_PIN_GROUP("lcd-slcd-16bit", x1830_lcd_slcd_16bit), 1540 + { "lcd-no-pins", }, 1567 1541 INGENIC_PIN_GROUP("pwm0-b", x1830_pwm_pwm0_b), 1568 1542 INGENIC_PIN_GROUP("pwm0-c", x1830_pwm_pwm0_c), 1569 1543 INGENIC_PIN_GROUP("pwm1-b", x1830_pwm_pwm1_b), ··· 1606 1572 static const char *x1830_i2c0_groups[] = { "i2c0-data", }; 1607 1573 static const char *x1830_i2c1_groups[] = { "i2c1-data", }; 1608 1574 static const char *x1830_i2c2_groups[] = { "i2c2-data", }; 1575 + static const char *x1830_lcd_groups[] = { 1576 + "lcd-rgb-18bit", "lcd-slcd-8bit", "lcd-slcd-16bit", "lcd-no-pins", 1577 + }; 1609 1578 static const char *x1830_pwm0_groups[] = { "pwm0-b", "pwm0-c", }; 1610 1579 static const char *x1830_pwm1_groups[] = { "pwm1-b", "pwm1-c", }; 1611 1580 static const char *x1830_pwm2_groups[] = { "pwm2-c-8", "pwm2-c-13", }; ··· 1630 1593 { "i2c0", x1830_i2c0_groups, ARRAY_SIZE(x1830_i2c0_groups), }, 1631 1594 { "i2c1", x1830_i2c1_groups, ARRAY_SIZE(x1830_i2c1_groups), }, 1632 1595 { "i2c2", x1830_i2c2_groups, ARRAY_SIZE(x1830_i2c2_groups), }, 1596 + { "lcd", x1830_lcd_groups, ARRAY_SIZE(x1830_lcd_groups), }, 1633 1597 { "pwm0", x1830_pwm0_groups, ARRAY_SIZE(x1830_pwm0_groups), }, 1634 1598 { "pwm1", x1830_pwm1_groups, ARRAY_SIZE(x1830_pwm1_groups), }, 1635 1599 { "pwm2", x1830_pwm2_groups, ARRAY_SIZE(x1830_pwm2_groups), }, ··· 1954 1916 struct ingenic_pinctrl *jzpc = jzgc->jzpc; 1955 1917 unsigned int pin = gc->base + offset; 1956 1918 1957 - if (jzpc->info->version >= ID_JZ4760) 1958 - return ingenic_get_pin_config(jzpc, pin, JZ4760_GPIO_PAT1); 1919 + if (jzpc->info->version >= ID_JZ4760) { 1920 + if (ingenic_get_pin_config(jzpc, pin, JZ4760_GPIO_PAT1)) 1921 + return GPIO_LINE_DIRECTION_IN; 1922 + return GPIO_LINE_DIRECTION_OUT; 1923 + } 1959 1924 1960 1925 if (ingenic_get_pin_config(jzpc, pin, JZ4740_GPIO_SELECT)) 1961 - return true; 1926 + return GPIO_LINE_DIRECTION_IN; 1962 1927 1963 - return !ingenic_get_pin_config(jzpc, pin, JZ4740_GPIO_DIR); 1928 + if (ingenic_get_pin_config(jzpc, pin, JZ4740_GPIO_DIR)) 1929 + return GPIO_LINE_DIRECTION_OUT; 1930 + 1931 + return GPIO_LINE_DIRECTION_IN; 1964 1932 } 1965 1933 1966 1934 static const struct pinctrl_ops ingenic_pctlops = { ··· 2202 2158 break; 2203 2159 2204 2160 default: 2205 - unreachable(); 2161 + /* unreachable */ 2162 + break; 2206 2163 } 2207 2164 } 2208 2165
+4 -1
drivers/pinctrl/pinctrl-ocelot.c
··· 604 604 605 605 regmap_read(info->map, REG(OCELOT_GPIO_OE, info, offset), &val); 606 606 607 - return !(val & BIT(offset % 32)); 607 + if (val & BIT(offset % 32)) 608 + return GPIO_LINE_DIRECTION_OUT; 609 + 610 + return GPIO_LINE_DIRECTION_IN; 608 611 } 609 612 610 613 static int ocelot_gpio_direction_input(struct gpio_chip *chip,
+4 -1
drivers/pinctrl/pinctrl-oxnas.c
··· 756 756 struct oxnas_gpio_bank *bank = gpiochip_get_data(chip); 757 757 u32 mask = BIT(offset); 758 758 759 - return !(readl_relaxed(bank->reg_base + OUTPUT_EN) & mask); 759 + if (readl_relaxed(bank->reg_base + OUTPUT_EN) & mask) 760 + return GPIO_LINE_DIRECTION_OUT; 761 + 762 + return GPIO_LINE_DIRECTION_IN; 760 763 } 761 764 762 765 static int oxnas_gpio_direction_input(struct gpio_chip *chip,
+4 -1
drivers/pinctrl/pinctrl-pic32.c
··· 1990 1990 { 1991 1991 struct pic32_gpio_bank *bank = gpiochip_get_data(chip); 1992 1992 1993 - return !!(readl(bank->reg_base + TRIS_REG) & BIT(offset)); 1993 + if (readl(bank->reg_base + TRIS_REG) & BIT(offset)) 1994 + return GPIO_LINE_DIRECTION_IN; 1995 + 1996 + return GPIO_LINE_DIRECTION_OUT; 1994 1997 } 1995 1998 1996 1999 static void pic32_gpio_irq_ack(struct irq_data *data)
+4 -1
drivers/pinctrl/pinctrl-pistachio.c
··· 1166 1166 { 1167 1167 struct pistachio_gpio_bank *bank = gpiochip_get_data(chip); 1168 1168 1169 - return !(gpio_readl(bank, GPIO_OUTPUT_EN) & BIT(offset)); 1169 + if (gpio_readl(bank, GPIO_OUTPUT_EN) & BIT(offset)) 1170 + return GPIO_LINE_DIRECTION_OUT; 1171 + 1172 + return GPIO_LINE_DIRECTION_IN; 1170 1173 } 1171 1174 1172 1175 static int pistachio_gpio_get(struct gpio_chip *chip, unsigned offset)
+5 -2
drivers/pinctrl/pinctrl-rk805.c
··· 184 184 185 185 /* default output*/ 186 186 if (!pci->pin_cfg[offset].dir_msk) 187 - return 0; 187 + return GPIO_LINE_DIRECTION_OUT; 188 188 189 189 ret = regmap_read(pci->rk808->regmap, 190 190 pci->pin_cfg[offset].reg, ··· 194 194 return ret; 195 195 } 196 196 197 - return !(val & pci->pin_cfg[offset].dir_msk); 197 + if (val & pci->pin_cfg[offset].dir_msk) 198 + return GPIO_LINE_DIRECTION_OUT; 199 + 200 + return GPIO_LINE_DIRECTION_IN; 198 201 } 199 202 200 203 static const struct gpio_chip rk805_gpio_chip = {
+4 -1
drivers/pinctrl/pinctrl-rockchip.c
··· 2549 2549 data = readl_relaxed(bank->reg_base + GPIO_SWPORT_DDR); 2550 2550 clk_disable(bank->clk); 2551 2551 2552 - return !(data & BIT(offset)); 2552 + if (data & BIT(offset)) 2553 + return GPIO_LINE_DIRECTION_OUT; 2554 + 2555 + return GPIO_LINE_DIRECTION_IN; 2553 2556 } 2554 2557 2555 2558 /*
+4 -1
drivers/pinctrl/pinctrl-rza1.c
··· 777 777 { 778 778 struct rza1_port *port = gpiochip_get_data(chip); 779 779 780 - return !!rza1_get_bit(port, RZA1_PM_REG, gpio); 780 + if (rza1_get_bit(port, RZA1_PM_REG, gpio)) 781 + return GPIO_LINE_DIRECTION_IN; 782 + 783 + return GPIO_LINE_DIRECTION_OUT; 781 784 } 782 785 783 786 static int rza1_gpio_direction_input(struct gpio_chip *chip,
+3 -3
drivers/pinctrl/pinctrl-rza2.c
··· 135 135 reg16 = (reg16 >> (pin * 2)) & RZA2_PDR_MASK; 136 136 137 137 if (reg16 == RZA2_PDR_OUTPUT) 138 - return 0; 138 + return GPIO_LINE_DIRECTION_OUT; 139 139 140 140 if (reg16 == RZA2_PDR_INPUT) 141 - return 1; 141 + return GPIO_LINE_DIRECTION_IN; 142 142 143 143 /* 144 144 * This GPIO controller has a default Hi-Z state that is not input or ··· 146 146 */ 147 147 rza2_pin_to_gpio(priv->base, offset, 1); 148 148 149 - return 1; 149 + return GPIO_LINE_DIRECTION_IN; 150 150 } 151 151 152 152 static int rza2_chip_direction_input(struct gpio_chip *chip,
+11 -3
drivers/pinctrl/pinctrl-st.c
··· 746 746 function = st_pctl_get_pin_function(&pc, offset); 747 747 if (function) { 748 748 st_pinconf_get_direction(&pc, offset, &config); 749 - return !ST_PINCONF_UNPACK_OE(config); 749 + if (ST_PINCONF_UNPACK_OE(config)) 750 + return GPIO_LINE_DIRECTION_OUT; 751 + 752 + return GPIO_LINE_DIRECTION_IN; 750 753 } 751 754 752 755 /* ··· 761 758 direction |= ((value >> offset) & 0x1) << i; 762 759 } 763 760 764 - return (direction == ST_GPIO_DIRECTION_IN); 761 + if (direction == ST_GPIO_DIRECTION_IN) 762 + return GPIO_LINE_DIRECTION_IN; 763 + 764 + return GPIO_LINE_DIRECTION_OUT; 765 765 } 766 766 767 767 /* Pinctrl Groups */ ··· 1002 996 unsigned int function; 1003 997 int offset = st_gpio_pin(pin_id); 1004 998 char f[16]; 999 + int oe; 1005 1000 1006 1001 mutex_unlock(&pctldev->mutex); 1007 1002 pc = st_get_pio_control(pctldev, pin_id); ··· 1015 1008 else 1016 1009 snprintf(f, 5, "GPIO"); 1017 1010 1011 + oe = st_gpio_get_direction(&pc_to_bank(pc)->gpio_chip, offset); 1018 1012 seq_printf(s, "[OE:%d,PU:%ld,OD:%ld]\t%s\n" 1019 1013 "\t\t[retime:%ld,invclk:%ld,clknotdat:%ld," 1020 1014 "de:%ld,rt-clk:%ld,rt-delay:%ld]", 1021 - !st_gpio_get_direction(&pc_to_bank(pc)->gpio_chip, offset), 1015 + (oe == GPIO_LINE_DIRECTION_OUT), 1022 1016 ST_PINCONF_UNPACK_PU(config), 1023 1017 ST_PINCONF_UNPACK_OD(config), 1024 1018 f,
+14 -3
drivers/pinctrl/pinctrl-stmfx.c
··· 134 134 ret = regmap_read(pctl->stmfx->map, reg, &val); 135 135 /* 136 136 * On stmfx, gpio pins direction is (0)input, (1)output. 137 - * .get_direction returns 0=out, 1=in 138 137 */ 138 + if (ret) 139 + return ret; 139 140 140 - return ret ? ret : !(val & mask); 141 + if (val & mask) 142 + return GPIO_LINE_DIRECTION_OUT; 143 + 144 + return GPIO_LINE_DIRECTION_IN; 141 145 } 142 146 143 147 static int stmfx_gpio_direction_input(struct gpio_chip *gc, unsigned int offset) ··· 227 223 dir = stmfx_gpio_get_direction(&pctl->gpio_chip, pin); 228 224 if (dir < 0) 229 225 return dir; 226 + 227 + /* 228 + * Currently the gpiolib IN is 1 and OUT is 0 but let's not count 229 + * on it just to be on the safe side also in the future :) 230 + */ 231 + dir = (dir == GPIO_LINE_DIRECTION_IN) ? 1 : 0; 232 + 230 233 type = stmfx_pinconf_get_type(pctl, pin); 231 234 if (type < 0) 232 235 return type; ··· 371 360 if (val < 0) 372 361 return; 373 362 374 - if (!dir) { 363 + if (dir == GPIO_LINE_DIRECTION_OUT) { 375 364 seq_printf(s, "output %s ", val ? "high" : "low"); 376 365 if (type) 377 366 seq_printf(s, "open drain %s internal pull-up ",
+6 -3
drivers/pinctrl/pinctrl-sx150x.c
··· 391 391 int ret; 392 392 393 393 if (sx150x_pin_is_oscio(pctl, offset)) 394 - return false; 394 + return GPIO_LINE_DIRECTION_OUT; 395 395 396 396 ret = regmap_read(pctl->regmap, pctl->data->reg_dir, &value); 397 397 if (ret < 0) 398 398 return ret; 399 399 400 - return !!(value & BIT(offset)); 400 + if (value & BIT(offset)) 401 + return GPIO_LINE_DIRECTION_IN; 402 + 403 + return GPIO_LINE_DIRECTION_OUT; 401 404 } 402 405 403 406 static int sx150x_gpio_get(struct gpio_chip *chip, unsigned int offset) ··· 690 687 if (ret < 0) 691 688 return ret; 692 689 693 - if (ret) 690 + if (ret == GPIO_LINE_DIRECTION_IN) 694 691 return -EINVAL; 695 692 696 693 ret = sx150x_gpio_get(&pctl->gpio, pin);
+10
drivers/pinctrl/qcom/Kconfig
··· 50 50 Qualcomm Technologies Inc. IPQ8074 platform. Select this for 51 51 IPQ8074. 52 52 53 + config PINCTRL_IPQ6018 54 + tristate "Qualcomm Technologies, Inc. IPQ6018 pin controller driver" 55 + depends on GPIOLIB && OF 56 + select PINCTRL_MSM 57 + help 58 + This is the pinctrl, pinmux, pinconf and gpiolib driver for 59 + the Qualcomm Technologies Inc. TLMM block found on the 60 + Qualcomm Technologies Inc. IPQ6018 platform. Select this for 61 + IPQ6018. 62 + 53 63 config PINCTRL_MSM8660 54 64 tristate "Qualcomm 8660 pin controller driver" 55 65 depends on GPIOLIB && OF
+1
drivers/pinctrl/qcom/Makefile
··· 6 6 obj-$(CONFIG_PINCTRL_IPQ4019) += pinctrl-ipq4019.o 7 7 obj-$(CONFIG_PINCTRL_IPQ8064) += pinctrl-ipq8064.o 8 8 obj-$(CONFIG_PINCTRL_IPQ8074) += pinctrl-ipq8074.o 9 + obj-$(CONFIG_PINCTRL_IPQ6018) += pinctrl-ipq6018.o 9 10 obj-$(CONFIG_PINCTRL_MSM8660) += pinctrl-msm8660.o 10 11 obj-$(CONFIG_PINCTRL_MSM8960) += pinctrl-msm8960.o 11 12 obj-$(CONFIG_PINCTRL_MSM8X74) += pinctrl-msm8x74.o
+1107
drivers/pinctrl/qcom/pinctrl-ipq6018.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * Copyright (c) 2016-2018, The Linux Foundation. All rights reserved. 4 + */ 5 + 6 + #include <linux/module.h> 7 + #include <linux/of.h> 8 + #include <linux/platform_device.h> 9 + #include <linux/pinctrl/pinctrl.h> 10 + 11 + #include "pinctrl-msm.h" 12 + 13 + #define FUNCTION(fname) \ 14 + [msm_mux_##fname] = { \ 15 + .name = #fname, \ 16 + .groups = fname##_groups, \ 17 + .ngroups = ARRAY_SIZE(fname##_groups), \ 18 + } 19 + 20 + #define REG_SIZE 0x1000 21 + #define PINGROUP(id, f1, f2, f3, f4, f5, f6, f7, f8, f9) \ 22 + { \ 23 + .name = "gpio" #id, \ 24 + .pins = gpio##id##_pins, \ 25 + .npins = (unsigned int)ARRAY_SIZE(gpio##id##_pins), \ 26 + .funcs = (int[]){ \ 27 + msm_mux_gpio, /* gpio mode */ \ 28 + msm_mux_##f1, \ 29 + msm_mux_##f2, \ 30 + msm_mux_##f3, \ 31 + msm_mux_##f4, \ 32 + msm_mux_##f5, \ 33 + msm_mux_##f6, \ 34 + msm_mux_##f7, \ 35 + msm_mux_##f8, \ 36 + msm_mux_##f9 \ 37 + }, \ 38 + .nfuncs = 10, \ 39 + .ctl_reg = REG_SIZE * id, \ 40 + .io_reg = 0x4 + REG_SIZE * id, \ 41 + .intr_cfg_reg = 0x8 + REG_SIZE * id, \ 42 + .intr_status_reg = 0xc + REG_SIZE * id, \ 43 + .intr_target_reg = 0x8 + REG_SIZE * id, \ 44 + .mux_bit = 2, \ 45 + .pull_bit = 0, \ 46 + .drv_bit = 6, \ 47 + .oe_bit = 9, \ 48 + .in_bit = 0, \ 49 + .out_bit = 1, \ 50 + .intr_enable_bit = 0, \ 51 + .intr_status_bit = 0, \ 52 + .intr_target_bit = 5, \ 53 + .intr_target_kpss_val = 3, \ 54 + .intr_raw_status_bit = 4, \ 55 + .intr_polarity_bit = 1, \ 56 + .intr_detection_bit = 2, \ 57 + .intr_detection_width = 2, \ 58 + } 59 + 60 + static const struct pinctrl_pin_desc ipq6018_pins[] = { 61 + PINCTRL_PIN(0, "GPIO_0"), 62 + PINCTRL_PIN(1, "GPIO_1"), 63 + PINCTRL_PIN(2, "GPIO_2"), 64 + PINCTRL_PIN(3, "GPIO_3"), 65 + PINCTRL_PIN(4, "GPIO_4"), 66 + PINCTRL_PIN(5, "GPIO_5"), 67 + PINCTRL_PIN(6, "GPIO_6"), 68 + PINCTRL_PIN(7, "GPIO_7"), 69 + PINCTRL_PIN(8, "GPIO_8"), 70 + PINCTRL_PIN(9, "GPIO_9"), 71 + PINCTRL_PIN(10, "GPIO_10"), 72 + PINCTRL_PIN(11, "GPIO_11"), 73 + PINCTRL_PIN(12, "GPIO_12"), 74 + PINCTRL_PIN(13, "GPIO_13"), 75 + PINCTRL_PIN(14, "GPIO_14"), 76 + PINCTRL_PIN(15, "GPIO_15"), 77 + PINCTRL_PIN(16, "GPIO_16"), 78 + PINCTRL_PIN(17, "GPIO_17"), 79 + PINCTRL_PIN(18, "GPIO_18"), 80 + PINCTRL_PIN(19, "GPIO_19"), 81 + PINCTRL_PIN(20, "GPIO_20"), 82 + PINCTRL_PIN(21, "GPIO_21"), 83 + PINCTRL_PIN(22, "GPIO_22"), 84 + PINCTRL_PIN(23, "GPIO_23"), 85 + PINCTRL_PIN(24, "GPIO_24"), 86 + PINCTRL_PIN(25, "GPIO_25"), 87 + PINCTRL_PIN(26, "GPIO_26"), 88 + PINCTRL_PIN(27, "GPIO_27"), 89 + PINCTRL_PIN(28, "GPIO_28"), 90 + PINCTRL_PIN(29, "GPIO_29"), 91 + PINCTRL_PIN(30, "GPIO_30"), 92 + PINCTRL_PIN(31, "GPIO_31"), 93 + PINCTRL_PIN(32, "GPIO_32"), 94 + PINCTRL_PIN(33, "GPIO_33"), 95 + PINCTRL_PIN(34, "GPIO_34"), 96 + PINCTRL_PIN(35, "GPIO_35"), 97 + PINCTRL_PIN(36, "GPIO_36"), 98 + PINCTRL_PIN(37, "GPIO_37"), 99 + PINCTRL_PIN(38, "GPIO_38"), 100 + PINCTRL_PIN(39, "GPIO_39"), 101 + PINCTRL_PIN(40, "GPIO_40"), 102 + PINCTRL_PIN(41, "GPIO_41"), 103 + PINCTRL_PIN(42, "GPIO_42"), 104 + PINCTRL_PIN(43, "GPIO_43"), 105 + PINCTRL_PIN(44, "GPIO_44"), 106 + PINCTRL_PIN(45, "GPIO_45"), 107 + PINCTRL_PIN(46, "GPIO_46"), 108 + PINCTRL_PIN(47, "GPIO_47"), 109 + PINCTRL_PIN(48, "GPIO_48"), 110 + PINCTRL_PIN(49, "GPIO_49"), 111 + PINCTRL_PIN(50, "GPIO_50"), 112 + PINCTRL_PIN(51, "GPIO_51"), 113 + PINCTRL_PIN(52, "GPIO_52"), 114 + PINCTRL_PIN(53, "GPIO_53"), 115 + PINCTRL_PIN(54, "GPIO_54"), 116 + PINCTRL_PIN(55, "GPIO_55"), 117 + PINCTRL_PIN(56, "GPIO_56"), 118 + PINCTRL_PIN(57, "GPIO_57"), 119 + PINCTRL_PIN(58, "GPIO_58"), 120 + PINCTRL_PIN(59, "GPIO_59"), 121 + PINCTRL_PIN(60, "GPIO_60"), 122 + PINCTRL_PIN(61, "GPIO_61"), 123 + PINCTRL_PIN(62, "GPIO_62"), 124 + PINCTRL_PIN(63, "GPIO_63"), 125 + PINCTRL_PIN(64, "GPIO_64"), 126 + PINCTRL_PIN(65, "GPIO_65"), 127 + PINCTRL_PIN(66, "GPIO_66"), 128 + PINCTRL_PIN(67, "GPIO_67"), 129 + PINCTRL_PIN(68, "GPIO_68"), 130 + PINCTRL_PIN(69, "GPIO_69"), 131 + PINCTRL_PIN(70, "GPIO_70"), 132 + PINCTRL_PIN(71, "GPIO_71"), 133 + PINCTRL_PIN(72, "GPIO_72"), 134 + PINCTRL_PIN(73, "GPIO_73"), 135 + PINCTRL_PIN(74, "GPIO_74"), 136 + PINCTRL_PIN(75, "GPIO_75"), 137 + PINCTRL_PIN(76, "GPIO_76"), 138 + PINCTRL_PIN(77, "GPIO_77"), 139 + PINCTRL_PIN(78, "GPIO_78"), 140 + PINCTRL_PIN(79, "GPIO_79"), 141 + }; 142 + 143 + #define DECLARE_MSM_GPIO_PINS(pin) \ 144 + static const unsigned int gpio##pin##_pins[] = { pin } 145 + DECLARE_MSM_GPIO_PINS(0); 146 + DECLARE_MSM_GPIO_PINS(1); 147 + DECLARE_MSM_GPIO_PINS(2); 148 + DECLARE_MSM_GPIO_PINS(3); 149 + DECLARE_MSM_GPIO_PINS(4); 150 + DECLARE_MSM_GPIO_PINS(5); 151 + DECLARE_MSM_GPIO_PINS(6); 152 + DECLARE_MSM_GPIO_PINS(7); 153 + DECLARE_MSM_GPIO_PINS(8); 154 + DECLARE_MSM_GPIO_PINS(9); 155 + DECLARE_MSM_GPIO_PINS(10); 156 + DECLARE_MSM_GPIO_PINS(11); 157 + DECLARE_MSM_GPIO_PINS(12); 158 + DECLARE_MSM_GPIO_PINS(13); 159 + DECLARE_MSM_GPIO_PINS(14); 160 + DECLARE_MSM_GPIO_PINS(15); 161 + DECLARE_MSM_GPIO_PINS(16); 162 + DECLARE_MSM_GPIO_PINS(17); 163 + DECLARE_MSM_GPIO_PINS(18); 164 + DECLARE_MSM_GPIO_PINS(19); 165 + DECLARE_MSM_GPIO_PINS(20); 166 + DECLARE_MSM_GPIO_PINS(21); 167 + DECLARE_MSM_GPIO_PINS(22); 168 + DECLARE_MSM_GPIO_PINS(23); 169 + DECLARE_MSM_GPIO_PINS(24); 170 + DECLARE_MSM_GPIO_PINS(25); 171 + DECLARE_MSM_GPIO_PINS(26); 172 + DECLARE_MSM_GPIO_PINS(27); 173 + DECLARE_MSM_GPIO_PINS(28); 174 + DECLARE_MSM_GPIO_PINS(29); 175 + DECLARE_MSM_GPIO_PINS(30); 176 + DECLARE_MSM_GPIO_PINS(31); 177 + DECLARE_MSM_GPIO_PINS(32); 178 + DECLARE_MSM_GPIO_PINS(33); 179 + DECLARE_MSM_GPIO_PINS(34); 180 + DECLARE_MSM_GPIO_PINS(35); 181 + DECLARE_MSM_GPIO_PINS(36); 182 + DECLARE_MSM_GPIO_PINS(37); 183 + DECLARE_MSM_GPIO_PINS(38); 184 + DECLARE_MSM_GPIO_PINS(39); 185 + DECLARE_MSM_GPIO_PINS(40); 186 + DECLARE_MSM_GPIO_PINS(41); 187 + DECLARE_MSM_GPIO_PINS(42); 188 + DECLARE_MSM_GPIO_PINS(43); 189 + DECLARE_MSM_GPIO_PINS(44); 190 + DECLARE_MSM_GPIO_PINS(45); 191 + DECLARE_MSM_GPIO_PINS(46); 192 + DECLARE_MSM_GPIO_PINS(47); 193 + DECLARE_MSM_GPIO_PINS(48); 194 + DECLARE_MSM_GPIO_PINS(49); 195 + DECLARE_MSM_GPIO_PINS(50); 196 + DECLARE_MSM_GPIO_PINS(51); 197 + DECLARE_MSM_GPIO_PINS(52); 198 + DECLARE_MSM_GPIO_PINS(53); 199 + DECLARE_MSM_GPIO_PINS(54); 200 + DECLARE_MSM_GPIO_PINS(55); 201 + DECLARE_MSM_GPIO_PINS(56); 202 + DECLARE_MSM_GPIO_PINS(57); 203 + DECLARE_MSM_GPIO_PINS(58); 204 + DECLARE_MSM_GPIO_PINS(59); 205 + DECLARE_MSM_GPIO_PINS(60); 206 + DECLARE_MSM_GPIO_PINS(61); 207 + DECLARE_MSM_GPIO_PINS(62); 208 + DECLARE_MSM_GPIO_PINS(63); 209 + DECLARE_MSM_GPIO_PINS(64); 210 + DECLARE_MSM_GPIO_PINS(65); 211 + DECLARE_MSM_GPIO_PINS(66); 212 + DECLARE_MSM_GPIO_PINS(67); 213 + DECLARE_MSM_GPIO_PINS(68); 214 + DECLARE_MSM_GPIO_PINS(69); 215 + DECLARE_MSM_GPIO_PINS(70); 216 + DECLARE_MSM_GPIO_PINS(71); 217 + DECLARE_MSM_GPIO_PINS(72); 218 + DECLARE_MSM_GPIO_PINS(73); 219 + DECLARE_MSM_GPIO_PINS(74); 220 + DECLARE_MSM_GPIO_PINS(75); 221 + DECLARE_MSM_GPIO_PINS(76); 222 + DECLARE_MSM_GPIO_PINS(77); 223 + DECLARE_MSM_GPIO_PINS(78); 224 + DECLARE_MSM_GPIO_PINS(79); 225 + 226 + enum ipq6018_functions { 227 + msm_mux_atest_char, 228 + msm_mux_atest_char0, 229 + msm_mux_atest_char1, 230 + msm_mux_atest_char2, 231 + msm_mux_atest_char3, 232 + msm_mux_audio0, 233 + msm_mux_audio1, 234 + msm_mux_audio2, 235 + msm_mux_audio3, 236 + msm_mux_audio_rxbclk, 237 + msm_mux_audio_rxfsync, 238 + msm_mux_audio_rxmclk, 239 + msm_mux_audio_rxmclkin, 240 + msm_mux_audio_txbclk, 241 + msm_mux_audio_txfsync, 242 + msm_mux_audio_txmclk, 243 + msm_mux_audio_txmclkin, 244 + msm_mux_blsp0_i2c, 245 + msm_mux_blsp0_spi, 246 + msm_mux_blsp0_uart, 247 + msm_mux_blsp1_i2c, 248 + msm_mux_blsp1_spi, 249 + msm_mux_blsp1_uart, 250 + msm_mux_blsp2_i2c, 251 + msm_mux_blsp2_spi, 252 + msm_mux_blsp2_uart, 253 + msm_mux_blsp3_i2c, 254 + msm_mux_blsp3_spi, 255 + msm_mux_blsp3_uart, 256 + msm_mux_blsp4_i2c, 257 + msm_mux_blsp4_spi, 258 + msm_mux_blsp4_uart, 259 + msm_mux_blsp5_i2c, 260 + msm_mux_blsp5_uart, 261 + msm_mux_burn0, 262 + msm_mux_burn1, 263 + msm_mux_cri_trng, 264 + msm_mux_cri_trng0, 265 + msm_mux_cri_trng1, 266 + msm_mux_cxc0, 267 + msm_mux_cxc1, 268 + msm_mux_dbg_out, 269 + msm_mux_gcc_plltest, 270 + msm_mux_gcc_tlmm, 271 + msm_mux_gpio, 272 + msm_mux_lpass_aud, 273 + msm_mux_lpass_aud0, 274 + msm_mux_lpass_aud1, 275 + msm_mux_lpass_aud2, 276 + msm_mux_lpass_pcm, 277 + msm_mux_lpass_pdm, 278 + msm_mux_mac00, 279 + msm_mux_mac01, 280 + msm_mux_mac10, 281 + msm_mux_mac11, 282 + msm_mux_mac12, 283 + msm_mux_mac13, 284 + msm_mux_mac20, 285 + msm_mux_mac21, 286 + msm_mux_mdc, 287 + msm_mux_mdio, 288 + msm_mux_pcie0_clk, 289 + msm_mux_pcie0_rst, 290 + msm_mux_pcie0_wake, 291 + msm_mux_prng_rosc, 292 + msm_mux_pta1_0, 293 + msm_mux_pta1_1, 294 + msm_mux_pta1_2, 295 + msm_mux_pta2_0, 296 + msm_mux_pta2_1, 297 + msm_mux_pta2_2, 298 + msm_mux_pwm00, 299 + msm_mux_pwm01, 300 + msm_mux_pwm02, 301 + msm_mux_pwm03, 302 + msm_mux_pwm04, 303 + msm_mux_pwm10, 304 + msm_mux_pwm11, 305 + msm_mux_pwm12, 306 + msm_mux_pwm13, 307 + msm_mux_pwm14, 308 + msm_mux_pwm20, 309 + msm_mux_pwm21, 310 + msm_mux_pwm22, 311 + msm_mux_pwm23, 312 + msm_mux_pwm24, 313 + msm_mux_pwm30, 314 + msm_mux_pwm31, 315 + msm_mux_pwm32, 316 + msm_mux_pwm33, 317 + msm_mux_qdss_cti_trig_in_a0, 318 + msm_mux_qdss_cti_trig_in_a1, 319 + msm_mux_qdss_cti_trig_out_a0, 320 + msm_mux_qdss_cti_trig_out_a1, 321 + msm_mux_qdss_cti_trig_in_b0, 322 + msm_mux_qdss_cti_trig_in_b1, 323 + msm_mux_qdss_cti_trig_out_b0, 324 + msm_mux_qdss_cti_trig_out_b1, 325 + msm_mux_qdss_traceclk_a, 326 + msm_mux_qdss_tracectl_a, 327 + msm_mux_qdss_tracedata_a, 328 + msm_mux_qdss_traceclk_b, 329 + msm_mux_qdss_tracectl_b, 330 + msm_mux_qdss_tracedata_b, 331 + msm_mux_qpic_pad, 332 + msm_mux_rx0, 333 + msm_mux_rx1, 334 + msm_mux_rx_swrm, 335 + msm_mux_rx_swrm0, 336 + msm_mux_rx_swrm1, 337 + msm_mux_sd_card, 338 + msm_mux_sd_write, 339 + msm_mux_tsens_max, 340 + msm_mux_tx_swrm, 341 + msm_mux_tx_swrm0, 342 + msm_mux_tx_swrm1, 343 + msm_mux_tx_swrm2, 344 + msm_mux_wci20, 345 + msm_mux_wci21, 346 + msm_mux_wci22, 347 + msm_mux_wci23, 348 + msm_mux_wsa_swrm, 349 + msm_mux__, 350 + }; 351 + 352 + static const char * const blsp3_uart_groups[] = { 353 + "gpio73", "gpio74", "gpio75", "gpio76", 354 + }; 355 + 356 + static const char * const blsp3_i2c_groups[] = { 357 + "gpio73", "gpio74", 358 + }; 359 + 360 + static const char * const blsp3_spi_groups[] = { 361 + "gpio73", "gpio74", "gpio75", "gpio76", "gpio77", "gpio78", "gpio79", 362 + }; 363 + 364 + static const char * const wci20_groups[] = { 365 + "gpio0", "gpio2", 366 + }; 367 + 368 + static const char * const qpic_pad_groups[] = { 369 + "gpio0", "gpio1", "gpio2", "gpio3", "gpio4", "gpio9", "gpio10", 370 + "gpio11", "gpio17", 371 + }; 372 + 373 + static const char * const burn0_groups[] = { 374 + "gpio0", 375 + }; 376 + 377 + static const char * const mac12_groups[] = { 378 + "gpio1", "gpio11", 379 + }; 380 + 381 + static const char * const qdss_tracectl_b_groups[] = { 382 + "gpio1", 383 + }; 384 + 385 + static const char * const burn1_groups[] = { 386 + "gpio1", 387 + }; 388 + 389 + static const char * const qdss_traceclk_b_groups[] = { 390 + "gpio0", 391 + }; 392 + 393 + static const char * const qdss_tracedata_b_groups[] = { 394 + "gpio2", "gpio3", "gpio4", "gpio5", "gpio6", "gpio7", "gpio8", "gpio9", 395 + "gpio10", "gpio11", "gpio12", "gpio13", "gpio14", "gpio15", "gpio16", 396 + "gpio17", 397 + }; 398 + 399 + static const char * const mac01_groups[] = { 400 + "gpio3", "gpio4", 401 + }; 402 + 403 + static const char * const mac21_groups[] = { 404 + "gpio5", "gpio6", 405 + }; 406 + 407 + static const char * const atest_char_groups[] = { 408 + "gpio9", 409 + }; 410 + 411 + static const char * const cxc0_groups[] = { 412 + "gpio9", "gpio16", 413 + }; 414 + 415 + static const char * const mac13_groups[] = { 416 + "gpio9", "gpio16", 417 + }; 418 + 419 + static const char * const dbg_out_groups[] = { 420 + "gpio9", 421 + }; 422 + 423 + static const char * const wci22_groups[] = { 424 + "gpio11", "gpio17", 425 + }; 426 + 427 + static const char * const pwm00_groups[] = { 428 + "gpio18", 429 + }; 430 + 431 + static const char * const atest_char0_groups[] = { 432 + "gpio18", 433 + }; 434 + 435 + static const char * const wci23_groups[] = { 436 + "gpio18", "gpio19", 437 + }; 438 + 439 + static const char * const mac11_groups[] = { 440 + "gpio18", "gpio19", 441 + }; 442 + 443 + static const char * const pwm10_groups[] = { 444 + "gpio19", 445 + }; 446 + 447 + static const char * const atest_char1_groups[] = { 448 + "gpio19", 449 + }; 450 + 451 + static const char * const pwm20_groups[] = { 452 + "gpio20", 453 + }; 454 + 455 + static const char * const atest_char2_groups[] = { 456 + "gpio20", 457 + }; 458 + 459 + static const char * const pwm30_groups[] = { 460 + "gpio21", 461 + }; 462 + 463 + static const char * const atest_char3_groups[] = { 464 + "gpio21", 465 + }; 466 + 467 + static const char * const audio_txmclk_groups[] = { 468 + "gpio22", 469 + }; 470 + 471 + static const char * const audio_txmclkin_groups[] = { 472 + "gpio22", 473 + }; 474 + 475 + static const char * const pwm02_groups[] = { 476 + "gpio22", 477 + }; 478 + 479 + static const char * const tx_swrm0_groups[] = { 480 + "gpio22", 481 + }; 482 + 483 + static const char * const qdss_cti_trig_out_b0_groups[] = { 484 + "gpio22", 485 + }; 486 + 487 + static const char * const audio_txbclk_groups[] = { 488 + "gpio23", 489 + }; 490 + 491 + static const char * const pwm12_groups[] = { 492 + "gpio23", 493 + }; 494 + 495 + static const char * const wsa_swrm_groups[] = { 496 + "gpio23", "gpio24", 497 + }; 498 + 499 + static const char * const tx_swrm1_groups[] = { 500 + "gpio23", 501 + }; 502 + 503 + static const char * const qdss_cti_trig_in_b0_groups[] = { 504 + "gpio23", 505 + }; 506 + 507 + static const char * const audio_txfsync_groups[] = { 508 + "gpio24", 509 + }; 510 + 511 + static const char * const pwm22_groups[] = { 512 + "gpio24", 513 + }; 514 + 515 + static const char * const tx_swrm2_groups[] = { 516 + "gpio24", 517 + }; 518 + 519 + static const char * const qdss_cti_trig_out_b1_groups[] = { 520 + "gpio24", 521 + }; 522 + 523 + static const char * const audio0_groups[] = { 524 + "gpio25", "gpio32", 525 + }; 526 + 527 + static const char * const pwm32_groups[] = { 528 + "gpio25", 529 + }; 530 + 531 + static const char * const tx_swrm_groups[] = { 532 + "gpio25", 533 + }; 534 + 535 + static const char * const qdss_cti_trig_in_b1_groups[] = { 536 + "gpio25", 537 + }; 538 + 539 + static const char * const audio1_groups[] = { 540 + "gpio26", "gpio33", 541 + }; 542 + 543 + static const char * const pwm04_groups[] = { 544 + "gpio26", 545 + }; 546 + 547 + static const char * const audio2_groups[] = { 548 + "gpio27", 549 + }; 550 + 551 + static const char * const pwm14_groups[] = { 552 + "gpio27", 553 + }; 554 + 555 + static const char * const audio3_groups[] = { 556 + "gpio28", 557 + }; 558 + 559 + static const char * const pwm24_groups[] = { 560 + "gpio28", 561 + }; 562 + 563 + static const char * const audio_rxmclk_groups[] = { 564 + "gpio29", 565 + }; 566 + 567 + static const char * const audio_rxmclkin_groups[] = { 568 + "gpio29", 569 + }; 570 + 571 + static const char * const pwm03_groups[] = { 572 + "gpio29", 573 + }; 574 + 575 + static const char * const lpass_pdm_groups[] = { 576 + "gpio29", "gpio30", "gpio31", "gpio32", 577 + }; 578 + 579 + static const char * const lpass_aud_groups[] = { 580 + "gpio29", 581 + }; 582 + 583 + static const char * const qdss_cti_trig_in_a1_groups[] = { 584 + "gpio29", 585 + }; 586 + 587 + static const char * const audio_rxbclk_groups[] = { 588 + "gpio30", 589 + }; 590 + 591 + static const char * const pwm13_groups[] = { 592 + "gpio30", 593 + }; 594 + 595 + static const char * const lpass_aud0_groups[] = { 596 + "gpio30", 597 + }; 598 + 599 + static const char * const rx_swrm_groups[] = { 600 + "gpio30", 601 + }; 602 + 603 + static const char * const qdss_cti_trig_out_a1_groups[] = { 604 + "gpio30", 605 + }; 606 + 607 + static const char * const audio_rxfsync_groups[] = { 608 + "gpio31", 609 + }; 610 + 611 + static const char * const pwm23_groups[] = { 612 + "gpio31", 613 + }; 614 + 615 + static const char * const lpass_aud1_groups[] = { 616 + "gpio31", 617 + }; 618 + 619 + static const char * const rx_swrm0_groups[] = { 620 + "gpio31", 621 + }; 622 + 623 + static const char * const qdss_cti_trig_in_a0_groups[] = { 624 + "gpio31", 625 + }; 626 + 627 + static const char * const pwm33_groups[] = { 628 + "gpio32", 629 + }; 630 + 631 + static const char * const lpass_aud2_groups[] = { 632 + "gpio32", 633 + }; 634 + 635 + static const char * const rx_swrm1_groups[] = { 636 + "gpio32", 637 + }; 638 + 639 + static const char * const qdss_cti_trig_out_a0_groups[] = { 640 + "gpio32", 641 + }; 642 + 643 + static const char * const lpass_pcm_groups[] = { 644 + "gpio34", "gpio35", "gpio36", "gpio37", 645 + }; 646 + 647 + static const char * const mac10_groups[] = { 648 + "gpio34", "gpio35", 649 + }; 650 + 651 + static const char * const mac00_groups[] = { 652 + "gpio34", "gpio35", 653 + }; 654 + 655 + static const char * const mac20_groups[] = { 656 + "gpio36", "gpio37", 657 + }; 658 + 659 + static const char * const blsp0_uart_groups[] = { 660 + "gpio38", "gpio39", "gpio40", "gpio41", 661 + }; 662 + 663 + static const char * const blsp0_i2c_groups[] = { 664 + "gpio38", "gpio39", 665 + }; 666 + 667 + static const char * const blsp0_spi_groups[] = { 668 + "gpio38", "gpio39", "gpio40", "gpio41", 669 + }; 670 + 671 + static const char * const blsp2_uart_groups[] = { 672 + "gpio42", "gpio43", "gpio44", "gpio45", 673 + }; 674 + 675 + static const char * const blsp2_i2c_groups[] = { 676 + "gpio42", "gpio43", 677 + }; 678 + 679 + static const char * const blsp2_spi_groups[] = { 680 + "gpio42", "gpio43", "gpio44", "gpio45", 681 + }; 682 + 683 + static const char * const blsp5_i2c_groups[] = { 684 + "gpio46", "gpio47", 685 + }; 686 + 687 + static const char * const blsp5_uart_groups[] = { 688 + "gpio48", "gpio49", 689 + }; 690 + 691 + static const char * const qdss_traceclk_a_groups[] = { 692 + "gpio48", 693 + }; 694 + 695 + static const char * const qdss_tracectl_a_groups[] = { 696 + "gpio49", 697 + }; 698 + 699 + static const char * const pwm01_groups[] = { 700 + "gpio50", 701 + }; 702 + 703 + static const char * const pta1_1_groups[] = { 704 + "gpio51", 705 + }; 706 + 707 + static const char * const pwm11_groups[] = { 708 + "gpio51", 709 + }; 710 + 711 + static const char * const rx1_groups[] = { 712 + "gpio51", 713 + }; 714 + 715 + static const char * const pta1_2_groups[] = { 716 + "gpio52", 717 + }; 718 + 719 + static const char * const pwm21_groups[] = { 720 + "gpio52", 721 + }; 722 + 723 + static const char * const pta1_0_groups[] = { 724 + "gpio53", 725 + }; 726 + 727 + static const char * const pwm31_groups[] = { 728 + "gpio53", 729 + }; 730 + 731 + static const char * const prng_rosc_groups[] = { 732 + "gpio53", 733 + }; 734 + 735 + static const char * const blsp4_uart_groups[] = { 736 + "gpio55", "gpio56", "gpio57", "gpio58", 737 + }; 738 + 739 + static const char * const blsp4_i2c_groups[] = { 740 + "gpio55", "gpio56", 741 + }; 742 + 743 + static const char * const blsp4_spi_groups[] = { 744 + "gpio55", "gpio56", "gpio57", "gpio58", 745 + }; 746 + 747 + static const char * const pcie0_clk_groups[] = { 748 + "gpio59", 749 + }; 750 + 751 + static const char * const cri_trng0_groups[] = { 752 + "gpio59", 753 + }; 754 + 755 + static const char * const pcie0_rst_groups[] = { 756 + "gpio60", 757 + }; 758 + 759 + static const char * const cri_trng1_groups[] = { 760 + "gpio60", 761 + }; 762 + 763 + static const char * const pcie0_wake_groups[] = { 764 + "gpio61", 765 + }; 766 + 767 + static const char * const cri_trng_groups[] = { 768 + "gpio61", 769 + }; 770 + 771 + static const char * const sd_card_groups[] = { 772 + "gpio62", 773 + }; 774 + 775 + static const char * const sd_write_groups[] = { 776 + "gpio63", 777 + }; 778 + 779 + static const char * const rx0_groups[] = { 780 + "gpio63", 781 + }; 782 + 783 + static const char * const tsens_max_groups[] = { 784 + "gpio63", 785 + }; 786 + 787 + static const char * const mdc_groups[] = { 788 + "gpio64", 789 + }; 790 + 791 + static const char * const qdss_tracedata_a_groups[] = { 792 + "gpio64", "gpio65", "gpio66", "gpio67", "gpio68", "gpio69", "gpio70", 793 + "gpio71", "gpio72", "gpio73", "gpio74", "gpio75", "gpio76", "gpio77", 794 + "gpio78", "gpio79", 795 + }; 796 + 797 + static const char * const mdio_groups[] = { 798 + "gpio65", 799 + }; 800 + 801 + static const char * const pta2_0_groups[] = { 802 + "gpio66", 803 + }; 804 + 805 + static const char * const wci21_groups[] = { 806 + "gpio66", "gpio68", 807 + }; 808 + 809 + static const char * const cxc1_groups[] = { 810 + "gpio66", "gpio68", 811 + }; 812 + 813 + static const char * const pta2_1_groups[] = { 814 + "gpio67", 815 + }; 816 + 817 + static const char * const pta2_2_groups[] = { 818 + "gpio68", 819 + }; 820 + 821 + static const char * const blsp1_uart_groups[] = { 822 + "gpio69", "gpio70", "gpio71", "gpio72", 823 + }; 824 + 825 + static const char * const blsp1_i2c_groups[] = { 826 + "gpio69", "gpio70", 827 + }; 828 + 829 + static const char * const blsp1_spi_groups[] = { 830 + "gpio69", "gpio70", "gpio71", "gpio72", 831 + }; 832 + 833 + static const char * const gcc_plltest_groups[] = { 834 + "gpio69", "gpio71", 835 + }; 836 + 837 + static const char * const gcc_tlmm_groups[] = { 838 + "gpio70", 839 + }; 840 + 841 + static const char * const gpio_groups[] = { 842 + "gpio0", "gpio1", "gpio2", "gpio3", "gpio4", "gpio5", "gpio6", "gpio7", 843 + "gpio8", "gpio9", "gpio10", "gpio11", "gpio12", "gpio13", "gpio14", 844 + "gpio15", "gpio16", "gpio17", "gpio18", "gpio19", "gpio20", "gpio21", 845 + "gpio22", "gpio23", "gpio24", "gpio25", "gpio26", "gpio27", "gpio28", 846 + "gpio29", "gpio30", "gpio31", "gpio32", "gpio33", "gpio34", "gpio35", 847 + "gpio36", "gpio37", "gpio38", "gpio39", "gpio40", "gpio41", "gpio42", 848 + "gpio43", "gpio44", "gpio45", "gpio46", "gpio47", "gpio48", "gpio49", 849 + "gpio50", "gpio51", "gpio52", "gpio53", "gpio54", "gpio55", "gpio56", 850 + "gpio57", "gpio58", "gpio59", "gpio60", "gpio61", "gpio62", "gpio63", 851 + "gpio64", "gpio65", "gpio66", "gpio67", "gpio68", "gpio69", "gpio70", 852 + "gpio71", "gpio72", "gpio73", "gpio74", "gpio75", "gpio76", "gpio77", 853 + "gpio78", "gpio79", 854 + }; 855 + 856 + static const struct msm_function ipq6018_functions[] = { 857 + FUNCTION(atest_char), 858 + FUNCTION(atest_char0), 859 + FUNCTION(atest_char1), 860 + FUNCTION(atest_char2), 861 + FUNCTION(atest_char3), 862 + FUNCTION(audio0), 863 + FUNCTION(audio1), 864 + FUNCTION(audio2), 865 + FUNCTION(audio3), 866 + FUNCTION(audio_rxbclk), 867 + FUNCTION(audio_rxfsync), 868 + FUNCTION(audio_rxmclk), 869 + FUNCTION(audio_rxmclkin), 870 + FUNCTION(audio_txbclk), 871 + FUNCTION(audio_txfsync), 872 + FUNCTION(audio_txmclk), 873 + FUNCTION(audio_txmclkin), 874 + FUNCTION(blsp0_i2c), 875 + FUNCTION(blsp0_spi), 876 + FUNCTION(blsp0_uart), 877 + FUNCTION(blsp1_i2c), 878 + FUNCTION(blsp1_spi), 879 + FUNCTION(blsp1_uart), 880 + FUNCTION(blsp2_i2c), 881 + FUNCTION(blsp2_spi), 882 + FUNCTION(blsp2_uart), 883 + FUNCTION(blsp3_i2c), 884 + FUNCTION(blsp3_spi), 885 + FUNCTION(blsp3_uart), 886 + FUNCTION(blsp4_i2c), 887 + FUNCTION(blsp4_spi), 888 + FUNCTION(blsp4_uart), 889 + FUNCTION(blsp5_i2c), 890 + FUNCTION(blsp5_uart), 891 + FUNCTION(burn0), 892 + FUNCTION(burn1), 893 + FUNCTION(cri_trng), 894 + FUNCTION(cri_trng0), 895 + FUNCTION(cri_trng1), 896 + FUNCTION(cxc0), 897 + FUNCTION(cxc1), 898 + FUNCTION(dbg_out), 899 + FUNCTION(gcc_plltest), 900 + FUNCTION(gcc_tlmm), 901 + FUNCTION(gpio), 902 + FUNCTION(lpass_aud), 903 + FUNCTION(lpass_aud0), 904 + FUNCTION(lpass_aud1), 905 + FUNCTION(lpass_aud2), 906 + FUNCTION(lpass_pcm), 907 + FUNCTION(lpass_pdm), 908 + FUNCTION(mac00), 909 + FUNCTION(mac01), 910 + FUNCTION(mac10), 911 + FUNCTION(mac11), 912 + FUNCTION(mac12), 913 + FUNCTION(mac13), 914 + FUNCTION(mac20), 915 + FUNCTION(mac21), 916 + FUNCTION(mdc), 917 + FUNCTION(mdio), 918 + FUNCTION(pcie0_clk), 919 + FUNCTION(pcie0_rst), 920 + FUNCTION(pcie0_wake), 921 + FUNCTION(prng_rosc), 922 + FUNCTION(pta1_0), 923 + FUNCTION(pta1_1), 924 + FUNCTION(pta1_2), 925 + FUNCTION(pta2_0), 926 + FUNCTION(pta2_1), 927 + FUNCTION(pta2_2), 928 + FUNCTION(pwm00), 929 + FUNCTION(pwm01), 930 + FUNCTION(pwm02), 931 + FUNCTION(pwm03), 932 + FUNCTION(pwm04), 933 + FUNCTION(pwm10), 934 + FUNCTION(pwm11), 935 + FUNCTION(pwm12), 936 + FUNCTION(pwm13), 937 + FUNCTION(pwm14), 938 + FUNCTION(pwm20), 939 + FUNCTION(pwm21), 940 + FUNCTION(pwm22), 941 + FUNCTION(pwm23), 942 + FUNCTION(pwm24), 943 + FUNCTION(pwm30), 944 + FUNCTION(pwm31), 945 + FUNCTION(pwm32), 946 + FUNCTION(pwm33), 947 + FUNCTION(qdss_cti_trig_in_a0), 948 + FUNCTION(qdss_cti_trig_in_a1), 949 + FUNCTION(qdss_cti_trig_out_a0), 950 + FUNCTION(qdss_cti_trig_out_a1), 951 + FUNCTION(qdss_cti_trig_in_b0), 952 + FUNCTION(qdss_cti_trig_in_b1), 953 + FUNCTION(qdss_cti_trig_out_b0), 954 + FUNCTION(qdss_cti_trig_out_b1), 955 + FUNCTION(qdss_traceclk_a), 956 + FUNCTION(qdss_tracectl_a), 957 + FUNCTION(qdss_tracedata_a), 958 + FUNCTION(qdss_traceclk_b), 959 + FUNCTION(qdss_tracectl_b), 960 + FUNCTION(qdss_tracedata_b), 961 + FUNCTION(qpic_pad), 962 + FUNCTION(rx0), 963 + FUNCTION(rx1), 964 + FUNCTION(rx_swrm), 965 + FUNCTION(rx_swrm0), 966 + FUNCTION(rx_swrm1), 967 + FUNCTION(sd_card), 968 + FUNCTION(sd_write), 969 + FUNCTION(tsens_max), 970 + FUNCTION(tx_swrm), 971 + FUNCTION(tx_swrm0), 972 + FUNCTION(tx_swrm1), 973 + FUNCTION(tx_swrm2), 974 + FUNCTION(wci20), 975 + FUNCTION(wci21), 976 + FUNCTION(wci22), 977 + FUNCTION(wci23), 978 + FUNCTION(wsa_swrm), 979 + }; 980 + 981 + static const struct msm_pingroup ipq6018_groups[] = { 982 + PINGROUP(0, qpic_pad, wci20, qdss_traceclk_b, _, burn0, _, _, _, _), 983 + PINGROUP(1, qpic_pad, mac12, qdss_tracectl_b, _, burn1, _, _, _, _), 984 + PINGROUP(2, qpic_pad, wci20, qdss_tracedata_b, _, _, _, _, _, _), 985 + PINGROUP(3, qpic_pad, mac01, qdss_tracedata_b, _, _, _, _, _, _), 986 + PINGROUP(4, qpic_pad, mac01, qdss_tracedata_b, _, _, _, _, _, _), 987 + PINGROUP(5, qpic_pad, mac21, qdss_tracedata_b, _, _, _, _, _, _), 988 + PINGROUP(6, qpic_pad, mac21, qdss_tracedata_b, _, _, _, _, _, _), 989 + PINGROUP(7, qpic_pad, qdss_tracedata_b, _, _, _, _, _, _, _), 990 + PINGROUP(8, qpic_pad, qdss_tracedata_b, _, _, _, _, _, _, _), 991 + PINGROUP(9, qpic_pad, atest_char, cxc0, mac13, dbg_out, qdss_tracedata_b, _, _, _), 992 + PINGROUP(10, qpic_pad, qdss_tracedata_b, _, _, _, _, _, _, _), 993 + PINGROUP(11, qpic_pad, wci22, mac12, qdss_tracedata_b, _, _, _, _, _), 994 + PINGROUP(12, qpic_pad, qdss_tracedata_b, _, _, _, _, _, _, _), 995 + PINGROUP(13, qpic_pad, qdss_tracedata_b, _, _, _, _, _, _, _), 996 + PINGROUP(14, qpic_pad, qdss_tracedata_b, _, _, _, _, _, _, _), 997 + PINGROUP(15, qpic_pad, qdss_tracedata_b, _, _, _, _, _, _, _), 998 + PINGROUP(16, qpic_pad, cxc0, mac13, qdss_tracedata_b, _, _, _, _, _), 999 + PINGROUP(17, qpic_pad, qdss_tracedata_b, wci22, _, _, _, _, _, _), 1000 + PINGROUP(18, pwm00, atest_char0, wci23, mac11, _, _, _, _, _), 1001 + PINGROUP(19, pwm10, atest_char1, wci23, mac11, _, _, _, _, _), 1002 + PINGROUP(20, pwm20, atest_char2, _, _, _, _, _, _, _), 1003 + PINGROUP(21, pwm30, atest_char3, _, _, _, _, _, _, _), 1004 + PINGROUP(22, audio_txmclk, audio_txmclkin, pwm02, tx_swrm0, _, qdss_cti_trig_out_b0, _, _, _), 1005 + PINGROUP(23, audio_txbclk, pwm12, wsa_swrm, tx_swrm1, _, qdss_cti_trig_in_b0, _, _, _), 1006 + PINGROUP(24, audio_txfsync, pwm22, wsa_swrm, tx_swrm2, _, qdss_cti_trig_out_b1, _, _, _), 1007 + PINGROUP(25, audio0, pwm32, tx_swrm, _, qdss_cti_trig_in_b1, _, _, _, _), 1008 + PINGROUP(26, audio1, pwm04, _, _, _, _, _, _, _), 1009 + PINGROUP(27, audio2, pwm14, _, _, _, _, _, _, _), 1010 + PINGROUP(28, audio3, pwm24, _, _, _, _, _, _, _), 1011 + PINGROUP(29, audio_rxmclk, audio_rxmclkin, pwm03, lpass_pdm, lpass_aud, qdss_cti_trig_in_a1, _, _, _), 1012 + PINGROUP(30, audio_rxbclk, pwm13, lpass_pdm, lpass_aud0, rx_swrm, _, qdss_cti_trig_out_a1, _, _), 1013 + PINGROUP(31, audio_rxfsync, pwm23, lpass_pdm, lpass_aud1, rx_swrm0, _, qdss_cti_trig_in_a0, _, _), 1014 + PINGROUP(32, audio0, pwm33, lpass_pdm, lpass_aud2, rx_swrm1, _, qdss_cti_trig_out_a0, _, _), 1015 + PINGROUP(33, audio1, _, _, _, _, _, _, _, _), 1016 + PINGROUP(34, lpass_pcm, mac10, mac00, _, _, _, _, _, _), 1017 + PINGROUP(35, lpass_pcm, mac10, mac00, _, _, _, _, _, _), 1018 + PINGROUP(36, lpass_pcm, mac20, _, _, _, _, _, _, _), 1019 + PINGROUP(37, lpass_pcm, mac20, _, _, _, _, _, _, _), 1020 + PINGROUP(38, blsp0_uart, blsp0_i2c, blsp0_spi, _, _, _, _, _, _), 1021 + PINGROUP(39, blsp0_uart, blsp0_i2c, blsp0_spi, _, _, _, _, _, _), 1022 + PINGROUP(40, blsp0_uart, blsp0_spi, _, _, _, _, _, _, _), 1023 + PINGROUP(41, blsp0_uart, blsp0_spi, _, _, _, _, _, _, _), 1024 + PINGROUP(42, blsp2_uart, blsp2_i2c, blsp2_spi, _, _, _, _, _, _), 1025 + PINGROUP(43, blsp2_uart, blsp2_i2c, blsp2_spi, _, _, _, _, _, _), 1026 + PINGROUP(44, blsp2_uart, blsp2_spi, _, _, _, _, _, _, _), 1027 + PINGROUP(45, blsp2_uart, blsp2_spi, _, _, _, _, _, _, _), 1028 + PINGROUP(46, blsp5_i2c, _, _, _, _, _, _, _, _), 1029 + PINGROUP(47, blsp5_i2c, _, _, _, _, _, _, _, _), 1030 + PINGROUP(48, blsp5_uart, _, qdss_traceclk_a, _, _, _, _, _, _), 1031 + PINGROUP(49, blsp5_uart, _, qdss_tracectl_a, _, _, _, _, _, _), 1032 + PINGROUP(50, pwm01, _, _, _, _, _, _, _, _), 1033 + PINGROUP(51, pta1_1, pwm11, _, rx1, _, _, _, _, _), 1034 + PINGROUP(52, pta1_2, pwm21, _, _, _, _, _, _, _), 1035 + PINGROUP(53, pta1_0, pwm31, prng_rosc, _, _, _, _, _, _), 1036 + PINGROUP(54, _, _, _, _, _, _, _, _, _), 1037 + PINGROUP(55, blsp4_uart, blsp4_i2c, blsp4_spi, _, _, _, _, _, _), 1038 + PINGROUP(56, blsp4_uart, blsp4_i2c, blsp4_spi, _, _, _, _, _, _), 1039 + PINGROUP(57, blsp4_uart, blsp4_spi, _, _, _, _, _, _, _), 1040 + PINGROUP(58, blsp4_uart, blsp4_spi, _, _, _, _, _, _, _), 1041 + PINGROUP(59, pcie0_clk, _, _, cri_trng0, _, _, _, _, _), 1042 + PINGROUP(60, pcie0_rst, _, _, cri_trng1, _, _, _, _, _), 1043 + PINGROUP(61, pcie0_wake, _, _, cri_trng, _, _, _, _, _), 1044 + PINGROUP(62, sd_card, _, _, _, _, _, _, _, _), 1045 + PINGROUP(63, sd_write, rx0, _, tsens_max, _, _, _, _, _), 1046 + PINGROUP(64, mdc, _, qdss_tracedata_a, _, _, _, _, _, _), 1047 + PINGROUP(65, mdio, _, qdss_tracedata_a, _, _, _, _, _, _), 1048 + PINGROUP(66, pta2_0, wci21, cxc1, qdss_tracedata_a, _, _, _, _, _), 1049 + PINGROUP(67, pta2_1, qdss_tracedata_a, _, _, _, _, _, _, _), 1050 + PINGROUP(68, pta2_2, wci21, cxc1, qdss_tracedata_a, _, _, _, _, _), 1051 + PINGROUP(69, blsp1_uart, blsp1_i2c, blsp1_spi, gcc_plltest, qdss_tracedata_a, _, _, _, _), 1052 + PINGROUP(70, blsp1_uart, blsp1_i2c, blsp1_spi, gcc_tlmm, qdss_tracedata_a, _, _, _, _), 1053 + PINGROUP(71, blsp1_uart, blsp1_spi, gcc_plltest, qdss_tracedata_a, _, _, _, _, _), 1054 + PINGROUP(72, blsp1_uart, blsp1_spi, qdss_tracedata_a, _, _, _, _, _, _), 1055 + PINGROUP(73, blsp3_uart, blsp3_i2c, blsp3_spi, _, qdss_tracedata_a, _, _, _, _), 1056 + PINGROUP(74, blsp3_uart, blsp3_i2c, blsp3_spi, _, qdss_tracedata_a, _, _, _, _), 1057 + PINGROUP(75, blsp3_uart, blsp3_spi, _, qdss_tracedata_a, _, _, _, _, _), 1058 + PINGROUP(76, blsp3_uart, blsp3_spi, _, qdss_tracedata_a, _, _, _, _, _), 1059 + PINGROUP(77, blsp3_spi, _, qdss_tracedata_a, _, _, _, _, _, _), 1060 + PINGROUP(78, blsp3_spi, _, qdss_tracedata_a, _, _, _, _, _, _), 1061 + PINGROUP(79, blsp3_spi, _, qdss_tracedata_a, _, _, _, _, _, _), 1062 + }; 1063 + 1064 + static const struct msm_pinctrl_soc_data ipq6018_pinctrl = { 1065 + .pins = ipq6018_pins, 1066 + .npins = ARRAY_SIZE(ipq6018_pins), 1067 + .functions = ipq6018_functions, 1068 + .nfunctions = ARRAY_SIZE(ipq6018_functions), 1069 + .groups = ipq6018_groups, 1070 + .ngroups = ARRAY_SIZE(ipq6018_groups), 1071 + .ngpios = 80, 1072 + }; 1073 + 1074 + static int ipq6018_pinctrl_probe(struct platform_device *pdev) 1075 + { 1076 + return msm_pinctrl_probe(pdev, &ipq6018_pinctrl); 1077 + } 1078 + 1079 + static const struct of_device_id ipq6018_pinctrl_of_match[] = { 1080 + { .compatible = "qcom,ipq6018-pinctrl", }, 1081 + { }, 1082 + }; 1083 + 1084 + static struct platform_driver ipq6018_pinctrl_driver = { 1085 + .driver = { 1086 + .name = "ipq6018-pinctrl", 1087 + .of_match_table = ipq6018_pinctrl_of_match, 1088 + }, 1089 + .probe = ipq6018_pinctrl_probe, 1090 + .remove = msm_pinctrl_remove, 1091 + }; 1092 + 1093 + static int __init ipq6018_pinctrl_init(void) 1094 + { 1095 + return platform_driver_register(&ipq6018_pinctrl_driver); 1096 + } 1097 + arch_initcall(ipq6018_pinctrl_init); 1098 + 1099 + static void __exit ipq6018_pinctrl_exit(void) 1100 + { 1101 + platform_driver_unregister(&ipq6018_pinctrl_driver); 1102 + } 1103 + module_exit(ipq6018_pinctrl_exit); 1104 + 1105 + MODULE_DESCRIPTION("QTI ipq6018 pinctrl driver"); 1106 + MODULE_LICENSE("GPL v2"); 1107 + MODULE_DEVICE_TABLE(of, ipq6018_pinctrl_of_match);
+5 -5
drivers/pinctrl/qcom/pinctrl-ipq8064.c
··· 299 299 }; 300 300 301 301 static const char * const mdio_groups[] = { 302 - "gpio0", "gpio1", "gpio10", "gpio11", 302 + "gpio0", "gpio1", "gpio2", "gpio10", "gpio11", "gpio66", 303 303 }; 304 304 305 305 static const char * const mi2s_groups[] = { ··· 403 403 }; 404 404 405 405 static const char * const rgmii2_groups[] = { 406 - "gpio27", "gpio28", "gpio29", "gpio30", "gpio31", "gpio32", 407 - "gpio51", "gpio52", "gpio59", "gpio60", "gpio61", "gpio62", 406 + "gpio2", "gpio27", "gpio28", "gpio29", "gpio30", "gpio31", "gpio32", 407 + "gpio51", "gpio52", "gpio59", "gpio60", "gpio61", "gpio62", "gpio66", 408 408 }; 409 409 410 410 static const char * const sata_groups[] = { ··· 539 539 static const struct msm_pingroup ipq8064_groups[] = { 540 540 PINGROUP(0, mdio, NA, NA, NA, NA, NA, NA, NA, NA, NA), 541 541 PINGROUP(1, mdio, NA, NA, NA, NA, NA, NA, NA, NA, NA), 542 - PINGROUP(2, gsbi5_spi_cs3, NA, NA, NA, NA, NA, NA, NA, NA, NA), 542 + PINGROUP(2, gsbi5_spi_cs3, rgmii2, mdio, NA, NA, NA, NA, NA, NA, NA), 543 543 PINGROUP(3, pcie1_rst, pcie1_prsnt, pdm, NA, NA, NA, NA, NA, NA, NA), 544 544 PINGROUP(4, pcie1_pwren_n, pcie1_pwren, NA, NA, NA, NA, NA, NA, NA, NA), 545 545 PINGROUP(5, pcie1_clk_req, pcie1_pwrflt, NA, NA, NA, NA, NA, NA, NA, NA), ··· 603 603 PINGROUP(63, pcie3_rst, NA, NA, NA, NA, NA, NA, NA, NA, NA), 604 604 PINGROUP(64, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 605 605 PINGROUP(65, pcie3_clk_req, NA, NA, NA, NA, NA, NA, NA, NA, NA), 606 - PINGROUP(66, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), 606 + PINGROUP(66, rgmii2, mdio, NA, NA, NA, NA, NA, NA, NA, NA), 607 607 PINGROUP(67, usb2_hsic, NA, NA, NA, NA, NA, NA, NA, NA, NA), 608 608 PINGROUP(68, usb2_hsic, NA, NA, NA, NA, NA, NA, NA, NA, NA), 609 609 SDC_PINGROUP(sdc3_clk, 0x204a, 14, 6),
+38 -8
drivers/pinctrl/qcom/pinctrl-msm.c
··· 22 22 #include <linux/reboot.h> 23 23 #include <linux/pm.h> 24 24 #include <linux/log2.h> 25 + #include <linux/qcom_scm.h> 26 + #include <linux/io.h> 25 27 26 28 #include <linux/soc/qcom/irq.h> 27 29 ··· 62 60 struct irq_chip irq_chip; 63 61 int irq; 64 62 63 + bool intr_target_use_scm; 64 + 65 65 raw_spinlock_t lock; 66 66 67 67 DECLARE_BITMAP(dual_edge_irqs, MAX_NR_GPIO); ··· 72 68 73 69 const struct msm_pinctrl_soc_data *soc; 74 70 void __iomem *regs[MAX_NR_TILES]; 71 + u32 phys_base[MAX_NR_TILES]; 75 72 }; 76 73 77 74 #define MSM_ACCESSOR(name) \ ··· 494 489 495 490 val = msm_readl_ctl(pctrl, g); 496 491 497 - /* 0 = output, 1 = input */ 498 - return val & BIT(g->oe_bit) ? 0 : 1; 492 + return val & BIT(g->oe_bit) ? GPIO_LINE_DIRECTION_OUT : 493 + GPIO_LINE_DIRECTION_IN; 499 494 } 500 495 501 496 static int msm_gpio_get(struct gpio_chip *chip, unsigned offset) ··· 887 882 else 888 883 clear_bit(d->hwirq, pctrl->dual_edge_irqs); 889 884 890 - /* Route interrupts to application cpu */ 891 - val = msm_readl_intr_target(pctrl, g); 892 - val &= ~(7 << g->intr_target_bit); 893 - val |= g->intr_target_kpss_val << g->intr_target_bit; 894 - msm_writel_intr_target(val, pctrl, g); 885 + /* Route interrupts to application cpu. 886 + * With intr_target_use_scm interrupts are routed to 887 + * application cpu using scm calls. 888 + */ 889 + if (pctrl->intr_target_use_scm) { 890 + u32 addr = pctrl->phys_base[0] + g->intr_target_reg; 891 + int ret; 892 + 893 + qcom_scm_io_readl(addr, &val); 894 + 895 + val &= ~(7 << g->intr_target_bit); 896 + val |= g->intr_target_kpss_val << g->intr_target_bit; 897 + 898 + ret = qcom_scm_io_writel(addr, val); 899 + if (ret) 900 + dev_err(pctrl->dev, 901 + "Failed routing %lu interrupt to Apps proc", 902 + d->hwirq); 903 + } else { 904 + val = msm_readl_intr_target(pctrl, g); 905 + val &= ~(7 << g->intr_target_bit); 906 + val |= g->intr_target_kpss_val << g->intr_target_bit; 907 + msm_writel_intr_target(val, pctrl, g); 908 + } 895 909 896 910 /* Update configuration for gpio. 897 911 * RAW_STATUS_EN is left on for all gpio irqs. Due to the ··· 1264 1240 pctrl->dev = &pdev->dev; 1265 1241 pctrl->soc = soc_data; 1266 1242 pctrl->chip = msm_gpio_template; 1243 + pctrl->intr_target_use_scm = of_device_is_compatible( 1244 + pctrl->dev->of_node, 1245 + "qcom,ipq8064-pinctrl"); 1267 1246 1268 1247 raw_spin_lock_init(&pctrl->lock); 1269 1248 ··· 1279 1252 return PTR_ERR(pctrl->regs[i]); 1280 1253 } 1281 1254 } else { 1282 - pctrl->regs[0] = devm_platform_ioremap_resource(pdev, 0); 1255 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1256 + pctrl->regs[0] = devm_ioremap_resource(&pdev->dev, res); 1283 1257 if (IS_ERR(pctrl->regs[0])) 1284 1258 return PTR_ERR(pctrl->regs[0]); 1259 + 1260 + pctrl->phys_base[0] = res->start; 1285 1261 } 1286 1262 1287 1263 msm_pinctrl_setup_pm_reset(pctrl);
+2 -2
drivers/pinctrl/sh-pfc/Kconfig
··· 26 26 select PINCTRL_PFC_R8A7792 if ARCH_R8A7792 27 27 select PINCTRL_PFC_R8A7793 if ARCH_R8A7793 28 28 select PINCTRL_PFC_R8A7794 if ARCH_R8A7794 29 - select PINCTRL_PFC_R8A77950 if ARCH_R8A77950 || ARCH_R8A7795 30 - select PINCTRL_PFC_R8A77951 if ARCH_R8A77951 || ARCH_R8A7795 29 + select PINCTRL_PFC_R8A77950 if ARCH_R8A77950 30 + select PINCTRL_PFC_R8A77951 if ARCH_R8A77951 31 31 select PINCTRL_PFC_R8A77960 if ARCH_R8A77960 32 32 select PINCTRL_PFC_R8A77961 if ARCH_R8A77961 33 33 select PINCTRL_PFC_R8A77965 if ARCH_R8A77965
+245 -62
drivers/pinctrl/sh-pfc/core.c
··· 726 726 #endif /* CONFIG_PM_SLEEP && CONFIG_ARM_PSCI_FW */ 727 727 728 728 #ifdef DEBUG 729 + #define SH_PFC_MAX_REGS 300 730 + #define SH_PFC_MAX_ENUMS 3000 731 + 732 + static unsigned int sh_pfc_errors __initdata = 0; 733 + static unsigned int sh_pfc_warnings __initdata = 0; 734 + static u32 *sh_pfc_regs __initdata = NULL; 735 + static u32 sh_pfc_num_regs __initdata = 0; 736 + static u16 *sh_pfc_enums __initdata = NULL; 737 + static u32 sh_pfc_num_enums __initdata = 0; 738 + 739 + #define sh_pfc_err(fmt, ...) \ 740 + do { \ 741 + pr_err("%s: " fmt, drvname, ##__VA_ARGS__); \ 742 + sh_pfc_errors++; \ 743 + } while (0) 744 + #define sh_pfc_warn(fmt, ...) \ 745 + do { \ 746 + pr_warn("%s: " fmt, drvname, ##__VA_ARGS__); \ 747 + sh_pfc_warnings++; \ 748 + } while (0) 749 + 729 750 static bool __init is0s(const u16 *enum_ids, unsigned int n) 730 751 { 731 752 unsigned int i; ··· 758 737 return true; 759 738 } 760 739 761 - static unsigned int sh_pfc_errors __initdata = 0; 762 - static unsigned int sh_pfc_warnings __initdata = 0; 740 + static bool __init same_name(const char *a, const char *b) 741 + { 742 + if (!a || !b) 743 + return false; 744 + 745 + return !strcmp(a, b); 746 + } 747 + 748 + static void __init sh_pfc_check_reg(const char *drvname, u32 reg) 749 + { 750 + unsigned int i; 751 + 752 + for (i = 0; i < sh_pfc_num_regs; i++) 753 + if (reg == sh_pfc_regs[i]) { 754 + sh_pfc_err("reg 0x%x conflict\n", reg); 755 + return; 756 + } 757 + 758 + if (sh_pfc_num_regs == SH_PFC_MAX_REGS) { 759 + pr_warn_once("%s: Please increase SH_PFC_MAX_REGS\n", drvname); 760 + return; 761 + } 762 + 763 + sh_pfc_regs[sh_pfc_num_regs++] = reg; 764 + } 765 + 766 + static int __init sh_pfc_check_enum(const char *drvname, u16 enum_id) 767 + { 768 + unsigned int i; 769 + 770 + for (i = 0; i < sh_pfc_num_enums; i++) { 771 + if (enum_id == sh_pfc_enums[i]) 772 + return -EINVAL; 773 + } 774 + 775 + if (sh_pfc_num_enums == SH_PFC_MAX_ENUMS) { 776 + pr_warn_once("%s: Please increase SH_PFC_MAX_ENUMS\n", drvname); 777 + return 0; 778 + } 779 + 780 + sh_pfc_enums[sh_pfc_num_enums++] = enum_id; 781 + return 0; 782 + } 783 + 784 + static void __init sh_pfc_check_reg_enums(const char *drvname, u32 reg, 785 + const u16 *enums, unsigned int n) 786 + { 787 + unsigned int i; 788 + 789 + for (i = 0; i < n; i++) { 790 + if (enums[i] && sh_pfc_check_enum(drvname, enums[i])) 791 + sh_pfc_err("reg 0x%x enum_id %u conflict\n", reg, 792 + enums[i]); 793 + } 794 + } 795 + 796 + static void __init sh_pfc_check_pin(const struct sh_pfc_soc_info *info, 797 + u32 reg, unsigned int pin) 798 + { 799 + const char *drvname = info->name; 800 + unsigned int i; 801 + 802 + if (pin == SH_PFC_PIN_NONE) 803 + return; 804 + 805 + for (i = 0; i < info->nr_pins; i++) { 806 + if (pin == info->pins[i].pin) 807 + return; 808 + } 809 + 810 + sh_pfc_err("reg 0x%x: pin %u not found\n", reg, pin); 811 + } 763 812 764 813 static void __init sh_pfc_check_cfg_reg(const char *drvname, 765 814 const struct pinmux_cfg_reg *cfg_reg) 766 815 { 767 816 unsigned int i, n, rw, fw; 768 817 818 + sh_pfc_check_reg(drvname, cfg_reg->reg); 819 + 769 820 if (cfg_reg->field_width) { 770 - /* Checked at build time */ 771 - return; 821 + n = cfg_reg->reg_width / cfg_reg->field_width; 822 + /* Skip field checks (done at build time) */ 823 + goto check_enum_ids; 772 824 } 773 825 774 826 for (i = 0, n = 0, rw = 0; (fw = cfg_reg->var_field_width[i]); i++) { 775 - if (fw > 3 && is0s(&cfg_reg->enum_ids[n], 1 << fw)) { 776 - pr_warn("%s: reg 0x%x: reserved field [%u:%u] can be split to reduce table size\n", 777 - drvname, cfg_reg->reg, rw, rw + fw - 1); 778 - sh_pfc_warnings++; 779 - } 827 + if (fw > 3 && is0s(&cfg_reg->enum_ids[n], 1 << fw)) 828 + sh_pfc_warn("reg 0x%x: reserved field [%u:%u] can be split to reduce table size\n", 829 + cfg_reg->reg, rw, rw + fw - 1); 780 830 n += 1 << fw; 781 831 rw += fw; 782 832 } 783 833 784 - if (rw != cfg_reg->reg_width) { 785 - pr_err("%s: reg 0x%x: var_field_width declares %u instead of %u bits\n", 786 - drvname, cfg_reg->reg, rw, cfg_reg->reg_width); 787 - sh_pfc_errors++; 788 - } 834 + if (rw != cfg_reg->reg_width) 835 + sh_pfc_err("reg 0x%x: var_field_width declares %u instead of %u bits\n", 836 + cfg_reg->reg, rw, cfg_reg->reg_width); 789 837 790 - if (n != cfg_reg->nr_enum_ids) { 791 - pr_err("%s: reg 0x%x: enum_ids[] has %u instead of %u values\n", 792 - drvname, cfg_reg->reg, cfg_reg->nr_enum_ids, n); 793 - sh_pfc_errors++; 838 + if (n != cfg_reg->nr_enum_ids) 839 + sh_pfc_err("reg 0x%x: enum_ids[] has %u instead of %u values\n", 840 + cfg_reg->reg, cfg_reg->nr_enum_ids, n); 841 + 842 + check_enum_ids: 843 + sh_pfc_check_reg_enums(drvname, cfg_reg->reg, cfg_reg->enum_ids, n); 844 + } 845 + 846 + static void __init sh_pfc_check_drive_reg(const struct sh_pfc_soc_info *info, 847 + const struct pinmux_drive_reg *drive) 848 + { 849 + const char *drvname = info->name; 850 + unsigned long seen = 0, mask; 851 + unsigned int i; 852 + 853 + sh_pfc_check_reg(info->name, drive->reg); 854 + for (i = 0; i < ARRAY_SIZE(drive->fields); i++) { 855 + const struct pinmux_drive_reg_field *field = &drive->fields[i]; 856 + 857 + if (!field->pin && !field->offset && !field->size) 858 + continue; 859 + 860 + mask = GENMASK(field->offset + field->size, field->offset); 861 + if (mask & seen) 862 + sh_pfc_err("drive_reg 0x%x: field %u overlap\n", 863 + drive->reg, i); 864 + seen |= mask; 865 + 866 + sh_pfc_check_pin(info, drive->reg, field->pin); 794 867 } 868 + } 869 + 870 + static void __init sh_pfc_check_bias_reg(const struct sh_pfc_soc_info *info, 871 + const struct pinmux_bias_reg *bias) 872 + { 873 + unsigned int i; 874 + 875 + sh_pfc_check_reg(info->name, bias->puen); 876 + if (bias->pud) 877 + sh_pfc_check_reg(info->name, bias->pud); 878 + for (i = 0; i < ARRAY_SIZE(bias->pins); i++) 879 + sh_pfc_check_pin(info, bias->puen, bias->pins[i]); 795 880 } 796 881 797 882 static void __init sh_pfc_check_info(const struct sh_pfc_soc_info *info) 798 883 { 799 - const struct sh_pfc_function *func; 800 884 const char *drvname = info->name; 801 885 unsigned int *refcnts; 802 886 unsigned int i, j, k; 803 887 804 888 pr_info("Checking %s\n", drvname); 889 + sh_pfc_num_regs = 0; 890 + sh_pfc_num_enums = 0; 805 891 806 892 /* Check pins */ 807 893 for (i = 0; i < info->nr_pins; i++) { 894 + const struct sh_pfc_pin *pin = &info->pins[i]; 895 + 896 + if (!pin->name) { 897 + sh_pfc_err("empty pin %u\n", i); 898 + continue; 899 + } 808 900 for (j = 0; j < i; j++) { 809 - if (!strcmp(info->pins[i].name, info->pins[j].name)) { 810 - pr_err("%s: pin %s/%s: name conflict\n", 811 - drvname, info->pins[i].name, 812 - info->pins[j].name); 813 - sh_pfc_errors++; 814 - } 901 + const struct sh_pfc_pin *pin2 = &info->pins[j]; 815 902 816 - if (info->pins[i].pin != (u16)-1 && 817 - info->pins[i].pin == info->pins[j].pin) { 818 - pr_err("%s: pin %s/%s: pin %u conflict\n", 819 - drvname, info->pins[i].name, 820 - info->pins[j].name, info->pins[i].pin); 821 - sh_pfc_errors++; 822 - } 903 + if (same_name(pin->name, pin2->name)) 904 + sh_pfc_err("pin %s: name conflict\n", 905 + pin->name); 823 906 824 - if (info->pins[i].enum_id && 825 - info->pins[i].enum_id == info->pins[j].enum_id) { 826 - pr_err("%s: pin %s/%s: enum_id %u conflict\n", 827 - drvname, info->pins[i].name, 828 - info->pins[j].name, 829 - info->pins[i].enum_id); 830 - sh_pfc_errors++; 831 - } 907 + if (pin->pin != (u16)-1 && pin->pin == pin2->pin) 908 + sh_pfc_err("pin %s/%s: pin %u conflict\n", 909 + pin->name, pin2->name, pin->pin); 910 + 911 + if (pin->enum_id && pin->enum_id == pin2->enum_id) 912 + sh_pfc_err("pin %s/%s: enum_id %u conflict\n", 913 + pin->name, pin2->name, 914 + pin->enum_id); 832 915 } 833 916 } 834 917 ··· 942 817 return; 943 818 944 819 for (i = 0; i < info->nr_functions; i++) { 945 - func = &info->functions[i]; 820 + const struct sh_pfc_function *func = &info->functions[i]; 821 + 946 822 if (!func->name) { 947 - pr_err("%s: empty function %u\n", drvname, i); 948 - sh_pfc_errors++; 823 + sh_pfc_err("empty function %u\n", i); 949 824 continue; 825 + } 826 + for (j = 0; j < i; j++) { 827 + if (same_name(func->name, info->functions[j].name)) 828 + sh_pfc_err("function %s: name conflict\n", 829 + func->name); 950 830 } 951 831 for (j = 0; j < func->nr_groups; j++) { 952 832 for (k = 0; k < info->nr_groups; k++) { 953 - if (info->groups[k].name && 954 - !strcmp(func->groups[j], 955 - info->groups[k].name)) { 833 + if (same_name(func->groups[j], 834 + info->groups[k].name)) { 956 835 refcnts[k]++; 957 836 break; 958 837 } 959 838 } 960 839 961 - if (k == info->nr_groups) { 962 - pr_err("%s: function %s: group %s not found\n", 963 - drvname, func->name, func->groups[j]); 964 - sh_pfc_errors++; 965 - } 840 + if (k == info->nr_groups) 841 + sh_pfc_err("function %s: group %s not found\n", 842 + func->name, func->groups[j]); 966 843 } 967 844 } 968 845 969 846 for (i = 0; i < info->nr_groups; i++) { 970 - if (!info->groups[i].name) { 971 - pr_err("%s: empty group %u\n", drvname, i); 972 - sh_pfc_errors++; 847 + const struct sh_pfc_pin_group *group = &info->groups[i]; 848 + 849 + if (!group->name) { 850 + sh_pfc_err("empty group %u\n", i); 973 851 continue; 974 852 } 975 - if (!refcnts[i]) { 976 - pr_err("%s: orphan group %s\n", drvname, 977 - info->groups[i].name); 978 - sh_pfc_errors++; 979 - } else if (refcnts[i] > 1) { 980 - pr_warn("%s: group %s referenced by %u functions\n", 981 - drvname, info->groups[i].name, refcnts[i]); 982 - sh_pfc_warnings++; 853 + for (j = 0; j < i; j++) { 854 + if (same_name(group->name, info->groups[j].name)) 855 + sh_pfc_err("group %s: name conflict\n", 856 + group->name); 983 857 } 858 + if (!refcnts[i]) 859 + sh_pfc_err("orphan group %s\n", group->name); 860 + else if (refcnts[i] > 1) 861 + sh_pfc_warn("group %s referenced by %u functions\n", 862 + group->name, refcnts[i]); 984 863 } 985 864 986 865 kfree(refcnts); ··· 992 863 /* Check config register descriptions */ 993 864 for (i = 0; info->cfg_regs && info->cfg_regs[i].reg; i++) 994 865 sh_pfc_check_cfg_reg(drvname, &info->cfg_regs[i]); 866 + 867 + /* Check drive strength registers */ 868 + for (i = 0; info->drive_regs && info->drive_regs[i].reg; i++) 869 + sh_pfc_check_drive_reg(info, &info->drive_regs[i]); 870 + 871 + /* Check bias registers */ 872 + for (i = 0; info->bias_regs && info->bias_regs[i].puen; i++) 873 + sh_pfc_check_bias_reg(info, &info->bias_regs[i]); 874 + 875 + /* Check ioctrl registers */ 876 + for (i = 0; info->ioctrl_regs && info->ioctrl_regs[i].reg; i++) 877 + sh_pfc_check_reg(drvname, info->ioctrl_regs[i].reg); 878 + 879 + /* Check data registers */ 880 + for (i = 0; info->data_regs && info->data_regs[i].reg; i++) { 881 + sh_pfc_check_reg(drvname, info->data_regs[i].reg); 882 + sh_pfc_check_reg_enums(drvname, info->data_regs[i].reg, 883 + info->data_regs[i].enum_ids, 884 + info->data_regs[i].reg_width); 885 + } 886 + 887 + #ifdef CONFIG_PINCTRL_SH_FUNC_GPIO 888 + /* Check function GPIOs */ 889 + for (i = 0; i < info->nr_func_gpios; i++) { 890 + const struct pinmux_func *func = &info->func_gpios[i]; 891 + 892 + if (!func->name) { 893 + sh_pfc_err("empty function gpio %u\n", i); 894 + continue; 895 + } 896 + for (j = 0; j < i; j++) { 897 + if (same_name(func->name, info->func_gpios[j].name)) 898 + sh_pfc_err("func_gpio %s: name conflict\n", 899 + func->name); 900 + } 901 + if (sh_pfc_check_enum(drvname, func->enum_id)) 902 + sh_pfc_err("%s enum_id %u conflict\n", func->name, 903 + func->enum_id); 904 + } 905 + #endif 995 906 } 996 907 997 908 static void __init sh_pfc_check_driver(const struct platform_driver *pdrv) 998 909 { 999 910 unsigned int i; 911 + 912 + sh_pfc_regs = kcalloc(SH_PFC_MAX_REGS, sizeof(*sh_pfc_regs), 913 + GFP_KERNEL); 914 + if (!sh_pfc_regs) 915 + return; 916 + 917 + sh_pfc_enums = kcalloc(SH_PFC_MAX_ENUMS, sizeof(*sh_pfc_enums), 918 + GFP_KERNEL); 919 + if (!sh_pfc_enums) 920 + goto free_regs; 1000 921 1001 922 pr_warn("Checking builtin pinmux tables\n"); 1002 923 ··· 1060 881 1061 882 pr_warn("Detected %u errors and %u warnings\n", sh_pfc_errors, 1062 883 sh_pfc_warnings); 884 + 885 + kfree(sh_pfc_enums); 886 + free_regs: 887 + kfree(sh_pfc_regs); 1063 888 } 1064 889 1065 890 #else /* !DEBUG */
+1 -4
drivers/pinctrl/sh-pfc/gpio.c
··· 205 205 206 206 for (k = 0; gpios[k] >= 0; k++) { 207 207 if (gpios[k] == offset) 208 - goto found; 208 + return pfc->irqs[i]; 209 209 } 210 210 } 211 211 212 212 return 0; 213 - 214 - found: 215 - return pfc->irqs[i]; 216 213 } 217 214 218 215 static int gpio_pin_setup(struct sh_pfc_chip *chip)
+1 -1
drivers/pinctrl/sirf/pinctrl-atlas7.c
··· 352 352 int nbank; 353 353 raw_spinlock_t lock; 354 354 struct gpio_chip chip; 355 - struct atlas7_gpio_bank banks[0]; 355 + struct atlas7_gpio_bank banks[]; 356 356 }; 357 357 358 358 /**
+5 -5
drivers/pinctrl/sprd/Kconfig
··· 4 4 # 5 5 6 6 config PINCTRL_SPRD 7 - bool "Spreadtrum pinctrl driver" 8 - depends on OF 9 - depends on ARCH_SPRD || COMPILE_TEST 7 + tristate 10 8 select PINMUX 11 9 select PINCONF 12 10 select GENERIC_PINCONF ··· 13 15 Say Y here to enable Spreadtrum pinctrl driver 14 16 15 17 config PINCTRL_SPRD_SC9860 16 - bool "Spreadtrum SC9860 pinctrl driver" 17 - depends on PINCTRL_SPRD 18 + tristate "Spreadtrum SC9860 pinctrl driver" 19 + depends on OF 20 + depends on ARCH_SPRD || COMPILE_TEST 21 + select PINCTRL_SPRD 18 22 help 19 23 Say Y here to enable Spreadtrum SC9860 pinctrl driver
+22 -3
drivers/pinctrl/sprd/pinctrl-sprd.c
··· 464 464 case PIN_CONFIG_INPUT_ENABLE: 465 465 arg = (reg >> SLEEP_INPUT_SHIFT) & SLEEP_INPUT_MASK; 466 466 break; 467 - case PIN_CONFIG_OUTPUT: 467 + case PIN_CONFIG_OUTPUT_ENABLE: 468 468 arg = reg & SLEEP_OUTPUT_MASK; 469 + break; 470 + case PIN_CONFIG_BIAS_HIGH_IMPEDANCE: 471 + if ((reg & SLEEP_OUTPUT) || (reg & SLEEP_INPUT)) 472 + return -EINVAL; 473 + 474 + arg = 1; 469 475 break; 470 476 case PIN_CONFIG_DRIVE_STRENGTH: 471 477 arg = (reg >> DRIVE_STRENGTH_SHIFT) & ··· 641 635 shift = SLEEP_INPUT_SHIFT; 642 636 } 643 637 break; 644 - case PIN_CONFIG_OUTPUT: 638 + case PIN_CONFIG_OUTPUT_ENABLE: 645 639 if (is_sleep_config == true) { 646 - val |= SLEEP_OUTPUT; 640 + if (arg > 0) 641 + val |= SLEEP_OUTPUT; 642 + else 643 + val &= ~SLEEP_OUTPUT; 644 + 647 645 mask = SLEEP_OUTPUT_MASK; 648 646 shift = SLEEP_OUTPUT_SHIFT; 647 + } 648 + break; 649 + case PIN_CONFIG_BIAS_HIGH_IMPEDANCE: 650 + if (is_sleep_config == true) { 651 + val = shift = 0; 652 + mask = SLEEP_OUTPUT | SLEEP_INPUT; 649 653 } 650 654 break; 651 655 case PIN_CONFIG_DRIVE_STRENGTH: ··· 1106 1090 1107 1091 return 0; 1108 1092 } 1093 + EXPORT_SYMBOL_GPL(sprd_pinctrl_core_probe); 1109 1094 1110 1095 int sprd_pinctrl_remove(struct platform_device *pdev) 1111 1096 { ··· 1115 1098 pinctrl_unregister(sprd_pctl->pctl); 1116 1099 return 0; 1117 1100 } 1101 + EXPORT_SYMBOL_GPL(sprd_pinctrl_remove); 1118 1102 1119 1103 void sprd_pinctrl_shutdown(struct platform_device *pdev) 1120 1104 { ··· 1130 1112 return; 1131 1113 pinctrl_select_state(pinctl, state); 1132 1114 } 1115 + EXPORT_SYMBOL_GPL(sprd_pinctrl_shutdown); 1133 1116 1134 1117 MODULE_DESCRIPTION("SPREADTRUM Pin Controller Driver"); 1135 1118 MODULE_AUTHOR("Baolin Wang <baolin.wang@spreadtrum.com>");
+2 -2
drivers/pinctrl/stm32/pinctrl-stm32.c
··· 284 284 285 285 stm32_pmx_get_mode(bank, pin, &mode, &alt); 286 286 if ((alt == 0) && (mode == 0)) 287 - ret = 1; 287 + ret = GPIO_LINE_DIRECTION_IN; 288 288 else if ((alt == 0) && (mode == 1)) 289 - ret = 0; 289 + ret = GPIO_LINE_DIRECTION_OUT; 290 290 else 291 291 ret = -EINVAL; 292 292
+14 -2
drivers/pinctrl/sunxi/pinctrl-sunxi.c
··· 13 13 #include <linux/io.h> 14 14 #include <linux/clk.h> 15 15 #include <linux/gpio/driver.h> 16 + #include <linux/interrupt.h> 16 17 #include <linux/irqdomain.h> 17 18 #include <linux/irqchip/chained_irq.h> 18 19 #include <linux/export.h> ··· 1059 1058 sunxi_pinctrl_irq_unmask(d); 1060 1059 } 1061 1060 1061 + static int sunxi_pinctrl_irq_set_wake(struct irq_data *d, unsigned int on) 1062 + { 1063 + struct sunxi_pinctrl *pctl = irq_data_get_irq_chip_data(d); 1064 + u8 bank = d->hwirq / IRQ_PER_BANK; 1065 + 1066 + return irq_set_irq_wake(pctl->irq[bank], on); 1067 + } 1068 + 1062 1069 static struct irq_chip sunxi_pinctrl_edge_irq_chip = { 1063 1070 .name = "sunxi_pio_edge", 1064 1071 .irq_ack = sunxi_pinctrl_irq_ack, ··· 1075 1066 .irq_request_resources = sunxi_pinctrl_irq_request_resources, 1076 1067 .irq_release_resources = sunxi_pinctrl_irq_release_resources, 1077 1068 .irq_set_type = sunxi_pinctrl_irq_set_type, 1078 - .flags = IRQCHIP_SKIP_SET_WAKE, 1069 + .irq_set_wake = sunxi_pinctrl_irq_set_wake, 1070 + .flags = IRQCHIP_MASK_ON_SUSPEND, 1079 1071 }; 1080 1072 1081 1073 static struct irq_chip sunxi_pinctrl_level_irq_chip = { ··· 1091 1081 .irq_request_resources = sunxi_pinctrl_irq_request_resources, 1092 1082 .irq_release_resources = sunxi_pinctrl_irq_release_resources, 1093 1083 .irq_set_type = sunxi_pinctrl_irq_set_type, 1094 - .flags = IRQCHIP_SKIP_SET_WAKE | IRQCHIP_EOI_THREADED | 1084 + .irq_set_wake = sunxi_pinctrl_irq_set_wake, 1085 + .flags = IRQCHIP_EOI_THREADED | 1086 + IRQCHIP_MASK_ON_SUSPEND | 1095 1087 IRQCHIP_EOI_IF_HANDLED, 1096 1088 }; 1097 1089
+49 -3
drivers/pinctrl/tegra/pinctrl-tegra.c
··· 275 275 return 0; 276 276 } 277 277 278 + static int tegra_pinctrl_gpio_request_enable(struct pinctrl_dev *pctldev, 279 + struct pinctrl_gpio_range *range, 280 + unsigned int offset) 281 + { 282 + struct tegra_pmx *pmx = pinctrl_dev_get_drvdata(pctldev); 283 + const struct tegra_pingroup *group; 284 + u32 value; 285 + 286 + if (!pmx->soc->sfsel_in_mux) 287 + return 0; 288 + 289 + group = &pmx->soc->groups[offset]; 290 + 291 + if (group->mux_reg < 0 || group->sfsel_bit < 0) 292 + return -EINVAL; 293 + 294 + value = pmx_readl(pmx, group->mux_bank, group->mux_reg); 295 + value &= ~BIT(group->sfsel_bit); 296 + pmx_writel(pmx, value, group->mux_bank, group->mux_reg); 297 + 298 + return 0; 299 + } 300 + 301 + static void tegra_pinctrl_gpio_disable_free(struct pinctrl_dev *pctldev, 302 + struct pinctrl_gpio_range *range, 303 + unsigned int offset) 304 + { 305 + struct tegra_pmx *pmx = pinctrl_dev_get_drvdata(pctldev); 306 + const struct tegra_pingroup *group; 307 + u32 value; 308 + 309 + if (!pmx->soc->sfsel_in_mux) 310 + return; 311 + 312 + group = &pmx->soc->groups[offset]; 313 + 314 + if (group->mux_reg < 0 || group->sfsel_bit < 0) 315 + return; 316 + 317 + value = pmx_readl(pmx, group->mux_bank, group->mux_reg); 318 + value |= BIT(group->sfsel_bit); 319 + pmx_writel(pmx, value, group->mux_bank, group->mux_reg); 320 + } 321 + 278 322 static const struct pinmux_ops tegra_pinmux_ops = { 279 323 .get_functions_count = tegra_pinctrl_get_funcs_count, 280 324 .get_function_name = tegra_pinctrl_get_func_name, 281 325 .get_function_groups = tegra_pinctrl_get_func_groups, 282 326 .set_mux = tegra_pinctrl_set_mux, 327 + .gpio_request_enable = tegra_pinctrl_gpio_request_enable, 328 + .gpio_disable_free = tegra_pinctrl_gpio_disable_free, 283 329 }; 284 330 285 331 static int tegra_pinconf_reg(struct tegra_pmx *pmx, ··· 735 689 .resume = &tegra_pinctrl_resume 736 690 }; 737 691 738 - static bool gpio_node_has_range(const char *compatible) 692 + static bool tegra_pinctrl_gpio_node_has_range(struct tegra_pmx *pmx) 739 693 { 740 694 struct device_node *np; 741 695 bool has_prop = false; 742 696 743 - np = of_find_compatible_node(NULL, NULL, compatible); 697 + np = of_find_compatible_node(NULL, NULL, pmx->soc->gpio_compatible); 744 698 if (!np) 745 699 return has_prop; 746 700 ··· 840 794 841 795 tegra_pinctrl_clear_parked_bits(pmx); 842 796 843 - if (!gpio_node_has_range(pmx->soc->gpio_compatible)) 797 + if (pmx->soc->ngpios > 0 && !tegra_pinctrl_gpio_node_has_range(pmx)) 844 798 pinctrl_add_gpio_range(pmx->pctl, &tegra_pinctrl_gpio_range); 845 799 846 800 platform_set_drvdata(pdev, pmx);
+4 -1
drivers/pinctrl/tegra/pinctrl-tegra.h
··· 107 107 * drvup, slwr, slwf, and drvtype parameters. 108 108 * @drv_bank: Drive fields register bank. 109 109 * @hsm_bit: High Speed Mode register bit. 110 - * @schmitt_bit: Scmitt register bit. 110 + * @sfsel_bit: GPIO/SFIO selection register bit. 111 + * @schmitt_bit: Schmitt register bit. 111 112 * @lpmd_bit: Low Power Mode register bit. 112 113 * @drvdn_bit: Drive Down register bit. 113 114 * @drvdn_width: Drive Down field width. ··· 154 153 s32 ioreset_bit:6; 155 154 s32 rcv_sel_bit:6; 156 155 s32 hsm_bit:6; 156 + s32 sfsel_bit:6; 157 157 s32 schmitt_bit:6; 158 158 s32 lpmd_bit:6; 159 159 s32 drvdn_bit:6; ··· 194 192 bool hsm_in_mux; 195 193 bool schmitt_in_mux; 196 194 bool drvtype_in_mux; 195 + bool sfsel_in_mux; 197 196 }; 198 197 199 198 extern const struct dev_pm_ops tegra_pinctrl_pm;
+23 -24
drivers/pinctrl/tegra/pinctrl-tegra194.c
··· 24 24 25 25 /* Define unique ID for each pins */ 26 26 enum pin_id { 27 - TEGRA_PIN_PEX_L5_CLKREQ_N_PGG0 = 256, 28 - TEGRA_PIN_PEX_L5_RST_N_PGG1 = 257, 29 - TEGRA_PIN_NUM_GPIOS = 258, 27 + TEGRA_PIN_PEX_L5_CLKREQ_N_PGG0, 28 + TEGRA_PIN_PEX_L5_RST_N_PGG1, 30 29 }; 31 30 32 31 /* Table for pin descriptor */ 33 32 static const struct pinctrl_pin_desc tegra194_pins[] = { 34 - PINCTRL_PIN(TEGRA_PIN_PEX_L5_CLKREQ_N_PGG0, 35 - "TEGRA_PIN_PEX_L5_CLKREQ_N_PGG0"), 36 - PINCTRL_PIN(TEGRA_PIN_PEX_L5_RST_N_PGG1, 37 - "TEGRA_PIN_PEX_L5_RST_N_PGG1"), 33 + PINCTRL_PIN(TEGRA_PIN_PEX_L5_CLKREQ_N_PGG0, "PEX_L5_CLKREQ_N_PGG0"), 34 + PINCTRL_PIN(TEGRA_PIN_PEX_L5_RST_N_PGG1, "PEX_L5_RST_N_PGG1"), 38 35 }; 39 36 40 37 static const unsigned int pex_l5_clkreq_n_pgg0_pins[] = { ··· 56 59 { \ 57 60 .name = #lid, \ 58 61 } 62 + 59 63 static struct tegra_function tegra194_functions[] = { 60 64 TEGRA_PIN_FUNCTION(rsvd0), 61 65 TEGRA_PIN_FUNCTION(rsvd1), ··· 68 70 #define DRV_PINGROUP_ENTRY_Y(r, drvdn_b, drvdn_w, drvup_b, \ 69 71 drvup_w, slwr_b, slwr_w, slwf_b, \ 70 72 slwf_w, bank) \ 71 - .drv_reg = ((r)), \ 73 + .drv_reg = ((r)), \ 72 74 .drv_bank = bank, \ 73 75 .drvdn_bit = drvdn_b, \ 74 76 .drvdn_width = drvdn_w, \ ··· 87 89 .hsm_bit = -1, \ 88 90 .mux_bank = bank, \ 89 91 .mux_bit = 0, \ 90 - .pupd_reg = ((r)), \ 92 + .pupd_reg = ((r)), \ 91 93 .pupd_bank = bank, \ 92 94 .pupd_bit = 2, \ 93 95 .tri_reg = ((r)), \ ··· 95 97 .tri_bit = 4, \ 96 98 .einput_bit = e_input, \ 97 99 .odrain_bit = e_od, \ 100 + .sfsel_bit = 10, \ 98 101 .schmitt_bit = schmitt_b, \ 99 102 .drvtype_bit = 13, \ 100 103 .drv_reg = -1, \ ··· 108 109 109 110 #define PINGROUP(pg_name, f0, f1, f2, f3, r, bank, pupd, e_lpbk, \ 110 111 e_input, e_lpdr, e_od, schmitt_b, drvtype, io_rail) \ 111 - { \ 112 - .name = #pg_name, \ 113 - .pins = pg_name##_pins, \ 114 - .npins = ARRAY_SIZE(pg_name##_pins), \ 115 - .funcs = { \ 116 - TEGRA_MUX_##f0, \ 117 - TEGRA_MUX_##f1, \ 118 - TEGRA_MUX_##f2, \ 119 - TEGRA_MUX_##f3, \ 120 - }, \ 121 - PIN_PINGROUP_ENTRY_Y(r, bank, pupd, e_lpbk, \ 122 - e_input, e_od, \ 123 - schmitt_b, drvtype), \ 124 - drive_##pg_name, \ 112 + { \ 113 + .name = #pg_name, \ 114 + .pins = pg_name##_pins, \ 115 + .npins = ARRAY_SIZE(pg_name##_pins), \ 116 + .funcs = { \ 117 + TEGRA_MUX_##f0, \ 118 + TEGRA_MUX_##f1, \ 119 + TEGRA_MUX_##f2, \ 120 + TEGRA_MUX_##f3, \ 121 + }, \ 122 + PIN_PINGROUP_ENTRY_Y(r, bank, pupd, e_lpbk, \ 123 + e_input, e_od, \ 124 + schmitt_b, drvtype), \ 125 + drive_##pg_name, \ 125 126 } 126 127 127 128 static const struct tegra_pingroup tegra194_groups[] = { ··· 132 133 }; 133 134 134 135 static const struct tegra_pinctrl_soc_data tegra194_pinctrl = { 135 - .ngpios = TEGRA_PIN_NUM_GPIOS, 136 136 .pins = tegra194_pins, 137 137 .npins = ARRAY_SIZE(tegra194_pins), 138 138 .functions = tegra194_functions, ··· 141 143 .hsm_in_mux = true, 142 144 .schmitt_in_mux = true, 143 145 .drvtype_in_mux = true, 146 + .sfsel_in_mux = true, 144 147 }; 145 148 146 149 static int tegra194_pinctrl_probe(struct platform_device *pdev)
+1 -1
drivers/pinctrl/uniphier/pinctrl-uniphier-core.c
··· 29 29 struct list_head node; 30 30 unsigned int base; 31 31 unsigned int nregs; 32 - u32 vals[0]; 32 + u32 vals[]; 33 33 }; 34 34 35 35 struct uniphier_pinctrl_priv {
+4 -2
drivers/pinctrl/vt8500/pinctrl-wmt.c
··· 486 486 u32 val; 487 487 488 488 val = readl_relaxed(data->base + reg_dir); 489 - /* Return 0 == output, 1 == input */ 490 - return !(val & BIT(bit)); 489 + if (val & BIT(bit)) 490 + return GPIO_LINE_DIRECTION_OUT; 491 + 492 + return GPIO_LINE_DIRECTION_IN; 491 493 } 492 494 493 495 static int wmt_gpio_get_value(struct gpio_chip *chip, unsigned offset)