All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] ALSA: dice: improve Dice notification handling
@ 2016-02-11 11:18 Takashi Sakamoto
  2016-02-11 11:18 ` [PATCH 1/2] ALSA: dice: change notification mask to detect lock status change Takashi Sakamoto
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Takashi Sakamoto @ 2016-02-11 11:18 UTC (permalink / raw)
  To: clemens, tiwai; +Cc: alsa-devel, ffado-devel

Hi,

This patchset improves Dice notification handling mainly for old firmwares.

Dice-based models with earlier firmwares brings 'fail to ensure phase lock'
message to ALSA dice driver. This is due to no Dice transaction at
confirming clock status. Although this patchet enables ALSA dice driver to
handle Dice-based models with old firmwares, I reccomend users to work with
updated firmwares because they may include some bug fixes and improve
device's behaviours.

Regards

Takashi Sakamoto (2):
  ALSA: dice: change notification mask to detect lock status change
  ALSA: dice: old firmware optimization for Dice notification

 sound/firewire/dice/dice-stream.c      | 17 ++++++++++++++---
 sound/firewire/dice/dice-transaction.c |  2 +-
 2 files changed, 15 insertions(+), 4 deletions(-)

-- 
2.5.0

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] ALSA: dice: change notification mask to detect lock status change
  2016-02-11 11:18 [PATCH 0/2] ALSA: dice: improve Dice notification handling Takashi Sakamoto
@ 2016-02-11 11:18 ` Takashi Sakamoto
  2016-02-11 11:18 ` [PATCH 2/2] ALSA: dice: old firmware optimization for Dice notification Takashi Sakamoto
  2016-02-12  8:53 ` [PATCH 0/2] ALSA: dice: improve Dice notification handling Takashi Iwai
  2 siblings, 0 replies; 4+ messages in thread
From: Takashi Sakamoto @ 2016-02-11 11:18 UTC (permalink / raw)
  To: clemens, tiwai; +Cc: alsa-devel, ffado-devel

With former patchset, ALSA dice driver doesn't change clock parameters
anymore, while the driver still touch clock configuration for phase lock.

Although the locking status is in Dice notification, the driver doesn't
detect it. Usually, this causes no issues because in most case
NOTIFY_LOCK_CHG notification transfers after NOTIFY_CLOCK_ACCEPTED
notification, while it's better to detect locking status.

This commit changes notification mask just to detect lock status change.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
---
 sound/firewire/dice/dice-transaction.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/firewire/dice/dice-transaction.c b/sound/firewire/dice/dice-transaction.c
