From: Krzysztof Kozlowski <krzk@kernel.org>
To: Loic Poulain <loic.poulain@oss.qualcomm.com>,
Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: andersson@kernel.org, konradybcio@kernel.org,
dave.stevenson@raspberrypi.com, robh@kernel.org,
krzk+dt@kernel.org, conor+dt@kernel.org, mchehab@kernel.org,
linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org,
linux-media@vger.kernel.org, laurent.pinchart@ideasonboard.com
Subject: Re: [PATCH v3 1/4] media: i2c: ov9282: Fix reset-gpio logical state
Date: Tue, 30 Dec 2025 14:49:32 +0100 [thread overview]
Message-ID: <954ecfcb-3d5f-4b65-9d59-4a5bdb067803@kernel.org> (raw)
In-Reply-To: <CAFEp6-1zoU2cfVU06MoeOtAwMYN+XAxCwc0ebwaQyo78VNBf2Q@mail.gmail.com>
On 03/12/2025 11:00, Loic Poulain wrote:
> Hi Laurent,
>
> On Mon, Nov 17, 2025 at 6:30 PM Sakari Ailus
> <sakari.ailus@linux.intel.com> wrote:
>>
>> Hi Loic,
>>
>> On Fri, Nov 14, 2025 at 02:38:19PM +0100, Loic Poulain wrote:
>>> Ensure reset state is low in the power-on state and high in the
>>> power-off state (assert reset). Note that the polarity is abstracted
>>> by the GPIO subsystem, so the logic level reflects the intended reset
>>> behavior.
>>
>> That's an interesting approach to fix DTS gone systematically wrong.
>>
>> I was thinking of the drivers that have this issue, too, but I would have
>> introduced a new GPIO under a different name (many sensors use "enable",
>> too). Any thoughts?
>>
>> Cc Laurent.
>
> Do you have any feedback on this change?
>
>>
>>>
>>> To maintain backward compatibility with DTS files that use an incorrect
>>> flag, we implement a mechanism similar to:
>>> commit 738455858a2d ("ASoC: codecs: wsa881x: Use proper shutdown GPIO polarity")
>>>
>>> Signed-off-by: Loic Poulain <loic.poulain@oss.qualcomm.com>
>>> ---
>>> drivers/media/i2c/ov9282.c | 26 ++++++++++++++++++++++----
>>> 1 file changed, 22 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/drivers/media/i2c/ov9282.c b/drivers/media/i2c/ov9282.c
>>> index a9f6176e9729..e79b326cdd94 100644
>>> --- a/drivers/media/i2c/ov9282.c
>>> +++ b/drivers/media/i2c/ov9282.c
>>> @@ -160,6 +160,7 @@ struct ov9282_mode {
>>> * @sd: V4L2 sub-device
>>> * @pad: Media pad. Only one pad supported
>>> * @reset_gpio: Sensor reset gpio
>>> + * @reset_gpio_val: Logical value to reset the sensor
>>> * @inclk: Sensor input clock
>>> * @supplies: Regulator supplies for the sensor
>>> * @ctrl_handler: V4L2 control handler
>>> @@ -180,6 +181,7 @@ struct ov9282 {
>>> struct v4l2_subdev sd;
>>> struct media_pad pad;
>>> struct gpio_desc *reset_gpio;
>>> + unsigned int reset_gpio_val;
>>> struct clk *inclk;
>>> struct regulator_bulk_data supplies[OV9282_NUM_SUPPLIES];
>>> struct v4l2_ctrl_handler ctrl_handler;
>>> @@ -1127,13 +1129,29 @@ static int ov9282_parse_hw_config(struct ov9282 *ov9282)
>>>
>>> /* Request optional reset pin */
>>> ov9282->reset_gpio = devm_gpiod_get_optional(ov9282->dev, "reset",
>>> - GPIOD_OUT_LOW);
>>> + GPIOD_OUT_HIGH);
>>> if (IS_ERR(ov9282->reset_gpio)) {
>>> dev_err(ov9282->dev, "failed to get reset gpio %ld",
>>> PTR_ERR(ov9282->reset_gpio));
>>> return PTR_ERR(ov9282->reset_gpio);
>>> }
>>>
>>> + /*
>>> + * Backwards compatibility work-around.
>>> + *
>>> + * The reset GPIO is active-low, but the driver has always used the
>>> + * gpiod API with inverted logic. As a result, the DTS had to
>>> + * incorrectly mark the GPIO as active-high to compensate for this
>>> + * behavior. Changing the flag in the driver now would break backward
>>> + * compatibility with existing DTS configurations. To address this,
>>> + * we add a simple value inversion so the driver works with both old
>>> + * and new DTS.
This obviously is not true - driver will fail to work with some of old DTS.
I am surprised that it is second approach last weeks duplicating the
same problem and claiming the same - the change is backwards compatible,
while it is not - instead of taking my old explanation from WSA drivers
and admit the actual case of broken DTS.
With proper description I could agree, but with incorrect claims - no,
it's wrong.
Best regards,
Krzysztof
next prev parent reply other threads:[~2025-12-30 13:49 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-14 13:38 [PATCH v3 0/4] Add QRB2210 RB1 vision mezzanine/kit support Loic Poulain
2025-11-14 13:38 ` [PATCH v3 1/4] media: i2c: ov9282: Fix reset-gpio logical state Loic Poulain
2025-11-17 17:30 ` Sakari Ailus
2025-12-03 10:00 ` Loic Poulain
2025-12-30 13:49 ` Krzysztof Kozlowski [this message]
2025-12-30 13:56 ` Krzysztof Kozlowski
2025-12-15 9:35 ` Loic Poulain
2025-12-15 9:40 ` Sakari Ailus
2025-12-15 10:19 ` Loic Poulain
2025-12-30 13:33 ` Laurent Pinchart
2025-12-30 13:54 ` Krzysztof Kozlowski
2025-12-30 15:03 ` Loic Poulain
2025-12-30 15:40 ` Laurent Pinchart
2025-12-30 15:41 ` Krzysztof Kozlowski
2026-01-06 19:53 ` Loic Poulain
2025-11-14 13:38 ` [PATCH v3 2/4] arm64: dts: qcom: qcm2290: Add pin configuration for mclks Loic Poulain
2025-11-17 13:07 ` Konrad Dybcio
2025-11-14 13:38 ` [PATCH v3 3/4] arm64: dts: qcom: qrb2210-rb1: Add PM8008 node Loic Poulain
2025-11-14 13:38 ` [PATCH v3 4/4] arm64: dts: qcom: qrb2210-rb1: Add overlay for vision mezzanine Loic Poulain
2025-11-18 4:25 ` Dmitry Baryshkov
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=954ecfcb-3d5f-4b65-9d59-4a5bdb067803@kernel.org \
--to=krzk@kernel.org \
--cc=andersson@kernel.org \
--cc=conor+dt@kernel.org \
--cc=dave.stevenson@raspberrypi.com \
--cc=devicetree@vger.kernel.org \
--cc=konradybcio@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=loic.poulain@oss.qualcomm.com \
--cc=mchehab@kernel.org \
--cc=robh@kernel.org \
--cc=sakari.ailus@linux.intel.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