From patchwork Wed Oct 27 18:45:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ma=C3=ADra_Canal?= X-Patchwork-Id: 12587781 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A705AC433F5 for ; Wed, 27 Oct 2021 18:45:50 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4339061039 for ; Wed, 27 Oct 2021 18:45:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4339061039 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=usp.br Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 961136E81D; Wed, 27 Oct 2021 18:45:49 +0000 (UTC) Received: from mail-qv1-xf2a.google.com (mail-qv1-xf2a.google.com [IPv6:2607:f8b0:4864:20::f2a]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3C1896E81D for ; Wed, 27 Oct 2021 18:45:47 +0000 (UTC) Received: by mail-qv1-xf2a.google.com with SMTP id v2so2399202qve.11 for ; Wed, 27 Oct 2021 11:45:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=usp.br; s=usp-google; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding; bh=A8jRX0QKAYjn4xUH+e8/6epT1HZFBjy/zHPwJDB1y2I=; b=K7U4qb/VrSu9y/l5QSpg4GLpjpE4DHWO65bczNlJoB1bhg0hrBqn3A2T9fiY4T9G1g seete8LDVmbo2J1tkmUUXb9HYEP8271eMBDURzJpf5RxcTnfL7vxJJPZS7FPEvONUtud nRu15MNY7Qnclb5uhqiaNzLfSszJN3m+M5eaNSngck+D+4grh5sOhleX8EODccBJs2FN e/05bu5jx8ovF5sjSKKVwJB0UFhySD55QjgCEYrHriMh+olhHW3nyVUzF5iRdD5bNI5n rZ/O0E7ucfpdN4GUAqb5oTr6AHd8AkSJRCpU8Ls4lDq5Gg2fr7xWHHZJZ2oPH8I4Qil4 zvEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding; bh=A8jRX0QKAYjn4xUH+e8/6epT1HZFBjy/zHPwJDB1y2I=; b=r194mzNESoHenb6471ZPIZyEoSv15QGaHrOKRaKV1Jgwvz+hyoKMmmnxPi0HyIlnU0 MLboGyOlWqvBTc2TfS9irqrKyGRotAkDP2xx9b/rxqc2QukgRBMkSd/tr93Hv0XDB0zg zc+xF/Mj3Omz1yGJfD+trZxfSGqEdIgGEg3WKFZS5RrHJcQvHBElyYeTamT5H7QuGHP/ p91qamsoX8GwBqs/qrKBW4PZxtMFKXLLVB5J9qKk5LGQRUXEeGvYZM85b7mAG3ykVfnv fevIliOL8uZQ4CvKVdWq27vBQ11u5azGIMD5DKjLq7TCCBS8Zuh+ytt0FjN1CKpTdNNx PpNQ== X-Gm-Message-State: AOAM530K+ebicdUdHSHi9VK8i6JzYDyFwAcOuFuCgFyuBCHu/25Ubssw yIe3um9LdrG4gFig8q3maNrJFA== X-Google-Smtp-Source: ABdhPJxctVR5Fb0BHbs0MVwHi/Q9mP9WYyhqidbxuJ/DJ9RSpTJk1zR1ZuujvluUZFWvXr0TH+VRow== X-Received: by 2002:a05:6214:cce:: with SMTP id 14mr31764551qvx.49.1635360346759; Wed, 27 Oct 2021 11:45:46 -0700 (PDT) Received: from fedora ([187.64.134.142]) by smtp.gmail.com with ESMTPSA id i67sm461196qkd.90.2021.10.27.11.45.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Oct 2021 11:45:46 -0700 (PDT) Date: Wed, 27 Oct 2021 15:45:40 -0300 From: =?iso-8859-1?q?Ma=EDra?= Canal To: lee.jones@linaro.org, daniel.thompson@linaro.org, jingoohan1@gmail.com, thierry.reding@gmail.com, u.kleine-koenig@pengutronix.de Cc: lkp@intel.com, llvm@lists.linux.dev, dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-pwm@vger.kernel.org Subject: [PATCH v2] backlight: lp855x: Switch to atomic PWM API Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Remove legacy PWM interface (pwm_config, pwm_enable, pwm_disable) and replace it for the atomic PWM API. Signed-off-by: MaĆ­ra Canal Reported-by: kernel test robot --- V1 -> V2: Initializing variable and simplyfing conditional loop --- drivers/video/backlight/lp855x_bl.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/drivers/video/backlight/lp855x_bl.c b/drivers/video/backlight/lp855x_bl.c index e94932c69f54..a895a8ca6d26 100644 --- a/drivers/video/backlight/lp855x_bl.c +++ b/drivers/video/backlight/lp855x_bl.c @@ -233,9 +233,8 @@ static int lp855x_configure(struct lp855x *lp) static void lp855x_pwm_ctrl(struct lp855x *lp, int br, int max_br) { - unsigned int period = lp->pdata->period_ns; - unsigned int duty = br * period / max_br; - struct pwm_device *pwm; + struct pwm_device *pwm = NULL; + struct pwm_state state; /* request pwm device with the consumer name */ if (!lp->pwm) { @@ -244,19 +243,15 @@ static void lp855x_pwm_ctrl(struct lp855x *lp, int br, int max_br) return; lp->pwm = pwm; - - /* - * FIXME: pwm_apply_args() should be removed when switching to - * the atomic PWM API. - */ - pwm_apply_args(pwm); } - pwm_config(lp->pwm, duty, period); - if (duty) - pwm_enable(lp->pwm); - else - pwm_disable(lp->pwm); + pwm_init_state(pwm, &state); + + state.period = lp->pdata->period_ns; + state.duty_cycle = br * state.period / max_br; + state.enabled = state.duty_cycle; + + pwm_apply_state(pwm, &state); } static int lp855x_bl_update_status(struct backlight_device *bl)