All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] media: imx258: remove test pattern map from driver
@ 2018-11-08  2:47 jasonx.z.chen
  0 siblings, 0 replies; 6+ messages in thread
From: jasonx.z.chen @ 2018-11-08  2:47 UTC (permalink / raw)
  To: linux-media; +Cc: sakari.ailus, andy.yeh, tfiga

From: "Chen, JasonX Z" <jasonx.z.chen@intel.com>

change bayer order when using test pattern mode.
remove test pattern mapping method

Signed-off-by: Chen, JasonX Z <jasonx.z.chen@intel.com>
---
 drivers/media/i2c/imx258.c | 23 ++++-------------------
 1 file changed, 4 insertions(+), 19 deletions(-)

diff --git a/drivers/media/i2c/imx258.c b/drivers/media/i2c/imx258.c
index 31a1e22..5a72b4a 100644
--- a/drivers/media/i2c/imx258.c
+++ b/drivers/media/i2c/imx258.c
@@ -62,11 +62,6 @@
 
 /* Test Pattern Control */
 #define IMX258_REG_TEST_PATTERN		0x0600
-#define IMX258_TEST_PATTERN_DISABLE	0
-#define IMX258_TEST_PATTERN_SOLID_COLOR	1
-#define IMX258_TEST_PATTERN_COLOR_BARS	2
-#define IMX258_TEST_PATTERN_GREY_COLOR	3
-#define IMX258_TEST_PATTERN_PN9		4
 
 /* Orientation */
 #define REG_MIRROR_FLIP_CONTROL		0x0101
@@ -504,20 +499,12 @@ struct imx258_mode {
 
 static const char * const imx258_test_pattern_menu[] = {
 	"Disabled",
-	"Color Bars",
 	"Solid Color",
+	"Color Bars",
 	"Grey Color Bars",
 	"PN9"
 };
 
-static const int imx258_test_pattern_val[] = {
-	IMX258_TEST_PATTERN_DISABLE,
-	IMX258_TEST_PATTERN_COLOR_BARS,
-	IMX258_TEST_PATTERN_SOLID_COLOR,
-	IMX258_TEST_PATTERN_GREY_COLOR,
-	IMX258_TEST_PATTERN_PN9,
-};
-
 /* Configurations for supported link frequencies */
 #define IMX258_LINK_FREQ_634MHZ	633600000ULL
 #define IMX258_LINK_FREQ_320MHZ	320000000ULL
@@ -757,6 +744,7 @@ static int imx258_set_ctrl(struct v4l2_ctrl *ctrl)
 	 * Applying V4L2 control value only happens
 	 * when power is up for streaming
 	 */
+
 	if (pm_runtime_get_if_in_use(&client->dev) == 0)
 		return 0;
 
@@ -778,13 +766,10 @@ static int imx258_set_ctrl(struct v4l2_ctrl *ctrl)
 	case V4L2_CID_TEST_PATTERN:
 		ret = imx258_write_reg(imx258, IMX258_REG_TEST_PATTERN,
 				IMX258_REG_VALUE_16BIT,
-				imx258_test_pattern_val[ctrl->val]);
-
+				ctrl->val);
 		ret = imx258_write_reg(imx258, REG_MIRROR_FLIP_CONTROL,
 				IMX258_REG_VALUE_08BIT,
-				ctrl->val == imx258_test_pattern_val
-				[IMX258_TEST_PATTERN_DISABLE] ?
-				REG_CONFIG_MIRROR_FLIP :
+				!ctrl->val ? REG_CONFIG_MIRROR_FLIP :
 				REG_CONFIG_FLIP_TEST_PATTERN);
 		break;
 	default:
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* RE: [PATCH] media: imx258: remove test pattern map from driver
  2018-11-07 10:31 ` Sakari Ailus
@ 2018-11-08  2:54   ` Chen, JasonX Z
  0 siblings, 0 replies; 6+ messages in thread
From: Chen, JasonX Z @ 2018-11-08  2:54 UTC (permalink / raw)
  To: Sakari Ailus; +Cc: linux-media, Yeh, Andy, tfiga

Hi Sakari 

Thanks for your feedback.
I will update to the next patch.

B.R.,
Jason

