14
14
15
15
LOG_MODULE_REGISTER (dac_renesas_ra , CONFIG_DAC_LOG_LEVEL );
16
16
17
+ #define HAS_CHARGEPUMP DT_PROP(DT_PARENT(DT_DRV_INST(0)), has_chargepump)
18
+ #define HAS_OUTPUT_AMPLIFIER DT_PROP(DT_PARENT(DT_DRV_INST(0)), has_output_amplifier)
19
+ #define HAS_INTERNAL_OUTPUT DT_PROP(DT_PARENT(DT_DRV_INST(0)), has_internal_output)
20
+
17
21
struct dac_renesas_ra_config {
18
22
const struct pinctrl_dev_config * pcfg ;
19
23
};
@@ -46,7 +50,9 @@ static int dac_renesas_ra_channel_setup(const struct device *dev,
46
50
const struct dac_channel_cfg * channel_cfg )
47
51
{
48
52
struct dac_renesas_ra_data * data = dev -> data ;
53
+ #if (HAS_OUTPUT_AMPLIFIER || HAS_CHARGEPUMP || HAS_INTERNAL_OUTPUT )
49
54
dac_extended_cfg_t * config_extend = (dac_extended_cfg_t * )data -> f_config .p_extend ;
55
+ #endif
50
56
fsp_err_t fsp_err ;
51
57
52
58
if (channel_cfg -> channel_id != 0 ) {
@@ -66,9 +72,9 @@ static int dac_renesas_ra_channel_setup(const struct device *dev,
66
72
}
67
73
}
68
74
69
- #if DT_PROP ( DT_PARENT ( DT_DRV_INST ( 0 )), has_output_amplifier )
75
+ #if HAS_OUTPUT_AMPLIFIER
70
76
config_extend -> output_amplifier_enabled = channel_cfg -> buffered ;
71
- #elif DT_PROP ( DT_PARENT ( DT_DRV_INST ( 0 )), has_chargepump )
77
+ #elif HAS_CHARGEPUMP
72
78
#if DT_NODE_HAS_STATUS_OKAY (DT_NODELABEL (moco ))
73
79
config_extend -> enable_charge_pump = channel_cfg -> buffered ;
74
80
#else
@@ -84,7 +90,7 @@ static int dac_renesas_ra_channel_setup(const struct device *dev,
84
90
}
85
91
#endif
86
92
87
- #if DT_PROP ( DT_PARENT ( DT_DRV_INST ( 0 )), has_internal_output )
93
+ #if HAS_INTERNAL_OUTPUT
88
94
config_extend -> internal_output_enabled = channel_cfg -> internal ;
89
95
#else
90
96
if (channel_cfg -> internal ) {
0 commit comments