Skip to content

Commit 1b72943

Browse files
crojewsk-intelbroonie
authored andcommitted
ASoC: Intel: avs: L1SEN reference counted
Code loading is not the only procedure that manipulates L1SEN. Update existing mechanism so the stream starting procedure can interfere with L1SEN without causing any trouble to its other users. Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com> Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com> Link: https://msgid.link/r/20240220115035.770402-2-cezary.rojewski@intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent b401b62 commit 1b72943

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

sound/soc/intel/avs/avs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ struct avs_dev {
127127
int *core_refs; /* reference count per core */
128128
char **lib_names;
129129
int num_lp_paths;
130+
atomic_t l1sen_counter; /* controls whether L1SEN should be disabled */
130131

131132
struct completion fw_ready;
132133
struct work_struct probe_work;

sound/soc/intel/avs/core.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,14 @@ void avs_hda_clock_gating_enable(struct avs_dev *adev, bool enable)
6969

7070
void avs_hda_l1sen_enable(struct avs_dev *adev, bool enable)
7171
{
72-
u32 value = enable ? AZX_VS_EM2_L1SEN : 0;
73-
74-
snd_hdac_chip_updatel(&adev->base.core, VS_EM2, AZX_VS_EM2_L1SEN, value);
72+
if (enable) {
73+
if (atomic_inc_and_test(&adev->l1sen_counter))
74+
snd_hdac_chip_updatel(&adev->base.core, VS_EM2, AZX_VS_EM2_L1SEN,
75+
AZX_VS_EM2_L1SEN);
76+
} else {
77+
if (atomic_dec_return(&adev->l1sen_counter) == -1)
78+
snd_hdac_chip_updatel(&adev->base.core, VS_EM2, AZX_VS_EM2_L1SEN, 0);
79+
}
7580
}
7681

7782
static int avs_hdac_bus_init_streams(struct hdac_bus *bus)

0 commit comments

Comments
 (0)