Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5ab24d0f authored by Camera Software Integration's avatar Camera Software Integration Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: camera: sensor: Read gpios property from dt node" into camera-kernel.lnx.3.1

parents da5d1def 47cb7dc0
Loading
Loading
Loading
Loading
+12 −10
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
 * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
 */

#include <linux/init.h>
@@ -9,6 +9,7 @@
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/gpio.h>
#include <linux/of_gpio.h>
#include "cam_debug_util.h"
#include "cam_res_mgr_api.h"
#include "cam_res_mgr_private.h"
@@ -604,15 +605,13 @@ EXPORT_SYMBOL(cam_res_mgr_shared_clk_config);

static int cam_res_mgr_parse_dt(struct device *dev)
{
	int rc = 0;
	int rc = 0, i = 0;
	struct device_node *of_node = NULL;
	struct cam_res_mgr_dt *dt = &cam_res->dt;

	of_node = dev->of_node;

	dt->num_shared_gpio = of_property_count_u32_elems(of_node,
		"shared-gpios");

	dt->num_shared_gpio = of_gpio_count(of_node);
	if (dt->num_shared_gpio > MAX_SHARED_GPIO_SIZE ||
		dt->num_shared_gpio <= 0) {
		/*
@@ -624,12 +623,15 @@ static int cam_res_mgr_parse_dt(struct device *dev)
		return -EINVAL;
	}

	rc = of_property_read_u32_array(of_node, "shared-gpios",
		dt->shared_gpio, dt->num_shared_gpio);
	if (rc) {
	for (i = 0; i < dt->num_shared_gpio; i++) {
		dt->shared_gpio[i] = of_get_gpio(of_node, i);
		if (dt->shared_gpio[i] < 0) {
			CAM_ERR(CAM_RES, "Get shared gpio array failed.");
			return -EINVAL;
		}
		CAM_DBG(CAM_UTIL, "shared_gpio[%d] = %d",
				i, dt->shared_gpio[i]);
	}

	dt->pinctrl_info.pinctrl = devm_pinctrl_get(dev);
	if (IS_ERR_OR_NULL(dt->pinctrl_info.pinctrl)) {