|
@@ -9,8 +9,6 @@
|
|
|
|
|
|
#include "dice.h"
|
|
|
|
|
|
-#define NOTIFICATION_TIMEOUT_MS (2 * MSEC_PER_SEC)
|
|
|
-
|
|
|
static u64 get_subaddr(struct snd_dice *dice, enum snd_dice_addr_type type,
|
|
|
u64 offset)
|
|
|
{
|
|
@@ -62,54 +60,6 @@ static unsigned int get_clock_info(struct snd_dice *dice, __be32 *info)
|
|
|
info, 4);
|
|
|
}
|
|
|
|
|
|
-static int set_clock_info(struct snd_dice *dice,
|
|
|
- unsigned int rate, unsigned int source)
|
|
|
-{
|
|
|
- unsigned int i;
|
|
|
- __be32 info;
|
|
|
- u32 mask;
|
|
|
- u32 clock;
|
|
|
- int err;
|
|
|
-
|
|
|
- err = get_clock_info(dice, &info);
|
|
|
- if (err < 0)
|
|
|
- return err;
|
|
|
-
|
|
|
- clock = be32_to_cpu(info);
|
|
|
- if (source != UINT_MAX) {
|
|
|
- mask = CLOCK_SOURCE_MASK;
|
|
|
- clock &= ~mask;
|
|
|
- clock |= source;
|
|
|
- }
|
|
|
- if (rate != UINT_MAX) {
|
|
|
- for (i = 0; i < ARRAY_SIZE(snd_dice_rates); i++) {
|
|
|
- if (snd_dice_rates[i] == rate)
|
|
|
- break;
|
|
|
- }
|
|
|
- if (i == ARRAY_SIZE(snd_dice_rates))
|
|
|
- return -EINVAL;
|
|
|
-
|
|
|
- mask = CLOCK_RATE_MASK;
|
|
|
- clock &= ~mask;
|
|
|
- clock |= i << CLOCK_RATE_SHIFT;
|
|
|
- }
|
|
|
- info = cpu_to_be32(clock);
|
|
|
-
|
|
|
- if (completion_done(&dice->clock_accepted))
|
|
|
- reinit_completion(&dice->clock_accepted);
|
|
|
-
|
|
|
- err = snd_dice_transaction_write_global(dice, GLOBAL_CLOCK_SELECT,
|
|
|
- &info, 4);
|
|
|
- if (err < 0)
|
|
|
- return err;
|
|
|
-
|
|
|
- if (wait_for_completion_timeout(&dice->clock_accepted,
|
|
|
- msecs_to_jiffies(NOTIFICATION_TIMEOUT_MS)) == 0)
|
|
|
- return -ETIMEDOUT;
|
|
|
-
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
int snd_dice_transaction_get_clock_source(struct snd_dice *dice,
|
|
|
unsigned int *source)
|
|
|
{
|
|
@@ -143,10 +93,6 @@ int snd_dice_transaction_get_rate(struct snd_dice *dice, unsigned int *rate)
|
|
|
end:
|
|
|
return err;
|
|
|
}
|
|
|
-int snd_dice_transaction_set_rate(struct snd_dice *dice, unsigned int rate)
|
|
|
-{
|
|
|
- return set_clock_info(dice, rate, UINT_MAX);
|
|
|
-}
|
|
|
|
|
|
int snd_dice_transaction_set_enable(struct snd_dice *dice)
|
|
|
{
|