pinctrl: cherryview: Don't use selection 0 to mark an interrupt line as unused
The selection 0 is a perfectly valid, so stop using it to have the special meaning of interrupt line not used in the intr_lines. Instead introduce a special CHV_INVALID_HWIRQ value, derived from INVALID_HWIRQ. which is never a valid selection and use that to indicate unused interrupt lines. Cc: Yauhen Kharuzhy <jekhor@gmail.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
This commit is contained in:
parent
6b4542664c
commit
bdfbef2d29
1 changed files with 16 additions and 2 deletions
|
@ -73,6 +73,8 @@ struct intel_pad_context {
|
||||||
u32 padctrl1;
|
u32 padctrl1;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define CHV_INVALID_HWIRQ ((unsigned int)INVALID_HWIRQ)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* struct intel_community_context - community context for Cherryview
|
* struct intel_community_context - community context for Cherryview
|
||||||
* @intr_lines: Mapping between 16 HW interrupt wires and GPIO offset (in GPIO number space)
|
* @intr_lines: Mapping between 16 HW interrupt wires and GPIO offset (in GPIO number space)
|
||||||
|
@ -812,7 +814,7 @@ static int chv_gpio_request_enable(struct pinctrl_dev *pctldev,
|
||||||
/* Reset the interrupt mapping */
|
/* Reset the interrupt mapping */
|
||||||
for (i = 0; i < ARRAY_SIZE(cctx->intr_lines); i++) {
|
for (i = 0; i < ARRAY_SIZE(cctx->intr_lines); i++) {
|
||||||
if (cctx->intr_lines[i] == offset) {
|
if (cctx->intr_lines[i] == offset) {
|
||||||
cctx->intr_lines[i] = 0;
|
cctx->intr_lines[i] = CHV_INVALID_HWIRQ;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1319,7 +1321,7 @@ static unsigned chv_gpio_irq_startup(struct irq_data *d)
|
||||||
else
|
else
|
||||||
handler = handle_edge_irq;
|
handler = handle_edge_irq;
|
||||||
|
|
||||||
if (!cctx->intr_lines[intsel]) {
|
if (cctx->intr_lines[intsel] == CHV_INVALID_HWIRQ) {
|
||||||
irq_set_handler_locked(d, handler);
|
irq_set_handler_locked(d, handler);
|
||||||
cctx->intr_lines[intsel] = pin;
|
cctx->intr_lines[intsel] = pin;
|
||||||
}
|
}
|
||||||
|
@ -1412,6 +1414,12 @@ static void chv_gpio_irq_handler(struct irq_desc *desc)
|
||||||
unsigned int offset;
|
unsigned int offset;
|
||||||
|
|
||||||
offset = cctx->intr_lines[intr_line];
|
offset = cctx->intr_lines[intr_line];
|
||||||
|
if (offset == CHV_INVALID_HWIRQ) {
|
||||||
|
dev_err(pctrl->dev, "interrupt on unused interrupt line %u\n",
|
||||||
|
intr_line);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
generic_handle_domain_irq(gc->irq.domain, offset);
|
generic_handle_domain_irq(gc->irq.domain, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1617,11 +1625,13 @@ static acpi_status chv_pinctrl_mmio_access_handler(u32 function,
|
||||||
static int chv_pinctrl_probe(struct platform_device *pdev)
|
static int chv_pinctrl_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
const struct intel_pinctrl_soc_data *soc_data;
|
const struct intel_pinctrl_soc_data *soc_data;
|
||||||
|
struct intel_community_context *cctx;
|
||||||
struct intel_community *community;
|
struct intel_community *community;
|
||||||
struct device *dev = &pdev->dev;
|
struct device *dev = &pdev->dev;
|
||||||
struct acpi_device *adev = ACPI_COMPANION(dev);
|
struct acpi_device *adev = ACPI_COMPANION(dev);
|
||||||
struct intel_pinctrl *pctrl;
|
struct intel_pinctrl *pctrl;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
unsigned int i;
|
||||||
int ret, irq;
|
int ret, irq;
|
||||||
|
|
||||||
soc_data = intel_pinctrl_get_soc_data(pdev);
|
soc_data = intel_pinctrl_get_soc_data(pdev);
|
||||||
|
@ -1663,6 +1673,10 @@ static int chv_pinctrl_probe(struct platform_device *pdev)
|
||||||
if (!pctrl->context.communities)
|
if (!pctrl->context.communities)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
cctx = &pctrl->context.communities[0];
|
||||||
|
for (i = 0; i < ARRAY_SIZE(cctx->intr_lines); i++)
|
||||||
|
cctx->intr_lines[i] = CHV_INVALID_HWIRQ;
|
||||||
|
|
||||||
irq = platform_get_irq(pdev, 0);
|
irq = platform_get_irq(pdev, 0);
|
||||||
if (irq < 0)
|
if (irq < 0)
|
||||||
return irq;
|
return irq;
|
||||||
|
|
Loading…
Add table
Reference in a new issue