Skip to content

Commit 6fd524c

Browse files
Nicolas FrattaroliYuryNorov
authored andcommitted
drm/rockchip: inno-hdmi: switch to FIELD_PREP_WM16 macro
The era of hand-rolled HIWORD_UPDATE macros is over, at least for those drivers that use constant masks. The inno-hdmi driver's own HIWORD_UPDATE macro is instantiated only twice. Remove it, and replace its uses with FIELD_PREP_WM16. Since FIELD_PREP_WM16 shifts the value for us, we replace using the mask as the value by simply using 1 instead. With the new FIELD_PREP_WM16 macro, we gain better error checking and a central shared definition. This has been compile-tested only as I lack hardware this old, but the change is trivial enough that I am fairly certain it's equivalent. Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com> Reviewed-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Yury Norov (NVIDIA) <yury.norov@gmail.com>
1 parent ad24f6e commit 6fd524c

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

drivers/gpu/drm/rockchip/inno_hdmi.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <linux/delay.h>
1111
#include <linux/err.h>
1212
#include <linux/hdmi.h>
13+
#include <linux/hw_bitfield.h>
1314
#include <linux/mfd/syscon.h>
1415
#include <linux/mod_devicetable.h>
1516
#include <linux/module.h>
@@ -382,8 +383,6 @@ enum {
382383
#define HDMI_CEC_BUSFREETIME_H 0xdd
383384
#define HDMI_CEC_LOGICADDR 0xde
384385

385-
#define HIWORD_UPDATE(val, mask) ((val) | (mask) << 16)
386-
387386
#define RK3036_GRF_SOC_CON2 0x148
388387
#define RK3036_HDMI_PHSYNC BIT(4)
389388
#define RK3036_HDMI_PVSYNC BIT(5)
@@ -756,10 +755,10 @@ static int inno_hdmi_config_video_timing(struct inno_hdmi *hdmi,
756755
int value, psync;
757756

758757
if (hdmi->variant->dev_type == RK3036_HDMI) {
759-
psync = mode->flags & DRM_MODE_FLAG_PHSYNC ? RK3036_HDMI_PHSYNC : 0;
760-
value = HIWORD_UPDATE(psync, RK3036_HDMI_PHSYNC);
761-
psync = mode->flags & DRM_MODE_FLAG_PVSYNC ? RK3036_HDMI_PVSYNC : 0;
762-
value |= HIWORD_UPDATE(psync, RK3036_HDMI_PVSYNC);
758+
psync = mode->flags & DRM_MODE_FLAG_PHSYNC ? 1 : 0;
759+
value = FIELD_PREP_WM16(RK3036_HDMI_PHSYNC, psync);
760+
psync = mode->flags & DRM_MODE_FLAG_PVSYNC ? 1 : 0;
761+
value |= FIELD_PREP_WM16(RK3036_HDMI_PVSYNC, psync);
763762
regmap_write(hdmi->grf, RK3036_GRF_SOC_CON2, value);
764763
}
765764

0 commit comments

Comments
 (0)