diff options
Diffstat (limited to 'sound/soc/omap/mcbsp.c')
-rw-r--r-- | sound/soc/omap/mcbsp.c | 54 |
1 files changed, 22 insertions, 32 deletions
diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c index a681a9a8b846..afb8d4f1bedf 100644 --- a/sound/soc/omap/mcbsp.c +++ b/sound/soc/omap/mcbsp.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/delay.h> | 24 | #include <linux/delay.h> |
25 | #include <linux/io.h> | 25 | #include <linux/io.h> |
26 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
27 | #include <linux/pm_runtime.h> | ||
27 | 28 | ||
28 | #include <linux/platform_data/asoc-ti-mcbsp.h> | 29 | #include <linux/platform_data/asoc-ti-mcbsp.h> |
29 | 30 | ||
@@ -728,50 +729,39 @@ void omap_mcbsp_stop(struct omap_mcbsp *mcbsp, int tx, int rx) | |||
728 | 729 | ||
729 | int omap2_mcbsp_set_clks_src(struct omap_mcbsp *mcbsp, u8 fck_src_id) | 730 | int omap2_mcbsp_set_clks_src(struct omap_mcbsp *mcbsp, u8 fck_src_id) |
730 | { | 731 | { |
732 | struct clk *fck_src; | ||
731 | const char *src; | 733 | const char *src; |
734 | int r; | ||
732 | 735 | ||
733 | if (fck_src_id == MCBSP_CLKS_PAD_SRC) | 736 | if (fck_src_id == MCBSP_CLKS_PAD_SRC) |
734 | src = "clks_ext"; | 737 | src = "pad_fck"; |
735 | else if (fck_src_id == MCBSP_CLKS_PRCM_SRC) | 738 | else if (fck_src_id == MCBSP_CLKS_PRCM_SRC) |
736 | src = "clks_fclk"; | 739 | src = "prcm_fck"; |
737 | else | 740 | else |
738 | return -EINVAL; | 741 | return -EINVAL; |
739 | 742 | ||
740 | if (mcbsp->pdata->set_clk_src) | 743 | fck_src = clk_get(mcbsp->dev, src); |
741 | return mcbsp->pdata->set_clk_src(mcbsp->dev, mcbsp->fclk, src); | 744 | if (IS_ERR(fck_src)) { |
742 | else | 745 | dev_err(mcbsp->dev, "CLKS: could not clk_get() %s\n", src); |
743 | return -EINVAL; | 746 | return -EINVAL; |
744 | } | 747 | } |
745 | |||
746 | int omap_mcbsp_6pin_src_mux(struct omap_mcbsp *mcbsp, u8 mux) | ||
747 | { | ||
748 | const char *signal, *src; | ||
749 | 748 | ||
750 | if (!mcbsp->pdata->mux_signal) | 749 | pm_runtime_put_sync(mcbsp->dev); |
751 | return -EINVAL; | ||
752 | 750 | ||
753 | switch (mux) { | 751 | r = clk_set_parent(mcbsp->fclk, fck_src); |
754 | case CLKR_SRC_CLKR: | 752 | if (r) { |
755 | signal = "clkr"; | 753 | dev_err(mcbsp->dev, "CLKS: could not clk_set_parent() to %s\n", |
756 | src = "clkr"; | 754 | src); |
757 | break; | 755 | clk_put(fck_src); |
758 | case CLKR_SRC_CLKX: | 756 | return r; |
759 | signal = "clkr"; | ||
760 | src = "clkx"; | ||
761 | break; | ||
762 | case FSR_SRC_FSR: | ||
763 | signal = "fsr"; | ||
764 | src = "fsr"; | ||
765 | break; | ||
766 | case FSR_SRC_FSX: | ||
767 | signal = "fsr"; | ||
768 | src = "fsx"; | ||
769 | break; | ||
770 | default: | ||
771 | return -EINVAL; | ||
772 | } | 757 | } |
773 | 758 | ||
774 | return mcbsp->pdata->mux_signal(mcbsp->dev, signal, src); | 759 | pm_runtime_get_sync(mcbsp->dev); |
760 | |||
761 | clk_put(fck_src); | ||
762 | |||
763 | return 0; | ||
764 | |||
775 | } | 765 | } |
776 | 766 | ||
777 | #define max_thres(m) (mcbsp->pdata->buffer_size) | 767 | #define max_thres(m) (mcbsp->pdata->buffer_size) |