hid-mcp2221.c (e36c31f8cac54d6d900d270078d6b33de74e1b0a) | hid-mcp2221.c (ca6961d8a851f3720175f500be38fe9cee5a2c13) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * MCP2221A - Microchip USB to I2C Host Protocol Bridge 4 * 5 * Copyright (c) 2020, Rishi Gupta <gupt21@gmail.com> 6 * 7 * Datasheet: https://ww1.microchip.com/downloads/en/DeviceDoc/20005565B.pdf 8 */ --- 580 unchanged lines hidden (view full) --- 589static int mcp_gpio_get(struct gpio_chip *gc, 590 unsigned int offset) 591{ 592 int ret; 593 struct mcp2221 *mcp = gpiochip_get_data(gc); 594 595 mcp->txbuf[0] = MCP2221_GPIO_GET; 596 | 1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * MCP2221A - Microchip USB to I2C Host Protocol Bridge 4 * 5 * Copyright (c) 2020, Rishi Gupta <gupt21@gmail.com> 6 * 7 * Datasheet: https://ww1.microchip.com/downloads/en/DeviceDoc/20005565B.pdf 8 */ --- 580 unchanged lines hidden (view full) --- 589static int mcp_gpio_get(struct gpio_chip *gc, 590 unsigned int offset) 591{ 592 int ret; 593 struct mcp2221 *mcp = gpiochip_get_data(gc); 594 595 mcp->txbuf[0] = MCP2221_GPIO_GET; 596 |
597 mcp->gp_idx = offsetof(struct mcp_get_gpio, gpio[offset].value); | 597 mcp->gp_idx = offsetof(struct mcp_get_gpio, gpio[offset]); |
598 599 mutex_lock(&mcp->lock); 600 ret = mcp_send_data_req_status(mcp, mcp->txbuf, 1); 601 mutex_unlock(&mcp->lock); 602 603 return ret; 604} 605 --- 64 unchanged lines hidden (view full) --- 670static int mcp_gpio_get_direction(struct gpio_chip *gc, 671 unsigned int offset) 672{ 673 int ret; 674 struct mcp2221 *mcp = gpiochip_get_data(gc); 675 676 mcp->txbuf[0] = MCP2221_GPIO_GET; 677 | 598 599 mutex_lock(&mcp->lock); 600 ret = mcp_send_data_req_status(mcp, mcp->txbuf, 1); 601 mutex_unlock(&mcp->lock); 602 603 return ret; 604} 605 --- 64 unchanged lines hidden (view full) --- 670static int mcp_gpio_get_direction(struct gpio_chip *gc, 671 unsigned int offset) 672{ 673 int ret; 674 struct mcp2221 *mcp = gpiochip_get_data(gc); 675 676 mcp->txbuf[0] = MCP2221_GPIO_GET; 677 |
678 mcp->gp_idx = offsetof(struct mcp_get_gpio, gpio[offset].direction); | 678 mcp->gp_idx = offsetof(struct mcp_get_gpio, gpio[offset]); |
679 680 mutex_lock(&mcp->lock); 681 ret = mcp_send_data_req_status(mcp, mcp->txbuf, 1); 682 mutex_unlock(&mcp->lock); 683 684 if (ret) 685 return ret; 686 --- 530 unchanged lines hidden --- | 679 680 mutex_lock(&mcp->lock); 681 ret = mcp_send_data_req_status(mcp, mcp->txbuf, 1); 682 mutex_unlock(&mcp->lock); 683 684 if (ret) 685 return ret; 686 --- 530 unchanged lines hidden --- |