Skip to content

Commit

Permalink
media: imx-pxp: detect PXP version
Browse files Browse the repository at this point in the history
Different versions of the Pixel Pipeline have different blocks and their
routing may be different. Read the PXP_HW_VERSION register to determine
the version of the PXP and print it to the log for debugging purposes.

Signed-off-by: Michael Tretter <[email protected]>
Reviewed-by: Philipp Zabel <[email protected]>
Signed-off-by: Laurent Pinchart <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
  • Loading branch information
tretter authored and mchehab committed Feb 8, 2023
1 parent 3ac7165 commit a4a69d1
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions drivers/media/platform/nxp/imx-pxp.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* Pawel Osciak, <[email protected]>
* Marek Szyprowski, <[email protected]>
*/
#include <linux/bitfield.h>
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/dma-mapping.h>
Expand Down Expand Up @@ -52,6 +53,11 @@ MODULE_PARM_DESC(debug, "activates debug info");
#define MEM2MEM_HFLIP (1 << 0)
#define MEM2MEM_VFLIP (1 << 1)

#define PXP_VERSION_MAJOR(version) \
FIELD_GET(BM_PXP_VERSION_MAJOR, version)
#define PXP_VERSION_MINOR(version) \
FIELD_GET(BM_PXP_VERSION_MINOR, version)

#define dprintk(dev, fmt, arg...) \
v4l2_dbg(1, debug, &dev->v4l2_dev, "%s: " fmt, __func__, ## arg)

Expand Down Expand Up @@ -1664,6 +1670,7 @@ static int pxp_probe(struct platform_device *pdev)
{
struct pxp_dev *dev;
struct video_device *vfd;
u32 hw_version;
int irq;
int ret;

Expand Down Expand Up @@ -1705,6 +1712,10 @@ static int pxp_probe(struct platform_device *pdev)
goto err_clk;
}

hw_version = readl(dev->mmio + HW_PXP_VERSION);
dev_dbg(&pdev->dev, "PXP Version %u.%u\n",
PXP_VERSION_MAJOR(hw_version), PXP_VERSION_MINOR(hw_version));

ret = v4l2_device_register(&pdev->dev, &dev->v4l2_dev);
if (ret)
goto err_clk;
Expand Down

0 comments on commit a4a69d1

Please sign in to comment.