30bcd58806fedf438d1ceb45c9c4190a4add8b03
[openwrt/openwrt.git] / target / linux / bcm27xx / patches-5.15 / 950-0164-Add-HDMI1-facility-to-the-driver.patch
1 From c22955161cfe7f3c10ff0ee4b1ff296c5bee9496 Mon Sep 17 00:00:00 2001
2 From: James Hughes <james.hughes@raspberrypi.org>
3 Date: Tue, 16 Jul 2019 12:18:21 +0100
4 Subject: [PATCH] Add HDMI1 facility to the driver.
5
6 For generic ALSA, all you need is the bcm2835.h change, but
7 have also added structures for IEC958 HDMI. Not sure how to
8 test those.
9 ---
10 .../vc04_services/bcm2835-audio/bcm2835.c | 29 ++++++++++++++++---
11 .../vc04_services/bcm2835-audio/bcm2835.h | 4 ++-
12 2 files changed, 28 insertions(+), 5 deletions(-)
13
14 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.c
15 +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.c
16 @@ -79,7 +79,11 @@ static int bcm2835_audio_alsa_newpcm(str
17 if (err)
18 return err;
19
20 - err = snd_bcm2835_new_pcm(chip, "bcm2835 IEC958/HDMI", 1, 0, 1, true);
21 + err = snd_bcm2835_new_pcm(chip, "bcm2835 IEC958/HDMI", 1, AUDIO_DEST_HDMI0, 1, true);
22 + if (err)
23 + return err;
24 +
25 + err = snd_bcm2835_new_pcm(chip, "bcm2835 IEC958/HDMI1", 2, AUDIO_DEST_HDMI1, 1, true);
26 if (err)
27 return err;
28
29 @@ -106,7 +110,7 @@ static struct bcm2835_audio_driver bcm28
30 .newctl = snd_bcm2835_new_ctl,
31 };
32
33 -static struct bcm2835_audio_driver bcm2835_audio_hdmi = {
34 +static struct bcm2835_audio_driver bcm2835_audio_hdmi0 = {
35 .driver = {
36 .name = "bcm2835_hdmi",
37 .owner = THIS_MODULE,
38 @@ -116,7 +120,20 @@ static struct bcm2835_audio_driver bcm28
39 .minchannels = 1,
40 .newpcm = bcm2835_audio_simple_newpcm,
41 .newctl = snd_bcm2835_new_hdmi_ctl,
42 - .route = AUDIO_DEST_HDMI
43 + .route = AUDIO_DEST_HDMI0
44 +};
45 +
46 +static struct bcm2835_audio_driver bcm2835_audio_hdmi1 = {
47 + .driver = {
48 + .name = "bcm2835_hdmi",
49 + .owner = THIS_MODULE,
50 + },
51 + .shortname = "bcm2835 HDMI 1",
52 + .longname = "bcm2835 HDMI 1",
53 + .minchannels = 1,
54 + .newpcm = bcm2835_audio_simple_newpcm,
55 + .newctl = snd_bcm2835_new_hdmi_ctl,
56 + .route = AUDIO_DEST_HDMI1
57 };
58
59 static struct bcm2835_audio_driver bcm2835_audio_headphones = {
60 @@ -143,7 +160,11 @@ static struct bcm2835_audio_drivers chil
61 .is_enabled = &enable_compat_alsa,
62 },
63 {
64 - .audio_driver = &bcm2835_audio_hdmi,
65 + .audio_driver = &bcm2835_audio_hdmi0,
66 + .is_enabled = &enable_hdmi,
67 + },
68 + {
69 + .audio_driver = &bcm2835_audio_hdmi1,
70 .is_enabled = &enable_hdmi,
71 },
72 {
73 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h
74 +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h
75 @@ -33,7 +33,9 @@ enum {
76 enum snd_bcm2835_route {
77 AUDIO_DEST_AUTO = 0,
78 AUDIO_DEST_HEADPHONES = 1,
79 - AUDIO_DEST_HDMI = 2,
80 + AUDIO_DEST_HDMI = 2, // for backwards compatibility.
81 + AUDIO_DEST_HDMI0 = 2,
82 + AUDIO_DEST_HDMI1 = 3,
83 AUDIO_DEST_MAX,
84 };
85