From: Michael Zoran Date: Fri, 13 Jan 2017 03:05:46 +0000 (-0800) Subject: ARM64/SND_BCM2835: Port it to arm64. X-Git-Tag: submit/tizen/20170828.023313~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1c3d2124f0587db06ae78ac2844ae2c472f1812e;p=platform%2Fkernel%2Flinux-rpi3.git ARM64/SND_BCM2835: Port it to arm64. In the messages sent to VCHIQ, SND_BCM2835 passes a callback and a context into two 32 bit pointers. Since this message is interpreted by the firmware, it can't be easily changed. Luckily only one of these fields is actual used, so on ARM64 only use one of the fields to store the upper half of the 64 bit callback pointer. The Kconfig is also changed to allow ARM audio to work for ARM64 as well. Signed-off-by: Michael Zoran --- diff --git a/sound/arm/Kconfig b/sound/arm/Kconfig index 02b6d263035c..944dee37a430 100644 --- a/sound/arm/Kconfig +++ b/sound/arm/Kconfig @@ -2,7 +2,7 @@ menuconfig SND_ARM bool "ARM sound devices" - depends on ARM + depends on (ARM || ARM64) default y help Support for sound devices specific to ARM architectures. diff --git a/sound/arm/bcm2835-vchiq.c b/sound/arm/bcm2835-vchiq.c index 7ee436ca9fa2..246ae501b7d9 100755 --- a/sound/arm/bcm2835-vchiq.c +++ b/sound/arm/bcm2835-vchiq.c @@ -226,7 +226,13 @@ static void audio_vchi_callback(void *param, complete(&instance->msg_avail_comp); } else if (m.type == VC_AUDIO_MSG_TYPE_COMPLETE) { bcm2835_alsa_stream_t *alsa_stream = instance->alsa_stream; +#if defined(CONFIG_64BIT) + irq_handler_t callback = + (irq_handler_t) (((unsigned long)m.u.complete.callbackl) | + ((unsigned long)m.u.complete.callbackh << 32)); +#else irq_handler_t callback = (irq_handler_t) m.u.complete.callback; +#endif LOG_DBG (" .. instance=%p, m.type=VC_AUDIO_MSG_TYPE_COMPLETE, complete=%d\n", instance, m.u.complete.count); @@ -803,8 +809,13 @@ int bcm2835_audio_write_worker(bcm2835_alsa_stream_t *alsa_stream, m.u.write.count = count; // old version uses bulk, new version uses control m.u.write.max_packet = instance->peer_version < 2 || force_bulk ? 0:4000; +#if defined(CONFIG_64BIT) + m.u.write.callbackl = (uint32_t)(((unsigned long)alsa_stream->fifo_irq_handler)&0xFFFFFFFF); + m.u.write.callbackh = (uint32_t)((((unsigned long)alsa_stream->fifo_irq_handler) >> 32)&0xFFFFFFFF); +#else m.u.write.callback = alsa_stream->fifo_irq_handler; m.u.write.cookie = alsa_stream; +#endif m.u.write.silence = src == NULL; /* Send the message to the videocore */ diff --git a/sound/arm/vc_vchi_audioserv_defs.h b/sound/arm/vc_vchi_audioserv_defs.h index af3e6eb69011..ede6154bc09d 100644 --- a/sound/arm/vc_vchi_audioserv_defs.h +++ b/sound/arm/vc_vchi_audioserv_defs.h @@ -78,8 +78,13 @@ typedef struct { // configure the write audio samples typedef struct { uint32_t count; // in bytes +#if defined(CONFIG_64BIT) + uint32_t callbackl; + uint32_t callbackh; +#else void *callback; void *cookie; +#endif uint16_t silence; uint16_t max_packet; } VC_AUDIO_WRITE_T; @@ -93,8 +98,13 @@ typedef struct { // Generic result for a request (VC->HOST) typedef struct { int32_t count; // Success value +#if defined(CONFIG_64BIT) + uint32_t callbackl; + uint32_t callbackh; +#else void *callback; void *cookie; +#endif } VC_AUDIO_COMPLETE_T; // Message header for all messages in HOST->VC direction