diff mbox

ASoC: fsl-ssi: Allow to use driver with generic audio card

Message ID 1398523756-9740-1-git-send-email-shc_work@mail.ru (mailing list archive)
State New, archived
Headers show

Commit Message

Alexander Shiyan April 26, 2014, 2:49 p.m. UTC
Generic sound card checks return value of functions for setup format,
clock and slot for -ENOTSUPP error. Add this compatibility to fsl-ssi
driver.
---
I'm really not sure that's a good solution, please correct me if I'm wrong.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 sound/soc/fsl/fsl_ssi.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Comments

Mark Brown April 26, 2014, 4:55 p.m. UTC | #1
On Sat, Apr 26, 2014 at 06:49:16PM +0400, Alexander Shiyan wrote:
> Generic sound card checks return value of functions for setup format,
> clock and slot for -ENOTSUPP error. Add this compatibility to fsl-ssi
> driver.
> ---
> I'm really not sure that's a good solution, please correct me if I'm wrong.

The intention behind -ENOTSUPP is to handle the case where a device has
no configuration facilities (eg, a fixed hardware CODEC) to save having
to have a dummy stub that just checks a parameter.

> @@ -764,7 +764,7 @@ static int fsl_ssi_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt)
>  			ssi_private->i2s_mode |= CCSR_SSI_SCR_I2S_MODE_SLAVE;
>  			break;
>  		default:
> -			return -EINVAL;
> +			return -ENOTSUPP;
>  		}
>  
>  		/* Data on rising edge of bclk, frame low, 1clk before data */

These are cases where we can do configuration but an invalid
configuration has been provided and we have spotted an error.  Ignoring
that should cause runtime problems - I guess it isn't for you though so
there may be something else going on?

Especially for cases like DAI format we should probably enhance the
framework so that these devices can set a variable in their struct
saying what they do support but for now we don't do that.
Mark Brown April 26, 2014, 5:22 p.m. UTC | #2
On Sat, Apr 26, 2014 at 09:02:06PM +0400, Alexander Shiyan wrote:
> Sat, 26 Apr 2014 17:55:19 +0100 ?? Mark Brown <broonie@kernel.org>:
> > On Sat, Apr 26, 2014 at 06:49:16PM +0400, Alexander Shiyan wrote:

> > These are cases where we can do configuration but an invalid
> > configuration has been provided and we have spotted an error.  Ignoring
> > that should cause runtime problems - I guess it isn't for you though so
> > there may be something else going on?

> > Especially for cases like DAI format we should probably enhance the
> > framework so that these devices can set a variable in their struct
> > saying what they do support but for now we don't do that.

> Other solution to this problem is to check ret != EPROBE_DEFER
> in the generic sound card. All other cases should be treated as
> good for setup parameters. Is this better?

I wouldn't expect to be getting -EPROBE_DEFER outside of the probe path?
Can we take a step back here, please - what's the problem you're seeing?
diff mbox

Patch

diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 25865d8f..6891b8c 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -764,7 +764,7 @@  static int fsl_ssi_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt)
 			ssi_private->i2s_mode |= CCSR_SSI_SCR_I2S_MODE_SLAVE;
 			break;
 		default:
-			return -EINVAL;
+			return -ENOTSUPP;
 		}
 
 		/* Data on rising edge of bclk, frame low, 1clk before data */
@@ -789,7 +789,7 @@  static int fsl_ssi_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt)
 		ssi_private->i2s_mode |= CCSR_SSI_SCR_I2S_MODE_NORMAL;
 		break;
 	default:
-		return -EINVAL;
+		return -ENOTSUPP;
 	}
 	scr |= ssi_private->i2s_mode;
 
@@ -812,7 +812,7 @@  static int fsl_ssi_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt)
 		strcr ^= CCSR_SSI_STCR_TFSI;
 		break;
 	default:
-		return -EINVAL;
+		return -ENOTSUPP;
 	}
 
 	/* DAI clock master masks */
@@ -825,7 +825,7 @@  static int fsl_ssi_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt)
 		scr &= ~CCSR_SSI_SCR_SYS_CLK_EN;
 		break;
 	default:
-		return -EINVAL;
+		return -ENOTSUPP;
 	}
 
 	stcr |= strcr;
@@ -897,7 +897,7 @@  static int fsl_ssi_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
 
 	/* Don't apply it to any non-baudclk circumstance */
 	if (IS_ERR(ssi_private->baudclk))
-		return -EINVAL;
+		return -ENOTSUPP;
 
 	/* It should be already enough to divide clock by setting pm alone */
 	psr = 0;
@@ -986,7 +986,7 @@  static int fsl_ssi_set_dai_tdm_slot(struct snd_soc_dai *cpu_dai, u32 tx_mask,
 	val = read_ssi(&ssi->scr) & (CCSR_SSI_SCR_I2S_MODE_MASK | CCSR_SSI_SCR_NET);
 	if (val && slots < 2) {
 		dev_err(cpu_dai->dev, "slot number should be >= 2 in I2S or NET\n");
-		return -EINVAL;
+		return -ENOTSUPP;
 	}
 
 	write_ssi_mask(&ssi->stccr, CCSR_SSI_SxCCR_DC_MASK,