~ubuntu-branches/ubuntu/saucy/linux-ti-omap4/saucy-proposed

« back to all changes in this revision

Viewing changes to arch/arm/mach-tegra/board-pinmux.c

  • Committer: Package Import Robot
  • Author(s): Paolo Pisati, Paolo Pisati, Stefan Bader, Upstream Kernel Changes
  • Date: 2012-08-15 17:17:43 UTC
  • Revision ID: package-import@ubuntu.com-20120815171743-h5wnuf51xe7pvdid
Tags: 3.5.0-207.13
[ Paolo Pisati ]

* Start new release

[ Stefan Bader ]

* (config) Enable getabis to use local package copies

[ Upstream Kernel Changes ]

* fixup: gargabe collect iva_seq[0|1] init
* [Config] enable all SND_OMAP_SOC_*s
* fixup: cm2xxx_3xxx.o is needed for omap2_cm_read|write_reg
* fixup: add some snd_soc_dai* helper functions
* fixup: s/snd_soc_dpcm_params/snd_soc_dpcm/g
* fixup: typo, no_host_mode and useless SDP4430 init
* fixup: enable again aess hwmod

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright (c) 2011, NVIDIA CORPORATION.  All rights reserved.
 
2
 * Copyright (c) 2011,2012, NVIDIA CORPORATION.  All rights reserved.
3
3
 *
4
4
 * This software is licensed under the terms of the GNU General Public
5
5
 * License version 2, as published by the Free Software Foundation, and
15
15
#include <linux/device.h>
16
16
#include <linux/kernel.h>
17
17
#include <linux/notifier.h>
18
 
#include <linux/of.h>
19
18
#include <linux/string.h>
20
19
 
21
 
#include <mach/gpio-tegra.h>
22
 
#include <mach/pinmux.h>
23
 
 
24
20
#include "board-pinmux.h"
25
21
#include "devices.h"
26
22
 
27
 
struct tegra_board_pinmux_conf *confs[2];
28
 
 
29
 
static void tegra_board_pinmux_setup_gpios(void)
30
 
{
31
 
        int i;
32
 
 
33
 
        for (i = 0; i < ARRAY_SIZE(confs); i++) {
34
 
                if (!confs[i])
35
 
                        continue;
36
 
 
37
 
                tegra_gpio_config(confs[i]->gpios, confs[i]->gpio_count);
38
 
        }
39
 
}
40
 
 
41
 
static void tegra_board_pinmux_setup_pinmux(void)
42
 
{
43
 
        int i;
44
 
 
45
 
        for (i = 0; i < ARRAY_SIZE(confs); i++) {
46
 
                if (!confs[i])
47
 
                        continue;
48
 
 
49
 
                tegra_pinmux_config_table(confs[i]->pgs, confs[i]->pg_count);
50
 
 
51
 
                if (confs[i]->drives)
52
 
                        tegra_drive_pinmux_config_table(confs[i]->drives,
53
 
                                                        confs[i]->drive_count);
54
 
        }
55
 
}
56
 
 
57
 
static int tegra_board_pinmux_bus_notify(struct notifier_block *nb,
58
 
                                         unsigned long event, void *vdev)
59
 
{
60
 
        static bool had_gpio;
61
 
        static bool had_pinmux;
62
 
 
63
 
        struct device *dev = vdev;
64
 
        const char *devname;
65
 
 
66
 
        if (event != BUS_NOTIFY_BOUND_DRIVER)
67
 
                return NOTIFY_DONE;
68
 
 
69
 
        devname = dev_name(dev);
70
 
 
71
 
        if (!had_gpio && !strcmp(devname, GPIO_DEV)) {
72
 
                tegra_board_pinmux_setup_gpios();
73
 
                had_gpio = true;
74
 
        } else if (!had_pinmux && !strcmp(devname, PINMUX_DEV)) {
75
 
                tegra_board_pinmux_setup_pinmux();
76
 
                had_pinmux = true;
77
 
        }
78
 
 
79
 
        if (had_gpio && had_pinmux)
80
 
                return NOTIFY_STOP_MASK;
81
 
        else
82
 
                return NOTIFY_DONE;
83
 
}
84
 
 
85
 
