|
@@ -149,3 +149,84 @@ int __init omap_mux_init_gpio(int gpio, int val)
|
|
|
int ret;
|
|
|
|
|
|
list_for_each_entry(partition, &mux_partitions, node) {
|
|
|
+ ret = _omap_mux_init_gpio(partition, gpio, val);
|
|
|
+ if (!ret)
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
+
|
|
|
+ return -ENODEV;
|
|
|
+}
|
|
|
+
|
|
|
+static int __init _omap_mux_get_by_name(struct omap_mux_partition *partition,
|
|
|
+ const char *muxname,
|
|
|
+ struct omap_mux **found_mux)
|
|
|
+{
|
|
|
+ struct omap_mux *mux = NULL;
|
|
|
+ struct omap_mux_entry *e;
|
|
|
+ const char *mode_name;
|
|
|
+ int found = 0, found_mode = 0, mode0_len = 0;
|
|
|
+ struct list_head *muxmodes = &partition->muxmodes;
|
|
|
+
|
|
|
+ mode_name = strchr(muxname, '.');
|
|
|
+ if (mode_name) {
|
|
|
+ mode0_len = strlen(muxname) - strlen(mode_name);
|
|
|
+ mode_name++;
|
|
|
+ } else {
|
|
|
+ mode_name = muxname;
|
|
|
+ }
|
|
|
+
|
|
|
+ list_for_each_entry(e, muxmodes, node) {
|
|
|
+ char *m0_entry;
|
|
|
+ int i;
|
|
|
+
|
|
|
+ mux = &e->mux;
|
|
|
+ m0_entry = mux->muxnames[0];
|
|
|
+
|
|
|
+ /* First check for full name in mode0.muxmode format */
|
|
|
+ if (mode0_len && strncmp(muxname, m0_entry, mode0_len))
|
|
|
+ continue;
|
|
|
+
|
|
|
+ /* Then check for muxmode only */
|
|
|
+ for (i = 0; i < OMAP_MUX_NR_MODES; i++) {
|
|
|
+ char *mode_cur = mux->muxnames[i];
|
|
|
+
|
|
|
+ if (!mode_cur)
|
|
|
+ continue;
|
|
|
+
|
|
|
+ if (!strcmp(mode_name, mode_cur)) {
|
|
|
+ *found_mux = mux;
|
|
|
+ found++;
|
|
|
+ found_mode = i;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (found == 1) {
|
|
|
+ return found_mode;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (found > 1) {
|
|
|
+ pr_err("%s: Multiple signal paths (%i) for %s\n", __func__,
|
|
|
+ found, muxname);
|
|
|
+ return -EINVAL;
|
|
|
+ }
|
|
|
+
|
|
|
+ pr_err("%s: Could not find signal %s\n", __func__, muxname);
|
|
|
+
|
|
|
+ return -ENODEV;
|
|
|
+}
|
|
|
+
|
|
|
+int __init omap_mux_get_by_name(const char *muxname,
|
|
|
+ struct omap_mux_partition **found_partition,
|
|
|
+ struct omap_mux **found_mux)
|
|
|
+{
|
|
|
+ struct omap_mux_partition *partition;
|
|
|
+
|
|
|
+ list_for_each_entry(partition, &mux_partitions, node) {
|
|
|
+ struct omap_mux *mux = NULL;
|
|
|
+ int mux_mode = _omap_mux_get_by_name(partition, muxname, &mux);
|
|
|
+ if (mux_mode < 0)
|
|
|
+ continue;
|
|
|
+
|
|
|
+ *found_partition = partition;
|
|
|
+ *found_mux = mux;
|