root/drivers/media/pci/tw5864/tw5864-util.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. tw5864_indir_writeb
  2. tw5864_indir_readb

   1 // SPDX-License-Identifier: GPL-2.0
   2 #include "tw5864.h"
   3 
   4 void tw5864_indir_writeb(struct tw5864_dev *dev, u16 addr, u8 data)
   5 {
   6         int retries = 30000;
   7 
   8         while (tw_readl(TW5864_IND_CTL) & BIT(31) && --retries)
   9                 ;
  10         if (!retries)
  11                 dev_err(&dev->pci->dev,
  12                         "tw_indir_writel() retries exhausted before writing\n");
  13 
  14         tw_writel(TW5864_IND_DATA, data);
  15         tw_writel(TW5864_IND_CTL, addr << 2 | TW5864_RW | TW5864_ENABLE);
  16 }
  17 
  18 u8 tw5864_indir_readb(struct tw5864_dev *dev, u16 addr)
  19 {
  20         int retries = 30000;
  21 
  22         while (tw_readl(TW5864_IND_CTL) & BIT(31) && --retries)
  23                 ;
  24         if (!retries)
  25                 dev_err(&dev->pci->dev,
  26                         "tw_indir_readl() retries exhausted before reading\n");
  27 
  28         tw_writel(TW5864_IND_CTL, addr << 2 | TW5864_ENABLE);
  29 
  30         retries = 30000;
  31         while (tw_readl(TW5864_IND_CTL) & BIT(31) && --retries)
  32                 ;
  33         if (!retries)
  34                 dev_err(&dev->pci->dev,
  35                         "tw_indir_readl() retries exhausted at reading\n");
  36 
  37         return tw_readl(TW5864_IND_DATA);
  38 }

/* [<][>][^][v][top][bottom][index][help] */