diff options
author | Linaro CI <ci_notify@linaro.org> | 2021-11-19 16:27:13 +0000 |
---|---|---|
committer | Linaro CI <ci_notify@linaro.org> | 2021-11-19 16:27:13 +0000 |
commit | f898f961d15dd2a0359d25a9d087f719a842738a (patch) | |
tree | 2354dfe57a7a98eb5145c0aeb8848f864ae902ae | |
parent | 920ce281a700f3a77dd6030fbcddd91765414fbd (diff) | |
parent | 5bf326c2b35aa0cd75208531a14ae6a17e532deb (diff) |
Merge remote-tracking branch 'sdm845-dp/tracking-qcomlt-sdm845-dp' into integration-linux-qcomlt
# Conflicts:
# arch/arm64/boot/dts/qcom/sdm845-db845c.dts
# arch/arm64/boot/dts/qcom/sdm845.dtsi
# drivers/phy/qualcomm/phy-qcom-qmp.c
-rw-r--r-- | arch/arm64/boot/dts/qcom/sdm845-db845c.dts | 11 | ||||
-rw-r--r-- | arch/arm64/boot/dts/qcom/sdm845.dtsi | 103 | ||||
-rw-r--r-- | drivers/phy/qualcomm/phy-qcom-qmp.c | 12 | ||||
-rw-r--r-- | drivers/usb/typec/mux/Kconfig | 7 | ||||
-rw-r--r-- | drivers/usb/typec/mux/Makefile | 1 | ||||
-rw-r--r-- | drivers/usb/typec/mux/gpio_aux_switch.c | 91 |
6 files changed, 216 insertions, 9 deletions
diff --git a/arch/arm64/boot/dts/qcom/sdm845-db845c.dts b/arch/arm64/boot/dts/qcom/sdm845-db845c.dts index 13f80a0b6faa..85a5ea2f1102 100644 --- a/arch/arm64/boot/dts/qcom/sdm845-db845c.dts +++ b/arch/arm64/boot/dts/qcom/sdm845-db845c.dts @@ -491,6 +491,17 @@ status = "okay"; }; +&mdss_mdp { + status = "okay"; +}; + +&msm_dp { + status = "okay"; + data-lanes = <0 1>; + vdda-1p2-supply = <&vreg_l26a_1p2>; + vdda-0p9-supply = <&vreg_l1a_0p875>; +}; + &mss_pil { status = "okay"; firmware-name = "qcom/sdm845/mba.mbn", "qcom/sdm845/modem.mbn"; diff --git a/arch/arm64/boot/dts/qcom/sdm845.dtsi b/arch/arm64/boot/dts/qcom/sdm845.dtsi index 526087586ba4..3b68ab7baf47 100644 --- a/arch/arm64/boot/dts/qcom/sdm845.dtsi +++ b/arch/arm64/boot/dts/qcom/sdm845.dtsi @@ -3709,9 +3709,10 @@ }; usb_1_qmpphy: phy@88e9000 { - compatible = "qcom,sdm845-qmp-usb3-phy"; + compatible = "qcom,sdm845-qmp-usb3-dp-phy"; reg = <0 0x088e9000 0 0x18c>, - <0 0x088e8000 0 0x10>; + <0 0x088e8000 0 0x38>, + <0 0x088ea000 0 0x40>; status = "disabled"; #address-cells = <2>; #size-cells = <2>; @@ -3723,11 +3724,11 @@ <&gcc GCC_USB3_PRIM_PHY_COM_AUX_CLK>; clock-names = "aux", "cfg_ahb", "ref", "com_aux"; - resets = <&gcc GCC_USB3_DP_PHY_PRIM_BCR>, - <&gcc GCC_USB3_PHY_PRIM_BCR>; + resets = <&gcc GCC_USB3_PHY_PRIM_BCR>, + <&gcc GCC_USB3_DP_PHY_PRIM_BCR>; reset-names = "phy", "common"; - usb_1_ssphy: phy@88e9200 { + usb_1_ssphy: usb3-phy@88e9200 { reg = <0 0x088e9200 0 0x128>, <0 0x088e9400 0 0x200>, <0 0x088e9c00 0 0x218>, @@ -3740,6 +3741,16 @@ clock-names = "pipe0"; clock-output-names = "usb3_phy_pipe_clk_src"; }; + + dp_phy: dp-phy@88ea200 { + reg = <0 0x088ea200 0 0x200>, + <0 0x088ea400 0 0x200>, + <0 0x088eaa00 0 0x200>, + <0 0x088ea600 0 0x200>, + <0 0x088ea800 0 0x200>; + #clock-cells = <1>; + #phy-cells = <0>; + }; }; usb_2_qmpphy: phy@88eb000 { @@ -4230,13 +4241,20 @@ port@0 { reg = <0>; - dpu_intf1_out: endpoint { - remote-endpoint = <&dsi0_in>; + dpu_intf0_out: endpoint { + remote-endpoint = <&dp_in>; }; }; port@1 { reg = <1>; + dpu_intf1_out: endpoint { + remote-endpoint = <&dsi0_in>; + }; + }; + + port@2 { + reg = <2>; dpu_intf2_out: endpoint { remote-endpoint = <&dsi1_in>; }; @@ -4268,6 +4286,73 @@ }; }; + msm_dp: displayport-controller@ae90000 { + status = "disabled"; + compatible = "qcom,sc7180-dp"; + + reg = <0 0x0ae90000 0 0x1400>; + + interrupt-parent = <&mdss>; + interrupts = <12>; + + clocks = <&dispcc DISP_CC_MDSS_AHB_CLK>, + <&dispcc DISP_CC_MDSS_DP_AUX_CLK>, + <&dispcc DISP_CC_MDSS_DP_LINK_CLK>, + <&dispcc DISP_CC_MDSS_DP_LINK_INTF_CLK>, + <&dispcc DISP_CC_MDSS_DP_PIXEL_CLK>; + clock-names = "core_iface", "core_aux", "ctrl_link", + "ctrl_link_iface", "stream_pixel"; + #clock-cells = <1>; + assigned-clocks = <&dispcc DISP_CC_MDSS_DP_LINK_CLK_SRC>, + <&dispcc DISP_CC_MDSS_DP_PIXEL_CLK_SRC>; + assigned-clock-parents = <&dp_phy 0>, <&dp_phy 1>; + phys = <&dp_phy>; + phy-names = "dp"; + + operating-points-v2 = <&dp_opp_table>; + power-domains = <&rpmhpd SDM845_CX>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + port@0 { + reg = <0>; + dp_in: endpoint { + remote-endpoint = <&dpu_intf0_out>; + }; + }; + + port@1 { + reg = <1>; + dp_out: endpoint { }; + }; + }; + + dp_opp_table: dp-opp-table { + compatible = "operating-points-v2"; + + opp-162000000 { + opp-hz = /bits/ 64 <162000000>; + required-opps = <&rpmhpd_opp_low_svs>; + }; + + opp-270000000 { + opp-hz = /bits/ 64 <270000000>; + required-opps = <&rpmhpd_opp_svs>; + }; + + opp-540000000 { + opp-hz = /bits/ 64 <540000000>; + required-opps = <&rpmhpd_opp_svs_l1>; + }; + + opp-810000000 { + opp-hz = /bits/ 64 <810000000>; + required-opps = <&rpmhpd_opp_nom>; + }; + }; + }; + dsi0: dsi@ae94000 { compatible = "qcom,mdss-dsi-ctrl"; reg = <0 0x0ae94000 0 0x400>; @@ -4560,8 +4645,8 @@ <&dsi0_phy 1>, <&dsi1_phy 0>, <&dsi1_phy 1>, - <0>, - <0>; + <&dp_phy 0>, + <&dp_phy 1>; clock-names = "bi_tcxo", "gcc_disp_gpll0_clk_src", "gcc_disp_gpll0_div_clk_src", diff --git a/drivers/phy/qualcomm/phy-qcom-qmp.c b/drivers/phy/qualcomm/phy-qcom-qmp.c index 456a59d8c7d0..02db38bf8c94 100644 --- a/drivers/phy/qualcomm/phy-qcom-qmp.c +++ b/drivers/phy/qualcomm/phy-qcom-qmp.c @@ -3550,6 +3550,11 @@ static const struct qmp_phy_combo_cfg sc7180_usb3dpphy_cfg = { .dp_cfg = &sc7180_dpphy_cfg, }; +static const struct qmp_phy_combo_cfg sdm845_usb3dpphy_cfg = { + .usb_cfg = &qmp_v3_usb3phy_cfg, + .dp_cfg = &sc7180_dpphy_cfg, +}; + static const struct qmp_phy_cfg qmp_v3_usb3_uniphy_cfg = { .type = PHY_TYPE_USB3, .nlanes = 1, @@ -5692,6 +5697,9 @@ static const struct of_device_id qcom_qmp_phy_of_match_table[] = { .compatible = "qcom,sdm845-qmp-usb3-uni-phy", .data = &qmp_v3_usb3_uniphy_cfg, }, { + .compatible = "qcom,sdm845-qmp-usb3-dp-phy", + /* It's a combo phy */ + }, { .compatible = "qcom,sdm845-qmp-ufs-phy", .data = &sdm845_ufsphy_cfg, }, { @@ -5766,6 +5774,10 @@ static const struct of_device_id qcom_qmp_combo_phy_of_match_table[] = { .compatible = "qcom,sc8180x-qmp-usb3-dp-phy", .data = &sc8180x_usb3dpphy_cfg, }, + { + .compatible = "qcom,sdm845-qmp-usb3-dp-phy", + .data = &sdm845_usb3dpphy_cfg, + }, { } }; diff --git a/drivers/usb/typec/mux/Kconfig b/drivers/usb/typec/mux/Kconfig index edead555835e..087981d59f9f 100644 --- a/drivers/usb/typec/mux/Kconfig +++ b/drivers/usb/typec/mux/Kconfig @@ -19,4 +19,11 @@ config TYPEC_MUX_INTEL_PMC control the USB role switch and also the multiplexer/demultiplexer switches used with USB Type-C Alternate Modes. +config TYPEC_MUX_GPIO + tristate "GPIO DP aux switch" + depends on I2C + help + Driver for GPIO-controlled DP aux switch, to flip DP aux lanes + when orientation changes. + endmenu diff --git a/drivers/usb/typec/mux/Makefile b/drivers/usb/typec/mux/Makefile index 280a6f553115..4aeebe4df61f 100644 --- a/drivers/usb/typec/mux/Makefile +++ b/drivers/usb/typec/mux/Makefile @@ -2,3 +2,4 @@ obj-$(CONFIG_TYPEC_MUX_PI3USB30532) += pi3usb30532.o obj-$(CONFIG_TYPEC_MUX_INTEL_PMC) += intel_pmc_mux.o +obj-$(CONFIG_TYPEC_MUX_GPIO) += gpio_aux_switch.o diff --git a/drivers/usb/typec/mux/gpio_aux_switch.c b/drivers/usb/typec/mux/gpio_aux_switch.c new file mode 100644 index 000000000000..6236b2a0b702 --- /dev/null +++ b/drivers/usb/typec/mux/gpio_aux_switch.c @@ -0,0 +1,91 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Driver for GPIO controlled aux switch + * + * Copyright (C) 2020 The Linux Foundation + */ + +#include <linux/gpio.h> +#include <linux/module.h> +#include <linux/platform_device.h> +#include <linux/usb/typec_dp.h> +#include <linux/usb/typec_mux.h> +#include <linux/usb/pd.h> + +struct gpio_aux_switch { + struct typec_mux *typec_mux; + struct gpio_desc *gpio_en, *gpio_cc; +}; + +static int gpio_typec_mux_set(struct typec_mux *mux, struct typec_mux_state *state) +{ + struct gpio_aux_switch *gas = typec_mux_get_drvdata(mux); + bool enable = false, reverse = false; + + if (!state->alt) + return 0; + + if (typec_altmode_get_orientation(state->alt) == TYPEC_ORIENTATION_REVERSE) + reverse = true; + + if (state->alt->svid == USB_TYPEC_DP_SID && state->alt->active) + enable = true; + + gpiod_set_value(gas->gpio_en, !enable); + gpiod_set_value(gas->gpio_cc, reverse); + + return 0; +} + +static int gpio_aux_switch_probe(struct platform_device *pdev) +{ + struct typec_mux_desc mux_desc = { }; + struct device *dev = &pdev->dev; + struct gpio_aux_switch *gas; + + gas = devm_kzalloc(dev, sizeof(*gas), GFP_KERNEL); + if (!gas) + return -ENOMEM; + + gas->gpio_en = devm_gpiod_get(dev, "enable", GPIOD_OUT_HIGH); + gas->gpio_cc = devm_gpiod_get(dev, "cc", GPIOD_OUT_LOW); + + mux_desc.fwnode = dev->fwnode; + mux_desc.drvdata = gas; + mux_desc.set = gpio_typec_mux_set; + gas->typec_mux = typec_mux_register(dev, &mux_desc); + if (IS_ERR(gas->typec_mux)) + return PTR_ERR(gas->typec_mux); + + platform_set_drvdata(pdev, gas); + + return 0; +} + +static int gpio_aux_switch_remove(struct platform_device *pdev) +{ + struct gpio_aux_switch *gas = platform_get_drvdata(pdev); + + typec_mux_unregister(gas->typec_mux); + + return 0; +} + +static const struct of_device_id gpio_aux_switch_dt_match[] = { + { .compatible = "gpio-aux-switch" }, + { } +}; + +static struct platform_driver gpio_aux_switch_driver = { + .driver = { + .name = "gpio-aux-switch", + .of_match_table = gpio_aux_switch_dt_match, + }, + .probe = gpio_aux_switch_probe, + .remove = gpio_aux_switch_remove, +}; + +module_platform_driver(gpio_aux_switch_driver); + +MODULE_LICENSE("GPL v2"); +MODULE_DESCRIPTION("GPIO AUX Switch driver"); |