mfd: max96755f: Add patgen_mode debug node

Enable pattern:
echo 2 > /sys/bus/i2c/devices/x-0040/patgen_mode

Disable pattern:
echo 0 > /sys/bus/i2c/devices/x-0040/patgen_mode

Change-Id: I5bf970210b14f93599a36c78703e53252546da5b
Signed-off-by: Guochun Huang <hero.huang@rock-chips.com>
This commit is contained in:
Guochun Huang
2023-04-21 01:31:11 +00:00
committed by Tao Huang
parent 5ab24a2706
commit ae15a01230
2 changed files with 23 additions and 0 deletions

View File

@@ -195,8 +195,28 @@ static ssize_t line_fault_monitor_show(struct device *device,
static DEVICE_ATTR_RO(line_fault_monitor);
static ssize_t patgen_mode_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
struct max96755f *max96755f = dev_get_drvdata(dev);
u8 patgen_mode;
int ret;
ret = kstrtou8(buf, 0, &patgen_mode);
if (ret)
return ret;
regmap_update_bits(max96755f->regmap, 0x01e5, PATGEN_MODE,
FIELD_PREP(PATGEN_MODE, patgen_mode));
return count;
}
static DEVICE_ATTR_WO(patgen_mode);
static struct attribute *max96755f_attrs[] = {
&dev_attr_line_fault_monitor.attr,
&dev_attr_patgen_mode.attr,
NULL
};

View File

@@ -79,6 +79,9 @@
/* 0170h */
#define SPI_EN BIT(0)
/* 01e5h */
#define PATGEN_MODE GENMASK(1, 0)
/* 02beh */
#define RES_CFG BIT(7)
#define TX_PRIO BIT(6)