Re: [PATCH 4/6] arm64: dts: qcom: pm8350: include SID into labels

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 29.03.2023 02:08, Dmitry Baryshkov wrote:
> The platform can use several instances of PM8350 PMIC. Include SID into
> all the labels to simplify such platforms configuration.
> 
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxx>
> ---
>  arch/arm64/boot/dts/qcom/pm8350.dtsi          | 31 +++++++++++++------
>  .../dts/qcom/sm8350-sony-xperia-sagami.dtsi   |  4 +--
>  .../dts/qcom/sm8450-sony-xperia-nagara.dtsi   |  4 +--
>  3 files changed, 26 insertions(+), 13 deletions(-)
> 
> diff --git a/arch/arm64/boot/dts/qcom/pm8350.dtsi b/arch/arm64/boot/dts/qcom/pm8350.dtsi
> index 2dfeb99300d7..f1ef242760f2 100644
> --- a/arch/arm64/boot/dts/qcom/pm8350.dtsi
> +++ b/arch/arm64/boot/dts/qcom/pm8350.dtsi
> @@ -6,21 +6,30 @@
>  #include <dt-bindings/interrupt-controller/irq.h>
>  #include <dt-bindings/spmi/spmi.h>
>  
> +/* (Sadly) this PMIC can be configured to be at different SIDs */
> +#ifndef PM8350_SID
> +	#define PM8350_SID 1
> +#endif
> +
> +#define __LABEL(pmic, sid, name) pmic ## _ ## sid ## _ ## name
> +#define _LABEL(pmic, sid, name) __LABEL(pmic, sid, name)
Perhaps that should go to some Qcom PMIC-common include now!

Also, at one point, an idea came up to stop writing so much dt, I'm
not necessarily a fan of creating .dtsc (like ACPI-C sources), but
perhaps we could explore having e.g. a "gen_dt.py" which would take
in some data and generate device trees based on that.. Not very
related to this patch, but I'm just throwing it in the open


Konrad
> +#define LABEL(name) _LABEL(pm8350, PM8350_SID, name)
> +
>  / {
>  	thermal-zones {
> -		pm8350_thermal: pm8350c-thermal {
> +		LABEL(thermal): pm8350c-thermal {
>  			polling-delay-passive = <100>;
>  			polling-delay = <0>;
> -			thermal-sensors = <&pm8350_temp_alarm>;
> +			thermal-sensors = <&LABEL(temp_alarm)>;
>  
>  			trips {
> -				pm8350_trip0: trip0 {
> +				LABEL(trip0): trip0 {
>  					temperature = <95000>;
>  					hysteresis = <0>;
>  					type = "passive";
>  				};
>  
> -				pm8350_crit: pm8350c-crit {
> +				LABEL(crit): pm8350c-crit {
>  					temperature = <115000>;
>  					hysteresis = <0>;
>  					type = "critical";
> @@ -33,25 +42,29 @@ pm8350_crit: pm8350c-crit {
>  &spmi_bus {
>  	pm8350: pmic@1 {
>  		compatible = "qcom,pm8350", "qcom,spmi-pmic";
> -		reg = <0x1 SPMI_USID>;
> +		reg = <PM8350_SID SPMI_USID>;
>  		#address-cells = <1>;
>  		#size-cells = <0>;
>  
> -		pm8350_temp_alarm: temp-alarm@a00 {
> +		LABEL(temp_alarm): temp-alarm@a00 {
>  			compatible = "qcom,spmi-temp-alarm";
>  			reg = <0xa00>;
> -			interrupts = <0x1 0xa 0x0 IRQ_TYPE_EDGE_BOTH>;
> +			interrupts = <PM8350_SID 0xa 0x0 IRQ_TYPE_EDGE_BOTH>;
>  			#thermal-sensor-cells = <0>;
>  		};
>  
> -		pm8350_gpios: gpio@8800 {
> +		LABEL(gpios): gpio@8800 {
>  			compatible = "qcom,pm8350-gpio", "qcom,spmi-gpio";
>  			reg = <0x8800>;
>  			gpio-controller;
> -			gpio-ranges = <&pm8350_gpios 0 0 10>;
> +			gpio-ranges = <&LABEL(gpios) 0 0 10>;
>  			#gpio-cells = <2>;
>  			interrupt-controller;
>  			#interrupt-cells = <2>;
>  		};
>  	};
>  };
> +
> +#undef LABEL
> +#undef _LABEL
> +#undef __LABEL
> diff --git a/arch/arm64/boot/dts/qcom/sm8350-sony-xperia-sagami.dtsi b/arch/arm64/boot/dts/qcom/sm8350-sony-xperia-sagami.dtsi
> index e28f49e31b9f..5c09b1d8881b 100644
> --- a/arch/arm64/boot/dts/qcom/sm8350-sony-xperia-sagami.dtsi
> +++ b/arch/arm64/boot/dts/qcom/sm8350-sony-xperia-sagami.dtsi
> @@ -72,7 +72,7 @@ key-camera-snapshot {
>  
>  		key-google-assist {
>  			label = "Google Assistant Key";
> -			gpios = <&pm8350_gpios 9 GPIO_ACTIVE_LOW>;
> +			gpios = <&pm8350_1_gpios 9 GPIO_ACTIVE_LOW>;
>  			linux,code = <KEY_LEFTMETA>;
>  			debounce-interval = <15>;
>  			linux,can-disable;
> @@ -564,7 +564,7 @@ &mpss {
>  	firmware-name = "qcom/sm8350/Sony/sagami/modem.mbn";
>  };
>  
> -&pm8350_gpios {
> +&pm8350_1_gpios {
>  	gpio-line-names = "ASSIGN1_THERM", /* GPIO_1 */
>  			  "LCD_ID",
>  			  "SDR_MMW_THERM",
> diff --git a/arch/arm64/boot/dts/qcom/sm8450-sony-xperia-nagara.dtsi b/arch/arm64/boot/dts/qcom/sm8450-sony-xperia-nagara.dtsi
> index 99e9b776b93d..d90e3fedb742 100644
> --- a/arch/arm64/boot/dts/qcom/sm8450-sony-xperia-nagara.dtsi
> +++ b/arch/arm64/boot/dts/qcom/sm8450-sony-xperia-nagara.dtsi
> @@ -56,7 +56,7 @@ key-camera-snapshot {
>  		key-volume-down {
>  			label = "Volume Down";
>  			linux,code = <KEY_VOLUMEDOWN>;
> -			gpios = <&pm8350_gpios 6 GPIO_ACTIVE_LOW>;
> +			gpios = <&pm8350_1_gpios 6 GPIO_ACTIVE_LOW>;
>  			debounce-interval = <15>;
>  			linux,can-disable;
>  			wakeup-source;
> @@ -622,7 +622,7 @@ &pcie0_phy {
>  	status = "okay";
>  };
>  
> -&pm8350_gpios {
> +&pm8350_1_gpios {
>  	gpio-line-names = "ASSIGN1_THERM", /* GPIO_1 */
>  			  "LCD_ID",
>  			  "SDR_MMW_THERM",



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [Linux for Sparc]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux