diff options
| -rw-r--r-- | sound/soc/sunxi/sun4i-i2s.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/sound/soc/sunxi/sun4i-i2s.c b/sound/soc/sunxi/sun4i-i2s.c index 761b7c0f6a32..d9910f6617ad 100644 --- a/sound/soc/sunxi/sun4i-i2s.c +++ b/sound/soc/sunxi/sun4i-i2s.c | |||
| @@ -106,6 +106,7 @@ | |||
| 106 | * @field_fmt_sr: regmap field to set sample resolution. | 106 | * @field_fmt_sr: regmap field to set sample resolution. |
| 107 | * @field_fmt_bclk: regmap field to set clk polarity. | 107 | * @field_fmt_bclk: regmap field to set clk polarity. |
| 108 | * @field_fmt_lrclk: regmap field to set frame polarity. | 108 | * @field_fmt_lrclk: regmap field to set frame polarity. |
| 109 | * @field_fmt_mode: regmap field to set the operational mode. | ||
| 109 | * @field_txchanmap: location of the tx channel mapping register. | 110 | * @field_txchanmap: location of the tx channel mapping register. |
| 110 | * @field_rxchanmap: location of the rx channel mapping register. | 111 | * @field_rxchanmap: location of the rx channel mapping register. |
| 111 | * @field_txchansel: location of the tx channel select bit fields. | 112 | * @field_txchansel: location of the tx channel select bit fields. |
| @@ -125,6 +126,7 @@ struct sun4i_i2s_quirks { | |||
| 125 | struct reg_field field_fmt_sr; | 126 | struct reg_field field_fmt_sr; |
| 126 | struct reg_field field_fmt_bclk; | 127 | struct reg_field field_fmt_bclk; |
| 127 | struct reg_field field_fmt_lrclk; | 128 | struct reg_field field_fmt_lrclk; |
| 129 | struct reg_field field_fmt_mode; | ||
| 128 | struct reg_field field_txchanmap; | 130 | struct reg_field field_txchanmap; |
| 129 | struct reg_field field_rxchanmap; | 131 | struct reg_field field_rxchanmap; |
| 130 | struct reg_field field_txchansel; | 132 | struct reg_field field_txchansel; |
| @@ -148,6 +150,7 @@ struct sun4i_i2s { | |||
| 148 | struct regmap_field *field_fmt_sr; | 150 | struct regmap_field *field_fmt_sr; |
| 149 | struct regmap_field *field_fmt_bclk; | 151 | struct regmap_field *field_fmt_bclk; |
| 150 | struct regmap_field *field_fmt_lrclk; | 152 | struct regmap_field *field_fmt_lrclk; |
| 153 | struct regmap_field *field_fmt_mode; | ||
| 151 | struct regmap_field *field_txchanmap; | 154 | struct regmap_field *field_txchanmap; |
| 152 | struct regmap_field *field_rxchanmap; | 155 | struct regmap_field *field_rxchanmap; |
| 153 | struct regmap_field *field_txchansel; | 156 | struct regmap_field *field_txchansel; |
| @@ -365,9 +368,7 @@ static int sun4i_i2s_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) | |||
| 365 | return -EINVAL; | 368 | return -EINVAL; |
| 366 | } | 369 | } |
| 367 | 370 | ||
| 368 | regmap_update_bits(i2s->regmap, SUN4I_I2S_FMT0_REG, | 371 | regmap_field_write(i2s->field_fmt_mode, val); |
| 369 | SUN4I_I2S_FMT0_FMT_MASK, | ||
| 370 | val); | ||
| 371 | 372 | ||
| 372 | /* DAI clock polarity */ | 373 | /* DAI clock polarity */ |
| 373 | switch (fmt & SND_SOC_DAIFMT_INV_MASK) { | 374 | switch (fmt & SND_SOC_DAIFMT_INV_MASK) { |
| @@ -722,6 +723,7 @@ static const struct sun4i_i2s_quirks sun4i_a10_i2s_quirks = { | |||
| 722 | .field_fmt_sr = REG_FIELD(SUN4I_I2S_FMT0_REG, 4, 5), | 723 | .field_fmt_sr = REG_FIELD(SUN4I_I2S_FMT0_REG, 4, 5), |
| 723 | .field_fmt_bclk = REG_FIELD(SUN4I_I2S_FMT0_REG, 6, 6), | 724 | .field_fmt_bclk = REG_FIELD(SUN4I_I2S_FMT0_REG, 6, 6), |
| 724 | .field_fmt_lrclk = REG_FIELD(SUN4I_I2S_FMT0_REG, 7, 7), | 725 | .field_fmt_lrclk = REG_FIELD(SUN4I_I2S_FMT0_REG, 7, 7), |
| 726 | .field_fmt_mode = REG_FIELD(SUN4I_I2S_FMT0_REG, 0, 1), | ||
| 725 | .field_txchanmap = REG_FIELD(SUN4I_I2S_TX_CHAN_MAP_REG, 0, 31), | 727 | .field_txchanmap = REG_FIELD(SUN4I_I2S_TX_CHAN_MAP_REG, 0, 31), |
| 726 | .field_rxchanmap = REG_FIELD(SUN4I_I2S_RX_CHAN_MAP_REG, 0, 31), | 728 | .field_rxchanmap = REG_FIELD(SUN4I_I2S_RX_CHAN_MAP_REG, 0, 31), |
| 727 | .field_txchansel = REG_FIELD(SUN4I_I2S_TX_CHAN_SEL_REG, 0, 2), | 729 | .field_txchansel = REG_FIELD(SUN4I_I2S_TX_CHAN_SEL_REG, 0, 2), |
| @@ -737,6 +739,7 @@ static const struct sun4i_i2s_quirks sun6i_a31_i2s_quirks = { | |||
| 737 | .field_fmt_sr = REG_FIELD(SUN4I_I2S_FMT0_REG, 4, 5), | 739 | .field_fmt_sr = REG_FIELD(SUN4I_I2S_FMT0_REG, 4, 5), |
| 738 | .field_fmt_bclk = REG_FIELD(SUN4I_I2S_FMT0_REG, 6, 6), | 740 | .field_fmt_bclk = REG_FIELD(SUN4I_I2S_FMT0_REG, 6, 6), |
| 739 | .field_fmt_lrclk = REG_FIELD(SUN4I_I2S_FMT0_REG, 7, 7), | 741 | .field_fmt_lrclk = REG_FIELD(SUN4I_I2S_FMT0_REG, 7, 7), |
| 742 | .field_fmt_mode = REG_FIELD(SUN4I_I2S_FMT0_REG, 0, 1), | ||
| 740 | .field_txchanmap = REG_FIELD(SUN4I_I2S_TX_CHAN_MAP_REG, 0, 31), | 743 | .field_txchanmap = REG_FIELD(SUN4I_I2S_TX_CHAN_MAP_REG, 0, 31), |
| 741 | .field_rxchanmap = REG_FIELD(SUN4I_I2S_RX_CHAN_MAP_REG, 0, 31), | 744 | .field_rxchanmap = REG_FIELD(SUN4I_I2S_RX_CHAN_MAP_REG, 0, 31), |
| 742 | .field_txchansel = REG_FIELD(SUN4I_I2S_TX_CHAN_SEL_REG, 0, 2), | 745 | .field_txchansel = REG_FIELD(SUN4I_I2S_TX_CHAN_SEL_REG, 0, 2), |
| @@ -776,6 +779,12 @@ static int sun4i_i2s_init_regmap_fields(struct device *dev, | |||
| 776 | if (IS_ERR(i2s->field_fmt_lrclk)) | 779 | if (IS_ERR(i2s->field_fmt_lrclk)) |
| 777 | return PTR_ERR(i2s->field_fmt_lrclk); | 780 | return PTR_ERR(i2s->field_fmt_lrclk); |
| 778 | 781 | ||
| 782 | i2s->field_fmt_mode = | ||
| 783 | devm_regmap_field_alloc(dev, i2s->regmap, | ||
| 784 | i2s->variant->field_fmt_mode); | ||
| 785 | if (IS_ERR(i2s->field_fmt_mode)) | ||
| 786 | return PTR_ERR(i2s->field_fmt_mode); | ||
| 787 | |||
| 779 | i2s->field_txchanmap = | 788 | i2s->field_txchanmap = |
| 780 | devm_regmap_field_alloc(dev, i2s->regmap, | 789 | devm_regmap_field_alloc(dev, i2s->regmap, |
| 781 | i2s->variant->field_txchanmap); | 790 | i2s->variant->field_txchanmap); |
