Unverified Commit aeaf27ec authored by Maciej Strozek's avatar Maciej Strozek Committed by Mark Brown
Browse files

ASoC: SDCA: Add FDL-specific IRQ processing

parent 71f7990a
Loading
Loading
Loading
Loading
+34 −0
Original line number Diff line number Diff line
@@ -18,8 +18,10 @@
#include <linux/soundwire/sdw.h>
#include <linux/soundwire/sdw_registers.h>
#include <sound/sdca.h>
#include <sound/sdca_fdl.h>
#include <sound/sdca_function.h>
#include <sound/sdca_interrupts.h>
#include <sound/sdca_ump.h>
#include <sound/soc-component.h>
#include <sound/soc.h>

@@ -245,6 +247,29 @@ static irqreturn_t detected_mode_handler(int irq, void *data)
	return irqret;
}

static irqreturn_t fdl_owner_handler(int irq, void *data)
{
	struct sdca_interrupt *interrupt = data;
	struct device *dev = interrupt->dev;
	irqreturn_t irqret = IRQ_NONE;
	int ret;

	ret = pm_runtime_get_sync(dev);
	if (ret < 0) {
		dev_err(dev, "failed to resume for fdl: %d\n", ret);
		goto error;
	}

	ret = sdca_fdl_process(interrupt);
	if (ret)
		goto error;

	irqret = IRQ_HANDLED;
error:
	pm_runtime_put(dev);
	return irqret;
}

static int sdca_irq_request_locked(struct device *dev,
				   struct sdca_interrupt_info *info,
				   int sdca_irq, const char *name,
@@ -423,6 +448,15 @@ int sdca_irq_populate(struct sdca_function_data *function,
				if (control->sel == SDCA_CTL_GE_DETECTED_MODE)
					handler = detected_mode_handler;
				break;
			case SDCA_ENTITY_TYPE_XU:
				if (control->sel == SDCA_CTL_XU_FDL_CURRENTOWNER) {
					ret = sdca_fdl_alloc_state(interrupt);
					if (ret)
						return ret;

					handler = fdl_owner_handler;
				}
				break;
			default:
				break;
			}