qcom-pdc.c (58f7553fa424fd0fd74e8b796d50c66014cebebe) | qcom-pdc.c (2f5fbc4305d07725bfebaedb09e57271315691ef) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved. 4 */ 5 6#include <linux/err.h> 7#include <linux/init.h> 8#include <linux/interrupt.h> --- 145 unchanged lines hidden (view full) --- 154 * takes care of converting falling edge to rising edge signal 155 * If @type is level, then forward that as level high as PDC 156 * takes care of converting falling edge to rising edge signal 157 */ 158static int qcom_pdc_gic_set_type(struct irq_data *d, unsigned int type) 159{ 160 int pin_out = d->hwirq; 161 enum pdc_irq_config_bits pdc_type; | 1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved. 4 */ 5 6#include <linux/err.h> 7#include <linux/init.h> 8#include <linux/interrupt.h> --- 145 unchanged lines hidden (view full) --- 154 * takes care of converting falling edge to rising edge signal 155 * If @type is level, then forward that as level high as PDC 156 * takes care of converting falling edge to rising edge signal 157 */ 158static int qcom_pdc_gic_set_type(struct irq_data *d, unsigned int type) 159{ 160 int pin_out = d->hwirq; 161 enum pdc_irq_config_bits pdc_type; |
162 enum pdc_irq_config_bits old_pdc_type; 163 int ret; |
|
162 163 if (pin_out == GPIO_NO_WAKE_IRQ) 164 return 0; 165 166 switch (type) { 167 case IRQ_TYPE_EDGE_RISING: 168 pdc_type = PDC_EDGE_RISING; 169 break; --- 12 unchanged lines hidden (view full) --- 182 pdc_type = PDC_LEVEL_LOW; 183 type = IRQ_TYPE_LEVEL_HIGH; 184 break; 185 default: 186 WARN_ON(1); 187 return -EINVAL; 188 } 189 | 164 165 if (pin_out == GPIO_NO_WAKE_IRQ) 166 return 0; 167 168 switch (type) { 169 case IRQ_TYPE_EDGE_RISING: 170 pdc_type = PDC_EDGE_RISING; 171 break; --- 12 unchanged lines hidden (view full) --- 184 pdc_type = PDC_LEVEL_LOW; 185 type = IRQ_TYPE_LEVEL_HIGH; 186 break; 187 default: 188 WARN_ON(1); 189 return -EINVAL; 190 } 191 |
192 old_pdc_type = pdc_reg_read(IRQ_i_CFG, pin_out); |
|
190 pdc_reg_write(IRQ_i_CFG, pin_out, pdc_type); 191 | 193 pdc_reg_write(IRQ_i_CFG, pin_out, pdc_type); 194 |
192 return irq_chip_set_type_parent(d, type); | 195 ret = irq_chip_set_type_parent(d, type); 196 if (ret) 197 return ret; 198 199 /* 200 * When we change types the PDC can give a phantom interrupt. 201 * Clear it. Specifically the phantom shows up when reconfiguring 202 * polarity of interrupt without changing the state of the signal 203 * but let's be consistent and clear it always. 204 * 205 * Doing this works because we have IRQCHIP_SET_TYPE_MASKED so the 206 * interrupt will be cleared before the rest of the system sees it. 207 */ 208 if (old_pdc_type != pdc_type) 209 irq_chip_set_parent_state(d, IRQCHIP_STATE_PENDING, false); 210 211 return 0; |
193} 194 195static struct irq_chip qcom_pdc_gic_chip = { 196 .name = "PDC", 197 .irq_eoi = irq_chip_eoi_parent, 198 .irq_mask = qcom_pdc_gic_mask, 199 .irq_unmask = qcom_pdc_gic_unmask, 200 .irq_disable = qcom_pdc_gic_disable, --- 243 unchanged lines hidden --- | 212} 213 214static struct irq_chip qcom_pdc_gic_chip = { 215 .name = "PDC", 216 .irq_eoi = irq_chip_eoi_parent, 217 .irq_mask = qcom_pdc_gic_mask, 218 .irq_unmask = qcom_pdc_gic_unmask, 219 .irq_disable = qcom_pdc_gic_disable, --- 243 unchanged lines hidden --- |