linux/drivers/gpu/drm/amd/display/dc/gpio/gpio_service.h
Chiawen Huang ac627caf6b drm/amd/display: add gpio lock/unlock
[Why]
When querying HPD via GPIO flow,
it will create a new gpio object then free in the end of query.
There is a irql issue for HPD querying at ISR level.

[How]
Therefore, creating the HPD gpio object in dc_link and set it as unlcok in default.
1. reducing unnecessary malloc/free when HPD querying.
2. reducing init GPIO flow.
3. add lock/unlock to prevent multi gpio service running.

Signed-off-by: Chiawen Huang <chiawen.huang@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2019-02-05 21:16:23 -05:00

66 lines
1.9 KiB
C

/*
* Copyright 2012-15 Advanced Micro Devices, Inc.
*
* 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, sublicense,
* 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 above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* 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 NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) 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.
*
* Authors: AMD
*
*/
#ifndef __DAL_GPIO_SERVICE_H__
#define __DAL_GPIO_SERVICE_H__
struct hw_translate;
struct hw_factory;
struct gpio_service {
struct dc_context *ctx;
struct hw_translate translate;
struct hw_factory factory;
/*
* @brief
* Business storage.
* one byte For each member of 'enum gpio_id'
*/
char *busyness[GPIO_ID_COUNT];
};
enum gpio_result dal_gpio_service_open(
struct gpio_service *service,
enum gpio_id id,
uint32_t en,
enum gpio_mode mode,
struct hw_gpio_pin **ptr);
void dal_gpio_service_close(
struct gpio_service *service,
struct hw_gpio_pin **ptr);
enum gpio_result dal_gpio_service_lock(
struct gpio_service *service,
enum gpio_id id,
uint32_t en);
enum gpio_result dal_gpio_service_unlock(
struct gpio_service *service,
enum gpio_id id,
uint32_t en);
#endif