Skip to content

Commit

Permalink
Merge branch 'i2c/for-current-fixed' of git://git.kernel.org/pub/scm/…
Browse files Browse the repository at this point in the history
…linux/kernel/git/wsa/linux

Pull i2c fixes from Wolfram Sang:
 "Three driver bugfixes and one leak fix for the core"

* 'i2c/for-current-fixed' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
  i2c: mlxcpld: Modify register setting for 400KHz frequency
  i2c: mlxcpld: Fix criteria for frequency setting
  i2c: mediatek: Add OFFSET_EXT_CONF setting back
  i2c: acpi: fix resource leak in reconfiguration device addition
  • Loading branch information
Linus Torvalds committed Oct 9, 2021
2 parents 0950fcb + fa10491 commit 7fd2bf8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
4 changes: 2 additions & 2 deletions drivers/i2c/busses/i2c-mlxcpld.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
#define MLXCPLD_LPCI2C_NACK_IND 2

#define MLXCPLD_I2C_FREQ_1000KHZ_SET 0x04
#define MLXCPLD_I2C_FREQ_400KHZ_SET 0x0f
#define MLXCPLD_I2C_FREQ_400KHZ_SET 0x0c
#define MLXCPLD_I2C_FREQ_100KHZ_SET 0x42

enum mlxcpld_i2c_frequency {
Expand Down Expand Up @@ -495,7 +495,7 @@ mlxcpld_i2c_set_frequency(struct mlxcpld_i2c_priv *priv,
return err;

/* Set frequency only if it is not 100KHz, which is default. */
switch ((data->reg & data->mask) >> data->bit) {
switch ((regval & data->mask) >> data->bit) {
case MLXCPLD_I2C_FREQ_1000KHZ:
freq = MLXCPLD_I2C_FREQ_1000KHZ_SET;
break;
Expand Down
11 changes: 10 additions & 1 deletion drivers/i2c/busses/i2c-mt65xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
#define I2C_HANDSHAKE_RST 0x0020
#define I2C_FIFO_ADDR_CLR 0x0001
#define I2C_DELAY_LEN 0x0002
#define I2C_ST_START_CON 0x8001
#define I2C_FS_START_CON 0x1800
#define I2C_TIME_CLR_VALUE 0x0000
#define I2C_TIME_DEFAULT_VALUE 0x0003
#define I2C_WRRD_TRANAC_VALUE 0x0002
Expand Down Expand Up @@ -480,6 +482,7 @@ static void mtk_i2c_init_hw(struct mtk_i2c *i2c)
{
u16 control_reg;
u16 intr_stat_reg;
u16 ext_conf_val;

mtk_i2c_writew(i2c, I2C_CHN_CLR_FLAG, OFFSET_START);
intr_stat_reg = mtk_i2c_readw(i2c, OFFSET_INTR_STAT);
Expand Down Expand Up @@ -518,8 +521,13 @@ static void mtk_i2c_init_hw(struct mtk_i2c *i2c)
if (i2c->dev_comp->ltiming_adjust)
mtk_i2c_writew(i2c, i2c->ltiming_reg, OFFSET_LTIMING);

if (i2c->speed_hz <= I2C_MAX_STANDARD_MODE_FREQ)
ext_conf_val = I2C_ST_START_CON;
else
ext_conf_val = I2C_FS_START_CON;

if (i2c->dev_comp->timing_adjust) {
mtk_i2c_writew(i2c, i2c->ac_timing.ext, OFFSET_EXT_CONF);
ext_conf_val = i2c->ac_timing.ext;
mtk_i2c_writew(i2c, i2c->ac_timing.inter_clk_div,
OFFSET_CLOCK_DIV);
mtk_i2c_writew(i2c, I2C_SCL_MIS_COMP_VALUE,
Expand All @@ -544,6 +552,7 @@ static void mtk_i2c_init_hw(struct mtk_i2c *i2c)
OFFSET_HS_STA_STO_AC_TIMING);
}
}
mtk_i2c_writew(i2c, ext_conf_val, OFFSET_EXT_CONF);

/* If use i2c pin from PMIC mt6397 side, need set PATH_DIR first */
if (i2c->have_pmic)
Expand Down
1 change: 1 addition & 0 deletions drivers/i2c/i2c-core-acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,7 @@ static int i2c_acpi_notify(struct notifier_block *nb, unsigned long value,
break;

i2c_acpi_register_device(adapter, adev, &info);
put_device(&adapter->dev);
break;
case ACPI_RECONFIG_DEVICE_REMOVE:
if (!acpi_device_enumerated(adev))
Expand Down

0 comments on commit 7fd2bf8

Please sign in to comment.