aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/sh
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/sh')
-rw-r--r--sound/soc/sh/fsi.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c
index 605ea7f17cf3..3c53693d7266 100644
--- a/sound/soc/sh/fsi.c
+++ b/sound/soc/sh/fsi.c
@@ -113,6 +113,8 @@
113 113
114#define FSI_FMTS (SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S16_LE) 114#define FSI_FMTS (SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S16_LE)
115 115
116typedef int (*set_rate_func)(struct device *dev, int is_porta, int rate, int enable);
117
116/* 118/*
117 * FSI driver use below type name for variable 119 * FSI driver use below type name for variable
118 * 120 *
@@ -269,11 +271,22 @@ static struct fsi_priv *fsi_get_priv(struct snd_pcm_substream *substream)
269 return fsi_get_priv_frm_dai(fsi_get_dai(substream)); 271 return fsi_get_priv_frm_dai(fsi_get_dai(substream));
270} 272}
271 273
274static set_rate_func fsi_get_info_set_rate(struct fsi_master *master)
275{
276 if (!master->info)
277 return NULL;
278
279 return master->info->set_rate;
280}
281
272static u32 fsi_get_info_flags(struct fsi_priv *fsi) 282static u32 fsi_get_info_flags(struct fsi_priv *fsi)
273{ 283{
274 int is_porta = fsi_is_port_a(fsi); 284 int is_porta = fsi_is_port_a(fsi);
275 struct fsi_master *master = fsi_get_master(fsi); 285 struct fsi_master *master = fsi_get_master(fsi);
276 286
287 if (!master->info)
288 return 0;
289
277 return is_porta ? master->info->porta_flags : 290 return is_porta ? master->info->porta_flags :
278 master->info->portb_flags; 291 master->info->portb_flags;
279} 292}
@@ -830,12 +843,12 @@ static void fsi_dai_shutdown(struct snd_pcm_substream *substream,
830 struct fsi_priv *fsi = fsi_get_priv(substream); 843 struct fsi_priv *fsi = fsi_get_priv(substream);
831 int is_play = fsi_is_play(substream); 844 int is_play = fsi_is_play(substream);
832 struct fsi_master *master = fsi_get_master(fsi); 845 struct fsi_master *master = fsi_get_master(fsi);
833 int (*set_rate)(struct device *dev, int is_porta, int rate, int enable); 846 set_rate_func set_rate;
834 847
835 fsi_irq_disable(fsi, is_play); 848 fsi_irq_disable(fsi, is_play);
836 fsi_clk_ctrl(fsi, 0); 849 fsi_clk_ctrl(fsi, 0);
837 850
838 set_rate = master->info->set_rate; 851 set_rate = fsi_get_info_set_rate(master);
839 if (set_rate && fsi->rate) 852 if (set_rate && fsi->rate)
840 set_rate(dai->dev, fsi_is_port_a(fsi), fsi->rate, 0); 853 set_rate(dai->dev, fsi_is_port_a(fsi), fsi->rate, 0);
841 fsi->rate = 0; 854 fsi->rate = 0;
@@ -902,12 +915,12 @@ static int fsi_dai_hw_params(struct snd_pcm_substream *substream,
902{ 915{
903 struct fsi_priv *fsi = fsi_get_priv(substream); 916 struct fsi_priv *fsi = fsi_get_priv(substream);
904 struct fsi_master *master = fsi_get_master(fsi); 917 struct fsi_master *master = fsi_get_master(fsi);
905 int (*set_rate)(struct device *dev, int is_porta, int rate, int enable); 918 set_rate_func set_rate;
906 int fsi_ver = master->core->ver; 919 int fsi_ver = master->core->ver;
907 long rate = params_rate(params); 920 long rate = params_rate(params);
908 int ret; 921 int ret;
909 922
910 set_rate = master->info->set_rate; 923 set_rate = fsi_get_info_set_rate(master);
911 if (!set_rate) 924 if (!set_rate)
912 return 0; 925 return 0;
913 926