i2c: qcom-geni: Use generic definitions for bus frequencies
Subsystems (3)
PATCH 1/1 i2c: qcom-geni: Use generic definitions for bus frequencies
Since we have generic definitions for bus frequencies, let's use them.
Signed-off-by Andy Shevchenko <[email protected]>
--- drivers/i2c/busses/i2c-qcom-geni.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)
drivers/i2c/busses/i2c-qcom-geni.c +9 -10
@@ -71,7 +71,6 @@ enum geni_i2c_err_code { << 5)#define I2C_AUTO_SUSPEND_DELAY 250 -#define KHZ (freq) (1000 * freq)#define PACKING_BYTES_PW 4#define ABORT_TIMEOUT HZ
@@ -148,18 +147,18 @@ struct geni_i2c_clk_fld {* source_clock = 19.2 MHz */ static const struct geni_i2c_clk_fld geni_i2c_clk_map_19p2mhz[] = { - {KHZ (100 ),7 ,10 ,12 ,26 }, - {KHZ (400 ),2 ,5 ,11 ,22 }, - {KHZ (1000 ),1 ,2 ,8 ,18 }, - {}, + {I2C_MAX_STANDARD_MODE_FREQ ,7 ,10 ,12 ,26 }, + {I2C_MAX_FAST_MODE_FREQ ,2 ,5 ,11 ,22 }, + {I2C_MAX_FAST_MODE_PLUS_FREQ ,1 ,2 ,8 ,18 }, + {} };/* source_clock = 32 MHz */ static const struct geni_i2c_clk_fld geni_i2c_clk_map_32mhz[] = { - {KHZ (100 ),8 ,14 ,18 ,40 }, - {KHZ (400 ),4 ,3 ,11 ,20 }, - {KHZ (1000 ),2 ,3 ,6 ,15 }, - {}, + {I2C_MAX_STANDARD_MODE_FREQ ,8 ,14 ,18 ,40 }, + {I2C_MAX_FAST_MODE_FREQ ,4 ,3 ,11 ,20 }, + {I2C_MAX_FAST_MODE_PLUS_FREQ ,2 ,3 ,6 ,15 }, + {} };static int geni_i2c_clk_map_idx (struct geni_i2c_dev *gi2c)
@@ -812,7 +811,7 @@ static int geni_i2c_probe(struct platform_device *pdev) &gi2c->clk_freq_out);if (ret) {dev_info (dev,"Bus frequency not specified, default to 100kHz.\n" ); - gi2c->clk_freq_out =KHZ (100 ); + gi2c->clk_freq_out =I2C_MAX_STANDARD_MODE_FREQ ; }if (has_acpi_companion (dev))
Signature · 1 line
2.47.2
Hi Andy,
Quoted 4 lines · Andy Shevchenko
Since we have generic definitions for bus frequencies, let's use them.
Signed-off-by Andy Shevchenko <[email protected]>
Looks good to me.
Reviewed-by Christopher Obbard <[email protected]>
Quoted 56 lines
--- drivers/i2c/busses/i2c-qcom-geni.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)drivers/i2c/busses/i2c-qcom-geni.c +9
-11@@ -71,7 +71,6 @@ enum geni_i2c_err_code { << 5)#define I2C_AUTO_SUSPEND_DELAY 250 -#define KHZ (freq) (1000 * freq)#define PACKING_BYTES_PW 4#define ABORT_TIMEOUT HZ@@ -148,18 +147,18 @@ struct geni_i2c_clk_fld {* source_clock = 19.2 MHz */ static const struct geni_i2c_clk_fld geni_i2c_clk_map_19p2mhz[] = { - {KHZ (100 ),7 ,10 ,12 ,26 }, - {KHZ (400 ),2 ,5 ,11 ,22 }, - {KHZ (1000 ),1 ,2 ,8 ,18 }, - {}, + {I2C_MAX_STANDARD_MODE_FREQ ,7 ,10 ,12 ,26 }, + {I2C_MAX_FAST_MODE_FREQ ,2 ,5 ,11 ,22 }, + {I2C_MAX_FAST_MODE_PLUS_FREQ ,1 ,2 ,8 ,18 }, + {} };/* source_clock = 32 MHz */ static const struct geni_i2c_clk_fld geni_i2c_clk_map_32mhz[] = { - {KHZ (100 ),8 ,14 ,18 ,40 }, - {KHZ (400 ),4 ,3 ,11 ,20 }, - {KHZ (1000 ),2 ,3 ,6 ,15 }, - {}, + {I2C_MAX_STANDARD_MODE_FREQ ,8 ,14 ,18 ,40 }, + {I2C_MAX_FAST_MODE_FREQ ,4 ,3 ,11 ,20 }, + {I2C_MAX_FAST_MODE_PLUS_FREQ ,2 ,3 ,6 ,15 }, + {} };static int geni_i2c_clk_map_idx (struct geni_i2c_dev *gi2c)@@ -812,7 +811,7 @@ static int geni_i2c_probe(struct platform_device *pdev) &gi2c->clk_freq_out);if (ret) {dev_info (dev,"Bus frequency not specified, default to 100kHz.\n" ); - gi2c->clk_freq_out =KHZ (100 ); + gi2c->clk_freq_out =I2C_MAX_STANDARD_MODE_FREQ ; }if (has_acpi_companion (dev)) --2.47.2
Mukesh Kumar Savaliya
Reviewed-byThanks Andy for the change !
Quoted 5 lines · Christopher Obbard
Hi Andy,
Quoted 1 line · Andy Shevchenko
Quoted 7 lines
Quoted 3 lines
Since we have generic definitions for bus frequencies, let's use them.
Signed-off-by Andy Shevchenko <[email protected]>Looks good to me.
Reviewed-by Christopher Obbard <[email protected]>
Reviewed-by Mukesh Kumar Savaliya <[email protected]>
Quoted 57 lines
Quoted 57 lines
--- drivers/i2c/busses/i2c-qcom-geni.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)drivers/i2c/busses/i2c-qcom-geni.c +9
-11@@ -71,7 +71,6 @@ enum geni_i2c_err_code { << 5)#define I2C_AUTO_SUSPEND_DELAY 250 -#define KHZ (freq) (1000 * freq)#define PACKING_BYTES_PW 4#define ABORT_TIMEOUT HZ@@ -148,18 +147,18 @@ struct geni_i2c_clk_fld {* source_clock = 19.2 MHz */ static const struct geni_i2c_clk_fld geni_i2c_clk_map_19p2mhz[] = { - {KHZ (100 ),7 ,10 ,12 ,26 }, - {KHZ (400 ),2 ,5 ,11 ,22 }, - {KHZ (1000 ),1 ,2 ,8 ,18 }, - {}, + {I2C_MAX_STANDARD_MODE_FREQ ,7 ,10 ,12 ,26 }, + {I2C_MAX_FAST_MODE_FREQ ,2 ,5 ,11 ,22 }, + {I2C_MAX_FAST_MODE_PLUS_FREQ ,1 ,2 ,8 ,18 }, + {} };/* source_clock = 32 MHz */ static const struct geni_i2c_clk_fld geni_i2c_clk_map_32mhz[] = { - {KHZ (100 ),8 ,14 ,18 ,40 }, - {KHZ (400 ),4 ,3 ,11 ,20 }, - {KHZ (1000 ),2 ,3 ,6 ,15 }, - {}, + {I2C_MAX_STANDARD_MODE_FREQ ,8 ,14 ,18 ,40 }, + {I2C_MAX_FAST_MODE_FREQ ,4 ,3 ,11 ,20 }, + {I2C_MAX_FAST_MODE_PLUS_FREQ ,2 ,3 ,6 ,15 }, + {} };static int geni_i2c_clk_map_idx (struct geni_i2c_dev *gi2c)@@ -812,7 +811,7 @@ static int geni_i2c_probe(struct platform_device *pdev) &gi2c->clk_freq_out);if (ret) {dev_info (dev,"Bus frequency not specified, default to 100kHz.\n" ); - gi2c->clk_freq_out =KHZ (100 ); + gi2c->clk_freq_out =I2C_MAX_STANDARD_MODE_FREQ ; }if (has_acpi_companion (dev)) --2.47.2
Hi Andy,
Quoted 3 lines · Andy Shevchenko
Since we have generic definitions for bus frequencies, let's use them.
Signed-off-by Andy Shevchenko <[email protected]>
merged to i2c/i2c-host.
Thanks,
Andi