Skip to content

Commit 4e21264

Browse files
cometzeroLinus Walleij
authored andcommitted
pinctrl: samsung: add pin_dbg_show callback for debugfs
This patch adds a samsung_pin_dbg_show function to implement the pin_dbg_show callback function which can be used to show pin confuration values. Basically, it can show pin setting values by accessing the "pins" node like below: $ cat pins pin 0 (gpy7-0) CON(0x0) DAT(0x1) PUD(0x1) DRV(0x0) CON_PDN(0x0) PUD_PDN(0x0) Signed-off-by: Chanho Park <parkch98@gmail.com> Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org> Tested-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
1 parent 60cc43f commit 4e21264

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

‎drivers/pinctrl/samsung/pinctrl-samsung.c‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,13 +279,42 @@ static int samsung_dt_node_to_map(struct pinctrl_dev *pctldev,
279279
return 0;
280280
}
281281

282+
#ifdef CONFIG_DEBUG_FS
283+
/* Forward declaration which can be used by samsung_pin_dbg_show */
284+
static int samsung_pinconf_get(struct pinctrl_dev *pctldev, unsigned int pin,
285+
unsigned long *config);
286+
static const char * const reg_names[] = {"CON", "DAT", "PUD", "DRV", "CON_PDN",
287+
"PUD_PDN"};
288+
289+
static void samsung_pin_dbg_show(struct pinctrl_dev *pctldev,
290+
struct seq_file *s, unsigned int pin)
291+
{
292+
enum pincfg_type cfg_type;
293+
unsigned long config;
294+
int ret;
295+
296+
for (cfg_type = 0; cfg_type < PINCFG_TYPE_NUM; cfg_type++) {
297+
config = PINCFG_PACK(cfg_type, 0);
298+
ret = samsung_pinconf_get(pctldev, pin, &config);
299+
if (ret < 0)
300+
continue;
301+
302+
seq_printf(s, " %s(0x%lx)", reg_names[cfg_type],
303+
PINCFG_UNPACK_VALUE(config));
304+
}
305+
}
306+
#endif
307+
282308
/* list of pinctrl callbacks for the pinctrl core */
283309
static const struct pinctrl_ops samsung_pctrl_ops = {
284310
.get_groups_count = samsung_get_group_count,
285311
.get_group_name = samsung_get_group_name,
286312
.get_group_pins = samsung_get_group_pins,
287313
.dt_node_to_map = samsung_dt_node_to_map,
288314
.dt_free_map = samsung_dt_free_map,
315+
#ifdef CONFIG_DEBUG_FS
316+
.pin_dbg_show = samsung_pin_dbg_show,
317+
#endif
289318
};
290319

291320
/* check if the selector is a valid pin function selector */

0 commit comments

Comments
 (0)