Commit e0839f3e authored by Arnd Bergmann's avatar Arnd Bergmann
Browse files

Merge tag 'imx-drivers-5.11' of...

Merge tag 'imx-drivers-5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux into arm/drivers

i.MX drivers change for 5.11:

- A series from Daniel Baluta to update imx-dsp driver and export
  functions for on demand channel request/free.
- A number of patches to add power domains for i.MX8qxp DC0, LVDS1,
  MIPI1 and JPEG subsystems.
- Add dummy functions for i.MX firmware drivers to avoid build failure
  seen with COMPILE_TEST.

* tag 'imx-drivers-5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux:
  firmware: imx: scu-pd: Add some power domains support for i.MX8qxp MIPI1 subsystem
  firmware: imx: scu-pd: Add main power domain support for i.MX8qxp LVDS1 subsystem
  firmware: imx: scu-pd: Add video0/1 power domains support for i.MX8qxp DC0 subsystem
  firmware: imx-dsp: Export functions to request/free channels
  firmware: imx: Save channel name for further use
  firmware: imx: Introduce imx_dsp_setup_channels
  firmware: imx: scu-pd: Add power domains for imx-jpeg
  firmware: imx: add dummy functions

Link: https://lore.kernel.org/r/20201202142717.9262-1-shawnguo@kernel.org


Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
parents 2bd87914 e00e70a4
Loading
Loading
Loading
Loading
+54 −18
Original line number Diff line number Diff line
@@ -60,22 +60,40 @@ static void imx_dsp_handle_rx(struct mbox_client *c, void *msg)
	}
}

static int imx_dsp_probe(struct platform_device *pdev)
struct mbox_chan *imx_dsp_request_channel(struct imx_dsp_ipc *dsp_ipc, int idx)
{
	struct imx_dsp_chan *dsp_chan;

	if (idx >= DSP_MU_CHAN_NUM)
		return ERR_PTR(-EINVAL);

	dsp_chan = &dsp_ipc->chans[idx];
	dsp_chan->ch = mbox_request_channel_byname(&dsp_chan->cl, dsp_chan->name);
	return dsp_chan->ch;
}
EXPORT_SYMBOL(imx_dsp_request_channel);

void imx_dsp_free_channel(struct imx_dsp_ipc *dsp_ipc, int idx)
{
	struct device *dev = &pdev->dev;
	struct imx_dsp_ipc *dsp_ipc;
	struct imx_dsp_chan *dsp_chan;

	if (idx >= DSP_MU_CHAN_NUM)
		return;

	dsp_chan = &dsp_ipc->chans[idx];
	mbox_free_channel(dsp_chan->ch);
}
EXPORT_SYMBOL(imx_dsp_free_channel);

static int imx_dsp_setup_channels(struct imx_dsp_ipc *dsp_ipc)
{
	struct device *dev = dsp_ipc->dev;
	struct imx_dsp_chan *dsp_chan;
	struct mbox_client *cl;
	char *chan_name;
	int ret;
	int i, j;

	device_set_of_node_from_dev(&pdev->dev, pdev->dev.parent);

	dsp_ipc = devm_kzalloc(dev, sizeof(*dsp_ipc), GFP_KERNEL);
	if (!dsp_ipc)
		return -ENOMEM;

	for (i = 0; i < DSP_MU_CHAN_NUM; i++) {
		if (i < 2)
			chan_name = kasprintf(GFP_KERNEL, "txdb%d", i);
@@ -86,6 +104,7 @@ static int imx_dsp_probe(struct platform_device *pdev)
			return -ENOMEM;

		dsp_chan = &dsp_ipc->chans[i];
		dsp_chan->name = chan_name;
		cl = &dsp_chan->cl;
		cl->dev = dev;
		cl->tx_block = false;
@@ -104,27 +123,43 @@ static int imx_dsp_probe(struct platform_device *pdev)
		}

		dev_dbg(dev, "request mbox chan %s\n", chan_name);
		/* chan_name is not used anymore by framework */
		kfree(chan_name);
	}

	dsp_ipc->dev = dev;

	dev_set_drvdata(dev, dsp_ipc);

	dev_info(dev, "NXP i.MX DSP IPC initialized\n");

	return 0;
out:
	kfree(chan_name);
	for (j = 0; j < i; j++) {
		dsp_chan = &dsp_ipc->chans[j];
		mbox_free_channel(dsp_chan->ch);
		kfree(dsp_chan->name);
	}

	return ret;
}

static int imx_dsp_probe(struct platform_device *pdev)
{
	struct device *dev = &pdev->dev;
	struct imx_dsp_ipc *dsp_ipc;
	int ret;

	device_set_of_node_from_dev(&pdev->dev, pdev->dev.parent);

	dsp_ipc = devm_kzalloc(dev, sizeof(*dsp_ipc), GFP_KERNEL);
	if (!dsp_ipc)
		return -ENOMEM;

	dsp_ipc->dev = dev;
	dev_set_drvdata(dev, dsp_ipc);

	ret = imx_dsp_setup_channels(dsp_ipc);
	if (ret < 0)
		return ret;

	dev_info(dev, "NXP i.MX DSP IPC initialized\n");

	return 0;
}

