From patchwork Thu Jun 8 12:24:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Brunet X-Patchwork-Id: 9774551 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 41382603B4 for ; Thu, 8 Jun 2017 12:24:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 31B61223C7 for ; Thu, 8 Jun 2017 12:24:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 26807284F6; Thu, 8 Jun 2017 12:24:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A571B23B24 for ; Thu, 8 Jun 2017 12:24:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=47PdrgF2Gk6BiSu54s1ViwvCB5puNSoKcWMQKzJsg3k=; b=dpz1L6uNSRBxmKkcBPY9D00/7l sbMveCYbKCSzyxNDSSEX5sZqgVMxnGV2cGlL4oi12xEGCYrC2lpk+fM81zuwGn5yXk2I3zQ6TzZ70 Di2ZUGZ6Irle32xHjJJcWV4qle4d+gO659rqw4vT/loqMui4LF5+D2CJRCPsB33OR6x8NqyB0n6qm +Ec0XOsQ4/E/+2cNeyFI13Bopw/U7VlYZLekWQCy3eEADbUsMFeOiHY1Ep8qA60qwWKfTkRk/sdMF 1bEXO3ZydH2gUultt0hCJxlpc2y+//CInNinU1RXNj3y4m+DEY1nwGjv/GkKPd67orFCj3t6VBUrc CFKy0TVw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dIwUb-0005qT-9b; Thu, 08 Jun 2017 12:24:49 +0000 Received: from mail-wm0-x230.google.com ([2a00:1450:400c:c09::230]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dIwUW-0005kC-BZ for linux-amlogic@lists.infradead.org; Thu, 08 Jun 2017 12:24:46 +0000 Received: by mail-wm0-x230.google.com with SMTP id x70so76352086wme.0 for ; Thu, 08 Jun 2017 05:24:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=88OEb/WTAR1JWrrWWW7/txHCy23COKLIWpnHWupyuBQ=; b=cExGyOcE3bdxCdQmHD5WmoxJ15PZhP8DLNZjpzfGTQDYocGDisaEnkXjjBFDKL7Dlx ROARt/vdOvfrj2j8oBaErw8zCLC+I47oPqOEWl6WjQlBrQIc5aDc/H96nab3xxkINkCW 1+PgILYRMr+iRNvXXC0brXW8FLaFFlDZg7s9ZaudDatFe7sySI3AcQXqKahVTaQ32sEQ 9/VMoQVGCdTi5aJe+fIeccRp6dJq54a07KFjoYzcnjKOm42RAkNc8RFZ9T208W1XomCU LfaThS/m29WbEp9TzUyV2wcOB2e53bt08efOUKyp8oXaf7326tpv8idzP1n5KKQdi1AF KB+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=88OEb/WTAR1JWrrWWW7/txHCy23COKLIWpnHWupyuBQ=; b=Kzc9SjiXxQ9IPZlkgmwJxxOXMaHGVtgyJlJ/sLW395rlJdeFJVkKH5kK8gIr/MKkab C4Frz9jmxZurMWrWmdRbxGPLdPC+q6PWcCYR2SMz7Pgh4tb81htEJyYrL/tulDbNUKvZ AuPWIYEyvQugttzNNnBBe7NNp07zf1nYSO6zVPH0F/zWrEFcyU10b1bW+BcSQV0rjjjX Pk5nD8CeQB1AzO7DpXzmL2zZBZAzxGTMRT9EN2v9CzXhwtbThYvLeDkSkfJIvjnGruU9 TVYq7yTHBHRRRXd2Xbq/Oy1eYQlFMWouSoAGnQlRuq/YUzWzomBU8+X7RYktzXQgwKcx Lq+g== X-Gm-Message-State: AODbwcBBI5rgy3OUY8Cziim2bBUYpqHT6DFS3DVAfn+25NqIhKlRHHRN De5JhaRK9JPBQa0t X-Received: by 10.28.41.65 with SMTP id p62mr3297190wmp.32.1496924662507; Thu, 08 Jun 2017 05:24:22 -0700 (PDT) Received: from localhost.localdomain ([90.63.244.31]) by smtp.googlemail.com with ESMTPSA id g46sm8505378wrg.69.2017.06.08.05.24.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Jun 2017 05:24:22 -0700 (PDT) From: Jerome Brunet To: Thierry Reding , Kevin Hilman , Neil Armstrong Subject: [PATCH v2 2/3] pwm: meson: add compatible for the gxbb ao pwms Date: Thu, 8 Jun 2017 14:24:15 +0200 Message-Id: <20170608122416.1993-3-jbrunet@baylibre.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170608122416.1993-1-jbrunet@baylibre.com> References: <20170608122416.1993-1-jbrunet@baylibre.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170608_052444_602736_9A20577B X-CRM114-Status: GOOD ( 13.31 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Carlo Caione , linux-pwm@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, Jerome Brunet MIME-Version: 1.0 Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP On the gxbb (and gxl) family, the PWMs of the AO domain require a specific compatible because the possible input clocks are different from the EE PWMs input clocks. Since the number of possible input clocks is also different, the 'num_parents' field is added to all the meson pwm data. Acked-by: Neil Armstrong Signed-off-by: Jerome Brunet Reviewed-by: Kevin Hilman --- drivers/pwm/pwm-meson.c | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c index 045ef9fa6fe3..b911a944744a 100644 --- a/drivers/pwm/pwm-meson.c +++ b/drivers/pwm/pwm-meson.c @@ -103,6 +103,7 @@ struct meson_pwm_channel { struct meson_pwm_data { const char * const *parent_names; + int num_parents; }; struct meson_pwm { @@ -381,6 +382,7 @@ static const char * const pwm_meson8b_parent_names[] = { static const struct meson_pwm_data pwm_meson8b_data = { .parent_names = pwm_meson8b_parent_names, + .num_parents = ARRAY_SIZE(pwm_meson8b_parent_names), }; static const char * const pwm_gxbb_parent_names[] = { @@ -389,11 +391,35 @@ static const char * const pwm_gxbb_parent_names[] = { static const struct meson_pwm_data pwm_gxbb_data = { .parent_names = pwm_gxbb_parent_names, + .num_parents = ARRAY_SIZE(pwm_gxbb_parent_names), +}; + +/* + * Only the 2 first inputs of the GXBB AO PWMs are valid + * The last 2 are grounded + */ +static const char * const pwm_gxbb_ao_parent_names[] = { + "xtal", "clk81" +}; + +static const struct meson_pwm_data pwm_gxbb_ao_data = { + .parent_names = pwm_gxbb_ao_parent_names, + .num_parents = ARRAY_SIZE(pwm_gxbb_ao_parent_names), }; static const struct of_device_id meson_pwm_matches[] = { - { .compatible = "amlogic,meson8b-pwm", .data = &pwm_meson8b_data }, - { .compatible = "amlogic,meson-gxbb-pwm", .data = &pwm_gxbb_data }, + { + .compatible = "amlogic,meson8b-pwm", + .data = &pwm_meson8b_data + }, + { + .compatible = "amlogic,meson-gxbb-pwm", + .data = &pwm_gxbb_data + }, + { + .compatible = "amlogic,meson-gxbb-ao-pwm", + .data = &pwm_gxbb_ao_data + }, {}, }; MODULE_DEVICE_TABLE(of, meson_pwm_matches); @@ -417,7 +443,7 @@ static int meson_pwm_init_channels(struct meson_pwm *meson, init.ops = &clk_mux_ops; init.flags = CLK_IS_BASIC; init.parent_names = meson->data->parent_names; - init.num_parents = 1 << MISC_CLK_SEL_WIDTH; + init.num_parents = meson->data->num_parents; channel->mux.reg = meson->base + REG_MISC_AB; channel->mux.shift = mux_reg_shifts[i];