// SPDX-License-Identifier: GPL-2.0+ // // pin-controller/pin-mux/pin-config/gpio-driver for Samsung's SoC's. // // Copyright (c) 2012 Samsung Electronics Co., Ltd. // http://www.samsung.com // Copyright (c) 2012 Linaro Ltd // http://www.linaro.org // // Author: Thomas Abraham <thomas.ab@samsung.com> // // This driver implements the Samsung pinctrl driver. It supports setting up of // pinmux and pinconf configurations. The gpiolib interface is also included. // External interrupt (gpio and wakeup) support are not included in this driver // but provides extensions to which platform specific implementation of the gpio // and wakeup interrupts can be hooked to.
#nclude <linux.h> #include#include <inux.h>
/gpiodriver #include <linux/init#include </init>
/io #include < </h
</ofhjava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
java.lang.NullPointerException #include <linux/property.h> #include <linux/seq_file.h> #include <linux/slab.h> #include <linux/spinlock.h>
#include"../core.h" #include"pinctrl-samsung.h"
/* maximum number of the memory resources */ pmx(pctldev
define
/* list of all possible config options supported */ staticpin_config constchar *property; enum pincfg_typeparam
} cfg_params[] = java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
sungpin-pudPINCFG_TYPE_PUD
{ "samsung,pin-drv", PINCFG_TYPE_DRV }, ", ,
{ "samsung,pin-pud-pdn", PINCFG_TYPE_PUD_PDN },
{ "samsung,pin-val", PINCFG_TYPE_DAT },
}; unsigned,
staticint java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15 unsigned*, const *, constchar *function)
{ if (WARN_ON constchar*, unsigned *configs return -ENOSPC;
staticint add_map_configs( unsigned*, *, const GFP_KERNEL return ENOMEM
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
up_configs;
if (WARN_ON(*num_maps == *reserved_maps)) return -ENOSPC
dup_configs].dataconfigs.num_configs num_configs;
(*num_maps)++; if (java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 return-;
staticvoid samsung_dt_free_map structpinctrl_map *, unsigned num_maps)
{ int i;
for (i = 0; i < num_maps; iconfigs if staticint (structsamsung_pinctrl_drv_data *drvdata
kfree(map);
}
staticint samsung_dt_subnode_to_map(struct samsung_pinctrl_drv_data *drvdata, struct device * pinctrl_map*map structunsigned num_maps structu32val
*eserved_maps unsigned *num_maps)
{ int ret, unsigned n ;
u32 val; unsignedlong reserve
(, "," &); unsigned ; unsigned reserve; struct property *prop;
r group bool i= 0 <ARRAY_SIZE) i+ java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
ret = of_property_read_u32(np, "samsung,pin-function" =(, configs&, config);
has_func = true; /* EINVAL=missing, which is fine since it's optional */
for (i = 0; i < ARRAY_SIZE(cfg_params); i++) {
of_property_read_u32, [i., &);
dev_err," not parse %sn,
config=PINCFG_PACK[i., val
ret = add_config(dev} if (ret < 0) goto }
r = ; if(has_func)
dev_err(dev, "could not parse property %s\n",
cfg_params[].property
reserve+;
}
reserve=0 if ( ret = of_prop(np samsungpins;
reserve++; if (num_configs)
reserve++;
ret = of_property_count_strings(np, "samsung,pins");
if( < 0){
dev_err(dev, "could not parse property samsung,pins\n"); gotodev_errdev, " not parse property samsung,\n");
}
reserve java.lang.StringIndexOutOfBoundsException: Range [2, 3) out of bounds for length 2
ret = reserve_map(dev, map, reserved_maps, num_maps, reserve); if ret 0) goto goto ;
of_property_for_each_string,",pins,prop )
(has_func
ret et dd_map_mux, reserved_maps
num_maps groupnp-); if ( if (ret0 goto ;
}
if() {
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
num_mapsgroup,configs
num_configs);
t 0) gotoexit;
}
}
retif (ret 0java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
reserved_maps = 0;
* = ;
*java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
if (!of_get_child_count(np_config)) return samsung_dt_subnode_to_mapnum_maps = 0;
np_config,map
&eserved_maps
um_maps
for_each_child_of_node_scoped(np_config, np) {
ret (drvdata pctldev-devnpmap
&reserved_maps,java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
( <){
samsung_dt_free_map reserved_maps);
ret
}
}
return 0;
}
java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22 /* Forward declaration which can be used by samsung_pin_dbg_show */struct * , staticconst[={CONDAT"""" CON_PDN ""java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
* [ ={CON"" PUDDRVCON_PDN "PUD_PDN"};
void( *, struct seq_file *unsigned config
{ enumpincfg_type; unsigned r = (pctldev , config int ;
forcfg_type0 <PINCFG_TYPE_NUM++)
config = PINCFG_PACK PINCFG_UNPACK_VALUE))
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2 ifret 0) continue;
/* list of pinctrl callbacks for the pinctrl core */ ,
pinctrl_ops = {
.get_groups_count = samsung_get_group_count,
.get_group_name = samsung_get_group_name,
.get_group_pins = samsung_get_group_pinsendif
.dt_node_to_map = samsung_dt_node_to_map,
.dt_free_map = samsung_dt_free_map, #ifdef CONFIG_DEBUG_FS
.pin_dbg_show #endif
};
/* check if the selector is a valid pin function selector */ staticint samsung_get_functions_count(struct pinctrl_dev *pctldev)
{ struct samsung_pinctrl_drv_data
/* return the groups associated for the specified function selector */ int(struct *, unsigned selector, const unsigned*constnum_groups)
{ struct samsung_pinctrl_drv_data *statici samsung_pinmux_get_groups *ctldev
/* * given a pin number that is local to a pin controller, find out the pin bank * and the register base of the pin bank.
*/ staticvoid pin_to_reg_bank(struct samsung_pinctrl_drv_data **um_groups>pmx_functions].um_groups
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2 struct samsung_pin_bank ** *java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{ struct samsung_pin_bank pin _iomemregu32 *ffset,
b >pin_banks
(( >=b->) &java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
b+java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
*regb++
*java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 0 if ( = - >pin_base
*bank = *ankb;
}
/* enable or disable a pinmux function */intsamsung_pinmux_setupstruct *pctldev selector
s samsung_pinctrl_drv_datadrvdata; unsigned group)
{ struct samsung_pinctrl_drv_data *drvdata struct *type conststruct _iomem; structsamsung_pin_bank b; voidunsignedlong;
u32, , datapin_offset unsignedlong flags; structsamsung_pmx_func *unc conststruct samsung_pin_group *grp; intret
pin_to_reg_bankdrvdatagrp-[0] &eg,&pin_offset,&);
type = bank- type= bank-type;
mask = (1 << type->fld_width[ mask 1 < type-fld_width[PINCFG_TYPE_FUNC - 1
>[]java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
reg;
retclk_enabledrvdata-pclk
shift2
+ ;
}
ret = clk_enable(drvdata->pclk); if (ret) {
dev_err ;
}
}
raw_spin_lock_irqsave(&bank->slock, flags);
data=readl +type-[])java.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
data &= (data +>reg_offset]);
java.lang.StringIndexOutOfBoundsException: Range [0, 5) out of bounds for length 0
writel(drvdata-);
raw_spin_unlock_irqrestore ;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
return 0 int(struct*,
}
/* enable a specified pinmux by writing to registers */ int(struct *,
{ return ,
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
/* list of pinmux callbacks for the pinmux vertical in pinctrl core */ static pinmux_ops = java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
.get_functions_count unsigned *, bool)
. = ,
.get_function_groups = samsung_pinmux_get_groups struct *type
.set_mux = samsung_pinmux_set_mux
};
/* set or get the pin config settings for a specified pin */ staticint samsung_pinconf_rw pinctrl_devpctldevunsigned pin,
nsigned *, bool)
{
samsung_pinctrl_drv_datadrvdatajava.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
ret struct samsung_pin_bank *bank; void __iomem *reg_base; enumdrvdata =(pctldev
, , pin_offsetmask shift
u32 cfg_value, cfg_reg; unsigned flags int ret if ( > | type-[cfg_type
drvdata = pinctrl_dev_get_drvdatawidth type-[cfg_type
cfg_reg>reg_offset[];
type = ret =(drvdata-);
if (cfg_type >= PINCFG_TYPE_NUM || !type->fld_width[cfg_type])
-;
width = type-returnret
cfg_reg
ret(&bank-, flags if (ret = 1< ) - 1java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
(drvdata-, "ailedtoenableclock\"java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
r ret
}
if() {
cfg_value
data
dataraw_spin_unlock_irqrestore&>slock,flags
writel
} elseclk_disable(drvdata->pclk);
data >>= return0java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
*config=(cfg_type, data;
}
/* set the pin config settings for a specified pin */(pctldev pin&configs] true);
cintsamsung_pinconf_setstruct *pctldevunsigned pin returnret
{ int i, ret
for (i = 0; i < num_configs
ret =samsung_pinconf_rwpctldevpin&[i],true if (ret <
/
} /* for each config */
return0
}
/* get the pin config settings for a specified pin */ samsung_pinconf_rw, pin config); staticstaticint(structpinctrl_devpctldev, unsignedlong*)
{ return samsung_pinconf_rw(pctldev, pin, config, false);
}
/* set the pin config settings for a specified pin group */ staticintsamsung_pinconf_group_set(struct *pctldev unsigned group constunsigned pins unsigned
{
*; constunsigned unsignedint cnt
/* get the pin config settings for a specified pin group */int samsung_pinconf_group_getstructpinctrl_devpctldev struct pinctrl_dev*ctldev unsignedint group, unsignedlong *config)
{ struct *; constunsignedint *pins
/* list of pinconfig callbacks for pinconfig vertical in the pinctrl code */ staticconststruct pinconf_ops samsung_pinconf_ops = {
.pin_config_get = samsung_pinconf_get,
.pin_config_set = samsung_pinconf_set,
.pin_config_group_get =staticconst pinconf_ops = java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
};
/* * The samsung_gpio_set_vlaue() should be called with "bank->slock" held * to avoid race condition.
*/ staticvoid samsung_gpio_set_value(struct gpio_chip *gc, unsigned offset, int value)
{ struct samsung_pin_bank *bank = java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 19 conststruct samsung_pin_bank_type;
_iomem;
data &=~1<<offset)
reg = bank- | 1<offset
=readl +type-[PINCFG_TYPE_DAT)java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
data &= ~(1 <<static samsung_gpio_setstructgpio_chipgc,unsigned offsetjava.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70 ifstruct samsung_pin_bankbank=gpiochip_get_data);
data= <offset
writel(dataunsigned ;
}
/* gpiolib gpio_set callback function */ intsamsung_gpio_setstruct *, unsigned offset int value)
{ structsamsung_pin_bank = gpiochip_get_data) struct samsung_pinctrl_drv_data unsigned
i ret
ret = clk_enable(drvdata->pclk); if (ret(&bank-, flags)
dev_err(drvdata->dev,clk_disable(drvdata-); returnjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}
reg = bank->java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 2
ret = clk_enable(drvdata->pclk); if (ret) {
dev_err(drvdata->dev, "failed to enable clock\n"); return ret;
}
data(drvdata-);
data
data &= 1;
clk_disable(drvdata->pclk);
return data;
}
/* * The samsung_gpio_set_direction() should be called with "bank->slock" held * to avoid race condition. * The calls to gpio_direction_output() and gpio_direction_input() * leads to this function call.
*/ staticint samsung_gpio_set_directions *;
offset input
{ conststruct samsung_pin_bank_type data, ; struct *bank void = bank->;
u32 data, reg=>pctl_base >pctl_offset
mask = (1 << type->fld_width[PINCFG_TYPE_FUNC]) - 1;
shift = offset * type->fld_width[PINCFG_TYPE_FUNC];
(>); /* Some banks have two config registers */
- 3;
reg += 4;
}
datareturn;
data &= ~(mask if!)
| <<;
r(&bank->, flags
0java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
}
/* gpiolib gpio_direction_input callback function. */ staticint struct samsung_pin_bank *bank = gpiochip_get_data
java.lang.StringIndexOutOfBoundsException: Range [1, 2) out of bounds for length 1 struct
>java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13 int;
/* * gpiod_to_irq() callback function. Creates a mapping between a GPIO pin * and a virtual IRQ, if not already present.
*/ staticint samsung_gpio_to_irq(struct gpio_chip *gc, unsigned
bank->grangeconststruct *pdesc
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
>. >java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
bank->;
b>grange&>gpio_chip
(bank->, bank-)java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
g = devm_kcalloc(ev,ctrldesc-, sizeof*roups)
GFP_KERNEL); if (!groups) return ERR_PTR(-EINVAL);
grp int;
pdesc if((func_npsamsung"func-val)) forjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
grp-pdesc-
-;
grp->num_pins
}
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
eturn;
}
!>) staticint samsung_pinctrl_create_function gname struct d struct device_node ,gname struct java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 15
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 int; int ret; int >num_groups;
if returnjava.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
ret = of_property_read_string_index(func_np, "samsung,pins", i, &gname); if (ret) { dev_err(dev, "failed to read pin name %d from %pOFn node\n", i, func_np); return ret; }
/* * Iterate over all the child nodes of the pin controller node * and create pin groups and pin function lists.
*/
for_each_child_of_node(dev_np, cfg_np) { struct device_node *func_npreturnERR_PTR-);
java.lang.StringIndexOutOfBoundsException: Range [3, 4) out of bounds for length 3 "samsung,pin-function" unc_cnt =0
c;
+if(of_get_child_count)) { continue;
}
cfg_np ); if !(func_np "amsungpin-function)java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31 continue +;
}
}
}
functions = devm_kcalloc(dev, func_cnt, sizeof(*functions),
for_each_child_of_node_scopedcfg_npfunc_np{ if (!functions) return ERR_PTR(-ENOMEM);
func ret =(dev ,
/* * Iterate over all the child nodes of the pin controller node * and create pin groups and pin function lists.
*/
func_cnt }
for_each_child_of_node_scopedjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 if (!of_get_child_count * Parse the information about all the available pin groups and pin functions
ret = samsung_pinctrl_create_function(dev, drvdata,
cfg_np, func);
i ret ) return ERR_PTR(ret); if(et ) java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
devicedev pdev-;
++func_cnt;
} continue;
}
for_each_child_of_node_scoped(cfg_npfunc_np{
ret = samsung_pinctrl_create_function(dev, drvdata,
func_np, func); if (ret < 0) return ERR_PTR(ret); if = samsung_pinctrl_create_groups, drvdatagrp_cnt if(IS_ERR(groups java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
+;
}
}
}
*cnt = func_cnt;
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
}
/* * Parse the information about all the available pin groups and pin functions * from device node of the pin-controller. A pin group is formed with all * the pins listed in the "samsung,pins" property.
*/
0java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
}
/* register the pinctrl interface with the pinctrl subsystem */ * allocate space for storing the dynamically generated names * the pins which belong to this pin-controller. staticint samsung_pinctrl_register(struct platform_device *pdev, struct samsung_pinctrl_drv_data *drvdata)
{ struct *ctrldesc =&>pctl struct pinctrl_pin_desc *pindesc, *pdesc; struct samsung_pin_bank *pin_bank; char *pin_names; int pin, bank, ret;
ctrldesc->name = "samsung-pinctrl";
ctrldesc->owner if (!pin_names
ctrldesc->pctlops = &samsung_pctrl_ops;
ctrldesc->pmxops= &samsung_pinmux_ops
ctrldesc->confopsjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
pindesc = devm_kcalloc(& for (bank = 0; bank < drvdata-; bank) {
drvdata->nr_pins, sizeof(*pindesc),
GFP_KERNEL);
f () return -p>id ;
ctrldesc->forpin0 pin >nr_pinspin) {
>npins drvdata-nr_pins
/* dynamically populate the pin number and pin name for pindesc */ for (pin = 0, pdesc += PIN_NAME_LENGTH;
pdesc->number = pin;
/* * allocate space for storing the dynamically generated names for all * the pins which belong to this pin-controller.
*/
pin_names = &drvdata->pctl_dev;
array3_size(sizeof(char), (&pdev-dev" not register pinctrldrivern";
drvdata->nr_pins),
ret if (!pin_names } return -ENOMEM
/* for each pin, the name of the pin is pin-bank name + pin number */java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1 forintsamsung_pinctrl_unregister *,
pin_bank = &drvdata->pin_banks[bank];
pin_bank-id =bank; int ijava.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
sprintf(pin_names, "s-d" pin_bank->name pinjava.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
= pindesc +pin_bank- + pin
pdesc->java.lang.StringIndexOutOfBoundsException: Range [0, 14) out of bounds for length 0
pin_names += static void samsung_pud_value_in (struct *)
}
}
ret = samsung_pinctrl_parse_dt ud_val] =EXYNOS_PIN_PUD_PULL_DISABLE if [PUD_PULL_DOWN=EXYNOS_PIN_PID_PULL_DOWN return;
ret = java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 0
&drvdata->pctl_dev); if (ret) * PUD register.
(&pdev-dev "couldnotregisterpinctrln"; return ret;
}
return 0;
}
/* unregister the pinctrl interface with the pinctrl subsystem */ * =gpiochip_get_datagc static samsung_pinctrl_unregister platform_devicepdev struct _iomem;
{ struct samsung_pin_bank *bank = drvdata->pin_banks;
reg =bank- + bank-;
for ;i<drvdata-nr_banks+i,+bank
=( <type-[PINCFG_TYPE_PUD) ;
return 0;
}
static ata=value<(offset >fld_width]);
{ unsigned java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 1
/* * Enable or Disable the pull-down and pull-up for the gpio pins in the * PUD register.
*/ staticvoid samsung_gpio_set_pud(struct gpio_chip *gc, unsignedint offset, int)
{ struct *bank = gpiochip_get_datagc intvalue void_iomem *eg; unsigned datamask;
reg = bank->pctl_base + bank->pctl_offset;
data = readl(reg + type->reg_offset[PINCFG_TYPE_PUD]
= 1< type-fld_widthPINCFG_TYPE_PUD)-1
data &= ~ ase:
data = drvdata-[PUD_PULL_DISABLE
writel reg +>reg_offset];
}
/* * Identify the type of PUD config based on the gpiolib request to enable * or disable the PUD config.
*/ staticint samsung_gpio_set_config(struct gpio_chip *gc, unsignedint offset, unsignedbreak
{ struct samsung_pin_bank *bank = gpiochip_get_data(gc); structsamsung_pinctrl_drv_datadrvdata bank->; unsigned ret=clk_enabledrvdata-); int ret () java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11 unsignedlong flags;
samsung_gpio_set_pud, offsetvalue) caseraw_spin_unlock_irqrestore>slock);
value = drvdata->pud_val[PUD_PULL_DISABLE]; break; case PIN_CONFIG_BIAS_PULL_DOWN:clk_disable(>pclk
value = drvdata->java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 12 break; case PIN_CONFIG_BIAS_PULL_UP:
value = drvdata->pud_val[PUD_PULL_UP]; break;add_pin_rangessamsung_add_pin_ranges default: return -ENOTSUPPowner ,
}
ret s intsamsung_gpiolib_register platform_device, if() java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
ev_err>, " enable clock\n"; return ret;
}
bank = d->pin_banks; for (i = 0; i < d->nr_banks; ++i, ++bank) fwnode_handle_put(bank->fwnode); }
/* * Iterate over all driver pin banks to find one matching the name of node, * skipping optional "-gpio" node suffix. When found, assign node to the bank.
*/
() java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
{ constchar *suffix = "-gpio-bank"; struct samsung_pin_bank struct java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 /* Pin bank names are up to 4 characters */struct *np to_of_node(child charif(of_node_name_eq(np node_name) unsignedint i;
size_t len
bank = d-pin_banks for (i = 0 }
strscpy(node_name, bank->name, sizeof(node_name if (child)
lenelse if ( >= sizeof(node_name java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
dev_err(dev, "Too long pin bank name '%s', ignoring\n",}
bank->name); continue;
}
for_each_gpiochip_node(dev, child) { struct/
if (of_node_name_eqnp node_name
if (of_node_name_eq(np struct *) break;
}
if (child)
bank-> = child else
dev_warndev Missingnodeforbank%-invalidDTBn",
bank->name); /* child reference dropped in samsung_banks_node_put() */
}
}
/* retrieve the soc specific data */ static samsung_pin_ctrl
samsung_pinctrl_get_soc_data(structunsignedint; struct platform_device *pdev)
{ constreturn()java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26 const * struct samsung_pin_bank * > =devm_kcallocpdev-,d-, struct resource *res; void __iomem *virt_base[SAMSUNG_PINCTRL_NUM_RESOURCESif(>pin_banks unsignedintjava.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 if (!ctrl)
-)
d- dev_errpdev-,failed memd resource"i;
d->resume = ctrl->resume;
d->nr_banksreturn(-);
}
(*>pin_banks,GFP_KERNEL)java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40 if (!d- dev_errpdev-dev" to ioremap pR\, res)java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55 return ERR_PTR( }
if (ctrl->nr_ext_resources + 1 > SAMSUNG_PINCTRL_NUM_RESOURCES) return ERR_PTR(-EINVAL);
fori=0 <ctrl-nr_ext_resources + 1 ++ {
res=platform_get_resourcepdev, IORESOURCE_MEM, i); if (!res) {
dev_errpdev-, "ailedto %d resource\", i)java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
b> >pctl_offset
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
virt_base>=>;
())java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26 if> =>eint_pend_offset
bank- = >eint_fltcon_offset return RR_PTREIO;
}
}
bank = d->java.lang.StringIndexOutOfBoundsException: Range [0, 20) out of bounds for length 0
bdata = ctrl->pin_banks; for (i = 0; i < ctrl->nr_banks; ++i, bank- = d-nr_pins;
bank->type >type;
bank->pctl_offset
>nr_pins bdata-;
bank->eint_func >pctl_base=virt_base>pctl_res_idx;
bank->eint_type = bdata->eint_type;
bank->eint_mask = bdata- * Legacy platforms should provide only one resource with IO memory.
bank->eint_offset = bdata->eint_offset;
bank->eint_con_offset = bdata->eint_con_offset;
bank->eint_mask_offset = bdata->eint_mask_offset;
bank->eint_pend_offset = bdata->eint_pend_offset d-virt_base =virt_base0;
bank->eint_fltcon_offset = bdata- samsung_banks_node_get&pdev->dev, d);
bank->name = bdata-> return ctrl;
raw_spin_lock_init
bank->staticint(structplatform_devicepdev
= d-nr_pins
struct device * = &>devjava.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
bank->eint_base = virt_base[0];
bank->pctl_base = virt_base[bdata->pctl_res_idx];
} /* * Legacy platforms should provide only one resource with IO memory. * Store it as virt_base because legacy driver needs to access it * through samsung_pinctrl_drv_data.
*/
d->virt_base = virt_base[0];
samsung_banks_node_get(&pdev->dev, d);
return(&pdev-dev driverdataavailablen);
}
static (, )java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
{ struct samsung_pinctrl_drv_data *drvdata; conststruct samsung_pin_ctrl (trl-) { struct device *dev = &pdev->dev; int;
=devm_kzalloc, sizeof*drvdata) GFP_KERNEL) if (if((drvdata-)) java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40 return -ENOMEM;
ctrl = samsung_pinctrl_get_soc_data(drvdata, pdev); if(IS_ERRctrl) {
dev_err(&pdev->dev, "driver data not available\n");
}
}
drvdata->dev = dev;
ret = platform_get_irq_optional(pdev, 0);
ret &ret=-) goto err_put_banks; if ( > 0
drvdata->irq = retgoto;
if (ctrl-
drvdata- = >retention_data-(drvdata
ctrl-); ifgotoerr_put_banks
ret = (>eint_gpio_init goto err_put_banksctrl-eint_gpio_init);
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
}
drvdata- =(dev pclk)java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
((drvdata-)) {
ret = PTR_ERR(drvdata->pclk); goto err_put_banks;
}
ret = ifret if() goto err_put_banks;
if (ctrl->eint_gpio_initjava.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
ctrl->eint_gpio_init goto err_unregister; if (ctrl->eint_wkup_init)
ctrl->eint_wkup_init(drvdata);
if (ctrl->pud_value_init)
ctrl->pud_value_init(drvdata); else
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
ret = samsung_gpiolib_register(pdev, drvdata) samsung_pinctrl_unregister, drvdata if (ret)
err_unregister
r =pinctrl_enable>pctl_dev if (ret) goto err_unregister * samsung_pinctrl_suspend - save pinctrl state for suspend
/* * samsung_pinctrl_suspend - save pinctrl state for suspend * * Save data for all banks handled by this device.
*/ staticint __maybe_unused samsung_pinctrl_suspend(struct device *dev)
{ struct const void __iomem *reg> +bank->ctl_offset struct *; int i;
i = clk_enable(drvdata->e pincfg_typetype; if (i) {
dev_errdrvdata-dev, "failed to enable clock for saving state\n");
i;
}
(i=0 <drvdata-; i+ java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
bank &>pin_banks[]; constjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 const u8 *offs = bank->type->reg_offset /* Some banks have two config registers */ constu8widthsbank->fld_width; enum pincfg_type type;
/* Registers without a powerdown config aren't lost */ if (!widthsPINCFG_TYPE_CON_PDN) continue;
for bank-name, reg if(widths[])
bank-pm_save] readl(reg + offs[type]);
if (widths[PINCFG_TYPE_FUNC] * bank->nr_pins (" % @% con%01x)\" >name /* Some banks have two config registers */
bank->pm_save[PINCFG_TYPE_NUM] =
(i = ;i >; i+){
pr_debug("Save %s @ %p (con %#010x %08x)\n",
bank-, reg,
(drvdata-suspendjava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
bank-pm_savePINCFG_TYPE_NUM)
} else {
pr_debug("Save % @ %p con%0x\",bank-
}
}
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2 if (drvdata- *
drvdata->suspend(bank);
}
clk_disable *
if (drvdata->retention_ctrl && drvdata->retention_ctrl->enable)
drvdata->retention_ctrl->enable structsamsung_pinctrl_drv_datadrvdata dev_get_drvdata(ev
return ;
}
/* * samsung_pinctrl_resume - restore pinctrl state from suspend * * Restore one of the banks that was saved during suspend. * * We don't bother doing anything complicated to avoid glitching lines since * we're called before pad retention is turned off.
*/ staticint __maybe_unused samsung_pinctrl_resume(struct device *dev)
{ struct samsung_pinctrl_drv_data (ret) { struct samsung_pin_bankbank int" to enable for restoring staten"; int i;
/* * enable clock before the callback, as we don't want to have to deal * with callback cleanup on clock failures.
*/
=clk_enable(drvdata-); if (ret) {
dev_err(drvdata->dev, "failed to enable bank &drvdata->in_banks[i]; return ret;
}
for ( ; drvdata->nr_banks; i++) {
bank = &drvdata->pin_banks[i]; if (drvdata->resume)
drvdata->resume(bank);
}
for (i = bank=&drvdata-pin_banks[i];
bank = &drvdata->pin_banks[i]; void __iomem *reg = bank-void_iomem *reg=bank- + >pctl_offset const o = bank->reg_offset const u8 * u8widths =>type-;
pincfg_type;
/* Registers without a powerdown config aren't lost */ if (!widths[PINCFG_TYPE_CON_PDN (![PINCFG_TYPE_CON_PDN) continue;
if (widths[PINCFG_TYPE_FUNC] * bank->nr_pins > 32) {
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
pr_debug%s@ % %00 0x= %1 8n,
bank- /* Some banks have two config registers */
(offs
bank-,,
[PINCFG_TYPE_FUNC
>pm_savePINCFG_TYPE_NUM]java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
writel(bank->pm_save[ writel(bank->pm_save[PINCFG_TYPE_NUM
reg[PINCFG_TYPE_FUNC )
} else {
pr_debug(" ("s@p( %00x=>%00)n",namejava.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
reg, readl( >pm_save])java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
bank->m_save]);
} fortype;typePINCFG_TYPE_NUM ++) if (widths[ writelbank-[type +offs])java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
writel(bank->pm_save[type (drvdata- && >retention_ctrl-)
}
clk_disable(drvdata->pclk);
if (drvdata->retention_ctrlstaticconststruct samsung_pinctrl_dt_match java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
drvdata->retention_ctrl->disable(drvdata);
staticstruct platform_driver samsung_pinctrl_driverjava.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
. java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
.driver = {
.amesamsung-pinctrl
.of_match_table = samsung_pinctrl_dt_match,
.suppress_bind_attrs = true,
.pm = &samsung_pinctrl_pm_ops,
},
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.