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

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

Merge "max31760: add support for additional registers"

parents 1fc5947e e07f3007
Loading
Loading
Loading
Loading
+11 −4
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only

/*
 * Copyright (c) 2020, The Linux Foundation. All rights reserved.
 * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
 */

#include <linux/device.h>
@@ -121,7 +121,7 @@ static ssize_t fan_show(struct device *dev, struct device_attribute *attr,
static ssize_t fan_store(struct device *dev, struct device_attribute *attr,
				const char *buf, size_t count)
{
	long val;
	long val, val1;
	struct max31760 *pdata;

	pdata =  dev_get_drvdata(dev);
@@ -131,8 +131,15 @@ static ssize_t fan_store(struct device *dev, struct device_attribute *attr,
	}

	kstrtol(buf, 0, &val);
	pr_debug("%s, count:%d  val:%lx, buf:%s\n",
				 __func__, count, val, buf);
	val1 = val >> 8;
	pr_debug("%s, count:%d  val:%lx, val1:%lx, buf:%s\n",
				 __func__, count, val, val1, buf);
	if (val1 == 0x50) {
		val1 = val & 0xFF;
		pr_debug("%s, reg value val1:%lx\n", __func__, val1);
		max31760_i2c_reg_set(pdata, 0x50, val1);
		return count;
	}

	if (val == 0xff) {
		turn_gpio(pdata, false);