• Peter Rosin's avatar
    ASoC: atmel_ssc_dai: Match the CMR divider only in full duplex. · eb58960e
    Peter Rosin authored
    The CMR divider register is shared by playback and capture. The SSC driver
    therefore tries to enforce rules so that the needed register content do
    not conflict during simultaneous playback/capture. However, the
    implementation also prevents changing the register content in
    half-duplex scenarios, which is needed when using the OSS API.
    
    Thus, only lock the divider if there is a stream in the other direction.
    
    Fixes the below program to not fail with the atmel ssc dai in master mode.
    
    int
    main(void)
    {
    	int fd;
    	int format;
    	int channels;
    	int speed;
    
    	if ((fd = open("/dev/dsp", O_WRONLY, 0)) == -1) {
    		perror("open");
    		return 1;
    	}
    	format = AFMT_S16_LE;
    	if (ioctl(fd, SNDCTL_DSP_SETFMT, &format) == -1) {
    		perror("SNDCTL_DSP_SETFMT");
    		return 1;
    	}
    	channels = 2;
    	if (ioctl(fd, SNDCTL_DSP_CHANNELS, &channels) == -1) {
    		perror("SNDCTL_DSP_CHANNELS");
    		return 1;
    	}
    	speed = 22025;
    	if (ioctl(fd, SNDCTL_DSP_SPEED, &speed) == -1) {
    		perror("SNDCTL_DSP_SPEED");
    		return 1;
    	}
    	return 0;
    }
    Signed-off-by: default avatarPeter Rosin <peda@axentia.se>
    Acked-by: default avatarBo Shen <voice.shen@atmel.com>
    Signed-off-by: default avatarMark Brown <broonie@kernel.org>
    eb58960e
atmel_ssc_dai.c 22.4 KB