Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp31012lqr; Tue, 4 Jun 2024 19:45:14 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVGocuMT6wHBC8RkxgGomC0OD3Y18LdyhILZh9Z6/vWcNRBjl7tRuRvxUUPEN8UPkGo3aZCgVmZ1uQDijYLeSAYv+D7woyCLfPaaKXK1w== X-Google-Smtp-Source: AGHT+IGmXs5JJg8BWy0F22bHkVsD07OZ76yqGFjQQS7EcvbUY43xnQNuaxUV7UshlP9GWQzYbEOH X-Received: by 2002:a50:d702:0:b0:56e:743:d4d9 with SMTP id 4fb4d7f45d1cf-57a8bcb63f8mr663799a12.42.1717555514813; Tue, 04 Jun 2024 19:45:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717555514; cv=pass; d=google.com; s=arc-20160816; b=e76rw4yf3UnK7WTgmZbf32KslYvfiW5+2EGGuD1QnbTfEuioJGu3+NU/jYm7SHrI6c 1Bbf484WltwAUNPkxGVYvIwTiy2n7TQ/aIVB3p7Lk5GybfaEWPL34Dirq0TI9aBC6AQO HdJXrBfqc5XgAq1OtX6p8+EzzQls5DnmCEGf+2CM+1oDwEuRlYa5FaEgGadw6yUC/R67 8Plso+rt4ZbwVNuhN/vdL4vxUwVZCfSD4h0ZF2oAW21wY5+iRr5dBWkQg18TPoMUa7Cm AGdtKuO0/L+1xaiTnTRKBQyf3MiyrUfGdFsem8Lb78QkRTZbv5xkg4tPn3/VjWD/UzU2 2lAQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=reply-to:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:subject:date:from:dkim-signature; bh=teEtRat8DFa8P8E/6NG0rFYm/auVer3d9z0Tk/0rzfI=; fh=U91pnJL1fBLcCMjZPqZp5B4oUy798Iq5CD+2Re/NYmA=; b=zImIHo3Rjl9eASo3cbcsDXRE7kXWFM3aJZIaWaeqVi56VzUNWdL6uSqb5YHSVaQtef StvtPVyqTMKpSpB2fpu9u9cO7i5/X/TYNYwWW3oBt1Th/OpeacFjs1S8zD1cMZzN1SE6 Ab2LApugxQZ/vhrDKg2sYbrL2G0NIWEI0cIncmPHvMqS1ceMbY/3XEXfD7hfOedv7E19 cQCLMo+tRgWLk2YcdNJiJ82Rsmjt1lzcNVv6pfcVVhBJkW/udYSAJyDe+dq9L71jsOVi DY6X7Fs8LFMpj2osI/PT7EqehGrVeJM007qLjh028R9CVYN9i+kgy/3StPYk9ZelwEeH aS+g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gxxkW2vL; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-201705-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-201705-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57a31c6303csi5808107a12.312.2024.06.04.19.45.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 19:45:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-201705-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gxxkW2vL; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-201705-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-201705-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 8AE591F236D9 for ; Wed, 5 Jun 2024 02:45:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D852473460; Wed, 5 Jun 2024 02:45:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="gxxkW2vL" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E98B961FE5; Wed, 5 Jun 2024 02:45:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717555501; cv=none; b=sKyxHQSHzwU93pk6VTIn+G/TVBM8DYcMTNNkZZXlxY7U4DN4cxFw03tWJ3Gxlm2lOckptZTqWGAJ5IkXQhX3/rF8SPbSaDsN/+yfuRB/LJ6rMi+xC3xR2DG+1HEG8L801kZbo1sKzMtuXAogjXtr0oFX/ejXWHEy1EMjTgbUTvA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717555501; c=relaxed/simple; bh=jyCjgjjbSAhEovi0cCm4ccKk2T1mvw3REIlJ5GXry+o=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=mVcqb2eHYTWHdRjWA5S07Up0QTDYArsR92zcX3rKlPx6MJ0kDYy6J1e6y5IoX7NsoPjKs+W68mkLhRadqrZqZYePZ0ggT8fCEM718xjcLjb0g/PeHDdIX6LHu+VTHjy0baNBQk3zrlO34x976oozgwo+tb8Eg6XvvXLmoKRuOg4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gxxkW2vL; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPS id 80DDEC4AF07; Wed, 5 Jun 2024 02:45:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717555500; bh=jyCjgjjbSAhEovi0cCm4ccKk2T1mvw3REIlJ5GXry+o=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=gxxkW2vLpRXd5EWX/sU9s4LyabNjHN6GD8eYbI28yz5Ds4wKH5Yl/IgLOAw9SkkXU Tm2Aq242Urow7hmKE2CMZGiF++Q7wi8qoEFvdfHjKGVGlBTMJlwkBdjEp/K+HqIBy2 ydM5HVb4MGDEjoyvn3VMb7upfa7henlhDd83Err2qGNVo3bFTE8OSb4cXti2/cwDBl jsDiFG1bpeOJfadQVkatiHpFcjiJ+B2Z4FKKkQ5+oLoTTsCIl/8b+iUyXuE7ENsG0w /UzqkCsXDLyZLdUEp9Tni17oMiE7aF+gt3JduFwlMKEtKKpNyCKIf9LReOmLxSokJ6 /2MjTZtXDcI7A== 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 6B748C27C5E; Wed, 5 Jun 2024 02:45:00 +0000 (UTC) From: Kelvin Zhang via B4 Relay Date: Wed, 05 Jun 2024 10:44:55 +0800 Subject: [PATCH v7 1/2] pwm: meson: Add support for Amlogic S4 PWM Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240605-s4-pwm-v7-1-e822b271d7b0@amlogic.com> References: <20240605-s4-pwm-v7-0-e822b271d7b0@amlogic.com> In-Reply-To: <20240605-s4-pwm-v7-0-e822b271d7b0@amlogic.com> To: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-pwm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Kelvin Zhang , Junyi Zhao X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1717555496; l=2138; i=kelvin.zhang@amlogic.com; s=20240329; h=from:subject:message-id; bh=PY1LLIlUoEaOvFEAiK0IUMl1TtUUL9kMLCoeJzffQ8s=; b=O3AHvuK3WmFNKLuTbYCYnQMWZjsI0xJhfK2Quo47JUGzgeNTjg8IqB5it1K0WOKPzh02VbzRs hyqZvrUF/TKCkHYHVAOnh1FYFmY/jadIYbIsTEeNXUFvQV8HZfz/wUi X-Developer-Key: i=kelvin.zhang@amlogic.com; a=ed25519; pk=pgnle7HTNvnNTcOoGejvtTC7BJT30HUNXfMHRRXSylI= X-Endpoint-Received: by B4 Relay for kelvin.zhang@amlogic.com/20240329 with auth_id=148 X-Original-From: Kelvin Zhang Reply-To: kelvin.zhang@amlogic.com From: Junyi Zhao Add support for Amlogic S4 PWM. Signed-off-by: Junyi Zhao Signed-off-by: Kelvin Zhang --- drivers/pwm/pwm-meson.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c index b2f97dfb01bb..4f01847525b2 100644 --- a/drivers/pwm/pwm-meson.c +++ b/drivers/pwm/pwm-meson.c @@ -460,6 +460,34 @@ static int meson_pwm_init_channels_meson8b_v2(struct pwm_chip *chip) return meson_pwm_init_clocks_meson8b(chip, mux_parent_data); } +static void meson_pwm_s4_put_clk(void *data) +{ + struct clk *clk = data; + + clk_put(clk); +} + +static int meson_pwm_init_channels_s4(struct pwm_chip *chip) +{ + struct device *dev = pwmchip_parent(chip); + struct device_node *np = dev->of_node; + struct meson_pwm *meson = to_meson_pwm(chip); + int i, ret; + + for (i = 0; i < MESON_NUM_PWMS; i++) { + meson->channels[i].clk = of_clk_get(np, i); + if (IS_ERR(meson->channels[i].clk)) { + ret = PTR_ERR(meson->channels[i].clk); + dev_err_probe(dev, ret, "Failed to get clk\n"); + return ret; + } + devm_add_action_or_reset(dev, meson_pwm_s4_put_clk, + meson->channels[i].clk); + } + + return 0; +} + 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, @@ -498,6 +526,10 @@ static const struct meson_pwm_data pwm_meson8_v2_data = { .channels_init = meson_pwm_init_channels_meson8b_v2, }; +static const struct meson_pwm_data pwm_s4_data = { + .channels_init = meson_pwm_init_channels_s4, +}; + static const struct of_device_id meson_pwm_matches[] = { { .compatible = "amlogic,meson8-pwm-v2", @@ -536,6 +568,10 @@ static const struct of_device_id meson_pwm_matches[] = { .compatible = "amlogic,meson-g12a-ao-pwm-cd", .data = &pwm_g12a_ao_cd_data }, + { + .compatible = "amlogic,meson-s4-pwm", + .data = &pwm_s4_data + }, {}, }; MODULE_DEVICE_TABLE(of, meson_pwm_matches); -- 2.37.1