Commit cbe1a44b authored by Andrey Filippov's avatar Andrey Filippov

Adding sysfs and DT suppport for the ported program

parent 646d3357
...@@ -299,5 +299,15 @@ ...@@ -299,5 +299,15 @@
klogger-393,buffer_size = <1048576>; klogger-393,buffer_size = <1048576>;
} ; } ;
/* i2c driver for the extension boards, such as imu, gps, etc */
elphel393_ext_i2c:elphel393-ext-i2c@0{
compatible = "elphel,elphel393-ext-i2c-1.00";
time_scl_high = <3>; /* SCL high duration (us) */
time_scl_low = <3>; /* SCL low duration (us) */
time_slave2master = <2>; /* slave -> master delay (us) */
time_master2slave = <2>; /* master -> slave delay (us) */
filter_sda = <7>; /* filter SDA read data by testing multiple times - currently just zero/non zero */
filter_scl = <7>; /* filter SCL read data by testing multiple times - currently just zero/non zero */
};
}; };
\ No newline at end of file
...@@ -298,6 +298,15 @@ ...@@ -298,6 +298,15 @@
compatible = "elphel,klogger-393-1.00"; compatible = "elphel,klogger-393-1.00";
klogger-393,buffer_size = <1048576>; klogger-393,buffer_size = <1048576>;
} ; } ;
/* i2c driver for the extension boards, such as imu, gps, etc */
elphel393_ext_i2c:elphel393-ext-i2c@0{
compatible = "elphel,elphel393-ext-i2c-1.00";
time_scl_high = <3>; /* SCL high duration (us) */
time_scl_low = <3>; /* SCL low duration (us) */
time_slave2master = <2>; /* slave -> master delay (us) */
time_master2slave = <2>; /* master -> slave delay (us) */
filter_sda = <7>; /* filter SDA read data by testing multiple times - currently just zero/non zero */
filter_scl = <7>; /* filter SCL read data by testing multiple times - currently just zero/non zero */
};
}; };
\ No newline at end of file
...@@ -299,5 +299,15 @@ ...@@ -299,5 +299,15 @@
klogger-393,buffer_size = <1048576>; klogger-393,buffer_size = <1048576>;
} ; } ;
/* i2c driver for the extension boards, such as imu, gps, etc */
elphel393_ext_i2c:elphel393-ext-i2c@0{
compatible = "elphel,elphel393-ext-i2c-1.00";
time_scl_high = <3>; /* SCL high duration (us) */
time_scl_low = <3>; /* SCL low duration (us) */
time_slave2master = <2>; /* slave -> master delay (us) */
time_master2slave = <2>; /* master -> slave delay (us) */
filter_sda = <7>; /* filter SDA read data by testing multiple times - currently just zero/non zero */
filter_scl = <7>; /* filter SCL read data by testing multiple times - currently just zero/non zero */
};
}; };
\ No newline at end of file
...@@ -299,5 +299,15 @@ ...@@ -299,5 +299,15 @@
klogger-393,buffer_size = <1048576>; klogger-393,buffer_size = <1048576>;
} ; } ;
/* i2c driver for the extension boards, such as imu, gps, etc */
elphel393_ext_i2c:elphel393-ext-i2c@0{
compatible = "elphel,elphel393-ext-i2c-1.00";
time_scl_high = <3>; /* SCL high duration (us) */
time_scl_low = <3>; /* SCL low duration (us) */
time_slave2master = <2>; /* slave -> master delay (us) */
time_master2slave = <2>; /* master -> slave delay (us) */
filter_sda = <7>; /* filter SDA read data by testing multiple times - currently just zero/non zero */
filter_scl = <7>; /* filter SCL read data by testing multiple times - currently just zero/non zero */
};
}; };
\ No newline at end of file
This diff is collapsed.
...@@ -246,7 +246,6 @@ static int get_channel_sub_from_name(struct device_attribute *attr) ///< Linux k ...@@ -246,7 +246,6 @@ static int get_channel_sub_from_name(struct device_attribute *attr) ///< Linux k
static ssize_t show_port_mux(struct device *dev, struct device_attribute *attr, char *buf) static ssize_t show_port_mux(struct device *dev, struct device_attribute *attr, char *buf)
{ {
int i;
const char * name = get_name_by_code(get_detected_mux_code(get_channel_from_name(attr)), DETECT_MUX); const char * name = get_name_by_code(get_detected_mux_code(get_channel_from_name(attr)), DETECT_MUX);
if (name) return sprintf(buf,"%s\n", name); if (name) return sprintf(buf,"%s\n", name);
// Should never get here // Should never get here
...@@ -254,7 +253,6 @@ static ssize_t show_port_mux(struct device *dev, struct device_attribute *attr, ...@@ -254,7 +253,6 @@ static ssize_t show_port_mux(struct device *dev, struct device_attribute *attr,
} }
static ssize_t show_sensor(struct device *dev, struct device_attribute *attr, char *buf) static ssize_t show_sensor(struct device *dev, struct device_attribute *attr, char *buf)
{ {
int i;
int psch = get_channel_sub_from_name(attr); int psch = get_channel_sub_from_name(attr);
int port = (psch>>4) &3; int port = (psch>>4) &3;
int sub_chn = psch &3; int sub_chn = psch &3;
...@@ -265,11 +263,11 @@ static ssize_t show_sensor(struct device *dev, struct device_attribute *attr, ch ...@@ -265,11 +263,11 @@ static ssize_t show_sensor(struct device *dev, struct device_attribute *attr, ch
} }
static ssize_t store_port_mux(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) static ssize_t store_port_mux(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
{ {
size_t len; // size_t len;
char name[80]; char name[80];
int port = get_channel_from_name(attr); int port = get_channel_from_name(attr);
int i, code, rslt; int rslt;
if (sscanf(buf, "%79s", name, &len)){ if (sscanf(buf, "%79s", name)){
if ((rslt = set_detected_mux_code( port, get_code_by_name(name, DETECT_MUX)))<0) if ((rslt = set_detected_mux_code( port, get_code_by_name(name, DETECT_MUX)))<0)
return rslt; return rslt;
...@@ -278,13 +276,13 @@ static ssize_t store_port_mux(struct device *dev, struct device_attribute *attr, ...@@ -278,13 +276,13 @@ static ssize_t store_port_mux(struct device *dev, struct device_attribute *attr,
} }
static ssize_t store_sensor(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) static ssize_t store_sensor(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
{ {
size_t len; // size_t len;
char name[80]; char name[80];
int psch = get_channel_sub_from_name(attr); int psch = get_channel_sub_from_name(attr);
int port = (psch>>4) &3; int port = (psch>>4) &3;
int sub_chn = psch &3; int sub_chn = psch &3;
int i, rslt; int rslt;
if (sscanf(buf, "%79s", name, &len)){ if (sscanf(buf, "%79s", name)){
if ((rslt = set_detected_sensor_code(port, sub_chn, get_code_by_name(name, DETECT_SENSOR)))<0) if ((rslt = set_detected_sensor_code(port, sub_chn, get_code_by_name(name, DETECT_SENSOR)))<0)
return rslt; return rslt;
} }
......
...@@ -44,7 +44,6 @@ ...@@ -44,7 +44,6 @@
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_fdt.h> #include <linux/of_fdt.h>
#include <linux/of_net.h> #include <linux/of_net.h>
#include <linux/platform_device.h>
#include <linux/sysfs.h> #include <linux/sysfs.h>
#include <linux/list.h> #include <linux/list.h>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment