Skip to content

Commit e6f2f6a

Browse files
committed
Merge tag 'i2c-for-6.2-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux
Pull i2c fixes from Wolfram Sang: "A bunch of driver fixes with a tiny bit of new IDs" * tag 'i2c-for-6.2-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: i2c: rk3x: fix a bunch of kernel-doc warnings i2c: axxia: use 'struct' for kernel-doc notation dt-bindings: i2c: renesas,rzv2m: Fix SoC specific string i2c: mxs: suppress probe-deferral error message i2c: designware-pci: Add new PCI IDs for AMD NAVI GPU i2c: designware: Fix unbalanced suspended flag i2c: designware: use casting of u64 in clock multiplication to avoid overflow
2 parents 37d0be6 + 0582d98 commit e6f2f6a

File tree

7 files changed

+37
-48
lines changed

7 files changed

+37
-48
lines changed

Documentation/devicetree/bindings/i2c/renesas,rzv2m.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ properties:
1616
compatible:
1717
items:
1818
- enum:
19-
- renesas,i2c-r9a09g011 # RZ/V2M
19+
- renesas,r9a09g011-i2c # RZ/V2M
2020
- const: renesas,rzv2m-i2c
2121

2222
reg:
@@ -66,7 +66,7 @@ examples:
6666
#include <dt-bindings/interrupt-controller/arm-gic.h>
6767
6868
i2c0: i2c@a4030000 {
69-
compatible = "renesas,i2c-r9a09g011", "renesas,rzv2m-i2c";
69+
compatible = "renesas,r9a09g011-i2c", "renesas,rzv2m-i2c";
7070
reg = <0xa4030000 0x80>;
7171
interrupts = <GIC_SPI 232 IRQ_TYPE_EDGE_RISING>,
7272
<GIC_SPI 236 IRQ_TYPE_EDGE_RISING>;

drivers/i2c/busses/i2c-axxia.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
#define SDA_HOLD_TIME 0x90
119119

120120
/**
121-
* axxia_i2c_dev - I2C device context
121+
* struct axxia_i2c_dev - I2C device context
122122
* @base: pointer to register struct
123123
* @msg: pointer to current message
124124
* @msg_r: pointer to current read message (sequence transfer)

drivers/i2c/busses/i2c-designware-common.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,8 @@ u32 i2c_dw_scl_hcnt(u32 ic_clk, u32 tSYMBOL, u32 tf, int cond, int offset)
351351
*
352352
* If your hardware is free from tHD;STA issue, try this one.
353353
*/
354-
return DIV_ROUND_CLOSEST(ic_clk * tSYMBOL, MICRO) - 8 + offset;
354+
return DIV_ROUND_CLOSEST_ULL((u64)ic_clk * tSYMBOL, MICRO) -
355+
8 + offset;
355356
else
356357
/*
357358
* Conditional expression:
@@ -367,7 +368,8 @@ u32 i2c_dw_scl_hcnt(u32 ic_clk, u32 tSYMBOL, u32 tf, int cond, int offset)
367368
* The reason why we need to take into account "tf" here,
368369
* is the same as described in i2c_dw_scl_lcnt().
369370
*/
370-
return DIV_ROUND_CLOSEST(ic_clk * (tSYMBOL + tf), MICRO) - 3 + offset;
371+
return DIV_ROUND_CLOSEST_ULL((u64)ic_clk * (tSYMBOL + tf), MICRO) -
372+
3 + offset;
371373
}
372374

373375
u32 i2c_dw_scl_lcnt(u32 ic_clk, u32 tLOW, u32 tf, int offset)
@@ -383,7 +385,8 @@ u32 i2c_dw_scl_lcnt(u32 ic_clk, u32 tLOW, u32 tf, int offset)
383385
* account the fall time of SCL signal (tf). Default tf value
384386
* should be 0.3 us, for safety.
385387
*/
386-
return DIV_ROUND_CLOSEST(ic_clk * (tLOW + tf), MICRO) - 1 + offset;
388+
return DIV_ROUND_CLOSEST_ULL((u64)ic_clk * (tLOW + tf), MICRO) -
389+
1 + offset;
387390
}
388391

389392
int i2c_dw_set_sda_hold(struct dw_i2c_dev *dev)

drivers/i2c/busses/i2c-designware-pcidrv.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,8 @@ static const struct pci_device_id i2_designware_pci_ids[] = {
396396
{ PCI_VDEVICE(ATI, 0x73a4), navi_amd },
397397
{ PCI_VDEVICE(ATI, 0x73e4), navi_amd },
398398
{ PCI_VDEVICE(ATI, 0x73c4), navi_amd },
399+
{ PCI_VDEVICE(ATI, 0x7444), navi_amd },
400+
{ PCI_VDEVICE(ATI, 0x7464), navi_amd },
399401
{ 0,}
400402
};
401403
MODULE_DEVICE_TABLE(pci, i2_designware_pci_ids);

drivers/i2c/busses/i2c-designware-platdrv.c

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -351,13 +351,11 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
351351

352352
if (dev->flags & ACCESS_NO_IRQ_SUSPEND) {
353353
dev_pm_set_driver_flags(&pdev->dev,
354-
DPM_FLAG_SMART_PREPARE |
355-
DPM_FLAG_MAY_SKIP_RESUME);
354+
DPM_FLAG_SMART_PREPARE);
356355
} else {
357356
dev_pm_set_driver_flags(&pdev->dev,
358357
DPM_FLAG_SMART_PREPARE |
359-
DPM_FLAG_SMART_SUSPEND |
360-
DPM_FLAG_MAY_SKIP_RESUME);
358+
DPM_FLAG_SMART_SUSPEND);
361359
}
362360

363361
device_enable_async_suspend(&pdev->dev);
@@ -419,21 +417,8 @@ static int dw_i2c_plat_prepare(struct device *dev)
419417
*/
420418
return !has_acpi_companion(dev);
421419
}
422-
423-
static void dw_i2c_plat_complete(struct device *dev)
424-
{
425-
/*
426-
* The device can only be in runtime suspend at this point if it has not
427-
* been resumed throughout the ending system suspend/resume cycle, so if
428-
* the platform firmware might mess up with it, request the runtime PM
429-
* framework to resume it.
430-
*/
431-
if (pm_runtime_suspended(dev) && pm_resume_via_firmware())
432-
pm_request_resume(dev);
433-
}
434420
#else
435421
#define dw_i2c_plat_prepare NULL
436-
#define dw_i2c_plat_complete NULL
437422
#endif
438423

439424
#ifdef CONFIG_PM
@@ -483,7 +468,6 @@ static int __maybe_unused dw_i2c_plat_resume(struct device *dev)
483468

484469
static const struct dev_pm_ops dw_i2c_dev_pm_ops = {
485470
.prepare = dw_i2c_plat_prepare,
486-
.complete = dw_i2c_plat_complete,
487471
SET_LATE_SYSTEM_SLEEP_PM_OPS(dw_i2c_plat_suspend, dw_i2c_plat_resume)
488472
SET_RUNTIME_PM_OPS(dw_i2c_plat_runtime_suspend, dw_i2c_plat_runtime_resume, NULL)
489473
};

drivers/i2c/busses/i2c-mxs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -826,8 +826,8 @@ static int mxs_i2c_probe(struct platform_device *pdev)
826826
/* Setup the DMA */
827827
i2c->dmach = dma_request_chan(dev, "rx-tx");
828828
if (IS_ERR(i2c->dmach)) {
829-
dev_err(dev, "Failed to request dma\n");
830-
return PTR_ERR(i2c->dmach);
829+
return dev_err_probe(dev, PTR_ERR(i2c->dmach),
830+
"Failed to request dma\n");
831831
}
832832

833833
platform_set_drvdata(pdev, i2c);

drivers/i2c/busses/i2c-rk3x.c

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ enum {
8080
#define DEFAULT_SCL_RATE (100 * 1000) /* Hz */
8181

8282
/**
83-
* struct i2c_spec_values:
83+
* struct i2c_spec_values - I2C specification values for various modes
8484
* @min_hold_start_ns: min hold time (repeated) START condition
8585
* @min_low_ns: min LOW period of the SCL clock
8686
* @min_high_ns: min HIGH period of the SCL cloc
@@ -136,7 +136,7 @@ static const struct i2c_spec_values fast_mode_plus_spec = {
136136
};
137137

138138
/**
139-
* struct rk3x_i2c_calced_timings:
139+
* struct rk3x_i2c_calced_timings - calculated V1 timings
140140
* @div_low: Divider output for low
141141
* @div_high: Divider output for high
142142
* @tuning: Used to adjust setup/hold data time,
@@ -159,7 +159,7 @@ enum rk3x_i2c_state {
159159
};
160160

161161
/**
162-
* struct rk3x_i2c_soc_data:
162+
* struct rk3x_i2c_soc_data - SOC-specific data
163163
* @grf_offset: offset inside the grf regmap for setting the i2c type
164164
* @calc_timings: Callback function for i2c timing information calculated
165165
*/
@@ -239,7 +239,8 @@ static inline void rk3x_i2c_clean_ipd(struct rk3x_i2c *i2c)
239239
}
240240

241241
/**
242-
* Generate a START condition, which triggers a REG_INT_START interrupt.
242+
* rk3x_i2c_start - Generate a START condition, which triggers a REG_INT_START interrupt.
243+
* @i2c: target controller data
243244
*/
244245
static void rk3x_i2c_start(struct rk3x_i2c *i2c)
245246
{
@@ -258,8 +259,8 @@ static void rk3x_i2c_start(struct rk3x_i2c *i2c)
258259
}
259260

