Message ID | 881c6ba1-1701-41be-a4ac-81cdca5f0eea@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp6476069vqy; Sun, 10 Dec 2023 03:47:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IFV02vnKzk0gvfKFGdj8xG0U2DXKPjhXN+jwjeSV9ULvKPJbd2MaxXD21yu4RDdQ63FH0If X-Received: by 2002:a17:902:7d8a:b0:1d0:9471:808d with SMTP id a10-20020a1709027d8a00b001d09471808dmr2505546plm.93.1702208832846; Sun, 10 Dec 2023 03:47:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702208832; cv=none; d=google.com; s=arc-20160816; b=Uqi/R/F+iVncljQO/wQc2s37ATK1ZrCbl8JAQ+EUvQm/i0dj1vb1Ek4ra4FmL0TxtU XQQfZfNOR3nGmTJHtVlCSVbgJgZU1xzsbnwf5OrrQzwBHeuqkkXWxe7qNIj3Syy8OmtL o8ujKCgjklbMbhKfhjsS1JYXK++8/bMgNeVOdmUqAtWCjAvi18A6MzBaJuKWp5quJBM8 TVfLE3+eh/lKRJRGZnLm6zYdtoKkF5AgA8eI+pYgvdcEXC+CXRZqQo9KLY+vJLAovu98 5YHvv0ve1+gW3oI1KXunSPeRNN+S5mrFhOukJGXZr9mvXqYylrF6041KXCrGavvfcMez SxKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject:from :content-language:user-agent:mime-version:date:message-id :dkim-signature; bh=cYrj7YLRRwrzGfDcX9P83UR5bzTmRqcF6ZHNEAxJQ20=; fh=zsBxv+28eS9P0xom3tuJBeMXpp/H3hS6b/+i6/r6+n4=; b=I560UhA5K9EUQSDvDd1txi4RMxar6/37iUZtbg/UZHxf46TARdMz9ZaFf5c6NWa+Xk 5jADCjMXMDIFBVLzg+WloclR7meCjvlFlHuToQW1Pbo3iDeAdwfXhMf/aig1ljrLXqVy FxCjBW2t3GcgmJFwujbldRRXKkF0CSD//KaFr9sAO07rM5FoPHU3h40uWDetZfz4FG1K 3whla5fjs3lXVFU6BqRyF+QxBlULHxaJsKcimBx7zriAVaJoIpL9IjL+9DuimuEDUZh4 y/o7godzJDGDE3QrNHHn9bOr4FfWCxOfnCrheyvcLMKPjfHx1Ryrb4g2hyydb3dZjcWf D1ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=MRZk640C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id g14-20020a1709029f8e00b001cc2c4fdbecsi4303307plq.649.2023.12.10.03.47.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Dec 2023 03:47:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=MRZk640C; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 92BDE8086531; Sun, 10 Dec 2023 03:47:09 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231978AbjLJLqy (ORCPT <rfc822;rua109.linux@gmail.com> + 99 others); Sun, 10 Dec 2023 06:46:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229482AbjLJLqx (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sun, 10 Dec 2023 06:46:53 -0500 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8540EFF; Sun, 10 Dec 2023 03:46:59 -0800 (PST) Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-1d0a5422c80so30802445ad.3; Sun, 10 Dec 2023 03:46:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702208819; x=1702813619; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:from:content-language :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=cYrj7YLRRwrzGfDcX9P83UR5bzTmRqcF6ZHNEAxJQ20=; b=MRZk640CVq3689f3oKKHZvPMh3vGIGcNaJ1b74Wq0FeegfiePX3Gy1aVEYPQWjMLFu yHqAciYTEzhZpLm9fXD8d0FS3OW+mUJASpxld4SOInn8eyWdwfrysWd9gTNjstsYpuMy YL91PE6s4k9ODtniz0FU58f+KTZBe4LUfy89y02rMbtS0AaBXCNvWS8BwRUB49FSylIF pao9JYF3sjk5uvMwvkbRorNUpp+ZJuVvUyat9mXPyiUUK0nTiAgAx8kLRyVsP2GC8lMS 8OQsw799wqSqeXCWkC1RNwmwB63ce5f+WvzXj2XxQEFRWLhvzatpLn86Pt57CziORdG6 wYbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702208819; x=1702813619; h=content-transfer-encoding:cc:to:subject:from:content-language :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=cYrj7YLRRwrzGfDcX9P83UR5bzTmRqcF6ZHNEAxJQ20=; b=R4EGO5odPEJAVpkRY4YfMdo3Zx6LU+9WtYBYKgk6TG2MC1uGvJaerZ/aXd6TAo0R94 kwzVtHLiNV8/zGmVQ6zJccPGqMv3iMnA81MtqEXVuzWseA5TVck2DbIJ6ie0E41X8R/w ZtxsUDscNigeByhORzYjWsBaziWnbv5h79w6cWyVloGyI/mogSJngb9rvsHOrZH80Dvu 5KD9nxFyDVk+z+sL4aKR2fKetVrqX6qadmN0RWv9BiZVNObmXr2Xu/UlQKY1P3bUnm+L OFxXM+lusbsZxZMF+45IHcpxm2lladXYnVzztxuM5opBKU9LAY/I5Qy4h60QCbbkRYKI DCVg== X-Gm-Message-State: AOJu0YxOiufr9DGoU0W5123B9vs59Gz3CqJS3qK0S/BhDpS6MLzoOEUi Z6Kel5HfB1ZpXko31TtvESCjmAQpYM8C3g== X-Received: by 2002:a17:903:2311:b0:1cf:c42c:cfbd with SMTP id d17-20020a170903231100b001cfc42ccfbdmr3432116plh.0.1702208818896; Sun, 10 Dec 2023 03:46:58 -0800 (PST) Received: from [192.168.238.123] ([103.208.68.40]) by smtp.gmail.com with ESMTPSA id gc4-20020a17090b310400b00288622137dfsm6331921pjb.5.2023.12.10.03.46.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 10 Dec 2023 03:46:58 -0800 (PST) Message-ID: <881c6ba1-1701-41be-a4ac-81cdca5f0eea@gmail.com> Date: Sun, 10 Dec 2023 17:16:52 +0530 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US From: Amitesh Singh <singh.amitesh@gmail.com> Subject: [PATCH] feat(kernel/pca963x): implement power management To: Pavel Machek <pavel@ucw.cz> Cc: Lee Jones <lee@kernel.org>, linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Sun, 10 Dec 2023 03:47:09 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784895329195988842 X-GMAIL-MSGID: 1784895329195988842 |
Series |
feat(kernel/pca963x): implement power management
|
|
Commit Message
Amitesh Singh
Dec. 10, 2023, 11:46 a.m. UTC
From a22dbd7390ce875e81d67f14f05f593d7f03d5c1 Mon Sep 17 00:00:00 2001 From: Amitesh Singh <singh.amitesh@gmail.com> Date: Fri, 8 Dec 2023 15:08:33 +0530 Subject: [PATCH] feat(kernel/pca963x): implement power management This implements power management in upstream driver for pca9633 which enables device sleep and resume on system-wide sleep/hibernation Signed-off-by: Amitesh Singh <singh.amitesh@gmail.com> --- drivers/leds/leds-pca963x.c | 41 +++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) #define PCA963X_MODE2_DMBLNK 0x20 /* Enable blinking */ @@ -380,6 +381,45 @@ static int pca963x_register_leds(struct i2c_client *client, return ret; } +#ifdef CONFIG_PM +static int pca963x_suspend(struct device *dev) +{ + struct pca963x *chip; + u8 reg; + + chip = dev_get_drvdata(dev); + + reg = i2c_smbus_read_byte_data(chip->client, PCA963X_MODE1); + reg = reg | (1 << PCA963X_MODE1_SLEEP); + 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); + + reg = i2c_smbus_read_byte_data(chip->client, PCA963X_MODE1); + reg = reg & ~(1 << PCA963X_MODE1_SLEEP); + i2c_smbus_write_byte_data(chip->client, PCA963X_MODE1, reg); + + return 0; +} + +static const struct dev_pm_ops pca963x_pmops = { + SET_SYSTEM_SLEEP_PM_OPS(pca963x_suspend, pca963x_resume) +}; + +#define PCA963X_SMBUS_PMOPS (&pca963x_pmops) + +#else +#define PCA963X_SMBUS_PMOPS NULL +#endif + static const struct of_device_id of_pca963x_match[] = { { .compatible = "nxp,pca9632", }, { .compatible = "nxp,pca9633", }, @@ -430,6 +470,7 @@ static struct i2c_driver pca963x_driver = { .driver = { .name = "leds-pca963x", .of_match_table = of_pca963x_match, + .pm = PCA963X_SMBUS_PMOPS }, .probe = pca963x_probe, .id_table = pca963x_id,
Comments
Hi Amitesh, kernel test robot noticed the following build warnings: [auto build test WARNING on lee-leds/for-leds-next] [also build test WARNING on linus/master v6.7-rc4 next-20231208] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Amitesh-Singh/feat-kernel-pca963x-implement-power-management/20231210-194846 base: https://git.kernel.org/pub/scm/linux/kernel/git/lee/leds.git for-leds-next patch link: https://lore.kernel.org/r/881c6ba1-1701-41be-a4ac-81cdca5f0eea%40gmail.com patch subject: [PATCH] feat(kernel/pca963x): implement power management config: arc-randconfig-002-20231211 (https://download.01.org/0day-ci/archive/20231211/202312110656.twrTxNHo-lkp@intel.com/config) compiler: arceb-elf-gcc (GCC) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231211/202312110656.twrTxNHo-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202312110656.twrTxNHo-lkp@intel.com/ All warnings (new ones prefixed by >>): >> drivers/leds/leds-pca963x.c:399:12: warning: 'pca963x_resume' defined but not used [-Wunused-function] 399 | static int pca963x_resume(struct device *dev) | ^~~~~~~~~~~~~~ >> drivers/leds/leds-pca963x.c:385:12: warning: 'pca963x_suspend' defined but not used [-Wunused-function] 385 | static int pca963x_suspend(struct device *dev) | ^~~~~~~~~~~~~~~ vim +/pca963x_resume +399 drivers/leds/leds-pca963x.c 383 384 #ifdef CONFIG_PM > 385 static int pca963x_suspend(struct device *dev) 386 { 387 struct pca963x *chip; 388 u8 reg; 389 390 chip = dev_get_drvdata(dev); 391 392 reg = i2c_smbus_read_byte_data(chip->client, PCA963X_MODE1); 393 reg = reg | (1 << PCA963X_MODE1_SLEEP); 394 i2c_smbus_write_byte_data(chip->client, PCA963X_MODE1, reg); 395 396 return 0; 397 } 398 > 399 static int pca963x_resume(struct device *dev) 400 { 401 struct pca963x *chip; 402 u8 reg; 403 404 chip = dev_get_drvdata(dev); 405 406 reg = i2c_smbus_read_byte_data(chip->client, PCA963X_MODE1); 407 reg = reg & ~(1 << PCA963X_MODE1_SLEEP); 408 i2c_smbus_write_byte_data(chip->client, PCA963X_MODE1, reg); 409 410 return 0; 411 } 412
On Sun, 10 Dec 2023, Amitesh Singh wrote: > From a22dbd7390ce875e81d67f14f05f593d7f03d5c1 Mon Sep 17 00:00:00 2001 > From: Amitesh Singh <singh.amitesh@gmail.com> > Date: Fri, 8 Dec 2023 15:08:33 +0530 > Subject: [PATCH] feat(kernel/pca963x): implement power management What are you using to send this patch? Please use the Git tools provided: git format-patch git send-email The subject line is also totally incorrect. Again Git can help: git log --oneline -- <subsystem> Please fix the bot's complaints before re-submitting. Thank you. > This implements power management in upstream driver > for pca9633 which enables device sleep and resume > on system-wide sleep/hibernation > > Signed-off-by: Amitesh Singh <singh.amitesh@gmail.com> > --- > drivers/leds/leds-pca963x.c | 41 +++++++++++++++++++++++++++++++++++++ > 1 file changed, 41 insertions(+) > > diff --git a/drivers/leds/leds-pca963x.c b/drivers/leds/leds-pca963x.c > index 47223c850e4b..462f917dc986 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,45 @@ static int pca963x_register_leds(struct i2c_client > *client, > return ret; > } > > +#ifdef CONFIG_PM > +static int pca963x_suspend(struct device *dev) > +{ > + struct pca963x *chip; > + u8 reg; > + > + chip = dev_get_drvdata(dev); > + > + reg = i2c_smbus_read_byte_data(chip->client, PCA963X_MODE1); > + reg = reg | (1 << PCA963X_MODE1_SLEEP); > + 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); > + > + reg = i2c_smbus_read_byte_data(chip->client, PCA963X_MODE1); > + reg = reg & ~(1 << PCA963X_MODE1_SLEEP); > + i2c_smbus_write_byte_data(chip->client, PCA963X_MODE1, reg); > + > + return 0; > +} > + > +static const struct dev_pm_ops pca963x_pmops = { > + SET_SYSTEM_SLEEP_PM_OPS(pca963x_suspend, pca963x_resume) > +}; > + > +#define PCA963X_SMBUS_PMOPS (&pca963x_pmops) > + > +#else > +#define PCA963X_SMBUS_PMOPS NULL > +#endif > + > static const struct of_device_id of_pca963x_match[] = { > { .compatible = "nxp,pca9632", }, > { .compatible = "nxp,pca9633", }, > @@ -430,6 +470,7 @@ static struct i2c_driver pca963x_driver = { > .driver = { > .name = "leds-pca963x", > .of_match_table = of_pca963x_match, > + .pm = PCA963X_SMBUS_PMOPS > }, > .probe = pca963x_probe, > .id_table = pca963x_id, > -- > 2.43.0 >
diff --git a/drivers/leds/leds-pca963x.c b/drivers/leds/leds-pca963x.c index 47223c850e4b..462f917dc986 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 */