Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 38d18978 authored by Bhalchandra Gajare's avatar Bhalchandra Gajare Committed by Phani Kumar Uppalapati
Browse files

ASoC: wcd-spi: handle WDSP_EVENT_GETOPS in the event handler



Add functionality to handle the WDSP_EVENT_GETOPS event and provide
the required operations to the manager driver. This is helpful for
manager or other components to call into the operations to request
functionality from this component.

Change-Id: I49232e11cbfca89f6ff8ac711c12ae6a39dcbd00
Signed-off-by: default avatarBhalchandra Gajare <gajare@codeaurora.org>
parent 6c1fed3a
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2016, The Linux Foundation. All rights reserved.
 * Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -54,4 +54,10 @@ int wcd_spi_data_read(struct spi_device *spi, struct wcd_spi_msg *msg)

#endif /* End of CONFIG_SND_SOC_WCD_SPI */

struct wcd_spi_ops {
	struct spi_device *spi_dev;
	int (*read_dev)(struct spi_device *spi, struct wcd_spi_msg *msg);
	int (*write_dev)(struct spi_device *spi, struct wcd_spi_msg *msg);
};

#endif /* End of __WCD_SPI_H__ */
+15 −0
Original line number Diff line number Diff line
@@ -925,6 +925,7 @@ static int wdsp_spi_event_handler(struct device *dev, void *priv_data,
{
	struct spi_device *spi = to_spi_device(dev);
	struct wcd_spi_priv *wcd_spi = spi_get_drvdata(spi);
	struct wcd_spi_ops *spi_ops;
	int ret = 0;

	dev_dbg(&spi->dev, "%s: event type %d\n",
@@ -979,6 +980,20 @@ static int wdsp_spi_event_handler(struct device *dev, void *priv_data,
		ret = wcd_spi_wait_for_resume(wcd_spi);
		break;

	case WDSP_EVENT_GET_DEVOPS:
		if (!data) {
			dev_err(&spi->dev, "%s: invalid data\n",
				__func__);
			ret = -EINVAL;
			break;
		}

		spi_ops = (struct wcd_spi_ops *) data;
		spi_ops->spi_dev = spi;
		spi_ops->read_dev = wcd_spi_data_read;
		spi_ops->write_dev = wcd_spi_data_write;
		break;

	default:
		dev_dbg(&spi->dev, "%s: Unhandled event %d\n",
			__func__, event);