Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp1758566rdb; Thu, 25 Jan 2024 05:29:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IFC1smxvM+VjEuo7QGC97VDNEO+pArqMCyVHccM4Qa3zAqbhLdWZCPZQHB1op8N60Gk8jqq X-Received: by 2002:a17:90a:4597:b0:290:3adc:8bde with SMTP id v23-20020a17090a459700b002903adc8bdemr543824pjg.94.1706189380626; Thu, 25 Jan 2024 05:29:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706189380; cv=pass; d=google.com; s=arc-20160816; b=YKj/LkRK/K976hWpKjIMQNqxIH38jP/1srdJVFAygnOi3EA35HIPRagN4HRi4J2NhM lRcUHYbVLcyq2WQJdumeS52ndmLUUo9tCbgJqmpaYH6e0oUSjo0B9ECJJtyOWNOTjiGG 65rUl08q4xHGomNgw8h7JrcuO0tHojlX1ed6E0n6nnNAZyfBi1avePSIwOZbaKZ9yBgu 7mw22quPgocFm9zBTJhDUyRzx7cS91zzr6HdifU8QITGGkvZWz2Msl3uA2Q86cSGkD4g +JJ0KLf/SxiPuDuKO1PQUEE2JJDPr+YH4acaqYz692+wtmGKL0o8CVYp1bMyRdlUZU6Q JsFA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=zaEpJXhHQj3kNp2PK4Ug6mIk1Lthf3ygBNSpJfoRwcE=; fh=SCGo8hzGjuM8RiSSgpuRSdKLuT/QSVqhh8TIb0uY7E0=; b=Og2lovt4cBtSTOO01vpAEDSOxBBzOrKHbCN3ztctgzzSwSYJItAyaJudoGpLJ6g4N3 rxASpa+t3AX9BCKItwTLLKe7Q91k6mGXV8hK2nRSJat4FooDPt1TnvJmJhcf55UVtd0g duZlbnfHIU0KjXjFkH/i3Y/OFGaGGhl5dOK8d0v8VOqPr/DnrGYmgFhmwxBsxydbkTn7 46d6rfq6EZkajGbxZC6svIc0nYAGnP9MbvMx7Z8P/862/ym+x3YUGfFyTSoku+uJpTlu AW3/YHo1I3QHllCgsfp0cNuNQkNTZZjcHbHTL8IE3+bAz6jGnR0bIHTmiFS2RKRA/KLR zoDQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hmoiqiCH; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-38647-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38647-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id kk4-20020a17090b4a0400b002926b731ccasi1279171pjb.184.2024.01.25.05.29.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 05:29:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-38647-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hmoiqiCH; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-38647-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38647-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 48329291334 for ; Thu, 25 Jan 2024 13:29:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6DF8550258; Thu, 25 Jan 2024 13:29:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="hmoiqiCH" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 969554F89D; Thu, 25 Jan 2024 13:29:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706189372; cv=none; b=uYigFl5F/5I95hposg4wTuFHsAzZG2z77rSl7fd4TJ8xqjbeVX4embveRd5/zvDevZIg4sAZMwYbeQD4RbsS9mhfCsxlvqvT3xkvfCGDx6XLn5Gp2W9tPedWK3YQ3ZI3jHszaIPsvAL2g9Wu1m6sGpyzc0dM+yeVgnocPv/6fvM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706189372; c=relaxed/simple; bh=2aP1hL6O4sgcfosAPQiaW//ddZstCirad6SDpyyNrRo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=B0w9fYwQlF53HWPUcQ3R09iMw+2kno1Sh+n408H4+OFIJmuGWmfvIRWCMJxXzT+/oJ1wK5Z6ojlQgiy25VTMG2dbEAyrMRv/ZJxA1Q9S0oUApBHQzsbKgeWqmd6vnPjeV47bvsmjRhQ7aCpOrCfIbD60NHNSe9g9iMQoGDgYtUE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=hmoiqiCH; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id F21CEC433C7; Thu, 25 Jan 2024 13:29:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706189372; bh=2aP1hL6O4sgcfosAPQiaW//ddZstCirad6SDpyyNrRo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=hmoiqiCHJn21mmIhBP2zRzEiNbvSSiKbtsYZF8au9g7t3KiHUHG7pHJUNbgzHI9yf 4/qa46etGHHl0udUB7D69O9vdZEAEboHh6WcPvR3zJOJhm7CvJ6sHceJdm6CpaXa29 aJRUnsBCgy2HajYkn+GG/56ngGhk6M/rMmhTrNq2vZDDqo8nz0knIHj511RJsK7s+D M9QS207LRVmlLA+99pnQlAAcUtrtd7LLiFjvrCrEkqg734e4r82UEoIMktZJg4AW5T W0AdsfaChln8BDoneEC40xqbqLGr9LbU5r0KCzfKI3bYIq/ofFDj//BshyIxHmqs/X FHNt0l6PMTI8Q== Date: Thu, 25 Jan 2024 13:29:28 +0000 From: Lee Jones To: Amitesh Singh Cc: pavel@ucw.cz, linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] leds/pca963x: implement power management Message-ID: <20240125132928.GI74950@google.com> References: <20240116072457.383438-1-singh.amitesh@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240116072457.383438-1-singh.amitesh@gmail.com> On Tue, 16 Jan 2024, Amitesh Singh wrote: > This implements power management in upstream driver This *is* the upstream driver. No need to mention that. > for pca9633 which enables device sleep and resume > on system-wide sleep/hibernation > > Signed-off-by: Amitesh Singh > --- > drivers/leds/leds-pca963x.c | 38 +++++++++++++++++++++++++++++++++++++ > 1 file changed, 38 insertions(+) > > diff --git a/drivers/leds/leds-pca963x.c b/drivers/leds/leds-pca963x.c > index 47223c850e4b..2474e40d8479 100644 > --- a/drivers/leds/leds-pca963x.c > +++ b/drivers/leds/leds-pca963x.c > @@ -39,6 +39,7 @@ > #define PCA963X_LED_PWM 0x2 /* Controlled through PWM */ > #define PCA963X_LED_GRP_PWM 0x3 /* Controlled through PWM/GRPPWM */ > > +#define PCA963X_MODE1_SLEEP 0x04 /* Normal mode or Low Power mode, oscillator off */ > #define PCA963X_MODE2_OUTDRV 0x04 /* Open-drain or totem pole */ > #define PCA963X_MODE2_INVRT 0x10 /* Normal or inverted direction */ > #define PCA963X_MODE2_DMBLNK 0x20 /* Enable blinking */ > @@ -380,6 +381,42 @@ static int pca963x_register_leds(struct i2c_client *client, > return ret; > } > > +#ifdef CONFIG_PM_SLEEP > +static int pca963x_suspend(struct device *dev) > +{ > + struct pca963x *chip; > + u8 reg; > + > + chip = dev_get_drvdata(dev); Do the assignment during declaration. > + reg = i2c_smbus_read_byte_data(chip->client, PCA963X_MODE1); > + reg = reg | (1 << PCA963X_MODE1_SLEEP); BIT() > + i2c_smbus_write_byte_data(chip->client, PCA963X_MODE1, reg); > + > + return 0; > +} > + > +static int pca963x_resume(struct device *dev) > +{ > + struct pca963x *chip; > + u8 reg; > + > + chip = dev_get_drvdata(dev); As above. > + reg = i2c_smbus_read_byte_data(chip->client, PCA963X_MODE1); > + reg = reg & ~(1 << PCA963X_MODE1_SLEEP); As above. > + i2c_smbus_write_byte_data(chip->client, PCA963X_MODE1, reg); > + > + return 0; > +} > +#endif > + > +static const struct dev_pm_ops pca963x_pmops = { > + SET_SYSTEM_SLEEP_PM_OPS(pca963x_suspend, pca963x_resume) > +}; > + Remove this line. > +static SIMPLE_DEV_PM_OPS(pca963x_pm, pca963x_suspend, pca963x_resume); > + > static const struct of_device_id of_pca963x_match[] = { > { .compatible = "nxp,pca9632", }, > { .compatible = "nxp,pca9633", }, > @@ -430,6 +467,7 @@ static struct i2c_driver pca963x_driver = { > .driver = { > .name = "leds-pca963x", > .of_match_table = of_pca963x_match, > + .pm = &pca963x_pmops > }, > .probe = pca963x_probe, > .id_table = pca963x_id, > -- > 2.43.0 > -- Lee Jones [李琼斯]