-----Original Message-----
From: Sakari Ailus [mailto:sakari.ailus@linux.intel.com] 
Sent: Wednesday, November 7, 2018 6:32 PM
To: Chen, JasonX Z <jasonx.z.chen@intel.com>
Cc: linux-media@vger.kernel.org; Yeh, Andy <andy.yeh@intel.com>; tfiga@chromium.org
Subject: Re: [PATCH] media: imx258: remove test pattern map from driver

Hi Jason,

Thanks for the patch.

On Wed, Nov 07, 2018 at 03:22:23PM +0800, jasonx.z.chen@intel.com wrote:
> From: "Chen, JasonX Z" <jasonx.z.chen@intel.com>
> 
> Test Pattern mode be picked at HAL instead of driver.
> do a FLIP when userspace use test pattern mode.
> add entity_ops for validating imx258 link.
> 
> Signed-off-by: Chen, JasonX Z <jasonx.z.chen@intel.com>
> ---
>  drivers/media/i2c/imx258.c | 28 ++++++++--------------------
>  1 file changed, 8 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/media/i2c/imx258.c b/drivers/media/i2c/imx258.c 
> index 31a1e22..71f9875 100644
> --- a/drivers/media/i2c/imx258.c
> +++ b/drivers/media/i2c/imx258.c
> @@ -62,11 +62,6 @@
>  
>  /* Test Pattern Control */
>  #define IMX258_REG_TEST_PATTERN		0x0600
> -#define IMX258_TEST_PATTERN_DISABLE	0
> -#define IMX258_TEST_PATTERN_SOLID_COLOR	1
> -#define IMX258_TEST_PATTERN_COLOR_BARS	2
> -#define IMX258_TEST_PATTERN_GREY_COLOR	3
> -#define IMX258_TEST_PATTERN_PN9		4
>  
>  /* Orientation */
>  #define REG_MIRROR_FLIP_CONTROL		0x0101
> @@ -504,20 +499,12 @@ struct imx258_mode {
>  
>  static const char * const imx258_test_pattern_menu[] = {
>  	"Disabled",
> -	"Color Bars",
>  	"Solid Color",
> +	"Color Bars",
>  	"Grey Color Bars",
>  	"PN9"
>  };
>  
> -static const int imx258_test_pattern_val[] = {
> -	IMX258_TEST_PATTERN_DISABLE,
> -	IMX258_TEST_PATTERN_COLOR_BARS,
> -	IMX258_TEST_PATTERN_SOLID_COLOR,
> -	IMX258_TEST_PATTERN_GREY_COLOR,
> -	IMX258_TEST_PATTERN_PN9,
> -};
> -
>  /* Configurations for supported link frequencies */
>  #define IMX258_LINK_FREQ_634MHZ	633600000ULL
>  #define IMX258_LINK_FREQ_320MHZ	320000000ULL
> @@ -752,7 +739,6 @@ static int imx258_set_ctrl(struct v4l2_ctrl *ctrl)
>  		container_of(ctrl->handler, struct imx258, ctrl_handler);
>  	struct i2c_client *client = v4l2_get_subdevdata(&imx258->sd);
>  	int ret = 0;
> -

This seems like an unrelated change, and it's a common (and usually good) practice to add an empty line after variable declarations.

>  	/*
>  	 * Applying V4L2 control value only happens
>  	 * when power is up for streaming
> @@ -778,13 +764,10 @@ static int imx258_set_ctrl(struct v4l2_ctrl *ctrl)
>  	case V4L2_CID_TEST_PATTERN:
>  		ret = imx258_write_reg(imx258, IMX258_REG_TEST_PATTERN,
>  				IMX258_REG_VALUE_16BIT,
> -				imx258_test_pattern_val[ctrl->val]);
> -
> +				ctrl->val);
>  		ret = imx258_write_reg(imx258, REG_MIRROR_FLIP_CONTROL,
>  				IMX258_REG_VALUE_08BIT,
> -				ctrl->val == imx258_test_pattern_val
> -				[IMX258_TEST_PATTERN_DISABLE] ?
> -				REG_CONFIG_MIRROR_FLIP :
> +				!ctrl->val?REG_CONFIG_MIRROR_FLIP :
>  				REG_CONFIG_FLIP_TEST_PATTERN);
>  		break;
>  	default:
> @@ -1105,6 +1088,10 @@ static int imx258_identify_module(struct imx258 *imx258)
>  	.pad = &imx258_pad_ops,
>  };
>  
> +static const struct media_entity_operations imx258_subdev_entity_ops = {
> +	.link_validate = v4l2_subdev_link_validate, };
> +

This seems unrelated as well. Do you need the link validation for something?
As far as I understand, the driver exposes a single source pad; therefore the link_validate op will never be called.

>  static const struct v4l2_subdev_internal_ops imx258_internal_ops = {
>  	.open = imx258_open,
>  };
> @@ -1250,6 +1237,7 @@ static int imx258_probe(struct i2c_client 
> *client)
>  
>  	/* Initialize subdev */
>  	imx258->sd.internal_ops = &imx258_internal_ops;
> +	imx258->sd.entity.ops  = &imx258_subdev_entity_ops;

Ditto.

>  	imx258->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
>  	imx258->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR;
>  

--
Kind regards,

Sakari Ailus
sakari.ailus@linux.intel.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] media: imx258: remove test pattern map from driver
  2018-11-07  7:22 jasonx.z.chen
