* [PATCH v3 2/3] Input: atmel_mxt_ts: Wait for device be ready for communication
From: Paweł Chmiel @ 2018-07-31 15:18 UTC (permalink / raw)
To: nick
Cc: dmitry.torokhov, robh+dt, mark.rutland, nicolas.ferre,
alexandre.belloni, linux-input, devicetree, linux-arm-kernel,
linux-kernel, Paweł Chmiel
In-Reply-To: <1533050291-11502-1-git-send-email-pawel.mikolaj.chmiel@gmail.com>
According to documentation, device isn't ready for communication,
until firmware asserts the CHG line. Add missing wait for this.
Signed-off-by: Paweł Chmiel <pawel.mikolaj.chmiel@gmail.com>
---
drivers/input/touchscreen/atmel_mxt_ts.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index 2cd7f6db6ba9..79e08916359f 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -202,6 +202,7 @@ enum t100_type {
#define MXT_CRC_TIMEOUT 1000 /* msec */
#define MXT_FW_RESET_TIME 3000 /* msec */
#define MXT_FW_CHG_TIMEOUT 300 /* msec */
+#define MXT_POWERON_DELAY 150 /* msec */
/* Command to unlock bootloader */
#define MXT_UNLOCK_CMD_MSB 0xaa
@@ -3046,6 +3047,16 @@ static int mxt_regulator_enable(struct mxt_data *data)
msleep(MXT_REGULATOR_DELAY);
gpiod_set_value(data->reset_gpio, 1);
msleep(MXT_RESET_INVALID_CHG);
+
+retry_wait:
+ reinit_completion(&data->bl_completion);
+ data->in_bootloader = true;
+ error = mxt_wait_for_completion(data, &data->bl_completion,
+ MXT_POWERON_DELAY);
+ if (error == -EINTR)
+ goto retry_wait;
+
+ data->in_bootloader = false;
}
return 0;
--
2.7.4
^ permalink raw reply related
* [PATCH v3 1/3] Input: atmel_mxt_ts: Add support for optional regulators.
From: Paweł Chmiel @ 2018-07-31 15:18 UTC (permalink / raw)
To: nick
Cc: dmitry.torokhov, robh+dt, mark.rutland, nicolas.ferre,
alexandre.belloni, linux-input, devicetree, linux-arm-kernel,
linux-kernel, Paweł Chmiel
In-Reply-To: <1533050291-11502-1-git-send-email-pawel.mikolaj.chmiel@gmail.com>
This patch adds optional regulators, which can be used to power
up touchscreen. After enabling regulators, we need to wait 150msec.
This value is taken from official driver.
It was tested on Samsung Galaxy i9000 (based on Samsung S5PV210 SOC).
Signed-off-by: Paweł Chmiel <pawel.mikolaj.chmiel@gmail.com>
---
Changes from v2:
- Move code enabling regulators into separate method,
to make code more readable.
Changes from v1:
- Enable regulators only if reset_gpio is present.
- Switch from devm_regulator_get_optional to devm_regulator_get
---
drivers/input/touchscreen/atmel_mxt_ts.c | 65 +++++++++++++++++++++++++++++---
1 file changed, 59 insertions(+), 6 deletions(-)
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index 54fe190fd4bc..2cd7f6db6ba9 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -27,6 +27,7 @@
#include <linux/interrupt.h>
#include <linux/of.h>
#include <linux/property.h>
+#include <linux/regulator/consumer.h>
#include <linux/slab.h>
#include <linux/gpio/consumer.h>
#include <linux/property.h>
@@ -194,10 +195,10 @@ enum t100_type {
/* Delay times */
#define MXT_BACKUP_TIME 50 /* msec */
-#define MXT_RESET_GPIO_TIME 20 /* msec */
#define MXT_RESET_INVALID_CHG 100 /* msec */
#define MXT_RESET_TIME 200 /* msec */
#define MXT_RESET_TIMEOUT 3000 /* msec */
+#define MXT_REGULATOR_DELAY 150 /* msec */
#define MXT_CRC_TIMEOUT 1000 /* msec */
#define MXT_FW_RESET_TIME 3000 /* msec */
#define MXT_FW_CHG_TIMEOUT 300 /* msec */
@@ -310,6 +311,8 @@ struct mxt_data {
struct t7_config t7_cfg;
struct mxt_dbg dbg;
struct gpio_desc *reset_gpio;
+ struct regulator *vdd_reg;
+ struct regulator *avdd_reg;
/* Cached parameters from object table */
u16 T5_address;
@@ -3016,6 +3019,38 @@ static const struct dmi_system_id chromebook_T9_suspend_dmi[] = {
{ }
};
+static int mxt_regulator_enable(struct mxt_data *data)
+{
+ int error;
+
+ if (data->reset_gpio) {
+ error = regulator_enable(data->vdd_reg);
+ if (error) {
+ dev_err(&data->client->dev, "Failed to enable vdd regulator: %d\n",
+ error);
+ return error;
+ }
+
+ error = regulator_enable(data->avdd_reg);
+ if (error) {
+ dev_err(&data->client->dev, "Failed to enable avdd regulator: %d\n",
+ error);
+ return error;
+ }
+
+ /*
+ * According to maXTouch power sequencing specification, RESET line
+ * must be kept low until some time after regulators come up to
+ * voltage
+ */
+ msleep(MXT_REGULATOR_DELAY);
+ gpiod_set_value(data->reset_gpio, 1);
+ msleep(MXT_RESET_INVALID_CHG);
+ }
+
+ return 0;
+}
+
static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id)
{
struct mxt_data *data;
@@ -3076,6 +3111,22 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id)
return error;
}
+ data->vdd_reg = devm_regulator_get(&client->dev, "vdd");
+ if (IS_ERR(data->vdd_reg)) {
+ error = PTR_ERR(data->vdd_reg);
+ dev_err(&client->dev, "Failed to get vdd regulator: %d\n",
+ error);
+ return error;
+ }
+
+ data->avdd_reg = devm_regulator_get(&client->dev, "avdd");
+ if (IS_ERR(data->avdd_reg)) {
+ error = PTR_ERR(data->avdd_reg);
+ dev_err(&client->dev, "Failed to get avdd regulator: %d\n",
+ error);
+ return error;
+ }
+
error = devm_request_threaded_irq(&client->dev, client->irq,
NULL, mxt_interrupt, IRQF_ONESHOT,
client->name, data);
@@ -3086,11 +3137,9 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id)
disable_irq(client->irq);
- if (data->reset_gpio) {
- msleep(MXT_RESET_GPIO_TIME);
- gpiod_set_value(data->reset_gpio, 1);
- msleep(MXT_RESET_INVALID_CHG);
- }
+ error = mxt_regulator_enable(data);
+ if (error)
+ return error;
error = mxt_initialize(data);
if (error)
@@ -3116,6 +3165,10 @@ static int mxt_remove(struct i2c_client *client)
struct mxt_data *data = i2c_get_clientdata(client);
disable_irq(data->irq);
+ if (data->reset_gpio) {
+ regulator_disable(data->avdd_reg);
+ regulator_disable(data->vdd_reg);
+ }
sysfs_remove_group(&client->dev.kobj, &mxt_attr_group);
mxt_free_input_device(data);
mxt_free_object_table(data);
--
2.7.4
^ permalink raw reply related
* [PATCH v3 0/3] Input: atmel_mxt_ts: Add support for optional regulators
From: Paweł Chmiel @ 2018-07-31 15:18 UTC (permalink / raw)
To: nick
Cc: dmitry.torokhov, robh+dt, mark.rutland, nicolas.ferre,
alexandre.belloni, linux-input, devicetree, linux-arm-kernel,
linux-kernel, Paweł Chmiel
This patch series adds optional regulator support to atmel_mxt_ts.
First patch adds regulators to driver.
Second patch ensures that device is ready for communication.
Third patch updates documentation.
Changes from v2:
- Add reviewed-by to one patch
- Move code for enabling regulators into separate method,
to make code more readable.
- Add wait code, to ensure that device is ready for communication.
Changes from v1:
- Enable regulators only if reset_gpio is present.
- Switch from devm_regulator_get_optional to devm_regulator_get.
Paweł Chmiel (3):
Input: atmel_mxt_ts: Add support for optional regulators.
Input: atmel_mxt_ts: Wait for device be ready for communication
Input: atmel_mxt_ts: Document optional voltage regulators
.../devicetree/bindings/input/atmel,maxtouch.txt | 8 +++
drivers/input/touchscreen/atmel_mxt_ts.c | 76 ++++++++++++++++++++--
2 files changed, 78 insertions(+), 6 deletions(-)
--
2.7.4
^ permalink raw reply
* Re: [PATCH] platform/x86: touchscreen_dmi: Add info for the Cube KNote i1101 tablet
From: Andy Shevchenko @ 2018-07-31 15:10 UTC (permalink / raw)
To: Hans de Goede
Cc: youling257, Linux Kernel Mailing List, Platform Driver,
linux-input, Andy Shevchenko, Darren Hart
In-Reply-To: <0cc13519-2a5d-e6a9-9fd0-17fd6bb119b0@redhat.com>
On Tue, Jul 31, 2018 at 2:53 PM, Hans de Goede <hdegoede@redhat.com> wrote:
> Hi,
>
> On 31-07-18 13:32, Andy Shevchenko wrote:
>>
>> On Tue, Jul 31, 2018 at 12:32 PM, youling257 <youling257@gmail.com> wrote:
>>>
>>> Add touchscreen info for the Cube KNote i1101 tablet.
>>>
>>
>> Thanks for the patch.
>> Unfortunately I can't take it w/o SoB line. If Hans volunteering to
>> give a such again, I guess we're fine.
>
>
> Yes you can add my:
>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>
> Like last time, or do you want me to resend this with it added?
I'll use it as Author, no need to resubmit, thanks!
>
> Regards,
>
> Hans
>
>
>
>>
>>> Reported-and-tested-by: lkongl <lkongl@163.com>
>>> ---
>>> drivers/platform/x86/touchscreen_dmi.c | 26 ++++++++++++++++++++++++++
>>> 1 file changed, 26 insertions(+)
>>>
>>> diff --git a/drivers/platform/x86/touchscreen_dmi.c
>>> b/drivers/platform/x86/touchscreen_dmi.c
>>> index 85e425420da2..cb204f973491 100644
>>> --- a/drivers/platform/x86/touchscreen_dmi.c
>>> +++ b/drivers/platform/x86/touchscreen_dmi.c
>>> @@ -117,6 +117,22 @@ static const struct ts_dmi_data cube_iwork8_air_data
>>> = {
>>> .properties = cube_iwork8_air_props,
>>> };
>>>
>>> +static const struct property_entry cube_knote_i1101_props[] = {
>>> + PROPERTY_ENTRY_U32("touchscreen-min-x", 20),
>>> + PROPERTY_ENTRY_U32("touchscreen-min-y", 22),
>>> + PROPERTY_ENTRY_U32("touchscreen-size-x", 1961),
>>> + PROPERTY_ENTRY_U32("touchscreen-size-y", 1513),
>>> + PROPERTY_ENTRY_STRING("firmware-name",
>>> "gsl3692-cube-knote-i1101.fw"),
>>> + PROPERTY_ENTRY_U32("silead,max-fingers", 10),
>>> + PROPERTY_ENTRY_BOOL("silead,home-button"),
>>> + { }
>>> +};
>>> +
>>> +static const struct ts_dmi_data cube_knote_i1101_data = {
>>> + .acpi_name = "MSSL1680:00",
>>> + .properties = cube_knote_i1101_props,
>>> +};
>>> +
>>> static const struct property_entry dexp_ursus_7w_props[] = {
>>> PROPERTY_ENTRY_U32("touchscreen-size-x", 890),
>>> PROPERTY_ENTRY_U32("touchscreen-size-y", 630),
>>> @@ -458,6 +474,16 @@ static const struct dmi_system_id
>>> touchscreen_dmi_table[] = {
>>> DMI_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"),
>>> },
>>> },
>>> + {
>>> + /* Cube KNote i1101 */
>>> + .driver_data = (void *)&cube_knote_i1101_data,
>>> + .matches = {
>>> + DMI_MATCH(DMI_BOARD_VENDOR, "Hampoo"),
>>> + DMI_MATCH(DMI_BOARD_NAME, "L1W6_I1101"),
>>> + DMI_MATCH(DMI_SYS_VENDOR, "ALLDOCUBE"),
>>> + DMI_MATCH(DMI_PRODUCT_NAME, "i1101"),
>>> + },
>>> + },
>>> {
>>> /* DEXP Ursus 7W */
>>> .driver_data = (void *)&dexp_ursus_7w_data,
>>> --
>>> 2.18.0
>>>
>>
>>
>>
>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply
* Re: [PATCH] platform/x86: touchscreen_dmi: Add info for the Cube KNote i1101 tablet
From: Hans de Goede @ 2018-07-31 11:53 UTC (permalink / raw)
To: Andy Shevchenko, youling257
Cc: Linux Kernel Mailing List, Platform Driver, linux-input,
Andy Shevchenko, Darren Hart
In-Reply-To: <CAHp75Vfp+EZjt_bg3iieKG0NPBvqzURXKh97D4=ULrKnbE4mvQ@mail.gmail.com>
Hi,
On 31-07-18 13:32, Andy Shevchenko wrote:
> On Tue, Jul 31, 2018 at 12:32 PM, youling257 <youling257@gmail.com> wrote:
>> Add touchscreen info for the Cube KNote i1101 tablet.
>>
>
> Thanks for the patch.
> Unfortunately I can't take it w/o SoB line. If Hans volunteering to
> give a such again, I guess we're fine.
Yes you can add my:
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Like last time, or do you want me to resend this with it added?
Regards,
Hans
>
>> Reported-and-tested-by: lkongl <lkongl@163.com>
>> ---
>> drivers/platform/x86/touchscreen_dmi.c | 26 ++++++++++++++++++++++++++
>> 1 file changed, 26 insertions(+)
>>
>> diff --git a/drivers/platform/x86/touchscreen_dmi.c b/drivers/platform/x86/touchscreen_dmi.c
>> index 85e425420da2..cb204f973491 100644
>> --- a/drivers/platform/x86/touchscreen_dmi.c
>> +++ b/drivers/platform/x86/touchscreen_dmi.c
>> @@ -117,6 +117,22 @@ static const struct ts_dmi_data cube_iwork8_air_data = {
>> .properties = cube_iwork8_air_props,
>> };
>>
>> +static const struct property_entry cube_knote_i1101_props[] = {
>> + PROPERTY_ENTRY_U32("touchscreen-min-x", 20),
>> + PROPERTY_ENTRY_U32("touchscreen-min-y", 22),
>> + PROPERTY_ENTRY_U32("touchscreen-size-x", 1961),
>> + PROPERTY_ENTRY_U32("touchscreen-size-y", 1513),
>> + PROPERTY_ENTRY_STRING("firmware-name", "gsl3692-cube-knote-i1101.fw"),
>> + PROPERTY_ENTRY_U32("silead,max-fingers", 10),
>> + PROPERTY_ENTRY_BOOL("silead,home-button"),
>> + { }
>> +};
>> +
>> +static const struct ts_dmi_data cube_knote_i1101_data = {
>> + .acpi_name = "MSSL1680:00",
>> + .properties = cube_knote_i1101_props,
>> +};
>> +
>> static const struct property_entry dexp_ursus_7w_props[] = {
>> PROPERTY_ENTRY_U32("touchscreen-size-x", 890),
>> PROPERTY_ENTRY_U32("touchscreen-size-y", 630),
>> @@ -458,6 +474,16 @@ static const struct dmi_system_id touchscreen_dmi_table[] = {
>> DMI_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"),
>> },
>> },
>> + {
>> + /* Cube KNote i1101 */
>> + .driver_data = (void *)&cube_knote_i1101_data,
>> + .matches = {
>> + DMI_MATCH(DMI_BOARD_VENDOR, "Hampoo"),
>> + DMI_MATCH(DMI_BOARD_NAME, "L1W6_I1101"),
>> + DMI_MATCH(DMI_SYS_VENDOR, "ALLDOCUBE"),
>> + DMI_MATCH(DMI_PRODUCT_NAME, "i1101"),
>> + },
>> + },
>> {
>> /* DEXP Ursus 7W */
>> .driver_data = (void *)&dexp_ursus_7w_data,
>> --
>> 2.18.0
>>
>
>
>
^ permalink raw reply
* Re: [PATCH] platform/x86: touchscreen_dmi: Add info for the Cube KNote i1101 tablet
From: Andy Shevchenko @ 2018-07-31 11:32 UTC (permalink / raw)
To: youling257
Cc: Linux Kernel Mailing List, Platform Driver, linux-input,
Andy Shevchenko, Darren Hart, Hans de Goede
In-Reply-To: <20180731093256.30533-1-youling257@gmail.com>
On Tue, Jul 31, 2018 at 12:32 PM, youling257 <youling257@gmail.com> wrote:
> Add touchscreen info for the Cube KNote i1101 tablet.
>
Thanks for the patch.
Unfortunately I can't take it w/o SoB line. If Hans volunteering to
give a such again, I guess we're fine.
> Reported-and-tested-by: lkongl <lkongl@163.com>
> ---
> drivers/platform/x86/touchscreen_dmi.c | 26 ++++++++++++++++++++++++++
> 1 file changed, 26 insertions(+)
>
> diff --git a/drivers/platform/x86/touchscreen_dmi.c b/drivers/platform/x86/touchscreen_dmi.c
> index 85e425420da2..cb204f973491 100644
> --- a/drivers/platform/x86/touchscreen_dmi.c
> +++ b/drivers/platform/x86/touchscreen_dmi.c
> @@ -117,6 +117,22 @@ static const struct ts_dmi_data cube_iwork8_air_data = {
> .properties = cube_iwork8_air_props,
> };
>
> +static const struct property_entry cube_knote_i1101_props[] = {
> + PROPERTY_ENTRY_U32("touchscreen-min-x", 20),
> + PROPERTY_ENTRY_U32("touchscreen-min-y", 22),
> + PROPERTY_ENTRY_U32("touchscreen-size-x", 1961),
> + PROPERTY_ENTRY_U32("touchscreen-size-y", 1513),
> + PROPERTY_ENTRY_STRING("firmware-name", "gsl3692-cube-knote-i1101.fw"),
> + PROPERTY_ENTRY_U32("silead,max-fingers", 10),
> + PROPERTY_ENTRY_BOOL("silead,home-button"),
> + { }
> +};
> +
> +static const struct ts_dmi_data cube_knote_i1101_data = {
> + .acpi_name = "MSSL1680:00",
> + .properties = cube_knote_i1101_props,
> +};
> +
> static const struct property_entry dexp_ursus_7w_props[] = {
> PROPERTY_ENTRY_U32("touchscreen-size-x", 890),
> PROPERTY_ENTRY_U32("touchscreen-size-y", 630),
> @@ -458,6 +474,16 @@ static const struct dmi_system_id touchscreen_dmi_table[] = {
> DMI_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"),
> },
> },
> + {
> + /* Cube KNote i1101 */
> + .driver_data = (void *)&cube_knote_i1101_data,
> + .matches = {
> + DMI_MATCH(DMI_BOARD_VENDOR, "Hampoo"),
> + DMI_MATCH(DMI_BOARD_NAME, "L1W6_I1101"),
> + DMI_MATCH(DMI_SYS_VENDOR, "ALLDOCUBE"),
> + DMI_MATCH(DMI_PRODUCT_NAME, "i1101"),
> + },
> + },
> {
> /* DEXP Ursus 7W */
> .driver_data = (void *)&dexp_ursus_7w_data,
> --
> 2.18.0
>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply
* [PATCH] platform/x86: touchscreen_dmi: Add info for the Cube KNote i1101 tablet
From: youling257 @ 2018-07-31 9:32 UTC (permalink / raw)
To: linux-kernel
Cc: platform-driver-x86, linux-input, andy, dvhart, hdegoede,
youling257
Add touchscreen info for the Cube KNote i1101 tablet.
Reported-and-tested-by: lkongl <lkongl@163.com>
---
drivers/platform/x86/touchscreen_dmi.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/drivers/platform/x86/touchscreen_dmi.c b/drivers/platform/x86/touchscreen_dmi.c
index 85e425420da2..cb204f973491 100644
--- a/drivers/platform/x86/touchscreen_dmi.c
+++ b/drivers/platform/x86/touchscreen_dmi.c
@@ -117,6 +117,22 @@ static const struct ts_dmi_data cube_iwork8_air_data = {
.properties = cube_iwork8_air_props,
};
+static const struct property_entry cube_knote_i1101_props[] = {
+ PROPERTY_ENTRY_U32("touchscreen-min-x", 20),
+ PROPERTY_ENTRY_U32("touchscreen-min-y", 22),
+ PROPERTY_ENTRY_U32("touchscreen-size-x", 1961),
+ PROPERTY_ENTRY_U32("touchscreen-size-y", 1513),
+ PROPERTY_ENTRY_STRING("firmware-name", "gsl3692-cube-knote-i1101.fw"),
+ PROPERTY_ENTRY_U32("silead,max-fingers", 10),
+ PROPERTY_ENTRY_BOOL("silead,home-button"),
+ { }
+};
+
+static const struct ts_dmi_data cube_knote_i1101_data = {
+ .acpi_name = "MSSL1680:00",
+ .properties = cube_knote_i1101_props,
+};
+
static const struct property_entry dexp_ursus_7w_props[] = {
PROPERTY_ENTRY_U32("touchscreen-size-x", 890),
PROPERTY_ENTRY_U32("touchscreen-size-y", 630),
@@ -458,6 +474,16 @@ static const struct dmi_system_id touchscreen_dmi_table[] = {
DMI_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"),
},
},
+ {
+ /* Cube KNote i1101 */
+ .driver_data = (void *)&cube_knote_i1101_data,
+ .matches = {
+ DMI_MATCH(DMI_BOARD_VENDOR, "Hampoo"),
+ DMI_MATCH(DMI_BOARD_NAME, "L1W6_I1101"),
+ DMI_MATCH(DMI_SYS_VENDOR, "ALLDOCUBE"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "i1101"),
+ },
+ },
{
/* DEXP Ursus 7W */
.driver_data = (void *)&dexp_ursus_7w_data,
--
2.18.0
^ permalink raw reply related
* Re: [PATCH 1/2] HID: redragon: Fix regression in non-Redragon keyboard due to this new driver
From: Robert Munteanu @ 2018-07-30 14:05 UTC (permalink / raw)
To: John S Gruber, Jiri Kosina, linux-input, benjamin.tissoires,
dmitry.torokhov, linux-kernel
In-Reply-To: <CAPotdmT-zCVL=hoV0y83bbksTQ3AWsCybzisL8B6n-OB-M645g@mail.gmail.com>
Hi John,
On Sat, 2018-07-28 at 15:53 -0400, John S Gruber wrote:
> The Redragon keyboard uses the second device being presented, but
> other
> devices with the same vendor_id/device_id pair (0x0c45:760b) use the
> first.
> Don't cause its deletion. Problem introduced in commit 85455dd906d5
> ("HID: redragon: Fix modifier keys for Redragon Asura Keyboard")
>
> Fixes: 85455dd906d5
> Signed-off-by: John S Gruber <JohnSGruber@gmail.com>
> ---
> drivers/hid/hid-redragon.c | 4 ----
> 1 file changed, 4 deletions(-)
>
> diff --git a/drivers/hid/hid-redragon.c b/drivers/hid/hid-redragon.c
> index daf5957..85a5fbb 100644
> --- a/drivers/hid/hid-redragon.c
> +++ b/drivers/hid/hid-redragon.c
> @@ -55,10 +55,6 @@ static int redragon_probe(struct hid_device *dev,
> return ret;
> }
>
> - /* do not register unused input device */
> - if (dev->maxapplication == 1)
> - return 0;
> -
> ret = hid_hw_start(dev, HID_CONNECT_DEFAULT);
> if (ret) {
> hid_err(dev, "hw start failed\n");
As I mentioned, this is already fixed by
dc9b8e85ed95cbe7e3ad0eabb5b48d617bbc365e, scheduled for 4.19, and I
suggest that we instead add that one to 4.18.
The explanation is that the block you deleted was the whole reason for
adding the redragon_probe function, so the changes are largely
equivalent.
Thanks,
Robert
^ permalink raw reply
* [PATCH v2 1/1] Input: synaptics - Enable RMI4 for Clevo P870DM laptops.
From: Teika Kazura @ 2018-07-30 11:35 UTC (permalink / raw)
To: rosenp; +Cc: linux-input, linux-kernel, jan.steffens, waltercool
In-Reply-To: <20180730.201359.525452745785453302.teika@gmx.com>
This patch enables SMBus/RMI4 for PCs with SYN1219, e.g. Clevo P870DM etc.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Co-Developed-by: Teika Kazura <teika@gmx.com>
Signed-off-by: Teika Kazura <teika@gmx.com>
---
drivers/input/mouse/synaptics.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index a9591d2..0669770 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -179,7 +179,7 @@ static const char * const smbus_pnp_ids[] = {
"LEN0096", /* X280 */
"LEN0097", /* X280 -> ALPS trackpoint */
"LEN200f", /* T450s */
+ "SYN1219", /* Schenker H506 (rebrand of Clevo P651RG), Clevo P870DM */
NULL
};
--
2.16.1
^ permalink raw reply related
* [PATCH v2 0/1] Input: synaptics - Enable RMI4 for Clevo P870DM laptops.
From: Teika Kazura @ 2018-07-30 11:35 UTC (permalink / raw)
To: Rosen Penev; +Cc: linux-input, linux-kernel, jan.steffens, Pablo Cholaky
@Rosen Penev: Could you please test this patch for kernel >= 4.17, for a week or so? At least suspend/resume should not cause any problem.
------------------------------------------------------------------------
This patch enables SMBus/RMI4 for PCs with SYN1219, e.g. Clevo P870DM etc.
Three users have reported SYN1219 supports SMBus, in Jul and Aug 2017:
https://marc.info/?l=linux-input&m=150049625613055&w=2
https://marc.info/?l=linux-input&m=150284057602358&w=2
https://marc.info/?l=linux-input&m=150094561111026&w=2
No problem has been reported since then.
---
v2
This patch was originally submitted by Rosen Penev in Jun 2018 [1], which modified the list forcepad_pnp_ids[]. The current version instead changes smbus_pnp_ids[].
This version is yet to be tested.
[1] https://www.spinics.net/lists/linux-input/msg56884.html
Teika Kazura (1):
Input: synaptics - Enable RMI4 for Clevo P870DM laptops.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Co-Developed-by: Teika Kazura <teika@gmx.com>
Signed-off-by: Teika Kazura <teika@gmx.com>
drivers/input/mouse/synaptics.c | 1 +
1 file changed, 1 insertion(+)
--
2.16.1
^ permalink raw reply
* Re: [PATCH v11 1/2] mfd: bd71837: mfd driver for ROHM BD71837 PMIC
From: Matti Vaittinen @ 2018-07-30 10:51 UTC (permalink / raw)
To: lee.jones, robh+dt, mark.rutland, eballetbo, linus.walleij,
mazziesaccount, dmitry.torokhov
Cc: linux-clk, devicetree, linux-kernel, sboyd, broonie, linux-input,
mikko.mutanen, heikki.haikola
In-Reply-To: <77184f651e5cefb112f1061bc682b759f88144c6.1532946848.git.matti.vaittinen@fi.rohmeurope.com>
On Mon, Jul 30, 2018 at 01:43:34PM +0300, Matti Vaittinen wrote:
> ROHM BD71837 PMIC MFD driver providing interrupts and support
> for three subsystems:
> - clk
> - Regulators
> - input/power-key
>
> Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
> Reviewed-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Please note that I maintained the acked-by line from Enric because the
patch version 11 mostly contains only trivial changes - and is not
touching the points Enric was originally concerned. Enric, please
let us know if this is not Ok for you.
Br,
Matti Vaittinen
^ permalink raw reply
* Re: [PATCH v11 2/2] mfd: bd71837: Devicetree bindings for ROHM BD71837 PMIC
From: Matti Vaittinen @ 2018-07-30 10:49 UTC (permalink / raw)
To: lee.jones, robh+dt, mark.rutland, eballetbo, linus.walleij,
mazziesaccount, dmitry.torokhov
Cc: linux-clk, devicetree, linux-kernel, sboyd, broonie, linux-input,
mikko.mutanen, heikki.haikola
In-Reply-To: <04328e559dcb38b8722248af5a2de028d4237224.1532946848.git.matti.vaittinen@fi.rohmeurope.com>
On Mon, Jul 30, 2018 at 01:46:37PM +0300, Matti Vaittinen wrote:
> Document devicetree bindings for ROHM BD71837 PMIC MFD.
>
> Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
> Reviewed-by: Rob Herring <robh@kernel.org>
> Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>
Please note - this patch is unchanged from previous version so I
maintained the reviewed-by and acked by statements.
Br,
Matti Vaittinen
^ permalink raw reply
* [PATCH v11 2/2] mfd: bd71837: Devicetree bindings for ROHM BD71837 PMIC
From: Matti Vaittinen @ 2018-07-30 10:46 UTC (permalink / raw)
To: lee.jones, robh+dt, mark.rutland, eballetbo, linus.walleij,
mazziesaccount, dmitry.torokhov
Cc: linux-clk, devicetree, linux-kernel, sboyd, broonie, linux-input,
mikko.mutanen, heikki.haikola
In-Reply-To: <cover.1532946848.git.matti.vaittinen@fi.rohmeurope.com>
Document devicetree bindings for ROHM BD71837 PMIC MFD.
Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Acked-for-MFD-by: Lee Jones <lee.jones@linaro.org>
---
.../devicetree/bindings/mfd/rohm,bd71837-pmic.txt | 62 ++++++++++++++++++++++
1 file changed, 62 insertions(+)
create mode 100644 Documentation/devicetree/bindings/mfd/rohm,bd71837-pmic.txt
diff --git a/Documentation/devicetree/bindings/mfd/rohm,bd71837-pmic.txt b/Documentation/devicetree/bindings/mfd/rohm,bd71837-pmic.txt
new file mode 100644
index 000000000000..3ca56fdb5ffe
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/rohm,bd71837-pmic.txt
@@ -0,0 +1,62 @@
+* ROHM BD71837 Power Management Integrated Circuit bindings
+
+BD71837MWV is a programmable Power Management IC for powering single-core,
+dual-core, and quad-core SoCs such as NXP-i.MX 8M. It is optimized for
+low BOM cost and compact solution footprint. It integrates 8 Buck
+egulators and 7 LDOs to provide all the power rails required by the SoC and
+the commonly used peripherals.
+
+Datasheet for PMIC is available at:
+https://www.rohm.com/datasheet/BD71837MWV/bd71837mwv-e
+
+Required properties:
+ - compatible : Should be "rohm,bd71837".
+ - reg : I2C slave address.
+ - interrupt-parent : Phandle to the parent interrupt controller.
+ - interrupts : The interrupt line the device is connected to.
+ - clocks : The parent clock connected to PMIC. If this is missing
+ 32768 KHz clock is assumed.
+ - #clock-cells : Should be 0.
+ - regulators: : List of child nodes that specify the regulators.
+ Please see ../regulator/rohm,bd71837-regulator.txt
+
+Optional properties:
+- clock-output-names : Should contain name for output clock.
+
+Example:
+
+ /* external oscillator node */
+ osc: oscillator {
+ compatible = "fixed-clock";
+ #clock-cells = <1>;
+ clock-frequency = <32768>;
+ clock-output-names = "osc";
+ };
+
+ pmic: pmic@4b {
+ compatible = "rohm,bd71837";
+ reg = <0x4b>;
+ interrupt-parent = <&gpio1>;
+ interrupts = <29 GPIO_ACTIVE_LOW>;
+ interrupt-names = "irq";
+ #clock-cells = <0>;
+ clocks = <&osc 0>;
+ clock-output-names = "bd71837-32k-out";
+
+ regulators {
+ buck1: BUCK1 {
+ regulator-name = "buck1";
+ regulator-min-microvolt = <700000>;
+ regulator-max-microvolt = <1300000>;
+ regulator-boot-on;
+ regulator-ramp-delay = <1250>;
+ };
+ };
+ };
+
+ /* Clock consumer node */
+ rtc@0 {
+ compatible = "company,my-rtc";
+ clock-names = "my-clock";
+ clocks = <&pmic>;
+ };
--
2.14.3
^ permalink raw reply related
* [PATCH v11 1/2] mfd: bd71837: mfd driver for ROHM BD71837 PMIC
From: Matti Vaittinen @ 2018-07-30 10:43 UTC (permalink / raw)
To: lee.jones, robh+dt, mark.rutland, eballetbo, linus.walleij,
mazziesaccount, dmitry.torokhov
Cc: linux-clk, devicetree, linux-kernel, sboyd, broonie, linux-input,
mikko.mutanen, heikki.haikola
In-Reply-To: <cover.1532946848.git.matti.vaittinen@fi.rohmeurope.com>
ROHM BD71837 PMIC MFD driver providing interrupts and support
for three subsystems:
- clk
- Regulators
- input/power-key
Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Reviewed-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
---
drivers/mfd/Kconfig | 13 ++
drivers/mfd/Makefile | 1 +
drivers/mfd/rohm-bd718x7.c | 208 ++++++++++++++++++++++++
include/linux/mfd/rohm-bd718x7.h | 332 +++++++++++++++++++++++++++++++++++++++
4 files changed, 554 insertions(+)
create mode 100644 drivers/mfd/rohm-bd718x7.c
create mode 100644 include/linux/mfd/rohm-bd718x7.h
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index f3fa516011ec..11841f4b7b2b 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -1817,6 +1817,19 @@ config MFD_STW481X
in various ST Microelectronics and ST-Ericsson embedded
Nomadik series.
+config MFD_ROHM_BD718XX
+ tristate "ROHM BD71837 Power Management IC"
+ depends on I2C=y
+ depends on OF
+ select REGMAP_I2C
+ select REGMAP_IRQ
+ select MFD_CORE
+ help
+ Select this option to get support for the ROHM BD71837
+ Power Management ICs. BD71837 is designed to power processors like
+ NXP i.MX8. It contains 8 BUCK outputs and 7 LDOs, voltage monitoring
+ and emergency shut down as well as 32,768KHz clock output.
+
config MFD_STM32_LPTIMER
tristate "Support for STM32 Low-Power Timer"
depends on (ARCH_STM32 && OF) || COMPILE_TEST
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 2852a6042ecf..5856a9489cbd 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -239,4 +239,5 @@ obj-$(CONFIG_MFD_STM32_TIMERS) += stm32-timers.o
obj-$(CONFIG_MFD_MXS_LRADC) += mxs-lradc.o
obj-$(CONFIG_MFD_SC27XX_PMIC) += sprd-sc27xx-spi.o
obj-$(CONFIG_RAVE_SP_CORE) += rave-sp.o
+obj-$(CONFIG_MFD_ROHM_BD718XX) += rohm-bd718x7.o
diff --git a/drivers/mfd/rohm-bd718x7.c b/drivers/mfd/rohm-bd718x7.c
new file mode 100644
index 000000000000..7392b73b2f9a
--- /dev/null
+++ b/drivers/mfd/rohm-bd718x7.c
@@ -0,0 +1,208 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+//
+// Copyright (C) 2018 ROHM Semiconductors
+//
+// ROHM BD71837MWV PMIC driver
+//
+// Datasheet available from
+// https://www.rohm.com/datasheet/BD71837MWV/bd71837mwv-e
+
+#include <linux/i2c.h>
+#include <linux/input.h>
+#include <linux/interrupt.h>
+#include <linux/mfd/rohm-bd718x7.h>
+#include <linux/mfd/core.h>
+#include <linux/module.h>
+#include <linux/regmap.h>
+
+/*
+ * gpio_keys.h requires definiton of bool. It is brought in
+ * by above includes. Keep this as last until gpio_keys.h gets fixed.
+ */
+#include <linux/gpio_keys.h>
+
+static const u8 supported_revisions[] = { 0xA2 /* BD71837 */ };
+
+static struct gpio_keys_button button = {
+ .code = KEY_POWER,
+ .gpio = -1,
+ .type = EV_KEY,
+};
+
+static struct gpio_keys_platform_data bd718xx_powerkey_data = {
+ .buttons = &button,
+ .nbuttons = 1,
+ .name = "bd718xx-pwrkey",
+};
+
+static struct mfd_cell bd71837_mfd_cells[] = {
+ {
+ .name = "gpio-keys",
+ .platform_data = &bd718xx_powerkey_data,
+ .pdata_size = sizeof(bd718xx_powerkey_data),
+ },
+ { .name = "bd71837-clk", },
+ { .name = "bd71837-pmic", },
+};
+
+static const struct regmap_irq bd71837_irqs[] = {
+ REGMAP_IRQ_REG(BD71837_INT_SWRST, 0, BD71837_INT_SWRST_MASK),
+ REGMAP_IRQ_REG(BD71837_INT_PWRBTN_S, 0, BD71837_INT_PWRBTN_S_MASK),
+ REGMAP_IRQ_REG(BD71837_INT_PWRBTN_L, 0, BD71837_INT_PWRBTN_L_MASK),
+ REGMAP_IRQ_REG(BD71837_INT_PWRBTN, 0, BD71837_INT_PWRBTN_MASK),
+ REGMAP_IRQ_REG(BD71837_INT_WDOG, 0, BD71837_INT_WDOG_MASK),
+ REGMAP_IRQ_REG(BD71837_INT_ON_REQ, 0, BD71837_INT_ON_REQ_MASK),
+ REGMAP_IRQ_REG(BD71837_INT_STBY_REQ, 0, BD71837_INT_STBY_REQ_MASK),
+};
+
+static struct regmap_irq_chip bd71837_irq_chip = {
+ .name = "bd71837-irq",
+ .irqs = bd71837_irqs,
+ .num_irqs = ARRAY_SIZE(bd71837_irqs),
+ .num_regs = 1,
+ .irq_reg_stride = 1,
+ .status_base = BD71837_REG_IRQ,
+ .mask_base = BD71837_REG_MIRQ,
+ .ack_base = BD71837_REG_IRQ,
+ .init_ack_masked = true,
+ .mask_invert = false,
+};
+
+static const struct regmap_range pmic_status_range = {
+ .range_min = BD71837_REG_IRQ,
+ .range_max = BD71837_REG_POW_STATE,
+};
+
+static const struct regmap_access_table volatile_regs = {
+ .yes_ranges = &pmic_status_range,
+ .n_yes_ranges = 1,
+};
+
+static const struct regmap_config bd71837_regmap_config = {
+ .reg_bits = 8,
+ .val_bits = 8,
+ .volatile_table = &volatile_regs,
+ .max_register = BD71837_MAX_REGISTER - 1,
+ .cache_type = REGCACHE_RBTREE,
+};
+
+static int bd71837_i2c_probe(struct i2c_client *i2c,
+ const struct i2c_device_id *id)
+{
+ struct bd71837 *bd71837;
+ int ret, i;
+ unsigned int val;
+
+ bd71837 = devm_kzalloc(&i2c->dev, sizeof(struct bd71837), GFP_KERNEL);
+
+ if (!bd71837)
+ return -ENOMEM;
+
+ bd71837->chip_irq = i2c->irq;
+
+ if (!bd71837->chip_irq) {
+ dev_err(&i2c->dev, "No IRQ configured\n");
+ return -EINVAL;
+ }
+
+ bd71837->dev = &i2c->dev;
+ dev_set_drvdata(&i2c->dev, bd71837);
+
+ bd71837->regmap = devm_regmap_init_i2c(i2c, &bd71837_regmap_config);
+ if (IS_ERR(bd71837->regmap)) {
+ dev_err(&i2c->dev, "regmap initialization failed\n");
+ return PTR_ERR(bd71837->regmap);
+ }
+
+ ret = regmap_read(bd71837->regmap, BD71837_REG_REV, &val);
+ if (ret) {
+ dev_err(&i2c->dev, "Read BD71837_REG_DEVICE failed\n");
+ return ret;
+ }
+ for (i = 0; i < ARRAY_SIZE(supported_revisions); i++)
+ if (supported_revisions[i] == val)
+ break;
+
+ if (i == ARRAY_SIZE(supported_revisions)) {
+ dev_err(&i2c->dev, "Unsupported chip revision\n");
+ return -ENODEV;
+ }
+
+ ret = devm_regmap_add_irq_chip(&i2c->dev, bd71837->regmap,
+ bd71837->chip_irq, IRQF_ONESHOT, 0,
+ &bd71837_irq_chip, &bd71837->irq_data);
+ if (ret) {
+ dev_err(&i2c->dev, "Failed to add irq_chip\n");
+ return ret;
+ }
+
+ /* Configure short press to 10 milliseconds */
+ ret = regmap_update_bits(bd71837->regmap,
+ BD71837_REG_PWRONCONFIG0,
+ BD718XX_PWRBTN_PRESS_DURATION_MASK,
+ BD718XX_PWRBTN_SHORT_PRESS_10MS);
+ if (ret) {
+ dev_err(&i2c->dev, "Failed to configure button short press timeout\n");
+ return ret;
+ }
+
+ /* Configure long press to 10 seconds */
+ ret = regmap_update_bits(bd71837->regmap,
+ BD71837_REG_PWRONCONFIG1,
+ BD718XX_PWRBTN_PRESS_DURATION_MASK,
+ BD718XX_PWRBTN_LONG_PRESS_10S);
+
+ if (ret) {
+ dev_err(&i2c->dev, "Failed to configure button long press timeout\n");
+ return ret;
+ }
+
+ button.irq = regmap_irq_get_virq(bd71837->irq_data,
+ BD71837_INT_PWRBTN_S);
+
+ if (button.irq < 0) {
+ dev_err(&i2c->dev, "Failed to get the IRQ\n");
+ return button.irq;
+ }
+
+ ret = devm_mfd_add_devices(bd71837->dev, PLATFORM_DEVID_AUTO,
+ bd71837_mfd_cells,
+ ARRAY_SIZE(bd71837_mfd_cells), NULL, 0,
+ regmap_irq_get_domain(bd71837->irq_data));
+ if (ret)
+ dev_err(&i2c->dev, "Failed to create subdevices\n");
+
+ return ret;
+}
+
+static const struct of_device_id bd71837_of_match[] = {
+ { .compatible = "rohm,bd71837", },
+ { }
+};
+MODULE_DEVICE_TABLE(of, bd71837_of_match);
+
+static struct i2c_driver bd71837_i2c_driver = {
+ .driver = {
+ .name = "rohm-bd718x7",
+ .of_match_table = bd71837_of_match,
+ },
+ .probe = bd71837_i2c_probe,
+};
+
+static int __init bd71837_i2c_init(void)
+{
+ return i2c_add_driver(&bd71837_i2c_driver);
+}
+
+/* Initialise early so consumer devices can complete system boot */
+subsys_initcall(bd71837_i2c_init);
+
+static void __exit bd71837_i2c_exit(void)
+{
+ i2c_del_driver(&bd71837_i2c_driver);
+}
+module_exit(bd71837_i2c_exit);
+
+MODULE_AUTHOR("Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>");
+MODULE_DESCRIPTION("ROHM BD71837 Power Management IC driver");
+MODULE_LICENSE("GPL");
diff --git a/include/linux/mfd/rohm-bd718x7.h b/include/linux/mfd/rohm-bd718x7.h
new file mode 100644
index 000000000000..a528747f8aed
--- /dev/null
+++ b/include/linux/mfd/rohm-bd718x7.h
@@ -0,0 +1,332 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/* Copyright (C) 2018 ROHM Semiconductors */
+
+#ifndef __LINUX_MFD_BD71837_H__
+#define __LINUX_MFD_BD71837_H__
+
+#include <linux/regmap.h>
+
+enum {
+ BD71837_BUCK1 = 0,
+ BD71837_BUCK2,
+ BD71837_BUCK3,
+ BD71837_BUCK4,
+ BD71837_BUCK5,
+ BD71837_BUCK6,
+ BD71837_BUCK7,
+ BD71837_BUCK8,
+ BD71837_LDO1,
+ BD71837_LDO2,
+ BD71837_LDO3,
+ BD71837_LDO4,
+ BD71837_LDO5,
+ BD71837_LDO6,
+ BD71837_LDO7,
+ BD71837_REGULATOR_CNT,
+};
+
+#define BD71837_BUCK1_VOLTAGE_NUM 0x40
+#define BD71837_BUCK2_VOLTAGE_NUM 0x40
+#define BD71837_BUCK3_VOLTAGE_NUM 0x40
+#define BD71837_BUCK4_VOLTAGE_NUM 0x40
+
+#define BD71837_BUCK5_VOLTAGE_NUM 0x08
+#define BD71837_BUCK6_VOLTAGE_NUM 0x04
+#define BD71837_BUCK7_VOLTAGE_NUM 0x08
+#define BD71837_BUCK8_VOLTAGE_NUM 0x40
+
+#define BD71837_LDO1_VOLTAGE_NUM 0x04
+#define BD71837_LDO2_VOLTAGE_NUM 0x02
+#define BD71837_LDO3_VOLTAGE_NUM 0x10
+#define BD71837_LDO4_VOLTAGE_NUM 0x10
+#define BD71837_LDO5_VOLTAGE_NUM 0x10
+#define BD71837_LDO6_VOLTAGE_NUM 0x10
+#define BD71837_LDO7_VOLTAGE_NUM 0x10
+
+enum {
+ BD71837_REG_REV = 0x00,
+ BD71837_REG_SWRESET = 0x01,
+ BD71837_REG_I2C_DEV = 0x02,
+ BD71837_REG_PWRCTRL0 = 0x03,
+ BD71837_REG_PWRCTRL1 = 0x04,
+ BD71837_REG_BUCK1_CTRL = 0x05,
+ BD71837_REG_BUCK2_CTRL = 0x06,
+ BD71837_REG_BUCK3_CTRL = 0x07,
+ BD71837_REG_BUCK4_CTRL = 0x08,
+ BD71837_REG_BUCK5_CTRL = 0x09,
+ BD71837_REG_BUCK6_CTRL = 0x0A,
+ BD71837_REG_BUCK7_CTRL = 0x0B,
+ BD71837_REG_BUCK8_CTRL = 0x0C,
+ BD71837_REG_BUCK1_VOLT_RUN = 0x0D,
+ BD71837_REG_BUCK1_VOLT_IDLE = 0x0E,
+ BD71837_REG_BUCK1_VOLT_SUSP = 0x0F,
+ BD71837_REG_BUCK2_VOLT_RUN = 0x10,
+ BD71837_REG_BUCK2_VOLT_IDLE = 0x11,
+ BD71837_REG_BUCK3_VOLT_RUN = 0x12,
+ BD71837_REG_BUCK4_VOLT_RUN = 0x13,
+ BD71837_REG_BUCK5_VOLT = 0x14,
+ BD71837_REG_BUCK6_VOLT = 0x15,
+ BD71837_REG_BUCK7_VOLT = 0x16,
+ BD71837_REG_BUCK8_VOLT = 0x17,
+ BD71837_REG_LDO1_VOLT = 0x18,
+ BD71837_REG_LDO2_VOLT = 0x19,
+ BD71837_REG_LDO3_VOLT = 0x1A,
+ BD71837_REG_LDO4_VOLT = 0x1B,
+ BD71837_REG_LDO5_VOLT = 0x1C,
+ BD71837_REG_LDO6_VOLT = 0x1D,
+ BD71837_REG_LDO7_VOLT = 0x1E,
+ BD71837_REG_TRANS_COND0 = 0x1F,
+ BD71837_REG_TRANS_COND1 = 0x20,
+ BD71837_REG_VRFAULTEN = 0x21,
+ BD71837_REG_MVRFLTMASK0 = 0x22,
+ BD71837_REG_MVRFLTMASK1 = 0x23,
+ BD71837_REG_MVRFLTMASK2 = 0x24,
+ BD71837_REG_RCVCFG = 0x25,
+ BD71837_REG_RCVNUM = 0x26,
+ BD71837_REG_PWRONCONFIG0 = 0x27,
+ BD71837_REG_PWRONCONFIG1 = 0x28,
+ BD71837_REG_RESETSRC = 0x29,
+ BD71837_REG_MIRQ = 0x2A,
+ BD71837_REG_IRQ = 0x2B,
+ BD71837_REG_IN_MON = 0x2C,
+ BD71837_REG_POW_STATE = 0x2D,
+ BD71837_REG_OUT32K = 0x2E,
+ BD71837_REG_REGLOCK = 0x2F,
+ BD71837_REG_OTPVER = 0xFF,
+ BD71837_MAX_REGISTER = 0x100,
+};
+
+#define REGLOCK_PWRSEQ 0x1
+#define REGLOCK_VREG 0x10
+
+/* Generic BUCK control masks */
+#define BD71837_BUCK_SEL 0x02
+#define BD71837_BUCK_EN 0x01
+#define BD71837_BUCK_RUN_ON 0x04
+
+/* Generic LDO masks */
+#define BD71837_LDO_SEL 0x80
+#define BD71837_LDO_EN 0x40
+
+/* BD71837 BUCK ramp rate CTRL reg bits */
+#define BUCK_RAMPRATE_MASK 0xC0
+#define BUCK_RAMPRATE_10P00MV 0x0
+#define BUCK_RAMPRATE_5P00MV 0x1
+#define BUCK_RAMPRATE_2P50MV 0x2
+#define BUCK_RAMPRATE_1P25MV 0x3
+
+/* BD71837_REG_BUCK1_VOLT_RUN bits */
+#define BUCK1_RUN_MASK 0x3F
+#define BUCK1_RUN_DEFAULT 0x14
+
+/* BD71837_REG_BUCK1_VOLT_SUSP bits */
+#define BUCK1_SUSP_MASK 0x3F
+#define BUCK1_SUSP_DEFAULT 0x14
+
+/* BD71837_REG_BUCK1_VOLT_IDLE bits */
+#define BUCK1_IDLE_MASK 0x3F
+#define BUCK1_IDLE_DEFAULT 0x14
+
+/* BD71837_REG_BUCK2_VOLT_RUN bits */
+#define BUCK2_RUN_MASK 0x3F
+#define BUCK2_RUN_DEFAULT 0x1E
+
+/* BD71837_REG_BUCK2_VOLT_IDLE bits */
+#define BUCK2_IDLE_MASK 0x3F
+#define BUCK2_IDLE_DEFAULT 0x14
+
+/* BD71837_REG_BUCK3_VOLT_RUN bits */
+#define BUCK3_RUN_MASK 0x3F
+#define BUCK3_RUN_DEFAULT 0x1E
+
+/* BD71837_REG_BUCK4_VOLT_RUN bits */
+#define BUCK4_RUN_MASK 0x3F
+#define BUCK4_RUN_DEFAULT 0x1E
+
+/* BD71837_REG_BUCK5_VOLT bits */
+#define BUCK5_MASK 0x07
+#define BUCK5_DEFAULT 0x02
+
+/* BD71837_REG_BUCK6_VOLT bits */
+#define BUCK6_MASK 0x03
+#define BUCK6_DEFAULT 0x03
+
+/* BD71837_REG_BUCK7_VOLT bits */
+#define BUCK7_MASK 0x07
+#define BUCK7_DEFAULT 0x03
+
+/* BD71837_REG_BUCK8_VOLT bits */
+#define BUCK8_MASK 0x3F
+#define BUCK8_DEFAULT 0x1E
+
+/* BD71837_REG_IRQ bits */
+#define IRQ_SWRST 0x40
+#define IRQ_PWRON_S 0x20
+#define IRQ_PWRON_L 0x10
+#define IRQ_PWRON 0x08
+#define IRQ_WDOG 0x04
+#define IRQ_ON_REQ 0x02
+#define IRQ_STBY_REQ 0x01
+
+/* BD71837_REG_OUT32K bits */
+#define BD71837_OUT32K_EN 0x01
+
+/* BD71837 gated clock rate */
+#define BD71837_CLK_RATE 32768
+
+/* ROHM BD71837 irqs */
+enum {
+ BD71837_INT_STBY_REQ,
+ BD71837_INT_ON_REQ,
+ BD71837_INT_WDOG,
+ BD71837_INT_PWRBTN,
+ BD71837_INT_PWRBTN_L,
+ BD71837_INT_PWRBTN_S,
+ BD71837_INT_SWRST
+};
+
+/* ROHM BD71837 interrupt masks */
+#define BD71837_INT_SWRST_MASK 0x40
+#define BD71837_INT_PWRBTN_S_MASK 0x20
+#define BD71837_INT_PWRBTN_L_MASK 0x10
+#define BD71837_INT_PWRBTN_MASK 0x8
+#define BD71837_INT_WDOG_MASK 0x4
+#define BD71837_INT_ON_REQ_MASK 0x2
+#define BD71837_INT_STBY_REQ_MASK 0x1
+
+/* BD71837_REG_LDO1_VOLT bits */
+#define LDO1_MASK 0x03
+
+/* BD71837_REG_LDO1_VOLT bits */
+#define LDO2_MASK 0x20
+
+/* BD71837_REG_LDO3_VOLT bits */
+#define LDO3_MASK 0x0F
+
+/* BD71837_REG_LDO4_VOLT bits */
+#define LDO4_MASK 0x0F
+
+/* BD71837_REG_LDO5_VOLT bits */
+#define LDO5_MASK 0x0F
+
+/* BD71837_REG_LDO6_VOLT bits */
+#define LDO6_MASK 0x0F
+
+/* BD71837_REG_LDO7_VOLT bits */
+#define LDO7_MASK 0x0F
+
+/* Register write induced reset settings */
+
+/*
+ * Even though the bit zero is not SWRESET type we still want to write zero
+ * to it when changing type. Bit zero is 'SWRESET' trigger bit and if we
+ * write 1 to it we will trigger the action. So always write 0 to it when
+ * changning SWRESET action - no matter what we read from it.
+ */
+#define BD71837_SWRESET_TYPE_MASK 7
+#define BD71837_SWRESET_TYPE_DISABLED 0
+#define BD71837_SWRESET_TYPE_COLD 4
+#define BD71837_SWRESET_TYPE_WARM 6
+
+#define BD71837_SWRESET_RESET_MASK 1
+#define BD71837_SWRESET_RESET 1
+
+/* Poweroff state transition conditions */
+
+#define BD718XX_ON_REQ_POWEROFF_MASK 1
+#define BD718XX_SWRESET_POWEROFF_MASK 2
+#define BD718XX_WDOG_POWEROFF_MASK 4
+#define BD718XX_KEY_L_POWEROFF_MASK 8
+
+#define BD718XX_POWOFF_TO_SNVS 0
+#define BD718XX_POWOFF_TO_RDY 0xF
+
+#define BD718XX_POWOFF_TIME_MASK 0xF0
+enum {
+ BD718XX_POWOFF_TIME_5MS = 0,
+ BD718XX_POWOFF_TIME_10MS,
+ BD718XX_POWOFF_TIME_15MS,
+ BD718XX_POWOFF_TIME_20MS,
+ BD718XX_POWOFF_TIME_25MS,
+ BD718XX_POWOFF_TIME_30MS,
+ BD718XX_POWOFF_TIME_35MS,
+ BD718XX_POWOFF_TIME_40MS,
+ BD718XX_POWOFF_TIME_45MS,
+ BD718XX_POWOFF_TIME_50MS,
+ BD718XX_POWOFF_TIME_75MS,
+ BD718XX_POWOFF_TIME_100MS,
+ BD718XX_POWOFF_TIME_250MS,
+ BD718XX_POWOFF_TIME_500MS,
+ BD718XX_POWOFF_TIME_750MS,
+ BD718XX_POWOFF_TIME_1500MS
+};
+
+/* Poweron sequence state transition conditions */
+#define BD718XX_RDY_TO_SNVS_MASK 0xF
+#define BD718XX_SNVS_TO_RUN_MASK 0xF0
+
+#define BD718XX_PWR_TRIG_KEY_L 1
+#define BD718XX_PWR_TRIG_KEY_S 2
+#define BD718XX_PWR_TRIG_PMIC_ON 4
+#define BD718XX_PWR_TRIG_VSYS_UVLO 8
+#define BD718XX_RDY_TO_SNVS_SIFT 0
+#define BD718XX_SNVS_TO_RUN_SIFT 4
+
+#define BD718XX_PWRBTN_PRESS_DURATION_MASK 0xF
+
+/* Timeout value for detecting short press */
+enum {
+ BD718XX_PWRBTN_SHORT_PRESS_10MS = 0,
+ BD718XX_PWRBTN_SHORT_PRESS_500MS,
+ BD718XX_PWRBTN_SHORT_PRESS_1000MS,
+ BD718XX_PWRBTN_SHORT_PRESS_1500MS,
+ BD718XX_PWRBTN_SHORT_PRESS_2000MS,
+ BD718XX_PWRBTN_SHORT_PRESS_2500MS,
+ BD718XX_PWRBTN_SHORT_PRESS_3000MS,
+ BD718XX_PWRBTN_SHORT_PRESS_3500MS,
+ BD718XX_PWRBTN_SHORT_PRESS_4000MS,
+ BD718XX_PWRBTN_SHORT_PRESS_4500MS,
+ BD718XX_PWRBTN_SHORT_PRESS_5000MS,
+ BD718XX_PWRBTN_SHORT_PRESS_5500MS,
+ BD718XX_PWRBTN_SHORT_PRESS_6000MS,
+ BD718XX_PWRBTN_SHORT_PRESS_6500MS,
+ BD718XX_PWRBTN_SHORT_PRESS_7000MS,
+ BD718XX_PWRBTN_SHORT_PRESS_7500MS
+};
+
+/* Timeout value for detecting LONG press */
+enum {
+ BD718XX_PWRBTN_LONG_PRESS_10MS = 0,
+ BD718XX_PWRBTN_LONG_PRESS_1S,
+ BD718XX_PWRBTN_LONG_PRESS_2S,
+ BD718XX_PWRBTN_LONG_PRESS_3S,
+ BD718XX_PWRBTN_LONG_PRESS_4S,
+ BD718XX_PWRBTN_LONG_PRESS_5S,
+ BD718XX_PWRBTN_LONG_PRESS_6S,
+ BD718XX_PWRBTN_LONG_PRESS_7S,
+ BD718XX_PWRBTN_LONG_PRESS_8S,
+ BD718XX_PWRBTN_LONG_PRESS_9S,
+ BD718XX_PWRBTN_LONG_PRESS_10S,
+ BD718XX_PWRBTN_LONG_PRESS_11S,
+ BD718XX_PWRBTN_LONG_PRESS_12S,
+ BD718XX_PWRBTN_LONG_PRESS_13S,
+ BD718XX_PWRBTN_LONG_PRESS_14S,
+ BD718XX_PWRBTN_LONG_PRESS_15S
+};
+
+struct bd71837_pmic;
+struct bd71837_clk;
+
+struct bd71837 {
+ struct device *dev;
+ struct regmap *regmap;
+ unsigned long int id;
+
+ int chip_irq;
+ struct regmap_irq_chip_data *irq_data;
+
+ struct bd71837_pmic *pmic;
+ struct bd71837_clk *clk;
+};
+
+#endif /* __LINUX_MFD_BD71837_H__ */
--
2.14.3
^ permalink raw reply related
* [PATCH v11 0/2] mfd/regulator/clk/input: bd71837: ROHM BD71837 PMIC driver
From: Matti Vaittinen @ 2018-07-30 10:41 UTC (permalink / raw)
To: lee.jones, robh+dt, mark.rutland, eballetbo, linus.walleij,
mazziesaccount, dmitry.torokhov
Cc: linux-clk, devicetree, linux-kernel, sboyd, broonie, linux-input,
mikko.mutanen, heikki.haikola
Patch series adding support for ROHM BD71837 PMIC.
BD71837 is a programmable Power Management IC for powering single-core,
dual-core, and quad-core SoCs such as NXP-i.MX 8M. It is optimized for
low BOM cost and compact solution footprint. It integrates 8 buck
regulators and 7 LDOs to provide all the power rails required by the
SoC and the commonly used peripherals.
This is reduced set of patches containing only the MFD and devicetree
bindings. This enables alrady applied regulator part and power button
support using gpio-keys. Clock and reset support will be sent as separate
set of patches.
Changelog v11
More fixes based on comments from Lee Jones
- styling issues/spelling errors.
- drop i2c_client struct from driver data.
- add chip revision validation.
Changelog v10
Fixes based on comments from Lee Jones
- Drop the platform data.
- Drop the regmap wrapper functions and use regmap directly.
- Rename files with rohm-prefix.
- Replace goto from probe by in-place returns.
- Drop unnecessary i2c_id table.
- Change gpio_keys_button array to simple struct.
- Fix return value checks for regmap functions.
- Various styling/spelling fixes.
- Replace foo-bar with something more meaningfull in DT example
Changelog v9
Fixes initiated by feedback from Enric Balletbo Serra, Lee and Dmitry.
- Simplified control flow for probe
- Removed accidentally left squash commit message
- Some comma presence toggling after last member in an array =)
- Styling of multi line comments.
Changelog v8
- Dropped clk-bd71837 from series (will send later)
- Dropped bd718xx-pwrkey driver and used gpio_keys instead.
- Added power-button short/long press duration configuratio to MFD
- Cleaned MFD driver according to comments from Enric Balletbo Serra.
(used devm, removed unnecessary header inclusions, removed redundant
assignment, styling issues, allow building MFD part as module, fixed
license mismatch).
Changelog v7
- patch 1: Cleaned MFD probe since MFD no longer directly reads DT
properties.
- patch 1/4: Moved power-key related definitions from powerkey patch (4)
to MFD patch (1) so that powerkey can be applied independently
- Patch 2 is unchanged.
- patch 3: Added missing allocation check back to clk probe
Changelog v6
- Added power-key input driver
Based on feedback from Rob Herring and Stephen Boyd
- Added link to datasheet
- Removed interrupt-controller from DT and fixed binding document
- clk styling fixes
- remove clkdev usage
- add clk bindings to MFD documentation
- removed clk binding document
Changelog v5
- dropped regulator patches which are already applied to Mark's tree
Based on feedback from Rob Herring and Stephen Boyd
- mfd bindings: explain why this can be interrupt-controller
- mfd bindings: describe interrupts better
- mfd bindings: require one cell interrupt specifier
- mfd bindings: use generic node names in example
- mfd driver: ack masked interrupt once at init
- clk bindings: use generic node names in example
- clk driver: use devm
- clk driver: use of_clk_add_hw_provider
- clk driver: change severity of print and how prints are emitted at
probe error path.
- clk driver: dropped forward declared functions
- clk configs: drop unnecessary dependencies
- clk driver: other styling issues
- mfd/clk DT: drop clk node.
Changelog v4
- remove mutex from regulator state check as core prevents simultaneous
accesses
- allow voltage change for bucks 1 to 4 when regulator is enabled
- fix indentiation problems
- properly correct SPDX comments
Changelog v3
- kill unused variable
- kill unused definitions
- use REGMAP_IRQ_REG
Changelog v2
Based on feedback from Mark Brown
- Squashed code and buildfile changes to same patch
- Fixed some styling issues
- Changed SPDX comments to CPP style
- Error out if voltage is changed when regulator is enabled instead of
Disabling the regulator for duration of change
- Use devm_regulator_register
- Remove compatible usage from regulators - use parent dev for config
- Add a note about using regulator-boot-on for BUCK6 and 7
- fixed warnings from kbuild test robot
patch 1:
MFD driver and definitions bringing interrupt support and
enabling clk, regulator and input subsystems.
patch 2:
MFD driver DT bindings
This patch series is based on for-mfd-next
---
Matti Vaittinen (2):
mfd: bd71837: mfd driver for ROHM BD71837 PMIC
mfd: bd71837: Devicetree bindings for ROHM BD71837 PMIC
.../devicetree/bindings/mfd/rohm,bd71837-pmic.txt | 62 ++++
drivers/mfd/Kconfig | 13 +
drivers/mfd/Makefile | 1 +
drivers/mfd/rohm-bd718x7.c | 208 +++++++++++++
include/linux/mfd/rohm-bd718x7.h | 332 +++++++++++++++++++++
5 files changed, 616 insertions(+)
create mode 100644 Documentation/devicetree/bindings/mfd/rohm,bd71837-pmic.txt
create mode 100644 drivers/mfd/rohm-bd718x7.c
create mode 100644 include/linux/mfd/rohm-bd718x7.h
--
2.14.3
^ permalink raw reply
* Re: [PATCH v10 1/2] mfd: bd71837: mfd driver for ROHM BD71837 PMIC
From: Matti Vaittinen @ 2018-07-30 6:52 UTC (permalink / raw)
To: Lee Jones
Cc: mturquette, robh+dt, sboyd, mark.rutland, lgirdwood, broonie,
mazziesaccount, arnd, dmitry.torokhov, sre, chenjh,
andrew.smirnov, linus.walleij, kstewart, heiko, gregkh, eballetbo,
linux-clk, devicetree, linux-kernel, linux-input, mikko.mutanen,
heikki.haikola
In-Reply-To: <20180712130013.GJ4641@dell>
Hello Lee & All others,
I'm physically back from my vacations so I can once again reach the
keyboard. So it's time to try address these issues =)
On Thu, Jul 12, 2018 at 02:00:13PM +0100, Lee Jones wrote:
> On Thu, 05 Jul 2018, Matti Vaittinen wrote:
>
> > + ret = regmap_read(bd71837->regmap, BD71837_REG_REV, &val);
> > + if (ret) {
> > + dev_err(&i2c->dev, "Read BD71837_REG_DEVICE failed\n");
> > + return ret;
> > + }
>
> You never do anything with the value here.
>
> Please either utilise it, read something useful or remove it.
Right. I'll add check that the chip revision is known and supported by
driver. Later I'll also use this value to distinguish between BD71837
and BD71847.
> > +struct bd71837_pmic;
> > +struct bd71837_clk;
> > +
> > +struct bd71837 {
> > + struct device *dev;
> > + struct i2c_client *i2c_client;
>
> Are these both being used?
>
> If you save one, you tend not to need the other.
>
That's what I would call experience. I indeed only use the dev pointer
in subdevices - and what's even more ugly is that I use
dev_get_drvdata(pdev->dev.parent) - in regulator while I use
i2c_set_clientdata(i2c, bd71837); in MFD. This works because
i2c_set_clientdata actually calls dev_set_drvdata - buit that's not
pretty.
I think it would be more appropriate to drop the i2c_client because
subdevices need not to know the chip is connected via i2c. I'll do that
and also replace the call to i2c_set_clientdata with direct use of
dev_set_drvdata. Thanks!
> > + struct regmap *regmap;
> > + unsigned long int id;
> > +
> > + int chip_irq;
> > + struct regmap_irq_chip_data *irq_data;
> > +
> > + struct bd71837_pmic *pmic;
> > + struct bd71837_clk *clk;
> > +};
> > +
> > +#endif /* __LINUX_MFD_BD71837_H__ */
>
> --
> Lee Jones [李琼斯]
> Linaro Services Technical Lead
> Linaro.org │ Open source software for ARM SoCs
> Follow Linaro: Facebook | Twitter | Blog
^ permalink raw reply
* Re: [PATCH] HID: intel_ish-hid: tx_buf memory leak on probe/remove
From: Srinivas Pandruvada @ 2018-07-30 1:36 UTC (permalink / raw)
To: Anton Vasilyev
Cc: Jiri Kosina, Benjamin Tissoires, Even Xu, linux-input,
linux-kernel, ldv-project
In-Reply-To: <20180724143455.13770-1-vasilyev@ispras.ru>
On Tue, 2018-07-24 at 17:34 +0300, Anton Vasilyev wrote:
> ish_dev_init() allocates 512*176 bytes memory for tx_buf and stores
> it at
> &dev->wr_free_list_head.link list on ish_probe().
> But there is no deallocation of this memory in ish_remove() and in
> ish_probe() error path.
> So current intel-ish-ipc provides 88 KB memory leak for each
> probe/release.
>
> The patch replaces kzalloc allocation by devm_kzalloc and removes
> ishtp_device *dev deallocation by kfree.
>
> Found by Linux Driver Verification project (linuxtesting.org).
>
I prefer align with "(" for the next line for multi line statements
even if character /line > slightly over 80. If you can do that resubmit
with my ACK below.
> Signed-off-by: Anton Vasilyev <vasilyev@ispras.ru>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
> ---
> drivers/hid/intel-ish-hid/ipc/ipc.c | 7 +++++--
> drivers/hid/intel-ish-hid/ipc/pci-ish.c | 2 --
> 2 files changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/hid/intel-ish-hid/ipc/ipc.c b/drivers/hid/intel-
> ish-hid/ipc/ipc.c
> index 9a60ec13cb10..2f8e5402b450 100644
> --- a/drivers/hid/intel-ish-hid/ipc/ipc.c
> +++ b/drivers/hid/intel-ish-hid/ipc/ipc.c
> @@ -907,7 +907,8 @@ struct ishtp_device *ish_dev_init(struct pci_dev
> *pdev)
> struct ishtp_device *dev;
> int i;
>
> - dev = kzalloc(sizeof(struct ishtp_device) + sizeof(struct
> ish_hw),
> + dev = devm_kzalloc(&pdev->dev,
> + sizeof(struct ishtp_device) + sizeof(struct ish_hw),
> GFP_KERNEL);
> if (!dev)
> return NULL;
> @@ -925,7 +926,9 @@ struct ishtp_device *ish_dev_init(struct pci_dev
> *pdev)
> for (i = 0; i < IPC_TX_FIFO_SIZE; ++i) {
> struct wr_msg_ctl_info *tx_buf;
>
> - tx_buf = kzalloc(sizeof(struct wr_msg_ctl_info),
> GFP_KERNEL);
> + tx_buf = devm_kzalloc(&pdev->dev,
> + sizeof(struct wr_msg_ctl_info),
> + GFP_KERNEL);
> if (!tx_buf) {
> /*
> * IPC buffers may be limited or not
> available
> diff --git a/drivers/hid/intel-ish-hid/ipc/pci-ish.c
> b/drivers/hid/intel-ish-hid/ipc/pci-ish.c
> index a2c53ea3b5ed..81d035a480bc 100644
> --- a/drivers/hid/intel-ish-hid/ipc/pci-ish.c
> +++ b/drivers/hid/intel-ish-hid/ipc/pci-ish.c
> @@ -172,7 +172,6 @@ static int ish_probe(struct pci_dev *pdev, const
> struct pci_device_id *ent)
> free_irq(pdev->irq, dev);
> free_device:
> pci_iounmap(pdev, hw->mem_addr);
> - kfree(dev);
> release_regions:
> pci_release_regions(pdev);
> disable_device:
> @@ -202,7 +201,6 @@ static void ish_remove(struct pci_dev *pdev)
> pci_release_regions(pdev);
> pci_clear_master(pdev);
> pci_disable_device(pdev);
> - kfree(ishtp_dev);
> }
>
> static struct device __maybe_unused *ish_resume_device;
^ permalink raw reply
* [PATCH 2/2] HID: redragon Add additional verification to rdesc modification quirk
From: John S Gruber @ 2018-07-28 19:53 UTC (permalink / raw)
To: Jiri Kosina, Robert Munteanu, linux-input, benjamin.tissoires,
dmitry.torokhov, linux-kernel, JohnSGruber
In-Reply-To: <1532807605-26023-1-git-send-email-JohnSGruber@gmail.com>
There are many devices using the vendor_id 0c45 and device_id of 760b
combination. Also the two bytes 0x81 0x00 aren't rare for a report
description. For these reasons the report description being altered
by the quirk should be verified more completely
If I'm understanding this correctly, I believe for an array field the
report_size should be greater or equal to
ceil(log2(usage_maximum - usage_minimum + 1)). That's 3 bits for these 8
shift keys, 0xe0-0xe7. Therefore the incorrect report description can't
be valid for any device.
Check the actual count of the rdesc and compare the entire field
description to reduce the chance of patching the wrong thing by
inadvertence.
Signed-off-by: John S Gruber <JohnSGruber@gmail.com>
---
drivers/hid/hid-redragon.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/drivers/hid/hid-redragon.c b/drivers/hid/hid-redragon.c
index 85a5fbb..6e506cb 100644
--- a/drivers/hid/hid-redragon.c
+++ b/drivers/hid/hid-redragon.c
@@ -18,6 +18,21 @@
#include "hid-ids.h"
+static __u8 asura_redragon_badfield[] = {
+ 0x05, 0x01, /* Usage Page (GenericDesktop) */
+ 0x09, 0x06, /* Usage (Keyboard) */
+ 0xa1, 0x01, /* Collection (Application) */
+ 0x85, 0x04, /* Report ID (4) */
+ 0x05, 0x07, /* Usage Page (Keyboard) */
+ 0x19, 0xe0, /* Usage Minimum (0xe0) Left Control */
+ 0x29, 0xe7, /* Usage Maximum (0xe7) Right GUI */
+ 0x15, 0x00, /* Logical Minimum (0) */
+ 0x25, 0x01, /* Logical Maximum (1) */
+ 0x75, 0x01, /* Report Size (1) */
+ 0x95, 0x08, /* Report Count(8) */
+ 0x81, 0x00 /* Input Array [Should be Input Var] */
+};
+
/*
* The Redragon Asura keyboard sends an incorrect HID descriptor.
@@ -36,7 +51,9 @@
static __u8 *redragon_report_fixup(struct hid_device *hdev, __u8 *rdesc,
unsigned int *rsize)
{
- if (*rsize >= 102 && rdesc[100] == 0x81 && rdesc[101] == 0x00) {
+ if (*rsize == 169 &&
+ memcmp(&rdesc[78], asura_redragon_badfield,
+ sizeof(asura_redragon_badfield)) == 0) {
dev_info(&hdev->dev, "Fixing Redragon ASURA report descriptor.\n");
rdesc[101] = 0x02;
}
--
1.9.1
^ permalink raw reply related
* [PATCH 1/2] HID: redragon: Fix regression in non-Redragon keyboard due to this new driver
From: John S Gruber @ 2018-07-28 19:53 UTC (permalink / raw)
To: Jiri Kosina, Robert Munteanu, linux-input, benjamin.tissoires,
dmitry.torokhov, linux-kernel, JohnSGruber
In-Reply-To: <1532807605-26023-1-git-send-email-JohnSGruber@gmail.com>
The Redragon keyboard uses the second device being presented, but other
devices with the same vendor_id/device_id pair (0x0c45:760b) use the first.
Don't cause its deletion. Problem introduced in commit 85455dd906d5
("HID: redragon: Fix modifier keys for Redragon Asura Keyboard")
Fixes: 85455dd906d5
Signed-off-by: John S Gruber <JohnSGruber@gmail.com>
---
drivers/hid/hid-redragon.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/drivers/hid/hid-redragon.c b/drivers/hid/hid-redragon.c
index daf5957..85a5fbb 100644
--- a/drivers/hid/hid-redragon.c
+++ b/drivers/hid/hid-redragon.c
@@ -55,10 +55,6 @@ static int redragon_probe(struct hid_device *dev,
return ret;
}
- /* do not register unused input device */
- if (dev->maxapplication == 1)
- return 0;
-
ret = hid_hw_start(dev, HID_CONNECT_DEFAULT);
if (ret) {
hid_err(dev, "hw start failed\n");
--
1.9.1
^ permalink raw reply related
* [PATCH 0/2] "HID: redragon: Fix modifier keys for Redragon Asura Keyboard" causes regression for Acer keyboard
From: John S Gruber @ 2018-07-28 19:53 UTC (permalink / raw)
To: Jiri Kosina, Robert Munteanu, linux-input, benjamin.tissoires,
dmitry.torokhov, linux-kernel, JohnSGruber
In-Reply-To: <CAPotdmQtXmfHJfcgrXZ02NrPgS3Az=SpZnBsRZ_8dGvPfdi+Mw@mail.gmail.com>
Please cc me in any replies.
The Acer branded keyboard that came with my Acer ATC-605-UB11 computer system
fails completely due to:
85455dd906d5 ("HID: redragon: Fix modifier keys for Redragon Asura Keyboard.")
That commit was merged to 4.18 on June 8.
The redragon vendor_id device_id combination 0c45:760b is shared by that
keyboard, as well as many others, it appears.
See https://linux-hardware.org/index.php?id=usb:0c45-760b
for other SONiX keyboards that don't appear to be Redragon devices.
First patch:
While the Redragon keyboard uses the second device created and not the first,
the Acer, and perhaps many others, use that first device
(the one with dev->maxapplication==1).
The hid-redragon.c driver should not cause this device to be ignored and
should not interfere with its being cleared up when disconnected.
It appears to me that this problematic change was made late in the
patch's revisions as a clean up.
I recently tried to connect another usb keyboard after the redragon driver
was activated by my Acer keyboard. It is blocked from working too
until the kernel is rebooted without my keyboard being plugged in. I
also understand that the interference with the first device stops
the keyboard LEDs from working correctly.
I'm resending this set as I haven't heard from the hid people in the two
weeks since I first sent this. Before 3.18 is released I believe either
this patch should be quickly finalized and applied, Robert's patch in the
linux-next tree should be applied instead, dc9b8e85ed9, or, as a last option,
the problematic commit should be reverted. I've tested all three
possibilities.
Second Patch:
As there are potentially many different devices being intercepted by the new
hid-redragon driver, and as the bytes x81 x00 are not rare in this context,
I also think it's advisable to improve the verification condition before
performing the report-description patch only meant for the Redragon Asura
Keyboard.
These two patches will follow. The first restores the function of my keyboard
sucessfully.
I don't have the Redragon Asura Keyboard necessary to test the second patch.
Its rdesc data come from Robert as posted to pastebin.
John S Gruber (2):
HID: redragon: Fix regression in non-Redragon keyboard due to this new
driver
HID: redragon Add additional verification to rdesc modification quirk
drivers/hid/hid-redragon.c | 23 ++++++++++++++++++-----
1 file changed, 18 insertions(+), 5 deletions(-)
--
1.9.1
^ permalink raw reply
* Re: [PATCH v2 1/2] Input: atmel_mxt_ts: Add support for optional regulators.
From: Paweł Chmiel @ 2018-07-28 13:16 UTC (permalink / raw)
To: Nick Dyer
Cc: mark.rutland, devicetree, alexandre.belloni, dmitry.torokhov,
linux-kernel, robh+dt, linux-input, linux-arm-kernel
In-Reply-To: <20180719205403.GA29273@hairyalien>
On Thursday, July 19, 2018 9:54:04 PM CEST Nick Dyer wrote:
> On Wed, Jul 18, 2018 at 06:21:30PM +0200, Paweł Chmiel wrote:
> > On Tuesday, July 17, 2018 10:00:05 PM CEST Nick Dyer wrote:
> > > On Tue, Jul 17, 2018 at 08:16:25PM +0200, Paweł Chmiel wrote:
> > > > This patch adds optional regulators, which can be used to power
> > > > up touchscreen. After enabling regulators, we need to wait 150msec.
> > > > This value is taken from official driver.
> > > >
> > > > It was tested on Samsung Galaxy i9000 (based on Samsung S5PV210 SOC).
> > > >
> > > > Signed-off-by: Paweł Chmiel <pawel.mikolaj.chmiel@gmail.com>
> > > > ---
> > > > Changes from v1:
> > > > - Enable regulators only if reset_gpio is present.
> > > > - Switch from devm_regulator_get_optional to devm_regulator_get
> > > > ---
> > > > drivers/input/touchscreen/atmel_mxt_ts.c | 46 ++++++++++++++++++++++++++++++--
> > > > 1 file changed, 44 insertions(+), 2 deletions(-)
> > >
> > > Hi Pawel-
> > >
> > > I see you've borrowed some of the logic from the patch I wrote a while
> > > back (see https://github.com/ndyer/linux/commit/8e9687e41ed062 )
> > Actually, i was looking at https://github.com/atmel-maxtouch/linux/blob/maxtouch-v3.14/drivers/input/touchscreen/atmel_mxt_ts.c (and didn't saw Your patch till now).
> > Are You going to submit it? (it has more functionalities - for example
> > suspend mode read from device tree).
>
> Getting that work upstream has stalled for a couple of years because I
> changed jobs. I have actually started recently to dust it off again, it
> was later on in my queue but if you have the time to work on it that is
> great.
>
> > > The correct behaviour according to Atmel should be:
> > >
> > > * Make RESET zero
> > > * Bring up regulators
> > > * Wait for a period to settle (150 msec)
> > > * Release RESET
> > > * Wait for 100 msec whilst device gets through bootloader
> > > * Wait for CHG line assert before reading info block
> > >
> > > I can't see the first and last steps in your patch at present.
> > About first step - reset_gpio is readed by using
> > devm_gpiod_get_optional with GPIOD_OUT_LOW flag, so i think (but might
> > be wrong) that we don't need to set this gpio value again to 0 before
> > enabling regulators,
>
> I see what you mean - that is fair enough.
>
> > since currently only place where reset_gpio is used is in driver probe
> > (in Your patch it is used in other cases/places - for example in
> > mxt_start/stop, when we enable regulators).
> > About missing wait after releasing reset, shouldn't this be separate
> > patch (since currently driver is not doing it)? I can prepare it and
> > send with other in next version.
>
> According to the maxtouch documentation, it isn't ready for comms until
> the firmware asserts the CHG line. I've seen a bunch of devices that get
> by without an explicit wait because the board file does the power on,
> and by the time the driver gets to probe it's a few hundred ms later
> anyway, so it doesn't matter. But if we put it all in the driver, it
> will attempt to read the info block straight after the 100 msec delay
> without waiting for CHG, and I suspect we'll end up with occasional
> probe failures. It'll depend on the maxtouch device, though: they have a
> range of different power on timings.
>
> Which platform are you doing this for? Is it a Chromebook?
No, it's Samsung Galaxy S (i9000) phone with S5PV210 Samsung Soc.
I'm preparing v3 version with separate patch adding this wait/delay.
>
> > Thanks for feedback
> > >
> > > The only downside with this approach is that there are a lot of
> > > delays during driver probe, but I believe the asynchronous probe stuff
> > > that's landed since I wrote the original patch should address that.
> > >
> > > cheers
> > >
> > > Nick
> > >
> > > > }
> > > > @@ -3116,6 +3154,10 @@ static int mxt_remove(struct i2c_client *client)
> > > > struct mxt_data *data = i2c_get_clientdata(client);
> > > >
> > > > disable_irq(data->irq);
> > > > + if (data->reset_gpio) {
> > > > + regulator_disable(data->avdd_reg);
> > > > + regulator_disable(data->vdd_reg);
> > > > + }
> > > > sysfs_remove_group(&client->dev.kobj, &mxt_attr_group);
> > > > mxt_free_input_device(data);
> > > > mxt_free_object_table(data);
> > >
> >
> >
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply
* Re: [PATCH v1 01/10] Input: atmel_mxt_ts - only use first T9 instance
From: Dmitry Torokhov @ 2018-07-27 18:54 UTC (permalink / raw)
To: Nick Dyer
Cc: linux-kernel, linux-input, Chris Healy, Nikita Yushchenko,
Lucas Stach, Nick Dyer
In-Reply-To: <20180720215122.23558-1-nick@shmanahar.org>
On Fri, Jul 20, 2018 at 10:51:13PM +0100, Nick Dyer wrote:
> From: Nick Dyer <nick.dyer@itdev.co.uk>
>
> The driver only registers one input device, which uses the screen
> parameters from the first T9 instance. The first T63 instance also uses
> those parameters.
>
> It is incorrect to send input reports from the second instances of these
> objects if they are enabled: the input scaling will be wrong and the
> positions will be mashed together.
>
> This also causes problems on Android if the number of slots exceeds 32.
>
> In the future, this could be handled by looking for enabled touch object
> instances and creating an input device for each one.
>
> Signed-off-by: Nick Dyer <nick.dyer@itdev.co.uk>
> Acked-by: Benson Leung <bleung@chromium.org>
> Acked-by: Yufeng Shen <miletus@chromium.org>
> ---
OK, I adjusted patch #7 to use kmemdup_nul() as we discussed, and
skipped #9, applied the rest.
Thanks!
> drivers/input/touchscreen/atmel_mxt_ts.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
> index 54fe190fd4bc..48c5ccab00a0 100644
> --- a/drivers/input/touchscreen/atmel_mxt_ts.c
> +++ b/drivers/input/touchscreen/atmel_mxt_ts.c
> @@ -1658,10 +1658,11 @@ static int mxt_parse_object_table(struct mxt_data *data,
> break;
> case MXT_TOUCH_MULTI_T9:
> data->multitouch = MXT_TOUCH_MULTI_T9;
> + /* Only handle messages from first T9 instance */
> data->T9_reportid_min = min_id;
> - data->T9_reportid_max = max_id;
> - data->num_touchids = object->num_report_ids
> - * mxt_obj_instances(object);
> + data->T9_reportid_max = min_id +
> + object->num_report_ids - 1;
> + data->num_touchids = object->num_report_ids;
> break;
> case MXT_SPT_MESSAGECOUNT_T44:
> data->T44_address = object->start_address;
> --
> 2.17.1
>
--
Dmitry
^ permalink raw reply
* Re: [PATCH] input: mouse: appletouch: Replace GFP_ATOMIC with GFP_KERNEL
From: Dmitry Torokhov @ 2018-07-27 18:36 UTC (permalink / raw)
To: Jia-Ju Bai; +Cc: gustavo, arvind.yadav.cs, linux-input, linux-kernel
In-Reply-To: <20180727022618.1007-1-baijiaju1990@gmail.com>
On Fri, Jul 27, 2018 at 10:26:18AM +0800, Jia-Ju Bai wrote:
> atp_open(), atp_recover() and atp_resume() are never
> called in atomic context.
> They call usb_submit_urb() with GFP_ATOMIC, which is not necessary.
> GFP_ATOMIC can be replaced with GFP_KERNEL.
>
> This is found by a static analysis tool named DCNS written by myself.
>
> Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Applied, thank you.
> ---
> drivers/input/mouse/appletouch.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c
> index 032d27983b6c..f593ec96c95f 100644
> --- a/drivers/input/mouse/appletouch.c
> +++ b/drivers/input/mouse/appletouch.c
> @@ -810,7 +810,7 @@ static int atp_open(struct input_dev *input)
> {
> struct atp *dev = input_get_drvdata(input);
>
> - if (usb_submit_urb(dev->urb, GFP_ATOMIC))
> + if (usb_submit_urb(dev->urb, GFP_KERNEL))
> return -EIO;
>
> dev->open = true;
> @@ -976,7 +976,7 @@ static int atp_recover(struct atp *dev)
> if (error)
> return error;
>
> - if (dev->open && usb_submit_urb(dev->urb, GFP_ATOMIC))
> + if (dev->open && usb_submit_urb(dev->urb, GFP_KERNEL))
> return -EIO;
>
> return 0;
> @@ -994,7 +994,7 @@ static int atp_resume(struct usb_interface *iface)
> {
> struct atp *dev = usb_get_intfdata(iface);
>
> - if (dev->open && usb_submit_urb(dev->urb, GFP_ATOMIC))
> + if (dev->open && usb_submit_urb(dev->urb, GFP_KERNEL))
> return -EIO;
>
> return 0;
> --
> 2.17.0
>
--
Dmitry
^ permalink raw reply
* Re: [PATCH] input: misc: yealink: Replace GFP_ATOMIC with GFP_KERNEL in usb_probe()
From: Dmitry Torokhov @ 2018-07-27 18:35 UTC (permalink / raw)
To: Jia-Ju Bai; +Cc: Henk.Vergonet, usbb2k-api-dev, linux-input, linux-kernel
In-Reply-To: <20180727022007.883-1-baijiaju1990@gmail.com>
On Fri, Jul 27, 2018 at 10:20:07AM +0800, Jia-Ju Bai wrote:
> usb_probe() is never called in atomic context.
> It calls usb_alloc_coherent() with GFP_ATOMIC, which is not necessary.
> GFP_ATOMIC can be replaced with GFP_KERNEL.
>
> This is found by a static analysis tool named DCNS written by myself.
>
> Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Applied, thank you.
> ---
> drivers/input/misc/yealink.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/input/misc/yealink.c b/drivers/input/misc/yealink.c
> index f0c9bf87b4e3..1365cd94ed9b 100644
> --- a/drivers/input/misc/yealink.c
> +++ b/drivers/input/misc/yealink.c
> @@ -894,12 +894,12 @@ static int usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
>
> /* allocate usb buffers */
> yld->irq_data = usb_alloc_coherent(udev, USB_PKT_LEN,
> - GFP_ATOMIC, &yld->irq_dma);
> + GFP_KERNEL, &yld->irq_dma);
> if (yld->irq_data == NULL)
> return usb_cleanup(yld, -ENOMEM);
>
> yld->ctl_data = usb_alloc_coherent(udev, USB_PKT_LEN,
> - GFP_ATOMIC, &yld->ctl_dma);
> + GFP_KERNEL, &yld->ctl_dma);
> if (!yld->ctl_data)
> return usb_cleanup(yld, -ENOMEM);
>
> --
> 2.17.0
>
--
Dmitry
^ permalink raw reply
* Re: [PATCH] input: tablet: aiptek: Replace GFP_ATOMIC with GFP_KERNEL in aiptek_probe()
From: Dmitry Torokhov @ 2018-07-27 18:35 UTC (permalink / raw)
To: Jia-Ju Bai; +Cc: linux-input, linux-kernel
In-Reply-To: <20180727022920.1233-1-baijiaju1990@gmail.com>
On Fri, Jul 27, 2018 at 10:29:20AM +0800, Jia-Ju Bai wrote:
> aiptek_probe() is never called in atomic context.
> It calls usb_alloc_coherent() with GFP_ATOMIC, which is not necessary.
> GFP_ATOMIC can be replaced with GFP_KERNEL.
>
> This is found by a static analysis tool named DCNS written by myself.
>
> Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Applied, thank you.
> ---
> drivers/input/tablet/aiptek.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/input/tablet/aiptek.c b/drivers/input/tablet/aiptek.c
> index 545fa6e89035..c82cd5079d0e 100644
> --- a/drivers/input/tablet/aiptek.c
> +++ b/drivers/input/tablet/aiptek.c
> @@ -1712,7 +1712,7 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id)
> }
>
> aiptek->data = usb_alloc_coherent(usbdev, AIPTEK_PACKET_LENGTH,
> - GFP_ATOMIC, &aiptek->data_dma);
> + GFP_KERNEL, &aiptek->data_dma);
> if (!aiptek->data) {
> dev_warn(&intf->dev, "cannot allocate usb buffer\n");
> goto fail1;
> --
> 2.17.0
>
--
Dmitry
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox