From patchwork Thu Apr 13 15:18:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 673724 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 93074C77B61 for ; Thu, 13 Apr 2023 15:19:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231289AbjDMPTm (ORCPT ); Thu, 13 Apr 2023 11:19:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230083AbjDMPTk (ORCPT ); Thu, 13 Apr 2023 11:19:40 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 066A29EF7 for ; Thu, 13 Apr 2023 08:18:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681399103; 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: in-reply-to:in-reply-to:references:references; bh=19DAvj0MIEfSChS6L62Nsvj3SR7juAb8fhzuGqtvJkI=; b=CrMs/bFXGni5ftmo610TnNI9+9Xksh+rKhL5/Vg2gRDkNscsmZwlxEz7gmVLEAT11jXAAS 4i1f9G/BA9o2/fo2wn/JOAEWfNjLwm+kS6z4SrsgMjIURvikxC87tUtuWaXyps4CEfE2Xc iciNJBWS+g9S+TQ8Evz4J8oCtaOne+Q= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-617-n8SdJqWwM3Sl2CDbY7zaSg-1; Thu, 13 Apr 2023 11:18:18 -0400 X-MC-Unique: n8SdJqWwM3Sl2CDbY7zaSg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9BF6938149B7; Thu, 13 Apr 2023 15:18:17 +0000 (UTC) Received: from x1.nl (unknown [10.39.192.251]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6BA0C141511D; Thu, 13 Apr 2023 15:18:16 +0000 (UTC) From: Hans de Goede To: Pavel Machek , Lee Jones , Yauhen Kharuzhy Cc: Hans de Goede , linux-leds@vger.kernel.org Subject: [PATCH 4/5] leds: cht-wcove: Set default trigger for charging LED Date: Thu, 13 Apr 2023 17:18:07 +0200 Message-Id: <20230413151808.20900-5-hdegoede@redhat.com> In-Reply-To: <20230413151808.20900-1-hdegoede@redhat.com> References: <20230413151808.20900-1-hdegoede@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 Precedence: bulk List-ID: X-Mailing-List: linux-leds@vger.kernel.org Set a default trigger for the charging LED based on the machine-model as set by the PMIC MFD driver. Signed-off-by: Hans de Goede --- drivers/leds/leds-cht-wcove.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/leds/leds-cht-wcove.c b/drivers/leds/leds-cht-wcove.c index 2b6c6f39d406..597bfbe19cc2 100644 --- a/drivers/leds/leds-cht-wcove.c +++ b/drivers/leds/leds-cht-wcove.c @@ -339,6 +339,25 @@ static int cht_wc_leds_probe(struct platform_device *pdev) if (ret < 0) return ret; + /* Set LED1 default trigger based on machine model */ + switch (pmic->cht_wc_model) { + case INTEL_CHT_WC_GPD_WIN_POCKET: + leds->leds[0].cdev.default_trigger = "max170xx_battery-charging-blink-full-solid"; + break; + case INTEL_CHT_WC_XIAOMI_MIPAD2: + leds->leds[0].cdev.default_trigger = "bq27520-0-charging-blink-full-solid"; + break; + case INTEL_CHT_WC_LENOVO_YOGABOOK1: + leds->leds[0].cdev.default_trigger = "bq27542-0-charging-blink-full-solid"; + break; + case INTEL_CHT_WC_LENOVO_YT3_X90: + leds->leds[0].cdev.default_trigger = "bq27500-1-charging-blink-full-solid"; + break; + default: + dev_warn(&pdev->dev, "Unknown model, no default charging trigger\n"); + break; + } + for (i = 0; i < CHT_WC_LED_COUNT; i++) { struct cht_wc_led *led = &leds->leds[i];