Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp882738lqp; Thu, 21 Mar 2024 20:38:32 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWvBS9uNSqmI2IQj+bOWAtAJX9Rm9u/TSMd6tMokTiLXycDnVwdk35i5BAHgDZO7uh1GvbRcMPSo6Zsn0ILh8KfoztX649peet9U3c4aA== X-Google-Smtp-Source: AGHT+IFP4KCmMwy0hxkOVLyQUr/exZwrvP0Ofs4yHJfL6WPnLvuDqPWvHuZt+V0QQslrYqfJMoU9 X-Received: by 2002:a05:6a20:4c1f:b0:1a1:6c88:591a with SMTP id fm31-20020a056a204c1f00b001a16c88591amr1433807pzb.35.1711078712062; Thu, 21 Mar 2024 20:38:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711078712; cv=pass; d=google.com; s=arc-20160816; b=BF3Ju6wO4qPgx5dE7Y1rovr9vIaG3pF8ymAFnwMQ1M6tfvdtspbESSh45F010BzBx2 hgR9R3jabOPJ27q20FbAV79tCK/9r70A6b3xj/pJbwft1lynsrjcNBsu/nBuf0b3n5TW xmjdhGDwm0+3D1S/OTvcdmFQZKZLB0zOivVKOB82Lt5207ygt8MUtVwaWspz5EbKSsB2 y6aMp+i+roNTq9Kaqpcya7Cw0RBIu4GgRY7lAJj0ZpPEi9OZzl/qXbaIzDCetA8LxH+K bFD4ZxYpC/fUQhg2woIaDtLBG4jZr6bsmC7I/d57TNzGpSyozoVFTU7VCpDnda/OKfBz iZYw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=NrnaIDGD9GLPzpqf9XIs73N3ICvGrhKs7eQKU2DgFLQ=; fh=rR1YVieb+I/qLcCLZHAv1ZNp7A4yTriVfUgwkCIFD60=; b=GezlJ9SmpKedcHGrdwJHafncM7+xXzzg4/kkYKwvLyT5sZsJcopCcFD7u9amP4IotH ugTW5+PtB0CfWPs1DXQ8evoN5kjI+cgR+d2VweW+6aYs+wgYjpQ8os1DJLHgwJK+mdam 7k79L+bXVVNup/FVrfGmTwGogDgw5z2JjMgl1xyDXC9/xG8m8QzVPOtC/tEPoYGfAxQo Ko9TPfcPksvCXBVgrkhnHKBYbfEeWJ2ci6Jy01KHsEYWmHuoTs+5AferHOLHBZBfUyPg iE2L6w+kZYaVZZcfyrqT23DneZWD/TQwj424HShW5CyrNQcwZ0+9qoUxupKCxxcfRFxN HYYQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XMo7cVqA; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-110906-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-110906-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id f4-20020a170902e98400b001e02875a0b9si969229plb.519.2024.03.21.20.38.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Mar 2024 20:38:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-110906-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XMo7cVqA; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-110906-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-110906-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 466B2284FEF for ; Fri, 22 Mar 2024 03:38:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B43016FAE; Fri, 22 Mar 2024 03:38:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="XMo7cVqA" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 13D5B4436 for ; Fri, 22 Mar 2024 03:38:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711078705; cv=none; b=BOFibHRhVBdhyaPW2rzP4mNQrW5KPPEVmGqwnSkZKJ9KBUvnf3TZzQXoEBLkpszjQPA8dLMCUZRio0xAAeGxZRp7Aju9Xe+A/56lLp8RcXUyR43H4CAdcXHGK3VUN+pURrb0mFWeV6r7Q2qXWSYi3V4s4nhEfGqdw9kKKUE/IKI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711078705; c=relaxed/simple; bh=9kD5mYuA0ixrmsz/Nc+tYzQ3aOX+CXGxr7IZ5BHCiyI=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=g/rlP244hJIy7zvXeKmiOlQrvGmL2ihwP83VLIe7Ez7GcsRXYrv8emVN1O1vh4Rq/7xTCHOCwZyhXmaRrysRPsu2G/LRwK3UdICYlXQ0AUfPh6myZIIk431jDFn+XXmRlr07P+D0Yu+nAAtkXCl9tra4RYgcOIJgw6Wmsdlwtac= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=XMo7cVqA; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1711078703; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=NrnaIDGD9GLPzpqf9XIs73N3ICvGrhKs7eQKU2DgFLQ=; b=XMo7cVqAxmPCmatuh8D1NX9O7Vbo2FCjoU2n9t8lYbZfk+jkS2ayu7DbpcXzBBDP3qsQsg F48bC8OftDC5q+GiR5Ds5191HgDevLUI/kqAC+NGhRg9b4Ey9faMnpXvPTKWAHhO5/SNkn 5TE93X5lJSDE2+QhsbftBEYkHpfqbis= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-413-kSuCZZKUNPKx6nmryfzERQ-1; Thu, 21 Mar 2024 23:38:21 -0400 X-MC-Unique: kSuCZZKUNPKx6nmryfzERQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3F0B8811E81; Fri, 22 Mar 2024 03:38:20 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.39.192.34]) by smtp.corp.redhat.com (Postfix) with ESMTP id C9B77200B3C8; Fri, 22 Mar 2024 03:38:14 +0000 (UTC) From: Kate Hsuan To: Pavel Machek , Lee Jones , linux-leds@vger.kernel.org, platform-driver-x86@vger.kernel.org, Hans de Goede , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , =?UTF-8?q?Andr=C3=A9=20Apitzsch?= , linux-kernel@vger.kernel.org, Sebastian Reichel , linux-pm@vger.kernel.org Cc: Kate Hsuan Subject: [PATCH v5 0/6] KTD2026 indicator LED for X86 Xiaomi Pad2 Date: Fri, 22 Mar 2024 11:37:30 +0800 Message-ID: <20240322033736.9344-1-hpa@redhat.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 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 This patch added the support for Xiaomi Pad2 indicator LED. This work included: 1. Added the KTD2026 swnode description to describe the LED controller. 2. Migrated the original driver to fwnode to support x86 platform. 3. Support for multi-color LED trigger event. 4. The LED will be red when charging and the LED will be green when the battery is full. Moreover, the LED trigger is set to the new trigger, called "bq27520-0-charging-red-full-green" for Xiaomi Pad2 so the LED will be red when charging and the LED will be green when the battery is full. The new LED API led_mc_trigger_event() can be found in the following URL. https://lore.kernel.org/linux-leds/f40a0b1a-ceac-e269-c2dd-0158c5b4a1ad@gmail.com/T/#t -- Changes in v5: 1. Fix swnode LED color settings. 2. Improve the driver based on the comments. 3. Introduce a LED new API- led_mc_trigger_event() to make the LED color can be changed according to the trigger. 4. Introduced a new trigger "charging-red-full-green". The LED will be red when charging and the the LED will be green when the battery is full. 5. Set the default trigger to "bq27520-0-charging-red-full-green" for Xiaomi Pad2. Changes in v4: 1. Fix double casting. 2. Since force casting a pointer value to int will trigger a compiler warning, the type of num_leds was changed to unsigned long. Changes in v3: 1. Drop the patch "leds-ktd202x: Skip regulator settings for Xiaomi pad2" Changes in v2: 1. Typo and style fixes. 2. The patch 0003 skips all the regulator setup for Xiaomi pad2 since KTD2026 on Xiaomi pad2 is already powered by BP25890RTWR. So, the sleep can be removed when removing the module. Hans de Goede (2): leds: core: Add led_mc_set_brightness() function leds: trigger: Add led_mc_trigger_event() function Kate Hsuan (4): platform: x86-android-tablets: other: Add swnode for Xiaomi pad2 indicator LED leds: rgb: leds-ktd202x: Get device properties through fwnode to support ACPI power: supply: power-supply-leds: Add charging_red_full_green trigger for RGB LED platform: x86-android-tablets: others: Set the LED trigger to charging_red_full_green for Xiaomi pad2 drivers/leds/led-class-multicolor.c | 1 + drivers/leds/led-core.c | 31 +++++++ drivers/leds/led-triggers.c | 20 +++++ drivers/leds/rgb/Kconfig | 1 - drivers/leds/rgb/leds-ktd202x.c | 75 ++++++++++------- .../platform/x86/x86-android-tablets/other.c | 82 +++++++++++++++++++ .../x86/x86-android-tablets/shared-psy-info.h | 2 + drivers/power/supply/power_supply_leds.c | 25 ++++++ include/linux/leds.h | 26 ++++++ include/linux/power_supply.h | 2 + 10 files changed, 235 insertions(+), 30 deletions(-) -- 2.44.0