All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Chen, JasonX Z" <jasonx.z.chen@intel.com>
To: Tomasz Figa <tfiga@chromium.org>, "Yeh, Andy" <andy.yeh@intel.com>
Cc: Linux Media Mailing List <linux-media@vger.kernel.org>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	"Chiang, AlanX" <alanx.chiang@intel.com>
Subject: RE: [PATCH v11] media: imx258: Add imx258 camera sensor driver
Date: Wed, 9 May 2018 09:28:30 +0000	[thread overview]
Message-ID: <5881B549BE56034BB7E7D11D6EDEA2020678E62E@PGSMSX106.gar.corp.intel.com> (raw)
In-Reply-To: <CAAFQd5BYokHC7J8wEjT4twx7_bU1Yyv1LbN2PAK2tjmCrr2cig@mail.gmail.com>

Hello Tomasz

>> +/* 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
>> +#define REG_CONFIG_MIRROR_FLIP         0x03
>> +#define REG_CONFIG_FLIP_TEST_PATTERN   0x02
>
>The names are inconsistent here. All other register addresses start with IMX258_REG and values with IMX258_<field name> (no REG).
>
>[snip]

We will update at next patch.

>> +static const char * const imx258_test_pattern_menu[] = {
>> +       "Disabled",
>> +       "Color Bars",
>> +       "Solid Color",
>> +       "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,
>> +};
>
>By reordering imx258_test_pattern_menu[], this array can be removed and
>ctrl->val can be used directly. It is validated by control framework to 
>ctrl->be
>within menu range and so safe to be used for programming hardware.
>
>[snip]

IPU3 HAL has a handler to bind test_pattern mode.
The COLOR BAR MODE in HAL has been configured to 1 when APP requests to output color bar image. 
However Sony sensor's COLOR BAR MODE is designed as 2 in register table. (grey color bars as 1).
When HAL sends handler to driver to switch test pattern mode (to COLOR BAR - val: 1), it will be grey color, since driver still set TEST_PATTERN_MODE reg value to 1, those it is not what we expected.

That is why we have to make an array with index to arrange the order of the test pattern items, so driver will choose COLOR BAR correctly when HAL send test_pattern message (with 1).
The concept is the test_pattern_menu could be listed in driver per real requirement, no matter how the sensor register is designed.

>> +       case V4L2_CID_TEST_PATTERN:
>> +               ret = imx258_write_reg(imx258, IMX258_REG_TEST_PATTERN,
>> +                               IMX258_REG_VALUE_16BIT,
>> +                               imx258_test_pattern_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 :
>> +                               REG_CONFIG_FLIP_TEST_PATTERN);
>
>The comparison above doesn't make any sense. ctrl->val is an index into imx258_test_pattern_val[], but imx258_test_pattern_val[IMX258_TEST_PATTERN_DISABLE] is a register value.
>Moreover, IMX258_TEST_PATTERN_DISABLE is also a register value, so it doesn't make sense to use it for indexing the array. I'd suggest simply checking for (!ctrl->val).
>

We will update at next patch.


B.R.,
Jason

  reply	other threads:[~2018-05-09  9:28 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-02 15:46 [PATCH v11] media: imx258: Add imx258 camera sensor driver Andy Yeh
2018-05-03 11:23 ` Sakari Ailus
2018-05-08  8:34 ` Tomasz Figa
2018-05-09  9:28   ` Chen, JasonX Z [this message]
2018-05-09  9:42     ` Sakari Ailus
2018-05-10 11:08       ` Zheng, Jian Xu
2018-05-12 12:47         ` Sakari Ailus
2018-05-15  3:46           ` Zheng, Jian Xu
2018-05-15  7:59             ` Sakari Ailus
2018-05-09 10:05     ` Tomasz Figa
2018-05-10  6:56       ` Zheng, Jian Xu
2018-05-10  7:04         ` Tomasz Figa
2018-05-10  8:33           ` Yeh, Andy
2018-05-10  8:39             ` Tomasz Figa
2018-05-10  9:11           ` Zheng, Jian Xu
2018-05-10  9:15             ` Tomasz Figa
2018-05-12 12:52               ` Sakari Ailus
2018-05-12 13:49                 ` Tomasz Figa
2018-05-09 19:02 ` Mauro Carvalho Chehab
2018-05-10  2:05 ` Yunliang Ding

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=5881B549BE56034BB7E7D11D6EDEA2020678E62E@PGSMSX106.gar.corp.intel.com \
    --to=jasonx.z.chen@intel.com \
    --cc=alanx.chiang@intel.com \
    --cc=andy.yeh@intel.com \
    --cc=linux-media@vger.kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=tfiga@chromium.org \
    /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.