static struct notifier_block nb = {
86
 
        .notifier_call = tegra_board_pinmux_bus_notify,
 
23
unsigned long tegra_pincfg_pullnone_driven[2] = {
 
24
        TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_PULL, TEGRA_PINCONFIG_PULL_NONE),
 
25
        TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_TRISTATE, TEGRA_PINCONFIG_DRIVEN),
 
26
};
 
27
 
 
28
unsigned long tegra_pincfg_pullnone_tristate[2] = {
 
29
        TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_PULL, TEGRA_PINCONFIG_PULL_NONE),
 
30
        TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_TRISTATE, TEGRA_PINCONFIG_TRISTATE),
 
31
};
 
32
 
 
33
unsigned long tegra_pincfg_pullnone_na[1] = {
 
34
        TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_PULL, TEGRA_PINCONFIG_PULL_NONE),
 
35
};
 
36
 
 
37
unsigned long tegra_pincfg_pullup_driven[2] = {
 
38
        TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_PULL, TEGRA_PINCONFIG_PULL_UP),
 
39
        TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_TRISTATE, TEGRA_PINCONFIG_DRIVEN),
 
40
};
 
41
 
 
42
unsigned long tegra_pincfg_pullup_tristate[2] = {
 
43
        TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_PULL, TEGRA_PINCONFIG_PULL_UP),
 
44
        TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_TRISTATE, TEGRA_PINCONFIG_TRISTATE),
 
45
};
 
46
 
 
47
unsigned long tegra_pincfg_pullup_na[1] = {
 
48
        TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_PULL, TEGRA_PINCONFIG_PULL_UP),
 
49
};
 
50
 
 
51
unsigned long tegra_pincfg_pulldown_driven[2] = {
 
52
        TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_PULL, TEGRA_PINCONFIG_PULL_DOWN),
 
53
        TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_TRISTATE, TEGRA_PINCONFIG_DRIVEN),
 
54
};
 
55
 
 
56
unsigned long tegra_pincfg_pulldown_tristate[2] = {
 
57
        TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_PULL, TEGRA_PINCONFIG_PULL_DOWN),
 
58
        TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_TRISTATE, TEGRA_PINCONFIG_TRISTATE),
 
59
};
 
60
 
 
61
unsigned long tegra_pincfg_pulldown_na[1] = {
 
62
        TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_PULL, TEGRA_PINCONFIG_PULL_DOWN),
 
63
};
 
64
 
 
65
unsigned long tegra_pincfg_pullna_driven[1] = {
 
66
        TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_TRISTATE, TEGRA_PINCONFIG_DRIVEN),
 
67
};
 
68
 
 
69
unsigned long tegra_pincfg_pullna_tristate[1] = {
 
70
        TEGRA_PINCONF_PACK(TEGRA_PINCONF_PARAM_TRISTATE, TEGRA_PINCONFIG_TRISTATE),
87
71
};
88
72
 
89
73
static struct platform_device *devices[] = {
94
78
void tegra_board_pinmux_init(struct tegra_board_pinmux_conf *conf_a,
95
79
                             struct tegra_board_pinmux_conf *conf_b)
96
80
{
97
 
        confs[0] = conf_a;
98
 
        confs[1] = conf_b;
99
 
 
100
 
        bus_register_notifier(&platform_bus_type, &nb);
101
 
 
102
 
        if (!of_machine_is_compatible("nvidia,tegra20"))
103
 
                platform_add_devices(devices, ARRAY_SIZE(devices));
 
81
        if (conf_a)
 
82
                pinctrl_register_mappings(conf_a->maps, conf_a->map_count);
 
83
        if (conf_b)
 
84
                pinctrl_register_mappings(conf_b->maps, conf_b->map_count);
 
85
 
 
86
        platform_add_devices(devices, ARRAY_SIZE(devices));
104
87
}