From patchwork Wed Jun 8 09:21:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 69620 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp2390799qgf; Wed, 8 Jun 2016 02:24:50 -0700 (PDT) X-Received: by 10.98.134.196 with SMTP id x187mr4761286pfd.21.1465377890712; Wed, 08 Jun 2016 02:24:50 -0700 (PDT) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id sn1si407406pac.215.2016.06.08.02.24.50 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Jun 2016 02:24:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1bAZi8-0000Xa-0I; Wed, 08 Jun 2016 09:23:40 +0000 Received: from mail-wm0-x232.google.com ([2a00:1450:400c:c09::232]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1bAZgS-0007F2-Fa for linux-arm-kernel@lists.infradead.org; Wed, 08 Jun 2016 09:21:59 +0000 Received: by mail-wm0-x232.google.com with SMTP id k184so15367556wme.1 for ; Wed, 08 Jun 2016 02:21:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=7niJbiswqV07GlSbxq9b2kaJy1QBjNqFlmbYPdcwbug=; b=EJFi/5dPGVeLbWW22MrKt4p+SAFAdUYLsR5D3yhE7WFXSGqq0Up6xGCc8wtwt+gEhk IH7n3MAma63CzrAVjTUjRUkhklGEFVFBLqSa0XG+G8V7g2h9oSdhvCJQDI551BXAiVrJ jKO3NbuDgE9F9hUVWEpPwRgZBuIX3dFfEgTl8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=7niJbiswqV07GlSbxq9b2kaJy1QBjNqFlmbYPdcwbug=; b=jL6dp5L6VNNPcVU67EgJCTx9U5zricXeB8CK5kDD0sRQveha6HVZ05uoTGsKW7U12X yw13DfTAOj7VSjbmRi9lbpr5YcSPbLFnLgS85arvnAEB8FoLF67v5kkt02KMHMbT6pt4 X37cB2TnDduZUaJPER1H4U2GlW88feEvuif+YbfYRlqGkMG27bRyp7ft2BzKUorGfjXP LUQJ0WF/Vuwuu1m9X+VR90wmexVMlRn+GTmu1TtZGAR6fuIN3dDazKUCnPtwQjZHyP/f JTkVASl5NjFcbNZ1SAcK8VyxdeNzZWFvrLH6wt+GcnWJpC69xxq+Ytr7ERO1R5XOVLRb q6/g== X-Gm-Message-State: ALyK8tJU1pnXDnI2kqHJoEe3KPFqJaxz5Wx4+KTiXEV1TD7kR/dEXKNJnPqgB62qWAAK1dF3 X-Received: by 10.194.8.3 with SMTP id n3mr3423987wja.120.1465377697686; Wed, 08 Jun 2016 02:21:37 -0700 (PDT) Received: from localhost.localdomain (host81-129-171-215.range81-129.btcentralplus.com. [81.129.171.215]) by smtp.gmail.com with ESMTPSA id g192sm23694494wme.15.2016.06.08.02.21.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Jun 2016 02:21:37 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 13/20] pwm: sti: Supply PWM Capture register addresses and bit locations Date: Wed, 8 Jun 2016 10:21:28 +0100 Message-Id: <20160608092135.21184-14-lee.jones@linaro.org> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20160608092135.21184-1-lee.jones@linaro.org> References: <20160608092135.21184-1-lee.jones@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160608_022156_812911_26926AA7 X-CRM114-Status: GOOD ( 13.15 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a00:1450:400c:c09:0:0:0:232 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-pwm@vger.kernel.org, kernel@stlinux.com, devicetree@vger.kernel.org, patrice.chotard@st.com, robh+dt@kernel.org, thierry.reding@gmail.com, Lee Jones , maxime.coquelin@st.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org Signed-off-by: Lee Jones --- drivers/pwm/pwm-sti.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) -- 2.8.3 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/drivers/pwm/pwm-sti.c b/drivers/pwm/pwm-sti.c index c4a34af..2f61e1e 100644 --- a/drivers/pwm/pwm-sti.c +++ b/drivers/pwm/pwm-sti.c @@ -22,26 +22,48 @@ #include #define PWM_OUT_VAL(x) (0x00 + (4 * (x))) /* Device's Duty Cycle register */ +#define PWM_CPT_VAL(x) (0x10 + (4 * (x))) /* Capture value */ +#define PWM_CPT_EDGE(x) (0x30 + (4 * (x))) /* Edge to capture on */ #define STI_PWM_CTRL 0x50 /* Control/Config register */ #define STI_INT_EN 0x54 /* Interrupt Enable/Disable register */ +#define STI_INT_STA 0x58 /* Interrupt Status register */ +#define PWM_INT_ACK 0x5c #define PWM_PRESCALE_LOW_MASK 0x0f #define PWM_PRESCALE_HIGH_MASK 0xf0 +#define PWM_CPT_EDGE_MASK 0x03 +#define PWM_INT_ACK_MASK 0x1ff + +#define STI_MAX_CPT_DEVS 4 +#define CPT_DC_MAX 0xff /* Regfield IDs */ enum { /* Bits in PWM_CTRL*/ PWMCLK_PRESCALE_LOW, PWMCLK_PRESCALE_HIGH, + CPTCLK_PRESCALE, PWM_OUT_EN, + PWM_CPT_EN, PWM_CPT_INT_EN, + PWM_CPT_INT_STAT, /* Keep last */ MAX_REGFIELDS }; +/* Each capture input can be programmed to detect rising-edge, falling-edge, + * either edge or neither egde + */ +enum sti_cpt_edge { + CPT_EDGE_DISABLED, + CPT_EDGE_RISING, + CPT_EDGE_FALLING, + CPT_EDGE_BOTH, +}; + struct sti_pwm_compat_data { const struct reg_field *reg_fields; unsigned int num_devs; @@ -69,8 +91,11 @@ struct sti_pwm_chip { static const struct reg_field sti_pwm_regfields[MAX_REGFIELDS] = { [PWMCLK_PRESCALE_LOW] = REG_FIELD(STI_PWM_CTRL, 0, 3), [PWMCLK_PRESCALE_HIGH] = REG_FIELD(STI_PWM_CTRL, 11, 14), + [CPTCLK_PRESCALE] = REG_FIELD(STI_PWM_CTRL, 4, 8), [PWM_OUT_EN] = REG_FIELD(STI_PWM_CTRL, 9, 9), + [PWM_CPT_EN] = REG_FIELD(STI_PWM_CTRL, 10, 10), [PWM_CPT_INT_EN] = REG_FIELD(STI_INT_EN, 1, 4), + [PWM_CPT_INT_STAT] = REG_FIELD(STI_INT_STA, 1, 4), }; static inline struct sti_pwm_chip *to_sti_pwmchip(struct pwm_chip *chip)