~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/sound/firewire/digi00x/digi00x-transaction.c

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0-only
  2 /*
  3  * digi00x-transaction.c - a part of driver for Digidesign Digi 002/003 family
  4  *
  5  * Copyright (c) 2014-2015 Takashi Sakamoto
  6  */
  7 
  8 #include <sound/asound.h>
  9 #include "digi00x.h"
 10 
 11 static void handle_unknown_message(struct snd_dg00x *dg00x,
 12                                    unsigned long long offset, __be32 *buf)
 13 {
 14         unsigned long flags;
 15 
 16         spin_lock_irqsave(&dg00x->lock, flags);
 17         dg00x->msg = be32_to_cpu(*buf);
 18         spin_unlock_irqrestore(&dg00x->lock, flags);
 19 
 20         wake_up(&dg00x->hwdep_wait);
 21 }
 22 
 23 static void handle_message(struct fw_card *card, struct fw_request *request,
 24                            int tcode, int destination, int source,
 25                            int generation, unsigned long long offset,
 26                            void *data, size_t length, void *callback_data)
 27 {
 28         struct snd_dg00x *dg00x = callback_data;
 29         __be32 *buf = (__be32 *)data;
 30 
 31         fw_send_response(card, request, RCODE_COMPLETE);
 32 
 33         if (offset == dg00x->async_handler.offset)
 34                 handle_unknown_message(dg00x, offset, buf);
 35 }
 36 
 37 int snd_dg00x_transaction_reregister(struct snd_dg00x *dg00x)
 38 {
 39         struct fw_device *device = fw_parent_device(dg00x->unit);
 40         __be32 data[2];
 41 
 42         /* Unknown. 4bytes. */
 43         data[0] = cpu_to_be32((device->card->node_id << 16) |
 44                               (dg00x->async_handler.offset >> 32));
 45         data[1] = cpu_to_be32(dg00x->async_handler.offset);
 46         return snd_fw_transaction(dg00x->unit, TCODE_WRITE_BLOCK_REQUEST,
 47                                   DG00X_ADDR_BASE + DG00X_OFFSET_MESSAGE_ADDR,
 48                                   &data, sizeof(data), 0);
 49 }
 50 
 51 void snd_dg00x_transaction_unregister(struct snd_dg00x *dg00x)
 52 {
 53         if (dg00x->async_handler.callback_data == NULL)
 54                 return;
 55 
 56         fw_core_remove_address_handler(&dg00x->async_handler);
 57 
 58         dg00x->async_handler.callback_data = NULL;
 59 }
 60 
 61 int snd_dg00x_transaction_register(struct snd_dg00x *dg00x)
 62 {
 63         static const struct fw_address_region resp_register_region = {
 64                 .start  = 0xffffe0000000ull,
 65                 .end    = 0xffffe000ffffull,
 66         };
 67         int err;
 68 
 69         dg00x->async_handler.length = 4;
 70         dg00x->async_handler.address_callback = handle_message;
 71         dg00x->async_handler.callback_data = dg00x;
 72 
 73         err = fw_core_add_address_handler(&dg00x->async_handler,
 74                                           &resp_register_region);
 75         if (err < 0)
 76                 return err;
 77 
 78         err = snd_dg00x_transaction_reregister(dg00x);
 79         if (err < 0)
 80                 snd_dg00x_transaction_unregister(dg00x);
 81 
 82         return err;
 83 }
 84 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php