From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0DC7D3845AB for ; Tue, 21 Apr 2026 09:47:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776764838; cv=none; b=lZkA2sKE74dlYaJlbwpAfSWltxh+Xv5xvQB4Wh2icVDxk+Hv3OHiAuUCD++IF/+8Q8pyVb5HS+nrGmqZGPUhrofT31TSgBMp0AnEXPVq8y1EZrduA8Ej/lZB/gtYL6BttVllix5cN9cOYhsVaddJDjEqGg1gsWz/VyS/yxquSpQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776764838; c=relaxed/simple; bh=p/1n76QtndyA7N+mwa516LE4DjU1ZfZ8rucKJsWG1fI=; h=Message-ID:Date:MIME-Version:From:Subject:To:Cc:References: In-Reply-To:Content-Type; b=lLjRQSEo20lvYbF5zLE8LOigmNddgeJ5FGba/T2sPisZCvpq6nq173c60SjTmxNvnxhSKLZpH5gusuUBETzFUx5ZQ4O3jz0XEnWe7Fi83e19mMVNOWPXq/tK8IazbhdvHuBhFKIB+lHQFyOHoZqj2qYnDMhQI+IzDlKl/jINKfw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=ouesvUmV; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=djaXiOFr; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="ouesvUmV"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="djaXiOFr" Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 63L9XV6l3164717 for ; Tue, 21 Apr 2026 09:47:16 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= rp6J7WgbrTFFo6tyAT+oL8v/X32Mr9UrX24jWpi2/iM=; b=ouesvUmVSh0q9boc vlbHLzY53BRcZflR4dJoOQ+R+RCa+NglfPCmGcM1/ooopXwaXyN4DdVJslHCBN2o hr0uQxltss2vj6qfJfmpsHCv1WoHDe2yG2MUhnG5TixnLleCwNK6ga7jXPqg9UPi zTsyDTZbHS1qmgoxmNRpGT3/ObeG4qsKKJP/N/IplsDKsYq49K73fXvlMayBGBoP 4cBiFPWyoqpvruoj6VSd4vME6zRHtYSVr0rkBtGKi7SsRwpjlBCxo1HoL2csNNoW jErYfeVogMtWVZ3VmQU0WJSVtn2tnOmgi+B8eoNEyWwrWbp3+qpmAnuTLQDtulVB IXsRsw== Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4dp6q801k4-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 21 Apr 2026 09:47:15 +0000 (GMT) Received: by mail-qt1-f198.google.com with SMTP id d75a77b69052e-50d826ed6f9so2543061cf.1 for ; Tue, 21 Apr 2026 02:47:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1776764835; x=1777369635; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:from:user-agent:mime-version:date:message-id:from:to :cc:subject:date:message-id:reply-to; bh=rp6J7WgbrTFFo6tyAT+oL8v/X32Mr9UrX24jWpi2/iM=; b=djaXiOFrgZ/8EgJlccvJOpPVv30amK3f6ygWLqeXv1a6QAayBJvm/gJUQQsQEyw6z/ Ilhi/WIZCkNfiU8kLKxd1jfqrEdJSEPHBzm75WcWYUm950nZvVcZZVd/QtgAeDV+yMOe V5I7sLLyc/VOU/KAPOm4bxWw1ch/NcyU9zqabTUafZoVXvIfNaz/AvCu/a60ne5Sv71m whd2dohBcfafjc2Js3gxX0O4cysE5kNVVH+Q3Up6r6fgZAPFBPmpaTrlDTGFL9VzKdWq A/7jbgcHLmMY8CS+vwwYYrlGM/Wh7jUnj9Hdvhy4J/rpWvNX6Bw9VcsaB6aC8wM1iHw/ da7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776764835; x=1777369635; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:from:user-agent:mime-version:date:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=rp6J7WgbrTFFo6tyAT+oL8v/X32Mr9UrX24jWpi2/iM=; b=gC3NclJgp+0oqxxcfjUY0asW5skzo4EFneqB0M155A892EtkGkYML9tw4BQTa83kcO DwdFUH9ch6n05Xs2VYuWj7kKohKqgxUzz98qqDvya/RVzU+FBp+oIEFHtVnD0gSXtpSH qLXDrqT919LhuUgpeGLcbLguuirCLyJd/ibOuMU9G95mrocyADIXW+uabJ8I5Z+QRCx/ rpy0nXorNLDrRMXq2mzQ5NWqCjWqSIcgWN2kCPgH1xrQ2vokQJ346qFw9dR0pXlflx8Z 3N1UaaewTEdm/zpktUar/bPSJEXg4kdhFqt6H51lwf4p7mPI7Pp/oRacKSP+0T0+GcMG rnqw== X-Forwarded-Encrypted: i=1; AFNElJ9kMg/gNJkliBTYIx/c6hbaGziEYnSSZq56JVD/xXfWHWEmEt+yGnbxFPmDaJCKJBulQsT3S8jLVMc+XZI=@vger.kernel.org X-Gm-Message-State: AOJu0YxZhWHgqwGvm62XIYoi0iSrL3RRDFXnO6fhpaxdrjQpY1FSYtmu YviPKdjqXygiyMFmcWEAXWeNfozYq2jPPufFzvS6ZGRNNWfF3z4wZ/wSQaQrpxX+ZDqysr/aMKL 0xM20tOGfzxNg5VQB4C4xhUxL8WaNQqGslfvDcHDP8Beboj6mFKR4F1aeDS28S5XLQFY= X-Gm-Gg: AeBDievTF4Z8qDRJuTDKP1fVVZjLvMstXzf2cKsoNUbsf6b7VXgjkhQykqOUySMO3IP +IT2ArpIi5b57iFJX6VQ3DbYou79qaAz1CuGr4+FmOCv6ybFuFdu0rI4Cw4K028/lqK1f/OjgNX QYgekAaxIXPVSSFExUKrptnDb8FFo7Y11OaYk/5x1s2LwUNohrMcfPRcc9kozpxl0Cu1QucURcC +/5eDod7XWLCiFCaw6tYrI7HTXSGmaD2RDUG/8SkUGEdWytoCOpI80Mex7eVQVQZ06u0oRWncFR We79tv3jUD8z1gapeosYptSCblScTpD0jz6R6P+3tQELqEPKfvW3x/SLiNBQeALCRz18zfrGUNT 30eYjcIQYwn+tRnrXKhou0tRueipNpGwVlTdC0eenyjC8M+3B4RQ3fatwUUGNa52u0KM1/+A1VA 7/k5kauoGuUmFLlSbFA0CDox/3xbxNRuIgTxrQf3xeTwH+DOqCtTj+rU2AjEqT4H5qpfXAKgYVb gURDQkOucn+zVBSt/E9qxnHEE8= X-Received: by 2002:a05:622a:1902:b0:50b:8b8c:f68b with SMTP id d75a77b69052e-50e367b90a2mr225159811cf.39.1776764835270; Tue, 21 Apr 2026 02:47:15 -0700 (PDT) X-Received: by 2002:a05:622a:1902:b0:50b:8b8c:f68b with SMTP id d75a77b69052e-50e367b90a2mr225159561cf.39.1776764834818; Tue, 21 Apr 2026 02:47:14 -0700 (PDT) Received: from ?IPV6:2001:1c00:c32:7800:5bfa:a036:83f0:f9ec? (2001-1c00-0c32-7800-5bfa-a036-83f0-f9ec.cable.dynamic.v6.ziggo.nl. [2001:1c00:c32:7800:5bfa:a036:83f0:f9ec]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ba451211091sm452427066b.5.2026.04.21.02.47.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 21 Apr 2026 02:47:13 -0700 (PDT) Message-ID: <07115433-dcfb-40a9-952a-5f841ee93947@oss.qualcomm.com> Date: Tue, 21 Apr 2026 11:47:12 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Hans de Goede Subject: Re: [PATCH 2/2] media: i2c: imx471: Add Sony IMX471 image sensor driver To: Sakari Ailus Cc: Kate Hsuan , Mauro Carvalho Chehab , Hans Verkuil , Serin Yeh , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org References: <20260417083214.222189-1-hpa@redhat.com> <20260417083214.222189-3-hpa@redhat.com> Content-Language: en-US, nl In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDIxMDA5NSBTYWx0ZWRfX1pZfxO6N+dak B2si6rG2NcSg1v398ewO/zOrPOfY2JZSgMkeAGMJFxLSfhk6Wk/tJ1wfcAHP9eawjJlIfi/m5UO rA7StWyVqywdxGDCQhxCBfRf/uE4akDNuHoNujPBMMGqscrp16us5LLMWRvEQJACUWLGzTv3CG9 JDRRj80M3FGftUMswt3NYgZgSMowLuk6eG9TYRgr5cs+kEFus6HmJmV5qmSDl6y5EXY+HC+i1IA /34/jkXosuF7nP7yeUM+zz769gjNi8Olm1HqtsRIwsaRfDMxDhpFB+MyZ1TQ9tesfbkfZarbmgv Z5r7/sNtXYLHMoYDVVHSTwIEJaqF9e/Irks0Ca/44cE9iPQiqOn91THSG/4ne1LEVQygcz+5214 1A45n8Tjjhe1CoQV3g2JDG3sr63YIlAUbbxYnm0rcNsg+yxhEitqZ0NibrlhXtfk1wV8xO6mifU 87xUl/o2G3EU0ZZZ2Mw== X-Proofpoint-ORIG-GUID: ljVBBET9xD0dll30pMYaX33kXSYsCllc X-Authority-Analysis: v=2.4 cv=eOYjSnp1 c=1 sm=1 tr=0 ts=69e747a3 cx=c_pps a=mPf7EqFMSY9/WdsSgAYMbA==:117 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=A5OVakUREuEA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=gowsoOTTUOVcmtlkKump:22 a=GbLmp5vPsrZZhUY_XBEA:9 a=QEXdDO2ut3YA:10 a=dawVfQjAaf238kedN5IG:22 X-Proofpoint-GUID: ljVBBET9xD0dll30pMYaX33kXSYsCllc X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-21_02,2026-04-20_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 spamscore=0 phishscore=0 impostorscore=0 malwarescore=0 bulkscore=0 adultscore=0 clxscore=1015 lowpriorityscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2604070000 definitions=main-2604210095 Hi Sakari, Kate, On 21-Apr-26 11:02, Sakari Ailus wrote: > Hi Hans, > > On Fri, Apr 17, 2026 at 12:16:11PM +0200, Hans de Goede wrote: ... >>> + >>> + cci_update_bits(sensor->regmap, IMX471_REG_ORIENTATION, >>> + flip_bit, val, &ret); >>> + >>> + return ret; >>> + } >>> + >>> + /* vflip */ >>> + cci_update_bits(sensor->regmap, IMX471_REG_ORIENTATION, >>> + flip_bit, val, &ret); >>> + if (ret) >>> + return ret; >> >> Hmm, I wonder if the problem here is you doing 2 subsequent >> cci_update_bits(). If the flip control registered is double-buffered >> and the new value is latched as the actual value on the start >> of the next frame; and this is combined with reading back >> reading the active value, not the last written value then >> the first time you do this the setting of the hflip bit will >> be overwritten by the second cci_update_bits. >> >> I think it would be better to do something similar to what >> imx219.c and replace these 2 cci_update_bits() calls with: >> >> cci_write(imx471->regmap, IMX471_REG_ORIENTATION, >> imx471->hflip->val | imx471->vflip->val << 1, &ret); >> >> I believe this should work here too. >> >> >>> + >>> + cci_write(sensor->regmap, IMX471_REG_V_WIN_OFFSET, >>> + value ? 0xe0 : 0xeb, &ret); >>> + if (ret) >>> + return ret; >>> + >>> + cci_update_bits(sensor->regmap, IMX471_REG_H_WIN_OFFSET, 1, >>> + value ? 0x01 : 0x00, &ret); >> >> No need for cci_update_bits() here, the register is always >> initialized to 0xc8 so this can just use hardcoded values >> like the V_WIN_OFFSET path: >> >> cci_write(sensor->regmap, IMX471_REG_H_WIN_OFFSET, >> value ? 0xc9 : 0xc8, &ret); >> >>> + return ret; >> >> Updating both offsets here is wrong when hflip != vflip, you >> should only update V_WIN_OFFSET when changing vflip and >> H_WIN_OFFSET when changing hflip. > > The cropping configuration should reflect the values on the sensor's pixel > array and should not be affected by flipping. At least the crop window > needs to be adjusted accordingly by the driver. Is there a need to change > flipping while streaming? Ah, that is a very valid question, no I don't think we do need to set them while streaming. Kate if you cannot get the start_x / start_y coordinate changes when changing flipping to work to get a stable bayer output pattern, then another way to fix this is to only allow changing the flip controls while not streaming and return -EBUSY otherwise. This can then be combined with reporting a flip-ctrl dependend bayer-order so that userspace sees the right bayer-order after flipping is applied as long as userspace reads the subdev format after setting the controls (which libcamera does I believe). For an example of an imx driver which reports a different bayer order depending in flipping see: imx214.c and the imx214_get_format_code() helper, a call to which should be used to replace any hardcoded mbus-formats in the driver. Regards, Hans