From patchwork Wed Mar 2 15:32:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 63390 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp2448432lbc; Wed, 2 Mar 2016 07:35:01 -0800 (PST) X-Received: by 10.66.147.164 with SMTP id tl4mr38309669pab.40.1456932901400; Wed, 02 Mar 2016 07:35:01 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id rr8si20044786pab.223.2016.03.02.07.35.01; Wed, 02 Mar 2016 07:35:01 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dkim=pass header.i=@linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755130AbcCBPe2 (ORCPT + 30 others); Wed, 2 Mar 2016 10:34:28 -0500 Received: from mail-wm0-f53.google.com ([74.125.82.53]:35749 "EHLO mail-wm0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755036AbcCBPeZ (ORCPT ); Wed, 2 Mar 2016 10:34:25 -0500 Received: by mail-wm0-f53.google.com with SMTP id l68so91158629wml.0 for ; Wed, 02 Mar 2016 07:34:24 -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=e4nsI+g5x3zYi1KSKwnoviBci+yiFecD6/PZTyrAdok=; b=QiYeJEy3khdFsQEW1iiIDc89IxeOVQ2+Y9pWXhyJTT9aWWKAYES+PjMJYy7639Wt88 KlLW0zjD+5hHhlt+tn5K2va+j21UfTlYpt2Hahe1EXdtXDg4+bdBfPJwK32xfVQziY2c xzxTkeFcU+I4wNrS89aTywITyZgnm7sy5lmBU= 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=e4nsI+g5x3zYi1KSKwnoviBci+yiFecD6/PZTyrAdok=; b=VyYxyJJDu7hAK0MRcWdlDZh7ak74kyAduDWrEpw8ExDP24qf+oNvRfjxv/+SMrepl9 efOWrYqmAsGu4T/DyzhZDTT91JUQZo2a2lVDllhQsru9WYYaa04qu0iabCmJBCy9jI6p sC1xLG5OGVk0hkLaDuWyt/6D6gov/v6rpaBBOkEikg2FEe+SfBbnk3PCTj1q5BvTvh0l eydoh9vyMdlsKAxixAre58Q+CYPaaeipFmk0ZuWoBpahUz8f09IDjrG4NIO6C3PTkgaD yVFyMvhuNta2cjOsDi3V25Ffg7etVfvYyjcPuq6Z1uOY357/fbeG0sIocnTl3221MF5b h4jQ== X-Gm-Message-State: AD7BkJLL0xfcqZkwh/1/QEe4OF/6opXU4jHQ1ZI04Q8QNTW7OPUg20/SiLqJlVWF3nrSQeYP X-Received: by 10.194.77.167 with SMTP id t7mr25729874wjw.90.1456932864079; Wed, 02 Mar 2016 07:34:24 -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.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 02 Mar 2016 07:34:23 -0800 (PST) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: kernel@stlinux.com, maxime.coquelin@st.com, thierry.reding@gmail.com, linux-pwm@vger.kernel.org, ajitpal.singh@st.com, Lee Jones Subject: [RESEND 10/11] pwm: sti: Enable PWM Capture Date: Wed, 2 Mar 2016 15:32:08 +0000 Message-Id: <1456932729-9667-11-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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Once all functionality is in place, we provide the means to enable PWM Capture. Here we are simply obtaining the associated regmap and twiddling the relevant enable register bits. Signed-off-by: Lee Jones --- drivers/pwm/pwm-sti.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) -- 1.9.1 diff --git a/drivers/pwm/pwm-sti.c b/drivers/pwm/pwm-sti.c index 8de9b4a..93cf20e 100644 --- a/drivers/pwm/pwm-sti.c +++ b/drivers/pwm/pwm-sti.c @@ -279,6 +279,13 @@ static int sti_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm) pwm->hwpwm); goto out; } + + ret = regmap_field_write(pc->pwm_cpt_en, 1); + if (ret) { + dev_err(dev, "failed to enable PWM capture:%d\n", + pwm->hwpwm); + goto out; + } } pc->en_count++; out: @@ -296,6 +303,7 @@ static void sti_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm) return; } regmap_field_write(pc->pwm_out_en, 0); + regmap_field_write(pc->pwm_cpt_en, 0); clk_disable(pc->pwm_clk); clk_disable(pc->cpt_clk); @@ -492,6 +500,11 @@ static int sti_pwm_probe_dt(struct sti_pwm_chip *pc) if (IS_ERR(pc->pwm_out_en)) return PTR_ERR(pc->pwm_out_en); + pc->pwm_cpt_en = devm_regmap_field_alloc(dev, pc->regmap, + reg_fields[PWM_CPT_EN]); + if (IS_ERR(pc->pwm_cpt_en)) + return PTR_ERR(pc->pwm_cpt_en); + pc->pwm_cpt_int_en = devm_regmap_field_alloc(dev, pc->regmap, reg_fields[PWM_CPT_INT_EN]); if (IS_ERR(pc->pwm_cpt_int_en))