-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
yaml --- r: 350490 b: refs/heads/master c: ab78029 h: refs/heads/master v: v3
- Loading branch information
Linus Walleij
committed
Jan 23, 2013
1 parent
e338e45
commit 65b0de7
Showing
9 changed files
with
174 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
--- | ||
refs/heads/master: 684697cbbcd076b8fde78d8863e341700533b542 | ||
refs/heads/master: ab78029ecc347debbd737f06688d788bd9d60c1d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
* Driver core interface to the pinctrl subsystem. | ||
* | ||
* Copyright (C) 2012 ST-Ericsson SA | ||
* Written on behalf of Linaro for ST-Ericsson | ||
* Based on bits of regulator core, gpio core and clk core | ||
* | ||
* Author: Linus Walleij <linus.walleij@linaro.org> | ||
* | ||
* License terms: GNU General Public License (GPL) version 2 | ||
*/ | ||
|
||
#include <linux/device.h> | ||
#include <linux/pinctrl/devinfo.h> | ||
#include <linux/pinctrl/consumer.h> | ||
#include <linux/slab.h> | ||
|
||
/** | ||
* pinctrl_bind_pins() - called by the device core before probe | ||
* @dev: the device that is just about to probe | ||
*/ | ||
int pinctrl_bind_pins(struct device *dev) | ||
{ | ||
int ret; | ||
|
||
dev->pins = devm_kzalloc(dev, sizeof(*(dev->pins)), GFP_KERNEL); | ||
if (!dev->pins) | ||
return -ENOMEM; | ||
|
||
dev->pins->p = devm_pinctrl_get(dev); | ||
if (IS_ERR(dev->pins->p)) { | ||
dev_dbg(dev, "no pinctrl handle\n"); | ||
ret = PTR_ERR(dev->pins->p); | ||
goto cleanup_alloc; | ||
} | ||
|
||
dev->pins->default_state = pinctrl_lookup_state(dev->pins->p, | ||
PINCTRL_STATE_DEFAULT); | ||
if (IS_ERR(dev->pins->default_state)) { | ||
dev_dbg(dev, "no default pinctrl state\n"); | ||
ret = 0; | ||
goto cleanup_get; | ||
} | ||
|
||
ret = pinctrl_select_state(dev->pins->p, dev->pins->default_state); | ||
if (ret) { | ||
dev_dbg(dev, "failed to activate default pinctrl state\n"); | ||
goto cleanup_get; | ||
} | ||
|
||
return 0; | ||
|
||
/* | ||
* If no pinctrl handle or default state was found for this device, | ||
* let's explicitly free the pin container in the device, there is | ||
* no point in keeping it around. | ||
*/ | ||
cleanup_get: | ||
devm_pinctrl_put(dev->pins->p); | ||
cleanup_alloc: | ||
devm_kfree(dev, dev->pins); | ||
dev->pins = NULL; | ||
|
||
/* Only return deferrals */ | ||
if (ret != -EPROBE_DEFER) | ||
ret = 0; | ||
|
||
return ret; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Per-device information from the pin control system. | ||
* This is the stuff that get included into the device | ||
* core. | ||
* | ||
* Copyright (C) 2012 ST-Ericsson SA | ||
* Written on behalf of Linaro for ST-Ericsson | ||
* This interface is used in the core to keep track of pins. | ||
* | ||
* Author: Linus Walleij <linus.walleij@linaro.org> | ||
* | ||
* License terms: GNU General Public License (GPL) version 2 | ||
*/ | ||
|
||
#ifndef PINCTRL_DEVINFO_H | ||
#define PINCTRL_DEVINFO_H | ||
|
||
#ifdef CONFIG_PINCTRL | ||
|
||
/* The device core acts as a consumer toward pinctrl */ | ||
#include <linux/pinctrl/consumer.h> | ||
|
||
/** | ||
* 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 | ||
*/ | ||
struct dev_pin_info { | ||
struct pinctrl *p; | ||
struct pinctrl_state *default_state; | ||
}; | ||
|
||
extern int pinctrl_bind_pins(struct device *dev); | ||
|
||
#else | ||
|
||
/* Stubs if we're not using pinctrl */ | ||
|
||
static inline int pinctrl_bind_pins(struct device *dev) | ||
{ | ||
return 0; | ||
} | ||
|
||
#endif /* CONFIG_PINCTRL */ | ||
#endif /* PINCTRL_DEVINFO_H */ |