drm/xe/i2c: Wire up reset/postinstall for I2C IRQ

I2C IRQ needs to be routed to SGUnit or PUnit for the devices that support
it. Wire up reset/postinstall handles for I2C IRQ to take care of this.

Signed-off-by: Raag Jadav <raag.jadav@intel.com>
Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20251011123509.3233213-3-raag.jadav@intel.com
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
This commit is contained in:
Raag Jadav 2025-10-11 18:05:09 +05:30 committed by Lucas De Marchi
parent 3df5aacb9d
commit 0bb78ce099
4 changed files with 30 additions and 0 deletions

View File

@ -14,6 +14,9 @@
#define REG_SG_REMAP_ADDR_PREFIX XE_REG(SOC_BASE + 0x0164) #define REG_SG_REMAP_ADDR_PREFIX XE_REG(SOC_BASE + 0x0164)
#define REG_SG_REMAP_ADDR_POSTFIX XE_REG(SOC_BASE + 0x0168) #define REG_SG_REMAP_ADDR_POSTFIX XE_REG(SOC_BASE + 0x0168)
#define I2C_BRIDGE_PCICFGCTL XE_REG(I2C_BRIDGE_OFFSET + 0x200)
#define ACPI_INTR_EN REG_BIT(1)
#define I2C_CONFIG_CMD XE_REG(I2C_CONFIG_SPACE_OFFSET + PCI_COMMAND) #define I2C_CONFIG_CMD XE_REG(I2C_CONFIG_SPACE_OFFSET + PCI_COMMAND)
#define I2C_CONFIG_PMCSR XE_REG(I2C_CONFIG_SPACE_OFFSET + 0x84) #define I2C_CONFIG_PMCSR XE_REG(I2C_CONFIG_SPACE_OFFSET + 0x84)

View File

@ -182,6 +182,26 @@ void xe_i2c_irq_handler(struct xe_device *xe, u32 master_ctl)
generic_handle_irq_safe(xe->i2c->adapter_irq); generic_handle_irq_safe(xe->i2c->adapter_irq);
} }
void xe_i2c_irq_reset(struct xe_device *xe)
{
struct xe_mmio *mmio = xe_root_tile_mmio(xe);
if (!xe_i2c_irq_present(xe))
return;
xe_mmio_rmw32(mmio, I2C_BRIDGE_PCICFGCTL, ACPI_INTR_EN, 0);
}
void xe_i2c_irq_postinstall(struct xe_device *xe)
{
struct xe_mmio *mmio = xe_root_tile_mmio(xe);
if (!xe_i2c_irq_present(xe))
return;
xe_mmio_rmw32(mmio, I2C_BRIDGE_PCICFGCTL, 0, ACPI_INTR_EN);
}
static int xe_i2c_irq_map(struct irq_domain *h, unsigned int virq, static int xe_i2c_irq_map(struct irq_domain *h, unsigned int virq,
irq_hw_number_t hw_irq_num) irq_hw_number_t hw_irq_num)
{ {
@ -339,6 +359,7 @@ int xe_i2c_probe(struct xe_device *xe)
if (ret) if (ret)
goto err_remove_irq; goto err_remove_irq;
xe_i2c_irq_postinstall(xe);
return devm_add_action_or_reset(drm_dev, xe_i2c_remove, i2c); return devm_add_action_or_reset(drm_dev, xe_i2c_remove, i2c);
err_remove_irq: err_remove_irq:

View File

@ -51,12 +51,16 @@ struct xe_i2c {
int xe_i2c_probe(struct xe_device *xe); int xe_i2c_probe(struct xe_device *xe);
bool xe_i2c_present(struct xe_device *xe); bool xe_i2c_present(struct xe_device *xe);
void xe_i2c_irq_handler(struct xe_device *xe, u32 master_ctl); void xe_i2c_irq_handler(struct xe_device *xe, u32 master_ctl);
void xe_i2c_irq_postinstall(struct xe_device *xe);
void xe_i2c_irq_reset(struct xe_device *xe);
void xe_i2c_pm_suspend(struct xe_device *xe); void xe_i2c_pm_suspend(struct xe_device *xe);
void xe_i2c_pm_resume(struct xe_device *xe, bool d3cold); void xe_i2c_pm_resume(struct xe_device *xe, bool d3cold);
#else #else
static inline int xe_i2c_probe(struct xe_device *xe) { return 0; } static inline int xe_i2c_probe(struct xe_device *xe) { return 0; }
static inline bool xe_i2c_present(struct xe_device *xe) { return false; } static inline bool xe_i2c_present(struct xe_device *xe) { return false; }
static inline void xe_i2c_irq_handler(struct xe_device *xe, u32 master_ctl) { } static inline void xe_i2c_irq_handler(struct xe_device *xe, u32 master_ctl) { }
static inline void xe_i2c_irq_postinstall(struct xe_device *xe) { }
static inline void xe_i2c_irq_reset(struct xe_device *xe) { }
static inline void xe_i2c_pm_suspend(struct xe_device *xe) { } static inline void xe_i2c_pm_suspend(struct xe_device *xe) { }
static inline void xe_i2c_pm_resume(struct xe_device *xe, bool d3cold) { } static inline void xe_i2c_pm_resume(struct xe_device *xe, bool d3cold) { }
#endif #endif

View File

@ -616,6 +616,7 @@ static void xe_irq_reset(struct xe_device *xe)
tile = xe_device_get_root_tile(xe); tile = xe_device_get_root_tile(xe);
mask_and_disable(tile, GU_MISC_IRQ_OFFSET); mask_and_disable(tile, GU_MISC_IRQ_OFFSET);
xe_display_irq_reset(xe); xe_display_irq_reset(xe);
xe_i2c_irq_reset(xe);
/* /*
* The tile's top-level status register should be the last one * The tile's top-level status register should be the last one
@ -657,6 +658,7 @@ static void xe_irq_postinstall(struct xe_device *xe)
} }
xe_display_irq_postinstall(xe, xe_root_mmio_gt(xe)); xe_display_irq_postinstall(xe, xe_root_mmio_gt(xe));
xe_i2c_irq_postinstall(xe);
/* /*
* ASLE backlight operations are reported via GUnit GSE interrupts * ASLE backlight operations are reported via GUnit GSE interrupts