static void s6000_i2s_start_channel(struct s6000_i2s_dev *dev, int channel) { int i, j, cur, prev; /* * Wait for WCLK to toggle 5 times before enabling the channel * s6000 Family Datasheet 3.6.4: * "At least two cycles of WS must occur between commands * to disable or enable the interface" */ j = 0; prev = ~S6_I2S_CUR_WS; for (i = 1000000; --i && j < 6; ) { cur = s6_i2s_read_reg(dev, S6_I2S_INTERFACE_CFG(channel)) & S6_I2S_CUR_WS; if (prev != cur) { prev = cur; j++; } } if (j < 6) printk(KERN_WARNING "s6000-i2s: timeout waiting for WCLK\n"); s6_i2s_write_reg(dev, S6_I2S_ENABLE(channel), S6_I2S_ENABLE_IF); }
static void s6000_i2s_start_channel(struct s6000_i2s_dev *dev, int channel) { int i, j, cur, prev; /* */ j = 0; prev = ~S6_I2S_CUR_WS; for (i = 1000000; --i && j < 6; ) { cur = s6_i2s_read_reg(dev, S6_I2S_INTERFACE_CFG(channel)) & S6_I2S_CUR_WS; if (prev != cur) { prev = cur; j++; } } if (j < 6) printk(KERN_WARNING "s6000-i2s: timeout waiting for WCLK\n"); s6_i2s_write_reg(dev, S6_I2S_ENABLE(channel), S6_I2S_ENABLE_IF); }
static void s6000_i2s_wait_disabled(struct s6000_i2s_dev *dev) { int channel; int n = 50; for (channel = 0; channel < 2; channel++) { while (--n >= 0) { int v = s6_i2s_read_reg(dev, S6_I2S_ENABLE(channel)); if ((v & S6_I2S_IS_ENABLED) || !(v & (S6_I2S_DMA_ACTIVE | S6_I2S_IS_BUSY))) break; udelay(20); } } if (n < 0) printk(KERN_WARNING "s6000-i2s: timeout disabling interfaces"); }
static void s6000_i2s_stop_channel(struct s6000_i2s_dev *dev, int channel) { s6_i2s_write_reg(dev, S6_I2S_ENABLE(channel), S6_I2S_DISABLE_IF); }