pinctrl-intel.c (13791bb6bf4318fbd8b901a4506fa9bb0d2083df) pinctrl-intel.c (e075cbfeb41ef1ce8b1bae7838ac985297ab367e)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Intel pinctrl/GPIO core driver.
4 *
5 * Copyright (C) 2015, Intel Corporation
6 * Authors: Mathias Nyman <mathias.nyman@linux.intel.com>
7 * Mika Westerberg <mika.westerberg@linux.intel.com>
8 */

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

109struct intel_community_context {
110 u32 *intmask;
111 u32 *hostown;
112};
113
114#define pin_to_padno(c, p) ((p) - (c)->pin_base)
115#define padgroup_offset(g, p) ((p) - (g)->base)
116
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Intel pinctrl/GPIO core driver.
4 *
5 * Copyright (C) 2015, Intel Corporation
6 * Authors: Mathias Nyman <mathias.nyman@linux.intel.com>
7 * Mika Westerberg <mika.westerberg@linux.intel.com>
8 */

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

109struct intel_community_context {
110 u32 *intmask;
111 u32 *hostown;
112};
113
114#define pin_to_padno(c, p) ((p) - (c)->pin_base)
115#define padgroup_offset(g, p) ((p) - (g)->base)
116
117struct intel_community *intel_get_community(struct intel_pinctrl *pctrl, unsigned int pin)
117const struct intel_community *intel_get_community(struct intel_pinctrl *pctrl, unsigned int pin)
118{
118{
119 struct intel_community *community;
119 const struct intel_community *community;
120 int i;
121
122 for (i = 0; i < pctrl->ncommunities; i++) {
123 community = &pctrl->communities[i];
124 if (pin >= community->pin_base &&
125 pin < community->pin_base + community->npins)
126 return community;
127 }

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

231 PAD_UNLOCKED = 0,
232 PAD_LOCKED = 1,
233 PAD_LOCKED_TX = 2,
234 PAD_LOCKED_FULL = PAD_LOCKED | PAD_LOCKED_TX,
235};
236
237static int intel_pad_locked(struct intel_pinctrl *pctrl, unsigned int pin)
238{
120 int i;
121
122 for (i = 0; i < pctrl->ncommunities; i++) {
123 community = &pctrl->communities[i];
124 if (pin >= community->pin_base &&
125 pin < community->pin_base + community->npins)
126 return community;
127 }

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

231 PAD_UNLOCKED = 0,
232 PAD_LOCKED = 1,
233 PAD_LOCKED_TX = 2,
234 PAD_LOCKED_FULL = PAD_LOCKED | PAD_LOCKED_TX,
235};
236
237static int intel_pad_locked(struct intel_pinctrl *pctrl, unsigned int pin)
238{
239 struct intel_community *community;
239 const struct intel_community *community;
240 const struct intel_padgroup *padgrp;
241 unsigned int offset, gpp_offset;
242 u32 value;
243 int ret = PAD_UNLOCKED;
244
245 community = intel_get_community(pctrl, pin);
246 if (!community)
247 return PAD_LOCKED_FULL;

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

1363}
1364
1365static int intel_gpio_add_pin_ranges(struct gpio_chip *gc)
1366{
1367 struct intel_pinctrl *pctrl = gpiochip_get_data(gc);
1368 int ret, i;
1369
1370 for (i = 0; i < pctrl->ncommunities; i++) {
240 const struct intel_padgroup *padgrp;
241 unsigned int offset, gpp_offset;
242 u32 value;
243 int ret = PAD_UNLOCKED;
244
245 community = intel_get_community(pctrl, pin);
246 if (!community)
247 return PAD_LOCKED_FULL;

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

1363}
1364
1365static int intel_gpio_add_pin_ranges(struct gpio_chip *gc)
1366{
1367 struct intel_pinctrl *pctrl = gpiochip_get_data(gc);
1368 int ret, i;
1369
1370 for (i = 0; i < pctrl->ncommunities; i++) {
1371 struct intel_community *community = &pctrl->communities[i];
1371 const struct intel_community *community = &pctrl->communities[i];
1372
1373 ret = intel_gpio_add_community_ranges(pctrl, community);
1374 if (ret) {
1375 dev_err(pctrl->dev, "failed to add GPIO pin range\n");
1376 return ret;
1377 }
1378 }
1379

--- 595 unchanged lines hidden ---
1372
1373 ret = intel_gpio_add_community_ranges(pctrl, community);
1374 if (ret) {
1375 dev_err(pctrl->dev, "failed to add GPIO pin range\n");
1376 return ret;
1377 }
1378 }
1379

--- 595 unchanged lines hidden ---