config PINCTRL_LYNXPOINT
tristate "Intel Lynxpoint pinctrl and GPIO driver"
depends on ACPI
- select PINMUX
- select PINCONF
- select GENERIC_PINCONF
- select GPIOLIB
- select GPIOLIB_IRQCHIP
+ select PINCTRL_INTEL
help
Lynxpoint is the PCH of Intel Haswell. This pinctrl driver
provides an interface that allows configuring of PCH pins and
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/kernel.h>
+#include <linux/module.h>
#include <linux/types.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
static DEFINE_RAW_SPINLOCK(byt_lock);
-static struct intel_community *byt_get_community(struct intel_pinctrl *vg,
- unsigned int pin)
-{
- struct intel_community *comm;
- int i;
-
- for (i = 0; i < vg->ncommunities; i++) {
- comm = vg->communities + i;
- if (pin < comm->pin_base + comm->npins && pin >= comm->pin_base)
- return comm;
- }
-
- return NULL;
-}
-
static void __iomem *byt_gpio_reg(struct intel_pinctrl *vg, unsigned int offset,
int reg)
{
- struct intel_community *comm = byt_get_community(vg, offset);
+ struct intel_community *comm = intel_get_community(vg, offset);
u32 reg_offset;
if (!comm)
return comm->pad_regs + reg_offset + reg;
}
-static int byt_get_groups_count(struct pinctrl_dev *pctldev)
-{
- struct intel_pinctrl *vg = pinctrl_dev_get_drvdata(pctldev);
-
- return vg->soc->ngroups;
-}
-
-static const char *byt_get_group_name(struct pinctrl_dev *pctldev,
- unsigned int selector)
-{
- struct intel_pinctrl *vg = pinctrl_dev_get_drvdata(pctldev);
-
- return vg->soc->groups[selector].grp.name;
-}
-
-static int byt_get_group_pins(struct pinctrl_dev *pctldev,
- unsigned int selector,
- const unsigned int **pins,
- unsigned int *num_pins)
-{
- struct intel_pinctrl *vg = pinctrl_dev_get_drvdata(pctldev);
-
- *pins = vg->soc->groups[selector].grp.pins;
- *num_pins = vg->soc->groups[selector].grp.npins;
-
- return 0;
-}
-
static const struct pinctrl_ops byt_pinctrl_ops = {
- .get_groups_count = byt_get_groups_count,
- .get_group_name = byt_get_group_name,
- .get_group_pins = byt_get_group_pins,
+ .get_groups_count = intel_get_groups_count,
+ .get_group_name = intel_get_group_name,
+ .get_group_pins = intel_get_group_pins,
};
-static int byt_get_functions_count(struct pinctrl_dev *pctldev)
-{
- struct intel_pinctrl *vg = pinctrl_dev_get_drvdata(pctldev);
-
- return vg->soc->nfunctions;
-}
-
-static const char *byt_get_function_name(struct pinctrl_dev *pctldev,
- unsigned int selector)
-{
- struct intel_pinctrl *vg = pinctrl_dev_get_drvdata(pctldev);
-
- return vg->soc->functions[selector].func.name;
-}
-
-static int byt_get_function_groups(struct pinctrl_dev *pctldev,
- unsigned int selector,
- const char * const **groups,
- unsigned int *ngroups)
-{
- struct intel_pinctrl *vg = pinctrl_dev_get_drvdata(pctldev);
-
- *groups = vg->soc->functions[selector].func.groups;
- *ngroups = vg->soc->functions[selector].func.ngroups;
-
- return 0;
-}
-
static void byt_set_group_simple_mux(struct intel_pinctrl *vg,
const struct intel_pingroup group,
unsigned int func)
}
static const struct pinmux_ops byt_pinmux_ops = {
- .get_functions_count = byt_get_functions_count,
- .get_function_name = byt_get_function_name,
- .get_function_groups = byt_get_function_groups,
+ .get_functions_count = intel_get_functions_count,
+ .get_function_name = intel_get_function_name,
+ .get_function_groups = intel_get_function_groups,
.set_mux = byt_set_mux,
.gpio_request_enable = byt_gpio_request_enable,
.gpio_disable_free = byt_gpio_disable_free,
val = readl(val_reg);
raw_spin_unlock_irqrestore(&byt_lock, flags);
- comm = byt_get_community(vg, pin);
+ comm = intel_get_community(vg, pin);
if (!comm) {
seq_printf(s, "Pin %i: can't retrieve community\n", pin);
continue;
return platform_driver_register(&byt_gpio_driver);
}
subsys_initcall(byt_gpio_init);
+
+MODULE_IMPORT_NS(PINCTRL_INTEL);
return chv_readl(pctrl, offset, CHV_PADCTRL1) & CHV_PADCTRL1_CFGLOCK;
}
-static int chv_get_groups_count(struct pinctrl_dev *pctldev)
-{
- struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
-
- return pctrl->soc->ngroups;
-}
-
-static const char *chv_get_group_name(struct pinctrl_dev *pctldev,
- unsigned int group)
-{
- struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
-
- return pctrl->soc->groups[group].grp.name;
-}
-
-static int chv_get_group_pins(struct pinctrl_dev *pctldev, unsigned int group,
- const unsigned int **pins, unsigned int *npins)
-{
- struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
-
- *pins = pctrl->soc->groups[group].grp.pins;
- *npins = pctrl->soc->groups[group].grp.npins;
- return 0;
-}
-
static void chv_pin_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s,
unsigned int offset)
{
}
static const struct pinctrl_ops chv_pinctrl_ops = {
- .get_groups_count = chv_get_groups_count,
- .get_group_name = chv_get_group_name,
- .get_group_pins = chv_get_group_pins,
+ .get_groups_count = intel_get_groups_count,
+ .get_group_name = intel_get_group_name,
+ .get_group_pins = intel_get_group_pins,
.pin_dbg_show = chv_pin_dbg_show,
};
-static int chv_get_functions_count(struct pinctrl_dev *pctldev)
-{
- struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
-
- return pctrl->soc->nfunctions;
-}
-
-static const char *chv_get_function_name(struct pinctrl_dev *pctldev,
- unsigned int function)
-{
- struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
-
- return pctrl->soc->functions[function].func.name;
-}
-
-static int chv_get_function_groups(struct pinctrl_dev *pctldev,
- unsigned int function,
- const char * const **groups,
- unsigned int * const ngroups)
-{
- struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
-
- *groups = pctrl->soc->functions[function].func.groups;
- *ngroups = pctrl->soc->functions[function].func.ngroups;
- return 0;
-}
-
static int chv_pinmux_set_mux(struct pinctrl_dev *pctldev,
unsigned int function, unsigned int group)
{
}
static const struct pinmux_ops chv_pinmux_ops = {
- .get_functions_count = chv_get_functions_count,
- .get_function_name = chv_get_function_name,
- .get_function_groups = chv_get_function_groups,
+ .get_functions_count = intel_get_functions_count,
+ .get_function_name = intel_get_function_name,
+ .get_function_groups = intel_get_function_groups,
.set_mux = chv_pinmux_set_mux,
.gpio_request_enable = chv_gpio_request_enable,
.gpio_disable_free = chv_gpio_disable_free,
unsigned int npins;
int ret;
- ret = chv_get_group_pins(pctldev, group, &pins, &npins);
+ ret = intel_get_group_pins(pctldev, group, &pins, &npins);
if (ret)
return ret;
unsigned int npins;
int i, ret;
- ret = chv_get_group_pins(pctldev, group, &pins, &npins);
+ ret = intel_get_group_pins(pctldev, group, &pins, &npins);
if (ret)
return ret;
MODULE_AUTHOR("Mika Westerberg <mika.westerberg@linux.intel.com>");
MODULE_DESCRIPTION("Intel Cherryview/Braswell pinctrl driver");
MODULE_LICENSE("GPL v2");
+MODULE_IMPORT_NS(PINCTRL_INTEL);
#define pin_to_padno(c, p) ((p) - (c)->pin_base)
#define padgroup_offset(g, p) ((p) - (g)->base)
-static struct intel_community *intel_get_community(struct intel_pinctrl *pctrl,
- unsigned int pin)
+struct intel_community *intel_get_community(struct intel_pinctrl *pctrl, unsigned int pin)
{
struct intel_community *community;
int i;
dev_warn(pctrl->dev, "failed to find community for pin %u\n", pin);
return NULL;
}
+EXPORT_SYMBOL_NS_GPL(intel_get_community, PINCTRL_INTEL);
static const struct intel_padgroup *
intel_community_get_padgroup(const struct intel_community *community,
return intel_pad_owned_by_host(pctrl, pin) && intel_pad_is_unlocked(pctrl, pin);
}
-static int intel_get_groups_count(struct pinctrl_dev *pctldev)
+int intel_get_groups_count(struct pinctrl_dev *pctldev)
{
struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
return pctrl->soc->ngroups;
}
+EXPORT_SYMBOL_NS_GPL(intel_get_groups_count, PINCTRL_INTEL);
-static const char *intel_get_group_name(struct pinctrl_dev *pctldev,
- unsigned int group)
+const char *intel_get_group_name(struct pinctrl_dev *pctldev, unsigned int group)
{
struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
return pctrl->soc->groups[group].grp.name;
}
+EXPORT_SYMBOL_NS_GPL(intel_get_group_name, PINCTRL_INTEL);
-static int intel_get_group_pins(struct pinctrl_dev *pctldev, unsigned int group,
- const unsigned int **pins, unsigned int *npins)
+int intel_get_group_pins(struct pinctrl_dev *pctldev, unsigned int group,
+ const unsigned int **pins, unsigned int *npins)
{
struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
*npins = pctrl->soc->groups[group].grp.npins;
return 0;
}
+EXPORT_SYMBOL_NS_GPL(intel_get_group_pins, PINCTRL_INTEL);
static void intel_pin_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s,
unsigned int pin)
.pin_dbg_show = intel_pin_dbg_show,
};
-static int intel_get_functions_count(struct pinctrl_dev *pctldev)
+int intel_get_functions_count(struct pinctrl_dev *pctldev)
{
struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
return pctrl->soc->nfunctions;
}
+EXPORT_SYMBOL_NS_GPL(intel_get_functions_count, PINCTRL_INTEL);
-static const char *intel_get_function_name(struct pinctrl_dev *pctldev,
- unsigned int function)
+const char *intel_get_function_name(struct pinctrl_dev *pctldev, unsigned int function)
{
struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
return pctrl->soc->functions[function].func.name;
}
+EXPORT_SYMBOL_NS_GPL(intel_get_function_name, PINCTRL_INTEL);
-static int intel_get_function_groups(struct pinctrl_dev *pctldev,
- unsigned int function,
- const char * const **groups,
- unsigned int * const ngroups)
+int intel_get_function_groups(struct pinctrl_dev *pctldev, unsigned int function,
+ const char * const **groups, unsigned int * const ngroups)
{
struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
*ngroups = pctrl->soc->functions[function].func.ngroups;
return 0;
}
+EXPORT_SYMBOL_NS_GPL(intel_get_function_groups, PINCTRL_INTEL);
static int intel_pinmux_set_mux(struct pinctrl_dev *pctldev,
unsigned int function, unsigned int group)
intel_pinctrl_resume_noirq) \
}
+struct intel_community *intel_get_community(struct intel_pinctrl *pctrl, unsigned int pin);
+
+int intel_get_groups_count(struct pinctrl_dev *pctldev);
+const char *intel_get_group_name(struct pinctrl_dev *pctldev, unsigned int group);
+int intel_get_group_pins(struct pinctrl_dev *pctldev, unsigned int group,
+ const unsigned int **pins, unsigned int *npins);
+
+int intel_get_functions_count(struct pinctrl_dev *pctldev);
+const char *intel_get_function_name(struct pinctrl_dev *pctldev, unsigned int function);
+int intel_get_function_groups(struct pinctrl_dev *pctldev, unsigned int function,
+ const char * const **groups, unsigned int * const ngroups);
+
#endif /* PINCTRL_INTEL_H */
* IOxAPIC redirection map applies only for gpio 8-10, 13-14, 45-55.
*/
-static struct intel_community *lp_get_community(struct intel_pinctrl *lg,
- unsigned int pin)
-{
- struct intel_community *comm;
- int i;
-
- for (i = 0; i < lg->ncommunities; i++) {
- comm = &lg->communities[i];
- if (pin < comm->pin_base + comm->npins && pin >= comm->pin_base)
- return comm;
- }
-
- return NULL;
-}
-
static void __iomem *lp_gpio_reg(struct gpio_chip *chip, unsigned int offset,
int reg)
{
struct intel_community *comm;
int reg_offset;
- comm = lp_get_community(lg, offset);
+ comm = intel_get_community(lg, offset);
if (!comm)
return NULL;
return false;
}
-static int lp_get_groups_count(struct pinctrl_dev *pctldev)
-{
- struct intel_pinctrl *lg = pinctrl_dev_get_drvdata(pctldev);
-
- return lg->soc->ngroups;
-}
-
-static const char *lp_get_group_name(struct pinctrl_dev *pctldev,
- unsigned int selector)
-{
- struct intel_pinctrl *lg = pinctrl_dev_get_drvdata(pctldev);
-
- return lg->soc->groups[selector].grp.name;
-}
-
-static int lp_get_group_pins(struct pinctrl_dev *pctldev,
- unsigned int selector,
- const unsigned int **pins,
- unsigned int *num_pins)
-{
- struct intel_pinctrl *lg = pinctrl_dev_get_drvdata(pctldev);
-
- *pins = lg->soc->groups[selector].grp.pins;
- *num_pins = lg->soc->groups[selector].grp.npins;
-
- return 0;
-}
-
static void lp_pin_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s,
unsigned int pin)
{
}
static const struct pinctrl_ops lptlp_pinctrl_ops = {
- .get_groups_count = lp_get_groups_count,
- .get_group_name = lp_get_group_name,
- .get_group_pins = lp_get_group_pins,
+ .get_groups_count = intel_get_groups_count,
+ .get_group_name = intel_get_group_name,
+ .get_group_pins = intel_get_group_pins,
.pin_dbg_show = lp_pin_dbg_show,
};
-static int lp_get_functions_count(struct pinctrl_dev *pctldev)
-{
- struct intel_pinctrl *lg = pinctrl_dev_get_drvdata(pctldev);
-
- return lg->soc->nfunctions;
-}
-
-static const char *lp_get_function_name(struct pinctrl_dev *pctldev,
- unsigned int selector)
-{
- struct intel_pinctrl *lg = pinctrl_dev_get_drvdata(pctldev);
-
- return lg->soc->functions[selector].func.name;
-}
-
-static int lp_get_function_groups(struct pinctrl_dev *pctldev,
- unsigned int selector,
- const char * const **groups,
- unsigned int *ngroups)
-{
- struct intel_pinctrl *lg = pinctrl_dev_get_drvdata(pctldev);
-
- *groups = lg->soc->functions[selector].func.groups;
- *ngroups = lg->soc->functions[selector].func.ngroups;
-
- return 0;
-}
-
static int lp_pinmux_set_mux(struct pinctrl_dev *pctldev,
unsigned int function, unsigned int group)
{
}
static const struct pinmux_ops lptlp_pinmux_ops = {
- .get_functions_count = lp_get_functions_count,
- .get_function_name = lp_get_function_name,
- .get_function_groups = lp_get_function_groups,
+ .get_functions_count = intel_get_functions_count,
+ .get_function_name = intel_get_function_name,
+ .get_function_groups = intel_get_function_groups,
.set_mux = lp_pinmux_set_mux,
.gpio_request_enable = lp_gpio_request_enable,
.gpio_disable_free = lp_gpio_disable_free,
MODULE_DESCRIPTION("Intel Lynxpoint pinctrl driver");
MODULE_LICENSE("GPL v2");
MODULE_ALIAS("platform:lp_gpio");
+MODULE_IMPORT_NS(PINCTRL_INTEL);