This patch adds support for output-disable requests from GPT, when dead time error occurs. Added sysfs to enable/disable for configuring GPT output disable request for dead time error. Signed-off-by: Biju Das <biju.das.jz@xxxxxxxxxxxxxx> --- .../ABI/testing/sysfs-platform-rzg2l-poeg | 23 ++++++++++++ drivers/pinctrl/renesas/poeg/rzg2l-poeg.c | 37 +++++++++++++++++++ 2 files changed, 60 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-platform-rzg2l-poeg b/Documentation/ABI/testing/sysfs-platform-rzg2l-poeg index 45a7f44dccdd..4ad421fef3b9 100644 --- a/Documentation/ABI/testing/sysfs-platform-rzg2l-poeg +++ b/Documentation/ABI/testing/sysfs-platform-rzg2l-poeg @@ -62,3 +62,26 @@ Description: output level low is enabled. - "0" - Output-disable request from gpt when same time output level low is disabled. + +What: /sys/devices/platform/<rzg2l-poeg's name>/gpt_req_deadtime_err +Date: November 2022 +KernelVersion: 6.3 +Contact: Biju Das <biju.das.jz@xxxxxxxxxxxxxx> +Description: + This file can be read and write. + The file used to configure the output disable request from + gpt when dead time error occurred. + + Write the following string to control the output disable: + + - "1" - Enables output-disable request from gpt when dead time + error occurs. + - "0" - Disables output-disable request from gpt when dead time + error occurs. + + Read the file, then it shows the following strings: + + - "1" - Output-disable request from gpt when dead time + error occurs is enabled. + - "0" - Output-disable request from gpt when dead time + error occurs is disabled. diff --git a/drivers/pinctrl/renesas/poeg/rzg2l-poeg.c b/drivers/pinctrl/renesas/poeg/rzg2l-poeg.c index 58a2cc9519e5..c712d26c4282 100644 --- a/drivers/pinctrl/renesas/poeg/rzg2l-poeg.c +++ b/drivers/pinctrl/renesas/poeg/rzg2l-poeg.c @@ -155,14 +155,51 @@ static ssize_t gpt_req_both_low_show(struct device *dev, return sysfs_emit(buf, "%u\n", test_bit(RZG2L_GPT_OABLF, chip->gpt_irq)); } +static ssize_t gpt_req_deadtime_err_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + struct rzg2l_poeg_chip *chip; + unsigned int val; + int ret; + + chip = dev_get_drvdata(dev); + ret = kstrtouint(buf, 0, &val); + if (ret) + return ret; + + if (val) + set_bit(RZG2L_GPT_DTEF, chip->gpt_irq); + else + clear_bit(RZG2L_GPT_DTEF, chip->gpt_irq); + + rzg2l_gpt_poeg_disable_req_deadtime_error(chip->gpt_dev, chip->index, + test_bit(RZG2L_GPT_DTEF, chip->gpt_irq)); + + return count; +} + +static ssize_t gpt_req_deadtime_err_show(struct device *dev, + struct device_attribute *attr, + char *buf) +{ + struct rzg2l_poeg_chip *chip; + + chip = dev_get_drvdata(dev); + + return sysfs_emit(buf, "%u\n", test_bit(RZG2L_GPT_DTEF, chip->gpt_irq)); +} + static DEVICE_ATTR_RW(output_disable); static DEVICE_ATTR_RW(gpt_req_both_high); static DEVICE_ATTR_RW(gpt_req_both_low); +static DEVICE_ATTR_RW(gpt_req_deadtime_err); static struct attribute *poeg_attrs[] = { &dev_attr_output_disable.attr, &dev_attr_gpt_req_both_high.attr, &dev_attr_gpt_req_both_low.attr, + &dev_attr_gpt_req_deadtime_err.attr, NULL, }; -- 2.25.1