index 76f9f72..0f03503 100644
--- a/sound/firewire/dice/dice-transaction.c
+++ b/sound/firewire/dice/dice-transaction.c
@@ -156,7 +156,7 @@ static void dice_notification(struct fw_card *card, struct fw_request *request,
 
 	fw_send_response(card, request, RCODE_COMPLETE);
 
-	if (bits & NOTIFY_CLOCK_ACCEPTED)
+	if (bits & NOTIFY_LOCK_CHG)
 		complete(&dice->clock_accepted);
 	wake_up(&dice->hwdep_wait);
 }
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] ALSA: dice: old firmware optimization for Dice notification
  2016-02-11 11:18 [PATCH 0/2] ALSA: dice: improve Dice notification handling Takashi Sakamoto
  2016-02-11 11:18 ` [PATCH 1/2] ALSA: dice: change notification mask to detect lock status change Takashi Sakamoto
@ 2016-02-11 11:18 ` Takashi Sakamoto
  2016-02-12  8:53 ` [PATCH 0/2] ALSA: dice: improve Dice notification handling Takashi Iwai
  2 siblings, 0 replies; 4+ messages in thread
From: Takashi Sakamoto @ 2016-02-11 11:18 UTC (permalink / raw)
  To: clemens, tiwai; +Cc: alsa-devel, ffado-devel

As long as I tested, Dice-based models produced by TC Electronic with
factory-configured settings transfer no notification within
ensure_phase_lock(). On the other hand, with upgraded firmwares, it
starts to transfer the notification. This seems to be a quirk of earlier
firmwares.

This commit ensures phase lock by reading a register after waiting for
the notification. Even if it's timed-out, ensure_phase_lock() return
success as long as the register has expected clock status.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
---
 sound/firewire/dice/dice-stream.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/sound/firewire/dice/dice-stream.c b/sound/firewire/dice/dice-stream.c
index e4938b0..a64b3cc 100644
--- a/sound/firewire/dice/dice-stream.c
+++ b/sound/firewire/dice/dice-stream.c
@@ -31,7 +31,7 @@ const unsigned int snd_dice_rates[SND_DICE_RATES_COUNT] = {
  */
 static int ensure_phase_lock(struct snd_dice *dice)
 {
-	__be32 reg;
+	__be32 reg, nominal;
 	int err;
 
 	err = snd_dice_transaction_read_global(dice, GLOBAL_CLOCK_SELECT,
@@ -48,8 +48,19 @@ static int ensure_phase_lock(struct snd_dice *dice)
 		return err;
 
 	if (wait_for_completion_timeout(&dice->clock_accepted,
-			msecs_to_jiffies(NOTIFICATION_TIMEOUT_MS)) == 0)
-		return -ETIMEDOUT;
+			msecs_to_jiffies(NOTIFICATION_TIMEOUT_MS)) == 0) {
+		/*
+		 * Old versions of Dice firmware transfer no notification when
+		 * the same clock status as current one is set. In this case,
+		 * just check current clock status.
+		 */
+		err = snd_dice_transaction_read_global(dice, GLOBAL_STATUS,
+						&nominal, sizeof(nominal));
+		if (err < 0)
+			return err;
+		if (!(be32_to_cpu(nominal) & STATUS_SOURCE_LOCKED))
+			return -ETIMEDOUT;
+	}
 
 	return 0;
 }
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] ALSA: dice: improve Dice notification handling
  2016-02-11 11:18 [PATCH 0/2] ALSA: dice: improve Dice notification handling Takashi Sakamoto
  2016-02-11 11:18 ` [PATCH 1/2] ALSA: dice: change notification mask to detect lock status change Takashi Sakamoto
  2016-02-11 11:18 ` [PATCH 2/2] ALSA: dice: old firmware optimization for Dice notification Takashi Sakamoto
@ 2016-02-12  8:53 ` Takashi Iwai
  2 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2016-02-12  8:53 UTC (permalink / raw)
  To: Takashi Sakamoto; +Cc: alsa-devel, clemens, ffado-devel

On Thu, 11 Feb 2016 12:18:36 +0100,
Takashi Sakamoto wrote:
> 
> Hi,
> 
> This patchset improves Dice notification handling mainly for old firmwares.
> 
> Dice-based models with earlier firmwares brings 'fail to ensure phase lock'
> message to ALSA dice driver. This is due to no Dice transaction at
> confirming clock status. Although this patchet enables ALSA dice driver to
> handle Dice-based models with old firmwares, I reccomend users to work with
> updated firmwares because they may include some bug fixes and improve
> device's behaviours.

Applied both patches.  Thanks.


Takashi

> 
> Regards
> 
> Takashi Sakamoto (2):
>   ALSA: dice: change notification mask to detect lock status change
>   ALSA: dice: old firmware optimization for Dice notification
> 
>  sound/firewire/dice/dice-stream.c      | 17 ++++++++++++++---
>  sound/firewire/dice/dice-transaction.c |  2 +-
>  2 files changed, 15 insertions(+), 4 deletions(-)
> 
> -- 
> 2.5.0
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-02-12  8:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-11 11:18 [PATCH 0/2] ALSA: dice: improve Dice notification handling Takashi Sakamoto
2016-02-11 11:18 ` [PATCH 1/2] ALSA: dice: change notification mask to detect lock status change Takashi Sakamoto
2016-02-11 11:18 ` [PATCH 2/2] ALSA: dice: old firmware optimization for Dice notification Takashi Sakamoto
2016-02-12  8:53 ` [PATCH 0/2] ALSA: dice: improve Dice notification handling Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.