From: Viken Dadhaniya <viken.dadhaniya@oss.qualcomm.com>
To: Praveen Talari <praveen.talari@oss.qualcomm.com>,
Andi Shyti <andi.shyti@kernel.org>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Mukesh Kumar Savaliya <mukesh.savaliya@oss.qualcomm.com>,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konradybcio@kernel.org>,
linux-arm-msm@vger.kernel.org, linux-i2c@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
bryan.odonoghue@linaro.org, dmitry.baryshkov@oss.qualcomm.com,
bjorn.andersson@oss.qualcomm.com
Cc: prasad.sodagudi@oss.qualcomm.com, quic_vtanuku@quicinc.com,
aniket.randive@oss.qualcomm.com,
chandana.chiluveru@oss.qualcomm.com
Subject: Re: [PATCH v3 11/12] i2c: qcom-geni: Store of_device_id data in driver private struct
Date: Wed, 21 Jan 2026 14:29:33 +0530 [thread overview]
Message-ID: <82db5424-8013-487d-90bb-82f133cbcbf2@oss.qualcomm.com> (raw)
In-Reply-To: <20260112104722.591521-12-praveen.talari@oss.qualcomm.com>
Acked-by: Viken Dadhaniya <viken.dadhaniya@oss.qualcomm.com>
On 1/12/2026 4:17 PM, Praveen Talari wrote:
> To avoid repeatedly fetching and checking platform data across various
> functions, store the struct of_device_id data directly in the i2c
> private structure. This change enhances code maintainability and reduces
> redundancy.
>
> Signed-off-by: Praveen Talari <praveen.talari@oss.qualcomm.com>
> ---
> drivers/i2c/busses/i2c-qcom-geni.c | 32 ++++++++++++++++--------------
> 1 file changed, 17 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c
> index b0a18e3d57d9..1c9356e13b97 100644
> --- a/drivers/i2c/busses/i2c-qcom-geni.c
> +++ b/drivers/i2c/busses/i2c-qcom-geni.c
> @@ -77,6 +77,13 @@ enum geni_i2c_err_code {
> #define XFER_TIMEOUT HZ
> #define RST_TIMEOUT HZ
>
> +struct geni_i2c_desc {
> + bool has_core_clk;
> + char *icc_ddr;
> + bool no_dma_support;
> + unsigned int tx_fifo_depth;
> +};
> +
> #define QCOM_I2C_MIN_NUM_OF_MSGS_MULTI_DESC 2
>
> /**
> @@ -121,13 +128,7 @@ struct geni_i2c_dev {
> bool is_tx_multi_desc_xfer;
> u32 num_msgs;
> struct geni_i2c_gpi_multi_desc_xfer i2c_multi_desc_config;
> -};
> -
> -struct geni_i2c_desc {
> - bool has_core_clk;
> - char *icc_ddr;
> - bool no_dma_support;
> - unsigned int tx_fifo_depth;
> + const struct geni_i2c_desc *dev_data;
> };
>
> struct geni_i2c_err_log {
> @@ -978,7 +979,6 @@ static int setup_gpi_dma(struct geni_i2c_dev *gi2c)
>
> static int geni_i2c_init(struct geni_i2c_dev *gi2c)
> {
> - const struct geni_i2c_desc *desc = NULL;
> u32 proto, tx_depth;
> bool fifo_disable;
> int ret;
> @@ -1001,8 +1001,7 @@ static int geni_i2c_init(struct geni_i2c_dev *gi2c)
> goto err;
> }
>
> - desc = device_get_match_data(gi2c->se.dev);
> - if (desc && desc->no_dma_support)
> + if (gi2c->dev_data->no_dma_support)
> fifo_disable = false;
> else
> fifo_disable = readl_relaxed(gi2c->se.base + GENI_IF_DISABLE_RO) & FIFO_IF_DISABLE;
> @@ -1020,8 +1019,8 @@ static int geni_i2c_init(struct geni_i2c_dev *gi2c)
> tx_depth = geni_se_get_tx_fifo_depth(&gi2c->se);
>
> /* I2C Master Hub Serial Elements doesn't have the HW_PARAM_0 register */
> - if (!tx_depth && desc)
> - tx_depth = desc->tx_fifo_depth;
> + if (!tx_depth && gi2c->dev_data->has_core_clk)
> + tx_depth = gi2c->dev_data->tx_fifo_depth;
>
> if (!tx_depth) {
> ret = dev_err_probe(gi2c->se.dev, -EINVAL,
> @@ -1064,7 +1063,6 @@ static int geni_i2c_probe(struct platform_device *pdev)
> struct geni_i2c_dev *gi2c;
> int ret;
> struct device *dev = &pdev->dev;
> - const struct geni_i2c_desc *desc = NULL;
>
> gi2c = devm_kzalloc(dev, sizeof(*gi2c), GFP_KERNEL);
> if (!gi2c)
> @@ -1076,7 +1074,7 @@ static int geni_i2c_probe(struct platform_device *pdev)
> if (IS_ERR(gi2c->se.base))
> return PTR_ERR(gi2c->se.base);
>
> - desc = device_get_match_data(&pdev->dev);
> + gi2c->dev_data = device_get_match_data(&pdev->dev);
>
> ret = device_property_read_u32(dev, "clock-frequency",
> &gi2c->clk_freq_out);
> @@ -1215,6 +1213,10 @@ static const struct dev_pm_ops geni_i2c_pm_ops = {
> NULL)
> };
>
> +static const struct geni_i2c_desc geni_i2c = {
> + .icc_ddr = "qup-memory",
> +};
> +
> static const struct geni_i2c_desc i2c_master_hub = {
> .has_core_clk = true,
> .icc_ddr = NULL,
> @@ -1223,7 +1225,7 @@ static const struct geni_i2c_desc i2c_master_hub = {
> };
>
> static const struct of_device_id geni_i2c_dt_match[] = {
> - { .compatible = "qcom,geni-i2c" },
> + { .compatible = "qcom,geni-i2c", .data = &geni_i2c },
> { .compatible = "qcom,geni-i2c-master-hub", .data = &i2c_master_hub },
> {}
> };
next prev parent reply other threads:[~2026-01-21 8:59 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-12 10:47 [PATCH v3 00/12] Enable I2C on SA8255p Qualcomm platforms Praveen Talari
2026-01-12 10:47 ` [PATCH v3 01/12] soc: qcom: geni-se: Refactor geni_icc_get() and make qup-memory ICC path optional Praveen Talari
2026-01-12 10:47 ` [PATCH v3 02/12] soc: qcom: geni-se: Add geni_icc_set_bw_ab() function Praveen Talari
2026-01-12 10:47 ` [PATCH v3 03/12] soc: qcom: geni-se: Introduce helper API for resource initialization Praveen Talari
2026-01-30 12:10 ` Konrad Dybcio
2026-01-30 17:00 ` Praveen Talari
2026-01-12 10:47 ` [PATCH v3 04/12] soc: qcom: geni-se: Add resources activation/deactivation helpers Praveen Talari
2026-01-30 12:11 ` Konrad Dybcio
2026-02-02 16:20 ` Praveen Talari
2026-01-12 10:47 ` [PATCH v3 05/12] soc: qcom: geni-se: Introduce helper API for attaching power domains Praveen Talari
2026-01-30 12:12 ` Konrad Dybcio
2026-01-30 16:55 ` Praveen Talari
2026-02-02 16:19 ` Praveen Talari
2026-01-12 10:47 ` [PATCH v3 06/12] soc: qcom: geni-se: Introduce helper APIs for performance control Praveen Talari
2026-01-30 12:23 ` Konrad Dybcio
2026-01-30 16:54 ` Praveen Talari
2026-02-03 11:14 ` Konrad Dybcio
2026-02-04 5:42 ` Praveen Talari
2026-02-17 12:25 ` Konrad Dybcio
2026-02-20 5:23 ` Praveen Talari
2026-02-23 13:43 ` Praveen Talari
2026-02-25 14:25 ` Konrad Dybcio
2026-01-12 10:47 ` [PATCH v3 07/12] dt-bindings: i2c: Describe SA8255p Praveen Talari
2026-01-12 10:47 ` [PATCH v3 08/12] i2c: qcom-geni: Isolate serial engine setup Praveen Talari
2026-01-21 7:47 ` Viken Dadhaniya
2026-01-12 10:47 ` [PATCH v3 09/12] i2c: qcom-geni: Move resource initialization to separate function Praveen Talari
2026-01-21 8:57 ` Viken Dadhaniya
2026-01-12 10:47 ` [PATCH v3 10/12] i2c: qcom-geni: Use resources helper APIs in runtime PM functions Praveen Talari
2026-01-21 8:58 ` Viken Dadhaniya
2026-01-30 12:05 ` Konrad Dybcio
2026-01-30 16:48 ` Praveen Talari
2026-02-03 11:13 ` Konrad Dybcio
2026-02-04 5:46 ` Praveen Talari
2026-01-12 10:47 ` [PATCH v3 11/12] i2c: qcom-geni: Store of_device_id data in driver private struct Praveen Talari
2026-01-21 8:59 ` Viken Dadhaniya [this message]
2026-01-30 12:29 ` Konrad Dybcio
2026-02-02 16:19 ` Praveen Talari
2026-01-12 10:47 ` [PATCH v3 12/12] i2c: qcom-geni: Enable I2C on SA8255p Qualcomm platforms Praveen Talari
2026-01-21 10:21 ` Viken Dadhaniya
2026-01-30 12:34 ` Konrad Dybcio
2026-01-30 16:44 ` Praveen Talari
2026-02-02 14:53 ` Konrad Dybcio
2026-02-04 5:43 ` Praveen Talari
2026-01-14 15:05 ` [PATCH v3 00/12] " Andi Shyti
2026-01-28 22:49 ` [SPAM] " Andi Shyti
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=82db5424-8013-487d-90bb-82f133cbcbf2@oss.qualcomm.com \
--to=viken.dadhaniya@oss.qualcomm.com \
--cc=andersson@kernel.org \
--cc=andi.shyti@kernel.org \
--cc=aniket.randive@oss.qualcomm.com \
--cc=bjorn.andersson@oss.qualcomm.com \
--cc=bryan.odonoghue@linaro.org \
--cc=chandana.chiluveru@oss.qualcomm.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.baryshkov@oss.qualcomm.com \
--cc=konradybcio@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mukesh.savaliya@oss.qualcomm.com \
--cc=prasad.sodagudi@oss.qualcomm.com \
--cc=praveen.talari@oss.qualcomm.com \
--cc=quic_vtanuku@quicinc.com \
--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