bclk_ratio is only a factor in clock producer mode, and needs to
override the default value of num_channels * sample_size.
Move the bclk_ratio handling into the hw_params method, only latching
the value in set_bclk_ratio, to address both of those matters.
See: https://github.com/raspberrypi/linux/issues/5817
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
if (dev->tdm_slots)
config->data_width = 32;
+ if ((dev->capability & DW_I2S_MASTER) && dev->bclk_ratio) {
+ switch (dev->bclk_ratio) {
+ case 32:
+ dev->ccr = 0x00;
+ break;
+
+ case 48:
+ dev->ccr = 0x08;
+ break;
+
+ case 64:
+ dev->ccr = 0x10;
+ break;
+
+ default:
+ return -EINVAL;
+ }
+ }
+
config->chan_nr = params_channels(params);
switch (config->chan_nr) {
dev_dbg(dev->dev, "%s(%d)\n", __func__, ratio);
- switch (ratio) {
- case 32:
- dev->ccr = 0x00;
- break;
-
- case 48:
- dev->ccr = 0x08;
- break;
-
- case 64:
- dev->ccr = 0x10;
- break;
- default:
- return -EINVAL;
- }
-
- i2s_write_reg(dev->i2s_base, CCR, dev->ccr);
+ dev->bclk_ratio = ratio;
return 0;
}
}
}
+ dev->bclk_ratio = 0;
dev->i2s_reg_comp1 = I2S_COMP_PARAM_1;
dev->i2s_reg_comp2 = I2S_COMP_PARAM_2;
if (pdata) {
unsigned int quirks;
unsigned int i2s_reg_comp1;
unsigned int i2s_reg_comp2;
+ unsigned int bclk_ratio;
struct device *dev;
u32 ccr;
u32 xfer_resolution;