* [PATCH 1/7] media: sun6i: Fill dma_pfn_offset to accomodate for the RAM offset
2018-03-05 9:35 ` [PATCH 0/7] media: sun6i: Various fixes and improvements Maxime Ripard
@ 2018-03-05 9:35 ` Maxime Ripard
2018-03-05 9:35 ` [PATCH 2/7] media: sun6i: Reduce the error level Maxime Ripard
` (7 subsequent siblings)
8 siblings, 0 replies; 13+ messages in thread
From: Maxime Ripard @ 2018-03-05 9:35 UTC (permalink / raw)
To: Yong Deng
Cc: Mauro Carvalho Chehab, Chen-Yu Tsai, Maxime Ripard, Hans Verkuil,
Sakari Ailus, linux-media, linux-arm-kernel, Thomas Petazzoni,
Mylene Josserand
The CSI controller does its DMA accesses through a DMA bus that has the RAM
mapped at the address 0.
The current code removes from the dma_addr_t PHYS_OFFSET, and while it
works, this is an abuse of the DMA API.
Instead, fill the dma_pfn_offset field in the struct device that should be
used to express such an offset, and the use the dma_addr_t directly as we
should.
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
---
drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c
index 1aaaae238d57..2ec33fb04632 100644
--- a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c
+++ b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c
@@ -563,20 +563,15 @@ int sun6i_csi_update_config(struct sun6i_csi *csi,
void sun6i_csi_update_buf_addr(struct sun6i_csi *csi, dma_addr_t addr)
{
struct sun6i_csi_dev *sdev = sun6i_csi_to_dev(csi);
- /* transform physical address to bus address */
-#if defined(CONFIG_COMPILE_TEST) && !defined(PHYS_OFFSET)
-#define PHYS_OFFSET 0
-#endif
- dma_addr_t bus_addr = addr - PHYS_OFFSET;
regmap_write(sdev->regmap, CSI_CH_F0_BUFA_REG,
- (bus_addr + sdev->planar_offset[0]) >> 2);
+ (addr + sdev->planar_offset[0]) >> 2);
if (sdev->planar_offset[1] != -1)
regmap_write(sdev->regmap, CSI_CH_F1_BUFA_REG,
- (bus_addr + sdev->planar_offset[1]) >> 2);
+ (addr + sdev->planar_offset[1]) >> 2);
if (sdev->planar_offset[2] != -1)
regmap_write(sdev->regmap, CSI_CH_F2_BUFA_REG,
- (bus_addr + sdev->planar_offset[2]) >> 2);
+ (addr + sdev->planar_offset[2]) >> 2);
}
void sun6i_csi_set_stream(struct sun6i_csi *csi, bool enable)
@@ -856,6 +851,14 @@ static int sun6i_csi_resource_request(struct sun6i_csi_dev *sdev,
return 0;
}
+/*
+ * PHYS_OFFSET isn't available on all architectures. In order to
+ * accomodate for COMPILE_TEST, let's define it to something dumb.
+ */
+#ifndef PHYS_OFFSET
+#define PHYS_OFFSET 0
+#endif
+
static int sun6i_csi_probe(struct platform_device *pdev)
{
struct sun6i_csi_dev *sdev;
@@ -866,6 +869,8 @@ static int sun6i_csi_probe(struct platform_device *pdev)
return -ENOMEM;
sdev->dev = &pdev->dev;
+ /* The DMA bus has the memory mapped at 0 */
+ sdev->dev->dma_pfn_offset = PHYS_OFFSET >> PAGE_SHIFT;
ret = sun6i_csi_resource_request(sdev, pdev);
if (ret)
--
2.14.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 2/7] media: sun6i: Reduce the error level
2018-03-05 9:35 ` [PATCH 0/7] media: sun6i: Various fixes and improvements Maxime Ripard
2018-03-05 9:35 ` [PATCH 1/7] media: sun6i: Fill dma_pfn_offset to accomodate for the RAM offset Maxime Ripard
@ 2018-03-05 9:35 ` Maxime Ripard
2018-03-05 9:35 ` [PATCH 3/7] media: sun6i: Pass the sun6i_csi_dev pointer to our helpers Maxime Ripard
` (6 subsequent siblings)
8 siblings, 0 replies; 13+ messages in thread
From: Maxime Ripard @ 2018-03-05 9:35 UTC (permalink / raw)
To: Yong Deng
Cc: Mauro Carvalho Chehab, Chen-Yu Tsai, Maxime Ripard, Hans Verkuil,
Sakari Ailus, linux-media, linux-arm-kernel, Thomas Petazzoni,
Mylene Josserand
The is_format_support function can be called in the standard format
negociation path with a sensor, where it's expected to have not exactly the
same set of formats available.
Reduce the error logging level when we find a format not supported to not
have a lot of spurious messages.
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
---
drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c
index 2ec33fb04632..b0ac8a188f92 100644
--- a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c
+++ b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c
@@ -111,15 +111,14 @@ bool sun6i_csi_is_format_support(struct sun6i_csi *csi,
case MEDIA_BUS_FMT_YVYU8_1X16:
return true;
default:
- dev_warn(sdev->dev,
- "Unsupported mbus code: 0x%x\n",
- mbus_code);
+ dev_dbg(sdev->dev, "Unsupported mbus code: 0x%x\n",
+ mbus_code);
break;
}
break;
default:
- dev_warn(sdev->dev, "Unsupported pixformat: 0x%x\n",
- pixformat);
+ dev_dbg(sdev->dev, "Unsupported pixformat: 0x%x\n",
+ pixformat);
break;
}
return false;
@@ -175,13 +174,13 @@ bool sun6i_csi_is_format_support(struct sun6i_csi *csi,
case MEDIA_BUS_FMT_YVYU8_2X8:
return true;
default:
- dev_warn(sdev->dev, "Unsupported mbus code: 0x%x\n",
- mbus_code);
+ dev_dbg(sdev->dev, "Unsupported mbus code: 0x%x\n",
+ mbus_code);
break;
}
break;
default:
- dev_warn(sdev->dev, "Unsupported pixformat: 0x%x\n", pixformat);
+ dev_dbg(sdev->dev, "Unsupported pixformat: 0x%x\n", pixformat);
break;
}
--
2.14.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 3/7] media: sun6i: Pass the sun6i_csi_dev pointer to our helpers
2018-03-05 9:35 ` [PATCH 0/7] media: sun6i: Various fixes and improvements Maxime Ripard
2018-03-05 9:35 ` [PATCH 1/7] media: sun6i: Fill dma_pfn_offset to accomodate for the RAM offset Maxime Ripard
2018-03-05 9:35 ` [PATCH 2/7] media: sun6i: Reduce the error level Maxime Ripard
@ 2018-03-05 9:35 ` Maxime Ripard
2018-03-05 9:35 ` [PATCH 4/7] media: sun6i: Don't emit a warning when the configured format isn't found Maxime Ripard
` (5 subsequent siblings)
8 siblings, 0 replies; 13+ messages in thread
From: Maxime Ripard @ 2018-03-05 9:35 UTC (permalink / raw)
To: Yong Deng
Cc: Mauro Carvalho Chehab, Chen-Yu Tsai, Maxime Ripard, Hans Verkuil,
Sakari Ailus, linux-media, linux-arm-kernel, Thomas Petazzoni,
Mylene Josserand
Some helpers need to log some errors for example when we don't support the
format passed as an argument. However, we don't currently have a dev
pointer available in those functions, preventing us from using any dev_*
logging function.
Fix that by passing the sun6i_csi_dev structure as an argument, which
itself contains a pointer to our struct device.
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
---
drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c
index b0ac8a188f92..f10c3bc2a6c5 100644
--- a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c
+++ b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c
@@ -225,7 +225,8 @@ int sun6i_csi_set_power(struct sun6i_csi *csi, bool enable)
return 0;
}
-static enum csi_input_fmt get_csi_input_format(u32 mbus_code, u32 pixformat)
+static enum csi_input_fmt get_csi_input_format(struct sun6i_csi_dev *sdev,
+ u32 mbus_code, u32 pixformat)
{
/* bayer */
if ((mbus_code & 0xF000) == 0x3000)
@@ -242,11 +243,12 @@ static enum csi_input_fmt get_csi_input_format(u32 mbus_code, u32 pixformat)
}
/* not support YUV420 input format yet */
- pr_debug("Select YUV422 as default input format of CSI.\n");
+ dev_dbg(sdev->dev, "Select YUV422 as default input format of CSI.\n");
return CSI_INPUT_FORMAT_YUV422;
}
-static enum csi_output_fmt get_csi_output_format(u32 pixformat, u32 field)
+static enum csi_output_fmt get_csi_output_format(struct sun6i_csi_dev *sdev,
+ u32 pixformat, u32 field)
{
bool buf_interlaced = false;
@@ -304,7 +306,8 @@ static enum csi_output_fmt get_csi_output_format(u32 pixformat, u32 field)
return CSI_FIELD_RAW_8;
}
-static enum csi_input_seq get_csi_input_seq(u32 mbus_code, u32 pixformat)
+static enum csi_input_seq get_csi_input_seq(struct sun6i_csi_dev *sdev,
+ u32 mbus_code, u32 pixformat)
{
switch (pixformat) {
@@ -449,13 +452,16 @@ static void sun6i_csi_set_format(struct sun6i_csi_dev *sdev)
CSI_CH_CFG_HFLIP_EN | CSI_CH_CFG_FIELD_SEL_MASK |
CSI_CH_CFG_INPUT_SEQ_MASK);
- val = get_csi_input_format(csi->config.code, csi->config.pixelformat);
+ val = get_csi_input_format(sdev, csi->config.code,
+ csi->config.pixelformat);
cfg |= CSI_CH_CFG_INPUT_FMT(val);
- val = get_csi_output_format(csi->config.pixelformat, csi->config.field);
+ val = get_csi_output_format(sdev, csi->config.pixelformat,
+ csi->config.field);
cfg |= CSI_CH_CFG_OUTPUT_FMT(val);
- val = get_csi_input_seq(csi->config.code, csi->config.pixelformat);
+ val = get_csi_input_seq(sdev, csi->config.code,
+ csi->config.pixelformat);
cfg |= CSI_CH_CFG_INPUT_SEQ(val);
if (csi->config.field == V4L2_FIELD_TOP)
--
2.14.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 4/7] media: sun6i: Don't emit a warning when the configured format isn't found
2018-03-05 9:35 ` [PATCH 0/7] media: sun6i: Various fixes and improvements Maxime Ripard
` (2 preceding siblings ...)
2018-03-05 9:35 ` [PATCH 3/7] media: sun6i: Pass the sun6i_csi_dev pointer to our helpers Maxime Ripard
@ 2018-03-05 9:35 ` Maxime Ripard
2018-03-05 9:35 ` [PATCH 5/7] media: sun6i: Support the YUYV format properly Maxime Ripard
` (4 subsequent siblings)
8 siblings, 0 replies; 13+ messages in thread
From: Maxime Ripard @ 2018-03-05 9:35 UTC (permalink / raw)
To: Yong Deng
Cc: Mauro Carvalho Chehab, Chen-Yu Tsai, Maxime Ripard, Hans Verkuil,
Sakari Ailus, linux-media, linux-arm-kernel, Thomas Petazzoni,
Mylene Josserand
Currently the driver will call WARN when a format isn't available,
resulting in a kernel backtrace in our logs. This makes it look much more
serious than it should be.
Replace the call to the WARN macro to a dev_warn, which will still allow us
to log what happened without making it too dramatic.
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
---
drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c
index f10c3bc2a6c5..9a25aad8b6b1 100644
--- a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c
+++ b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c
@@ -299,7 +299,7 @@ static enum csi_output_fmt get_csi_output_format(struct sun6i_csi_dev *sdev,
return buf_interlaced ? CSI_FRAME_PLANAR_YUV422 :
CSI_FIELD_PLANAR_YUV422;
default:
- WARN(1, "Unsupported pixformat: 0x%x\n", pixformat);
+ dev_warn(sdev->dev, "Unsupported pixformat: 0x%x\n", pixformat);
break;
}
@@ -330,7 +330,8 @@ static enum csi_input_seq get_csi_input_seq(struct sun6i_csi_dev *sdev,
case MEDIA_BUS_FMT_YVYU8_2X8:
return CSI_INPUT_SEQ_YVYU;
default:
- WARN(1, "Unsupported mbus code: 0x%x\n", mbus_code);
+ dev_warn(sdev->dev, "Unsupported mbus code: 0x%x\n",
+ mbus_code);
break;
}
break;
@@ -351,12 +352,14 @@ static enum csi_input_seq get_csi_input_seq(struct sun6i_csi_dev *sdev,
case MEDIA_BUS_FMT_YVYU8_2X8:
return CSI_INPUT_SEQ_YUYV;
default:
- WARN(1, "Unsupported mbus code: 0x%x\n", mbus_code);
+ dev_warn(sdev->dev, "Unsupported mbus code: 0x%x\n",
+ mbus_code);
break;
}
break;
default:
- WARN(1, "Unsupported pixformat: 0x%x\n", pixformat);
+ dev_warn(sdev->dev, "Unsupported pixformat: 0x%x, defaulting to YUYV\n",
+ pixformat);
break;
}
--
2.14.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 5/7] media: sun6i: Support the YUYV format properly
2018-03-05 9:35 ` [PATCH 0/7] media: sun6i: Various fixes and improvements Maxime Ripard
` (3 preceding siblings ...)
2018-03-05 9:35 ` [PATCH 4/7] media: sun6i: Don't emit a warning when the configured format isn't found Maxime Ripard
@ 2018-03-05 9:35 ` Maxime Ripard
2018-03-05 9:35 ` [PATCH 6/7] media: sun6i: Invert the polarities Maxime Ripard
` (3 subsequent siblings)
8 siblings, 0 replies; 13+ messages in thread
From: Maxime Ripard @ 2018-03-05 9:35 UTC (permalink / raw)
To: Yong Deng
Cc: Mauro Carvalho Chehab, Chen-Yu Tsai, Maxime Ripard, Hans Verkuil,
Sakari Ailus, linux-media, linux-arm-kernel, Thomas Petazzoni,
Mylene Josserand
Currently, if we ever start a capture using the YUYV format, the switch
case in the get_csi_input_seq function will not catch it since it considers
it the default case.
However, that switch default also calls dev_warn to log an error, which is
this case will be either an unsupported format, or the YUYV format.
Obviously, the latter creates a spurious message. Make sure this isn't the
case.
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
---
drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c
index 9a25aad8b6b1..e0b39ea641aa 100644
--- a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c
+++ b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c
@@ -357,6 +357,10 @@ static enum csi_input_seq get_csi_input_seq(struct sun6i_csi_dev *sdev,
break;
}
break;
+
+ case V4L2_PIX_FMT_YUYV:
+ return CSI_INPUT_SEQ_YUYV;
+
default:
dev_warn(sdev->dev, "Unsupported pixformat: 0x%x, defaulting to YUYV\n",
pixformat);
--
2.14.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 6/7] media: sun6i: Invert the polarities
2018-03-05 9:35 ` [PATCH 0/7] media: sun6i: Various fixes and improvements Maxime Ripard
` (4 preceding siblings ...)
2018-03-05 9:35 ` [PATCH 5/7] media: sun6i: Support the YUYV format properly Maxime Ripard
@ 2018-03-05 9:35 ` Maxime Ripard
2018-03-05 9:35 ` [PATCH 7/7] media: sun6i: Expose controls on the v4l2_device Maxime Ripard
` (2 subsequent siblings)
8 siblings, 0 replies; 13+ messages in thread
From: Maxime Ripard @ 2018-03-05 9:35 UTC (permalink / raw)
To: Yong Deng
Cc: Mauro Carvalho Chehab, Chen-Yu Tsai, Maxime Ripard, Hans Verkuil,
Sakari Ailus, linux-media, linux-arm-kernel, Thomas Petazzoni,
Mylene Josserand
A good look at an oscilloscope and test with a camera have shown that the
polarity of all signals are actually reversed compared to the polarity
documented in the datasheet for the clock, HSYNC and VSYNC signals.
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
---
drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c
index e0b39ea641aa..a93bc25ff372 100644
--- a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c
+++ b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c
@@ -398,12 +398,12 @@ static void sun6i_csi_setup_bus(struct sun6i_csi_dev *sdev)
if (flags & V4L2_MBUS_FIELD_EVEN_LOW)
cfg |= CSI_IF_CFG_FIELD_POSITIVE;
- if (flags & V4L2_MBUS_VSYNC_ACTIVE_HIGH)
+ if (flags & V4L2_MBUS_VSYNC_ACTIVE_LOW)
cfg |= CSI_IF_CFG_VREF_POL_POSITIVE;
- if (flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH)
+ if (flags & V4L2_MBUS_HSYNC_ACTIVE_LOW)
cfg |= CSI_IF_CFG_HREF_POL_POSITIVE;
- if (flags & V4L2_MBUS_PCLK_SAMPLE_FALLING)
+ if (flags & V4L2_MBUS_PCLK_SAMPLE_RISING)
cfg |= CSI_IF_CFG_CLK_POL_FALLING_EDGE;
break;
case V4L2_MBUS_BT656:
--
2.14.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 7/7] media: sun6i: Expose controls on the v4l2_device
2018-03-05 9:35 ` [PATCH 0/7] media: sun6i: Various fixes and improvements Maxime Ripard
` (5 preceding siblings ...)
2018-03-05 9:35 ` [PATCH 6/7] media: sun6i: Invert the polarities Maxime Ripard
@ 2018-03-05 9:35 ` Maxime Ripard
2018-03-05 9:35 ` [PATCH 8/8] media: sun6i: Add g_parm/s_parm ioctl support Maxime Ripard
2018-03-05 10:35 ` [PATCH 0/7] media: sun6i: Various fixes and improvements Yong
8 siblings, 0 replies; 13+ messages in thread
From: Maxime Ripard @ 2018-03-05 9:35 UTC (permalink / raw)
To: Yong Deng
Cc: Mauro Carvalho Chehab, Chen-Yu Tsai, Maxime Ripard, Hans Verkuil,
Sakari Ailus, linux-media, linux-arm-kernel, Thomas Petazzoni,
Mylene Josserand
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
---
drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c | 8 ++++++++
drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.h | 2 ++
drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c | 6 ++++++
3 files changed, 16 insertions(+)
diff --git a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c
index a93bc25ff372..26d57e6053df 100644
--- a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c
+++ b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c
@@ -729,7 +729,15 @@ static int sun6i_csi_v4l2_init(struct sun6i_csi *csi)
media_device_init(&csi->media_dev);
+ ret = v4l2_ctrl_handler_init(&csi->ctrl_handler, 0);
+ if (ret) {
+ dev_err(csi->dev, "V4L2 controls handler init failed (%d)\n",
+ ret);
+ goto clean_media;
+ }
+
csi->v4l2_dev.mdev = &csi->media_dev;
+ csi->v4l2_dev.ctrl_handler = &csi->ctrl_handler;
ret = v4l2_device_register(csi->dev, &csi->v4l2_dev);
if (ret) {
dev_err(csi->dev, "V4L2 device registration failed (%d)\n",
diff --git a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.h b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.h
index c1a1e3aefaa8..c0e8b14073d1 100644
--- a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.h
+++ b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.h
@@ -8,6 +8,7 @@
#ifndef __SUN6I_CSI_H__
#define __SUN6I_CSI_H__
+#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
#include <media/v4l2-fwnode.h>
@@ -33,6 +34,7 @@ struct sun6i_csi_config {
struct sun6i_csi {
struct device *dev;
+ struct v4l2_ctrl_handler ctrl_handler;
struct v4l2_device v4l2_dev;
struct media_device media_dev;
diff --git a/drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c b/drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c
index c74565d15014..bf7c0d1d1d47 100644
--- a/drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c
+++ b/drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c
@@ -8,6 +8,7 @@
#include <linux/of.h>
#include <media/v4l2-device.h>
+#include <media/v4l2-event.h>
#include <media/v4l2-ioctl.h>
#include <media/v4l2-mc.h>
#include <media/videobuf2-dma-contig.h>
@@ -497,6 +498,11 @@ static const struct v4l2_ioctl_ops sun6i_video_ioctl_ops = {
.vidioc_prepare_buf = vb2_ioctl_prepare_buf,
.vidioc_streamon = vb2_ioctl_streamon,
.vidioc_streamoff = vb2_ioctl_streamoff,
+
+ .vidioc_log_status = v4l2_ctrl_log_status,
+ .vidioc_subscribe_event = v4l2_ctrl_subscribe_event,
+ .vidioc_unsubscribe_event = v4l2_event_unsubscribe,
+
};
/* -----------------------------------------------------------------------------
--
2.14.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 8/8] media: sun6i: Add g_parm/s_parm ioctl support
2018-03-05 9:35 ` [PATCH 0/7] media: sun6i: Various fixes and improvements Maxime Ripard
` (6 preceding siblings ...)
2018-03-05 9:35 ` [PATCH 7/7] media: sun6i: Expose controls on the v4l2_device Maxime Ripard
@ 2018-03-05 9:35 ` Maxime Ripard
2018-03-05 9:46 ` Maxime Ripard
2018-03-05 10:35 ` [PATCH 0/7] media: sun6i: Various fixes and improvements Yong
8 siblings, 1 reply; 13+ messages in thread
From: Maxime Ripard @ 2018-03-05 9:35 UTC (permalink / raw)
To: Yong Deng
Cc: Mauro Carvalho Chehab, Chen-Yu Tsai, Maxime Ripard, Hans Verkuil,
Sakari Ailus, linux-media, linux-arm-kernel, Thomas Petazzoni,
Mylene Josserand
Add a g_parm and s_parm callback in order to be able to control the sensor
framerate of the sensor.
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
---
.../media/platform/sunxi/sun6i-csi/sun6i_video.c | 29 ++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c b/drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c
index bf7c0d1d1d47..bac867004fa0 100644
--- a/drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c
+++ b/drivers/media/platform/sunxi/sun6i-csi/sun6i_video.c
@@ -478,6 +478,32 @@ static int vidioc_s_input(struct file *file, void *fh, unsigned int i)
return 0;
}
+static int vidioc_g_parm(struct file *file, void *fh, struct v4l2_streamparm *a)
+{
+ struct sun6i_video *video = video_drvdata(file);
+ struct v4l2_subdev *subdev;
+ u32 pad;
+
+ subdev = sun6i_video_remote_subdev(video, &pad);
+ if (subdev == NULL)
+ return -ENXIO;
+
+ return v4l2_g_parm_cap(video_devdata(file), subdev, a);
+}
+
+static int vidioc_s_parm(struct file *file, void *fh, struct v4l2_streamparm *a)
+{
+ struct sun6i_video *video = video_drvdata(file);
+ struct v4l2_subdev *subdev;
+ u32 pad;
+
+ subdev = sun6i_video_remote_subdev(video, &pad);
+ if (subdev == NULL)
+ return -ENXIO;
+
+ return v4l2_s_parm_cap(video_devdata(file), subdev, a);
+}
+
static const struct v4l2_ioctl_ops sun6i_video_ioctl_ops = {
.vidioc_querycap = vidioc_querycap,
.vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap,
@@ -489,6 +515,9 @@ static const struct v4l2_ioctl_ops sun6i_video_ioctl_ops = {
.vidioc_s_input = vidioc_s_input,
.vidioc_g_input = vidioc_g_input,
+ .vidioc_g_parm = vidioc_g_parm,
+ .vidioc_s_parm = vidioc_s_parm,
+
.vidioc_reqbufs = vb2_ioctl_reqbufs,
.vidioc_querybuf = vb2_ioctl_querybuf,
.vidioc_qbuf = vb2_ioctl_qbuf,
--
2.14.3
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 8/8] media: sun6i: Add g_parm/s_parm ioctl support
2018-03-05 9:35 ` [PATCH 8/8] media: sun6i: Add g_parm/s_parm ioctl support Maxime Ripard
@ 2018-03-05 9:46 ` Maxime Ripard
0 siblings, 0 replies; 13+ messages in thread
From: Maxime Ripard @ 2018-03-05 9:46 UTC (permalink / raw)
To: Yong Deng
Cc: Mauro Carvalho Chehab, Chen-Yu Tsai, Hans Verkuil, Sakari Ailus,
linux-media, linux-arm-kernel, Thomas Petazzoni,
Mylene Josserand
[-- Attachment #1: Type: text/plain, Size: 506 bytes --]
On Mon, Mar 05, 2018 at 10:35:35AM +0100, Maxime Ripard wrote:
> Add a g_parm and s_parm callback in order to be able to control the sensor
> framerate of the sensor.
>
> Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>
Hmmm, that patch shouldn't have been there. This is an outdated
version based on Hans g_parm/s_parm rework that will not need this
anymore.
Maxime
--
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 0/7] media: sun6i: Various fixes and improvements
2018-03-05 9:35 ` [PATCH 0/7] media: sun6i: Various fixes and improvements Maxime Ripard
` (7 preceding siblings ...)
2018-03-05 9:35 ` [PATCH 8/8] media: sun6i: Add g_parm/s_parm ioctl support Maxime Ripard
@ 2018-03-05 10:35 ` Yong
2018-03-06 9:34 ` Maxime Ripard
8 siblings, 1 reply; 13+ messages in thread
From: Yong @ 2018-03-05 10:35 UTC (permalink / raw)
To: Maxime Ripard
Cc: Mauro Carvalho Chehab, Chen-Yu Tsai, Hans Verkuil, Sakari Ailus,
linux-media, linux-arm-kernel, Thomas Petazzoni,
Mylene Josserand
Hi Maxime,
On Mon, 5 Mar 2018 10:35:27 +0100
Maxime Ripard <maxime.ripard@bootlin.com> wrote:
> Hi Yong,
>
> Here are a bunch of patches I came up with after testing your last
> (v8) version of the CSI patches.
>
> There's some improvements (patches 1 and 7) and fixes for
> regressions found in the v8 compared to the v7 (patches 2, 3, 4 and
> 5), and one fix that we discussed for the signals polarity for the
> parallel interface (patch 6).
>
> Feel free to squash them in your serie for the v9.
OK. Thank you!
I notice that your responses have not been listed in google group
since February.
> Thanks!
> Maxime
>
> Maxime Ripard (7):
> media: sun6i: Fill dma_pfn_offset to accomodate for the RAM offset
> media: sun6i: Reduce the error level
> media: sun6i: Pass the sun6i_csi_dev pointer to our helpers
> media: sun6i: Don't emit a warning when the configured format isn't
> found
> media: sun6i: Support the YUYV format properly
> media: sun6i: Invert the polarities
> media: sun6i: Expose controls on the v4l2_device
>
> drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c | 85 ++++++++++++++--------
> drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.h | 2 +
> .../media/platform/sunxi/sun6i-csi/sun6i_video.c | 6 ++
> 3 files changed, 63 insertions(+), 30 deletions(-)
>
> --
> 2.14.3
Thanks,
Yong
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 0/7] media: sun6i: Various fixes and improvements
2018-03-05 10:35 ` [PATCH 0/7] media: sun6i: Various fixes and improvements Yong
@ 2018-03-06 9:34 ` Maxime Ripard
0 siblings, 0 replies; 13+ messages in thread
From: Maxime Ripard @ 2018-03-06 9:34 UTC (permalink / raw)
To: Yong
Cc: Mauro Carvalho Chehab, Chen-Yu Tsai, Hans Verkuil, Sakari Ailus,
linux-media, linux-arm-kernel, Thomas Petazzoni,
Mylene Josserand
[-- Attachment #1: Type: text/plain, Size: 906 bytes --]
On Mon, Mar 05, 2018 at 06:35:35PM +0800, Yong wrote:
> > Hi Yong,
> >
> > Here are a bunch of patches I came up with after testing your last
> > (v8) version of the CSI patches.
> >
> > There's some improvements (patches 1 and 7) and fixes for
> > regressions found in the v8 compared to the v7 (patches 2, 3, 4 and
> > 5), and one fix that we discussed for the signals polarity for the
> > parallel interface (patch 6).
> >
> > Feel free to squash them in your serie for the v9.
>
> OK. Thank you!
>
> I notice that your responses have not been listed in google group
> since February.
Yeah, I know, apparently I can't change my email address in google
groups, or unsubscribe, so I'm not subscribed with my new mail, which
means I can't post either.
Maxime
--
Maxime Ripard, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread