stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org,
	Charles Keepax <ckeepax@opensource.wolfsonmicro.com>,
	Brian Austin <brian.austin@cirrus.com>,
	Mark Brown <broonie@kernel.org>
Subject: [PATCH 4.2 028/110] ASoC: Add info callback for SX_TLV controls
Date: Fri,  6 Nov 2015 11:18:35 -0800	[thread overview]
Message-ID: <20151106191704.650726649@linuxfoundation.org> (raw)
In-Reply-To: <20151106191703.247930828@linuxfoundation.org>

4.2-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>

commit 34198710f55b5f359f43e67d9a08fe5aadfbca1b upstream.

SX_TLV controls are intended for situations where the register behind
the control has some non-zero value indicating the minimum gain
and then gains increasing from there and eventually overflowing through
zero.

Currently every CODEC implementing these controls specifies the minimum
as the non-zero value for the minimum and the maximum as the number of
gain settings available.

This means when the info callback subtracts the minimum value from the
maximum value to calculate the number of gain levels available it is
actually under reporting the available levels. This patch fixes this
issue by adding a new snd_soc_info_volsw_sx callback that does not
subtract the minimum value.

Fixes: 1d99f2436d0d ("ASoC: core: Rework SOC_DOUBLE_R_SX_TLV add SOC_SINGLE_SX_TLV")
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Acked-by: Brian Austin <brian.austin@cirrus.com>
Tested-by: Brian Austin <brian.austin@cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 include/sound/soc.h |    6 ++++--
 sound/soc/soc-ops.c |   28 ++++++++++++++++++++++++++++
 2 files changed, 32 insertions(+), 2 deletions(-)

--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -86,7 +86,7 @@
 	.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
 	SNDRV_CTL_ELEM_ACCESS_READWRITE, \
 	.tlv.p  = (tlv_array),\
-	.info = snd_soc_info_volsw, \
+	.info = snd_soc_info_volsw_sx, \
 	.get = snd_soc_get_volsw_sx,\
 	.put = snd_soc_put_volsw_sx, \
 	.private_value = (unsigned long)&(struct soc_mixer_control) \
@@ -156,7 +156,7 @@
 	.access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
 	SNDRV_CTL_ELEM_ACCESS_READWRITE, \
 	.tlv.p  = (tlv_array), \
-	.info = snd_soc_info_volsw, \
+	.info = snd_soc_info_volsw_sx, \
 	.get = snd_soc_get_volsw_sx, \
 	.put = snd_soc_put_volsw_sx, \
 	.private_value = (unsigned long)&(struct soc_mixer_control) \
@@ -573,6 +573,8 @@ int snd_soc_put_enum_double(struct snd_k
 	struct snd_ctl_elem_value *ucontrol);
 int snd_soc_info_volsw(struct snd_kcontrol *kcontrol,
 	struct snd_ctl_elem_info *uinfo);
+int snd_soc_info_volsw_sx(struct snd_kcontrol *kcontrol,
+			  struct snd_ctl_elem_info *uinfo);
 #define snd_soc_info_bool_ext		snd_ctl_boolean_mono_info
 int snd_soc_get_volsw(struct snd_kcontrol *kcontrol,
 	struct snd_ctl_elem_value *ucontrol);
