From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Rajat Jain <rajatja@google.com>, Jiri Kosina <jikos@kernel.org>,
Benjamin Tissoires <benjamin.tissoires@redhat.com>,
David Arcari <darcari@redhat.com>,
Mika Westerberg <mika.westerberg@linux.intel.com>,
HungNien Chen <hn.chen@weidahitech.com>,
Hans de Goede <hdegoede@redhat.com>,
Brian Norris <briannorris@chromium.org>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
dtor@google.com, linux-input@vger.kernel.org,
linux-kernel@vger.kernel.org, rajatxjain@gmail.com
Subject: Re: [PATCH] HID: i2c-hid: Use device properties (instead of device tree)
Date: Sun, 01 Oct 2017 19:18:50 +0300 [thread overview]
Message-ID: <1506874730.16112.194.camel@linux.intel.com> (raw)
In-Reply-To: <20170929224441.98176-1-rajatja@google.com>
On Fri, 2017-09-29 at 15:44 -0700, Rajat Jain wrote:
> Use the device properties (that can be provided by ACPI systems
> as well as non ACPI systems) instead of device tree properties
> (that are not provided ACPI systems). This required some minor
> code restructuring.
>
> I don't think its a big deal, but just FYI, this changes the order in
> which we
> look for HID register address from
> (device tree -> platform_data -> ACPI) to
> (platform data -> device tree -> ACPI)
I do.
We would like to discourage use of legacy platform data in favour
of Device Tree / ACPI.
> +static int i2c_hid_fwnode_probe(struct i2c_client *client,
> struct i2c_hid_platform_data *pdata)
> {
> struct device *dev = &client->dev;
> u32 val;
> int ret;
>
> - ret = of_property_read_u32(dev->of_node, "hid-descr-addr",
> &val);
> - if (ret) {
> - dev_err(&client->dev, "HID register address not
> provided\n");
> - return -ENODEV;
> - }
> - if (val >> 16) {
> - dev_err(&client->dev, "Bad HID register address:
> 0x%08x\n",
> - val);
> - return -EINVAL;
> + ret = device_property_read_u32(dev, "hid-descr-addr", &val);
> + if (ret || val >> 16) {
> + /* Couldn't read using fwnode, try ACPI next */
> + if (!i2c_hid_acpi_pdata(client, pdata)) {
> + dev_err(dev, "Bad/Not provided HID register
> address\n");
> + return -ENODEV;
> + }
Why not just replace of_ calls by device_ ones?
> }
> pdata->hid_descriptor_address = val;
>
> - ret = of_property_read_u32(dev->of_node, "post-power-on-
> delay-ms",
> - &val);
> + ret = device_property_read_u32(dev, "post-power-on-delay-ms",
> &val);
> if (!ret)
> pdata->post_power_delay_ms = val;
>
> return 0;
> }
>
Looking how ACPI support is established in the driver, I would rather
NAK this change. Is there any _actual_ hardware on the wild with such
properties?
HID protocol for ACPI is described in [1] where nothing is about _DSD.
[1]: https://docs.microsoft.com/en-us/windows-hardware/drivers/hid/plug-
and-play-support-and-power-management
--
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy
next prev parent reply other threads:[~2017-10-01 16:18 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-29 22:44 [PATCH] HID: i2c-hid: Use device properties (instead of device tree) Rajat Jain
2017-09-30 0:08 ` Brian Norris
2017-10-02 19:27 ` Rajat Jain
2017-10-01 16:18 ` Andy Shevchenko [this message]
2017-10-02 19:23 ` Rajat Jain
2017-10-02 21:32 ` [PATCH] HID: i2c-hid: Allow ACPI systems to specify "post-power-on-delay-ms" Rajat Jain
2017-10-03 9:28 ` Andy Shevchenko
2017-10-03 18:24 ` Rajat Jain
2017-10-03 18:19 ` [PATCH v3] " Rajat Jain
2017-11-21 12:30 ` Jiri Kosina
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=1506874730.16112.194.camel@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=benjamin.tissoires@redhat.com \
--cc=briannorris@chromium.org \
--cc=darcari@redhat.com \
--cc=dmitry.torokhov@gmail.com \
--cc=dtor@google.com \
--cc=hdegoede@redhat.com \
--cc=hn.chen@weidahitech.com \
--cc=jikos@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=rajatja@google.com \
--cc=rajatxjain@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.