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

Commit 6774fc89 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "driver: iio: imu: Enable gpio to control the power on to asm330 sensor"

parents cec05346 7e0c2302
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -220,6 +220,7 @@
		reg = <0x6b>;
		reg = <0x6b>;
		pinctrl-names = "default";
		pinctrl-names = "default";
		pinctrl-0 = <&sensor_int1_default>,<&sensor_enable_default>;
		pinctrl-0 = <&sensor_int1_default>,<&sensor_enable_default>;
		asm330-enable-gpio = <&tlmm 87 0x1>;
		interrupt-parent = <&tlmm>;
		interrupt-parent = <&tlmm>;
		interrupts = <84 IRQ_TYPE_EDGE_RISING>;
		interrupts = <84 IRQ_TYPE_EDGE_RISING>;
		st,drdy-int-pin= <2>;
		st,drdy-int-pin= <2>;
+2 −2
Original line number Original line Diff line number Diff line
/* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
/* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
 *
 *
 * This program is free software; you can redistribute it and/or modify
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * it under the terms of the GNU General Public License version 2 and
@@ -1670,7 +1670,7 @@
				pins = "gpio87";
				pins = "gpio87";
				drive-strength = <16>; /* 16 mA */
				drive-strength = <16>; /* 16 mA */
				bias-pull-up; /* pull up */
				bias-pull-up; /* pull up */
				output-high;
				output-low;
			};
			};
		};
		};


+1 −0
Original line number Original line Diff line number Diff line
@@ -239,6 +239,7 @@ struct st_asm330lhh_hw {
	struct st_asm330lhh_transfer_buffer tb;
	struct st_asm330lhh_transfer_buffer tb;
	struct regulator *vdd;
	struct regulator *vdd;
	struct regulator *vio;
	struct regulator *vio;
	int enable_gpio;
};
};


extern const struct dev_pm_ops st_asm330lhh_pm_ops;
extern const struct dev_pm_ops st_asm330lhh_pm_ops;
+17 −0
Original line number Original line Diff line number Diff line
@@ -16,6 +16,7 @@
#include <linux/pm.h>
#include <linux/pm.h>
#include <linux/version.h>
#include <linux/version.h>
#include <linux/of.h>
#include <linux/of.h>
#include <linux/of_gpio.h>
#include <linux/regulator/consumer.h>
#include <linux/regulator/consumer.h>


#include <linux/platform_data/st_sensors_pdata.h>
#include <linux/platform_data/st_sensors_pdata.h>
@@ -69,6 +70,9 @@
#define ST_ASM330LHH_TEMP_FS_GAIN		(1000000 / ST_ASM330LHH_TEMP_GAIN)
#define ST_ASM330LHH_TEMP_FS_GAIN		(1000000 / ST_ASM330LHH_TEMP_GAIN)
#define ST_ASM330LHH_OFFSET			(6400)
#define ST_ASM330LHH_OFFSET			(6400)


/* Turn on of sensor in ms */
#define ST_ASM330LHH_TURN_ON_TIME		35

static int asm330_check_regulator;
static int asm330_check_regulator;


struct st_asm330lhh_std_entry {
struct st_asm330lhh_std_entry {
@@ -1152,6 +1156,19 @@ int st_asm330lhh_probe(struct device *dev, int irq,
	hw->tf = tf_ops;
	hw->tf = tf_ops;
	np = hw->dev->of_node;
	np = hw->dev->of_node;


	hw->enable_gpio = of_get_named_gpio(np, "asm330-enable-gpio", 0);
	if (gpio_is_valid(hw->enable_gpio)) {
		err = gpio_request(hw->enable_gpio, "asm330_enable");
		if (err < 0) {
			dev_err(hw->dev,
					"failed to request gpio %d: %d\n",
					hw->enable_gpio, err);
			return err;
		}
		gpio_direction_output(hw->enable_gpio, 1);
		msleep(ST_ASM330LHH_TURN_ON_TIME);
	}

	dev_info(hw->dev, "Ver: %s\n", ST_ASM330LHH_VERSION);
	dev_info(hw->dev, "Ver: %s\n", ST_ASM330LHH_VERSION);


	/* use qtimer if property is enabled */
	/* use qtimer if property is enabled */