260261
/**
261-
* Generate a STOP condition, which triggers a REG_INT_STOP interrupt.
262-
*
262+
* rk3x_i2c_stop - Generate a STOP condition, which triggers a REG_INT_STOP interrupt.
263+
* @i2c: target controller data
263264
* @error: Error code to return in rk3x_i2c_xfer
264265
*/
265266
static void rk3x_i2c_stop(struct rk3x_i2c *i2c, int error)
@@ -298,7 +299,8 @@ static void rk3x_i2c_stop(struct rk3x_i2c *i2c, int error)
298299
}
299300

300301
/**
301-
* Setup a read according to i2c->msg
302+
* rk3x_i2c_prepare_read - Setup a read according to i2c->msg
303+
* @i2c: target controller data
302304
*/
303305
static void rk3x_i2c_prepare_read(struct rk3x_i2c *i2c)
304306
{
@@ -329,7 +331,8 @@ static void rk3x_i2c_prepare_read(struct rk3x_i2c *i2c)
329331
}
330332

331333
/**
332-
* Fill the transmit buffer with data from i2c->msg
334+
* rk3x_i2c_fill_transmit_buf - Fill the transmit buffer with data from i2c->msg
335+
* @i2c: target controller data
333336
*/
334337
static void rk3x_i2c_fill_transmit_buf(struct rk3x_i2c *i2c)
335338
{
@@ -532,11 +535,10 @@ static irqreturn_t rk3x_i2c_irq(int irqno, void *dev_id)
532535
}
533536

534537
/**
535-
* Get timing values of I2C specification
536-
*
538+
* rk3x_i2c_get_spec - Get timing values of I2C specification
537539
* @speed: Desired SCL frequency
538540
*
539-
* Returns: Matched i2c spec values.
541+
* Return: Matched i2c_spec_values.
540542
*/
541543
static const struct i2c_spec_values *rk3x_i2c_get_spec(unsigned int speed)
542544
{
@@ -549,13 +551,12 @@ static const struct i2c_spec_values *rk3x_i2c_get_spec(unsigned int speed)
549551
}
550552

551553
/**
552-
* Calculate divider values for desired SCL frequency
553-
*
554+
* rk3x_i2c_v0_calc_timings - Calculate divider values for desired SCL frequency
554555
* @clk_rate: I2C input clock rate
555556
* @t: Known I2C timing information
556557
* @t_calc: Caculated rk3x private timings that would be written into regs
557558
*
558-
* Returns: 0 on success, -EINVAL if the goal SCL rate is too slow. In that case
559+
* Return: %0 on success, -%EINVAL if the goal SCL rate is too slow. In that case
559560
* a best-effort divider value is returned in divs. If the target rate is
560561
* too high, we silently use the highest possible rate.
561562
*/
@@ -710,13 +711,12 @@ static int rk3x_i2c_v0_calc_timings(unsigned long clk_rate,
710711
}
711712

712713
/**
713-
* Calculate timing values for desired SCL frequency
714-
*
714+
* rk3x_i2c_v1_calc_timings - Calculate timing values for desired SCL frequency
715715
* @clk_rate: I2C input clock rate
716716
* @t: Known I2C timing information
717717
* @t_calc: Caculated rk3x private timings that would be written into regs
718718
*
719-
* Returns: 0 on success, -EINVAL if the goal SCL rate is too slow. In that case
719+
* Return: %0 on success, -%EINVAL if the goal SCL rate is too slow. In that case
720720
* a best-effort divider value is returned in divs. If the target rate is
721721
* too high, we silently use the highest possible rate.
722722
* The following formulas are v1's method to calculate timings.
@@ -960,14 +960,14 @@ static int rk3x_i2c_clk_notifier_cb(struct notifier_block *nb, unsigned long
960960
}
961961

962962
/**
963-
* Setup I2C registers for an I2C operation specified by msgs, num.
964-
*
965-
* Must be called with i2c->lock held.
966-
*
963+
* rk3x_i2c_setup - Setup I2C registers for an I2C operation specified by msgs, num.
964+
* @i2c: target controller data
967965
* @msgs: I2C msgs to process
968966
* @num: Number of msgs
969967
*
970-
* returns: Number of I2C msgs processed or negative in case of error
968+
* Must be called with i2c->lock held.
969+
*
970+
* Return: Number of I2C msgs processed or negative in case of error
971971
*/
972972
static int rk3x_i2c_setup(struct rk3x_i2c *i2c, struct i2c_msg *msgs, int num)
973973
{

0 commit comments

Comments
 (0)