drm/amd/display: fix bug where we are creating bogus i2c aux
authorTony Cheng <tony.cheng@amd.com>
Fri, 15 Jun 2018 21:53:35 +0000 (17:53 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 13 Jul 2018 19:47:25 +0000 (14:47 -0500)
[WHY]
we were using  6 instances based on i2caux_dce110.c

[HOW]
pass in how many instances to ctor

Signed-off-by: Tony Cheng <tony.cheng@amd.com>
Reviewed-by: Yongqiang Sun <yongqiang.sun@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/i2caux/dce100/i2caux_dce100.c
drivers/gpu/drm/amd/display/dc/i2caux/dce110/i2caux_dce110.c
drivers/gpu/drm/amd/display/dc/i2caux/dce110/i2caux_dce110.h
drivers/gpu/drm/amd/display/dc/i2caux/dce112/i2caux_dce112.c
drivers/gpu/drm/amd/display/dc/i2caux/dce120/i2caux_dce120.c
drivers/gpu/drm/amd/display/dc/i2caux/dcn10/i2caux_dcn10.c

index e8d3781..8b704ab 100644 (file)
@@ -97,6 +97,7 @@ struct i2caux *dal_i2caux_dce100_create(
 
        dal_i2caux_dce110_construct(i2caux_dce110,
                                    ctx,
+                                   ARRAY_SIZE(dce100_aux_regs),
                                    dce100_aux_regs,
                                    dce100_hw_engine_regs,
                                    &i2c_shift,
index 2a047f8..e0557d3 100644 (file)
@@ -199,6 +199,7 @@ static const struct dce110_i2c_hw_engine_mask i2c_mask = {
 void dal_i2caux_dce110_construct(
        struct i2caux_dce110 *i2caux_dce110,
        struct dc_context *ctx,
+       unsigned int num_i2caux_inst,
        const struct dce110_aux_registers aux_regs[],
        const struct dce110_i2c_hw_engine_registers i2c_hw_engine_regs[],
        const struct dce110_i2c_hw_engine_shift *i2c_shift,
@@ -251,7 +252,7 @@ void dal_i2caux_dce110_construct(
                        dal_i2c_hw_engine_dce110_create(&hw_arg_dce110);
 
                ++i;
-       } while (i < ARRAY_SIZE(hw_ddc_lines));
+       } while (i < num_i2caux_inst);
 
        /* Create AUX engines for all lines which has assisted HW AUX
         * 'i' (loop counter) used as DDC/AUX engine_id */
@@ -272,7 +273,7 @@ void dal_i2caux_dce110_construct(
                        dal_aux_engine_dce110_create(&aux_init_data);
 
                ++i;
-       } while (i < ARRAY_SIZE(hw_aux_lines));
+       } while (i < num_i2caux_inst);
 
        /*TODO Generic I2C SW and HW*/
 }
@@ -303,6 +304,7 @@ struct i2caux *dal_i2caux_dce110_create(
 
        dal_i2caux_dce110_construct(i2caux_dce110,
                                    ctx,
+                                   ARRAY_SIZE(dce110_aux_regs),
                                    dce110_aux_regs,
                                    i2c_hw_engine_regs,
                                    &i2c_shift,
index 1b1f71c..d3d8cc5 100644 (file)
@@ -45,6 +45,7 @@ struct i2caux *dal_i2caux_dce110_create(
 void dal_i2caux_dce110_construct(
        struct i2caux_dce110 *i2caux_dce110,
        struct dc_context *ctx,
+       unsigned int num_i2caux_inst,
        const struct dce110_aux_registers *aux_regs,
        const struct dce110_i2c_hw_engine_registers *i2c_hw_engine_regs,
        const struct dce110_i2c_hw_engine_shift *i2c_shift,
index dafc1a7..a9db047 100644 (file)
@@ -93,6 +93,7 @@ static void construct(
 {
        dal_i2caux_dce110_construct(i2caux_dce110,
                                    ctx,
+                                   ARRAY_SIZE(dce112_aux_regs),
                                    dce112_aux_regs,
                                    dce112_hw_engine_regs,
                                    &i2c_shift,
index 0e7b182..6a4f344 100644 (file)
@@ -111,6 +111,7 @@ struct i2caux *dal_i2caux_dce120_create(
 
        dal_i2caux_dce110_construct(i2caux_dce110,
                                    ctx,
+                                   ARRAY_SIZE(dce120_aux_regs),
                                    dce120_aux_regs,
                                    dce120_hw_engine_regs,
                                    &i2c_shift,
index e44a890..a59c1f5 100644 (file)
@@ -111,6 +111,7 @@ struct i2caux *dal_i2caux_dcn10_create(
 
        dal_i2caux_dce110_construct(i2caux_dce110,
                                    ctx,
+                                   ARRAY_SIZE(dcn10_aux_regs),
                                    dcn10_aux_regs,
                                    dcn10_hw_engine_regs,
                                    &i2c_shift,