// SPDX-License-Identifier: GPL-2.0 /* * Support to GPOs on ROHM BD71815 * Copyright 2021 ROHM Semiconductors. * Author: Matti Vaittinen <[email protected]> * * Copyright 2014 Embest Technology Co. Ltd. Inc. * Author: [email protected] */ #include <linux/gpio/driver.h> #include <linux/init.h> #include <linux/irq.h> #include <linux/module.h> #include <linux/of.h> #include <linux/platform_device.h> /* For the BD71815 register definitions */ #include <linux/mfd/rohm-bd71815.h> struct bd71815_gpio { … }; static int bd71815gpo_get(struct gpio_chip *chip, unsigned int offset) { … } static void bd71815gpo_set(struct gpio_chip *chip, unsigned int offset, int value) { … } static int bd71815_gpio_set_config(struct gpio_chip *chip, unsigned int offset, unsigned long config) { … } /* BD71815 GPIO is actually GPO */ static int bd71815gpo_direction_get(struct gpio_chip *gc, unsigned int offset) { … } /* Template for GPIO chip */ static const struct gpio_chip bd71815gpo_chip = …; #define BD71815_TWO_GPIOS … #define BD71815_ONE_GPIO … /* * Sigh. The BD71815 and BD71817 were originally designed to support two GPO * pins. At some point it was noticed the second GPO pin which is the E5 pin * located at the center of IC is hard to use on PCB (due to the location). It * was decided to not promote this second GPO and the pin is marked as GND in * the datasheet. The functionality is still there though! I guess driving a GPO * connected to the ground is a bad idea. Thus we do not support it by default. * OTOH - the original driver written by colleagues at Embest did support * controlling this second GPO. It is thus possible this is used in some of the * products. * * This driver does not by default support configuring this second GPO * but allows using it by providing the DT property * "rohm,enable-hidden-gpo". */ static int bd71815_init_valid_mask(struct gpio_chip *gc, unsigned long *valid_mask, unsigned int ngpios) { … } static int gpo_bd71815_probe(struct platform_device *pdev) { … } static struct platform_driver gpo_bd71815_driver = …; module_platform_driver(…) …; MODULE_ALIAS(…) …; MODULE_AUTHOR(…) …; MODULE_AUTHOR(…) …; MODULE_DESCRIPTION(…) …; MODULE_LICENSE(…) …;