lkml.org 
[lkml]   [2020]   [Mar]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v9 52/55] input: touchscreen: atmel_mxt_ts: Added sysfs entry for touchscreen status
From
Date
Hi Dmitry

On 2020/03/26 4:35, Dmitry Osipenko wrote:
> 25.03.2020 16:33, Jiada Wang пишет:
>> From: Naveen Chakka <Naveen.Chakka@in.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.

will replace with delayer_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.
>
right, I will add lock in next version

>> + 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".
>
Thanks for your suggestion, I will use module_param to enable/disable
watchdog

Thanks,
Jiada

\
 
 \ /
  Last update: 2020-03-27 13:50    [W:0.108 / U:18.736 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site