From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com [209.85.218.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ED076175D29 for ; Fri, 22 Nov 2024 09:25:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732267553; cv=none; b=CjGHMaovkZYOWLj+8eGXgbvQYDe/VHd64nmS6lJR41cMT0lHydLu87Mq+EKxnVdOGUbAvFGVlNCpyEBgxgWMPHO1mlQwkUvZOu5VHePD6ybMeAjuAiB/Nn6GA001WqHyGMlpLHpJeXfvkFm0USOMP9b/ileUF/spUvxevsixixM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732267553; c=relaxed/simple; bh=yc0fJubc64CpPPPO5rh39xdgkeVNt62XS7Y+a6w3kRw=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=lZQkzvkjfEdHjLAdYByxcQ/GFfL7InRmajQm3JPdqvjAgZPoYTlIi3yCy5jX83K0ScqzbB0keYPAbOPELnxu8rO5fphHC3bu/HslZZsfYyeZZf3QDye4Rj/Y0KCMcmzM1RFILsu2PGN1QuTASW5+fPwqOw3M3qcUy32D54Yp5wE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=0VltoJIc; arc=none smtp.client-ip=209.85.218.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="0VltoJIc" Received: by mail-ej1-f49.google.com with SMTP id a640c23a62f3a-a9f1c590ecdso326066566b.1 for ; Fri, 22 Nov 2024 01:25:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1732267550; x=1732872350; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=8kGVIObe0vVdWgPVNKUPs0E9cZC3gBnTEl6g/zCTMjk=; b=0VltoJIc8irbMu1L8+SU00irK/xc6YJXfFgUWctDq9jEA0BST5Qh5romhDMHGnV08u pbe2DQY9/Lkegu9b/S6vcIP07haf93v2VkOvOYlA18PRN4A8JUyTuGMDWkJqJmv0+NxV eLF8B9RcQ3TLLRuaDr+36xprpXBNk26KcsDbF74Dvs87P8eDivxkGQqDE4UTnuM66Qjr HkGZ9tOBq4tptjCgQlaBWPcin8R5dM238NRI36f6WpKlKE40s+HNJU40iHcToraR41Tw pxHAbHkLkc+HCWGyLMvZYMD5TqZdpGOM8PM8mxw6a1g+HOI1mtT1mzqUUOBjACWF9s3T WBLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732267550; x=1732872350; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8kGVIObe0vVdWgPVNKUPs0E9cZC3gBnTEl6g/zCTMjk=; b=QVVUsTLmtXgmsPSAUrrrBzl75Ouo/3FgQOax8aqelA9+Pyqp5yF0q8qC+qzpdERbMQ aKOIOm8/nYh5olDjPxC+F1PEGfCKo5ZWvK/aWUb3uSHUFeWCj2wuJUh8H0hg0IuYORxn mq5S6thgbZeaiD85tPY/hV5q4qRsECiFjZN30Tf4uCoegQbjL+73vPgmAFEpq76B3USC y7NHSq0PrcwLDvYz8Vqq+oX/QlUnwBbtyNSKIaA+1eIk+XClydtJoUrTYHWsADnFEwML MN6I8XadZuvlBVGx/dNgOKa6inTsRUXawaCV3ZS4TtbjEFGtemkzEAR1aCWR3n9UyL/k xI9g== X-Forwarded-Encrypted: i=1; AJvYcCXWbGzlnduy3WheUbtrShP7FyjJiU2w9oBKwMrqPJ5YE3IMDMB94fXMKAf4l8VlM3HjEM4lU6xySUZcgE4=@vger.kernel.org X-Gm-Message-State: AOJu0YxAM1tKVbbT/ZfJRgzciOvZS40YvgTmjKgkzxGTe+/qUqlTY0H6 ksY+vLhdhskxlj5LIqUgV5M1iizQ2jg6buAE69Z+j0LyDemH46Vnc7mpFpl2ws5iiHm2BBf6fkF wlwkmWcABJ9jnKEz7BiaeqQxr+pVPX6Nh/TGQtQ== X-Gm-Gg: ASbGncsVDECnkyPy9zRkQKc7tRZyxLlLxVHcIdtx6no9h2GW7xfdzlmY5OH/ocYImMa Ff6pjiYk0GTfjFMo0lNGzQtUEOghv1g== X-Google-Smtp-Source: AGHT+IGelwCxgal9/XHOQ4gQV2eBA2tvjKzser7OohWcveCSBW6AFI6GvR8S/BH009DfNRCjqG5gbgXZGS6L6ZzyHyQ= X-Received: by 2002:a17:906:3101:b0:a99:5f16:3539 with SMTP id a640c23a62f3a-aa509694028mr173072766b.0.1732267550340; Fri, 22 Nov 2024 01:25:50 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20241121-add-mtk-isp-3-0-support-v7-0-b04dc9610619@baylibre.com> <20241121-add-mtk-isp-3-0-support-v7-4-b04dc9610619@baylibre.com> <767085562b5efb43f248e8528bb154a6c30d3999.camel@mediatek.com> In-Reply-To: <767085562b5efb43f248e8528bb154a6c30d3999.camel@mediatek.com> From: Julien Stephan Date: Fri, 22 Nov 2024 10:25:39 +0100 Message-ID: Subject: Re: [PATCH v7 4/5] media: platform: mediatek: isp: add mediatek ISP3.0 camsv To: =?UTF-8?B?Q0sgSHUgKOiDoeS/iuWFiSk=?= Cc: "mchehab@kernel.org" , "conor+dt@kernel.org" , "robh@kernel.org" , =?UTF-8?B?QW5keSBIc2llaCAo6Kyd5pm655qTKQ==?= , "matthias.bgg@gmail.com" , "laurent.pinchart@ideasonboard.com" , "krzk+dt@kernel.org" , AngeloGioacchino Del Regno , "linux-kernel@vger.kernel.org" , "linux-mediatek@lists.infradead.org" , "linux-media@vger.kernel.org" , "devicetree@vger.kernel.org" , "paul.elder@ideasonboard.com" , "linux-arm-kernel@lists.infradead.org" , "fsylvestre@baylibre.com" , "pnguyen@baylibre.com" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Le ven. 22 nov. 2024 =C3=A0 09:41, CK Hu (=E8=83=A1=E4=BF=8A=E5=85=89) a =C3=A9crit : > > Hi, Julien: > > On Thu, 2024-11-21 at 09:53 +0100, Julien Stephan wrote: > > External email : Please do not click links or open attachments until yo= u have verified the sender or the content. > > > > > > From: Phi-bang Nguyen > > > > This driver provides a path to bypass the SoC ISP so that image data > > coming from the SENINF can go directly into memory without any image > > processing. This allows the use of an external ISP. > > > > Signed-off-by: Phi-bang Nguyen > > Signed-off-by: Florian Sylvestre > > [Paul Elder fix irq locking] > > Signed-off-by: Paul Elder > > Co-developed-by: Laurent Pinchart > > Signed-off-by: Laurent Pinchart > > Co-developed-by: Julien Stephan > > Signed-off-by: Julien Stephan > > --- > > [snip] > > > +static irqreturn_t isp_irq_camsv30(int irq, void *data) > > +{ > > + struct mtk_cam_dev *cam_dev =3D (struct mtk_cam_dev *)data; > > + struct mtk_cam_dev_buffer *buf; > > + unsigned int irq_status; > > + > > + spin_lock(&cam_dev->buf_list_lock); > > + > > + irq_status =3D mtk_camsv30_read(cam_dev, CAMSV_INT_STATUS); > > + > > + if (irq_status & INT_ST_MASK_CAMSV_ERR) > > + dev_err(cam_dev->dev, "irq error 0x%lx\n", > > + irq_status & INT_ST_MASK_CAMSV_ERR); > > + > > + /* De-queue frame */ > > + if (irq_status & CAMSV_IRQ_PASS1_DON) { > > + cam_dev->sequence++; > > + > > + buf =3D list_first_entry_or_null(&cam_dev->buf_list, > > + struct mtk_cam_dev_buffe= r, > > + list); > > + if (buf) { > > + buf->v4l2_buf.sequence =3D cam_dev->sequence; > > + buf->v4l2_buf.vb2_buf.timestamp =3D > > + ktime_get_ns(); > > + vb2_buffer_done(&buf->v4l2_buf.vb2_buf, > > + VB2_BUF_STATE_DONE); > > + list_del(&buf->list); > > + } > > + > > + buf =3D list_first_entry_or_null(&cam_dev->buf_list, > > + struct mtk_cam_dev_buffe= r, > > + list); > > + if (buf) > > + mtk_camsv30_update_buffers_add(cam_dev, buf); > > If buf =3D=3D NULL, so hardware would automatically stop DMA? > I don't know how this hardware work. > Below is my imagine about this hardware. > > 1. Software use CAMSV_IMGO_FBC_RCNT_INC to increase software buffer index= . > 2. Hardware has a hardware buffer index. After hardware finish one frame,= hardware buffer index increase. > 3. After software buffer index increase, hardware start DMA. > 4. When hardware buffer index is equal to software buffer index, hardware= automatically stop DMA. > > Does the hardware work as my imagine? > If hardware could automatically stop DMA, add comment to describe. > If hardware could not automatically stop DMA, software should do somethin= g to stop DMA when buf =3D=3D NULL. > You are right except that dma is not stopped but frames are automatically dropped by hardware until a new buffer is enqueued and software uses CAMSV_IMGO_FBC_RCNT_INC to increase the software buffer index. What about adding the following comment: /* * If there is no user buffer available, hardware will drop automatically * frames until buf_queue is called */ Let me know if that works for you Cheers Julien > Regards, > CK > > > + } > > + > > + spin_unlock(&cam_dev->buf_list_lock); > > + > > + return IRQ_HANDLED; > > +} > > + > > ************* MEDIATEK Confidentiality Notice ******************** > The information contained in this e-mail message (including any > attachments) may be confidential, proprietary, privileged, or otherwise > exempt from disclosure under applicable laws. It is intended to be > conveyed only to the designated recipient(s). Any use, dissemination, > distribution, printing, retaining or copying of this e-mail (including it= s > attachments) by unintended recipient(s) is strictly prohibited and may > be unlawful. If you are not an intended recipient of this e-mail, or beli= eve > that you have received this e-mail in error, please notify the sender > immediately (by replying to this e-mail), delete any and all copies of > this e-mail (including any attachments) from your system, and do not > disclose the content of this e-mail to any other person. Thank you!