/* * mix.c * * Copyright (c) 2015 Kuninori Morimoto * * 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 "rsnd.h" #define MIX_NAME_SIZE 16 #define MIX_NAME "mix" struct rsnd_mix { struct rsnd_mod mod; }; #define rsnd_mix_get(priv, id) ((struct rsnd_mix *)(priv->mix) + id) #define rsnd_mix_nr(priv) ((priv)->mix_nr) #define for_each_rsnd_mix(pos, priv, i) \ for ((i) = 0; \ ((i) < rsnd_mix_nr(priv)) && \ ((pos) = (struct rsnd_mix *)(priv)->mix + i); \ i++) static void rsnd_mix_activation(struct rsnd_mod *mod) { rsnd_mod_write(mod, MIX_SWRSR, 0); rsnd_mod_write(mod, MIX_SWRSR, 1); } static void rsnd_mix_halt(struct rsnd_mod *mod) { rsnd_mod_write(mod, MIX_MIXIR, 1); rsnd_mod_write(mod, MIX_SWRSR, 0); } static void rsnd_mix_volume_parameter(struct rsnd_dai_stream *io, struct rsnd_mod *mod) { rsnd_mod_write(mod, MIX_MDBAR, 0); rsnd_mod_write(mod, MIX_MDBBR, 0); rsnd_mod_write(mod, MIX_MDBCR, 0); rsnd_mod_write(mod, MIX_MDBDR, 0); } static void rsnd_mix_volume_init(struct rsnd_dai_stream *io, struct rsnd_mod *mod) { rsnd_mod_write(mod, MIX_MIXIR, 1); /* General Information */ rsnd_mod_write(mod, MIX_ADINR, rsnd_runtime_channel_after_ctu(io)); /* volume step */ rsnd_mod_write(mod, MIX_MIXMR, 0); rsnd_mod_write(mod, MIX_MVPDR, 0); /* common volume parameter */ rsnd_mix_volume_parameter(io, mod); rsnd_mod_write(mod, MIX_MIXIR, 0); } static void rsnd_mix_volume_update(struct rsnd_dai_stream *io, struct rsnd_mod *mod) { /* Disable MIX dB setting */ rsnd_mod_write(mod, MIX_MDBER, 0); /* common volume parameter */ rsnd_mix_volume_parameter(io, mod); /* Enable MIX dB setting */ rsnd_mod_write(mod, MIX_MDBER, 1); } static int rsnd_mix_probe_(struct rsnd_mod *mod, struct rsnd_dai_stream *io, struct rsnd_priv *priv) { return rsnd_cmd_attach(io, rsnd_mod_id(mod)); } static int rsnd_mix_init(struct rsnd_mod *mod, struct rsnd_dai_stream *io, struct rsnd_priv *priv) { rsnd_mod_power_on(mod); rsnd_mix_activation(mod); rsnd_mix_volume_init(io, mod); rsnd_mix_volume_update(io, mod); return 0; } static int rsnd_mix_quit(struct rsnd_mod *mod, struct rsnd_dai_stream *io, struct rsnd_priv *priv) { rsnd_mix_halt(mod); rsnd_mod_power_off(mod); return 0; } static struct rsnd_mod_ops rsnd_mix_ops = { .name = MIX_NAME, .probe = rsnd_mix_probe_, .init = rsnd_mix_init, .quit = rsnd_mix_quit, }; struct rsnd_mod *rsnd_mix_mod_get(struct rsnd_priv *priv, int id) { if (WARN_ON(id < 0 || id >= rsnd_mix_nr(priv))) id = 0; return rsnd_mod_get(rsnd_mix_get(priv, id)); } int rsnd_mix_probe(struct rsnd_priv *priv) { struct device_node *node; struct device_node *np; struct device *dev = rsnd_priv_to_dev(priv); struct rsnd_mix *mix; struct clk *clk; char name[MIX_NAME_SIZE]; int i, nr, ret; /* This driver doesn't support Gen1 at this point */ if (rsnd_is_gen1(priv)) return 0; node = rsnd_mix_of_node(priv); if (!node) return 0; /* not used is not error */ nr = of_get_child_count(node); if (!nr) { ret = -EINVAL; goto rsnd_mix_probe_done; } mix = devm_kzalloc(dev, sizeof(*mix) * nr, GFP_KERNEL); if (!mix) { ret = -ENOMEM; goto rsnd_mix_probe_done; } priv->mix_nr = nr; priv->mix = mix; i = 0; ret = 0; for_each_child_of_node(node, np) { mix = rsnd_mix_get(priv, i); snprintf(name, MIX_NAME_SIZE, "%s.%d", MIX_NAME, i); clk = devm_clk_get(dev, name); if (IS_ERR(clk)) { ret = PTR_ERR(clk); goto rsnd_mix_probe_done; } ret = rsnd_mod_init(priv, rsnd_mod_get(mix), &rsnd_mix_ops, clk, rsnd_mod_get_status, RSND_MOD_MIX, i); if (ret) goto rsnd_mix_probe_done; i++; } rsnd_mix_probe_done: of_node_put(node); return ret; } void rsnd_mix_remove(struct rsnd_priv *priv) { struct rsnd_mix *mix; int i; for_each_rsnd_mix(mix, priv, i) { rsnd_mod_quit(rsnd_mod_get(mix)); } } >space:mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-01-27 12:54:16 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2017-01-27 12:54:16 -0800
commit1b1bc42c1692e9b62756323c675a44cb1a1f9dbd (patch)
treed514a2d8512fc52c15747841e2368f8f99a50787 /sound/soc/dwc/Makefile
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/soc/dwc/Makefile')