ath79: add support for COMFAST CF-E130N v2
[openwrt/openwrt.git] / target / linux / bcm27xx / patches-4.19 / 950-0370-sound-Fixes-for-audioinjector-octo-under-4.19.patch
1 From d003eff5bc4d19902867ad585292780a94746705 Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.org>
3 Date: Thu, 21 Mar 2019 11:19:46 +0000
4 Subject: [PATCH] sound: Fixes for audioinjector-octo under 4.19
5
6 1. Move the DT alias declaration to the I2C shim in the cases
7 where the shim is enabled. This works around a problem caused by a
8 4.19 commit [1] that generates DT/OF uevents for I2C drivers.
9
10 2. Fix the diagnostics in an error path of the soundcard driver to
11 correctly identify the reason for the failure to load.
12
13 3. Move the declaration of the clock node in the overlay outside
14 the I2C node to avoid warnings.
15
16 4. Sort the overlay nodes so that dependencies are only to earlier
17 fragments, in an attempt to get runtime dtoverlay application to
18 work (it still doesn't...)
19
20 See: https://github.com/Audio-Injector/Octo/issues/14
21 Signed-off-by: Phil Elwell <phil@raspberrypi.org>
22
23 [1] af503716ac14 ("i2c: core: report OF style module alias for devices registered via OF")
24 ---
25 .../overlays/audioinjector-addons-overlay.dts | 19 ++++++++++++-------
26 sound/soc/bcm/audioinjector-octo-soundcard.c | 2 +-
27 sound/soc/codecs/cs42xx8-i2c.c | 7 +++++++
28 sound/soc/codecs/cs42xx8.c | 2 ++
29 4 files changed, 22 insertions(+), 8 deletions(-)
30
31 --- a/arch/arm/boot/dts/overlays/audioinjector-addons-overlay.dts
32 +++ b/arch/arm/boot/dts/overlays/audioinjector-addons-overlay.dts
33 @@ -13,6 +13,17 @@
34 };
35
36 fragment@1 {
37 + target-path = "/";
38 + __overlay__ {
39 + cs42448_mclk: codec-mclk {
40 + compatible = "fixed-clock";
41 + #clock-cells = <0>;
42 + clock-frequency = <49152000>;
43 + };
44 + };
45 + };
46 +
47 + fragment@2 {
48 target = <&i2c1>;
49 __overlay__ {
50 #address-cells = <1>;
51 @@ -27,16 +38,10 @@
52 clock-names = "mclk";
53 status = "okay";
54 };
55 -
56 - cs42448_mclk: codec-mclk {
57 - compatible = "fixed-clock";
58 - #clock-cells = <0>;
59 - clock-frequency = <49152000>;
60 - };
61 };
62 };
63
64 - fragment@2 {
65 + fragment@3 {
66 target = <&sound>;
67 snd: __overlay__ {
68 compatible = "ai,audioinjector-octo-soundcard";
69 --- a/sound/soc/bcm/audioinjector-octo-soundcard.c
70 +++ b/sound/soc/bcm/audioinjector-octo-soundcard.c
71 @@ -297,7 +297,7 @@ static int audioinjector_octo_probe(stru
72 dai->codec_name = NULL;
73 dai->codec_of_node = codec_node;
74 } else
75 - if (!dai->cpu_of_node) {
76 + if (!i2s_node) {
77 dev_err(&pdev->dev,
78 "i2s-controller missing or invalid in DT\n");
79 return -EINVAL;
80 --- a/sound/soc/codecs/cs42xx8-i2c.c
81 +++ b/sound/soc/codecs/cs42xx8-i2c.c
82 @@ -45,6 +45,13 @@ static struct i2c_device_id cs42xx8_i2c_
83 };
84 MODULE_DEVICE_TABLE(i2c, cs42xx8_i2c_id);
85
86 +const struct of_device_id cs42xx8_of_match[] = {
87 + { .compatible = "cirrus,cs42448", .data = &cs42448_data, },
88 + { .compatible = "cirrus,cs42888", .data = &cs42888_data, },
89 + { /* sentinel */ }
90 +};
91 +MODULE_DEVICE_TABLE(of, cs42xx8_of_match);
92 +
93 static struct i2c_driver cs42xx8_i2c_driver = {
94 .driver = {
95 .name = "cs42xx8",
96 --- a/sound/soc/codecs/cs42xx8.c
97 +++ b/sound/soc/codecs/cs42xx8.c
98 @@ -436,8 +436,10 @@ const struct of_device_id cs42xx8_of_mat
99 { .compatible = "cirrus,cs42888", .data = &cs42888_data, },
100 { /* sentinel */ }
101 };
102 +#if !IS_ENABLED(CONFIG_SND_SOC_CS42XX8_I2C)
103 MODULE_DEVICE_TABLE(of, cs42xx8_of_match);
104 EXPORT_SYMBOL_GPL(cs42xx8_of_match);
105 +#endif
106
107 int cs42xx8_probe(struct device *dev, struct regmap *regmap)
108 {