Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753958AbbERNIz (ORCPT ); Mon, 18 May 2015 09:08:55 -0400 Received: from mail-la0-f43.google.com ([209.85.215.43]:35629 "EHLO mail-la0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753109AbbERNHo (ORCPT ); Mon, 18 May 2015 09:07:44 -0400 MIME-Version: 1.0 In-Reply-To: <20150515190058.GN31753@codeaurora.org> References: <1429521950-16431-1-git-send-email-pi-cheng.chen@linaro.org> <20150515190058.GN31753@codeaurora.org> Date: Mon, 18 May 2015 21:07:42 +0800 Message-ID: Subject: Re: [PATCH v2] clk: mediatek: Export CPU mux clocks for CPU frequency control From: Pi-Cheng Chen To: Stephen Boyd Cc: Mike Turquette , Matthias Brugger , Sascha Hauer , Henry Chen , James Liao , Chen Fan , Eddie Huang , "Joe.C" , Linux Kernel Mailing List , "linux-arm-kernel@lists.infradead.org" , "devicetree@vger.kernel.org" , Linaro Kernel Mailman List , linux-mediatek@lists.infradead.org Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 5012 Lines: 171 Hi Stephen, On Sat, May 16, 2015 at 3:00 AM, Stephen Boyd wrote: > On 04/20, pi-cheng.chen wrote: >> Signed-off-by: pi-cheng.chen >> diff --git a/drivers/clk/mediatek/clk-cpumux.c b/drivers/clk/mediatek/clk-cpumux.c >> new file mode 100644 >> index 0000000..dc14074 >> --- /dev/null >> +++ b/drivers/clk/mediatek/clk-cpumux.c >> @@ -0,0 +1,122 @@ >> +/* >> + * Copyright (c) 2015 Linaro Ltd. >> + * Author: Pi-Cheng Chen >> + * >> + * This program is free software; you can redistribute it and/or modify >> + * it under the terms of the GNU General Public License version 2 as >> + * published by the Free Software Foundation. >> + * >> + * This program is distributed in the hope that it will be useful, >> + * but WITHOUT ANY WARRANTY; without even the implied warranty of >> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >> + * GNU General Public License for more details. >> + */ >> + >> +#include > > Do you need this include for some reason? No. I think I forgot to remove it after adding it for some debugging purpose. Will remove it. > >> +#include >> +#include >> +#include >> + >> +#include "clk-mtk.h" >> +#include "clk-cpumux.h" >> + > [...] >> + >> +static struct clk_ops clk_cpumux_ops = { > > const? Yes. Will add it. > >> + .get_parent = clk_cpumux_get_parent, >> + .set_parent = clk_cpumux_set_parent, >> +}; >> + >> +static struct clk *mtk_clk_register_cpumux(const struct mtk_composite *mux, >> + struct regmap *regmap) >> +{ >> + struct mtk_clk_cpumux *cpumux; >> + struct clk *clk; >> + struct clk_init_data init; >> + >> + cpumux = kzalloc(sizeof(*cpumux), GFP_KERNEL); >> + if (!cpumux) >> + return ERR_PTR(-ENOMEM); >> + >> + init.name = mux->name; >> + init.ops = &clk_cpumux_ops; >> + init.parent_names = mux->parent_names; >> + init.num_parents = mux->num_parents; >> + >> + cpumux->reg = mux->mux_reg; >> + cpumux->shift = mux->mux_shift; >> + cpumux->mask = (BIT(mux->mux_width) - 1); > > Unnecessary parenthesis. Will fix it. > >> + cpumux->regmap = regmap; >> + cpumux->hw.init = &init; >> + >> + clk = clk_register(NULL, &cpumux->hw); >> + if (IS_ERR(clk)) >> + kfree(cpumux); >> + >> + return clk; >> +} >> + >> +int mtk_clk_register_cpumuxes(struct device_node *node, >> + const struct mtk_composite *clks, int num, >> + struct clk_onecell_data *clk_data) >> +{ >> + int i; >> + struct clk *clk; >> + struct regmap *regmap; >> + >> + if (!clk_data) >> + return -ENOMEM; > > Why would we call the function with NULL clk_data? Please remove > this check. Will remove it. > >> + >> + regmap = syscon_node_to_regmap(node); >> + if (IS_ERR(regmap)) { >> + pr_err("Cannot find regmap for %s: %ld\n", node->full_name, >> + PTR_ERR(regmap)); >> + return PTR_ERR(regmap); >> + } >> + >> diff --git a/drivers/clk/mediatek/clk-cpumux.h b/drivers/clk/mediatek/clk-cpumux.h >> new file mode 100644 >> index 0000000..b82ad20 >> --- /dev/null >> +++ b/drivers/clk/mediatek/clk-cpumux.h >> @@ -0,0 +1,31 @@ >> +/* >> + * Copyright (c) 2015 Linaro Ltd. >> + * Author: Pi-Cheng Chen >> + * >> + * This program is free software; you can redistribute it and/or modify >> + * it under the terms of the GNU General Public License version 2 as >> + * published by the Free Software Foundation. >> + * >> + * This program is distributed in the hope that it will be useful, >> + * but WITHOUT ANY WARRANTY; without even the implied warranty of >> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >> + * GNU General Public License for more details. >> + */ >> + >> +#ifndef __DRV_CLK_CPUMUX_H >> +#define __DRV_CLK_CPUMUX_H >> + >> +#include > > Looks unnecessary. Just forward declare the type you need, struct > regmap. Yes. Will fix. Thanks for reviewing. Best Regards, Pi-Cheng > >> + >> +struct mtk_clk_cpumux { >> + struct clk_hw hw; >> + struct regmap *regmap; >> + u32 reg; >> + u32 mask; >> + u8 shift; >> +}; >> + >> +int mtk_clk_register_cpumuxes(struct device_node *node, >> + const struct mtk_composite *clks, int num, >> + struct clk_onecell_data *clk_data); >> +#endif /* __DRV_CLK_CPUMUX_H */ > > -- > Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, > a Linux Foundation Collaborative Project -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/