[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4aeda6f1-25d8-9437-5cd0-560e43dbe081@gmail.com>
Date: Wed, 25 Mar 2020 22:35:22 +0300
From: Dmitry Osipenko <digetx@...il.com>
To: Jiada Wang <jiada_wang@...tor.com>, nick@...anahar.org,
dmitry.torokhov@...il.com, jikos@...nel.org,
benjamin.tissoires@...hat.com, bsz@...ihalf.com,
rydberg@...math.org
Cc: linux-input@...r.kernel.org, linux-kernel@...r.kernel.org,
erosca@...adit-jv.com, Andrew_Gabbasov@...tor.com
Subject: Re: [PATCH v9 52/55] input: touchscreen: atmel_mxt_ts: Added sysfs
entry for touchscreen status
25.03.2020 16:33, Jiada Wang пишет:
> From: Naveen Chakka <Naveen.Chakka@...bosch.com>
>
> To know the current communication status of the touch controller during
> runtime, sysfs interface is added
>
> sysfs interface: /sys/class/i2c-dev/i2c-*/device/*/touch_dev_stat
> Executing the above sysfs interface provides two output values
>
> 1)Status of the touch device
> value 0 represents device is inactive
> value 1 represents device is active
> 2)Error counter
> value represents the number of times device in inactive since last read
...
> /* Each client has this additional data */
> struct mxt_data {
> struct i2c_client *client;
> @@ -372,6 +380,9 @@ struct mxt_data {
> const char *pcfg_name;
> const char *input_name;
> struct mxt_flash *flash;
> + struct work_struct watchdog_work;
> + struct timer_list watchdog_timer;
This should be replaced with a delayed_work.
> + struct mxt_statusinfo mxt_status;
>
> /* Cached parameters from object table */
> u16 T5_address;
...
> +static void mxt_watchdog_work(struct work_struct *work)
> +{
> + struct mxt_data *data =
> + container_of(work, struct mxt_data, watchdog_work);
> + u16 info_buf;
> + int ret = 0;
> + u8 size = 2;
> + if (data->suspended || data->in_bootloader)
> + return;
> +
> + ret = __mxt_read_reg(data->client, 0, size, &info_buf);
Looks like this need to be protected with a lock to not race with the
suspending / bootloader states.
> + if (ret) {
> + data->mxt_status.error_count++;
> + data->mxt_status.dev_status = false;
> + } else {
> + data->mxt_status.dev_status = true;
> + }
> +}
...> @@ -4329,6 +4414,13 @@ static int mxt_probe(struct i2c_client
*client, const struct i2c_device_id *id)
> msleep(MXT_RESET_TIME);
> }
>
> + INIT_WORK(&data->watchdog_work, mxt_watchdog_work);
> +
> + /* setup watchdog timer */
> + timer_setup(&data->watchdog_timer, mxt_watchdog_timer, 0);
> +
> + mxt_start_wd_timer(data);
I'd expect it to be optional and opt-in by either using #ifdef
TOUCHSCREEN_ATMEL_MXT_DEBUG or having a new debugfs option to explicitly
enable the "watchdog".
Powered by blists - more mailing lists