From patchwork Wed Sep 14 14:47:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 12976271 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E5554ECAAD3 for ; Wed, 14 Sep 2022 14:47:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229703AbiINOrx (ORCPT ); Wed, 14 Sep 2022 10:47:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229538AbiINOrx (ORCPT ); Wed, 14 Sep 2022 10:47:53 -0400 Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2CC03659EE; Wed, 14 Sep 2022 07:47:52 -0700 (PDT) Received: by mail-ej1-x62a.google.com with SMTP id y17so30241143ejo.6; Wed, 14 Sep 2022 07:47:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date; bh=y0tx4iXEt6rtKpQ7JfJuD84UB0Bf5IVCRu8OAnpgQxs=; b=F4doHotWLWUSfD3H6nxU9wHelCDt5FuEFgfpisf/KHiEVlxit1EN2h52YJ0B5Z7NLg jf1BIFET+hvXkpn8Vb6OToIUyAQn1H7SkXCfQTuph9wnNssGHV/rgXdV9zXZpFoQfc/y VD7kIS8JqMwyXFyelZbMZFpVwbhI8lU7SDiz6yy4uakTycvdOjCUkwhHXPIBZ0wxUXFg SxbwYWcHFkFS/vgZ2akRRNENy04tpQOLM6uBdqBrOAbjyJnUK1rMgbiRjiDauC16t3EN Tg4qSlTsMNaVoISwIoIvVfhZROA7/d7LKnijVl+0eKfFoAUoYFiJMjkLsjFOW5+4TLDd c7ZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date; bh=y0tx4iXEt6rtKpQ7JfJuD84UB0Bf5IVCRu8OAnpgQxs=; b=qnPD80dWz52KeiVFAN/Yby/6BybphMzRUqPNcpRgjjKVZH47+YyzLuwiBsGc3ISZv/ AkwnGBdJEqDexpQ6I3m6+3NEAjPMyZwpWd1gtjt+97aKHH7RrhWl5E23i6Mse7Swo0AK jUVzY2NoKsR7KDYFXFEX3YPeD4eiLpOjDdgTTDUgb0jq1azk/YvnHPki5HpZyKvGZj6/ 2CIcuFwrd8hJdJJiWaXKQDZkNPzNbogEYbxOE92NhEzNBkQMBzTCEd0+rxn1NT78q//L M+G+4iAwhrjr5+Gx8QqvRKghrvhOQryrv9d/XLDSygoC9E3+rasNGR4ju62dICE0njMJ JGhQ== X-Gm-Message-State: ACgBeo3kq5Xsqk2qm8KPl9BLMtfiL/8vvMwddJe8e0EHL5Q0wI2ljSRl AxjkL+mD0Qk4NvOpZcTOj64= X-Google-Smtp-Source: AA6agR7TCG6qJgnxms9eWwvhts2s5/ovjaT5lWQx3UyShlI9J/b3cee8fmDf8c6CPxU2yTEE/mXYug== X-Received: by 2002:a17:906:5a6a:b0:77c:2c7f:bd69 with SMTP id my42-20020a1709065a6a00b0077c2c7fbd69mr13308438ejc.283.1663166870614; Wed, 14 Sep 2022 07:47:50 -0700 (PDT) Received: from localhost.localdomain (93-42-70-134.ip85.fastwebnet.it. [93.42.70.134]) by smtp.googlemail.com with ESMTPSA id 6-20020a170906300600b0073ae9ba9ba8sm7601484ejz.3.2022.09.14.07.47.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Sep 2022 07:47:50 -0700 (PDT) From: Christian Marangi To: Bjorn Andersson , Andy Gross , Konrad Dybcio , Michael Turquette , Stephen Boyd , linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Christian Marangi Subject: [PATCH v2 1/2] clk: introduce (devm_)hw_register_mux_parent_data_table API Date: Wed, 14 Sep 2022 16:47:42 +0200 Message-Id: <20220914144743.17369-1-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Introduce (devm_)hw_register_mux_parent_data_table new API. We have basic support for clk_register_mux using parent_data but we lack any API to provide a custom parent_map. Add these 2 new API to correctly handle these special configuration instead of using the generic __(devm_)clk_hw_register_mux API. Signed-off-by: Christian Marangi Acked-by: Stephen Boyd --- v2: - Rebase on top of linux-next/master include/linux/clk-provider.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 1615010aa0ec..65b70f0d62c5 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -974,6 +974,13 @@ struct clk *clk_register_mux_table(struct device *dev, const char *name, __clk_hw_register_mux((dev), NULL, (name), (num_parents), NULL, NULL, \ (parent_data), (flags), (reg), (shift), \ BIT((width)) - 1, (clk_mux_flags), NULL, (lock)) +#define clk_hw_register_mux_parent_data_table(dev, name, parent_data, \ + num_parents, flags, reg, shift, \ + width, clk_mux_flags, table, \ + lock) \ + __clk_hw_register_mux((dev), NULL, (name), (num_parents), NULL, NULL, \ + (parent_data), (flags), (reg), (shift), \ + BIT((width)) - 1, (clk_mux_flags), table, (lock)) #define devm_clk_hw_register_mux(dev, name, parent_names, num_parents, flags, reg, \ shift, width, clk_mux_flags, lock) \ __devm_clk_hw_register_mux((dev), NULL, (name), (num_parents), \ @@ -987,6 +994,13 @@ struct clk *clk_register_mux_table(struct device *dev, const char *name, (parent_hws), NULL, (flags), (reg), \ (shift), BIT((width)) - 1, \ (clk_mux_flags), NULL, (lock)) +#define devm_clk_hw_register_mux_parent_data_table(dev, name, parent_data, \ + num_parents, flags, reg, shift, \ + width, clk_mux_flags, table, \ + lock) \ + __devm_clk_hw_register_mux((dev), NULL, (name), (num_parents), NULL, \ + NULL, (parent_data), (flags), (reg), (shift), \ + BIT((width)) - 1, (clk_mux_flags), table, (lock)) int clk_mux_val_to_index(struct clk_hw *hw, const u32 *table, unsigned int flags, unsigned int val); From patchwork Wed Sep 14 14:47:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 12976272 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E5627C6FA8D for ; Wed, 14 Sep 2022 14:47:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229804AbiINOrz (ORCPT ); Wed, 14 Sep 2022 10:47:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229814AbiINOrx (ORCPT ); Wed, 14 Sep 2022 10:47:53 -0400 Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [IPv6:2a00:1450:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3122272FD8; Wed, 14 Sep 2022 07:47:53 -0700 (PDT) Received: by mail-ej1-x62b.google.com with SMTP id gh9so35317695ejc.8; Wed, 14 Sep 2022 07:47:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=ezcKyjQey00m/zcYeoKkPoL5W+jceK+n2B8j+yODyx4=; b=fhgMK4z6YDV157dbHHvzgw0yHO9rCqHI00yDfXWp5AMlD8/vlQb+FGd7zqdtRq3Ur2 YusYiVFuGOVWOEZk3fsOhw6OyLCu731CwvOav21Eb89J6z80AuvCZeX2Z+cxj/rCt7Ve sTT8YapEyokfpnJwS3dsp0lbI8ga2Up6V99raRBVe4M3dWnBT2fE8yRV+e366CLPN06k regN9BD0XKOBq7TlrzJtRGA0v52cko+eDla2AMtpRnKuU0Zi5rDz+Qk9IfYmaw24e/g/ /b1k6ZnCRCmUSylEr1/V7vpdAJBUqntbGO+Xn91a74HhiS1eTAl97kG4ko1jwtjiqzs+ HMug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=ezcKyjQey00m/zcYeoKkPoL5W+jceK+n2B8j+yODyx4=; b=BmLI7Zsu3OeUw+C4H3RJzEmzW8RoRqnwL0o9YAhUrmsgIv4i4FPZz8dpIALc4+Kkcp 2K/xd8bWiuWPFqzWN6AlrlccqoEe3mLk2Gpqmc39TFhdaFukRa6lF5qXhWjDCG/ZFGNL HYMzd2KM9Mm713GkYDSEH7TdiGa8EihPtEpZp6mal6G8aKju5JdI+Dhnu0H5mp9XJfcH 3BtMpZkcAFfQqhs6LeRxVT5vmj5yo5VyFctWIMp8fWOOPINTJZ3cNh9uH/PkCrVGKxUF IzYCXqsMsJH7fbjRaSAHP65WJns//fjunC4nvfVJojlYlAAoAT5kRPQQIMPxKJf/IAiB tRsQ== X-Gm-Message-State: ACgBeo3y1Fs/m6Clm3qEIn5M0VDhvHGg+clxyibpYmuN8RjKfaj0PBX5 RONYmE4K0yDpKv8LfNSRVfE= X-Google-Smtp-Source: AA6agR64/vR14k8oAfXTsKMrgGKHvakepBr2paxUYWJNmMYJQAnBQPs9MTGKVy7lpX/mG94AVOMgjQ== X-Received: by 2002:a17:907:2c4b:b0:77e:2c09:4111 with SMTP id hf11-20020a1709072c4b00b0077e2c094111mr10172304ejc.21.1663166871651; Wed, 14 Sep 2022 07:47:51 -0700 (PDT) Received: from localhost.localdomain (93-42-70-134.ip85.fastwebnet.it. [93.42.70.134]) by smtp.googlemail.com with ESMTPSA id 6-20020a170906300600b0073ae9ba9ba8sm7601484ejz.3.2022.09.14.07.47.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Sep 2022 07:47:51 -0700 (PDT) From: Christian Marangi To: Bjorn Andersson , Andy Gross , Konrad Dybcio , Michael Turquette , Stephen Boyd , linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Christian Marangi Subject: [PATCH v2 2/2] clk: qcom: kpss-xcc: convert to parent data API Date: Wed, 14 Sep 2022 16:47:43 +0200 Message-Id: <20220914144743.17369-2-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220914144743.17369-1-ansuelsmth@gmail.com> References: <20220914144743.17369-1-ansuelsmth@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Convert the driver to parent data API. From the Documentation pll8_vote and pxo should be declared in the DTS so fw_name can be used instead of parent_names. .name is changed to the legacy pxo_board following how it's declared in other drivers. Signed-off-by: Christian Marangi Reviewed-by: Dmitry Baryshkov --- v2: - Change .name from pxo to pxo_board following other driver drivers/clk/qcom/kpss-xcc.c | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/drivers/clk/qcom/kpss-xcc.c b/drivers/clk/qcom/kpss-xcc.c index 88d4b33ac0cc..b1b370274ec4 100644 --- a/drivers/clk/qcom/kpss-xcc.c +++ b/drivers/clk/qcom/kpss-xcc.c @@ -12,9 +12,9 @@ #include #include -static const char *aux_parents[] = { - "pll8_vote", - "pxo", +static const struct clk_parent_data aux_parents[] = { + { .fw_name = "pll8_vote", .name = "pll8_vote" }, + { .fw_name = "pxo", .name = "pxo_board" }, }; static const u32 aux_parent_map[] = { @@ -32,8 +32,8 @@ MODULE_DEVICE_TABLE(of, kpss_xcc_match_table); static int kpss_xcc_driver_probe(struct platform_device *pdev) { const struct of_device_id *id; - struct clk *clk; void __iomem *base; + struct clk_hw *hw; const char *name; id = of_match_device(kpss_xcc_match_table, &pdev->dev); @@ -55,24 +55,16 @@ static int kpss_xcc_driver_probe(struct platform_device *pdev) base += 0x28; } - clk = clk_register_mux_table(&pdev->dev, name, aux_parents, - ARRAY_SIZE(aux_parents), 0, base, 0, 0x3, - 0, aux_parent_map, NULL); + hw = devm_clk_hw_register_mux_parent_data_table(&pdev->dev, name, aux_parents, + ARRAY_SIZE(aux_parents), 0, + base, 0, 0x3, + 0, aux_parent_map, NULL); - platform_set_drvdata(pdev, clk); - - return PTR_ERR_OR_ZERO(clk); -} - -static int kpss_xcc_driver_remove(struct platform_device *pdev) -{ - clk_unregister_mux(platform_get_drvdata(pdev)); - return 0; + return PTR_ERR_OR_ZERO(hw); } static struct platform_driver kpss_xcc_driver = { .probe = kpss_xcc_driver_probe, - .remove = kpss_xcc_driver_remove, .driver = { .name = "kpss-xcc", .of_match_table = kpss_xcc_match_table,