From: Anvesh Jain P <anvesh.p@oss.qualcomm.com>
To: "Konrad Dybcio" <konrad.dybcio@oss.qualcomm.com>,
"Sibi Sankar" <sibi.sankar@oss.qualcomm.com>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Hans de Goede" <hansg@kernel.org>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Bryan O'Donoghue" <bryan.odonoghue@linaro.org>,
"Bjorn Andersson" <andersson@kernel.org>,
"Konrad Dybcio" <konradybcio@kernel.org>
Cc: linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
platform-driver-x86@vger.kernel.org,
Maya Matuszczyk <maccraft123mc@gmail.com>
Subject: Re: [PATCH v4 2/5] platform: arm64: Add driver for EC found on Qualcomm reference devices
Date: Mon, 16 Mar 2026 22:37:12 +0530 [thread overview]
Message-ID: <417e71b5-1956-4841-bfb7-4116d20f3dc5@oss.qualcomm.com> (raw)
In-Reply-To: <6eb3a173-c364-431f-93e4-7bbb7a32431e@oss.qualcomm.com>
On 3/16/2026 3:57 PM, Konrad Dybcio wrote:
> On 3/13/26 11:29 AM, Anvesh Jain P wrote:
>> From: Sibi Sankar <sibi.sankar@oss.qualcomm.com>
>>
>> Add Embedded controller driver support for Hamoa/Purwa/Glymur qualcomm
>> reference boards. It handles fan control, temperature sensors, access
>> to EC state changes and supports reporting suspend entry/exit to the
>> EC.
>>
>> Co-developed-by: Maya Matuszczyk <maccraft123mc@gmail.com>
>> Signed-off-by: Maya Matuszczyk <maccraft123mc@gmail.com>
>> Signed-off-by: Sibi Sankar <sibi.sankar@oss.qualcomm.com>
>> Co-developed-by: Anvesh Jain P <anvesh.p@oss.qualcomm.com>
>> Signed-off-by: Anvesh Jain P <anvesh.p@oss.qualcomm.com>
>> ---
>
> [...]
>
>> + * ------------------------------------------------------------------------------
>> + * | Offset | Name | Description |
>> + * ------------------------------------------------------------------------------
>> + * | 0x00 | Byte count | Number of bytes in response |
>> + * | | | (exluding byte count) |
>> + * ------------------------------------------------------------------------------
>> + * | 0x02 (LSB) | EC Thermal | Bit 0-1: Number of fans |
>> + * | 0x3 | Capabilities | Bit 2-4: Type of fan |
>> + * | | | Bit 5-6: Reserved |
>> + * | | | Bit 7: Data Valid/Invalid |
>> + * | | | (Valid - 1, Invalid - 0) |
>> + * | | | Bit 8-15: Thermistor 0 - 7 presence |
>> + * | | | (0 present, 1 absent) |
> ^ huh??
>
> I see that it's not currently used, but I think flipping these
> bits would make it easier to comprehend down the line
>
> [...]
>
Thanks for taking time to review the series
The 0=present encoding was taken directly from the EC firmware spec, but
on closer inspection this appears to be a typo in the spec — the correct
behavior is 1=present, 0=absent. Will update the comment in v5.
>> + default:
>> + dev_dbg(dev, "Unknown EC event: %d\n", val);
>
> Maybe dev_notice(), this would be good to log
>
Agreed, will switch to dev_notice for unknown EC events in v5.
>> + break;
>> + }
>> +
>> + return IRQ_HANDLED;
>> +}
>> +
>> +static int qcom_ec_sci_evt_control(struct device *dev, bool enable)
>> +{
>> + struct i2c_client *client = to_i2c_client(dev);
>> + u8 control = enable ? 1 : 0;
>> + int ret;
>> +
>> + ret = i2c_smbus_write_byte_data(client, EC_SCI_EVT_CONTROL_CMD, control);
>> +
>> + return ret;
>
> return i2c_smbus_write_byte_data(client, EC_SCI_EVT_CONTROL_CMD, !!enable);
>
> [...]
>
Agreed, will simplify in v5
>> +static int qcom_ec_resume(struct device *dev)
>> +{
>> + struct i2c_client *client = to_i2c_client(dev);
>> + int ret;
>> +
>> + ret = i2c_smbus_write_byte_data(client, EC_MODERN_STANDBY_CMD, EC_MODERN_STANDBY_ENTER);
>> +
>> + return ret;
>
> In a pattern like this, unless you have some error checking/logging to
> do, you can just return directly
>
> [...]
>
Agreed, will simplify in v5.
>> + ret = qcom_ec_read_fw_version(dev);
>> + if (ret < 0)
>> + return dev_err_probe(dev, ret, "Failed to read ec firmware version\n");
>
> "EC"
>
> [...]
>
Agreed, will fix in v5
>> + for (i = 0; i < ec->thermal_cap.fan_cnt; i++) {
>> + struct qcom_ec_cooling_dev *ec_cdev = &ec->ec_cdev[i];
>> + char name[EC_FAN_NAME_SIZE];
>> +
>> + snprintf(name, EC_FAN_NAME_SIZE, "qcom_ec_fan_%d", i);
>> + ec_cdev->fan_id = i + 1;
>> + ec_cdev->parent_dev = dev;
>> +
>> + ec_cdev->cdev = thermal_cooling_device_register(name, ec_cdev,
>> + &qcom_ec_thermal_ops);
>> + if (IS_ERR(ec_cdev->cdev)) {
>> + dev_err_probe(dev, PTR_ERR(cdev),
>> + "Thermal cooling device registration failed\n");
>> + ret = -EINVAL;
>> + goto unroll_cooling_dev;
>> + }
>> + }
>> +
>> + return 0;
>> +
>> +unroll_cooling_dev:
>
> For those cases, one would usually add add a devres-managed version of
> the helper (devm_foo_bar()), removing the need to repeat this in the
> driver remove callback as well
>
> Konrad
Agreed, will switch to devm_thermal_of_cooling_device_register in v5
--
Best Regards,
Anvesh
next prev parent reply other threads:[~2026-03-16 17:07 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-13 10:29 [PATCH v4 0/5] Add driver for EC found on Qualcomm reference devices Anvesh Jain P
2026-03-13 10:29 ` [PATCH v4 1/5] dt-bindings: embedded-controller: Add EC bindings for " Anvesh Jain P
2026-03-13 19:01 ` Krzysztof Kozlowski
2026-03-16 9:37 ` Anvesh Jain P
2026-03-13 10:29 ` [PATCH v4 2/5] platform: arm64: Add driver for EC found on " Anvesh Jain P
2026-03-13 12:17 ` Bryan O'Donoghue
2026-03-13 14:13 ` Anvesh Jain P
2026-03-13 14:35 ` Dmitry Baryshkov
2026-03-13 17:24 ` Anvesh Jain P
2026-03-13 19:05 ` Krzysztof Kozlowski
2026-03-16 9:43 ` Anvesh Jain P
2026-03-16 10:27 ` Konrad Dybcio
2026-03-16 17:07 ` Anvesh Jain P [this message]
2026-03-16 10:29 ` Konrad Dybcio
2026-03-16 17:20 ` Anvesh Jain P
2026-03-16 13:23 ` kernel test robot
2026-03-16 17:28 ` kernel test robot
2026-03-13 10:29 ` [PATCH v4 3/5] arm64: dts: qcom: glymur-crd: Add Embedded controller node Anvesh Jain P
2026-03-13 15:49 ` Dmitry Baryshkov
2026-03-16 10:46 ` Konrad Dybcio
2026-03-13 10:29 ` [PATCH v4 4/5] arm64: dts: qcom: x1-crd: " Anvesh Jain P
2026-03-13 15:49 ` Dmitry Baryshkov
2026-03-16 10:45 ` Konrad Dybcio
2026-03-13 10:29 ` [PATCH v4 5/5] arm64: dts: qcom: hamoa-iot-evk: " Anvesh Jain P
2026-03-13 15:49 ` Dmitry Baryshkov
2026-03-16 10:45 ` Konrad Dybcio
2026-03-13 12:18 ` [PATCH v4 0/5] Add driver for EC found on Qualcomm reference devices Bryan O'Donoghue
2026-03-13 13:15 ` Anvesh Jain P
2026-03-13 16:26 ` Bryan O'Donoghue
2026-03-13 17:17 ` Dmitry Baryshkov
2026-03-14 4:09 ` Bryan O'Donoghue
2026-03-16 10:22 ` Anvesh Jain P
2026-03-16 13:31 ` Bryan O'Donoghue
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=417e71b5-1956-4841-bfb7-4116d20f3dc5@oss.qualcomm.com \
--to=anvesh.p@oss.qualcomm.com \
--cc=andersson@kernel.org \
--cc=bryan.odonoghue@linaro.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=hansg@kernel.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=konrad.dybcio@oss.qualcomm.com \
--cc=konradybcio@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maccraft123mc@gmail.com \
--cc=platform-driver-x86@vger.kernel.org \
--cc=robh@kernel.org \
--cc=sibi.sankar@oss.qualcomm.com \
/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