fa24932b1b69f2b331a341a81c16fbb244e12260
[oweals/openwrt.git] /
1 From 26693d4d1239b8239644ce6da50b8ce06ff18ae5 Mon Sep 17 00:00:00 2001
2 From: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
3 Date: Wed, 17 Oct 2018 21:01:50 +0200
4 Subject: [PATCH] staging: bcm2835-audio: unify FOURCC command
5  definitions
6
7 commit a90d8f49cc7fd7220aa24b85fc74ef3cfd62b96f upstream.
8
9 The device communicates with the audio core using FOURCC codes. The
10 driver was generating them using different macros/expressions. We now
11 use the same macro to create them and centralize all the definitions.
12
13 Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
14 Reviewed-by: Takashi Iwai <tiwai@suse.de>
15 Acked-by: Stefan Wahren <stefan.wahren@i2se.com>
16 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
17 ---
18  .../vc04_services/bcm2835-audio/bcm2835-vchiq.c     | 13 ++++---------
19  .../bcm2835-audio/vc_vchi_audioserv_defs.h          |  4 +++-
20  2 files changed, 7 insertions(+), 10 deletions(-)
21
22 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
23 +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
24 @@ -89,11 +89,6 @@ static int bcm2835_audio_send_simple(str
25         return bcm2835_audio_send_msg(instance, &m, wait);
26  }
27  
28 -static const u32 BCM2835_AUDIO_WRITE_COOKIE1 = ('B' << 24 | 'C' << 16 |
29 -                                               'M' << 8  | 'A');
30 -static const u32 BCM2835_AUDIO_WRITE_COOKIE2 = ('D' << 24 | 'A' << 16 |
31 -                                               'T' << 8  | 'A');
32 -
33  static void audio_vchi_callback(void *param,
34                                 const VCHI_CALLBACK_REASON_T reason,
35                                 void *msg_handle)
36 @@ -112,8 +107,8 @@ static void audio_vchi_callback(void *pa
37                 instance->result = m.u.result.success;
38                 complete(&instance->msg_avail_comp);
39         } else if (m.type == VC_AUDIO_MSG_TYPE_COMPLETE) {
40 -               if (m.u.complete.cookie1 != BCM2835_AUDIO_WRITE_COOKIE1 ||
41 -                   m.u.complete.cookie2 != BCM2835_AUDIO_WRITE_COOKIE2)
42 +               if (m.u.complete.cookie1 != VC_AUDIO_WRITE_COOKIE1 ||
43 +                   m.u.complete.cookie2 != VC_AUDIO_WRITE_COOKIE2)
44                         dev_err(instance->dev, "invalid cookie\n");
45                 else
46                         bcm2835_playback_fifo(instance->alsa_stream,
47 @@ -337,8 +332,8 @@ int bcm2835_audio_write(struct bcm2835_a
48                 .type = VC_AUDIO_MSG_TYPE_WRITE,
49                 .u.write.count = size,
50                 .u.write.max_packet = instance->max_packet,
51 -               .u.write.cookie1 = BCM2835_AUDIO_WRITE_COOKIE1,
52 -               .u.write.cookie2 = BCM2835_AUDIO_WRITE_COOKIE2,
53 +               .u.write.cookie1 = VC_AUDIO_WRITE_COOKIE1,
54 +               .u.write.cookie2 = VC_AUDIO_WRITE_COOKIE2,
55         };
56         unsigned int count;
57         int err, status;
58 --- a/drivers/staging/vc04_services/bcm2835-audio/vc_vchi_audioserv_defs.h
59 +++ b/drivers/staging/vc04_services/bcm2835-audio/vc_vchi_audioserv_defs.h
60 @@ -7,8 +7,10 @@
61  #define VC_AUDIOSERV_MIN_VER 1
62  #define VC_AUDIOSERV_VER 2
63  
64 -/* FourCC code used for VCHI connection */
65 +/* FourCC codes used for VCHI communication */
66  #define VC_AUDIO_SERVER_NAME  MAKE_FOURCC("AUDS")
67 +#define VC_AUDIO_WRITE_COOKIE1 MAKE_FOURCC("BCMA")
68 +#define VC_AUDIO_WRITE_COOKIE2 MAKE_FOURCC("DATA")
69  
70  /*
71   *  List of screens that are currently supported