ITE drivers/sensor/vcmp: don't connect shared irq multiple times
This driver exectue connecting the shared irq one time for every status "okay" vcmp nodes, then it will show enable the same irq multiple times when build. So I check whether the irq is enabled or not, if yes, we needn't to enable again. And we will figure out the triggered channel in vcmp_it8xxx2_isr(). Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
This commit is contained in:
parent
5d51fbc8cb
commit
199eaac0a4
@ -42,8 +42,6 @@ struct vcmp_it8xxx2_config {
|
||||
volatile uint8_t *reg_vcmpsts2;
|
||||
/* Voltage comparator module irq */
|
||||
int irq;
|
||||
/* Voltage comparator module irq config function */
|
||||
void (*irq_cfg_func)(void);
|
||||
/* Voltage comparator channel */
|
||||
int vcmp_ch;
|
||||
/* Scan period for "all voltage comparator channel" */
|
||||
@ -322,11 +320,20 @@ static int vcmp_it8xxx2_init(const struct device *dev)
|
||||
vcmp_ite_it8xxx2_attr_set(dev, SENSOR_CHAN_VOLTAGE, attr, &val);
|
||||
}
|
||||
|
||||
ite_intc_isr_clear(config->irq);
|
||||
/*
|
||||
* All voltage comparator channels share one irq interrupt,
|
||||
* so if the irq is enabled before, we needn't to enable again.
|
||||
* And we will figure out the triggered channel in vcmp_it8xxx2_isr().
|
||||
*/
|
||||
if (!irq_is_enabled(config->irq)) {
|
||||
ite_intc_isr_clear(config->irq);
|
||||
|
||||
config->irq_cfg_func();
|
||||
irq_connect_dynamic(config->irq, 0,
|
||||
(void (*)(const void *))vcmp_it8xxx2_isr,
|
||||
(const void *)dev, 0);
|
||||
|
||||
irq_enable(config->irq);
|
||||
irq_enable(config->irq);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -338,15 +345,6 @@ static const struct sensor_driver_api vcmp_ite_it8xxx2_api = {
|
||||
};
|
||||
|
||||
#define VCMP_IT8XXX2_INIT(inst) \
|
||||
static void vcmp_it8xxx2_irq_cfg_func_##inst(void) \
|
||||
{ \
|
||||
IRQ_CONNECT(DT_INST_IRQN(inst), \
|
||||
0, \
|
||||
vcmp_it8xxx2_isr, \
|
||||
DEVICE_DT_INST_GET(inst), \
|
||||
0); \
|
||||
} \
|
||||
\
|
||||
static const struct vcmp_it8xxx2_config vcmp_it8xxx2_cfg_##inst = { \
|
||||
.reg_vcmpxctl = (uint8_t *)DT_INST_REG_ADDR_BY_IDX(inst, 0), \
|
||||
.reg_vcmpxcselm = (uint8_t *)DT_INST_REG_ADDR_BY_IDX(inst, 1), \
|
||||
@ -356,7 +354,6 @@ static const struct sensor_driver_api vcmp_ite_it8xxx2_api = {
|
||||
.reg_vcmpsts = (uint8_t *)DT_INST_REG_ADDR_BY_IDX(inst, 5), \
|
||||
.reg_vcmpsts2 = (uint8_t *)DT_INST_REG_ADDR_BY_IDX(inst, 6), \
|
||||
.irq = DT_INST_IRQN(inst), \
|
||||
.irq_cfg_func = vcmp_it8xxx2_irq_cfg_func_##inst, \
|
||||
.vcmp_ch = DT_INST_PROP(inst, vcmp_ch), \
|
||||
.scan_period = DT_INST_PROP(inst, scan_period), \
|
||||
.comparison = DT_INST_PROP(inst, comparison), \
|
||||
|
||||
Loading…
Reference in New Issue
Block a user