brcm2708: update to v3.18
[openwrt/svn-archive/archive.git] / target / linux / brcm2708 / patches-3.18 / 0074-TAS5713-return-error-if-initialisation-fails.patch
1 From 2a72cdffabd2dd290d126c9a4e544bb65b537993 Mon Sep 17 00:00:00 2001
2 From: Daniel Matuschek <daniel@hifiberry.com>
3 Date: Fri, 23 Jan 2015 16:41:17 +0100
4 Subject: [PATCH 074/114] TAS5713: return error if initialisation fails
5
6 Existing TAS5713 driver logs errors during initialisation, but does not return
7 an error code. Therefore even if initialisation fails, the driver will still be
8 loaded, but won't work. This patch fixes this. I2C communication error will now
9 reported correctly by a non-zero return code.
10 ---
11 sound/soc/codecs/tas5713.c | 13 ++++++++++---
12 1 file changed, 10 insertions(+), 3 deletions(-)
13
14 diff --git a/sound/soc/codecs/tas5713.c b/sound/soc/codecs/tas5713.c
15 index a24c1da..9b27138 100644
16 --- a/sound/soc/codecs/tas5713.c
17 +++ b/sound/soc/codecs/tas5713.c
18 @@ -182,33 +182,40 @@ static int tas5713_probe(struct snd_soc_codec *codec)
19
20 // Reset error
21 ret = snd_soc_write(codec, TAS5713_ERROR_STATUS, 0x00);
22 + if (ret < 0) return ret;
23
24 // Trim oscillator
25 - ret = snd_soc_write(codec, TAS5713_OSC_TRIM, 0x00);
26 + ret = snd_soc_write(codec, TAS5713_OSC_TRIM, 0x00);
27 + if (ret < 0) return ret;
28 msleep(1000);
29
30 // Reset error
31 ret = snd_soc_write(codec, TAS5713_ERROR_STATUS, 0x00);
32 + if (ret < 0) return ret;
33
34 // Clock mode: 44/48kHz, MCLK=64xfs
35 ret = snd_soc_write(codec, TAS5713_CLOCK_CTRL, 0x60);
36 + if (ret < 0) return ret;
37
38 // I2S 24bit
39 ret = snd_soc_write(codec, TAS5713_SERIAL_DATA_INTERFACE, 0x05);
40 + if (ret < 0) return ret;
41
42 // Unmute
43 ret = snd_soc_write(codec, TAS5713_SYSTEM_CTRL2, 0x00);
44 + if (ret < 0) return ret;
45 ret = snd_soc_write(codec, TAS5713_SOFT_MUTE, 0x00);
46 + if (ret < 0) return ret;
47
48 // Set volume to 0db
49 ret = snd_soc_write(codec, TAS5713_VOL_MASTER, 0x00);
50 + if (ret < 0) return ret;
51
52 // Now start programming the default initialization sequence
53 for (i = 0; i < ARRAY_SIZE(tas5713_init_sequence); ++i) {
54 ret = i2c_master_send(i2c,
55 tas5713_init_sequence[i].data,
56 tas5713_init_sequence[i].size);
57 -
58 if (ret < 0) {
59 printk(KERN_INFO "TAS5713 CODEC PROBE: InitSeq returns: %d\n", ret);
60 }
61 @@ -216,7 +223,7 @@ static int tas5713_probe(struct snd_soc_codec *codec)
62
63 // Unmute
64 ret = snd_soc_write(codec, TAS5713_SYSTEM_CTRL2, 0x00);
65 -
66 + if (ret < 0) return ret;
67
68 return 0;
69 }
70 --
71 1.8.3.2
72