From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 34DB4CD5BA4 for ; Thu, 21 May 2026 08:27:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Reply-To:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References: Message-Id:MIME-Version:Subject:Date:From:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Gq7VUveO6Kd3ldgtcmba21kNCQmp3ZAmPD18Sp+kNnE=; b=0upKz8HxunCI1S jSEUcKV1y8SlN1W11badzVdXb/Q0mFn/XVZIBsvTdOXNt99nLfz/OgRqRNHf/lLC3OmVTfBIYJWJO Wfw0o8YIgxqrioJ4TpWDYtL6cPH96VOE6Zkf5sPMeWJwxCVK6wdVdPCzeGUgAcN8aW37oC64+YUHm h+F2e0HNTK3lUh0YxrCRGxQdqcEABlkfQu8Kp9ZAiFml1cBffUWnN1jBlz6ucfV1/duyag9/pxy1w JBj2oa37nhGL7lU6r9dJPd7eaxXwBt3rEizY4/0II8Vz1XhzwUTb9MbBVG6URINmdig22JAwZkixW 7epsRQx3V1XgMyuD8SPQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wPykJ-000000078XB-0c8K; Thu, 21 May 2026 08:27:11 +0000 Received: from tor.source.kernel.org ([2600:3c04:e001:324:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1wPykH-000000078VT-02sP; Thu, 21 May 2026 08:27:09 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id 5EC9B60212; Thu, 21 May 2026 08:27:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPS id D278AC4AF0C; Thu, 21 May 2026 08:27:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1779352027; bh=nrmg3HWgO9uceNXtSgM/Z0gIFOwywmG6C/cjZ3MQNRg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=lsbs/SCa6p3fbOzxKPf34ToX+DYsBS5QxvDLoTNHqWIRdx14VpoHl0McLsd9Cmf5F Ca7WXCX7Uh68tuyMhLF8/OeeVIWZ3EUGKMNgAZwFRFmsHDClBs/ATGXRLXPppTzMt9 ZLobIdIPV0q8aZjX0npQFH2hAzCzFZEsjafiBSmkC9krjvHAaTYa0ZqyfSJ8PkSy6k LywhsXikY28TB3eW2Ko612L2KZ6gK+KyJXg739OA/TkEXmrU5QOXMVxiudW74ddPCJ Vvb15xvM3g2dO2lPY+t8N2Fs+LC46tj1mne3UulrO8LaNMIevGYawA4z23D5f4oioP PyLXYwhMHUyrg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id C0881CD5BAF; Thu, 21 May 2026 08:27:07 +0000 (UTC) From: Xianwei Zhao via B4 Relay Date: Thu, 21 May 2026 08:26:59 +0000 Subject: [PATCH v3 2/2] pwm: meson: Add support for Amlogic S7 MIME-Version: 1.0 Message-Id: <20260521-s6-s7-pwm-v3-2-57b073fbafef@amlogic.com> References: <20260521-s6-s7-pwm-v3-0-57b073fbafef@amlogic.com> In-Reply-To: <20260521-s6-s7-pwm-v3-0-57b073fbafef@amlogic.com> To: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiner Kallweit , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl Cc: linux-pwm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, Xianwei Zhao X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1779352023; l=5104; i=xianwei.zhao@amlogic.com; s=20251216; h=from:subject:message-id; bh=ee7S/9E5/xxvFyHNx3kYA681vl0XgvW4Y8eFZhpoo0U=; b=TXiAdEYbw/KybAgqyonbV6T/exp3oQ74Da0C919cp5Yin7jK9EMw1J+LofGU2rmIBRHa/Yom2 qGwM9+P1ScGAT1BFgu9YEEYa3gT6jpNbGBiMxyO/URz5UFU2L/CFeJe X-Developer-Key: i=xianwei.zhao@amlogic.com; a=ed25519; pk=dWwxtWCxC6FHRurOmxEtr34SuBYU+WJowV/ZmRJ7H+k= X-Endpoint-Received: by B4 Relay for xianwei.zhao@amlogic.com/20251216 with auth_id=578 X-Original-From: Xianwei Zhao X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: xianwei.zhao@amlogic.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+linux-amlogic=archiver.kernel.org@lists.infradead.org From: Xianwei Zhao Add support for Amlogic S7 PWM. Amlogic S7 different from the previous SoCs, a controller includes one pwm, at the same time, the controller has only one input clock source. Signed-off-by: Xianwei Zhao --- drivers/pwm/pwm-meson.c | 41 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c index 8c6bf3d49753..66c41bf036de 100644 --- a/drivers/pwm/pwm-meson.c +++ b/drivers/pwm/pwm-meson.c @@ -113,6 +113,7 @@ struct meson_pwm_data { int (*channels_init)(struct pwm_chip *chip); bool has_constant; bool has_polarity; + u8 npwm; }; struct meson_pwm { @@ -503,6 +504,18 @@ static void meson_pwm_s4_put_clk(void *data) clk_put(clk); } +static int meson_pwm_init_channels_s7(struct pwm_chip *chip) +{ + struct device *dev = pwmchip_parent(chip); + struct meson_pwm *meson = to_meson_pwm(chip); + + meson->channels[0].clk = devm_clk_get(dev, NULL); + if (IS_ERR(meson->channels[0].clk)) + return dev_err_probe(dev, PTR_ERR(meson->channels[0].clk), + "Failed to get clk\n"); + return 0; +} + static int meson_pwm_init_channels_s4(struct pwm_chip *chip) { struct device *dev = pwmchip_parent(chip); @@ -530,6 +543,7 @@ static int meson_pwm_init_channels_s4(struct pwm_chip *chip) static const struct meson_pwm_data pwm_meson8b_data = { .parent_names = { "xtal", NULL, "fclk_div4", "fclk_div3" }, .channels_init = meson_pwm_init_channels_meson8b_legacy, + .npwm = MESON_NUM_PWMS, }; /* @@ -539,6 +553,7 @@ static const struct meson_pwm_data pwm_meson8b_data = { static const struct meson_pwm_data pwm_gxbb_ao_data = { .parent_names = { "xtal", "clk81", NULL, NULL }, .channels_init = meson_pwm_init_channels_meson8b_legacy, + .npwm = MESON_NUM_PWMS, }; static const struct meson_pwm_data pwm_axg_ee_data = { @@ -546,6 +561,7 @@ static const struct meson_pwm_data pwm_axg_ee_data = { .channels_init = meson_pwm_init_channels_meson8b_legacy, .has_constant = true, .has_polarity = true, + .npwm = MESON_NUM_PWMS, }; static const struct meson_pwm_data pwm_axg_ao_data = { @@ -553,6 +569,7 @@ static const struct meson_pwm_data pwm_axg_ao_data = { .channels_init = meson_pwm_init_channels_meson8b_legacy, .has_constant = true, .has_polarity = true, + .npwm = MESON_NUM_PWMS, }; static const struct meson_pwm_data pwm_g12a_ee_data = { @@ -560,6 +577,7 @@ static const struct meson_pwm_data pwm_g12a_ee_data = { .channels_init = meson_pwm_init_channels_meson8b_legacy, .has_constant = true, .has_polarity = true, + .npwm = MESON_NUM_PWMS, }; static const struct meson_pwm_data pwm_g12a_ao_ab_data = { @@ -567,6 +585,7 @@ static const struct meson_pwm_data pwm_g12a_ao_ab_data = { .channels_init = meson_pwm_init_channels_meson8b_legacy, .has_constant = true, .has_polarity = true, + .npwm = MESON_NUM_PWMS, }; static const struct meson_pwm_data pwm_g12a_ao_cd_data = { @@ -574,22 +593,33 @@ static const struct meson_pwm_data pwm_g12a_ao_cd_data = { .channels_init = meson_pwm_init_channels_meson8b_legacy, .has_constant = true, .has_polarity = true, + .npwm = MESON_NUM_PWMS, }; static const struct meson_pwm_data pwm_meson8_v2_data = { .channels_init = meson_pwm_init_channels_meson8b_v2, + .npwm = MESON_NUM_PWMS, }; static const struct meson_pwm_data pwm_meson_axg_v2_data = { .channels_init = meson_pwm_init_channels_meson8b_v2, .has_constant = true, .has_polarity = true, + .npwm = MESON_NUM_PWMS, }; static const struct meson_pwm_data pwm_s4_data = { .channels_init = meson_pwm_init_channels_s4, .has_constant = true, .has_polarity = true, + .npwm = MESON_NUM_PWMS, +}; + +static const struct meson_pwm_data pwm_s7_data = { + .channels_init = meson_pwm_init_channels_s7, + .has_constant = true, + .has_polarity = true, + .npwm = 1, }; static const struct of_device_id meson_pwm_matches[] = { @@ -642,7 +672,11 @@ static const struct of_device_id meson_pwm_matches[] = { .compatible = "amlogic,meson-s4-pwm", .data = &pwm_s4_data }, - {}, + { + .compatible = "amlogic,s7-pwm", + .data = &pwm_s7_data + }, + { } }; MODULE_DEVICE_TABLE(of, meson_pwm_matches); @@ -650,9 +684,10 @@ static int meson_pwm_probe(struct platform_device *pdev) { struct pwm_chip *chip; struct meson_pwm *meson; + const struct meson_pwm_data *pdata = of_device_get_match_data(&pdev->dev); int err; - chip = devm_pwmchip_alloc(&pdev->dev, MESON_NUM_PWMS, sizeof(*meson)); + chip = devm_pwmchip_alloc(&pdev->dev, pdata->npwm, sizeof(*meson)); if (IS_ERR(chip)) return PTR_ERR(chip); meson = to_meson_pwm(chip); @@ -664,7 +699,7 @@ static int meson_pwm_probe(struct platform_device *pdev) spin_lock_init(&meson->lock); chip->ops = &meson_pwm_ops; - meson->data = of_device_get_match_data(&pdev->dev); + meson->data = pdata; err = meson->data->channels_init(chip); if (err < 0) -- 2.52.0 _______________________________________________ linux-amlogic mailing list linux-amlogic@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-amlogic