Loading drivers/soc/qcom/glink_spi_xprt.c +16 −17 Original line number Diff line number Diff line Loading @@ -111,7 +111,7 @@ struct glink_cmpnt { * @xprt_cfg: The transport configuration for the glink core * assocaited with this edge. * @subsys_name: Name of the remote subsystem in the edge. * @spi_dev: Pointer to the connectingSPI Device. * @spi_ops: Function pointers for ops provided by spi. * @fifo_size: Size of the FIFO at the remote end. * @tx_fifo_start: Base Address of the TX FIFO. * @tx_fifo_end: End Address of the TX FIFO. Loading Loading @@ -147,7 +147,7 @@ struct edge_info { struct glink_transport_if xprt_if; struct glink_core_transport_cfg xprt_cfg; char subsys_name[GLINK_NAME_SIZE]; struct spi_device *spi_dev; struct wcd_spi_ops spi_ops; uint32_t fifo_size; uint32_t tx_fifo_start; Loading Loading @@ -286,11 +286,14 @@ static int glink_spi_xprt_rx_data(struct edge_info *einfo, void *src, { struct wcd_spi_msg spi_msg; if (unlikely(!einfo->spi_ops.read_dev)) return -EINVAL; memset(&spi_msg, 0, sizeof(spi_msg)); spi_msg.data = dst; spi_msg.remote_addr = (uint32_t)(size_t)src; spi_msg.len = (size_t)size; return wcd_spi_data_read(einfo->spi_dev, &spi_msg); return einfo->spi_ops.read_dev(einfo->spi_ops.spi_dev, &spi_msg); } /** Loading @@ -310,11 +313,14 @@ static int glink_spi_xprt_tx_data(struct edge_info *einfo, void *src, { struct wcd_spi_msg spi_msg; if (unlikely(!einfo->spi_ops.write_dev)) return -EINVAL; memset(&spi_msg, 0, sizeof(spi_msg)); spi_msg.data = src; spi_msg.remote_addr = (uint32_t)(size_t)dst; spi_msg.len = (size_t)size; return wcd_spi_data_write(einfo->spi_dev, &spi_msg); return einfo->spi_ops.write_dev(einfo->spi_ops.spi_dev, &spi_msg); } /** Loading Loading @@ -1796,28 +1802,21 @@ static int glink_wdsp_cmpnt_event_handler(struct device *dev, { struct edge_info *einfo = dev_get_drvdata(dev); struct glink_cmpnt *cmpnt = &einfo->cmpnt; struct device *sdev; struct spi_device *spi_dev; int rc = -EINVAL; switch (event) { case WDSP_EVENT_PRE_BOOTUP: if (cmpnt && cmpnt->master_dev && cmpnt->master_ops && cmpnt->master_ops->get_dev_for_cmpnt) sdev = cmpnt->master_ops->get_dev_for_cmpnt( cmpnt->master_dev, WDSP_CMPNT_TRANSPORT); else sdev = NULL; cmpnt->master_ops->get_devops_for_cmpnt) rc = cmpnt->master_ops->get_devops_for_cmpnt( cmpnt->master_dev, WDSP_CMPNT_TRANSPORT, &einfo->spi_ops); if (!sdev) { if (rc) dev_err(dev, "%s: Failed to get transport device\n", __func__); break; } spi_dev = to_spi_device(sdev); einfo->spi_dev = spi_dev; break; case WDSP_EVENT_POST_BOOTUP: einfo->in_ssr = false; synchronize_srcu(&einfo->use_ref); Loading include/sound/wcd-dsp-mgr.h +8 −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 Loading Loading @@ -63,6 +63,9 @@ enum wdsp_event_type { /* Suspend/Resume related */ WDSP_EVENT_SUSPEND, WDSP_EVENT_RESUME, /* Misc */ WDSP_EVENT_GET_DEVOPS }; enum wdsp_signal { Loading Loading @@ -109,6 +112,8 @@ struct wdsp_err_signal_arg { * their own ops to manager driver * @get_dev_for_cmpnt: components can use this to get handle * to struct device * of any other component * @get_devops_for_cmpnt: components can use this to get ops * from other related components. * @signal_handler: callback to notify manager driver that signal * has occurred. Cannot be called from interrupt * context as this can sleep Loading @@ -126,6 +131,8 @@ struct wdsp_mgr_ops { struct wdsp_cmpnt_ops *ops); struct device *(*get_dev_for_cmpnt)(struct device *wdsp_dev, enum wdsp_cmpnt_type type); int (*get_devops_for_cmpnt)(struct device *wdsp_dev, enum wdsp_cmpnt_type type, void *data); int (*signal_handler)(struct device *wdsp_dev, enum wdsp_signal signal, void *arg); int (*vote_for_dsp)(struct device *wdsp_dev, bool vote); Loading include/sound/wcd-spi.h +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 Loading Loading @@ -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__ */ sound/soc/codecs/wcd-dsp-mgr.c +20 −0 Original line number Diff line number Diff line Loading @@ -610,6 +610,25 @@ static struct device *wdsp_get_dev_for_cmpnt(struct device *wdsp_dev, return cmpnt->cdev; } static int wdsp_get_devops_for_cmpnt(struct device *wdsp_dev, enum wdsp_cmpnt_type type, void *data) { struct wdsp_mgr_priv *wdsp; int ret = 0; if (!wdsp_dev || type >= WDSP_CMPNT_TYPE_MAX) return -EINVAL; wdsp = dev_get_drvdata(wdsp_dev); ret = wdsp_unicast_event(wdsp, type, WDSP_EVENT_GET_DEVOPS, data); if (ret) WDSP_ERR(wdsp, "get_dev_ops failed for cmpnt type %d", type); return ret; } static void wdsp_collect_ramdumps(struct wdsp_mgr_priv *wdsp) { struct wdsp_img_section img_section; Loading Loading @@ -941,6 +960,7 @@ static int wdsp_resume(struct device *wdsp_dev) static struct wdsp_mgr_ops wdsp_ops = { .register_cmpnt_ops = wdsp_register_cmpnt_ops, .get_dev_for_cmpnt = wdsp_get_dev_for_cmpnt, .get_devops_for_cmpnt = wdsp_get_devops_for_cmpnt, .signal_handler = wdsp_signal_handler, .vote_for_dsp = wdsp_vote_for_dsp, .suspend = wdsp_suspend, Loading sound/soc/codecs/wcd-spi.c +15 −0 Original line number Diff line number Diff line Loading @@ -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", Loading Loading @@ -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); Loading Loading
drivers/soc/qcom/glink_spi_xprt.c +16 −17 Original line number Diff line number Diff line Loading @@ -111,7 +111,7 @@ struct glink_cmpnt { * @xprt_cfg: The transport configuration for the glink core * assocaited with this edge. * @subsys_name: Name of the remote subsystem in the edge. * @spi_dev: Pointer to the connectingSPI Device. * @spi_ops: Function pointers for ops provided by spi. * @fifo_size: Size of the FIFO at the remote end. * @tx_fifo_start: Base Address of the TX FIFO. * @tx_fifo_end: End Address of the TX FIFO. Loading Loading @@ -147,7 +147,7 @@ struct edge_info { struct glink_transport_if xprt_if; struct glink_core_transport_cfg xprt_cfg; char subsys_name[GLINK_NAME_SIZE]; struct spi_device *spi_dev; struct wcd_spi_ops spi_ops; uint32_t fifo_size; uint32_t tx_fifo_start; Loading Loading @@ -286,11 +286,14 @@ static int glink_spi_xprt_rx_data(struct edge_info *einfo, void *src, { struct wcd_spi_msg spi_msg; if (unlikely(!einfo->spi_ops.read_dev)) return -EINVAL; memset(&spi_msg, 0, sizeof(spi_msg)); spi_msg.data = dst; spi_msg.remote_addr = (uint32_t)(size_t)src; spi_msg.len = (size_t)size; return wcd_spi_data_read(einfo->spi_dev, &spi_msg); return einfo->spi_ops.read_dev(einfo->spi_ops.spi_dev, &spi_msg); } /** Loading @@ -310,11 +313,14 @@ static int glink_spi_xprt_tx_data(struct edge_info *einfo, void *src, { struct wcd_spi_msg spi_msg; if (unlikely(!einfo->spi_ops.write_dev)) return -EINVAL; memset(&spi_msg, 0, sizeof(spi_msg)); spi_msg.data = src; spi_msg.remote_addr = (uint32_t)(size_t)dst; spi_msg.len = (size_t)size; return wcd_spi_data_write(einfo->spi_dev, &spi_msg); return einfo->spi_ops.write_dev(einfo->spi_ops.spi_dev, &spi_msg); } /** Loading Loading @@ -1796,28 +1802,21 @@ static int glink_wdsp_cmpnt_event_handler(struct device *dev, { struct edge_info *einfo = dev_get_drvdata(dev); struct glink_cmpnt *cmpnt = &einfo->cmpnt; struct device *sdev; struct spi_device *spi_dev; int rc = -EINVAL; switch (event) { case WDSP_EVENT_PRE_BOOTUP: if (cmpnt && cmpnt->master_dev && cmpnt->master_ops && cmpnt->master_ops->get_dev_for_cmpnt) sdev = cmpnt->master_ops->get_dev_for_cmpnt( cmpnt->master_dev, WDSP_CMPNT_TRANSPORT); else sdev = NULL; cmpnt->master_ops->get_devops_for_cmpnt) rc = cmpnt->master_ops->get_devops_for_cmpnt( cmpnt->master_dev, WDSP_CMPNT_TRANSPORT, &einfo->spi_ops); if (!sdev) { if (rc) dev_err(dev, "%s: Failed to get transport device\n", __func__); break; } spi_dev = to_spi_device(sdev); einfo->spi_dev = spi_dev; break; case WDSP_EVENT_POST_BOOTUP: einfo->in_ssr = false; synchronize_srcu(&einfo->use_ref); Loading
include/sound/wcd-dsp-mgr.h +8 −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 Loading Loading @@ -63,6 +63,9 @@ enum wdsp_event_type { /* Suspend/Resume related */ WDSP_EVENT_SUSPEND, WDSP_EVENT_RESUME, /* Misc */ WDSP_EVENT_GET_DEVOPS }; enum wdsp_signal { Loading Loading @@ -109,6 +112,8 @@ struct wdsp_err_signal_arg { * their own ops to manager driver * @get_dev_for_cmpnt: components can use this to get handle * to struct device * of any other component * @get_devops_for_cmpnt: components can use this to get ops * from other related components. * @signal_handler: callback to notify manager driver that signal * has occurred. Cannot be called from interrupt * context as this can sleep Loading @@ -126,6 +131,8 @@ struct wdsp_mgr_ops { struct wdsp_cmpnt_ops *ops); struct device *(*get_dev_for_cmpnt)(struct device *wdsp_dev, enum wdsp_cmpnt_type type); int (*get_devops_for_cmpnt)(struct device *wdsp_dev, enum wdsp_cmpnt_type type, void *data); int (*signal_handler)(struct device *wdsp_dev, enum wdsp_signal signal, void *arg); int (*vote_for_dsp)(struct device *wdsp_dev, bool vote); Loading
include/sound/wcd-spi.h +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 Loading Loading @@ -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__ */
sound/soc/codecs/wcd-dsp-mgr.c +20 −0 Original line number Diff line number Diff line Loading @@ -610,6 +610,25 @@ static struct device *wdsp_get_dev_for_cmpnt(struct device *wdsp_dev, return cmpnt->cdev; } static int wdsp_get_devops_for_cmpnt(struct device *wdsp_dev, enum wdsp_cmpnt_type type, void *data) { struct wdsp_mgr_priv *wdsp; int ret = 0; if (!wdsp_dev || type >= WDSP_CMPNT_TYPE_MAX) return -EINVAL; wdsp = dev_get_drvdata(wdsp_dev); ret = wdsp_unicast_event(wdsp, type, WDSP_EVENT_GET_DEVOPS, data); if (ret) WDSP_ERR(wdsp, "get_dev_ops failed for cmpnt type %d", type); return ret; } static void wdsp_collect_ramdumps(struct wdsp_mgr_priv *wdsp) { struct wdsp_img_section img_section; Loading Loading @@ -941,6 +960,7 @@ static int wdsp_resume(struct device *wdsp_dev) static struct wdsp_mgr_ops wdsp_ops = { .register_cmpnt_ops = wdsp_register_cmpnt_ops, .get_dev_for_cmpnt = wdsp_get_dev_for_cmpnt, .get_devops_for_cmpnt = wdsp_get_devops_for_cmpnt, .signal_handler = wdsp_signal_handler, .vote_for_dsp = wdsp_vote_for_dsp, .suspend = wdsp_suspend, Loading
sound/soc/codecs/wcd-spi.c +15 −0 Original line number Diff line number Diff line Loading @@ -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", Loading Loading @@ -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); Loading