RE: [PATCH 2/3] drm/amd/amdgpu: Add ISP driver support
[AMD Official Use Only - General] Thanks Mario for the inputs and clarifications on the offline chat. I submitted a fresh set of 3 patches addressing the comments, adding the cover-letter and brief change log in the cutlist in patch-2. Hope this is in the right format. Incase this needs to be further improved, please let us know. Thanks, Pratap -Original Message- From: Limonciello, Mario Sent: Thursday, May 9, 2024 1:22 PM To: Nirujogi, Pratap ; amd-gfx@lists.freedesktop.org Cc: Deucher, Alexander ; Chan, Benjamin (Koon Pan) ; Li, King ; Du, Bin Subject: RE: [PATCH 2/3] drm/amd/amdgpu: Add ISP driver support [AMD Official Use Only - General] Thanks, I'll take a look. In general make sure that you prefix new versions with "PATCH v2", "PATCH v3" etc and include a changelog below the cutlist or in the cover letter. There is a --subject-prefix argument for git send-email you can use. It's okay this time, but if you end up spinning again for a v3 do that. > -Original Message- > From: Nirujogi, Pratap > Sent: Thursday, May 9, 2024 12:19 > To: Limonciello, Mario ; amd- > g...@lists.freedesktop.org > Cc: Deucher, Alexander ; Chan, Benjamin > (Koon Pan) ; Li, King ; Du, > Bin > Subject: RE: [PATCH 2/3] drm/amd/amdgpu: Add ISP driver support > > [AMD Official Use Only - General] > > Hi Mario, > > I addressed the comments, submitted the updated patchset, please > review and let us know your comments. > > Thanks, > Pratap > > -Original Message- > From: Limonciello, Mario > Sent: Thursday, May 9, 2024 10:15 AM > To: Nirujogi, Pratap ; amd- > g...@lists.freedesktop.org > Cc: Deucher, Alexander ; Chan, Benjamin > (Koon Pan) ; Li, King ; Du, > Bin > Subject: Re: [PATCH 2/3] drm/amd/amdgpu: Add ISP driver support > > On 5/8/2024 09:50, Pratap Nirujogi wrote: > > Add the isp driver in amdgpu to support ISP device on the APUs that > > supports ISP IP block. ISP hw block is used for camera front-end, > > pre and post processing operations. > > > > Signed-off-by: Pratap Nirujogi > > --- > > drivers/gpu/drm/amd/amdgpu/Makefile | 3 + > > drivers/gpu/drm/amd/amdgpu/amdgpu.h | 4 + > > drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c | 298 > ++ > > drivers/gpu/drm/amd/amdgpu/amdgpu_isp.h | 54 > > drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 3 + > > drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 5 + > > drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h | 1 + > > 7 files changed, 368 insertions(+) > > create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c > > create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_isp.h > > > > diff --git a/drivers/gpu/drm/amd/amdgpu/Makefile > > b/drivers/gpu/drm/amd/amdgpu/Makefile > > index de7b76327f5b..12ba76025cb7 100644 > > --- a/drivers/gpu/drm/amd/amdgpu/Makefile > > +++ b/drivers/gpu/drm/amd/amdgpu/Makefile > > @@ -324,4 +324,7 @@ amdgpu-y += $(AMD_DISPLAY_FILES) > > > > endif > > > > +# add isp block > > +amdgpu-y += amdgpu_isp.o > > + > > obj-$(CONFIG_DRM_AMDGPU)+= amdgpu.o diff --git > > a/drivers/gpu/drm/amd/amdgpu/amdgpu.h > > b/drivers/gpu/drm/amd/amdgpu/amdgpu.h > > index eb60d28a3a13..6d7f9ef53269 100644 > > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h > > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h > > @@ -112,6 +112,7 @@ > > #include "amdgpu_xcp.h" > > #include "amdgpu_seq64.h" > > #include "amdgpu_reg_state.h" > > +#include "amdgpu_isp.h" > > > > #define MAX_GPU_INSTANCE64 > > > > @@ -1045,6 +1046,9 @@ struct amdgpu_device { > > /* display related functionality */ > > struct amdgpu_display_manager dm; > > > > + /* isp */ > > + struct amdgpu_isp isp; > > + > > /* mes */ > > boolenable_mes; > > boolenable_mes_kiq; > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c > > b/drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c > > new file mode 100644 > > index ..dcc01a339a43 > > --- /dev/null > > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c > > @@ -0,0 +1,298 @@ > > +/* SPDX-License-Identifier: MIT */ > > +/* > > + * Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved. > > + * All Rights Reserved. > > + * > > + * Permission is hereby granted, free of charge, to any person > > +obtaining a > > + * copy of this software and associated documentation files (the > > + * "Software
RE: [PATCH 2/3] drm/amd/amdgpu: Add ISP driver support
[AMD Official Use Only - General] Hi Alex, Please see inline comments. RE: You should replace 162 with whatever the src id you need for your IP is. 162 was the src id for ACP. I think it's something else for ISP. Also, if you need both the client id and the src id, you should update amdgpu_irq_create_mapping() to take into account both ids. >> removed adding the IORESOURCE_IRQ in this patch and is taken care of it in >> the separate patch(i.e. patch 4/4), which is yet to submitted to amd-gfx >> group. Thanks, Pratap -Original Message- From: Alex Deucher Sent: Thursday, May 9, 2024 11:35 AM To: Nirujogi, Pratap Cc: amd-gfx@lists.freedesktop.org; Deucher, Alexander ; Chan, Benjamin (Koon Pan) ; Li, King ; Du, Bin Subject: Re: [PATCH 2/3] drm/amd/amdgpu: Add ISP driver support Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding. On Wed, May 8, 2024 at 11:17 AM Pratap Nirujogi mailto:pratap.niruj...@amd.com>> wrote: > > Add the isp driver in amdgpu to support ISP device on the APUs that > supports ISP IP block. ISP hw block is used for camera front-end, pre > and post processing operations. > > Signed-off-by: Pratap Nirujogi > mailto:pratap.niruj...@amd.com>> > --- > drivers/gpu/drm/amd/amdgpu/Makefile | 3 + > drivers/gpu/drm/amd/amdgpu/amdgpu.h | 4 + > drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c | 298 ++ > drivers/gpu/drm/amd/amdgpu/amdgpu_isp.h | 54 > drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 3 + > drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 5 + > drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h | 1 + > 7 files changed, 368 insertions(+) > create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c > create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_isp.h > > diff --git a/drivers/gpu/drm/amd/amdgpu/Makefile > b/drivers/gpu/drm/amd/amdgpu/Makefile > index de7b76327f5b..12ba76025cb7 100644 > --- a/drivers/gpu/drm/amd/amdgpu/Makefile > +++ b/drivers/gpu/drm/amd/amdgpu/Makefile > @@ -324,4 +324,7 @@ amdgpu-y += $(AMD_DISPLAY_FILES) > > endif > > +# add isp block > +amdgpu-y += amdgpu_isp.o > + > obj-$(CONFIG_DRM_AMDGPU)+= amdgpu.o > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h > b/drivers/gpu/drm/amd/amdgpu/amdgpu.h > index eb60d28a3a13..6d7f9ef53269 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h > @@ -112,6 +112,7 @@ > #include "amdgpu_xcp.h" > #include "amdgpu_seq64.h" > #include "amdgpu_reg_state.h" > +#include "amdgpu_isp.h" > > #define MAX_GPU_INSTANCE 64 > > @@ -1045,6 +1046,9 @@ struct amdgpu_device { > /* display related functionality */ > struct amdgpu_display_manager dm; > > + /* isp */ > + struct amdgpu_isp isp; > + > /* mes */ > boolenable_mes; > boolenable_mes_kiq; > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c > b/drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c > new file mode 100644 > index ..dcc01a339a43 > --- /dev/null > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c > @@ -0,0 +1,298 @@ > +/* SPDX-License-Identifier: MIT */ > +/* > + * Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved. > + * All Rights Reserved. > + * > + * Permission is hereby granted, free of charge, to any person > +obtaining a > + * copy of this software and associated documentation files (the > + * "Software"), to deal in the Software without restriction, > +including > + * without limitation the rights to use, copy, modify, merge, > +publish, > + * distribute, sub license, and/or sell copies of the Software, and > +to > + * permit persons to whom the Software is furnished to do so, subject > +to > + * the following conditions: > + * > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, > +EXPRESS OR > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF > +MERCHANTABILITY, > + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT > +SHALL > + * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR > +ANY CLAIM, > + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT > +OR > + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE > +OR THE > + * USE OR OTHER DEALINGS IN THE SOFTWARE. > + * > + * The above copyright notice and this permission notice (including > +the >
RE: [PATCH 2/3] drm/amd/amdgpu: Add ISP driver support
[AMD Official Use Only - General] Thanks, I'll take a look. In general make sure that you prefix new versions with "PATCH v2", "PATCH v3" etc and include a changelog below the cutlist or in the cover letter. There is a --subject-prefix argument for git send-email you can use. It's okay this time, but if you end up spinning again for a v3 do that. > -Original Message- > From: Nirujogi, Pratap > Sent: Thursday, May 9, 2024 12:19 > To: Limonciello, Mario ; amd- > g...@lists.freedesktop.org > Cc: Deucher, Alexander ; Chan, Benjamin > (Koon Pan) ; Li, King ; Du, > Bin > Subject: RE: [PATCH 2/3] drm/amd/amdgpu: Add ISP driver support > > [AMD Official Use Only - General] > > Hi Mario, > > I addressed the comments, submitted the updated patchset, please review > and let us know your comments. > > Thanks, > Pratap > > -Original Message- > From: Limonciello, Mario > Sent: Thursday, May 9, 2024 10:15 AM > To: Nirujogi, Pratap ; amd- > g...@lists.freedesktop.org > Cc: Deucher, Alexander ; Chan, Benjamin > (Koon Pan) ; Li, King ; Du, > Bin > Subject: Re: [PATCH 2/3] drm/amd/amdgpu: Add ISP driver support > > On 5/8/2024 09:50, Pratap Nirujogi wrote: > > Add the isp driver in amdgpu to support ISP device on the APUs that > > supports ISP IP block. ISP hw block is used for camera front-end, pre > > and post processing operations. > > > > Signed-off-by: Pratap Nirujogi > > --- > > drivers/gpu/drm/amd/amdgpu/Makefile | 3 + > > drivers/gpu/drm/amd/amdgpu/amdgpu.h | 4 + > > drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c | 298 > ++ > > drivers/gpu/drm/amd/amdgpu/amdgpu_isp.h | 54 > > drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 3 + > > drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 5 + > > drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h | 1 + > > 7 files changed, 368 insertions(+) > > create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c > > create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_isp.h > > > > diff --git a/drivers/gpu/drm/amd/amdgpu/Makefile > > b/drivers/gpu/drm/amd/amdgpu/Makefile > > index de7b76327f5b..12ba76025cb7 100644 > > --- a/drivers/gpu/drm/amd/amdgpu/Makefile > > +++ b/drivers/gpu/drm/amd/amdgpu/Makefile > > @@ -324,4 +324,7 @@ amdgpu-y += $(AMD_DISPLAY_FILES) > > > > endif > > > > +# add isp block > > +amdgpu-y += amdgpu_isp.o > > + > > obj-$(CONFIG_DRM_AMDGPU)+= amdgpu.o > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h > > b/drivers/gpu/drm/amd/amdgpu/amdgpu.h > > index eb60d28a3a13..6d7f9ef53269 100644 > > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h > > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h > > @@ -112,6 +112,7 @@ > > #include "amdgpu_xcp.h" > > #include "amdgpu_seq64.h" > > #include "amdgpu_reg_state.h" > > +#include "amdgpu_isp.h" > > > > #define MAX_GPU_INSTANCE64 > > > > @@ -1045,6 +1046,9 @@ struct amdgpu_device { > > /* display related functionality */ > > struct amdgpu_display_manager dm; > > > > + /* isp */ > > + struct amdgpu_isp isp; > > + > > /* mes */ > > boolenable_mes; > > boolenable_mes_kiq; > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c > > b/drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c > > new file mode 100644 > > index ..dcc01a339a43 > > --- /dev/null > > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c > > @@ -0,0 +1,298 @@ > > +/* SPDX-License-Identifier: MIT */ > > +/* > > + * Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved. > > + * All Rights Reserved. > > + * > > + * Permission is hereby granted, free of charge, to any person > > +obtaining a > > + * copy of this software and associated documentation files (the > > + * "Software"), to deal in the Software without restriction, > > +including > > + * without limitation the rights to use, copy, modify, merge, > > +publish, > > + * distribute, sub license, and/or sell copies of the Software, and > > +to > > + * permit persons to whom the Software is furnished to do so, subject > > +to > > + * the following conditions: > > + * > > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY > KIND, > > +EXPRESS OR > > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF > > +MERCHANTABILITY, > > +
RE: [PATCH 2/3] drm/amd/amdgpu: Add ISP driver support
[AMD Official Use Only - General] Hi Mario, I addressed the comments, submitted the updated patchset, please review and let us know your comments. Thanks, Pratap -Original Message- From: Limonciello, Mario Sent: Thursday, May 9, 2024 10:15 AM To: Nirujogi, Pratap ; amd-gfx@lists.freedesktop.org Cc: Deucher, Alexander ; Chan, Benjamin (Koon Pan) ; Li, King ; Du, Bin Subject: Re: [PATCH 2/3] drm/amd/amdgpu: Add ISP driver support On 5/8/2024 09:50, Pratap Nirujogi wrote: > Add the isp driver in amdgpu to support ISP device on the APUs that > supports ISP IP block. ISP hw block is used for camera front-end, pre > and post processing operations. > > Signed-off-by: Pratap Nirujogi > --- > drivers/gpu/drm/amd/amdgpu/Makefile | 3 + > drivers/gpu/drm/amd/amdgpu/amdgpu.h | 4 + > drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c | 298 ++ > drivers/gpu/drm/amd/amdgpu/amdgpu_isp.h | 54 > drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 3 + > drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 5 + > drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h | 1 + > 7 files changed, 368 insertions(+) > create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c > create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_isp.h > > diff --git a/drivers/gpu/drm/amd/amdgpu/Makefile > b/drivers/gpu/drm/amd/amdgpu/Makefile > index de7b76327f5b..12ba76025cb7 100644 > --- a/drivers/gpu/drm/amd/amdgpu/Makefile > +++ b/drivers/gpu/drm/amd/amdgpu/Makefile > @@ -324,4 +324,7 @@ amdgpu-y += $(AMD_DISPLAY_FILES) > > endif > > +# add isp block > +amdgpu-y += amdgpu_isp.o > + > obj-$(CONFIG_DRM_AMDGPU)+= amdgpu.o > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h > b/drivers/gpu/drm/amd/amdgpu/amdgpu.h > index eb60d28a3a13..6d7f9ef53269 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h > @@ -112,6 +112,7 @@ > #include "amdgpu_xcp.h" > #include "amdgpu_seq64.h" > #include "amdgpu_reg_state.h" > +#include "amdgpu_isp.h" > > #define MAX_GPU_INSTANCE64 > > @@ -1045,6 +1046,9 @@ struct amdgpu_device { > /* display related functionality */ > struct amdgpu_display_manager dm; > > + /* isp */ > + struct amdgpu_isp isp; > + > /* mes */ > boolenable_mes; > boolenable_mes_kiq; > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c > b/drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c > new file mode 100644 > index ..dcc01a339a43 > --- /dev/null > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c > @@ -0,0 +1,298 @@ > +/* SPDX-License-Identifier: MIT */ > +/* > + * Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved. > + * All Rights Reserved. > + * > + * Permission is hereby granted, free of charge, to any person > +obtaining a > + * copy of this software and associated documentation files (the > + * "Software"), to deal in the Software without restriction, > +including > + * without limitation the rights to use, copy, modify, merge, > +publish, > + * distribute, sub license, and/or sell copies of the Software, and > +to > + * permit persons to whom the Software is furnished to do so, subject > +to > + * the following conditions: > + * > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, > +EXPRESS OR > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF > +MERCHANTABILITY, > + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT > +SHALL > + * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR > +ANY CLAIM, > + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT > +OR > + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE > +OR THE > + * USE OR OTHER DEALINGS IN THE SOFTWARE. > + * > + * The above copyright notice and this permission notice (including > +the > + * next paragraph) shall be included in all copies or substantial > +portions > + * of the Software. > + * > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include "amdgpu_smu.h" > +#include "atom.h" > +#include "amdgpu_isp.h" > +#include "smu_internal.h" > +#include "smu_v11_5_ppsmc.h" > +#include "smu_v11_5_pmfw.h" > + > +#define mmDAGB0_WRCLI5_V4_1 0x6811C > +#define mmDAGB0_WRCLI9_V4_1 0x6812C > +#define mmDAGB0_WRCLI10_V4_1 0x68130 > +#define mmDAGB0_WRCLI14_V4_1 0x68140 > +#define mmDAGB0_WRCLI19_V4_1 0x68154 > +#define mmDAG
[PATCH 2/3] drm/amd/amdgpu: Add ISP driver support
Add the isp driver in amdgpu to support ISP device on the APUs that supports ISP IP block. ISP hw block is used for camera front-end, pre and post processing operations. Signed-off-by: Pratap Nirujogi Change-Id: I67ef206e5eca1fe74e495c3262746be495e17d09 --- drivers/gpu/drm/amd/amdgpu/Makefile | 3 + drivers/gpu/drm/amd/amdgpu/amdgpu.h | 4 + drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c | 287 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_isp.h | 54 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 3 + drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 5 + drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h | 1 + 7 files changed, 357 insertions(+) create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_isp.h diff --git a/drivers/gpu/drm/amd/amdgpu/Makefile b/drivers/gpu/drm/amd/amdgpu/Makefile index de7b76327f5b..12ba76025cb7 100644 --- a/drivers/gpu/drm/amd/amdgpu/Makefile +++ b/drivers/gpu/drm/amd/amdgpu/Makefile @@ -324,4 +324,7 @@ amdgpu-y += $(AMD_DISPLAY_FILES) endif +# add isp block +amdgpu-y += amdgpu_isp.o + obj-$(CONFIG_DRM_AMDGPU)+= amdgpu.o diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index eb60d28a3a13..6d7f9ef53269 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h @@ -112,6 +112,7 @@ #include "amdgpu_xcp.h" #include "amdgpu_seq64.h" #include "amdgpu_reg_state.h" +#include "amdgpu_isp.h" #define MAX_GPU_INSTANCE 64 @@ -1045,6 +1046,9 @@ struct amdgpu_device { /* display related functionality */ struct amdgpu_display_manager dm; + /* isp */ + struct amdgpu_isp isp; + /* mes */ boolenable_mes; boolenable_mes_kiq; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c new file mode 100644 index ..97e67a147259 --- /dev/null +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c @@ -0,0 +1,287 @@ +/* SPDX-License-Identifier: MIT */ +/* + * Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "amdgpu_smu.h" +#include "atom.h" +#include "amdgpu_isp.h" +#include "smu_internal.h" +#include "smu_v11_5_ppsmc.h" +#include "smu_v11_5_pmfw.h" + +#define mmDAGB0_WRCLI5_V4_10x6811C +#define mmDAGB0_WRCLI9_V4_10x6812C +#define mmDAGB0_WRCLI10_V4_1 0x68130 +#define mmDAGB0_WRCLI14_V4_1 0x68140 +#define mmDAGB0_WRCLI19_V4_1 0x68154 +#define mmDAGB0_WRCLI20_V4_1 0x68158 + +static int isp_sw_init(void *handle) +{ + struct amdgpu_device *adev = (struct amdgpu_device *)handle; + + adev->isp.parent = adev->dev; + + adev->isp.cgs_device = amdgpu_cgs_create_device(adev); + if (!adev->isp.cgs_device) + return -EINVAL; + + return 0; +} + +static int isp_sw_fini(void *handle) +{ + struct amdgpu_device *adev = (struct amdgpu_device *)handle; + + if (adev->isp.cgs_device) + amdgpu_cgs_destroy_device(adev->isp.cgs_device); + + return 0; +} + +/** + * isp_hw_init - start and test isp block + * + * @handle: handle for amdgpu_device pointer + * + */ +static int isp_hw_init(void *handle) +{ + int r; + u64 isp_base; + struct amdgpu_device *adev = (struct amdgpu_device *)handle; + + const struct amdgpu_ip_block *ip_block = + amdgpu_device_ip_get_ip_block(adev, AMD_IP_BLOCK_TYPE_ISP); + + if (!ip_block) + return -EINVAL; + + if (adev->rmmio_size == 0 || adev->rmmio_size < 0x5289) + return -EINVAL; + + isp_base = adev->rmmio_base; + +
Re: [PATCH 2/3] drm/amd/amdgpu: Add ISP driver support
On Wed, May 8, 2024 at 11:17 AM Pratap Nirujogi wrote: > > Add the isp driver in amdgpu to support ISP device on the APUs that > supports ISP IP block. ISP hw block is used for camera front-end, pre > and post processing operations. > > Signed-off-by: Pratap Nirujogi > --- > drivers/gpu/drm/amd/amdgpu/Makefile | 3 + > drivers/gpu/drm/amd/amdgpu/amdgpu.h | 4 + > drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c | 298 ++ > drivers/gpu/drm/amd/amdgpu/amdgpu_isp.h | 54 > drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 3 + > drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 5 + > drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h | 1 + > 7 files changed, 368 insertions(+) > create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c > create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_isp.h > > diff --git a/drivers/gpu/drm/amd/amdgpu/Makefile > b/drivers/gpu/drm/amd/amdgpu/Makefile > index de7b76327f5b..12ba76025cb7 100644 > --- a/drivers/gpu/drm/amd/amdgpu/Makefile > +++ b/drivers/gpu/drm/amd/amdgpu/Makefile > @@ -324,4 +324,7 @@ amdgpu-y += $(AMD_DISPLAY_FILES) > > endif > > +# add isp block > +amdgpu-y += amdgpu_isp.o > + > obj-$(CONFIG_DRM_AMDGPU)+= amdgpu.o > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h > b/drivers/gpu/drm/amd/amdgpu/amdgpu.h > index eb60d28a3a13..6d7f9ef53269 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h > @@ -112,6 +112,7 @@ > #include "amdgpu_xcp.h" > #include "amdgpu_seq64.h" > #include "amdgpu_reg_state.h" > +#include "amdgpu_isp.h" > > #define MAX_GPU_INSTANCE 64 > > @@ -1045,6 +1046,9 @@ struct amdgpu_device { > /* display related functionality */ > struct amdgpu_display_manager dm; > > + /* isp */ > + struct amdgpu_isp isp; > + > /* mes */ > boolenable_mes; > boolenable_mes_kiq; > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c > b/drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c > new file mode 100644 > index ..dcc01a339a43 > --- /dev/null > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c > @@ -0,0 +1,298 @@ > +/* SPDX-License-Identifier: MIT */ > +/* > + * Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved. > + * All Rights Reserved. > + * > + * Permission is hereby granted, free of charge, to any person obtaining a > + * copy of this software and associated documentation files (the > + * "Software"), to deal in the Software without restriction, including > + * without limitation the rights to use, copy, modify, merge, publish, > + * distribute, sub license, and/or sell copies of the Software, and to > + * permit persons to whom the Software is furnished to do so, subject to > + * the following conditions: > + * > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, > + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL > + * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY > CLAIM, > + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR > + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE > + * USE OR OTHER DEALINGS IN THE SOFTWARE. > + * > + * The above copyright notice and this permission notice (including the > + * next paragraph) shall be included in all copies or substantial portions > + * of the Software. > + * > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include "amdgpu_smu.h" > +#include "atom.h" > +#include "amdgpu_isp.h" > +#include "smu_internal.h" > +#include "smu_v11_5_ppsmc.h" > +#include "smu_v11_5_pmfw.h" > + > +#define mmDAGB0_WRCLI5_V4_10x6811C > +#define mmDAGB0_WRCLI9_V4_10x6812C > +#define mmDAGB0_WRCLI10_V4_1 0x68130 > +#define mmDAGB0_WRCLI14_V4_1 0x68140 > +#define mmDAGB0_WRCLI19_V4_1 0x68154 > +#define mmDAGB0_WRCLI20_V4_1 0x68158 > + > +static int isp_sw_init(void *handle) > +{ > + struct amdgpu_device *adev = (struct amdgpu_device *)handle; > + > + pr_info("%s called adev %p\n", __func__, adev); > + > + adev->isp.parent = adev->dev; > + > + adev->isp.cgs_device = amdgpu_cgs_create_device(adev); > + if (!adev->isp.cgs_device) > + return -EINVAL; > + > + return 0; > +} > + > +static int isp_sw_fini(void *handle) > +{ > + struct amdgpu_device *adev = (struct amdgpu_device *)handle; > + > + pr_info("%s called adev %p\n", __func__, adev); > + > + if (adev->isp.cgs_device) > + amdgpu_cgs_destroy_device(adev->isp.cgs_device); > + > + return 0; > +} > + > +/** > + * isp_hw_init - start and test isp block > + * > + * @adev: amdgpu_device pointer > + * > + */ > +static int isp_hw_init(void *handle) > +{ > + int r; > + u64 isp_base; > +
Re: [PATCH 2/3] drm/amd/amdgpu: Add ISP driver support
On 5/8/2024 09:50, Pratap Nirujogi wrote: Add the isp driver in amdgpu to support ISP device on the APUs that supports ISP IP block. ISP hw block is used for camera front-end, pre and post processing operations. Signed-off-by: Pratap Nirujogi --- drivers/gpu/drm/amd/amdgpu/Makefile | 3 + drivers/gpu/drm/amd/amdgpu/amdgpu.h | 4 + drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c | 298 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_isp.h | 54 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 3 + drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 5 + drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h | 1 + 7 files changed, 368 insertions(+) create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_isp.h diff --git a/drivers/gpu/drm/amd/amdgpu/Makefile b/drivers/gpu/drm/amd/amdgpu/Makefile index de7b76327f5b..12ba76025cb7 100644 --- a/drivers/gpu/drm/amd/amdgpu/Makefile +++ b/drivers/gpu/drm/amd/amdgpu/Makefile @@ -324,4 +324,7 @@ amdgpu-y += $(AMD_DISPLAY_FILES) endif +# add isp block +amdgpu-y += amdgpu_isp.o + obj-$(CONFIG_DRM_AMDGPU)+= amdgpu.o diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index eb60d28a3a13..6d7f9ef53269 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h @@ -112,6 +112,7 @@ #include "amdgpu_xcp.h" #include "amdgpu_seq64.h" #include "amdgpu_reg_state.h" +#include "amdgpu_isp.h" #define MAX_GPU_INSTANCE 64 @@ -1045,6 +1046,9 @@ struct amdgpu_device { /* display related functionality */ struct amdgpu_display_manager dm; + /* isp */ + struct amdgpu_isp isp; + /* mes */ boolenable_mes; boolenable_mes_kiq; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c new file mode 100644 index ..dcc01a339a43 --- /dev/null +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c @@ -0,0 +1,298 @@ +/* SPDX-License-Identifier: MIT */ +/* + * Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "amdgpu_smu.h" +#include "atom.h" +#include "amdgpu_isp.h" +#include "smu_internal.h" +#include "smu_v11_5_ppsmc.h" +#include "smu_v11_5_pmfw.h" + +#define mmDAGB0_WRCLI5_V4_10x6811C +#define mmDAGB0_WRCLI9_V4_10x6812C +#define mmDAGB0_WRCLI10_V4_1 0x68130 +#define mmDAGB0_WRCLI14_V4_1 0x68140 +#define mmDAGB0_WRCLI19_V4_1 0x68154 +#define mmDAGB0_WRCLI20_V4_1 0x68158 + +static int isp_sw_init(void *handle) +{ + struct amdgpu_device *adev = (struct amdgpu_device *)handle; + + pr_info("%s called adev %p\n", __func__, adev); This and other pr_info() statements are too noisy. I guess they were bringup code that should be torn out now. + + adev->isp.parent = adev->dev; + + adev->isp.cgs_device = amdgpu_cgs_create_device(adev); + if (!adev->isp.cgs_device) + return -EINVAL; + + return 0; +} + +static int isp_sw_fini(void *handle) +{ + struct amdgpu_device *adev = (struct amdgpu_device *)handle; + + pr_info("%s called adev %p\n", __func__, adev); + + if (adev->isp.cgs_device) + amdgpu_cgs_destroy_device(adev->isp.cgs_device); + + return 0; +} + +/** + * isp_hw_init - start and test isp block + * + * @adev: amdgpu_device pointer Wrong argument for the function. + * + */ +static int isp_hw_init(void *handle) +{ + int r; + u64 isp_base; + struct amdgpu_device *adev = (struct amdgpu_device *)handle; + + const struct amdgpu_ip_block *ip_block = +
[PATCH 2/3] drm/amd/amdgpu: Add ISP driver support
Add the isp driver in amdgpu to support ISP device on the APUs that supports ISP IP block. ISP hw block is used for camera front-end, pre and post processing operations. Signed-off-by: Pratap Nirujogi --- drivers/gpu/drm/amd/amdgpu/Makefile | 3 + drivers/gpu/drm/amd/amdgpu/amdgpu.h | 4 + drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c | 298 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_isp.h | 54 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 3 + drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 5 + drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h | 1 + 7 files changed, 368 insertions(+) create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_isp.h diff --git a/drivers/gpu/drm/amd/amdgpu/Makefile b/drivers/gpu/drm/amd/amdgpu/Makefile index de7b76327f5b..12ba76025cb7 100644 --- a/drivers/gpu/drm/amd/amdgpu/Makefile +++ b/drivers/gpu/drm/amd/amdgpu/Makefile @@ -324,4 +324,7 @@ amdgpu-y += $(AMD_DISPLAY_FILES) endif +# add isp block +amdgpu-y += amdgpu_isp.o + obj-$(CONFIG_DRM_AMDGPU)+= amdgpu.o diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index eb60d28a3a13..6d7f9ef53269 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h @@ -112,6 +112,7 @@ #include "amdgpu_xcp.h" #include "amdgpu_seq64.h" #include "amdgpu_reg_state.h" +#include "amdgpu_isp.h" #define MAX_GPU_INSTANCE 64 @@ -1045,6 +1046,9 @@ struct amdgpu_device { /* display related functionality */ struct amdgpu_display_manager dm; + /* isp */ + struct amdgpu_isp isp; + /* mes */ boolenable_mes; boolenable_mes_kiq; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c new file mode 100644 index ..dcc01a339a43 --- /dev/null +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_isp.c @@ -0,0 +1,298 @@ +/* SPDX-License-Identifier: MIT */ +/* + * Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "amdgpu_smu.h" +#include "atom.h" +#include "amdgpu_isp.h" +#include "smu_internal.h" +#include "smu_v11_5_ppsmc.h" +#include "smu_v11_5_pmfw.h" + +#define mmDAGB0_WRCLI5_V4_10x6811C +#define mmDAGB0_WRCLI9_V4_10x6812C +#define mmDAGB0_WRCLI10_V4_1 0x68130 +#define mmDAGB0_WRCLI14_V4_1 0x68140 +#define mmDAGB0_WRCLI19_V4_1 0x68154 +#define mmDAGB0_WRCLI20_V4_1 0x68158 + +static int isp_sw_init(void *handle) +{ + struct amdgpu_device *adev = (struct amdgpu_device *)handle; + + pr_info("%s called adev %p\n", __func__, adev); + + adev->isp.parent = adev->dev; + + adev->isp.cgs_device = amdgpu_cgs_create_device(adev); + if (!adev->isp.cgs_device) + return -EINVAL; + + return 0; +} + +static int isp_sw_fini(void *handle) +{ + struct amdgpu_device *adev = (struct amdgpu_device *)handle; + + pr_info("%s called adev %p\n", __func__, adev); + + if (adev->isp.cgs_device) + amdgpu_cgs_destroy_device(adev->isp.cgs_device); + + return 0; +} + +/** + * isp_hw_init - start and test isp block + * + * @adev: amdgpu_device pointer + * + */ +static int isp_hw_init(void *handle) +{ + int r; + u64 isp_base; + struct amdgpu_device *adev = (struct amdgpu_device *)handle; + + const struct amdgpu_ip_block *ip_block = + amdgpu_device_ip_get_ip_block(adev, AMD_IP_BLOCK_TYPE_ISP); + + if (!ip_block) + return -EINVAL; + + if (adev->rmmio_size == 0 || adev->rmmio_size < 0x5289) + return