Loading drivers/input/sensors/smi130/smi130.c +304 −304 File changed.Preview size limit exceeded, changes collapsed. Show changes drivers/input/sensors/smi130/smi130.h +89 −89 Original line number Diff line number Diff line Loading @@ -4606,10 +4606,10 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat0_single_tap_intr(u8 /**\name FUNCTION FOR ORIENT INTERRUPT STATUS */ /*************************************************/ /*! * @brief This API reads the orient status * @brief This API reads the orient_mbl status * from the register 0x1C bit 6 * flag is associated with a specific interrupt function. * It is set when the orient interrupt triggers. The * It is set when the orient_mbl interrupt triggers. The * setting of INT_LATCH controls if the * interrupt signal and hence the * respective interrupt flag will be Loading @@ -4619,27 +4619,27 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat0_single_tap_intr(u8 * * * * @param v_orient_intr_u8 : The status of orient interrupt * @param v_orient_mbl_intr_u8 : The status of orient_mbl interrupt * * @note For orient interrupt configuration use the following functions * @note For orient_mbl interrupt configuration use the following functions * @note STATUS * @note smi130_get_stat0_orient_intr() * @note smi130_get_stat0_orient_mbl_intr() * @note AXIS MAPPING * @note smi130_get_stat3_orient_xy() * @note smi130_get_stat3_orient_z() * @note smi130_set_intr_orient_axes_enable() * @note smi130_get_stat3_orient_mbl_xy() * @note smi130_get_stat3_orient_mbl_z() * @note smi130_set_intr_orient_mbl_axes_enable() * @note INTERRUPT MAPPING * @note smi130_set_intr_orient() * @note smi130_set_intr_orient_mbl() * @note INTERRUPT OUTPUT * @note smi130_set_intr_orient_ud_enable() * @note smi130_set_intr_orient_mbl_ud_enable() * @note THETA * @note smi130_set_intr_orient_theta() * @note smi130_set_intr_orient_mbl_theta() * @note HYSTERESIS * @note smi130_set_intr_orient_hyst() * @note smi130_set_intr_orient_mbl_hyst() * @note BLOCKING * @note smi130_set_intr_orient_blocking() * @note smi130_set_intr_orient_mbl_blocking() * @note MODE * @note smi130_set_intr_orient_mode() * @note smi130_set_intr_orient_mbl_mode() * * @return results of bus communication function * @retval 0 -> Success Loading @@ -4647,8 +4647,8 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat0_single_tap_intr(u8 * * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat0_orient_intr(u8 *v_orient_intr_u8); SMI130_RETURN_FUNCTION_TYPE smi130_get_stat0_orient_mbl_intr(u8 *v_orient_mbl_intr_u8); /**************************************************/ /**\name FUNCTION FOR FLAT INTERRUPT STATUS */ /*************************************************/ Loading Loading @@ -5184,11 +5184,11 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat3_high_g_sign(u8 /**\name FUNCTIONS FOR ORIENT XY AND Z INTERRUPT STATUS*/ /*************************************************/ /*! * @brief This API reads the status of orient_xy plane * @brief This API reads the status of orient_mbl_xy plane * from the register 0x1F bit 4 and 5 * * * @param v_orient_xy_u8 :The status of orient_xy plane * @param v_orient_mbl_xy_u8 :The status of orient_mbl_xy plane * value | status * -----------|------------- * 0x00 | portrait upright Loading @@ -5203,14 +5203,14 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat3_high_g_sign(u8 * * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat3_orient_xy(u8 *v_orient_xy_u8); SMI130_RETURN_FUNCTION_TYPE smi130_get_stat3_orient_mbl_xy(u8 *v_orient_mbl_xy_u8); /*! * @brief This API reads the status of orient z plane * @brief This API reads the status of orient_mbl z plane * from the register 0x1F bit 6 * * * @param v_orient_z_u8 :The status of orient z * @param v_orient_mbl_z_u8 :The status of orient_mbl z * value | status * -----------|------------- * 0x00 | upward looking Loading @@ -5222,8 +5222,8 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat3_orient_xy(u8 * * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat3_orient_z(u8 *v_orient_z_u8); SMI130_RETURN_FUNCTION_TYPE smi130_get_stat3_orient_mbl_z(u8 *v_orient_mbl_z_u8); /**************************************************/ /**\name FUNCTIONS FOR FLAT INTERRUPT STATUS*/ /*************************************************/ Loading Loading @@ -7050,7 +7050,7 @@ u8 v_channel_u8, u8 v_output_enable_u8); * @brief This API is used to get the latch duration * from the register 0x54 bit 0 to 3 * @brief This latch selection is not applicable for data ready, * orientation and flat interrupts. * orient_mblation and flat interrupts. * * * Loading Loading @@ -7088,7 +7088,7 @@ u8 *v_latch_intr_u8); * @brief This API is used to set the latch duration * from the register 0x54 bit 0 to 3 * @brief This latch selection is not applicable for data ready, * orientation and flat interrupts. * orient_mblation and flat interrupts. * * * Loading Loading @@ -7541,13 +7541,13 @@ u8 v_channel_u8, u8 v_intr_single_tap_u8); * @brief interrupt2 bit 6 in the register 0x57 * * * @param v_channel_u8: The value of orient interrupt selection * @param v_channel_u8: The value of orient_mbl interrupt selection * v_channel_u8 | interrupt * ---------------|--------------- * 0 | SMI130_INTR1_MAP_ORIENT * 1 | SMI130_INTR2_MAP_ORIENT * * @param v_intr_orient_u8 : The value of orient enable * @param v_intr_orient_mbl_u8 : The value of orient_mbl enable * value | interrupt enable * ----------|------------------- * 0x01 | SMI130_ENABLE Loading @@ -7561,8 +7561,8 @@ u8 v_channel_u8, u8 v_intr_single_tap_u8); * * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_orient( u8 v_channel_u8, u8 *v_intr_orient_u8); SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_orient_mbl( u8 v_channel_u8, u8 *v_intr_orient_mbl_u8); /*! * @brief Write the Orient interrupt * interrupt mapped to interrupt1 Loading @@ -7571,13 +7571,13 @@ u8 v_channel_u8, u8 *v_intr_orient_u8); * @brief interrupt2 bit 6 in the register 0x57 * * * @param v_channel_u8: The value of orient interrupt selection * @param v_channel_u8: The value of orient_mbl interrupt selection * v_channel_u8 | interrupt * ---------------|--------------- * 0 | SMI130_INTR1_MAP_ORIENT * 1 | SMI130_INTR2_MAP_ORIENT * * @param v_intr_orient_u8 : The value of orient enable * @param v_intr_orient_mbl_u8 : The value of orient_mbl enable * value | interrupt enable * ----------|------------------- * 0x01 | SMI130_ENABLE Loading @@ -7591,8 +7591,8 @@ u8 v_channel_u8, u8 *v_intr_orient_u8); * * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_orient( u8 v_channel_u8, u8 v_intr_orient_u8); SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_orient_mbl( u8 v_channel_u8, u8 v_intr_orient_mbl_u8); /*! * @brief Reads the Flat interrupt * mapped to interrupt1 Loading Loading @@ -8965,10 +8965,10 @@ u8 v_tap_thres_u8); /**\name FUNCTION FOR ORIENT MODE CONFIGURATION*/ /***************************************************************/ /*! * @brief This API read the threshold for orientation interrupt * @brief This API read the threshold for orient_mblation interrupt * from the register 0x65 bit 0 and 1 * * @param v_orient_mode_u8 : The value of threshold for orientation * @param v_orient_mbl_mode_u8 : The value of threshold for orient_mblation * value | Behaviour * ----------|------------------- * 0x00 | symmetrical Loading @@ -8984,13 +8984,13 @@ u8 v_tap_thres_u8); * * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_orient_mode( u8 *v_orient_mode_u8); SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_orient_mbl_mode( u8 *v_orient_mbl_mode_u8); /*! * @brief This API write the threshold for orientation interrupt * @brief This API write the threshold for orient_mblation interrupt * from the register 0x65 bit 0 and 1 * * @param v_orient_mode_u8 : The value of threshold for orientation * @param v_orient_mbl_mode_u8 : The value of threshold for orient_mblation * value | Behaviour * ----------|------------------- * 0x00 | symmetrical Loading @@ -9006,17 +9006,17 @@ u8 *v_orient_mode_u8); * * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_orient_mode( u8 v_orient_mode_u8); SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_orient_mbl_mode( u8 v_orient_mbl_mode_u8); /***************************************************************/ /**\name FUNCTION FOR ORIENT BLOCKING CONFIGURATION*/ /***************************************************************/ /*! * @brief This API read the orient blocking mode * that is used for the generation of the orientation interrupt. * @brief This API read the orient_mbl blocking mode * that is used for the generation of the orient_mblation interrupt. * from the register 0x65 bit 2 and 3 * * @param v_orient_blocking_u8 : The value of orient blocking mode * @param v_orient_mbl_blocking_u8 : The value of orient_mbl blocking mode * value | Behaviour * ----------|------------------- * 0x00 | No blocking Loading @@ -9025,7 +9025,7 @@ u8 v_orient_mode_u8); * - | 0.2g or acceleration in any axis > 1.5g * 0x03 | Theta blocking or acceleration slope in any axis > * - | 0.4g or acceleration in any axis > * - | 1.5g and value of orient is not stable * - | 1.5g and value of orient_mbl is not stable * - | for at least 100 ms * * Loading @@ -9036,14 +9036,14 @@ u8 v_orient_mode_u8); * * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_orient_blocking( u8 *v_orient_blocking_u8); SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_orient_mbl_blocking( u8 *v_orient_mbl_blocking_u8); /*! * @brief This API write the orient blocking mode * that is used for the generation of the orientation interrupt. * @brief This API write the orient_mbl blocking mode * that is used for the generation of the orient_mblation interrupt. * from the register 0x65 bit 2 and 3 * * @param v_orient_blocking_u8 : The value of orient blocking mode * @param v_orient_mbl_blocking_u8 : The value of orient_mbl blocking mode * value | Behaviour * ----------|------------------- * 0x00 | No blocking Loading @@ -9052,7 +9052,7 @@ u8 *v_orient_blocking_u8); * - | 0.2g or acceleration in any axis > 1.5g * 0x03 | Theta blocking or acceleration slope in any axis > * - | 0.4g or acceleration in any axis > * - | 1.5g and value of orient is not stable * - | 1.5g and value of orient_mbl is not stable * - | for at least 100 ms * * Loading @@ -9063,8 +9063,8 @@ u8 *v_orient_blocking_u8); * * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_orient_blocking( u8 v_orient_blocking_u8); SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_orient_mbl_blocking( u8 v_orient_mbl_blocking_u8); /***************************************************************/ /**\name FUNCTION FOR ORIENT HYSTERESIS CONFIGURATION*/ /***************************************************************/ Loading @@ -9074,7 +9074,7 @@ u8 v_orient_blocking_u8); * * * * @param v_orient_hyst_u8 : The value of orient hysteresis * @param v_orient_mbl_hyst_u8 : The value of orient_mbl hysteresis * * @note 1 LSB corresponds to 62.5 mg, * irrespective of the selected accel range Loading @@ -9086,15 +9086,15 @@ u8 v_orient_blocking_u8); * * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_orient_hyst( u8 *v_orient_hyst_u8); SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_orient_mbl_hyst( u8 *v_orient_mbl_hyst_u8); /*! * @brief This API write Orient interrupt * hysteresis, from the register 0x64 bit 4 to 7 * * * * @param v_orient_hyst_u8 : The value of orient hysteresis * @param v_orient_mbl_hyst_u8 : The value of orient_mbl hysteresis * * @note 1 LSB corresponds to 62.5 mg, * irrespective of the selected accel range Loading @@ -9106,8 +9106,8 @@ u8 *v_orient_hyst_u8); * * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_orient_hyst( u8 v_orient_hyst_u8); SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_orient_mbl_hyst( u8 v_orient_mbl_hyst_u8); /***************************************************************/ /**\name FUNCTION FOR ORIENT THETA CONFIGURATION*/ /***************************************************************/ Loading @@ -9115,7 +9115,7 @@ u8 v_orient_hyst_u8); * @brief This API read Orient * blocking angle (0 to 44.8) from the register 0x66 bit 0 to 5 * * @param v_orient_theta_u8 : The value of Orient blocking angle * @param v_orient_mbl_theta_u8 : The value of Orient blocking angle * * * Loading @@ -9125,13 +9125,13 @@ u8 v_orient_hyst_u8); * * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_orient_theta( u8 *v_orient_theta_u8); SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_orient_mbl_theta( u8 *v_orient_mbl_theta_u8); /*! * @brief This API write Orient * blocking angle (0 to 44.8) from the register 0x66 bit 0 to 5 * * @param v_orient_theta_u8 : The value of Orient blocking angle * @param v_orient_mbl_theta_u8 : The value of Orient blocking angle * * * Loading @@ -9141,20 +9141,20 @@ u8 *v_orient_theta_u8); * * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_orient_theta( u8 v_orient_theta_u8); SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_orient_mbl_theta( u8 v_orient_mbl_theta_u8); /***************************************************************/ /**\name FUNCTION FOR ORIENT OUTPUT ENABLE CONFIGURATION*/ /***************************************************************/ /*! * @brief This API read orient change * @brief This API read orient_mbl change * of up/down bit from the register 0x66 bit 6 * * @param v_orient_ud_u8 : The value of orient change of up/down * @param v_orient_mbl_ud_u8 : The value of orient_mbl change of up/down * value | Behaviour * ----------|------------------- * 0x00 | Is ignored * 0x01 | Generates orientation interrupt * 0x01 | Generates orient_mblation interrupt * * * @return results of bus communication function Loading @@ -9163,17 +9163,17 @@ u8 v_orient_theta_u8); * * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_orient_ud_enable( u8 *v_orient_ud_u8); SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_orient_mbl_ud_enable( u8 *v_orient_mbl_ud_u8); /*! * @brief This API write orient change * @brief This API write orient_mbl change * of up/down bit from the register 0x66 bit 6 * * @param v_orient_ud_u8 : The value of orient change of up/down * @param v_orient_mbl_ud_u8 : The value of orient_mbl change of up/down * value | Behaviour * ----------|------------------- * 0x00 | Is ignored * 0x01 | Generates orientation interrupt * 0x01 | Generates orient_mblation interrupt * * * @return results of bus communication function Loading @@ -9182,20 +9182,20 @@ u8 *v_orient_ud_u8); * * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_orient_ud_enable( u8 v_orient_ud_u8); SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_orient_mbl_ud_enable( u8 v_orient_mbl_ud_u8); /***************************************************************/ /**\name FUNCTION FOR ORIENT AXIS ENABLE CONFIGURATION*/ /***************************************************************/ /*! * @brief This API read orientation axes changes * @brief This API read orient_mblation axes changes * from the register 0x66 bit 7 * * @param v_orient_axes_u8 : The value of orient axes assignment * @param v_orient_mbl_axes_u8 : The value of orient_mbl axes assignment * value | Behaviour | Name * ----------|--------------------|------ * 0x00 | x = x, y = y, z = z|orient_ax_noex * 0x01 | x = y, y = z, z = x|orient_ax_ex * 0x00 | x = x, y = y, z = z|orient_mbl_ax_noex * 0x01 | x = y, y = z, z = x|orient_mbl_ax_ex * * * @return results of bus communication function Loading @@ -9204,17 +9204,17 @@ u8 v_orient_ud_u8); * * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_orient_axes_enable( u8 *v_orient_axes_u8); SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_orient_mbl_axes_enable( u8 *v_orient_mbl_axes_u8); /*! * @brief This API write orientation axes changes * @brief This API write orient_mblation axes changes * from the register 0x66 bit 7 * * @param v_orient_axes_u8 : The value of orient axes assignment * @param v_orient_mbl_axes_u8 : The value of orient_mbl axes assignment * value | Behaviour | Name * ----------|--------------------|------ * 0x00 | x = x, y = y, z = z|orient_ax_noex * 0x01 | x = y, y = z, z = x|orient_ax_ex * 0x00 | x = x, y = y, z = z|orient_mbl_ax_noex * 0x01 | x = y, y = z, z = x|orient_mbl_ax_ex * * * @return results of bus communication function Loading @@ -9223,8 +9223,8 @@ u8 *v_orient_axes_u8); * * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_orient_axes_enable( u8 v_orient_axes_u8); SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_orient_mbl_axes_enable( u8 v_orient_mbl_axes_u8); /***************************************************************/ /**\name FUNCTION FOR FLAT THETA CONFIGURATION*/ /***************************************************************/ Loading Loading @@ -10928,7 +10928,7 @@ SMI130_RETURN_FUNCTION_TYPE smi130_bmm150_mag_wakeup(void); * * */ SMI130_RETURN_FUNCTION_TYPE smi130_read_bmm150_mag_trim(void); SMI130_RETURN_FUNCTION_TYPE smi130_read_bmm150_mag_trim_mbl(void); /*! * @brief This function used for read the compensated value of mag * Before start reading the mag compensated data's Loading drivers/input/sensors/smi130/smi130_acc.c +42 −42 Original line number Diff line number Diff line Loading @@ -2391,7 +2391,7 @@ static int smi130_acc_get_slope_sign(struct i2c_client *client, unsigned char } #endif static int smi130_acc_get_orient_status(struct i2c_client *client, unsigned char static int smi130_acc_get_orient_mbl_status(struct i2c_client *client, unsigned char *intstatus) { int comres = 0; Loading @@ -2405,7 +2405,7 @@ static int smi130_acc_get_orient_status(struct i2c_client *client, unsigned char return comres; } static int smi130_acc_get_orient_flat_status(struct i2c_client *client, unsigned static int smi130_acc_get_orient_mbl_flat_status(struct i2c_client *client, unsigned char *intstatus) { int comres = 0; Loading Loading @@ -2808,7 +2808,7 @@ static int smi130_acc_get_tap_samp(struct i2c_client *client, unsigned char *sta return comres; } static int smi130_acc_set_orient_mode(struct i2c_client *client, unsigned char mode) static int smi130_acc_set_orient_mbl_mode(struct i2c_client *client, unsigned char mode) { int comres = 0; unsigned char data = 0; Loading @@ -2821,7 +2821,7 @@ static int smi130_acc_set_orient_mode(struct i2c_client *client, unsigned char m return comres; } static int smi130_acc_get_orient_mode(struct i2c_client *client, unsigned char static int smi130_acc_get_orient_mbl_mode(struct i2c_client *client, unsigned char *status) { int comres = 0; Loading @@ -2834,7 +2834,7 @@ static int smi130_acc_get_orient_mode(struct i2c_client *client, unsigned char return comres; } static int smi130_acc_set_orient_blocking(struct i2c_client *client, unsigned char static int smi130_acc_set_orient_mbl_blocking(struct i2c_client *client, unsigned char samp) { int comres = 0; Loading @@ -2849,7 +2849,7 @@ static int smi130_acc_set_orient_blocking(struct i2c_client *client, unsigned ch return comres; } static int smi130_acc_get_orient_blocking(struct i2c_client *client, unsigned char static int smi130_acc_get_orient_mbl_blocking(struct i2c_client *client, unsigned char *status) { int comres = 0; Loading @@ -2862,21 +2862,21 @@ static int smi130_acc_get_orient_blocking(struct i2c_client *client, unsigned ch return comres; } static int smi130_acc_set_orient_hyst(struct i2c_client *client, unsigned char orienthyst) static int smi130_acc_set_orient_mbl_hyst(struct i2c_client *client, unsigned char orient_mblhyst) { int comres = 0; unsigned char data = 0; comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_ORIENT_HYST__REG, &data); data = SMI_ACC2X2_SET_BITSLICE(data, SMI_ACC2X2_ORIENT_HYST, orienthyst); data = SMI_ACC2X2_SET_BITSLICE(data, SMI_ACC2X2_ORIENT_HYST, orient_mblhyst); comres = smi130_acc_smbus_write_byte(client, SMI_ACC2X2_ORIENT_HYST__REG, &data); return comres; } static int smi130_acc_get_orient_hyst(struct i2c_client *client, unsigned char static int smi130_acc_get_orient_mbl_hyst(struct i2c_client *client, unsigned char *status) { int comres = 0; Loading Loading @@ -4541,21 +4541,21 @@ static ssize_t smi130_acc_tap_samp_store(struct device *dev, return count; } static ssize_t smi130_acc_orient_mode_show(struct device *dev, static ssize_t smi130_acc_orient_mbl_mode_show(struct device *dev, struct device_attribute *attr, char *buf) { unsigned char data = 0; struct i2c_client *client = to_i2c_client(dev); struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); if (smi130_acc_get_orient_mode(smi130_acc->smi130_acc_client, &data) < 0) if (smi130_acc_get_orient_mbl_mode(smi130_acc->smi130_acc_client, &data) < 0) return -EINVAL; return snprintf(buf, 16, "%d\n", data); } static ssize_t smi130_acc_orient_mode_store(struct device *dev, static ssize_t smi130_acc_orient_mbl_mode_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { Loading @@ -4568,28 +4568,28 @@ static ssize_t smi130_acc_orient_mode_store(struct device *dev, if (error) return error; if (smi130_acc_set_orient_mode(smi130_acc->smi130_acc_client, (unsigned char)data) < if (smi130_acc_set_orient_mbl_mode(smi130_acc->smi130_acc_client, (unsigned char)data) < 0) return -EINVAL; return count; } static ssize_t smi130_acc_orient_blocking_show(struct device *dev, static ssize_t smi130_acc_orient_mbl_blocking_show(struct device *dev, struct device_attribute *attr, char *buf) { unsigned char data = 0; struct i2c_client *client = to_i2c_client(dev); struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); if (smi130_acc_get_orient_blocking(smi130_acc->smi130_acc_client, &data) < 0) if (smi130_acc_get_orient_mbl_blocking(smi130_acc->smi130_acc_client, &data) < 0) return -EINVAL; return snprintf(buf, 16, "%d\n", data); } static ssize_t smi130_acc_orient_blocking_store(struct device *dev, static ssize_t smi130_acc_orient_mbl_blocking_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { Loading @@ -4602,27 +4602,27 @@ static ssize_t smi130_acc_orient_blocking_store(struct device *dev, if (error) return error; if (smi130_acc_set_orient_blocking(smi130_acc->smi130_acc_client, (unsigned if (smi130_acc_set_orient_mbl_blocking(smi130_acc->smi130_acc_client, (unsigned char)data) < 0) return -EINVAL; return count; } static ssize_t smi130_acc_orient_hyst_show(struct device *dev, static ssize_t smi130_acc_orient_mbl_hyst_show(struct device *dev, struct device_attribute *attr, char *buf) { unsigned char data = 0; struct i2c_client *client = to_i2c_client(dev); struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); if (smi130_acc_get_orient_hyst(smi130_acc->smi130_acc_client, &data) < 0) if (smi130_acc_get_orient_mbl_hyst(smi130_acc->smi130_acc_client, &data) < 0) return -EINVAL; return snprintf(buf, 16, "%d\n", data); } static ssize_t smi130_acc_orient_hyst_store(struct device *dev, static ssize_t smi130_acc_orient_mbl_hyst_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { Loading @@ -4635,14 +4635,14 @@ static ssize_t smi130_acc_orient_hyst_store(struct device *dev, if (error) return error; if (smi130_acc_set_orient_hyst(smi130_acc->smi130_acc_client, (unsigned char)data) < if (smi130_acc_set_orient_mbl_hyst(smi130_acc->smi130_acc_client, (unsigned char)data) < 0) return -EINVAL; return count; } static ssize_t smi130_acc_orient_theta_show(struct device *dev, static ssize_t smi130_acc_orient_mbl_theta_show(struct device *dev, struct device_attribute *attr, char *buf) { unsigned char data = 0; Loading @@ -4656,7 +4656,7 @@ static ssize_t smi130_acc_orient_theta_show(struct device *dev, } static ssize_t smi130_acc_orient_theta_store(struct device *dev, static ssize_t smi130_acc_orient_mbl_theta_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { Loading Loading @@ -6513,14 +6513,14 @@ static DEVICE_ATTR(tap_shock, S_IRUGO | S_IWUSR, smi130_acc_tap_shock_show, smi130_acc_tap_shock_store); static DEVICE_ATTR(tap_samp, S_IRUGO | S_IWUSR, smi130_acc_tap_samp_show, smi130_acc_tap_samp_store); static DEVICE_ATTR(orient_mode, S_IRUGO | S_IWUSR, smi130_acc_orient_mode_show, smi130_acc_orient_mode_store); static DEVICE_ATTR(orient_blocking, S_IRUGO | S_IWUSR, smi130_acc_orient_blocking_show, smi130_acc_orient_blocking_store); static DEVICE_ATTR(orient_hyst, S_IRUGO | S_IWUSR, smi130_acc_orient_hyst_show, smi130_acc_orient_hyst_store); static DEVICE_ATTR(orient_theta, S_IRUGO | S_IWUSR, smi130_acc_orient_theta_show, smi130_acc_orient_theta_store); static DEVICE_ATTR(orient_mbl_mode, S_IRUGO | S_IWUSR, smi130_acc_orient_mbl_mode_show, smi130_acc_orient_mbl_mode_store); static DEVICE_ATTR(orient_mbl_blocking, S_IRUGO | S_IWUSR, smi130_acc_orient_mbl_blocking_show, smi130_acc_orient_mbl_blocking_store); static DEVICE_ATTR(orient_mbl_hyst, S_IRUGO | S_IWUSR, smi130_acc_orient_mbl_hyst_show, smi130_acc_orient_mbl_hyst_store); static DEVICE_ATTR(orient_mbl_theta, S_IRUGO | S_IWUSR, smi130_acc_orient_mbl_theta_show, smi130_acc_orient_mbl_theta_store); static DEVICE_ATTR(flat_theta, S_IRUGO | S_IWUSR, smi130_acc_flat_theta_show, smi130_acc_flat_theta_store); static DEVICE_ATTR(flat_hold_time, S_IRUGO | S_IWUSR, Loading Loading @@ -6591,10 +6591,10 @@ static struct attribute *smi130_acc_attributes[] = { &dev_attr_tap_quiet.attr, &dev_attr_tap_shock.attr, &dev_attr_tap_samp.attr, &dev_attr_orient_mode.attr, &dev_attr_orient_blocking.attr, &dev_attr_orient_hyst.attr, &dev_attr_orient_theta.attr, &dev_attr_orient_mbl_mode.attr, &dev_attr_orient_mbl_blocking.attr, &dev_attr_orient_mbl_hyst.attr, &dev_attr_orient_mbl_theta.attr, &dev_attr_flat_theta.attr, &dev_attr_flat_hold_time.attr, &dev_attr_selftest.attr, Loading Loading @@ -6646,7 +6646,7 @@ static struct attribute_group smi130_acc_double_tap_attribute_group = { #if defined(SMI_ACC2X2_ENABLE_INT1) || defined(SMI_ACC2X2_ENABLE_INT2) unsigned char *orient[] = {"upward looking portrait upright", unsigned char *orient_mbl[] = {"upward looking portrait upright", "upward looking portrait upside-down", "upward looking landscape left", "upward looking landscape right", Loading Loading @@ -6886,10 +6886,10 @@ static void smi130_acc_irq_work_func(struct work_struct *work) #endif case 0x40: smi130_acc_get_orient_status(smi130_acc->smi130_acc_client, smi130_acc_get_orient_mbl_status(smi130_acc->smi130_acc_client, &first_value); PINFO("orient interrupt happened,%s\n", orient[first_value]); PINFO("orient_mbl interrupt happened,%s\n", orient_mbl[first_value]); if (first_value == 0) input_report_abs(smi130_acc->dev_interrupt, ORIENT_INTERRUPT, Loading Loading @@ -6924,7 +6924,7 @@ static void smi130_acc_irq_work_func(struct work_struct *work) DOWNWARD_LANDSCAPE_RIGHT_INTERRUPT_HAPPENED); break; case 0x80: smi130_acc_get_orient_flat_status(smi130_acc->smi130_acc_client, smi130_acc_get_orient_mbl_flat_status(smi130_acc->smi130_acc_client, &sign_value); PINFO("flat interrupt happened,flat status is %d\n", sign_value); Loading Loading @@ -7054,7 +7054,7 @@ static int smi130_acc_probe(struct i2c_client *client, smi130_acc_set_Int_Mode(client, 1);/*latch interrupt 250ms*/ /* do not open any interrupt here */ /*10,orient /*10,orient_mbl 11,flat*/ /* smi130_acc_set_Int_Enable(client, 10, 1); */ /* smi130_acc_set_Int_Enable(client, 11, 1); */ Loading drivers/input/sensors/smi130/smi130_driver.c +3 −3 Original line number Diff line number Diff line Loading @@ -135,7 +135,7 @@ #define I2C_BURST_READ_MAX_LEN (256) #define SMI130_STORE_COUNT (6000) #define LMADA (1) uint64_t g_current_apts_us; uint64_t g_current_apts_us_mbl; enum SMI_SENSOR_INT_T { Loading Loading @@ -285,7 +285,7 @@ enum SMI_CALIBRATION_STATUS_TYPE { SMI_ACC_Z_FAST_CALI_RDY }; unsigned int reg_op_addr; unsigned int reg_op_addr_mbl; static const int smi_pmu_cmd_acc_arr[SMI_ACC_PM_MAX] = { /*!smi pmu for acc normal, low power1, Loading Loading @@ -372,7 +372,7 @@ struct smi130_store_info_t { uint64_t fifo_time; }; uint64_t get_current_timestamp(void) uint64_t get_current_timestamp_mbl(void) { uint64_t ts_ap; struct timespec tmp_time; Loading Loading
drivers/input/sensors/smi130/smi130.c +304 −304 File changed.Preview size limit exceeded, changes collapsed. Show changes
drivers/input/sensors/smi130/smi130.h +89 −89 Original line number Diff line number Diff line Loading @@ -4606,10 +4606,10 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat0_single_tap_intr(u8 /**\name FUNCTION FOR ORIENT INTERRUPT STATUS */ /*************************************************/ /*! * @brief This API reads the orient status * @brief This API reads the orient_mbl status * from the register 0x1C bit 6 * flag is associated with a specific interrupt function. * It is set when the orient interrupt triggers. The * It is set when the orient_mbl interrupt triggers. The * setting of INT_LATCH controls if the * interrupt signal and hence the * respective interrupt flag will be Loading @@ -4619,27 +4619,27 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat0_single_tap_intr(u8 * * * * @param v_orient_intr_u8 : The status of orient interrupt * @param v_orient_mbl_intr_u8 : The status of orient_mbl interrupt * * @note For orient interrupt configuration use the following functions * @note For orient_mbl interrupt configuration use the following functions * @note STATUS * @note smi130_get_stat0_orient_intr() * @note smi130_get_stat0_orient_mbl_intr() * @note AXIS MAPPING * @note smi130_get_stat3_orient_xy() * @note smi130_get_stat3_orient_z() * @note smi130_set_intr_orient_axes_enable() * @note smi130_get_stat3_orient_mbl_xy() * @note smi130_get_stat3_orient_mbl_z() * @note smi130_set_intr_orient_mbl_axes_enable() * @note INTERRUPT MAPPING * @note smi130_set_intr_orient() * @note smi130_set_intr_orient_mbl() * @note INTERRUPT OUTPUT * @note smi130_set_intr_orient_ud_enable() * @note smi130_set_intr_orient_mbl_ud_enable() * @note THETA * @note smi130_set_intr_orient_theta() * @note smi130_set_intr_orient_mbl_theta() * @note HYSTERESIS * @note smi130_set_intr_orient_hyst() * @note smi130_set_intr_orient_mbl_hyst() * @note BLOCKING * @note smi130_set_intr_orient_blocking() * @note smi130_set_intr_orient_mbl_blocking() * @note MODE * @note smi130_set_intr_orient_mode() * @note smi130_set_intr_orient_mbl_mode() * * @return results of bus communication function * @retval 0 -> Success Loading @@ -4647,8 +4647,8 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat0_single_tap_intr(u8 * * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat0_orient_intr(u8 *v_orient_intr_u8); SMI130_RETURN_FUNCTION_TYPE smi130_get_stat0_orient_mbl_intr(u8 *v_orient_mbl_intr_u8); /**************************************************/ /**\name FUNCTION FOR FLAT INTERRUPT STATUS */ /*************************************************/ Loading Loading @@ -5184,11 +5184,11 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat3_high_g_sign(u8 /**\name FUNCTIONS FOR ORIENT XY AND Z INTERRUPT STATUS*/ /*************************************************/ /*! * @brief This API reads the status of orient_xy plane * @brief This API reads the status of orient_mbl_xy plane * from the register 0x1F bit 4 and 5 * * * @param v_orient_xy_u8 :The status of orient_xy plane * @param v_orient_mbl_xy_u8 :The status of orient_mbl_xy plane * value | status * -----------|------------- * 0x00 | portrait upright Loading @@ -5203,14 +5203,14 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat3_high_g_sign(u8 * * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat3_orient_xy(u8 *v_orient_xy_u8); SMI130_RETURN_FUNCTION_TYPE smi130_get_stat3_orient_mbl_xy(u8 *v_orient_mbl_xy_u8); /*! * @brief This API reads the status of orient z plane * @brief This API reads the status of orient_mbl z plane * from the register 0x1F bit 6 * * * @param v_orient_z_u8 :The status of orient z * @param v_orient_mbl_z_u8 :The status of orient_mbl z * value | status * -----------|------------- * 0x00 | upward looking Loading @@ -5222,8 +5222,8 @@ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat3_orient_xy(u8 * * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_stat3_orient_z(u8 *v_orient_z_u8); SMI130_RETURN_FUNCTION_TYPE smi130_get_stat3_orient_mbl_z(u8 *v_orient_mbl_z_u8); /**************************************************/ /**\name FUNCTIONS FOR FLAT INTERRUPT STATUS*/ /*************************************************/ Loading Loading @@ -7050,7 +7050,7 @@ u8 v_channel_u8, u8 v_output_enable_u8); * @brief This API is used to get the latch duration * from the register 0x54 bit 0 to 3 * @brief This latch selection is not applicable for data ready, * orientation and flat interrupts. * orient_mblation and flat interrupts. * * * Loading Loading @@ -7088,7 +7088,7 @@ u8 *v_latch_intr_u8); * @brief This API is used to set the latch duration * from the register 0x54 bit 0 to 3 * @brief This latch selection is not applicable for data ready, * orientation and flat interrupts. * orient_mblation and flat interrupts. * * * Loading Loading @@ -7541,13 +7541,13 @@ u8 v_channel_u8, u8 v_intr_single_tap_u8); * @brief interrupt2 bit 6 in the register 0x57 * * * @param v_channel_u8: The value of orient interrupt selection * @param v_channel_u8: The value of orient_mbl interrupt selection * v_channel_u8 | interrupt * ---------------|--------------- * 0 | SMI130_INTR1_MAP_ORIENT * 1 | SMI130_INTR2_MAP_ORIENT * * @param v_intr_orient_u8 : The value of orient enable * @param v_intr_orient_mbl_u8 : The value of orient_mbl enable * value | interrupt enable * ----------|------------------- * 0x01 | SMI130_ENABLE Loading @@ -7561,8 +7561,8 @@ u8 v_channel_u8, u8 v_intr_single_tap_u8); * * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_orient( u8 v_channel_u8, u8 *v_intr_orient_u8); SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_orient_mbl( u8 v_channel_u8, u8 *v_intr_orient_mbl_u8); /*! * @brief Write the Orient interrupt * interrupt mapped to interrupt1 Loading @@ -7571,13 +7571,13 @@ u8 v_channel_u8, u8 *v_intr_orient_u8); * @brief interrupt2 bit 6 in the register 0x57 * * * @param v_channel_u8: The value of orient interrupt selection * @param v_channel_u8: The value of orient_mbl interrupt selection * v_channel_u8 | interrupt * ---------------|--------------- * 0 | SMI130_INTR1_MAP_ORIENT * 1 | SMI130_INTR2_MAP_ORIENT * * @param v_intr_orient_u8 : The value of orient enable * @param v_intr_orient_mbl_u8 : The value of orient_mbl enable * value | interrupt enable * ----------|------------------- * 0x01 | SMI130_ENABLE Loading @@ -7591,8 +7591,8 @@ u8 v_channel_u8, u8 *v_intr_orient_u8); * * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_orient( u8 v_channel_u8, u8 v_intr_orient_u8); SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_orient_mbl( u8 v_channel_u8, u8 v_intr_orient_mbl_u8); /*! * @brief Reads the Flat interrupt * mapped to interrupt1 Loading Loading @@ -8965,10 +8965,10 @@ u8 v_tap_thres_u8); /**\name FUNCTION FOR ORIENT MODE CONFIGURATION*/ /***************************************************************/ /*! * @brief This API read the threshold for orientation interrupt * @brief This API read the threshold for orient_mblation interrupt * from the register 0x65 bit 0 and 1 * * @param v_orient_mode_u8 : The value of threshold for orientation * @param v_orient_mbl_mode_u8 : The value of threshold for orient_mblation * value | Behaviour * ----------|------------------- * 0x00 | symmetrical Loading @@ -8984,13 +8984,13 @@ u8 v_tap_thres_u8); * * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_orient_mode( u8 *v_orient_mode_u8); SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_orient_mbl_mode( u8 *v_orient_mbl_mode_u8); /*! * @brief This API write the threshold for orientation interrupt * @brief This API write the threshold for orient_mblation interrupt * from the register 0x65 bit 0 and 1 * * @param v_orient_mode_u8 : The value of threshold for orientation * @param v_orient_mbl_mode_u8 : The value of threshold for orient_mblation * value | Behaviour * ----------|------------------- * 0x00 | symmetrical Loading @@ -9006,17 +9006,17 @@ u8 *v_orient_mode_u8); * * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_orient_mode( u8 v_orient_mode_u8); SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_orient_mbl_mode( u8 v_orient_mbl_mode_u8); /***************************************************************/ /**\name FUNCTION FOR ORIENT BLOCKING CONFIGURATION*/ /***************************************************************/ /*! * @brief This API read the orient blocking mode * that is used for the generation of the orientation interrupt. * @brief This API read the orient_mbl blocking mode * that is used for the generation of the orient_mblation interrupt. * from the register 0x65 bit 2 and 3 * * @param v_orient_blocking_u8 : The value of orient blocking mode * @param v_orient_mbl_blocking_u8 : The value of orient_mbl blocking mode * value | Behaviour * ----------|------------------- * 0x00 | No blocking Loading @@ -9025,7 +9025,7 @@ u8 v_orient_mode_u8); * - | 0.2g or acceleration in any axis > 1.5g * 0x03 | Theta blocking or acceleration slope in any axis > * - | 0.4g or acceleration in any axis > * - | 1.5g and value of orient is not stable * - | 1.5g and value of orient_mbl is not stable * - | for at least 100 ms * * Loading @@ -9036,14 +9036,14 @@ u8 v_orient_mode_u8); * * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_orient_blocking( u8 *v_orient_blocking_u8); SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_orient_mbl_blocking( u8 *v_orient_mbl_blocking_u8); /*! * @brief This API write the orient blocking mode * that is used for the generation of the orientation interrupt. * @brief This API write the orient_mbl blocking mode * that is used for the generation of the orient_mblation interrupt. * from the register 0x65 bit 2 and 3 * * @param v_orient_blocking_u8 : The value of orient blocking mode * @param v_orient_mbl_blocking_u8 : The value of orient_mbl blocking mode * value | Behaviour * ----------|------------------- * 0x00 | No blocking Loading @@ -9052,7 +9052,7 @@ u8 *v_orient_blocking_u8); * - | 0.2g or acceleration in any axis > 1.5g * 0x03 | Theta blocking or acceleration slope in any axis > * - | 0.4g or acceleration in any axis > * - | 1.5g and value of orient is not stable * - | 1.5g and value of orient_mbl is not stable * - | for at least 100 ms * * Loading @@ -9063,8 +9063,8 @@ u8 *v_orient_blocking_u8); * * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_orient_blocking( u8 v_orient_blocking_u8); SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_orient_mbl_blocking( u8 v_orient_mbl_blocking_u8); /***************************************************************/ /**\name FUNCTION FOR ORIENT HYSTERESIS CONFIGURATION*/ /***************************************************************/ Loading @@ -9074,7 +9074,7 @@ u8 v_orient_blocking_u8); * * * * @param v_orient_hyst_u8 : The value of orient hysteresis * @param v_orient_mbl_hyst_u8 : The value of orient_mbl hysteresis * * @note 1 LSB corresponds to 62.5 mg, * irrespective of the selected accel range Loading @@ -9086,15 +9086,15 @@ u8 v_orient_blocking_u8); * * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_orient_hyst( u8 *v_orient_hyst_u8); SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_orient_mbl_hyst( u8 *v_orient_mbl_hyst_u8); /*! * @brief This API write Orient interrupt * hysteresis, from the register 0x64 bit 4 to 7 * * * * @param v_orient_hyst_u8 : The value of orient hysteresis * @param v_orient_mbl_hyst_u8 : The value of orient_mbl hysteresis * * @note 1 LSB corresponds to 62.5 mg, * irrespective of the selected accel range Loading @@ -9106,8 +9106,8 @@ u8 *v_orient_hyst_u8); * * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_orient_hyst( u8 v_orient_hyst_u8); SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_orient_mbl_hyst( u8 v_orient_mbl_hyst_u8); /***************************************************************/ /**\name FUNCTION FOR ORIENT THETA CONFIGURATION*/ /***************************************************************/ Loading @@ -9115,7 +9115,7 @@ u8 v_orient_hyst_u8); * @brief This API read Orient * blocking angle (0 to 44.8) from the register 0x66 bit 0 to 5 * * @param v_orient_theta_u8 : The value of Orient blocking angle * @param v_orient_mbl_theta_u8 : The value of Orient blocking angle * * * Loading @@ -9125,13 +9125,13 @@ u8 v_orient_hyst_u8); * * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_orient_theta( u8 *v_orient_theta_u8); SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_orient_mbl_theta( u8 *v_orient_mbl_theta_u8); /*! * @brief This API write Orient * blocking angle (0 to 44.8) from the register 0x66 bit 0 to 5 * * @param v_orient_theta_u8 : The value of Orient blocking angle * @param v_orient_mbl_theta_u8 : The value of Orient blocking angle * * * Loading @@ -9141,20 +9141,20 @@ u8 *v_orient_theta_u8); * * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_orient_theta( u8 v_orient_theta_u8); SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_orient_mbl_theta( u8 v_orient_mbl_theta_u8); /***************************************************************/ /**\name FUNCTION FOR ORIENT OUTPUT ENABLE CONFIGURATION*/ /***************************************************************/ /*! * @brief This API read orient change * @brief This API read orient_mbl change * of up/down bit from the register 0x66 bit 6 * * @param v_orient_ud_u8 : The value of orient change of up/down * @param v_orient_mbl_ud_u8 : The value of orient_mbl change of up/down * value | Behaviour * ----------|------------------- * 0x00 | Is ignored * 0x01 | Generates orientation interrupt * 0x01 | Generates orient_mblation interrupt * * * @return results of bus communication function Loading @@ -9163,17 +9163,17 @@ u8 v_orient_theta_u8); * * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_orient_ud_enable( u8 *v_orient_ud_u8); SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_orient_mbl_ud_enable( u8 *v_orient_mbl_ud_u8); /*! * @brief This API write orient change * @brief This API write orient_mbl change * of up/down bit from the register 0x66 bit 6 * * @param v_orient_ud_u8 : The value of orient change of up/down * @param v_orient_mbl_ud_u8 : The value of orient_mbl change of up/down * value | Behaviour * ----------|------------------- * 0x00 | Is ignored * 0x01 | Generates orientation interrupt * 0x01 | Generates orient_mblation interrupt * * * @return results of bus communication function Loading @@ -9182,20 +9182,20 @@ u8 *v_orient_ud_u8); * * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_orient_ud_enable( u8 v_orient_ud_u8); SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_orient_mbl_ud_enable( u8 v_orient_mbl_ud_u8); /***************************************************************/ /**\name FUNCTION FOR ORIENT AXIS ENABLE CONFIGURATION*/ /***************************************************************/ /*! * @brief This API read orientation axes changes * @brief This API read orient_mblation axes changes * from the register 0x66 bit 7 * * @param v_orient_axes_u8 : The value of orient axes assignment * @param v_orient_mbl_axes_u8 : The value of orient_mbl axes assignment * value | Behaviour | Name * ----------|--------------------|------ * 0x00 | x = x, y = y, z = z|orient_ax_noex * 0x01 | x = y, y = z, z = x|orient_ax_ex * 0x00 | x = x, y = y, z = z|orient_mbl_ax_noex * 0x01 | x = y, y = z, z = x|orient_mbl_ax_ex * * * @return results of bus communication function Loading @@ -9204,17 +9204,17 @@ u8 v_orient_ud_u8); * * */ SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_orient_axes_enable( u8 *v_orient_axes_u8); SMI130_RETURN_FUNCTION_TYPE smi130_get_intr_orient_mbl_axes_enable( u8 *v_orient_mbl_axes_u8); /*! * @brief This API write orientation axes changes * @brief This API write orient_mblation axes changes * from the register 0x66 bit 7 * * @param v_orient_axes_u8 : The value of orient axes assignment * @param v_orient_mbl_axes_u8 : The value of orient_mbl axes assignment * value | Behaviour | Name * ----------|--------------------|------ * 0x00 | x = x, y = y, z = z|orient_ax_noex * 0x01 | x = y, y = z, z = x|orient_ax_ex * 0x00 | x = x, y = y, z = z|orient_mbl_ax_noex * 0x01 | x = y, y = z, z = x|orient_mbl_ax_ex * * * @return results of bus communication function Loading @@ -9223,8 +9223,8 @@ u8 *v_orient_axes_u8); * * */ SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_orient_axes_enable( u8 v_orient_axes_u8); SMI130_RETURN_FUNCTION_TYPE smi130_set_intr_orient_mbl_axes_enable( u8 v_orient_mbl_axes_u8); /***************************************************************/ /**\name FUNCTION FOR FLAT THETA CONFIGURATION*/ /***************************************************************/ Loading Loading @@ -10928,7 +10928,7 @@ SMI130_RETURN_FUNCTION_TYPE smi130_bmm150_mag_wakeup(void); * * */ SMI130_RETURN_FUNCTION_TYPE smi130_read_bmm150_mag_trim(void); SMI130_RETURN_FUNCTION_TYPE smi130_read_bmm150_mag_trim_mbl(void); /*! * @brief This function used for read the compensated value of mag * Before start reading the mag compensated data's Loading
drivers/input/sensors/smi130/smi130_acc.c +42 −42 Original line number Diff line number Diff line Loading @@ -2391,7 +2391,7 @@ static int smi130_acc_get_slope_sign(struct i2c_client *client, unsigned char } #endif static int smi130_acc_get_orient_status(struct i2c_client *client, unsigned char static int smi130_acc_get_orient_mbl_status(struct i2c_client *client, unsigned char *intstatus) { int comres = 0; Loading @@ -2405,7 +2405,7 @@ static int smi130_acc_get_orient_status(struct i2c_client *client, unsigned char return comres; } static int smi130_acc_get_orient_flat_status(struct i2c_client *client, unsigned static int smi130_acc_get_orient_mbl_flat_status(struct i2c_client *client, unsigned char *intstatus) { int comres = 0; Loading Loading @@ -2808,7 +2808,7 @@ static int smi130_acc_get_tap_samp(struct i2c_client *client, unsigned char *sta return comres; } static int smi130_acc_set_orient_mode(struct i2c_client *client, unsigned char mode) static int smi130_acc_set_orient_mbl_mode(struct i2c_client *client, unsigned char mode) { int comres = 0; unsigned char data = 0; Loading @@ -2821,7 +2821,7 @@ static int smi130_acc_set_orient_mode(struct i2c_client *client, unsigned char m return comres; } static int smi130_acc_get_orient_mode(struct i2c_client *client, unsigned char static int smi130_acc_get_orient_mbl_mode(struct i2c_client *client, unsigned char *status) { int comres = 0; Loading @@ -2834,7 +2834,7 @@ static int smi130_acc_get_orient_mode(struct i2c_client *client, unsigned char return comres; } static int smi130_acc_set_orient_blocking(struct i2c_client *client, unsigned char static int smi130_acc_set_orient_mbl_blocking(struct i2c_client *client, unsigned char samp) { int comres = 0; Loading @@ -2849,7 +2849,7 @@ static int smi130_acc_set_orient_blocking(struct i2c_client *client, unsigned ch return comres; } static int smi130_acc_get_orient_blocking(struct i2c_client *client, unsigned char static int smi130_acc_get_orient_mbl_blocking(struct i2c_client *client, unsigned char *status) { int comres = 0; Loading @@ -2862,21 +2862,21 @@ static int smi130_acc_get_orient_blocking(struct i2c_client *client, unsigned ch return comres; } static int smi130_acc_set_orient_hyst(struct i2c_client *client, unsigned char orienthyst) static int smi130_acc_set_orient_mbl_hyst(struct i2c_client *client, unsigned char orient_mblhyst) { int comres = 0; unsigned char data = 0; comres = smi130_acc_smbus_read_byte(client, SMI_ACC2X2_ORIENT_HYST__REG, &data); data = SMI_ACC2X2_SET_BITSLICE(data, SMI_ACC2X2_ORIENT_HYST, orienthyst); data = SMI_ACC2X2_SET_BITSLICE(data, SMI_ACC2X2_ORIENT_HYST, orient_mblhyst); comres = smi130_acc_smbus_write_byte(client, SMI_ACC2X2_ORIENT_HYST__REG, &data); return comres; } static int smi130_acc_get_orient_hyst(struct i2c_client *client, unsigned char static int smi130_acc_get_orient_mbl_hyst(struct i2c_client *client, unsigned char *status) { int comres = 0; Loading Loading @@ -4541,21 +4541,21 @@ static ssize_t smi130_acc_tap_samp_store(struct device *dev, return count; } static ssize_t smi130_acc_orient_mode_show(struct device *dev, static ssize_t smi130_acc_orient_mbl_mode_show(struct device *dev, struct device_attribute *attr, char *buf) { unsigned char data = 0; struct i2c_client *client = to_i2c_client(dev); struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); if (smi130_acc_get_orient_mode(smi130_acc->smi130_acc_client, &data) < 0) if (smi130_acc_get_orient_mbl_mode(smi130_acc->smi130_acc_client, &data) < 0) return -EINVAL; return snprintf(buf, 16, "%d\n", data); } static ssize_t smi130_acc_orient_mode_store(struct device *dev, static ssize_t smi130_acc_orient_mbl_mode_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { Loading @@ -4568,28 +4568,28 @@ static ssize_t smi130_acc_orient_mode_store(struct device *dev, if (error) return error; if (smi130_acc_set_orient_mode(smi130_acc->smi130_acc_client, (unsigned char)data) < if (smi130_acc_set_orient_mbl_mode(smi130_acc->smi130_acc_client, (unsigned char)data) < 0) return -EINVAL; return count; } static ssize_t smi130_acc_orient_blocking_show(struct device *dev, static ssize_t smi130_acc_orient_mbl_blocking_show(struct device *dev, struct device_attribute *attr, char *buf) { unsigned char data = 0; struct i2c_client *client = to_i2c_client(dev); struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); if (smi130_acc_get_orient_blocking(smi130_acc->smi130_acc_client, &data) < 0) if (smi130_acc_get_orient_mbl_blocking(smi130_acc->smi130_acc_client, &data) < 0) return -EINVAL; return snprintf(buf, 16, "%d\n", data); } static ssize_t smi130_acc_orient_blocking_store(struct device *dev, static ssize_t smi130_acc_orient_mbl_blocking_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { Loading @@ -4602,27 +4602,27 @@ static ssize_t smi130_acc_orient_blocking_store(struct device *dev, if (error) return error; if (smi130_acc_set_orient_blocking(smi130_acc->smi130_acc_client, (unsigned if (smi130_acc_set_orient_mbl_blocking(smi130_acc->smi130_acc_client, (unsigned char)data) < 0) return -EINVAL; return count; } static ssize_t smi130_acc_orient_hyst_show(struct device *dev, static ssize_t smi130_acc_orient_mbl_hyst_show(struct device *dev, struct device_attribute *attr, char *buf) { unsigned char data = 0; struct i2c_client *client = to_i2c_client(dev); struct smi130_acc_data *smi130_acc = i2c_get_clientdata(client); if (smi130_acc_get_orient_hyst(smi130_acc->smi130_acc_client, &data) < 0) if (smi130_acc_get_orient_mbl_hyst(smi130_acc->smi130_acc_client, &data) < 0) return -EINVAL; return snprintf(buf, 16, "%d\n", data); } static ssize_t smi130_acc_orient_hyst_store(struct device *dev, static ssize_t smi130_acc_orient_mbl_hyst_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { Loading @@ -4635,14 +4635,14 @@ static ssize_t smi130_acc_orient_hyst_store(struct device *dev, if (error) return error; if (smi130_acc_set_orient_hyst(smi130_acc->smi130_acc_client, (unsigned char)data) < if (smi130_acc_set_orient_mbl_hyst(smi130_acc->smi130_acc_client, (unsigned char)data) < 0) return -EINVAL; return count; } static ssize_t smi130_acc_orient_theta_show(struct device *dev, static ssize_t smi130_acc_orient_mbl_theta_show(struct device *dev, struct device_attribute *attr, char *buf) { unsigned char data = 0; Loading @@ -4656,7 +4656,7 @@ static ssize_t smi130_acc_orient_theta_show(struct device *dev, } static ssize_t smi130_acc_orient_theta_store(struct device *dev, static ssize_t smi130_acc_orient_mbl_theta_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { Loading Loading @@ -6513,14 +6513,14 @@ static DEVICE_ATTR(tap_shock, S_IRUGO | S_IWUSR, smi130_acc_tap_shock_show, smi130_acc_tap_shock_store); static DEVICE_ATTR(tap_samp, S_IRUGO | S_IWUSR, smi130_acc_tap_samp_show, smi130_acc_tap_samp_store); static DEVICE_ATTR(orient_mode, S_IRUGO | S_IWUSR, smi130_acc_orient_mode_show, smi130_acc_orient_mode_store); static DEVICE_ATTR(orient_blocking, S_IRUGO | S_IWUSR, smi130_acc_orient_blocking_show, smi130_acc_orient_blocking_store); static DEVICE_ATTR(orient_hyst, S_IRUGO | S_IWUSR, smi130_acc_orient_hyst_show, smi130_acc_orient_hyst_store); static DEVICE_ATTR(orient_theta, S_IRUGO | S_IWUSR, smi130_acc_orient_theta_show, smi130_acc_orient_theta_store); static DEVICE_ATTR(orient_mbl_mode, S_IRUGO | S_IWUSR, smi130_acc_orient_mbl_mode_show, smi130_acc_orient_mbl_mode_store); static DEVICE_ATTR(orient_mbl_blocking, S_IRUGO | S_IWUSR, smi130_acc_orient_mbl_blocking_show, smi130_acc_orient_mbl_blocking_store); static DEVICE_ATTR(orient_mbl_hyst, S_IRUGO | S_IWUSR, smi130_acc_orient_mbl_hyst_show, smi130_acc_orient_mbl_hyst_store); static DEVICE_ATTR(orient_mbl_theta, S_IRUGO | S_IWUSR, smi130_acc_orient_mbl_theta_show, smi130_acc_orient_mbl_theta_store); static DEVICE_ATTR(flat_theta, S_IRUGO | S_IWUSR, smi130_acc_flat_theta_show, smi130_acc_flat_theta_store); static DEVICE_ATTR(flat_hold_time, S_IRUGO | S_IWUSR, Loading Loading @@ -6591,10 +6591,10 @@ static struct attribute *smi130_acc_attributes[] = { &dev_attr_tap_quiet.attr, &dev_attr_tap_shock.attr, &dev_attr_tap_samp.attr, &dev_attr_orient_mode.attr, &dev_attr_orient_blocking.attr, &dev_attr_orient_hyst.attr, &dev_attr_orient_theta.attr, &dev_attr_orient_mbl_mode.attr, &dev_attr_orient_mbl_blocking.attr, &dev_attr_orient_mbl_hyst.attr, &dev_attr_orient_mbl_theta.attr, &dev_attr_flat_theta.attr, &dev_attr_flat_hold_time.attr, &dev_attr_selftest.attr, Loading Loading @@ -6646,7 +6646,7 @@ static struct attribute_group smi130_acc_double_tap_attribute_group = { #if defined(SMI_ACC2X2_ENABLE_INT1) || defined(SMI_ACC2X2_ENABLE_INT2) unsigned char *orient[] = {"upward looking portrait upright", unsigned char *orient_mbl[] = {"upward looking portrait upright", "upward looking portrait upside-down", "upward looking landscape left", "upward looking landscape right", Loading Loading @@ -6886,10 +6886,10 @@ static void smi130_acc_irq_work_func(struct work_struct *work) #endif case 0x40: smi130_acc_get_orient_status(smi130_acc->smi130_acc_client, smi130_acc_get_orient_mbl_status(smi130_acc->smi130_acc_client, &first_value); PINFO("orient interrupt happened,%s\n", orient[first_value]); PINFO("orient_mbl interrupt happened,%s\n", orient_mbl[first_value]); if (first_value == 0) input_report_abs(smi130_acc->dev_interrupt, ORIENT_INTERRUPT, Loading Loading @@ -6924,7 +6924,7 @@ static void smi130_acc_irq_work_func(struct work_struct *work) DOWNWARD_LANDSCAPE_RIGHT_INTERRUPT_HAPPENED); break; case 0x80: smi130_acc_get_orient_flat_status(smi130_acc->smi130_acc_client, smi130_acc_get_orient_mbl_flat_status(smi130_acc->smi130_acc_client, &sign_value); PINFO("flat interrupt happened,flat status is %d\n", sign_value); Loading Loading @@ -7054,7 +7054,7 @@ static int smi130_acc_probe(struct i2c_client *client, smi130_acc_set_Int_Mode(client, 1);/*latch interrupt 250ms*/ /* do not open any interrupt here */ /*10,orient /*10,orient_mbl 11,flat*/ /* smi130_acc_set_Int_Enable(client, 10, 1); */ /* smi130_acc_set_Int_Enable(client, 11, 1); */ Loading
drivers/input/sensors/smi130/smi130_driver.c +3 −3 Original line number Diff line number Diff line Loading @@ -135,7 +135,7 @@ #define I2C_BURST_READ_MAX_LEN (256) #define SMI130_STORE_COUNT (6000) #define LMADA (1) uint64_t g_current_apts_us; uint64_t g_current_apts_us_mbl; enum SMI_SENSOR_INT_T { Loading Loading @@ -285,7 +285,7 @@ enum SMI_CALIBRATION_STATUS_TYPE { SMI_ACC_Z_FAST_CALI_RDY }; unsigned int reg_op_addr; unsigned int reg_op_addr_mbl; static const int smi_pmu_cmd_acc_arr[SMI_ACC_PM_MAX] = { /*!smi pmu for acc normal, low power1, Loading Loading @@ -372,7 +372,7 @@ struct smi130_store_info_t { uint64_t fifo_time; }; uint64_t get_current_timestamp(void) uint64_t get_current_timestamp_mbl(void) { uint64_t ts_ap; struct timespec tmp_time; Loading