mirror of
https://github.com/torvalds/linux.git
synced 2026-05-22 22:22:08 +02:00
ASoC: cs35l56: Set access permissions on volatile
Merge series from Richard Fitzgerald <rf@opensource.cirrus.com>: The CAL_SET_STATUS and CAL_DATA_RB controls are volatile and read-only, but the existing ASoC macros to define controls don't allow setting access permissions, so those controls were marked as non-volatile read/write. These four patches fix that. The first two patches add two new control macros to soc.h. I really don't like codec drivers open-coding a kcontrol_new content for a control that will be managed by the ASoC info/get/put handlers. If a new type of ASoC control definition is needed it's better to have it in soc.h so all the dependencies between ASoC and the kcontrol_new content are in one place.
This commit is contained in:
commit
172e221802
|
|
@ -319,6 +319,13 @@ struct platform_device;
|
|||
#define SOC_VALUE_ENUM_EXT(xname, xenum, xhandler_get, xhandler_put) \
|
||||
SOC_ENUM_EXT(xname, xenum, xhandler_get, xhandler_put)
|
||||
|
||||
#define SOC_ENUM_EXT_ACC(xname, xenum, xhandler_get, xhandler_put, xaccess) \
|
||||
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
|
||||
.access = xaccess, \
|
||||
.info = snd_soc_info_enum_double, \
|
||||
.get = xhandler_get, .put = xhandler_put, \
|
||||
.private_value = (unsigned long)&xenum }
|
||||
|
||||
#define SND_SOC_BYTES(xname, xbase, xregs) \
|
||||
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
|
||||
.info = snd_soc_bytes_info, .get = snd_soc_bytes_get, \
|
||||
|
|
@ -331,6 +338,13 @@ struct platform_device;
|
|||
.put = xhandler_put, .private_value = \
|
||||
((unsigned long)&(struct soc_bytes) \
|
||||
{.base = xbase, .num_regs = xregs }) }
|
||||
#define SND_SOC_BYTES_E_ACC(xname, xbase, xregs, xhandler_get, xhandler_put, xaccess) \
|
||||
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
|
||||
.access = xaccess, \
|
||||
.info = snd_soc_bytes_info, .get = xhandler_get, \
|
||||
.put = xhandler_put, .private_value = \
|
||||
((unsigned long)&(struct soc_bytes) \
|
||||
{.base = xbase, .num_regs = xregs }) }
|
||||
|
||||
#define SND_SOC_BYTES_MASK(xname, xbase, xregs, xmask) \
|
||||
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
|
||||
|
|
|
|||
|
|
@ -95,8 +95,9 @@ static const struct snd_kcontrol_new cs35l56_controls[] = {
|
|||
SOC_SINGLE_EXT("Posture Number", CS35L56_MAIN_POSTURE_NUMBER,
|
||||
0, 255, 0,
|
||||
cs35l56_dspwait_get_volsw, cs35l56_dspwait_put_volsw),
|
||||
SOC_ENUM_EXT("CAL_SET_STATUS", cs35l56_cal_set_status_enum,
|
||||
cs35l56_cal_set_status_ctl_get, NULL),
|
||||
SOC_ENUM_EXT_ACC("CAL_SET_STATUS", cs35l56_cal_set_status_enum,
|
||||
cs35l56_cal_set_status_ctl_get, NULL,
|
||||
SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE),
|
||||
};
|
||||
|
||||
static const struct snd_kcontrol_new cs35l63_controls[] = {
|
||||
|
|
@ -116,8 +117,9 @@ static const struct snd_kcontrol_new cs35l63_controls[] = {
|
|||
SOC_SINGLE_EXT("Posture Number", CS35L63_MAIN_POSTURE_NUMBER,
|
||||
0, 255, 0,
|
||||
cs35l56_dspwait_get_volsw, cs35l56_dspwait_put_volsw),
|
||||
SOC_ENUM_EXT("CAL_SET_STATUS", cs35l56_cal_set_status_enum,
|
||||
cs35l56_cal_set_status_ctl_get, NULL),
|
||||
SOC_ENUM_EXT_ACC("CAL_SET_STATUS", cs35l56_cal_set_status_enum,
|
||||
cs35l56_cal_set_status_ctl_get, NULL,
|
||||
SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE),
|
||||
};
|
||||
|
||||
static SOC_VALUE_ENUM_SINGLE_DECL(cs35l56_asp1tx1_enum,
|
||||
|
|
@ -1097,8 +1099,9 @@ static int cs35l56_cal_data_ctl_set(struct snd_kcontrol *kcontrol,
|
|||
static const struct snd_kcontrol_new cs35l56_cal_data_restore_controls[] = {
|
||||
SND_SOC_BYTES_E("CAL_DATA", 0, sizeof(struct cirrus_amp_cal_data) / sizeof(u32),
|
||||
cs35l56_cal_data_ctl_get, cs35l56_cal_data_ctl_set),
|
||||
SND_SOC_BYTES_E("CAL_DATA_RB", 0, sizeof(struct cirrus_amp_cal_data) / sizeof(u32),
|
||||
cs35l56_cal_data_rb_ctl_get, NULL),
|
||||
SND_SOC_BYTES_E_ACC("CAL_DATA_RB", 0, sizeof(struct cirrus_amp_cal_data) / sizeof(u32),
|
||||
cs35l56_cal_data_rb_ctl_get, NULL,
|
||||
SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE),
|
||||
};
|
||||
|
||||
static int cs35l56_set_fw_suffix(struct cs35l56_private *cs35l56)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user