/* * ALSA SoC driver for * Asahi Kasei AK5386 Single-ended 24-Bit 192kHz delta-sigma ADC * * (c) 2013 Daniel Mack * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #include #include #include #include #include #include #include #include #include static const char * const supply_names[] = { "va", "vd" }; struct ak5386_priv { int reset_gpio; struct regulator_bulk_data supplies[ARRAY_SIZE(supply_names)]; }; static const struct snd_soc_dapm_widget ak5386_dapm_widgets[] = { SND_SOC_DAPM_INPUT("AINL"), SND_SOC_DAPM_INPUT("AINR"), }; static const struct snd_soc_dapm_route ak5386_dapm_routes[] = { { "Capture", NULL, "AINL" }, { "Capture", NULL, "AINR" }, }; static int ak5386_soc_probe(struct snd_soc_codec *codec) { struct ak5386_priv *priv = snd_soc_codec_get_drvdata(codec); return regulator_bulk_enable(ARRAY_SIZE(priv->supplies), priv->supplies); } static int ak5386_soc_remove(struct snd_soc_codec *codec) { struct ak5386_priv *priv = snd_soc_codec_get_drvdata(codec); regulator_bulk_disable(ARRAY_SIZE(priv->supplies), priv->supplies); return 0; } #ifdef CONFIG_PM static int ak5386_soc_suspend(struct snd_soc_codec *codec) { struct ak5386_priv *priv = snd_soc_codec_get_drvdata(codec); regulator_bulk_disable(ARRAY_SIZE(priv->supplies), priv->supplies); return 0; } static int ak5386_soc_resume(struct snd_soc_codec *codec) { struct ak5386_priv *priv = snd_soc_codec_get_drvdata(codec); return regulator_bulk_enable(ARRAY_SIZE(priv->supplies), priv->supplies); } #else #define ak5386_soc_suspend NULL #define ak5386_soc_resume NULL #endif /* CONFIG_PM */ static struct snd_soc_codec_driver soc_codec_ak5386 = { .probe = ak5386_soc_probe, .remove = ak5386_soc_remove, .suspend = ak5386_soc_suspend, .resume = ak5386_soc_resume, .component_driver = { .dapm_widgets = ak5386_dapm_widgets, .num_dapm_widgets = ARRAY_SIZE(ak5386_dapm_widgets), .dapm_routes = ak5386_dapm_routes, .num_dapm_routes = ARRAY_SIZE(ak5386_dapm_routes), }, }; static int ak5386_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int format) { struct snd_soc_codec *codec = codec_dai->codec; format &= SND_SOC_DAIFMT_FORMAT_MASK; if (format != SND_SOC_DAIFMT_LEFT_J && format != SND_SOC_DAIFMT_I2S) { dev_err(codec->dev, "Invalid DAI format\n"); return -EINVAL; } return 0; } static int ak5386_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) { struct snd_soc_codec *codec = dai->codec; struct ak5386_priv *priv = snd_soc_codec_get_drvdata(codec); /* * From the datasheet: * * All external clocks (MCLK, SCLK and LRCK) must be present unless * PDN pin = ā€œLā€. If these clocks are not provided, the AK5386 may * draw excess current due to its use of internal dynamically * refreshed logic. If the external clocks are not present, place * the AK5386 in power-down mode (PDN pin = ā€œLā€). */ if (gpio_is_valid(priv->reset_gpio)) gpio_set_value(priv->reset_gpio, 1); return 0; } static int ak5386_hw_free(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { struct snd_soc_codec *codec = dai->codec; struct ak5386_priv *priv = snd_soc_codec_get_drvdata(codec); if (gpio_is_valid(priv->reset_gpio)) gpio_set_value(priv->reset_gpio, 0); return 0; } static const struct snd_soc_dai_ops ak5386_dai_ops = { .set_fmt = ak5386_set_dai_fmt, .hw_params = ak5386_hw_params, .hw_free = ak5386_hw_free, }; static struct snd_soc_dai_driver ak5386_dai = { .name = "ak5386-hifi", .capture = { .stream_name = "Capture", .channels_min = 1, .channels_max = 2, .rates = SNDRV_PCM_RATE_8000_192000, .formats = SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S24_3LE, }, .ops = &ak5386_dai_ops, }; #ifdef CONFIG_OF static const struct of_device_id ak5386_dt_ids[] = { { .compatible = "asahi-kasei,ak5386", }, { } }; MODULE_DEVICE_TABLE(of, ak5386_dt_ids); #endif static int ak5386_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct ak5386_priv *priv; int ret, i; priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); if (!priv) return -ENOMEM; priv->reset_gpio = -EINVAL; dev_set_drvdata(dev, priv); for (i = 0; i < ARRAY_SIZE(supply_names); i++) priv->supplies[i].supply = supply_names[i]; ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(priv->supplies), priv->supplies); if (ret < 0) return ret; if (of_match_device(of_match_ptr(ak5386_dt_ids), dev)) priv->reset_gpio = of_get_named_gpio(dev->of_node, "reset-gpio", 0); if (gpio_is_valid(priv->reset_gpio)) if (devm_gpio_request_one(dev, priv->reset_gpio, GPIOF_OUT_INIT_LOW, "AK5386 Reset")) priv->reset_gpio = -EINVAL; return snd_soc_register_codec(dev, &soc_codec_ak5386, &ak5386_dai, 1); } static int ak5386_remove(struct platform_device *pdev) { snd_soc_unregister_codec(&pdev->dev); return 0; } static struct platform_driver ak5386_driver = { .probe = ak5386_probe, .remove = ak5386_remove, .driver = { .name = "ak5386", .of_match_table = of_match_ptr(ak5386_dt_ids), }, }; module_platform_driver(ak5386_driver); MODULE_DESCRIPTION("ASoC driver for AK5386 ADC"); MODULE_AUTHOR("Daniel Mack "); MODULE_LICENSE("GPL"); ) treed514a2d8512fc52c15747841e2368f8f99a50787 /sound/pci/lola/lola.h parent3365135d43f861003555c963b309672d053a2228 (diff)parent950eabbd6ddedc1b08350b9169a6a51b130ebaaf (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: 1) GTP fixes from Andreas Schultz (missing genl module alias, clear IP DF on transmit). 2) Netfilter needs to reflect the fwmark when sending resets, from Pau Espin Pedrol. 3) nftable dump OOPS fix from Liping Zhang. 4) Fix erroneous setting of VIRTIO_NET_HDR_F_DATA_VALID on transmit, from Rolf Neugebauer. 5) Fix build error of ipt_CLUSTERIP when procfs is disabled, from Arnd Bergmann. 6) Fix regression in handling of NETIF_F_SG in harmonize_features(), from Eric Dumazet. 7) Fix RTNL deadlock wrt. lwtunnel module loading, from David Ahern. 8) tcp_fastopen_create_child() needs to setup tp->max_window, from Alexey Kodanev. 9) Missing kmemdup() failure check in ipv6 segment routing code, from Eric Dumazet. 10) Don't execute unix_bind() under the bindlock, otherwise we deadlock with splice. From WANG Cong. 11) ip6_tnl_parse_tlv_enc_lim() potentially reallocates the skb buffer, therefore callers must reload cached header pointers into that skb. Fix from Eric Dumazet. 12) Fix various bugs in legacy IRQ fallback handling in alx driver, from Tobias Regnery. 13) Do not allow lwtunnel drivers to be unloaded while they are referenced by active instances, from Robert Shearman. 14) Fix truncated PHY LED trigger names, from Geert Uytterhoeven. 15) Fix a few regressions from virtio_net XDP support, from John Fastabend and Jakub Kicinski. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (102 commits) ISDN: eicon: silence misleading array-bounds warning net: phy: micrel: add support for KSZ8795 gtp: fix cross netns recv on gtp socket gtp: clear DF bit on GTP packet tx gtp: add genl family modules alias tcp: don't annotate mark on control socket from tcp_v6_send_response() ravb: unmap descriptors when freeing rings virtio_net: reject XDP programs using header adjustment virtio_net: use dev_kfree_skb for small buffer XDP receive r8152: check rx after napi is enabled r8152: re-schedule napi for tx r8152: avoid start_xmit to schedule napi when napi is disabled r8152: avoid start_xmit to call napi_schedule during autosuspend net: dsa: Bring back device detaching in dsa_slave_suspend() net: phy: leds: Fix truncated LED trigger names net: phy: leds: Break dependency of phy.h on phy_led_triggers.h net: phy: leds: Clear phy_num_led_triggers on failure to avoid crash net-next: ethernet: mediatek: change the compatible string Documentation: devicetree: change the mediatek ethernet compatible string bnxt_en: Fix RTNL lock usage on bnxt_get_port_module_status(). ...
Diffstat (limited to 'sound/pci/lola/lola.h')