From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f175.google.com (mail-pg1-f175.google.com [209.85.215.175]) (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 0B18F3A16B9 for ; Wed, 17 Jun 2026 05:39:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781674788; cv=none; b=MBJTMYYN86LHaEax8GMIcZJGdCXHFywhX+e2qaQBEKWLQiVrrNIreBgYhYwLllDxp+i8HNzjgS8v/TdhqVGpsgtSZnsL1Ggt+EcqWeK9MJW+6HULyG4Qax6tEwEEl3KIr+fX0fcYFEVeGfZUv1avi40KJLLC+jOm5oJlIQU234E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781674788; c=relaxed/simple; bh=UHZCVozcM2EcJKws2E/C7a5uOhbIOrIOnfe4myFgS98=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=gF0/lYaMuhkEYZhBYzBTbyZzr+1rkQpiPRz5s4CyFrr+NHAgTu0vEet/Tda/ocLGtFsHkZh3cbnzjUWYDhzGcZ21VwfqRfVO6O5tLMCnEpuJrqrQ4pK+QDi7BAO5zL8zcr7bRvY7mCOqKJQ0vbAFpC6UWkXjDf34KAAPOHUMgwM= 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=PMS4h1Lt; arc=none smtp.client-ip=209.85.215.175 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="PMS4h1Lt" Received: by mail-pg1-f175.google.com with SMTP id 41be03b00d2f7-c858961a8efso2277334a12.2 for ; Tue, 16 Jun 2026 22:39:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1781674783; x=1782279583; 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=1rF2bDRyjtCAOETKbmKM190p1BI25Y2JTP/DKDl8RF0=; b=PMS4h1Lt0AnYpPLDW0/TLmIOuvZL6kjxrgU28kGOiSM1Wz7VPQII2efxhKfjpXZ9Tg Mv0mzYuSHN0nvQRQbbM344KFYCwdAqQ68PB9nBBzlYkqfcP9XK+1WWzI3WKHZIFBpyOJ iTJ8fYPa/tNuCuozIYaUyuNcizqmKQUNeaDnnvql8Qk2+NTozTkhaizP2g7ZCVgrf06i GHfJaUaetca8ta3zq5VRzGhEONbq1qBApcZK3RtM1LqtYDpOYu3mKRmsKt9etUpDdBBg BN1jKc7lc+rdWXhwArKzXD6J4dsvmaOQAp2qrKe+TvMpMKYFpOSUA6LJ4ipU3UZLpkfy Z1VA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781674783; x=1782279583; 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=1rF2bDRyjtCAOETKbmKM190p1BI25Y2JTP/DKDl8RF0=; b=loqIPJ1YqxRPyZhJC5oyYqOURXqRNM87yS9IA7kMd8U0J9yrQCqb8HP6GPPrXttB+h 2E8mVQYPY23lWsQ6zUvceaNI+V/Zy9Tk3svu10vskzGJwa8kkCMb3scexoq/Ph87EJRo iw0WopABu7Gsy4rPG9KZect+T5VFBc070BnzUAnbf+GrhCOB/cxy7nqX2NDKzAjmN8x9 OfhzJHQFoXD9QgE8Mx6rw/blzofNge4O6NDaPAWHzvEvBoxsuOv5r2M+Ycdiqz/ky+wx ixcbh+mcQkokk15eYO/c0uAzoLLHUkhAKIoNyHJH6pBVYbu9P7ANOIJkN/YrfrvPgZ08 rP4w== X-Forwarded-Encrypted: i=1; AFNElJ+7lypugDpRxudXh7WADE3p3w2qbwr70Fo8+cOiiEJJeyDXK6FD84y1D+MLy5Ocj0Ri1r0bpCh1P6YM5pc=@vger.kernel.org X-Gm-Message-State: AOJu0YyBVGtpX24I00o+pTtLC+7l1GbdH3Xc+/v0TfUNW+bYcIrVDcl3 ePdDI0Z9k4peN7W3lfyHta1t0zYhABcmEGfag1ejja5o+zKKuo27sTy+ X-Gm-Gg: AfdE7ckvWVW5l0dsuoCRwWV9+zJ7RLdI6k4hi9Js9QtSih0zXO3ufzTH+3cn49RFm0/ z/ad2h49/Ajg1h1KA52K6AkH+/DllN+elvUtqpnyMzL444igQFiXGJVokVqXHdLZs13lJIoSDze 3eTVHPAh7135fF+cX2BSjgqM/t0STlUBqOHW4ReS8IcBTAJi6wODOUEg4OWK67nTrcCdtT8NCmS PXIl0U2akEIagWvfQMQP4fuERFAmK1GvWcQe4pbU0OZXpeClnElu5fVdwg+CevCMCg82RYodEfQ WoJyqAR28F1CV+P01u5DDt2uWX20FXbIp5ICU+HwG5Fvhx47qnALSwddjcuECGuIJSahGFOjcfG hAx33CAc84xiKAY/MpOLv0bzOdccuBhq4eg/waHXP62djD/mjlw0dWX7AA9RAV1Vcjtyw46KXFa HPam9BKM5PxEUS9iCLg+BAcUBGaHbQZilN5QcDmTUG28ZmNXptjLZua5qwapYdMoUkhCp5PQ== X-Received: by 2002:a17:903:46c6:b0:2c0:fa4e:91f6 with SMTP id d9443c01a7336-2c6bc0bdcbdmr23674865ad.13.1781674783146; Tue, 16 Jun 2026 22:39:43 -0700 (PDT) Received: from cosmo-ubuntu-2404.. (61-220-246-151.hinet-ip.hinet.net. [61.220.246.151]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2c6a758a3c6sm30490435ad.52.2026.06.16.22.39.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jun 2026 22:39:42 -0700 (PDT) From: Cosmo Chou To: riku.voipio@iki.fi, lee@kernel.org, pavel@kernel.org, linusw@kernel.org, brgl@kernel.org Cc: linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, cosmo.chou@quantatw.com, Cosmo Chou Subject: [PATCH] leds: pca9532: Fix inverted GPIO output polarity Date: Wed, 17 Jun 2026 13:39:34 +0800 Message-ID: <20260617053934.2122685-1-chou.cosmo@gmail.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: 8bit The pca9532_gpio_set_value() function incorrectly mapped the requested value to PCA9532_ON and PCA9532_OFF, inverting the GPIO output polarity. A requested logical high (val=1) incorrectly enabled the LED output driver, which on this open-drain device pulls the pin low, while a requested logical low (val=0) released the pin. Correct the mapping so that val=1 yields PCA9532_OFF (pin released / high-impedance) and val=0 yields PCA9532_ON (pin driven low). pca9532_gpio_direction_input() is also updated to pass val=1 to pca9532_gpio_set_value() to align with the corrected polarity mapping, ensuring the pin remains not driven when configured as an input. Fixes: <3c1ab50d0a31b27bb4e55168f4901dd91e6e5ea4> ("drivers/leds/leds-pca9532.c: add gpio capability") Signed-off-by: Cosmo Chou --- drivers/leds/leds-pca9532.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/leds/leds-pca9532.c b/drivers/leds/leds-pca9532.c index 0344189bb991..80bf94e699d4 100644 --- a/drivers/leds/leds-pca9532.c +++ b/drivers/leds/leds-pca9532.c @@ -325,9 +325,9 @@ static int pca9532_gpio_set_value(struct gpio_chip *gc, unsigned int offset, struct pca9532_led *led = &data->leds[offset]; if (val) - led->state = PCA9532_ON; - else led->state = PCA9532_OFF; + else + led->state = PCA9532_ON; pca9532_setled(led); @@ -347,7 +347,7 @@ static int pca9532_gpio_get_value(struct gpio_chip *gc, unsigned offset) static int pca9532_gpio_direction_input(struct gpio_chip *gc, unsigned offset) { /* To use as input ensure pin is not driven */ - pca9532_gpio_set_value(gc, offset, 0); + pca9532_gpio_set_value(gc, offset, 1); return 0; } -- 2.43.0