Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp496815ybi; Thu, 13 Jun 2019 21:19:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqwYxiTPoT+6DlCNtPti3bfC+gTrBQooyAE0oNw+c9/Sov2hc0iUGjfrnsr7axdFb81l8XrJ X-Received: by 2002:a17:902:31a4:: with SMTP id x33mr61974801plb.331.1560485948277; Thu, 13 Jun 2019 21:19:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560485948; cv=none; d=google.com; s=arc-20160816; b=FiqdhxPXvyISz6Hysfrr94z8b76hQ5r/AUrkDxJObdFIhzAY0wzWoRSLxATyflwP/I wM+uXqDOPMXDdodJIrwCd3aihnwWTY3l/vfZdnVxdg/mdnN/mtOj30slqAUh3ic4C02w hA4IVS8RolzmyfR+SC1XtY3iQMoR29/RQdd4EysR6Kf8ev6LWKyxGlWKyamqZM3Tug2f sIVKzUKTrNEc9oSugVCige1BKtOBJcIMehq1AEVNhWRP2ToT94hS2SyzcJmAsQAS8q1v brGkEn41tzKaXktiVLCh2KmnzHhl1p0c9UYEZrScLlHXkdDfVad2r+hQ4Rc6z8agwx7m +O0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:references :mime-version:message-id:in-reply-to:date:dkim-signature; bh=VA7s9ly0lqdagUAyh1uYpw4qgEasvgJFlK1lzvkukqY=; b=NRRKg0XtIOofKyGktNb55+r+mjp1/LH0YpHNCU3vIilhkTNU0bxXHXx5J4Nl/dNVJE 9015srrGMApFyeQtNwb/MjEPiMV//eJp0C/JPsAPzUAEA++5qv/Myk7o2HuMeypRq1kF 6Ve3Vh/0EHXrmrlGAGoMlztl+ZSQLoHDpEGlDYtcxgxG1jbqY9WxbPsddNaFgrCJ+GAP NeYIazEB7cQ+AGthBkHParrl2MDS/PUeoXKttGNTW5MMOH5aBpqBMdf3VzJmPi5VkCOG T5UUFOSlzHzMbCTZU4SbQhMN/uEmggLwkNk2FN/1Lqpdpe1xvBlUiULXaKwOGe/wATsb iueg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=TrEXlT8d; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z5si1407670pgv.280.2019.06.13.21.18.52; Thu, 13 Jun 2019 21:19:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=TrEXlT8d; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726490AbfFNESM (ORCPT + 99 others); Fri, 14 Jun 2019 00:18:12 -0400 Received: from mail-qk1-f202.google.com ([209.85.222.202]:44450 "EHLO mail-qk1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726435AbfFNESK (ORCPT ); Fri, 14 Jun 2019 00:18:10 -0400 Received: by mail-qk1-f202.google.com with SMTP id c207so996057qkb.11 for ; Thu, 13 Jun 2019 21:18:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=VA7s9ly0lqdagUAyh1uYpw4qgEasvgJFlK1lzvkukqY=; b=TrEXlT8djNpXPJc0j8YuBg6jTcfItK6GjAaeUSewHjYjftr5gYxyJuqq3MGH1OUe1T F3xdsaC3oKrSs+dlLVQW3XrlXYI+1M2VVTmgutAgeR/C8BeBT2yPpIVqmYf0mybVrYxo wmtTS/hWV6UkMbpi0KH7Dgq3wWGTIZtkgefl5OGGmwKX/S5v6YwKVnVU3C1gpFDeO+2I FBr4uMGQpUMsUfh59BM9jW4yJHzxtr2LArxfDQbupQodPwMohSfxjbPi3RMe0hpBN2iX XKBIGUhfIgNitWDR3R/EHS75rmfuv6cnWhkdhva0AOGRbVQuo7nzNskKg+bmAYvCCtN7 zNcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=VA7s9ly0lqdagUAyh1uYpw4qgEasvgJFlK1lzvkukqY=; b=sJM6m2ANmH+NRRZ6O0M6awQpb9EHcyEC1WXp31xeZUv9jXAom7d2JhWTpht3DrZ8de Dr0eW3AMw0utc6G0RqlL9vYuKvWgubqxD53AJJQPxjpt6/rn2dMhtey8MydcuWWEuFJ5 oLa13Umdfranv32wHDwMGMcR5hRJNphVattQObRKJlY//MRLtLaTtdFrzgc1Xa6Bgx2o oI/sz7V58ORjpkqJBxCyyg4PWL4gyRVlJQfmh0sz9SVlCXgB1+cJoDYjYgtWXPl9oWmG TXisRw/jHv3Kk+PEoe4SniQmdCc/hJ3LP6htxhlOfHyzqiMIXyCNSW8fjkJI+MizG2JO ewCw== X-Gm-Message-State: APjAAAU8D2p4RJy31dgEeD8lSv7K7MRNJnLa7GrD+ZDjK8ZPKCQYdj8H 51gXW9AkEUh0XF0LB78WdZBZs8UO/k0dkDM= X-Received: by 2002:ac8:1794:: with SMTP id o20mr80687898qtj.239.1560485889196; Thu, 13 Jun 2019 21:18:09 -0700 (PDT) Date: Thu, 13 Jun 2019 21:17:32 -0700 In-Reply-To: <20190614041733.120807-1-saravanak@google.com> Message-Id: <20190614041733.120807-11-saravanak@google.com> Mime-Version: 1.0 References: <20190614041733.120807-1-saravanak@google.com> X-Mailer: git-send-email 2.22.0.rc2.383.gf4fbbf30c2-goog Subject: [PATCH v2 10/11] OPP: Allow copying OPPs tables between devices From: Saravana Kannan To: Georgi Djakov , Rob Herring , Mark Rutland , Viresh Kumar , Nishanth Menon , Stephen Boyd , "Rafael J. Wysocki" , MyungJoo Ham , Kyungmin Park , Chanwoo Choi Cc: Saravana Kannan , Rajendra Nayak , Jordan Crouse , vincent.guittot@linaro.org, bjorn.andersson@linaro.org, amit.kucheria@linaro.org, seansw@qti.qualcomm.com, daidavid1@codeaurora.org, evgreen@chromium.org, sibis@codeaurora.org, kernel-team@android.com, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some hardware devices might create multiple children devices to manage different components of the hardware. In these cases, it might be necessary for the original hardware device to copy specific OPP tables to a specific the new child device. Add dev_pm_opp_add_opp_table() to do that. Signed-off-by: Saravana Kannan --- drivers/opp/core.c | 8 ++++++++ include/linux/pm_opp.h | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/drivers/opp/core.c b/drivers/opp/core.c index c9914afd508a..668a377f59a5 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -943,6 +943,14 @@ struct opp_device *_add_opp_dev(const struct device *dev, return opp_dev; } +int dev_pm_opp_add_opp_table(struct device *dev, struct opp_table *opp_table) +{ + if (!dev || !opp_table) + return -EINVAL; + + return _add_opp_dev(dev, opp_table) ? 0 : -ENOMEM; +} + static struct opp_table *_allocate_opp_table(struct device *dev, int index) { struct opp_table *opp_table; diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index d9156b62d966..3694d703817f 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -81,6 +81,7 @@ struct dev_pm_set_opp_data { struct opp_table *dev_pm_opp_get_opp_table(struct device *dev); struct opp_table *dev_pm_opp_get_opp_table_indexed(struct device *dev, int index); void dev_pm_opp_put_opp_table(struct opp_table *opp_table); +int dev_pm_opp_add_opp_table(struct device *dev, struct opp_table *opp_table); unsigned long dev_pm_opp_get_voltage(struct dev_pm_opp *opp); @@ -158,6 +159,12 @@ static inline struct opp_table *dev_pm_opp_get_opp_table_indexed(struct device * static inline void dev_pm_opp_put_opp_table(struct opp_table *opp_table) {} +static int dev_pm_opp_add_opp_table(struct device *dev, + struct opp_table *opp_table) +{ + return -ENOTSUPP; +} + static inline unsigned long dev_pm_opp_get_voltage(struct dev_pm_opp *opp) { return 0; -- 2.22.0.rc2.383.gf4fbbf30c2-goog