From patchwork Thu Jun 21 01:52:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Kaehlcke X-Patchwork-Id: 10478965 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DAA0160365 for ; Thu, 21 Jun 2018 01:53:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CB7732858D for ; Thu, 21 Jun 2018 01:53:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C00D4289EB; Thu, 21 Jun 2018 01:53:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 720882858D for ; Thu, 21 Jun 2018 01:53:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754677AbeFUBxi (ORCPT ); Wed, 20 Jun 2018 21:53:38 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:35091 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754420AbeFUBxM (ORCPT ); Wed, 20 Jun 2018 21:53:12 -0400 Received: by mail-pf0-f195.google.com with SMTP id c22-v6so688852pfi.2 for ; Wed, 20 Jun 2018 18:53:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=eNU51yjQ+sbmP/gaQ7xE6DCoKhrY5SF7m+blOGUlUtA=; b=oVwT06pe2SSq/RGplFgjTDURkmbOJkEZPSRuSE0XZqB1+yB/hyIfUNnG8IUMg5SmxQ GTn1HHoazzqSPyVX1DIBYdQOD6EWEn1oLOlSsKEch5l4nmivDw8qLkWNwhmCicx79T3n Qq2YDb9c1Y+mJGQ7RsG7lUuVxGzS4wF4lPEMU6Ghhjm7uvCJgWFqrQbvyqB289FnI3ei Xl5KdxiduAD3UiXBG7YUdkYSf4AYvU596fQJ7ZWMRzXrarh9zXzdhO+5JXY3e//cJh2f kULQMkQWvFaDjlL42LgHvc+BR++Y1i/2g89fkZyMM3FZb4zdaD5nFg6ZYTy2XZWuf8GR djlg== X-Gm-Message-State: APt69E0NTnNBugSwJubkiQg6wklrcpDO3pgqc4+jMlWkDlbU5KJW71+n 8BPP8pfBbSXUgwn9OWm7zzcAIQ== X-Google-Smtp-Source: ADUXVKLq8W+PyONR2JwsWMZfNSqXD8+Xul6LUSPgcIkQ1QBQEy4znZYd7AIEUqmfLH0buGz9yAymhQ== X-Received: by 2002:a65:6141:: with SMTP id o1-v6mr20520172pgv.409.1529545991617; Wed, 20 Jun 2018 18:53:11 -0700 (PDT) Received: from mka.mtv.corp.google.com ([2620:0:1000:1501:8e2d:4727:1211:622]) by smtp.gmail.com with ESMTPSA id p12-v6sm6585877pfi.175.2018.06.20.18.53.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Jun 2018 18:53:10 -0700 (PDT) From: Matthias Kaehlcke To: MyungJoo Ham Cc: Kyungmin Park , Chanwoo Choi , Arnd Bergmann , Greg Kroah-Hartman , Rob Herring , Mark Rutland , linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Brian Norris , Douglas Anderson , Enric Balletbo i Serra , "Rafael J . Wysocki" , Viresh Kumar , Lee Jones , Benson Leung , Olof Johansson , Matthias Kaehlcke Subject: [PATCH v4 12/12] mfd: cros_ec: Add throttler sub-device Date: Wed, 20 Jun 2018 18:52:37 -0700 Message-Id: <20180621015237.100100-13-mka@chromium.org> X-Mailer: git-send-email 2.18.0.rc2.346.g013aa6912e-goog In-Reply-To: <20180621015237.100100-1-mka@chromium.org> References: <20180621015237.100100-1-mka@chromium.org> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Instantiate the CrOS EC throttler if it is enabled in the kernel configuration. Signed-off-by: Matthias Kaehlcke Reviewed-by: Brian Norris --- Changes in v4: - register throttler in cros_ec_dev.c instead of cros_ec.c Changes in v3: - patch added to series --- drivers/mfd/cros_ec_dev.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c index eafd06f62a3a..9e56c2793075 100644 --- a/drivers/mfd/cros_ec_dev.c +++ b/drivers/mfd/cros_ec_dev.c @@ -383,6 +383,22 @@ static void cros_ec_sensors_register(struct cros_ec_dev *ec) kfree(msg); } +static const struct mfd_cell ec_throttler_cells[] = { + { .name = "cros-ec-throttler" } +}; + +static void cros_ec_throttler_register(struct cros_ec_dev *ec) +{ + int ret; + + ret = mfd_add_devices(ec->dev, 0, ec_throttler_cells, + ARRAY_SIZE(ec_throttler_cells), + NULL, 0, NULL); + if (ret) + dev_err(ec->dev, + "failed to add cros-ec-throttler device: %d\n", ret); +} + static int ec_device_probe(struct platform_device *pdev) { int retval = -ENOMEM; @@ -422,6 +438,9 @@ static int ec_device_probe(struct platform_device *pdev) if (cros_ec_check_features(ec, EC_FEATURE_MOTION_SENSE)) cros_ec_sensors_register(ec); + if (IS_ENABLED(CONFIG_CROS_EC_THROTTLER)) + cros_ec_throttler_register(ec); + /* Take control of the lightbar from the EC. */ lb_manual_suspend_ctrl(ec, 1);