From patchwork Mon Oct 24 20:52:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 10402 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp706949wru; Mon, 24 Oct 2022 16:43:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4mJJGFSJPA8mq96Q9FebT+V2uNfQCcMR8OITuDB6sb1SQjvWkAb1Nq56voZiERewMV+/pq X-Received: by 2002:aa7:9212:0:b0:562:b5f6:f7d7 with SMTP id 18-20020aa79212000000b00562b5f6f7d7mr36872160pfo.70.1666654988218; Mon, 24 Oct 2022 16:43:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666654988; cv=none; d=google.com; s=arc-20160816; b=ST67tPQ3sLMyFBuQ0Q6t60J9q+qy0nZB2MMOnKeQpP7ldmqjr8n3a27TA/YpdF1qo2 4D1c4iic7ZFKgWPcFToKnPMqh8nD9VkH+nc/oCMERzlCLfWdUjNJ+fgoYJidyaZA1smC oGlckvco5196BOY1pMm5m9Tg6T8aGwj8cdbK9dqj3eVmUrjA2/SipG3TL99dCaWUXel/ vt3/7s8bruuga9wXK+M2NhdIBddqwEc5RsyYFvg6y4tJ5kgei7OI+ZhqU78ZAV9JF0OK vnR/bpLb/w7sNeVQdYolo1EzEmq1KoiygTb0XG+HQ7SJRaWn2fmXqcByRWRXd9+3h9C3 jI5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=HPp+33aYNoQqAGKipSoPytGt3HFjbS0IYlzYnBXZnaU=; b=gepoVww7uZW+oOcW4AOh8GvM1WLCEhnZ9a+YdO5x81N/XBm4/tdSKfclXhM2JoLyv7 JZmETl5yBKxvzG4A9UBZoWuP/YPk76vHUgc7SWiS6XZ/pxEif7sO+kaUWpwKa1JGueGF Xe0q7CfBVxYsjv7n/HXr73ooRasQ45ezUyt2Dh0xy5huTEj0DW938EHS1thVf8iw/wpv q3NANjg9gz2iajep+ELQLrM6qNeNZhxpSjbg+rikeI4i960JtBilZyV+RW1WSnWOzuEo ULY9tdJsc0nSsBtHMvurIMRXuDYL+5rgOxwB7WrbmGXoKLyHkE7/1okkKXRZ3P117qS8 OFIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=jmCmEXMj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u11-20020a65670b000000b00460b9d08d7bsi948077pgf.868.2022.10.24.16.42.55; Mon, 24 Oct 2022 16:43:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=jmCmEXMj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231345AbiJXXcN (ORCPT + 99 others); Mon, 24 Oct 2022 19:32:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231297AbiJXXbq (ORCPT ); Mon, 24 Oct 2022 19:31:46 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 017771D4DFA; Mon, 24 Oct 2022 14:52:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666644743; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HPp+33aYNoQqAGKipSoPytGt3HFjbS0IYlzYnBXZnaU=; b=jmCmEXMjhFZ7z+eIBo9HtNqhmipvRftvCUfSkfxFDQLiBRNfB9VrBmbvT96g75zhyIZIce shnY8wpFnn7y/GovUG363mZ+WURakSFyv420pdTbBDBiPOx0yoe+99bQVAb/OULG5PUbgE R7g4gCSz49qRygDCKTsSTHba6xJ1CCw= From: Paul Cercueil To: Thierry Reding , =?utf-8?q?Uwe_Kleine-K=C3=B6n?= =?utf-8?q?ig?= Cc: od@opendingux.net, linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, Paul Cercueil Subject: [PATCH 5/5] pwm: jz4740: Use regmap_{set,clear}_bits Date: Mon, 24 Oct 2022 21:52:13 +0100 Message-Id: <20221024205213.327001-6-paul@crapouillou.net> In-Reply-To: <20221024205213.327001-1-paul@crapouillou.net> References: <20221024205213.327001-1-paul@crapouillou.net> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747614420568793956?= X-GMAIL-MSGID: =?utf-8?q?1747614420568793956?= Simplify a bit the code by using regmap_set_bits() and regmap_clear_bits() instead of regmap_update_bits() when possible. Signed-off-by: Paul Cercueil Reviewed-by: Philippe Mathieu-Daudé Acked-by: Uwe Kleine-König --- drivers/pwm/pwm-jz4740.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/pwm/pwm-jz4740.c b/drivers/pwm/pwm-jz4740.c index c0afc0c316a8..22fcdca66081 100644 --- a/drivers/pwm/pwm-jz4740.c +++ b/drivers/pwm/pwm-jz4740.c @@ -88,8 +88,7 @@ static int jz4740_pwm_enable(struct pwm_chip *chip, struct pwm_device *pwm) struct jz4740_pwm_chip *jz = to_jz4740(chip); /* Enable PWM output */ - regmap_update_bits(jz->map, TCU_REG_TCSRc(pwm->hwpwm), - TCU_TCSR_PWM_EN, TCU_TCSR_PWM_EN); + regmap_set_bits(jz->map, TCU_REG_TCSRc(pwm->hwpwm), TCU_TCSR_PWM_EN); /* Start counter */ regmap_write(jz->map, TCU_REG_TESR, BIT(pwm->hwpwm)); @@ -129,8 +128,7 @@ static void jz4740_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm) * In TCU2 mode (channel 1/2 on JZ4750+), this must be done before the * counter is stopped, while in TCU1 mode the order does not matter. */ - regmap_update_bits(jz->map, TCU_REG_TCSRc(pwm->hwpwm), - TCU_TCSR_PWM_EN, 0); + regmap_clear_bits(jz->map, TCU_REG_TCSRc(pwm->hwpwm), TCU_TCSR_PWM_EN); /* Stop counter */ regmap_write(jz->map, TCU_REG_TECR, BIT(pwm->hwpwm)); @@ -204,8 +202,8 @@ static int jz4740_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, regmap_write(jz4740->map, TCU_REG_TDFRc(pwm->hwpwm), period); /* Set abrupt shutdown */ - regmap_update_bits(jz4740->map, TCU_REG_TCSRc(pwm->hwpwm), - TCU_TCSR_PWM_SD, TCU_TCSR_PWM_SD); + regmap_set_bits(jz4740->map, TCU_REG_TCSRc(pwm->hwpwm), + TCU_TCSR_PWM_SD); if (state->enabled) { /*