From patchwork Wed Mar 2 15:32:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 63396 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp2449134lbc; Wed, 2 Mar 2016 07:36:28 -0800 (PST) X-Received: by 10.98.87.5 with SMTP id l5mr37236612pfb.101.1456932988584; Wed, 02 Mar 2016 07:36:28 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id g14si28865593pfd.189.2016.03.02.07.36.28 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 Mar 2016 07:36:28 -0800 (PST) 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; 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; dkim=neutral (body hash did not verify) header.i=@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 1ab8o8-0005qn-R9; Wed, 02 Mar 2016 15:35:24 +0000 Received: from mail-wm0-x231.google.com ([2a00:1450:400c:c09::231]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ab8nN-0004MC-Mv for linux-arm-kernel@lists.infradead.org; Wed, 02 Mar 2016 15:34:39 +0000 Received: by mail-wm0-x231.google.com with SMTP id l68so91154611wml.0 for ; Wed, 02 Mar 2016 07:34:20 -0800 (PST) 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=IFESZwlOLqSbn4OrxWQ3nTTQplgmzwcWRWqqbuq2VBo=; b=gIvEsKI4EA+J8oMAI5/3QK8+JmlXhfpPkDB/jQu/fiuGli0av/at0jcyS8DWrbBc6N 7/Qn3ctsq7EKXvmb08pfC1kgIILkWPaW3NMPWdcHjj0X2mt5q6n+5RB5dwb2si1qYg8w S65k3lFlj/S92BACsEbZrIJ6k5TEc/cqNAUHA= 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=IFESZwlOLqSbn4OrxWQ3nTTQplgmzwcWRWqqbuq2VBo=; b=j1o8ZS5RAgURzyy9yVWZl+MAZffQl+XIOUXSzRsu6GduvIwfe5c9lfsAA6eJmZ9lJ0 cL+N7zt2ztk61HhEfuBV+/Mg2bPybnrxS52EGZCnxjh23cXBzRdUqPcIjv7wJ5FH2Ruc Diabvs0lD0r7slA1lxW20KLK92oBJuJ2FqY2dLAfbyuoVGtV6uCJFwAiSSaB4Y3YgshO wSui1H1v2w21byvdQGGpwMsYC67TVed0eJ1YsJpyCZf5ww2A5CJzUZQPqACRg/tmKI3V XWWr1+0VhSh8fI8rVayyj+0TWjEBwmmDM3lAtePqmoL1xFFhm/cMbkEYRQU732X9WP3m 9aFg== X-Gm-Message-State: AD7BkJJx4r69XaCR/vJtiXowWv+dJKcG1EzK3Q68ibKtjINbNLG5VTK2XWmxCYXBfeHebB+T X-Received: by 10.194.175.33 with SMTP id bx1mr27053284wjc.104.1456932858981; Wed, 02 Mar 2016 07:34:18 -0800 (PST) Received: from localhost.localdomain (host81-154-142-245.range81-154.btcentralplus.com. [81.154.142.245]) by smtp.gmail.com with ESMTPSA id da6sm26941407wjb.24.2016.03.02.07.34.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 02 Mar 2016 07:34:18 -0800 (PST) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [RESEND 05/11] pwm: sti: Supply PWM Capture register addresses and bit locations Date: Wed, 2 Mar 2016 15:32:03 +0000 Message-Id: <1456932729-9667-6-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1456932729-9667-1-git-send-email-lee.jones@linaro.org> References: <1456932729-9667-1-git-send-email-lee.jones@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160302_073438_084187_5E8FFF9C X-CRM114-Status: GOOD ( 12.18 ) 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:231 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_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 -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 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, ajitpal.singh@st.com, 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(+) -- 1.9.1 _______________________________________________ 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 aa217e2..2336bac 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))) /* Channel'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_CHANS 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_chan; @@ -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)