From patchwork Fri Aug 19 15:53:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 74285 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp382594qga; Fri, 19 Aug 2016 08:54:51 -0700 (PDT) X-Received: by 10.98.25.8 with SMTP id 8mr15468931pfz.94.1471622091137; Fri, 19 Aug 2016 08:54:51 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t22si5627073pfi.209.2016.08.19.08.54.50; Fri, 19 Aug 2016 08:54:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755355AbcHSPyt (ORCPT + 7 others); Fri, 19 Aug 2016 11:54:49 -0400 Received: from mail-wm0-f48.google.com ([74.125.82.48]:34192 "EHLO mail-wm0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754298AbcHSPyC (ORCPT ); Fri, 19 Aug 2016 11:54:02 -0400 Received: by mail-wm0-f48.google.com with SMTP id q128so9690066wma.1 for ; Fri, 19 Aug 2016 08:54:01 -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=YRFZIVWUeBhu53alWwNmwIHl8t53v+gY/deh28GlPZY=; b=hc64wjxq/lkIApqRiC06oP8mvp1fp8siKkcMpR42670Tb7aXVm0aQxMh3avSL5RJV6 lqXiUqWSNpdZuRIUvE0PCxuGQDkg30zDf5PgW3MzKDLS+/gLVgQLfQwQYHu9y9EXkGsw jGK5Z5JRN0fm1dMDIlTABNuh701XoJp/1MttQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=YRFZIVWUeBhu53alWwNmwIHl8t53v+gY/deh28GlPZY=; b=AOcWx3enu0OjpiFgwkbVn+xu/9ca1MBjnN6DfxCRdkScOpbPQdcg1iiNlAmGTYouSp At9Q30Hxs5D/fXv0ZVnykZVGEHtYDyWHI30aBlF/L4Zw14GfuRm1Qlsrqe/bLkNePG2i zOsC7tCjmk4x5J28jlwhZlLWk/7r6Wi3k4Ul9aqY9ABtXLGLKR48MXiZll7SKC56Z98w UB5ve/TBAMmBSXCMOQ4uBIRKMUBQ15Bizca+uez+LWLoaYvytGS+zkJte8lsNrSsXLVH x/Tjb7qL8g/jcMfGrpbWrF+Eldjtknot6TBZzTVIEc2XHhfeKx13/6j7Yjv/aJXwC3m5 zn9g== X-Gm-Message-State: AEkoouu6ufELADr6FpFHxH3P2O5Zw1A1O38oUF4TIUOhzq5QTu+3RUwn7S3KWrb1/FO79sWC X-Received: by 10.28.40.133 with SMTP id o127mr4807063wmo.46.1471622040232; Fri, 19 Aug 2016 08:54:00 -0700 (PDT) Received: from mms-0440.wifi.mm-sol.com ([37.157.136.206]) by smtp.gmail.com with ESMTPSA id m81sm5027581wmf.1.2016.08.19.08.53.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 19 Aug 2016 08:53:59 -0700 (PDT) From: Stanimir Varbanov To: Andy Gross , Ohad Ben-Cohen , Bjorn Andersson , Stephen Boyd , Rob Herring , Mark Rutland Cc: Rob Clark , Srinivas Kandagatla , linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org, Stanimir Varbanov Subject: [PATCH 1/4] firmware: qcom: scm: add a video command for state setting Date: Fri, 19 Aug 2016 18:53:17 +0300 Message-Id: <1471622000-1906-2-git-send-email-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1471622000-1906-1-git-send-email-stanimir.varbanov@linaro.org> References: <1471622000-1906-1-git-send-email-stanimir.varbanov@linaro.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org This scm call is used to change the video core state, more specifically it is used to suspend and resume the core. Signed-off-by: Stanimir Varbanov --- drivers/firmware/qcom_scm-32.c | 18 ++++++++++++++++++ drivers/firmware/qcom_scm-64.c | 16 ++++++++++++++++ drivers/firmware/qcom_scm.c | 16 ++++++++++++++++ drivers/firmware/qcom_scm.h | 2 ++ include/linux/qcom_scm.h | 2 ++ 5 files changed, 54 insertions(+) -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/firmware/qcom_scm-32.c b/drivers/firmware/qcom_scm-32.c index c6aeedbdcbb0..82c1d8d0d36b 100644 --- a/drivers/firmware/qcom_scm-32.c +++ b/drivers/firmware/qcom_scm-32.c @@ -560,3 +560,21 @@ int __qcom_scm_pas_mss_reset(struct device *dev, bool reset) return ret ? : le32_to_cpu(out); } + +int __qcom_scm_video_set_state(struct device *dev, u32 state, u32 spare) +{ + struct { + __le32 state; + __le32 spare; + } req; + __le32 scm_ret = 0; + int ret; + + req.state = cpu_to_le32(state); + req.spare = cpu_to_le32(spare); + + ret = qcom_scm_call(dev, QCOM_SCM_SVC_BOOT, QCOM_SCM_VIDEO_SET_STATE, + &req, sizeof(req), &scm_ret, sizeof(scm_ret)); + + return ret ? : le32_to_cpu(scm_ret); +} diff --git a/drivers/firmware/qcom_scm-64.c b/drivers/firmware/qcom_scm-64.c index 4a0f5ead4fb5..68484ea2aa51 100644 --- a/drivers/firmware/qcom_scm-64.c +++ b/drivers/firmware/qcom_scm-64.c @@ -358,3 +358,19 @@ int __qcom_scm_pas_mss_reset(struct device *dev, bool reset) return ret ? : res.a1; } + +int __qcom_scm_video_set_state(struct device *dev, u32 state, u32 spare) +{ + struct qcom_scm_desc desc = {0}; + struct arm_smccc_res res; + int ret; + + desc.args[0] = state; + desc.args[1] = spare; + desc.arginfo = QCOM_SCM_ARGS(2); + + ret = qcom_scm_call(dev, QCOM_SCM_SVC_BOOT, QCOM_SCM_VIDEO_SET_STATE, + &desc, &res); + + return ret ? : res.a1; +} diff --git a/drivers/firmware/qcom_scm.c b/drivers/firmware/qcom_scm.c index e64a501adbf4..3b0e31c48639 100644 --- a/drivers/firmware/qcom_scm.c +++ b/drivers/firmware/qcom_scm.c @@ -317,6 +317,22 @@ bool qcom_scm_is_available(void) } EXPORT_SYMBOL(qcom_scm_is_available); +int qcom_scm_video_set_state(u32 state, u32 spare) +{ + int ret; + + ret = qcom_scm_clk_enable(); + if (ret) + return ret; + + ret = __qcom_scm_video_set_state(__scm->dev, state, spare); + + qcom_scm_clk_disable(); + + return ret; +} +EXPORT_SYMBOL(qcom_scm_video_set_state); + static int qcom_scm_probe(struct platform_device *pdev) { struct qcom_scm *scm; diff --git a/drivers/firmware/qcom_scm.h b/drivers/firmware/qcom_scm.h index 3584b00fe7e6..4830559b2639 100644 --- a/drivers/firmware/qcom_scm.h +++ b/drivers/firmware/qcom_scm.h @@ -15,6 +15,8 @@ #define QCOM_SCM_SVC_BOOT 0x1 #define QCOM_SCM_BOOT_ADDR 0x1 #define QCOM_SCM_BOOT_ADDR_MC 0x11 +#define QCOM_SCM_VIDEO_SET_STATE 0xa +extern int __qcom_scm_video_set_state(struct device *dev, u32 state, u32 spare); #define QCOM_SCM_FLAG_HLOS 0x01 #define QCOM_SCM_FLAG_COLDBOOT_MC 0x02 diff --git a/include/linux/qcom_scm.h b/include/linux/qcom_scm.h index cc32ab852fbc..2ece81a6b078 100644 --- a/include/linux/qcom_scm.h +++ b/include/linux/qcom_scm.h @@ -46,4 +46,6 @@ extern void qcom_scm_cpu_power_down(u32 flags); extern u32 qcom_scm_get_version(void); +extern int qcom_scm_video_set_state(u32 state, u32 spare); + #endif