pinctrl-cy8c95x0.c (f12352f334c28a85e738f9caa31a0c5b07febd20) pinctrl-cy8c95x0.c (8586466e4f11a5879a7c0df5d25da6c6a7d7c672)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * CY8C95X0 20/40/60 pin I2C GPIO port expander with interrupt support
4 *
5 * Copyright (C) 2022 9elements GmbH
6 * Author: Patrick Rudolph <patrick.rudolph@9elements.com>
7 * Author: Naresh Solanki <Naresh.Solanki@9elements.com>
8 */
9
10#include <linux/bitmap.h>
11#include <linux/gpio/driver.h>
12#include <linux/gpio/consumer.h>
13#include <linux/i2c.h>
14#include <linux/init.h>
15#include <linux/interrupt.h>
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * CY8C95X0 20/40/60 pin I2C GPIO port expander with interrupt support
4 *
5 * Copyright (C) 2022 9elements GmbH
6 * Author: Patrick Rudolph <patrick.rudolph@9elements.com>
7 * Author: Naresh Solanki <Naresh.Solanki@9elements.com>
8 */
9
10#include <linux/bitmap.h>
11#include <linux/gpio/driver.h>
12#include <linux/gpio/consumer.h>
13#include <linux/i2c.h>
14#include <linux/init.h>
15#include <linux/interrupt.h>
16#include <linux/mod_devicetable.h>
16#include <linux/module.h>
17#include <linux/module.h>
17#include <linux/of.h>
18#include <linux/of_platform.h>
18#include <linux/property.h>
19#include <linux/regmap.h>
20#include <linux/regulator/consumer.h>
21
19#include <linux/pinctrl/pinctrl.h>
20#include <linux/pinctrl/pinconf.h>
21#include <linux/pinctrl/pinconf-generic.h>
22#include <linux/pinctrl/pinmux.h>
22#include <linux/pinctrl/pinctrl.h>
23#include <linux/pinctrl/pinconf.h>
24#include <linux/pinctrl/pinconf-generic.h>
25#include <linux/pinctrl/pinmux.h>
23#include <linux/regmap.h>
24#include <linux/regulator/consumer.h>
25
26/* Fast access registers */
27#define CY8C95X0_INPUT 0x00
28#define CY8C95X0_OUTPUT 0x08
29#define CY8C95X0_INTSTATUS 0x10
30
31#define CY8C95X0_INPUT_(x) (CY8C95X0_INPUT + (x))
32#define CY8C95X0_OUTPUT_(x) (CY8C95X0_OUTPUT + (x))

--- 1013 unchanged lines hidden (view full) ---

1046
1047 seq_printf(s, "MODE:%s", cy8c95x0_get_fname(test_bit(pin, pwm)));
1048}
1049
1050static const struct pinctrl_ops cy8c95x0_pinctrl_ops = {
1051 .get_groups_count = cy8c95x0_pinctrl_get_groups_count,
1052 .get_group_name = cy8c95x0_pinctrl_get_group_name,
1053 .get_group_pins = cy8c95x0_pinctrl_get_group_pins,
26
27/* Fast access registers */
28#define CY8C95X0_INPUT 0x00
29#define CY8C95X0_OUTPUT 0x08
30#define CY8C95X0_INTSTATUS 0x10
31
32#define CY8C95X0_INPUT_(x) (CY8C95X0_INPUT + (x))
33#define CY8C95X0_OUTPUT_(x) (CY8C95X0_OUTPUT + (x))

--- 1013 unchanged lines hidden (view full) ---

1047
1048 seq_printf(s, "MODE:%s", cy8c95x0_get_fname(test_bit(pin, pwm)));
1049}
1050
1051static const struct pinctrl_ops cy8c95x0_pinctrl_ops = {
1052 .get_groups_count = cy8c95x0_pinctrl_get_groups_count,
1053 .get_group_name = cy8c95x0_pinctrl_get_group_name,
1054 .get_group_pins = cy8c95x0_pinctrl_get_group_pins,
1055#ifdef CONFIG_OF
1054 .dt_node_to_map = pinconf_generic_dt_node_to_map_pin,
1055 .dt_free_map = pinconf_generic_dt_free_map,
1056 .dt_node_to_map = pinconf_generic_dt_node_to_map_pin,
1057 .dt_free_map = pinconf_generic_dt_free_map,
1058#endif
1056 .pin_dbg_show = cy8c95x0_pin_dbg_show,
1057};
1058
1059static const char *cy8c95x0_get_functions_name(struct pinctrl_dev *pctldev, unsigned int selector)
1060{
1061 return cy8c95x0_get_fname(selector);
1062}
1063

--- 187 unchanged lines hidden (view full) ---

1251
1252 chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL);
1253 if (!chip)
1254 return -ENOMEM;
1255
1256 chip->dev = &client->dev;
1257
1258 /* Set the device type */
1059 .pin_dbg_show = cy8c95x0_pin_dbg_show,
1060};
1061
1062static const char *cy8c95x0_get_functions_name(struct pinctrl_dev *pctldev, unsigned int selector)
1063{
1064 return cy8c95x0_get_fname(selector);
1065}
1066

--- 187 unchanged lines hidden (view full) ---

1254
1255 chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL);
1256 if (!chip)
1257 return -ENOMEM;
1258
1259 chip->dev = &client->dev;
1260
1261 /* Set the device type */
1259 if (client->dev.of_node)
1260 chip->driver_data = (unsigned long)of_device_get_match_data(&client->dev);
1261 else
1262 chip->driver_data = (unsigned long)device_get_match_data(&client->dev);
1263 if (!chip->driver_data)
1262 chip->driver_data = i2c_match_id(cy8c95x0_id, client)->driver_data;
1263
1264 if (!chip->driver_data)
1265 return -ENODEV;
1266
1267 i2c_set_clientdata(client, chip);
1268
1269 chip->tpin = chip->driver_data & CY8C95X0_GPIO_MASK;

--- 87 unchanged lines hidden ---
1264 chip->driver_data = i2c_match_id(cy8c95x0_id, client)->driver_data;
1265
1266 if (!chip->driver_data)
1267 return -ENODEV;
1268
1269 i2c_set_clientdata(client, chip);
1270
1271 chip->tpin = chip->driver_data & CY8C95X0_GPIO_MASK;

--- 87 unchanged lines hidden ---