From nobody Mon Feb 9 09:08:04 2026 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 696A11DF75B for ; Fri, 14 Nov 2025 14:56:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763132174; cv=none; b=jboye06DPv5+eKUuo+sKMEJp7OnwC+K7fO3gXkP7hqDY9DIgOJNM2HfmqRw1CYJn7btdGDGbspf8LJX2HDIJ9T7/g0Rqh+t6pm75zAc19qLbECGdwABF97DSfJkNHfcN/g8AhumIoTK2DM5oWTynMefKyGyOGV+msgb4u0zFh60= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763132174; c=relaxed/simple; bh=nhXoDjA1PWTMn6uiehqF3ffeV5CNc4kbk1M8EgQv+DQ=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=dg4XLkmmmA7Zos4bayLEjg/01rkDaEUSaXO3R524wfBg+hm7lg4QCgDPs0BheYX+DGNzsa2yJNn3B5Q+HjKE83pn41jkwF8eUFNglfXZ6MzuGaxfl3V+/Dx0LRcJ5uAX9zmAQlsFOSxLwhiAOGME7ACGwULgpH0L0Rr8b2d1f+U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=fjdxNwwy; arc=none smtp.client-ip=209.85.128.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fjdxNwwy" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-47118259fd8so16041115e9.3 for ; Fri, 14 Nov 2025 06:56:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1763132170; x=1763736970; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=WiVLm9glz9q/D2Y2GvnPtcV9YqAxrkU1bdmECATlQW4=; b=fjdxNwwy5XkzQ4nDATT1xxVdJWrOJWuLJUT5g2lx5qwLHHb02DdejrtfS7QJacKGRl T+HGwCakMQHCYnpLx6DhVxYkz3EwrsV95+YbAYat0ucJfDBFLIXX2FIGxsMtyNUoFCCu DjDZ/RoHvwKn006fWE6Jqhrs5DU6sboF8Z+f1uSOxs6tLtho8vCZ1DfEd1An1DZ9s7GY iMD6LT57JYKstTmZfINDdqZ9xxxol/MBVMF+IDkrxB6OkovouD7fooeFBQqgMonVyekt B4jXR3CdoQaZ18YWWmeGCqHtY5pCOLoAo6F/qJSXXfWh/EpPfFuYrnl2P8iwdNeWUrHT Fj8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763132170; x=1763736970; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=WiVLm9glz9q/D2Y2GvnPtcV9YqAxrkU1bdmECATlQW4=; b=Nqa2bV/QrX1Dm3lgtQxaVnpq9XsdDlkWB5OEa+Fj+Rt1rFzHGnv38JNuW8OTub+kFa Cxz76qZCD2pS0NDO9V3PrBS5VfgyP9WB5NSFIN2Eh8yun640VJ6sM46c1tA0pe9dBTrV LNlY4c/M/1O0LlpApWoL0yUKqvz9+bdHJrwCifcS9gZpjRDcU6HsCno6xEMCt0VWRXVa XVIrtpOag81Vurd0756zrQWr7SGR/m+1A3NNDMgzA8DhFa8JpCGdl9ALg/QOY0mRIUmM 9oX3Eohp3HHA89WPih7qWzOQ5G2ECKOKNWAl7kmzi+C94oq2HWeu/CLNjHs7RRCIZSk4 iyKA== X-Forwarded-Encrypted: i=1; AJvYcCVBsafUDzZOqFeqkr8DpNnHlk9z3UMlmXACkwPiQZoXNZ9ibUG6EDwae7QKYYynt+ngsfXYVd/OxcMNLso=@vger.kernel.org X-Gm-Message-State: AOJu0YzQmBZG5DmRl6V07ofz1pcQo0w9sLXpuInvB4b+U9W2WjtrI7ZI yQt+JamYoH1GEbnOL1/F+at5YBo1rFPOEn8LkqVSuxyWMPr2tehPEbqn X-Gm-Gg: ASbGnctwF9JcZnMTdg9wd5Xg4PJDRsGbJGXeokb98WziMnJIFYmkt8GM0vbX/qb8Zeq BQ62BH2lge2Y/mhzZz3Qj85EFhg95sXJvWHZKKU+XQlpd6JbDDL4n7uiI7hEJ1641PTYB/legZU TwbnlgjslplH9gn0WFpgDXbevLVdyQpU44vSt9yEI6AUgqb4ND91kMcYxDgX2iySi6sYjclUCjI JljS4ER81hg+/HMajGChSP/ZL9K/eXBV30bQ0Fl1LiPLPlpC4Mf5aF9/iLkJ8+ZkM56kewBvM3k kvoK/kNmlRHJ0lXuVFnXFqdh37p0x0q+yBb5vbytcaT1rJltbMqt6k6TxoIPW4zBB4yISMmQAxF 3942Bsdaq8t0sEKQ1WNG9gKcok7QVCV6bcOMer/NwIxnvvZipSuE4g8cnC0gbahozpghXMZc1DH ZKr9oYDrhooqoUjMAT00o5MZeUw8RYmCWCQZtWDIfVTwmVCwH6JYic2BIuChc4wTDXX/GsqOzuO RvZDOPPQN7vSpH3 X-Google-Smtp-Source: AGHT+IFzsL9fkHuLUlOZ0H7+bcguyZLzKvaRulLdHVAWsB/gVcOA7RfTg5kpkh6+zj/vIpjFoqRACQ== X-Received: by 2002:a05:600c:1387:b0:477:7b30:a6fc with SMTP id 5b1f17b1804b1-4778feb13femr39245125e9.30.1763132169611; Fri, 14 Nov 2025 06:56:09 -0800 (PST) Received: from localhost.localdomain (host86-162-200-138.range86-162.btcentralplus.com. [86.162.200.138]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4778bd27e97sm47073115e9.7.2025.11.14.06.56.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Nov 2025 06:56:09 -0800 (PST) From: Biju X-Google-Original-From: Biju To: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Cc: Biju Das , linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven , Prabhakar Mahadev Lad , Biju Das , linux-renesas-soc@vger.kernel.org, stable@kernel.org Subject: [PATCH v4] pwm: rzg2l-gpt: Reinitialize the cache value in rzg2l_gpt_disable() Date: Fri, 14 Nov 2025 14:56:01 +0000 Message-ID: <20251114145606.200948-1-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Biju Das The rzg2l_gpt_config() test the rzg2l_gpt->period_tick variable. This check is not valid, if enabling of a channel happens after disabling all the channels as it test against the cached value. Therefore, reinitialize the variable rzg2l_gpt->period_tick to 0 in rzg2l_gpt_disable(), when all the logical channels of a hardware channel is disabled. Cc: stable@kernel.org Fixes: 061f087f5d0b ("pwm: Add support for RZ/G2L GPT") Signed-off-by: Biju Das --- v3->v4: * Split the patch as separate from [1] for easy merging. * Updated commit description * Added comments about the fix in rzg2l_gpt_disable() v3: * New patch [1] https://lore.kernel.org/all/20250915163637.3572-1-biju.das.jz@bp.renesa= s.com/#t --- drivers/pwm/pwm-rzg2l-gpt.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/pwm/pwm-rzg2l-gpt.c b/drivers/pwm/pwm-rzg2l-gpt.c index 360c8bf3b190..ab91bfd7da48 100644 --- a/drivers/pwm/pwm-rzg2l-gpt.c +++ b/drivers/pwm/pwm-rzg2l-gpt.c @@ -190,8 +190,17 @@ static void rzg2l_gpt_disable(struct rzg2l_gpt_chip *r= zg2l_gpt, /* Stop count, Output low on GTIOCx pin when counting stops */ rzg2l_gpt->channel_enable_count[ch]--; =20 - if (!rzg2l_gpt->channel_enable_count[ch]) + if (!rzg2l_gpt->channel_enable_count[ch]) { rzg2l_gpt_modify(rzg2l_gpt, RZG2L_GTCR(ch), RZG2L_GTCR_CST, 0); + /* + * The rzg2l_gpt_config() test the rzg2l_gpt->period_tick + * variable. This check is not valid, if enabling of a channel + * happens after disabling all the channels as it test against + * the cached value. Therefore, reinitialize the variable + * rzg2l_gpt->period_tick to 0. + */ + rzg2l_gpt->period_ticks[ch] =3D 0; + } =20 /* Disable pin output */ rzg2l_gpt_modify(rzg2l_gpt, RZG2L_GTIOR(ch), RZG2L_GTIOR_OxE(sub_ch), 0); --=20 2.43.0