From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (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 C6B1C14B972 for ; Wed, 14 Aug 2024 23:53:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723679602; cv=none; b=BGxvxqilFYcS1jLVB2e9z8nDP+esfXDgV1FOyYYp1GnoTGyFKglsggegokIanG3LDkREkSwJPYq48n1DYmWJQ7VXhWD2AzareEW6JCGUhPd1edD9fMN94o/+lewnEbKCVBXNgR9UlQ9wleWNk5D9LnaJFnwFCDyLDIYVjJxIhbw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723679602; c=relaxed/simple; bh=oWcr9yvSj89hwLY1f4OI1N0YsmHkbUrc/8uMmyWpRAo=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=YxunHPiNwFUX2+c5l0nha7oOikwykfq+h7sPeILGgfWe5c9lg2V6YucxfeisQHJNjn9X5tDHeliPjpyQ4JhCQdQrYG8dIV+Rxo9taRH28XW559+CGMAcPSnOcvBjVIx7hhYFzCb/PMGBJ3Ssy6QViQpH7qlunoFIBzKoe7xAzdg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=U7qAc2E3; arc=none smtp.client-ip=209.85.128.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="U7qAc2E3" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-4280ee5f1e3so2157035e9.0 for ; Wed, 14 Aug 2024 16:53:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723679599; x=1724284399; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=/EGN+b4/f+L1J4PwtsVMenONq33iywKxH0fU8rJy0js=; b=U7qAc2E3dcQ70B+h3jUnQhy+qHCqU2llTkXF2+Cg+HoiJgT30sc054eniEPWtMziqX 8Sw6SIjj5bGVNlOB2lf2Cto67EUaJWF2/2xpx9C9loQ0WlUt8iuXJLoE9Qy3897Oe2pK gnA01EvT07PZqYWbnthAlgJ8zxmQ+r7FvfncUIbwFf9uPGLyh7E7KaWN4yRHfHMlP+m9 yS6BqqhQ97MDupXals/rhRCHN/RQIshgfjerFwxiXtxVpqUsfbq0PaLdX2OUjhJI09dG GoC1sLTQTkOO/nJbQ8XhDdryqD+rcwySYdBuxbuEC046yHX1fy0FyPAY180dwRMupu9P p+Sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723679599; x=1724284399; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=/EGN+b4/f+L1J4PwtsVMenONq33iywKxH0fU8rJy0js=; b=xRb7KubvLwV8i7R/sED3vDdcXFcffcKvTpN+vVWiwldRgJxTtdZWzLhuKmUPJ1YOZz 07LT0MEkLf34jJD8Ps+vIzOv6brCzYC/0G9lXWvmaY21A5KGFIwdgZ2Z0hrMbtScoMxD ELbL+hUwibL+S+PTpFmi71Jg9bWGEl/zeKg5wYEYgoMCGNjdOP4NYF0DkfoXl4ZViVhc fH0Nsc1F5ml6JZACOapHOCZ8qDuQdSAhhAF17T2RYHkH18hMYUSAIw9McCIFfcs1t1i5 11tuKa6ydoj98iJTnWHmvtbstFzw7EqehZA94LRYbsFcjMZJbUc9A3w7vjqwDYd3VKPe xzzA== X-Forwarded-Encrypted: i=1; AJvYcCWGT5a+Zzev9JsknfdCrGSPrYfM7WKBS6/Mf1mH7pv4Okt1Fc1ndK6UYRdeUZmaSegndZW4nBY93XB6LJQVzjz1TVCC36hrn2j8+g== X-Gm-Message-State: AOJu0Yxj/skS8L+abKUVF7zvEBh+xH1B8AXxZsnjzjJBIDNHMjIeD5k7 bZgfa11ZjjW/eeQn1VmHJ8WfjHrr1URAPPqX1K1gFagqcL+rkZxESfE0w7j8fmk= X-Google-Smtp-Source: AGHT+IHnR9FXVZqaGbdhBGxRE1L18EtaOWa7lw8oftSVGi5gyStVTja4iv7pJGXAgPHIo7eMHDjlDQ== X-Received: by 2002:a05:600c:138f:b0:426:6eac:8314 with SMTP id 5b1f17b1804b1-429dd22f4c1mr30463375e9.1.1723679598842; Wed, 14 Aug 2024 16:53:18 -0700 (PDT) Received: from [192.168.0.25] ([176.61.106.227]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-429e7e1c46fsm3963855e9.39.2024.08.14.16.53.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 14 Aug 2024 16:53:18 -0700 (PDT) Message-ID: <8c504081-b0e4-4a64-9e21-e7d040a0aa6c@linaro.org> Date: Thu, 15 Aug 2024 00:53:17 +0100 Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 08/13] media: qcom: camss: csid: Move common code into csid core To: Depeng Shao , rfoss@kernel.org, todor.too@gmail.com, mchehab@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org Cc: linux-arm-msm@vger.kernel.org, linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@quicinc.com References: <20240812144131.369378-1-quic_depengs@quicinc.com> <20240812144131.369378-9-quic_depengs@quicinc.com> Content-Language: en-US From: Bryan O'Donoghue In-Reply-To: <20240812144131.369378-9-quic_depengs@quicinc.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 12/08/2024 15:41, Depeng Shao wrote: > The get hw version and src pad code functions can be common code in csid > core file, then the csid driver of different hw version can reuse them, > rather than adding duplicate code in csid driver for each version. > > Suggested-by: Bryan O'Donoghue > Signed-off-by: Depeng Shao > --- > .../platform/qcom/camss/camss-csid-4-1.c | 19 ----- > .../platform/qcom/camss/camss-csid-4-7.c | 42 ---------- > .../platform/qcom/camss/camss-csid-gen2.c | 60 --------------- > .../media/platform/qcom/camss/camss-csid.c | 77 +++++++++++++++++++ > .../media/platform/qcom/camss/camss-csid.h | 21 +++++ > 5 files changed, 98 insertions(+), 121 deletions(-) > > diff --git a/drivers/media/platform/qcom/camss/camss-csid-4-1.c b/drivers/media/platform/qcom/camss/camss-csid-4-1.c > index c95861420502..6998e1c52895 100644 > --- a/drivers/media/platform/qcom/camss/camss-csid-4-1.c > +++ b/drivers/media/platform/qcom/camss/camss-csid-4-1.c > @@ -17,7 +17,6 @@ > #include "camss-csid-gen1.h" > #include "camss.h" > > -#define CAMSS_CSID_HW_VERSION 0x0 > #define CAMSS_CSID_CORE_CTRL_0 0x004 > #define CAMSS_CSID_CORE_CTRL_1 0x008 > #define CAMSS_CSID_RST_CMD 0x00c > @@ -139,15 +138,6 @@ static int csid_configure_testgen_pattern(struct csid_device *csid, s32 val) > return 0; > } > > -static u32 csid_hw_version(struct csid_device *csid) > -{ > - u32 hw_version = readl_relaxed(csid->base + CAMSS_CSID_HW_VERSION); > - > - dev_dbg(csid->camss->dev, "CSID HW Version = 0x%08x\n", hw_version); > - > - return hw_version; > -} > > -static u32 csid_hw_version(struct csid_device *csid) > -{ > - u32 hw_version = readl_relaxed(csid->base + CAMSS_CSID_HW_VERSION); > - > - dev_dbg(csid->camss->dev, "CSID HW Version = 0x%08x\n", hw_version); > - > - return hw_version; > -} Is it also the case with csid-4-1 and csid-47 that the HW version is in the format x.x.x - because you're removing this printout which just prints the register in favour of a later function that decodes that register into three parts. Suggest having a csid_hw_version_gen1() for these two and a csid_hw_version_gen2() which does the x.x.x print instead. => camss-csid-4-1.c and camss-csid-4-7.c will have hw_version = csid_hw_version_gen1() => camss-csid-gen2, camss-csid-790 will have hw_version = hw_version_gen2() --- bod