From 07e3c2c7fecc7e48b40b9ef73a78a7e13aeccc17 Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Wed, 12 Jul 2023 16:44:28 +0200 Subject: [PATCH] Minor changes --- ina260.c | 45 ++++++++++++++++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 9 deletions(-) diff --git a/ina260.c b/ina260.c index b05ca31..672598f 100644 --- a/ina260.c +++ b/ina260.c @@ -271,6 +271,33 @@ static ssize_t attr_field_store(struct kobject *_kobj, } else if(INA260_IS_ATTR(ishct)){ if(ina260_set_register_3bits(cdata,reg,3,data)) return -EINVAL; + } else if(INA260_IS_ATTR(vbusct)){ + if(ina260_set_register_3bits(cdata,reg,6,data)) + return -EINVAL; + } else if(INA260_IS_ATTR(ocl)){ + if(ina260_set_register_1bit(cdata,reg,15,data)) + return -EINVAL; + } else if(INA260_IS_ATTR(ucl)){ + if(ina260_set_register_1bit(cdata,reg,14,data)) + return -EINVAL; + } else if(INA260_IS_ATTR(bol)){ + if(ina260_set_register_1bit(cdata,reg,13,data)) + return -EINVAL; + } else if(INA260_IS_ATTR(bul)){ + if(ina260_set_register_1bit(cdata,reg,12,data)) + return -EINVAL; + } else if(INA260_IS_ATTR(pol)){ + if(ina260_set_register_1bit(cdata,reg,11,data)) + return -EINVAL; + } else if(INA260_IS_ATTR(cnvr)){ + if(ina260_set_register_1bit(cdata,reg,10,data)) + return -EINVAL; + } else if(INA260_IS_ATTR(apol)){ + if(ina260_set_register_1bit(cdata,reg,1,data)) + return -EINVAL; + } else if(INA260_IS_ATTR(len)){ + if(ina260_set_register_1bit(cdata,reg,0,data)) + return -EINVAL; } return count; @@ -324,29 +351,29 @@ static struct kobj_attribute mode_field_attribute = static struct kobj_attribute ishct_field_attribute = __ATTR(ishct, 0664, attr_field_show, attr_field_store); static struct kobj_attribute vbusct_field_attribute = - __ATTR(vbusct, 0444, attr_field_show, attr_field_store); + __ATTR(vbusct, 0664, attr_field_show, attr_field_store); static struct kobj_attribute aff_field_attribute = __ATTR(aff, 0444, attr_field_show, attr_field_store); static struct kobj_attribute cvrf_field_attribute = __ATTR(cvrf, 0444, attr_field_show, attr_field_store); static struct kobj_attribute ocl_field_attribute = - __ATTR(ocl, 0444, attr_field_show, attr_field_store); + __ATTR(ocl, 0664, attr_field_show, attr_field_store); static struct kobj_attribute ucl_field_attribute = - __ATTR(ucl, 0444, attr_field_show, attr_field_store); + __ATTR(ucl, 0664, attr_field_show, attr_field_store); static struct kobj_attribute bol_field_attribute = - __ATTR(bol, 0444, attr_field_show, attr_field_store); + __ATTR(bol, 0664, attr_field_show, attr_field_store); static struct kobj_attribute bul_field_attribute = - __ATTR(bul, 0444, attr_field_show, attr_field_store); + __ATTR(bul, 0664, attr_field_show, attr_field_store); static struct kobj_attribute pol_field_attribute = - __ATTR(pol, 0444, attr_field_show, attr_field_store); + __ATTR(pol, 0664, attr_field_show, attr_field_store); static struct kobj_attribute cnvr_field_attribute = - __ATTR(cnvr, 0444, attr_field_show, attr_field_store); + __ATTR(cnvr, 0664, attr_field_show, attr_field_store); static struct kobj_attribute ovf_field_attribute = __ATTR(ovf, 0444, attr_field_show, attr_field_store); static struct kobj_attribute apol_field_attribute = - __ATTR(apol, 0444, attr_field_show, attr_field_store); + __ATTR(apol, 0664, attr_field_show, attr_field_store); static struct kobj_attribute len_field_attribute = - __ATTR(len, 0444, attr_field_show, attr_field_store); + __ATTR(len, 0664, attr_field_show, attr_field_store); static struct kobj_attribute did_field_attribute = __ATTR(did, 0444, attr_field_show, attr_field_store); static struct kobj_attribute rid_field_attribute =