Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'asoc-5.3' into asoc-5.4

+286 -136
+1 -1
MAINTAINERS
··· 16078 16078 F: drivers/net/ethernet/ti/netcp* 16079 16079 16080 16080 TI PCM3060 ASoC CODEC DRIVER 16081 - M: Kirill Marinushkin <kmarinushkin@birdec.tech> 16081 + M: Kirill Marinushkin <kmarinushkin@birdec.com> 16082 16082 L: alsa-devel@alsa-project.org (moderated for non-subscribers) 16083 16083 S: Maintained 16084 16084 F: Documentation/devicetree/bindings/sound/pcm3060.txt
+4
include/sound/simple_card_utils.h
··· 141 141 { 142 142 struct device *dev = simple_priv_to_dev(priv); 143 143 144 + /* dai might be NULL */ 145 + if (!dai) 146 + return; 147 + 144 148 if (dai->name) 145 149 dev_dbg(dev, "%s dai name = %s\n", 146 150 name, dai->name);
+9 -7
include/uapi/sound/sof/fw.h
··· 13 13 #ifndef __INCLUDE_UAPI_SOF_FW_H__ 14 14 #define __INCLUDE_UAPI_SOF_FW_H__ 15 15 16 + #include <linux/types.h> 17 + 16 18 #define SND_SOF_FW_SIG_SIZE 4 17 19 #define SND_SOF_FW_ABI 1 18 20 #define SND_SOF_FW_SIG "Reef" ··· 48 46 49 47 struct snd_sof_blk_hdr { 50 48 enum snd_sof_fw_blk_type type; 51 - uint32_t size; /* bytes minus this header */ 52 - uint32_t offset; /* offset from base */ 49 + __u32 size; /* bytes minus this header */ 50 + __u32 offset; /* offset from base */ 53 51 } __packed; 54 52 55 53 /* ··· 63 61 64 62 struct snd_sof_mod_hdr { 65 63 enum snd_sof_fw_mod_type type; 66 - uint32_t size; /* bytes minus this header */ 67 - uint32_t num_blocks; /* number of blocks */ 64 + __u32 size; /* bytes minus this header */ 65 + __u32 num_blocks; /* number of blocks */ 68 66 } __packed; 69 67 70 68 /* ··· 72 70 */ 73 71 struct snd_sof_fw_header { 74 72 unsigned char sig[SND_SOF_FW_SIG_SIZE]; /* "Reef" */ 75 - uint32_t file_size; /* size of file minus this header */ 76 - uint32_t num_modules; /* number of modules */ 77 - uint32_t abi; /* version of header format */ 73 + __u32 file_size; /* size of file minus this header */ 74 + __u32 num_modules; /* number of modules */ 75 + __u32 abi; /* version of header format */ 78 76 } __packed; 79 77 80 78 #endif
+8 -6
include/uapi/sound/sof/header.h
··· 9 9 #ifndef __INCLUDE_UAPI_SOUND_SOF_USER_HEADER_H__ 10 10 #define __INCLUDE_UAPI_SOUND_SOF_USER_HEADER_H__ 11 11 12 + #include <linux/types.h> 13 + 12 14 /* 13 15 * Header for all non IPC ABI data. 14 16 * ··· 18 16 * Used by any bespoke component data structures or binary blobs. 19 17 */ 20 18 struct sof_abi_hdr { 21 - uint32_t magic; /**< 'S', 'O', 'F', '\0' */ 22 - uint32_t type; /**< component specific type */ 23 - uint32_t size; /**< size in bytes of data excl. this struct */ 24 - uint32_t abi; /**< SOF ABI version */ 25 - uint32_t reserved[4]; /**< reserved for future use */ 26 - uint32_t data[0]; /**< Component data - opaque to core */ 19 + __u32 magic; /**< 'S', 'O', 'F', '\0' */ 20 + __u32 type; /**< component specific type */ 21 + __u32 size; /**< size in bytes of data excl. this struct */ 22 + __u32 abi; /**< SOF ABI version */ 23 + __u32 reserved[4]; /**< reserved for future use */ 24 + __u32 data[0]; /**< Component data - opaque to core */ 27 25 } __packed; 28 26 29 27 #endif
+97 -19
sound/soc/codecs/cs42xx8.c
··· 47 47 unsigned long sysclk; 48 48 u32 tx_channels; 49 49 struct gpio_desc *gpiod_reset; 50 + u32 rate[2]; 50 51 }; 51 52 52 53 /* -127.5dB to 0dB with step of 0.5dB */ ··· 177 176 }; 178 177 179 178 struct cs42xx8_ratios { 180 - unsigned int ratio; 181 - unsigned char speed; 182 - unsigned char mclk; 179 + unsigned int mfreq; 180 + unsigned int min_mclk; 181 + unsigned int max_mclk; 182 + unsigned int ratio[3]; 183 183 }; 184 184 185 + /* 186 + * According to reference mannual, define the cs42xx8_ratio struct 187 + * MFreq2 | MFreq1 | MFreq0 | Description | SSM | DSM | QSM | 188 + * 0 | 0 | 0 |1.029MHz to 12.8MHz | 256 | 128 | 64 | 189 + * 0 | 0 | 1 |1.536MHz to 19.2MHz | 384 | 192 | 96 | 190 + * 0 | 1 | 0 |2.048MHz to 25.6MHz | 512 | 256 | 128 | 191 + * 0 | 1 | 1 |3.072MHz to 38.4MHz | 768 | 384 | 192 | 192 + * 1 | x | x |4.096MHz to 51.2MHz |1024 | 512 | 256 | 193 + */ 185 194 static const struct cs42xx8_ratios cs42xx8_ratios[] = { 186 - { 64, CS42XX8_FM_QUAD, CS42XX8_FUNCMOD_MFREQ_256(4) }, 187 - { 96, CS42XX8_FM_QUAD, CS42XX8_FUNCMOD_MFREQ_384(4) }, 188 - { 128, CS42XX8_FM_QUAD, CS42XX8_FUNCMOD_MFREQ_512(4) }, 189 - { 192, CS42XX8_FM_QUAD, CS42XX8_FUNCMOD_MFREQ_768(4) }, 190 - { 256, CS42XX8_FM_SINGLE, CS42XX8_FUNCMOD_MFREQ_256(1) }, 191 - { 384, CS42XX8_FM_SINGLE, CS42XX8_FUNCMOD_MFREQ_384(1) }, 192 - { 512, CS42XX8_FM_SINGLE, CS42XX8_FUNCMOD_MFREQ_512(1) }, 193 - { 768, CS42XX8_FM_SINGLE, CS42XX8_FUNCMOD_MFREQ_768(1) }, 194 - { 1024, CS42XX8_FM_SINGLE, CS42XX8_FUNCMOD_MFREQ_1024(1) } 195 + { 0, 1029000, 12800000, {256, 128, 64} }, 196 + { 2, 1536000, 19200000, {384, 192, 96} }, 197 + { 4, 2048000, 25600000, {512, 256, 128} }, 198 + { 6, 3072000, 38400000, {768, 384, 192} }, 199 + { 8, 4096000, 51200000, {1024, 512, 256} }, 195 200 }; 196 201 197 202 static int cs42xx8_set_dai_sysclk(struct snd_soc_dai *codec_dai, ··· 264 257 struct snd_soc_component *component = dai->component; 265 258 struct cs42xx8_priv *cs42xx8 = snd_soc_component_get_drvdata(component); 266 259 bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK; 267 - u32 ratio = cs42xx8->sysclk / params_rate(params); 268 - u32 i, fm, val, mask; 260 + u32 ratio[2]; 261 + u32 rate[2]; 262 + u32 fm[2]; 263 + u32 i, val, mask; 264 + bool condition1, condition2; 269 265 270 266 if (tx) 271 267 cs42xx8->tx_channels = params_channels(params); 272 268 269 + rate[tx] = params_rate(params); 270 + rate[!tx] = cs42xx8->rate[!tx]; 271 + 272 + ratio[tx] = rate[tx] > 0 ? cs42xx8->sysclk / rate[tx] : 0; 273 + ratio[!tx] = rate[!tx] > 0 ? cs42xx8->sysclk / rate[!tx] : 0; 274 + 275 + /* Get functional mode for tx and rx according to rate */ 276 + for (i = 0; i < 2; i++) { 277 + if (cs42xx8->slave_mode) { 278 + fm[i] = CS42XX8_FM_AUTO; 279 + } else { 280 + if (rate[i] < 50000) { 281 + fm[i] = CS42XX8_FM_SINGLE; 282 + } else if (rate[i] > 50000 && rate[i] < 100000) { 283 + fm[i] = CS42XX8_FM_DOUBLE; 284 + } else if (rate[i] > 100000 && rate[i] < 200000) { 285 + fm[i] = CS42XX8_FM_QUAD; 286 + } else { 287 + dev_err(component->dev, 288 + "unsupported sample rate\n"); 289 + return -EINVAL; 290 + } 291 + } 292 + } 293 + 273 294 for (i = 0; i < ARRAY_SIZE(cs42xx8_ratios); i++) { 274 - if (cs42xx8_ratios[i].ratio == ratio) 295 + /* Is the ratio[tx] valid ? */ 296 + condition1 = ((fm[tx] == CS42XX8_FM_AUTO) ? 297 + (cs42xx8_ratios[i].ratio[0] == ratio[tx] || 298 + cs42xx8_ratios[i].ratio[1] == ratio[tx] || 299 + cs42xx8_ratios[i].ratio[2] == ratio[tx]) : 300 + (cs42xx8_ratios[i].ratio[fm[tx]] == ratio[tx])) && 301 + cs42xx8->sysclk >= cs42xx8_ratios[i].min_mclk && 302 + cs42xx8->sysclk <= cs42xx8_ratios[i].max_mclk; 303 + 304 + if (!ratio[tx]) 305 + condition1 = true; 306 + 307 + /* Is the ratio[!tx] valid ? */ 308 + condition2 = ((fm[!tx] == CS42XX8_FM_AUTO) ? 309 + (cs42xx8_ratios[i].ratio[0] == ratio[!tx] || 310 + cs42xx8_ratios[i].ratio[1] == ratio[!tx] || 311 + cs42xx8_ratios[i].ratio[2] == ratio[!tx]) : 312 + (cs42xx8_ratios[i].ratio[fm[!tx]] == ratio[!tx])); 313 + 314 + if (!ratio[!tx]) 315 + condition2 = true; 316 + 317 + /* 318 + * Both ratio[tx] and ratio[!tx] is valid, then we get 319 + * a proper MFreq. 320 + */ 321 + if (condition1 && condition2) 275 322 break; 276 323 } 277 324 ··· 334 273 return -EINVAL; 335 274 } 336 275 337 - mask = CS42XX8_FUNCMOD_MFREQ_MASK; 338 - val = cs42xx8_ratios[i].mclk; 276 + cs42xx8->rate[tx] = params_rate(params); 339 277 340 - fm = cs42xx8->slave_mode ? CS42XX8_FM_AUTO : cs42xx8_ratios[i].speed; 278 + mask = CS42XX8_FUNCMOD_MFREQ_MASK; 279 + val = cs42xx8_ratios[i].mfreq; 341 280 342 281 regmap_update_bits(cs42xx8->regmap, CS42XX8_FUNCMOD, 343 282 CS42XX8_FUNCMOD_xC_FM_MASK(tx) | mask, 344 - CS42XX8_FUNCMOD_xC_FM(tx, fm) | val); 283 + CS42XX8_FUNCMOD_xC_FM(tx, fm[tx]) | val); 345 284 285 + return 0; 286 + } 287 + 288 + static int cs42xx8_hw_free(struct snd_pcm_substream *substream, 289 + struct snd_soc_dai *dai) 290 + { 291 + struct snd_soc_component *component = dai->component; 292 + struct cs42xx8_priv *cs42xx8 = snd_soc_component_get_drvdata(component); 293 + bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK; 294 + 295 + /* Clear stored rate */ 296 + cs42xx8->rate[tx] = 0; 297 + 298 + regmap_update_bits(cs42xx8->regmap, CS42XX8_FUNCMOD, 299 + CS42XX8_FUNCMOD_xC_FM_MASK(tx), 300 + CS42XX8_FUNCMOD_xC_FM(tx, CS42XX8_FM_AUTO)); 346 301 return 0; 347 302 } 348 303 ··· 379 302 .set_fmt = cs42xx8_set_dai_fmt, 380 303 .set_sysclk = cs42xx8_set_dai_sysclk, 381 304 .hw_params = cs42xx8_hw_params, 305 + .hw_free = cs42xx8_hw_free, 382 306 .digital_mute = cs42xx8_digital_mute, 383 307 }; 384 308
+4 -21
sound/soc/codecs/max98357a.c
··· 20 20 #include <sound/soc-dapm.h> 21 21 22 22 struct max98357a_priv { 23 - struct delayed_work enable_sdmode_work; 24 23 struct gpio_desc *sdmode; 25 24 unsigned int sdmode_delay; 26 25 }; 27 - 28 - static void max98357a_enable_sdmode_work(struct work_struct *work) 29 - { 30 - struct max98357a_priv *max98357a = 31 - container_of(work, struct max98357a_priv, 32 - enable_sdmode_work.work); 33 - 34 - gpiod_set_value(max98357a->sdmode, 1); 35 - } 36 26 37 27 static int max98357a_daiops_trigger(struct snd_pcm_substream *substream, 38 28 int cmd, struct snd_soc_dai *dai) ··· 36 46 case SNDRV_PCM_TRIGGER_START: 37 47 case SNDRV_PCM_TRIGGER_RESUME: 38 48 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: 39 - queue_delayed_work(system_power_efficient_wq, 40 - &max98357a->enable_sdmode_work, 41 - msecs_to_jiffies(max98357a->sdmode_delay)); 49 + mdelay(max98357a->sdmode_delay); 50 + gpiod_set_value(max98357a->sdmode, 1); 42 51 break; 43 52 case SNDRV_PCM_TRIGGER_STOP: 44 53 case SNDRV_PCM_TRIGGER_SUSPEND: 45 54 case SNDRV_PCM_TRIGGER_PAUSE_PUSH: 46 - cancel_delayed_work_sync(&max98357a->enable_sdmode_work); 47 55 gpiod_set_value(max98357a->sdmode, 0); 48 56 break; 49 57 } ··· 100 112 int ret; 101 113 102 114 max98357a = devm_kzalloc(&pdev->dev, sizeof(*max98357a), GFP_KERNEL); 103 - 104 115 if (!max98357a) 105 116 return -ENOMEM; 106 117 107 118 max98357a->sdmode = devm_gpiod_get_optional(&pdev->dev, 108 119 "sdmode", GPIOD_OUT_LOW); 109 - 110 120 if (IS_ERR(max98357a->sdmode)) 111 121 return PTR_ERR(max98357a->sdmode); 112 122 113 123 ret = device_property_read_u32(&pdev->dev, "sdmode-delay", 114 124 &max98357a->sdmode_delay); 115 - 116 125 if (ret) { 117 126 max98357a->sdmode_delay = 0; 118 127 dev_dbg(&pdev->dev, 119 - "no optional property 'sdmode-delay' found, default: no delay\n"); 128 + "no optional property 'sdmode-delay' found, " 129 + "default: no delay\n"); 120 130 } 121 131 122 132 dev_set_drvdata(&pdev->dev, max98357a); 123 - 124 - INIT_DELAYED_WORK(&max98357a->enable_sdmode_work, 125 - max98357a_enable_sdmode_work); 126 133 127 134 return devm_snd_soc_register_component(&pdev->dev, 128 135 &max98357a_component_driver,
+2 -2
sound/soc/codecs/pcm3060-i2c.c
··· 2 2 // 3 3 // PCM3060 I2C driver 4 4 // 5 - // Copyright (C) 2018 Kirill Marinushkin <kmarinushkin@birdec.tech> 5 + // Copyright (C) 2018 Kirill Marinushkin <kmarinushkin@birdec.com> 6 6 7 7 #include <linux/i2c.h> 8 8 #include <linux/module.h> ··· 56 56 module_i2c_driver(pcm3060_i2c_driver); 57 57 58 58 MODULE_DESCRIPTION("PCM3060 I2C driver"); 59 - MODULE_AUTHOR("Kirill Marinushkin <kmarinushkin@birdec.tech>"); 59 + MODULE_AUTHOR("Kirill Marinushkin <kmarinushkin@birdec.com>"); 60 60 MODULE_LICENSE("GPL v2");
+2 -2
sound/soc/codecs/pcm3060-spi.c
··· 2 2 // 3 3 // PCM3060 SPI driver 4 4 // 5 - // Copyright (C) 2018 Kirill Marinushkin <kmarinushkin@birdec.tech> 5 + // Copyright (C) 2018 Kirill Marinushkin <kmarinushkin@birdec.com> 6 6 7 7 #include <linux/module.h> 8 8 #include <linux/spi/spi.h> ··· 55 55 module_spi_driver(pcm3060_spi_driver); 56 56 57 57 MODULE_DESCRIPTION("PCM3060 SPI driver"); 58 - MODULE_AUTHOR("Kirill Marinushkin <kmarinushkin@birdec.tech>"); 58 + MODULE_AUTHOR("Kirill Marinushkin <kmarinushkin@birdec.com>"); 59 59 MODULE_LICENSE("GPL v2");
+2 -2
sound/soc/codecs/pcm3060.c
··· 2 2 // 3 3 // PCM3060 codec driver 4 4 // 5 - // Copyright (C) 2018 Kirill Marinushkin <kmarinushkin@birdec.tech> 5 + // Copyright (C) 2018 Kirill Marinushkin <kmarinushkin@birdec.com> 6 6 7 7 #include <linux/module.h> 8 8 #include <sound/pcm_params.h> ··· 342 342 EXPORT_SYMBOL(pcm3060_probe); 343 343 344 344 MODULE_DESCRIPTION("PCM3060 codec driver"); 345 - MODULE_AUTHOR("Kirill Marinushkin <kmarinushkin@birdec.tech>"); 345 + MODULE_AUTHOR("Kirill Marinushkin <kmarinushkin@birdec.com>"); 346 346 MODULE_LICENSE("GPL v2");
+1 -1
sound/soc/codecs/pcm3060.h
··· 2 2 /* 3 3 * PCM3060 codec driver 4 4 * 5 - * Copyright (C) 2018 Kirill Marinushkin <kmarinushkin@birdec.tech> 5 + * Copyright (C) 2018 Kirill Marinushkin <kmarinushkin@birdec.com> 6 6 */ 7 7 8 8 #ifndef _SND_SOC_PCM3060_H
+2 -2
sound/soc/codecs/rt1011.c
··· 39 39 { RT1011_POWER_9, 0xa840 }, 40 40 41 41 { RT1011_ADC_SET_5, 0x0a20 }, 42 - { RT1011_DAC_SET_2, 0xa232 }, 42 + { RT1011_DAC_SET_2, 0xa032 }, 43 43 { RT1011_ADC_SET_1, 0x2925 }, 44 44 45 45 { RT1011_SPK_PRO_DC_DET_1, 0xb00c }, ··· 1917 1917 snd_soc_component_write(component, 1918 1918 RT1011_SYSTEM_RESET_2, 0x0000); 1919 1919 snd_soc_component_write(component, 1920 - RT1011_SYSTEM_RESET_3, 0x0000); 1920 + RT1011_SYSTEM_RESET_3, 0x0001); 1921 1921 snd_soc_component_write(component, 1922 1922 RT1011_SYSTEM_RESET_1, 0x003f); 1923 1923 snd_soc_component_write(component,
sound/soc/codecs/rt1308.c
sound/soc/codecs/rt1308.h
+16 -14
sound/soc/generic/audio-graph-card.c
··· 63 63 struct device_node *endpoint; 64 64 struct of_endpoint info; 65 65 int i, id; 66 + const u32 *reg; 66 67 int ret; 67 68 68 69 /* use driver specified DAI ID if exist */ ··· 84 83 return info.id; 85 84 86 85 node = of_get_parent(ep); 86 + reg = of_get_property(node, "reg", NULL); 87 87 of_node_put(node); 88 - if (of_get_property(node, "reg", NULL)) 88 + if (reg) 89 89 return info.port; 90 90 } 91 91 node = of_graph_get_port_parent(ep); ··· 210 208 211 209 dev_dbg(dev, "link_of DPCM (%pOF)\n", ep); 212 210 213 - of_node_put(ports); 214 - of_node_put(port); 215 - of_node_put(node); 216 - 217 211 if (li->cpu) { 218 212 int is_single_links = 0; 219 213 ··· 227 229 228 230 ret = asoc_simple_parse_cpu(ep, dai_link, &is_single_links); 229 231 if (ret) 230 - return ret; 232 + goto out_put_node; 231 233 232 234 ret = asoc_simple_parse_clk_cpu(dev, ep, dai_link, dai); 233 235 if (ret < 0) 234 - return ret; 236 + goto out_put_node; 235 237 236 238 ret = asoc_simple_set_dailink_name(dev, dai_link, 237 239 "fe.%s", 238 240 cpus->dai_name); 239 241 if (ret < 0) 240 - return ret; 242 + goto out_put_node; 241 243 242 244 /* card->num_links includes Codec */ 243 245 asoc_simple_canonicalize_cpu(dai_link, is_single_links); ··· 261 263 262 264 ret = asoc_simple_parse_codec(ep, dai_link); 263 265 if (ret < 0) 264 - return ret; 266 + goto out_put_node; 265 267 266 268 ret = asoc_simple_parse_clk_codec(dev, ep, dai_link, dai); 267 269 if (ret < 0) 268 - return ret; 270 + goto out_put_node; 269 271 270 272 ret = asoc_simple_set_dailink_name(dev, dai_link, 271 273 "be.%s", 272 274 codecs->dai_name); 273 275 if (ret < 0) 274 - return ret; 276 + goto out_put_node; 275 277 276 278 /* check "prefix" from top node */ 277 279 snd_soc_of_parse_node_prefix(top, cconf, codecs->of_node, ··· 291 293 292 294 ret = asoc_simple_parse_tdm(ep, dai); 293 295 if (ret) 294 - return ret; 296 + goto out_put_node; 295 297 296 298 ret = asoc_simple_parse_daifmt(dev, cpu_ep, codec_ep, 297 299 NULL, &dai_link->dai_fmt); 298 300 if (ret < 0) 299 - return ret; 301 + goto out_put_node; 300 302 301 303 dai_link->dpcm_playback = 1; 302 304 dai_link->dpcm_capture = 1; 303 305 dai_link->ops = &graph_ops; 304 306 dai_link->init = asoc_simple_dai_init; 305 307 306 - return 0; 308 + out_put_node: 309 + of_node_put(ports); 310 + of_node_put(port); 311 + of_node_put(node); 312 + return ret; 307 313 } 308 314 309 315 static int graph_dai_link_of(struct asoc_simple_priv *priv,
+7
sound/soc/generic/simple-card-utils.c
··· 349 349 /* Assumes platform == cpu */ 350 350 if (!dai_link->platforms->of_node) 351 351 dai_link->platforms->of_node = dai_link->cpus->of_node; 352 + 353 + /* 354 + * DPCM BE can be no platform. 355 + * Alloced memory will be waste, but not leak. 356 + */ 357 + if (!dai_link->platforms->of_node) 358 + dai_link->num_platforms = 0; 352 359 } 353 360 EXPORT_SYMBOL_GPL(asoc_simple_canonicalize_platform); 354 361
+13 -13
sound/soc/generic/simple-card.c
··· 124 124 125 125 li->link++; 126 126 127 - of_node_put(node); 128 - 129 127 /* For single DAI link & old style of DT node */ 130 128 if (is_top) 131 129 prefix = PREFIX; ··· 145 147 146 148 ret = asoc_simple_parse_cpu(np, dai_link, &is_single_links); 147 149 if (ret) 148 - return ret; 150 + goto out_put_node; 149 151 150 152 ret = asoc_simple_parse_clk_cpu(dev, np, dai_link, dai); 151 153 if (ret < 0) 152 - return ret; 154 + goto out_put_node; 153 155 154 156 ret = asoc_simple_set_dailink_name(dev, dai_link, 155 157 "fe.%s", 156 158 cpus->dai_name); 157 159 if (ret < 0) 158 - return ret; 160 + goto out_put_node; 159 161 160 162 asoc_simple_canonicalize_cpu(dai_link, is_single_links); 161 163 } else { ··· 178 180 179 181 ret = asoc_simple_parse_codec(np, dai_link); 180 182 if (ret < 0) 181 - return ret; 183 + goto out_put_node; 182 184 183 185 ret = asoc_simple_parse_clk_codec(dev, np, dai_link, dai); 184 186 if (ret < 0) 185 - return ret; 187 + goto out_put_node; 186 188 187 189 ret = asoc_simple_set_dailink_name(dev, dai_link, 188 190 "be.%s", 189 191 codecs->dai_name); 190 192 if (ret < 0) 191 - return ret; 193 + goto out_put_node; 192 194 193 195 /* check "prefix" from top node */ 194 196 snd_soc_of_parse_node_prefix(top, cconf, codecs->of_node, ··· 206 208 207 209 ret = asoc_simple_parse_tdm(np, dai); 208 210 if (ret) 209 - return ret; 211 + goto out_put_node; 210 212 211 213 ret = asoc_simple_parse_daifmt(dev, node, codec, 212 214 prefix, &dai_link->dai_fmt); 213 215 if (ret < 0) 214 - return ret; 216 + goto out_put_node; 215 217 216 218 dai_link->dpcm_playback = 1; 217 219 dai_link->dpcm_capture = 1; 218 220 dai_link->ops = &simple_ops; 219 221 dai_link->init = asoc_simple_dai_init; 220 222 221 - return 0; 223 + out_put_node: 224 + of_node_put(node); 225 + return ret; 222 226 } 223 227 224 228 static int simple_dai_link_of(struct asoc_simple_priv *priv, ··· 364 364 goto error; 365 365 } 366 366 367 - of_node_put(codec); 368 - 369 367 /* get convert-xxx property */ 370 368 memset(&adata, 0, sizeof(adata)); 371 369 for_each_child_of_node(node, np) ··· 385 387 ret = func_noml(priv, np, codec, li, is_top); 386 388 387 389 if (ret < 0) { 390 + of_node_put(codec); 388 391 of_node_put(np); 389 392 goto error; 390 393 } 391 394 } 392 395 396 + of_node_put(codec); 393 397 node = of_get_next_child(top, node); 394 398 } while (!is_top && node); 395 399
+8
sound/soc/intel/boards/bytcht_es8316.c
··· 437 437 438 438 /* Please keep this list alphabetically sorted */ 439 439 static const struct dmi_system_id byt_cht_es8316_quirk_table[] = { 440 + { /* Irbis NB41 */ 441 + .matches = { 442 + DMI_MATCH(DMI_SYS_VENDOR, "IRBIS"), 443 + DMI_MATCH(DMI_PRODUCT_NAME, "NB41"), 444 + }, 445 + .driver_data = (void *)(BYT_CHT_ES8316_INTMIC_IN2_MAP 446 + | BYT_CHT_ES8316_JD_INVERTED), 447 + }, 440 448 { /* Teclast X98 Plus II */ 441 449 .matches = { 442 450 DMI_MATCH(DMI_SYS_VENDOR, "TECLAST"),
+1 -1
sound/soc/intel/common/soc-acpi-intel-bxt-match.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 /* 3 - * soc-apci-intel-bxt-match.c - tables and support for BXT ACPI enumeration. 3 + * soc-acpi-intel-bxt-match.c - tables and support for BXT ACPI enumeration. 4 4 * 5 5 * Copyright (c) 2018, Intel Corporation. 6 6 *
+1 -1
sound/soc/intel/common/soc-acpi-intel-byt-match.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0-only 2 2 /* 3 - * soc-apci-intel-byt-match.c - tables and support for BYT ACPI enumeration. 3 + * soc-acpi-intel-byt-match.c - tables and support for BYT ACPI enumeration. 4 4 * 5 5 * Copyright (c) 2017, Intel Corporation. 6 6 */
+1 -1
sound/soc/intel/common/soc-acpi-intel-cht-match.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0-only 2 2 /* 3 - * soc-apci-intel-cht-match.c - tables and support for CHT ACPI enumeration. 3 + * soc-acpi-intel-cht-match.c - tables and support for CHT ACPI enumeration. 4 4 * 5 5 * Copyright (c) 2017, Intel Corporation. 6 6 */
+1 -1
sound/soc/intel/common/soc-acpi-intel-cnl-match.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 /* 3 - * soc-apci-intel-cnl-match.c - tables and support for CNL ACPI enumeration. 3 + * soc-acpi-intel-cnl-match.c - tables and support for CNL ACPI enumeration. 4 4 * 5 5 * Copyright (c) 2018, Intel Corporation. 6 6 *
+1 -1
sound/soc/intel/common/soc-acpi-intel-glk-match.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 /* 3 - * soc-apci-intel-glk-match.c - tables and support for GLK ACPI enumeration. 3 + * soc-acpi-intel-glk-match.c - tables and support for GLK ACPI enumeration. 4 4 * 5 5 * Copyright (c) 2018, Intel Corporation. 6 6 *
+1 -1
sound/soc/intel/common/soc-acpi-intel-hda-match.c
··· 2 2 // Copyright (c) 2018, Intel Corporation. 3 3 4 4 /* 5 - * soc-apci-intel-hda-match.c - tables and support for HDA+ACPI enumeration. 5 + * soc-acpi-intel-hda-match.c - tables and support for HDA+ACPI enumeration. 6 6 * 7 7 */ 8 8
+1 -1
sound/soc/intel/common/soc-acpi-intel-hsw-bdw-match.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0-only 2 2 /* 3 - * soc-apci-intel-hsw-bdw-match.c - tables and support for ACPI enumeration. 3 + * soc-acpi-intel-hsw-bdw-match.c - tables and support for ACPI enumeration. 4 4 * 5 5 * Copyright (c) 2017, Intel Corporation. 6 6 */
+1 -1
sound/soc/intel/common/soc-acpi-intel-icl-match.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 /* 3 - * soc-apci-intel-icl-match.c - tables and support for ICL ACPI enumeration. 3 + * soc-acpi-intel-icl-match.c - tables and support for ICL ACPI enumeration. 4 4 * 5 5 * Copyright (c) 2018, Intel Corporation. 6 6 *
+1 -1
sound/soc/intel/common/soc-acpi-intel-kbl-match.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 /* 3 - * soc-apci-intel-kbl-match.c - tables and support for KBL ACPI enumeration. 3 + * soc-acpi-intel-kbl-match.c - tables and support for KBL ACPI enumeration. 4 4 * 5 5 * Copyright (c) 2018, Intel Corporation. 6 6 *
+1 -1
sound/soc/intel/common/soc-acpi-intel-skl-match.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 /* 3 - * soc-apci-intel-skl-match.c - tables and support for SKL ACPI enumeration. 3 + * soc-acpi-intel-skl-match.c - tables and support for SKL ACPI enumeration. 4 4 * 5 5 * Copyright (c) 2018, Intel Corporation. 6 6 *
+10 -10
sound/soc/qcom/apq8016_sbc.c
··· 150 150 151 151 link = data->dai_link; 152 152 153 - dlc = devm_kzalloc(dev, 2 * sizeof(*dlc), GFP_KERNEL); 154 - if (!dlc) 155 - return ERR_PTR(-ENOMEM); 156 - 157 - link->cpus = &dlc[0]; 158 - link->platforms = &dlc[1]; 159 - 160 - link->num_cpus = 1; 161 - link->num_platforms = 1; 162 - 163 153 for_each_child_of_node(node, np) { 154 + dlc = devm_kzalloc(dev, 2 * sizeof(*dlc), GFP_KERNEL); 155 + if (!dlc) 156 + return ERR_PTR(-ENOMEM); 157 + 158 + link->cpus = &dlc[0]; 159 + link->platforms = &dlc[1]; 160 + 161 + link->num_cpus = 1; 162 + link->num_platforms = 1; 163 + 164 164 cpu = of_get_child_by_name(np, "cpu"); 165 165 codec = of_get_child_by_name(np, "codec"); 166 166
+2 -3
sound/soc/rockchip/rockchip_i2s.c
··· 326 326 val |= I2S_CHN_4; 327 327 break; 328 328 case 2: 329 - case 1: 330 329 val |= I2S_CHN_2; 331 330 break; 332 331 default: ··· 458 459 }, 459 460 .capture = { 460 461 .stream_name = "Capture", 461 - .channels_min = 1, 462 + .channels_min = 2, 462 463 .channels_max = 2, 463 464 .rates = SNDRV_PCM_RATE_8000_192000, 464 465 .formats = (SNDRV_PCM_FMTBIT_S8 | ··· 658 659 } 659 660 660 661 if (!of_property_read_u32(node, "rockchip,capture-channels", &val)) { 661 - if (val >= 1 && val <= 8) 662 + if (val >= 2 && val <= 8) 662 663 soc_dai->capture.channels_max = val; 663 664 } 664 665
+32
sound/soc/rockchip/rockchip_max98090.c
··· 60 60 SOC_DAPM_PIN_SWITCH("Speaker"), 61 61 }; 62 62 63 + static int rk_jack_event(struct notifier_block *nb, unsigned long event, 64 + void *data) 65 + { 66 + struct snd_soc_jack *jack = (struct snd_soc_jack *)data; 67 + struct snd_soc_dapm_context *dapm = &jack->card->dapm; 68 + 69 + if (event & SND_JACK_MICROPHONE) 70 + snd_soc_dapm_force_enable_pin(dapm, "MICBIAS"); 71 + else 72 + snd_soc_dapm_disable_pin(dapm, "MICBIAS"); 73 + 74 + snd_soc_dapm_sync(dapm); 75 + 76 + return 0; 77 + } 78 + 79 + static struct notifier_block rk_jack_nb = { 80 + .notifier_call = rk_jack_event, 81 + }; 82 + 83 + static int rk_init(struct snd_soc_pcm_runtime *runtime) 84 + { 85 + /* 86 + * The jack has already been created in the rk_98090_headset_init() 87 + * function. 88 + */ 89 + snd_soc_jack_notifier_register(&headset_jack, &rk_jack_nb); 90 + 91 + return 0; 92 + } 93 + 63 94 static int rk_aif1_hw_params(struct snd_pcm_substream *substream, 64 95 struct snd_pcm_hw_params *params) 65 96 { ··· 149 118 static struct snd_soc_dai_link rk_dailink = { 150 119 .name = "max98090", 151 120 .stream_name = "Audio", 121 + .init = rk_init, 152 122 .ops = &rk_aif1_ops, 153 123 /* set max98090 as slave */ 154 124 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
+5 -3
sound/soc/samsung/odroid.c
··· 284 284 } 285 285 286 286 of_node_put(cpu); 287 - of_node_put(codec); 288 287 if (ret < 0) 289 - return ret; 288 + goto err_put_node; 290 289 291 290 ret = snd_soc_of_get_dai_link_codecs(dev, codec, codec_link); 292 291 if (ret < 0) ··· 308 309 ret = PTR_ERR(priv->clk_i2s_bus); 309 310 goto err_put_sclk; 310 311 } 311 - of_node_put(cpu_dai); 312 312 313 313 ret = devm_snd_soc_register_card(dev, card); 314 314 if (ret < 0) { ··· 315 317 goto err_put_clk_i2s; 316 318 } 317 319 320 + of_node_put(cpu_dai); 321 + of_node_put(codec); 318 322 return 0; 319 323 320 324 err_put_clk_i2s: ··· 326 326 err_put_cpu_dai: 327 327 of_node_put(cpu_dai); 328 328 snd_soc_of_put_dai_link_codecs(codec_link); 329 + err_put_node: 330 + of_node_put(codec); 329 331 return ret; 330 332 } 331 333
+5 -2
sound/soc/soc-core.c
··· 1511 1511 } 1512 1512 } 1513 1513 1514 - if (dai_link->dai_fmt) 1515 - snd_soc_runtime_set_dai_fmt(rtd, dai_link->dai_fmt); 1514 + if (dai_link->dai_fmt) { 1515 + ret = snd_soc_runtime_set_dai_fmt(rtd, dai_link->dai_fmt); 1516 + if (ret) 1517 + return ret; 1518 + } 1516 1519 1517 1520 ret = soc_post_component_init(rtd, dai_link->name); 1518 1521 if (ret)
+6 -4
sound/soc/soc-dapm.c
··· 1157 1157 list_add_tail(&widget->work_list, list); 1158 1158 1159 1159 if (custom_stop_condition && custom_stop_condition(widget, dir)) { 1160 - widget->endpoints[dir] = 1; 1161 - return widget->endpoints[dir]; 1160 + list = NULL; 1161 + custom_stop_condition = NULL; 1162 1162 } 1163 1163 1164 1164 if ((widget->is_ep & SND_SOC_DAPM_DIR_TO_EP(dir)) && widget->connected) { ··· 1195 1195 * 1196 1196 * Optionally, can be supplied with a function acting as a stopping condition. 1197 1197 * This function takes the dapm widget currently being examined and the walk 1198 - * direction as an arguments, it should return true if the walk should be 1199 - * stopped and false otherwise. 1198 + * direction as an arguments, it should return true if widgets from that point 1199 + * in the graph onwards should not be added to the widget list. 1200 1200 */ 1201 1201 static int is_connected_output_ep(struct snd_soc_dapm_widget *widget, 1202 1202 struct list_head *list, ··· 3706 3706 dev_err(dapm->dev, "ASoC: Failed to request %s: %d\n", 3707 3707 w->name, ret); 3708 3708 3709 + kfree_const(w->sname); 3710 + kfree(w); 3709 3711 return ERR_PTR(ret); 3710 3712 } 3711 3713
+2 -2
sound/soc/sof/intel/cnl.c
··· 101 101 /* 102 102 * This interrupt is not shared so no need to return IRQ_NONE. 103 103 */ 104 - dev_err_ratelimited(sdev->dev, 105 - "error: nothing to do in IRQ thread\n"); 104 + dev_dbg_ratelimited(sdev->dev, 105 + "nothing to do in IPC IRQ thread\n"); 106 106 } 107 107 108 108 /* re-enable IPC interrupt */
+2 -2
sound/soc/sof/intel/hda-ipc.c
··· 224 224 /* 225 225 * This interrupt is not shared so no need to return IRQ_NONE. 226 226 */ 227 - dev_err_ratelimited(sdev->dev, 228 - "error: nothing to do in IRQ thread\n"); 227 + dev_dbg_ratelimited(sdev->dev, 228 + "nothing to do in IPC IRQ thread\n"); 229 229 } 230 230 231 231 /* re-enable IPC interrupt */
+36 -10
sound/soc/ti/davinci-mcasp.c
··· 196 196 { 197 197 u32 bit; 198 198 199 - for_each_set_bit(bit, &mcasp->pdir, PIN_BIT_AFSR) { 199 + for_each_set_bit(bit, &mcasp->pdir, PIN_BIT_AMUTE) { 200 200 if (enable) 201 201 mcasp_set_bits(mcasp, DAVINCI_MCASP_PDIR_REG, BIT(bit)); 202 202 else ··· 224 224 if (mcasp_is_synchronous(mcasp)) { 225 225 mcasp_set_ctl_reg(mcasp, DAVINCI_MCASP_GBLCTLX_REG, TXHCLKRST); 226 226 mcasp_set_ctl_reg(mcasp, DAVINCI_MCASP_GBLCTLX_REG, TXCLKRST); 227 + mcasp_set_clk_pdir(mcasp, true); 227 228 } 228 229 229 230 /* Activate serializer(s) */ ··· 1264 1263 return ret; 1265 1264 } 1266 1265 1266 + static int davinci_mcasp_hw_rule_slot_width(struct snd_pcm_hw_params *params, 1267 + struct snd_pcm_hw_rule *rule) 1268 + { 1269 + struct davinci_mcasp_ruledata *rd = rule->private; 1270 + struct snd_mask *fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT); 1271 + struct snd_mask nfmt; 1272 + int i, slot_width; 1273 + 1274 + snd_mask_none(&nfmt); 1275 + slot_width = rd->mcasp->slot_width; 1276 + 1277 + for (i = 0; i <= SNDRV_PCM_FORMAT_LAST; i++) { 1278 + if (snd_mask_test(fmt, i)) { 1279 + if (snd_pcm_format_width(i) <= slot_width) { 1280 + snd_mask_set(&nfmt, i); 1281 + } 1282 + } 1283 + } 1284 + 1285 + return snd_mask_refine(fmt, &nfmt); 1286 + } 1287 + 1267 1288 static const unsigned int davinci_mcasp_dai_rates[] = { 1268 1289 8000, 11025, 16000, 22050, 32000, 44100, 48000, 64000, 1269 1290 88200, 96000, 176400, 192000, ··· 1407 1384 struct davinci_mcasp_ruledata *ruledata = 1408 1385 &mcasp->ruledata[substream->stream]; 1409 1386 u32 max_channels = 0; 1410 - int i, dir; 1387 + int i, dir, ret; 1411 1388 int tdm_slots = mcasp->tdm_slots; 1412 1389 1413 1390 /* Do not allow more then one stream per direction */ ··· 1436 1413 max_channels++; 1437 1414 } 1438 1415 ruledata->serializers = max_channels; 1416 + ruledata->mcasp = mcasp; 1439 1417 max_channels *= tdm_slots; 1440 1418 /* 1441 1419 * If the already active stream has less channels than the calculated ··· 1463 1439 0, SNDRV_PCM_HW_PARAM_CHANNELS, 1464 1440 &mcasp->chconstr[substream->stream]); 1465 1441 1466 - if (mcasp->slot_width) 1467 - snd_pcm_hw_constraint_minmax(substream->runtime, 1468 - SNDRV_PCM_HW_PARAM_SAMPLE_BITS, 1469 - 8, mcasp->slot_width); 1442 + if (mcasp->slot_width) { 1443 + /* Only allow formats require <= slot_width bits on the bus */ 1444 + ret = snd_pcm_hw_rule_add(substream->runtime, 0, 1445 + SNDRV_PCM_HW_PARAM_FORMAT, 1446 + davinci_mcasp_hw_rule_slot_width, 1447 + ruledata, 1448 + SNDRV_PCM_HW_PARAM_FORMAT, -1); 1449 + if (ret) 1450 + return ret; 1451 + } 1470 1452 1471 1453 /* 1472 1454 * If we rely on implicit BCLK divider setting we should 1473 1455 * set constraints based on what we can provide. 1474 1456 */ 1475 1457 if (mcasp->bclk_master && mcasp->bclk_div == 0 && mcasp->sysclk_freq) { 1476 - int ret; 1477 - 1478 - ruledata->mcasp = mcasp; 1479 - 1480 1458 ret = snd_pcm_hw_rule_add(substream->runtime, 0, 1481 1459 SNDRV_PCM_HW_PARAM_RATE, 1482 1460 davinci_mcasp_hw_rule_rate,