Skip to content

Commit 9093598

Browse files
khoa-nguyen-18kartben
authored andcommitted
drivers: dac: Update Renesas DAC driver to support for RA4
Update Renesas DAC driver to support DAC for RA4 Signed-off-by: Khoa Nguyen <[email protected]>
1 parent 1489038 commit 9093598

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

drivers/dac/dac_renesas_ra.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414

1515
LOG_MODULE_REGISTER(dac_renesas_ra, CONFIG_DAC_LOG_LEVEL);
1616

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+
1721
struct dac_renesas_ra_config {
1822
const struct pinctrl_dev_config *pcfg;
1923
};
@@ -46,7 +50,9 @@ static int dac_renesas_ra_channel_setup(const struct device *dev,
4650
const struct dac_channel_cfg *channel_cfg)
4751
{
4852
struct dac_renesas_ra_data *data = dev->data;
53+
#if (HAS_OUTPUT_AMPLIFIER || HAS_CHARGEPUMP || HAS_INTERNAL_OUTPUT)
4954
dac_extended_cfg_t *config_extend = (dac_extended_cfg_t *)data->f_config.p_extend;
55+
#endif
5056
fsp_err_t fsp_err;
5157

5258
if (channel_cfg->channel_id != 0) {
@@ -66,9 +72,9 @@ static int dac_renesas_ra_channel_setup(const struct device *dev,
6672
}
6773
}
6874

69-
#if DT_PROP(DT_PARENT(DT_DRV_INST(0)), has_output_amplifier)
75+
#if HAS_OUTPUT_AMPLIFIER
7076
config_extend->output_amplifier_enabled = channel_cfg->buffered;
71-
#elif DT_PROP(DT_PARENT(DT_DRV_INST(0)), has_chargepump)
77+
#elif HAS_CHARGEPUMP
7278
#if DT_NODE_HAS_STATUS_OKAY(DT_NODELABEL(moco))
7379
config_extend->enable_charge_pump = channel_cfg->buffered;
7480
#else
@@ -84,7 +90,7 @@ static int dac_renesas_ra_channel_setup(const struct device *dev,
8490
}
8591
#endif
8692

87-
#if DT_PROP(DT_PARENT(DT_DRV_INST(0)), has_internal_output)
93+
#if HAS_INTERNAL_OUTPUT
8894
config_extend->internal_output_enabled = channel_cfg->internal;
8995
#else
9096
if (channel_cfg->internal) {

dts/bindings/dac/renesas,ra-dac-global.yaml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,24 @@ include: [base.yaml]
1010
properties:
1111
has-internal-output:
1212
type: boolean
13-
description: True if the SoC supports the internal output feature in the DAC HWIP
13+
description: |
14+
True if the SoC supports the "internal output" feature in the DAC HWIP.
15+
Note: If the SoC doesn't support this "internal output" features,
16+
it cannot support the "internal" feature.
1417
1518
has-output-amplifier:
1619
type: boolean
17-
description: True if the SoC supports the output amplifier feature in the DAC HWIP
20+
description: |
21+
True if the SoC supports the "output amplifier" feature in the DAC HWIP.
1822
1923
has-chargepump:
2024
type: boolean
21-
description: True if the SoC supports the chargepump feature in the DAC HWIP
25+
description: |
26+
True if the SoC supports the "chargepump" feature in the DAC HWIP.
27+
Note: If the SoC doesn't support the "output amplifier" and "charge pump" features,
28+
it cannot support the "buffer" feature.
2229
2330
has-davrefcr:
2431
type: boolean
25-
description: True if the SoC supports the D/A VREF configuration in the DAC HWIP
32+
description: |
33+
True if the SoC supports the D/A VREF configuration in the DAC HWIP.

0 commit comments

Comments
 (0)