clk: qcom: Add spmi_pmic clock divider support
PATCH v4 1/1 clk: qcom: Add spmi_pmic clock divider support
Clkdiv module provides a clock output on the PMIC with CXO as the source. This clock can be routed through PMIC GPIOs. Add a device driver to configure this clkdiv module.
--- .../bindings/clock/clk-spmi-pmic-div.txt | 56 ++++ drivers/clk/qcom/Kconfig | 9 + drivers/clk/qcom/Makefile | 1 + drivers/clk/qcom/clk-spmi-pmic-div.c | 342 +++++++++++++++++++++ 4 files changed, 408 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/clk-spmi-pmic-div.txt create mode 100644 drivers/clk/qcom/clk-spmi-pmic-div.c
Documentation/devicetree/bindings/clock/clk-spmi-pmic-div.txt new file +56 -0
@@ -0,0 +1,56 @@ +Qualcomm Technologies, Inc. SPMI PMIC clock divider (clkdiv) + +clkdiv configures the clock frequency of a set of outputs on the PMIC. +These clocks are typically wired through alternate functions on +gpio pins. + +======================= +Properties +======================= + +- compatible + Usage: required + Value type: <string> + Definition: must be one of: + "qcom,spmi-clkdiv" + "qcom,pm8998-clkdiv" + +- reg + Usage: required + Value type: <prop-encoded-array> + Definition: Addresses and sizes for the memory of this CLKDIV + peripheral. + +- clocks: + Usage: required + Value type: <prop-encoded-array> + Definition: reference to the xo clock. + +- clock-names: + Usage: required + Value type: <stringlist> + Definition: must be "xo". + +- clock-cells: + Usage: required + Value type: <u32> + Definition: shall contain 1. + +======= +Example +======= + +pm8998_clk_divs: qcom,clock@5b00 { + compatible = "qcom,pm8998-clkdiv"; + reg = <0x5b00>; + #clock-cells = <1>; + clocks = <&xo_board>; + clock-names = "xo"; + + assigned-clocks = <&pm8998_clk_divs 1>, + <&pm8998_clk_divs 2>, + <&pm8998_clk_divs 3>; + assigned-clock-rates = <9600000>, + <9600000>, + <9600000>; +};
drivers/clk/qcom/Kconfig +9 -0
@@ -196,3 +196,12 @@ config MSM_MMCC_8996 Support for the multimedia clock controller on msm8996 devices. Say Y if you want to support multimedia devices such as display, graphics, video encode/decode, camera, etc. + +config SPMI_PMIC_CLKDIV + tristate "spmi pmic clkdiv driver" + depends on (COMMON_CLK_QCOM && SPMI) || COMPILE_TEST + help + This driver supports the clkdiv functionality on the Qualcomm + Technologies, Inc. SPMI PMIC. It configures the frequency of + clkdiv outputs on the PMIC. These clocks are typically wired + through alternate functions on gpio pins.
drivers/clk/qcom/Makefile +1 -0
@@ -33,3 +33,4 @@ obj-$(CONFIG_MSM_MMCC_8974) += mmcc-msm8974.o obj-$(CONFIG_MSM_MMCC_8996) += mmcc-msm8996.o obj-$(CONFIG_QCOM_CLK_RPM) += clk-rpm.o obj-$(CONFIG_QCOM_CLK_SMD_RPM) += clk-smd-rpm.o +obj-$(CONFIG_SPMI_PMIC_CLKDIV) += clk-spmi-pmic-div.o
drivers/clk/qcom/clk-spmi-pmic-div.c new file +342 -0
342 lines not on this page · raw message
Signature · 1 line
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
kbuild test robot
build botreproduce:
Hi Tirupathi,
[auto build test WARNING on clk/clk-next]
[also build test WARNING on v4.14-rc1 next-20170918]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Tirupathi-Reddy/clk-qcom-Add-spmi_pmic-clock-divider-support/20170919-043600 base: https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git clk-next config: i386-allmodconfig (attached as .config) compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 reproduce: # save the attached .config to linux build tree make ARCH=i386
All warnings (new ones prefixed by >>):
In file included from include/linux/printk.h:6:0,
from include/linux/kernel.h:13,
from include/linux/clk.h:16,
from drivers/clk/qcom/clk-spmi-pmic-div.c:14:
drivers/clk/qcom/clk-spmi-pmic-div.c: In function 'spmi_pmic_div_clk_hw_get':
>> include/linux/kern_levels.h:4:18: warning: format '%d' expects a matching 'int' argument [-Wformat=]
#define KERN_SOH "\001" /* ASCII Start Of Header */
^
include/linux/kern_levels.h:10:18: note: in expansion of macro 'KERN_SOH'
#define KERN_ERR KERN_SOH "3" /* error conditions */
^~~~~~~~
include/linux/printk.h:301:9: note: in expansion of macro 'KERN_ERR'
printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
^~~~~~~~
>> drivers/clk/qcom/clk-spmi-pmic-div.c:219:3: note: in expansion of macro 'pr_err'pr_err("%s: index value %u is invalid; allowed range: [%d, %d]\n", ^~~~~~
vim +/pr_err +219 drivers/clk/qcom/clk-spmi-pmic-div.c
211
212 static struct clk_hw *spmi_pmic_div_clk_hw_get(struct of_phandle_args *clkspec,
213 void *data)
214 {
215 struct spmi_pmic_div_clk_cc *clk_cc = data;
216 unsigned int idx = (clkspec->args[0] - SPMI_PMIC_CLKDIV_MIN_INDEX);
217
218 if (idx < 0 || idx >= clk_cc->nclks) {
> 219 pr_err("%s: index value %u is invalid; allowed range: [%d, %d]\n", 220 __func__, SPMI_PMIC_CLKDIV_MIN_INDEX, clk_cc->nclks);
221 return ERR_PTR(-EINVAL);
222 }
223
224 return clk_cc->div_clks[idx];
225 }
226
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
kbuild test robot
build botreproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross…
Hi Tirupathi,
[auto build test WARNING on clk/clk-next]
[also build test WARNING on v4.14-rc1 next-20170918]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Tirupathi-Reddy/clk-qcom-Add-spmi_pmic-clock-divider-support/20170919-043600 base: https://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git clk-next config: xtensa-allmodconfig (attached as .config) compiler: xtensa-linux-gcc (GCC) 4.9.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=xtensa
All warnings (new ones prefixed by >>):
drivers/clk/qcom/clk-spmi-pmic-div.c: In function 'spmi_pmic_div_clk_hw_get':
>> drivers/clk/qcom/clk-spmi-pmic-div.c:219:3: warning: format '%d' expects a matching 'int' argument [-Wformat=]
pr_err("%s: index value %u is invalid; allowed range: [%d, %d]\n", ^
vim +219 drivers/clk/qcom/clk-spmi-pmic-div.c
211
212 static struct clk_hw *spmi_pmic_div_clk_hw_get(struct of_phandle_args *clkspec,
213 void *data)
214 {
215 struct spmi_pmic_div_clk_cc *clk_cc = data;
216 unsigned int idx = (clkspec->args[0] - SPMI_PMIC_CLKDIV_MIN_INDEX);
217
218 if (idx < 0 || idx >= clk_cc->nclks) {
> 219 pr_err("%s: index value %u is invalid; allowed range: [%d, %d]\n", 220 __func__, SPMI_PMIC_CLKDIV_MIN_INDEX, clk_cc->nclks);
221 return ERR_PTR(-EINVAL);
222 }
223
224 return clk_cc->div_clks[idx];
225 }
226
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation