From patchwork Tue Jul 3 23:47:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Kaehlcke X-Patchwork-Id: 10505619 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 481D060225 for ; Tue, 3 Jul 2018 23:48:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3960B28979 for ; Tue, 3 Jul 2018 23:48:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2DA5A2899B; Tue, 3 Jul 2018 23:48:11 +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=unavailable 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 CD38F28979 for ; Tue, 3 Jul 2018 23:48:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932079AbeGCXr4 (ORCPT ); Tue, 3 Jul 2018 19:47:56 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:39775 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753673AbeGCXrl (ORCPT ); Tue, 3 Jul 2018 19:47:41 -0400 Received: by mail-pf0-f196.google.com with SMTP id s21-v6so1729894pfm.6 for ; Tue, 03 Jul 2018 16:47:41 -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=/chklxYGnds1v6AD2Nh4VsBa5gEuMWGNfrXOybMzQM0=; b=E32z0mveJT9AbtwO7/ArXOMAwgmEiilujwXPYcDT+vJJl+4L0/SnN2Qz/aptIqupzl rid3u6kO90kW0u+UqLEjAzUMXserPH7yypV4AexFV8IIfR2SZfrf4LXoY8mW/jlMkrFh F8Yqi7htdbRowp90hZk753RU9bnYe37Do0kIATlR4b2P475MKliF+p8cpy2MOWEh4yl0 00Xa1VefF+lUCI+f1fvBZaSUc4D1jE7UIW+4nIRmwyrPCQ1gVCnMv6UevIgjc/AJU5mD BZtoprS8Mnr6xoWq/aOx9fIDeFD/yOs0RcP1Ofz36eHUDRGasEAnbovIGuWdnA8O18uq 79Fg== X-Gm-Message-State: APt69E2P6s31etc8KJ20WbmthMHpHD2DHQLkHfhbER0F6SYmh0bPoWky +LXn2KEG3SSn3kckW0sP0Or0JA== X-Google-Smtp-Source: AAOMgpfEkJPE/bSzUYXj77mTpULFHM7K+ltuKSaZPVt0YU3Vi4tFZ9KLQSjGrgk9FBxF1Fqo7RzTVQ== X-Received: by 2002:a63:7a43:: with SMTP id j3-v6mr10683080pgn.363.1530661660879; Tue, 03 Jul 2018 16:47:40 -0700 (PDT) Received: from mka.mtv.corp.google.com ([2620:0:1000:1501:8e2d:4727:1211:622]) by smtp.gmail.com with ESMTPSA id l85-v6sm6608562pfk.79.2018.07.03.16.47.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Jul 2018 16:47:40 -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 v5 12/12] mfd: cros_ec: Add throttler sub-device Date: Tue, 3 Jul 2018 16:47:05 -0700 Message-Id: <20180703234705.227473-13-mka@chromium.org> X-Mailer: git-send-email 2.18.0.203.gfac676dfb9-goog In-Reply-To: <20180703234705.227473-1-mka@chromium.org> References: <20180703234705.227473-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 v5: - added 'Reviewed-by: Brian Norris ' tag 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);