From patchwork Wed Oct 16 19:37:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thara Gopinath X-Patchwork-Id: 176519 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp7827264ill; Wed, 16 Oct 2019 12:37:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqx2YtdqPya+q9tNuLUQFMJzE5Ju42NI4/N7RooupH0avBF9d4IG6eOQrNJqNNW06TZ831AW X-Received: by 2002:a50:fc9a:: with SMTP id f26mr40572280edq.217.1571254658420; Wed, 16 Oct 2019 12:37:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571254658; cv=none; d=google.com; s=arc-20160816; b=nMfjENzMAx57fLF6O3IUrQYIZi4eeDqUcRGq4yZnxINFzLnR4+uOlS+JQV/qf8Pf+w k+iNSa6ZuVBIPUrUAq2ReMI89lJNNA12yJPd3eh52AU6uplFwOdEV1pypDWwnAG7zo4J xl5nu6XOEF31+jQFliZp1UO/OKAj9cEgdmDIMUoG7fLDUdCFUoPHOF9Fqaxp++oa01ot fJIvDqOf1SiYNWxhHgYQTkKR/EBhrnJI/cDRkPnxkSj9eFxPN8Blzhti0aeXaRQtMH7d l6aXOnrsE56uxqVR9+R+Q+CIAp4wdWjLmC/mpuTL0AJaKNgHgTt4WNs4o4uwUjiZvBsr jCog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=E2xMtfg5bJTmZe94/qx4v5HPv3cpP1DHi2yBTTi4UXk=; b=rK5xadCQt2X1p+thzBmRfDYAH/05TRTlMU3n4QTBnW1AL+J2rwQ0ccQ1mPm7IjF5QT aBi47GEZnK/+O8M28RmUjbbBAWmMmV9BHT7DJ6SZIHGUD8BECQWGMRi5E8LK/IV043wC Fd6YDoDASOizZdTWQe65GjAElAFVmiYepXhpXOmrTf22O2aB7iD/uv0FVluKpHLzL6KH Udfpb3jhgXuc+f3rTBIPCkbpWKKrbC65swxe+ExX1rf+8eKgBE0HfTCJ1/YQxDhwMkOg JrDvTPWu/OyIE6n8ExIdjFyC5aTtNQD8TSdSg6wLFMaZjjd1VRmCYAqdk4+KtQ8hbKct GTHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yiEGyuxw; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z19si16302545ejr.244.2019.10.16.12.37.38; Wed, 16 Oct 2019 12:37:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-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=@linaro.org header.s=google header.b=yiEGyuxw; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2394463AbfJPThd (ORCPT + 15 others); Wed, 16 Oct 2019 15:37:33 -0400 Received: from mail-qt1-f196.google.com ([209.85.160.196]:37497 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2394448AbfJPThc (ORCPT ); Wed, 16 Oct 2019 15:37:32 -0400 Received: by mail-qt1-f196.google.com with SMTP id n17so18518623qtr.4 for ; Wed, 16 Oct 2019 12:37:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=E2xMtfg5bJTmZe94/qx4v5HPv3cpP1DHi2yBTTi4UXk=; b=yiEGyuxwygGASqd+4EnfQQXnAstv6WNIJC4tpcMTrjTHMRBlAxqUUmy3TXbQ9wu1OS jDd/n79uL5Fh7FnlU3t+AjYcBamWvQW9x5Fk4Wu2074XgFIzZ614l7R8FsvKfxEMRsWJ ITsuWypSAEltVlevAHN+PVhr+CvPw2BZNuOgs/ZRm91Ly7xpPDomQ4Rv00ssBs+cxQFg 0B3G4r0phywCDRzo2iFnxSmyTQTnWVtEJDawys7gUkmESDhvMhbJb7XHsia+hkyAB/of 7OowfA6qoW5J/sGNBUqAGvouMHJQYZA2yIbTy4NzsYAcJZ4oqmGDXC087MoHr6rLPfiA LnkA== 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=E2xMtfg5bJTmZe94/qx4v5HPv3cpP1DHi2yBTTi4UXk=; b=B/kp5n+/y4VQ43NfP8boKezDQ94qE5Djm3YKh21O/qkdJiFB22NKmHlomv3yBXKNxX 91kWyPsdEX4V8omznpa+iK38JR2NbG/G2nxtCQliyg0wbivCBxFJpgSXzfdRzM2IxXBh Ova8n6EugVDMTosLIrvj6sTnO3dGcFK6hgKTPcqrK4K7abA4GEv8eko6z5xFXOSznV2e jIP824HOO6z1bhLV3hff4RSIseAb4MQh7Tov8g6fguTHqQ3zxKg5VLsUsPVZFzKJKf4q 62F9XqFMWS2J+e1ksxPLzp+fUUD1h3/x2+qUm9e7UB2Qr81C5gqptQPblrbJHmtm5P6Y lX3g== X-Gm-Message-State: APjAAAUzR6Dxnr5mMyxwQRSXNnBeLtVJ9+WJH90XMy7AdTqCAcsk60iX J9u9fmIm6uz767I9CvdHAGGlAQ== X-Received: by 2002:ac8:3652:: with SMTP id n18mr13523277qtb.232.1571254651349; Wed, 16 Oct 2019 12:37:31 -0700 (PDT) Received: from Thara-Work-Ubuntu.fios-router.home (pool-71-255-246-27.washdc.fios.verizon.net. [71.255.246.27]) by smtp.googlemail.com with ESMTPSA id 54sm16246030qts.75.2019.10.16.12.37.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 16 Oct 2019 12:37:30 -0700 (PDT) From: Thara Gopinath To: edubezval@gmail.com, rui.zhang@intel.com, ulf.hansson@linaro.org, daniel.lezcano@linaro.org, bjorn.andersson@linaro.org, agross@kernel.org Cc: amit.kucheria@verdurent.com, mark.rutland@arm.com, rjw@rjwysocki.net, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 2/7] soc: qcom: rpmhpd: Introduce function to retrieve power domain performance state count Date: Wed, 16 Oct 2019 15:37:16 -0400 Message-Id: <1571254641-13626-3-git-send-email-thara.gopinath@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1571254641-13626-1-git-send-email-thara.gopinath@linaro.org> References: <1571254641-13626-1-git-send-email-thara.gopinath@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Populate .get_performace_state_count in genpd ops to retrieve the count of performance states supported by a rpmh power domain. Signed-off-by: Thara Gopinath --- drivers/soc/qcom/rpmhpd.c | 9 +++++++++ 1 file changed, 9 insertions(+) -- 2.1.4 diff --git a/drivers/soc/qcom/rpmhpd.c b/drivers/soc/qcom/rpmhpd.c index 5741ec3..9d37534 100644 --- a/drivers/soc/qcom/rpmhpd.c +++ b/drivers/soc/qcom/rpmhpd.c @@ -285,6 +285,13 @@ static unsigned int rpmhpd_get_performance_state(struct generic_pm_domain *genpd return dev_pm_opp_get_level(opp); } +static int rpmhpd_performance_states_count(struct generic_pm_domain *domain) +{ + struct rpmhpd *pd = domain_to_rpmhpd(domain); + + return pd->level_count; +} + static int rpmhpd_update_level_mapping(struct rpmhpd *rpmhpd) { int i; @@ -373,6 +380,8 @@ static int rpmhpd_probe(struct platform_device *pdev) rpmhpds[i]->pd.power_on = rpmhpd_power_on; rpmhpds[i]->pd.set_performance_state = rpmhpd_set_performance_state; rpmhpds[i]->pd.opp_to_performance_state = rpmhpd_get_performance_state; + rpmhpds[i]->pd.get_performance_state_count = + rpmhpd_performance_states_count; pm_genpd_init(&rpmhpds[i]->pd, NULL, true); data->domains[i] = &rpmhpds[i]->pd; From patchwork Wed Oct 16 19:37:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thara Gopinath X-Patchwork-Id: 176520 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp7827269ill; Wed, 16 Oct 2019 12:37:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqxWhqPhSZ+bX8WE1OOckr+i84ZsQxHfg7YAlr2Z1C0I4cT/HqlF7qdIjPkodoLO53sY8Jdv X-Received: by 2002:a17:906:3797:: with SMTP id n23mr41241361ejc.284.1571254658905; Wed, 16 Oct 2019 12:37:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571254658; cv=none; d=google.com; s=arc-20160816; b=EWdLhQgU/tJnGgNp43EmOuASNIuqiOfmbbP4KWdRI7Jv8lw/DanKHpD8/x+uEke2Sq WnT10OVUmerk8hUgsn7rxN+dNZj9Ba0U1QNKB54AmUKWKhBYGgZHQlVhE3SmnjaNuANm HyjoOK+W4eeBiSy65uQd4HEoM49p99sl322Dldmnv1LLcKXu2UuERpeVGGxJV1AgBbG/ X2tRiSHmErcngB5pJLPhvP4FQoW1m9h8qjla1kWPbLAkKPto6NU91P2wEtk+t1+blSPa rX9iE1SxQp9AAp1TavzotjTEyTZmTFtXDiUYAKGzPTcJX1c+DI5m0D1e3PEI54j18zO7 4Hkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=SEzzpxn6TNoCaJjNnbG2b9pO7Zr0jWolxxLkxLULV5c=; b=Q2gVcJh775hrt90J5orJDS6gKRQkB+Z4dhnOz1kwN6J+FEYVOGFnWJhIPtdiv/xYxw 60vIprJxpWMWaRwDlKShQwpgrZbm8FvY0Yg/PTMZPxn8qeFEYt9L9+NflyHO8FVNlqVn S88pjSlNBDbCcG1repMF+odd1oGMihDxfZCC09qyKMqQY11vFDxFxSm4rmMK8pJvS/TR +xh7QNNRQYfujAqQqgPSeZkNExse2lGd5KhDV/BJ//4tQAQgMaJ11KdHisV4QSmiXHWu VC+ZJXiOPuPxnQEeoDKaEASuQWUO5nS7bto93Fot4tKpkBO3PQeiq2x5fd6tNDpB1KCe WNzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jtg46D18; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z19si16302545ejr.244.2019.10.16.12.37.38; Wed, 16 Oct 2019 12:37:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-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=@linaro.org header.s=google header.b=jtg46D18; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2394466AbfJPThe (ORCPT + 15 others); Wed, 16 Oct 2019 15:37:34 -0400 Received: from mail-qk1-f195.google.com ([209.85.222.195]:38275 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2394451AbfJPThe (ORCPT ); Wed, 16 Oct 2019 15:37:34 -0400 Received: by mail-qk1-f195.google.com with SMTP id p4so3368206qkf.5 for ; Wed, 16 Oct 2019 12:37:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=SEzzpxn6TNoCaJjNnbG2b9pO7Zr0jWolxxLkxLULV5c=; b=jtg46D18bjGRyC40A5rJir1izsa/p65sPjSA6mfWjUIbPAwgAbDKZuoyK3S88fFVaw kuXOvBRiVr3prI14Wzpr879D32cekWxy2DfL9VOQ2S1SIbB3nvPiazNqIlkKepocZ5DZ laBNkiMBhlGk+kgT37dsdeInOu+lArHA3YkDS712pXc2v6jeK71o8l1wuztqj+wqCoPV sZ8vQS0SqkAK3789qvJtMJMZOLtTFDvdKIED6p38HeakzS1elUEavpdgF1ZXo8k0oXoa afIKOcKef7hh8Skn3Qb5TDFs2mP8t+6bBhJf0iEclk9Rstsq7HuNJh9zdbn/QS/T/ieW VIjg== 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=SEzzpxn6TNoCaJjNnbG2b9pO7Zr0jWolxxLkxLULV5c=; b=Up1dRL7KAyooRQlQfsjJ2H9cPYHk9LX6QrBqgbXPmN9lgdcYH64aRc9DylsMBEko57 UzX7O6GLpCTXfm/n80S8ZauCJjzCK9TOBUuo1kLmX7AXi6XjNUdNNB1Ced+phpNPVr3q kUibl2jIDIVIByiP5sVumaiqiQ/HcXT1URrfc99tz6BEois1a5gJ03qE6dOxIuMnPMAT z/ncgZpcCBQ2TEjK+Oyr8uwSOLXdtiENiDzfZgfrEJGjmn9JqDHp7fkD6gdSF3gE7ryv bUg9DZws3btwMbR8ceV1WEKb0Wr55bhVoMtoeNbEZIEqnzEILtJembFoV3a1NVpCS6u5 GVGw== X-Gm-Message-State: APjAAAVZ+lUQNvIEWF/2VPiOYX3SV8iZqdrR5lUeZU6/TLftZQ+UAdIw oMJHCBXPnJ0PAMP8uVZxfNjw5hSIFMMDnA== X-Received: by 2002:a37:f70f:: with SMTP id q15mr39409920qkj.428.1571254652961; Wed, 16 Oct 2019 12:37:32 -0700 (PDT) Received: from Thara-Work-Ubuntu.fios-router.home (pool-71-255-246-27.washdc.fios.verizon.net. [71.255.246.27]) by smtp.googlemail.com with ESMTPSA id 54sm16246030qts.75.2019.10.16.12.37.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 16 Oct 2019 12:37:32 -0700 (PDT) From: Thara Gopinath To: edubezval@gmail.com, rui.zhang@intel.com, ulf.hansson@linaro.org, daniel.lezcano@linaro.org, bjorn.andersson@linaro.org, agross@kernel.org Cc: amit.kucheria@verdurent.com, mark.rutland@arm.com, rjw@rjwysocki.net, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 3/7] thermal: core: Add late init hook to cooling device ops Date: Wed, 16 Oct 2019 15:37:17 -0400 Message-Id: <1571254641-13626-4-git-send-email-thara.gopinath@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1571254641-13626-1-git-send-email-thara.gopinath@linaro.org> References: <1571254641-13626-1-git-send-email-thara.gopinath@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Add a hook in thermal_cooling_device_ops to be called after the cooling device has been initialized and registered but before binding it to a thermal zone. In this patch series it is used to hook up a power domain to the device pointer of cooling device. It can be used for any other relevant late initializations of a cooling device as well. Signed-off-by: Thara Gopinath --- drivers/thermal/thermal_core.c | 13 +++++++++++++ include/linux/thermal.h | 1 + 2 files changed, 14 insertions(+) -- 2.1.4 diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 886e8fa..c2ecb73 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -994,6 +994,19 @@ __thermal_cooling_device_register(struct device_node *np, list_add(&cdev->node, &thermal_cdev_list); mutex_unlock(&thermal_list_lock); + /* Call into cdev late initialization if defined */ + if (cdev->ops->late_init) { + result = cdev->ops->late_init(cdev); + if (result) { + ida_simple_remove(&thermal_cdev_ida, cdev->id); + put_device(&cdev->device); + mutex_lock(&thermal_list_lock); + list_del(&cdev->node); + mutex_unlock(&thermal_list_lock); + return ERR_PTR(result); + } + } + /* Update binding information for 'this' new cdev */ bind_cdev(cdev); diff --git a/include/linux/thermal.h b/include/linux/thermal.h index e45659c..e94b3de 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -125,6 +125,7 @@ struct thermal_cooling_device_ops { struct thermal_zone_device *, unsigned long, u32 *); int (*power2state)(struct thermal_cooling_device *, struct thermal_zone_device *, u32, unsigned long *); + int (*late_init)(struct thermal_cooling_device *); }; struct thermal_cooling_device {