Compare

2f46e80fa993fdee5e4fc5da80436e3e21bc2bd0..709ba1c547eaf37da36ded2ecf3ea4e304cdfa9a

pinctrl: qcom: ipq5018: replace gcc_plltest with pwm2 on gpio12

The pingroup table has gcc_plltest at function 5 of gpio12 and does not
offer pwm2 on that pin, so the pinmux core rejects a request for pwm2 on
gpio12 as an invalid group. On the hardware, function 5 of gpio12
carries the PWM2 output: the Xiaomi AX3000T v2 drives its blue status
LED from PWM2 on gpio12.

The vendor kernel shipped on that router (Linux 4.4, stock firmware
2.0.28) has pwm2 in this slot. Its pingroup table, as read from the
firmware image, lists these functions for gpio12:

  gpio, blsp0_spi, blsp0_i2c, blsp1_uart0, _, pwm2, qdss_tracedata_a,
  _, _, _

and has pwm3 at function 4 of gpio13, matching commit c6c159fcdb4e
("pinctrl: qcom: ipq5018: add missing pwm3 function on gpio13").

Measured on the board: with gpio12 set to each of the 16 function
values in turn, and PWM2 held at 0% and then at 100% duty, the pad
level read back from GPIO_IN follows PWM2 only at function 5. There it
does not follow PWM channels 0, 1 or 3, and the LED switches with PWM2.
Functions 4 and 7, which the table leaves empty, do not carry PWM2.

Put pwm2 in function 5 of gpio12 and list gpio12 in pwm2_groups. Drop
gpio12 from gcc_plltest_groups: none of its functions is gcc_plltest
any more, and selecting it would trigger the WARN_ON() in
msm_pinmux_set_mux().

Fixes: 725d1c891658 ("pinctrl: qcom: Add IPQ5018 pinctrl driver")
Assisted-by: LLM
Signed-off-by: Adriel Santos <adriel@adriel.eu>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Link: https://patch.msgid.link/20261002160958.908424-1-adriel@adriel.eu
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>

Adriel Santos <adriel@adriel.eu> · 2026-10-02 16:09 UTC · committed by Bartosz Golaszewski

