[v1,03/18] arm64: dts: mediatek: mt6795: xperia-m5: Enable Frequency Hopping

Message ID 20230324175456.219954-4-angelogioacchino.delregno@collabora.com
State New
Headers
Series MT6795 Helio X10 and Sony Xperia M5: DT step 2! |

Commit Message

AngeloGioacchino Del Regno March 24, 2023, 5:54 p.m. UTC
  Enable FHCTL with Spread Spectrum for MAINPLL, MPLL and MSDCPLL
as found on the downstream kernel for this smartphone.
Which one to enable, and at what SSC percentage, was found by
dumping the debugging data from a running downstream kernel and
checking the downstream code.

/proc/freqhopping # cat status
FH status:
===============================================
id == fh_status == pll_status == setting_id == curr_freq == user_defined
 0           0             1             0      1599000         0
 1           0             1             0      1716000         0
 2           1             1             2      1092000         0
 3           1             1             2      2912000         0
 4           1             0             2      1600000         0
 5           0             0             0            0         0
 6           0             1             0      1518002         0
 7           0             0             0            0         0
 8           0             0             0            0         0

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
 arch/arm64/boot/dts/mediatek/mt6795-sony-xperia-m5.dts | 7 +++++++
 1 file changed, 7 insertions(+)
  

Comments

Pavel Machek March 25, 2023, 9:11 p.m. UTC | #1
On Fri 2023-03-24 18:54:41, AngeloGioacchino Del Regno wrote:
> Enable FHCTL with Spread Spectrum for MAINPLL, MPLL and MSDCPLL
> as found on the downstream kernel for this smartphone.
> Which one to enable, and at what SSC percentage, was found by
> dumping the debugging data from a running downstream kernel and
> checking the downstream code.

What advantages does this have? Lower EMI emissions?

Best regards,
							Pavel
							-- 
People of Russia, stop Putin before his war on Ukraine escalates.
  
AngeloGioacchino Del Regno March 27, 2023, 8:09 a.m. UTC | #2
Il 25/03/23 22:11, Pavel Machek ha scritto:
> On Fri 2023-03-24 18:54:41, AngeloGioacchino Del Regno wrote:
>> Enable FHCTL with Spread Spectrum for MAINPLL, MPLL and MSDCPLL
>> as found on the downstream kernel for this smartphone.
>> Which one to enable, and at what SSC percentage, was found by
>> dumping the debugging data from a running downstream kernel and
>> checking the downstream code.
> 
> What advantages does this have? Lower EMI emissions?
> 

Hello Pavel,

this is done for multiple reasons, main one being lower EMI, but the effects
on functionality, depending on the actual board, may be quite dramatic and
ranging from lower WiFi and/or modem signal "sensitivity" (as in, for example,
having to automatically lower signal gain because of signal disturbance from
the conducted EMI ripple), to even a complete platform crash due to clocking
issues.

This is not about accounting for hardware quirks because having this situation
is totally normal and expected, especially on "particular" usecases such as
smartphones, where the actual board is typically much constrained in terms of
space, and where on the same board you have multiple components generating noise,
either wanted (a nfc/wifi/bt/2g/3g/4g/5g/something-else signal), or unwanted.

Cheers!
Angelo
  

Patch

diff --git a/arch/arm64/boot/dts/mediatek/mt6795-sony-xperia-m5.dts b/arch/arm64/boot/dts/mediatek/mt6795-sony-xperia-m5.dts
index d3415527d389..52ce3284a46f 100644
--- a/arch/arm64/boot/dts/mediatek/mt6795-sony-xperia-m5.dts
+++ b/arch/arm64/boot/dts/mediatek/mt6795-sony-xperia-m5.dts
@@ -48,6 +48,13 @@  bootloader-region@46000000 {
 	};
 };
 
+&fhctl {
+	clocks = <&apmixedsys CLK_APMIXED_MAINPLL>, <&apmixedsys CLK_APMIXED_MPLL>,
+		 <&apmixedsys CLK_APMIXED_MSDCPLL>;
+	mediatek,hopping-ssc-percent = <8>, <5>, <8>;
+	status = "okay";
+};
+
 &pio {
 	uart0_pins: uart0-pins {
 		pins-rx {