Commit 24c86c8a authored by Claudiu Beznea's avatar Claudiu Beznea Committed by Mark Brown

ASoC: mchp-spdiftx: use FIELD_PREP() where possible

Use FIELD_PREP() in macro definitions.
Signed-off-by: default avatarClaudiu Beznea <claudiu.beznea@microchip.com>
Link: https://lore.kernel.org/r/20221213112851.89212-5-claudiu.beznea@microchip.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 404c61c4
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
// //
// Author: Codrin Ciubotariu <codrin.ciubotariu@microchip.com> // Author: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
#include <linux/bitfield.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -71,11 +72,11 @@ ...@@ -71,11 +72,11 @@
/* Valid Bits per Sample */ /* Valid Bits per Sample */
#define SPDIFTX_MR_VBPS_MASK GENMASK(13, 8) #define SPDIFTX_MR_VBPS_MASK GENMASK(13, 8)
#define SPDIFTX_MR_VBPS(bps) (((bps) << 8) & SPDIFTX_MR_VBPS_MASK) #define SPDIFTX_MR_VBPS(bps) FIELD_PREP(SPDIFTX_MR_VBPS_MASK, bps)
/* Chunk Size */ /* Chunk Size */
#define SPDIFTX_MR_CHUNK_MASK GENMASK(19, 16) #define SPDIFTX_MR_CHUNK_MASK GENMASK(19, 16)
#define SPDIFTX_MR_CHUNK(size) (((size) << 16) & SPDIFTX_MR_CHUNK_MASK) #define SPDIFTX_MR_CHUNK(size) FIELD_PREP(SPDIFTX_MR_CHUNK_MASK, size)
/* Validity Bits for Channels 1 and 2 */ /* Validity Bits for Channels 1 and 2 */
#define SPDIFTX_MR_VALID1 BIT(24) #define SPDIFTX_MR_VALID1 BIT(24)
...@@ -88,8 +89,7 @@ ...@@ -88,8 +89,7 @@
/* Bytes per Sample */ /* Bytes per Sample */
#define SPDIFTX_MR_BPS_MASK GENMASK(29, 28) #define SPDIFTX_MR_BPS_MASK GENMASK(29, 28)
#define SPDIFTX_MR_BPS(bytes) \ #define SPDIFTX_MR_BPS(bytes) FIELD_PREP(SPDIFTX_MR_BPS_MASK, (bytes - 1))
((((bytes) - 1) << 28) & SPDIFTX_MR_BPS_MASK)
/* /*
* ---- Interrupt Enable/Disable/Mask/Status Register (Write/Read-only) ---- * ---- Interrupt Enable/Disable/Mask/Status Register (Write/Read-only) ----
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment