Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

clk: qcom: gcc-msm8916: Add rates to the GP clocks

msm8916 has (at least) 6 "General Purpose" clocks that can be muxed to
SoC pins. These clocks are:

GP_CLK{0, 1} : GPIO_{31, 32} (Belongs to CAMSS according to Linux)
GP_CLK_{1-3}{A, B} : GPIO_{49-51, 97, 12, 13} (Belongs to GCC itself)
GP_MN : GPIO_110 (Doesn't seem to be described in gcc,
ignored in this patch)

Those clocks may be used as e.g. PWM sources for external peripherals.
Add more frequencies to the table for those clocks so it's possible
for arbitrary peripherals to make use of them.

Reviewed-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Nikita Travkin <nikita@trvn.ru>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20220612145955.385787-5-nikita@trvn.ru

authored by

Nikita Travkin and committed by
Bjorn Andersson
bf8bb8ea d0696770

+35
+35
drivers/clk/qcom/gcc-msm8916.c
··· 765 765 }, 766 766 }; 767 767 768 + /* 769 + * This is a frequency table for "General Purpose" clocks. 770 + * These clocks can be muxed to the SoC pins and may be used by 771 + * external devices. They're often used as PWM source. 772 + * 773 + * See comment at ftbl_gcc_gp1_3_clk. 774 + */ 768 775 static const struct freq_tbl ftbl_gcc_camss_gp0_1_clk[] = { 776 + F(10000, P_XO, 16, 1, 120), 777 + F(100000, P_XO, 16, 1, 12), 778 + F(500000, P_GPLL0, 16, 1, 100), 779 + F(1000000, P_GPLL0, 16, 1, 50), 780 + F(2500000, P_GPLL0, 16, 1, 20), 781 + F(5000000, P_GPLL0, 16, 1, 10), 769 782 F(100000000, P_GPLL0, 8, 0, 0), 770 783 F(200000000, P_GPLL0, 4, 0, 0), 771 784 { } ··· 940 927 }, 941 928 }; 942 929 930 + /* 931 + * This is a frequency table for "General Purpose" clocks. 932 + * These clocks can be muxed to the SoC pins and may be used by 933 + * external devices. They're often used as PWM source. 934 + * 935 + * Please note that MND divider must be enabled for duty-cycle 936 + * control to be possible. (M != N) Also since D register is configured 937 + * with a value multiplied by 2, and duty cycle is calculated as 938 + * (2 * D) % 2^W 939 + * DutyCycle = ---------------- 940 + * 2 * (N % 2^W) 941 + * (where W = .mnd_width) 942 + * N must be half or less than maximum value for the register. 943 + * Otherwise duty-cycle control would be limited. 944 + * (e.g. for 8-bit NMD N should be less than 128) 945 + */ 943 946 static const struct freq_tbl ftbl_gcc_gp1_3_clk[] = { 947 + F(10000, P_XO, 16, 1, 120), 948 + F(100000, P_XO, 16, 1, 12), 949 + F(500000, P_GPLL0, 16, 1, 100), 950 + F(1000000, P_GPLL0, 16, 1, 50), 951 + F(2500000, P_GPLL0, 16, 1, 20), 952 + F(5000000, P_GPLL0, 16, 1, 10), 944 953 F(19200000, P_XO, 1, 0, 0), 945 954 { } 946 955 };