@ 2018-11-07 10:31 ` Sakari Ailus
  2018-11-08  2:54   ` Chen, JasonX Z
  0 siblings, 1 reply; 6+ messages in thread
From: Sakari Ailus @ 2018-11-07 10:31 UTC (permalink / raw)
  To: jasonx.z.chen; +Cc: linux-media, andy.yeh, tfiga

Hi Jason,

Thanks for the patch.

On Wed, Nov 07, 2018 at 03:22:23PM +0800, jasonx.z.chen@intel.com wrote:
> From: "Chen, JasonX Z" <jasonx.z.chen@intel.com>
> 
> Test Pattern mode be picked at HAL instead of driver.
> do a FLIP when userspace use test pattern mode.
> add entity_ops for validating imx258 link.
> 
> Signed-off-by: Chen, JasonX Z <jasonx.z.chen@intel.com>
> ---
>  drivers/media/i2c/imx258.c | 28 ++++++++--------------------
>  1 file changed, 8 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/media/i2c/imx258.c b/drivers/media/i2c/imx258.c
> index 31a1e22..71f9875 100644
> --- a/drivers/media/i2c/imx258.c
> +++ b/drivers/media/i2c/imx258.c
> @@ -62,11 +62,6 @@
>  
>  /* Test Pattern Control */
>  #define IMX258_REG_TEST_PATTERN		0x0600
> -#define IMX258_TEST_PATTERN_DISABLE	0
> -#define IMX258_TEST_PATTERN_SOLID_COLOR	1
> -#define IMX258_TEST_PATTERN_COLOR_BARS	2
> -#define IMX258_TEST_PATTERN_GREY_COLOR	3
> -#define IMX258_TEST_PATTERN_PN9		4
>  
>  /* Orientation */
>  #define REG_MIRROR_FLIP_CONTROL		0x0101
> @@ -504,20 +499,12 @@ struct imx258_mode {
>  
>  static const char * const imx258_test_pattern_menu[] = {
>  	"Disabled",
> -	"Color Bars",
>  	"Solid Color",
> +	"Color Bars",
>  	"Grey Color Bars",
>  	"PN9"
>  };
>  
> -static const int imx258_test_pattern_val[] = {
> -	IMX258_TEST_PATTERN_DISABLE,
> -	IMX258_TEST_PATTERN_COLOR_BARS,
> -	IMX258_TEST_PATTERN_SOLID_COLOR,
> -	IMX258_TEST_PATTERN_GREY_COLOR,
> -	IMX258_TEST_PATTERN_PN9,
> -};
> -
>  /* Configurations for supported link frequencies */
>  #define IMX258_LINK_FREQ_634MHZ	633600000ULL
>  #define IMX258_LINK_FREQ_320MHZ	320000000ULL
> @@ -752,7 +739,6 @@ static int imx258_set_ctrl(struct v4l2_ctrl *ctrl)
>  		container_of(ctrl->handler, struct imx258, ctrl_handler);
>  	struct i2c_client *client = v4l2_get_subdevdata(&imx258->sd);
>  	int ret = 0;
> -

This seems like an unrelated change, and it's a common (and usually good)
practice to add an empty line after variable declarations.

>  	/*
>  	 * Applying V4L2 control value only happens
>  	 * when power is up for streaming
> @@ -778,13 +764,10 @@ static int imx258_set_ctrl(struct v4l2_ctrl *ctrl)
>  	case V4L2_CID_TEST_PATTERN:
>  		ret = imx258_write_reg(imx258, IMX258_REG_TEST_PATTERN,
>  				IMX258_REG_VALUE_16BIT,
> -				imx258_test_pattern_val[ctrl->val]);
> -
> +				ctrl->val);
>  		ret = imx258_write_reg(imx258, REG_MIRROR_FLIP_CONTROL,
>  				IMX258_REG_VALUE_08BIT,
> -				ctrl->val == imx258_test_pattern_val
> -				[IMX258_TEST_PATTERN_DISABLE] ?
> -				REG_CONFIG_MIRROR_FLIP :
> +				!ctrl->val?REG_CONFIG_MIRROR_FLIP :
>  				REG_CONFIG_FLIP_TEST_PATTERN);
>  		break;
>  	default:
> @@ -1105,6 +1088,10 @@ static int imx258_identify_module(struct imx258 *imx258)
>  	.pad = &imx258_pad_ops,
>  };
>  
> +static const struct media_entity_operations imx258_subdev_entity_ops = {
> +	.link_validate = v4l2_subdev_link_validate,
> +};
> +

This seems unrelated as well. Do you need the link validation for something?
As far as I understand, the driver exposes a single source pad; therefore
the link_validate op will never be called.

>  static const struct v4l2_subdev_internal_ops imx258_internal_ops = {
>  	.open = imx258_open,
>  };
> @@ -1250,6 +1237,7 @@ static int imx258_probe(struct i2c_client *client)
>  
>  	/* Initialize subdev */
>  	imx258->sd.internal_ops = &imx258_internal_ops;
> +	imx258->sd.entity.ops  = &imx258_subdev_entity_ops;

Ditto.

>  	imx258->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
>  	imx258->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR;
>  

-- 
Kind regards,

Sakari Ailus
sakari.ailus@linux.intel.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] media: imx258: remove test pattern map from driver
@ 2018-11-07  7:22 jasonx.z.chen
  2018-11-07 10:31 ` Sakari Ailus
  0 siblings, 1 reply; 6+ messages in thread
From: jasonx.z.chen @ 2018-11-07  7:22 UTC (permalink / raw)
  To: linux-media; +Cc: sakari.ailus, andy.yeh, tfiga

From: "Chen, JasonX Z" <jasonx.z.chen@intel.com>

Test Pattern mode be picked at HAL instead of driver.
do a FLIP when userspace use test pattern mode.
add entity_ops for validating imx258 link.

Signed-off-by: Chen, JasonX Z <jasonx.z.chen@intel.com>
---
 drivers/media/i2c/imx258.c | 28 ++++++++--------------------
 1 file changed, 8 insertions(+), 20 deletions(-)

diff --git a/drivers/media/i2c/imx258.c b/drivers/media/i2c/imx258.c
index 31a1e22..71f9875 100644
--- a/drivers/media/i2c/imx258.c
+++ b/drivers/media/i2c/imx258.c
@@ -62,11 +62,6 @@
 
 /* Test Pattern Control */
 #define IMX258_REG_TEST_PATTERN		0x0600
-#define IMX258_TEST_PATTERN_DISABLE	0
-#define IMX258_TEST_PATTERN_SOLID_COLOR	1
-#define IMX258_TEST_PATTERN_COLOR_BARS	2
-#define IMX258_TEST_PATTERN_GREY_COLOR	3
-#define IMX258_TEST_PATTERN_PN9		4
 
 /* Orientation */
 #define REG_MIRROR_FLIP_CONTROL		0x0101
@@ -504,20 +499,12 @@ struct imx258_mode {
 
 static const char * const imx258_test_pattern_menu[] = {
 	"Disabled",
-	"Color Bars",
 	"Solid Color",
+	"Color Bars",
 	"Grey Color Bars",
 	"PN9"
 };
 
-static const int imx258_test_pattern_val[] = {
-	IMX258_TEST_PATTERN_DISABLE,
-	IMX258_TEST_PATTERN_COLOR_BARS,
-	IMX258_TEST_PATTERN_SOLID_COLOR,
-	IMX258_TEST_PATTERN_GREY_COLOR,
-	IMX258_TEST_PATTERN_PN9,
-};
-
 /* Configurations for supported link frequencies */
 #define IMX258_LINK_FREQ_634MHZ	633600000ULL
 #define IMX258_LINK_FREQ_320MHZ	320000000ULL
@@ -752,7 +739,6 @@ static int imx258_set_ctrl(struct v4l2_ctrl *ctrl)
 		container_of(ctrl->handler, struct imx258, ctrl_handler);
 	struct i2c_client *client = v4l2_get_subdevdata(&imx258->sd);
 	int ret = 0;
-
 	/*
 	 * Applying V4L2 control value only happens
 	 * when power is up for streaming
@@ -778,13 +764,10 @@ static int imx258_set_ctrl(struct v4l2_ctrl *ctrl)
 	case V4L2_CID_TEST_PATTERN:
 		ret = imx258_write_reg(imx258, IMX258_REG_TEST_PATTERN,
 				IMX258_REG_VALUE_16BIT,
-				imx258_test_pattern_val[ctrl->val]);
-
+				ctrl->val);
 		ret = imx258_write_reg(imx258, REG_MIRROR_FLIP_CONTROL,
 				IMX258_REG_VALUE_08BIT,
-				ctrl->val == imx258_test_pattern_val
-				[IMX258_TEST_PATTERN_DISABLE] ?
-				REG_CONFIG_MIRROR_FLIP :
+				!ctrl->val?REG_CONFIG_MIRROR_FLIP :
 				REG_CONFIG_FLIP_TEST_PATTERN);
 		break;
 	default:
@@ -1105,6 +1088,10 @@ static int imx258_identify_module(struct imx258 *imx258)
 	.pad = &imx258_pad_ops,
 };
 
+static const struct media_entity_operations imx258_subdev_entity_ops = {
+	.link_validate = v4l2_subdev_link_validate,
+};
+
 static const struct v4l2_subdev_internal_ops imx258_internal_ops = {
 	.open = imx258_open,
 };
@@ -1250,6 +1237,7 @@ static int imx258_probe(struct i2c_client *client)
 
 	/* Initialize subdev */
 	imx258->sd.internal_ops = &imx258_internal_ops;
+	imx258->sd.entity.ops  = &imx258_subdev_entity_ops;
 	imx258->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
 	imx258->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR;
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] media: imx258: remove test pattern map from driver
  2018-08-02  8:17 jasonx.z.chen
@ 2018-08-02 12:39 ` Sakari Ailus
  0 siblings, 0 replies; 6+ messages in thread