Browse files
26 files changed, +105 −96
modified .mailmap
@@ -484,7 +484,6 @@ Juha Yrjola <juha.yrjola@nokia.com>
484 484 Juha Yrjola <juha.yrjola@solidboot.com>
485 485 Julien Thierry <julien.thierry.kdev@gmail.com> <julien.thierry@arm.com>
486 486 Justin Iurman <justin.iurman@gmail.com> <justin.iurman@uliege.be>
487 - Imre Kaloz <kaloz@kernel.org> <kaloz@openwrt.org>
488 487 Ira Weiny <iweiny@kernel.org> <ira.weiny@intel.com>
489 488 Iskren Chernev <me@iskren.info> <iskren.chernev@gmail.com>
490 489 Kalle Valo <kvalo@kernel.org> <kvalo@codeaurora.org>
modified MAINTAINERS
@@ -3012,7 +3012,7 @@ F: arch/arm/boot/dts/ti/omap/omap3-igep*
3012 3012
3013 3013 ARM/INTEL IXP4XX ARM ARCHITECTURE
3014 3014 M: Linus Walleij <linusw@kernel.org>
3015 - M: Imre Kaloz <kaloz@kernel.org>
3015 + M: Imre Kaloz <kaloz@openwrt.org>
3016 3016 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
3017 3017 S: Maintained
3018 3018 F: Documentation/devicetree/bindings/arm/intel-ixp4xx.yaml
modified arch/arm64/boot/dts/freescale/fsl-lx216x.dtsi
@@ -1602,7 +1602,7 @@
1602 1602 };
1603 1603
1604 1604 dspi2_miso_mosi_pins: iic5-spi3-pins {
1605 - pinctrl-single,bits = <0x0 (0x3 << 9) (0x7 << 9)>;
1605 + pinctrl-single,bits = <0x3 (0x2 << 9) (0x7 << 9)>;
1606 1606 };
1607 1607
1608 1608 i2c5_pins: iic6-i2c-pins {
@@ -1622,7 +1622,7 @@
1622 1622 };
1623 1623
1624 1624 gpio1_31_28_pins: xspi1-data74-gpio-pins {
1625 - pinctrl-single,bits = <0x0 (0x1 << 15) (0x7 << 15)>;
1625 + pinctrl-single,bits = <0x0 0x1 (0x7 << 15)>;
1626 1626 };
1627 1627
1628 1628 fspi_data30_pins: xspi1-data30-pins {
@@ -1630,7 +1630,7 @@
1630 1630 };
1631 1631
1632 1632 gpio1_27_24_pins: xspi1-data30-gpio-pins {
1633 - pinctrl-single,bits = <0x0 (0x1 << 18) (0x7 << 18)>;
1633 + pinctrl-single,bits = <0x0 0x1 (0x7 << 18)>;
1634 1634 };
1635 1635
1636 1636 fspi_dqs_sck_cs10_pins: xspi1-base-pins {
@@ -1638,7 +1638,7 @@
1638 1638 };
1639 1639
1640 1640 gpio1_23_20_pins: xspi1-base-gpio-pins {
1641 - pinctrl-single,bits = <0x0 (0x1 << 21) (0x7 << 21)>;
1641 + pinctrl-single,bits = <0x0 0x1 (0x7 << 21)>;
1642 1642 };
1643 1643
1644 1644 esdhc0_cmd_data30_clk_vsel_pins: sdhc1-base-sdhc-vsel-pins {
@@ -1687,19 +1687,12 @@
1687 1687 };
1688 1688
1689 1689 /* RCWSR14 */
1690 - /*
1691 - * IIC1_PMUX is a single bit at RCWSR14[10], but bit-per-mux
1692 - * uses the mask for the field to clear before applying the
1693 - * value.
1694 - * So bits 11 and 12, which are reserved, are written as 0
1695 - * on every mux switch, it is harmless.
1696 - */
1697 1690 i2c0_pins: iic1-i2c-pins {
1698 - pinctrl-single,bits = <0x8 0x0 (0x7 << 10)>;
1691 + pinctrl-single,bits = <0x8 0x0 (0x1 << 10)>;
1699 1692 };
1700 1693
1701 1694 gpio0_3_2_pins: iic1-gpio-pins {
1702 - pinctrl-single,bits = <0x8 (0x1 << 10) (0x7 << 10)>;
1695 + pinctrl-single,bits = <0x8 (0x1 << 10) (0x1 << 10)>;
1703 1696 };
1704 1697 };
1705 1698
modified arch/arm64/boot/dts/freescale/imx8mp-var-dart-sonata.dts
@@ -511,7 +511,6 @@
511 511 pinctrl-2 = <&pinctrl_usdhc2_200mhz>, <&pinctrl_usdhc2_gpio>;
512 512 cd-gpios = <&gpio2 12 GPIO_ACTIVE_LOW>;
513 513 vmmc-supply = <&reg_usdhc2_vmmc>;
514 - vqmmc-supply = <&ldo5>;
515 514 bus-width = <4>;
516 515 status = "okay";
517 516 };
modified arch/arm64/boot/dts/qcom/x1-microsoft-denali.dtsi
@@ -863,11 +863,11 @@
863 863 };
864 864
865 865 &lpass_vamacro {
866 - pinctrl-0 = <&dmic01_default>;
866 + pinctrl-0 = <&dmic01_default>, <&dmic23_default>;
867 867 pinctrl-names = "default";
868 868
869 869 vdd-micb-supply = <&vreg_l1b_1p8>;
870 - qcom,dmic-sample-rate = <2400000>;
870 + qcom,dmic-sample-rate = <4800000>;
871 871 };
872 872
873 873 &mdss {
modified arch/riscv/boot/dts/microchip/mpfs-beaglev-fire.dts
@@ -90,6 +90,10 @@
90 90 };
91 91
92 92 &gpio0 {
93 + interrupts = <13>, <14>, <15>, <16>,
94 + <17>, <18>, <19>, <20>,
95 + <21>, <22>, <23>, <24>,
96 + <25>, <26>;
93 97 ngpios = <14>;
94 98 gpio-line-names = "", "", "", "", "", "", "",
95 99 "", "", "", "", "", "SD_CARD_CS", "USER_BUTTON";
@@ -97,6 +101,12 @@
97 101 };
98 102
99 103 &gpio1 {
104 + interrupts = <27>, <28>, <29>, <30>,
105 + <31>, <32>, <33>, <34>,
106 + <35>, <36>, <37>, <38>,
107 + <39>, <40>, <41>, <42>,
108 + <43>, <44>, <45>, <46>,
109 + <47>, <48>, <49>, <50>;
100 110 ngpios = <24>;
101 111 gpio-line-names = "", "", "", "", "", "", "", "", "", "",
102 112 "", "", "", "", "", "", "", "", "", "",
@@ -105,6 +115,14 @@
105 115 };
106 116
107 117 &gpio2 {
118 + interrupts = <53>, <53>, <53>, <53>,
119 + <53>, <53>, <53>, <53>,
120 + <53>, <53>, <53>, <53>,
121 + <53>, <53>, <53>, <53>,
122 + <53>, <53>, <53>, <53>,
123 + <53>, <53>, <53>, <53>,
124 + <53>, <53>, <53>, <53>,
125 + <53>, <53>, <53>, <53>;
108 126 ngpios = <32>;
109 127 gpio-line-names = "P8_PIN3_USER_LED_0", "P8_PIN4_USER_LED_1", "P8_PIN5_USER_LED_2",
110 128 "P8_PIN6_USER_LED_3", "P8_PIN7_USER_LED_4", "P8_PIN8_USER_LED_5",
modified drivers/clk/qcom/gcc-eliza.c
@@ -3010,6 +3010,8 @@ static const u32 gcc_eliza_critical_cbcrs[] = {
3010 3010 0x26034, /* GCC_CAMERA_XO_CLK */
3011 3011 0x27004, /* GCC_DISP_AHB_CLK */
3012 3012 0x71004, /* GCC_GPU_CFG_AHB_CLK */
3013 + 0x52010, /* GCC_PCIE_RSCC_CFG_AHB_CLK */
3014 + 0x52010, /* GCC_PCIE_RSCC_XO_CLK */
3013 3015 0x32004, /* GCC_VIDEO_AHB_CLK */
3014 3016 0x32038, /* GCC_VIDEO_XO_CLK */
3015 3017 };
@@ -3043,10 +3045,6 @@ static const struct regmap_config gcc_eliza_regmap_config = {
3043 3045
3044 3046 static void clk_eliza_regs_configure(struct device *dev, struct regmap *regmap)
3045 3047 {
3046 - /* Keep clocks always enabled */
3047 - regmap_update_bits(regmap, 0x52010, BIT(20), BIT(20)); /* GCC_PCIE_RSCC_CFG_AHB_CLK */
3048 - regmap_update_bits(regmap, 0x52010, BIT(21), BIT(21)); /* GCC_PCIE_RSCC_XO_CLK */
3049 -
3050 3048 /* FORCE_MEM_CORE_ON for ufs phy ice core and gcc ufs phy axi clocks */
3051 3049 qcom_branch_set_force_mem_core(regmap, gcc_ufs_phy_ice_core_clk, true);
3052 3050 qcom_branch_set_force_mem_core(regmap, gcc_ufs_phy_axi_clk, true);
modified drivers/clk/qcom/gcc-hawi.c
@@ -3692,6 +3692,8 @@ static const u32 gcc_hawi_critical_cbcrs[] = {
3692 3692 0x67084, /* GCC_PCIE_1_RSC_CORE_CLK */
3693 3693 0x43014, /* GCC_PCIE_LINK_XO_CLK */
3694 3694 0x6b088, /* GCC_PCIE_RSC_CORE_CLK */
3695 + 0x52010, /* GCC_PCIE_RSCC_CFG_AHB_CLK */
3696 + 0x52010, /* GCC_PCIE_RSCC_XO_CLK */
3695 3697 0x32004, /* GCC_VIDEO_AHB_CLK */
3696 3698 0x32028, /* GCC_VIDEO_XO_CLK */
3697 3699 };
@@ -3761,10 +3763,6 @@ static const struct regmap_config gcc_hawi_regmap_config = {
3761 3763
3762 3764 static void clk_hawi_regs_configure(struct device *dev, struct regmap *regmap)
3763 3765 {
3764 - /* Keep clocks always enabled */
3765 - regmap_update_bits(regmap, 0x52010, BIT(20), BIT(20)); /* GCC_PCIE_RSCC_CFG_AHB_CLK */
3766 - regmap_update_bits(regmap, 0x52010, BIT(21), BIT(21)); /* GCC_PCIE_RSCC_XO_CLK */
3767 -
3768 3766 /* FORCE_MEM_CORE_ON for ufs phy ice core clocks */
3769 3767 qcom_branch_set_force_mem_core(regmap, gcc_ufs_phy_ice_core_clk, true);
3770 3768 }
modified drivers/clk/qcom/gcc-kaanapali.c
@@ -3464,6 +3464,8 @@ static const u32 gcc_kaanapali_critical_cbcrs[] = {
3464 3464 0x9f004, /* GCC_EVA_AHB_CLK */
3465 3465 0x9f024, /* GCC_EVA_XO_CLK */
3466 3466 0x71004, /* GCC_GPU_CFG_AHB_CLK */
3467 + 0x52010, /* GCC_PCIE_RSCC_CFG_AHB_CLK */
3468 + 0x52010, /* GCC_PCIE_RSCC_XO_CLK */
3467 3469 0x32004, /* GCC_VIDEO_AHB_CLK */
3468 3470 0x32040, /* GCC_VIDEO_XO_CLK */
3469 3471 };
@@ -3478,10 +3480,6 @@ static const struct regmap_config gcc_kaanapali_regmap_config = {
3478 3480
3479 3481 static void clk_kaanapali_regs_configure(struct device *dev, struct regmap *regmap)
3480 3482 {
3481 - /* Keep clocks always enabled */
3482 - regmap_update_bits(regmap, 0x52010, BIT(20), BIT(20)); /* GCC_PCIE_RSCC_CFG_AHB_CLK */
3483 - regmap_update_bits(regmap, 0x52010, BIT(21), BIT(21)); /* GCC_PCIE_RSCC_XO_CLK */
3484 -
3485 3483 /* FORCE_MEM_CORE_ON for ufs phy ice core clocks */
3486 3484 qcom_branch_set_force_mem_core(regmap, gcc_ufs_phy_ice_core_clk, true);
3487 3485 }
modified drivers/clk/qcom/gpucc-glymur.c
@@ -510,7 +510,7 @@ static struct gdsc gpu_cc_cx_gdsc = {
510 510 .name = "gpu_cc_cx_gdsc",
511 511 },
512 512 .pwrsts = PWRSTS_OFF_ON,
513 - .flags = RETAIN_FF_ENABLE | VOTABLE,
513 + .flags = POLL_CFG_GDSCR | RETAIN_FF_ENABLE,
514 514 };
515 515
516 516 static struct clk_regmap *gpu_cc_glymur_clocks[] = {
modified drivers/clk/qcom/gpucc-kaanapali.c
@@ -380,7 +380,7 @@ static struct gdsc gpu_cc_cx_gdsc = {
380 380 .name = "gpu_cc_cx_gdsc",
381 381 },
382 382 .pwrsts = PWRSTS_OFF_ON,
383 - .flags = RETAIN_FF_ENABLE | VOTABLE,
383 + .flags = POLL_CFG_GDSCR | RETAIN_FF_ENABLE,
384 384 };
385 385
386 386 static struct clk_regmap *gpu_cc_kaanapali_clocks[] = {
modified drivers/pinctrl/qcom/pinctrl-hawi.c
@@ -47,6 +47,7 @@
47 47 .intr_wakeup_present_bit = 6, \
48 48 .intr_wakeup_enable_bit = 7, \
49 49 .intr_target_bit = 8, \
50 + .intr_target_width = 4, \
50 51 .intr_target_kpss_val = 3, \
51 52 .intr_raw_status_bit = 4, \
52 53 .intr_polarity_bit = 1, \
modified drivers/pinctrl/qcom/pinctrl-ipq5018.c
@@ -361,7 +361,7 @@ static const char * const blsp1_uart0_groups[] = {
361 361 };
362 362
363 363 static const char * const gcc_plltest_groups[] = {
364 - "gpio10", "gpio12",
364 + "gpio10",
365 365 };
366 366
367 367 static const char * const gcc_tlmm_groups[] = {
@@ -539,7 +539,7 @@ static const char * const qdss_tracectl_b_groups[] = {
539 539 };
540 540
541 541 static const char * const pwm0_groups[] = {
542 - "gpio42",
542 + "gpio42", "gpio46",
543 543 };
544 544
545 545 static const char * const qdss_cti_trig_out_b0_groups[] = {
@@ -547,7 +547,7 @@ static const char * const qdss_cti_trig_out_b0_groups[] = {
547 547 };
548 548
549 549 static const char * const pwm1_groups[] = {
550 - "gpio43",
550 + "gpio43", "gpio1",
551 551 };
552 552
553 553 static const char * const qdss_cti_trig_in_b0_groups[] = {
@@ -555,7 +555,7 @@ static const char * const qdss_cti_trig_in_b0_groups[] = {
555 555 };
556 556
557 557 static const char * const pwm2_groups[] = {
558 - "gpio44",
558 + "gpio12", "gpio44",
559 559 };
560 560
561 561 static const char * const qdss_cti_trig_out_b1_groups[] = {
@@ -563,7 +563,7 @@ static const char * const qdss_cti_trig_out_b1_groups[] = {
563 563 };
564 564
565 565 static const char * const pwm3_groups[] = {
566 - "gpio45",
566 + "gpio45", "gpio30", "gpio13",
567 567 };
568 568
569 569 static const char * const qdss_cti_trig_in_b1_groups[] = {
@@ -677,7 +677,7 @@ static const struct pinfunction ipq5018_functions[] = {
677 677
678 678 static const struct msm_pingroup ipq5018_groups[] = {
679 679 PINGROUP(0, atest_char, _, qdss_cti_trig_out_a0, wci_txd, wci_rxd, xfem, _, _, _),
680 - PINGROUP(1, atest_char, _, qdss_cti_trig_in_a0, wci_txd, wci_rxd, xfem, _, _, _),
680 + PINGROUP(1, atest_char, pwm1, qdss_cti_trig_in_a0, wci_txd, wci_rxd, xfem, _, _, _),
681 681 PINGROUP(2, atest_char, _, qdss_cti_trig_out_a1, wci_txd, wci_rxd, xfem, _, _, _),
682 682 PINGROUP(3, atest_char, _, qdss_cti_trig_in_a1, wci_txd, wci_rxd, xfem, _, _, _),
683 683 PINGROUP(4, sdc1_data, qspi_data, blsp1_spi1, btss, dbg_out, qdss_traceclk_a, _, burn0, _),
@@ -688,8 +688,8 @@ static const struct msm_pingroup ipq5018_groups[] = {
688 688 PINGROUP(9, sdc1_clk, qspi_clk, _, qdss_tracedata_a, _, _, _, _, _),
689 689 PINGROUP(10, blsp0_spi, blsp1_uart0, led0, gcc_plltest, qdss_tracedata_a, _, _, _, _),
690 690 PINGROUP(11, blsp0_spi, blsp1_uart0, _, gcc_tlmm, qdss_tracedata_a, _, _, _, _),
691 - PINGROUP(12, blsp0_spi, blsp0_i2c, blsp1_uart0, _, gcc_plltest, qdss_tracedata_a, _, _, _),
692 - PINGROUP(13, blsp0_spi, blsp0_i2c, blsp1_uart0, _, qdss_tracedata_a, _, _, _, _),
691 + PINGROUP(12, blsp0_spi, blsp0_i2c, blsp1_uart0, _, pwm2, qdss_tracedata_a, _, _, _),
692 + PINGROUP(13, blsp0_spi, blsp0_i2c, blsp1_uart0, pwm3, qdss_tracedata_a, _, _, _, _),
693 693 PINGROUP(14, pcie0_clk, _, _, cri_trng0, qdss_tracedata_a, _, _, _, _),
694 694 PINGROUP(15, _, _, cri_trng1, qdss_tracedata_a, _, _, _, _, _),
695 695 PINGROUP(16, pcie0_wake, _, _, cri_trng, qdss_tracedata_a, _, _, _, _),
@@ -706,7 +706,7 @@ static const struct msm_pingroup ipq5018_groups[] = {
706 706 PINGROUP(27, audio_txmclk, wsa_swrm, audio_txmclk, blsp2_spi, btss, _, qdss_tracedata_b, _, _),
707 707 PINGROUP(28, audio_txbclk, wsa_swrm, blsp0_uart1, btss, qdss_tracedata_b, _, _, _, _),
708 708 PINGROUP(29, audio_txfsync, _, blsp0_uart1, _, qdss_tracedata_b, _, _, _, _),
709 - PINGROUP(30, audio_txd, led2, led0, _, _, _, _, _, _),
709 + PINGROUP(30, audio_txd, led2, led0, pwm3, _, _, _, _, _),
710 710 PINGROUP(31, blsp2_spi0, blsp1_uart1, _, qdss_tracedata_b, eud_gpio, _, _, _, _),
711 711 PINGROUP(32, blsp2_spi0, blsp1_uart1, _, qdss_tracedata_b, eud_gpio, _, _, _, _),
712 712 PINGROUP(33, blsp2_i2c0, blsp2_spi0, blsp1_uart1, _, qdss_tracedata_b, eud_gpio, _, _, _),
@@ -722,7 +722,7 @@ static const struct msm_pingroup ipq5018_groups[] = {
722 722 PINGROUP(43, pwm1, qdss_cti_trig_in_b0, wci_txd, wci_rxd, xfem, _, _, _, _),
723 723 PINGROUP(44, pwm2, qdss_cti_trig_out_b1, wci_txd, wci_rxd, xfem, _, _, _, _),
724 724 PINGROUP(45, pwm3, qdss_cti_trig_in_b1, wci_txd, wci_rxd, xfem, _, _, _, _),
725 - PINGROUP(46, led0, _, _, _, _, _, _, _, _),
725 + PINGROUP(46, led0, pwm0, _, _, _, _, _, _, _),
726 726 };
727 727
728 728 static const struct msm_pinctrl_soc_data ipq5018_pinctrl = {
modified drivers/pinctrl/qcom/pinctrl-maili.c
@@ -47,6 +47,7 @@
47 47 .intr_wakeup_present_bit = 6, \
48 48 .intr_wakeup_enable_bit = 7, \
49 49 .intr_target_bit = 8, \
50 + .intr_target_width = 4, \
50 51 .intr_target_kpss_val = 3, \
51 52 .intr_raw_status_bit = 4, \
52 53 .intr_polarity_bit = 1, \
modified drivers/pinctrl/qcom/pinctrl-nord.c
@@ -32,6 +32,7 @@
32 32 .intr_wakeup_present_bit = 6, \
33 33 .intr_wakeup_enable_bit = 7, \
34 34 .intr_target_bit = 8, \
35 + .intr_target_width = 4, \
35 36 .intr_target_kpss_val = 3, \
36 37 .intr_raw_status_bit = 4, \
37 38 .intr_polarity_bit = 1, \
modified drivers/pinctrl/qcom/pinctrl-qcs8300.c
@@ -45,6 +45,7 @@
45 45 .intr_enable_bit = 0, \
46 46 .intr_status_bit = 0, \
47 47 .intr_target_bit = 5, \
48 + .intr_target_width = 4, \
48 49 .intr_target_kpss_val = 3, \
49 50 .intr_raw_status_bit = 4, \
50 51 .intr_polarity_bit = 1, \
modified drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
@@ -734,29 +734,50 @@ static int pmic_gpio_get_direction(struct gpio_chip *chip, unsigned pin)
734 734 (!pad->input_enabled && !pad->output_enabled))
735 735 return -EINVAL;
736 736
737 - /* Make sure the state is aligned on what pmic_gpio_get() returns */
738 - return pad->input_enabled ? GPIO_LINE_DIRECTION_IN : GPIO_LINE_DIRECTION_OUT;
737 + /*
738 + * An open-drain or open-source pad keeps its input buffer enabled while
739 + * driving, so the output buffer is what tells the direction.
740 + */
741 + return pad->output_enabled ? GPIO_LINE_DIRECTION_OUT : GPIO_LINE_DIRECTION_IN;
739 742 }
740 743
741 744 static int pmic_gpio_direction_input(struct gpio_chip *chip, unsigned pin)
742 745 {
743 746 struct pmic_gpio_state *state = gpiochip_get_data(chip);
744 - unsigned long config;
747 + unsigned long configs[2];
745 748
746 - config = pinconf_to_config_packed(PIN_CONFIG_INPUT_ENABLE, 1);
749 + configs[0] = pinconf_to_config_packed(PIN_CONFIG_OUTPUT_ENABLE, 0);
750 + configs[1] = pinconf_to_config_packed(PIN_CONFIG_INPUT_ENABLE, 1);
747 751
748 - return pmic_gpio_config_set(state->ctrl, pin, &config, 1);
752 + return pmic_gpio_config_set(state->ctrl, pin, configs,
753 + ARRAY_SIZE(configs));
749 754 }
750 755
751 756 static int pmic_gpio_direction_output(struct gpio_chip *chip,
752 757 unsigned pin, int val)
753 758 {
754 759 struct pmic_gpio_state *state = gpiochip_get_data(chip);
755 - unsigned long config;
760 + struct pmic_gpio_pad *pad = state->ctrl->desc->pins[pin].drv_data;
761 + unsigned long configs[2];
756 762
757 - config = pinconf_to_config_packed(PIN_CONFIG_LEVEL, val);
763 + /*
764 + * An open-drain or open-source pad only ever drives one rail, so the
765 + * line can still be sampled while the pad is an output. Keep the input
766 + * buffer enabled for those, so that pmic_gpio_get() reports what is on
767 + * the wire rather than the value last written, and disable it for a
768 + * CMOS pad, so that the pad ends up in DIGITAL_OUTPUT rather than
769 + * DIGITAL_INPUT_OUTPUT. Program it either way, as the buffer may have
770 + * been left in the opposite state by the bootloader or by an earlier
771 + * direction change with a different buffer type. gpiolib applies
772 + * PIN_CONFIG_DRIVE_OPEN_DRAIN before calling this, so buffer_type is
773 + * already up to date here.
774 + */
775 + configs[0] = pinconf_to_config_packed(PIN_CONFIG_INPUT_ENABLE,
776 + pad->buffer_type != PMIC_GPIO_OUT_BUF_CMOS);
777 + configs[1] = pinconf_to_config_packed(PIN_CONFIG_LEVEL, val);
758 778
759 - return pmic_gpio_config_set(state->ctrl, pin, &config, 1);
779 + return pmic_gpio_config_set(state->ctrl, pin, configs,
780 + ARRAY_SIZE(configs));
760 781 }
761 782
762 783 static int pmic_gpio_get(struct gpio_chip *chip, unsigned pin)
modified drivers/soc/tegra/fuse/tegra-apbmisc.c
@@ -309,7 +309,7 @@ void tegra_acpi_init_apbmisc(void)
309 309
310 310 ret = acpi_dev_get_memory_resources(adev, &resource_list);
311 311 if (ret < 0) {
312 - pr_err("failed to get APBMISC memory resources\n");
312 + pr_err("failed to get APBMISC memory resources");
313 313 goto out_put_acpi_dev;
314 314 }
315 315
modified drivers/soc/tegra/pmc.c
@@ -3151,7 +3151,6 @@ static int tegra_pmc_probe(struct platform_device *pdev)
3151 3151
3152 3152 #if defined(CONFIG_ARM)
3153 3153 mutex_lock(&early_pmc->powergates_lock);
3154 - early_pmc->rate = pmc->rate;
3155 3154 iounmap(early_pmc->base);
3156 3155 early_pmc->base = pmc->base;
3157 3156 mutex_unlock(&early_pmc->powergates_lock);
modified drivers/tee/optee/ffa_abi.c
@@ -198,8 +198,7 @@ static int to_msg_param_ffa_mem(struct optee_msg_param *mp,
198 198 if (shm) {
199 199 u64 shm_offs = p->u.memref.shm_offs;
200 200
201 - mp->u.fmem.internal_offs = tee_shm_get_page_offset(shm) &
202 - (FFA_PAGE_SIZE - 1);
201 + mp->u.fmem.internal_offs = shm->offset;
203 202
204 203 mp->u.fmem.offs_low = shm_offs;
205 204 mp->u.fmem.offs_high = shm_offs >> 32;
@@ -285,26 +284,14 @@ static int optee_ffa_shm_register(struct tee_context *ctx, struct tee_shm *shm,
285 284 .nattrs = 1,
286 285 };
287 286 struct sg_table sgt;
288 - size_t ffa_offs;
289 287 int rc;
290 288
291 - if (!num_pages)
292 - return -EINVAL;
293 -
294 289 rc = optee_check_mem_type(start, num_pages);
295 290 if (rc)
296 291 return rc;
297 292
298 - /*
299 - * Start the FF-A descriptor at the 4 KiB page containing the shared
300 - * buffer, skipping unused leading 4 KiB pages when PAGE_SIZE is
301 - * larger. Same approach as optee_fill_pages_list() in the SMC ABI.
302 - * This leaves only the offset into that 4 KiB page for internal_offs.
303 - */
304 - ffa_offs = round_down(tee_shm_get_page_offset(shm), FFA_PAGE_SIZE);
305 - rc = sg_alloc_table_from_pages(&sgt, pages, num_pages, ffa_offs,
306 - num_pages * PAGE_SIZE - ffa_offs,
307 - GFP_KERNEL);
293 + rc = sg_alloc_table_from_pages(&sgt, pages, num_pages, 0,
294 + num_pages * PAGE_SIZE, GFP_KERNEL);
308 295 if (rc)
309 296 return rc;
310 297 args.sg = sgt.sgl;
@@ -471,8 +458,7 @@ static void handle_ffa_rpc_func_cmd_shm_alloc(struct tee_context *ctx,
471 458 .attr = OPTEE_MSG_ATTR_TYPE_FMEM_OUTPUT,
472 459 .u.fmem.size = tee_shm_get_size(shm),
473 460 .u.fmem.global_id = shm->sec_world_id,
474 - .u.fmem.internal_offs = tee_shm_get_page_offset(shm) &
475 - (FFA_PAGE_SIZE - 1),
461 + .u.fmem.internal_offs = shm->offset,
476 462 };
477 463
478 464 arg->ret = TEEC_SUCCESS;
@@ -1137,6 +1123,14 @@ static int optee_ffa_probe(struct ffa_device *ffa_dev)
1137 1123
1138 1124 optee_set_dev_group(optee);
1139 1125
1126 + rc = tee_device_register(optee->teedev);
1127 + if (rc)
1128 + goto err_unreg_supp_teedev;
1129 +
1130 + rc = tee_device_register(optee->supp_teedev);
1131 + if (rc)
1132 + goto err_unreg_supp_teedev;
1133 +
1140 1134 rc = rhashtable_init(&optee->ffa.global_ids, &shm_rhash_params);
1141 1135 if (rc)
1142 1136 goto err_unreg_supp_teedev;
@@ -1165,14 +1159,6 @@ static int optee_ffa_probe(struct ffa_device *ffa_dev)
1165 1159 if (optee_ffa_protmem_pool_init(optee, sec_caps))
1166 1160 pr_info("Protected memory service not available\n");
1167 1161
1168 - rc = tee_device_register(optee->teedev);
1169 - if (rc)
1170 - goto err_unregister_devices;
1171 -
1172 - rc = tee_device_register(optee->supp_teedev);
1173 - if (rc)
1174 - goto err_unregister_devices;
1175 -
1176 1162 rc = optee_enumerate_devices(PTA_CMD_GET_DEVICES);
1177 1163 if (rc)
1178 1164 goto err_unregister_devices;
modified drivers/tee/optee/optee_msg.h
@@ -136,8 +136,8 @@ struct optee_msg_param_rmem {
136 136 * struct optee_msg_param_fmem - FF-A memory reference parameter
137 137 * @offs_low: lower bits of offset into shared memory reference
138 138 * @offs_high: higher bits of offset into shared memory reference
139 - * @internal_offs: offset into the first 4 KiB page of the FF-A shared
140 - * memory region
139 + * @internal_offs: internal offset into the first page of shared memory
140 + * reference
141 141 * @size: size of the buffer
142 142 * @global_id: global identifier of the shared memory
143 143 */
modified drivers/tee/optee/smc_abi.c
@@ -1849,6 +1849,14 @@ static int optee_probe(struct platform_device *pdev)
1849 1849
1850 1850 optee_set_dev_group(optee);
1851 1851
1852 + rc = tee_device_register(optee->teedev);
1853 + if (rc)
1854 + goto err_unreg_supp_teedev;
1855 +
1856 + rc = tee_device_register(optee->supp_teedev);
1857 + if (rc)
1858 + goto err_unreg_supp_teedev;
1859 +
1852 1860 optee_cq_init(&optee->call_queue, thread_count);
1853 1861 optee_supp_init(&optee->supp);
1854 1862 optee->smc.memremaped_shm = memremaped_shm;
@@ -1908,14 +1916,6 @@ static int optee_probe(struct platform_device *pdev)
1908 1916 if (optee->smc.sec_caps & OPTEE_SMC_SEC_CAP_DYNAMIC_SHM)
1909 1917 pr_info("dynamic shared memory is enabled\n");
1910 1918
1911 - rc = tee_device_register(optee->teedev);
1912 - if (rc)
1913 - goto err_disable_shm_cache;
1914 -
1915 - rc = tee_device_register(optee->supp_teedev);
1916 - if (rc)
1917 - goto err_disable_shm_cache;
1918 -
1919 1919 rc = optee_enumerate_devices(PTA_CMD_GET_DEVICES);
1920 1920 if (rc)
1921 1921 goto err_disable_shm_cache;
@@ -1942,6 +1942,7 @@ err_supp_uninit:
1942 1942 optee_shm_arg_cache_uninit(optee);
1943 1943 optee_supp_uninit(&optee->supp);
1944 1944 mutex_destroy(&optee->call_queue.mutex);
1945 + err_unreg_supp_teedev:
1945 1946 tee_device_unregister(optee->supp_teedev);
1946 1947 err_unreg_teedev:
1947 1948 tee_device_unregister(optee->teedev);
modified drivers/tee/qcomtee/async.c
@@ -97,10 +97,10 @@ static void qcomtee_get_async_buffer(struct qcomtee_object_invoke_ctx *oic,
97 97 /**
98 98 * async_release() - Process QTEE async release requests.
99 99 * @oic: context used for the current invocation.
100 - * @async_msg: async message for object release.
100 + * @msg: async message for object release.
101 101 * @size: size of the async buffer available.
102 102 *
103 - * Return: Size of the outbound buffer used when processing @async_msg.
103 + * Return: Size of the outbound buffer used when processing @msg.
104 104 */
105 105 static size_t async_release(struct qcomtee_object_invoke_ctx *oic,
106 106 struct qcomtee_async_msg_hdr *async_msg,
modified drivers/tee/qcomtee/qcomtee_msg.h
@@ -112,7 +112,7 @@ union qcomtee_msg_arg {
112 112
113 113 /**
114 114 * struct qcomtee_msg_object_invoke - Direct object invocation message.
115 - * @cxt: object ID hosted in QTEE.
115 + * @ctx: object ID hosted in QTEE.
116 116 * @op: operation for the object.
117 117 * @counts: number of different types of arguments in @args.
118 118 * @args: array of arguments.
modified drivers/tee/qcomtee/qcomtee_object.h
@@ -74,7 +74,6 @@ enum qcomtee_object_type {
74 74 * @QCOMTEE_ARG_TYPE_OO: output object (OO).
75 75 * @QCOMTEE_ARG_TYPE_IB: input buffer (IB).
76 76 * @QCOMTEE_ARG_TYPE_IO: input object (IO).
77 - * @QCOMTEE_ARG_TYPE_NR: number of argument types.
78 77 *
79 78 * Use the invalid type to specify the end of the argument array.
80 79 */
modified drivers/tee/tee_shm.c
@@ -343,10 +343,6 @@ int tee_dyn_shm_alloc_helper(struct tee_shm *shm, size_t size, size_t align,
343 343 unsigned int i;
344 344 int rc = 0;
345 345
346 - /* get_order(0) is undefined and exceeds MAX_PAGE_ORDER. */
347 - if (!nr_pages)
348 - return -EINVAL;
349 -
350 346 /*
351 347 * Ignore alignment since this is already going to be page aligned
352 348 * and there's no need for any larger alignment.