Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 294060
b: refs/heads/master
c: 28a8d14
h: refs/heads/master
v: v3
  • Loading branch information
Linus Walleij committed Feb 10, 2012
1 parent 176a418 commit 28844a9
Show file tree
Hide file tree
Showing 7 changed files with 126 additions and 95 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f4e66983293f78e177bb210d19a46f083f5e8197
refs/heads/master: 28a8d14cc74a0180323d9150c3d3dbf9dd60d55a
6 changes: 5 additions & 1 deletion trunk/Documentation/pinctrl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ unconnected.

For example, a platform may do this:

#include <linux/pinctrl/consumer.h>

ret = pin_config_set("foo-dev", "FOO_GPIO_PIN", PLATFORM_X_PULL_UP);

To pull up a pin to VDD. The pin configuration driver implements callbacks for
Expand Down Expand Up @@ -920,7 +922,7 @@ this is not possible.
A driver may request a certain mux to be activated, usually just the default
mux like this:

#include <linux/pinctrl/pinmux.h>
#include <linux/pinctrl/consumer.h>

struct foo_state {
struct pinmux *pmx;
Expand Down Expand Up @@ -1019,6 +1021,8 @@ function, but with different named in the mapping as described under
This snippet first muxes the function in the pins defined by group A, enables
it, disables and releases it, and muxes it in on the pins defined by group B:

#include <linux/pinctrl/consumer.h>

foo_switch()
{
struct pinmux *pmx;
Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/arm/mach-u300/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <linux/mtd/nand.h>
#include <linux/mtd/fsmc.h>
#include <linux/pinctrl/machine.h>
#include <linux/pinctrl/pinmux.h>
#include <linux/pinctrl/consumer.h>
#include <linux/dma-mapping.h>

#include <asm/types.h>
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/pinctrl/pinctrl-coh901.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <linux/gpio.h>
#include <linux/list.h>
#include <linux/slab.h>
#include <linux/pinctrl/pinmux.h>
#include <linux/pinctrl/consumer.h>
#include <mach/gpio-u300.h>

/*
Expand Down
118 changes: 118 additions & 0 deletions trunk/include/linux/pinctrl/consumer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
/*
* Consumer interface the pin control 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
*/
#ifndef __LINUX_PINCTRL_CONSUMER_H
#define __LINUX_PINCTRL_CONSUMER_H

#include <linux/list.h>
#include <linux/seq_file.h>
#include "pinctrl.h"

/* This struct is private to the core and should be regarded as a cookie */
struct pinmux;

#ifdef CONFIG_PINMUX

/* External interface to pinmux */
extern int pinmux_request_gpio(unsigned gpio);
extern void pinmux_free_gpio(unsigned gpio);
extern int pinmux_gpio_direction_input(unsigned gpio);
extern int pinmux_gpio_direction_output(unsigned gpio);
extern struct pinmux * __must_check pinmux_get(struct device *dev, const char *name);
extern void pinmux_put(struct pinmux *pmx);
extern int pinmux_enable(struct pinmux *pmx);
extern void pinmux_disable(struct pinmux *pmx);

#else /* !CONFIG_PINMUX */

static inline int pinmux_request_gpio(unsigned gpio)
{
return 0;
}

static inline void pinmux_free_gpio(unsigned gpio)
{
}

static inline int pinmux_gpio_direction_input(unsigned gpio)
{
return 0;
}

static inline int pinmux_gpio_direction_output(unsigned gpio)
{
return 0;
}

static inline struct pinmux * __must_check pinmux_get(struct device *dev, const char *name)
{
return NULL;
}

static inline void pinmux_put(struct pinmux *pmx)
{
}

static inline int pinmux_enable(struct pinmux *pmx)
{
return 0;
}

static inline void pinmux_disable(struct pinmux *pmx)
{
}

#endif /* CONFIG_PINMUX */

#ifdef CONFIG_PINCONF

extern int pin_config_get(const char *dev_name, const char *name,
unsigned long *config);
extern int pin_config_set(const char *dev_name, const char *name,
unsigned long config);
extern int pin_config_group_get(const char *dev_name,
const char *pin_group,
unsigned long *config);
extern int pin_config_group_set(const char *dev_name,
const char *pin_group,
unsigned long config);

#else

static inline int pin_config_get(const char *dev_name, const char *name,
unsigned long *config)
{
return 0;
}

static inline int pin_config_set(const char *dev_name, const char *name,
unsigned long config)
{
return 0;
}

static inline int pin_config_group_get(const char *dev_name,
const char *pin_group,
unsigned long *config)
{
return 0;
}

static inline int pin_config_group_set(const char *dev_name,
const char *pin_group,
unsigned long config)
{
return 0;
}

#endif

#endif /* __LINUX_PINCTRL_CONSUMER_H */
39 changes: 0 additions & 39 deletions trunk/include/linux/pinctrl/pinconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,45 +53,6 @@ struct pinconf_ops {
unsigned selector);
};

extern int pin_config_get(const char *dev_name, const char *name,
unsigned long *config);
extern int pin_config_set(const char *dev_name, const char *name,
unsigned long config);
extern int pin_config_group_get(const char *dev_name,
const char *pin_group,
unsigned long *config);
extern int pin_config_group_set(const char *dev_name,
const char *pin_group,
unsigned long config);

#else

static inline int pin_config_get(const char *dev_name, const char *name,
unsigned long *config)
{
return 0;
}

static inline int pin_config_set(const char *dev_name, const char *name,
unsigned long config)
{
return 0;
}

static inline int pin_config_group_get(const char *dev_name,
const char *pin_group,
unsigned long *config)
{
return 0;
}

static inline int pin_config_group_set(const char *dev_name,
const char *pin_group,
unsigned long config)
{
return 0;
}

#endif

#endif /* __LINUX_PINCTRL_PINCONF_H */
52 changes: 0 additions & 52 deletions trunk/include/linux/pinctrl/pinmux.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
#include <linux/seq_file.h>
#include "pinctrl.h"

/* This struct is private to the core and should be regarded as a cookie */
struct pinmux;

#ifdef CONFIG_PINMUX

struct pinctrl_dev;
Expand Down Expand Up @@ -88,55 +85,6 @@ struct pinmux_ops {
bool input);
};

/* External interface to pinmux */
extern int pinmux_request_gpio(unsigned gpio);
extern void pinmux_free_gpio(unsigned gpio);
extern int pinmux_gpio_direction_input(unsigned gpio);
extern int pinmux_gpio_direction_output(unsigned gpio);
extern struct pinmux * __must_check pinmux_get(struct device *dev, const char *name);
extern void pinmux_put(struct pinmux *pmx);
extern int pinmux_enable(struct pinmux *pmx);
extern void pinmux_disable(struct pinmux *pmx);

#else /* !CONFIG_PINMUX */

static inline int pinmux_request_gpio(unsigned gpio)
{
return 0;
}

static inline void pinmux_free_gpio(unsigned gpio)
{
}

static inline int pinmux_gpio_direction_input(unsigned gpio)
{
return 0;
}

static inline int pinmux_gpio_direction_output(unsigned gpio)
{
return 0;
}

static inline struct pinmux * __must_check pinmux_get(struct device *dev, const char *name)
{
return NULL;
}

static inline void pinmux_put(struct pinmux *pmx)
{
}

static inline int pinmux_enable(struct pinmux *pmx)
{
return 0;
}

static inline void pinmux_disable(struct pinmux *pmx)
{
}

#endif /* CONFIG_PINMUX */

#endif /* __LINUX_PINCTRL_PINMUX_H */

0 comments on commit 28844a9

Please sign in to comment.