Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: Griffin Kroah-Hartman <griffin.kroah@fairphone.com>
Cc: "Mauro Carvalho Chehab" <mchehab@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	devicetree@vger.kernel.org, "Daniel Scally" <djrscally@gmail.com>,
	"Bjorn Andersson" <andersson@kernel.org>,
	"Konrad Dybcio" <konradybcio@kernel.org>,
	"André Apitzsch" <git@apitzsch.eu>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH 2/4] media: i2c: dw9719: Add DW9800K support
Date: Fri, 3 Oct 2025 10:04:15 +0300	[thread overview]
Message-ID: <aN91bwetQGrpj6of@kekkonen.localdomain> (raw)
In-Reply-To: <20251002-dw9800-driver-v1-2-c305328e44f0@fairphone.com>

Hi Griffin,

Thank you for the set.

On Thu, Oct 02, 2025 at 12:15:34PM +0200, Griffin Kroah-Hartman wrote:
> The DW9800K is a similar part to the DW9719. The method for operation is
> the same as the DW9719, but the register set is different. Add support
> for this part to the existing dw9719 driver.
> 
> Tested on the Fairphone 5 smartphone.
> 
> Signed-off-by: Griffin Kroah-Hartman <griffin.kroah@fairphone.com>
> ---
>  drivers/media/i2c/dw9719.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/drivers/media/i2c/dw9719.c b/drivers/media/i2c/dw9719.c
> index 3627e78b8b6668933c4ecd92231465ce4105ff0c..172479f2c9f63f6b2a1f6eccf8184142edb383b9 100644
> --- a/drivers/media/i2c/dw9719.c
> +++ b/drivers/media/i2c/dw9719.c
> @@ -68,6 +68,9 @@
>  #define DW9761_VCM_PRELOAD		CCI_REG8(8)
>  #define DW9761_DEFAULT_VCM_PRELOAD	0x73
>  
> +#define DW9800K_DEFAULT_SAC		1
> +#define DW9800K_MODE_SAC_SHIFT		6
> +#define DW9800K_DEFAULT_VCM_FREQ		0x10
>  
>  #define to_dw9719_device(x) container_of(x, struct dw9719_device, sd)
>  
> @@ -75,6 +78,7 @@ enum dw9719_model {
>  	DW9718S,
>  	DW9719,
>  	DW9761,
> +	DW9800K,
>  };
>  
>  struct dw9719_device {
> @@ -137,6 +141,12 @@ static int dw9719_power_up(struct dw9719_device *dw9719, bool detect)
>  			goto props;
>  		}
>  
> +		if (dw9719->model == DW9800K) {
> +			dw9719->sac_mode = DW9800K_DEFAULT_SAC;
> +			dw9719->vcm_freq = DW9800K_DEFAULT_VCM_FREQ;
> +			goto props;
> +		}

How about using switch() instead?

> +
>  		ret = cci_read(dw9719->regmap, DW9719_INFO, &val, NULL);
>  		if (ret < 0)
>  			return ret;
> @@ -177,6 +187,12 @@ static int dw9719_power_up(struct dw9719_device *dw9719, bool detect)
>  	}
>  
>  	switch (dw9719->model) {
> +	case DW9800K:
> +		cci_write(dw9719->regmap, DW9719_CONTROL, DW9719_ENABLE_RINGING, &ret);
> +		cci_write(dw9719->regmap, DW9719_MODE,
> +				  dw9719->sac_mode << DW9800K_MODE_SAC_SHIFT, &ret);

Indentation.

> +		cci_write(dw9719->regmap, DW9719_VCM_FREQ, dw9719->vcm_freq, &ret);
> +		break;
>  	case DW9718S:
>  		/* Datasheet says [OCP/UVLO] should be disabled below 2.5V */
>  		dw9719->sac_mode &= DW9718S_CONTROL_SAC_MASK;
> @@ -426,6 +442,7 @@ static const struct of_device_id dw9719_of_table[] = {
>  	{ .compatible = "dongwoon,dw9718s", .data = (const void *)DW9718S },
>  	{ .compatible = "dongwoon,dw9719", .data = (const void *)DW9719 },
>  	{ .compatible = "dongwoon,dw9761", .data = (const void *)DW9761 },
> +	{ .compatible = "dongwoon,dw9800k", .data = (const void *)DW9800K },
>  	{ }
>  };
>  MODULE_DEVICE_TABLE(of, dw9719_of_table);
> 

-- 
Regards,

Sakari Ailus

  parent reply	other threads:[~2025-10-03  7:04 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-02 10:15 [PATCH 0/4] Add support for Dongwoon Anatech DW9800K driver Griffin Kroah-Hartman
2025-10-02 10:15 ` [PATCH 1/4] dt-bindings: media: i2c: dw9719: Document DW9800K Griffin Kroah-Hartman
2025-10-08 20:02   ` Rob Herring (Arm)
2025-10-02 10:15 ` [PATCH 2/4] media: i2c: dw9719: Add DW9800K support Griffin Kroah-Hartman
2025-10-02 12:58   ` Luca Weiss
2025-10-03  7:04   ` Sakari Ailus [this message]
2025-10-02 10:15 ` [PATCH 3/4] arm64: dts: qcom: qcm6490-fairphone-fp5: Enable CCI pull-up Griffin Kroah-Hartman
2025-10-02 12:45   ` Konrad Dybcio
2025-10-02 13:12     ` Bryan O'Donoghue
2025-10-02 13:14     ` Luca Weiss
2025-10-02 14:05       ` Wolfram Sang
2025-10-03 10:35     ` Kieran Bingham
2025-10-03 11:03       ` Konrad Dybcio
2025-10-02 10:15 ` [PATCH 4/4] arm64: dts: qcom: qcm6490-fairphone-fp5: Add UW cam actuator Griffin Kroah-Hartman
2025-10-02 13:16   ` Luca Weiss
2025-10-06  9:20   ` Konrad Dybcio
2025-10-06  9:44     ` Luca Weiss
2025-10-06 11:26       ` Konrad Dybcio

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=aN91bwetQGrpj6of@kekkonen.localdomain \
    --to=sakari.ailus@linux.intel.com \
    --cc=andersson@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=djrscally@gmail.com \
    --cc=git@apitzsch.eu \
    --cc=griffin.kroah@fairphone.com \
    --cc=konradybcio@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=robh@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox