From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oi1-f173.google.com (mail-oi1-f173.google.com [209.85.167.173]) (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 298F52D837C for ; Wed, 20 May 2026 13:34:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779284067; cv=none; b=CSJ/KWgjXahfn/7BKFBcoUyAIS1c466iNbjidhqT0Tacya+Y6dtyAC+bSgV29g6SNhU5N8JWpZRBjRu74lCDdf8ATvXL0BrU52XJWCp3JyOquah9GeyV5XerkKlEm7LQZ6oVMZNNBl1NUJ6TdFtKmZpGIfk/lS1fs3IPu7uJCNQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779284067; c=relaxed/simple; bh=33+ik9qldfzElfwEbUFdDRSw3s77jyByMHu+q2J05gI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DcXL/kPrn1tfhGtXWVf6DrHWiBRXkHG0Ra59sASY1OmkLDHGdt3cESqkaAaJJVMlXV4bgGJwNKsDNad7rp7kFucHMbqQUo8D0SsZYDwB8Uz7h84gNQTdoJX44hj43JRGhQhdCDTDvdRLcjNmeRdFIP07nxhqDZYLKfIqrgy2mm4= 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=VGQkL1Tj; arc=none smtp.client-ip=209.85.167.173 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="VGQkL1Tj" Received: by mail-oi1-f173.google.com with SMTP id 5614622812f47-479d85152c9so1823706b6e.2 for ; Wed, 20 May 2026 06:34:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779284065; x=1779888865; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vDbe/ecn+aILq8lwi+Q4VCno4aximoHPHL06TCJTUbc=; b=VGQkL1TjfYqFkDOBcz9/aqaw3XxRpnBGYZLrhrtR0RcVLgAhX76mrx9dJAWhh90XhT d8yp+vCO+o4U66bc18nYe1u378LR+s6cE1kEOvifD10kI+S3nXr/0/crP/FszsJ9nSrQ YdaW29FY1gIcEej5szMCuFiexjLR+udmIQlBBdZRW1lNuzYkjpjf1kf3pR2QOloUChHv yMTT8fphMroh4Sj5IAkOI+KZx++4dFssSNImWPxCXjl1babT7C4HUqrzWNZE0MRgeZ7a lCGiKseoPWu8CdVcUh3hPF5F/DPw4Bw0YOD5bFcwNCiZ5E5mHmusySyQ9OkvQWrwomjT thMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779284065; x=1779888865; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=vDbe/ecn+aILq8lwi+Q4VCno4aximoHPHL06TCJTUbc=; b=GXqc51jpXapYfb64ohuX/0OEdLRe11M0oBhh9mNCGNeXhvBT4ETe323Cz+Ghi5XOd/ i5UoY5Tbv/1vHg8mvhjSjHAdMlSUCjyOHbI6mLlWPi914cHmOvhCaDsj+ty088Ixxyzl X3uC9XrZoP0VKVKeestzJbXnHBp+9PE+z6ssE3VD+FQYIvB+CU6VrOpBYGb3MbdNuFXw V+gHy3Hbhs83jaRIN0nwRrPA6Gs3kTGX9YjFggiyN+RhGC0MOMfQ3fRTPhozFea52q0q 0vc1rS9ZJb31I1CS8nOm7Y5yPHV7f6QVsGBxhRFdIxqAd5LK2gJzQObvrT0Nc7S/jxCB 57PA== X-Gm-Message-State: AOJu0YyGfJt2Kv+tmkCfc9IweN20nJEZpy1RwfSgISNwPwRsp0VLwynV G3Mee6yJ8NgRYY3o9DhudNWdN4+++OQCQtQ+roRAPsEIbSUdOaPhsOqP6VZXkTNa X-Gm-Gg: Acq92OG5NjaESobjSYF83FzPIC0k5/e+4RPRhe9boiYhJDteNMnPraG65jVy7e/vzUy V2UxZnVq1dmDSs2nIW/W/v9W+TeiuZB0mO9aBlE4BK50ChEIAlf46pKf7lEZ7UT3ttalqUO4Hq5 n7zNKaFIi2K73iqoEW9vN9rQ/RLWRd21n8KI4OP6WwgWh054SwC7eZyNYfRJUia2ltEhJ5aajO3 7hV/UFzhHSFWRJUlwdwpWG6/Q/mYX6jsV1781CQIV0IJZ9HT71etA6vCqHBfZWB4eELyzPBszu1 KtxiieTppGj32bb4sqWBJOftFWzFaB9fvgsdxX5QTIBqk3vs6BJxs3sV84vREv7e9LAtcpC/9NF q8q4AtgDygIWrGKdTu6p73wCWxmIbgbx4mOTj2OCenhf7DWWez+hbZLAH3sqh5pvEpjGgcaQKox SehbvybV+hQFz8Eju023yLwpnXjXFiWa6iZQ31Grc= X-Received: by 2002:a05:6808:3986:b0:482:dae4:23cd with SMTP id 5614622812f47-482e564d54cmr16908898b6e.10.1779284065074; Wed, 20 May 2026 06:34:25 -0700 (PDT) Received: from arch.localdomain ([2409:8a28:a52:5b11:a58f:5208:2fa7:bba5]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-43a956fa075sm10253951fac.10.2026.05.20.06.34.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 May 2026 06:34:24 -0700 (PDT) From: Jun Yan To: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-leds@vger.kernel.org Cc: lee@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, luccafachinetti@gmail.com, pzalewski@thegoodpenguin.co.uk, daniel@zonque.org, Jun Yan Subject: [PATCH v6 6/6] leds: is31fl32xx: Move pwm frequency setting to init_regs() Date: Wed, 20 May 2026 21:33:43 +0800 Message-ID: <20260520133343.1423946-7-jerrysteve1101@gmail.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260520133343.1423946-1-jerrysteve1101@gmail.com> References: <20260520133343.1423946-1-jerrysteve1101@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Commit a18983b95a61 ("leds: is31fl32xx: Add support for is31fl3293") swapped the order of is31fl32xx_parse_dt() and is31fl32xx_init_regs(). This causes the PWM frequency configuration programmed in is31fl32xx_parse_dt() to be overwritten by the register reset operation performed in is31fl32xx_init_regs(). Move the PWM frequency setting logic from is31fl32xx_parse_dt() to is31fl32xx_init_regs() and separates device tree parsing from hardware initialization. Fixes: a18983b95a61 ("leds: is31f132xx: Add support for is31fl3293") Signed-off-by: Jun Yan --- drivers/leds/leds-is31fl32xx.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/drivers/leds/leds-is31fl32xx.c b/drivers/leds/leds-is31fl32xx.c index 5678c2273bbd..3e86e414c532 100644 --- a/drivers/leds/leds-is31fl32xx.c +++ b/drivers/leds/leds-is31fl32xx.c @@ -63,6 +63,7 @@ struct is31fl32xx_priv { struct i2c_client *client; struct gpio_desc *powerdown_gpio; unsigned int num_leds; + bool pwm_22khz; struct is31fl32xx_led_data leds[]; }; @@ -346,6 +347,14 @@ static int is31fl32xx_init_regs(struct is31fl32xx_priv *priv) if (ret) return ret; + if ((cdef->output_frequency_setting_reg != IS31FL32XX_REG_NONE) && + priv->pwm_22khz) { + ret = is31fl32xx_write(priv, cdef->output_frequency_setting_reg, + IS31FL32XX_PWM_FREQUENCY_22KHZ); + if (ret) + return ret; + } + /* * Set enable bit for all channels. * We will control state with PWM registers alone. @@ -420,7 +429,6 @@ static struct is31fl32xx_led_data *is31fl32xx_find_led_data( static int is31fl32xx_parse_dt(struct device *dev, struct is31fl32xx_priv *priv) { - const struct is31fl32xx_chipdef *cdef = priv->cdef; int ret = 0; /* Driving this GPIO line low takes the chip out of shutdown, @@ -431,17 +439,7 @@ static int is31fl32xx_parse_dt(struct device *dev, return dev_err_probe(dev, PTR_ERR(priv->powerdown_gpio), "Failed to get powerdown gpio\n"); - if ((cdef->output_frequency_setting_reg != IS31FL32XX_REG_NONE) && - of_property_read_bool(dev_of_node(dev), "issi,22khz-pwm")) { - - ret = is31fl32xx_write(priv, cdef->output_frequency_setting_reg, - IS31FL32XX_PWM_FREQUENCY_22KHZ); - - if (ret) { - dev_err(dev, "Failed to write output PWM frequency register\n"); - return ret; - } - } + priv->pwm_22khz = of_property_read_bool(dev_of_node(dev), "issi,22khz-pwm"); for_each_available_child_of_node_scoped(dev_of_node(dev), child) { struct led_init_data init_data = {}; -- 2.54.0