mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzk@kernel.org>
To: wangshuaijie@awinic.com, jeff@labundy.com
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org,
	dmitry.torokhov@gmail.com, kangjiajun@awinic.com,
	krzk+dt@kernel.org, linux-input@vger.kernel.org,
	linux-kernel@vger.kernel.org, liweilei@awinic.com,
	robh@kernel.org
Subject: Re: [PATCH V2 0/5] Add support for Awinic SAR sensor
Date: Fri, 12 Jul 2024 14:02:40 +0200	[thread overview]
Message-ID: <b6cf55a8-5032-4db9-9431-b938158a1706@kernel.org> (raw)
In-Reply-To: <20240712094925.2395733-1-wangshuaijie@awinic.com>

On 12/07/2024 11:49, wangshuaijie@awinic.com wrote:
> Hi Jeff,
> 
> Thank you very much for your valuable suggestions. They are indeed a great help to me. 
> 
> There are some issues with this driver, but I will do my utmost to improve it 
> based on your advice. I will change the input subsystem in the driver to the 
> IIO subsystem and place it in the IIO/proximity directory. I will also modify 
> the structure of the driver to make it appear more reasonable.
> 
> On Wed, 5 Jun 2024 22:04:16 -0500, jeff@labundy.com wrote:
>> Hi Shuaijie,
>>
>> On Wed, Jun 05, 2024 at 09:11:38AM +0000, wangshuaijie@awinic.com wrote:
>>> From: shuaijie wang <wangshuaijie@awinic.com>
>>>
>>> Add drivers that support Awinic SAR (Specific Absorption Rate)
>>> sensors to the Linux kernel.
>>>
>>> The AW9610X series and AW963XX series are high-sensitivity
>>> capacitive proximity detection sensors.
>>>
>>> This device detects human proximity and assists electronic devices
>>> in reducing SAR to pass SAR related certifications.
>>>
>>> The device reduces RF power and reduces harm when detecting human proximity.
>>> Increase power and improve signal quality when the human body is far away.
>>>
>>> This patch implements device initialization, registration,
>>> I/O operation handling and interrupt handling, and passed basic testing.
>>
>> Thank you for your submission! It's always great to see new devices
>> introduced to the kernel. Maybe I can give some high-level feedback
>> first.
>>
>> Unfortunately, I don't think we can review this driver in its current
>> form; the style and structure are simply too different from what is
>> expected in mainline. Many of these problems can be identified with
>> checkpatch [1].
>>
>> To that point, I don't think this driver belongs as an input driver.
>> The input subsystem tends to be a catch-all for sensors in downstream
>> kernels, and some bespoke SOC vendor HALs tend to follow this approach,
>> but that does not necessarily mean input is always the best choice.
>>
>> SAR devices are a special case where an argument could be made for the
>> driver to be an input driver, or an IIO/proximity driver. If the device
>> emits binary near/far events, then an input driver is a good choice;
>> typically the near/far event could be mapped to a switch code such as
>> SW_FRONT_PROXIMITY.
>>
>> If the device emits continuous proximity data (in arbitrary units or
>> otherwise), however, IIO/proximity seems like a better choice here. This
>> driver seems to report proximity using ABS_DISTANCE, which is kind of an
>> abuse of the input subsystem, and a strong indicator that this driver
>> should really be an IIO/proximity driver. If you disagree, I think we
>> at least need some compelling reasoning in the commit message.
>>
>> Regardless of this choice, this driver should really only be 2-3 patches
>> (not counting cover letter): one for the binding, and one for a single,
>> homogenous driver for each of the two devices, unless they have enough
>> in common that they can be supported by a single driver. Mainline tends
>> to avoid vendor-specific (and especially part-specific) entire directories.
>>
>> I agree with Krzysztof's advice in one of the other patches; I think it
>> would be best to study some existing drivers in mainline to gain a
>> better sense of how they are organized, then use those as a model. If I
>> may suggest, consider referring to drivers such as [2] and its cousins
>> in the same directory; these are capacitive proximity sensors that can
>> be used as buttons, but SAR devices tend to be built upon the same principle.

Not much improved in v3 in this regard.

Sorry, this code is not ready for review. There are so many trivial
style issues, it's like someone sends us Windows drivers for Linux.

Best regards,
Krzysztof


  reply	other threads:[~2024-07-12 12:02 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-05  9:11 wangshuaijie
2024-06-05  9:11 ` [PATCH V2 1/5] dt-bindings: input: Add YAML to Awinic sar sensor wangshuaijie
2024-06-05 10:20   ` Krzysztof Kozlowski
2024-07-12  9:47     ` wangshuaijie
2024-06-05  9:11 ` [PATCH V2 2/5] Add universal interface for the aw_sar driver wangshuaijie
2024-06-05  9:11 ` [PATCH V2 3/5] Add aw9610x series related interfaces to " wangshuaijie
2024-06-05 10:22   ` Krzysztof Kozlowski
2024-07-12  9:50     ` wangshuaijie
2024-06-05  9:11 ` [PATCH V2 4/5] Add aw963xx " wangshuaijie
2024-06-05 10:29   ` Krzysztof Kozlowski
2024-07-12  9:48     ` wangshuaijie
2024-06-05  9:11 ` [PATCH V2 5/5] Add support for Awinic sar sensor wangshuaijie
2024-06-05 10:33   ` Krzysztof Kozlowski
2024-07-12  9:48     ` wangshuaijie
2024-06-05 12:09   ` kernel test robot
2024-06-06 18:32   ` kernel test robot
2024-06-08  2:22   ` kernel test robot
2024-06-06  3:04 ` [PATCH V2 0/5] Add support for Awinic SAR sensor Jeff LaBundy
2024-07-12  9:49   ` wangshuaijie
2024-07-12 12:02     ` Krzysztof Kozlowski [this message]
2024-07-25 12:48       ` wangshuaijie

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=b6cf55a8-5032-4db9-9431-b938158a1706@kernel.org \
    --to=krzk@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=jeff@labundy.com \
    --cc=kangjiajun@awinic.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liweilei@awinic.com \
    --cc=robh@kernel.org \
    --cc=wangshuaijie@awinic.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

all inboxes | Powered by JetHome®