Lines Matching +full:com +full:- +full:seq
1 // SPDX-License-Identifier: GPL-2.0
3 * Power-source driver for Bay Trail Crystal Cove PMIC
5 * Copyright (c) 2023 Hans de Goede <hdegoede@redhat.com>
63 static void crc_pwrsrc_log(struct seq_file *seq, const char *prefix, in crc_pwrsrc_log() argument
70 seq_printf(seq, "%s by %s\n", prefix, info[i]); in crc_pwrsrc_log()
74 static int pwrsrc_show(struct seq_file *seq, void *unused) in pwrsrc_show() argument
76 struct crc_pwrsrc_data *data = seq->private; in pwrsrc_show()
80 ret = regmap_read(data->regmap, CRYSTALCOVE_SPWRSRC_REG, ®_val); in pwrsrc_show()
84 crc_pwrsrc_log(seq, "System powered", pwrsrc_pwrsrc_info, reg_val); in pwrsrc_show()
88 static int resetsrc_show(struct seq_file *seq, void *unused) in resetsrc_show() argument
90 struct crc_pwrsrc_data *data = seq->private; in resetsrc_show()
92 crc_pwrsrc_log(seq, "Last shutdown caused", pwrsrc_resetsrc0_info, data->resetsrc0); in resetsrc_show()
93 crc_pwrsrc_log(seq, "Last shutdown caused", pwrsrc_resetsrc1_info, data->resetsrc1); in resetsrc_show()
97 static int wakesrc_show(struct seq_file *seq, void *unused) in wakesrc_show() argument
99 struct crc_pwrsrc_data *data = seq->private; in wakesrc_show()
101 crc_pwrsrc_log(seq, "Last wake caused", pwrsrc_wakesrc_info, data->wakesrc); in wakesrc_show()
114 ret = regmap_read(data->regmap, reg, val); in crc_pwrsrc_read_and_clear()
118 return regmap_write(data->regmap, reg, *val); in crc_pwrsrc_read_and_clear()
123 struct intel_soc_pmic *pmic = dev_get_drvdata(pdev->dev.parent); in crc_pwrsrc_probe()
127 data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); in crc_pwrsrc_probe()
129 return -ENOMEM; in crc_pwrsrc_probe()
131 data->regmap = pmic->regmap; in crc_pwrsrc_probe()
140 ret = crc_pwrsrc_read_and_clear(data, CRYSTALCOVE_RESETSRC0_REG, &data->resetsrc0); in crc_pwrsrc_probe()
144 ret = crc_pwrsrc_read_and_clear(data, CRYSTALCOVE_RESETSRC1_REG, &data->resetsrc1); in crc_pwrsrc_probe()
148 ret = crc_pwrsrc_read_and_clear(data, CRYSTALCOVE_WAKESRC_REG, &data->wakesrc); in crc_pwrsrc_probe()
152 data->debug_dentry = debugfs_create_dir(KBUILD_MODNAME, NULL); in crc_pwrsrc_probe()
153 debugfs_create_file("pwrsrc", 0444, data->debug_dentry, data, &pwrsrc_fops); in crc_pwrsrc_probe()
154 debugfs_create_file("resetsrc", 0444, data->debug_dentry, data, &resetsrc_fops); in crc_pwrsrc_probe()
155 debugfs_create_file("wakesrc", 0444, data->debug_dentry, data, &wakesrc_fops); in crc_pwrsrc_probe()
165 debugfs_remove_recursive(data->debug_dentry); in crc_pwrsrc_remove()
178 MODULE_AUTHOR("Hans de Goede <hdegoede@redhat.com>");
179 MODULE_DESCRIPTION("Power-source driver for Bay Trail Crystal Cove PMIC");