Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp319832lqd; Wed, 24 Apr 2024 03:28:59 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVFod4ekO+gIiP6G/z8EwS74bNRmnF6DYd9Tgf+YShJvFJJu1L/sj1R88/I2GIbUHf3fwK+KsuuiqrZNCn83NZbezKit5g2wk9tgICxpg== X-Google-Smtp-Source: AGHT+IGbrli8+y+9KFdAWbrFC6TxI8uDqKkku2kIklwp+s0KplD14N1o3ILbMuPlp9++bUpQhdOO X-Received: by 2002:a05:6a20:4305:b0:1a7:78d2:a142 with SMTP id h5-20020a056a20430500b001a778d2a142mr2384295pzk.38.1713954539614; Wed, 24 Apr 2024 03:28:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713954539; cv=pass; d=google.com; s=arc-20160816; b=m5ac8cB/seyrm8/1SfrR/QZQ7zXn/LDBoq+Tgr1+T5PbyA1coKt9MCStDjQDAkrVhY MuoKvB3W7adWTTJHdt31xAi8ryA+KuNhUTCiWCspXiBgFhAZPHIEtIoJvTwhmFZ1rUSJ LvbgUf1pjGbBl2m/qMbaFfU/95GbfVtM1vAPSeZRCdBa4cb5fhag4/eGufxjpPbGB3Ar vZ488K5O/CyETUDg+SMJhWww082S6cRyIoO8wQE8XsIduzciS3y1c6s53ir6qlyp6oaz 0Q1u9vIY4kueQ6R3pWNYx1B2tG2hb4fr75EKJS3I2UBnfbjrXVQmEe0LEKZoZhnpVREA nPuA== 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=/lpv7brR0RF76hxqPeDFsv+yMIPET6CiXSOh/uaU9JU=; fh=U91pnJL1fBLcCMjZPqZp5B4oUy798Iq5CD+2Re/NYmA=; b=Qp26nHzl3iQkwBT2mdgoTgXIn+ex9LOoqN73mS8GyJ0r6OlsxUoX3F5NQ9SQJNZGxB ekiisNZ2eIjIKQ/nrqBFuxBuc4tv7b4RpfrD/TdlD9ubLXFHK7bXmz/Ds7RDhavFSa70 HnLgc/b2gyUxCR047J5hh6KfBUcZjhoMgPdSUs3M/m5SebYE8jewK8DyoZb7TpAvAEB5 bB3XPkYfiUWCSvMHOZ9CAVSClDGj+bwcohUqUHNJ5CbDVIczF1YqBJiWJWiKH8A7+9eP +3wrFrizw8WykhZRl88c2D6j92XWWsCLW6cAhYsUOP/oORcX9B8UeiDOHDs/pCereJZV bYYQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YMbrlT3q; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-156727-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-156727-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id m67-20020a625846000000b006eb3c2bbe38si10269763pfb.405.2024.04.24.03.28.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 03:28:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-156727-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YMbrlT3q; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-156727-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-156727-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 27E5E28694F for ; Wed, 24 Apr 2024 10:28:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4E6CD1598F1; Wed, 24 Apr 2024 10:28:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="YMbrlT3q" 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 66B7415921D; Wed, 24 Apr 2024 10:28:45 +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=1713954525; cv=none; b=hfM6LR+zGq5z5wM7H9g08Oz/SJOEr2BgoS15/uk02OBLl32RWeh5M4205rPpevpsdGB5tHn03FQd+is+UXo5fPCmdlCvQ0nI3kWB0HrzbCoZti/I/IlRnBeUGAtEEsw+m8H9v7dUwVuE1UlSLZTa1eeSEyyTvQlMBrSZFmhJecU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713954525; c=relaxed/simple; bh=8ajJMJwApKqgCf9f89bVvjuzXAt5v7XkRoPUav8YUV4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hc2EQfj0Zi9fLzLVvAn1VO4zqwRa5z2YpWVP5LbP9X3eQX2STrnMJ7zngc6+ndBPJIbjBBRKC2yeXrIYZGvbX62t5/SAflkpirxABJ62PsiHHEMK07L1l8NFlujpdHf4SUg2UO5HV9P52/rQV0snyTkGtKriTC31rPiNcTa49+k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=YMbrlT3q; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPS id 10352C32781; Wed, 24 Apr 2024 10:28:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713954525; bh=8ajJMJwApKqgCf9f89bVvjuzXAt5v7XkRoPUav8YUV4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=YMbrlT3q971srEC/EdzXQzYg9th7O/dE3TBkPX+5C9rd86TwGXVoGLBlzixIqn32q gqOFkCj/BOHOUaIWbP5Bpb4Wb6Wc9C4iJyztdGYGbigDAqNU63SzWRH/IMdfVcrlcd p4fdK0b2XnSJEmO5V5Eg9FKu+OLwbhJiFolk3SfNlTlylYcVcsn68USIYn3mqgzRvv VSotiIsqhReg5aL8SgoZoetk+PRnQWcaYSmaHVr4mjqXssEe6cUuR/A2YeQH3k35F/ jcoHjcduJZlSNl4FAPAYSwpUjJdSqn+u6Tl2BS0B77ZVJlwsO4n7KYujFAQfzf2nx/ VUza5eFYjAORw== 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 E4DE9C10F15; Wed, 24 Apr 2024 10:28:44 +0000 (UTC) From: Kelvin Zhang via B4 Relay Date: Wed, 24 Apr 2024 18:28:34 +0800 Subject: [PATCH v4 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: <20240424-s4-pwm-v4-1-ee22effd40d0@amlogic.com> References: <20240424-s4-pwm-v4-0-ee22effd40d0@amlogic.com> In-Reply-To: <20240424-s4-pwm-v4-0-ee22effd40d0@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=1713954523; l=2139; i=kelvin.zhang@amlogic.com; s=20240329; h=from:subject:message-id; bh=gtMEBe84ZprBZCQ2WIxZzSC+jfy6SdQC7eTQHo6OrP0=; b=2QReknnu4j0rhx43sc1H5ezdFAmc2B0Conf7r5ceTUUiA7AhpLj1EGHL8ako++gaojevQyKMp /bUmR33rPpQBpTp6b3G0VADO0q5tb3bJ3U47m/++XxFOOnLyRO0dKc6 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 This patch adds support for Amlogic S4 PWM. Signed-off-by: Junyi Zhao Signed-off-by: Kelvin Zhang --- drivers/pwm/pwm-meson.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c index ea96c5973488..6abc823745e4 100644 --- a/drivers/pwm/pwm-meson.c +++ b/drivers/pwm/pwm-meson.c @@ -462,6 +462,35 @@ static int meson_pwm_init_channels_meson8b_v2(struct pwm_chip *chip) return meson_pwm_init_clocks_meson8b(chip, mux_parent_data); } +static int meson_pwm_init_channels_meson_s4(struct pwm_chip *chip) +{ + int i, ret; + struct device *dev = pwmchip_parent(chip); + struct device_node *np = dev->of_node; + struct meson_pwm *meson = to_meson_pwm(chip); + struct meson_pwm_channel *channel; + + for (i = 0; i < MESON_NUM_PWMS; i++) { + channel = &meson->channels[i]; + channel->clk = of_clk_get(np, i); + if (IS_ERR(channel->clk)) { + ret = PTR_ERR(channel->clk); + dev_err_probe(dev, ret, "Failed to get clk\n"); + goto err; + } + } + + return 0; + +err: + while (--i >= 0) { + channel = &meson->channels[i]; + clk_put(channel->clk); + } + + return ret; +} + 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, @@ -500,6 +529,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_meson_s4_data = { + .channels_init = meson_pwm_init_channels_meson_s4, +}; + static const struct of_device_id meson_pwm_matches[] = { { .compatible = "amlogic,meson8-pwm-v2", @@ -538,6 +571,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_meson_s4_data + }, {}, }; MODULE_DEVICE_TABLE(of, meson_pwm_matches); -- 2.37.1