/* sa1111_set_audio_rate - set the audio sample rate @sadev: SA1111 SAC function block @rate: sample rate to select  */
int sa1111_set_audio_rate(struct sa1111_dev *sadev, int rate)
/* sa1111_set_audio_rate - set the audio sample rate @sadev: SA1111 SAC function block @rate: sample rate to select  */
int sa1111_set_audio_rate(struct sa1111_dev *sadev, int rate)
{
	struct sa1111 *sachip = sa1111_chip_driver(sadev);
	unsigned int div;
	if (sadev->devid != SA1111_DEVID_SAC)
		return -EINVAL;
	div = (__sa1111_pll_clock(sachip) / 256 + rate / 2) / rate;
	if (div == 0)
		div = 1;
	if (div > 128)
		div = 128;
	sa1111_writel(div - 1, sachip->base + SA1111_SKAUD);
	return 0;
}