2023-12-07 18:46:29 +02:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
|
|
|
/*
|
|
|
|
* Honeywell TruStability HSC Series pressure/temperature sensor
|
|
|
|
*
|
|
|
|
* Copyright (c) 2023 Petre Rodan <petre.rodan@subdimension.ro>
|
|
|
|
*
|
2024-02-11 09:56:35 +02:00
|
|
|
* Datasheet: https://prod-edam.honeywell.com/content/dam/honeywell-edam/sps/siot/en-us/products/sensors/pressure-sensors/board-mount-pressure-sensors/common/documents/sps-siot-i2c-comms-digital-output-pressure-sensors-tn-008201-3-en-ciid-45841.pdf
|
|
|
|
* Datasheet: https://prod-edam.honeywell.com/content/dam/honeywell-edam/sps/siot/en-us/products/sensors/pressure-sensors/common/documents/sps-siot-sleep-mode-technical-note-008286-1-en-ciid-155793.pdf
|
2023-12-07 18:46:29 +02:00
|
|
|
*/
|
|
|
|
|
2024-02-11 09:56:36 +02:00
|
|
|
#include <linux/delay.h>
|
2024-02-11 09:56:34 +02:00
|
|
|
#include <linux/device.h>
|
2023-12-07 18:46:29 +02:00
|
|
|
#include <linux/errno.h>
|
|
|
|
#include <linux/i2c.h>
|
|
|
|
#include <linux/mod_devicetable.h>
|
|
|
|
#include <linux/module.h>
|
2024-02-11 09:56:34 +02:00
|
|
|
#include <linux/types.h>
|
2023-12-07 18:46:29 +02:00
|
|
|
|
|
|
|
#include <linux/iio/iio.h>
|
|
|
|
|
|
|
|
#include "hsc030pa.h"
|
|
|
|
|
|
|
|
static int hsc_i2c_recv(struct hsc_data *data)
|
|
|
|
{
|
|
|
|
struct i2c_client *client = to_i2c_client(data->dev);
|
|
|
|
struct i2c_msg msg;
|
|
|
|
int ret;
|
|
|
|
|
2024-02-11 09:56:36 +02:00
|
|
|
msleep_interruptible(HSC_RESP_TIME_MS);
|
|
|
|
|
2023-12-07 18:46:29 +02:00
|
|
|
msg.addr = client->addr;
|
|
|
|
msg.flags = client->flags | I2C_M_RD;
|
|
|
|
msg.len = HSC_REG_MEASUREMENT_RD_SIZE;
|
|
|
|
msg.buf = data->buffer;
|
|
|
|
|
|
|
|
ret = i2c_transfer(client->adapter, &msg, 1);
|
|
|
|
|
|
|
|
return (ret == 2) ? 0 : ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int hsc_i2c_probe(struct i2c_client *client)
|
|
|
|
{
|
|
|
|
if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C))
|
|
|
|
return -EOPNOTSUPP;
|
|
|
|
|
|
|
|
return hsc_common_probe(&client->dev, hsc_i2c_recv);
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct of_device_id hsc_i2c_match[] = {
|
|
|
|
{ .compatible = "honeywell,hsc030pa" },
|
2025-04-11 15:49:34 -05:00
|
|
|
{ }
|
2023-12-07 18:46:29 +02:00
|
|
|
};
|
|
|
|
MODULE_DEVICE_TABLE(of, hsc_i2c_match);
|
|
|
|
|
|
|
|
static const struct i2c_device_id hsc_i2c_id[] = {
|
|
|
|
{ "hsc030pa" },
|
2025-04-11 15:49:34 -05:00
|
|
|
{ }
|
2023-12-07 18:46:29 +02:00
|
|
|
};
|
|
|
|
MODULE_DEVICE_TABLE(i2c, hsc_i2c_id);
|
|
|
|
|
|
|
|
static struct i2c_driver hsc_i2c_driver = {
|
|
|
|
.driver = {
|
|
|
|
.name = "hsc030pa",
|
|
|
|
.of_match_table = hsc_i2c_match,
|
|
|
|
},
|
|
|
|
.probe = hsc_i2c_probe,
|
|
|
|
.id_table = hsc_i2c_id,
|
|
|
|
};
|
|
|
|
module_i2c_driver(hsc_i2c_driver);
|
|
|
|
|
|
|
|
MODULE_AUTHOR("Petre Rodan <petre.rodan@subdimension.ro>");
|
|
|
|
MODULE_DESCRIPTION("Honeywell HSC and SSC pressure sensor i2c driver");
|
|
|
|
MODULE_LICENSE("GPL");
|
module: Convert symbol namespace to string literal
Clean up the existing export namespace code along the same lines of
commit 33def8498fdd ("treewide: Convert macro and uses of __section(foo)
to __section("foo")") and for the same reason, it is not desired for the
namespace argument to be a macro expansion itself.
Scripted using
git grep -l -e MODULE_IMPORT_NS -e EXPORT_SYMBOL_NS | while read file;
do
awk -i inplace '
/^#define EXPORT_SYMBOL_NS/ {
gsub(/__stringify\(ns\)/, "ns");
print;
next;
}
/^#define MODULE_IMPORT_NS/ {
gsub(/__stringify\(ns\)/, "ns");
print;
next;
}
/MODULE_IMPORT_NS/ {
$0 = gensub(/MODULE_IMPORT_NS\(([^)]*)\)/, "MODULE_IMPORT_NS(\"\\1\")", "g");
}
/EXPORT_SYMBOL_NS/ {
if ($0 ~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+),/) {
if ($0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/ &&
$0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(\)/ &&
$0 !~ /^my/) {
getline line;
gsub(/[[:space:]]*\\$/, "");
gsub(/[[:space:]]/, "", line);
$0 = $0 " " line;
}
$0 = gensub(/(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/,
"\\1(\\2, \"\\3\")", "g");
}
}
{ print }' $file;
done
Requested-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://mail.google.com/mail/u/2/#inbox/FMfcgzQXKWgMmjdFwwdsfgxzKpVHWPlc
Acked-by: Greg KH <gregkh@linuxfoundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2024-12-02 15:59:47 +01:00
|
|
|
MODULE_IMPORT_NS("IIO_HONEYWELL_HSC030PA");
|