All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Steve Longerbeam <slongerbeam@gmail.com>
Cc: linux-media@vger.kernel.org,
	Steve Longerbeam <steve_longerbeam@mentor.com>
Subject: Re: [PATCH 08/43] imx-drm: ipu-v3: Add units required for video capture
Date: Wed, 11 Jun 2014 08:18:56 +0200	[thread overview]
Message-ID: <20140611061856.GC664@pengutronix.de> (raw)
In-Reply-To: <1402178205-22697-9-git-send-email-steve_longerbeam@mentor.com>

On Sat, Jun 07, 2014 at 02:56:10PM -0700, Steve Longerbeam wrote:
> Adds the following new IPU units:
> 
> - Camera Sensor Interface (csi)
> - Sensor Multi FIFO Controller (smfc)
> - Image Converter (ic)
> - Image Rotator (irt)
> 
> Signed-off-by: Steve Longerbeam <steve_longerbeam@mentor.com>
> ---
>  drivers/staging/imx-drm/ipu-v3/Makefile     |    3 +-
>  drivers/staging/imx-drm/ipu-v3/ipu-common.c |   67 ++-
>  drivers/staging/imx-drm/ipu-v3/ipu-csi.c    |  821 ++++++++++++++++++++++++++
>  drivers/staging/imx-drm/ipu-v3/ipu-ic.c     |  835 +++++++++++++++++++++++++++
>  drivers/staging/imx-drm/ipu-v3/ipu-irt.c    |  103 ++++
>  drivers/staging/imx-drm/ipu-v3/ipu-prv.h    |   24 +
>  drivers/staging/imx-drm/ipu-v3/ipu-smfc.c   |  348 +++++++++++
>  include/linux/platform_data/imx-ipu-v3.h    |  151 +++++
>  8 files changed, 2350 insertions(+), 2 deletions(-)
>  create mode 100644 drivers/staging/imx-drm/ipu-v3/ipu-csi.c
>  create mode 100644 drivers/staging/imx-drm/ipu-v3/ipu-ic.c
>  create mode 100644 drivers/staging/imx-drm/ipu-v3/ipu-irt.c
>  create mode 100644 drivers/staging/imx-drm/ipu-v3/ipu-smfc.c
> 
> diff --git a/drivers/staging/imx-drm/ipu-v3/Makefile b/drivers/staging/imx-drm/ipu-v3/Makefile
> index 28ed72e..79c0c88 100644
> --- a/drivers/staging/imx-drm/ipu-v3/Makefile
> +++ b/drivers/staging/imx-drm/ipu-v3/Makefile
> @@ -1,3 +1,4 @@
>  obj-$(CONFIG_DRM_IMX_IPUV3_CORE) += imx-ipu-v3.o
>  
> -imx-ipu-v3-objs := ipu-common.o ipu-dc.o ipu-di.o ipu-dp.o ipu-dmfc.o
> +imx-ipu-v3-objs := ipu-common.o ipu-csi.o ipu-dc.o ipu-di.o \
> +	ipu-dp.o ipu-dmfc.o ipu-ic.o ipu-irt.o ipu-smfc.o
> diff --git a/drivers/staging/imx-drm/ipu-v3/ipu-common.c b/drivers/staging/imx-drm/ipu-v3/ipu-common.c
> index 1c606b5..3d7e28d 100644
> --- a/drivers/staging/imx-drm/ipu-v3/ipu-common.c
> +++ b/drivers/staging/imx-drm/ipu-v3/ipu-common.c
> @@ -834,6 +834,10 @@ struct ipu_devtype {
>  	unsigned long cpmem_ofs;
>  	unsigned long srm_ofs;
>  	unsigned long tpm_ofs;
> +	unsigned long csi0_ofs;
> +	unsigned long csi1_ofs;
> +	unsigned long smfc_ofs;
> +	unsigned long ic_ofs;
>  	unsigned long disp0_ofs;
>  	unsigned long disp1_ofs;
>  	unsigned long dc_tmpl_ofs;
> @@ -873,8 +877,12 @@ static struct ipu_devtype ipu_type_imx6q = {
>  	.cpmem_ofs = 0x00300000,
>  	.srm_ofs = 0x00340000,
>  	.tpm_ofs = 0x00360000,
> +	.csi0_ofs = 0x00230000,
> +	.csi1_ofs = 0x00238000,
>  	.disp0_ofs = 0x00240000,
>  	.disp1_ofs = 0x00248000,
> +	.smfc_ofs =  0x00250000,
> +	.ic_ofs = 0x00220000,
>  	.dc_tmpl_ofs = 0x00380000,
>  	.vdi_ofs = 0x00268000,
>  	.type = IPUV3H,
> @@ -915,8 +923,44 @@ static int ipu_submodules_init(struct ipu_soc *ipu,
>  	struct device *dev = &pdev->dev;
>  	const struct ipu_devtype *devtype = ipu->devtype;
>  
> +	ret = ipu_csi_init(ipu, dev, 0, ipu_base + devtype->csi0_ofs,
> +			   IPU_CONF_CSI0_EN, ipu_clk);
> +	if (ret) {
> +		unit = "csi0";
> +		goto err_csi_0;
> +	}

Please be nice to other SoCs. You set csi0_ofs for i.MX6, but not for
i.MX5. For i.MX5 you silently initialize the CSI with bogus register
offsets. Either test for _ofs == 0 before initializing it or add the
correct values for i.MX51/53 (preferred).

> +int ipu_csi_set_src(struct ipu_csi *csi, u32 vc, bool select_mipi_csi2)
> +{
> +	struct ipu_soc *ipu = csi->ipu;
> +	int ipu_id = ipu_get_num(ipu);
> +	u32 val, bit;
> +
> +	/*
> +	 * Set the muxes that choose between mipi-csi2 and parallel inputs
> +	 * to the CSI's.
> +	 */
> +	if (csi->ipu->ipu_type == IPUV3HDL) {
> +		/*
> +		 * On D/L, the mux is in GPR13. The TRM is unclear,
> +		 * but it appears the mux allows selecting the MIPI
> +		 * CSI-2 virtual channel number to route to the CSIs.
> +		 */
> +		bit = GPR13_IPUV3HDL_CSI_MUX_CTL_SHIFT + csi->id * 3;
> +		val = select_mipi_csi2 ? vc << bit : 4 << bit;
> +		regmap_update_bits(ipu->gp_reg, IOMUXC_GPR13,
> +				   0x7 << bit, val);
> +	} else if (csi->ipu->ipu_type == IPUV3H) {
> +		/*
> +		 * For Q/D, the mux only exists on IPU0-CSI0 and IPU1-CSI1,
> +		 * and the routed virtual channel numbers are fixed at 0 and
> +		 * 3 respectively.
> +		 */
> +		if ((ipu_id == 0 && csi->id == 0) ||
> +		    (ipu_id == 1 && csi->id == 1)) {
> +			bit = GPR1_IPU_CSI_MUX_CTL_SHIFT + csi->ipu->id;
> +			val = select_mipi_csi2 ? 0 : 1 << bit;
> +			regmap_update_bits(ipu->gp_reg, IOMUXC_GPR1,
> +					   0x1 << bit, val);
> +		}
> +	} else {
> +		dev_err(csi->ipu->dev,
> +			"ERROR: %s: unsupported CPU version!\n",
> +			__func__);
> +		return -EINVAL;
> +	}
> +
> +	/*
> +	 * there is another mux in the IPU config register that
> +	 * must be set as well
> +	 */
> +	ipu_set_csi_src_mux(ipu, csi->id, select_mipi_csi2);

This is not a property of the IPU but how the IPU is integrated into the
SoC. I'm unsure this should be integrated like this, it sounds more like
a job for mediactrl.

> +#include <linux/types.h>
> +#include <linux/init.h>
> +#include <linux/errno.h>
> +#include <linux/spinlock.h>
> +#include <linux/videodev2.h>
> +#include <linux/bitrev.h>
> +#include <linux/io.h>
> +#include <linux/err.h>
> +#include <linux/platform_device.h>
> +#include <linux/clk.h>
> +#include <linux/clk-provider.h>
> +#include <linux/clkdev.h>

Please clean up the include list. There is nothing used from
clk-provider.h for example.

> +static int init_csc(struct ipu_ic *ic,
> +		    enum ipu_color_space in_format,
> +		    enum ipu_color_space out_format,
> +		    int csc_index);
> +static int calc_resize_coeffs(struct ipu_ic *ic,
> +			      u32 in_size, u32 out_size,
> +			      u32 *resize_coeff,
> +			      u32 *downsize_coeff);

Please reorder functions to get rid of static function declarations.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

  reply	other threads:[~2014-06-11  6:18 UTC|newest]

Thread overview: 79+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-07 21:56 [PATCH 00/43] i.MX6 Video capture Steve Longerbeam
2014-06-07 21:56 ` [PATCH 01/43] imx-drm: ipu-v3: Move imx-ipu-v3.h to include/linux/platform_data/ Steve Longerbeam
2014-06-11 11:22   ` Philipp Zabel
2014-06-07 21:56 ` [PATCH 02/43] ARM: dts: imx6qdl: Add ipu aliases Steve Longerbeam
2014-06-11 11:21   ` Philipp Zabel
2014-06-07 21:56 ` [PATCH 03/43] imx-drm: ipu-v3: Add ipu_get_num() Steve Longerbeam
2014-06-11 11:22   ` Philipp Zabel
2014-06-07 21:56 ` [PATCH 04/43] imx-drm: ipu-v3: Add solo/dual-lite IPU device type Steve Longerbeam
2014-06-11  5:37   ` Sascha Hauer
2014-06-11 11:38   ` Philipp Zabel
2014-06-07 21:56 ` [PATCH 05/43] imx-drm: ipu-v3: Map IOMUXC registers Steve Longerbeam
2014-06-11 13:11   ` Philipp Zabel
2014-06-07 21:56 ` [PATCH 06/43] imx-drm: ipu-v3: Add functions to set CSI/IC source muxes Steve Longerbeam
2014-06-11 11:22   ` Philipp Zabel
2014-06-07 21:56 ` [PATCH 07/43] imx-drm: ipu-v3: Rename and add IDMAC channels Steve Longerbeam
2014-06-11 11:22   ` Philipp Zabel
2014-06-07 21:56 ` [PATCH 08/43] imx-drm: ipu-v3: Add units required for video capture Steve Longerbeam
2014-06-11  6:18   ` Sascha Hauer [this message]
2014-06-11 14:09   ` Philipp Zabel
2014-06-07 21:56 ` [PATCH 09/43] imx-drm: ipu-v3: Add ipu_mbus_code_to_colorspace() Steve Longerbeam
2014-06-07 21:56 ` [PATCH 10/43] imx-drm: ipu-v3: Add rotation mode conversion utilities Steve Longerbeam
2014-06-07 21:56 ` [PATCH 11/43] imx-drm: ipu-v3: Add helper function checking if pixfmt is planar Steve Longerbeam
2014-06-07 21:56 ` [PATCH 12/43] imx-drm: ipu-v3: Move IDMAC channel names to imx-ipu-v3.h Steve Longerbeam
2014-06-07 21:56 ` [PATCH 13/43] imx-drm: ipu-v3: Add ipu_idmac_buffer_is_ready() Steve Longerbeam
2014-06-07 21:56 ` [PATCH 14/43] imx-drm: ipu-v3: Add ipu_idmac_clear_buffer() Steve Longerbeam
2014-06-07 21:56 ` [PATCH 15/43] imx-drm: ipu-v3: Add ipu_idmac_current_buffer() Steve Longerbeam
2014-06-11 11:22   ` Philipp Zabel
2014-06-07 21:56 ` [PATCH 16/43] imx-drm: ipu-v3: Add __ipu_idmac_reset_current_buffer() Steve Longerbeam
2014-06-07 21:56 ` [PATCH 17/43] imx-drm: ipu-v3: Add ipu_stride_to_bytes() Steve Longerbeam
2014-06-07 21:56 ` [PATCH 18/43] imx-drm: ipu-v3: Add ipu_idmac_enable_watermark() Steve Longerbeam
2014-06-07 21:56 ` [PATCH 19/43] imx-drm: ipu-v3: Add ipu_idmac_lock_enable() Steve Longerbeam
2014-06-07 21:56 ` [PATCH 20/43] imx-drm: ipu-v3: Add idmac channel linking support Steve Longerbeam
2014-06-07 21:56 ` [PATCH 21/43] imx-drm: ipu-v3: Add ipu_bits_per_pixel() Steve Longerbeam
2014-06-11 11:23   ` Philipp Zabel
2014-06-07 21:56 ` [PATCH 22/43] imx-drm: ipu-v3: Add ipu-cpmem unit Steve Longerbeam
2014-06-11 11:23   ` Philipp Zabel
2014-06-07 21:56 ` [PATCH 23/43] imx-drm: ipu-cpmem: Add ipu_cpmem_set_block_mode() Steve Longerbeam
2014-06-07 21:56 ` [PATCH 24/43] imx-drm: ipu-cpmem: Add ipu_cpmem_set_axi_id() Steve Longerbeam
2014-06-07 21:56 ` [PATCH 25/43] imx-drm: ipu-cpmem: Add ipu_cpmem_set_rotation() Steve Longerbeam
2014-06-07 21:56 ` [PATCH 26/43] imx-drm: ipu-cpmem: Add second buffer support to ipu_cpmem_set_image() Steve Longerbeam
2014-06-07 21:56 ` [PATCH 27/43] imx-drm: ipu-v3: Add more planar formats support Steve Longerbeam
2014-06-07 21:56 ` [PATCH 28/43] imx-drm: ipu-cpmem: Add ipu_cpmem_dump() Steve Longerbeam
2014-06-07 21:56 ` [PATCH 29/43] imx-drm: ipu-v3: Add ipu_dump() Steve Longerbeam
2014-06-07 21:56 ` [PATCH 30/43] ARM: dts: imx6: add pin groups for imx6q/dl for IPU1 CSI0 Steve Longerbeam
2014-06-11  5:56   ` Sascha Hauer
2014-06-07 21:56 ` [PATCH 31/43] ARM: dts: imx6qdl: Flesh out MIPI CSI2 receiver node Steve Longerbeam
2014-06-11 11:38   ` Philipp Zabel
2014-06-07 21:56 ` [PATCH 32/43] ARM: dts: imx: sabrelite: add video capture ports and endpoints Steve Longerbeam
2014-06-11 11:38   ` Philipp Zabel
2014-06-12 17:13     ` Philipp Zabel
2014-06-07 21:56 ` [PATCH 33/43] ARM: dts: imx6-sabresd: " Steve Longerbeam
2014-06-07 21:56 ` [PATCH 34/43] ARM: dts: imx6-sabreauto: " Steve Longerbeam
2014-06-07 21:56 ` [PATCH 35/43] ARM: dts: imx6qdl: Add simple-bus to ipu compatibility Steve Longerbeam
2014-06-11 11:39   ` Philipp Zabel
2014-06-07 21:56 ` [PATCH 36/43] gpio: pca953x: Add reset-gpios property Steve Longerbeam
2014-06-11 11:39   ` Philipp Zabel
2014-06-07 21:56 ` [PATCH 37/43] ARM: imx6q: clk: Add video 27m clock Steve Longerbeam
2014-06-07 21:56 ` [PATCH 38/43] media: imx6: Add device tree binding documentation Steve Longerbeam
2014-06-07 21:56 ` [PATCH 39/43] media: Add new camera interface driver for i.MX6 Steve Longerbeam
2014-06-11 15:27   ` Philipp Zabel
2014-06-07 21:56 ` [PATCH 40/43] media: imx6: Add support for MIPI CSI-2 OV5640 Steve Longerbeam
2014-06-11 11:39   ` Philipp Zabel
2014-06-07 21:56 ` [PATCH 41/43] media: imx6: Add support for Parallel OV5642 Steve Longerbeam
2014-06-07 21:56 ` [PATCH 42/43] media: imx6: Add support for ADV7180 Video Decoder Steve Longerbeam
2015-01-17 19:54   ` Fabio Estevam
2014-06-07 21:56 ` [PATCH 43/43] ARM: imx_v6_v7_defconfig: Enable video4linux drivers Steve Longerbeam
2014-06-08  8:36 ` [PATCH 00/43] i.MX6 Video capture Hans Verkuil
2014-06-08  8:39   ` Hans Verkuil
2014-06-09 16:42   ` Steve Longerbeam
2014-06-10 15:11     ` Hans Verkuil
2014-06-11  0:54       ` Steve Longerbeam
2014-06-11  7:01         ` Hans Verkuil
2014-06-11 11:21 ` Philipp Zabel
2014-06-12  1:04   ` Steve Longerbeam
2014-06-12 16:50     ` Philipp Zabel
2014-06-12 21:05       ` Steve Longerbeam
2014-06-12 21:35         ` Troy Kisky
2014-06-13 15:37         ` Philipp Zabel
2014-06-15 22:34           ` Steve Longerbeam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140611061856.GC664@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=linux-media@vger.kernel.org \
    --cc=slongerbeam@gmail.com \
    --cc=steve_longerbeam@mentor.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.