From c42d3d21315003e3ad059570f07bde28bd45bd0d Mon Sep 17 00:00:00 2001 From: Guru Das Srinagesh Date: Thu, 14 May 2020 18:15:37 -0700 Subject: [PATCH 1/4] dt-bindings: pwm-qti-lpg: Update nvmem specification Some targets such as PM8350C have a two-nvmem scheme in which LUT pattern data is stored separately from the per-channel data. Update the dt-bindings to reflect this. Change-Id: I01c8e619c4bb758a3ea8436a689fa58059d10b0c --- bindings/pwm/pwm-qti-lpg.txt | 72 ++++++++++++++++++++++++++++++------ 1 file changed, 60 insertions(+), 12 deletions(-) diff --git a/bindings/pwm/pwm-qti-lpg.txt b/bindings/pwm/pwm-qti-lpg.txt index a4a65294e5b3..8c7a728313eb 100644 --- a/bindings/pwm/pwm-qti-lpg.txt +++ b/bindings/pwm/pwm-qti-lpg.txt @@ -36,27 +36,34 @@ device module in Qualcomm Technologies, Inc. PMIC chips. - nvmem-names: Usage: optional - Value type: - Definition: The nvmem device name for the SDAM module where the LUT - pattern is stored. It must be "ppg_sdam". This property - is required only when LUT mode is supported with a SDAM - module instead of a LUT module. + Value type: + Definition: The nvmem device name(s) for the SDAM module(s) where the + LUT pattern data is stored. This property is required + only when LUT mode is supported with a SDAM module + instead of a LUT module. It can take the following + mutually exclusive sets of values: + (a) "ppg_sdam": + LUT pattern data and per-channel data are stored in a + single SDAM module. + (b) "lut_sdam", "lpg_chan_sdam": + LUT pattern data and per-channel data are stored in + two different SDAM modules. - nvmem: Usage: optional - Value type: - Definition: Phandle of the nvmem device to access the LUT stored - in the SDAM module. This property is required only when - LUT mode is supported and the LUT pattern is stored in a - SDAM module instead of a LUT module. + Value type: + Definition: Phandle(s) of the nvmem device(s) to access the LUT stored + in the SDAM module(s). This property is required only when + LUT mode is supported and the LUT pattern is stored in + SDAM modules instead of a LUT module. - qcom,pbs-client Usage: optional Value type: Definition: Phandle of the PBS client used for sending the PBS trigger. This property is required when LUT mode is - supported and the LUT pattern is stored in a SDAM - module instead of a LUT module. + supported and the LUT pattern is stored in a single SDAM + module (not two) instead of a LUT module. - qcom,lut-sdam-base: Usage: optional @@ -252,3 +259,44 @@ Example when LUT pattern is stored in a SDAM module: qcom,lpg-sdam-base = <0x64>; }; }; + +Example when LUT pattern is stored in two SDAM modules: + + pm8350c_pwm_1: pwms@e800 { + compatible = "qcom,pwm-lpg"; + reg = <0xe800>; + reg-names = "lpg-base"; + #pwm-cells = <2>; + qcom,num-lpg-channels = <3>; + nvmem = <&pmk8350_sdam_21 &pmk8350_sdam_22>; + nvmem-names = "lpg_chan_sdam", "lut_sdam"; + qcom,lut-sdam-base = <0x45>; + qcom,lut-patterns = <0 10 20 30 40 50 60 70 80 90 100 + 90 80 70 60 50 40 30 20 10 0>; + lpg@1 { + qcom,lpg-chan-id = <1>; + qcom,ramp-step-ms = <200>; + qcom,ramp-low-index = <0>; + qcom,ramp-high-index = <19>; + qcom,ramp-pattern-repeat; + qcom,lpg-sdam-base = <0x48>; + }; + + lpg@2 { + qcom,lpg-chan-id = <2>; + qcom,ramp-step-ms = <200>; + qcom,ramp-low-index = <0>; + qcom,ramp-high-index = <19>; + qcom,ramp-pattern-repeat; + qcom,lpg-sdam-base = <0x56>; + }; + + lpg@3 { + qcom,lpg-chan-id = <3>; + qcom,ramp-step-ms = <200>; + qcom,ramp-low-index = <0>; + qcom,ramp-high-index = <19>; + qcom,ramp-pattern-repeat; + qcom,lpg-sdam-base = <0x64>; + }; + }; From 5958abfd7282bcd1a7132dfd6747c7b6517dc327 Mon Sep 17 00:00:00 2001 From: Guru Das Srinagesh Date: Wed, 22 Jan 2020 17:32:07 -0800 Subject: [PATCH 2/4] ARM: dts: msm: Add nvmem devices on PMK8350 to support PPG PWMs on PM8350C require the nvmem devices SDAM21 and SDAM22 to store pattern data as well as per-channel data. Add the required devices to PMK8350 so that they may be referenced and used by the PWM node. Change-Id: I762ff0c81ed7855d52231be81b8e08abfef5e708 --- qcom/pmk8350.dtsi | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/qcom/pmk8350.dtsi b/qcom/pmk8350.dtsi index 185d62edbef2..b8ce79089d11 100644 --- a/qcom/pmk8350.dtsi +++ b/qcom/pmk8350.dtsi @@ -199,6 +199,16 @@ }; }; + pmk8350_sdam_21: sdam@8400 { + compatible = "qcom,spmi-sdam"; + reg = <0x8400>; + }; + + pmk8350_sdam_22: sdam@8500 { + compatible = "qcom,spmi-sdam"; + reg = <0x8500>; + }; + pmk8350_gpios: pinctrl@b000 { compatible = "qcom,pmk8350-gpio"; reg = <0xb000>; From e10958cbc3d98d4fa30d3574f41641ef44619ab0 Mon Sep 17 00:00:00 2001 From: Guru Das Srinagesh Date: Tue, 26 May 2020 18:02:24 -0700 Subject: [PATCH 3/4] dt-bindings: pwm-qti-lpg: Add qcom,tick-duration-us property This specifies the duration (in microseconds) of a single tick for the clock used in PPG. Change-Id: I5c527f26362b32e8f50210d3f6f1ad65611aead4 --- bindings/pwm/pwm-qti-lpg.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bindings/pwm/pwm-qti-lpg.txt b/bindings/pwm/pwm-qti-lpg.txt index 8c7a728313eb..3802bea5890f 100644 --- a/bindings/pwm/pwm-qti-lpg.txt +++ b/bindings/pwm/pwm-qti-lpg.txt @@ -125,6 +125,12 @@ parameters needs to be configured for that channel. 1 - 511 when LUT module is used, and 8 - 2000 when SDAM is used. +- qcom,tick-duration-us: + Usage: optional + Value type: + Definition: The tick duration in microseconds for PPG. If this property + is not specified, a default value of 7800 will be used. + - qcom,ramp-high-index: Usage: required Value type: From c4a61cfdf83a93b6723e427e5463da980c3e84ec Mon Sep 17 00:00:00 2001 From: Guru Das Srinagesh Date: Wed, 22 Jan 2020 17:36:57 -0800 Subject: [PATCH 4/4] ARM: dts: msm: Specify PPG parameters for PWM device in PM8350C The PWM PPG feature in PM8350C uses two separate nvmems to store the lookup table and the per-channel data. It also does not need a PBS client for the PPG feature. Change-Id: Iaf506cca458fb3c51b849d91383135ab62e9f829 --- qcom/pm8350c.dtsi | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/qcom/pm8350c.dtsi b/qcom/pm8350c.dtsi index e04bad7ab114..61b2ad002754 100644 --- a/qcom/pm8350c.dtsi +++ b/qcom/pm8350c.dtsi @@ -35,6 +35,39 @@ reg-names = "lpg-base"; #pwm-cells = <2>; qcom,num-lpg-channels = <3>; + nvmem = <&pmk8350_sdam_21 &pmk8350_sdam_22>; + nvmem-names = "lpg_chan_sdam", "lut_sdam"; + qcom,lut-sdam-base = <0x45>; + qcom,lut-patterns = <0 10 20 30 40 50 60 70 80 90 100 + 90 80 70 60 50 40 30 20 10 0>; + qcom,tick-duration-us = <8000>; + + lpg@1 { + qcom,lpg-chan-id = <1>; + qcom,ramp-step-ms = <200>; + qcom,ramp-low-index = <0>; + qcom,ramp-high-index = <19>; + qcom,ramp-pattern-repeat; + qcom,lpg-sdam-base = <0x48>; + }; + + lpg@2 { + qcom,lpg-chan-id = <2>; + qcom,ramp-step-ms = <200>; + qcom,ramp-low-index = <0>; + qcom,ramp-high-index = <19>; + qcom,ramp-pattern-repeat; + qcom,lpg-sdam-base = <0x56>; + }; + + lpg@3 { + qcom,lpg-chan-id = <3>; + qcom,ramp-step-ms = <200>; + qcom,ramp-low-index = <0>; + qcom,ramp-high-index = <19>; + qcom,ramp-pattern-repeat; + qcom,lpg-sdam-base = <0x64>; + }; }; pm8350c_pwm_2: pwms@eb00 {