diff --git a/arch/arm64/boot/dts/qcom/Makefile b/arch/arm64/boot/dts/qcom/Makefile index 48b0fd495c38bb..3e61ce39247935 100644 --- a/arch/arm64/boot/dts/qcom/Makefile +++ b/arch/arm64/boot/dts/qcom/Makefile @@ -257,6 +257,7 @@ dtb-$(CONFIG_ARCH_QCOM) += sm7150-xiaomi-surya-huaxing.dtb dtb-$(CONFIG_ARCH_QCOM) += sm7150-xiaomi-surya-tianma.dtb dtb-$(CONFIG_ARCH_QCOM) += sm7150-xiaomi-sweet.dtb dtb-$(CONFIG_ARCH_QCOM) += sm7150-xiaomi-tucana.dtb +dtb-$(CONFIG_ARCH_QCOM) += sm7150-samsung-a715f.dtb dtb-$(CONFIG_ARCH_QCOM) += sm7225-fairphone-fp4.dtb dtb-$(CONFIG_ARCH_QCOM) += sm7325-nothing-spacewar.dtb dtb-$(CONFIG_ARCH_QCOM) += sm8150-hdk.dtb diff --git a/arch/arm64/boot/dts/qcom/sm7150-samsung-a715f.dts b/arch/arm64/boot/dts/qcom/sm7150-samsung-a715f.dts new file mode 100644 index 00000000000000..234f4d17f76be7 --- /dev/null +++ b/arch/arm64/boot/dts/qcom/sm7150-samsung-a715f.dts @@ -0,0 +1,1031 @@ +// SPDX-License-Identifier: BSD-3-Clause +/* + * Copyright (c) 2023, Danila Tikhonov + * Copyright (c) 2025, Waldemar Tomme + */ + +/dts-v1/; + +#include +#include +#include +#include +#include +#include +#include + +#include "sm7150.dtsi" +#include "pm6150.dtsi" +#include "pm6150l.dtsi" + +/delete-node/ &camera_mem; +/delete-node/ &mpss_mem; +/delete-node/ &venus_mem; +/delete-node/ &cdsp_mem; +/delete-node/ &adsp_mem; +/delete-node/ &wlan_msa_mem; +/delete-node/ &npu_mem; +/delete-node/ &ipa_fw_mem; +/delete-node/ &ipa_gsi_mem; +/delete-node/ &gpu_mem; +/delete-node/ &sec_cdsp_mem; + +/* Increase the size */ +&tz_mem { + reg = <0x0 0x86200000 0x0 0x5600000>; +}; + +&qseecom_mem { + reg = <0x0 0x9e400000 0x0 0x2400000>; +}; + +/ { + model = "Samsung Galaxy A71"; + compatible = "samsung,a715f", "qcom,sm7150"; + chassis-type = "handset"; + + aliases { + bluetooth0 = &bluetooth; + hsuart0 = &uart3; + wifi0 = &wifi; + }; + + battery: battery { + compatible = "simple-battery"; + + voltage-min-design-microvolt = <3400000>; + voltage-max-design-microvolt = <4400000>; + charge-full-design-microamp-hours = <4500000>; + }; + + chosen { + #address-cells = <2>; + #size-cells = <2>; + ranges; + framebuffer@9c000000 { + compatible = "simple-framebuffer"; + reg = <0x0 0x9c000000 0x0 (1080 * 2400 * 4)>; + width = <1080>; + height = <2400>; + stride = <(1080 * 4)>; + format = "a8r8g8b8"; + clocks = <&gcc GCC_DISP_HF_AXI_CLK>; + }; + }; + + gpio_keys: gpio-keys { + compatible = "gpio-keys"; + pinctrl-names = "default"; + pinctrl-0 = <&vol_up_n>; + + key-volume-up { + label = "Volume Up"; + linux,code = ; + gpios = <&pm6150l_gpios 2 GPIO_ACTIVE_LOW>; + debounce-interval = <15>; + }; + }; + + reserved-memory { + camera_mem: memory@8cb00000 { + reg = <0x0 0x8cb00000 0x0 0x500000>; + no-map; + }; + + mpss_mem: memory@8d000000 { + reg = <0x0 0x8d000000 0x0 0x8c00000>; + no-map; + }; + + venus_mem: memory@95c00000 { + reg = <0x0 0x95c00000 0x0 0x500000>; + no-map; + }; + + cdsp_mem: memory@96100000 { + reg = <0x0 0x96100000 0x0 0x1e00000>; + no-map; + }; + + adsp_mem: memory@97f00000 { + reg = <0x0 0x97f00000 0x0 0x2800000>; + no-map; + }; + + wlan_msa_mem: memory@9a700000 { + reg = <0x0 0x9a700000 0x0 0x180000>; + no-map; + }; + + npu_mem: memory@9a880000 { + reg = <0x0 0x9a880000 0x0 0x80000>; + no-map; + }; + + ipa_fw_mem: memory@9a900000 { + reg = <0x0 0x9a900000 0x0 0x10000>; + no-map; + }; + + ipa_gsi_mem: memory@9a910000 { + reg = <0x0 0x9a910000 0x0 0x5000>; + no-map; + }; + + gpu_mem: memory@9a915000 { + reg = <0x0 0x9a915000 0x0 0x2000>; + no-map; + }; + + framebuffer_region@9c000000 { + reg = <0x0 0x9c000000 0x0 (1080 * 2400 * 4)>; + no-map; + }; + + ramoops@a1300000 { + compatible = "ramoops"; + reg = <0x0 0xa1300000 0x0 0x100000>; + + record-size = <0x40000>; + pmsg-size = <0x40000>; + console-size = <0x40000>; + }; + + sec_cdsp_mem: memory@a4000000 { + reg = <0x0 0xa4000000 0x0 0xc00000>; + no-map; + }; + + rmtfs_mem: memory@fe301000 { + compatible = "qcom,rmtfs-mem"; + reg = <0 0xfe301000 0 0x200000>; + no-map; + + qcom,client-id = <1>; + qcom,vmid = <15>; + }; + }; + + vph_pwr: vph-pwr-regulator { + compatible = "regulator-fixed"; + regulator-name = "vph_pwr"; + regulator-min-microvolt = <3700000>; + regulator-max-microvolt = <3700000>; + }; + + // S3A is really mx.lvl but it's there for supply map completeness sake. + vreg_s3a_0p8: smpa3-regulator { + compatible = "regulator-fixed"; + regulator-name = "vreg_s3a_0p8"; + + regulator-min-microvolt = <800000>; + regulator-max-microvolt = <800000>; + regulator-always-on; + vin-supply = <&vph_pwr>; + }; +}; + +&apps_rsc { + regulators-0 { + compatible = "qcom,pm6150-rpmh-regulators"; + qcom,pmic-id = "a"; + + vdd-s1-supply = <&vph_pwr>; + vdd-s2-supply = <&vph_pwr>; + vdd-s3-supply = <&vph_pwr>; + vdd-s4-supply = <&vph_pwr>; + vdd-s5-supply = <&vph_pwr>; + + vdd-l1-supply = <&vreg_s8c_1p35>; + vdd-l2-l3-supply = <&vreg_s4a_1p1>; + vdd-l4-l7-l8-supply = <&vreg_s4a_1p1>; + vdd-l5-l16-l17-l18-l19-supply = <&vreg_bob>; + vdd-l6-supply = <&vreg_s8c_1p35>; + vdd-l9-supply = <&vreg_s3a_0p8>; + vdd-l10-l14-l15-supply = <&vreg_s5a_2p0>; + vdd-l11-l12-l13-supply = <&vreg_s5a_2p0>; + + vreg_s4a_1p1: smps4 { + regulator-name = "vreg_s4a_1p1"; + regulator-min-microvolt = <824000>; + regulator-max-microvolt = <1120000>; + }; + + vreg_s5a_2p0: smps5 { + regulator-name = "vreg_s5a_2p0"; + regulator-min-microvolt = <1744000>; + regulator-max-microvolt = <2040000>; + }; + + vreg_l1a_1p2: ldo1 { + regulator-name = "vreg_l1a_1p2"; + regulator-min-microvolt = <1096000>; + regulator-max-microvolt = <1304000>; + regulator-initial-mode = ; + regulator-allow-set-load; + regulator-allowed-modes = ; + }; + + vreg_l2a_1p0: ldo2 { + regulator-name = "vreg_l2a_1p0"; + regulator-min-microvolt = <944000>; + regulator-max-microvolt = <1056000>; + regulator-initial-mode = ; + regulator-allow-set-load; + regulator-allowed-modes = ; + }; + + vreg_l3a_1p0: ldo3 { + regulator-name = "vreg_l3a_1p0"; + regulator-min-microvolt = <968000>; + regulator-max-microvolt = <1064000>; + regulator-initial-mode = ; + regulator-allow-set-load; + regulator-allowed-modes = ; + }; + + vreg_l4a_0p88: ldo4 { + regulator-name = "vreg_l4a_0p88"; + regulator-min-microvolt = <824000>; + regulator-max-microvolt = <920000>; + regulator-initial-mode = ; + regulator-allow-set-load; + regulator-allowed-modes = ; + }; + + vreg_l5a_2p7: ldo5 { + regulator-name = "vreg_l5a_2p7"; + regulator-min-microvolt = <2600000>; + regulator-max-microvolt = <2800000>; + regulator-initial-mode = ; + regulator-allow-set-load; + regulator-allowed-modes = ; + }; + + vreg_l6a_1p2: ldo6 { + regulator-name = "vreg_l6a_1p2"; + regulator-min-microvolt = <1096000>; + regulator-max-microvolt = <1304000>; + regulator-initial-mode = ; + regulator-allow-set-load; + regulator-allowed-modes = ; + }; + + vreg_l9a_0p8: ldo9 { + regulator-name = "vreg_l9a_0p8"; + regulator-min-microvolt = <624000>; + regulator-max-microvolt = <760000>; + regulator-initial-mode = ; + regulator-allow-set-load; + regulator-allowed-modes = ; + }; + + vreg_l10a_1p8: ldo10 { + regulator-name = "vreg_l10a_1p8"; + regulator-min-microvolt = <1720000>; + regulator-max-microvolt = <1832000>; + regulator-initial-mode = ; + regulator-allow-set-load; + regulator-allowed-modes = ; + }; + + vreg_l11a_1p8: ldo11 { + regulator-name = "vreg_l11a_1p8"; + regulator-min-microvolt = <1696000>; + regulator-max-microvolt = <1984000>; + regulator-initial-mode = ; + regulator-allow-set-load; + regulator-allowed-modes = ; + }; + + vreg_l12a_1p8: ldo12 { + regulator-name = "vreg_l12a_1p8"; + regulator-min-microvolt = <1696000>; + regulator-max-microvolt = <1952000>; + regulator-initial-mode = ; + regulator-allow-set-load; + regulator-allowed-modes = ; + }; + + vreg_l13a_1p8: ldo13 { + regulator-name = "vreg_l13a_1p8"; + regulator-min-microvolt = <1696000>; + regulator-max-microvolt = <1904000>; + regulator-initial-mode = ; + regulator-allow-set-load; + regulator-allowed-modes = ; + }; + + vreg_l14a_1p8: ldo14 { + regulator-name = "vreg_l14a_1p8"; + regulator-min-microvolt = <1720000>; + regulator-max-microvolt = <1856000>; + regulator-initial-mode = ; + regulator-allow-set-load; + regulator-allowed-modes = ; + }; + + vreg_l15a_1p8: ldo15 { + regulator-name = "vreg_l15a_1p8"; + regulator-min-microvolt = <1696000>; + regulator-max-microvolt = <1904000>; + regulator-initial-mode = ; + regulator-allow-set-load; + regulator-allowed-modes = ; + }; + + vreg_l16a_2p8: ldo16 { + regulator-name = "vreg_l16a_2p8"; + regulator-min-microvolt = <2424000>; + regulator-max-microvolt = <2976000>; + regulator-initial-mode = ; + regulator-allow-set-load; + regulator-allowed-modes = ; + }; + + vreg_l17a_3p1: ldo17 { + regulator-name = "vreg_l17a_3p1"; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3232000>; + regulator-initial-mode = ; + regulator-allow-set-load; + regulator-allowed-modes = ; + }; + + vreg_l18a_2p8: ldo18 { + regulator-name = "vreg_l18a_2p8"; + regulator-min-microvolt = <2800000>; + regulator-max-microvolt = <3000000>; + regulator-initial-mode = ; + regulator-allow-set-load; + regulator-allowed-modes = ; + }; + + vreg_l19a_2p85: ldo19 { + regulator-name = "vreg_l19a_2p85"; + regulator-min-microvolt = <2944000>; + regulator-max-microvolt = <3304000>; + regulator-initial-mode = ; + regulator-allow-set-load; + regulator-allowed-modes = ; + }; + }; + + regulators-1 { + compatible = "qcom,pm6150l-rpmh-regulators"; + qcom,pmic-id = "c"; + + vdd-s1-supply = <&vph_pwr>; + vdd-s2-supply = <&vph_pwr>; + vdd-s3-supply = <&vph_pwr>; + vdd-s4-supply = <&vph_pwr>; + vdd-s5-supply = <&vph_pwr>; + vdd-s6-supply = <&vph_pwr>; + vdd-s7-supply = <&vph_pwr>; + vdd-s8-supply = <&vph_pwr>; + + vdd-l2-l3-supply = <&vreg_s8c_1p35>; + vdd-l4-l5-l6-supply = <&vreg_bob>; + vdd-l7-l11-supply = <&vreg_bob>; + vdd-l9-l10-supply = <&vreg_bob>; + + vdd-bob-supply = <&vph_pwr>; + vdd-flash-supply = <&vreg_bob>; + vdd-rgb-supply = <&vreg_bob>; + + vreg_s1c_1p13: smps1 { + regulator-name = "vreg_s1c_1p13"; + regulator-min-microvolt = <1000000>; + regulator-max-microvolt = <1200000>; + }; + + vreg_s8c_1p35: smps8 { + regulator-name = "vreg_s8c_1p35"; + regulator-min-microvolt = <1120000>; + regulator-max-microvolt = <1408000>; + }; + + vreg_l1c_1p8: ldo1 { + regulator-name = "vreg_l1c_1p8"; + regulator-min-microvolt = <1616000>; + regulator-max-microvolt = <1984000>; + regulator-initial-mode = ; + regulator-allow-set-load; + regulator-allowed-modes = ; + }; + + vreg_l2c_1p3: ldo2 { + regulator-name = "vreg_l2c_1p3"; + regulator-min-microvolt = <1200000>; + regulator-max-microvolt = <1352000>; + regulator-initial-mode = ; + regulator-allow-set-load; + regulator-allowed-modes = ; + }; + + vreg_l3c_1p23: ldo3 { + regulator-name = "vreg_l3c_1p23"; + regulator-min-microvolt = <1144000>; + regulator-max-microvolt = <1256000>; + regulator-initial-mode = ; + regulator-allow-set-load; + regulator-allowed-modes = ; + }; + + vreg_l4c_1p8: ldo4 { + regulator-name = "vreg_l4c_1p8"; + regulator-min-microvolt = <1648000>; + regulator-max-microvolt = <2950000>; + regulator-initial-mode = ; + regulator-allow-set-load; + regulator-allowed-modes = ; + }; + + vreg_l5c_1p8: ldo5 { + regulator-name = "vreg_l5c_1p8"; + regulator-min-microvolt = <1648000>; + regulator-max-microvolt = <2950000>; + regulator-initial-mode = ; + regulator-allow-set-load; + regulator-allowed-modes = ; + }; + + vreg_l6c_3p0: ldo6 { + regulator-name = "vreg_l6c_3p0"; + regulator-min-microvolt = <1648000>; + regulator-max-microvolt = <3100000>; + regulator-initial-mode = ; + regulator-allow-set-load; + regulator-allowed-modes = ; + }; + + vreg_l7c_3p0: ldo7 { + regulator-name = "vreg_l7c_3p0"; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3312000>; + regulator-initial-mode = ; + regulator-allow-set-load; + regulator-allowed-modes = ; + }; + + vreg_l8c_1p8: ldo8 { + regulator-name = "vreg_l8c_1p8"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1900000>; + regulator-initial-mode = ; + regulator-allow-set-load; + regulator-allowed-modes = ; + }; + + /* + * Downstream specifies a range of 2950-3312mV. + * Tighten the range to 2950-3100mV. + */ + vreg_l9c_3p1: ldo9 { + regulator-name = "vreg_l9c_3p1"; + regulator-min-microvolt = <2950000>; + regulator-max-microvolt = <3100000>; + regulator-initial-mode = ; + regulator-allow-set-load; + regulator-allowed-modes = ; + }; + + vreg_l10c_3p3: ldo10 { + regulator-name = "vreg_l10c_3p3"; + regulator-min-microvolt = <3200000>; + regulator-max-microvolt = <3312000>; + regulator-initial-mode = ; + regulator-allow-set-load; + regulator-allowed-modes = ; + }; + + vreg_l11c_3p3: ldo11 { + regulator-name = "vreg_l11c_3p3"; + regulator-min-microvolt = <2950000>; + regulator-max-microvolt = <3400000>; + regulator-initial-mode = ; + regulator-allow-set-load; + regulator-allowed-modes = ; + }; + + vreg_bob: bob { + regulator-name = "vreg_bob"; + regulator-min-microvolt = <3296000>; + regulator-max-microvolt = <3960000>; + regulator-initial-mode = ; + regulator-allow-bypass; + }; + }; +}; + +&gpi_dma0 { + status = "okay"; +}; + +&gpi_dma1 { + status = "okay"; +}; + +&gpu { + zap-shader { + firmware-name = "qcom/sm7150/samsung/a715f/a615_zap.mbn"; + }; +}; + +&i2c0 { + clock-frequency = <100000>; + status = "okay"; + + // tas2562@4c +}; + +&i2c2 { + clock-frequency = <1000000>; + status = "okay"; + + // nq@28 + // pn547@2B +}; + +&i2c7 { + clock-frequency = <100000>; + status = "okay"; + + // st_fts@49 + // synaptics_dsx@20 + // touchscreen@48 +}; + +// NOTE: i2c9 is enabled downstream but no device is connected + +&ipa { + memory-region = <&ipa_fw_mem>; + firmware-name = "qcom/sm7150/samsung/a715f/ipa_fws.mbn"; + status = "okay"; +}; + +&mdss { + status = "okay"; +}; + +&mdss_dsi0 { + vdda-supply = <&vreg_l3c_1p23>; + status = "okay"; + + panel@0 { + compatible = "samsung,s6e3fa9-amb667um06-a715f", "samsung,s6e3fa9-amb667um06"; + reg = <0>; + + /* + * In the downstream kernel pin 11 of &tlmm is used for resetting the display. + * If it's actually set here then the display will turn off as soon as the pin is set to LOW and apparently it won't turn on again. + * If it's not set at all the display won't show anything because reset-gpios is required by the driver. + */ + reset-gpios = <&tlmm 11 GPIO_ACTIVE_HIGH>; + + pinctrl-names = "default", "suspend"; + pinctrl-0 = <&sde_te_active &sde_dsi_active &sde_esd_active &sde_ub_det_active>; + pinctrl-1 = <&sde_te_suspend &sde_dsi_suspend &sde_esd_suspend &sde_ub_det_suspend>; + + vddio-supply = <&vreg_l13a_1p8>; + vdd3p3-supply = <&vreg_l18a_2p8>; + + port { + panel_in: endpoint { + remote-endpoint = <&mdss_dsi0_out>; + }; + }; + }; +}; + +&mdss_dsi0_out { + data-lanes = <0 1 2 3>; + remote-endpoint = <&panel_in>; + status = "okay"; +}; + +&mdss_dsi0_phy { + status = "okay"; +}; + +&pm6150_qgauge { + monitored-battery = <&battery>; + status = "okay"; +}; + +&pm6150_resin { + linux,code = ; + status = "okay"; +}; + +&pm6150_rtc { + status = "okay"; +}; + +&pm6150_typec { + vdd-vbus-supply = <&pm6150_vbus>; + vdd-pdphy-supply = <&vreg_l17a_3p1>; + status = "okay"; + + connector { + compatible = "usb-c-connector"; + + power-role = "source"; + data-role = "dual"; + self-powered; + + source-pdos = ; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + pm6150_role_switch_in: endpoint { + remote-endpoint = <&usb_1_dwc3_hs>; + }; + }; + }; + }; +}; + +&pm6150_vbus { + regulator-min-microamp = <500000>; + regulator-max-microamp = <3000000>; + status = "okay"; +}; + +&pm6150l_gpios { + vol_up_n: vol-up-n-state { + pins = "gpio2"; + function = PMIC_GPIO_FUNC_NORMAL; + input-enable; + bias-pull-up; + power-source = <0>; + }; +}; + +&qupv3_id_0 { + status = "okay"; +}; + +&qupv3_id_1 { + status = "okay"; +}; + +&remoteproc_adsp { + firmware-name = "qcom/sm7150/samsung/a715f/adsp.mbn"; + status = "okay"; +}; + +&remoteproc_cdsp { + firmware-name = "qcom/sm7150/samsung/a715f/cdsp.mbn"; + status = "okay"; +}; + +&remoteproc_mpss { + firmware-name = "qcom/sm7150/samsung/a715f/modem.mbn"; + status = "okay"; +}; + +&sdhc_2 { + cd-gpios = <&tlmm 69 GPIO_ACTIVE_HIGH>; + + vmmc-supply = <&vreg_l9c_3p1>; + vqmmc-supply = <&vreg_l6c_3p0>; + + pinctrl-names = "default", "sleep"; + pinctrl-0 = <&sdc2_on>; + pinctrl-1 = <&sdc2_off>; + + status = "okay"; +}; + +&tlmm { + /* + * gpio0, gpio1, gpio2, gpio3 -> spi1 -> ese_spi@0 + * gpio59, gpio60, gpio61, gpio62 -> spi6 -> etspi-spi@0 + * gpio83, gpio84 -> ??? // TODO: check downstream for pins + */ + gpio-reserved-ranges = <0 4>, <59 4>, <83 2>; + + gpio-line-names = + "", /* GPIO_0 */ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", /* GPIO_10 */ + "reset_gpio", + "", + "", + "", + "", + "", + "", + "", + "", + "", /* GPIO_20 */ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", /* GPIO_30 */ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", /* GPIO_40 */ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", /* GPIO_50 */ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", /* GPIO_60 */ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", /* GPIO_70 */ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", /* GPIO_80 */ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", /* GPIO_90 */ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", /* GPIO_100 */ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", /* GPIO_110 */ + "", + "", + "", + "", + "", + "", + "", + ""; + + sde_te_active: sde-te-state { + pins = "gpio10"; + function = "mdp_vsync"; + drive-strength = <2>; + bias-pull-down; + }; + + sde_te_suspend: sde-te-state { + pins = "gpio10"; + function = "mdp_vsync"; + drive-strength = <2>; + bias-pull-down; + }; + + sde_dsi_active: sde-dsi-state { + pins = "gpio11", "gpio64"; + function = "gpio"; + drive-strength = <8>; + bias-disable = <0>; + }; + + sde_dsi_suspend: sde-dsi-state { + pins = "gpio11", "gpio64"; + function = "gpio"; + drive-strength = <2>; + bias-pull-down; + }; + + sde_esd_active: sde-esd-state { + pins = "gpio63"; + function = "gpio"; + drive-strength = <8>; + bias-disable = <0>; + }; + + sde_esd_suspend: sde-esd-state { + pins = "gpio63"; + function = "gpio"; + drive-strength = <2>; + bias-pull-down; + }; + + sde_ub_det_active: sde-ub-det-state { + pins = "gpio66"; + function = "gpio"; + drive-strength = <2>; + bias-disable = <0>; + }; + + sde_ub_det_suspend: sde-ub-det-state { + pins = "gpio66"; + function = "gpio"; + drive-strength = <2>; + bias-disable = <0>; + }; + + sdc2_on: sdc2-on-state { + clk-pins { + pins = "sdc2_clk"; + bias-disable; + drive-strength = <16>; + }; + + cmd-pins { + pins = "sdc2_cmd"; + bias-pull-up; + drive-strength = <10>; + }; + + data-pins { + pins = "sdc2_data"; + bias-pull-up; + drive-strength = <10>; + }; + + sd-cd-pins { + pins = "gpio69"; + function = "gpio"; + bias-pull-up; + drive-strength = <2>; + }; + }; + + sdc2_off: sdc1-off-state { + clk-pins { + pins = "sdc2_clk"; + bias-disable; + drive-strength = <2>; + }; + + cmd-pins { + pins = "sdc2_cmd"; + bias-pull-up; + drive-strength = <2>; + }; + + data-pins { + pins = "sdc2_data"; + bias-pull-up; + drive-strength = <2>; + }; + + sd-cd-pins { + pins = "gpio69"; + function = "gpio"; + bias-pull-up; + drive-strength = <2>; + }; + }; +}; + +&uart3 { + /delete-property/interrupts; + interrupts-extended = <&intc GIC_SPI 604 IRQ_TYPE_LEVEL_HIGH>, + <&tlmm 41 IRQ_TYPE_EDGE_FALLING>; + pinctrl-names = "default", "sleep"; + pinctrl-1 = <&qup_uart3_default>; + status = "okay"; + + bluetooth: bluetooth { + compatible = "qcom,wcn3990-bt"; + + vddio-supply = <&vreg_l10a_1p8>; + vddxo-supply = <&vreg_l1c_1p8>; + vddrf-supply = <&vreg_l2c_1p3>; + vddch0-supply = <&vreg_l10c_3p3>; + max-speed = <3200000>; + }; +}; + +&ufs_mem_hc { + vcc-supply = <&vreg_l19a_2p85>; + vcc-max-microamp = <600000>; + vccq2-supply = <&vreg_l12a_1p8>; + vccq2-max-microamp = <600000>; + status = "okay"; +}; + +&ufs_mem_phy { + vdda-phy-supply = <&vreg_l4a_0p88>; + vdda-pll-supply = <&vreg_l3c_1p23>; + status = "okay"; +}; + +&usb_1 { + qcom,select-utmi-as-pipe-clk; + status = "okay"; +}; + +&usb_1_dwc3 { + dr_mode = "otg"; + usb-role-switch; + maximum-speed = "high-speed"; +}; + +&usb_1_dwc3_hs { + remote-endpoint = <&pm6150_role_switch_in>; +}; + +&usb_1_hsphy { + vdd-supply = <&vreg_l4a_0p88>; + vdda-pll-supply = <&vreg_l11a_1p8>; + vdda-phy-dpdm-supply = <&vreg_l17a_3p1>; + status = "okay"; +}; + +&venus { + firmware-name = "qcom/sm7150/samsung/a715f/venus.mbn"; +}; diff --git a/arch/arm64/configs/sm7150.config b/arch/arm64/configs/sm7150.config index 5c91b9dcfa0c80..94e80309f713ee 100644 --- a/arch/arm64/configs/sm7150.config +++ b/arch/arm64/configs/sm7150.config @@ -41,6 +41,9 @@ CONFIG_SND_SOC_TAS2562=m # Xiaomi Redmi Note 10 Pro (Sweet) CONFIG_DRM_PANEL_SAMSUNG_AMS667YR01=y +# Samsung Galaxy A71 (A715F) +CONFIG_DRM_PANEL_S6E3FA9_AMB667UM06_FHD=y + # SM7150 SoC CONFIG_INTERCONNECT_QCOM_OSM_L3=y CONFIG_INTERCONNECT_QCOM_SM7150=y diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig index 31618189255faa..5560ac7b6397a9 100644 --- a/drivers/gpu/drm/panel/Kconfig +++ b/drivers/gpu/drm/panel/Kconfig @@ -1062,4 +1062,14 @@ config DRM_PANEL_XINPENG_XPP055C272 Say Y here if you want to enable support for the Xinpeng XPP055C272 controller for 720x1280 LCD panels with MIPI/RGB/SPI system interfaces. + +config DRM_PANEL_S6E3FA9_AMB667UM06_FHD + tristate "S6E3FA9_AMB667UM06_FHD panel driver" + depends on OF + depends on DRM_MIPI_DSI + depends on BACKLIGHT_CLASS_DEVICE + help + Say Y here if you want to enable support for the + S6E3FA9_AMB667UM06_FHD controller for 1080x2400 LCD panels with MIPI/RGB/SPI + system interfaces. endmenu diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile index 4f665830769a1f..9c5b9ad406358f 100644 --- a/drivers/gpu/drm/panel/Makefile +++ b/drivers/gpu/drm/panel/Makefile @@ -108,3 +108,4 @@ obj-$(CONFIG_DRM_PANEL_VISIONOX_VTDR6130) += panel-visionox-vtdr6130.o obj-$(CONFIG_DRM_PANEL_VISIONOX_R66451) += panel-visionox-r66451.o obj-$(CONFIG_DRM_PANEL_WIDECHIPS_WS2401) += panel-widechips-ws2401.o obj-$(CONFIG_DRM_PANEL_XINPENG_XPP055C272) += panel-xinpeng-xpp055c272.o +obj-$(CONFIG_DRM_PANEL_S6E3FA9_AMB667UM06_FHD) += panel-s6e3fa9-amb667um06.o diff --git a/drivers/gpu/drm/panel/panel-s6e3fa9-amb667um06.c b/drivers/gpu/drm/panel/panel-s6e3fa9-amb667um06.c new file mode 100644 index 00000000000000..743ec37641de2b --- /dev/null +++ b/drivers/gpu/drm/panel/panel-s6e3fa9-amb667um06.c @@ -0,0 +1,267 @@ +// SPDX-License-Identifier: GPL-2.0-only +// Copyright (c) 2024 FIXME +// Generated with linux-mdss-dsi-panel-driver-generator from vendor device tree: +// Copyright (c) 2013, The Linux Foundation. All rights reserved. (FIXME) + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +struct s6e3fa9_amb667um06 { + struct drm_panel panel; + struct mipi_dsi_device *dsi; + struct gpio_desc *reset_gpio; +}; + +static inline +struct s6e3fa9_amb667um06 *to_s6e3fa9_amb667um06(struct drm_panel *panel) +{ + return container_of(panel, struct s6e3fa9_amb667um06, panel); +} + +static void s6e3fa9_amb667um06_reset(struct s6e3fa9_amb667um06 *ctx) +{ + gpiod_set_value_cansleep(ctx->reset_gpio, 1); + usleep_range(10000, 11000); + // TODO: disable this for now due to screen turning off ireversibly + // gpiod_set_value_cansleep(ctx->reset_gpio, 0); + // usleep_range(10000, 11000); +} + +static int s6e3fa9_amb667um06_on(struct s6e3fa9_amb667um06 *ctx) +{ + struct mipi_dsi_multi_context dsi_ctx = { .dsi = ctx->dsi }; + + ctx->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM; + + mipi_dsi_dcs_exit_sleep_mode_multi(&dsi_ctx); + mipi_dsi_usleep_range(&dsi_ctx, 10000, 11000); + mipi_dsi_generic_write_seq_multi(&dsi_ctx, 0xf0, 0x5a, 0x5a); + mipi_dsi_generic_write_seq_multi(&dsi_ctx, 0x35, 0x00); + mipi_dsi_generic_write_seq_multi(&dsi_ctx, 0xf0, 0xa5, 0xa5); + mipi_dsi_generic_write_seq_multi(&dsi_ctx, 0x2a, + 0x00, 0x00, 0x04, 0x37); + mipi_dsi_generic_write_seq_multi(&dsi_ctx, 0x2b, + 0x00, 0x00, 0x09, 0x5f); + mipi_dsi_generic_write_seq_multi(&dsi_ctx, 0xf0, 0x5a, 0x5a); + mipi_dsi_generic_write_seq_multi(&dsi_ctx, 0xfc, 0x5a, 0x5a); + mipi_dsi_generic_write_seq_multi(&dsi_ctx, 0xe5, 0x13); + mipi_dsi_generic_write_seq_multi(&dsi_ctx, 0xed, 0x00, 0x4c); + mipi_dsi_generic_write_seq_multi(&dsi_ctx, 0xf0, 0xa5, 0xa5); + mipi_dsi_generic_write_seq_multi(&dsi_ctx, 0xfc, 0xa5, 0xa5); + mipi_dsi_generic_write_seq_multi(&dsi_ctx, 0xf0, 0x5a, 0x5a); + mipi_dsi_generic_write_seq_multi(&dsi_ctx, 0xb9, + 0x00, 0x80, 0xe8, 0x09, 0x00, 0x00, + 0x00, 0x11, 0x03); + mipi_dsi_generic_write_seq_multi(&dsi_ctx, 0xf0, 0xa5, 0xa5); + + return dsi_ctx.accum_err; +} + +static int s6e3fa9_amb667um06_off(struct s6e3fa9_amb667um06 *ctx) +{ + struct mipi_dsi_multi_context dsi_ctx = { .dsi = ctx->dsi }; + + ctx->dsi->mode_flags |= MIPI_DSI_MODE_LPM; + + mipi_dsi_dcs_set_display_off_multi(&dsi_ctx); + mipi_dsi_msleep(&dsi_ctx, 20); + mipi_dsi_dcs_enter_sleep_mode_multi(&dsi_ctx); + mipi_dsi_msleep(&dsi_ctx, 120); + + return dsi_ctx.accum_err; +} + +static int s6e3fa9_amb667um06_prepare(struct drm_panel *panel) +{ + struct s6e3fa9_amb667um06 *ctx = to_s6e3fa9_amb667um06(panel); + struct device *dev = &ctx->dsi->dev; + int ret; + + s6e3fa9_amb667um06_reset(ctx); + + ret = s6e3fa9_amb667um06_on(ctx); + if (ret < 0) { + dev_err(dev, "Failed to initialize panel: %d\n", ret); + gpiod_set_value_cansleep(ctx->reset_gpio, 1); + return ret; + } + + return 0; +} + +static int s6e3fa9_amb667um06_unprepare(struct drm_panel *panel) +{ + struct s6e3fa9_amb667um06 *ctx = to_s6e3fa9_amb667um06(panel); + struct device *dev = &ctx->dsi->dev; + int ret; + + ret = s6e3fa9_amb667um06_off(ctx); + if (ret < 0) + dev_err(dev, "Failed to un-initialize panel: %d\n", ret); + + gpiod_set_value_cansleep(ctx->reset_gpio, 1); + + return 0; +} + +static const struct drm_display_mode s6e3fa9_amb667um06_mode = { + .clock = (1080 + 120 + 121 + 122) * (2400 + 248 + 2 + 16) * 60 / 1000, + .hdisplay = 1080, + .hsync_start = 1080 + 120, + .hsync_end = 1080 + 120 + 121, + .htotal = 1080 + 120 + 121 + 122, + .vdisplay = 2400, + .vsync_start = 2400 + 248, + .vsync_end = 2400 + 248 + 2, + .vtotal = 2400 + 248 + 2 + 16, + .width_mm = 70, + .height_mm = 155, + .type = DRM_MODE_TYPE_DRIVER, +}; + +static int s6e3fa9_amb667um06_get_modes(struct drm_panel *panel, + struct drm_connector *connector) +{ + return drm_connector_helper_get_modes_fixed(connector, &s6e3fa9_amb667um06_mode); +} + +static const struct drm_panel_funcs s6e3fa9_amb667um06_panel_funcs = { + .prepare = s6e3fa9_amb667um06_prepare, + .unprepare = s6e3fa9_amb667um06_unprepare, + .get_modes = s6e3fa9_amb667um06_get_modes, +}; + +static int s6e3fa9_amb667um06_bl_update_status(struct backlight_device *bl) +{ + struct mipi_dsi_device *dsi = bl_get_data(bl); + u16 brightness = backlight_get_brightness(bl); + int ret; + + dsi->mode_flags &= ~MIPI_DSI_MODE_LPM; + + ret = mipi_dsi_dcs_set_display_brightness_large(dsi, brightness); + if (ret < 0) + return ret; + + dsi->mode_flags |= MIPI_DSI_MODE_LPM; + + return 0; +} + +static int s6e3fa9_amb667um06_bl_get_brightness(struct backlight_device *bl) +{ + struct mipi_dsi_device *dsi = bl_get_data(bl); + u16 brightness; + int ret; + + dsi->mode_flags &= ~MIPI_DSI_MODE_LPM; + + ret = mipi_dsi_dcs_get_display_brightness_large(dsi, &brightness); + if (ret < 0) + return ret; + + dsi->mode_flags |= MIPI_DSI_MODE_LPM; + + return brightness; +} + +static const struct backlight_ops s6e3fa9_amb667um06_bl_ops = { + .update_status = s6e3fa9_amb667um06_bl_update_status, + .get_brightness = s6e3fa9_amb667um06_bl_get_brightness, +}; + +static struct backlight_device * +s6e3fa9_amb667um06_create_backlight(struct mipi_dsi_device *dsi) +{ + struct device *dev = &dsi->dev; + const struct backlight_properties props = { + .type = BACKLIGHT_RAW, + .brightness = 425, + .max_brightness = 425, + }; + + return devm_backlight_device_register(dev, dev_name(dev), dev, dsi, + &s6e3fa9_amb667um06_bl_ops, &props); +} + +static int s6e3fa9_amb667um06_probe(struct mipi_dsi_device *dsi) +{ + struct device *dev = &dsi->dev; + struct s6e3fa9_amb667um06 *ctx; + int ret; + + ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); + if (!ctx) + return -ENOMEM; + + ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH); + if (IS_ERR(ctx->reset_gpio)) + return dev_err_probe(dev, PTR_ERR(ctx->reset_gpio), + "Failed to get reset-gpios\n"); + + ctx->dsi = dsi; + mipi_dsi_set_drvdata(dsi, ctx); + + dsi->lanes = 4; + dsi->format = MIPI_DSI_FMT_RGB888; + dsi->mode_flags = MIPI_DSI_CLOCK_NON_CONTINUOUS; + + drm_panel_init(&ctx->panel, dev, &s6e3fa9_amb667um06_panel_funcs, + DRM_MODE_CONNECTOR_DSI); + ctx->panel.prepare_prev_first = true; + + ctx->panel.backlight = s6e3fa9_amb667um06_create_backlight(dsi); + if (IS_ERR(ctx->panel.backlight)) + return dev_err_probe(dev, PTR_ERR(ctx->panel.backlight), + "Failed to create backlight\n"); + + drm_panel_add(&ctx->panel); + + ret = devm_mipi_dsi_attach(dev, dsi); + if (ret < 0) { + drm_panel_remove(&ctx->panel); + return dev_err_probe(dev, ret, "Failed to attach to DSI host\n"); + } + + return 0; +} + +static void s6e3fa9_amb667um06_remove(struct mipi_dsi_device *dsi) +{ + struct s6e3fa9_amb667um06 *ctx = mipi_dsi_get_drvdata(dsi); + int ret; + + ret = mipi_dsi_detach(dsi); + if (ret < 0) + dev_err(&dsi->dev, "Failed to detach from DSI host: %d\n", ret); + + drm_panel_remove(&ctx->panel); +} + +static const struct of_device_id s6e3fa9_amb667um06_of_match[] = { + { .compatible = "samsung,s6e3fa9-amb667um06" }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, s6e3fa9_amb667um06_of_match); + +static struct mipi_dsi_driver s6e3fa9_amb667um06_driver = { + .probe = s6e3fa9_amb667um06_probe, + .remove = s6e3fa9_amb667um06_remove, + .driver = { + .name = "panel-s6e3fa9-amb667um06", + .of_match_table = s6e3fa9_amb667um06_of_match, + }, +}; +module_mipi_dsi_driver(s6e3fa9_amb667um06_driver); + +MODULE_AUTHOR("Waldemar Tomme "); +MODULE_DESCRIPTION("DRM driver for ss_dsi_panel_S6E3FA9_AMB667UM06_FHD"); +MODULE_LICENSE("GPL");