From: Sakari Ailus @ 2018-08-02 12:39 UTC (permalink / raw)
  To: jasonx.z.chen; +Cc: linux-media, andy.yeh, tfiga

Hi Jason,

On Thu, Aug 02, 2018 at 04:17:00PM +0800, jasonx.z.chen@intel.com wrote:
> From: "Chen, JasonX Z" <jasonx.z.chen@intel.com>
> 
> Test Pattern mode be picked at HAL instead of driver.
> do a FLIP when userspace use test pattern mode.
> add entity_ops for validating imx258 link.

Hmm. I think this would be changed based on my comments anyway, but please
explain what you're doing and *why*. HAL is not relevant in this context
I'd say.

> 
> Signed-off-by: Chen, JasonX Z <jasonx.z.chen@intel.com>
> ---
>  drivers/media/i2c/imx258.c | 28 ++++++++--------------------
>  1 file changed, 8 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/media/i2c/imx258.c b/drivers/media/i2c/imx258.c
> index 31a1e22..71f9875 100644
> --- a/drivers/media/i2c/imx258.c
> +++ b/drivers/media/i2c/imx258.c
> @@ -62,11 +62,6 @@
>  
>  /* Test Pattern Control */
>  #define IMX258_REG_TEST_PATTERN		0x0600
> -#define IMX258_TEST_PATTERN_DISABLE	0
> -#define IMX258_TEST_PATTERN_SOLID_COLOR	1
> -#define IMX258_TEST_PATTERN_COLOR_BARS	2
> -#define IMX258_TEST_PATTERN_GREY_COLOR	3
> -#define IMX258_TEST_PATTERN_PN9		4
>  
>  /* Orientation */
>  #define REG_MIRROR_FLIP_CONTROL		0x0101
> @@ -504,20 +499,12 @@ struct imx258_mode {
>  
>  static const char * const imx258_test_pattern_menu[] = {
>  	"Disabled",
> -	"Color Bars",
>  	"Solid Color",
> +	"Color Bars",
>  	"Grey Color Bars",
>  	"PN9"
>  };
>  
> -static const int imx258_test_pattern_val[] = {
> -	IMX258_TEST_PATTERN_DISABLE,
> -	IMX258_TEST_PATTERN_COLOR_BARS,
> -	IMX258_TEST_PATTERN_SOLID_COLOR,
> -	IMX258_TEST_PATTERN_GREY_COLOR,
> -	IMX258_TEST_PATTERN_PN9,
> -};
> -
>  /* Configurations for supported link frequencies */
>  #define IMX258_LINK_FREQ_634MHZ	633600000ULL
>  #define IMX258_LINK_FREQ_320MHZ	320000000ULL
> @@ -752,7 +739,6 @@ static int imx258_set_ctrl(struct v4l2_ctrl *ctrl)
>  		container_of(ctrl->handler, struct imx258, ctrl_handler);
>  	struct i2c_client *client = v4l2_get_subdevdata(&imx258->sd);
>  	int ret = 0;
> -

I think this newline is where it should be.

>  	/*
>  	 * Applying V4L2 control value only happens
>  	 * when power is up for streaming
> @@ -778,13 +764,10 @@ static int imx258_set_ctrl(struct v4l2_ctrl *ctrl)
>  	case V4L2_CID_TEST_PATTERN:
>  		ret = imx258_write_reg(imx258, IMX258_REG_TEST_PATTERN,
>  				IMX258_REG_VALUE_16BIT,
> -				imx258_test_pattern_val[ctrl->val]);
> -
> +				ctrl->val);
>  		ret = imx258_write_reg(imx258, REG_MIRROR_FLIP_CONTROL,
>  				IMX258_REG_VALUE_08BIT,
> -				ctrl->val == imx258_test_pattern_val
> -				[IMX258_TEST_PATTERN_DISABLE] ?
> -				REG_CONFIG_MIRROR_FLIP :
> +				!ctrl->val?REG_CONFIG_MIRROR_FLIP :

Spaces around "?".

>  				REG_CONFIG_FLIP_TEST_PATTERN);
>  		break;
>  	default:
> @@ -1105,6 +1088,10 @@ static int imx258_identify_module(struct imx258 *imx258)
>  	.pad = &imx258_pad_ops,
>  };
>  
> +static const struct media_entity_operations imx258_subdev_entity_ops = {
> +	.link_validate = v4l2_subdev_link_validate,

The sensor only has a source pad while the link validate is only needed for
sink pads.

> +};
> +
>  static const struct v4l2_subdev_internal_ops imx258_internal_ops = {
>  	.open = imx258_open,
>  };
> @@ -1250,6 +1237,7 @@ static int imx258_probe(struct i2c_client *client)
>  
>  	/* Initialize subdev */
>  	imx258->sd.internal_ops = &imx258_internal_ops;
> +	imx258->sd.entity.ops  = &imx258_subdev_entity_ops;
>  	imx258->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
>  	imx258->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR;
>  

-- 
Regards,

Sakari Ailus
sakari.ailus@linux.intel.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] media: imx258: remove test pattern map from driver
@ 2018-08-02  8:17 jasonx.z.chen
  2018-08-02 12:39 ` Sakari Ailus
  0 siblings, 1 reply; 6+ messages in thread
From: jasonx.z.chen @ 2018-08-02  8:17 UTC (permalink / raw)
  To: linux-media; +Cc: sakari.ailus, andy.yeh, tfiga, jasonx.z.chen

From: "Chen, JasonX Z" <jasonx.z.chen@intel.com>

Test Pattern mode be picked at HAL instead of driver.
do a FLIP when userspace use test pattern mode.
add entity_ops for validating imx258 link.

Signed-off-by: Chen, JasonX Z <jasonx.z.chen@intel.com>
---
 drivers/media/i2c/imx258.c | 28 ++++++++--------------------
 1 file changed, 8 insertions(+), 20 deletions(-)

diff --git a/drivers/media/i2c/imx258.c b/drivers/media/i2c/imx258.c
index 31a1e22..71f9875 100644
--- a/drivers/media/i2c/imx258.c
+++ b/drivers/media/i2c/imx258.c
@@ -62,11 +62,6 @@
 
 /* Test Pattern Control */
 #define IMX258_REG_TEST_PATTERN		0x0600
-#define IMX258_TEST_PATTERN_DISABLE	0
-#define IMX258_TEST_PATTERN_SOLID_COLOR	1
-#define IMX258_TEST_PATTERN_COLOR_BARS	2
-#define IMX258_TEST_PATTERN_GREY_COLOR	3
-#define IMX258_TEST_PATTERN_PN9		4
 
 /* Orientation */
 #define REG_MIRROR_FLIP_CONTROL		0x0101
@@ -504,20 +499,12 @@ struct imx258_mode {
 
 static const char * const imx258_test_pattern_menu[] = {
 	"Disabled",
-	"Color Bars",
 	"Solid Color",
+	"Color Bars",
 	"Grey Color Bars",
 	"PN9"
 };
 
-static const int imx258_test_pattern_val[] = {
-	IMX258_TEST_PATTERN_DISABLE,
-	IMX258_TEST_PATTERN_COLOR_BARS,
-	IMX258_TEST_PATTERN_SOLID_COLOR,
-	IMX258_TEST_PATTERN_GREY_COLOR,
-	IMX258_TEST_PATTERN_PN9,
-};
-
 /* Configurations for supported link frequencies */
 #define IMX258_LINK_FREQ_634MHZ	633600000ULL
 #define IMX258_LINK_FREQ_320MHZ	320000000ULL
@@ -752,7 +739,6 @@ static int imx258_set_ctrl(struct v4l2_ctrl *ctrl)
 		container_of(ctrl->handler, struct imx258, ctrl_handler);
 	struct i2c_client *client = v4l2_get_subdevdata(&imx258->sd);
 	int ret = 0;
-
 	/*
 	 * Applying V4L2 control value only happens
 	 * when power is up for streaming
@@ -778,13 +764,10 @@ static int imx258_set_ctrl(struct v4l2_ctrl *ctrl)
 	case V4L2_CID_TEST_PATTERN:
 		ret = imx258_write_reg(imx258, IMX258_REG_TEST_PATTERN,
 				IMX258_REG_VALUE_16BIT,
-				imx258_test_pattern_val[ctrl->val]);
-
+				ctrl->val);
 		ret = imx258_write_reg(imx258, REG_MIRROR_FLIP_CONTROL,
 				IMX258_REG_VALUE_08BIT,
-				ctrl->val == imx258_test_pattern_val
-				[IMX258_TEST_PATTERN_DISABLE] ?
-				REG_CONFIG_MIRROR_FLIP :
+				!ctrl->val?REG_CONFIG_MIRROR_FLIP :
 				REG_CONFIG_FLIP_TEST_PATTERN);
 		break;
 	default:
@@ -1105,6 +1088,10 @@ static int imx258_identify_module(struct imx258 *imx258)
 	.pad = &imx258_pad_ops,
 };
 
+static const struct media_entity_operations imx258_subdev_entity_ops = {
+	.link_validate = v4l2_subdev_link_validate,
+};
+
 static const struct v4l2_subdev_internal_ops imx258_internal_ops = {
 	.open = imx258_open,
 };
@@ -1250,6 +1237,7 @@ static int imx258_probe(struct i2c_client *client)
 
 	/* Initialize subdev */
 	imx258->sd.internal_ops = &imx258_internal_ops;
+	imx258->sd.entity.ops  = &imx258_subdev_entity_ops;
 	imx258->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
 	imx258->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR;
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-11-08 12:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-08  2:47 [PATCH] media: imx258: remove test pattern map from driver jasonx.z.chen
  -- strict thread matches above, loose matches on Subject: below --
2018-11-07  7:22 jasonx.z.chen
2018-11-07 10:31 ` Sakari Ailus
2018-11-08  2:54   ` Chen, JasonX Z
2018-08-02  8:17 jasonx.z.chen
2018-08-02 12:39 ` Sakari Ailus

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.