static int ti_adpll_setup_clock(struct ti_adpll_data *d, struct clk *clock, int index, int output_index, const char *name, void (*unregister)(struct clk *clk)) { struct clk_lookup *cl; const char *postfix = NULL; char con_id[ADPLL_MAX_CON_ID]; d->clocks[index].clk = clock; d->clocks[index].unregister = unregister; /* Separate con_id in format "pll040dcoclkldo" to fit MAX_CON_ID */ postfix = strrchr(name, '.'); if (postfix && strlen(postfix) > 1) { if (strlen(postfix) > ADPLL_MAX_CON_ID) dev_warn(d->dev, "clock %s con_id lookup may fail\n", name); snprintf(con_id, 16, "pll%03lx%s", d->pa & 0xfff, postfix + 1); cl = clkdev_create(clock, con_id, NULL); if (!cl) return -ENOMEM; d->clocks[index].cl = cl; } else { dev_warn(d->dev, "no con_id for clock %s\n", name); } if (output_index < 0) return 0; d->outputs.clks[output_index] = clock; d->outputs.clk_num++; return 0; }
/* Create a clkdev entry for a given device/clk */ void __init orion_clkdev_add(const char *con_id, const char *dev_id, struct clk *clk) { clkdev_create(clk, con_id, "%s", dev_id); }