Linux Media Controller development
 help / color / mirror / Atom feed
From: Hao Yao <hao.yao@intel.com>
To: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Arec Kao <arec.kao@intel.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	<linux-media@vger.kernel.org>, Bingbu Cao <bingbu.cao@intel.com>
Subject: Re: [PATCH 2/2] media: i2c: ov13b10: Support 2 lane mode
Date: Tue, 11 Mar 2025 14:42:57 +0800	[thread overview]
Message-ID: <b1dd819b-89f0-4962-907b-29eaadd58ae3@intel.com> (raw)
In-Reply-To: <Z86RSEg3BL0uiWlX@kekkonen.localdomain>

Hi Sakari,

On 2025/3/10 15:14, Sakari Ailus wrote:
> Hi Hao,
> 
> On Mon, Mar 10, 2025 at 12:06:04PM +0800, Hao Yao wrote:
>>>> @@ -1459,12 +1539,25 @@ static int ov13b10_check_hwcfg(struct device *dev)
>>>>    	if (ret)
>>>>    		return ret;
>>>> -	if (bus_cfg.bus.mipi_csi2.num_data_lanes != OV13B10_DATA_LANES) {
>>>> +	dlane = bus_cfg.bus.mipi_csi2.num_data_lanes;
>>>> +	if (dlane != OV13B10_4_DATA_LANES && dlane != OV13B10_2_DATA_LANES) {
>>>>    		dev_err(dev, "number of CSI2 data lanes %d is not supported",
>>>> -			bus_cfg.bus.mipi_csi2.num_data_lanes);
>>>> +			dlane);
>>>>    		ret = -EINVAL;
>>>>    		goto out_err;
>>>>    	}
>>>> +	ov13b->data_lanes = dlane;
>>>> +	ov13b->supported_modes = supported_4_lanes_modes;
>>>> +	ov13b->supported_modes_num = ARRAY_SIZE(supported_4_lanes_modes);
>>>> +	if (dlane == OV13B10_2_DATA_LANES) {
>>>> +		ov13b->supported_modes = supported_2_lanes_modes;
>>>> +		ov13b->supported_modes_num =
>>>> +			ARRAY_SIZE(supported_2_lanes_modes);
>>>
>>> How about using switch() here?
>>
>> How about:
>> 	ov13b->data_lanes = bus_cfg.bus.mipi_csi2.num_data_lanes;
>> 	switch (ov13b->data_lanes) {
>> 	case OV13B10_4_DATA_LANES:
>> 		ov13b->supported_modes = supported_4_lanes_modes;
>> 		ov13b->supported_modes_num =
>> 			ARRAY_SIZE(supported_4_lanes_modes);
>> 		break;
>>
>> 	case OV13B10_2_DATA_LANES:
>> 		ov13b->supported_modes = supported_2_lanes_modes;
>> 		ov13b->supported_modes_num =
>> 			ARRAY_SIZE(supported_2_lanes_modes);
>> 		break;
>>
>> 	default:
>> 		dev_err(dev, "number of CSI2 data lanes %d is not supported",
>> 			ov13b->data_lanes);
>> 		ret = -EINVAL;
>> 		goto out_err;
>> 	}
> 
> Looks good to me. I'd do the assignment to ov13b->data_lanes after checking
> the value though.
> 

Thank you, I will prepare v2 later.
BTW, do you have any suggestions on patch 1/2 ?

Best Regards,
Hao Yao


  reply	other threads:[~2025-03-11  6:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-07  9:31 [PATCH 1/2] media: i2c: ov13b10: Fix h_blank calculation Hao Yao
2025-03-07  9:31 ` [PATCH 2/2] media: i2c: ov13b10: Support 2 lane mode Hao Yao
2025-03-07  9:43   ` Sakari Ailus
2025-03-10  4:06     ` Hao Yao
2025-03-10  7:14       ` Sakari Ailus
2025-03-11  6:42         ` Hao Yao [this message]
2025-03-11  8:17           ` Sakari Ailus

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=b1dd819b-89f0-4962-907b-29eaadd58ae3@intel.com \
    --to=hao.yao@intel.com \
    --cc=arec.kao@intel.com \
    --cc=bingbu.cao@intel.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=sakari.ailus@linux.intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox