diff mbox series

media: qcom: camss: Fix overflows in clock rate calculations

Message ID 20210210122906.3037085-1-junak.pub@gmail.com (mailing list archive)
State New, archived
Headers show
Series media: qcom: camss: Fix overflows in clock rate calculations | expand

Commit Message

Vladimir Lypak Feb. 10, 2021, 12:29 p.m. UTC
Because of u32 type being used to store pixel clock rate, expression used
to calculate pipeline clocks (pixel_clock * bpp) produces wrong value due
to integer overflow. This patch changes data type used to store, pass and
retrieve pixel_clock from u32 to u64 to make this mistake less likely to
be repeated in the future.

Signed-off-by: Vladimir Lypak <junak.pub@gmail.com>
---
 drivers/media/platform/qcom/camss/camss-csid.c           | 2 +-
 drivers/media/platform/qcom/camss/camss-csiphy-2ph-1-0.c | 4 ++--
 drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c | 4 ++--
 drivers/media/platform/qcom/camss/camss-csiphy.c         | 4 ++--
 drivers/media/platform/qcom/camss/camss-csiphy.h         | 2 +-
 drivers/media/platform/qcom/camss/camss-vfe.c            | 4 ++--
 drivers/media/platform/qcom/camss/camss.c                | 2 +-
 drivers/media/platform/qcom/camss/camss.h                | 2 +-
 8 files changed, 12 insertions(+), 12 deletions(-)

Comments

Robert Foss Feb. 10, 2021, 2:23 p.m. UTC | #1
Hey Vladimir,

This patch looks good to me, thanks for the submission.
Acked-by: Robert Foss <robert.foss@linaro.org>

On Wed, 10 Feb 2021 at 13:51, Vladimir Lypak <junak.pub@gmail.com> wrote:
>
> Because of u32 type being used to store pixel clock rate, expression used
> to calculate pipeline clocks (pixel_clock * bpp) produces wrong value due
> to integer overflow. This patch changes data type used to store, pass and
> retrieve pixel_clock from u32 to u64 to make this mistake less likely to
> be repeated in the future.
>
> Signed-off-by: Vladimir Lypak <junak.pub@gmail.com>
> ---
>  drivers/media/platform/qcom/camss/camss-csid.c           | 2 +-
>  drivers/media/platform/qcom/camss/camss-csiphy-2ph-1-0.c | 4 ++--
>  drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c | 4 ++--
>  drivers/media/platform/qcom/camss/camss-csiphy.c         | 4 ++--
>  drivers/media/platform/qcom/camss/camss-csiphy.h         | 2 +-
>  drivers/media/platform/qcom/camss/camss-vfe.c            | 4 ++--
>  drivers/media/platform/qcom/camss/camss.c                | 2 +-
>  drivers/media/platform/qcom/camss/camss.h                | 2 +-
>  8 files changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/media/platform/qcom/camss/camss-csid.c b/drivers/media/platform/qcom/camss/camss-csid.c
> index be3fe76f3dc30..6307b889baa69 100644
> --- a/drivers/media/platform/qcom/camss/camss-csid.c
> +++ b/drivers/media/platform/qcom/camss/camss-csid.c
> @@ -462,7 +462,7 @@ static irqreturn_t csid_isr(int irq, void *dev)
>  static int csid_set_clock_rates(struct csid_device *csid)
>  {
>         struct device *dev = csid->camss->dev;
> -       u32 pixel_clock;
> +       u64 pixel_clock;
>         int i, j;
>         int ret;
>
> diff --git a/drivers/media/platform/qcom/camss/camss-csiphy-2ph-1-0.c b/drivers/media/platform/qcom/camss/camss-csiphy-2ph-1-0.c
> index 12bce391d71fd..ec66d1557b8b1 100644
> --- a/drivers/media/platform/qcom/camss/camss-csiphy-2ph-1-0.c
> +++ b/drivers/media/platform/qcom/camss/camss-csiphy-2ph-1-0.c
> @@ -57,7 +57,7 @@ static void csiphy_reset(struct csiphy_device *csiphy)
>   * Return settle count value or 0 if the CSI2 pixel clock
>   * frequency is not available
>   */
> -static u8 csiphy_settle_cnt_calc(u32 pixel_clock, u8 bpp, u8 num_lanes,
> +static u8 csiphy_settle_cnt_calc(u64 pixel_clock, u8 bpp, u8 num_lanes,
>                                  u32 timer_clk_rate)
>  {
>         u32 mipi_clock; /* Hz */
> @@ -83,7 +83,7 @@ static u8 csiphy_settle_cnt_calc(u32 pixel_clock, u8 bpp, u8 num_lanes,
>
>  static void csiphy_lanes_enable(struct csiphy_device *csiphy,
>                                 struct csiphy_config *cfg,
> -                               u32 pixel_clock, u8 bpp, u8 lane_mask)
> +                               u64 pixel_clock, u8 bpp, u8 lane_mask)
>  {
>         struct csiphy_lanes_cfg *c = &cfg->csi2->lane_cfg;
>         u8 settle_cnt;
> diff --git a/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c b/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c
> index 97cb9de850315..cd6eb88a7c153 100644
> --- a/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c
> +++ b/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c
> @@ -113,7 +113,7 @@ static irqreturn_t csiphy_isr(int irq, void *dev)
>   * Return settle count value or 0 if the CSI2 pixel clock
>   * frequency is not available
>   */
> -static u8 csiphy_settle_cnt_calc(u32 pixel_clock, u8 bpp, u8 num_lanes,
> +static u8 csiphy_settle_cnt_calc(u64 pixel_clock, u8 bpp, u8 num_lanes,
>                                  u32 timer_clk_rate)
>  {
>         u32 mipi_clock; /* Hz */
> @@ -137,7 +137,7 @@ static u8 csiphy_settle_cnt_calc(u32 pixel_clock, u8 bpp, u8 num_lanes,
>
>  static void csiphy_lanes_enable(struct csiphy_device *csiphy,
>                                 struct csiphy_config *cfg,
> -                               u32 pixel_clock, u8 bpp, u8 lane_mask)
> +                               u64 pixel_clock, u8 bpp, u8 lane_mask)
>  {
>         struct csiphy_lanes_cfg *c = &cfg->csi2->lane_cfg;
>         u8 settle_cnt;
> diff --git a/drivers/media/platform/qcom/camss/camss-csiphy.c b/drivers/media/platform/qcom/camss/camss-csiphy.c
> index 509c9a59c09cd..61628f55c4f63 100644
> --- a/drivers/media/platform/qcom/camss/camss-csiphy.c
> +++ b/drivers/media/platform/qcom/camss/camss-csiphy.c
> @@ -102,7 +102,7 @@ static u8 csiphy_get_bpp(const struct csiphy_format *formats,
>  static int csiphy_set_clock_rates(struct csiphy_device *csiphy)
>  {
>         struct device *dev = csiphy->camss->dev;
> -       u32 pixel_clock;
> +       u64 pixel_clock;
>         int i, j;
>         int ret;
>
> @@ -238,7 +238,7 @@ static u8 csiphy_get_lane_mask(struct csiphy_lanes_cfg *lane_cfg)
>  static int csiphy_stream_on(struct csiphy_device *csiphy)
>  {
>         struct csiphy_config *cfg = &csiphy->cfg;
> -       u32 pixel_clock;
> +       u64 pixel_clock;
>         u8 lane_mask = csiphy_get_lane_mask(&cfg->csi2->lane_cfg);
>         u8 bpp = csiphy_get_bpp(csiphy->formats, csiphy->nformats,
>                                 csiphy->fmt[MSM_CSIPHY_PAD_SINK].code);
> diff --git a/drivers/media/platform/qcom/camss/camss-csiphy.h b/drivers/media/platform/qcom/camss/camss-csiphy.h
> index f7967ef836dcc..450c8247bd533 100644
> --- a/drivers/media/platform/qcom/camss/camss-csiphy.h
> +++ b/drivers/media/platform/qcom/camss/camss-csiphy.h
> @@ -50,7 +50,7 @@ struct csiphy_hw_ops {
>         void (*reset)(struct csiphy_device *csiphy);
>         void (*lanes_enable)(struct csiphy_device *csiphy,
>                              struct csiphy_config *cfg,
> -                            u32 pixel_clock, u8 bpp, u8 lane_mask);
> +                            u64 pixel_clock, u8 bpp, u8 lane_mask);
>         void (*lanes_disable)(struct csiphy_device *csiphy,
>                               struct csiphy_config *cfg);
>         irqreturn_t (*isr)(int irq, void *dev);
> diff --git a/drivers/media/platform/qcom/camss/camss-vfe.c b/drivers/media/platform/qcom/camss/camss-vfe.c
> index fae2b513b2f9d..b2c95b46ce661 100644
> --- a/drivers/media/platform/qcom/camss/camss-vfe.c
> +++ b/drivers/media/platform/qcom/camss/camss-vfe.c
> @@ -1112,7 +1112,7 @@ static inline void vfe_isr_halt_ack(struct vfe_device *vfe)
>  static int vfe_set_clock_rates(struct vfe_device *vfe)
>  {
>         struct device *dev = vfe->camss->dev;
> -       u32 pixel_clock[MSM_VFE_LINE_NUM];
> +       u64 pixel_clock[MSM_VFE_LINE_NUM];
>         int i, j;
>         int ret;
>
> @@ -1194,7 +1194,7 @@ static int vfe_set_clock_rates(struct vfe_device *vfe)
>   */
>  static int vfe_check_clock_rates(struct vfe_device *vfe)
>  {
> -       u32 pixel_clock[MSM_VFE_LINE_NUM];
> +       u64 pixel_clock[MSM_VFE_LINE_NUM];
>         int i, j;
>         int ret;
>
> diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c
> index 8fefce57bc49f..eb55cf436b717 100644
> --- a/drivers/media/platform/qcom/camss/camss.c
> +++ b/drivers/media/platform/qcom/camss/camss.c
> @@ -555,7 +555,7 @@ struct media_entity *camss_find_sensor(struct media_entity *entity)
>   *
>   * Return 0 on success or a negative error code otherwise
>   */
> -int camss_get_pixel_clock(struct media_entity *entity, u32 *pixel_clock)
> +int camss_get_pixel_clock(struct media_entity *entity, u64 *pixel_clock)
>  {
>         struct media_entity *sensor;
>         struct v4l2_subdev *subdev;
> diff --git a/drivers/media/platform/qcom/camss/camss.h b/drivers/media/platform/qcom/camss/camss.h
> index 3a0484683cd6e..fabfce9a3496c 100644
> --- a/drivers/media/platform/qcom/camss/camss.h
> +++ b/drivers/media/platform/qcom/camss/camss.h
> @@ -108,7 +108,7 @@ int camss_enable_clocks(int nclocks, struct camss_clock *clock,
>                         struct device *dev);
>  void camss_disable_clocks(int nclocks, struct camss_clock *clock);
>  struct media_entity *camss_find_sensor(struct media_entity *entity);
> -int camss_get_pixel_clock(struct media_entity *entity, u32 *pixel_clock);
> +int camss_get_pixel_clock(struct media_entity *entity, u64 *pixel_clock);
>  int camss_pm_domain_on(struct camss *camss, int id);
>  void camss_pm_domain_off(struct camss *camss, int id);
>  void camss_delete(struct camss *camss);
> --
> 2.30.0
>
kernel test robot Feb. 10, 2021, 9:09 p.m. UTC | #2
Hi Vladimir,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linuxtv-media/master]
[also build test ERROR on v5.11-rc7 next-20210125]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Vladimir-Lypak/media-qcom-camss-Fix-overflows-in-clock-rate-calculations/20210210-205411
base:   git://linuxtv.org/media_tree.git master
config: h8300-allyesconfig (attached as .config)
compiler: h8300-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/68e1cff848a4157c917b620569636ed464640048
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Vladimir-Lypak/media-qcom-camss-Fix-overflows-in-clock-rate-calculations/20210210-205411
        git checkout 68e1cff848a4157c917b620569636ed464640048
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=h8300 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   h8300-linux-ld: drivers/media/platform/qcom/camss/camss-csid.o: in function `.L131':
>> camss-csid.c:(.text+0xa85): undefined reference to `__udivdi3'
   h8300-linux-ld: drivers/media/platform/qcom/camss/camss-csiphy-2ph-1-0.o: in function `csiphy_lanes_enable':
>> camss-csiphy-2ph-1-0.c:(.text+0x247): undefined reference to `__udivdi3'
   h8300-linux-ld: drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.o: in function `csiphy_lanes_enable':
>> camss-csiphy-3ph-1-0.c:(.text+0x309): undefined reference to `__udivdi3'
   h8300-linux-ld: drivers/media/platform/qcom/camss/camss-csiphy.o: in function `.L94':
>> camss-csiphy.c:(.text+0x93f): undefined reference to `__udivdi3'

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Hans Verkuil March 4, 2021, 10:30 a.m. UTC | #3
On 10/02/2021 13:29, Vladimir Lypak wrote:
> Because of u32 type being used to store pixel clock rate, expression used
> to calculate pipeline clocks (pixel_clock * bpp) produces wrong value due
> to integer overflow. This patch changes data type used to store, pass and
> retrieve pixel_clock from u32 to u64 to make this mistake less likely to
> be repeated in the future.

This patch conflicts with Andrey's patch:

https://patchwork.linuxtv.org/project/linux-media/patch/20210217221134.2606-4-andrey.konovalov@linaro.org/

I've picked up Andrey's patch in a pull request (not yet merged in our media master tree),
but you should rebase your patch on top of his if it is still needed.

Regards,

	Hans

> 
> Signed-off-by: Vladimir Lypak <junak.pub@gmail.com>
> ---
>  drivers/media/platform/qcom/camss/camss-csid.c           | 2 +-
>  drivers/media/platform/qcom/camss/camss-csiphy-2ph-1-0.c | 4 ++--
>  drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c | 4 ++--
>  drivers/media/platform/qcom/camss/camss-csiphy.c         | 4 ++--
>  drivers/media/platform/qcom/camss/camss-csiphy.h         | 2 +-
>  drivers/media/platform/qcom/camss/camss-vfe.c            | 4 ++--
>  drivers/media/platform/qcom/camss/camss.c                | 2 +-
>  drivers/media/platform/qcom/camss/camss.h                | 2 +-
>  8 files changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/media/platform/qcom/camss/camss-csid.c b/drivers/media/platform/qcom/camss/camss-csid.c
> index be3fe76f3dc30..6307b889baa69 100644
> --- a/drivers/media/platform/qcom/camss/camss-csid.c
> +++ b/drivers/media/platform/qcom/camss/camss-csid.c
> @@ -462,7 +462,7 @@ static irqreturn_t csid_isr(int irq, void *dev)
>  static int csid_set_clock_rates(struct csid_device *csid)
>  {
>  	struct device *dev = csid->camss->dev;
> -	u32 pixel_clock;
> +	u64 pixel_clock;
>  	int i, j;
>  	int ret;
>  
> diff --git a/drivers/media/platform/qcom/camss/camss-csiphy-2ph-1-0.c b/drivers/media/platform/qcom/camss/camss-csiphy-2ph-1-0.c
> index 12bce391d71fd..ec66d1557b8b1 100644
> --- a/drivers/media/platform/qcom/camss/camss-csiphy-2ph-1-0.c
> +++ b/drivers/media/platform/qcom/camss/camss-csiphy-2ph-1-0.c
> @@ -57,7 +57,7 @@ static void csiphy_reset(struct csiphy_device *csiphy)
>   * Return settle count value or 0 if the CSI2 pixel clock
>   * frequency is not available
>   */
> -static u8 csiphy_settle_cnt_calc(u32 pixel_clock, u8 bpp, u8 num_lanes,
> +static u8 csiphy_settle_cnt_calc(u64 pixel_clock, u8 bpp, u8 num_lanes,
>  				 u32 timer_clk_rate)
>  {
>  	u32 mipi_clock; /* Hz */
> @@ -83,7 +83,7 @@ static u8 csiphy_settle_cnt_calc(u32 pixel_clock, u8 bpp, u8 num_lanes,
>  
>  static void csiphy_lanes_enable(struct csiphy_device *csiphy,
>  				struct csiphy_config *cfg,
> -				u32 pixel_clock, u8 bpp, u8 lane_mask)
> +				u64 pixel_clock, u8 bpp, u8 lane_mask)
>  {
>  	struct csiphy_lanes_cfg *c = &cfg->csi2->lane_cfg;
>  	u8 settle_cnt;
> diff --git a/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c b/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c
> index 97cb9de850315..cd6eb88a7c153 100644
> --- a/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c
> +++ b/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c
> @@ -113,7 +113,7 @@ static irqreturn_t csiphy_isr(int irq, void *dev)
>   * Return settle count value or 0 if the CSI2 pixel clock
>   * frequency is not available
>   */
> -static u8 csiphy_settle_cnt_calc(u32 pixel_clock, u8 bpp, u8 num_lanes,
> +static u8 csiphy_settle_cnt_calc(u64 pixel_clock, u8 bpp, u8 num_lanes,
>  				 u32 timer_clk_rate)
>  {
>  	u32 mipi_clock; /* Hz */
> @@ -137,7 +137,7 @@ static u8 csiphy_settle_cnt_calc(u32 pixel_clock, u8 bpp, u8 num_lanes,
>  
>  static void csiphy_lanes_enable(struct csiphy_device *csiphy,
>  				struct csiphy_config *cfg,
> -				u32 pixel_clock, u8 bpp, u8 lane_mask)
> +				u64 pixel_clock, u8 bpp, u8 lane_mask)
>  {
>  	struct csiphy_lanes_cfg *c = &cfg->csi2->lane_cfg;
>  	u8 settle_cnt;
> diff --git a/drivers/media/platform/qcom/camss/camss-csiphy.c b/drivers/media/platform/qcom/camss/camss-csiphy.c
> index 509c9a59c09cd..61628f55c4f63 100644
> --- a/drivers/media/platform/qcom/camss/camss-csiphy.c
> +++ b/drivers/media/platform/qcom/camss/camss-csiphy.c
> @@ -102,7 +102,7 @@ static u8 csiphy_get_bpp(const struct csiphy_format *formats,
>  static int csiphy_set_clock_rates(struct csiphy_device *csiphy)
>  {
>  	struct device *dev = csiphy->camss->dev;
> -	u32 pixel_clock;
> +	u64 pixel_clock;
>  	int i, j;
>  	int ret;
>  
> @@ -238,7 +238,7 @@ static u8 csiphy_get_lane_mask(struct csiphy_lanes_cfg *lane_cfg)
>  static int csiphy_stream_on(struct csiphy_device *csiphy)
>  {
>  	struct csiphy_config *cfg = &csiphy->cfg;
> -	u32 pixel_clock;
> +	u64 pixel_clock;
>  	u8 lane_mask = csiphy_get_lane_mask(&cfg->csi2->lane_cfg);
>  	u8 bpp = csiphy_get_bpp(csiphy->formats, csiphy->nformats,
>  				csiphy->fmt[MSM_CSIPHY_PAD_SINK].code);
> diff --git a/drivers/media/platform/qcom/camss/camss-csiphy.h b/drivers/media/platform/qcom/camss/camss-csiphy.h
> index f7967ef836dcc..450c8247bd533 100644
> --- a/drivers/media/platform/qcom/camss/camss-csiphy.h
> +++ b/drivers/media/platform/qcom/camss/camss-csiphy.h
> @@ -50,7 +50,7 @@ struct csiphy_hw_ops {
>  	void (*reset)(struct csiphy_device *csiphy);
>  	void (*lanes_enable)(struct csiphy_device *csiphy,
>  			     struct csiphy_config *cfg,
> -			     u32 pixel_clock, u8 bpp, u8 lane_mask);
> +			     u64 pixel_clock, u8 bpp, u8 lane_mask);
>  	void (*lanes_disable)(struct csiphy_device *csiphy,
>  			      struct csiphy_config *cfg);
>  	irqreturn_t (*isr)(int irq, void *dev);
> diff --git a/drivers/media/platform/qcom/camss/camss-vfe.c b/drivers/media/platform/qcom/camss/camss-vfe.c
> index fae2b513b2f9d..b2c95b46ce661 100644
> --- a/drivers/media/platform/qcom/camss/camss-vfe.c
> +++ b/drivers/media/platform/qcom/camss/camss-vfe.c
> @@ -1112,7 +1112,7 @@ static inline void vfe_isr_halt_ack(struct vfe_device *vfe)
>  static int vfe_set_clock_rates(struct vfe_device *vfe)
>  {
>  	struct device *dev = vfe->camss->dev;
> -	u32 pixel_clock[MSM_VFE_LINE_NUM];
> +	u64 pixel_clock[MSM_VFE_LINE_NUM];
>  	int i, j;
>  	int ret;
>  
> @@ -1194,7 +1194,7 @@ static int vfe_set_clock_rates(struct vfe_device *vfe)
>   */
>  static int vfe_check_clock_rates(struct vfe_device *vfe)
>  {
> -	u32 pixel_clock[MSM_VFE_LINE_NUM];
> +	u64 pixel_clock[MSM_VFE_LINE_NUM];
>  	int i, j;
>  	int ret;
>  
> diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c
> index 8fefce57bc49f..eb55cf436b717 100644
> --- a/drivers/media/platform/qcom/camss/camss.c
> +++ b/drivers/media/platform/qcom/camss/camss.c
> @@ -555,7 +555,7 @@ struct media_entity *camss_find_sensor(struct media_entity *entity)
>   *
>   * Return 0 on success or a negative error code otherwise
>   */
> -int camss_get_pixel_clock(struct media_entity *entity, u32 *pixel_clock)
> +int camss_get_pixel_clock(struct media_entity *entity, u64 *pixel_clock)
>  {
>  	struct media_entity *sensor;
>  	struct v4l2_subdev *subdev;
> diff --git a/drivers/media/platform/qcom/camss/camss.h b/drivers/media/platform/qcom/camss/camss.h
> index 3a0484683cd6e..fabfce9a3496c 100644
> --- a/drivers/media/platform/qcom/camss/camss.h
> +++ b/drivers/media/platform/qcom/camss/camss.h
> @@ -108,7 +108,7 @@ int camss_enable_clocks(int nclocks, struct camss_clock *clock,
>  			struct device *dev);
>  void camss_disable_clocks(int nclocks, struct camss_clock *clock);
>  struct media_entity *camss_find_sensor(struct media_entity *entity);
> -int camss_get_pixel_clock(struct media_entity *entity, u32 *pixel_clock);
> +int camss_get_pixel_clock(struct media_entity *entity, u64 *pixel_clock);
>  int camss_pm_domain_on(struct camss *camss, int id);
>  void camss_pm_domain_off(struct camss *camss, int id);
>  void camss_delete(struct camss *camss);
>
diff mbox series

Patch

diff --git a/drivers/media/platform/qcom/camss/camss-csid.c b/drivers/media/platform/qcom/camss/camss-csid.c
index be3fe76f3dc30..6307b889baa69 100644
--- a/drivers/media/platform/qcom/camss/camss-csid.c
+++ b/drivers/media/platform/qcom/camss/camss-csid.c
@@ -462,7 +462,7 @@  static irqreturn_t csid_isr(int irq, void *dev)
 static int csid_set_clock_rates(struct csid_device *csid)
 {
 	struct device *dev = csid->camss->dev;
-	u32 pixel_clock;
+	u64 pixel_clock;
 	int i, j;
 	int ret;
 
diff --git a/drivers/media/platform/qcom/camss/camss-csiphy-2ph-1-0.c b/drivers/media/platform/qcom/camss/camss-csiphy-2ph-1-0.c
index 12bce391d71fd..ec66d1557b8b1 100644
--- a/drivers/media/platform/qcom/camss/camss-csiphy-2ph-1-0.c
+++ b/drivers/media/platform/qcom/camss/camss-csiphy-2ph-1-0.c
@@ -57,7 +57,7 @@  static void csiphy_reset(struct csiphy_device *csiphy)
  * Return settle count value or 0 if the CSI2 pixel clock
  * frequency is not available
  */
-static u8 csiphy_settle_cnt_calc(u32 pixel_clock, u8 bpp, u8 num_lanes,
+static u8 csiphy_settle_cnt_calc(u64 pixel_clock, u8 bpp, u8 num_lanes,
 				 u32 timer_clk_rate)
 {
 	u32 mipi_clock; /* Hz */
@@ -83,7 +83,7 @@  static u8 csiphy_settle_cnt_calc(u32 pixel_clock, u8 bpp, u8 num_lanes,
 
 static void csiphy_lanes_enable(struct csiphy_device *csiphy,
 				struct csiphy_config *cfg,
-				u32 pixel_clock, u8 bpp, u8 lane_mask)
+				u64 pixel_clock, u8 bpp, u8 lane_mask)
 {
 	struct csiphy_lanes_cfg *c = &cfg->csi2->lane_cfg;
 	u8 settle_cnt;
diff --git a/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c b/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c
index 97cb9de850315..cd6eb88a7c153 100644
--- a/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c
+++ b/drivers/media/platform/qcom/camss/camss-csiphy-3ph-1-0.c
@@ -113,7 +113,7 @@  static irqreturn_t csiphy_isr(int irq, void *dev)
  * Return settle count value or 0 if the CSI2 pixel clock
  * frequency is not available
  */
-static u8 csiphy_settle_cnt_calc(u32 pixel_clock, u8 bpp, u8 num_lanes,
+static u8 csiphy_settle_cnt_calc(u64 pixel_clock, u8 bpp, u8 num_lanes,
 				 u32 timer_clk_rate)
 {
 	u32 mipi_clock; /* Hz */
@@ -137,7 +137,7 @@  static u8 csiphy_settle_cnt_calc(u32 pixel_clock, u8 bpp, u8 num_lanes,
 
 static void csiphy_lanes_enable(struct csiphy_device *csiphy,
 				struct csiphy_config *cfg,
-				u32 pixel_clock, u8 bpp, u8 lane_mask)
+				u64 pixel_clock, u8 bpp, u8 lane_mask)
 {
 	struct csiphy_lanes_cfg *c = &cfg->csi2->lane_cfg;
 	u8 settle_cnt;
diff --git a/drivers/media/platform/qcom/camss/camss-csiphy.c b/drivers/media/platform/qcom/camss/camss-csiphy.c
index 509c9a59c09cd..61628f55c4f63 100644
--- a/drivers/media/platform/qcom/camss/camss-csiphy.c
+++ b/drivers/media/platform/qcom/camss/camss-csiphy.c
@@ -102,7 +102,7 @@  static u8 csiphy_get_bpp(const struct csiphy_format *formats,
 static int csiphy_set_clock_rates(struct csiphy_device *csiphy)
 {
 	struct device *dev = csiphy->camss->dev;
-	u32 pixel_clock;
+	u64 pixel_clock;
 	int i, j;
 	int ret;
 
@@ -238,7 +238,7 @@  static u8 csiphy_get_lane_mask(struct csiphy_lanes_cfg *lane_cfg)
 static int csiphy_stream_on(struct csiphy_device *csiphy)
 {
 	struct csiphy_config *cfg = &csiphy->cfg;
-	u32 pixel_clock;
+	u64 pixel_clock;
 	u8 lane_mask = csiphy_get_lane_mask(&cfg->csi2->lane_cfg);
 	u8 bpp = csiphy_get_bpp(csiphy->formats, csiphy->nformats,
 				csiphy->fmt[MSM_CSIPHY_PAD_SINK].code);
diff --git a/drivers/media/platform/qcom/camss/camss-csiphy.h b/drivers/media/platform/qcom/camss/camss-csiphy.h
index f7967ef836dcc..450c8247bd533 100644
--- a/drivers/media/platform/qcom/camss/camss-csiphy.h
+++ b/drivers/media/platform/qcom/camss/camss-csiphy.h
@@ -50,7 +50,7 @@  struct csiphy_hw_ops {
 	void (*reset)(struct csiphy_device *csiphy);
 	void (*lanes_enable)(struct csiphy_device *csiphy,
 			     struct csiphy_config *cfg,
-			     u32 pixel_clock, u8 bpp, u8 lane_mask);
+			     u64 pixel_clock, u8 bpp, u8 lane_mask);
 	void (*lanes_disable)(struct csiphy_device *csiphy,
 			      struct csiphy_config *cfg);
 	irqreturn_t (*isr)(int irq, void *dev);
diff --git a/drivers/media/platform/qcom/camss/camss-vfe.c b/drivers/media/platform/qcom/camss/camss-vfe.c
index fae2b513b2f9d..b2c95b46ce661 100644
--- a/drivers/media/platform/qcom/camss/camss-vfe.c
+++ b/drivers/media/platform/qcom/camss/camss-vfe.c
@@ -1112,7 +1112,7 @@  static inline void vfe_isr_halt_ack(struct vfe_device *vfe)
 static int vfe_set_clock_rates(struct vfe_device *vfe)
 {
 	struct device *dev = vfe->camss->dev;
-	u32 pixel_clock[MSM_VFE_LINE_NUM];
+	u64 pixel_clock[MSM_VFE_LINE_NUM];
 	int i, j;
 	int ret;
 
@@ -1194,7 +1194,7 @@  static int vfe_set_clock_rates(struct vfe_device *vfe)
  */
 static int vfe_check_clock_rates(struct vfe_device *vfe)
 {
-	u32 pixel_clock[MSM_VFE_LINE_NUM];
+	u64 pixel_clock[MSM_VFE_LINE_NUM];
 	int i, j;
 	int ret;
 
diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c
index 8fefce57bc49f..eb55cf436b717 100644
--- a/drivers/media/platform/qcom/camss/camss.c
+++ b/drivers/media/platform/qcom/camss/camss.c
@@ -555,7 +555,7 @@  struct media_entity *camss_find_sensor(struct media_entity *entity)
  *
  * Return 0 on success or a negative error code otherwise
  */
-int camss_get_pixel_clock(struct media_entity *entity, u32 *pixel_clock)
+int camss_get_pixel_clock(struct media_entity *entity, u64 *pixel_clock)
 {
 	struct media_entity *sensor;
 	struct v4l2_subdev *subdev;
diff --git a/drivers/media/platform/qcom/camss/camss.h b/drivers/media/platform/qcom/camss/camss.h
index 3a0484683cd6e..fabfce9a3496c 100644
--- a/drivers/media/platform/qcom/camss/camss.h
+++ b/drivers/media/platform/qcom/camss/camss.h
@@ -108,7 +108,7 @@  int camss_enable_clocks(int nclocks, struct camss_clock *clock,
 			struct device *dev);
 void camss_disable_clocks(int nclocks, struct camss_clock *clock);
 struct media_entity *camss_find_sensor(struct media_entity *entity);
-int camss_get_pixel_clock(struct media_entity *entity, u32 *pixel_clock);
+int camss_get_pixel_clock(struct media_entity *entity, u64 *pixel_clock);
 int camss_pm_domain_on(struct camss *camss, int id);
 void camss_pm_domain_off(struct camss *camss, int id);
 void camss_delete(struct camss *camss);