Linux Audio

Check our new training course

Loading...
v5.9
  1// SPDX-License-Identifier: GPL-2.0-only
  2/*
  3 *  linux/drivers/pinctrl/pinctrl-lantiq.c
  4 *  based on linux/drivers/pinctrl/pinctrl-pxa3xx.c
  5 *
  6 *  Copyright (C) 2012 John Crispin <john@phrozen.org>
 
 
 
 
  7 */
  8
  9#include <linux/module.h>
 10#include <linux/device.h>
 11#include <linux/io.h>
 12#include <linux/platform_device.h>
 13#include <linux/slab.h>
 14#include <linux/of.h>
 15
 16#include "pinctrl-lantiq.h"
 17
 18static int ltq_get_group_count(struct pinctrl_dev *pctrldev)
 19{
 20	struct ltq_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
 21	return info->num_grps;
 22}
 23
 24static const char *ltq_get_group_name(struct pinctrl_dev *pctrldev,
 25					 unsigned selector)
 26{
 27	struct ltq_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
 28	if (selector >= info->num_grps)
 29		return NULL;
 30	return info->grps[selector].name;
 31}
 32
 33static int ltq_get_group_pins(struct pinctrl_dev *pctrldev,
 34				 unsigned selector,
 35				 const unsigned **pins,
 36				 unsigned *num_pins)
 37{
 38	struct ltq_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
 39	if (selector >= info->num_grps)
 40		return -EINVAL;
 41	*pins = info->grps[selector].pins;
 42	*num_pins = info->grps[selector].npins;
 43	return 0;
 44}
 45
 46static void ltq_pinctrl_dt_free_map(struct pinctrl_dev *pctldev,
 47				    struct pinctrl_map *map, unsigned num_maps)
 48{
 49	int i;
 50
 51	for (i = 0; i < num_maps; i++)
 52		if (map[i].type == PIN_MAP_TYPE_CONFIGS_PIN ||
 53		    map[i].type == PIN_MAP_TYPE_CONFIGS_GROUP)
 54			kfree(map[i].data.configs.configs);
 55	kfree(map);
 56}
 57
 58static void ltq_pinctrl_pin_dbg_show(struct pinctrl_dev *pctldev,
 59					struct seq_file *s,
 60					unsigned offset)
 61{
 62	seq_printf(s, " %s", dev_name(pctldev->dev));
 63}
 64
 65static void ltq_pinctrl_dt_subnode_to_map(struct pinctrl_dev *pctldev,
 66				struct device_node *np,
 67				struct pinctrl_map **map)
 68{
 69	struct ltq_pinmux_info *info = pinctrl_dev_get_drvdata(pctldev);
 70	struct property *pins = of_find_property(np, "lantiq,pins", NULL);
 71	struct property *groups = of_find_property(np, "lantiq,groups", NULL);
 72	unsigned long configs[3];
 73	unsigned num_configs = 0;
 74	struct property *prop;
 75	const char *group, *pin;
 76	const char *function;
 77	int ret, i;
 78
 79	if (!pins && !groups) {
 80		dev_err(pctldev->dev, "%pOFn defines neither pins nor groups\n",
 81			np);
 82		return;
 83	}
 84
 85	if (pins && groups) {
 86		dev_err(pctldev->dev, "%pOFn defines both pins and groups\n",
 87			np);
 88		return;
 89	}
 90
 91	ret = of_property_read_string(np, "lantiq,function", &function);
 92	if (groups && !ret) {
 93		of_property_for_each_string(np, "lantiq,groups", prop, group) {
 94			(*map)->type = PIN_MAP_TYPE_MUX_GROUP;
 95			(*map)->name = function;
 96			(*map)->data.mux.group = group;
 97			(*map)->data.mux.function = function;
 98			(*map)++;
 99		}
100	}
101
102	for (i = 0; i < info->num_params; i++) {
103		u32 val;
104		int ret = of_property_read_u32(np,
105				info->params[i].property, &val);
106		if (!ret)
107			configs[num_configs++] =
108				LTQ_PINCONF_PACK(info->params[i].param,
109				val);
110	}
111
112	if (!num_configs)
113		return;
114
115	of_property_for_each_string(np, "lantiq,pins", prop, pin) {
116		(*map)->data.configs.configs = kmemdup(configs,
117					num_configs * sizeof(unsigned long),
118					GFP_KERNEL);
119		(*map)->type = PIN_MAP_TYPE_CONFIGS_PIN;
120		(*map)->name = pin;
121		(*map)->data.configs.group_or_pin = pin;
122		(*map)->data.configs.num_configs = num_configs;
123		(*map)++;
124	}
125	of_property_for_each_string(np, "lantiq,groups", prop, group) {
126		(*map)->data.configs.configs = kmemdup(configs,
127					num_configs * sizeof(unsigned long),
128					GFP_KERNEL);
129		(*map)->type = PIN_MAP_TYPE_CONFIGS_GROUP;
130		(*map)->name = group;
131		(*map)->data.configs.group_or_pin = group;
132		(*map)->data.configs.num_configs = num_configs;
133		(*map)++;
134	}
135}
136
137static int ltq_pinctrl_dt_subnode_size(struct device_node *np)
138{
139	int ret;
140
141	ret = of_property_count_strings(np, "lantiq,groups");
142	if (ret < 0)
143		ret = of_property_count_strings(np, "lantiq,pins");
144	return ret;
145}
146
147static int ltq_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
148				      struct device_node *np_config,
149				      struct pinctrl_map **map,
150				      unsigned *num_maps)
151{
152	struct pinctrl_map *tmp;
153	struct device_node *np;
154	int max_maps = 0;
155
156	for_each_child_of_node(np_config, np)
157		max_maps += ltq_pinctrl_dt_subnode_size(np);
158	*map = kzalloc(array3_size(max_maps, sizeof(struct pinctrl_map), 2),
159		       GFP_KERNEL);
160	if (!*map)
161		return -ENOMEM;
162	tmp = *map;
163
164	for_each_child_of_node(np_config, np)
165		ltq_pinctrl_dt_subnode_to_map(pctldev, np, &tmp);
166	*num_maps = ((int)(tmp - *map));
167
168	return 0;
169}
170
171static const struct pinctrl_ops ltq_pctrl_ops = {
172	.get_groups_count	= ltq_get_group_count,
173	.get_group_name		= ltq_get_group_name,
174	.get_group_pins		= ltq_get_group_pins,
175	.pin_dbg_show		= ltq_pinctrl_pin_dbg_show,
176	.dt_node_to_map		= ltq_pinctrl_dt_node_to_map,
177	.dt_free_map		= ltq_pinctrl_dt_free_map,
178};
179
180static int ltq_pmx_func_count(struct pinctrl_dev *pctrldev)
181{
182	struct ltq_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
183
184	return info->num_funcs;
185}
186
187static const char *ltq_pmx_func_name(struct pinctrl_dev *pctrldev,
188					 unsigned selector)
189{
190	struct ltq_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
191
192	if (selector >= info->num_funcs)
193		return NULL;
194
195	return info->funcs[selector].name;
196}
197
198static int ltq_pmx_get_groups(struct pinctrl_dev *pctrldev,
199				unsigned func,
200				const char * const **groups,
201				unsigned * const num_groups)
202{
203	struct ltq_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
204
205	*groups = info->funcs[func].groups;
206	*num_groups = info->funcs[func].num_groups;
207
208	return 0;
209}
210
211/* Return function number. If failure, return negative value. */
212static int match_mux(const struct ltq_mfp_pin *mfp, unsigned mux)
213{
214	int i;
215	for (i = 0; i < LTQ_MAX_MUX; i++) {
216		if (mfp->func[i] == mux)
217			break;
218	}
219	if (i >= LTQ_MAX_MUX)
220		return -EINVAL;
221	return i;
222}
223
224/* don't assume .mfp is linearly mapped. find the mfp with the correct .pin */
225static int match_mfp(const struct ltq_pinmux_info *info, int pin)
226{
227	int i;
228	for (i = 0; i < info->num_mfp; i++) {
229		if (info->mfp[i].pin == pin)
230			return i;
231	}
232	return -1;
233}
234
235/* check whether current pin configuration is valid. Negative for failure */
236static int match_group_mux(const struct ltq_pin_group *grp,
237			   const struct ltq_pinmux_info *info,
238			   unsigned mux)
239{
240	int i, pin, ret = 0;
241	for (i = 0; i < grp->npins; i++) {
242		pin = match_mfp(info, grp->pins[i]);
243		if (pin < 0) {
244			dev_err(info->dev, "could not find mfp for pin %d\n",
245				grp->pins[i]);
246			return -EINVAL;
247		}
248		ret = match_mux(&info->mfp[pin], mux);
249		if (ret < 0) {
250			dev_err(info->dev, "Can't find mux %d on pin%d\n",
251				mux, pin);
252			break;
253		}
254	}
255	return ret;
256}
257
258static int ltq_pmx_set(struct pinctrl_dev *pctrldev,
259		       unsigned func,
260		       unsigned group)
261{
262	struct ltq_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
263	const struct ltq_pin_group *pin_grp = &info->grps[group];
264	int i, pin, pin_func, ret;
265
266	if (!pin_grp->npins ||
267		(match_group_mux(pin_grp, info, pin_grp->mux) < 0)) {
268		dev_err(info->dev, "Failed to set the pin group: %s\n",
269			info->grps[group].name);
270		return -EINVAL;
271	}
272	for (i = 0; i < pin_grp->npins; i++) {
273		pin = match_mfp(info, pin_grp->pins[i]);
274		if (pin < 0) {
275			dev_err(info->dev, "could not find mfp for pin %d\n",
276				pin_grp->pins[i]);
277			return -EINVAL;
278		}
279		pin_func = match_mux(&info->mfp[pin], pin_grp->mux);
280		ret = info->apply_mux(pctrldev, pin, pin_func);
281		if (ret) {
282			dev_err(info->dev,
283				"failed to apply mux %d for pin %d\n",
284				pin_func, pin);
285			return ret;
286		}
287	}
288	return 0;
289}
290
291static int ltq_pmx_gpio_request_enable(struct pinctrl_dev *pctrldev,
292				struct pinctrl_gpio_range *range,
293				unsigned pin)
294{
295	struct ltq_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
296	int mfp = match_mfp(info, pin);
297	int pin_func;
298
299	if (mfp < 0) {
300		dev_err(info->dev, "could not find mfp for pin %d\n", pin);
301		return -EINVAL;
302	}
303
304	pin_func = match_mux(&info->mfp[mfp], 0);
305	if (pin_func < 0) {
306		dev_err(info->dev, "No GPIO function on pin%d\n", mfp);
307		return -EINVAL;
308	}
309
310	return info->apply_mux(pctrldev, mfp, pin_func);
311}
312
313static const struct pinmux_ops ltq_pmx_ops = {
314	.get_functions_count	= ltq_pmx_func_count,
315	.get_function_name	= ltq_pmx_func_name,
316	.get_function_groups	= ltq_pmx_get_groups,
317	.set_mux		= ltq_pmx_set,
318	.gpio_request_enable	= ltq_pmx_gpio_request_enable,
319};
320
321/*
322 * allow different socs to register with the generic part of the lanti
323 * pinctrl code
324 */
325int ltq_pinctrl_register(struct platform_device *pdev,
326				struct ltq_pinmux_info *info)
327{
328	struct pinctrl_desc *desc;
329
330	if (!info)
331		return -EINVAL;
332	desc = info->desc;
333	desc->pctlops = &ltq_pctrl_ops;
334	desc->pmxops = &ltq_pmx_ops;
335	info->dev = &pdev->dev;
336
337	info->pctrl = devm_pinctrl_register(&pdev->dev, desc, info);
338	if (IS_ERR(info->pctrl)) {
339		dev_err(&pdev->dev, "failed to register LTQ pinmux driver\n");
340		return PTR_ERR(info->pctrl);
341	}
342	platform_set_drvdata(pdev, info);
343	return 0;
344}
v3.15
 
  1/*
  2 *  linux/drivers/pinctrl/pinctrl-lantiq.c
  3 *  based on linux/drivers/pinctrl/pinctrl-pxa3xx.c
  4 *
  5 *  This program is free software; you can redistribute it and/or modify
  6 *  it under the terms of the GNU General Public License version 2 as
  7 *  publishhed by the Free Software Foundation.
  8 *
  9 *  Copyright (C) 2012 John Crispin <blogic@openwrt.org>
 10 */
 11
 12#include <linux/module.h>
 13#include <linux/device.h>
 14#include <linux/io.h>
 15#include <linux/platform_device.h>
 16#include <linux/slab.h>
 17#include <linux/of.h>
 18
 19#include "pinctrl-lantiq.h"
 20
 21static int ltq_get_group_count(struct pinctrl_dev *pctrldev)
 22{
 23	struct ltq_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
 24	return info->num_grps;
 25}
 26
 27static const char *ltq_get_group_name(struct pinctrl_dev *pctrldev,
 28					 unsigned selector)
 29{
 30	struct ltq_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
 31	if (selector >= info->num_grps)
 32		return NULL;
 33	return info->grps[selector].name;
 34}
 35
 36static int ltq_get_group_pins(struct pinctrl_dev *pctrldev,
 37				 unsigned selector,
 38				 const unsigned **pins,
 39				 unsigned *num_pins)
 40{
 41	struct ltq_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
 42	if (selector >= info->num_grps)
 43		return -EINVAL;
 44	*pins = info->grps[selector].pins;
 45	*num_pins = info->grps[selector].npins;
 46	return 0;
 47}
 48
 49static void ltq_pinctrl_dt_free_map(struct pinctrl_dev *pctldev,
 50				    struct pinctrl_map *map, unsigned num_maps)
 51{
 52	int i;
 53
 54	for (i = 0; i < num_maps; i++)
 55		if (map[i].type == PIN_MAP_TYPE_CONFIGS_PIN ||
 56		    map[i].type == PIN_MAP_TYPE_CONFIGS_GROUP)
 57			kfree(map[i].data.configs.configs);
 58	kfree(map);
 59}
 60
 61static void ltq_pinctrl_pin_dbg_show(struct pinctrl_dev *pctldev,
 62					struct seq_file *s,
 63					unsigned offset)
 64{
 65	seq_printf(s, " %s", dev_name(pctldev->dev));
 66}
 67
 68static void ltq_pinctrl_dt_subnode_to_map(struct pinctrl_dev *pctldev,
 69				struct device_node *np,
 70				struct pinctrl_map **map)
 71{
 72	struct ltq_pinmux_info *info = pinctrl_dev_get_drvdata(pctldev);
 73	struct property *pins = of_find_property(np, "lantiq,pins", NULL);
 74	struct property *groups = of_find_property(np, "lantiq,groups", NULL);
 75	unsigned long configs[3];
 76	unsigned num_configs = 0;
 77	struct property *prop;
 78	const char *group, *pin;
 79	const char *function;
 80	int ret, i;
 81
 82	if (!pins && !groups) {
 83		dev_err(pctldev->dev, "%s defines neither pins nor groups\n",
 84			np->name);
 85		return;
 86	}
 87
 88	if (pins && groups) {
 89		dev_err(pctldev->dev, "%s defines both pins and groups\n",
 90			np->name);
 91		return;
 92	}
 93
 94	ret = of_property_read_string(np, "lantiq,function", &function);
 95	if (groups && !ret) {
 96		of_property_for_each_string(np, "lantiq,groups", prop, group) {
 97			(*map)->type = PIN_MAP_TYPE_MUX_GROUP;
 98			(*map)->name = function;
 99			(*map)->data.mux.group = group;
100			(*map)->data.mux.function = function;
101			(*map)++;
102		}
103	}
104
105	for (i = 0; i < info->num_params; i++) {
106		u32 val;
107		int ret = of_property_read_u32(np,
108				info->params[i].property, &val);
109		if (!ret)
110			configs[num_configs++] =
111				LTQ_PINCONF_PACK(info->params[i].param,
112				val);
113	}
114
115	if (!num_configs)
116		return;
117
118	of_property_for_each_string(np, "lantiq,pins", prop, pin) {
119		(*map)->data.configs.configs = kmemdup(configs,
120					num_configs * sizeof(unsigned long),
121					GFP_KERNEL);
122		(*map)->type = PIN_MAP_TYPE_CONFIGS_PIN;
123		(*map)->name = pin;
124		(*map)->data.configs.group_or_pin = pin;
125		(*map)->data.configs.num_configs = num_configs;
126		(*map)++;
127	}
128	of_property_for_each_string(np, "lantiq,groups", prop, group) {
129		(*map)->data.configs.configs = kmemdup(configs,
130					num_configs * sizeof(unsigned long),
131					GFP_KERNEL);
132		(*map)->type = PIN_MAP_TYPE_CONFIGS_GROUP;
133		(*map)->name = group;
134		(*map)->data.configs.group_or_pin = group;
135		(*map)->data.configs.num_configs = num_configs;
136		(*map)++;
137	}
138}
139
140static int ltq_pinctrl_dt_subnode_size(struct device_node *np)
141{
142	int ret;
143
144	ret = of_property_count_strings(np, "lantiq,groups");
145	if (ret < 0)
146		ret = of_property_count_strings(np, "lantiq,pins");
147	return ret;
148}
149
150static int ltq_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev,
151				      struct device_node *np_config,
152				      struct pinctrl_map **map,
153				      unsigned *num_maps)
154{
155	struct pinctrl_map *tmp;
156	struct device_node *np;
157	int max_maps = 0;
158
159	for_each_child_of_node(np_config, np)
160		max_maps += ltq_pinctrl_dt_subnode_size(np);
161	*map = kzalloc(max_maps * sizeof(struct pinctrl_map) * 2, GFP_KERNEL);
 
162	if (!*map)
163		return -ENOMEM;
164	tmp = *map;
165
166	for_each_child_of_node(np_config, np)
167		ltq_pinctrl_dt_subnode_to_map(pctldev, np, &tmp);
168	*num_maps = ((int)(tmp - *map));
169
170	return 0;
171}
172
173static const struct pinctrl_ops ltq_pctrl_ops = {
174	.get_groups_count	= ltq_get_group_count,
175	.get_group_name		= ltq_get_group_name,
176	.get_group_pins		= ltq_get_group_pins,
177	.pin_dbg_show		= ltq_pinctrl_pin_dbg_show,
178	.dt_node_to_map		= ltq_pinctrl_dt_node_to_map,
179	.dt_free_map		= ltq_pinctrl_dt_free_map,
180};
181
182static int ltq_pmx_func_count(struct pinctrl_dev *pctrldev)
183{
184	struct ltq_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
185
186	return info->num_funcs;
187}
188
189static const char *ltq_pmx_func_name(struct pinctrl_dev *pctrldev,
190					 unsigned selector)
191{
192	struct ltq_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
193
194	if (selector >= info->num_funcs)
195		return NULL;
196
197	return info->funcs[selector].name;
198}
199
200static int ltq_pmx_get_groups(struct pinctrl_dev *pctrldev,
201				unsigned func,
202				const char * const **groups,
203				unsigned * const num_groups)
204{
205	struct ltq_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
206
207	*groups = info->funcs[func].groups;
208	*num_groups = info->funcs[func].num_groups;
209
210	return 0;
211}
212
213/* Return function number. If failure, return negative value. */
214static int match_mux(const struct ltq_mfp_pin *mfp, unsigned mux)
215{
216	int i;
217	for (i = 0; i < LTQ_MAX_MUX; i++) {
218		if (mfp->func[i] == mux)
219			break;
220	}
221	if (i >= LTQ_MAX_MUX)
222		return -EINVAL;
223	return i;
224}
225
226/* dont assume .mfp is linearly mapped. find the mfp with the correct .pin */
227static int match_mfp(const struct ltq_pinmux_info *info, int pin)
228{
229	int i;
230	for (i = 0; i < info->num_mfp; i++) {
231		if (info->mfp[i].pin == pin)
232			return i;
233	}
234	return -1;
235}
236
237/* check whether current pin configuration is valid. Negative for failure */
238static int match_group_mux(const struct ltq_pin_group *grp,
239			   const struct ltq_pinmux_info *info,
240			   unsigned mux)
241{
242	int i, pin, ret = 0;
243	for (i = 0; i < grp->npins; i++) {
244		pin = match_mfp(info, grp->pins[i]);
245		if (pin < 0) {
246			dev_err(info->dev, "could not find mfp for pin %d\n",
247				grp->pins[i]);
248			return -EINVAL;
249		}
250		ret = match_mux(&info->mfp[pin], mux);
251		if (ret < 0) {
252			dev_err(info->dev, "Can't find mux %d on pin%d\n",
253				mux, pin);
254			break;
255		}
256	}
257	return ret;
258}
259
260static int ltq_pmx_enable(struct pinctrl_dev *pctrldev,
261				unsigned func,
262				unsigned group)
263{
264	struct ltq_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
265	const struct ltq_pin_group *pin_grp = &info->grps[group];
266	int i, pin, pin_func, ret;
267
268	if (!pin_grp->npins ||
269		(match_group_mux(pin_grp, info, pin_grp->mux) < 0)) {
270		dev_err(info->dev, "Failed to set the pin group: %s\n",
271			info->grps[group].name);
272		return -EINVAL;
273	}
274	for (i = 0; i < pin_grp->npins; i++) {
275		pin = match_mfp(info, pin_grp->pins[i]);
276		if (pin < 0) {
277			dev_err(info->dev, "could not find mfp for pin %d\n",
278				pin_grp->pins[i]);
279			return -EINVAL;
280		}
281		pin_func = match_mux(&info->mfp[pin], pin_grp->mux);
282		ret = info->apply_mux(pctrldev, pin, pin_func);
283		if (ret) {
284			dev_err(info->dev,
285				"failed to apply mux %d for pin %d\n",
286				pin_func, pin);
287			return ret;
288		}
289	}
290	return 0;
291}
292
293static int ltq_pmx_gpio_request_enable(struct pinctrl_dev *pctrldev,
294				struct pinctrl_gpio_range *range,
295				unsigned pin)
296{
297	struct ltq_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
298	int mfp = match_mfp(info, pin);
299	int pin_func;
300
301	if (mfp < 0) {
302		dev_err(info->dev, "could not find mfp for pin %d\n", pin);
303		return -EINVAL;
304	}
305
306	pin_func = match_mux(&info->mfp[mfp], 0);
307	if (pin_func < 0) {
308		dev_err(info->dev, "No GPIO function on pin%d\n", mfp);
309		return -EINVAL;
310	}
311
312	return info->apply_mux(pctrldev, mfp, pin_func);
313}
314
315static const struct pinmux_ops ltq_pmx_ops = {
316	.get_functions_count	= ltq_pmx_func_count,
317	.get_function_name	= ltq_pmx_func_name,
318	.get_function_groups	= ltq_pmx_get_groups,
319	.enable			= ltq_pmx_enable,
320	.gpio_request_enable	= ltq_pmx_gpio_request_enable,
321};
322
323/*
324 * allow different socs to register with the generic part of the lanti
325 * pinctrl code
326 */
327int ltq_pinctrl_register(struct platform_device *pdev,
328				struct ltq_pinmux_info *info)
329{
330	struct pinctrl_desc *desc;
331
332	if (!info)
333		return -EINVAL;
334	desc = info->desc;
335	desc->pctlops = &ltq_pctrl_ops;
336	desc->pmxops = &ltq_pmx_ops;
337	info->dev = &pdev->dev;
338
339	info->pctrl = pinctrl_register(desc, &pdev->dev, info);
340	if (!info->pctrl) {
341		dev_err(&pdev->dev, "failed to register LTQ pinmux driver\n");
342		return -EINVAL;
343	}
344	platform_set_drvdata(pdev, info);
345	return 0;
346}