static int imx_dsp_remove(struct platform_device *pdev)
{
	struct imx_dsp_chan *dsp_chan;
@@ -136,6 +171,7 @@ static int imx_dsp_remove(struct platform_device *pdev)
	for (i = 0; i < DSP_MU_CHAN_NUM; i++) {
		dsp_chan = &dsp_ipc->chans[i];
		mbox_free_channel(dsp_chan->ch);
		kfree(dsp_chan->name);
	}

	return 0;
+12 −0
Original line number Diff line number Diff line
@@ -160,12 +160,18 @@ static const struct imx_sc_pd_range imx8qxp_scu_pd_ranges[] = {
	{ "mipi0-pwm0", IMX_SC_R_MIPI_0_PWM_0, 1, false, 0 },
	{ "mipi0-i2c", IMX_SC_R_MIPI_0_I2C_0, 2, true, 0 },

	{ "mipi1", IMX_SC_R_MIPI_1, 1, false, 0 },
	{ "mipi1-pwm0", IMX_SC_R_MIPI_1_PWM_0, 1, false, 0 },
	{ "mipi1-i2c", IMX_SC_R_MIPI_1_I2C_0, 2, true, 0 },

	/* LVDS SS */
	{ "lvds0", IMX_SC_R_LVDS_0, 1, false, 0 },
	{ "lvds1", IMX_SC_R_LVDS_1, 1, false, 0 },

	/* DC SS */
	{ "dc0", IMX_SC_R_DC_0, 1, false, 0 },
	{ "dc0-pll", IMX_SC_R_DC_0_PLL_0, 2, true, 0 },
	{ "dc0-video", IMX_SC_R_DC_0_VIDEO0, 2, true, 0 },

	/* CM40 SS */
	{ "cm40-i2c", IMX_SC_R_M4_0_I2C, 1, false, 0 },
@@ -180,6 +186,12 @@ static const struct imx_sc_pd_range imx8qxp_scu_pd_ranges[] = {
	{ "cm41-pid", IMX_SC_R_M4_1_PID0, 5, true, 0},
	{ "cm41-mu-a1", IMX_SC_R_M4_1_MU_1A, 1, false, 0},
	{ "cm41-lpuart", IMX_SC_R_M4_1_UART, 1, false, 0},

	/* IMAGE SS */
	{ "img-jpegdec-mp", IMX_SC_R_MJPEG_DEC_MP, 1, false, 0 },
	{ "img-jpegdec-s0", IMX_SC_R_MJPEG_DEC_S0, 4, true, 0 },
	{ "img-jpegenc-mp", IMX_SC_R_MJPEG_ENC_MP, 1, false, 0 },
	{ "img-jpegenc-s0", IMX_SC_R_MJPEG_ENC_S0, 4, true, 0 },
};

static const struct imx_sc_pd_soc imx8qxp_scu_pd = {
+10 −0
Original line number Diff line number Diff line
@@ -55,6 +55,9 @@ static inline void *imx_dsp_get_data(struct imx_dsp_ipc *ipc)

int imx_dsp_ring_doorbell(struct imx_dsp_ipc *dsp, unsigned int chan_idx);

struct mbox_chan *imx_dsp_request_channel(struct imx_dsp_ipc *ipc, int idx);
void imx_dsp_free_channel(struct imx_dsp_ipc *ipc, int idx);

#else

static inline int imx_dsp_ring_doorbell(struct imx_dsp_ipc *ipc,
@@ -63,5 +66,12 @@ static inline int imx_dsp_ring_doorbell(struct imx_dsp_ipc *ipc,
	return -ENOTSUPP;
}

struct mbox_chan *imx_dsp_request_channel(struct imx_dsp_ipc *ipc, int idx)
{
	return ERR_PTR(-EOPNOTSUPP);
}

void imx_dsp_free_channel(struct imx_dsp_ipc *ipc, int idx) { }

#endif
#endif /* _IMX_DSP_IPC_H */
+13 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ struct imx_sc_rpc_msg {
	uint8_t func;
};

#ifdef CONFIG_IMX_SCU
/*
 * This is an function to send an RPC message over an IPC channel.
 * It is called by client-side SCFW API function shims.
@@ -55,4 +56,16 @@ int imx_scu_call_rpc(struct imx_sc_ipc *ipc, void *msg, bool have_resp);
 * @return Returns an error code (0 = success, failed if < 0)
 */
int imx_scu_get_handle(struct imx_sc_ipc **ipc);
#else
static inline int imx_scu_call_rpc(struct imx_sc_ipc *ipc, void *msg,
				   bool have_resp)
{
	return -ENOTSUPP;
}

static inline int imx_scu_get_handle(struct imx_sc_ipc **ipc)
{
	return -ENOTSUPP;
}
#endif
#endif /* _SC_IPC_H */
+27 −0
Original line number Diff line number Diff line
@@ -16,9 +16,36 @@
#include <linux/firmware/imx/svc/pm.h>
#include <linux/firmware/imx/svc/rm.h>

#if IS_ENABLED(CONFIG_IMX_SCU)
int imx_scu_enable_general_irq_channel(struct device *dev);
int imx_scu_irq_register_notifier(struct notifier_block *nb);
int imx_scu_irq_unregister_notifier(struct notifier_block *nb);
int imx_scu_irq_group_enable(u8 group, u32 mask, u8 enable);
int imx_scu_soc_init(struct device *dev);
#else
static inline int imx_scu_soc_init(struct device *dev)
{
	return -ENOTSUPP;
}

static inline int imx_scu_enable_general_irq_channel(struct device *dev)
{
	return -ENOTSUPP;
}

static inline int imx_scu_irq_register_notifier(struct notifier_block *nb)
{
	return -ENOTSUPP;
}

static inline int imx_scu_irq_unregister_notifier(struct notifier_block *nb)
{
	return -ENOTSUPP;
}

static inline int imx_scu_irq_group_enable(u8 group, u32 mask, u8 enable)
{
	return -ENOTSUPP;
}
#endif
#endif /* _SC_SCI_H */
Loading