Message ID | 20200925103115.15191-1-srinivas.kandagatla@linaro.org |
---|---|
Headers | show |
Series | clk: qcom : add sm8250 LPASS GFM drivers | expand |
On Fri, 25 Sep 2020 11:31:12 +0100, Srinivas Kandagatla wrote: > Audio Clock controller is a block inside LPASS which controls > 2 Glitch free muxes to LPASS codec Macros. > > Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> > --- > .../bindings/clock/qcom,audiocc-sm8250.yaml | 58 +++++++++++++++++++ > .../clock/qcom,sm8250-lpass-audiocc.h | 13 +++++ > 2 files changed, 71 insertions(+) > create mode 100644 Documentation/devicetree/bindings/clock/qcom,audiocc-sm8250.yaml > create mode 100644 include/dt-bindings/clock/qcom,sm8250-lpass-audiocc.h > My bot found errors running 'make dt_binding_check' on your patch: Error: Documentation/devicetree/bindings/clock/qcom,audiocc-sm8250.example.dts:25.30-31 syntax error FATAL ERROR: Unable to parse input tree make[1]: *** [scripts/Makefile.lib:342: Documentation/devicetree/bindings/clock/qcom,audiocc-sm8250.example.dt.yaml] Error 1 make[1]: *** Waiting for unfinished jobs.... make: *** [Makefile:1366: dt_binding_check] Error 2 See https://patchwork.ozlabs.org/patch/1371157 If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure dt-schema is up to date: pip3 install git+https://github.com/devicetree-org/dt-schema.git@master --upgrade Please check and re-submit.
Quoting Srinivas Kandagatla (2020-09-25 03:31:11) > This patchset adds support for GFM Muxes found in LPASS > (Low Power Audio SubSystem) IP in Audio Clock Controller > and Always ON clock controller. > > Clocks derived from these muxes are consumed by LPASS Digital Codec. > Currently the driver for Audio and Always ON clock controller only > supports GFM Muxes, however it should be easy to add more clock > support when required > > Changes since v1: > -removed unnecessary Kconfig dependencies > - cleaned up header includes. > - moved to using pm_clk > - Moved to right place in Makefile > - moved to use module_platform_driver instead of builtin_platform_driver > - add null check for of_device_get_match_data > > verified dt_binding_check to pass on linux next https://paste.ubuntu.com/p/6nVzjRwvsW/ Rob's bot complained again. Can you run with make DT_SCHEMA_FILES=<path to schema file.yaml> dt_binding_check and make sure the schema is up to date?
Quoting Srinivas Kandagatla (2020-09-25 03:31:14) > GFM Muxes in AUDIO_CC control clocks to LPASS WSA and RX Codec Macros. > This patch adds support to these muxes. > > Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> > --- > drivers/clk/qcom/Kconfig | 6 + > drivers/clk/qcom/Makefile | 1 + > drivers/clk/qcom/lpass-gfm-sm8250.c | 260 ++++++++++++++++++++++++++++ > 3 files changed, 267 insertions(+) > create mode 100644 drivers/clk/qcom/lpass-gfm-sm8250.c > > diff --git a/drivers/clk/qcom/Kconfig b/drivers/clk/qcom/Kconfig > index 058327310c25..08078f4b0591 100644 > --- a/drivers/clk/qcom/Kconfig > +++ b/drivers/clk/qcom/Kconfig > @@ -475,4 +475,10 @@ config KRAITCC > Support for the Krait CPU clocks on Qualcomm devices. > Say Y if you want to support CPU frequency scaling. > > +config CLK_GFM_LPASS_SM8250 > + tristate "GFM LPASS Clocks" Can we get SM8250 in the name? And also sort this into the other SoC compatible strings with a name that matches how it's been done otherwise. I guess CONFIG_SM_LPASS_8250? GFM for Glitch Free Mux doesn't seem very important unless it is actually part of the device name? > + help > + Support for the GFM Glitch Free Mux LPASS clock. Say Y I'd write "Support for the Glitch Free Mux (GFM) Low power audio subsystem (LPASS) clocks found on SM8250 SoCs." > + if you want to support GFM Clocks on LPASS for SM8250 SoC. > + > endif > diff --git a/drivers/clk/qcom/lpass-gfm-sm8250.c b/drivers/clk/qcom/lpass-gfm-sm8250.c > new file mode 100644 > index 000000000000..c79854e1494d > --- /dev/null > +++ b/drivers/clk/qcom/lpass-gfm-sm8250.c > @@ -0,0 +1,260 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * LPASS Audio CC and Always ON CC Glitch Free Mux clock driver > + * > + * Copyright (c) 2020 Linaro Ltd. > + * Author: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> > + */ > + > +#include <linux/kernel.h> > +#include <linux/module.h> > +#include <linux/clk-provider.h> > +#include <linux/io.h> > +#include <linux/clk.h> Is this include used? > +#include <linux/slab.h> > +#include <linux/err.h> > +#include <linux/pm_clock.h> > +#include <linux/pm_runtime.h> > +#include <linux/device.h> > +#include <linux/platform_device.h> > +#include <linux/of_device.h> > +#include <dt-bindings/clock/qcom,sm8250-lpass-audiocc.h> > + > +static struct clk_gfm lpass_gfm_wsa_mclk = { > + .mux_reg = 0x220d8, > + .mux_mask = BIT(0), > + .hw.init = &(struct clk_init_data) { > + .name = "WSA_MCLK", > + .ops = &clk_gfm_ops, > + .flags = CLK_SET_RATE_PARENT | CLK_OPS_PARENT_ENABLE, > + .parent_data = (const struct clk_parent_data[]){ > + { > + .index = 0, > + .name = "LPASS_CLK_ID_TX_CORE_MCLK", Can these use .fw_name instead of .name? The .fw_name is the future and .name is for drivers that don't use DT bindings or existed before we parsed clks from DT in the core. > + }, { > + .index = 1, > + .name = "LPASS_CLK_ID_WSA_CORE_MCLK", > + }, > + }, > + .num_parents = 2, > + }, > +}; > + [...] > +static int lpass_gfm_clk_driver_probe(struct platform_device *pdev) > +{ > + const struct lpass_gfm_data *data; > + struct device *dev = &pdev->dev; > + struct resource *res; > + struct clk_gfm *gfm; > + struct lpass_gfm *cc; > + int err, i; > + > + data = of_device_get_match_data(dev); > + if (!data) > + return -EINVAL; > + > + cc = devm_kzalloc(dev, sizeof(*cc), GFP_KERNEL); > + if (!cc) > + return -ENOMEM; > + > + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > + cc->base = devm_ioremap_resource(dev, res); devm_platform_ioremap_resource() > + if (IS_ERR(cc->base)) > + return PTR_ERR(cc->base); > + > + pm_runtime_enable(dev); > + err = pm_clk_create(dev); > + if (err) > + goto pm_clk_err; > + > + err = of_pm_clk_add_clks(dev); > + if (err < 0) { > + dev_dbg(dev, "Failed to get lpass core voting clocks\n"); > + goto clk_reg_err; > + } > + > + for (i = 0; i < data->onecell_data->num; i++) { > + if (!data->gfm_clks[i]) > + continue; > + > + gfm = data->gfm_clks[i]; > + gfm->priv = cc; > + gfm->gfm_mux = cc->base; > + gfm->gfm_mux = gfm->gfm_mux + data->gfm_clks[i]->mux_reg; > + > + err = devm_clk_hw_register(dev, &data->gfm_clks[i]->hw); > + if (err) > + goto clk_reg_err; > + > + } > + > + err = devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get, > + data->onecell_data); > + if (err) > + goto clk_reg_err; > + > + return 0; > + > +clk_reg_err: > + pm_clk_destroy(dev); > +pm_clk_err: > + pm_runtime_disable(dev); > + return err; > +} > +
thanks Stephen, On 14/10/2020 02:45, Stephen Boyd wrote: >> Changes since v1: >> -removed unnecessary Kconfig dependencies >> - cleaned up header includes. >> - moved to using pm_clk >> - Moved to right place in Makefile >> - moved to use module_platform_driver instead of builtin_platform_driver >> - add null check for of_device_get_match_data >> >> verified dt_binding_check to pass on linux nexthttps://paste.ubuntu.com/p/6nVzjRwvsW/ > Rob's bot complained again. Can you run with Yes, I think the bot is probably checking against linus master branch. Now the dependent patches are merged in master. dt_binding_check passes, I will send v3 with the suggested changes! --srini > > make DT_SCHEMA_FILES=<path to schema file.yaml> dt_binding_check > > and make sure the schema is up to date?