--- a/sound/soc/soc-ops.c
+++ b/sound/soc/soc-ops.c
@@ -207,6 +207,34 @@ int snd_soc_info_volsw(struct snd_kcontr
 EXPORT_SYMBOL_GPL(snd_soc_info_volsw);
 
 /**
+ * snd_soc_info_volsw_sx - Mixer info callback for SX TLV controls
+ * @kcontrol: mixer control
+ * @uinfo: control element information
+ *
+ * Callback to provide information about a single mixer control, or a double
+ * mixer control that spans 2 registers of the SX TLV type. SX TLV controls
+ * have a range that represents both positive and negative values either side
+ * of zero but without a sign bit.
+ *
+ * Returns 0 for success.
+ */
+int snd_soc_info_volsw_sx(struct snd_kcontrol *kcontrol,
+			  struct snd_ctl_elem_info *uinfo)
+{
+	struct soc_mixer_control *mc =
+		(struct soc_mixer_control *)kcontrol->private_value;
+
+	snd_soc_info_volsw(kcontrol, uinfo);
+	/* Max represents the number of levels in an SX control not the
+	 * maximum value, so add the minimum value back on
+	 */
+	uinfo->value.integer.max += mc->min;
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(snd_soc_info_volsw_sx);
+
+/**
  * snd_soc_get_volsw - single mixer get callback
  * @kcontrol: mixer control
  * @ucontrol: control element information



  parent reply	other threads:[~2015-11-06 19:18 UTC|newest]

Thread overview: 113+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-06 19:18 [PATCH 4.2 000/110] 4.2.6-stable review Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 001/110] mac80211: Fix hwflags debugfs file format Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 002/110] ath9k: declare required extra tx headroom Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 003/110] mmc: core: Fix init_card in 52Mhz Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 004/110] iwlwifi: dvm: fix D3 firmware PN programming Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 005/110] iwlwifi: fix firmware filename for 3160 Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 006/110] rtlwifi: rtl8821ae: Fix system lockups on boot Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 007/110] iwlwifi: mvm: clear csa countdown when AP is stopped Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 008/110] iwlwifi: mvm: fix D3 CCMP TX PN assignment Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 009/110] iwlwifi: mvm: fix D3 firmware PN programming Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 010/110] iwlwifi: mvm: init card correctly on ctkill exit check Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 011/110] iwlwifi: mvm: flush fw_dump_wk when mvm fails to start Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 012/110] iwlwifi: pci: add a few more PCI subvendor IDs for the 7265 series Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 013/110] iommu/vt-d: fix range computation when making room for large pages Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 014/110] iommu/amd: Fix BUG when faulting a PROT_NONE VMA Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 015/110] iommu/amd: Dont clear DTE flags when modifying it Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 016/110] powerpc/rtas: Validate rtas.entry before calling enter_rtas() Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 017/110] drm: fix mutex leak in drm_dp_get_mst_branch_device Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 018/110] drm: Correct arguments to list_tail_add in create blob ioctl Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 019/110] drm: crtc: integer overflow in drm_property_create_blob() Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 020/110] [media] m88ds3103: use own reg update_bits() implementation Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 021/110] [media] si2157: Bounds check firmware Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 022/110] [media] si2168: " Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 023/110] [media] rtl28xxu: fix control message flaws Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 024/110] KVM: arm: use GIC support unconditionally Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 025/110] ALSA: hdac: Explicitly add io.h Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 026/110] ALSA: hda - Fix inverted internal mic on Lenovo G50-80 Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 027/110] ALSA: hda - Fix deadlock at error in building PCM Greg Kroah-Hartman
2015-11-06 19:18 ` Greg Kroah-Hartman [this message]
2015-11-06 19:18 ` [PATCH 4.2 029/110] ASoC: wm8904: Correct number of EQ registers Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 031/110] x86/setup: Extend low identity map to cover whole kernel range Greg Kroah-Hartman
2015-11-06 19:33   ` Borislav Petkov
2015-11-06 19:48     ` Greg Kroah-Hartman
2015-11-13  9:20       ` Borislav Petkov
2015-12-07  7:29         ` Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 032/110] x86/ioapic: Prevent NULL pointer dereference in setup_ioapic_dest() Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 033/110] mm: make sendfile(2) killable Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 034/110] fault-inject: fix inverted interval/probability values in printk Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 035/110] tracing: Have stack tracer force RCU to be watching Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 036/110] bus: arm-ccn: Fix irq affinity setting on CPU migration Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 037/110] drm/nouveau/gem: return only valid domain when theres only one Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 038/110] drm/radeon/dpm: dont add pwm attributes if DPM is disabled Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 039/110] drm/amdgpu: add missing dpm check for KV dpm late init Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 043/110] drm/radeon: dont try to recreate sysfs entries on resume Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 044/110] drm/amdgpu: " Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 048/110] iio: st_accel: fix interrupt handling on LIS3LV02 Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 049/110] iio: accel: sca3000: memory corruption in sca3000_read_first_n_hw_rb() Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 050/110] rbd: require stable pages if message data CRCs are enabled Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 051/110] rbd: dont leak parent_spec in rbd_dev_probe_parent() Greg Kroah-Hartman
2015-11-06 19:18 ` [PATCH 4.2 052/110] rbd: prevent kernel stack blow up on rbd map Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 053/110] ARM: EXYNOS: Fix double of_node_put() when parsing child power domains Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 054/110] ARM: orion: Fix DSA platform device after mvmdio conversion Greg Kroah-Hartman
2015-11-06 19:32   ` Florian Fainelli
2015-11-06 19:19 ` [PATCH 4.2 055/110] ARM: mvebu: correct a385-db-ap compatible string Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 056/110] ARM: dts: berlin: change BG2Qs USB PHY compatible Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 057/110] ARM: dts: Fix audio card detection on Peach boards Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 058/110] ARM: dts: imx7d: Fix UART2 base address Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 059/110] ARM: dts: am57xx-beagle-x15: set VDD_SD to always-on Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 060/110] ARM: ux500: modify initial levelshifter status Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 061/110] ARM: OMAP1: fix incorrect INT_DMA_LCD Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 062/110] ARM: 8445/1: fix vdsomunge not to depend on glibc specific byteswap.h Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 063/110] ARM: 8449/1: fix bug in vdsomunge swab32 macro Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 064/110] Revert "ARM64: unwind: Fix PC calculation" Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 065/110] arm64: kernel: fix tcr_el1.t0sz restore on systems with extended idmap Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 066/110] block: dont release bdi while request_queue has live references Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 067/110] dm btree remove: fix a bug when rebalancing nodes after removal Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 068/110] dm cache: the CLEAN_SHUTDOWN flag was not being set Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 069/110] dm btree: fix leak of bufio-backed block in btree_split_beneath error path Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 070/110] nvme: fix 32-bit build warning Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 071/110] Revert "serial: 8250_dma: dont bother DMA with small transfers" Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 073/110] i2c: mv64xxx: really allow I2C offloading Greg Kroah-Hartman
2015-11-07 16:26   ` Ben Hutchings
2015-11-06 19:19 ` [PATCH 4.2 074/110] clkdev: fix clk_add_alias() with a NULL alias device name Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 075/110] fbcon: initialize blink interval before calling fb_set_par Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 076/110] xhci: handle no ping response error properly Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 077/110] xhci: Add spurious wakeup quirk for LynxPoint-LP controllers Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 078/110] xen-blkfront: check for null drvdata in blkback_changed (XenbusStateClosing) Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 079/110] module: Fix locking in symbol_put_addr() Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 080/110] PCI: Prevent out of bounds access in numa_node override Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 081/110] ovl: free stack of paths in ovl_fill_super Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 082/110] ovl: free lower_mnt array in ovl_put_super Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 083/110] ovl: use O_LARGEFILE in ovl_copy_up() Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 084/110] ovl: fix dentry reference leak Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 085/110] ovl: fix open in stacked overlay Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 087/110] crypto: api - Only abort operations on fatal signal Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 088/110] md/raid1: submit_bio_wait() returns 0 on success Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 089/110] md/raid10: " Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 090/110] md/raid5: fix locking in handle_stripe_clean_event() Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 091/110] Revert "md: allow a partially recovered device to be hot-added to an array." Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 092/110] EDAC, sb_edac: Fix TAD presence check for sbridge_mci_bind_devs() Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 093/110] irqchip/tegra: Propagate IRQ type setting to parent Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 095/110] netfilter: ipset: Fix sleeping memory allocation in atomic context Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 096/110] btrfs: fix possible leak in btrfs_ioctl_balance() Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 097/110] kvm: irqchip: fix memory leak Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 098/110] thermal: exynos: Fix register read in TMU Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 099/110] um: Fix kernel mode fault condition Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 100/110] blk-mq: fix use-after-free in blk_mq_free_tag_set() Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 101/110] IB/cm: Fix rb-tree duplicate free and use-after-free Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 102/110] sched/deadline: Fix migration of SCHED_DEADLINE tasks Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 103/110] cpufreq: intel_pstate: Fix divide by zero on Knights Landing (KNL) Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 104/110] arm64: compat: fix stxr failure case in SWP emulation Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 105/110] NVMe: Fix memory leak on retried commands Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 106/110] drm/vmwgfx: Fix up user_dmabuf refcounting Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 107/110] thp: use is_zero_pfn() only after pte_present() check Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 108/110] pinctrl: baytrail: Serialize all register access Greg Kroah-Hartman
2015-11-08  9:38   ` Ben Hutchings
2015-11-06 19:19 ` [PATCH 4.2 109/110] pinctrl: baytrail: Use raw_spinlock for locking Greg Kroah-Hartman
2015-11-06 19:19 ` [PATCH 4.2 110/110] xen: fix backport of previous kexec patch Greg Kroah-Hartman
2015-11-07  1:45 ` [PATCH 4.2 000/110] 4.2.6-stable review Guenter Roeck
2015-11-07  2:44   ` Greg Kroah-Hartman
2015-11-07  2:53 ` Shuah Khan
2015-11-07  3:00   ` Greg Kroah-Hartman
2015-11-09  9:27 ` Sudip Mukherjee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151106191704.650726649@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=brian.austin@cirrus.com \
    --cc=broonie@kernel.org \
    --cc=ckeepax@opensource.wolfsonmicro.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).