From patchwork Tue Jun 11 08:16:56 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 17789 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qe0-f71.google.com (mail-qe0-f71.google.com [209.85.128.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 499AB25E1A for ; Tue, 11 Jun 2013 08:18:13 +0000 (UTC) Received: by mail-qe0-f71.google.com with SMTP id 1sf8244597qee.2 for ; Tue, 11 Jun 2013 01:18:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-beenthere:x-forwarded-to:x-forwarded-for:delivered-to:from:to:cc :subject:date:message-id:x-mailer:mime-version:x-gm-message-state :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:x-google-group-id:list-post:list-help :list-archive:list-unsubscribe:content-type; bh=hYdDPd+/xzXlAtZg4jSRQ4J3lIV7QZvhXD5ZxcncjmQ=; b=DQiQ7FfSuAgqqST+5ojQSrurm4Yk74acV16GayejIu69BEoIY3JsRBQxLeotUtDTSs +t7tk4TF74mXrfjRT1sH6gSwXjOPx4aHCfuhrJkSS+Wu3ek7dySI0Y6jCJkBLGubRwPc Cg7EomVmWuXVIPDL3+KWjWUyb5QWHuchEK2G3ipuS6xdv0GVonQwCiWZC4xER41sCXqo 3+nk9mipoU7sK9oWgvXptwZ+Xqok+ljEgLnjyyNqSyBK0FOKg4qfZX6p/ssgp1X8aw0m 4g74R0eW7vy95lTXKhj7Sm44uo0j1GLo4e0U2aixgEieHQSnCz100ZAnFkEtLo+dYQgh z53A== X-Received: by 10.224.42.141 with SMTP id s13mr10345783qae.3.1370938692885; Tue, 11 Jun 2013 01:18:12 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.40.131 with SMTP id x3ls2913796qek.40.gmail; Tue, 11 Jun 2013 01:18:12 -0700 (PDT) X-Received: by 10.220.123.131 with SMTP id p3mr4531784vcr.69.1370938692561; Tue, 11 Jun 2013 01:18:12 -0700 (PDT) Received: from mail-vb0-x230.google.com (mail-vb0-x230.google.com [2607:f8b0:400c:c02::230]) by mx.google.com with ESMTPS id p8si6558135vdv.31.2013.06.11.01.18.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 11 Jun 2013 01:18:12 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c02::230 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c02::230; Received: by mail-vb0-f48.google.com with SMTP id w15so2825018vbf.35 for ; Tue, 11 Jun 2013 01:18:12 -0700 (PDT) X-Received: by 10.58.29.42 with SMTP id g10mr7448594veh.59.1370938692217; Tue, 11 Jun 2013 01:18:12 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.221.10.206 with SMTP id pb14csp99383vcb; Tue, 11 Jun 2013 01:18:11 -0700 (PDT) X-Received: by 10.14.172.70 with SMTP id s46mr15196550eel.133.1370938690659; Tue, 11 Jun 2013 01:18:10 -0700 (PDT) Received: from eu1sys200aog122.obsmtp.com (eu1sys200aog122.obsmtp.com [207.126.144.153]) by mx.google.com with SMTP id p43si4682833eeu.183.2013.06.11.01.17.25 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 11 Jun 2013 01:18:10 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.153 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) client-ip=207.126.144.153; Received: from beta.dmz-us.st.com ([167.4.1.35]) (using TLSv1) by eu1sys200aob122.postini.com ([207.126.147.11]) with SMTP ID DSNKUbbdEbiFyViYh2HDA3syf5haoi8LfRz5@postini.com; Tue, 11 Jun 2013 08:18:10 UTC Received: from zeta.dmz-us.st.com (ns4.st.com [167.4.16.71]) by beta.dmz-us.st.com (STMicroelectronics) with ESMTP id BE35848; Tue, 11 Jun 2013 08:16:03 +0000 (GMT) Received: from relay2.stm.gmessaging.net (unknown [10.230.100.18]) by zeta.dmz-us.st.com (STMicroelectronics) with ESMTP id D44FE4E; Tue, 11 Jun 2013 08:17:03 +0000 (GMT) Received: from exdcvycastm004.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm004", Issuer "exdcvycastm004" (not verified)) by relay2.stm.gmessaging.net (Postfix) with ESMTPS id CCB4AA8088; Tue, 11 Jun 2013 10:16:59 +0200 (CEST) Received: from steludxu4075.lud.stericsson.com (10.230.100.153) by smtp.stericsson.com (10.230.100.2) with Microsoft SMTP Server (TLS) id 8.3.279.5; Tue, 11 Jun 2013 10:17:03 +0200 From: Linus Walleij To: Greg Kroah-Hartman , Stephen Warren , Kevin Hilman , Tony Lindgren Cc: , , Linus Walleij , Hebbar Gururaja , Dmitry Torokhov , Stephen Warren , Wolfram Sang , Mark Brown Subject: [PATCH] drivers: pinctrl: add active state to core Date: Tue, 11 Jun 2013 10:16:56 +0200 Message-ID: <1370938616-5952-1-git-send-email-linus.walleij@stericsson.com> X-Mailer: git-send-email 1.7.11.3 MIME-Version: 1.0 X-Gm-Message-State: ALoCoQkaKZwY8Jo1hJe+7uMiUDK+3FoM8WNVYgxbl36qH5KJindbM/nG1K8VXN/G3eYAQyBx7UGg X-Original-Sender: linus.walleij@stericsson.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c02::230 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Linus Walleij In addition to the recently introduced pinctrl core control, the PM runtime pin control for the OMAP platforms require a fourth state in addtition to the default, idle and sleep states already handled by the core: an explicit "active" state. Let's introduce this to the core in addition to the other states already defined. Cc: Hebbar Gururaja Cc: Dmitry Torokhov Cc: Stephen Warren Cc: Wolfram Sang Cc: Greg Kroah-Hartman Cc: Mark Brown Cc: Kevin Hilman Suggested-by: Tony Lindgren Signed-off-by: Linus Walleij --- Greg: need your ACK on this to merge it through the pinctrl tree. --- drivers/base/pinctrl.c | 8 +++++++- drivers/pinctrl/core.c | 15 +++++++++++++++ include/linux/pinctrl/consumer.h | 10 ++++++++++ include/linux/pinctrl/devinfo.h | 4 ++++ include/linux/pinctrl/pinctrl-state.h | 5 +++++ 5 files changed, 41 insertions(+), 1 deletion(-) diff --git a/drivers/base/pinctrl.c b/drivers/base/pinctrl.c index 5fb74b4..833d7cd 100644 --- a/drivers/base/pinctrl.c +++ b/drivers/base/pinctrl.c @@ -51,9 +51,15 @@ int pinctrl_bind_pins(struct device *dev) #ifdef CONFIG_PM /* * If power management is enabled, we also look for the optional - * sleep and idle pin states, with semantics as defined in + * active, sleep and idle pin states, with semantics as defined in * */ + dev->pins->active_state = pinctrl_lookup_state(dev->pins->p, + PINCTRL_STATE_ACTIVE); + if (IS_ERR(dev->pins->active_state)) + /* Not supplying this state is perfectly legal */ + dev_dbg(dev, "no active pinctrl state\n"); + dev->pins->sleep_state = pinctrl_lookup_state(dev->pins->p, PINCTRL_STATE_SLEEP); if (IS_ERR(dev->pins->sleep_state)) diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c index dca9208..ff01b8f 100644 --- a/drivers/pinctrl/core.c +++ b/drivers/pinctrl/core.c @@ -1217,6 +1217,21 @@ int pinctrl_pm_select_default_state(struct device *dev) return ret; } +int pinctrl_pm_select_active_state(struct device *dev) +{ + struct dev_pin_info *pins = dev->pins; + int ret; + + if (!pins) + return 0; + if (IS_ERR(pins->active_state)) + return 0; /* No active state */ + ret = pinctrl_select_state(pins->p, pins->active_state); + if (ret) + dev_err(dev, "failed to activate pinctrl active state\n"); + return ret; +} + /** * pinctrl_pm_select_sleep_state() - select sleep pinctrl state for PM * @dev: device to select sleep state for diff --git a/include/linux/pinctrl/consumer.h b/include/linux/pinctrl/consumer.h index 0f32f10..18cdbb1 100644 --- a/include/linux/pinctrl/consumer.h +++ b/include/linux/pinctrl/consumer.h @@ -42,6 +42,7 @@ extern void devm_pinctrl_put(struct pinctrl *p); #ifdef CONFIG_PM extern int pinctrl_pm_select_default_state(struct device *dev); +extern int pinctrl_pm_select_active_state(struct device *dev); extern int pinctrl_pm_select_sleep_state(struct device *dev); extern int pinctrl_pm_select_idle_state(struct device *dev); #else @@ -49,6 +50,10 @@ static inline int pinctrl_pm_select_default_state(struct device *dev) { return 0; } +static inline int pinctrl_pm_select_active_state(struct device *dev) +{ + return 0; +} static inline int pinctrl_pm_select_sleep_state(struct device *dev) { return 0; @@ -223,6 +228,11 @@ static inline int pinctrl_pm_select_default_state(struct device *dev) return 0; } +static inline int pinctrl_pm_select_active_state(struct device *dev) +{ + return 0; +} + static inline int pinctrl_pm_select_sleep_state(struct device *dev) { return 0; diff --git a/include/linux/pinctrl/devinfo.h b/include/linux/pinctrl/devinfo.h index 281cb91..a61e6a5 100644 --- a/include/linux/pinctrl/devinfo.h +++ b/include/linux/pinctrl/devinfo.h @@ -24,11 +24,15 @@ * struct dev_pin_info - pin state container for devices * @p: pinctrl handle for the containing device * @default_state: the default state for the handle, if found + * @active_state: the active state for the handle, if found + * @sleep_state: the sleep state for the handle, if found + * @idle_state: the idle state for the handle, if found */ struct dev_pin_info { struct pinctrl *p; struct pinctrl_state *default_state; #ifdef CONFIG_PM + struct pinctrl_state *active_state; struct pinctrl_state *sleep_state; struct pinctrl_state *idle_state; #endif diff --git a/include/linux/pinctrl/pinctrl-state.h b/include/linux/pinctrl/pinctrl-state.h index b5919f8..37d0cd1 100644 --- a/include/linux/pinctrl/pinctrl-state.h +++ b/include/linux/pinctrl/pinctrl-state.h @@ -9,6 +9,10 @@ * hogs to configure muxing and pins at boot, and also as a state * to go into when returning from sleep and idle in * .pm_runtime_resume() or ordinary .resume() for example. + * @PINCTRL_STATE_ACTIVE: the state the pinctrl handle shall be put + * into for explicitly active mode, typically in .pm_runtime_resume() + * and other occasions where we want to be sure that the pins are + * ready to roll. * @PINCTRL_STATE_IDLE: the state the pinctrl handle shall be put into * when the pins are idle. This is a state where the system is relaxed * but not fully sleeping - some power may be on but clocks gated for @@ -20,5 +24,6 @@ * ordinary .suspend() function. */ #define PINCTRL_STATE_DEFAULT "default" +#define PINCTRL_STATE_ACTIVE "active" #define PINCTRL_STATE_IDLE "idle" #define PINCTRL_STATE_SLEEP "sleep"